@reactoo/watchtogether-sdk-js 2.5.65 → 2.5.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @reactoo/watchtogether-sdk-js
|
|
3
|
-
* @version 2.5.
|
|
3
|
+
* @version 2.5.66
|
|
4
4
|
*/
|
|
5
5
|
!function webpackUniversalModuleDefinition(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define("WatchTogetherSDK",[],i):"object"==typeof exports?exports.WatchTogetherSDK=i():t.WatchTogetherSDK=i()}("undefined"!=typeof self?self:this,(function(){return function(t){var i={};function __webpack_require__(o){if(i[o])return i[o].exports;var a=i[o]={i:o,l:!1,exports:{}};return t[o].call(a.exports,a,a.exports,__webpack_require__),a.l=!0,a.exports}return __webpack_require__.m=t,__webpack_require__.c=i,__webpack_require__.d=function(t,i,o){__webpack_require__.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:o})},__webpack_require__.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},__webpack_require__.t=function(t,i){if(1&i&&(t=__webpack_require__(t)),8&i)return t;if(4&i&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(__webpack_require__.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var a in t)__webpack_require__.d(o,a,function(i){return t[i]}.bind(null,a));return o},__webpack_require__.n=function(t){var i=t&&t.__esModule?function getDefault(){return t.default}:function getModuleExports(){return t};return __webpack_require__.d(i,"a",i),i},__webpack_require__.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=774)}([function(t,i,o){t.exports=o(548)},function(t,i){"function"==typeof Object.create?t.exports=function inherits(t,i){i&&(t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function inherits(t,i){if(i){t.super_=i;var TempCtor=function(){};TempCtor.prototype=i.prototype,t.prototype=new TempCtor,t.prototype.constructor=t}}},function(t,i,o){"use strict";var a=o(12),u=o(103),c=o(9),h=o(14),l=o(64).f,d=o(200),p=o(15),m=o(66),g=o(45),v=o(21),wrapConstructor=function(t){var Wrapper=function(i,o,a){if(this instanceof Wrapper){switch(arguments.length){case 0:return new t;case 1:return new t(i);case 2:return new t(i,o)}return new t(i,o,a)}return u(t,this,arguments)};return Wrapper.prototype=t.prototype,Wrapper};t.exports=function(t,i){var o,u,b,w,_,M,k,B,P=t.target,x=t.global,I=t.stat,N=t.proto,A=x?a:I?a[P]:(a[P]||{}).prototype,C=x?p:p[P]||g(p,P,{})[P],O=C.prototype;for(b in i)o=!d(x?b:P+(I?".":"#")+b,t.forced)&&A&&v(A,b),_=C[b],o&&(M=t.dontCallGetSet?(B=l(A,b))&&B.value:A[b]),w=o&&M?M:i[b],o&&typeof _==typeof w||(k=t.bind&&o?m(w,a):t.wrap&&o?wrapConstructor(w):N&&h(w)?c(w):w,(t.sham||w&&w.sham||_&&_.sham)&&g(k,"sham",!0),g(C,b,k),N&&(v(p,u=P+"Prototype")||g(p,u,{}),g(p[u],b,w),t.real&&O&&!O[b]&&g(O,b,w)))}},function(t,i,o){t.exports=o(197)},function(t,i,o){var a=o(10),u=a.Buffer;function copyProps(t,i){for(var o in t)i[o]=t[o]}function SafeBuffer(t,i,o){return u(t,i,o)}u.from&&u.alloc&&u.allocUnsafe&&u.allocUnsafeSlow?t.exports=a:(copyProps(a,i),i.Buffer=SafeBuffer),copyProps(u,SafeBuffer),SafeBuffer.from=function(t,i,o){if("number"==typeof t)throw new TypeError("Argument must not be a number");return u(t,i,o)},SafeBuffer.alloc=function(t,i,o){if("number"!=typeof t)throw new TypeError("Argument must be a number");var a=u(t);return void 0!==i?"string"==typeof o?a.fill(i,o):a.fill(i):a.fill(0),a},SafeBuffer.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return u(t)},SafeBuffer.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return a.SlowBuffer(t)}},function(t,i,o){t.exports=o(544)},function(t,i,o){var a=o(196),u=o(204),c=o(350),h=o(357),l=o(214),d=o(375),p=o(382),m=o(119),g=o(395);function ownKeys(t,i){var o=a(t);if(u){var l=u(t);i&&(l=c(l).call(l,(function(i){return h(t,i).enumerable}))),o.push.apply(o,l)}return o}t.exports=function _objectSpread2(t){for(var i=1;i<arguments.length;i++){var o,a,u=null!=arguments[i]?arguments[i]:{};i%2?l(o=ownKeys(Object(u),!0)).call(o,(function(i){g(t,i,u[i])})):d?p(t,d(u)):l(a=ownKeys(Object(u))).call(a,(function(i){m(t,i,h(u,i))}))}return t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i,o){var a=o(94),u=o(464);function _typeof(i){return t.exports=_typeof="function"==typeof a&&"symbol"==typeof u?function(t){return typeof t}:function(t){return t&&"function"==typeof a&&t.constructor===a&&t!==a.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,_typeof(i)}t.exports=_typeof,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,i,o){var a=o(104),u=Function.prototype,c=u.bind,h=u.call,l=a&&c.bind(h,h);t.exports=a?function(t){return t&&l(t)}:function(t){return t&&function(){return h.apply(t,arguments)}}},function(t,i,o){"use strict";(function(t){var a=o(328),u=o(329),c=o(136);function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(t,i){if(kMaxLength()<i)throw new RangeError("Invalid typed array length");return Buffer.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(i)).__proto__=Buffer.prototype:(null===t&&(t=new Buffer(i)),t.length=i),t}function Buffer(t,i,o){if(!(Buffer.TYPED_ARRAY_SUPPORT||this instanceof Buffer))return new Buffer(t,i,o);if("number"==typeof t){if("string"==typeof i)throw new Error("If encoding is specified then the first argument must be a string");return allocUnsafe(this,t)}return from(this,t,i,o)}function from(t,i,o,a){if("number"==typeof i)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&i instanceof ArrayBuffer?function fromArrayBuffer(t,i,o,a){if(i.byteLength,o<0||i.byteLength<o)throw new RangeError("'offset' is out of bounds");if(i.byteLength<o+(a||0))throw new RangeError("'length' is out of bounds");i=void 0===o&&void 0===a?new Uint8Array(i):void 0===a?new Uint8Array(i,o):new Uint8Array(i,o,a);Buffer.TYPED_ARRAY_SUPPORT?(t=i).__proto__=Buffer.prototype:t=fromArrayLike(t,i);return t}(t,i,o,a):"string"==typeof i?function fromString(t,i,o){"string"==typeof o&&""!==o||(o="utf8");if(!Buffer.isEncoding(o))throw new TypeError('"encoding" must be a valid string encoding');var a=0|byteLength(i,o),u=(t=createBuffer(t,a)).write(i,o);u!==a&&(t=t.slice(0,u));return t}(t,i,o):function fromObject(t,i){if(Buffer.isBuffer(i)){var o=0|checked(i.length);return 0===(t=createBuffer(t,o)).length||i.copy(t,0,0,o),t}if(i){if("undefined"!=typeof ArrayBuffer&&i.buffer instanceof ArrayBuffer||"length"in i)return"number"!=typeof i.length||function isnan(t){return t!=t}(i.length)?createBuffer(t,0):fromArrayLike(t,i);if("Buffer"===i.type&&c(i.data))return fromArrayLike(t,i.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,i)}function assertSize(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function allocUnsafe(t,i){if(assertSize(i),t=createBuffer(t,i<0?0:0|checked(i)),!Buffer.TYPED_ARRAY_SUPPORT)for(var o=0;o<i;++o)t[o]=0;return t}function fromArrayLike(t,i){var o=i.length<0?0:0|checked(i.length);t=createBuffer(t,o);for(var a=0;a<o;a+=1)t[a]=255&i[a];return t}function checked(t){if(t>=kMaxLength())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kMaxLength().toString(16)+" bytes");return 0|t}function byteLength(t,i){if(Buffer.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var o=t.length;if(0===o)return 0;for(var a=!1;;)switch(i){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":case void 0:return utf8ToBytes(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*o;case"hex":return o>>>1;case"base64":return base64ToBytes(t).length;default:if(a)return utf8ToBytes(t).length;i=(""+i).toLowerCase(),a=!0}}function slowToString(t,i,o){var a=!1;if((void 0===i||i<0)&&(i=0),i>this.length)return"";if((void 0===o||o>this.length)&&(o=this.length),o<=0)return"";if((o>>>=0)<=(i>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return hexSlice(this,i,o);case"utf8":case"utf-8":return utf8Slice(this,i,o);case"ascii":return asciiSlice(this,i,o);case"latin1":case"binary":return latin1Slice(this,i,o);case"base64":return base64Slice(this,i,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,i,o);default:if(a)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),a=!0}}function swap(t,i,o){var a=t[i];t[i]=t[o],t[o]=a}function bidirectionalIndexOf(t,i,o,a,u){if(0===t.length)return-1;if("string"==typeof o?(a=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,isNaN(o)&&(o=u?0:t.length-1),o<0&&(o=t.length+o),o>=t.length){if(u)return-1;o=t.length-1}else if(o<0){if(!u)return-1;o=0}if("string"==typeof i&&(i=Buffer.from(i,a)),Buffer.isBuffer(i))return 0===i.length?-1:arrayIndexOf(t,i,o,a,u);if("number"==typeof i)return i&=255,Buffer.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?u?Uint8Array.prototype.indexOf.call(t,i,o):Uint8Array.prototype.lastIndexOf.call(t,i,o):arrayIndexOf(t,[i],o,a,u);throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(t,i,o,a,u){var c,h=1,l=t.length,d=i.length;if(void 0!==a&&("ucs2"===(a=String(a).toLowerCase())||"ucs-2"===a||"utf16le"===a||"utf-16le"===a)){if(t.length<2||i.length<2)return-1;h=2,l/=2,d/=2,o/=2}function read(t,i){return 1===h?t[i]:t.readUInt16BE(i*h)}if(u){var p=-1;for(c=o;c<l;c++)if(read(t,c)===read(i,-1===p?0:c-p)){if(-1===p&&(p=c),c-p+1===d)return p*h}else-1!==p&&(c-=c-p),p=-1}else for(o+d>l&&(o=l-d),c=o;c>=0;c--){for(var m=!0,g=0;g<d;g++)if(read(t,c+g)!==read(i,g)){m=!1;break}if(m)return c}return-1}function hexWrite(t,i,o,a){o=Number(o)||0;var u=t.length-o;a?(a=Number(a))>u&&(a=u):a=u;var c=i.length;if(c%2!=0)throw new TypeError("Invalid hex string");a>c/2&&(a=c/2);for(var h=0;h<a;++h){var l=parseInt(i.substr(2*h,2),16);if(isNaN(l))return h;t[o+h]=l}return h}function utf8Write(t,i,o,a){return blitBuffer(utf8ToBytes(i,t.length-o),t,o,a)}function asciiWrite(t,i,o,a){return blitBuffer(function asciiToBytes(t){for(var i=[],o=0;o<t.length;++o)i.push(255&t.charCodeAt(o));return i}(i),t,o,a)}function latin1Write(t,i,o,a){return asciiWrite(t,i,o,a)}function base64Write(t,i,o,a){return blitBuffer(base64ToBytes(i),t,o,a)}function ucs2Write(t,i,o,a){return blitBuffer(function utf16leToBytes(t,i){for(var o,a,u,c=[],h=0;h<t.length&&!((i-=2)<0);++h)o=t.charCodeAt(h),a=o>>8,u=o%256,c.push(u),c.push(a);return c}(i,t.length-o),t,o,a)}function base64Slice(t,i,o){return 0===i&&o===t.length?a.fromByteArray(t):a.fromByteArray(t.slice(i,o))}function utf8Slice(t,i,o){o=Math.min(t.length,o);for(var a=[],u=i;u<o;){var c,h,l,d,p=t[u],m=null,g=p>239?4:p>223?3:p>191?2:1;if(u+g<=o)switch(g){case 1:p<128&&(m=p);break;case 2:128==(192&(c=t[u+1]))&&(d=(31&p)<<6|63&c)>127&&(m=d);break;case 3:c=t[u+1],h=t[u+2],128==(192&c)&&128==(192&h)&&(d=(15&p)<<12|(63&c)<<6|63&h)>2047&&(d<55296||d>57343)&&(m=d);break;case 4:c=t[u+1],h=t[u+2],l=t[u+3],128==(192&c)&&128==(192&h)&&128==(192&l)&&(d=(15&p)<<18|(63&c)<<12|(63&h)<<6|63&l)>65535&&d<1114112&&(m=d)}null===m?(m=65533,g=1):m>65535&&(m-=65536,a.push(m>>>10&1023|55296),m=56320|1023&m),a.push(m),u+=g}return function decodeCodePointsArray(t){var i=t.length;if(i<=4096)return String.fromCharCode.apply(String,t);var o="",a=0;for(;a<i;)o+=String.fromCharCode.apply(String,t.slice(a,a+=4096));return o}(a)}i.Buffer=Buffer,i.SlowBuffer=function SlowBuffer(t){+t!=t&&(t=0);return Buffer.alloc(+t)},i.INSPECT_MAX_BYTES=50,Buffer.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function typedArraySupport(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),i.kMaxLength=kMaxLength(),Buffer.poolSize=8192,Buffer._augment=function(t){return t.__proto__=Buffer.prototype,t},Buffer.from=function(t,i,o){return from(null,t,i,o)},Buffer.TYPED_ARRAY_SUPPORT&&(Buffer.prototype.__proto__=Uint8Array.prototype,Buffer.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Buffer[Symbol.species]===Buffer&&Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:!0})),Buffer.alloc=function(t,i,o){return function alloc(t,i,o,a){return assertSize(i),i<=0?createBuffer(t,i):void 0!==o?"string"==typeof a?createBuffer(t,i).fill(o,a):createBuffer(t,i).fill(o):createBuffer(t,i)}(null,t,i,o)},Buffer.allocUnsafe=function(t){return allocUnsafe(null,t)},Buffer.allocUnsafeSlow=function(t){return allocUnsafe(null,t)},Buffer.isBuffer=function isBuffer(t){return!(null==t||!t._isBuffer)},Buffer.compare=function compare(t,i){if(!Buffer.isBuffer(t)||!Buffer.isBuffer(i))throw new TypeError("Arguments must be Buffers");if(t===i)return 0;for(var o=t.length,a=i.length,u=0,c=Math.min(o,a);u<c;++u)if(t[u]!==i[u]){o=t[u],a=i[u];break}return o<a?-1:a<o?1:0},Buffer.isEncoding=function isEncoding(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Buffer.concat=function concat(t,i){if(!c(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return Buffer.alloc(0);var o;if(void 0===i)for(i=0,o=0;o<t.length;++o)i+=t[o].length;var a=Buffer.allocUnsafe(i),u=0;for(o=0;o<t.length;++o){var h=t[o];if(!Buffer.isBuffer(h))throw new TypeError('"list" argument must be an Array of Buffers');h.copy(a,u),u+=h.length}return a},Buffer.byteLength=byteLength,Buffer.prototype._isBuffer=!0,Buffer.prototype.swap16=function swap16(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var i=0;i<t;i+=2)swap(this,i,i+1);return this},Buffer.prototype.swap32=function swap32(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var i=0;i<t;i+=4)swap(this,i,i+3),swap(this,i+1,i+2);return this},Buffer.prototype.swap64=function swap64(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var i=0;i<t;i+=8)swap(this,i,i+7),swap(this,i+1,i+6),swap(this,i+2,i+5),swap(this,i+3,i+4);return this},Buffer.prototype.toString=function toString(){var t=0|this.length;return 0===t?"":0===arguments.length?utf8Slice(this,0,t):slowToString.apply(this,arguments)},Buffer.prototype.equals=function equals(t){if(!Buffer.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===Buffer.compare(this,t)},Buffer.prototype.inspect=function inspect(){var t="",o=i.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,o).match(/.{2}/g).join(" "),this.length>o&&(t+=" ... ")),"<Buffer "+t+">"},Buffer.prototype.compare=function compare(t,i,o,a,u){if(!Buffer.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===i&&(i=0),void 0===o&&(o=t?t.length:0),void 0===a&&(a=0),void 0===u&&(u=this.length),i<0||o>t.length||a<0||u>this.length)throw new RangeError("out of range index");if(a>=u&&i>=o)return 0;if(a>=u)return-1;if(i>=o)return 1;if(this===t)return 0;for(var c=(u>>>=0)-(a>>>=0),h=(o>>>=0)-(i>>>=0),l=Math.min(c,h),d=this.slice(a,u),p=t.slice(i,o),m=0;m<l;++m)if(d[m]!==p[m]){c=d[m],h=p[m];break}return c<h?-1:h<c?1:0},Buffer.prototype.includes=function includes(t,i,o){return-1!==this.indexOf(t,i,o)},Buffer.prototype.indexOf=function indexOf(t,i,o){return bidirectionalIndexOf(this,t,i,o,!0)},Buffer.prototype.lastIndexOf=function lastIndexOf(t,i,o){return bidirectionalIndexOf(this,t,i,o,!1)},Buffer.prototype.write=function write(t,i,o,a){if(void 0===i)a="utf8",o=this.length,i=0;else if(void 0===o&&"string"==typeof i)a=i,o=this.length,i=0;else{if(!isFinite(i))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");i|=0,isFinite(o)?(o|=0,void 0===a&&(a="utf8")):(a=o,o=void 0)}var u=this.length-i;if((void 0===o||o>u)&&(o=u),t.length>0&&(o<0||i<0)||i>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var c=!1;;)switch(a){case"hex":return hexWrite(this,t,i,o);case"utf8":case"utf-8":return utf8Write(this,t,i,o);case"ascii":return asciiWrite(this,t,i,o);case"latin1":case"binary":return latin1Write(this,t,i,o);case"base64":return base64Write(this,t,i,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,t,i,o);default:if(c)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),c=!0}},Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function asciiSlice(t,i,o){var a="";o=Math.min(t.length,o);for(var u=i;u<o;++u)a+=String.fromCharCode(127&t[u]);return a}function latin1Slice(t,i,o){var a="";o=Math.min(t.length,o);for(var u=i;u<o;++u)a+=String.fromCharCode(t[u]);return a}function hexSlice(t,i,o){var a=t.length;(!i||i<0)&&(i=0),(!o||o<0||o>a)&&(o=a);for(var u="",c=i;c<o;++c)u+=toHex(t[c]);return u}function utf16leSlice(t,i,o){for(var a=t.slice(i,o),u="",c=0;c<a.length;c+=2)u+=String.fromCharCode(a[c]+256*a[c+1]);return u}function checkOffset(t,i,o){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+i>o)throw new RangeError("Trying to access beyond buffer length")}function checkInt(t,i,o,a,u,c){if(!Buffer.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(i>u||i<c)throw new RangeError('"value" argument is out of bounds');if(o+a>t.length)throw new RangeError("Index out of range")}function objectWriteUInt16(t,i,o,a){i<0&&(i=65535+i+1);for(var u=0,c=Math.min(t.length-o,2);u<c;++u)t[o+u]=(i&255<<8*(a?u:1-u))>>>8*(a?u:1-u)}function objectWriteUInt32(t,i,o,a){i<0&&(i=4294967295+i+1);for(var u=0,c=Math.min(t.length-o,4);u<c;++u)t[o+u]=i>>>8*(a?u:3-u)&255}function checkIEEE754(t,i,o,a,u,c){if(o+a>t.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function writeFloat(t,i,o,a,c){return c||checkIEEE754(t,0,o,4),u.write(t,i,o,a,23,4),o+4}function writeDouble(t,i,o,a,c){return c||checkIEEE754(t,0,o,8),u.write(t,i,o,a,52,8),o+8}Buffer.prototype.slice=function slice(t,i){var o,a=this.length;if((t=~~t)<0?(t+=a)<0&&(t=0):t>a&&(t=a),(i=void 0===i?a:~~i)<0?(i+=a)<0&&(i=0):i>a&&(i=a),i<t&&(i=t),Buffer.TYPED_ARRAY_SUPPORT)(o=this.subarray(t,i)).__proto__=Buffer.prototype;else{var u=i-t;o=new Buffer(u,void 0);for(var c=0;c<u;++c)o[c]=this[c+t]}return o},Buffer.prototype.readUIntLE=function readUIntLE(t,i,o){t|=0,i|=0,o||checkOffset(t,i,this.length);for(var a=this[t],u=1,c=0;++c<i&&(u*=256);)a+=this[t+c]*u;return a},Buffer.prototype.readUIntBE=function readUIntBE(t,i,o){t|=0,i|=0,o||checkOffset(t,i,this.length);for(var a=this[t+--i],u=1;i>0&&(u*=256);)a+=this[t+--i]*u;return a},Buffer.prototype.readUInt8=function readUInt8(t,i){return i||checkOffset(t,1,this.length),this[t]},Buffer.prototype.readUInt16LE=function readUInt16LE(t,i){return i||checkOffset(t,2,this.length),this[t]|this[t+1]<<8},Buffer.prototype.readUInt16BE=function readUInt16BE(t,i){return i||checkOffset(t,2,this.length),this[t]<<8|this[t+1]},Buffer.prototype.readUInt32LE=function readUInt32LE(t,i){return i||checkOffset(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Buffer.prototype.readUInt32BE=function readUInt32BE(t,i){return i||checkOffset(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Buffer.prototype.readIntLE=function readIntLE(t,i,o){t|=0,i|=0,o||checkOffset(t,i,this.length);for(var a=this[t],u=1,c=0;++c<i&&(u*=256);)a+=this[t+c]*u;return a>=(u*=128)&&(a-=Math.pow(2,8*i)),a},Buffer.prototype.readIntBE=function readIntBE(t,i,o){t|=0,i|=0,o||checkOffset(t,i,this.length);for(var a=i,u=1,c=this[t+--a];a>0&&(u*=256);)c+=this[t+--a]*u;return c>=(u*=128)&&(c-=Math.pow(2,8*i)),c},Buffer.prototype.readInt8=function readInt8(t,i){return i||checkOffset(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Buffer.prototype.readInt16LE=function readInt16LE(t,i){i||checkOffset(t,2,this.length);var o=this[t]|this[t+1]<<8;return 32768&o?4294901760|o:o},Buffer.prototype.readInt16BE=function readInt16BE(t,i){i||checkOffset(t,2,this.length);var o=this[t+1]|this[t]<<8;return 32768&o?4294901760|o:o},Buffer.prototype.readInt32LE=function readInt32LE(t,i){return i||checkOffset(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Buffer.prototype.readInt32BE=function readInt32BE(t,i){return i||checkOffset(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Buffer.prototype.readFloatLE=function readFloatLE(t,i){return i||checkOffset(t,4,this.length),u.read(this,t,!0,23,4)},Buffer.prototype.readFloatBE=function readFloatBE(t,i){return i||checkOffset(t,4,this.length),u.read(this,t,!1,23,4)},Buffer.prototype.readDoubleLE=function readDoubleLE(t,i){return i||checkOffset(t,8,this.length),u.read(this,t,!0,52,8)},Buffer.prototype.readDoubleBE=function readDoubleBE(t,i){return i||checkOffset(t,8,this.length),u.read(this,t,!1,52,8)},Buffer.prototype.writeUIntLE=function writeUIntLE(t,i,o,a){(t=+t,i|=0,o|=0,a)||checkInt(this,t,i,o,Math.pow(2,8*o)-1,0);var u=1,c=0;for(this[i]=255&t;++c<o&&(u*=256);)this[i+c]=t/u&255;return i+o},Buffer.prototype.writeUIntBE=function writeUIntBE(t,i,o,a){(t=+t,i|=0,o|=0,a)||checkInt(this,t,i,o,Math.pow(2,8*o)-1,0);var u=o-1,c=1;for(this[i+u]=255&t;--u>=0&&(c*=256);)this[i+u]=t/c&255;return i+o},Buffer.prototype.writeUInt8=function writeUInt8(t,i,o){return t=+t,i|=0,o||checkInt(this,t,i,1,255,0),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[i]=255&t,i+1},Buffer.prototype.writeUInt16LE=function writeUInt16LE(t,i,o){return t=+t,i|=0,o||checkInt(this,t,i,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[i]=255&t,this[i+1]=t>>>8):objectWriteUInt16(this,t,i,!0),i+2},Buffer.prototype.writeUInt16BE=function writeUInt16BE(t,i,o){return t=+t,i|=0,o||checkInt(this,t,i,2,65535,0),Buffer.TYPED_ARRAY_SUPPORT?(this[i]=t>>>8,this[i+1]=255&t):objectWriteUInt16(this,t,i,!1),i+2},Buffer.prototype.writeUInt32LE=function writeUInt32LE(t,i,o){return t=+t,i|=0,o||checkInt(this,t,i,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[i+3]=t>>>24,this[i+2]=t>>>16,this[i+1]=t>>>8,this[i]=255&t):objectWriteUInt32(this,t,i,!0),i+4},Buffer.prototype.writeUInt32BE=function writeUInt32BE(t,i,o){return t=+t,i|=0,o||checkInt(this,t,i,4,4294967295,0),Buffer.TYPED_ARRAY_SUPPORT?(this[i]=t>>>24,this[i+1]=t>>>16,this[i+2]=t>>>8,this[i+3]=255&t):objectWriteUInt32(this,t,i,!1),i+4},Buffer.prototype.writeIntLE=function writeIntLE(t,i,o,a){if(t=+t,i|=0,!a){var u=Math.pow(2,8*o-1);checkInt(this,t,i,o,u-1,-u)}var c=0,h=1,l=0;for(this[i]=255&t;++c<o&&(h*=256);)t<0&&0===l&&0!==this[i+c-1]&&(l=1),this[i+c]=(t/h>>0)-l&255;return i+o},Buffer.prototype.writeIntBE=function writeIntBE(t,i,o,a){if(t=+t,i|=0,!a){var u=Math.pow(2,8*o-1);checkInt(this,t,i,o,u-1,-u)}var c=o-1,h=1,l=0;for(this[i+c]=255&t;--c>=0&&(h*=256);)t<0&&0===l&&0!==this[i+c+1]&&(l=1),this[i+c]=(t/h>>0)-l&255;return i+o},Buffer.prototype.writeInt8=function writeInt8(t,i,o){return t=+t,i|=0,o||checkInt(this,t,i,1,127,-128),Buffer.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[i]=255&t,i+1},Buffer.prototype.writeInt16LE=function writeInt16LE(t,i,o){return t=+t,i|=0,o||checkInt(this,t,i,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[i]=255&t,this[i+1]=t>>>8):objectWriteUInt16(this,t,i,!0),i+2},Buffer.prototype.writeInt16BE=function writeInt16BE(t,i,o){return t=+t,i|=0,o||checkInt(this,t,i,2,32767,-32768),Buffer.TYPED_ARRAY_SUPPORT?(this[i]=t>>>8,this[i+1]=255&t):objectWriteUInt16(this,t,i,!1),i+2},Buffer.prototype.writeInt32LE=function writeInt32LE(t,i,o){return t=+t,i|=0,o||checkInt(this,t,i,4,2147483647,-2147483648),Buffer.TYPED_ARRAY_SUPPORT?(this[i]=255&t,this[i+1]=t>>>8,this[i+2]=t>>>16,this[i+3]=t>>>24):objectWriteUInt32(this,t,i,!0),i+4},Buffer.prototype.writeInt32BE=function writeInt32BE(t,i,o){return t=+t,i|=0,o||checkInt(this,t,i,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Buffer.TYPED_ARRAY_SUPPORT?(this[i]=t>>>24,this[i+1]=t>>>16,this[i+2]=t>>>8,this[i+3]=255&t):objectWriteUInt32(this,t,i,!1),i+4},Buffer.prototype.writeFloatLE=function writeFloatLE(t,i,o){return writeFloat(this,t,i,!0,o)},Buffer.prototype.writeFloatBE=function writeFloatBE(t,i,o){return writeFloat(this,t,i,!1,o)},Buffer.prototype.writeDoubleLE=function writeDoubleLE(t,i,o){return writeDouble(this,t,i,!0,o)},Buffer.prototype.writeDoubleBE=function writeDoubleBE(t,i,o){return writeDouble(this,t,i,!1,o)},Buffer.prototype.copy=function copy(t,i,o,a){if(o||(o=0),a||0===a||(a=this.length),i>=t.length&&(i=t.length),i||(i=0),a>0&&a<o&&(a=o),a===o)return 0;if(0===t.length||0===this.length)return 0;if(i<0)throw new RangeError("targetStart out of bounds");if(o<0||o>=this.length)throw new RangeError("sourceStart out of bounds");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),t.length-i<a-o&&(a=t.length-i+o);var u,c=a-o;if(this===t&&o<i&&i<a)for(u=c-1;u>=0;--u)t[u+i]=this[u+o];else if(c<1e3||!Buffer.TYPED_ARRAY_SUPPORT)for(u=0;u<c;++u)t[u+i]=this[u+o];else Uint8Array.prototype.set.call(t,this.subarray(o,o+c),i);return c},Buffer.prototype.fill=function fill(t,i,o,a){if("string"==typeof t){if("string"==typeof i?(a=i,i=0,o=this.length):"string"==typeof o&&(a=o,o=this.length),1===t.length){var u=t.charCodeAt(0);u<256&&(t=u)}if(void 0!==a&&"string"!=typeof a)throw new TypeError("encoding must be a string");if("string"==typeof a&&!Buffer.isEncoding(a))throw new TypeError("Unknown encoding: "+a)}else"number"==typeof t&&(t&=255);if(i<0||this.length<i||this.length<o)throw new RangeError("Out of range index");if(o<=i)return this;var c;if(i>>>=0,o=void 0===o?this.length:o>>>0,t||(t=0),"number"==typeof t)for(c=i;c<o;++c)this[c]=t;else{var h=Buffer.isBuffer(t)?t:utf8ToBytes(new Buffer(t,a).toString()),l=h.length;for(c=0;c<o-i;++c)this[c+i]=h[c%l]}return this};var h=/[^+\/0-9A-Za-z-_]/g;function toHex(t){return t<16?"0"+t.toString(16):t.toString(16)}function utf8ToBytes(t,i){var o;i=i||1/0;for(var a=t.length,u=null,c=[],h=0;h<a;++h){if((o=t.charCodeAt(h))>55295&&o<57344){if(!u){if(o>56319){(i-=3)>-1&&c.push(239,191,189);continue}if(h+1===a){(i-=3)>-1&&c.push(239,191,189);continue}u=o;continue}if(o<56320){(i-=3)>-1&&c.push(239,191,189),u=o;continue}o=65536+(u-55296<<10|o-56320)}else u&&(i-=3)>-1&&c.push(239,191,189);if(u=null,o<128){if((i-=1)<0)break;c.push(o)}else if(o<2048){if((i-=2)<0)break;c.push(o>>6|192,63&o|128)}else if(o<65536){if((i-=3)<0)break;c.push(o>>12|224,o>>6&63|128,63&o|128)}else{if(!(o<1114112))throw new Error("Invalid code point");if((i-=4)<0)break;c.push(o>>18|240,o>>12&63|128,o>>6&63|128,63&o|128)}}return c}function base64ToBytes(t){return a.toByteArray(function base64clean(t){if((t=function stringtrim(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(h,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function blitBuffer(t,i,o,a){for(var u=0;u<a&&!(u+o>=i.length||u>=t.length);++u)i[u+o]=t[u];return u}}).call(this,o(17))},function(t,i){var o,a,u=t.exports={};function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}function runTimeout(t){if(o===setTimeout)return setTimeout(t,0);if((o===defaultSetTimout||!o)&&setTimeout)return o=setTimeout,setTimeout(t,0);try{return o(t,0)}catch(i){try{return o.call(null,t,0)}catch(i){return o.call(this,t,0)}}}!function(){try{o="function"==typeof setTimeout?setTimeout:defaultSetTimout}catch(t){o=defaultSetTimout}try{a="function"==typeof clearTimeout?clearTimeout:defaultClearTimeout}catch(t){a=defaultClearTimeout}}();var c,h=[],l=!1,d=-1;function cleanUpNextTick(){l&&c&&(l=!1,c.length?h=c.concat(h):d=-1,h.length&&drainQueue())}function drainQueue(){if(!l){var t=runTimeout(cleanUpNextTick);l=!0;for(var i=h.length;i;){for(c=h,h=[];++d<i;)c&&c[d].run();d=-1,i=h.length}c=null,l=!1,function runClearTimeout(t){if(a===clearTimeout)return clearTimeout(t);if((a===defaultClearTimeout||!a)&&clearTimeout)return a=clearTimeout,clearTimeout(t);try{return a(t)}catch(i){try{return a.call(null,t)}catch(i){return a.call(this,t)}}}(t)}}function Item(t,i){this.fun=t,this.array=i}function noop(){}u.nextTick=function(t){var i=new Array(arguments.length-1);if(arguments.length>1)for(var o=1;o<arguments.length;o++)i[o-1]=arguments[o];h.push(new Item(t,i)),1!==h.length||l||runTimeout(drainQueue)},Item.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=noop,u.addListener=noop,u.once=noop,u.off=noop,u.removeListener=noop,u.removeAllListeners=noop,u.emit=noop,u.prependListener=noop,u.prependOnceListener=noop,u.listeners=function(t){return[]},u.binding=function(t){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(t){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},function(t,i,o){(function(i){var check=function(t){return t&&t.Math==Math&&t};t.exports=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof i&&i)||function(){return this}()||Function("return this")()}).call(this,o(17))},function(t,i,o){var a=o(12),u=o(90),c=o(21),h=o(110),l=o(75),d=o(198),p=u("wks"),m=a.Symbol,g=m&&m.for,v=d?m:m&&m.withoutSetter||h;t.exports=function(t){if(!c(p,t)||!l&&"string"!=typeof p[t]){var i="Symbol."+t;l&&c(m,t)?p[t]=m[t]:p[t]=d&&g?g(i):v(i)}return p[t]}},function(t,i){t.exports=function(t){return"function"==typeof t}},function(t,i){t.exports={}},function(t,i,o){var a=o(15),u=o(21),c=o(145),h=o(34).f;t.exports=function(t){var i=a.Symbol||(a.Symbol={});u(i,t)||h(i,t,{value:c.f(t)})}},function(t,i){var o;o=function(){return this}();try{o=o||new Function("return this")()}catch(t){"object"==typeof window&&(o=window)}t.exports=o},function(t,i,o){var a=o(8);t.exports=!a((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},function(t,i,o){var a=o(104),u=Function.prototype.call;t.exports=a?u.bind(u):function(){return u.apply(u,arguments)}},function(t,i,o){var a=o(14);t.exports=function(t){return"object"==typeof t?null!==t:a(t)}},function(t,i,o){var a=o(9),u=o(40),c=a({}.hasOwnProperty);t.exports=Object.hasOwn||function hasOwn(t,i){return c(u(t),i)}},function(t,i,o){t.exports=o(227)},function(t,i,o){t.exports=o(396)},function(t,i,o){t.exports=o(213)},function(t,i,o){var a=o(9);t.exports=a({}.isPrototypeOf)},function(t,i,o){var a=o(470),u=o(471),c=o(152),h=o(472);t.exports=function _slicedToArray(t,i){return a(t)||u(t,i)||c(t,i)||h()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i,o){var a=o(15),u=o(12),c=o(14),aFunction=function(t){return c(t)?t:void 0};t.exports=function(t,i){return arguments.length<2?aFunction(a[t])||aFunction(u[t]):a[t]&&a[t][i]||u[t]&&u[t][i]}},function(t,i,o){var a=o(20),u=String,c=TypeError;t.exports=function(t){if(a(t))return t;throw c(u(t)+" is not an object")}},function(t,i,o){var a=o(503)();t.exports=a;try{regeneratorRuntime=a}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=a:Function("r","regeneratorRuntime = r")(a)}},function(t,i,o){var a=o(15);t.exports=function(t){return a[t+"Prototype"]}},function(t,i,o){"use strict";var a,u="object"==typeof Reflect?Reflect:null,c=u&&"function"==typeof u.apply?u.apply:function ReflectApply(t,i,o){return Function.prototype.apply.call(t,i,o)};a=u&&"function"==typeof u.ownKeys?u.ownKeys:Object.getOwnPropertySymbols?function ReflectOwnKeys(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function ReflectOwnKeys(t){return Object.getOwnPropertyNames(t)};var h=Number.isNaN||function NumberIsNaN(t){return t!=t};function EventEmitter(){EventEmitter.init.call(this)}t.exports=EventEmitter,t.exports.once=function once(t,i){return new Promise((function(o,a){function errorListener(o){t.removeListener(i,resolver),a(o)}function resolver(){"function"==typeof t.removeListener&&t.removeListener("error",errorListener),o([].slice.call(arguments))}eventTargetAgnosticAddListener(t,i,resolver,{once:!0}),"error"!==i&&function addErrorHandlerIfEventEmitter(t,i,o){"function"==typeof t.on&&eventTargetAgnosticAddListener(t,"error",i,o)}(t,errorListener,{once:!0})}))},EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._eventsCount=0,EventEmitter.prototype._maxListeners=void 0;var l=10;function checkListener(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function _getMaxListeners(t){return void 0===t._maxListeners?EventEmitter.defaultMaxListeners:t._maxListeners}function _addListener(t,i,o,a){var u,c,h;if(checkListener(o),void 0===(c=t._events)?(c=t._events=Object.create(null),t._eventsCount=0):(void 0!==c.newListener&&(t.emit("newListener",i,o.listener?o.listener:o),c=t._events),h=c[i]),void 0===h)h=c[i]=o,++t._eventsCount;else if("function"==typeof h?h=c[i]=a?[o,h]:[h,o]:a?h.unshift(o):h.push(o),(u=_getMaxListeners(t))>0&&h.length>u&&!h.warned){h.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+h.length+" "+String(i)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=i,l.count=h.length,function ProcessEmitWarning(t){console&&console.warn&&console.warn(t)}(l)}return t}function onceWrapper(){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 _onceWrap(t,i,o){var a={fired:!1,wrapFn:void 0,target:t,type:i,listener:o},u=onceWrapper.bind(a);return u.listener=o,a.wrapFn=u,u}function _listeners(t,i,o){var a=t._events;if(void 0===a)return[];var u=a[i];return void 0===u?[]:"function"==typeof u?o?[u.listener||u]:[u]:o?function unwrapListeners(t){for(var i=new Array(t.length),o=0;o<i.length;++o)i[o]=t[o].listener||t[o];return i}(u):arrayClone(u,u.length)}function listenerCount(t){var i=this._events;if(void 0!==i){var o=i[t];if("function"==typeof o)return 1;if(void 0!==o)return o.length}return 0}function arrayClone(t,i){for(var o=new Array(i),a=0;a<i;++a)o[a]=t[a];return o}function eventTargetAgnosticAddListener(t,i,o,a){if("function"==typeof t.on)a.once?t.once(i,o):t.on(i,o);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(i,(function wrapListener(u){a.once&&t.removeEventListener(i,wrapListener),o(u)}))}}Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(t){if("number"!=typeof t||t<0||h(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");l=t}}),EventEmitter.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},EventEmitter.prototype.setMaxListeners=function setMaxListeners(t){if("number"!=typeof t||t<0||h(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},EventEmitter.prototype.getMaxListeners=function getMaxListeners(){return _getMaxListeners(this)},EventEmitter.prototype.emit=function emit(t){for(var i=[],o=1;o<arguments.length;o++)i.push(arguments[o]);var a="error"===t,u=this._events;if(void 0!==u)a=a&&void 0===u.error;else if(!a)return!1;if(a){var h;if(i.length>0&&(h=i[0]),h instanceof Error)throw h;var l=new Error("Unhandled error."+(h?" ("+h.message+")":""));throw l.context=h,l}var d=u[t];if(void 0===d)return!1;if("function"==typeof d)c(d,this,i);else{var p=d.length,m=arrayClone(d,p);for(o=0;o<p;++o)c(m[o],this,i)}return!0},EventEmitter.prototype.addListener=function addListener(t,i){return _addListener(this,t,i,!1)},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.prependListener=function prependListener(t,i){return _addListener(this,t,i,!0)},EventEmitter.prototype.once=function once(t,i){return checkListener(i),this.on(t,_onceWrap(this,t,i)),this},EventEmitter.prototype.prependOnceListener=function prependOnceListener(t,i){return checkListener(i),this.prependListener(t,_onceWrap(this,t,i)),this},EventEmitter.prototype.removeListener=function removeListener(t,i){var o,a,u,c,h;if(checkListener(i),void 0===(a=this._events))return this;if(void 0===(o=a[t]))return this;if(o===i||o.listener===i)0==--this._eventsCount?this._events=Object.create(null):(delete a[t],a.removeListener&&this.emit("removeListener",t,o.listener||i));else if("function"!=typeof o){for(u=-1,c=o.length-1;c>=0;c--)if(o[c]===i||o[c].listener===i){h=o[c].listener,u=c;break}if(u<0)return this;0===u?o.shift():function spliceOne(t,i){for(;i+1<t.length;i++)t[i]=t[i+1];t.pop()}(o,u),1===o.length&&(a[t]=o[0]),void 0!==a.removeListener&&this.emit("removeListener",t,h||i)}return this},EventEmitter.prototype.off=EventEmitter.prototype.removeListener,EventEmitter.prototype.removeAllListeners=function removeAllListeners(t){var i,o,a;if(void 0===(o=this._events))return this;if(void 0===o.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==o[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete o[t]),this;if(0===arguments.length){var u,c=Object.keys(o);for(a=0;a<c.length;++a)"removeListener"!==(u=c[a])&&this.removeAllListeners(u);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(i=o[t]))this.removeListener(t,i);else if(void 0!==i)for(a=i.length-1;a>=0;a--)this.removeListener(t,i[a]);return this},EventEmitter.prototype.listeners=function listeners(t){return _listeners(this,t,!0)},EventEmitter.prototype.rawListeners=function rawListeners(t){return _listeners(this,t,!1)},EventEmitter.listenerCount=function(t,i){return"function"==typeof t.listenerCount?t.listenerCount(i):listenerCount.call(t,i)},EventEmitter.prototype.listenerCount=listenerCount,EventEmitter.prototype.eventNames=function eventNames(){return this._eventsCount>0?a(this._events):[]}},function(t,i,o){"use strict";var a=o(405),u=o(406);function Url(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}i.parse=urlParse,i.resolve=function urlResolve(t,i){return urlParse(t,!1,!0).resolve(i)},i.resolveObject=function urlResolveObject(t,i){return t?urlParse(t,!1,!0).resolveObject(i):i},i.format=function urlFormat(t){u.isString(t)&&(t=urlParse(t));return t instanceof Url?t.format():Url.prototype.format.call(t)},i.Url=Url;var c=/^([a-z0-9.+-]+:)/i,h=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,d=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),p=["'"].concat(d),m=["%","/","?",";","#"].concat(p),g=["/","?","#"],v=/^[+a-z0-9A-Z_-]{0,63}$/,b=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,w={javascript:!0,"javascript:":!0},_={javascript:!0,"javascript:":!0},M={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},k=o(407);function urlParse(t,i,o){if(t&&u.isObject(t)&&t instanceof Url)return t;var a=new Url;return a.parse(t,i,o),a}Url.prototype.parse=function(t,i,o){if(!u.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var h=t.indexOf("?"),d=-1!==h&&h<t.indexOf("#")?"?":"#",B=t.split(d);B[0]=B[0].replace(/\\/g,"/");var P=t=B.join(d);if(P=P.trim(),!o&&1===t.split("#").length){var x=l.exec(P);if(x)return this.path=P,this.href=P,this.pathname=x[1],x[2]?(this.search=x[2],this.query=i?k.parse(this.search.substr(1)):this.search.substr(1)):i&&(this.search="",this.query={}),this}var I=c.exec(P);if(I){var N=(I=I[0]).toLowerCase();this.protocol=N,P=P.substr(I.length)}if(o||I||P.match(/^\/\/[^@\/]+@[^@\/]+/)){var A="//"===P.substr(0,2);!A||I&&_[I]||(P=P.substr(2),this.slashes=!0)}if(!_[I]&&(A||I&&!M[I])){for(var C,O,j=-1,L=0;L<g.length;L++){-1!==(q=P.indexOf(g[L]))&&(-1===j||q<j)&&(j=q)}-1!==(O=-1===j?P.lastIndexOf("@"):P.lastIndexOf("@",j))&&(C=P.slice(0,O),P=P.slice(O+1),this.auth=decodeURIComponent(C)),j=-1;for(L=0;L<m.length;L++){var q;-1!==(q=P.indexOf(m[L]))&&(-1===j||q<j)&&(j=q)}-1===j&&(j=P.length),this.host=P.slice(0,j),P=P.slice(j),this.parseHost(),this.hostname=this.hostname||"";var U="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!U)for(var z=this.hostname.split(/\./),H=(L=0,z.length);L<H;L++){var W=z[L];if(W&&!W.match(v)){for(var V="",G=0,J=W.length;G<J;G++)W.charCodeAt(G)>127?V+="x":V+=W[G];if(!V.match(v)){var $=z.slice(0,L),Z=z.slice(L+1),Y=W.match(b);Y&&($.push(Y[1]),Z.unshift(Y[2])),Z.length&&(P="/"+Z.join(".")+P),this.hostname=$.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),U||(this.hostname=a.toASCII(this.hostname));var X=this.port?":"+this.port:"",Q=this.hostname||"";this.host=Q+X,this.href+=this.host,U&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==P[0]&&(P="/"+P))}if(!w[N])for(L=0,H=p.length;L<H;L++){var ee=p[L];if(-1!==P.indexOf(ee)){var te=encodeURIComponent(ee);te===ee&&(te=escape(ee)),P=P.split(ee).join(te)}}var re=P.indexOf("#");-1!==re&&(this.hash=P.substr(re),P=P.slice(0,re));var ne=P.indexOf("?");if(-1!==ne?(this.search=P.substr(ne),this.query=P.substr(ne+1),i&&(this.query=k.parse(this.query)),P=P.slice(0,ne)):i&&(this.search="",this.query={}),P&&(this.pathname=P),M[N]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){X=this.pathname||"";var ie=this.search||"";this.path=X+ie}return this.href=this.format(),this},Url.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var i=this.protocol||"",o=this.pathname||"",a=this.hash||"",c=!1,h="";this.host?c=t+this.host:this.hostname&&(c=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(c+=":"+this.port)),this.query&&u.isObject(this.query)&&Object.keys(this.query).length&&(h=k.stringify(this.query));var l=this.search||h&&"?"+h||"";return i&&":"!==i.substr(-1)&&(i+=":"),this.slashes||(!i||M[i])&&!1!==c?(c="//"+(c||""),o&&"/"!==o.charAt(0)&&(o="/"+o)):c||(c=""),a&&"#"!==a.charAt(0)&&(a="#"+a),l&&"?"!==l.charAt(0)&&(l="?"+l),i+c+(o=o.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(l=l.replace("#","%23"))+a},Url.prototype.resolve=function(t){return this.resolveObject(urlParse(t,!1,!0)).format()},Url.prototype.resolveObject=function(t){if(u.isString(t)){var i=new Url;i.parse(t,!1,!0),t=i}for(var o=new Url,a=Object.keys(this),c=0;c<a.length;c++){var h=a[c];o[h]=this[h]}if(o.hash=t.hash,""===t.href)return o.href=o.format(),o;if(t.slashes&&!t.protocol){for(var l=Object.keys(t),d=0;d<l.length;d++){var p=l[d];"protocol"!==p&&(o[p]=t[p])}return M[o.protocol]&&o.hostname&&!o.pathname&&(o.path=o.pathname="/"),o.href=o.format(),o}if(t.protocol&&t.protocol!==o.protocol){if(!M[t.protocol]){for(var m=Object.keys(t),g=0;g<m.length;g++){var v=m[g];o[v]=t[v]}return o.href=o.format(),o}if(o.protocol=t.protocol,t.host||_[t.protocol])o.pathname=t.pathname;else{for(var b=(t.pathname||"").split("/");b.length&&!(t.host=b.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==b[0]&&b.unshift(""),b.length<2&&b.unshift(""),o.pathname=b.join("/")}if(o.search=t.search,o.query=t.query,o.host=t.host||"",o.auth=t.auth,o.hostname=t.hostname||t.host,o.port=t.port,o.pathname||o.search){var w=o.pathname||"",k=o.search||"";o.path=w+k}return o.slashes=o.slashes||t.slashes,o.href=o.format(),o}var B=o.pathname&&"/"===o.pathname.charAt(0),P=t.host||t.pathname&&"/"===t.pathname.charAt(0),x=P||B||o.host&&t.pathname,I=x,N=o.pathname&&o.pathname.split("/")||[],A=(b=t.pathname&&t.pathname.split("/")||[],o.protocol&&!M[o.protocol]);if(A&&(o.hostname="",o.port=null,o.host&&(""===N[0]?N[0]=o.host:N.unshift(o.host)),o.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===b[0]?b[0]=t.host:b.unshift(t.host)),t.host=null),x=x&&(""===b[0]||""===N[0])),P)o.host=t.host||""===t.host?t.host:o.host,o.hostname=t.hostname||""===t.hostname?t.hostname:o.hostname,o.search=t.search,o.query=t.query,N=b;else if(b.length)N||(N=[]),N.pop(),N=N.concat(b),o.search=t.search,o.query=t.query;else if(!u.isNullOrUndefined(t.search)){if(A)o.hostname=o.host=N.shift(),(q=!!(o.host&&o.host.indexOf("@")>0)&&o.host.split("@"))&&(o.auth=q.shift(),o.host=o.hostname=q.shift());return o.search=t.search,o.query=t.query,u.isNull(o.pathname)&&u.isNull(o.search)||(o.path=(o.pathname?o.pathname:"")+(o.search?o.search:"")),o.href=o.format(),o}if(!N.length)return o.pathname=null,o.search?o.path="/"+o.search:o.path=null,o.href=o.format(),o;for(var C=N.slice(-1)[0],O=(o.host||t.host||N.length>1)&&("."===C||".."===C)||""===C,j=0,L=N.length;L>=0;L--)"."===(C=N[L])?N.splice(L,1):".."===C?(N.splice(L,1),j++):j&&(N.splice(L,1),j--);if(!x&&!I)for(;j--;j)N.unshift("..");!x||""===N[0]||N[0]&&"/"===N[0].charAt(0)||N.unshift(""),O&&"/"!==N.join("/").substr(-1)&&N.push("");var q,U=""===N[0]||N[0]&&"/"===N[0].charAt(0);A&&(o.hostname=o.host=U?"":N.length?N.shift():"",(q=!!(o.host&&o.host.indexOf("@")>0)&&o.host.split("@"))&&(o.auth=q.shift(),o.host=o.hostname=q.shift()));return(x=x||o.host&&N.length)&&!U&&N.unshift(""),N.length?o.pathname=N.join("/"):(o.pathname=null,o.path=null),u.isNull(o.pathname)&&u.isNull(o.search)||(o.path=(o.pathname?o.pathname:"")+(o.search?o.search:"")),o.auth=t.auth||o.auth,o.slashes=o.slashes||t.slashes,o.href=o.format(),o},Url.prototype.parseHost=function(){var t=this.host,i=h.exec(t);i&&(":"!==(i=i[0])&&(this.port=i.substr(1)),t=t.substr(0,t.length-i.length)),t&&(this.hostname=t)}},function(t,i){t.exports=!0},function(t,i,o){var a=o(18),u=o(199),c=o(201),h=o(28),l=o(106),d=TypeError,p=Object.defineProperty,m=Object.getOwnPropertyDescriptor;i.f=a?c?function defineProperty(t,i,o){if(h(t),i=l(i),h(o),"function"==typeof t&&"prototype"===i&&"value"in o&&"writable"in o&&!o.writable){var a=m(t,i);a&&a.writable&&(t[i]=o.value,o={configurable:"configurable"in o?o.configurable:a.configurable,enumerable:"enumerable"in o?o.enumerable:a.enumerable,writable:!1})}return p(t,i,o)}:p:function defineProperty(t,i,o){if(h(t),i=l(i),h(o),u)try{return p(t,i,o)}catch(t){}if("get"in o||"set"in o)throw d("Accessors not supported");return"value"in o&&(t[i]=o.value),t}},function(t,i){function assert(t,i){if(!t)throw new Error(i||"Assertion failed")}t.exports=assert,assert.equal=function assertEqual(t,i,o){if(t!=i)throw new Error(o||"Assertion failed: "+t+" != "+i)}},function(t,i,o){"use strict";var a=i,u=o(49),c=o(35),h=o(295);a.assert=c,a.toArray=h.toArray,a.zero2=h.zero2,a.toHex=h.toHex,a.encode=h.encode,a.getNAF=function getNAF(t,i,o){var a=new Array(Math.max(t.bitLength(),o)+1);a.fill(0);for(var u=1<<i+1,c=t.clone(),h=0;h<a.length;h++){var l,d=c.andln(u-1);c.isOdd()?(l=d>(u>>1)-1?(u>>1)-d:d,c.isubn(l)):l=0,a[h]=l,c.iushrn(1)}return a},a.getJSF=function getJSF(t,i){var o=[[],[]];t=t.clone(),i=i.clone();for(var a,u=0,c=0;t.cmpn(-u)>0||i.cmpn(-c)>0;){var h,l,d=t.andln(3)+u&3,p=i.andln(3)+c&3;3===d&&(d=-1),3===p&&(p=-1),h=0==(1&d)?0:3!==(a=t.andln(7)+u&7)&&5!==a||2!==p?d:-d,o[0].push(h),l=0==(1&p)?0:3!==(a=i.andln(7)+c&7)&&5!==a||2!==d?p:-p,o[1].push(l),2*u===h+1&&(u=1-u),2*c===l+1&&(c=1-c),t.iushrn(1),i.iushrn(1)}return o},a.cachedProperty=function cachedProperty(t,i,o){var a="_"+i;t.prototype[i]=function cachedProperty(){return void 0!==this[a]?this[a]:this[a]=o.call(this)}},a.parseBytes=function parseBytes(t){return"string"==typeof t?a.toArray(t,"hex"):t},a.intFromLE=function intFromLE(t){return new u(t,"hex","le")}},function(t,i,o){"use strict";i.a=function(){let t=new Map;return{emit(i){for(var o=arguments.length,a=new Array(o>1?o-1:0),u=1;u<o;u++)a[u-1]=arguments[u];let c=t.get(i);c&&c.length&&c.forEach(t=>{t.callback.call(t.vm,...a),t.once&&this.off(i,t.callback,t.vm)})},on(i,o,a){t.has(i)||t.set(i,[]),t.get(i).push({callback:o,vm:a||this})},off(i,o,a){let u=t.get(i);if(u&&u.length){let c=u.findIndex(t=>"function"==typeof t.callback&&t.callback===o&&t.vm===(a||this));c>-1&&(u.splice(c,1),t.set(i,u))}},once(i,o,a){t.has(i)||t.set(i,[]),t.get(i).push({callback:o,vm:a||this,once:!0})},clear(){t.clear()}}}},function(t,i,o){var a=o(137),u=o(89);t.exports=function(t){return a(u(t))}},function(t,i,o){var a=o(566),u=o(567),c=o(152),h=o(568);t.exports=function _toConsumableArray(t){return a(t)||u(t)||c(t)||h()},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i,o){var a=o(89),u=Object;t.exports=function(t){return u(a(t))}},function(t,i,o){function objectToString(t){return Object.prototype.toString.call(t)}i.isArray=function isArray(t){return Array.isArray?Array.isArray(t):"[object Array]"===objectToString(t)},i.isBoolean=function isBoolean(t){return"boolean"==typeof t},i.isNull=function isNull(t){return null===t},i.isNullOrUndefined=function isNullOrUndefined(t){return null==t},i.isNumber=function isNumber(t){return"number"==typeof t},i.isString=function isString(t){return"string"==typeof t},i.isSymbol=function isSymbol(t){return"symbol"==typeof t},i.isUndefined=function isUndefined(t){return void 0===t},i.isRegExp=function isRegExp(t){return"[object RegExp]"===objectToString(t)},i.isObject=function isObject(t){return"object"==typeof t&&null!==t},i.isDate=function isDate(t){return"[object Date]"===objectToString(t)},i.isError=function isError(t){return"[object Error]"===objectToString(t)||t instanceof Error},i.isFunction=function isFunction(t){return"function"==typeof t},i.isPrimitive=function isPrimitive(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},i.isBuffer=o(10).Buffer.isBuffer},function(t,i,o){"use strict";var a=o(35),u=o(1);function isSurrogatePair(t,i){return 55296==(64512&t.charCodeAt(i))&&(!(i<0||i+1>=t.length)&&56320==(64512&t.charCodeAt(i+1)))}function htonl(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function zero2(t){return 1===t.length?"0"+t:t}function zero8(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}i.inherits=u,i.toArray=function toArray(t,i){if(Array.isArray(t))return t.slice();if(!t)return[];var o=[];if("string"==typeof t)if(i){if("hex"===i)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),u=0;u<t.length;u+=2)o.push(parseInt(t[u]+t[u+1],16))}else for(var a=0,u=0;u<t.length;u++){var c=t.charCodeAt(u);c<128?o[a++]=c:c<2048?(o[a++]=c>>6|192,o[a++]=63&c|128):isSurrogatePair(t,u)?(c=65536+((1023&c)<<10)+(1023&t.charCodeAt(++u)),o[a++]=c>>18|240,o[a++]=c>>12&63|128,o[a++]=c>>6&63|128,o[a++]=63&c|128):(o[a++]=c>>12|224,o[a++]=c>>6&63|128,o[a++]=63&c|128)}else for(u=0;u<t.length;u++)o[u]=0|t[u];return o},i.toHex=function toHex(t){for(var i="",o=0;o<t.length;o++)i+=zero2(t[o].toString(16));return i},i.htonl=htonl,i.toHex32=function toHex32(t,i){for(var o="",a=0;a<t.length;a++){var u=t[a];"little"===i&&(u=htonl(u)),o+=zero8(u.toString(16))}return o},i.zero2=zero2,i.zero8=zero8,i.join32=function join32(t,i,o,u){var c=o-i;a(c%4==0);for(var h=new Array(c/4),l=0,d=i;l<h.length;l++,d+=4){var p;p="big"===u?t[d]<<24|t[d+1]<<16|t[d+2]<<8|t[d+3]:t[d+3]<<24|t[d+2]<<16|t[d+1]<<8|t[d],h[l]=p>>>0}return h},i.split32=function split32(t,i){for(var o=new Array(4*t.length),a=0,u=0;a<t.length;a++,u+=4){var c=t[a];"big"===i?(o[u]=c>>>24,o[u+1]=c>>>16&255,o[u+2]=c>>>8&255,o[u+3]=255&c):(o[u+3]=c>>>24,o[u+2]=c>>>16&255,o[u+1]=c>>>8&255,o[u]=255&c)}return o},i.rotr32=function rotr32(t,i){return t>>>i|t<<32-i},i.rotl32=function rotl32(t,i){return t<<i|t>>>32-i},i.sum32=function sum32(t,i){return t+i>>>0},i.sum32_3=function sum32_3(t,i,o){return t+i+o>>>0},i.sum32_4=function sum32_4(t,i,o,a){return t+i+o+a>>>0},i.sum32_5=function sum32_5(t,i,o,a,u){return t+i+o+a+u>>>0},i.sum64=function sum64(t,i,o,a){var u=t[i],c=a+t[i+1]>>>0,h=(c<a?1:0)+o+u;t[i]=h>>>0,t[i+1]=c},i.sum64_hi=function sum64_hi(t,i,o,a){return(i+a>>>0<i?1:0)+t+o>>>0},i.sum64_lo=function sum64_lo(t,i,o,a){return i+a>>>0},i.sum64_4_hi=function sum64_4_hi(t,i,o,a,u,c,h,l){var d=0,p=i;return d+=(p=p+a>>>0)<i?1:0,d+=(p=p+c>>>0)<c?1:0,t+o+u+h+(d+=(p=p+l>>>0)<l?1:0)>>>0},i.sum64_4_lo=function sum64_4_lo(t,i,o,a,u,c,h,l){return i+a+c+l>>>0},i.sum64_5_hi=function sum64_5_hi(t,i,o,a,u,c,h,l,d,p){var m=0,g=i;return m+=(g=g+a>>>0)<i?1:0,m+=(g=g+c>>>0)<c?1:0,m+=(g=g+l>>>0)<l?1:0,t+o+u+h+d+(m+=(g=g+p>>>0)<p?1:0)>>>0},i.sum64_5_lo=function sum64_5_lo(t,i,o,a,u,c,h,l,d,p){return i+a+c+l+p>>>0},i.rotr64_hi=function rotr64_hi(t,i,o){return(i<<32-o|t>>>o)>>>0},i.rotr64_lo=function rotr64_lo(t,i,o){return(t<<32-o|i>>>o)>>>0},i.shr64_hi=function shr64_hi(t,i,o){return t>>>o},i.shr64_lo=function shr64_lo(t,i,o){return(t<<32-o|i>>>o)>>>0}},function(t,i,o){var a=o(94),u=o(150),c=o(151),h=o(152);t.exports=function _createForOfIteratorHelper(t,i){var o=void 0!==a&&u(t)||t["@@iterator"];if(!o){if(c(t)||(o=h(t))||i&&t&&"number"==typeof t.length){o&&(t=o);var l=0,d=function F(){};return{s:d,n:function n(){return l>=t.length?{done:!0}:{done:!1,value:t[l++]}},e:function e(t){throw t},f:d}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var p,m=!0,g=!1;return{s:function s(){o=o.call(t)},n:function n(){var t=o.next();return m=t.done,t},e:function e(t){g=!0,p=t},f:function f(){try{m||null==o.return||o.return()}finally{if(g)throw p}}}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i,o){var a=o(14),u=o(76),c=TypeError;t.exports=function(t){if(a(t))return t;throw c(u(t)+" is not a function")}},function(t,i,o){var a=o(18),u=o(34),c=o(53);t.exports=a?function(t,i,o){return u.f(t,i,c(1,o))}:function(t,i,o){return t[i]=o,t}},function(t,i,o){var a=o(45);t.exports=function(t,i,o,u){return u&&u.enumerable?t[i]=o:a(t,i,o),t}},function(t,i,o){(i=t.exports=o(255)).Stream=i,i.Readable=i,i.Writable=o(259),i.Duplex=o(84),i.Transform=o(260),i.PassThrough=o(656),i.finished=o(167),i.pipeline=o(657)},function(t,i,o){"use strict";(function(i){void 0===i||!i.version||0===i.version.indexOf("v0.")||0===i.version.indexOf("v1.")&&0!==i.version.indexOf("v1.8.")?t.exports={nextTick:function nextTick(t,o,a,u){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var c,h,l=arguments.length;switch(l){case 0:case 1:return i.nextTick(t);case 2:return i.nextTick((function afterTickOne(){t.call(null,o)}));case 3:return i.nextTick((function afterTickTwo(){t.call(null,o,a)}));case 4:return i.nextTick((function afterTickThree(){t.call(null,o,a,u)}));default:for(c=new Array(l-1),h=0;h<c.length;)c[h++]=arguments[h];return i.nextTick((function afterTick(){t.apply(null,c)}))}}}:t.exports=i}).call(this,o(11))},function(t,i,o){(function(t){!function(t,i){"use strict";function assert(t,i){if(!t)throw new Error(i||"Assertion failed")}function inherits(t,i){t.super_=i;var TempCtor=function(){};TempCtor.prototype=i.prototype,t.prototype=new TempCtor,t.prototype.constructor=t}function BN(t,i,o){if(BN.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(o=i,i=10),this._init(t||0,i||10,o||"be"))}var a;"object"==typeof t?t.exports=BN:i.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:o(720).Buffer}catch(t){}function parseHex4Bits(t,i){var o=t.charCodeAt(i);return o>=65&&o<=70?o-55:o>=97&&o<=102?o-87:o-48&15}function parseHexByte(t,i,o){var a=parseHex4Bits(t,o);return o-1>=i&&(a|=parseHex4Bits(t,o-1)<<4),a}function parseBase(t,i,o,a){for(var u=0,c=Math.min(t.length,o),h=i;h<c;h++){var l=t.charCodeAt(h)-48;u*=a,u+=l>=49?l-49+10:l>=17?l-17+10:l}return u}BN.isBN=function isBN(t){return t instanceof BN||null!==t&&"object"==typeof t&&t.constructor.wordSize===BN.wordSize&&Array.isArray(t.words)},BN.max=function max(t,i){return t.cmp(i)>0?t:i},BN.min=function min(t,i){return t.cmp(i)<0?t:i},BN.prototype._init=function init(t,i,o){if("number"==typeof t)return this._initNumber(t,i,o);if("object"==typeof t)return this._initArray(t,i,o);"hex"===i&&(i=16),assert(i===(0|i)&&i>=2&&i<=36);var a=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a<t.length&&(16===i?this._parseHex(t,a,o):(this._parseBase(t,i,a),"le"===o&&this._initArray(this.toArray(),i,o)))},BN.prototype._initNumber=function _initNumber(t,i,o){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(assert(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),i,o)},BN.prototype._initArray=function _initArray(t,i,o){if(assert("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var a=0;a<this.length;a++)this.words[a]=0;var u,c,h=0;if("be"===o)for(a=t.length-1,u=0;a>=0;a-=3)c=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[u]|=c<<h&67108863,this.words[u+1]=c>>>26-h&67108863,(h+=24)>=26&&(h-=26,u++);else if("le"===o)for(a=0,u=0;a<t.length;a+=3)c=t[a]|t[a+1]<<8|t[a+2]<<16,this.words[u]|=c<<h&67108863,this.words[u+1]=c>>>26-h&67108863,(h+=24)>=26&&(h-=26,u++);return this.strip()},BN.prototype._parseHex=function _parseHex(t,i,o){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var a=0;a<this.length;a++)this.words[a]=0;var u,c=0,h=0;if("be"===o)for(a=t.length-1;a>=i;a-=2)u=parseHexByte(t,i,a)<<c,this.words[h]|=67108863&u,c>=18?(c-=18,h+=1,this.words[h]|=u>>>26):c+=8;else for(a=(t.length-i)%2==0?i+1:i;a<t.length;a+=2)u=parseHexByte(t,i,a)<<c,this.words[h]|=67108863&u,c>=18?(c-=18,h+=1,this.words[h]|=u>>>26):c+=8;this.strip()},BN.prototype._parseBase=function _parseBase(t,i,o){this.words=[0],this.length=1;for(var a=0,u=1;u<=67108863;u*=i)a++;a--,u=u/i|0;for(var c=t.length-o,h=c%a,l=Math.min(c,c-h)+o,d=0,p=o;p<l;p+=a)d=parseBase(t,p,p+a,i),this.imuln(u),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d);if(0!==h){var m=1;for(d=parseBase(t,p,t.length,i),p=0;p<h;p++)m*=i;this.imuln(m),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d)}this.strip()},BN.prototype.copy=function copy(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},BN.prototype.clone=function clone(){var t=new BN(null);return this.copy(t),t},BN.prototype._expand=function _expand(t){for(;this.length<t;)this.words[this.length++]=0;return this},BN.prototype.strip=function strip(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(t,i,o){o.negative=i.negative^t.negative;var a=t.length+i.length|0;o.length=a,a=a-1|0;var u=0|t.words[0],c=0|i.words[0],h=u*c,l=67108863&h,d=h/67108864|0;o.words[0]=l;for(var p=1;p<a;p++){for(var m=d>>>26,g=67108863&d,v=Math.min(p,i.length-1),b=Math.max(0,p-t.length+1);b<=v;b++){var w=p-b|0;m+=(h=(u=0|t.words[w])*(c=0|i.words[b])+g)/67108864|0,g=67108863&h}o.words[p]=0|g,d=0|m}return 0!==d?o.words[p]=0|d:o.length--,o.strip()}BN.prototype.toString=function toString(t,i){var o;if(i=0|i||1,16===(t=t||10)||"hex"===t){o="";for(var a=0,l=0,d=0;d<this.length;d++){var p=this.words[d],m=(16777215&(p<<a|l)).toString(16);o=0!==(l=p>>>24-a&16777215)||d!==this.length-1?u[6-m.length]+m+o:m+o,(a+=2)>=26&&(a-=26,d--)}for(0!==l&&(o=l.toString(16)+o);o.length%i!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(t===(0|t)&&t>=2&&t<=36){var g=c[t],v=h[t];o="";var b=this.clone();for(b.negative=0;!b.isZero();){var w=b.modn(v).toString(t);o=(b=b.idivn(v)).isZero()?w+o:u[g-w.length]+w+o}for(this.isZero()&&(o="0"+o);o.length%i!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(t,i){return assert(void 0!==a),this.toArrayLike(a,t,i)},BN.prototype.toArray=function toArray(t,i){return this.toArrayLike(Array,t,i)},BN.prototype.toArrayLike=function toArrayLike(t,i,o){var a=this.byteLength(),u=o||Math.max(1,a);assert(a<=u,"byte array longer than desired length"),assert(u>0,"Requested array length <= 0"),this.strip();var c,h,l="le"===i,d=new t(u),p=this.clone();if(l){for(h=0;!p.isZero();h++)c=p.andln(255),p.iushrn(8),d[h]=c;for(;h<u;h++)d[h]=0}else{for(h=0;h<u-a;h++)d[h]=0;for(h=0;!p.isZero();h++)c=p.andln(255),p.iushrn(8),d[u-h-1]=c}return d},Math.clz32?BN.prototype._countBits=function _countBits(t){return 32-Math.clz32(t)}:BN.prototype._countBits=function _countBits(t){var i=t,o=0;return i>=4096&&(o+=13,i>>>=13),i>=64&&(o+=7,i>>>=7),i>=8&&(o+=4,i>>>=4),i>=2&&(o+=2,i>>>=2),o+i},BN.prototype._zeroBits=function _zeroBits(t){if(0===t)return 26;var i=t,o=0;return 0==(8191&i)&&(o+=13,i>>>=13),0==(127&i)&&(o+=7,i>>>=7),0==(15&i)&&(o+=4,i>>>=4),0==(3&i)&&(o+=2,i>>>=2),0==(1&i)&&o++,o},BN.prototype.bitLength=function bitLength(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var o=this._zeroBits(this.words[i]);if(t+=o,26!==o)break}return t},BN.prototype.byteLength=function byteLength(){return Math.ceil(this.bitLength()/8)},BN.prototype.toTwos=function toTwos(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},BN.prototype.fromTwos=function fromTwos(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},BN.prototype.isNeg=function isNeg(){return 0!==this.negative},BN.prototype.neg=function neg(){return this.clone().ineg()},BN.prototype.ineg=function ineg(){return this.isZero()||(this.negative^=1),this},BN.prototype.iuor=function iuor(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this.strip()},BN.prototype.ior=function ior(t){return assert(0==(this.negative|t.negative)),this.iuor(t)},BN.prototype.or=function or(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},BN.prototype.uor=function uor(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},BN.prototype.iuand=function iuand(t){var i;i=this.length>t.length?t:this;for(var o=0;o<i.length;o++)this.words[o]=this.words[o]&t.words[o];return this.length=i.length,this.strip()},BN.prototype.iand=function iand(t){return assert(0==(this.negative|t.negative)),this.iuand(t)},BN.prototype.and=function and(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},BN.prototype.uand=function uand(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},BN.prototype.iuxor=function iuxor(t){var i,o;this.length>t.length?(i=this,o=t):(i=t,o=this);for(var a=0;a<o.length;a++)this.words[a]=i.words[a]^o.words[a];if(this!==i)for(;a<i.length;a++)this.words[a]=i.words[a];return this.length=i.length,this.strip()},BN.prototype.ixor=function ixor(t){return assert(0==(this.negative|t.negative)),this.iuxor(t)},BN.prototype.xor=function xor(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},BN.prototype.uxor=function uxor(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},BN.prototype.inotn=function inotn(t){assert("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),o=t%26;this._expand(i),o>0&&i--;for(var a=0;a<i;a++)this.words[a]=67108863&~this.words[a];return o>0&&(this.words[a]=~this.words[a]&67108863>>26-o),this.strip()},BN.prototype.notn=function notn(t){return this.clone().inotn(t)},BN.prototype.setn=function setn(t,i){assert("number"==typeof t&&t>=0);var o=t/26|0,a=t%26;return this._expand(o+1),this.words[o]=i?this.words[o]|1<<a:this.words[o]&~(1<<a),this.strip()},BN.prototype.iadd=function iadd(t){var i,o,a;if(0!==this.negative&&0===t.negative)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();this.length>t.length?(o=this,a=t):(o=t,a=this);for(var u=0,c=0;c<a.length;c++)i=(0|o.words[c])+(0|a.words[c])+u,this.words[c]=67108863&i,u=i>>>26;for(;0!==u&&c<o.length;c++)i=(0|o.words[c])+u,this.words[c]=67108863&i,u=i>>>26;if(this.length=o.length,0!==u)this.words[this.length]=u,this.length++;else if(o!==this)for(;c<o.length;c++)this.words[c]=o.words[c];return this},BN.prototype.add=function add(t){var i;return 0!==t.negative&&0===this.negative?(t.negative=0,i=this.sub(t),t.negative^=1,i):0===t.negative&&0!==this.negative?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},BN.prototype.isub=function isub(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var o,a,u=this.cmp(t);if(0===u)return this.negative=0,this.length=1,this.words[0]=0,this;u>0?(o=this,a=t):(o=t,a=this);for(var c=0,h=0;h<a.length;h++)c=(i=(0|o.words[h])-(0|a.words[h])+c)>>26,this.words[h]=67108863&i;for(;0!==c&&h<o.length;h++)c=(i=(0|o.words[h])+c)>>26,this.words[h]=67108863&i;if(0===c&&h<o.length&&o!==this)for(;h<o.length;h++)this.words[h]=o.words[h];return this.length=Math.max(this.length,h),o!==this&&(this.negative=1),this.strip()},BN.prototype.sub=function sub(t){return this.clone().isub(t)};var l=function comb10MulTo(t,i,o){var a,u,c,h=t.words,l=i.words,d=o.words,p=0,m=0|h[0],g=8191&m,v=m>>>13,b=0|h[1],w=8191&b,_=b>>>13,M=0|h[2],k=8191&M,B=M>>>13,P=0|h[3],x=8191&P,I=P>>>13,N=0|h[4],A=8191&N,C=N>>>13,O=0|h[5],j=8191&O,L=O>>>13,q=0|h[6],U=8191&q,z=q>>>13,H=0|h[7],W=8191&H,V=H>>>13,G=0|h[8],J=8191&G,$=G>>>13,Z=0|h[9],Y=8191&Z,X=Z>>>13,Q=0|l[0],ee=8191&Q,te=Q>>>13,re=0|l[1],ne=8191&re,ie=re>>>13,oe=0|l[2],se=8191&oe,ae=oe>>>13,ue=0|l[3],ce=8191&ue,he=ue>>>13,le=0|l[4],fe=8191&le,de=le>>>13,pe=0|l[5],me=8191&pe,ge=pe>>>13,ve=0|l[6],ye=8191&ve,be=ve>>>13,we=0|l[7],_e=8191&we,Me=we>>>13,Se=0|l[8],ke=8191&Se,Ee=Se>>>13,Be=0|l[9],Pe=8191&Be,xe=Be>>>13;o.negative=t.negative^i.negative,o.length=19;var Te=(p+(a=Math.imul(g,ee))|0)+((8191&(u=(u=Math.imul(g,te))+Math.imul(v,ee)|0))<<13)|0;p=((c=Math.imul(v,te))+(u>>>13)|0)+(Te>>>26)|0,Te&=67108863,a=Math.imul(w,ee),u=(u=Math.imul(w,te))+Math.imul(_,ee)|0,c=Math.imul(_,te);var Ie=(p+(a=a+Math.imul(g,ne)|0)|0)+((8191&(u=(u=u+Math.imul(g,ie)|0)+Math.imul(v,ne)|0))<<13)|0;p=((c=c+Math.imul(v,ie)|0)+(u>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,a=Math.imul(k,ee),u=(u=Math.imul(k,te))+Math.imul(B,ee)|0,c=Math.imul(B,te),a=a+Math.imul(w,ne)|0,u=(u=u+Math.imul(w,ie)|0)+Math.imul(_,ne)|0,c=c+Math.imul(_,ie)|0;var Ne=(p+(a=a+Math.imul(g,se)|0)|0)+((8191&(u=(u=u+Math.imul(g,ae)|0)+Math.imul(v,se)|0))<<13)|0;p=((c=c+Math.imul(v,ae)|0)+(u>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,a=Math.imul(x,ee),u=(u=Math.imul(x,te))+Math.imul(I,ee)|0,c=Math.imul(I,te),a=a+Math.imul(k,ne)|0,u=(u=u+Math.imul(k,ie)|0)+Math.imul(B,ne)|0,c=c+Math.imul(B,ie)|0,a=a+Math.imul(w,se)|0,u=(u=u+Math.imul(w,ae)|0)+Math.imul(_,se)|0,c=c+Math.imul(_,ae)|0;var Ae=(p+(a=a+Math.imul(g,ce)|0)|0)+((8191&(u=(u=u+Math.imul(g,he)|0)+Math.imul(v,ce)|0))<<13)|0;p=((c=c+Math.imul(v,he)|0)+(u>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,a=Math.imul(A,ee),u=(u=Math.imul(A,te))+Math.imul(C,ee)|0,c=Math.imul(C,te),a=a+Math.imul(x,ne)|0,u=(u=u+Math.imul(x,ie)|0)+Math.imul(I,ne)|0,c=c+Math.imul(I,ie)|0,a=a+Math.imul(k,se)|0,u=(u=u+Math.imul(k,ae)|0)+Math.imul(B,se)|0,c=c+Math.imul(B,ae)|0,a=a+Math.imul(w,ce)|0,u=(u=u+Math.imul(w,he)|0)+Math.imul(_,ce)|0,c=c+Math.imul(_,he)|0;var Re=(p+(a=a+Math.imul(g,fe)|0)|0)+((8191&(u=(u=u+Math.imul(g,de)|0)+Math.imul(v,fe)|0))<<13)|0;p=((c=c+Math.imul(v,de)|0)+(u>>>13)|0)+(Re>>>26)|0,Re&=67108863,a=Math.imul(j,ee),u=(u=Math.imul(j,te))+Math.imul(L,ee)|0,c=Math.imul(L,te),a=a+Math.imul(A,ne)|0,u=(u=u+Math.imul(A,ie)|0)+Math.imul(C,ne)|0,c=c+Math.imul(C,ie)|0,a=a+Math.imul(x,se)|0,u=(u=u+Math.imul(x,ae)|0)+Math.imul(I,se)|0,c=c+Math.imul(I,ae)|0,a=a+Math.imul(k,ce)|0,u=(u=u+Math.imul(k,he)|0)+Math.imul(B,ce)|0,c=c+Math.imul(B,he)|0,a=a+Math.imul(w,fe)|0,u=(u=u+Math.imul(w,de)|0)+Math.imul(_,fe)|0,c=c+Math.imul(_,de)|0;var Ce=(p+(a=a+Math.imul(g,me)|0)|0)+((8191&(u=(u=u+Math.imul(g,ge)|0)+Math.imul(v,me)|0))<<13)|0;p=((c=c+Math.imul(v,ge)|0)+(u>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,a=Math.imul(U,ee),u=(u=Math.imul(U,te))+Math.imul(z,ee)|0,c=Math.imul(z,te),a=a+Math.imul(j,ne)|0,u=(u=u+Math.imul(j,ie)|0)+Math.imul(L,ne)|0,c=c+Math.imul(L,ie)|0,a=a+Math.imul(A,se)|0,u=(u=u+Math.imul(A,ae)|0)+Math.imul(C,se)|0,c=c+Math.imul(C,ae)|0,a=a+Math.imul(x,ce)|0,u=(u=u+Math.imul(x,he)|0)+Math.imul(I,ce)|0,c=c+Math.imul(I,he)|0,a=a+Math.imul(k,fe)|0,u=(u=u+Math.imul(k,de)|0)+Math.imul(B,fe)|0,c=c+Math.imul(B,de)|0,a=a+Math.imul(w,me)|0,u=(u=u+Math.imul(w,ge)|0)+Math.imul(_,me)|0,c=c+Math.imul(_,ge)|0;var Oe=(p+(a=a+Math.imul(g,ye)|0)|0)+((8191&(u=(u=u+Math.imul(g,be)|0)+Math.imul(v,ye)|0))<<13)|0;p=((c=c+Math.imul(v,be)|0)+(u>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,a=Math.imul(W,ee),u=(u=Math.imul(W,te))+Math.imul(V,ee)|0,c=Math.imul(V,te),a=a+Math.imul(U,ne)|0,u=(u=u+Math.imul(U,ie)|0)+Math.imul(z,ne)|0,c=c+Math.imul(z,ie)|0,a=a+Math.imul(j,se)|0,u=(u=u+Math.imul(j,ae)|0)+Math.imul(L,se)|0,c=c+Math.imul(L,ae)|0,a=a+Math.imul(A,ce)|0,u=(u=u+Math.imul(A,he)|0)+Math.imul(C,ce)|0,c=c+Math.imul(C,he)|0,a=a+Math.imul(x,fe)|0,u=(u=u+Math.imul(x,de)|0)+Math.imul(I,fe)|0,c=c+Math.imul(I,de)|0,a=a+Math.imul(k,me)|0,u=(u=u+Math.imul(k,ge)|0)+Math.imul(B,me)|0,c=c+Math.imul(B,ge)|0,a=a+Math.imul(w,ye)|0,u=(u=u+Math.imul(w,be)|0)+Math.imul(_,ye)|0,c=c+Math.imul(_,be)|0;var De=(p+(a=a+Math.imul(g,_e)|0)|0)+((8191&(u=(u=u+Math.imul(g,Me)|0)+Math.imul(v,_e)|0))<<13)|0;p=((c=c+Math.imul(v,Me)|0)+(u>>>13)|0)+(De>>>26)|0,De&=67108863,a=Math.imul(J,ee),u=(u=Math.imul(J,te))+Math.imul($,ee)|0,c=Math.imul($,te),a=a+Math.imul(W,ne)|0,u=(u=u+Math.imul(W,ie)|0)+Math.imul(V,ne)|0,c=c+Math.imul(V,ie)|0,a=a+Math.imul(U,se)|0,u=(u=u+Math.imul(U,ae)|0)+Math.imul(z,se)|0,c=c+Math.imul(z,ae)|0,a=a+Math.imul(j,ce)|0,u=(u=u+Math.imul(j,he)|0)+Math.imul(L,ce)|0,c=c+Math.imul(L,he)|0,a=a+Math.imul(A,fe)|0,u=(u=u+Math.imul(A,de)|0)+Math.imul(C,fe)|0,c=c+Math.imul(C,de)|0,a=a+Math.imul(x,me)|0,u=(u=u+Math.imul(x,ge)|0)+Math.imul(I,me)|0,c=c+Math.imul(I,ge)|0,a=a+Math.imul(k,ye)|0,u=(u=u+Math.imul(k,be)|0)+Math.imul(B,ye)|0,c=c+Math.imul(B,be)|0,a=a+Math.imul(w,_e)|0,u=(u=u+Math.imul(w,Me)|0)+Math.imul(_,_e)|0,c=c+Math.imul(_,Me)|0;var je=(p+(a=a+Math.imul(g,ke)|0)|0)+((8191&(u=(u=u+Math.imul(g,Ee)|0)+Math.imul(v,ke)|0))<<13)|0;p=((c=c+Math.imul(v,Ee)|0)+(u>>>13)|0)+(je>>>26)|0,je&=67108863,a=Math.imul(Y,ee),u=(u=Math.imul(Y,te))+Math.imul(X,ee)|0,c=Math.imul(X,te),a=a+Math.imul(J,ne)|0,u=(u=u+Math.imul(J,ie)|0)+Math.imul($,ne)|0,c=c+Math.imul($,ie)|0,a=a+Math.imul(W,se)|0,u=(u=u+Math.imul(W,ae)|0)+Math.imul(V,se)|0,c=c+Math.imul(V,ae)|0,a=a+Math.imul(U,ce)|0,u=(u=u+Math.imul(U,he)|0)+Math.imul(z,ce)|0,c=c+Math.imul(z,he)|0,a=a+Math.imul(j,fe)|0,u=(u=u+Math.imul(j,de)|0)+Math.imul(L,fe)|0,c=c+Math.imul(L,de)|0,a=a+Math.imul(A,me)|0,u=(u=u+Math.imul(A,ge)|0)+Math.imul(C,me)|0,c=c+Math.imul(C,ge)|0,a=a+Math.imul(x,ye)|0,u=(u=u+Math.imul(x,be)|0)+Math.imul(I,ye)|0,c=c+Math.imul(I,be)|0,a=a+Math.imul(k,_e)|0,u=(u=u+Math.imul(k,Me)|0)+Math.imul(B,_e)|0,c=c+Math.imul(B,Me)|0,a=a+Math.imul(w,ke)|0,u=(u=u+Math.imul(w,Ee)|0)+Math.imul(_,ke)|0,c=c+Math.imul(_,Ee)|0;var Le=(p+(a=a+Math.imul(g,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(g,xe)|0)+Math.imul(v,Pe)|0))<<13)|0;p=((c=c+Math.imul(v,xe)|0)+(u>>>13)|0)+(Le>>>26)|0,Le&=67108863,a=Math.imul(Y,ne),u=(u=Math.imul(Y,ie))+Math.imul(X,ne)|0,c=Math.imul(X,ie),a=a+Math.imul(J,se)|0,u=(u=u+Math.imul(J,ae)|0)+Math.imul($,se)|0,c=c+Math.imul($,ae)|0,a=a+Math.imul(W,ce)|0,u=(u=u+Math.imul(W,he)|0)+Math.imul(V,ce)|0,c=c+Math.imul(V,he)|0,a=a+Math.imul(U,fe)|0,u=(u=u+Math.imul(U,de)|0)+Math.imul(z,fe)|0,c=c+Math.imul(z,de)|0,a=a+Math.imul(j,me)|0,u=(u=u+Math.imul(j,ge)|0)+Math.imul(L,me)|0,c=c+Math.imul(L,ge)|0,a=a+Math.imul(A,ye)|0,u=(u=u+Math.imul(A,be)|0)+Math.imul(C,ye)|0,c=c+Math.imul(C,be)|0,a=a+Math.imul(x,_e)|0,u=(u=u+Math.imul(x,Me)|0)+Math.imul(I,_e)|0,c=c+Math.imul(I,Me)|0,a=a+Math.imul(k,ke)|0,u=(u=u+Math.imul(k,Ee)|0)+Math.imul(B,ke)|0,c=c+Math.imul(B,Ee)|0;var Fe=(p+(a=a+Math.imul(w,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(w,xe)|0)+Math.imul(_,Pe)|0))<<13)|0;p=((c=c+Math.imul(_,xe)|0)+(u>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,a=Math.imul(Y,se),u=(u=Math.imul(Y,ae))+Math.imul(X,se)|0,c=Math.imul(X,ae),a=a+Math.imul(J,ce)|0,u=(u=u+Math.imul(J,he)|0)+Math.imul($,ce)|0,c=c+Math.imul($,he)|0,a=a+Math.imul(W,fe)|0,u=(u=u+Math.imul(W,de)|0)+Math.imul(V,fe)|0,c=c+Math.imul(V,de)|0,a=a+Math.imul(U,me)|0,u=(u=u+Math.imul(U,ge)|0)+Math.imul(z,me)|0,c=c+Math.imul(z,ge)|0,a=a+Math.imul(j,ye)|0,u=(u=u+Math.imul(j,be)|0)+Math.imul(L,ye)|0,c=c+Math.imul(L,be)|0,a=a+Math.imul(A,_e)|0,u=(u=u+Math.imul(A,Me)|0)+Math.imul(C,_e)|0,c=c+Math.imul(C,Me)|0,a=a+Math.imul(x,ke)|0,u=(u=u+Math.imul(x,Ee)|0)+Math.imul(I,ke)|0,c=c+Math.imul(I,Ee)|0;var qe=(p+(a=a+Math.imul(k,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(k,xe)|0)+Math.imul(B,Pe)|0))<<13)|0;p=((c=c+Math.imul(B,xe)|0)+(u>>>13)|0)+(qe>>>26)|0,qe&=67108863,a=Math.imul(Y,ce),u=(u=Math.imul(Y,he))+Math.imul(X,ce)|0,c=Math.imul(X,he),a=a+Math.imul(J,fe)|0,u=(u=u+Math.imul(J,de)|0)+Math.imul($,fe)|0,c=c+Math.imul($,de)|0,a=a+Math.imul(W,me)|0,u=(u=u+Math.imul(W,ge)|0)+Math.imul(V,me)|0,c=c+Math.imul(V,ge)|0,a=a+Math.imul(U,ye)|0,u=(u=u+Math.imul(U,be)|0)+Math.imul(z,ye)|0,c=c+Math.imul(z,be)|0,a=a+Math.imul(j,_e)|0,u=(u=u+Math.imul(j,Me)|0)+Math.imul(L,_e)|0,c=c+Math.imul(L,Me)|0,a=a+Math.imul(A,ke)|0,u=(u=u+Math.imul(A,Ee)|0)+Math.imul(C,ke)|0,c=c+Math.imul(C,Ee)|0;var Ue=(p+(a=a+Math.imul(x,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(x,xe)|0)+Math.imul(I,Pe)|0))<<13)|0;p=((c=c+Math.imul(I,xe)|0)+(u>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,a=Math.imul(Y,fe),u=(u=Math.imul(Y,de))+Math.imul(X,fe)|0,c=Math.imul(X,de),a=a+Math.imul(J,me)|0,u=(u=u+Math.imul(J,ge)|0)+Math.imul($,me)|0,c=c+Math.imul($,ge)|0,a=a+Math.imul(W,ye)|0,u=(u=u+Math.imul(W,be)|0)+Math.imul(V,ye)|0,c=c+Math.imul(V,be)|0,a=a+Math.imul(U,_e)|0,u=(u=u+Math.imul(U,Me)|0)+Math.imul(z,_e)|0,c=c+Math.imul(z,Me)|0,a=a+Math.imul(j,ke)|0,u=(u=u+Math.imul(j,Ee)|0)+Math.imul(L,ke)|0,c=c+Math.imul(L,Ee)|0;var ze=(p+(a=a+Math.imul(A,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(A,xe)|0)+Math.imul(C,Pe)|0))<<13)|0;p=((c=c+Math.imul(C,xe)|0)+(u>>>13)|0)+(ze>>>26)|0,ze&=67108863,a=Math.imul(Y,me),u=(u=Math.imul(Y,ge))+Math.imul(X,me)|0,c=Math.imul(X,ge),a=a+Math.imul(J,ye)|0,u=(u=u+Math.imul(J,be)|0)+Math.imul($,ye)|0,c=c+Math.imul($,be)|0,a=a+Math.imul(W,_e)|0,u=(u=u+Math.imul(W,Me)|0)+Math.imul(V,_e)|0,c=c+Math.imul(V,Me)|0,a=a+Math.imul(U,ke)|0,u=(u=u+Math.imul(U,Ee)|0)+Math.imul(z,ke)|0,c=c+Math.imul(z,Ee)|0;var He=(p+(a=a+Math.imul(j,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(j,xe)|0)+Math.imul(L,Pe)|0))<<13)|0;p=((c=c+Math.imul(L,xe)|0)+(u>>>13)|0)+(He>>>26)|0,He&=67108863,a=Math.imul(Y,ye),u=(u=Math.imul(Y,be))+Math.imul(X,ye)|0,c=Math.imul(X,be),a=a+Math.imul(J,_e)|0,u=(u=u+Math.imul(J,Me)|0)+Math.imul($,_e)|0,c=c+Math.imul($,Me)|0,a=a+Math.imul(W,ke)|0,u=(u=u+Math.imul(W,Ee)|0)+Math.imul(V,ke)|0,c=c+Math.imul(V,Ee)|0;var We=(p+(a=a+Math.imul(U,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(U,xe)|0)+Math.imul(z,Pe)|0))<<13)|0;p=((c=c+Math.imul(z,xe)|0)+(u>>>13)|0)+(We>>>26)|0,We&=67108863,a=Math.imul(Y,_e),u=(u=Math.imul(Y,Me))+Math.imul(X,_e)|0,c=Math.imul(X,Me),a=a+Math.imul(J,ke)|0,u=(u=u+Math.imul(J,Ee)|0)+Math.imul($,ke)|0,c=c+Math.imul($,Ee)|0;var Ke=(p+(a=a+Math.imul(W,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(W,xe)|0)+Math.imul(V,Pe)|0))<<13)|0;p=((c=c+Math.imul(V,xe)|0)+(u>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,a=Math.imul(Y,ke),u=(u=Math.imul(Y,Ee))+Math.imul(X,ke)|0,c=Math.imul(X,Ee);var Ve=(p+(a=a+Math.imul(J,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(J,xe)|0)+Math.imul($,Pe)|0))<<13)|0;p=((c=c+Math.imul($,xe)|0)+(u>>>13)|0)+(Ve>>>26)|0,Ve&=67108863;var Ge=(p+(a=Math.imul(Y,Pe))|0)+((8191&(u=(u=Math.imul(Y,xe))+Math.imul(X,Pe)|0))<<13)|0;return p=((c=Math.imul(X,xe))+(u>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,d[0]=Te,d[1]=Ie,d[2]=Ne,d[3]=Ae,d[4]=Re,d[5]=Ce,d[6]=Oe,d[7]=De,d[8]=je,d[9]=Le,d[10]=Fe,d[11]=qe,d[12]=Ue,d[13]=ze,d[14]=He,d[15]=We,d[16]=Ke,d[17]=Ve,d[18]=Ge,0!==p&&(d[19]=p,o.length++),o};function jumboMulTo(t,i,o){return(new FFTM).mulp(t,i,o)}function FFTM(t,i){this.x=t,this.y=i}Math.imul||(l=smallMulTo),BN.prototype.mulTo=function mulTo(t,i){var o=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,i):o<63?smallMulTo(this,t,i):o<1024?function bigMulTo(t,i,o){o.negative=i.negative^t.negative,o.length=t.length+i.length;for(var a=0,u=0,c=0;c<o.length-1;c++){var h=u;u=0;for(var l=67108863&a,d=Math.min(c,i.length-1),p=Math.max(0,c-t.length+1);p<=d;p++){var m=c-p,g=(0|t.words[m])*(0|i.words[p]),v=67108863&g;l=67108863&(v=v+l|0),u+=(h=(h=h+(g/67108864|0)|0)+(v>>>26)|0)>>>26,h&=67108863}o.words[c]=l,a=h,h=u}return 0!==a?o.words[c]=a:o.length--,o.strip()}(this,t,i):jumboMulTo(this,t,i)},FFTM.prototype.makeRBT=function makeRBT(t){for(var i=new Array(t),o=BN.prototype._countBits(t)-1,a=0;a<t;a++)i[a]=this.revBin(a,o,t);return i},FFTM.prototype.revBin=function revBin(t,i,o){if(0===t||t===o-1)return t;for(var a=0,u=0;u<i;u++)a|=(1&t)<<i-u-1,t>>=1;return a},FFTM.prototype.permute=function permute(t,i,o,a,u,c){for(var h=0;h<c;h++)a[h]=i[t[h]],u[h]=o[t[h]]},FFTM.prototype.transform=function transform(t,i,o,a,u,c){this.permute(c,t,i,o,a,u);for(var h=1;h<u;h<<=1)for(var l=h<<1,d=Math.cos(2*Math.PI/l),p=Math.sin(2*Math.PI/l),m=0;m<u;m+=l)for(var g=d,v=p,b=0;b<h;b++){var w=o[m+b],_=a[m+b],M=o[m+b+h],k=a[m+b+h],B=g*M-v*k;k=g*k+v*M,M=B,o[m+b]=w+M,a[m+b]=_+k,o[m+b+h]=w-M,a[m+b+h]=_-k,b!==l&&(B=d*g-p*v,v=d*v+p*g,g=B)}},FFTM.prototype.guessLen13b=function guessLen13b(t,i){var o=1|Math.max(i,t),a=1&o,u=0;for(o=o/2|0;o;o>>>=1)u++;return 1<<u+1+a},FFTM.prototype.conjugate=function conjugate(t,i,o){if(!(o<=1))for(var a=0;a<o/2;a++){var u=t[a];t[a]=t[o-a-1],t[o-a-1]=u,u=i[a],i[a]=-i[o-a-1],i[o-a-1]=-u}},FFTM.prototype.normalize13b=function normalize13b(t,i){for(var o=0,a=0;a<i/2;a++){var u=8192*Math.round(t[2*a+1]/i)+Math.round(t[2*a]/i)+o;t[a]=67108863&u,o=u<67108864?0:u/67108864|0}return t},FFTM.prototype.convert13b=function convert13b(t,i,o,a){for(var u=0,c=0;c<i;c++)u+=0|t[c],o[2*c]=8191&u,u>>>=13,o[2*c+1]=8191&u,u>>>=13;for(c=2*i;c<a;++c)o[c]=0;assert(0===u),assert(0==(-8192&u))},FFTM.prototype.stub=function stub(t){for(var i=new Array(t),o=0;o<t;o++)i[o]=0;return i},FFTM.prototype.mulp=function mulp(t,i,o){var a=2*this.guessLen13b(t.length,i.length),u=this.makeRBT(a),c=this.stub(a),h=new Array(a),l=new Array(a),d=new Array(a),p=new Array(a),m=new Array(a),g=new Array(a),v=o.words;v.length=a,this.convert13b(t.words,t.length,h,a),this.convert13b(i.words,i.length,p,a),this.transform(h,c,l,d,a,u),this.transform(p,c,m,g,a,u);for(var b=0;b<a;b++){var w=l[b]*m[b]-d[b]*g[b];d[b]=l[b]*g[b]+d[b]*m[b],l[b]=w}return this.conjugate(l,d,a),this.transform(l,d,v,c,a,u),this.conjugate(v,c,a),this.normalize13b(v,a),o.negative=t.negative^i.negative,o.length=t.length+i.length,o.strip()},BN.prototype.mul=function mul(t){var i=new BN(null);return i.words=new Array(this.length+t.length),this.mulTo(t,i)},BN.prototype.mulf=function mulf(t){var i=new BN(null);return i.words=new Array(this.length+t.length),jumboMulTo(this,t,i)},BN.prototype.imul=function imul(t){return this.clone().mulTo(t,this)},BN.prototype.imuln=function imuln(t){assert("number"==typeof t),assert(t<67108864);for(var i=0,o=0;o<this.length;o++){var a=(0|this.words[o])*t,u=(67108863&a)+(67108863&i);i>>=26,i+=a/67108864|0,i+=u>>>26,this.words[o]=67108863&u}return 0!==i&&(this.words[o]=i,this.length++),this},BN.prototype.muln=function muln(t){return this.clone().imuln(t)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(t){var i=function toBitArray(t){for(var i=new Array(t.bitLength()),o=0;o<i.length;o++){var a=o/26|0,u=o%26;i[o]=(t.words[a]&1<<u)>>>u}return i}(t);if(0===i.length)return new BN(1);for(var o=this,a=0;a<i.length&&0===i[a];a++,o=o.sqr());if(++a<i.length)for(var u=o.sqr();a<i.length;a++,u=u.sqr())0!==i[a]&&(o=o.mul(u));return o},BN.prototype.iushln=function iushln(t){assert("number"==typeof t&&t>=0);var i,o=t%26,a=(t-o)/26,u=67108863>>>26-o<<26-o;if(0!==o){var c=0;for(i=0;i<this.length;i++){var h=this.words[i]&u,l=(0|this.words[i])-h<<o;this.words[i]=l|c,c=h>>>26-o}c&&(this.words[i]=c,this.length++)}if(0!==a){for(i=this.length-1;i>=0;i--)this.words[i+a]=this.words[i];for(i=0;i<a;i++)this.words[i]=0;this.length+=a}return this.strip()},BN.prototype.ishln=function ishln(t){return assert(0===this.negative),this.iushln(t)},BN.prototype.iushrn=function iushrn(t,i,o){var a;assert("number"==typeof t&&t>=0),a=i?(i-i%26)/26:0;var u=t%26,c=Math.min((t-u)/26,this.length),h=67108863^67108863>>>u<<u,l=o;if(a-=c,a=Math.max(0,a),l){for(var d=0;d<c;d++)l.words[d]=this.words[d];l.length=c}if(0===c);else if(this.length>c)for(this.length-=c,d=0;d<this.length;d++)this.words[d]=this.words[d+c];else this.words[0]=0,this.length=1;var p=0;for(d=this.length-1;d>=0&&(0!==p||d>=a);d--){var m=0|this.words[d];this.words[d]=p<<26-u|m>>>u,p=m&h}return l&&0!==p&&(l.words[l.length++]=p),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(t,i,o){return assert(0===this.negative),this.iushrn(t,i,o)},BN.prototype.shln=function shln(t){return this.clone().ishln(t)},BN.prototype.ushln=function ushln(t){return this.clone().iushln(t)},BN.prototype.shrn=function shrn(t){return this.clone().ishrn(t)},BN.prototype.ushrn=function ushrn(t){return this.clone().iushrn(t)},BN.prototype.testn=function testn(t){assert("number"==typeof t&&t>=0);var i=t%26,o=(t-i)/26,a=1<<i;return!(this.length<=o)&&!!(this.words[o]&a)},BN.prototype.imaskn=function imaskn(t){assert("number"==typeof t&&t>=0);var i=t%26,o=(t-i)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==i&&o++,this.length=Math.min(o,this.length),0!==i){var a=67108863^67108863>>>i<<i;this.words[this.length-1]&=a}return this.strip()},BN.prototype.maskn=function maskn(t){return this.clone().imaskn(t)},BN.prototype.iaddn=function iaddn(t){return assert("number"==typeof t),assert(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},BN.prototype._iaddn=function _iaddn(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},BN.prototype.isubn=function isubn(t){if(assert("number"==typeof t),assert(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this.strip()},BN.prototype.addn=function addn(t){return this.clone().iaddn(t)},BN.prototype.subn=function subn(t){return this.clone().isubn(t)},BN.prototype.iabs=function iabs(){return this.negative=0,this},BN.prototype.abs=function abs(){return this.clone().iabs()},BN.prototype._ishlnsubmul=function _ishlnsubmul(t,i,o){var a,u,c=t.length+o;this._expand(c);var h=0;for(a=0;a<t.length;a++){u=(0|this.words[a+o])+h;var l=(0|t.words[a])*i;h=((u-=67108863&l)>>26)-(l/67108864|0),this.words[a+o]=67108863&u}for(;a<this.length-o;a++)h=(u=(0|this.words[a+o])+h)>>26,this.words[a+o]=67108863&u;if(0===h)return this.strip();for(assert(-1===h),h=0,a=0;a<this.length;a++)h=(u=-(0|this.words[a])+h)>>26,this.words[a]=67108863&u;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(t,i){var o=(this.length,t.length),a=this.clone(),u=t,c=0|u.words[u.length-1];0!==(o=26-this._countBits(c))&&(u=u.ushln(o),a.iushln(o),c=0|u.words[u.length-1]);var h,l=a.length-u.length;if("mod"!==i){(h=new BN(null)).length=l+1,h.words=new Array(h.length);for(var d=0;d<h.length;d++)h.words[d]=0}var p=a.clone()._ishlnsubmul(u,1,l);0===p.negative&&(a=p,h&&(h.words[l]=1));for(var m=l-1;m>=0;m--){var g=67108864*(0|a.words[u.length+m])+(0|a.words[u.length+m-1]);for(g=Math.min(g/c|0,67108863),a._ishlnsubmul(u,g,m);0!==a.negative;)g--,a.negative=0,a._ishlnsubmul(u,1,m),a.isZero()||(a.negative^=1);h&&(h.words[m]=g)}return h&&h.strip(),a.strip(),"div"!==i&&0!==o&&a.iushrn(o),{div:h||null,mod:a}},BN.prototype.divmod=function divmod(t,i,o){return assert(!t.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===t.negative?(c=this.neg().divmod(t,i),"mod"!==i&&(a=c.div.neg()),"div"!==i&&(u=c.mod.neg(),o&&0!==u.negative&&u.iadd(t)),{div:a,mod:u}):0===this.negative&&0!==t.negative?(c=this.divmod(t.neg(),i),"mod"!==i&&(a=c.div.neg()),{div:a,mod:c.mod}):0!=(this.negative&t.negative)?(c=this.neg().divmod(t.neg(),i),"div"!==i&&(u=c.mod.neg(),o&&0!==u.negative&&u.isub(t)),{div:c.div,mod:u}):t.length>this.length||this.cmp(t)<0?{div:new BN(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new BN(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new BN(this.modn(t.words[0]))}:this._wordDiv(t,i);var a,u,c},BN.prototype.div=function div(t){return this.divmod(t,"div",!1).div},BN.prototype.mod=function mod(t){return this.divmod(t,"mod",!1).mod},BN.prototype.umod=function umod(t){return this.divmod(t,"mod",!0).mod},BN.prototype.divRound=function divRound(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var o=0!==i.div.negative?i.mod.isub(t):i.mod,a=t.ushrn(1),u=t.andln(1),c=o.cmp(a);return c<0||1===u&&0===c?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},BN.prototype.modn=function modn(t){assert(t<=67108863);for(var i=(1<<26)%t,o=0,a=this.length-1;a>=0;a--)o=(i*o+(0|this.words[a]))%t;return o},BN.prototype.idivn=function idivn(t){assert(t<=67108863);for(var i=0,o=this.length-1;o>=0;o--){var a=(0|this.words[o])+67108864*i;this.words[o]=a/t|0,i=a%t}return this.strip()},BN.prototype.divn=function divn(t){return this.clone().idivn(t)},BN.prototype.egcd=function egcd(t){assert(0===t.negative),assert(!t.isZero());var i=this,o=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var a=new BN(1),u=new BN(0),c=new BN(0),h=new BN(1),l=0;i.isEven()&&o.isEven();)i.iushrn(1),o.iushrn(1),++l;for(var d=o.clone(),p=i.clone();!i.isZero();){for(var m=0,g=1;0==(i.words[0]&g)&&m<26;++m,g<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(p)),a.iushrn(1),u.iushrn(1);for(var v=0,b=1;0==(o.words[0]&b)&&v<26;++v,b<<=1);if(v>0)for(o.iushrn(v);v-- >0;)(c.isOdd()||h.isOdd())&&(c.iadd(d),h.isub(p)),c.iushrn(1),h.iushrn(1);i.cmp(o)>=0?(i.isub(o),a.isub(c),u.isub(h)):(o.isub(i),c.isub(a),h.isub(u))}return{a:c,b:h,gcd:o.iushln(l)}},BN.prototype._invmp=function _invmp(t){assert(0===t.negative),assert(!t.isZero());var i=this,o=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var a,u=new BN(1),c=new BN(0),h=o.clone();i.cmpn(1)>0&&o.cmpn(1)>0;){for(var l=0,d=1;0==(i.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(i.iushrn(l);l-- >0;)u.isOdd()&&u.iadd(h),u.iushrn(1);for(var p=0,m=1;0==(o.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(o.iushrn(p);p-- >0;)c.isOdd()&&c.iadd(h),c.iushrn(1);i.cmp(o)>=0?(i.isub(o),u.isub(c)):(o.isub(i),c.isub(u))}return(a=0===i.cmpn(1)?u:c).cmpn(0)<0&&a.iadd(t),a},BN.prototype.gcd=function gcd(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),o=t.clone();i.negative=0,o.negative=0;for(var a=0;i.isEven()&&o.isEven();a++)i.iushrn(1),o.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;o.isEven();)o.iushrn(1);var u=i.cmp(o);if(u<0){var c=i;i=o,o=c}else if(0===u||0===o.cmpn(1))break;i.isub(o)}return o.iushln(a)},BN.prototype.invm=function invm(t){return this.egcd(t).a.umod(t)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(t){return this.words[0]&t},BN.prototype.bincn=function bincn(t){assert("number"==typeof t);var i=t%26,o=(t-i)/26,a=1<<i;if(this.length<=o)return this._expand(o+1),this.words[o]|=a,this;for(var u=a,c=o;0!==u&&c<this.length;c++){var h=0|this.words[c];u=(h+=u)>>>26,h&=67108863,this.words[c]=h}return 0!==u&&(this.words[c]=u,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(t){var i,o=t<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this.strip(),this.length>1)i=1;else{o&&(t=-t),assert(t<=67108863,"Number is too big");var a=0|this.words[0];i=a===t?0:a<t?-1:1}return 0!==this.negative?0|-i:i},BN.prototype.cmp=function cmp(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var i=this.ucmp(t);return 0!==this.negative?0|-i:i},BN.prototype.ucmp=function ucmp(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,o=this.length-1;o>=0;o--){var a=0|this.words[o],u=0|t.words[o];if(a!==u){a<u?i=-1:a>u&&(i=1);break}}return i},BN.prototype.gtn=function gtn(t){return 1===this.cmpn(t)},BN.prototype.gt=function gt(t){return 1===this.cmp(t)},BN.prototype.gten=function gten(t){return this.cmpn(t)>=0},BN.prototype.gte=function gte(t){return this.cmp(t)>=0},BN.prototype.ltn=function ltn(t){return-1===this.cmpn(t)},BN.prototype.lt=function lt(t){return-1===this.cmp(t)},BN.prototype.lten=function lten(t){return this.cmpn(t)<=0},BN.prototype.lte=function lte(t){return this.cmp(t)<=0},BN.prototype.eqn=function eqn(t){return 0===this.cmpn(t)},BN.prototype.eq=function eq(t){return 0===this.cmp(t)},BN.red=function red(t){return new Red(t)},BN.prototype.toRed=function toRed(t){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(t){return this.red=t,this},BN.prototype.forceRed=function forceRed(t){return assert(!this.red,"Already a number in reduction context"),this._forceRed(t)},BN.prototype.redAdd=function redAdd(t){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},BN.prototype.redIAdd=function redIAdd(t){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},BN.prototype.redSub=function redSub(t){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},BN.prototype.redISub=function redISub(t){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},BN.prototype.redShl=function redShl(t){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},BN.prototype.redMul=function redMul(t){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},BN.prototype.redIMul=function redIMul(t){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(t){return assert(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(t,i){this.name=t,this.p=new BN(i,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(t){if("string"==typeof t){var i=BN._prime(t);this.m=i.p,this.prime=i}else assert(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function Mont(t){Red.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var t=new BN(null);return t.words=new Array(Math.ceil(this.n/13)),t},MPrime.prototype.ireduce=function ireduce(t){var i,o=t;do{this.split(o,this.tmp),i=(o=(o=this.imulK(o)).iadd(this.tmp)).bitLength()}while(i>this.n);var a=i<this.n?-1:o.ucmp(this.p);return 0===a?(o.words[0]=0,o.length=1):a>0?o.isub(this.p):void 0!==o.strip?o.strip():o._strip(),o},MPrime.prototype.split=function split(t,i){t.iushrn(this.n,0,i)},MPrime.prototype.imulK=function imulK(t){return t.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(t,i){for(var o=Math.min(t.length,9),a=0;a<o;a++)i.words[a]=t.words[a];if(i.length=o,t.length<=9)return t.words[0]=0,void(t.length=1);var u=t.words[9];for(i.words[i.length++]=4194303&u,a=10;a<t.length;a++){var c=0|t.words[a];t.words[a-10]=(4194303&c)<<4|u>>>22,u=c}u>>>=22,t.words[a-10]=u,0===u&&t.length>10?t.length-=10:t.length-=9},K256.prototype.imulK=function imulK(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,o=0;o<t.length;o++){var a=0|t.words[o];i+=977*a,t.words[o]=67108863&i,i=64*a+(i/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},inherits(P224,MPrime),inherits(P192,MPrime),inherits(P25519,MPrime),P25519.prototype.imulK=function imulK(t){for(var i=0,o=0;o<t.length;o++){var a=19*(0|t.words[o])+i,u=67108863&a;a>>>=26,t.words[o]=u,i=a}return 0!==i&&(t.words[t.length++]=i),t},BN._prime=function prime(t){if(d[t])return d[t];var prime;if("k256"===t)prime=new K256;else if("p224"===t)prime=new P224;else if("p192"===t)prime=new P192;else{if("p25519"!==t)throw new Error("Unknown prime "+t);prime=new P25519}return d[t]=prime,prime},Red.prototype._verify1=function _verify1(t){assert(0===t.negative,"red works only with positives"),assert(t.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(t,i){assert(0==(t.negative|i.negative),"red works only with positives"),assert(t.red&&t.red===i.red,"red works only with red numbers")},Red.prototype.imod=function imod(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Red.prototype.add=function add(t,i){this._verify2(t,i);var o=t.add(i);return o.cmp(this.m)>=0&&o.isub(this.m),o._forceRed(this)},Red.prototype.iadd=function iadd(t,i){this._verify2(t,i);var o=t.iadd(i);return o.cmp(this.m)>=0&&o.isub(this.m),o},Red.prototype.sub=function sub(t,i){this._verify2(t,i);var o=t.sub(i);return o.cmpn(0)<0&&o.iadd(this.m),o._forceRed(this)},Red.prototype.isub=function isub(t,i){this._verify2(t,i);var o=t.isub(i);return o.cmpn(0)<0&&o.iadd(this.m),o},Red.prototype.shl=function shl(t,i){return this._verify1(t),this.imod(t.ushln(i))},Red.prototype.imul=function imul(t,i){return this._verify2(t,i),this.imod(t.imul(i))},Red.prototype.mul=function mul(t,i){return this._verify2(t,i),this.imod(t.mul(i))},Red.prototype.isqr=function isqr(t){return this.imul(t,t.clone())},Red.prototype.sqr=function sqr(t){return this.mul(t,t)},Red.prototype.sqrt=function sqrt(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(assert(i%2==1),3===i){var o=this.m.add(new BN(1)).iushrn(2);return this.pow(t,o)}for(var a=this.m.subn(1),u=0;!a.isZero()&&0===a.andln(1);)u++,a.iushrn(1);assert(!a.isZero());var c=new BN(1).toRed(this),h=c.redNeg(),l=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,l).cmp(h);)d.redIAdd(h);for(var p=this.pow(d,a),m=this.pow(t,a.addn(1).iushrn(1)),g=this.pow(t,a),v=u;0!==g.cmp(c);){for(var b=g,w=0;0!==b.cmp(c);w++)b=b.redSqr();assert(w<v);var _=this.pow(p,new BN(1).iushln(v-w-1));m=m.redMul(_),p=_.redSqr(),g=g.redMul(p),v=w}return m},Red.prototype.invm=function invm(t){var i=t._invmp(this.m);return 0!==i.negative?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},Red.prototype.pow=function pow(t,i){if(i.isZero())return new BN(1).toRed(this);if(0===i.cmpn(1))return t.clone();var o=new Array(16);o[0]=new BN(1).toRed(this),o[1]=t;for(var a=2;a<o.length;a++)o[a]=this.mul(o[a-1],t);var u=o[0],c=0,h=0,l=i.bitLength()%26;for(0===l&&(l=26),a=i.length-1;a>=0;a--){for(var d=i.words[a],p=l-1;p>=0;p--){var m=d>>p&1;u!==o[0]&&(u=this.sqr(u)),0!==m||0!==c?(c<<=1,c|=m,(4===++h||0===a&&0===p)&&(u=this.mul(u,o[c]),h=0,c=0)):h=0}l=26}return u},Red.prototype.convertTo=function convertTo(t){var i=t.umod(this.m);return i===t?i.clone():i},Red.prototype.convertFrom=function convertFrom(t){var i=t.clone();return i.red=null,i},BN.mont=function mont(t){return new Mont(t)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(t){return this.imod(t.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},Mont.prototype.imul=function imul(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var o=t.imul(i),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=o.isub(a).iushrn(this.shift),c=u;return u.cmp(this.m)>=0?c=u.isub(this.m):u.cmpn(0)<0&&(c=u.iadd(this.m)),c._forceRed(this)},Mont.prototype.mul=function mul(t,i){if(t.isZero()||i.isZero())return new BN(0)._forceRed(this);var o=t.mul(i),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=o.isub(a).iushrn(this.shift),c=u;return u.cmp(this.m)>=0?c=u.isub(this.m):u.cmpn(0)<0&&(c=u.iadd(this.m)),c._forceRed(this)},Mont.prototype.invm=function invm(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,o(60)(t))},function(t,i,o){t.exports=o(533)},function(t,i,o){t.exports=o(235)},function(t,i,o){"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.File=i.Blob=i.FormData=void 0;const a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:window;i.FormData=a.FormData,i.Blob=a.Blob,i.File=a.File},function(t,i){t.exports=function(t,i){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:i}}},function(t,i,o){var a=o(203);t.exports=function(t){return a(t.length)}},function(t,i,o){var a=o(56),u=String;t.exports=function(t){if("Symbol"===a(t))throw TypeError("Cannot convert a Symbol value to a string");return u(t)}},function(t,i,o){var a=o(143),u=o(14),c=o(65),h=o(13)("toStringTag"),l=Object,d="Arguments"==c(function(){return arguments}());t.exports=a?c:function(t){var i,o,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(o=function(t,i){try{return t[i]}catch(t){}}(i=l(t),h))?o:d?c(i):"Object"==(a=c(i))&&u(i.callee)?"Arguments":a}},function(t,i,o){var a=o(143),u=o(34).f,c=o(45),h=o(21),l=o(345),d=o(13)("toStringTag");t.exports=function(t,i,o,p){if(t){var m=o?t:t.prototype;h(m,d)||u(m,d,{configurable:!0,value:i}),p&&!a&&c(m,"toString",l)}}},function(t,i,o){var a,u,c,h=o(210),l=o(12),d=o(9),p=o(20),m=o(45),g=o(21),v=o(139),b=o(113),w=o(92),_=l.TypeError,M=l.WeakMap;if(h||v.state){var k=v.state||(v.state=new M),B=d(k.get),P=d(k.has),x=d(k.set);a=function(t,i){if(P(k,t))throw new _("Object already initialized");return i.facade=t,x(k,t,i),i},u=function(t){return B(k,t)||{}},c=function(t){return P(k,t)}}else{var I=b("state");w[I]=!0,a=function(t,i){if(g(t,I))throw new _("Object already initialized");return i.facade=t,m(t,I,i),i},u=function(t){return g(t,I)?t[I]:{}},c=function(t){return g(t,I)}}t.exports={set:a,get:u,has:c,enforce:function(t){return c(t)?u(t):a(t,{})},getterFor:function(t){return function(i){var o;if(!p(i)||(o=u(i)).type!==t)throw _("Incompatible receiver, "+t+" required");return o}}}},function(t,i,o){o(68);var a=o(370),u=o(12),c=o(56),h=o(45),l=o(80),d=o(13)("toStringTag");for(var p in a){var m=u[p],g=m&&m.prototype;g&&c(g)!==d&&h(g,d,p),l[p]=l.Array}},function(t,i){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,i,o){"use strict";var a=o(44),PromiseCapability=function(t){var i,o;this.promise=new t((function(t,a){if(void 0!==i||void 0!==o)throw TypeError("Bad Promise constructor");i=t,o=a})),this.resolve=a(i),this.reject=a(o)};t.exports.f=function(t){return new PromiseCapability(t)}},function(t,i,o){var a=o(4).Buffer,u=o(681).Transform,c=o(70).StringDecoder;function CipherBase(t){u.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}o(1)(CipherBase,u),CipherBase.prototype.update=function(t,i,o){"string"==typeof t&&(t=a.from(t,i));var u=this._update(t);return this.hashMode?this:(o&&(u=this._toString(u,o)),u)},CipherBase.prototype.setAutoPadding=function(){},CipherBase.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},CipherBase.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},CipherBase.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},CipherBase.prototype._transform=function(t,i,o){var a;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){a=t}finally{o(a)}},CipherBase.prototype._flush=function(t){var i;try{this.push(this.__final())}catch(t){i=t}t(i)},CipherBase.prototype._finalOrDigest=function(t){var i=this.__final()||a.alloc(0);return t&&(i=this._toString(i,t,!0)),i},CipherBase.prototype._toString=function(t,i,o){if(this._decoder||(this._decoder=new c(i),this._encoding=i),this._encoding!==i)throw new Error("can't switch encodings");var a=this._decoder.write(t);return o&&(a+=this._decoder.end()),a},t.exports=CipherBase},function(t,i,o){var a=o(592);t.exports=function get(t,i,o){var u=null==t?void 0:a(t,i);return void 0===u?o:u}},function(t,i,o){var a=o(18),u=o(19),c=o(105),h=o(53),l=o(38),d=o(106),p=o(21),m=o(199),g=Object.getOwnPropertyDescriptor;i.f=a?g:function getOwnPropertyDescriptor(t,i){if(t=l(t),i=d(i),m)try{return g(t,i)}catch(t){}if(p(t,i))return h(!u(c.f,t,i),t[i])}},function(t,i,o){var a=o(9),u=a({}.toString),c=a("".slice);t.exports=function(t){return c(u(t),8,-1)}},function(t,i,o){var a=o(9),u=o(44),c=o(104),h=a(a.bind);t.exports=function(t,i){return u(t),void 0===i?t:c?h(t,i):function(){return t.apply(i,arguments)}}},function(t,i,o){var a=o(66),u=o(9),c=o(137),h=o(40),l=o(54),d=o(147),p=u([].push),createMethod=function(t){var i=1==t,o=2==t,u=3==t,m=4==t,g=6==t,v=7==t,b=5==t||g;return function(w,_,M,k){for(var B,P,x=h(w),I=c(x),N=a(_,M),A=l(I),C=0,O=k||d,j=i?O(w,A):o||v?O(w,0):void 0;A>C;C++)if((b||C in I)&&(P=N(B=I[C],C,x),t))if(i)j[C]=P;else if(P)switch(t){case 3:return!0;case 5:return B;case 6:return C;case 2:p(j,B)}else switch(t){case 4:return!1;case 7:p(j,B)}return g?-1:u||m?m:j}};t.exports={forEach:createMethod(0),map:createMethod(1),filter:createMethod(2),some:createMethod(3),every:createMethod(4),find:createMethod(5),findIndex:createMethod(6),filterReject:createMethod(7)}},function(t,i,o){"use strict";var a=o(38),u=o(149),c=o(80),h=o(58),l=o(34).f,d=o(215),p=o(33),m=o(18),g=h.set,v=h.getterFor("Array Iterator");t.exports=d(Array,"Array",(function(t,i){g(this,{type:"Array Iterator",target:a(t),index:0,kind:i})}),(function(){var t=v(this),i=t.target,o=t.kind,a=t.index++;return!i||a>=i.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==o?{value:a,done:!1}:"values"==o?{value:i[a],done:!1}:{value:[a,i[a]],done:!1}}),"values");var b=c.Arguments=c.Array;if(u("keys"),u("values"),u("entries"),!p&&m&&"values"!==b.name)try{l(b,"name",{value:"values"})}catch(t){}},function(t,i,o){var a=o(66),u=o(19),c=o(28),h=o(76),l=o(231),d=o(54),p=o(25),m=o(153),g=o(96),v=o(230),b=TypeError,Result=function(t,i){this.stopped=t,this.result=i},w=Result.prototype;t.exports=function(t,i,o){var _,M,k,B,P,x,I,N=o&&o.that,A=!(!o||!o.AS_ENTRIES),C=!(!o||!o.IS_RECORD),O=!(!o||!o.IS_ITERATOR),j=!(!o||!o.INTERRUPTED),L=a(i,N),stop=function(t){return _&&v(_,"normal",t),new Result(!0,t)},callFn=function(t){return A?(c(t),j?L(t[0],t[1],stop):L(t[0],t[1])):j?L(t,stop):L(t)};if(C)_=t.iterator;else if(O)_=t;else{if(!(M=g(t)))throw b(h(t)+" is not iterable");if(l(M)){for(k=0,B=d(t);B>k;k++)if((P=callFn(t[k]))&&p(w,P))return P;return new Result(!1)}_=m(t,M)}for(x=C?t.next:_.next;!(I=u(x,_)).done;){try{P=callFn(I.value)}catch(t){v(_,"throw",t)}if("object"==typeof P&&P&&p(w,P))return P}return new Result(!1)}},function(t,i,o){"use strict";var a=o(4).Buffer,u=a.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function StringDecoder(t){var i;switch(this.encoding=function normalizeEncoding(t){var i=function _normalizeEncoding(t){if(!t)return"utf8";for(var i;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(i)return;t=(""+t).toLowerCase(),i=!0}}(t);if("string"!=typeof i&&(a.isEncoding===u||!u(t)))throw new Error("Unknown encoding: "+t);return i||t}(t),this.encoding){case"utf16le":this.text=utf16Text,this.end=utf16End,i=4;break;case"utf8":this.fillLast=utf8FillLast,i=4;break;case"base64":this.text=base64Text,this.end=base64End,i=3;break;default:return this.write=simpleWrite,void(this.end=simpleEnd)}this.lastNeed=0,this.lastTotal=0,this.lastChar=a.allocUnsafe(i)}function utf8CheckByte(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function utf8FillLast(t){var i=this.lastTotal-this.lastNeed,o=function utf8CheckExtraBytes(t,i,o){if(128!=(192&i[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&i.length>1){if(128!=(192&i[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&i.length>2&&128!=(192&i[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==o?o:this.lastNeed<=t.length?(t.copy(this.lastChar,i,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,i,0,t.length),void(this.lastNeed-=t.length))}function utf16Text(t,i){if((t.length-i)%2==0){var o=t.toString("utf16le",i);if(o){var a=o.charCodeAt(o.length-1);if(a>=55296&&a<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],o.slice(0,-1)}return o}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",i,t.length-1)}function utf16End(t){var i=t&&t.length?this.write(t):"";if(this.lastNeed){var o=this.lastTotal-this.lastNeed;return i+this.lastChar.toString("utf16le",0,o)}return i}function base64Text(t,i){var o=(t.length-i)%3;return 0===o?t.toString("base64",i):(this.lastNeed=3-o,this.lastTotal=3,1===o?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",i,t.length-o))}function base64End(t){var i=t&&t.length?this.write(t):"";return this.lastNeed?i+this.lastChar.toString("base64",0,3-this.lastNeed):i}function simpleWrite(t){return t.toString(this.encoding)}function simpleEnd(t){return t&&t.length?this.write(t):""}i.StringDecoder=StringDecoder,StringDecoder.prototype.write=function(t){if(0===t.length)return"";var i,o;if(this.lastNeed){if(void 0===(i=this.fillLast(t)))return"";o=this.lastNeed,this.lastNeed=0}else o=0;return o<t.length?i?i+this.text(t,o):this.text(t,o):i||""},StringDecoder.prototype.end=function utf8End(t){var i=t&&t.length?this.write(t):"";return this.lastNeed?i+"�":i},StringDecoder.prototype.text=function utf8Text(t,i){var o=function utf8CheckIncomplete(t,i,o){var a=i.length-1;if(a<o)return 0;var u=utf8CheckByte(i[a]);if(u>=0)return u>0&&(t.lastNeed=u-1),u;if(--a<o||-2===u)return 0;if((u=utf8CheckByte(i[a]))>=0)return u>0&&(t.lastNeed=u-2),u;if(--a<o||-2===u)return 0;if((u=utf8CheckByte(i[a]))>=0)return u>0&&(2===u?u=0:t.lastNeed=u-3),u;return 0}(this,t,i);if(!this.lastNeed)return t.toString("utf8",i);this.lastTotal=o;var a=t.length-(o-this.lastNeed);return t.copy(this.lastChar,0,a),t.toString("utf8",i,a)},StringDecoder.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,i,o){(function(a){i.formatArgs=function formatArgs(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const o="color: "+this.color;i.splice(1,0,o,"color: inherit");let a=0,u=0;i[0].replace(/%[a-zA-Z%]/g,t=>{"%%"!==t&&(a++,"%c"===t&&(u=a))}),i.splice(u,0,o)},i.save=function save(t){try{t?i.storage.setItem("debug",t):i.storage.removeItem("debug")}catch(t){}},i.load=function load(){let t;try{t=i.storage.getItem("debug")}catch(t){}!t&&void 0!==a&&"env"in a&&(t=a.env.DEBUG);return t},i.useColors=function useColors(){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+)/)},i.storage=function localstorage(){try{return localStorage}catch(t){}}(),i.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),i.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"],i.log=console.debug||console.log||(()=>{}),t.exports=o(663)(i);const{formatters:u}=t.exports;u.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this,o(11))},function(t,i,o){"use strict";var a=o(48),u=Object.keys||function(t){var i=[];for(var o in t)i.push(o);return i};t.exports=Duplex;var c=Object.create(o(41));c.inherits=o(1);var h=o(272),l=o(175);c.inherits(Duplex,h);for(var d=u(l.prototype),p=0;p<d.length;p++){var m=d[p];Duplex.prototype[m]||(Duplex.prototype[m]=l.prototype[m])}function Duplex(t){if(!(this instanceof Duplex))return new Duplex(t);h.call(this,t),l.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",onend)}function onend(){this.allowHalfOpen||this._writableState.ended||a.nextTick(onEndNT,this)}function onEndNT(t){t.end()}Object.defineProperty(Duplex.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(Duplex.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),Duplex.prototype._destroy=function(t,i){this.push(null),this.end(),a.nextTick(i,t)}},function(t,i,o){t.exports=o(542)},function(t,i,o){"use strict";const a={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};a.localCName=a.generateIdentifier(),a.splitLines=function(t){return t.trim().split("\n").map(t=>t.trim())},a.splitSections=function(t){return t.split("\nm=").map((t,i)=>(i>0?"m="+t:t).trim()+"\r\n")},a.getDescription=function(t){const i=a.splitSections(t);return i&&i[0]},a.getMediaSections=function(t){const i=a.splitSections(t);return i.shift(),i},a.matchPrefix=function(t,i){return a.splitLines(t).filter(t=>0===t.indexOf(i))},a.parseCandidate=function(t){let i;i=0===t.indexOf("a=candidate:")?t.substring(12).split(" "):t.substring(10).split(" ");const o={foundation:i[0],component:{1:"rtp",2:"rtcp"}[i[1]]||i[1],protocol:i[2].toLowerCase(),priority:parseInt(i[3],10),ip:i[4],address:i[4],port:parseInt(i[5],10),type:i[7]};for(let t=8;t<i.length;t+=2)switch(i[t]){case"raddr":o.relatedAddress=i[t+1];break;case"rport":o.relatedPort=parseInt(i[t+1],10);break;case"tcptype":o.tcpType=i[t+1];break;case"ufrag":o.ufrag=i[t+1],o.usernameFragment=i[t+1];break;default:void 0===o[i[t]]&&(o[i[t]]=i[t+1])}return o},a.writeCandidate=function(t){const i=[];i.push(t.foundation);const o=t.component;"rtp"===o?i.push(1):"rtcp"===o?i.push(2):i.push(o),i.push(t.protocol.toUpperCase()),i.push(t.priority),i.push(t.address||t.ip),i.push(t.port);const a=t.type;return i.push("typ"),i.push(a),"host"!==a&&t.relatedAddress&&t.relatedPort&&(i.push("raddr"),i.push(t.relatedAddress),i.push("rport"),i.push(t.relatedPort)),t.tcpType&&"tcp"===t.protocol.toLowerCase()&&(i.push("tcptype"),i.push(t.tcpType)),(t.usernameFragment||t.ufrag)&&(i.push("ufrag"),i.push(t.usernameFragment||t.ufrag)),"candidate:"+i.join(" ")},a.parseIceOptions=function(t){return t.substr(14).split(" ")},a.parseRtpMap=function(t){let i=t.substr(9).split(" ");const o={payloadType:parseInt(i.shift(),10)};return i=i[0].split("/"),o.name=i[0],o.clockRate=parseInt(i[1],10),o.channels=3===i.length?parseInt(i[2],10):1,o.numChannels=o.channels,o},a.writeRtpMap=function(t){let i=t.payloadType;void 0!==t.preferredPayloadType&&(i=t.preferredPayloadType);const o=t.channels||t.numChannels||1;return"a=rtpmap:"+i+" "+t.name+"/"+t.clockRate+(1!==o?"/"+o:"")+"\r\n"},a.parseExtmap=function(t){const i=t.substr(9).split(" ");return{id:parseInt(i[0],10),direction:i[0].indexOf("/")>0?i[0].split("/")[1]:"sendrecv",uri:i[1]}},a.writeExtmap=function(t){return"a=extmap:"+(t.id||t.preferredId)+(t.direction&&"sendrecv"!==t.direction?"/"+t.direction:"")+" "+t.uri+"\r\n"},a.parseFmtp=function(t){const i={};let o;const a=t.substr(t.indexOf(" ")+1).split(";");for(let t=0;t<a.length;t++)o=a[t].trim().split("="),i[o[0].trim()]=o[1];return i},a.writeFmtp=function(t){let i="",o=t.payloadType;if(void 0!==t.preferredPayloadType&&(o=t.preferredPayloadType),t.parameters&&Object.keys(t.parameters).length){const a=[];Object.keys(t.parameters).forEach(i=>{void 0!==t.parameters[i]?a.push(i+"="+t.parameters[i]):a.push(i)}),i+="a=fmtp:"+o+" "+a.join(";")+"\r\n"}return i},a.parseRtcpFb=function(t){const i=t.substr(t.indexOf(" ")+1).split(" ");return{type:i.shift(),parameter:i.join(" ")}},a.writeRtcpFb=function(t){let i="",o=t.payloadType;return void 0!==t.preferredPayloadType&&(o=t.preferredPayloadType),t.rtcpFeedback&&t.rtcpFeedback.length&&t.rtcpFeedback.forEach(t=>{i+="a=rtcp-fb:"+o+" "+t.type+(t.parameter&&t.parameter.length?" "+t.parameter:"")+"\r\n"}),i},a.parseSsrcMedia=function(t){const i=t.indexOf(" "),o={ssrc:parseInt(t.substr(7,i-7),10)},a=t.indexOf(":",i);return a>-1?(o.attribute=t.substr(i+1,a-i-1),o.value=t.substr(a+1)):o.attribute=t.substr(i+1),o},a.parseSsrcGroup=function(t){const i=t.substr(13).split(" ");return{semantics:i.shift(),ssrcs:i.map(t=>parseInt(t,10))}},a.getMid=function(t){const i=a.matchPrefix(t,"a=mid:")[0];if(i)return i.substr(6)},a.parseFingerprint=function(t){const i=t.substr(14).split(" ");return{algorithm:i[0].toLowerCase(),value:i[1].toUpperCase()}},a.getDtlsParameters=function(t,i){return{role:"auto",fingerprints:a.matchPrefix(t+i,"a=fingerprint:").map(a.parseFingerprint)}},a.writeDtlsParameters=function(t,i){let o="a=setup:"+i+"\r\n";return t.fingerprints.forEach(t=>{o+="a=fingerprint:"+t.algorithm+" "+t.value+"\r\n"}),o},a.parseCryptoLine=function(t){const i=t.substr(9).split(" ");return{tag:parseInt(i[0],10),cryptoSuite:i[1],keyParams:i[2],sessionParams:i.slice(3)}},a.writeCryptoLine=function(t){return"a=crypto:"+t.tag+" "+t.cryptoSuite+" "+("object"==typeof t.keyParams?a.writeCryptoKeyParams(t.keyParams):t.keyParams)+(t.sessionParams?" "+t.sessionParams.join(" "):"")+"\r\n"},a.parseCryptoKeyParams=function(t){if(0!==t.indexOf("inline:"))return null;const i=t.substr(7).split("|");return{keyMethod:"inline",keySalt:i[0],lifeTime:i[1],mkiValue:i[2]?i[2].split(":")[0]:void 0,mkiLength:i[2]?i[2].split(":")[1]:void 0}},a.writeCryptoKeyParams=function(t){return t.keyMethod+":"+t.keySalt+(t.lifeTime?"|"+t.lifeTime:"")+(t.mkiValue&&t.mkiLength?"|"+t.mkiValue+":"+t.mkiLength:"")},a.getCryptoParameters=function(t,i){return a.matchPrefix(t+i,"a=crypto:").map(a.parseCryptoLine)},a.getIceParameters=function(t,i){const o=a.matchPrefix(t+i,"a=ice-ufrag:")[0],u=a.matchPrefix(t+i,"a=ice-pwd:")[0];return o&&u?{usernameFragment:o.substr(12),password:u.substr(10)}:null},a.writeIceParameters=function(t){let i="a=ice-ufrag:"+t.usernameFragment+"\r\na=ice-pwd:"+t.password+"\r\n";return t.iceLite&&(i+="a=ice-lite\r\n"),i},a.parseRtpParameters=function(t){const i={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},o=a.splitLines(t)[0].split(" ");for(let u=3;u<o.length;u++){const c=o[u],h=a.matchPrefix(t,"a=rtpmap:"+c+" ")[0];if(h){const o=a.parseRtpMap(h),u=a.matchPrefix(t,"a=fmtp:"+c+" ");switch(o.parameters=u.length?a.parseFmtp(u[0]):{},o.rtcpFeedback=a.matchPrefix(t,"a=rtcp-fb:"+c+" ").map(a.parseRtcpFb),i.codecs.push(o),o.name.toUpperCase()){case"RED":case"ULPFEC":i.fecMechanisms.push(o.name.toUpperCase())}}}return a.matchPrefix(t,"a=extmap:").forEach(t=>{i.headerExtensions.push(a.parseExtmap(t))}),i},a.writeRtpDescription=function(t,i){let o="";o+="m="+t+" ",o+=i.codecs.length>0?"9":"0",o+=" UDP/TLS/RTP/SAVPF ",o+=i.codecs.map(t=>void 0!==t.preferredPayloadType?t.preferredPayloadType:t.payloadType).join(" ")+"\r\n",o+="c=IN IP4 0.0.0.0\r\n",o+="a=rtcp:9 IN IP4 0.0.0.0\r\n",i.codecs.forEach(t=>{o+=a.writeRtpMap(t),o+=a.writeFmtp(t),o+=a.writeRtcpFb(t)});let u=0;return i.codecs.forEach(t=>{t.maxptime>u&&(u=t.maxptime)}),u>0&&(o+="a=maxptime:"+u+"\r\n"),i.headerExtensions&&i.headerExtensions.forEach(t=>{o+=a.writeExtmap(t)}),o},a.parseRtpEncodingParameters=function(t){const i=[],o=a.parseRtpParameters(t),u=-1!==o.fecMechanisms.indexOf("RED"),c=-1!==o.fecMechanisms.indexOf("ULPFEC"),h=a.matchPrefix(t,"a=ssrc:").map(t=>a.parseSsrcMedia(t)).filter(t=>"cname"===t.attribute),l=h.length>0&&h[0].ssrc;let d;const p=a.matchPrefix(t,"a=ssrc-group:FID").map(t=>t.substr(17).split(" ").map(t=>parseInt(t,10)));p.length>0&&p[0].length>1&&p[0][0]===l&&(d=p[0][1]),o.codecs.forEach(t=>{if("RTX"===t.name.toUpperCase()&&t.parameters.apt){let o={ssrc:l,codecPayloadType:parseInt(t.parameters.apt,10)};l&&d&&(o.rtx={ssrc:d}),i.push(o),u&&(o=JSON.parse(JSON.stringify(o)),o.fec={ssrc:l,mechanism:c?"red+ulpfec":"red"},i.push(o))}}),0===i.length&&l&&i.push({ssrc:l});let m=a.matchPrefix(t,"b=");return m.length&&(m=0===m[0].indexOf("b=TIAS:")?parseInt(m[0].substr(7),10):0===m[0].indexOf("b=AS:")?1e3*parseInt(m[0].substr(5),10)*.95-16e3:void 0,i.forEach(t=>{t.maxBitrate=m})),i},a.parseRtcpParameters=function(t){const i={},o=a.matchPrefix(t,"a=ssrc:").map(t=>a.parseSsrcMedia(t)).filter(t=>"cname"===t.attribute)[0];o&&(i.cname=o.value,i.ssrc=o.ssrc);const u=a.matchPrefix(t,"a=rtcp-rsize");i.reducedSize=u.length>0,i.compound=0===u.length;const c=a.matchPrefix(t,"a=rtcp-mux");return i.mux=c.length>0,i},a.writeRtcpParameters=function(t){let i="";return t.reducedSize&&(i+="a=rtcp-rsize\r\n"),t.mux&&(i+="a=rtcp-mux\r\n"),void 0!==t.ssrc&&t.cname&&(i+="a=ssrc:"+t.ssrc+" cname:"+t.cname+"\r\n"),i},a.parseMsid=function(t){let i;const o=a.matchPrefix(t,"a=msid:");if(1===o.length)return i=o[0].substr(7).split(" "),{stream:i[0],track:i[1]};const u=a.matchPrefix(t,"a=ssrc:").map(t=>a.parseSsrcMedia(t)).filter(t=>"msid"===t.attribute);return u.length>0?(i=u[0].value.split(" "),{stream:i[0],track:i[1]}):void 0},a.parseSctpDescription=function(t){const i=a.parseMLine(t),o=a.matchPrefix(t,"a=max-message-size:");let u;o.length>0&&(u=parseInt(o[0].substr(19),10)),isNaN(u)&&(u=65536);const c=a.matchPrefix(t,"a=sctp-port:");if(c.length>0)return{port:parseInt(c[0].substr(12),10),protocol:i.fmt,maxMessageSize:u};const h=a.matchPrefix(t,"a=sctpmap:");if(h.length>0){const t=h[0].substr(10).split(" ");return{port:parseInt(t[0],10),protocol:t[1],maxMessageSize:u}}},a.writeSctpDescription=function(t,i){let o=[];return o="DTLS/SCTP"!==t.protocol?["m="+t.kind+" 9 "+t.protocol+" "+i.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+i.port+"\r\n"]:["m="+t.kind+" 9 "+t.protocol+" "+i.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+i.port+" "+i.protocol+" 65535\r\n"],void 0!==i.maxMessageSize&&o.push("a=max-message-size:"+i.maxMessageSize+"\r\n"),o.join("")},a.generateSessionId=function(){return Math.random().toString().substr(2,21)},a.writeSessionBoilerplate=function(t,i,o){let u;const c=void 0!==i?i:2;u=t||a.generateSessionId();return"v=0\r\no="+(o||"thisisadapterortc")+" "+u+" "+c+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},a.getDirection=function(t,i){const o=a.splitLines(t);for(let t=0;t<o.length;t++)switch(o[t]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return o[t].substr(2)}return i?a.getDirection(i):"sendrecv"},a.getKind=function(t){return a.splitLines(t)[0].split(" ")[0].substr(2)},a.isRejected=function(t){return"0"===t.split(" ",2)[1]},a.parseMLine=function(t){const i=a.splitLines(t)[0].substr(2).split(" ");return{kind:i[0],port:parseInt(i[1],10),protocol:i[2],fmt:i.slice(3).join(" ")}},a.parseOLine=function(t){const i=a.matchPrefix(t,"o=")[0].substr(2).split(" ");return{username:i[0],sessionId:i[1],sessionVersion:parseInt(i[2],10),netType:i[3],addressType:i[4],address:i[5]}},a.isValidSDP=function(t){if("string"!=typeof t||0===t.length)return!1;const i=a.splitLines(t);for(let t=0;t<i.length;t++)if(i[t].length<2||"="!==i[t].charAt(1))return!1;return!0},t.exports=a},function(t,i,o){var a=o(108),u=o(8);t.exports=!!Object.getOwnPropertySymbols&&!u((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&a&&a<41}))},function(t,i){var o=String;t.exports=function(t){try{return o(t)}catch(t){return"Object"}}},function(t,i,o){var a,u=o(28),c=o(144),h=o(142),l=o(92),d=o(206),p=o(140),m=o(113),g=m("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(t){return"<script>"+t+"<\/script>"},NullProtoObjectViaActiveX=function(t){t.write(scriptTag("")),t.close();var i=t.parentWindow.Object;return t=null,i},NullProtoObject=function(){try{a=new ActiveXObject("htmlfile")}catch(t){}var t,i;NullProtoObject="undefined"!=typeof document?document.domain&&a?NullProtoObjectViaActiveX(a):((i=p("iframe")).style.display="none",d.appendChild(i),i.src=String("javascript:"),(t=i.contentWindow.document).open(),t.write(scriptTag("document.F=Object")),t.close(),t.F):NullProtoObjectViaActiveX(a);for(var o=h.length;o--;)delete NullProtoObject.prototype[h[o]];return NullProtoObject()};l[g]=!0,t.exports=Object.create||function create(t,i){var o;return null!==t?(EmptyConstructor.prototype=u(t),o=new EmptyConstructor,EmptyConstructor.prototype=null,o[g]=t):o=NullProtoObject(),void 0===i?o:c.f(o,i)}},function(t,i,o){"use strict";var a=o(106),u=o(34),c=o(53);t.exports=function(t,i,o){var h=a(i);h in t?u.f(t,h,c(0,o)):t[h]=o}},function(t,i,o){var a=o(65);t.exports=Array.isArray||function isArray(t){return"Array"==a(t)}},function(t,i){t.exports={}},function(t,i){t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},function(t,i,o){var a=o(12);t.exports=a.Promise},function(t,i,o){"use strict";var a={};function createErrorType(t,i,o){o||(o=Error);var u=function(t){function NodeError(o,a,u){return t.call(this,function getMessage(t,o,a){return"string"==typeof i?i:i(t,o,a)}(o,a,u))||this}return function _inheritsLoose(t,i){t.prototype=Object.create(i.prototype),t.prototype.constructor=t,t.__proto__=i}(NodeError,t),NodeError}(o);u.prototype.name=o.name,u.prototype.code=t,a[t]=u}function oneOf(t,i){if(Array.isArray(t)){var o=t.length;return t=t.map((function(t){return String(t)})),o>2?"one of ".concat(i," ").concat(t.slice(0,o-1).join(", "),", or ")+t[o-1]:2===o?"one of ".concat(i," ").concat(t[0]," or ").concat(t[1]):"of ".concat(i," ").concat(t[0])}return"of ".concat(i," ").concat(String(t))}createErrorType("ERR_INVALID_OPT_VALUE",(function(t,i){return'The value "'+i+'" is invalid for option "'+t+'"'}),TypeError),createErrorType("ERR_INVALID_ARG_TYPE",(function(t,i,o){var a,u;if("string"==typeof i&&function startsWith(t,i,o){return t.substr(!o||o<0?0:+o,i.length)===i}(i,"not ")?(a="must not be",i=i.replace(/^not /,"")):a="must be",function endsWith(t,i,o){return(void 0===o||o>t.length)&&(o=t.length),t.substring(o-i.length,o)===i}(t," argument"))u="The ".concat(t," ").concat(a," ").concat(oneOf(i,"type"));else{var c=function includes(t,i,o){return"number"!=typeof o&&(o=0),!(o+i.length>t.length)&&-1!==t.indexOf(i,o)}(t,".")?"property":"argument";u='The "'.concat(t,'" ').concat(c," ").concat(a," ").concat(oneOf(i,"type"))}return u+=". Received type ".concat(typeof o)}),TypeError),createErrorType("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),createErrorType("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),createErrorType("ERR_STREAM_PREMATURE_CLOSE","Premature close"),createErrorType("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),createErrorType("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),createErrorType("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),createErrorType("ERR_STREAM_WRITE_AFTER_END","write after end"),createErrorType("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),createErrorType("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),createErrorType("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=a},function(t,i,o){"use strict";(function(i){var a=Object.keys||function(t){var i=[];for(var o in t)i.push(o);return i};t.exports=Duplex;var u=o(255),c=o(259);o(1)(Duplex,u);for(var h=a(c.prototype),l=0;l<h.length;l++){var d=h[l];Duplex.prototype[d]||(Duplex.prototype[d]=c.prototype[d])}function Duplex(t){if(!(this instanceof Duplex))return new Duplex(t);u.call(this,t),c.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",onend)))}function onend(){this._writableState.ended||i.nextTick(onEndNT,this)}function onEndNT(t){t.end()}Object.defineProperty(Duplex.prototype,"writableHighWaterMark",{enumerable:!1,get:function get(){return this._writableState.highWaterMark}}),Object.defineProperty(Duplex.prototype,"writableBuffer",{enumerable:!1,get:function get(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Duplex.prototype,"writableLength",{enumerable:!1,get:function get(){return this._writableState.length}}),Object.defineProperty(Duplex.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function set(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})}).call(this,o(11))},function(t,i,o){"use strict";(function(i,a){var u=o(4).Buffer,c=i.crypto||i.msCrypto;c&&c.getRandomValues?t.exports=function randomBytes(t,i){if(t>4294967295)throw new RangeError("requested too many random bytes");var o=u.allocUnsafe(t);if(t>0)if(t>65536)for(var h=0;h<t;h+=65536)c.getRandomValues(o.slice(h,h+65536));else c.getRandomValues(o);if("function"==typeof i)return a.nextTick((function(){i(null,o)}));return o}:t.exports=function oldBrowser(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,o(17),o(11))},function(t,i,o){var a=o(4).Buffer;function Hash(t,i){this._block=a.alloc(t),this._finalSize=i,this._blockSize=t,this._len=0}Hash.prototype.update=function(t,i){"string"==typeof t&&(i=i||"utf8",t=a.from(t,i));for(var o=this._block,u=this._blockSize,c=t.length,h=this._len,l=0;l<c;){for(var d=h%u,p=Math.min(c-l,u-d),m=0;m<p;m++)o[d+m]=t[l+m];l+=p,(h+=p)%u==0&&this._update(o)}return this._len+=c,this},Hash.prototype.digest=function(t){var i=this._len%this._blockSize;this._block[i]=128,this._block.fill(0,i+1),i>=this._finalSize&&(this._update(this._block),this._block.fill(0));var o=8*this._len;if(o<=4294967295)this._block.writeUInt32BE(o,this._blockSize-4);else{var a=(4294967295&o)>>>0,u=(o-a)/4294967296;this._block.writeUInt32BE(u,this._blockSize-8),this._block.writeUInt32BE(a,this._blockSize-4)}this._update(this._block);var c=this._hash();return t?c.toString(t):c},Hash.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=Hash},function(t,i,o){"use strict";var a=o(48),u=Object.keys||function(t){var i=[];for(var o in t)i.push(o);return i};t.exports=Duplex;var c=Object.create(o(41));c.inherits=o(1);var h=o(312),l=o(315);c.inherits(Duplex,h);for(var d=u(l.prototype),p=0;p<d.length;p++){var m=d[p];Duplex.prototype[m]||(Duplex.prototype[m]=l.prototype[m])}function Duplex(t){if(!(this instanceof Duplex))return new Duplex(t);h.call(this,t),l.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",onend)}function onend(){this.allowHalfOpen||this._writableState.ended||a.nextTick(onEndNT,this)}function onEndNT(t){t.end()}Object.defineProperty(Duplex.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(Duplex.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),Duplex.prototype._destroy=function(t,i){this.push(null),this.end(),a.nextTick(i,t)}},function(t,i,o){var a=o(234);function asyncGeneratorStep(t,i,o,u,c,h,l){try{var d=t[h](l),p=d.value}catch(t){return void o(t)}d.done?i(p):a.resolve(p).then(u,c)}t.exports=function _asyncToGenerator(t){return function(){var i=this,o=arguments;return new a((function(a,u){var c=t.apply(i,o);function _next(t){asyncGeneratorStep(c,a,u,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(c,a,u,_next,_throw,"throw",t)}_next(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i){var o=TypeError;t.exports=function(t){if(null==t)throw o("Can't call method on "+t);return t}},function(t,i,o){var a=o(33),u=o(139);(t.exports=function(t,i){return u[t]||(u[t]=void 0!==i?i:{})})("versions",[]).push({version:"3.24.1",mode:a?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.24.1/LICENSE",source:"https://github.com/zloirock/core-js"})},function(t,i,o){var a=o(202),u=o(142);t.exports=Object.keys||function keys(t){return a(t,u)}},function(t,i){t.exports={}},function(t,i,o){var a=o(8),u=o(13),c=o(108),h=u("species");t.exports=function(t){return c>=51||!a((function(){var i=[];return(i.constructor={})[h]=function(){return{foo:1}},1!==i[t](Boolean).foo}))}},function(t,i,o){t.exports=o(410)},function(t,i){},function(t,i,o){var a=o(56),u=o(138),c=o(80),h=o(13)("iterator");t.exports=function(t){if(null!=t)return u(t,h)||u(t,"@@iterator")||c[a(t)]}},function(t,i,o){var a=o(12),u=o(82),c=o(14),h=o(200),l=o(146),d=o(13),p=o(492),m=o(241),g=o(33),v=o(108),b=u&&u.prototype,w=d("species"),_=!1,M=c(a.PromiseRejectionEvent),k=h("Promise",(function(){var t=l(u),i=t!==String(u);if(!i&&66===v)return!0;if(g&&(!b.catch||!b.finally))return!0;if(!v||v<51||!/native code/.test(t)){var o=new u((function(t){t(1)})),FakePromise=function(t){t((function(){}),(function(){}))};if((o.constructor={})[w]=FakePromise,!(_=o.then((function(){}))instanceof FakePromise))return!0}return!i&&(p||m)&&!M}));t.exports={CONSTRUCTOR:k,REJECTION_EVENT:M,SUBCLASSING:_}},function(t,i,o){"use strict";var a=o(1),u=o(171),c=o(172),h=o(173),l=o(62);function Hash(t){l.call(this,"digest"),this._hash=t}a(Hash,l),Hash.prototype._update=function(t){this._hash.update(t)},Hash.prototype._final=function(){return this._hash.digest()},t.exports=function createHash(t){return"md5"===(t=t.toLowerCase())?new u:"rmd160"===t||"ripemd160"===t?new c:new Hash(h(t))}},function(t,i,o){(function(i){t.exports=function xor(t,o){for(var a=Math.min(t.length,o.length),u=new i(a),c=0;c<a;++c)u[c]=t[c]^o[c];return u}}).call(this,o(10).Buffer)},function(t,i,o){"use strict";var a=o(42),u=o(35);function BlockHash(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}i.BlockHash=BlockHash,BlockHash.prototype.update=function update(t,i){if(t=a.toArray(t,i),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var o=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-o,t.length),0===this.pending.length&&(this.pending=null),t=a.join32(t,0,t.length-o,this.endian);for(var u=0;u<t.length;u+=this._delta32)this._update(t,u,u+this._delta32)}return this},BlockHash.prototype.digest=function digest(t){return this.update(this._pad()),u(null===this.pending),this._digest(t)},BlockHash.prototype._pad=function pad(){var t=this.pendingTotal,i=this._delta8,o=i-(t+this.padLength)%i,a=new Array(o+this.padLength);a[0]=128;for(var u=1;u<o;u++)a[u]=0;if(t<<=3,"big"===this.endian){for(var c=8;c<this.padLength;c++)a[u++]=0;a[u++]=0,a[u++]=0,a[u++]=0,a[u++]=0,a[u++]=t>>>24&255,a[u++]=t>>>16&255,a[u++]=t>>>8&255,a[u++]=255&t}else for(a[u++]=255&t,a[u++]=t>>>8&255,a[u++]=t>>>16&255,a[u++]=t>>>24&255,a[u++]=0,a[u++]=0,a[u++]=0,a[u++]=0,c=8;c<this.padLength;c++)a[u++]=0;return a}},function(t,i,o){"use strict";const a=o(1),u=o(188).Reporter,c=o(186).Buffer;function DecoderBuffer(t,i){u.call(this,i),c.isBuffer(t)?(this.base=t,this.offset=0,this.length=t.length):this.error("Input not Buffer")}function EncoderBuffer(t,i){if(Array.isArray(t))this.length=0,this.value=t.map((function(t){return EncoderBuffer.isEncoderBuffer(t)||(t=new EncoderBuffer(t,i)),this.length+=t.length,t}),this);else if("number"==typeof t){if(!(0<=t&&t<=255))return i.error("non-byte EncoderBuffer value");this.value=t,this.length=1}else if("string"==typeof t)this.value=t,this.length=c.byteLength(t);else{if(!c.isBuffer(t))return i.error("Unsupported type: "+typeof t);this.value=t,this.length=t.length}}a(DecoderBuffer,u),i.DecoderBuffer=DecoderBuffer,DecoderBuffer.isDecoderBuffer=function isDecoderBuffer(t){if(t instanceof DecoderBuffer)return!0;return"object"==typeof t&&c.isBuffer(t.base)&&"DecoderBuffer"===t.constructor.name&&"number"==typeof t.offset&&"number"==typeof t.length&&"function"==typeof t.save&&"function"==typeof t.restore&&"function"==typeof t.isEmpty&&"function"==typeof t.readUInt8&&"function"==typeof t.skip&&"function"==typeof t.raw},DecoderBuffer.prototype.save=function save(){return{offset:this.offset,reporter:u.prototype.save.call(this)}},DecoderBuffer.prototype.restore=function restore(t){const i=new DecoderBuffer(this.base);return i.offset=t.offset,i.length=this.offset,this.offset=t.offset,u.prototype.restore.call(this,t.reporter),i},DecoderBuffer.prototype.isEmpty=function isEmpty(){return this.offset===this.length},DecoderBuffer.prototype.readUInt8=function readUInt8(t){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(t||"DecoderBuffer overrun")},DecoderBuffer.prototype.skip=function skip(t,i){if(!(this.offset+t<=this.length))return this.error(i||"DecoderBuffer overrun");const o=new DecoderBuffer(this.base);return o._reporterState=this._reporterState,o.offset=this.offset,o.length=this.offset+t,this.offset+=t,o},DecoderBuffer.prototype.raw=function raw(t){return this.base.slice(t?t.offset:this.offset,this.length)},i.EncoderBuffer=EncoderBuffer,EncoderBuffer.isEncoderBuffer=function isEncoderBuffer(t){if(t instanceof EncoderBuffer)return!0;return"object"==typeof t&&"EncoderBuffer"===t.constructor.name&&"number"==typeof t.length&&"function"==typeof t.join},EncoderBuffer.prototype.join=function join(t,i){return t||(t=c.alloc(this.length)),i||(i=0),0===this.length||(Array.isArray(this.value)?this.value.forEach((function(o){o.join(t,i),i+=o.length})):("number"==typeof this.value?t[i]=this.value:"string"==typeof this.value?t.write(this.value,i):c.isBuffer(this.value)&&this.value.copy(t,i),i+=this.length)),t}},function(t,i,o){t.exports=o(400)},function(t,i,o){var a=o(104),u=Function.prototype,c=u.apply,h=u.call;t.exports="object"==typeof Reflect&&Reflect.apply||(a?h.bind(c):function(){return h.apply(c,arguments)})},function(t,i,o){var a=o(8);t.exports=!a((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},function(t,i,o){"use strict";var a={}.propertyIsEnumerable,u=Object.getOwnPropertyDescriptor,c=u&&!a.call({1:2},1);i.f=c?function propertyIsEnumerable(t){var i=u(this,t);return!!i&&i.enumerable}:a},function(t,i,o){var a=o(335),u=o(107);t.exports=function(t){var i=a(t,"string");return u(i)?i:i+""}},function(t,i,o){var a=o(27),u=o(14),c=o(25),h=o(198),l=Object;t.exports=h?function(t){return"symbol"==typeof t}:function(t){var i=a("Symbol");return u(i)&&c(i.prototype,l(t))}},function(t,i,o){var a,u,c=o(12),h=o(109),l=c.process,d=c.Deno,p=l&&l.versions||d&&d.version,m=p&&p.v8;m&&(u=(a=m.split("."))[0]>0&&a[0]<4?1:+(a[0]+a[1])),!u&&h&&(!(a=h.match(/Edge\/(\d+)/))||a[1]>=74)&&(a=h.match(/Chrome\/(\d+)/))&&(u=+a[1]),t.exports=u},function(t,i,o){var a=o(27);t.exports=a("navigator","userAgent")||""},function(t,i,o){var a=o(9),u=0,c=Math.random(),h=a(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+h(++u+c,36)}},function(t,i,o){var a=o(112),u=Math.max,c=Math.min;t.exports=function(t,i){var o=a(t);return o<0?u(o+i,0):c(o,i)}},function(t,i,o){var a=o(338);t.exports=function(t){var i=+t;return i!=i||0===i?0:a(i)}},function(t,i,o){var a=o(90),u=o(110),c=a("keys");t.exports=function(t){return c[t]||(c[t]=u(t))}},function(t,i,o){var a=o(202),u=o(142).concat("length","prototype");i.f=Object.getOwnPropertyNames||function getOwnPropertyNames(t){return a(t,u)}},function(t,i){i.f=Object.getOwnPropertySymbols},function(t,i,o){var a=o(9),u=o(8),c=o(14),h=o(56),l=o(27),d=o(146),noop=function(){},p=[],m=l("Reflect","construct"),g=/^\s*(?:class|function)\b/,v=a(g.exec),b=!g.exec(noop),w=function isConstructor(t){if(!c(t))return!1;try{return m(noop,p,t),!0}catch(t){return!1}},_=function isConstructor(t){if(!c(t))return!1;switch(h(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return b||!!v(g,d(t))}catch(t){return!0}};_.sham=!0,t.exports=!m||u((function(){var t;return w(w.call)||!w(Object)||!w((function(){t=!0}))||t}))?_:w},function(t,i,o){var a=o(21),u=o(14),c=o(40),h=o(113),l=o(218),d=h("IE_PROTO"),p=Object,m=p.prototype;t.exports=l?p.getPrototypeOf:function(t){var i=c(t);if(a(i,d))return i[d];var o=i.constructor;return u(o)&&i instanceof o?o.prototype:i instanceof p?m:null}},function(t,i,o){var a=o(9),u=o(28),c=o(369);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,i=!1,o={};try{(t=a(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(o,[]),i=o instanceof Array}catch(t){}return function setPrototypeOf(o,a){return u(o),c(a),i?t(o,a):o.__proto__=a,o}}():void 0)},function(t,i,o){t.exports=o(389)},function(t,i,o){"use strict";var a=o(444).charAt,u=o(55),c=o(58),h=o(215),l=c.set,d=c.getterFor("String Iterator");h(String,"String",(function(t){l(this,{type:"String Iterator",string:u(t),index:0})}),(function next(){var t,i=d(this),o=i.string,u=i.index;return u>=o.length?{value:void 0,done:!0}:(t=a(o,u),i.index+=t.length,{value:t,done:!1})}))},function(t,i,o){var a=o(65),u=o(12);t.exports="process"==a(u.process)},function(t,i,o){var a=o(25),u=TypeError;t.exports=function(t,i){if(a(i,t))return t;throw u("Incorrect invocation")}},function(t,i,o){var a=o(250)(Object,"create");t.exports=a},function(t,i,o){var a=o(619);t.exports=function assocIndexOf(t,i){for(var o=t.length;o--;)if(a(t[o][0],i))return o;return-1}},function(t,i,o){var a=o(625);t.exports=function getMapData(t,i){var o=t.__data__;return a(i)?o["string"==typeof i?"string":"hash"]:o.map}},function(t,i,o){var a=o(4).Buffer;function asUInt32Array(t){a.isBuffer(t)||(t=a.from(t));for(var i=t.length/4|0,o=new Array(i),u=0;u<i;u++)o[u]=t.readUInt32BE(4*u);return o}function scrubVec(t){for(;0<t.length;t++)t[0]=0}function cryptBlock(t,i,o,a,u){for(var c,h,l,d,p=o[0],m=o[1],g=o[2],v=o[3],b=t[0]^i[0],w=t[1]^i[1],_=t[2]^i[2],M=t[3]^i[3],k=4,B=1;B<u;B++)c=p[b>>>24]^m[w>>>16&255]^g[_>>>8&255]^v[255&M]^i[k++],h=p[w>>>24]^m[_>>>16&255]^g[M>>>8&255]^v[255&b]^i[k++],l=p[_>>>24]^m[M>>>16&255]^g[b>>>8&255]^v[255&w]^i[k++],d=p[M>>>24]^m[b>>>16&255]^g[w>>>8&255]^v[255&_]^i[k++],b=c,w=h,_=l,M=d;return c=(a[b>>>24]<<24|a[w>>>16&255]<<16|a[_>>>8&255]<<8|a[255&M])^i[k++],h=(a[w>>>24]<<24|a[_>>>16&255]<<16|a[M>>>8&255]<<8|a[255&b])^i[k++],l=(a[_>>>24]<<24|a[M>>>16&255]<<16|a[b>>>8&255]<<8|a[255&w])^i[k++],d=(a[M>>>24]<<24|a[b>>>16&255]<<16|a[w>>>8&255]<<8|a[255&_])^i[k++],[c>>>=0,h>>>=0,l>>>=0,d>>>=0]}var u=[0,1,2,4,8,16,32,64,128,27,54],c=function(){for(var t=new Array(256),i=0;i<256;i++)t[i]=i<128?i<<1:i<<1^283;for(var o=[],a=[],u=[[],[],[],[]],c=[[],[],[],[]],h=0,l=0,d=0;d<256;++d){var p=l^l<<1^l<<2^l<<3^l<<4;p=p>>>8^255&p^99,o[h]=p,a[p]=h;var m=t[h],g=t[m],v=t[g],b=257*t[p]^16843008*p;u[0][h]=b<<24|b>>>8,u[1][h]=b<<16|b>>>16,u[2][h]=b<<8|b>>>24,u[3][h]=b,b=16843009*v^65537*g^257*m^16843008*h,c[0][p]=b<<24|b>>>8,c[1][p]=b<<16|b>>>16,c[2][p]=b<<8|b>>>24,c[3][p]=b,0===h?h=l=1:(h=m^t[t[t[v^m]]],l^=t[t[l]])}return{SBOX:o,INV_SBOX:a,SUB_MIX:u,INV_SUB_MIX:c}}();function AES(t){this._key=asUInt32Array(t),this._reset()}AES.blockSize=16,AES.keySize=32,AES.prototype.blockSize=AES.blockSize,AES.prototype.keySize=AES.keySize,AES.prototype._reset=function(){for(var t=this._key,i=t.length,o=i+6,a=4*(o+1),h=[],l=0;l<i;l++)h[l]=t[l];for(l=i;l<a;l++){var d=h[l-1];l%i==0?(d=d<<8|d>>>24,d=c.SBOX[d>>>24]<<24|c.SBOX[d>>>16&255]<<16|c.SBOX[d>>>8&255]<<8|c.SBOX[255&d],d^=u[l/i|0]<<24):i>6&&l%i==4&&(d=c.SBOX[d>>>24]<<24|c.SBOX[d>>>16&255]<<16|c.SBOX[d>>>8&255]<<8|c.SBOX[255&d]),h[l]=h[l-i]^d}for(var p=[],m=0;m<a;m++){var g=a-m,v=h[g-(m%4?0:4)];p[m]=m<4||g<=4?v:c.INV_SUB_MIX[0][c.SBOX[v>>>24]]^c.INV_SUB_MIX[1][c.SBOX[v>>>16&255]]^c.INV_SUB_MIX[2][c.SBOX[v>>>8&255]]^c.INV_SUB_MIX[3][c.SBOX[255&v]]}this._nRounds=o,this._keySchedule=h,this._invKeySchedule=p},AES.prototype.encryptBlockRaw=function(t){return cryptBlock(t=asUInt32Array(t),this._keySchedule,c.SUB_MIX,c.SBOX,this._nRounds)},AES.prototype.encryptBlock=function(t){var i=this.encryptBlockRaw(t),o=a.allocUnsafe(16);return o.writeUInt32BE(i[0],0),o.writeUInt32BE(i[1],4),o.writeUInt32BE(i[2],8),o.writeUInt32BE(i[3],12),o},AES.prototype.decryptBlock=function(t){var i=(t=asUInt32Array(t))[1];t[1]=t[3],t[3]=i;var o=cryptBlock(t,this._invKeySchedule,c.INV_SUB_MIX,c.INV_SBOX,this._nRounds),u=a.allocUnsafe(16);return u.writeUInt32BE(o[0],0),u.writeUInt32BE(o[3],4),u.writeUInt32BE(o[2],8),u.writeUInt32BE(o[1],12),u},AES.prototype.scrub=function(){scrubVec(this._keySchedule),scrubVec(this._invKeySchedule),scrubVec(this._key)},t.exports.AES=AES},function(t,i,o){var a=o(4).Buffer,u=o(171);t.exports=function EVP_BytesToKey(t,i,o,c){if(a.isBuffer(t)||(t=a.from(t,"binary")),i&&(a.isBuffer(i)||(i=a.from(i,"binary")),8!==i.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var h=o/8,l=a.alloc(h),d=a.alloc(c||0),p=a.alloc(0);h>0||c>0;){var m=new u;m.update(p),m.update(t),i&&m.update(i),p=m.digest();var g=0;if(h>0){var v=l.length-h;g=Math.min(h,p.length),p.copy(l,v,0,g),h-=g}if(g<p.length&&c>0){var b=d.length-c,w=Math.min(c,p.length-g);p.copy(d,b,g,g+w),c-=w}}return p.fill(0),{key:l,iv:d}}},function(t,i,o){"use strict";var a=o(49),u=o(36),c=u.getNAF,h=u.getJSF,l=u.assert;function BaseCurve(t,i){this.type=t,this.p=new a(i.p,16),this.red=i.prime?a.red(i.prime):a.mont(this.p),this.zero=new a(0).toRed(this.red),this.one=new a(1).toRed(this.red),this.two=new a(2).toRed(this.red),this.n=i.n&&new a(i.n,16),this.g=i.g&&this.pointFromJSON(i.g,i.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var o=this.n&&this.p.div(this.n);!o||o.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function BasePoint(t,i){this.curve=t,this.type=i,this.precomputed=null}t.exports=BaseCurve,BaseCurve.prototype.point=function point(){throw new Error("Not implemented")},BaseCurve.prototype.validate=function validate(){throw new Error("Not implemented")},BaseCurve.prototype._fixedNafMul=function _fixedNafMul(t,i){l(t.precomputed);var o=t._getDoubles(),a=c(i,1,this._bitLength),u=(1<<o.step+1)-(o.step%2==0?2:1);u/=3;var h,d,p=[];for(h=0;h<a.length;h+=o.step){d=0;for(var m=h+o.step-1;m>=h;m--)d=(d<<1)+a[m];p.push(d)}for(var g=this.jpoint(null,null,null),v=this.jpoint(null,null,null),b=u;b>0;b--){for(h=0;h<p.length;h++)(d=p[h])===b?v=v.mixedAdd(o.points[h]):d===-b&&(v=v.mixedAdd(o.points[h].neg()));g=g.add(v)}return g.toP()},BaseCurve.prototype._wnafMul=function _wnafMul(t,i){var o=4,a=t._getNAFPoints(o);o=a.wnd;for(var u=a.points,h=c(i,o,this._bitLength),d=this.jpoint(null,null,null),p=h.length-1;p>=0;p--){for(var m=0;p>=0&&0===h[p];p--)m++;if(p>=0&&m++,d=d.dblp(m),p<0)break;var g=h[p];l(0!==g),d="affine"===t.type?g>0?d.mixedAdd(u[g-1>>1]):d.mixedAdd(u[-g-1>>1].neg()):g>0?d.add(u[g-1>>1]):d.add(u[-g-1>>1].neg())}return"affine"===t.type?d.toP():d},BaseCurve.prototype._wnafMulAdd=function _wnafMulAdd(t,i,o,a,u){var l,d,p,m=this._wnafT1,g=this._wnafT2,v=this._wnafT3,b=0;for(l=0;l<a;l++){var w=(p=i[l])._getNAFPoints(t);m[l]=w.wnd,g[l]=w.points}for(l=a-1;l>=1;l-=2){var _=l-1,M=l;if(1===m[_]&&1===m[M]){var k=[i[_],null,null,i[M]];0===i[_].y.cmp(i[M].y)?(k[1]=i[_].add(i[M]),k[2]=i[_].toJ().mixedAdd(i[M].neg())):0===i[_].y.cmp(i[M].y.redNeg())?(k[1]=i[_].toJ().mixedAdd(i[M]),k[2]=i[_].add(i[M].neg())):(k[1]=i[_].toJ().mixedAdd(i[M]),k[2]=i[_].toJ().mixedAdd(i[M].neg()));var B=[-3,-1,-5,-7,0,7,5,1,3],P=h(o[_],o[M]);for(b=Math.max(P[0].length,b),v[_]=new Array(b),v[M]=new Array(b),d=0;d<b;d++){var x=0|P[0][d],I=0|P[1][d];v[_][d]=B[3*(x+1)+(I+1)],v[M][d]=0,g[_]=k}}else v[_]=c(o[_],m[_],this._bitLength),v[M]=c(o[M],m[M],this._bitLength),b=Math.max(v[_].length,b),b=Math.max(v[M].length,b)}var N=this.jpoint(null,null,null),A=this._wnafT4;for(l=b;l>=0;l--){for(var C=0;l>=0;){var O=!0;for(d=0;d<a;d++)A[d]=0|v[d][l],0!==A[d]&&(O=!1);if(!O)break;C++,l--}if(l>=0&&C++,N=N.dblp(C),l<0)break;for(d=0;d<a;d++){var j=A[d];0!==j&&(j>0?p=g[d][j-1>>1]:j<0&&(p=g[d][-j-1>>1].neg()),N="affine"===p.type?N.mixedAdd(p):N.add(p))}}for(l=0;l<a;l++)g[l]=null;return u?N:N.toP()},BaseCurve.BasePoint=BasePoint,BasePoint.prototype.eq=function eq(){throw new Error("Not implemented")},BasePoint.prototype.validate=function validate(){return this.curve.validate(this)},BaseCurve.prototype.decodePoint=function decodePoint(t,i){t=u.toArray(t,i);var o=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*o)return 6===t[0]?l(t[t.length-1]%2==0):7===t[0]&&l(t[t.length-1]%2==1),this.point(t.slice(1,1+o),t.slice(1+o,1+2*o));if((2===t[0]||3===t[0])&&t.length-1===o)return this.pointFromX(t.slice(1,1+o),3===t[0]);throw new Error("Unknown point format")},BasePoint.prototype.encodeCompressed=function encodeCompressed(t){return this.encode(t,!0)},BasePoint.prototype._encode=function _encode(t){var i=this.curve.p.byteLength(),o=this.getX().toArray("be",i);return t?[this.getY().isEven()?2:3].concat(o):[4].concat(o,this.getY().toArray("be",i))},BasePoint.prototype.encode=function encode(t,i){return u.encode(this._encode(i),t)},BasePoint.prototype.precompute=function precompute(t){if(this.precomputed)return this;var i={doubles:null,naf:null,beta:null};return i.naf=this._getNAFPoints(8),i.doubles=this._getDoubles(4,t),i.beta=this._getBeta(),this.precomputed=i,this},BasePoint.prototype._hasDoubles=function _hasDoubles(t){if(!this.precomputed)return!1;var i=this.precomputed.doubles;return!!i&&i.points.length>=Math.ceil((t.bitLength()+1)/i.step)},BasePoint.prototype._getDoubles=function _getDoubles(t,i){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var o=[this],a=this,u=0;u<i;u+=t){for(var c=0;c<t;c++)a=a.dbl();o.push(a)}return{step:t,points:o}},BasePoint.prototype._getNAFPoints=function _getNAFPoints(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var i=[this],o=(1<<t)-1,a=1===o?null:this.dbl(),u=1;u<o;u++)i[u]=i[u-1].add(a);return{wnd:t,points:i}},BasePoint.prototype._getBeta=function _getBeta(){return null},BasePoint.prototype.dblp=function dblp(t){for(var i=this,o=0;o<t;o++)i=i.dbl();return i}},function(t,i,o){var a=o(738),u=o(746),c=o(747),h=o(177),l=o(280),d=o(4).Buffer;function parseKeys(t){var i;"object"!=typeof t||d.isBuffer(t)||(i=t.passphrase,t=t.key),"string"==typeof t&&(t=d.from(t));var o,p,m=c(t,i),g=m.tag,v=m.data;switch(g){case"CERTIFICATE":p=a.certificate.decode(v,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(p||(p=a.PublicKey.decode(v,"der")),o=p.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return a.RSAPublicKey.decode(p.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return p.subjectPrivateKey=p.subjectPublicKey,{type:"ec",data:p};case"1.2.840.10040.4.1":return p.algorithm.params.pub_key=a.DSAparam.decode(p.subjectPublicKey.data,"der"),{type:"dsa",data:p.algorithm.params};default:throw new Error("unknown key id "+o)}case"ENCRYPTED PRIVATE KEY":v=function decrypt(t,i){var o=t.algorithm.decrypt.kde.kdeparams.salt,a=parseInt(t.algorithm.decrypt.kde.kdeparams.iters.toString(),10),c=u[t.algorithm.decrypt.cipher.algo.join(".")],p=t.algorithm.decrypt.cipher.iv,m=t.subjectPrivateKey,g=parseInt(c.split("-")[1],10)/8,v=l.pbkdf2Sync(i,o,a,g,"sha1"),b=h.createDecipheriv(c,v,p),w=[];return w.push(b.update(m)),w.push(b.final()),d.concat(w)}(v=a.EncryptedPrivateKey.decode(v,"der"),i);case"PRIVATE KEY":switch(o=(p=a.PrivateKey.decode(v,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return a.RSAPrivateKey.decode(p.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:p.algorithm.curve,privateKey:a.ECPrivateKey.decode(p.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return p.algorithm.params.priv_key=a.DSAparam.decode(p.subjectPrivateKey,"der"),{type:"dsa",params:p.algorithm.params};default:throw new Error("unknown key id "+o)}case"RSA PUBLIC KEY":return a.RSAPublicKey.decode(v,"der");case"RSA PRIVATE KEY":return a.RSAPrivateKey.decode(v,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:a.DSAPrivateKey.decode(v,"der")};case"EC PRIVATE KEY":return{curve:(v=a.ECPrivateKey.decode(v,"der")).parameters.value,privateKey:v.privateKey};default:throw new Error("unknown key type "+g)}}t.exports=parseKeys,parseKeys.signature=a.signature},function(t,i){t.exports=function(t){return null==t}},function(t,i,o){t.exports=o(229)},function(t,i,o){t.exports=o(551)},function(t,i){t.exports=function _classCallCheck(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i,o){var a=o(119);function _defineProperties(t,i){for(var o=0;o<i.length;o++){var u=i[o];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),a(t,u.key,u)}}t.exports=function _createClass(t,i,o){return i&&_defineProperties(t.prototype,i),o&&_defineProperties(t,o),a(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i,o){"use strict";var a=o(555),u=o(565),c=o(156);t.exports={formats:c,parse:u,stringify:a}},function(t,i){var o={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==o.call(t)}},function(t,i,o){var a=o(9),u=o(8),c=o(65),h=Object,l=a("".split);t.exports=u((function(){return!h("z").propertyIsEnumerable(0)}))?function(t){return"String"==c(t)?l(t,""):h(t)}:h},function(t,i,o){var a=o(44);t.exports=function(t,i){var o=t[i];return null==o?void 0:a(o)}},function(t,i,o){var a=o(12),u=o(337),c=a["__core-js_shared__"]||u("__core-js_shared__",{});t.exports=c},function(t,i,o){var a=o(12),u=o(20),c=a.document,h=u(c)&&u(c.createElement);t.exports=function(t){return h?c.createElement(t):{}}},function(t,i,o){var a=o(38),u=o(111),c=o(54),createMethod=function(t){return function(i,o,h){var l,d=a(i),p=c(d),m=u(h,p);if(t&&o!=o){for(;p>m;)if((l=d[m++])!=l)return!0}else for(;p>m;m++)if((t||m in d)&&d[m]===o)return t||m||0;return!t&&-1}};t.exports={includes:createMethod(!0),indexOf:createMethod(!1)}},function(t,i){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(t,i,o){var a={};a[o(13)("toStringTag")]="z",t.exports="[object z]"===String(a)},function(t,i,o){var a=o(18),u=o(201),c=o(34),h=o(28),l=o(38),d=o(91);i.f=a&&!u?Object.defineProperties:function defineProperties(t,i){h(t);for(var o,a=l(i),u=d(i),p=u.length,m=0;p>m;)c.f(t,o=u[m++],a[o]);return t}},function(t,i,o){var a=o(13);i.f=a},function(t,i,o){var a=o(9),u=o(14),c=o(139),h=a(Function.toString);u(c.inspectSource)||(c.inspectSource=function(t){return h(t)}),t.exports=c.inspectSource},function(t,i,o){var a=o(346);t.exports=function(t,i){return new(a(t))(0===i?0:i)}},function(t,i,o){var a=o(9);t.exports=a([].slice)},function(t,i){t.exports=function(){}},function(t,i,o){t.exports=o(439)},function(t,i,o){t.exports=o(445)},function(t,i,o){var a=o(226),u=o(228),c=o(233);t.exports=function _unsupportedIterableToArray(t,i){var o;if(t){if("string"==typeof t)return c(t,i);var h=a(o=Object.prototype.toString.call(t)).call(o,8,-1);return"Object"===h&&t.constructor&&(h=t.constructor.name),"Map"===h||"Set"===h?u(t):"Arguments"===h||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(h)?c(t,i):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i,o){var a=o(19),u=o(44),c=o(28),h=o(76),l=o(96),d=TypeError;t.exports=function(t,i){var o=arguments.length<2?l(t):i;if(u(o))return c(a(o,t));throw d(h(t)+" is not iterable")}},function(t,i,o){"use strict";var a=SyntaxError,u=Function,c=TypeError,getEvalledConstructor=function(t){try{return u('"use strict"; return ('+t+").constructor;")()}catch(t){}},h=Object.getOwnPropertyDescriptor;if(h)try{h({},"")}catch(t){h=null}var throwTypeError=function(){throw new c},l=h?function(){try{return throwTypeError}catch(t){try{return h(arguments,"callee").get}catch(t){return throwTypeError}}}():throwTypeError,d=o(557)(),p=Object.getPrototypeOf||function(t){return t.__proto__},m={},g="undefined"==typeof Uint8Array?void 0:p(Uint8Array),v={"%AggregateError%":"undefined"==typeof AggregateError?void 0:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayIteratorPrototype%":d?p([][Symbol.iterator]()):void 0,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":m,"%AsyncGenerator%":m,"%AsyncGeneratorFunction%":m,"%AsyncIteratorPrototype%":m,"%Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"%BigInt%":"undefined"==typeof BigInt?void 0:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?void 0:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?void 0:FinalizationRegistry,"%Function%":u,"%GeneratorFunction%":m,"%Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":d?p(p([][Symbol.iterator]())):void 0,"%JSON%":"object"==typeof JSON?JSON:void 0,"%Map%":"undefined"==typeof Map?void 0:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&d?p((new Map)[Symbol.iterator]()):void 0,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?void 0:Promise,"%Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?void 0:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&d?p((new Set)[Symbol.iterator]()):void 0,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":d?p(""[Symbol.iterator]()):void 0,"%Symbol%":d?Symbol:void 0,"%SyntaxError%":a,"%ThrowTypeError%":l,"%TypedArray%":g,"%TypeError%":c,"%Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?void 0:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet},b={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},w=o(155),_=o(560),M=w.call(Function.call,Array.prototype.concat),k=w.call(Function.apply,Array.prototype.splice),B=w.call(Function.call,String.prototype.replace),P=w.call(Function.call,String.prototype.slice),x=w.call(Function.call,RegExp.prototype.exec),I=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,N=/\\(\\)?/g,A=function stringToPath(t){var i=P(t,0,1),o=P(t,-1);if("%"===i&&"%"!==o)throw new a("invalid intrinsic syntax, expected closing `%`");if("%"===o&&"%"!==i)throw new a("invalid intrinsic syntax, expected opening `%`");var u=[];return B(t,I,(function(t,i,o,a){u[u.length]=o?B(a,N,"$1"):i||t})),u},C=function getBaseIntrinsic(t,i){var o,u=t;if(_(b,u)&&(u="%"+(o=b[u])[0]+"%"),_(v,u)){var h=v[u];if(h===m&&(h=function doEval(t){var i;if("%AsyncFunction%"===t)i=getEvalledConstructor("async function () {}");else if("%GeneratorFunction%"===t)i=getEvalledConstructor("function* () {}");else if("%AsyncGeneratorFunction%"===t)i=getEvalledConstructor("async function* () {}");else if("%AsyncGenerator%"===t){var o=doEval("%AsyncGeneratorFunction%");o&&(i=o.prototype)}else if("%AsyncIteratorPrototype%"===t){var a=doEval("%AsyncGenerator%");a&&(i=p(a.prototype))}return v[t]=i,i}(u)),void 0===h&&!i)throw new c("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:o,name:u,value:h}}throw new a("intrinsic "+t+" does not exist!")};t.exports=function GetIntrinsic(t,i){if("string"!=typeof t||0===t.length)throw new c("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof i)throw new c('"allowMissing" argument must be a boolean');if(null===x(/^%?[^%]*%?$/g,t))throw new a("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var o=A(t),u=o.length>0?o[0]:"",l=C("%"+u+"%",i),d=l.name,p=l.value,m=!1,g=l.alias;g&&(u=g[0],k(o,M([0,1],g)));for(var b=1,w=!0;b<o.length;b+=1){var B=o[b],I=P(B,0,1),N=P(B,-1);if(('"'===I||"'"===I||"`"===I||'"'===N||"'"===N||"`"===N)&&I!==N)throw new a("property names with quotes must have matching quotes");if("constructor"!==B&&w||(m=!0),_(v,d="%"+(u+="."+B)+"%"))p=v[d];else if(null!=p){if(!(B in p)){if(!i)throw new c("base intrinsic for "+t+" exists, but the property is not available.");return}if(h&&b+1>=o.length){var O=h(p,B);p=(w=!!O)&&"get"in O&&!("originalValue"in O.get)?O.get:p[B]}else w=_(p,B),p=p[B];w&&!m&&(v[d]=p)}}return p}},function(t,i,o){"use strict";var a=o(559);t.exports=Function.prototype.bind||a},function(t,i,o){"use strict";var a=String.prototype.replace,u=/%20/g,c="RFC1738",h="RFC3986";t.exports={default:h,formatters:{RFC1738:function(t){return a.call(t,u,"+")},RFC3986:function(t){return String(t)}},RFC1738:c,RFC3986:h}},function(t,i,o){var a=o(46);t.exports=function(t,i,o){for(var u in i)o&&o.unsafe&&t[u]?t[u]=i[u]:a(t,u,i[u],o);return t}},function(t,i,o){var a=o(2),u=o(9),c=o(92),h=o(20),l=o(21),d=o(34).f,p=o(114),m=o(207),g=o(248),v=o(110),b=o(583),w=!1,_=v("meta"),M=0,setMetadata=function(t){d(t,_,{value:{objectID:"O"+M++,weakData:{}}})},k=t.exports={enable:function(){k.enable=function(){},w=!0;var t=p.f,i=u([].splice),o={};o[_]=1,t(o).length&&(p.f=function(o){for(var a=t(o),u=0,c=a.length;u<c;u++)if(a[u]===_){i(a,u,1);break}return a},a({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:m.f}))},fastKey:function(t,i){if(!h(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!l(t,_)){if(!g(t))return"F";if(!i)return"E";setMetadata(t)}return t[_].objectID},getWeakData:function(t,i){if(!l(t,_)){if(!g(t))return!0;if(!i)return!1;setMetadata(t)}return t[_].weakData},onFreeze:function(t){return b&&w&&g(t)&&!l(t,_)&&setMetadata(t),t}};c[_]=!0},function(t,i){var o=Array.isArray;t.exports=o},function(t,i,o){var a=o(249),u=o(598);t.exports=function isSymbol(t){return"symbol"==typeof t||u(t)&&"[object Symbol]"==a(t)}},function(t,i,o){var a=o(162).Symbol;t.exports=a},function(t,i,o){var a=o(595),u="object"==typeof self&&self&&self.Object===Object&&self,c=a||u||Function("return this")();t.exports=c},function(t,i,o){(function(i){var a=o(31),u=o(164).inherits,c=o(649),h=o(674),l=o(310),d=o(758),p=o(130),m=o(759),g=o(761),v=o(191);function makeTwoDigits(t){return t>9?t:"0"+t}function signUrl(t,i,o,a,u,c,d,m,g,v,b,w,_,M){var k=t+"\n"+a+"\n"+u+"\n"+("host:"+o.toLowerCase()+"\n")+"\nhost\n"+l(v,{asBytes:!0});!0===_&&console.log("canonical request: "+k+"\n");var B=l(k,{asBytes:!0});!0===_&&console.log("hashed canonical request: "+B+"\n");var P="AWS4-HMAC-SHA256\n"+w+"\n"+b+"/"+m+"/"+g+"/aws4_request\n"+B;!0===_&&console.log("string to sign: "+P+"\n");var x=function getSignatureKey(t,i,o,a){var u=h(i,"AWS4"+t,{asBytes:!0}),c=h(o,u,{asBytes:!0}),l=h(a,c,{asBytes:!0});return h("aws4_request",l,{asBytes:!0})}(d,b,m,g);!0===_&&console.log("signing key: "+x+"\n");var I=h(P,x,{asBytes:!0});!0===_&&console.log("signature: "+I+"\n");var N=u+"&X-Amz-Signature="+I;p(M)||(N+="&X-Amz-Security-Token="+encodeURIComponent(M));var A=i+o+a+"?"+N;return!0===_&&console.log("url: "+A+"\n"),A}function prepareWebSocketUrl(t,i,o,a){var u=function getDateTimeString(){var t=new Date;return t.getUTCFullYear()+""+makeTwoDigits(t.getUTCMonth()+1)+makeTwoDigits(t.getUTCDate())+"T"+makeTwoDigits(t.getUTCHours())+makeTwoDigits(t.getUTCMinutes())+makeTwoDigits(t.getUTCSeconds())+"Z"}(),c=function getDateString(t){return t.substring(0,t.indexOf("T"))}(u),h="X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential="+i+"%2F"+c+"%2F"+t.region+"%2Fiotdevicegateway%2Faws4_request&X-Amz-Date="+u+"&X-Amz-SignedHeaders=host",l=t.host;return p(t.port)||443===t.port||(l=t.host+":"+t.port),signUrl("GET","wss://",l,"/mqtt",h,0,o,t.region,"iotdevicegateway","",c,u,t.debug,a)}function prepareWebSocketCustomAuthUrl(t){var i=t.host;return p(t.port)||443===t.port||(i=t.host+":"+t.port),"wss://"+i+"/mqtt"+(t.customAuthQueryString||"")}function getCredentials(t){var i={},o={};return function arrayEach(t,i){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&i.call(this,t[o],parseInt(o,10))}(t.split(/\r?\n/),(function(t){var a=(t=t.split(/(^|\s)[;#]/)[0]).match(/^\s*\[([^\[\]]+)\]\s*$/);if(a)o=a[1];else if(o){var u=t.match(/^\s*(.+?)\s*=\s*(.+?)\s*$/);u&&(i[o]=i[o]||{},i[o][u[1]]=u[2])}})),i}function DeviceClient(t){if(!(this instanceof DeviceClient))return new DeviceClient(t);var a=this,u=[],h=!0,l=0,b="oldest";u.length=0;var w=[];w.length=0;var _=[],M=!0;_.length=0;var k=[];k.length=0;var B,P,x,I,N="inactive",A=null,C=250,O=1e3,j=2e4,L=128e3,q=null,U="?SDK=JavaScript&Version="+o(762).version;if(p(t)||0===Object.keys(t).length)throw new Error(d.INVALID_CONNECT_OPTIONS);if(p(t.keepalive)&&(t.keepalive=300),(p(t.enableMetrics)||!0===t.enableMetrics)&&(p(t.username)?t.username=U:t.username+=U),p(t.baseReconnectTimeMs)||(O=t.baseReconnectTimeMs),p(t.minimumConnectionTimeMs)||(j=t.minimumConnectionTimeMs),p(t.maximumReconnectTimeMs)||(L=t.maximumReconnectTimeMs),p(t.drainTimeMs)||(C=t.drainTimeMs),p(t.autoResubscribe)||(M=t.autoResubscribe),p(t.offlineQueueing)||(h=t.offlineQueueing),p(t.offlineQueueMaxSize)||(l=t.offlineQueueMaxSize),p(t.offlineQueueDropBehavior)||(b=t.offlineQueueDropBehavior),B=O,t.reconnectPeriod=B,t.fastDisconnectDetection=!0,t.resubscribe=!1,t.baseReconnectTimeMs<=0)throw new Error(d.INVALID_RECONNECT_TIMING);if(L<O)throw new Error(d.INVALID_RECONNECT_TIMING);if(j<O)throw new Error(d.INVALID_RECONNECT_TIMING);if("newest"!==b&&"oldest"!==b)throw new Error(d.INVALID_OFFLINE_QUEUEING_PARAMETERS);if(l<0)throw new Error(d.INVALID_OFFLINE_QUEUEING_PARAMETERS);if(p(t.protocol)&&(t.protocol="mqtts"),p(t.host))throw new Error(d.INVALID_CONNECT_OPTIONS);if(p(t.servername)&&(t.servername=t.host.split(":")[0]),"mqtts"===t.protocol)p(t.port)&&(t.port=8883),m(t);else if("wss"===t.protocol||"wss-custom-auth"===t.protocol){if("wss"===t.protocol){if(P=p(t.accessKeyId)?i.env.AWS_ACCESS_KEY_ID:t.accessKeyId,x=p(t.secretKey)?i.env.AWS_SECRET_ACCESS_KEY:t.secretKey,I=p(t.sessionToken)?i.env.AWS_SESSION_TOKEN:t.sessionToken,p(P)||p(x)){var z,H=t.profile||i.env.AWS_PROFILE||"default";try{z=p(t.filename)?function _loadDefaultFilename(){var t=i.env.HOME||i.env.USERPROFILE||(i.env.HOMEPATH?(i.env.HOMEDRIVE||"C:/")+i.env.HOMEPATH:null);return g.join(t,".aws","credentials")}():t.filename;var W=getCredentials(v.readFileSync(z,"utf-8"))[H];P=W.aws_access_key_id,x=W.aws_secret_access_key,I=W.aws_session_token}catch(t){console.log(t),console.log("Failed to read credentials for AWS_PROFILE "+H+" from "+z)}}if(p(P)||p(x))throw console.log("To connect via WebSocket/SigV4, AWS Access Key ID and AWS Secret Key must be passed either in options or as environment variables; see README.md"),new Error(d.INVALID_CONNECT_OPTIONS)}else if(p(t.customAuthHeaders)&&p(t.customAuthQueryString))throw console.log("To authenticate with a custom authorizer, you must provide the required HTTP headers or queryString; see README.md"),new Error(d.INVALID_CONNECT_OPTIONS);if(!p(t.host)&&p(t.region)){var V=/[a-zA-Z0-9]+\.iot\.([a-z]+-[a-z]+-[0-9]+)\.amazonaws\..+/.exec(t.host);if(null===V)throw console.log("Host endpoint is not valid"),new Error(d.INVALID_CONNECT_OPTIONS);t.region=V[1]}p(t.port)&&(t.port=443),p(t.websocketOptions)?t.websocketOptions={protocol:"mqttv3.1"}:t.websocketOptions.protocol="mqttv3.1","wss-custom-auth"===t.protocol&&(t.websocketOptions.headers=t.customAuthHeaders)}p(t)||!0!==t.debug||(console.log(t),console.log("attempting new mqtt connection..."));var G={};function _addToSubscriptionCache(t,i){0===_.filter((function(i){return i.topic===t})).length&&_.push({topic:t,options:i})}function _deleteFromSubscriptionCache(t,i){var o=_.filter((function(i){return i.topic!==t}));_=o}function _updateSubscriptionCache(t,i,o){var a=null;!1!==M&&("subscribe"===t?a=_addToSubscriptionCache:"unsubscribe"===t&&(a=_deleteFromSubscriptionCache),"[object Array]"===Object.prototype.toString.call(i)?i.forEach((function(t,i,u){a(t,o)})):a(i,o))}function _filling(){return"inactive"===N}G.mqtts=o(763),G.wss=o(764);var J=new c.MqttClient((function _wrapper(i){var o,a=t.protocol;return"wss"===a?(o=""===P||""===x?"wss://no-credentials-available":prepareWebSocketUrl(t,P,x,I),!0===t.debug&&console.log("using websockets, will connect to '"+o+"'..."),t.url=o):"wss-custom-auth"===a&&(t.url=prepareWebSocketCustomAuthUrl(t),!0===t.debug&&console.log("using websockets custom auth, will connect to '"+t.url+"'..."),a="wss"),G[a](i,t)}),t);function _markConnectionStable(){B=O,J.options.reconnectPeriod=B,q=null,N="stable"}function _drainOperationQueue(){var t=k.shift();if(p(t)){var i=w.shift();if(p(i)){var o=u.shift();p(o)||J.publish(o.topic,o.message,o.options,o.callback),0===u.length&&(clearInterval(A),A=null)}else _updateSubscriptionCache(i.type,i.topics,i.options),"subscribe"===i.type?p(i.callback)?J.subscribe(i.topics,i.options):J.subscribe(i.topics,i.options,i.callback):"unsubscribe"===i.type&&J.unsubscribe(i.topics,i.callback)}else p(t.callback)?J.subscribe(t.topic,t.options):J.subscribe(t.topic,t.options,t.callback)}J.on("connect",(function(t){null===q&&(q=setTimeout(_markConnectionStable,j)),N="established",null===A&&(k=_.slice(0),A=setInterval(_drainOperationQueue,C)),a.emit("connect",t)})),J.on("close",(function(i){p(i)||a.emit("error",i),p(t)||!0!==t.debug||console.log("connection lost - will attempt reconnection in "+J.options.reconnectPeriod/1e3+" seconds..."),clearTimeout(q),q=null,clearInterval(A),A=null,N="inactive",a.emit("close")})),J.on("reconnect",(function(){B*=2,B=Math.min(L,B),J.options.reconnectPeriod=B,a.emit("reconnect")})),J.on("end",(function(){a.emit("end")})),J.on("offline",(function(){a.emit("offline")})),J.on("error",(function(t){a.emit("error",t)})),J.on("packetsend",(function(t){a.emit("packetsend",t)})),J.on("packetreceive",(function(t){a.emit("packetreceive",t)})),J.on("message",(function(t,i,o){a.emit("message",t,i,o)})),this.publish=function(t,i,o,a){!0!==h||!_filling()&&null===A?!0!==h&&_filling()||J.publish(t,i,o,a):function _trimOfflinePublishQueueIfNecessary(){var t=!0;return l>0&&u.length>=l&&("oldest"===b?u.shift():t=!1),t}()&&u.push({topic:t,message:i,options:o,callback:a})},this.subscribe=function(t,i,o){_filling()&&!1!==M?w.length<50?w.push({type:"subscribe",topics:t,options:i,callback:o}):a.emit("error",new Error("Maximum queued offline subscription reached")):(_updateSubscriptionCache("subscribe",t,i),p(o)?J.subscribe(t,i):J.subscribe(t,i,o))},this.unsubscribe=function(i,o){_filling()&&!1!==M?w.length<50&&w.push({type:"unsubscribe",topics:i,options:t,callback:o}):(_updateSubscriptionCache("unsubscribe",i),J.unsubscribe(i,o))},this.end=function(t,i){J.end(t,i)},this.handleMessage=J.handleMessage.bind(J),J.handleMessage=function(t,i){a.handleMessage(t,i)},this.updateWebSocketCredentials=function(t,i,o,a){P=t,x=i,I=o},this.getWebsocketHeaders=function(){return t.websocketOptions.headers},this.updateCustomAuthHeaders=function(i){t.websocketOptions.headers=i},this.simulateNetworkFailure=function(){J.stream.emit("error",new Error("simulated connection error")),J.stream.end()}}u(DeviceClient,a.EventEmitter),t.exports=DeviceClient,t.exports.DeviceClient=DeviceClient,t.exports.prepareWebSocketUrl=prepareWebSocketUrl,t.exports.prepareWebSocketCustomAuthUrl=prepareWebSocketCustomAuthUrl}).call(this,o(11))},function(t,i,o){(function(t){var a=Object.getOwnPropertyDescriptors||function getOwnPropertyDescriptors(t){for(var i=Object.keys(t),o={},a=0;a<i.length;a++)o[i[a]]=Object.getOwnPropertyDescriptor(t,i[a]);return o},u=/%[sdj%]/g;i.format=function(t){if(!isString(t)){for(var i=[],o=0;o<arguments.length;o++)i.push(inspect(arguments[o]));return i.join(" ")}o=1;for(var a=arguments,c=a.length,h=String(t).replace(u,(function(t){if("%%"===t)return"%";if(o>=c)return t;switch(t){case"%s":return String(a[o++]);case"%d":return Number(a[o++]);case"%j":try{return JSON.stringify(a[o++])}catch(t){return"[Circular]"}default:return t}})),l=a[o];o<c;l=a[++o])isNull(l)||!isObject(l)?h+=" "+l:h+=" "+inspect(l);return h},i.deprecate=function(o,a){if(void 0!==t&&!0===t.noDeprecation)return o;if(void 0===t)return function(){return i.deprecate(o,a).apply(this,arguments)};var u=!1;return function deprecated(){if(!u){if(t.throwDeprecation)throw new Error(a);t.traceDeprecation?console.trace(a):console.error(a),u=!0}return o.apply(this,arguments)}};var c,h={};function inspect(t,o){var a={seen:[],stylize:stylizeNoColor};return arguments.length>=3&&(a.depth=arguments[2]),arguments.length>=4&&(a.colors=arguments[3]),isBoolean(o)?a.showHidden=o:o&&i._extend(a,o),isUndefined(a.showHidden)&&(a.showHidden=!1),isUndefined(a.depth)&&(a.depth=2),isUndefined(a.colors)&&(a.colors=!1),isUndefined(a.customInspect)&&(a.customInspect=!0),a.colors&&(a.stylize=stylizeWithColor),formatValue(a,t,a.depth)}function stylizeWithColor(t,i){var o=inspect.styles[i];return o?"["+inspect.colors[o][0]+"m"+t+"["+inspect.colors[o][1]+"m":t}function stylizeNoColor(t,i){return t}function formatValue(t,o,a){if(t.customInspect&&o&&isFunction(o.inspect)&&o.inspect!==i.inspect&&(!o.constructor||o.constructor.prototype!==o)){var u=o.inspect(a,t);return isString(u)||(u=formatValue(t,u,a)),u}var c=function formatPrimitive(t,i){if(isUndefined(i))return t.stylize("undefined","undefined");if(isString(i)){var o="'"+JSON.stringify(i).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(o,"string")}if(isNumber(i))return t.stylize(""+i,"number");if(isBoolean(i))return t.stylize(""+i,"boolean");if(isNull(i))return t.stylize("null","null")}(t,o);if(c)return c;var h=Object.keys(o),l=function arrayToHash(t){var i={};return t.forEach((function(t,o){i[t]=!0})),i}(h);if(t.showHidden&&(h=Object.getOwnPropertyNames(o)),isError(o)&&(h.indexOf("message")>=0||h.indexOf("description")>=0))return formatError(o);if(0===h.length){if(isFunction(o)){var d=o.name?": "+o.name:"";return t.stylize("[Function"+d+"]","special")}if(isRegExp(o))return t.stylize(RegExp.prototype.toString.call(o),"regexp");if(isDate(o))return t.stylize(Date.prototype.toString.call(o),"date");if(isError(o))return formatError(o)}var p,m="",g=!1,v=["{","}"];(isArray(o)&&(g=!0,v=["[","]"]),isFunction(o))&&(m=" [Function"+(o.name?": "+o.name:"")+"]");return isRegExp(o)&&(m=" "+RegExp.prototype.toString.call(o)),isDate(o)&&(m=" "+Date.prototype.toUTCString.call(o)),isError(o)&&(m=" "+formatError(o)),0!==h.length||g&&0!=o.length?a<0?isRegExp(o)?t.stylize(RegExp.prototype.toString.call(o),"regexp"):t.stylize("[Object]","special"):(t.seen.push(o),p=g?function formatArray(t,i,o,a,u){for(var c=[],h=0,l=i.length;h<l;++h)hasOwnProperty(i,String(h))?c.push(formatProperty(t,i,o,a,String(h),!0)):c.push("");return u.forEach((function(u){u.match(/^\d+$/)||c.push(formatProperty(t,i,o,a,u,!0))})),c}(t,o,a,l,h):h.map((function(i){return formatProperty(t,o,a,l,i,g)})),t.seen.pop(),function reduceToSingleString(t,i,o){if(t.reduce((function(t,i){return i.indexOf("\n")>=0&&0,t+i.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return o[0]+(""===i?"":i+"\n ")+" "+t.join(",\n ")+" "+o[1];return o[0]+i+" "+t.join(", ")+" "+o[1]}(p,m,v)):v[0]+m+v[1]}function formatError(t){return"["+Error.prototype.toString.call(t)+"]"}function formatProperty(t,i,o,a,u,c){var h,l,d;if((d=Object.getOwnPropertyDescriptor(i,u)||{value:i[u]}).get?l=d.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):d.set&&(l=t.stylize("[Setter]","special")),hasOwnProperty(a,u)||(h="["+u+"]"),l||(t.seen.indexOf(d.value)<0?(l=isNull(o)?formatValue(t,d.value,null):formatValue(t,d.value,o-1)).indexOf("\n")>-1&&(l=c?l.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+l.split("\n").map((function(t){return" "+t})).join("\n")):l=t.stylize("[Circular]","special")),isUndefined(h)){if(c&&u.match(/^\d+$/))return l;(h=JSON.stringify(""+u)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(h=h.substr(1,h.length-2),h=t.stylize(h,"name")):(h=h.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),h=t.stylize(h,"string"))}return h+": "+l}function isArray(t){return Array.isArray(t)}function isBoolean(t){return"boolean"==typeof t}function isNull(t){return null===t}function isNumber(t){return"number"==typeof t}function isString(t){return"string"==typeof t}function isUndefined(t){return void 0===t}function isRegExp(t){return isObject(t)&&"[object RegExp]"===objectToString(t)}function isObject(t){return"object"==typeof t&&null!==t}function isDate(t){return isObject(t)&&"[object Date]"===objectToString(t)}function isError(t){return isObject(t)&&("[object Error]"===objectToString(t)||t instanceof Error)}function isFunction(t){return"function"==typeof t}function objectToString(t){return Object.prototype.toString.call(t)}function pad(t){return t<10?"0"+t.toString(10):t.toString(10)}i.debuglog=function(o){if(isUndefined(c)&&(c=t.env.NODE_DEBUG||""),o=o.toUpperCase(),!h[o])if(new RegExp("\\b"+o+"\\b","i").test(c)){var a=t.pid;h[o]=function(){var t=i.format.apply(i,arguments);console.error("%s %d: %s",o,a,t)}}else h[o]=function(){};return h[o]},i.inspect=inspect,inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},i.isArray=isArray,i.isBoolean=isBoolean,i.isNull=isNull,i.isNullOrUndefined=function isNullOrUndefined(t){return null==t},i.isNumber=isNumber,i.isString=isString,i.isSymbol=function isSymbol(t){return"symbol"==typeof t},i.isUndefined=isUndefined,i.isRegExp=isRegExp,i.isObject=isObject,i.isDate=isDate,i.isError=isError,i.isFunction=isFunction,i.isPrimitive=function isPrimitive(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},i.isBuffer=o(647);var l=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var t=new Date,i=[pad(t.getHours()),pad(t.getMinutes()),pad(t.getSeconds())].join(":");return[t.getDate(),l[t.getMonth()],i].join(" ")}function hasOwnProperty(t,i){return Object.prototype.hasOwnProperty.call(t,i)}i.log=function(){console.log("%s - %s",timestamp(),i.format.apply(i,arguments))},i.inherits=o(648),i._extend=function(t,i){if(!i||!isObject(i))return t;for(var o=Object.keys(i),a=o.length;a--;)t[o[a]]=i[o[a]];return t};var d="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function callbackifyOnRejected(t,i){if(!t){var o=new Error("Promise was rejected with a falsy value");o.reason=t,t=o}return i(t)}i.promisify=function promisify(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(d&&t[d]){var i;if("function"!=typeof(i=t[d]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(i,d,{value:i,enumerable:!1,writable:!1,configurable:!0}),i}function i(){for(var i,o,a=new Promise((function(t,a){i=t,o=a})),u=[],c=0;c<arguments.length;c++)u.push(arguments[c]);u.push((function(t,a){t?o(t):i(a)}));try{t.apply(this,u)}catch(t){o(t)}return a}return Object.setPrototypeOf(i,Object.getPrototypeOf(t)),d&&Object.defineProperty(i,d,{value:i,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(i,a(t))},i.promisify.custom=d,i.callbackify=function callbackify(i){if("function"!=typeof i)throw new TypeError('The "original" argument must be of type Function');function callbackified(){for(var o=[],a=0;a<arguments.length;a++)o.push(arguments[a]);var u=o.pop();if("function"!=typeof u)throw new TypeError("The last argument must be of type Function");var c=this,cb=function(){return u.apply(c,arguments)};i.apply(this,o).then((function(i){t.nextTick(cb,null,i)}),(function(i){t.nextTick(callbackifyOnRejected,i,cb)}))}return Object.setPrototypeOf(callbackified,Object.getPrototypeOf(i)),Object.defineProperties(callbackified,a(i)),callbackified}}).call(this,o(11))},function(t,i){t.exports=function extend(){for(var t={},i=0;i<arguments.length;i++){var a=arguments[i];for(var u in a)o.call(a,u)&&(t[u]=a[u])}return t};var o=Object.prototype.hasOwnProperty},function(t,i,o){(function(i){function config(t){try{if(!i.localStorage)return!1}catch(t){return!1}var o=i.localStorage[t];return null!=o&&"true"===String(o).toLowerCase()}t.exports=function deprecate(t,i){if(config("noDeprecation"))return t;var o=!1;return function deprecated(){if(!o){if(config("throwDeprecation"))throw new Error(i);config("traceDeprecation")?console.trace(i):console.warn(i),o=!0}return t.apply(this,arguments)}}}).call(this,o(17))},function(t,i,o){"use strict";var a=o(83).codes.ERR_STREAM_PREMATURE_CLOSE;function noop(){}t.exports=function eos(t,i,o){if("function"==typeof i)return eos(t,null,i);i||(i={}),o=function once(t){var i=!1;return function(){if(!i){i=!0;for(var o=arguments.length,a=new Array(o),u=0;u<o;u++)a[u]=arguments[u];t.apply(this,a)}}}(o||noop);var u=i.readable||!1!==i.readable&&t.readable,c=i.writable||!1!==i.writable&&t.writable,h=function onlegacyfinish(){t.writable||d()},l=t._writableState&&t._writableState.finished,d=function onfinish(){c=!1,l=!0,u||o.call(t)},p=t._readableState&&t._readableState.endEmitted,m=function onend(){u=!1,p=!0,c||o.call(t)},g=function onerror(i){o.call(t,i)},v=function onclose(){var i;return u&&!p?(t._readableState&&t._readableState.ended||(i=new a),o.call(t,i)):c&&!l?(t._writableState&&t._writableState.ended||(i=new a),o.call(t,i)):void 0},b=function onrequest(){t.req.on("finish",d)};return!function isRequest(t){return t.setHeader&&"function"==typeof t.abort}(t)?c&&!t._writableState&&(t.on("end",h),t.on("close",h)):(t.on("complete",d),t.on("abort",v),t.req?b():t.on("request",b)),t.on("end",m),t.on("finish",d),!1!==i.error&&t.on("error",g),t.on("close",v),function(){t.removeListener("complete",d),t.removeListener("abort",v),t.removeListener("request",b),t.req&&t.req.removeListener("finish",d),t.removeListener("end",h),t.removeListener("close",h),t.removeListener("finish",d),t.removeListener("end",m),t.removeListener("error",g),t.removeListener("close",v)}}},function(t,i,o){"use strict";var a=o(670),u=o(71)("mqttjs:tls");t.exports=function buildBuilder(t,i){var o;function handleTLSerrors(a){i.rejectUnauthorized&&t.emit("error",a),o.end()}return i.port=i.port||8883,i.host=i.hostname||i.host||"localhost",i.servername=i.host,i.rejectUnauthorized=!1!==i.rejectUnauthorized,delete i.path,u("port %d host %s rejectUnauthorized %b",i.port,i.host,i.rejectUnauthorized),(o=a.connect(i)).on("secureConnect",(function(){i.rejectUnauthorized&&!o.authorized?o.emit("error",new Error("TLS not authorized")):o.removeListener("error",handleTLSerrors)})),o.on("error",handleTLSerrors),o}},function(t,i,o){(function(i,a){var u=o(47),c=o(265),h=o(1),l=o(266),d=i.from&&i.from!==Uint8Array.from?i.from([0]):new i([0]),onuncork=function(t,i){t._corked?t.once("uncork",i):i()},destroyer=function(t,i){return function(o){o?function(t,i){t._autoDestroy&&t.destroy(i)}(t,"premature close"===o.message?null:o):i&&!t._ended&&t.end()}},noop=function(){},Duplexify=function(t,i,o){if(!(this instanceof Duplexify))return new Duplexify(t,i,o);u.Duplex.call(this,o),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!o||!1!==o.autoDestroy,this._forwardDestroy=!o||!1!==o.destroy,this._forwardEnd=!o||!1!==o.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,t&&this.setWritable(t),i&&this.setReadable(i)};h(Duplexify,u.Duplex),Duplexify.obj=function(t,i,o){return o||(o={}),o.objectMode=!0,o.highWaterMark=16,new Duplexify(t,i,o)},Duplexify.prototype.cork=function(){1==++this._corked&&this.emit("cork")},Duplexify.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},Duplexify.prototype.setWritable=function(t){if(this._unwrite&&this._unwrite(),this.destroyed)t&&t.destroy&&t.destroy();else if(null!==t&&!1!==t){var i=this,o=c(t,{writable:!0,readable:!1},destroyer(this,this._forwardEnd)),ondrain=function(){var t=i._ondrain;i._ondrain=null,t&&t()};this._unwrite&&a.nextTick(ondrain),this._writable=t,this._writable.on("drain",ondrain),this._unwrite=function(){i._writable.removeListener("drain",ondrain),o()},this.uncork()}else this.end()},Duplexify.prototype.setReadable=function(t){if(this._unread&&this._unread(),this.destroyed)t&&t.destroy&&t.destroy();else{if(null===t||!1===t)return this.push(null),void this.resume();var i,o=this,a=c(t,{writable:!1,readable:!0},destroyer(this)),onreadable=function(){o._forward()},onend=function(){o.push(null)};this._drained=!0,this._readable=t,this._readable2=t._readableState?t:(i=t,new u.Readable({objectMode:!0,highWaterMark:16}).wrap(i)),this._readable2.on("readable",onreadable),this._readable2.on("end",onend),this._unread=function(){o._readable2.removeListener("readable",onreadable),o._readable2.removeListener("end",onend),a()},this._forward()}},Duplexify.prototype._read=function(){this._drained=!0,this._forward()},Duplexify.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var t;for(this._forwarding=!0;this._drained&&null!==(t=l(this._readable2));)this.destroyed||(this._drained=this.push(t));this._forwarding=!1}},Duplexify.prototype.destroy=function(t,i){if(i||(i=noop),this.destroyed)return i(null);this.destroyed=!0;var o=this;a.nextTick((function(){o._destroy(t),i(null)}))},Duplexify.prototype._destroy=function(t){if(t){var i=this._ondrain;this._ondrain=null,i?i(t):this.emit("error",t)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},Duplexify.prototype._write=function(t,i,o){if(!this.destroyed)return this._corked?onuncork(this,this._write.bind(this,t,i,o)):t===d?this._finish(o):this._writable?void(!1===this._writable.write(t)?this._ondrain=o:this.destroyed||o()):o()},Duplexify.prototype._finish=function(t){var i=this;this.emit("preend"),onuncork(this,(function(){var o,a;o=i._forwardEnd&&i._writable,a=function(){!1===i._writableState.prefinished&&(i._writableState.prefinished=!0),i.emit("prefinish"),onuncork(i,t)},o?o._writableState&&o._writableState.finished?a():o._writableState?o.end(a):(o.end(),a()):a()}))},Duplexify.prototype.end=function(t,i,o){return"function"==typeof t?this.end(null,null,t):"function"==typeof i?this.end(t,null,i):(this._ended=!0,t&&this.write(t),this._writableState.ending||this._writableState.destroyed||this.write(d),u.Writable.prototype.end.call(this,o))},t.exports=Duplexify}).call(this,o(10).Buffer,o(11))},function(t,i,o){(function(i){var a;t.exports=(a=a||function(t,a){var u;if("undefined"!=typeof window&&window.crypto&&(u=window.crypto),!u&&"undefined"!=typeof window&&window.msCrypto&&(u=window.msCrypto),!u&&void 0!==i&&i.crypto&&(u=i.crypto),!u)try{u=o(675)}catch(t){}var cryptoSecureRandomInt=function(){if(u){if("function"==typeof u.getRandomValues)try{return u.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof u.randomBytes)try{return u.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},c=Object.create||function(){function F(){}return function(t){var i;return F.prototype=t,i=new F,F.prototype=null,i}}(),h={},l=h.lib={},d=l.Base={extend:function(t){var i=c(this);return t&&i.mixIn(t),i.hasOwnProperty("init")&&this.init!==i.init||(i.init=function(){i.$super.init.apply(this,arguments)}),i.init.prototype=i,i.$super=this,i},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var i in t)t.hasOwnProperty(i)&&(this[i]=t[i]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},p=l.WordArray=d.extend({init:function(t,i){t=this.words=t||[],this.sigBytes=null!=i?i:4*t.length},toString:function(t){return(t||g).stringify(this)},concat:function(t){var i=this.words,o=t.words,a=this.sigBytes,u=t.sigBytes;if(this.clamp(),a%4)for(var c=0;c<u;c++){var h=o[c>>>2]>>>24-c%4*8&255;i[a+c>>>2]|=h<<24-(a+c)%4*8}else for(c=0;c<u;c+=4)i[a+c>>>2]=o[c>>>2];return this.sigBytes+=u,this},clamp:function(){var i=this.words,o=this.sigBytes;i[o>>>2]&=4294967295<<32-o%4*8,i.length=t.ceil(o/4)},clone:function(){var t=d.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var i=[],o=0;o<t;o+=4)i.push(cryptoSecureRandomInt());return new p.init(i,t)}}),m=h.enc={},g=m.Hex={stringify:function(t){for(var i=t.words,o=t.sigBytes,a=[],u=0;u<o;u++){var c=i[u>>>2]>>>24-u%4*8&255;a.push((c>>>4).toString(16)),a.push((15&c).toString(16))}return a.join("")},parse:function(t){for(var i=t.length,o=[],a=0;a<i;a+=2)o[a>>>3]|=parseInt(t.substr(a,2),16)<<24-a%8*4;return new p.init(o,i/2)}},v=m.Latin1={stringify:function(t){for(var i=t.words,o=t.sigBytes,a=[],u=0;u<o;u++){var c=i[u>>>2]>>>24-u%4*8&255;a.push(String.fromCharCode(c))}return a.join("")},parse:function(t){for(var i=t.length,o=[],a=0;a<i;a++)o[a>>>2]|=(255&t.charCodeAt(a))<<24-a%4*8;return new p.init(o,i)}},b=m.Utf8={stringify:function(t){try{return decodeURIComponent(escape(v.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return v.parse(unescape(encodeURIComponent(t)))}},w=l.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new p.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=b.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(i){var o,a=this._data,u=a.words,c=a.sigBytes,h=this.blockSize,l=c/(4*h),d=(l=i?t.ceil(l):t.max((0|l)-this._minBufferSize,0))*h,m=t.min(4*d,c);if(d){for(var g=0;g<d;g+=h)this._doProcessBlock(u,g);o=u.splice(0,d),a.sigBytes-=m}return new p.init(o,m)},clone:function(){var t=d.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),_=(l.Hasher=w.extend({cfg:d.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){w.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(i,o){return new t.init(o).finalize(i)}},_createHmacHelper:function(t){return function(i,o){return new _.HMAC.init(t,o).finalize(i)}}}),h.algo={});return h}(Math),a)}).call(this,o(17))},function(t,i,o){"use strict";var a=o(1),u=o(269),c=o(4).Buffer,h=new Array(16);function MD5(){u.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function rotl(t,i){return t<<i|t>>>32-i}function fnF(t,i,o,a,u,c,h){return rotl(t+(i&o|~i&a)+u+c|0,h)+i|0}function fnG(t,i,o,a,u,c,h){return rotl(t+(i&a|o&~a)+u+c|0,h)+i|0}function fnH(t,i,o,a,u,c,h){return rotl(t+(i^o^a)+u+c|0,h)+i|0}function fnI(t,i,o,a,u,c,h){return rotl(t+(o^(i|~a))+u+c|0,h)+i|0}a(MD5,u),MD5.prototype._update=function(){for(var t=h,i=0;i<16;++i)t[i]=this._block.readInt32LE(4*i);var o=this._a,a=this._b,u=this._c,c=this._d;o=fnF(o,a,u,c,t[0],3614090360,7),c=fnF(c,o,a,u,t[1],3905402710,12),u=fnF(u,c,o,a,t[2],606105819,17),a=fnF(a,u,c,o,t[3],3250441966,22),o=fnF(o,a,u,c,t[4],4118548399,7),c=fnF(c,o,a,u,t[5],1200080426,12),u=fnF(u,c,o,a,t[6],2821735955,17),a=fnF(a,u,c,o,t[7],4249261313,22),o=fnF(o,a,u,c,t[8],1770035416,7),c=fnF(c,o,a,u,t[9],2336552879,12),u=fnF(u,c,o,a,t[10],4294925233,17),a=fnF(a,u,c,o,t[11],2304563134,22),o=fnF(o,a,u,c,t[12],1804603682,7),c=fnF(c,o,a,u,t[13],4254626195,12),u=fnF(u,c,o,a,t[14],2792965006,17),o=fnG(o,a=fnF(a,u,c,o,t[15],1236535329,22),u,c,t[1],4129170786,5),c=fnG(c,o,a,u,t[6],3225465664,9),u=fnG(u,c,o,a,t[11],643717713,14),a=fnG(a,u,c,o,t[0],3921069994,20),o=fnG(o,a,u,c,t[5],3593408605,5),c=fnG(c,o,a,u,t[10],38016083,9),u=fnG(u,c,o,a,t[15],3634488961,14),a=fnG(a,u,c,o,t[4],3889429448,20),o=fnG(o,a,u,c,t[9],568446438,5),c=fnG(c,o,a,u,t[14],3275163606,9),u=fnG(u,c,o,a,t[3],4107603335,14),a=fnG(a,u,c,o,t[8],1163531501,20),o=fnG(o,a,u,c,t[13],2850285829,5),c=fnG(c,o,a,u,t[2],4243563512,9),u=fnG(u,c,o,a,t[7],1735328473,14),o=fnH(o,a=fnG(a,u,c,o,t[12],2368359562,20),u,c,t[5],4294588738,4),c=fnH(c,o,a,u,t[8],2272392833,11),u=fnH(u,c,o,a,t[11],1839030562,16),a=fnH(a,u,c,o,t[14],4259657740,23),o=fnH(o,a,u,c,t[1],2763975236,4),c=fnH(c,o,a,u,t[4],1272893353,11),u=fnH(u,c,o,a,t[7],4139469664,16),a=fnH(a,u,c,o,t[10],3200236656,23),o=fnH(o,a,u,c,t[13],681279174,4),c=fnH(c,o,a,u,t[0],3936430074,11),u=fnH(u,c,o,a,t[3],3572445317,16),a=fnH(a,u,c,o,t[6],76029189,23),o=fnH(o,a,u,c,t[9],3654602809,4),c=fnH(c,o,a,u,t[12],3873151461,11),u=fnH(u,c,o,a,t[15],530742520,16),o=fnI(o,a=fnH(a,u,c,o,t[2],3299628645,23),u,c,t[0],4096336452,6),c=fnI(c,o,a,u,t[7],1126891415,10),u=fnI(u,c,o,a,t[14],2878612391,15),a=fnI(a,u,c,o,t[5],4237533241,21),o=fnI(o,a,u,c,t[12],1700485571,6),c=fnI(c,o,a,u,t[3],2399980690,10),u=fnI(u,c,o,a,t[10],4293915773,15),a=fnI(a,u,c,o,t[1],2240044497,21),o=fnI(o,a,u,c,t[8],1873313359,6),c=fnI(c,o,a,u,t[15],4264355552,10),u=fnI(u,c,o,a,t[6],2734768916,15),a=fnI(a,u,c,o,t[13],1309151649,21),o=fnI(o,a,u,c,t[4],4149444226,6),c=fnI(c,o,a,u,t[11],3174756917,10),u=fnI(u,c,o,a,t[2],718787259,15),a=fnI(a,u,c,o,t[9],3951481745,21),this._a=this._a+o|0,this._b=this._b+a|0,this._c=this._c+u|0,this._d=this._d+c|0},MD5.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=c.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=MD5},function(t,i,o){"use strict";var a=o(10).Buffer,u=o(1),c=o(269),h=new Array(16),l=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],d=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],p=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],m=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],g=[0,1518500249,1859775393,2400959708,2840853838],v=[1352829926,1548603684,1836072691,2053994217,0];function RIPEMD160(){c.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function rotl(t,i){return t<<i|t>>>32-i}function fn1(t,i,o,a,u,c,h,l){return rotl(t+(i^o^a)+c+h|0,l)+u|0}function fn2(t,i,o,a,u,c,h,l){return rotl(t+(i&o|~i&a)+c+h|0,l)+u|0}function fn3(t,i,o,a,u,c,h,l){return rotl(t+((i|~o)^a)+c+h|0,l)+u|0}function fn4(t,i,o,a,u,c,h,l){return rotl(t+(i&a|o&~a)+c+h|0,l)+u|0}function fn5(t,i,o,a,u,c,h,l){return rotl(t+(i^(o|~a))+c+h|0,l)+u|0}u(RIPEMD160,c),RIPEMD160.prototype._update=function(){for(var t=h,i=0;i<16;++i)t[i]=this._block.readInt32LE(4*i);for(var o=0|this._a,a=0|this._b,u=0|this._c,c=0|this._d,b=0|this._e,w=0|this._a,_=0|this._b,M=0|this._c,k=0|this._d,B=0|this._e,P=0;P<80;P+=1){var x,I;P<16?(x=fn1(o,a,u,c,b,t[l[P]],g[0],p[P]),I=fn5(w,_,M,k,B,t[d[P]],v[0],m[P])):P<32?(x=fn2(o,a,u,c,b,t[l[P]],g[1],p[P]),I=fn4(w,_,M,k,B,t[d[P]],v[1],m[P])):P<48?(x=fn3(o,a,u,c,b,t[l[P]],g[2],p[P]),I=fn3(w,_,M,k,B,t[d[P]],v[2],m[P])):P<64?(x=fn4(o,a,u,c,b,t[l[P]],g[3],p[P]),I=fn2(w,_,M,k,B,t[d[P]],v[3],m[P])):(x=fn5(o,a,u,c,b,t[l[P]],g[4],p[P]),I=fn1(w,_,M,k,B,t[d[P]],v[4],m[P])),o=b,b=c,c=rotl(u,10),u=a,a=x,w=B,B=k,k=rotl(M,10),M=_,_=I}var N=this._b+u+k|0;this._b=this._c+c+B|0,this._c=this._d+b+w|0,this._d=this._e+o+_|0,this._e=this._a+a+M|0,this._a=N},RIPEMD160.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=a.alloc?a.alloc(20):new a(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=RIPEMD160},function(t,i,o){(i=t.exports=function SHA(t){t=t.toLowerCase();var o=i[t];if(!o)throw new Error(t+" is not supported (we accept pull requests)");return new o}).sha=o(677),i.sha1=o(678),i.sha224=o(679),i.sha256=o(270),i.sha384=o(680),i.sha512=o(271)},function(t,i,o){(i=t.exports=o(272)).Stream=i,i.Readable=i,i.Writable=o(175),i.Duplex=o(72),i.Transform=o(276),i.PassThrough=o(686)},function(t,i,o){"use strict";(function(i,a,u){var c=o(48);function CorkedRequest(t){var i=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(t,i,o){var a=t.entry;t.entry=null;for(;a;){var u=a.callback;i.pendingcb--,u(o),a=a.next}i.corkedRequestsFree?i.corkedRequestsFree.next=t:i.corkedRequestsFree=t}(i,t)}}t.exports=Writable;var h,l=!i.browser&&["v0.10","v0.9."].indexOf(i.version.slice(0,5))>-1?a:c.nextTick;Writable.WritableState=WritableState;var d=Object.create(o(41));d.inherits=o(1);var p={deprecate:o(166)},m=o(273),g=o(4).Buffer,v=u.Uint8Array||function(){};var b,w=o(274);function nop(){}function WritableState(t,i){h=h||o(72),t=t||{};var a=i instanceof h;this.objectMode=!!t.objectMode,a&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var u=t.highWaterMark,d=t.writableHighWaterMark,p=this.objectMode?16:16384;this.highWaterMark=u||0===u?u:a&&(d||0===d)?d:p,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var m=!1===t.decodeStrings;this.decodeStrings=!m,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function onwrite(t,i){var o=t._writableState,a=o.sync,u=o.writecb;if(function onwriteStateUpdate(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(o),i)!function onwriteError(t,i,o,a,u){--i.pendingcb,o?(c.nextTick(u,a),c.nextTick(finishMaybe,t,i),t._writableState.errorEmitted=!0,t.emit("error",a)):(u(a),t._writableState.errorEmitted=!0,t.emit("error",a),finishMaybe(t,i))}(t,o,a,i,u);else{var h=needFinish(o);h||o.corked||o.bufferProcessing||!o.bufferedRequest||clearBuffer(t,o),a?l(afterWrite,t,o,h,u):afterWrite(t,o,h,u)}}(i,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new CorkedRequest(this)}function Writable(t){if(h=h||o(72),!(b.call(Writable,this)||this instanceof h))return new Writable(t);this._writableState=new WritableState(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),m.call(this)}function doWrite(t,i,o,a,u,c,h){i.writelen=a,i.writecb=h,i.writing=!0,i.sync=!0,o?t._writev(u,i.onwrite):t._write(u,c,i.onwrite),i.sync=!1}function afterWrite(t,i,o,a){o||function onwriteDrain(t,i){0===i.length&&i.needDrain&&(i.needDrain=!1,t.emit("drain"))}(t,i),i.pendingcb--,a(),finishMaybe(t,i)}function clearBuffer(t,i){i.bufferProcessing=!0;var o=i.bufferedRequest;if(t._writev&&o&&o.next){var a=i.bufferedRequestCount,u=new Array(a),c=i.corkedRequestsFree;c.entry=o;for(var h=0,l=!0;o;)u[h]=o,o.isBuf||(l=!1),o=o.next,h+=1;u.allBuffers=l,doWrite(t,i,!0,i.length,u,"",c.finish),i.pendingcb++,i.lastBufferedRequest=null,c.next?(i.corkedRequestsFree=c.next,c.next=null):i.corkedRequestsFree=new CorkedRequest(i),i.bufferedRequestCount=0}else{for(;o;){var d=o.chunk,p=o.encoding,m=o.callback;if(doWrite(t,i,!1,i.objectMode?1:d.length,d,p,m),o=o.next,i.bufferedRequestCount--,i.writing)break}null===o&&(i.lastBufferedRequest=null)}i.bufferedRequest=o,i.bufferProcessing=!1}function needFinish(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function callFinal(t,i){t._final((function(o){i.pendingcb--,o&&t.emit("error",o),i.prefinished=!0,t.emit("prefinish"),finishMaybe(t,i)}))}function finishMaybe(t,i){var o=needFinish(i);return o&&(!function prefinish(t,i){i.prefinished||i.finalCalled||("function"==typeof t._final?(i.pendingcb++,i.finalCalled=!0,c.nextTick(callFinal,t,i)):(i.prefinished=!0,t.emit("prefinish")))}(t,i),0===i.pendingcb&&(i.finished=!0,t.emit("finish"))),o}d.inherits(Writable,m),WritableState.prototype.getBuffer=function getBuffer(){for(var t=this.bufferedRequest,i=[];t;)i.push(t),t=t.next;return i},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:p.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(b=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function(t){return!!b.call(this,t)||this===Writable&&(t&&t._writableState instanceof WritableState)}})):b=function(t){return t instanceof this},Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},Writable.prototype.write=function(t,i,o){var a=this._writableState,u=!1,h=!a.objectMode&&function _isUint8Array(t){return g.isBuffer(t)||t instanceof v}(t);return h&&!g.isBuffer(t)&&(t=function _uint8ArrayToBuffer(t){return g.from(t)}(t)),"function"==typeof i&&(o=i,i=null),h?i="buffer":i||(i=a.defaultEncoding),"function"!=typeof o&&(o=nop),a.ended?function writeAfterEnd(t,i){var o=new Error("write after end");t.emit("error",o),c.nextTick(i,o)}(this,o):(h||function validChunk(t,i,o,a){var u=!0,h=!1;return null===o?h=new TypeError("May not write null values to stream"):"string"==typeof o||void 0===o||i.objectMode||(h=new TypeError("Invalid non-string/buffer chunk")),h&&(t.emit("error",h),c.nextTick(a,h),u=!1),u}(this,a,t,o))&&(a.pendingcb++,u=function writeOrBuffer(t,i,o,a,u,c){if(!o){var h=function decodeChunk(t,i,o){t.objectMode||!1===t.decodeStrings||"string"!=typeof i||(i=g.from(i,o));return i}(i,a,u);a!==h&&(o=!0,u="buffer",a=h)}var l=i.objectMode?1:a.length;i.length+=l;var d=i.length<i.highWaterMark;d||(i.needDrain=!0);if(i.writing||i.corked){var p=i.lastBufferedRequest;i.lastBufferedRequest={chunk:a,encoding:u,isBuf:o,callback:c,next:null},p?p.next=i.lastBufferedRequest:i.bufferedRequest=i.lastBufferedRequest,i.bufferedRequestCount+=1}else doWrite(t,i,!1,l,a,u,c);return d}(this,a,h,t,i,o)),u},Writable.prototype.cork=function(){this._writableState.corked++},Writable.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||clearBuffer(this,t))},Writable.prototype.setDefaultEncoding=function setDefaultEncoding(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(t,i,o){o(new Error("_write() is not implemented"))},Writable.prototype._writev=null,Writable.prototype.end=function(t,i,o){var a=this._writableState;"function"==typeof t?(o=t,t=null,i=null):"function"==typeof i&&(o=i,i=null),null!=t&&this.write(t,i),a.corked&&(a.corked=1,this.uncork()),a.ending||a.finished||function endWritable(t,i,o){i.ending=!0,finishMaybe(t,i),o&&(i.finished?c.nextTick(o):t.once("finish",o));i.ended=!0,t.writable=!1}(this,a,o)},Object.defineProperty(Writable.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),Writable.prototype.destroy=w.destroy,Writable.prototype._undestroy=w.undestroy,Writable.prototype._destroy=function(t,i){this.end(),i(t)}}).call(this,o(11),o(275).setImmediate,o(17))},function(t,i,o){"use strict";var a=o(35);function Cipher(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}t.exports=Cipher,Cipher.prototype._init=function _init(){},Cipher.prototype.update=function update(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},Cipher.prototype._buffer=function _buffer(t,i){for(var o=Math.min(this.buffer.length-this.bufferOff,t.length-i),a=0;a<o;a++)this.buffer[this.bufferOff+a]=t[i+a];return this.bufferOff+=o,o},Cipher.prototype._flushBuffer=function _flushBuffer(t,i){return this._update(this.buffer,0,t,i),this.bufferOff=0,this.blockSize},Cipher.prototype._updateEncrypt=function _updateEncrypt(t){var i=0,o=0,a=(this.bufferOff+t.length)/this.blockSize|0,u=new Array(a*this.blockSize);0!==this.bufferOff&&(i+=this._buffer(t,i),this.bufferOff===this.buffer.length&&(o+=this._flushBuffer(u,o)));for(var c=t.length-(t.length-i)%this.blockSize;i<c;i+=this.blockSize)this._update(t,i,u,o),o+=this.blockSize;for(;i<t.length;i++,this.bufferOff++)this.buffer[this.bufferOff]=t[i];return u},Cipher.prototype._updateDecrypt=function _updateDecrypt(t){for(var i=0,o=0,a=Math.ceil((this.bufferOff+t.length)/this.blockSize)-1,u=new Array(a*this.blockSize);a>0;a--)i+=this._buffer(t,i),o+=this._flushBuffer(u,o);return i+=this._buffer(t,i),u},Cipher.prototype.final=function final(t){var i,o;return t&&(i=this.update(t)),o="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),i?i.concat(o):o},Cipher.prototype._pad=function _pad(t,i){if(0===i)return!1;for(;i<t.length;)t[i++]=0;return!0},Cipher.prototype._finalEncrypt=function _finalEncrypt(){if(!this._pad(this.buffer,this.bufferOff))return[];var t=new Array(this.blockSize);return this._update(this.buffer,0,t,0),t},Cipher.prototype._unpad=function _unpad(t){return t},Cipher.prototype._finalDecrypt=function _finalDecrypt(){a.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var t=new Array(this.blockSize);return this._flushBuffer(t,0),this._unpad(t)}},function(t,i,o){var a=o(699),u=o(707),c=o(289);i.createCipher=i.Cipher=a.createCipher,i.createCipheriv=i.Cipheriv=a.createCipheriv,i.createDecipher=i.Decipher=u.createDecipher,i.createDecipheriv=i.Decipheriv=u.createDecipheriv,i.listCiphers=i.getCiphers=function getCiphers(){return Object.keys(c)}},function(t,i,o){var a={ECB:o(700),CBC:o(701),CFB:o(702),CFB8:o(703),CFB1:o(704),OFB:o(705),CTR:o(287),GCM:o(287)},u=o(289);for(var c in u)u[c].module=a[u[c].mode];t.exports=u},function(t,i,o){var a;function Rand(t){this.rand=t}if(t.exports=function rand(t){return a||(a=new Rand(null)),a.generate(t)},t.exports.Rand=Rand,Rand.prototype.generate=function generate(t){return this._rand(t)},Rand.prototype._rand=function _rand(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var i=new Uint8Array(t),o=0;o<i.length;o++)i[o]=this.rand.getByte();return i},"object"==typeof self)self.crypto&&self.crypto.getRandomValues?Rand.prototype._rand=function _rand(t){var i=new Uint8Array(t);return self.crypto.getRandomValues(i),i}:self.msCrypto&&self.msCrypto.getRandomValues?Rand.prototype._rand=function _rand(t){var i=new Uint8Array(t);return self.msCrypto.getRandomValues(i),i}:"object"==typeof window&&(Rand.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var u=o(713);if("function"!=typeof u.randomBytes)throw new Error("Not supported");Rand.prototype._rand=function _rand(t){return u.randomBytes(t)}}catch(t){}},function(t,i,o){var a=o(10),u=a.Buffer;function copyProps(t,i){for(var o in t)i[o]=t[o]}function SafeBuffer(t,i,o){return u(t,i,o)}u.from&&u.alloc&&u.allocUnsafe&&u.allocUnsafeSlow?t.exports=a:(copyProps(a,i),i.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(u.prototype),copyProps(u,SafeBuffer),SafeBuffer.from=function(t,i,o){if("number"==typeof t)throw new TypeError("Argument must not be a number");return u(t,i,o)},SafeBuffer.alloc=function(t,i,o){if("number"!=typeof t)throw new TypeError("Argument must be a number");var a=u(t);return void 0!==i?"string"==typeof o?a.fill(i,o):a.fill(i):a.fill(0),a},SafeBuffer.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return u(t)},SafeBuffer.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return a.SlowBuffer(t)}},function(t,i,o){(function(i){var a=o(182),u=o(85);function getr(t){var i,o=t.modulus.byteLength();do{i=new a(u(o))}while(i.cmp(t.modulus)>=0||!i.umod(t.prime1)||!i.umod(t.prime2));return i}function crt(t,o){var u=function blind(t){var i=getr(t);return{blinder:i.toRed(a.mont(t.modulus)).redPow(new a(t.publicExponent)).fromRed(),unblinder:i.invm(t.modulus)}}(o),c=o.modulus.byteLength(),h=new a(t).mul(u.blinder).umod(o.modulus),l=h.toRed(a.mont(o.prime1)),d=h.toRed(a.mont(o.prime2)),p=o.coefficient,m=o.prime1,g=o.prime2,v=l.redPow(o.exponent1).fromRed(),b=d.redPow(o.exponent2).fromRed(),w=v.isub(b).imul(p).umod(m).imul(g);return b.iadd(w).imul(u.unblinder).umod(o.modulus).toArrayLike(i,"be",c)}crt.getr=getr,t.exports=crt}).call(this,o(10).Buffer)},function(t,i,o){(function(t){!function(t,i){"use strict";function assert(t,i){if(!t)throw new Error(i||"Assertion failed")}function inherits(t,i){t.super_=i;var TempCtor=function(){};TempCtor.prototype=i.prototype,t.prototype=new TempCtor,t.prototype.constructor=t}function BN(t,i,o){if(BN.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(o=i,i=10),this._init(t||0,i||10,o||"be"))}var a;"object"==typeof t?t.exports=BN:i.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:o(718).Buffer}catch(t){}function parseHex4Bits(t,i){var o=t.charCodeAt(i);return o>=48&&o<=57?o-48:o>=65&&o<=70?o-55:o>=97&&o<=102?o-87:void assert(!1,"Invalid character in "+t)}function parseHexByte(t,i,o){var a=parseHex4Bits(t,o);return o-1>=i&&(a|=parseHex4Bits(t,o-1)<<4),a}function parseBase(t,i,o,a){for(var u=0,c=0,h=Math.min(t.length,o),l=i;l<h;l++){var d=t.charCodeAt(l)-48;u*=a,c=d>=49?d-49+10:d>=17?d-17+10:d,assert(d>=0&&c<a,"Invalid character"),u+=c}return u}function move(t,i){t.words=i.words,t.length=i.length,t.negative=i.negative,t.red=i.red}if(BN.isBN=function isBN(t){return t instanceof BN||null!==t&&"object"==typeof t&&t.constructor.wordSize===BN.wordSize&&Array.isArray(t.words)},BN.max=function max(t,i){return t.cmp(i)>0?t:i},BN.min=function min(t,i){return t.cmp(i)<0?t:i},BN.prototype._init=function init(t,i,o){if("number"==typeof t)return this._initNumber(t,i,o);if("object"==typeof t)return this._initArray(t,i,o);"hex"===i&&(i=16),assert(i===(0|i)&&i>=2&&i<=36);var a=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a<t.length&&(16===i?this._parseHex(t,a,o):(this._parseBase(t,i,a),"le"===o&&this._initArray(this.toArray(),i,o)))},BN.prototype._initNumber=function _initNumber(t,i,o){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(assert(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),i,o)},BN.prototype._initArray=function _initArray(t,i,o){if(assert("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var a=0;a<this.length;a++)this.words[a]=0;var u,c,h=0;if("be"===o)for(a=t.length-1,u=0;a>=0;a-=3)c=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[u]|=c<<h&67108863,this.words[u+1]=c>>>26-h&67108863,(h+=24)>=26&&(h-=26,u++);else if("le"===o)for(a=0,u=0;a<t.length;a+=3)c=t[a]|t[a+1]<<8|t[a+2]<<16,this.words[u]|=c<<h&67108863,this.words[u+1]=c>>>26-h&67108863,(h+=24)>=26&&(h-=26,u++);return this._strip()},BN.prototype._parseHex=function _parseHex(t,i,o){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var a=0;a<this.length;a++)this.words[a]=0;var u,c=0,h=0;if("be"===o)for(a=t.length-1;a>=i;a-=2)u=parseHexByte(t,i,a)<<c,this.words[h]|=67108863&u,c>=18?(c-=18,h+=1,this.words[h]|=u>>>26):c+=8;else for(a=(t.length-i)%2==0?i+1:i;a<t.length;a+=2)u=parseHexByte(t,i,a)<<c,this.words[h]|=67108863&u,c>=18?(c-=18,h+=1,this.words[h]|=u>>>26):c+=8;this._strip()},BN.prototype._parseBase=function _parseBase(t,i,o){this.words=[0],this.length=1;for(var a=0,u=1;u<=67108863;u*=i)a++;a--,u=u/i|0;for(var c=t.length-o,h=c%a,l=Math.min(c,c-h)+o,d=0,p=o;p<l;p+=a)d=parseBase(t,p,p+a,i),this.imuln(u),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d);if(0!==h){var m=1;for(d=parseBase(t,p,t.length,i),p=0;p<h;p++)m*=i;this.imuln(m),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d)}this._strip()},BN.prototype.copy=function copy(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},BN.prototype._move=function _move(t){move(t,this)},BN.prototype.clone=function clone(){var t=new BN(null);return this.copy(t),t},BN.prototype._expand=function _expand(t){for(;this.length<t;)this.words[this.length++]=0;return this},BN.prototype._strip=function strip(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{BN.prototype[Symbol.for("nodejs.util.inspect.custom")]=inspect}catch(t){BN.prototype.inspect=inspect}else BN.prototype.inspect=inspect;function inspect(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];BN.prototype.toString=function toString(t,i){var o;if(i=0|i||1,16===(t=t||10)||"hex"===t){o="";for(var a=0,l=0,d=0;d<this.length;d++){var p=this.words[d],m=(16777215&(p<<a|l)).toString(16);l=p>>>24-a&16777215,(a+=2)>=26&&(a-=26,d--),o=0!==l||d!==this.length-1?u[6-m.length]+m+o:m+o}for(0!==l&&(o=l.toString(16)+o);o.length%i!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(t===(0|t)&&t>=2&&t<=36){var g=c[t],v=h[t];o="";var b=this.clone();for(b.negative=0;!b.isZero();){var w=b.modrn(v).toString(t);o=(b=b.idivn(v)).isZero()?w+o:u[g-w.length]+w+o}for(this.isZero()&&(o="0"+o);o.length%i!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},BN.prototype.toJSON=function toJSON(){return this.toString(16,2)},a&&(BN.prototype.toBuffer=function toBuffer(t,i){return this.toArrayLike(a,t,i)}),BN.prototype.toArray=function toArray(t,i){return this.toArrayLike(Array,t,i)};function smallMulTo(t,i,o){o.negative=i.negative^t.negative;var a=t.length+i.length|0;o.length=a,a=a-1|0;var u=0|t.words[0],c=0|i.words[0],h=u*c,l=67108863&h,d=h/67108864|0;o.words[0]=l;for(var p=1;p<a;p++){for(var m=d>>>26,g=67108863&d,v=Math.min(p,i.length-1),b=Math.max(0,p-t.length+1);b<=v;b++){var w=p-b|0;m+=(h=(u=0|t.words[w])*(c=0|i.words[b])+g)/67108864|0,g=67108863&h}o.words[p]=0|g,d=0|m}return 0!==d?o.words[p]=0|d:o.length--,o._strip()}BN.prototype.toArrayLike=function toArrayLike(t,i,o){this._strip();var a=this.byteLength(),u=o||Math.max(1,a);assert(a<=u,"byte array longer than desired length"),assert(u>0,"Requested array length <= 0");var c=function allocate(t,i){return t.allocUnsafe?t.allocUnsafe(i):new t(i)}(t,u);return this["_toArrayLike"+("le"===i?"LE":"BE")](c,a),c},BN.prototype._toArrayLikeLE=function _toArrayLikeLE(t,i){for(var o=0,a=0,u=0,c=0;u<this.length;u++){var h=this.words[u]<<c|a;t[o++]=255&h,o<t.length&&(t[o++]=h>>8&255),o<t.length&&(t[o++]=h>>16&255),6===c?(o<t.length&&(t[o++]=h>>24&255),a=0,c=0):(a=h>>>24,c+=2)}if(o<t.length)for(t[o++]=a;o<t.length;)t[o++]=0},BN.prototype._toArrayLikeBE=function _toArrayLikeBE(t,i){for(var o=t.length-1,a=0,u=0,c=0;u<this.length;u++){var h=this.words[u]<<c|a;t[o--]=255&h,o>=0&&(t[o--]=h>>8&255),o>=0&&(t[o--]=h>>16&255),6===c?(o>=0&&(t[o--]=h>>24&255),a=0,c=0):(a=h>>>24,c+=2)}if(o>=0)for(t[o--]=a;o>=0;)t[o--]=0},Math.clz32?BN.prototype._countBits=function _countBits(t){return 32-Math.clz32(t)}:BN.prototype._countBits=function _countBits(t){var i=t,o=0;return i>=4096&&(o+=13,i>>>=13),i>=64&&(o+=7,i>>>=7),i>=8&&(o+=4,i>>>=4),i>=2&&(o+=2,i>>>=2),o+i},BN.prototype._zeroBits=function _zeroBits(t){if(0===t)return 26;var i=t,o=0;return 0==(8191&i)&&(o+=13,i>>>=13),0==(127&i)&&(o+=7,i>>>=7),0==(15&i)&&(o+=4,i>>>=4),0==(3&i)&&(o+=2,i>>>=2),0==(1&i)&&o++,o},BN.prototype.bitLength=function bitLength(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var o=this._zeroBits(this.words[i]);if(t+=o,26!==o)break}return t},BN.prototype.byteLength=function byteLength(){return Math.ceil(this.bitLength()/8)},BN.prototype.toTwos=function toTwos(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},BN.prototype.fromTwos=function fromTwos(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},BN.prototype.isNeg=function isNeg(){return 0!==this.negative},BN.prototype.neg=function neg(){return this.clone().ineg()},BN.prototype.ineg=function ineg(){return this.isZero()||(this.negative^=1),this},BN.prototype.iuor=function iuor(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this._strip()},BN.prototype.ior=function ior(t){return assert(0==(this.negative|t.negative)),this.iuor(t)},BN.prototype.or=function or(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},BN.prototype.uor=function uor(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},BN.prototype.iuand=function iuand(t){var i;i=this.length>t.length?t:this;for(var o=0;o<i.length;o++)this.words[o]=this.words[o]&t.words[o];return this.length=i.length,this._strip()},BN.prototype.iand=function iand(t){return assert(0==(this.negative|t.negative)),this.iuand(t)},BN.prototype.and=function and(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},BN.prototype.uand=function uand(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},BN.prototype.iuxor=function iuxor(t){var i,o;this.length>t.length?(i=this,o=t):(i=t,o=this);for(var a=0;a<o.length;a++)this.words[a]=i.words[a]^o.words[a];if(this!==i)for(;a<i.length;a++)this.words[a]=i.words[a];return this.length=i.length,this._strip()},BN.prototype.ixor=function ixor(t){return assert(0==(this.negative|t.negative)),this.iuxor(t)},BN.prototype.xor=function xor(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},BN.prototype.uxor=function uxor(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},BN.prototype.inotn=function inotn(t){assert("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),o=t%26;this._expand(i),o>0&&i--;for(var a=0;a<i;a++)this.words[a]=67108863&~this.words[a];return o>0&&(this.words[a]=~this.words[a]&67108863>>26-o),this._strip()},BN.prototype.notn=function notn(t){return this.clone().inotn(t)},BN.prototype.setn=function setn(t,i){assert("number"==typeof t&&t>=0);var o=t/26|0,a=t%26;return this._expand(o+1),this.words[o]=i?this.words[o]|1<<a:this.words[o]&~(1<<a),this._strip()},BN.prototype.iadd=function iadd(t){var i,o,a;if(0!==this.negative&&0===t.negative)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();this.length>t.length?(o=this,a=t):(o=t,a=this);for(var u=0,c=0;c<a.length;c++)i=(0|o.words[c])+(0|a.words[c])+u,this.words[c]=67108863&i,u=i>>>26;for(;0!==u&&c<o.length;c++)i=(0|o.words[c])+u,this.words[c]=67108863&i,u=i>>>26;if(this.length=o.length,0!==u)this.words[this.length]=u,this.length++;else if(o!==this)for(;c<o.length;c++)this.words[c]=o.words[c];return this},BN.prototype.add=function add(t){var i;return 0!==t.negative&&0===this.negative?(t.negative=0,i=this.sub(t),t.negative^=1,i):0===t.negative&&0!==this.negative?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},BN.prototype.isub=function isub(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var o,a,u=this.cmp(t);if(0===u)return this.negative=0,this.length=1,this.words[0]=0,this;u>0?(o=this,a=t):(o=t,a=this);for(var c=0,h=0;h<a.length;h++)c=(i=(0|o.words[h])-(0|a.words[h])+c)>>26,this.words[h]=67108863&i;for(;0!==c&&h<o.length;h++)c=(i=(0|o.words[h])+c)>>26,this.words[h]=67108863&i;if(0===c&&h<o.length&&o!==this)for(;h<o.length;h++)this.words[h]=o.words[h];return this.length=Math.max(this.length,h),o!==this&&(this.negative=1),this._strip()},BN.prototype.sub=function sub(t){return this.clone().isub(t)};var l=function comb10MulTo(t,i,o){var a,u,c,h=t.words,l=i.words,d=o.words,p=0,m=0|h[0],g=8191&m,v=m>>>13,b=0|h[1],w=8191&b,_=b>>>13,M=0|h[2],k=8191&M,B=M>>>13,P=0|h[3],x=8191&P,I=P>>>13,N=0|h[4],A=8191&N,C=N>>>13,O=0|h[5],j=8191&O,L=O>>>13,q=0|h[6],U=8191&q,z=q>>>13,H=0|h[7],W=8191&H,V=H>>>13,G=0|h[8],J=8191&G,$=G>>>13,Z=0|h[9],Y=8191&Z,X=Z>>>13,Q=0|l[0],ee=8191&Q,te=Q>>>13,re=0|l[1],ne=8191&re,ie=re>>>13,oe=0|l[2],se=8191&oe,ae=oe>>>13,ue=0|l[3],ce=8191&ue,he=ue>>>13,le=0|l[4],fe=8191&le,de=le>>>13,pe=0|l[5],me=8191&pe,ge=pe>>>13,ve=0|l[6],ye=8191&ve,be=ve>>>13,we=0|l[7],_e=8191&we,Me=we>>>13,Se=0|l[8],ke=8191&Se,Ee=Se>>>13,Be=0|l[9],Pe=8191&Be,xe=Be>>>13;o.negative=t.negative^i.negative,o.length=19;var Te=(p+(a=Math.imul(g,ee))|0)+((8191&(u=(u=Math.imul(g,te))+Math.imul(v,ee)|0))<<13)|0;p=((c=Math.imul(v,te))+(u>>>13)|0)+(Te>>>26)|0,Te&=67108863,a=Math.imul(w,ee),u=(u=Math.imul(w,te))+Math.imul(_,ee)|0,c=Math.imul(_,te);var Ie=(p+(a=a+Math.imul(g,ne)|0)|0)+((8191&(u=(u=u+Math.imul(g,ie)|0)+Math.imul(v,ne)|0))<<13)|0;p=((c=c+Math.imul(v,ie)|0)+(u>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,a=Math.imul(k,ee),u=(u=Math.imul(k,te))+Math.imul(B,ee)|0,c=Math.imul(B,te),a=a+Math.imul(w,ne)|0,u=(u=u+Math.imul(w,ie)|0)+Math.imul(_,ne)|0,c=c+Math.imul(_,ie)|0;var Ne=(p+(a=a+Math.imul(g,se)|0)|0)+((8191&(u=(u=u+Math.imul(g,ae)|0)+Math.imul(v,se)|0))<<13)|0;p=((c=c+Math.imul(v,ae)|0)+(u>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,a=Math.imul(x,ee),u=(u=Math.imul(x,te))+Math.imul(I,ee)|0,c=Math.imul(I,te),a=a+Math.imul(k,ne)|0,u=(u=u+Math.imul(k,ie)|0)+Math.imul(B,ne)|0,c=c+Math.imul(B,ie)|0,a=a+Math.imul(w,se)|0,u=(u=u+Math.imul(w,ae)|0)+Math.imul(_,se)|0,c=c+Math.imul(_,ae)|0;var Ae=(p+(a=a+Math.imul(g,ce)|0)|0)+((8191&(u=(u=u+Math.imul(g,he)|0)+Math.imul(v,ce)|0))<<13)|0;p=((c=c+Math.imul(v,he)|0)+(u>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,a=Math.imul(A,ee),u=(u=Math.imul(A,te))+Math.imul(C,ee)|0,c=Math.imul(C,te),a=a+Math.imul(x,ne)|0,u=(u=u+Math.imul(x,ie)|0)+Math.imul(I,ne)|0,c=c+Math.imul(I,ie)|0,a=a+Math.imul(k,se)|0,u=(u=u+Math.imul(k,ae)|0)+Math.imul(B,se)|0,c=c+Math.imul(B,ae)|0,a=a+Math.imul(w,ce)|0,u=(u=u+Math.imul(w,he)|0)+Math.imul(_,ce)|0,c=c+Math.imul(_,he)|0;var Re=(p+(a=a+Math.imul(g,fe)|0)|0)+((8191&(u=(u=u+Math.imul(g,de)|0)+Math.imul(v,fe)|0))<<13)|0;p=((c=c+Math.imul(v,de)|0)+(u>>>13)|0)+(Re>>>26)|0,Re&=67108863,a=Math.imul(j,ee),u=(u=Math.imul(j,te))+Math.imul(L,ee)|0,c=Math.imul(L,te),a=a+Math.imul(A,ne)|0,u=(u=u+Math.imul(A,ie)|0)+Math.imul(C,ne)|0,c=c+Math.imul(C,ie)|0,a=a+Math.imul(x,se)|0,u=(u=u+Math.imul(x,ae)|0)+Math.imul(I,se)|0,c=c+Math.imul(I,ae)|0,a=a+Math.imul(k,ce)|0,u=(u=u+Math.imul(k,he)|0)+Math.imul(B,ce)|0,c=c+Math.imul(B,he)|0,a=a+Math.imul(w,fe)|0,u=(u=u+Math.imul(w,de)|0)+Math.imul(_,fe)|0,c=c+Math.imul(_,de)|0;var Ce=(p+(a=a+Math.imul(g,me)|0)|0)+((8191&(u=(u=u+Math.imul(g,ge)|0)+Math.imul(v,me)|0))<<13)|0;p=((c=c+Math.imul(v,ge)|0)+(u>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,a=Math.imul(U,ee),u=(u=Math.imul(U,te))+Math.imul(z,ee)|0,c=Math.imul(z,te),a=a+Math.imul(j,ne)|0,u=(u=u+Math.imul(j,ie)|0)+Math.imul(L,ne)|0,c=c+Math.imul(L,ie)|0,a=a+Math.imul(A,se)|0,u=(u=u+Math.imul(A,ae)|0)+Math.imul(C,se)|0,c=c+Math.imul(C,ae)|0,a=a+Math.imul(x,ce)|0,u=(u=u+Math.imul(x,he)|0)+Math.imul(I,ce)|0,c=c+Math.imul(I,he)|0,a=a+Math.imul(k,fe)|0,u=(u=u+Math.imul(k,de)|0)+Math.imul(B,fe)|0,c=c+Math.imul(B,de)|0,a=a+Math.imul(w,me)|0,u=(u=u+Math.imul(w,ge)|0)+Math.imul(_,me)|0,c=c+Math.imul(_,ge)|0;var Oe=(p+(a=a+Math.imul(g,ye)|0)|0)+((8191&(u=(u=u+Math.imul(g,be)|0)+Math.imul(v,ye)|0))<<13)|0;p=((c=c+Math.imul(v,be)|0)+(u>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,a=Math.imul(W,ee),u=(u=Math.imul(W,te))+Math.imul(V,ee)|0,c=Math.imul(V,te),a=a+Math.imul(U,ne)|0,u=(u=u+Math.imul(U,ie)|0)+Math.imul(z,ne)|0,c=c+Math.imul(z,ie)|0,a=a+Math.imul(j,se)|0,u=(u=u+Math.imul(j,ae)|0)+Math.imul(L,se)|0,c=c+Math.imul(L,ae)|0,a=a+Math.imul(A,ce)|0,u=(u=u+Math.imul(A,he)|0)+Math.imul(C,ce)|0,c=c+Math.imul(C,he)|0,a=a+Math.imul(x,fe)|0,u=(u=u+Math.imul(x,de)|0)+Math.imul(I,fe)|0,c=c+Math.imul(I,de)|0,a=a+Math.imul(k,me)|0,u=(u=u+Math.imul(k,ge)|0)+Math.imul(B,me)|0,c=c+Math.imul(B,ge)|0,a=a+Math.imul(w,ye)|0,u=(u=u+Math.imul(w,be)|0)+Math.imul(_,ye)|0,c=c+Math.imul(_,be)|0;var De=(p+(a=a+Math.imul(g,_e)|0)|0)+((8191&(u=(u=u+Math.imul(g,Me)|0)+Math.imul(v,_e)|0))<<13)|0;p=((c=c+Math.imul(v,Me)|0)+(u>>>13)|0)+(De>>>26)|0,De&=67108863,a=Math.imul(J,ee),u=(u=Math.imul(J,te))+Math.imul($,ee)|0,c=Math.imul($,te),a=a+Math.imul(W,ne)|0,u=(u=u+Math.imul(W,ie)|0)+Math.imul(V,ne)|0,c=c+Math.imul(V,ie)|0,a=a+Math.imul(U,se)|0,u=(u=u+Math.imul(U,ae)|0)+Math.imul(z,se)|0,c=c+Math.imul(z,ae)|0,a=a+Math.imul(j,ce)|0,u=(u=u+Math.imul(j,he)|0)+Math.imul(L,ce)|0,c=c+Math.imul(L,he)|0,a=a+Math.imul(A,fe)|0,u=(u=u+Math.imul(A,de)|0)+Math.imul(C,fe)|0,c=c+Math.imul(C,de)|0,a=a+Math.imul(x,me)|0,u=(u=u+Math.imul(x,ge)|0)+Math.imul(I,me)|0,c=c+Math.imul(I,ge)|0,a=a+Math.imul(k,ye)|0,u=(u=u+Math.imul(k,be)|0)+Math.imul(B,ye)|0,c=c+Math.imul(B,be)|0,a=a+Math.imul(w,_e)|0,u=(u=u+Math.imul(w,Me)|0)+Math.imul(_,_e)|0,c=c+Math.imul(_,Me)|0;var je=(p+(a=a+Math.imul(g,ke)|0)|0)+((8191&(u=(u=u+Math.imul(g,Ee)|0)+Math.imul(v,ke)|0))<<13)|0;p=((c=c+Math.imul(v,Ee)|0)+(u>>>13)|0)+(je>>>26)|0,je&=67108863,a=Math.imul(Y,ee),u=(u=Math.imul(Y,te))+Math.imul(X,ee)|0,c=Math.imul(X,te),a=a+Math.imul(J,ne)|0,u=(u=u+Math.imul(J,ie)|0)+Math.imul($,ne)|0,c=c+Math.imul($,ie)|0,a=a+Math.imul(W,se)|0,u=(u=u+Math.imul(W,ae)|0)+Math.imul(V,se)|0,c=c+Math.imul(V,ae)|0,a=a+Math.imul(U,ce)|0,u=(u=u+Math.imul(U,he)|0)+Math.imul(z,ce)|0,c=c+Math.imul(z,he)|0,a=a+Math.imul(j,fe)|0,u=(u=u+Math.imul(j,de)|0)+Math.imul(L,fe)|0,c=c+Math.imul(L,de)|0,a=a+Math.imul(A,me)|0,u=(u=u+Math.imul(A,ge)|0)+Math.imul(C,me)|0,c=c+Math.imul(C,ge)|0,a=a+Math.imul(x,ye)|0,u=(u=u+Math.imul(x,be)|0)+Math.imul(I,ye)|0,c=c+Math.imul(I,be)|0,a=a+Math.imul(k,_e)|0,u=(u=u+Math.imul(k,Me)|0)+Math.imul(B,_e)|0,c=c+Math.imul(B,Me)|0,a=a+Math.imul(w,ke)|0,u=(u=u+Math.imul(w,Ee)|0)+Math.imul(_,ke)|0,c=c+Math.imul(_,Ee)|0;var Le=(p+(a=a+Math.imul(g,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(g,xe)|0)+Math.imul(v,Pe)|0))<<13)|0;p=((c=c+Math.imul(v,xe)|0)+(u>>>13)|0)+(Le>>>26)|0,Le&=67108863,a=Math.imul(Y,ne),u=(u=Math.imul(Y,ie))+Math.imul(X,ne)|0,c=Math.imul(X,ie),a=a+Math.imul(J,se)|0,u=(u=u+Math.imul(J,ae)|0)+Math.imul($,se)|0,c=c+Math.imul($,ae)|0,a=a+Math.imul(W,ce)|0,u=(u=u+Math.imul(W,he)|0)+Math.imul(V,ce)|0,c=c+Math.imul(V,he)|0,a=a+Math.imul(U,fe)|0,u=(u=u+Math.imul(U,de)|0)+Math.imul(z,fe)|0,c=c+Math.imul(z,de)|0,a=a+Math.imul(j,me)|0,u=(u=u+Math.imul(j,ge)|0)+Math.imul(L,me)|0,c=c+Math.imul(L,ge)|0,a=a+Math.imul(A,ye)|0,u=(u=u+Math.imul(A,be)|0)+Math.imul(C,ye)|0,c=c+Math.imul(C,be)|0,a=a+Math.imul(x,_e)|0,u=(u=u+Math.imul(x,Me)|0)+Math.imul(I,_e)|0,c=c+Math.imul(I,Me)|0,a=a+Math.imul(k,ke)|0,u=(u=u+Math.imul(k,Ee)|0)+Math.imul(B,ke)|0,c=c+Math.imul(B,Ee)|0;var Fe=(p+(a=a+Math.imul(w,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(w,xe)|0)+Math.imul(_,Pe)|0))<<13)|0;p=((c=c+Math.imul(_,xe)|0)+(u>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,a=Math.imul(Y,se),u=(u=Math.imul(Y,ae))+Math.imul(X,se)|0,c=Math.imul(X,ae),a=a+Math.imul(J,ce)|0,u=(u=u+Math.imul(J,he)|0)+Math.imul($,ce)|0,c=c+Math.imul($,he)|0,a=a+Math.imul(W,fe)|0,u=(u=u+Math.imul(W,de)|0)+Math.imul(V,fe)|0,c=c+Math.imul(V,de)|0,a=a+Math.imul(U,me)|0,u=(u=u+Math.imul(U,ge)|0)+Math.imul(z,me)|0,c=c+Math.imul(z,ge)|0,a=a+Math.imul(j,ye)|0,u=(u=u+Math.imul(j,be)|0)+Math.imul(L,ye)|0,c=c+Math.imul(L,be)|0,a=a+Math.imul(A,_e)|0,u=(u=u+Math.imul(A,Me)|0)+Math.imul(C,_e)|0,c=c+Math.imul(C,Me)|0,a=a+Math.imul(x,ke)|0,u=(u=u+Math.imul(x,Ee)|0)+Math.imul(I,ke)|0,c=c+Math.imul(I,Ee)|0;var qe=(p+(a=a+Math.imul(k,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(k,xe)|0)+Math.imul(B,Pe)|0))<<13)|0;p=((c=c+Math.imul(B,xe)|0)+(u>>>13)|0)+(qe>>>26)|0,qe&=67108863,a=Math.imul(Y,ce),u=(u=Math.imul(Y,he))+Math.imul(X,ce)|0,c=Math.imul(X,he),a=a+Math.imul(J,fe)|0,u=(u=u+Math.imul(J,de)|0)+Math.imul($,fe)|0,c=c+Math.imul($,de)|0,a=a+Math.imul(W,me)|0,u=(u=u+Math.imul(W,ge)|0)+Math.imul(V,me)|0,c=c+Math.imul(V,ge)|0,a=a+Math.imul(U,ye)|0,u=(u=u+Math.imul(U,be)|0)+Math.imul(z,ye)|0,c=c+Math.imul(z,be)|0,a=a+Math.imul(j,_e)|0,u=(u=u+Math.imul(j,Me)|0)+Math.imul(L,_e)|0,c=c+Math.imul(L,Me)|0,a=a+Math.imul(A,ke)|0,u=(u=u+Math.imul(A,Ee)|0)+Math.imul(C,ke)|0,c=c+Math.imul(C,Ee)|0;var Ue=(p+(a=a+Math.imul(x,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(x,xe)|0)+Math.imul(I,Pe)|0))<<13)|0;p=((c=c+Math.imul(I,xe)|0)+(u>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,a=Math.imul(Y,fe),u=(u=Math.imul(Y,de))+Math.imul(X,fe)|0,c=Math.imul(X,de),a=a+Math.imul(J,me)|0,u=(u=u+Math.imul(J,ge)|0)+Math.imul($,me)|0,c=c+Math.imul($,ge)|0,a=a+Math.imul(W,ye)|0,u=(u=u+Math.imul(W,be)|0)+Math.imul(V,ye)|0,c=c+Math.imul(V,be)|0,a=a+Math.imul(U,_e)|0,u=(u=u+Math.imul(U,Me)|0)+Math.imul(z,_e)|0,c=c+Math.imul(z,Me)|0,a=a+Math.imul(j,ke)|0,u=(u=u+Math.imul(j,Ee)|0)+Math.imul(L,ke)|0,c=c+Math.imul(L,Ee)|0;var ze=(p+(a=a+Math.imul(A,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(A,xe)|0)+Math.imul(C,Pe)|0))<<13)|0;p=((c=c+Math.imul(C,xe)|0)+(u>>>13)|0)+(ze>>>26)|0,ze&=67108863,a=Math.imul(Y,me),u=(u=Math.imul(Y,ge))+Math.imul(X,me)|0,c=Math.imul(X,ge),a=a+Math.imul(J,ye)|0,u=(u=u+Math.imul(J,be)|0)+Math.imul($,ye)|0,c=c+Math.imul($,be)|0,a=a+Math.imul(W,_e)|0,u=(u=u+Math.imul(W,Me)|0)+Math.imul(V,_e)|0,c=c+Math.imul(V,Me)|0,a=a+Math.imul(U,ke)|0,u=(u=u+Math.imul(U,Ee)|0)+Math.imul(z,ke)|0,c=c+Math.imul(z,Ee)|0;var He=(p+(a=a+Math.imul(j,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(j,xe)|0)+Math.imul(L,Pe)|0))<<13)|0;p=((c=c+Math.imul(L,xe)|0)+(u>>>13)|0)+(He>>>26)|0,He&=67108863,a=Math.imul(Y,ye),u=(u=Math.imul(Y,be))+Math.imul(X,ye)|0,c=Math.imul(X,be),a=a+Math.imul(J,_e)|0,u=(u=u+Math.imul(J,Me)|0)+Math.imul($,_e)|0,c=c+Math.imul($,Me)|0,a=a+Math.imul(W,ke)|0,u=(u=u+Math.imul(W,Ee)|0)+Math.imul(V,ke)|0,c=c+Math.imul(V,Ee)|0;var We=(p+(a=a+Math.imul(U,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(U,xe)|0)+Math.imul(z,Pe)|0))<<13)|0;p=((c=c+Math.imul(z,xe)|0)+(u>>>13)|0)+(We>>>26)|0,We&=67108863,a=Math.imul(Y,_e),u=(u=Math.imul(Y,Me))+Math.imul(X,_e)|0,c=Math.imul(X,Me),a=a+Math.imul(J,ke)|0,u=(u=u+Math.imul(J,Ee)|0)+Math.imul($,ke)|0,c=c+Math.imul($,Ee)|0;var Ke=(p+(a=a+Math.imul(W,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(W,xe)|0)+Math.imul(V,Pe)|0))<<13)|0;p=((c=c+Math.imul(V,xe)|0)+(u>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,a=Math.imul(Y,ke),u=(u=Math.imul(Y,Ee))+Math.imul(X,ke)|0,c=Math.imul(X,Ee);var Ve=(p+(a=a+Math.imul(J,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(J,xe)|0)+Math.imul($,Pe)|0))<<13)|0;p=((c=c+Math.imul($,xe)|0)+(u>>>13)|0)+(Ve>>>26)|0,Ve&=67108863;var Ge=(p+(a=Math.imul(Y,Pe))|0)+((8191&(u=(u=Math.imul(Y,xe))+Math.imul(X,Pe)|0))<<13)|0;return p=((c=Math.imul(X,xe))+(u>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,d[0]=Te,d[1]=Ie,d[2]=Ne,d[3]=Ae,d[4]=Re,d[5]=Ce,d[6]=Oe,d[7]=De,d[8]=je,d[9]=Le,d[10]=Fe,d[11]=qe,d[12]=Ue,d[13]=ze,d[14]=He,d[15]=We,d[16]=Ke,d[17]=Ve,d[18]=Ge,0!==p&&(d[19]=p,o.length++),o};function bigMulTo(t,i,o){o.negative=i.negative^t.negative,o.length=t.length+i.length;for(var a=0,u=0,c=0;c<o.length-1;c++){var h=u;u=0;for(var l=67108863&a,d=Math.min(c,i.length-1),p=Math.max(0,c-t.length+1);p<=d;p++){var m=c-p,g=(0|t.words[m])*(0|i.words[p]),v=67108863&g;l=67108863&(v=v+l|0),u+=(h=(h=h+(g/67108864|0)|0)+(v>>>26)|0)>>>26,h&=67108863}o.words[c]=l,a=h,h=u}return 0!==a?o.words[c]=a:o.length--,o._strip()}function jumboMulTo(t,i,o){return bigMulTo(t,i,o)}function FFTM(t,i){this.x=t,this.y=i}Math.imul||(l=smallMulTo),BN.prototype.mulTo=function mulTo(t,i){var o=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,i):o<63?smallMulTo(this,t,i):o<1024?bigMulTo(this,t,i):jumboMulTo(this,t,i)},FFTM.prototype.makeRBT=function makeRBT(t){for(var i=new Array(t),o=BN.prototype._countBits(t)-1,a=0;a<t;a++)i[a]=this.revBin(a,o,t);return i},FFTM.prototype.revBin=function revBin(t,i,o){if(0===t||t===o-1)return t;for(var a=0,u=0;u<i;u++)a|=(1&t)<<i-u-1,t>>=1;return a},FFTM.prototype.permute=function permute(t,i,o,a,u,c){for(var h=0;h<c;h++)a[h]=i[t[h]],u[h]=o[t[h]]},FFTM.prototype.transform=function transform(t,i,o,a,u,c){this.permute(c,t,i,o,a,u);for(var h=1;h<u;h<<=1)for(var l=h<<1,d=Math.cos(2*Math.PI/l),p=Math.sin(2*Math.PI/l),m=0;m<u;m+=l)for(var g=d,v=p,b=0;b<h;b++){var w=o[m+b],_=a[m+b],M=o[m+b+h],k=a[m+b+h],B=g*M-v*k;k=g*k+v*M,M=B,o[m+b]=w+M,a[m+b]=_+k,o[m+b+h]=w-M,a[m+b+h]=_-k,b!==l&&(B=d*g-p*v,v=d*v+p*g,g=B)}},FFTM.prototype.guessLen13b=function guessLen13b(t,i){var o=1|Math.max(i,t),a=1&o,u=0;for(o=o/2|0;o;o>>>=1)u++;return 1<<u+1+a},FFTM.prototype.conjugate=function conjugate(t,i,o){if(!(o<=1))for(var a=0;a<o/2;a++){var u=t[a];t[a]=t[o-a-1],t[o-a-1]=u,u=i[a],i[a]=-i[o-a-1],i[o-a-1]=-u}},FFTM.prototype.normalize13b=function normalize13b(t,i){for(var o=0,a=0;a<i/2;a++){var u=8192*Math.round(t[2*a+1]/i)+Math.round(t[2*a]/i)+o;t[a]=67108863&u,o=u<67108864?0:u/67108864|0}return t},FFTM.prototype.convert13b=function convert13b(t,i,o,a){for(var u=0,c=0;c<i;c++)u+=0|t[c],o[2*c]=8191&u,u>>>=13,o[2*c+1]=8191&u,u>>>=13;for(c=2*i;c<a;++c)o[c]=0;assert(0===u),assert(0==(-8192&u))},FFTM.prototype.stub=function stub(t){for(var i=new Array(t),o=0;o<t;o++)i[o]=0;return i},FFTM.prototype.mulp=function mulp(t,i,o){var a=2*this.guessLen13b(t.length,i.length),u=this.makeRBT(a),c=this.stub(a),h=new Array(a),l=new Array(a),d=new Array(a),p=new Array(a),m=new Array(a),g=new Array(a),v=o.words;v.length=a,this.convert13b(t.words,t.length,h,a),this.convert13b(i.words,i.length,p,a),this.transform(h,c,l,d,a,u),this.transform(p,c,m,g,a,u);for(var b=0;b<a;b++){var w=l[b]*m[b]-d[b]*g[b];d[b]=l[b]*g[b]+d[b]*m[b],l[b]=w}return this.conjugate(l,d,a),this.transform(l,d,v,c,a,u),this.conjugate(v,c,a),this.normalize13b(v,a),o.negative=t.negative^i.negative,o.length=t.length+i.length,o._strip()},BN.prototype.mul=function mul(t){var i=new BN(null);return i.words=new Array(this.length+t.length),this.mulTo(t,i)},BN.prototype.mulf=function mulf(t){var i=new BN(null);return i.words=new Array(this.length+t.length),jumboMulTo(this,t,i)},BN.prototype.imul=function imul(t){return this.clone().mulTo(t,this)},BN.prototype.imuln=function imuln(t){var i=t<0;i&&(t=-t),assert("number"==typeof t),assert(t<67108864);for(var o=0,a=0;a<this.length;a++){var u=(0|this.words[a])*t,c=(67108863&u)+(67108863&o);o>>=26,o+=u/67108864|0,o+=c>>>26,this.words[a]=67108863&c}return 0!==o&&(this.words[a]=o,this.length++),i?this.ineg():this},BN.prototype.muln=function muln(t){return this.clone().imuln(t)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(t){var i=function toBitArray(t){for(var i=new Array(t.bitLength()),o=0;o<i.length;o++){var a=o/26|0,u=o%26;i[o]=t.words[a]>>>u&1}return i}(t);if(0===i.length)return new BN(1);for(var o=this,a=0;a<i.length&&0===i[a];a++,o=o.sqr());if(++a<i.length)for(var u=o.sqr();a<i.length;a++,u=u.sqr())0!==i[a]&&(o=o.mul(u));return o},BN.prototype.iushln=function iushln(t){assert("number"==typeof t&&t>=0);var i,o=t%26,a=(t-o)/26,u=67108863>>>26-o<<26-o;if(0!==o){var c=0;for(i=0;i<this.length;i++){var h=this.words[i]&u,l=(0|this.words[i])-h<<o;this.words[i]=l|c,c=h>>>26-o}c&&(this.words[i]=c,this.length++)}if(0!==a){for(i=this.length-1;i>=0;i--)this.words[i+a]=this.words[i];for(i=0;i<a;i++)this.words[i]=0;this.length+=a}return this._strip()},BN.prototype.ishln=function ishln(t){return assert(0===this.negative),this.iushln(t)},BN.prototype.iushrn=function iushrn(t,i,o){var a;assert("number"==typeof t&&t>=0),a=i?(i-i%26)/26:0;var u=t%26,c=Math.min((t-u)/26,this.length),h=67108863^67108863>>>u<<u,l=o;if(a-=c,a=Math.max(0,a),l){for(var d=0;d<c;d++)l.words[d]=this.words[d];l.length=c}if(0===c);else if(this.length>c)for(this.length-=c,d=0;d<this.length;d++)this.words[d]=this.words[d+c];else this.words[0]=0,this.length=1;var p=0;for(d=this.length-1;d>=0&&(0!==p||d>=a);d--){var m=0|this.words[d];this.words[d]=p<<26-u|m>>>u,p=m&h}return l&&0!==p&&(l.words[l.length++]=p),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},BN.prototype.ishrn=function ishrn(t,i,o){return assert(0===this.negative),this.iushrn(t,i,o)},BN.prototype.shln=function shln(t){return this.clone().ishln(t)},BN.prototype.ushln=function ushln(t){return this.clone().iushln(t)},BN.prototype.shrn=function shrn(t){return this.clone().ishrn(t)},BN.prototype.ushrn=function ushrn(t){return this.clone().iushrn(t)},BN.prototype.testn=function testn(t){assert("number"==typeof t&&t>=0);var i=t%26,o=(t-i)/26,a=1<<i;return!(this.length<=o)&&!!(this.words[o]&a)},BN.prototype.imaskn=function imaskn(t){assert("number"==typeof t&&t>=0);var i=t%26,o=(t-i)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==i&&o++,this.length=Math.min(o,this.length),0!==i){var a=67108863^67108863>>>i<<i;this.words[this.length-1]&=a}return this._strip()},BN.prototype.maskn=function maskn(t){return this.clone().imaskn(t)},BN.prototype.iaddn=function iaddn(t){return assert("number"==typeof t),assert(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},BN.prototype._iaddn=function _iaddn(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},BN.prototype.isubn=function isubn(t){if(assert("number"==typeof t),assert(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this._strip()},BN.prototype.addn=function addn(t){return this.clone().iaddn(t)},BN.prototype.subn=function subn(t){return this.clone().isubn(t)},BN.prototype.iabs=function iabs(){return this.negative=0,this},BN.prototype.abs=function abs(){return this.clone().iabs()},BN.prototype._ishlnsubmul=function _ishlnsubmul(t,i,o){var a,u,c=t.length+o;this._expand(c);var h=0;for(a=0;a<t.length;a++){u=(0|this.words[a+o])+h;var l=(0|t.words[a])*i;h=((u-=67108863&l)>>26)-(l/67108864|0),this.words[a+o]=67108863&u}for(;a<this.length-o;a++)h=(u=(0|this.words[a+o])+h)>>26,this.words[a+o]=67108863&u;if(0===h)return this._strip();for(assert(-1===h),h=0,a=0;a<this.length;a++)h=(u=-(0|this.words[a])+h)>>26,this.words[a]=67108863&u;return this.negative=1,this._strip()},BN.prototype._wordDiv=function _wordDiv(t,i){var o=(this.length,t.length),a=this.clone(),u=t,c=0|u.words[u.length-1];0!==(o=26-this._countBits(c))&&(u=u.ushln(o),a.iushln(o),c=0|u.words[u.length-1]);var h,l=a.length-u.length;if("mod"!==i){(h=new BN(null)).length=l+1,h.words=new Array(h.length);for(var d=0;d<h.length;d++)h.words[d]=0}var p=a.clone()._ishlnsubmul(u,1,l);0===p.negative&&(a=p,h&&(h.words[l]=1));for(var m=l-1;m>=0;m--){var g=67108864*(0|a.words[u.length+m])+(0|a.words[u.length+m-1]);for(g=Math.min(g/c|0,67108863),a._ishlnsubmul(u,g,m);0!==a.negative;)g--,a.negative=0,a._ishlnsubmul(u,1,m),a.isZero()||(a.negative^=1);h&&(h.words[m]=g)}return h&&h._strip(),a._strip(),"div"!==i&&0!==o&&a.iushrn(o),{div:h||null,mod:a}},BN.prototype.divmod=function divmod(t,i,o){return assert(!t.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===t.negative?(c=this.neg().divmod(t,i),"mod"!==i&&(a=c.div.neg()),"div"!==i&&(u=c.mod.neg(),o&&0!==u.negative&&u.iadd(t)),{div:a,mod:u}):0===this.negative&&0!==t.negative?(c=this.divmod(t.neg(),i),"mod"!==i&&(a=c.div.neg()),{div:a,mod:c.mod}):0!=(this.negative&t.negative)?(c=this.neg().divmod(t.neg(),i),"div"!==i&&(u=c.mod.neg(),o&&0!==u.negative&&u.isub(t)),{div:c.div,mod:u}):t.length>this.length||this.cmp(t)<0?{div:new BN(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new BN(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new BN(this.modrn(t.words[0]))}:this._wordDiv(t,i);var a,u,c},BN.prototype.div=function div(t){return this.divmod(t,"div",!1).div},BN.prototype.mod=function mod(t){return this.divmod(t,"mod",!1).mod},BN.prototype.umod=function umod(t){return this.divmod(t,"mod",!0).mod},BN.prototype.divRound=function divRound(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var o=0!==i.div.negative?i.mod.isub(t):i.mod,a=t.ushrn(1),u=t.andln(1),c=o.cmp(a);return c<0||1===u&&0===c?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},BN.prototype.modrn=function modrn(t){var i=t<0;i&&(t=-t),assert(t<=67108863);for(var o=(1<<26)%t,a=0,u=this.length-1;u>=0;u--)a=(o*a+(0|this.words[u]))%t;return i?-a:a},BN.prototype.modn=function modn(t){return this.modrn(t)},BN.prototype.idivn=function idivn(t){var i=t<0;i&&(t=-t),assert(t<=67108863);for(var o=0,a=this.length-1;a>=0;a--){var u=(0|this.words[a])+67108864*o;this.words[a]=u/t|0,o=u%t}return this._strip(),i?this.ineg():this},BN.prototype.divn=function divn(t){return this.clone().idivn(t)},BN.prototype.egcd=function egcd(t){assert(0===t.negative),assert(!t.isZero());var i=this,o=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var a=new BN(1),u=new BN(0),c=new BN(0),h=new BN(1),l=0;i.isEven()&&o.isEven();)i.iushrn(1),o.iushrn(1),++l;for(var d=o.clone(),p=i.clone();!i.isZero();){for(var m=0,g=1;0==(i.words[0]&g)&&m<26;++m,g<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(p)),a.iushrn(1),u.iushrn(1);for(var v=0,b=1;0==(o.words[0]&b)&&v<26;++v,b<<=1);if(v>0)for(o.iushrn(v);v-- >0;)(c.isOdd()||h.isOdd())&&(c.iadd(d),h.isub(p)),c.iushrn(1),h.iushrn(1);i.cmp(o)>=0?(i.isub(o),a.isub(c),u.isub(h)):(o.isub(i),c.isub(a),h.isub(u))}return{a:c,b:h,gcd:o.iushln(l)}},BN.prototype._invmp=function _invmp(t){assert(0===t.negative),assert(!t.isZero());var i=this,o=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var a,u=new BN(1),c=new BN(0),h=o.clone();i.cmpn(1)>0&&o.cmpn(1)>0;){for(var l=0,d=1;0==(i.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(i.iushrn(l);l-- >0;)u.isOdd()&&u.iadd(h),u.iushrn(1);for(var p=0,m=1;0==(o.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(o.iushrn(p);p-- >0;)c.isOdd()&&c.iadd(h),c.iushrn(1);i.cmp(o)>=0?(i.isub(o),u.isub(c)):(o.isub(i),c.isub(u))}return(a=0===i.cmpn(1)?u:c).cmpn(0)<0&&a.iadd(t),a},BN.prototype.gcd=function gcd(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),o=t.clone();i.negative=0,o.negative=0;for(var a=0;i.isEven()&&o.isEven();a++)i.iushrn(1),o.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;o.isEven();)o.iushrn(1);var u=i.cmp(o);if(u<0){var c=i;i=o,o=c}else if(0===u||0===o.cmpn(1))break;i.isub(o)}return o.iushln(a)},BN.prototype.invm=function invm(t){return this.egcd(t).a.umod(t)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(t){return this.words[0]&t},BN.prototype.bincn=function bincn(t){assert("number"==typeof t);var i=t%26,o=(t-i)/26,a=1<<i;if(this.length<=o)return this._expand(o+1),this.words[o]|=a,this;for(var u=a,c=o;0!==u&&c<this.length;c++){var h=0|this.words[c];u=(h+=u)>>>26,h&=67108863,this.words[c]=h}return 0!==u&&(this.words[c]=u,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(t){var i,o=t<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this._strip(),this.length>1)i=1;else{o&&(t=-t),assert(t<=67108863,"Number is too big");var a=0|this.words[0];i=a===t?0:a<t?-1:1}return 0!==this.negative?0|-i:i},BN.prototype.cmp=function cmp(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var i=this.ucmp(t);return 0!==this.negative?0|-i:i},BN.prototype.ucmp=function ucmp(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,o=this.length-1;o>=0;o--){var a=0|this.words[o],u=0|t.words[o];if(a!==u){a<u?i=-1:a>u&&(i=1);break}}return i},BN.prototype.gtn=function gtn(t){return 1===this.cmpn(t)},BN.prototype.gt=function gt(t){return 1===this.cmp(t)},BN.prototype.gten=function gten(t){return this.cmpn(t)>=0},BN.prototype.gte=function gte(t){return this.cmp(t)>=0},BN.prototype.ltn=function ltn(t){return-1===this.cmpn(t)},BN.prototype.lt=function lt(t){return-1===this.cmp(t)},BN.prototype.lten=function lten(t){return this.cmpn(t)<=0},BN.prototype.lte=function lte(t){return this.cmp(t)<=0},BN.prototype.eqn=function eqn(t){return 0===this.cmpn(t)},BN.prototype.eq=function eq(t){return 0===this.cmp(t)},BN.red=function red(t){return new Red(t)},BN.prototype.toRed=function toRed(t){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(t){return this.red=t,this},BN.prototype.forceRed=function forceRed(t){return assert(!this.red,"Already a number in reduction context"),this._forceRed(t)},BN.prototype.redAdd=function redAdd(t){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},BN.prototype.redIAdd=function redIAdd(t){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},BN.prototype.redSub=function redSub(t){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},BN.prototype.redISub=function redISub(t){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},BN.prototype.redShl=function redShl(t){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},BN.prototype.redMul=function redMul(t){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},BN.prototype.redIMul=function redIMul(t){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(t){return assert(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(t,i){this.name=t,this.p=new BN(i,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(t){if("string"==typeof t){var i=BN._prime(t);this.m=i.p,this.prime=i}else assert(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function Mont(t){Red.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var t=new BN(null);return t.words=new Array(Math.ceil(this.n/13)),t},MPrime.prototype.ireduce=function ireduce(t){var i,o=t;do{this.split(o,this.tmp),i=(o=(o=this.imulK(o)).iadd(this.tmp)).bitLength()}while(i>this.n);var a=i<this.n?-1:o.ucmp(this.p);return 0===a?(o.words[0]=0,o.length=1):a>0?o.isub(this.p):void 0!==o.strip?o.strip():o._strip(),o},MPrime.prototype.split=function split(t,i){t.iushrn(this.n,0,i)},MPrime.prototype.imulK=function imulK(t){return t.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(t,i){for(var o=Math.min(t.length,9),a=0;a<o;a++)i.words[a]=t.words[a];if(i.length=o,t.length<=9)return t.words[0]=0,void(t.length=1);var u=t.words[9];for(i.words[i.length++]=4194303&u,a=10;a<t.length;a++){var c=0|t.words[a];t.words[a-10]=(4194303&c)<<4|u>>>22,u=c}u>>>=22,t.words[a-10]=u,0===u&&t.length>10?t.length-=10:t.length-=9},K256.prototype.imulK=function imulK(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,o=0;o<t.length;o++){var a=0|t.words[o];i+=977*a,t.words[o]=67108863&i,i=64*a+(i/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},inherits(P224,MPrime),inherits(P192,MPrime),inherits(P25519,MPrime),P25519.prototype.imulK=function imulK(t){for(var i=0,o=0;o<t.length;o++){var a=19*(0|t.words[o])+i,u=67108863&a;a>>>=26,t.words[o]=u,i=a}return 0!==i&&(t.words[t.length++]=i),t},BN._prime=function prime(t){if(d[t])return d[t];var prime;if("k256"===t)prime=new K256;else if("p224"===t)prime=new P224;else if("p192"===t)prime=new P192;else{if("p25519"!==t)throw new Error("Unknown prime "+t);prime=new P25519}return d[t]=prime,prime},Red.prototype._verify1=function _verify1(t){assert(0===t.negative,"red works only with positives"),assert(t.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(t,i){assert(0==(t.negative|i.negative),"red works only with positives"),assert(t.red&&t.red===i.red,"red works only with red numbers")},Red.prototype.imod=function imod(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(move(t,t.umod(this.m)._forceRed(this)),t)},Red.prototype.neg=function neg(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Red.prototype.add=function add(t,i){this._verify2(t,i);var o=t.add(i);return o.cmp(this.m)>=0&&o.isub(this.m),o._forceRed(this)},Red.prototype.iadd=function iadd(t,i){this._verify2(t,i);var o=t.iadd(i);return o.cmp(this.m)>=0&&o.isub(this.m),o},Red.prototype.sub=function sub(t,i){this._verify2(t,i);var o=t.sub(i);return o.cmpn(0)<0&&o.iadd(this.m),o._forceRed(this)},Red.prototype.isub=function isub(t,i){this._verify2(t,i);var o=t.isub(i);return o.cmpn(0)<0&&o.iadd(this.m),o},Red.prototype.shl=function shl(t,i){return this._verify1(t),this.imod(t.ushln(i))},Red.prototype.imul=function imul(t,i){return this._verify2(t,i),this.imod(t.imul(i))},Red.prototype.mul=function mul(t,i){return this._verify2(t,i),this.imod(t.mul(i))},Red.prototype.isqr=function isqr(t){return this.imul(t,t.clone())},Red.prototype.sqr=function sqr(t){return this.mul(t,t)},Red.prototype.sqrt=function sqrt(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(assert(i%2==1),3===i){var o=this.m.add(new BN(1)).iushrn(2);return this.pow(t,o)}for(var a=this.m.subn(1),u=0;!a.isZero()&&0===a.andln(1);)u++,a.iushrn(1);assert(!a.isZero());var c=new BN(1).toRed(this),h=c.redNeg(),l=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,l).cmp(h);)d.redIAdd(h);for(var p=this.pow(d,a),m=this.pow(t,a.addn(1).iushrn(1)),g=this.pow(t,a),v=u;0!==g.cmp(c);){for(var b=g,w=0;0!==b.cmp(c);w++)b=b.redSqr();assert(w<v);var _=this.pow(p,new BN(1).iushln(v-w-1));m=m.redMul(_),p=_.redSqr(),g=g.redMul(p),v=w}return m},Red.prototype.invm=function invm(t){var i=t._invmp(this.m);return 0!==i.negative?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},Red.prototype.pow=function pow(t,i){if(i.isZero())return new BN(1).toRed(this);if(0===i.cmpn(1))return t.clone();var o=new Array(16);o[0]=new BN(1).toRed(this),o[1]=t;for(var a=2;a<o.length;a++)o[a]=this.mul(o[a-1],t);var u=o[0],c=0,h=0,l=i.bitLength()%26;for(0===l&&(l=26),a=i.length-1;a>=0;a--){for(var d=i.words[a],p=l-1;p>=0;p--){var m=d>>p&1;u!==o[0]&&(u=this.sqr(u)),0!==m||0!==c?(c<<=1,c|=m,(4===++h||0===a&&0===p)&&(u=this.mul(u,o[c]),h=0,c=0)):h=0}l=26}return u},Red.prototype.convertTo=function convertTo(t){var i=t.umod(this.m);return i===t?i.clone():i},Red.prototype.convertFrom=function convertFrom(t){var i=t.clone();return i.red=null,i},BN.mont=function mont(t){return new Mont(t)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(t){return this.imod(t.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},Mont.prototype.imul=function imul(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var o=t.imul(i),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=o.isub(a).iushrn(this.shift),c=u;return u.cmp(this.m)>=0?c=u.isub(this.m):u.cmpn(0)<0&&(c=u.iadd(this.m)),c._forceRed(this)},Mont.prototype.mul=function mul(t,i){if(t.isZero()||i.isZero())return new BN(0)._forceRed(this);var o=t.mul(i),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=o.isub(a).iushrn(this.shift),c=u;return u.cmp(this.m)>=0?c=u.isub(this.m):u.cmpn(0)<0&&(c=u.iadd(this.m)),c._forceRed(this)},Mont.prototype.invm=function invm(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,o(60)(t))},function(t,i,o){"use strict";var a=i;a.version=o(719).version,a.utils=o(36),a.rand=o(179),a.curve=o(296),a.curves=o(184),a.ec=o(731),a.eddsa=o(735)},function(t,i,o){"use strict";var a,u=i,c=o(185),h=o(296),l=o(36).assert;function PresetCurve(t){"short"===t.type?this.curve=new h.short(t):"edwards"===t.type?this.curve=new h.edwards(t):this.curve=new h.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,l(this.g.validate(),"Invalid curve"),l(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function defineCurve(t,i){Object.defineProperty(u,t,{configurable:!0,enumerable:!0,get:function(){var o=new PresetCurve(i);return Object.defineProperty(u,t,{configurable:!0,enumerable:!0,value:o}),o}})}u.PresetCurve=PresetCurve,defineCurve("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:c.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),defineCurve("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:c.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),defineCurve("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:c.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),defineCurve("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:c.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),defineCurve("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:c.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),defineCurve("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:c.sha256,gRed:!1,g:["9"]}),defineCurve("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:c.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{a=o(730)}catch(t){a=void 0}defineCurve("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:c.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",a]})},function(t,i,o){var a=i;a.utils=o(42),a.common=o(100),a.sha=o(724),a.ripemd=o(728),a.hmac=o(729),a.sha1=a.sha.sha1,a.sha256=a.sha.sha256,a.sha224=a.sha.sha224,a.sha384=a.sha.sha384,a.sha512=a.sha.sha512,a.ripemd160=a.ripemd.ripemd160},function(t,i,o){"use strict";(function(i){var a,u=o(10),c=u.Buffer,h={};for(a in u)u.hasOwnProperty(a)&&"SlowBuffer"!==a&&"Buffer"!==a&&(h[a]=u[a]);var l=h.Buffer={};for(a in c)c.hasOwnProperty(a)&&"allocUnsafe"!==a&&"allocUnsafeSlow"!==a&&(l[a]=c[a]);if(h.Buffer.prototype=c.prototype,l.from&&l.from!==Uint8Array.from||(l.from=function(t,i,o){if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof t);if(t&&void 0===t.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);return c(t,i,o)}),l.alloc||(l.alloc=function(t,i,o){if("number"!=typeof t)throw new TypeError('The "size" argument must be of type number. Received type '+typeof t);if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var a=c(t);return i&&0!==i.length?"string"==typeof o?a.fill(i,o):a.fill(i):a.fill(0),a}),!h.kStringMaxLength)try{h.kStringMaxLength=i.binding("buffer").kStringMaxLength}catch(t){}h.constants||(h.constants={MAX_LENGTH:h.kMaxLength},h.kStringMaxLength&&(h.constants.MAX_STRING_LENGTH=h.kStringMaxLength)),t.exports=h}).call(this,o(11))},function(t,i,o){"use strict";const a=o(188).Reporter,u=o(101).EncoderBuffer,c=o(101).DecoderBuffer,h=o(35),l=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],d=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(l);function Node(t,i,o){const a={};this._baseState=a,a.name=o,a.enc=t,a.parent=i||null,a.children=null,a.tag=null,a.args=null,a.reverseArgs=null,a.choice=null,a.optional=!1,a.any=!1,a.obj=!1,a.use=null,a.useDecoder=null,a.key=null,a.default=null,a.explicit=null,a.implicit=null,a.contains=null,a.parent||(a.children=[],this._wrap())}t.exports=Node;const p=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];Node.prototype.clone=function clone(){const t=this._baseState,i={};p.forEach((function(o){i[o]=t[o]}));const o=new this.constructor(i.parent);return o._baseState=i,o},Node.prototype._wrap=function wrap(){const t=this._baseState;d.forEach((function(i){this[i]=function _wrappedMethod(){const o=new this.constructor(this);return t.children.push(o),o[i].apply(o,arguments)}}),this)},Node.prototype._init=function init(t){const i=this._baseState;h(null===i.parent),t.call(this),i.children=i.children.filter((function(t){return t._baseState.parent===this}),this),h.equal(i.children.length,1,"Root node can have only one child")},Node.prototype._useArgs=function useArgs(t){const i=this._baseState,o=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==o.length&&(h(null===i.children),i.children=o,o.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(h(null===i.args),i.args=t,i.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;const i={};return Object.keys(t).forEach((function(o){o==(0|o)&&(o|=0);const a=t[o];i[a]=o})),i})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){Node.prototype[t]=function _overrided(){const i=this._baseState;throw new Error(t+" not implemented for encoding: "+i.enc)}})),l.forEach((function(t){Node.prototype[t]=function _tagMethod(){const i=this._baseState,o=Array.prototype.slice.call(arguments);return h(null===i.tag),i.tag=t,this._useArgs(o),this}})),Node.prototype.use=function use(t){h(t);const i=this._baseState;return h(null===i.use),i.use=t,this},Node.prototype.optional=function optional(){return this._baseState.optional=!0,this},Node.prototype.def=function def(t){const i=this._baseState;return h(null===i.default),i.default=t,i.optional=!0,this},Node.prototype.explicit=function explicit(t){const i=this._baseState;return h(null===i.explicit&&null===i.implicit),i.explicit=t,this},Node.prototype.implicit=function implicit(t){const i=this._baseState;return h(null===i.explicit&&null===i.implicit),i.implicit=t,this},Node.prototype.obj=function obj(){const t=this._baseState,i=Array.prototype.slice.call(arguments);return t.obj=!0,0!==i.length&&this._useArgs(i),this},Node.prototype.key=function key(t){const i=this._baseState;return h(null===i.key),i.key=t,this},Node.prototype.any=function any(){return this._baseState.any=!0,this},Node.prototype.choice=function choice(t){const i=this._baseState;return h(null===i.choice),i.choice=t,this._useArgs(Object.keys(t).map((function(i){return t[i]}))),this},Node.prototype.contains=function contains(t){const i=this._baseState;return h(null===i.use),i.contains=t,this},Node.prototype._decode=function decode(t,i){const o=this._baseState;if(null===o.parent)return t.wrapResult(o.children[0]._decode(t,i));let a,u=o.default,h=!0,l=null;if(null!==o.key&&(l=t.enterKey(o.key)),o.optional){let a=null;if(null!==o.explicit?a=o.explicit:null!==o.implicit?a=o.implicit:null!==o.tag&&(a=o.tag),null!==a||o.any){if(h=this._peekTag(t,a,o.any),t.isError(h))return h}else{const a=t.save();try{null===o.choice?this._decodeGeneric(o.tag,t,i):this._decodeChoice(t,i),h=!0}catch(t){h=!1}t.restore(a)}}if(o.obj&&h&&(a=t.enterObject()),h){if(null!==o.explicit){const i=this._decodeTag(t,o.explicit);if(t.isError(i))return i;t=i}const a=t.offset;if(null===o.use&&null===o.choice){let i;o.any&&(i=t.save());const a=this._decodeTag(t,null!==o.implicit?o.implicit:o.tag,o.any);if(t.isError(a))return a;o.any?u=t.raw(i):t=a}if(i&&i.track&&null!==o.tag&&i.track(t.path(),a,t.length,"tagged"),i&&i.track&&null!==o.tag&&i.track(t.path(),t.offset,t.length,"content"),o.any||(u=null===o.choice?this._decodeGeneric(o.tag,t,i):this._decodeChoice(t,i)),t.isError(u))return u;if(o.any||null!==o.choice||null===o.children||o.children.forEach((function decodeChildren(o){o._decode(t,i)})),o.contains&&("octstr"===o.tag||"bitstr"===o.tag)){const a=new c(u);u=this._getUse(o.contains,t._reporterState.obj)._decode(a,i)}}return o.obj&&h&&(u=t.leaveObject(a)),null===o.key||null===u&&!0!==h?null!==l&&t.exitKey(l):t.leaveKey(l,o.key,u),u},Node.prototype._decodeGeneric=function decodeGeneric(t,i,o){const a=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(i,t,a.args[0],o):/str$/.test(t)?this._decodeStr(i,t,o):"objid"===t&&a.args?this._decodeObjid(i,a.args[0],a.args[1],o):"objid"===t?this._decodeObjid(i,null,null,o):"gentime"===t||"utctime"===t?this._decodeTime(i,t,o):"null_"===t?this._decodeNull(i,o):"bool"===t?this._decodeBool(i,o):"objDesc"===t?this._decodeStr(i,t,o):"int"===t||"enum"===t?this._decodeInt(i,a.args&&a.args[0],o):null!==a.use?this._getUse(a.use,i._reporterState.obj)._decode(i,o):i.error("unknown tag: "+t)},Node.prototype._getUse=function _getUse(t,i){const o=this._baseState;return o.useDecoder=this._use(t,i),h(null===o.useDecoder._baseState.parent),o.useDecoder=o.useDecoder._baseState.children[0],o.implicit!==o.useDecoder._baseState.implicit&&(o.useDecoder=o.useDecoder.clone(),o.useDecoder._baseState.implicit=o.implicit),o.useDecoder},Node.prototype._decodeChoice=function decodeChoice(t,i){const o=this._baseState;let a=null,u=!1;return Object.keys(o.choice).some((function(c){const h=t.save(),l=o.choice[c];try{const o=l._decode(t,i);if(t.isError(o))return!1;a={type:c,value:o},u=!0}catch(i){return t.restore(h),!1}return!0}),this),u?a:t.error("Choice not matched")},Node.prototype._createEncoderBuffer=function createEncoderBuffer(t){return new u(t,this.reporter)},Node.prototype._encode=function encode(t,i,o){const a=this._baseState;if(null!==a.default&&a.default===t)return;const u=this._encodeValue(t,i,o);return void 0===u||this._skipDefault(u,i,o)?void 0:u},Node.prototype._encodeValue=function encode(t,i,o){const u=this._baseState;if(null===u.parent)return u.children[0]._encode(t,i||new a);let c=null;if(this.reporter=i,u.optional&&void 0===t){if(null===u.default)return;t=u.default}let h=null,l=!1;if(u.any)c=this._createEncoderBuffer(t);else if(u.choice)c=this._encodeChoice(t,i);else if(u.contains)h=this._getUse(u.contains,o)._encode(t,i),l=!0;else if(u.children)h=u.children.map((function(o){if("null_"===o._baseState.tag)return o._encode(null,i,t);if(null===o._baseState.key)return i.error("Child should have a key");const a=i.enterKey(o._baseState.key);if("object"!=typeof t)return i.error("Child expected, but input is not object");const u=o._encode(t[o._baseState.key],i,t);return i.leaveKey(a),u}),this).filter((function(t){return t})),h=this._createEncoderBuffer(h);else if("seqof"===u.tag||"setof"===u.tag){if(!u.args||1!==u.args.length)return i.error("Too many args for : "+u.tag);if(!Array.isArray(t))return i.error("seqof/setof, but data is not Array");const o=this.clone();o._baseState.implicit=null,h=this._createEncoderBuffer(t.map((function(o){const a=this._baseState;return this._getUse(a.args[0],t)._encode(o,i)}),o))}else null!==u.use?c=this._getUse(u.use,o)._encode(t,i):(h=this._encodePrimitive(u.tag,t),l=!0);if(!u.any&&null===u.choice){const t=null!==u.implicit?u.implicit:u.tag,o=null===u.implicit?"universal":"context";null===t?null===u.use&&i.error("Tag could be omitted only for .use()"):null===u.use&&(c=this._encodeComposite(t,l,o,h))}return null!==u.explicit&&(c=this._encodeComposite(u.explicit,!1,"context",c)),c},Node.prototype._encodeChoice=function encodeChoice(t,i){const o=this._baseState,a=o.choice[t.type];return a||h(!1,t.type+" not found in "+JSON.stringify(Object.keys(o.choice))),a._encode(t.value,i)},Node.prototype._encodePrimitive=function encodePrimitive(t,i){const o=this._baseState;if(/str$/.test(t))return this._encodeStr(i,t);if("objid"===t&&o.args)return this._encodeObjid(i,o.reverseArgs[0],o.args[1]);if("objid"===t)return this._encodeObjid(i,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(i,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(i,o.args&&o.reverseArgs[0]);if("bool"===t)return this._encodeBool(i);if("objDesc"===t)return this._encodeStr(i,t);throw new Error("Unsupported tag: "+t)},Node.prototype._isNumstr=function isNumstr(t){return/^[0-9 ]*$/.test(t)},Node.prototype._isPrintstr=function isPrintstr(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},function(t,i,o){"use strict";const a=o(1);function Reporter(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function ReporterError(t,i){this.path=t,this.rethrow(i)}i.Reporter=Reporter,Reporter.prototype.isError=function isError(t){return t instanceof ReporterError},Reporter.prototype.save=function save(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},Reporter.prototype.restore=function restore(t){const i=this._reporterState;i.obj=t.obj,i.path=i.path.slice(0,t.pathLen)},Reporter.prototype.enterKey=function enterKey(t){return this._reporterState.path.push(t)},Reporter.prototype.exitKey=function exitKey(t){const i=this._reporterState;i.path=i.path.slice(0,t-1)},Reporter.prototype.leaveKey=function leaveKey(t,i,o){const a=this._reporterState;this.exitKey(t),null!==a.obj&&(a.obj[i]=o)},Reporter.prototype.path=function path(){return this._reporterState.path.join("/")},Reporter.prototype.enterObject=function enterObject(){const t=this._reporterState,i=t.obj;return t.obj={},i},Reporter.prototype.leaveObject=function leaveObject(t){const i=this._reporterState,o=i.obj;return i.obj=t,o},Reporter.prototype.error=function error(t){let i;const o=this._reporterState,a=t instanceof ReporterError;if(i=a?t:new ReporterError(o.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!o.options.partial)throw i;return a||o.errors.push(i),i},Reporter.prototype.wrapResult=function wrapResult(t){const i=this._reporterState;return i.options.partial?{result:this.isError(t)?null:t,errors:i.errors}:t},a(ReporterError,Error),ReporterError.prototype.rethrow=function rethrow(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,ReporterError),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},function(t,i,o){"use strict";function reverse(t){const i={};return Object.keys(t).forEach((function(o){(0|o)==o&&(o|=0);const a=t[o];i[a]=o})),i}i.tagClass={0:"universal",1:"application",2:"context",3:"private"},i.tagClassByName=reverse(i.tagClass),i.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},i.tagByName=reverse(i.tag)},function(t,i,o){(function(t){!function(t,i){"use strict";function assert(t,i){if(!t)throw new Error(i||"Assertion failed")}function inherits(t,i){t.super_=i;var TempCtor=function(){};TempCtor.prototype=i.prototype,t.prototype=new TempCtor,t.prototype.constructor=t}function BN(t,i,o){if(BN.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(o=i,i=10),this._init(t||0,i||10,o||"be"))}var a;"object"==typeof t?t.exports=BN:i.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:o(754).Buffer}catch(t){}function parseHex4Bits(t,i){var o=t.charCodeAt(i);return o>=65&&o<=70?o-55:o>=97&&o<=102?o-87:o-48&15}function parseHexByte(t,i,o){var a=parseHex4Bits(t,o);return o-1>=i&&(a|=parseHex4Bits(t,o-1)<<4),a}function parseBase(t,i,o,a){for(var u=0,c=Math.min(t.length,o),h=i;h<c;h++){var l=t.charCodeAt(h)-48;u*=a,u+=l>=49?l-49+10:l>=17?l-17+10:l}return u}BN.isBN=function isBN(t){return t instanceof BN||null!==t&&"object"==typeof t&&t.constructor.wordSize===BN.wordSize&&Array.isArray(t.words)},BN.max=function max(t,i){return t.cmp(i)>0?t:i},BN.min=function min(t,i){return t.cmp(i)<0?t:i},BN.prototype._init=function init(t,i,o){if("number"==typeof t)return this._initNumber(t,i,o);if("object"==typeof t)return this._initArray(t,i,o);"hex"===i&&(i=16),assert(i===(0|i)&&i>=2&&i<=36);var a=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a<t.length&&(16===i?this._parseHex(t,a,o):(this._parseBase(t,i,a),"le"===o&&this._initArray(this.toArray(),i,o)))},BN.prototype._initNumber=function _initNumber(t,i,o){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(assert(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),i,o)},BN.prototype._initArray=function _initArray(t,i,o){if(assert("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var a=0;a<this.length;a++)this.words[a]=0;var u,c,h=0;if("be"===o)for(a=t.length-1,u=0;a>=0;a-=3)c=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[u]|=c<<h&67108863,this.words[u+1]=c>>>26-h&67108863,(h+=24)>=26&&(h-=26,u++);else if("le"===o)for(a=0,u=0;a<t.length;a+=3)c=t[a]|t[a+1]<<8|t[a+2]<<16,this.words[u]|=c<<h&67108863,this.words[u+1]=c>>>26-h&67108863,(h+=24)>=26&&(h-=26,u++);return this.strip()},BN.prototype._parseHex=function _parseHex(t,i,o){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var a=0;a<this.length;a++)this.words[a]=0;var u,c=0,h=0;if("be"===o)for(a=t.length-1;a>=i;a-=2)u=parseHexByte(t,i,a)<<c,this.words[h]|=67108863&u,c>=18?(c-=18,h+=1,this.words[h]|=u>>>26):c+=8;else for(a=(t.length-i)%2==0?i+1:i;a<t.length;a+=2)u=parseHexByte(t,i,a)<<c,this.words[h]|=67108863&u,c>=18?(c-=18,h+=1,this.words[h]|=u>>>26):c+=8;this.strip()},BN.prototype._parseBase=function _parseBase(t,i,o){this.words=[0],this.length=1;for(var a=0,u=1;u<=67108863;u*=i)a++;a--,u=u/i|0;for(var c=t.length-o,h=c%a,l=Math.min(c,c-h)+o,d=0,p=o;p<l;p+=a)d=parseBase(t,p,p+a,i),this.imuln(u),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d);if(0!==h){var m=1;for(d=parseBase(t,p,t.length,i),p=0;p<h;p++)m*=i;this.imuln(m),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d)}this.strip()},BN.prototype.copy=function copy(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},BN.prototype.clone=function clone(){var t=new BN(null);return this.copy(t),t},BN.prototype._expand=function _expand(t){for(;this.length<t;)this.words[this.length++]=0;return this},BN.prototype.strip=function strip(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(t,i,o){o.negative=i.negative^t.negative;var a=t.length+i.length|0;o.length=a,a=a-1|0;var u=0|t.words[0],c=0|i.words[0],h=u*c,l=67108863&h,d=h/67108864|0;o.words[0]=l;for(var p=1;p<a;p++){for(var m=d>>>26,g=67108863&d,v=Math.min(p,i.length-1),b=Math.max(0,p-t.length+1);b<=v;b++){var w=p-b|0;m+=(h=(u=0|t.words[w])*(c=0|i.words[b])+g)/67108864|0,g=67108863&h}o.words[p]=0|g,d=0|m}return 0!==d?o.words[p]=0|d:o.length--,o.strip()}BN.prototype.toString=function toString(t,i){var o;if(i=0|i||1,16===(t=t||10)||"hex"===t){o="";for(var a=0,l=0,d=0;d<this.length;d++){var p=this.words[d],m=(16777215&(p<<a|l)).toString(16);o=0!==(l=p>>>24-a&16777215)||d!==this.length-1?u[6-m.length]+m+o:m+o,(a+=2)>=26&&(a-=26,d--)}for(0!==l&&(o=l.toString(16)+o);o.length%i!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(t===(0|t)&&t>=2&&t<=36){var g=c[t],v=h[t];o="";var b=this.clone();for(b.negative=0;!b.isZero();){var w=b.modn(v).toString(t);o=(b=b.idivn(v)).isZero()?w+o:u[g-w.length]+w+o}for(this.isZero()&&(o="0"+o);o.length%i!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(t,i){return assert(void 0!==a),this.toArrayLike(a,t,i)},BN.prototype.toArray=function toArray(t,i){return this.toArrayLike(Array,t,i)},BN.prototype.toArrayLike=function toArrayLike(t,i,o){var a=this.byteLength(),u=o||Math.max(1,a);assert(a<=u,"byte array longer than desired length"),assert(u>0,"Requested array length <= 0"),this.strip();var c,h,l="le"===i,d=new t(u),p=this.clone();if(l){for(h=0;!p.isZero();h++)c=p.andln(255),p.iushrn(8),d[h]=c;for(;h<u;h++)d[h]=0}else{for(h=0;h<u-a;h++)d[h]=0;for(h=0;!p.isZero();h++)c=p.andln(255),p.iushrn(8),d[u-h-1]=c}return d},Math.clz32?BN.prototype._countBits=function _countBits(t){return 32-Math.clz32(t)}:BN.prototype._countBits=function _countBits(t){var i=t,o=0;return i>=4096&&(o+=13,i>>>=13),i>=64&&(o+=7,i>>>=7),i>=8&&(o+=4,i>>>=4),i>=2&&(o+=2,i>>>=2),o+i},BN.prototype._zeroBits=function _zeroBits(t){if(0===t)return 26;var i=t,o=0;return 0==(8191&i)&&(o+=13,i>>>=13),0==(127&i)&&(o+=7,i>>>=7),0==(15&i)&&(o+=4,i>>>=4),0==(3&i)&&(o+=2,i>>>=2),0==(1&i)&&o++,o},BN.prototype.bitLength=function bitLength(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var o=this._zeroBits(this.words[i]);if(t+=o,26!==o)break}return t},BN.prototype.byteLength=function byteLength(){return Math.ceil(this.bitLength()/8)},BN.prototype.toTwos=function toTwos(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},BN.prototype.fromTwos=function fromTwos(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},BN.prototype.isNeg=function isNeg(){return 0!==this.negative},BN.prototype.neg=function neg(){return this.clone().ineg()},BN.prototype.ineg=function ineg(){return this.isZero()||(this.negative^=1),this},BN.prototype.iuor=function iuor(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this.strip()},BN.prototype.ior=function ior(t){return assert(0==(this.negative|t.negative)),this.iuor(t)},BN.prototype.or=function or(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},BN.prototype.uor=function uor(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},BN.prototype.iuand=function iuand(t){var i;i=this.length>t.length?t:this;for(var o=0;o<i.length;o++)this.words[o]=this.words[o]&t.words[o];return this.length=i.length,this.strip()},BN.prototype.iand=function iand(t){return assert(0==(this.negative|t.negative)),this.iuand(t)},BN.prototype.and=function and(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},BN.prototype.uand=function uand(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},BN.prototype.iuxor=function iuxor(t){var i,o;this.length>t.length?(i=this,o=t):(i=t,o=this);for(var a=0;a<o.length;a++)this.words[a]=i.words[a]^o.words[a];if(this!==i)for(;a<i.length;a++)this.words[a]=i.words[a];return this.length=i.length,this.strip()},BN.prototype.ixor=function ixor(t){return assert(0==(this.negative|t.negative)),this.iuxor(t)},BN.prototype.xor=function xor(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},BN.prototype.uxor=function uxor(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},BN.prototype.inotn=function inotn(t){assert("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),o=t%26;this._expand(i),o>0&&i--;for(var a=0;a<i;a++)this.words[a]=67108863&~this.words[a];return o>0&&(this.words[a]=~this.words[a]&67108863>>26-o),this.strip()},BN.prototype.notn=function notn(t){return this.clone().inotn(t)},BN.prototype.setn=function setn(t,i){assert("number"==typeof t&&t>=0);var o=t/26|0,a=t%26;return this._expand(o+1),this.words[o]=i?this.words[o]|1<<a:this.words[o]&~(1<<a),this.strip()},BN.prototype.iadd=function iadd(t){var i,o,a;if(0!==this.negative&&0===t.negative)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();this.length>t.length?(o=this,a=t):(o=t,a=this);for(var u=0,c=0;c<a.length;c++)i=(0|o.words[c])+(0|a.words[c])+u,this.words[c]=67108863&i,u=i>>>26;for(;0!==u&&c<o.length;c++)i=(0|o.words[c])+u,this.words[c]=67108863&i,u=i>>>26;if(this.length=o.length,0!==u)this.words[this.length]=u,this.length++;else if(o!==this)for(;c<o.length;c++)this.words[c]=o.words[c];return this},BN.prototype.add=function add(t){var i;return 0!==t.negative&&0===this.negative?(t.negative=0,i=this.sub(t),t.negative^=1,i):0===t.negative&&0!==this.negative?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},BN.prototype.isub=function isub(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var o,a,u=this.cmp(t);if(0===u)return this.negative=0,this.length=1,this.words[0]=0,this;u>0?(o=this,a=t):(o=t,a=this);for(var c=0,h=0;h<a.length;h++)c=(i=(0|o.words[h])-(0|a.words[h])+c)>>26,this.words[h]=67108863&i;for(;0!==c&&h<o.length;h++)c=(i=(0|o.words[h])+c)>>26,this.words[h]=67108863&i;if(0===c&&h<o.length&&o!==this)for(;h<o.length;h++)this.words[h]=o.words[h];return this.length=Math.max(this.length,h),o!==this&&(this.negative=1),this.strip()},BN.prototype.sub=function sub(t){return this.clone().isub(t)};var l=function comb10MulTo(t,i,o){var a,u,c,h=t.words,l=i.words,d=o.words,p=0,m=0|h[0],g=8191&m,v=m>>>13,b=0|h[1],w=8191&b,_=b>>>13,M=0|h[2],k=8191&M,B=M>>>13,P=0|h[3],x=8191&P,I=P>>>13,N=0|h[4],A=8191&N,C=N>>>13,O=0|h[5],j=8191&O,L=O>>>13,q=0|h[6],U=8191&q,z=q>>>13,H=0|h[7],W=8191&H,V=H>>>13,G=0|h[8],J=8191&G,$=G>>>13,Z=0|h[9],Y=8191&Z,X=Z>>>13,Q=0|l[0],ee=8191&Q,te=Q>>>13,re=0|l[1],ne=8191&re,ie=re>>>13,oe=0|l[2],se=8191&oe,ae=oe>>>13,ue=0|l[3],ce=8191&ue,he=ue>>>13,le=0|l[4],fe=8191&le,de=le>>>13,pe=0|l[5],me=8191&pe,ge=pe>>>13,ve=0|l[6],ye=8191&ve,be=ve>>>13,we=0|l[7],_e=8191&we,Me=we>>>13,Se=0|l[8],ke=8191&Se,Ee=Se>>>13,Be=0|l[9],Pe=8191&Be,xe=Be>>>13;o.negative=t.negative^i.negative,o.length=19;var Te=(p+(a=Math.imul(g,ee))|0)+((8191&(u=(u=Math.imul(g,te))+Math.imul(v,ee)|0))<<13)|0;p=((c=Math.imul(v,te))+(u>>>13)|0)+(Te>>>26)|0,Te&=67108863,a=Math.imul(w,ee),u=(u=Math.imul(w,te))+Math.imul(_,ee)|0,c=Math.imul(_,te);var Ie=(p+(a=a+Math.imul(g,ne)|0)|0)+((8191&(u=(u=u+Math.imul(g,ie)|0)+Math.imul(v,ne)|0))<<13)|0;p=((c=c+Math.imul(v,ie)|0)+(u>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,a=Math.imul(k,ee),u=(u=Math.imul(k,te))+Math.imul(B,ee)|0,c=Math.imul(B,te),a=a+Math.imul(w,ne)|0,u=(u=u+Math.imul(w,ie)|0)+Math.imul(_,ne)|0,c=c+Math.imul(_,ie)|0;var Ne=(p+(a=a+Math.imul(g,se)|0)|0)+((8191&(u=(u=u+Math.imul(g,ae)|0)+Math.imul(v,se)|0))<<13)|0;p=((c=c+Math.imul(v,ae)|0)+(u>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,a=Math.imul(x,ee),u=(u=Math.imul(x,te))+Math.imul(I,ee)|0,c=Math.imul(I,te),a=a+Math.imul(k,ne)|0,u=(u=u+Math.imul(k,ie)|0)+Math.imul(B,ne)|0,c=c+Math.imul(B,ie)|0,a=a+Math.imul(w,se)|0,u=(u=u+Math.imul(w,ae)|0)+Math.imul(_,se)|0,c=c+Math.imul(_,ae)|0;var Ae=(p+(a=a+Math.imul(g,ce)|0)|0)+((8191&(u=(u=u+Math.imul(g,he)|0)+Math.imul(v,ce)|0))<<13)|0;p=((c=c+Math.imul(v,he)|0)+(u>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,a=Math.imul(A,ee),u=(u=Math.imul(A,te))+Math.imul(C,ee)|0,c=Math.imul(C,te),a=a+Math.imul(x,ne)|0,u=(u=u+Math.imul(x,ie)|0)+Math.imul(I,ne)|0,c=c+Math.imul(I,ie)|0,a=a+Math.imul(k,se)|0,u=(u=u+Math.imul(k,ae)|0)+Math.imul(B,se)|0,c=c+Math.imul(B,ae)|0,a=a+Math.imul(w,ce)|0,u=(u=u+Math.imul(w,he)|0)+Math.imul(_,ce)|0,c=c+Math.imul(_,he)|0;var Re=(p+(a=a+Math.imul(g,fe)|0)|0)+((8191&(u=(u=u+Math.imul(g,de)|0)+Math.imul(v,fe)|0))<<13)|0;p=((c=c+Math.imul(v,de)|0)+(u>>>13)|0)+(Re>>>26)|0,Re&=67108863,a=Math.imul(j,ee),u=(u=Math.imul(j,te))+Math.imul(L,ee)|0,c=Math.imul(L,te),a=a+Math.imul(A,ne)|0,u=(u=u+Math.imul(A,ie)|0)+Math.imul(C,ne)|0,c=c+Math.imul(C,ie)|0,a=a+Math.imul(x,se)|0,u=(u=u+Math.imul(x,ae)|0)+Math.imul(I,se)|0,c=c+Math.imul(I,ae)|0,a=a+Math.imul(k,ce)|0,u=(u=u+Math.imul(k,he)|0)+Math.imul(B,ce)|0,c=c+Math.imul(B,he)|0,a=a+Math.imul(w,fe)|0,u=(u=u+Math.imul(w,de)|0)+Math.imul(_,fe)|0,c=c+Math.imul(_,de)|0;var Ce=(p+(a=a+Math.imul(g,me)|0)|0)+((8191&(u=(u=u+Math.imul(g,ge)|0)+Math.imul(v,me)|0))<<13)|0;p=((c=c+Math.imul(v,ge)|0)+(u>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,a=Math.imul(U,ee),u=(u=Math.imul(U,te))+Math.imul(z,ee)|0,c=Math.imul(z,te),a=a+Math.imul(j,ne)|0,u=(u=u+Math.imul(j,ie)|0)+Math.imul(L,ne)|0,c=c+Math.imul(L,ie)|0,a=a+Math.imul(A,se)|0,u=(u=u+Math.imul(A,ae)|0)+Math.imul(C,se)|0,c=c+Math.imul(C,ae)|0,a=a+Math.imul(x,ce)|0,u=(u=u+Math.imul(x,he)|0)+Math.imul(I,ce)|0,c=c+Math.imul(I,he)|0,a=a+Math.imul(k,fe)|0,u=(u=u+Math.imul(k,de)|0)+Math.imul(B,fe)|0,c=c+Math.imul(B,de)|0,a=a+Math.imul(w,me)|0,u=(u=u+Math.imul(w,ge)|0)+Math.imul(_,me)|0,c=c+Math.imul(_,ge)|0;var Oe=(p+(a=a+Math.imul(g,ye)|0)|0)+((8191&(u=(u=u+Math.imul(g,be)|0)+Math.imul(v,ye)|0))<<13)|0;p=((c=c+Math.imul(v,be)|0)+(u>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,a=Math.imul(W,ee),u=(u=Math.imul(W,te))+Math.imul(V,ee)|0,c=Math.imul(V,te),a=a+Math.imul(U,ne)|0,u=(u=u+Math.imul(U,ie)|0)+Math.imul(z,ne)|0,c=c+Math.imul(z,ie)|0,a=a+Math.imul(j,se)|0,u=(u=u+Math.imul(j,ae)|0)+Math.imul(L,se)|0,c=c+Math.imul(L,ae)|0,a=a+Math.imul(A,ce)|0,u=(u=u+Math.imul(A,he)|0)+Math.imul(C,ce)|0,c=c+Math.imul(C,he)|0,a=a+Math.imul(x,fe)|0,u=(u=u+Math.imul(x,de)|0)+Math.imul(I,fe)|0,c=c+Math.imul(I,de)|0,a=a+Math.imul(k,me)|0,u=(u=u+Math.imul(k,ge)|0)+Math.imul(B,me)|0,c=c+Math.imul(B,ge)|0,a=a+Math.imul(w,ye)|0,u=(u=u+Math.imul(w,be)|0)+Math.imul(_,ye)|0,c=c+Math.imul(_,be)|0;var De=(p+(a=a+Math.imul(g,_e)|0)|0)+((8191&(u=(u=u+Math.imul(g,Me)|0)+Math.imul(v,_e)|0))<<13)|0;p=((c=c+Math.imul(v,Me)|0)+(u>>>13)|0)+(De>>>26)|0,De&=67108863,a=Math.imul(J,ee),u=(u=Math.imul(J,te))+Math.imul($,ee)|0,c=Math.imul($,te),a=a+Math.imul(W,ne)|0,u=(u=u+Math.imul(W,ie)|0)+Math.imul(V,ne)|0,c=c+Math.imul(V,ie)|0,a=a+Math.imul(U,se)|0,u=(u=u+Math.imul(U,ae)|0)+Math.imul(z,se)|0,c=c+Math.imul(z,ae)|0,a=a+Math.imul(j,ce)|0,u=(u=u+Math.imul(j,he)|0)+Math.imul(L,ce)|0,c=c+Math.imul(L,he)|0,a=a+Math.imul(A,fe)|0,u=(u=u+Math.imul(A,de)|0)+Math.imul(C,fe)|0,c=c+Math.imul(C,de)|0,a=a+Math.imul(x,me)|0,u=(u=u+Math.imul(x,ge)|0)+Math.imul(I,me)|0,c=c+Math.imul(I,ge)|0,a=a+Math.imul(k,ye)|0,u=(u=u+Math.imul(k,be)|0)+Math.imul(B,ye)|0,c=c+Math.imul(B,be)|0,a=a+Math.imul(w,_e)|0,u=(u=u+Math.imul(w,Me)|0)+Math.imul(_,_e)|0,c=c+Math.imul(_,Me)|0;var je=(p+(a=a+Math.imul(g,ke)|0)|0)+((8191&(u=(u=u+Math.imul(g,Ee)|0)+Math.imul(v,ke)|0))<<13)|0;p=((c=c+Math.imul(v,Ee)|0)+(u>>>13)|0)+(je>>>26)|0,je&=67108863,a=Math.imul(Y,ee),u=(u=Math.imul(Y,te))+Math.imul(X,ee)|0,c=Math.imul(X,te),a=a+Math.imul(J,ne)|0,u=(u=u+Math.imul(J,ie)|0)+Math.imul($,ne)|0,c=c+Math.imul($,ie)|0,a=a+Math.imul(W,se)|0,u=(u=u+Math.imul(W,ae)|0)+Math.imul(V,se)|0,c=c+Math.imul(V,ae)|0,a=a+Math.imul(U,ce)|0,u=(u=u+Math.imul(U,he)|0)+Math.imul(z,ce)|0,c=c+Math.imul(z,he)|0,a=a+Math.imul(j,fe)|0,u=(u=u+Math.imul(j,de)|0)+Math.imul(L,fe)|0,c=c+Math.imul(L,de)|0,a=a+Math.imul(A,me)|0,u=(u=u+Math.imul(A,ge)|0)+Math.imul(C,me)|0,c=c+Math.imul(C,ge)|0,a=a+Math.imul(x,ye)|0,u=(u=u+Math.imul(x,be)|0)+Math.imul(I,ye)|0,c=c+Math.imul(I,be)|0,a=a+Math.imul(k,_e)|0,u=(u=u+Math.imul(k,Me)|0)+Math.imul(B,_e)|0,c=c+Math.imul(B,Me)|0,a=a+Math.imul(w,ke)|0,u=(u=u+Math.imul(w,Ee)|0)+Math.imul(_,ke)|0,c=c+Math.imul(_,Ee)|0;var Le=(p+(a=a+Math.imul(g,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(g,xe)|0)+Math.imul(v,Pe)|0))<<13)|0;p=((c=c+Math.imul(v,xe)|0)+(u>>>13)|0)+(Le>>>26)|0,Le&=67108863,a=Math.imul(Y,ne),u=(u=Math.imul(Y,ie))+Math.imul(X,ne)|0,c=Math.imul(X,ie),a=a+Math.imul(J,se)|0,u=(u=u+Math.imul(J,ae)|0)+Math.imul($,se)|0,c=c+Math.imul($,ae)|0,a=a+Math.imul(W,ce)|0,u=(u=u+Math.imul(W,he)|0)+Math.imul(V,ce)|0,c=c+Math.imul(V,he)|0,a=a+Math.imul(U,fe)|0,u=(u=u+Math.imul(U,de)|0)+Math.imul(z,fe)|0,c=c+Math.imul(z,de)|0,a=a+Math.imul(j,me)|0,u=(u=u+Math.imul(j,ge)|0)+Math.imul(L,me)|0,c=c+Math.imul(L,ge)|0,a=a+Math.imul(A,ye)|0,u=(u=u+Math.imul(A,be)|0)+Math.imul(C,ye)|0,c=c+Math.imul(C,be)|0,a=a+Math.imul(x,_e)|0,u=(u=u+Math.imul(x,Me)|0)+Math.imul(I,_e)|0,c=c+Math.imul(I,Me)|0,a=a+Math.imul(k,ke)|0,u=(u=u+Math.imul(k,Ee)|0)+Math.imul(B,ke)|0,c=c+Math.imul(B,Ee)|0;var Fe=(p+(a=a+Math.imul(w,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(w,xe)|0)+Math.imul(_,Pe)|0))<<13)|0;p=((c=c+Math.imul(_,xe)|0)+(u>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,a=Math.imul(Y,se),u=(u=Math.imul(Y,ae))+Math.imul(X,se)|0,c=Math.imul(X,ae),a=a+Math.imul(J,ce)|0,u=(u=u+Math.imul(J,he)|0)+Math.imul($,ce)|0,c=c+Math.imul($,he)|0,a=a+Math.imul(W,fe)|0,u=(u=u+Math.imul(W,de)|0)+Math.imul(V,fe)|0,c=c+Math.imul(V,de)|0,a=a+Math.imul(U,me)|0,u=(u=u+Math.imul(U,ge)|0)+Math.imul(z,me)|0,c=c+Math.imul(z,ge)|0,a=a+Math.imul(j,ye)|0,u=(u=u+Math.imul(j,be)|0)+Math.imul(L,ye)|0,c=c+Math.imul(L,be)|0,a=a+Math.imul(A,_e)|0,u=(u=u+Math.imul(A,Me)|0)+Math.imul(C,_e)|0,c=c+Math.imul(C,Me)|0,a=a+Math.imul(x,ke)|0,u=(u=u+Math.imul(x,Ee)|0)+Math.imul(I,ke)|0,c=c+Math.imul(I,Ee)|0;var qe=(p+(a=a+Math.imul(k,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(k,xe)|0)+Math.imul(B,Pe)|0))<<13)|0;p=((c=c+Math.imul(B,xe)|0)+(u>>>13)|0)+(qe>>>26)|0,qe&=67108863,a=Math.imul(Y,ce),u=(u=Math.imul(Y,he))+Math.imul(X,ce)|0,c=Math.imul(X,he),a=a+Math.imul(J,fe)|0,u=(u=u+Math.imul(J,de)|0)+Math.imul($,fe)|0,c=c+Math.imul($,de)|0,a=a+Math.imul(W,me)|0,u=(u=u+Math.imul(W,ge)|0)+Math.imul(V,me)|0,c=c+Math.imul(V,ge)|0,a=a+Math.imul(U,ye)|0,u=(u=u+Math.imul(U,be)|0)+Math.imul(z,ye)|0,c=c+Math.imul(z,be)|0,a=a+Math.imul(j,_e)|0,u=(u=u+Math.imul(j,Me)|0)+Math.imul(L,_e)|0,c=c+Math.imul(L,Me)|0,a=a+Math.imul(A,ke)|0,u=(u=u+Math.imul(A,Ee)|0)+Math.imul(C,ke)|0,c=c+Math.imul(C,Ee)|0;var Ue=(p+(a=a+Math.imul(x,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(x,xe)|0)+Math.imul(I,Pe)|0))<<13)|0;p=((c=c+Math.imul(I,xe)|0)+(u>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,a=Math.imul(Y,fe),u=(u=Math.imul(Y,de))+Math.imul(X,fe)|0,c=Math.imul(X,de),a=a+Math.imul(J,me)|0,u=(u=u+Math.imul(J,ge)|0)+Math.imul($,me)|0,c=c+Math.imul($,ge)|0,a=a+Math.imul(W,ye)|0,u=(u=u+Math.imul(W,be)|0)+Math.imul(V,ye)|0,c=c+Math.imul(V,be)|0,a=a+Math.imul(U,_e)|0,u=(u=u+Math.imul(U,Me)|0)+Math.imul(z,_e)|0,c=c+Math.imul(z,Me)|0,a=a+Math.imul(j,ke)|0,u=(u=u+Math.imul(j,Ee)|0)+Math.imul(L,ke)|0,c=c+Math.imul(L,Ee)|0;var ze=(p+(a=a+Math.imul(A,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(A,xe)|0)+Math.imul(C,Pe)|0))<<13)|0;p=((c=c+Math.imul(C,xe)|0)+(u>>>13)|0)+(ze>>>26)|0,ze&=67108863,a=Math.imul(Y,me),u=(u=Math.imul(Y,ge))+Math.imul(X,me)|0,c=Math.imul(X,ge),a=a+Math.imul(J,ye)|0,u=(u=u+Math.imul(J,be)|0)+Math.imul($,ye)|0,c=c+Math.imul($,be)|0,a=a+Math.imul(W,_e)|0,u=(u=u+Math.imul(W,Me)|0)+Math.imul(V,_e)|0,c=c+Math.imul(V,Me)|0,a=a+Math.imul(U,ke)|0,u=(u=u+Math.imul(U,Ee)|0)+Math.imul(z,ke)|0,c=c+Math.imul(z,Ee)|0;var He=(p+(a=a+Math.imul(j,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(j,xe)|0)+Math.imul(L,Pe)|0))<<13)|0;p=((c=c+Math.imul(L,xe)|0)+(u>>>13)|0)+(He>>>26)|0,He&=67108863,a=Math.imul(Y,ye),u=(u=Math.imul(Y,be))+Math.imul(X,ye)|0,c=Math.imul(X,be),a=a+Math.imul(J,_e)|0,u=(u=u+Math.imul(J,Me)|0)+Math.imul($,_e)|0,c=c+Math.imul($,Me)|0,a=a+Math.imul(W,ke)|0,u=(u=u+Math.imul(W,Ee)|0)+Math.imul(V,ke)|0,c=c+Math.imul(V,Ee)|0;var We=(p+(a=a+Math.imul(U,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(U,xe)|0)+Math.imul(z,Pe)|0))<<13)|0;p=((c=c+Math.imul(z,xe)|0)+(u>>>13)|0)+(We>>>26)|0,We&=67108863,a=Math.imul(Y,_e),u=(u=Math.imul(Y,Me))+Math.imul(X,_e)|0,c=Math.imul(X,Me),a=a+Math.imul(J,ke)|0,u=(u=u+Math.imul(J,Ee)|0)+Math.imul($,ke)|0,c=c+Math.imul($,Ee)|0;var Ke=(p+(a=a+Math.imul(W,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(W,xe)|0)+Math.imul(V,Pe)|0))<<13)|0;p=((c=c+Math.imul(V,xe)|0)+(u>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,a=Math.imul(Y,ke),u=(u=Math.imul(Y,Ee))+Math.imul(X,ke)|0,c=Math.imul(X,Ee);var Ve=(p+(a=a+Math.imul(J,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(J,xe)|0)+Math.imul($,Pe)|0))<<13)|0;p=((c=c+Math.imul($,xe)|0)+(u>>>13)|0)+(Ve>>>26)|0,Ve&=67108863;var Ge=(p+(a=Math.imul(Y,Pe))|0)+((8191&(u=(u=Math.imul(Y,xe))+Math.imul(X,Pe)|0))<<13)|0;return p=((c=Math.imul(X,xe))+(u>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,d[0]=Te,d[1]=Ie,d[2]=Ne,d[3]=Ae,d[4]=Re,d[5]=Ce,d[6]=Oe,d[7]=De,d[8]=je,d[9]=Le,d[10]=Fe,d[11]=qe,d[12]=Ue,d[13]=ze,d[14]=He,d[15]=We,d[16]=Ke,d[17]=Ve,d[18]=Ge,0!==p&&(d[19]=p,o.length++),o};function jumboMulTo(t,i,o){return(new FFTM).mulp(t,i,o)}function FFTM(t,i){this.x=t,this.y=i}Math.imul||(l=smallMulTo),BN.prototype.mulTo=function mulTo(t,i){var o=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,i):o<63?smallMulTo(this,t,i):o<1024?function bigMulTo(t,i,o){o.negative=i.negative^t.negative,o.length=t.length+i.length;for(var a=0,u=0,c=0;c<o.length-1;c++){var h=u;u=0;for(var l=67108863&a,d=Math.min(c,i.length-1),p=Math.max(0,c-t.length+1);p<=d;p++){var m=c-p,g=(0|t.words[m])*(0|i.words[p]),v=67108863&g;l=67108863&(v=v+l|0),u+=(h=(h=h+(g/67108864|0)|0)+(v>>>26)|0)>>>26,h&=67108863}o.words[c]=l,a=h,h=u}return 0!==a?o.words[c]=a:o.length--,o.strip()}(this,t,i):jumboMulTo(this,t,i)},FFTM.prototype.makeRBT=function makeRBT(t){for(var i=new Array(t),o=BN.prototype._countBits(t)-1,a=0;a<t;a++)i[a]=this.revBin(a,o,t);return i},FFTM.prototype.revBin=function revBin(t,i,o){if(0===t||t===o-1)return t;for(var a=0,u=0;u<i;u++)a|=(1&t)<<i-u-1,t>>=1;return a},FFTM.prototype.permute=function permute(t,i,o,a,u,c){for(var h=0;h<c;h++)a[h]=i[t[h]],u[h]=o[t[h]]},FFTM.prototype.transform=function transform(t,i,o,a,u,c){this.permute(c,t,i,o,a,u);for(var h=1;h<u;h<<=1)for(var l=h<<1,d=Math.cos(2*Math.PI/l),p=Math.sin(2*Math.PI/l),m=0;m<u;m+=l)for(var g=d,v=p,b=0;b<h;b++){var w=o[m+b],_=a[m+b],M=o[m+b+h],k=a[m+b+h],B=g*M-v*k;k=g*k+v*M,M=B,o[m+b]=w+M,a[m+b]=_+k,o[m+b+h]=w-M,a[m+b+h]=_-k,b!==l&&(B=d*g-p*v,v=d*v+p*g,g=B)}},FFTM.prototype.guessLen13b=function guessLen13b(t,i){var o=1|Math.max(i,t),a=1&o,u=0;for(o=o/2|0;o;o>>>=1)u++;return 1<<u+1+a},FFTM.prototype.conjugate=function conjugate(t,i,o){if(!(o<=1))for(var a=0;a<o/2;a++){var u=t[a];t[a]=t[o-a-1],t[o-a-1]=u,u=i[a],i[a]=-i[o-a-1],i[o-a-1]=-u}},FFTM.prototype.normalize13b=function normalize13b(t,i){for(var o=0,a=0;a<i/2;a++){var u=8192*Math.round(t[2*a+1]/i)+Math.round(t[2*a]/i)+o;t[a]=67108863&u,o=u<67108864?0:u/67108864|0}return t},FFTM.prototype.convert13b=function convert13b(t,i,o,a){for(var u=0,c=0;c<i;c++)u+=0|t[c],o[2*c]=8191&u,u>>>=13,o[2*c+1]=8191&u,u>>>=13;for(c=2*i;c<a;++c)o[c]=0;assert(0===u),assert(0==(-8192&u))},FFTM.prototype.stub=function stub(t){for(var i=new Array(t),o=0;o<t;o++)i[o]=0;return i},FFTM.prototype.mulp=function mulp(t,i,o){var a=2*this.guessLen13b(t.length,i.length),u=this.makeRBT(a),c=this.stub(a),h=new Array(a),l=new Array(a),d=new Array(a),p=new Array(a),m=new Array(a),g=new Array(a),v=o.words;v.length=a,this.convert13b(t.words,t.length,h,a),this.convert13b(i.words,i.length,p,a),this.transform(h,c,l,d,a,u),this.transform(p,c,m,g,a,u);for(var b=0;b<a;b++){var w=l[b]*m[b]-d[b]*g[b];d[b]=l[b]*g[b]+d[b]*m[b],l[b]=w}return this.conjugate(l,d,a),this.transform(l,d,v,c,a,u),this.conjugate(v,c,a),this.normalize13b(v,a),o.negative=t.negative^i.negative,o.length=t.length+i.length,o.strip()},BN.prototype.mul=function mul(t){var i=new BN(null);return i.words=new Array(this.length+t.length),this.mulTo(t,i)},BN.prototype.mulf=function mulf(t){var i=new BN(null);return i.words=new Array(this.length+t.length),jumboMulTo(this,t,i)},BN.prototype.imul=function imul(t){return this.clone().mulTo(t,this)},BN.prototype.imuln=function imuln(t){assert("number"==typeof t),assert(t<67108864);for(var i=0,o=0;o<this.length;o++){var a=(0|this.words[o])*t,u=(67108863&a)+(67108863&i);i>>=26,i+=a/67108864|0,i+=u>>>26,this.words[o]=67108863&u}return 0!==i&&(this.words[o]=i,this.length++),this},BN.prototype.muln=function muln(t){return this.clone().imuln(t)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(t){var i=function toBitArray(t){for(var i=new Array(t.bitLength()),o=0;o<i.length;o++){var a=o/26|0,u=o%26;i[o]=(t.words[a]&1<<u)>>>u}return i}(t);if(0===i.length)return new BN(1);for(var o=this,a=0;a<i.length&&0===i[a];a++,o=o.sqr());if(++a<i.length)for(var u=o.sqr();a<i.length;a++,u=u.sqr())0!==i[a]&&(o=o.mul(u));return o},BN.prototype.iushln=function iushln(t){assert("number"==typeof t&&t>=0);var i,o=t%26,a=(t-o)/26,u=67108863>>>26-o<<26-o;if(0!==o){var c=0;for(i=0;i<this.length;i++){var h=this.words[i]&u,l=(0|this.words[i])-h<<o;this.words[i]=l|c,c=h>>>26-o}c&&(this.words[i]=c,this.length++)}if(0!==a){for(i=this.length-1;i>=0;i--)this.words[i+a]=this.words[i];for(i=0;i<a;i++)this.words[i]=0;this.length+=a}return this.strip()},BN.prototype.ishln=function ishln(t){return assert(0===this.negative),this.iushln(t)},BN.prototype.iushrn=function iushrn(t,i,o){var a;assert("number"==typeof t&&t>=0),a=i?(i-i%26)/26:0;var u=t%26,c=Math.min((t-u)/26,this.length),h=67108863^67108863>>>u<<u,l=o;if(a-=c,a=Math.max(0,a),l){for(var d=0;d<c;d++)l.words[d]=this.words[d];l.length=c}if(0===c);else if(this.length>c)for(this.length-=c,d=0;d<this.length;d++)this.words[d]=this.words[d+c];else this.words[0]=0,this.length=1;var p=0;for(d=this.length-1;d>=0&&(0!==p||d>=a);d--){var m=0|this.words[d];this.words[d]=p<<26-u|m>>>u,p=m&h}return l&&0!==p&&(l.words[l.length++]=p),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(t,i,o){return assert(0===this.negative),this.iushrn(t,i,o)},BN.prototype.shln=function shln(t){return this.clone().ishln(t)},BN.prototype.ushln=function ushln(t){return this.clone().iushln(t)},BN.prototype.shrn=function shrn(t){return this.clone().ishrn(t)},BN.prototype.ushrn=function ushrn(t){return this.clone().iushrn(t)},BN.prototype.testn=function testn(t){assert("number"==typeof t&&t>=0);var i=t%26,o=(t-i)/26,a=1<<i;return!(this.length<=o)&&!!(this.words[o]&a)},BN.prototype.imaskn=function imaskn(t){assert("number"==typeof t&&t>=0);var i=t%26,o=(t-i)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==i&&o++,this.length=Math.min(o,this.length),0!==i){var a=67108863^67108863>>>i<<i;this.words[this.length-1]&=a}return this.strip()},BN.prototype.maskn=function maskn(t){return this.clone().imaskn(t)},BN.prototype.iaddn=function iaddn(t){return assert("number"==typeof t),assert(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},BN.prototype._iaddn=function _iaddn(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},BN.prototype.isubn=function isubn(t){if(assert("number"==typeof t),assert(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this.strip()},BN.prototype.addn=function addn(t){return this.clone().iaddn(t)},BN.prototype.subn=function subn(t){return this.clone().isubn(t)},BN.prototype.iabs=function iabs(){return this.negative=0,this},BN.prototype.abs=function abs(){return this.clone().iabs()},BN.prototype._ishlnsubmul=function _ishlnsubmul(t,i,o){var a,u,c=t.length+o;this._expand(c);var h=0;for(a=0;a<t.length;a++){u=(0|this.words[a+o])+h;var l=(0|t.words[a])*i;h=((u-=67108863&l)>>26)-(l/67108864|0),this.words[a+o]=67108863&u}for(;a<this.length-o;a++)h=(u=(0|this.words[a+o])+h)>>26,this.words[a+o]=67108863&u;if(0===h)return this.strip();for(assert(-1===h),h=0,a=0;a<this.length;a++)h=(u=-(0|this.words[a])+h)>>26,this.words[a]=67108863&u;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(t,i){var o=(this.length,t.length),a=this.clone(),u=t,c=0|u.words[u.length-1];0!==(o=26-this._countBits(c))&&(u=u.ushln(o),a.iushln(o),c=0|u.words[u.length-1]);var h,l=a.length-u.length;if("mod"!==i){(h=new BN(null)).length=l+1,h.words=new Array(h.length);for(var d=0;d<h.length;d++)h.words[d]=0}var p=a.clone()._ishlnsubmul(u,1,l);0===p.negative&&(a=p,h&&(h.words[l]=1));for(var m=l-1;m>=0;m--){var g=67108864*(0|a.words[u.length+m])+(0|a.words[u.length+m-1]);for(g=Math.min(g/c|0,67108863),a._ishlnsubmul(u,g,m);0!==a.negative;)g--,a.negative=0,a._ishlnsubmul(u,1,m),a.isZero()||(a.negative^=1);h&&(h.words[m]=g)}return h&&h.strip(),a.strip(),"div"!==i&&0!==o&&a.iushrn(o),{div:h||null,mod:a}},BN.prototype.divmod=function divmod(t,i,o){return assert(!t.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===t.negative?(c=this.neg().divmod(t,i),"mod"!==i&&(a=c.div.neg()),"div"!==i&&(u=c.mod.neg(),o&&0!==u.negative&&u.iadd(t)),{div:a,mod:u}):0===this.negative&&0!==t.negative?(c=this.divmod(t.neg(),i),"mod"!==i&&(a=c.div.neg()),{div:a,mod:c.mod}):0!=(this.negative&t.negative)?(c=this.neg().divmod(t.neg(),i),"div"!==i&&(u=c.mod.neg(),o&&0!==u.negative&&u.isub(t)),{div:c.div,mod:u}):t.length>this.length||this.cmp(t)<0?{div:new BN(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new BN(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new BN(this.modn(t.words[0]))}:this._wordDiv(t,i);var a,u,c},BN.prototype.div=function div(t){return this.divmod(t,"div",!1).div},BN.prototype.mod=function mod(t){return this.divmod(t,"mod",!1).mod},BN.prototype.umod=function umod(t){return this.divmod(t,"mod",!0).mod},BN.prototype.divRound=function divRound(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var o=0!==i.div.negative?i.mod.isub(t):i.mod,a=t.ushrn(1),u=t.andln(1),c=o.cmp(a);return c<0||1===u&&0===c?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},BN.prototype.modn=function modn(t){assert(t<=67108863);for(var i=(1<<26)%t,o=0,a=this.length-1;a>=0;a--)o=(i*o+(0|this.words[a]))%t;return o},BN.prototype.idivn=function idivn(t){assert(t<=67108863);for(var i=0,o=this.length-1;o>=0;o--){var a=(0|this.words[o])+67108864*i;this.words[o]=a/t|0,i=a%t}return this.strip()},BN.prototype.divn=function divn(t){return this.clone().idivn(t)},BN.prototype.egcd=function egcd(t){assert(0===t.negative),assert(!t.isZero());var i=this,o=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var a=new BN(1),u=new BN(0),c=new BN(0),h=new BN(1),l=0;i.isEven()&&o.isEven();)i.iushrn(1),o.iushrn(1),++l;for(var d=o.clone(),p=i.clone();!i.isZero();){for(var m=0,g=1;0==(i.words[0]&g)&&m<26;++m,g<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(p)),a.iushrn(1),u.iushrn(1);for(var v=0,b=1;0==(o.words[0]&b)&&v<26;++v,b<<=1);if(v>0)for(o.iushrn(v);v-- >0;)(c.isOdd()||h.isOdd())&&(c.iadd(d),h.isub(p)),c.iushrn(1),h.iushrn(1);i.cmp(o)>=0?(i.isub(o),a.isub(c),u.isub(h)):(o.isub(i),c.isub(a),h.isub(u))}return{a:c,b:h,gcd:o.iushln(l)}},BN.prototype._invmp=function _invmp(t){assert(0===t.negative),assert(!t.isZero());var i=this,o=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var a,u=new BN(1),c=new BN(0),h=o.clone();i.cmpn(1)>0&&o.cmpn(1)>0;){for(var l=0,d=1;0==(i.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(i.iushrn(l);l-- >0;)u.isOdd()&&u.iadd(h),u.iushrn(1);for(var p=0,m=1;0==(o.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(o.iushrn(p);p-- >0;)c.isOdd()&&c.iadd(h),c.iushrn(1);i.cmp(o)>=0?(i.isub(o),u.isub(c)):(o.isub(i),c.isub(u))}return(a=0===i.cmpn(1)?u:c).cmpn(0)<0&&a.iadd(t),a},BN.prototype.gcd=function gcd(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),o=t.clone();i.negative=0,o.negative=0;for(var a=0;i.isEven()&&o.isEven();a++)i.iushrn(1),o.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;o.isEven();)o.iushrn(1);var u=i.cmp(o);if(u<0){var c=i;i=o,o=c}else if(0===u||0===o.cmpn(1))break;i.isub(o)}return o.iushln(a)},BN.prototype.invm=function invm(t){return this.egcd(t).a.umod(t)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(t){return this.words[0]&t},BN.prototype.bincn=function bincn(t){assert("number"==typeof t);var i=t%26,o=(t-i)/26,a=1<<i;if(this.length<=o)return this._expand(o+1),this.words[o]|=a,this;for(var u=a,c=o;0!==u&&c<this.length;c++){var h=0|this.words[c];u=(h+=u)>>>26,h&=67108863,this.words[c]=h}return 0!==u&&(this.words[c]=u,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(t){var i,o=t<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this.strip(),this.length>1)i=1;else{o&&(t=-t),assert(t<=67108863,"Number is too big");var a=0|this.words[0];i=a===t?0:a<t?-1:1}return 0!==this.negative?0|-i:i},BN.prototype.cmp=function cmp(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var i=this.ucmp(t);return 0!==this.negative?0|-i:i},BN.prototype.ucmp=function ucmp(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,o=this.length-1;o>=0;o--){var a=0|this.words[o],u=0|t.words[o];if(a!==u){a<u?i=-1:a>u&&(i=1);break}}return i},BN.prototype.gtn=function gtn(t){return 1===this.cmpn(t)},BN.prototype.gt=function gt(t){return 1===this.cmp(t)},BN.prototype.gten=function gten(t){return this.cmpn(t)>=0},BN.prototype.gte=function gte(t){return this.cmp(t)>=0},BN.prototype.ltn=function ltn(t){return-1===this.cmpn(t)},BN.prototype.lt=function lt(t){return-1===this.cmp(t)},BN.prototype.lten=function lten(t){return this.cmpn(t)<=0},BN.prototype.lte=function lte(t){return this.cmp(t)<=0},BN.prototype.eqn=function eqn(t){return 0===this.cmpn(t)},BN.prototype.eq=function eq(t){return 0===this.cmp(t)},BN.red=function red(t){return new Red(t)},BN.prototype.toRed=function toRed(t){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(t){return this.red=t,this},BN.prototype.forceRed=function forceRed(t){return assert(!this.red,"Already a number in reduction context"),this._forceRed(t)},BN.prototype.redAdd=function redAdd(t){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},BN.prototype.redIAdd=function redIAdd(t){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},BN.prototype.redSub=function redSub(t){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},BN.prototype.redISub=function redISub(t){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},BN.prototype.redShl=function redShl(t){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},BN.prototype.redMul=function redMul(t){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},BN.prototype.redIMul=function redIMul(t){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(t){return assert(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(t,i){this.name=t,this.p=new BN(i,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(t){if("string"==typeof t){var i=BN._prime(t);this.m=i.p,this.prime=i}else assert(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function Mont(t){Red.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var t=new BN(null);return t.words=new Array(Math.ceil(this.n/13)),t},MPrime.prototype.ireduce=function ireduce(t){var i,o=t;do{this.split(o,this.tmp),i=(o=(o=this.imulK(o)).iadd(this.tmp)).bitLength()}while(i>this.n);var a=i<this.n?-1:o.ucmp(this.p);return 0===a?(o.words[0]=0,o.length=1):a>0?o.isub(this.p):void 0!==o.strip?o.strip():o._strip(),o},MPrime.prototype.split=function split(t,i){t.iushrn(this.n,0,i)},MPrime.prototype.imulK=function imulK(t){return t.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(t,i){for(var o=Math.min(t.length,9),a=0;a<o;a++)i.words[a]=t.words[a];if(i.length=o,t.length<=9)return t.words[0]=0,void(t.length=1);var u=t.words[9];for(i.words[i.length++]=4194303&u,a=10;a<t.length;a++){var c=0|t.words[a];t.words[a-10]=(4194303&c)<<4|u>>>22,u=c}u>>>=22,t.words[a-10]=u,0===u&&t.length>10?t.length-=10:t.length-=9},K256.prototype.imulK=function imulK(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,o=0;o<t.length;o++){var a=0|t.words[o];i+=977*a,t.words[o]=67108863&i,i=64*a+(i/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},inherits(P224,MPrime),inherits(P192,MPrime),inherits(P25519,MPrime),P25519.prototype.imulK=function imulK(t){for(var i=0,o=0;o<t.length;o++){var a=19*(0|t.words[o])+i,u=67108863&a;a>>>=26,t.words[o]=u,i=a}return 0!==i&&(t.words[t.length++]=i),t},BN._prime=function prime(t){if(d[t])return d[t];var prime;if("k256"===t)prime=new K256;else if("p224"===t)prime=new P224;else if("p192"===t)prime=new P192;else{if("p25519"!==t)throw new Error("Unknown prime "+t);prime=new P25519}return d[t]=prime,prime},Red.prototype._verify1=function _verify1(t){assert(0===t.negative,"red works only with positives"),assert(t.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(t,i){assert(0==(t.negative|i.negative),"red works only with positives"),assert(t.red&&t.red===i.red,"red works only with red numbers")},Red.prototype.imod=function imod(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Red.prototype.add=function add(t,i){this._verify2(t,i);var o=t.add(i);return o.cmp(this.m)>=0&&o.isub(this.m),o._forceRed(this)},Red.prototype.iadd=function iadd(t,i){this._verify2(t,i);var o=t.iadd(i);return o.cmp(this.m)>=0&&o.isub(this.m),o},Red.prototype.sub=function sub(t,i){this._verify2(t,i);var o=t.sub(i);return o.cmpn(0)<0&&o.iadd(this.m),o._forceRed(this)},Red.prototype.isub=function isub(t,i){this._verify2(t,i);var o=t.isub(i);return o.cmpn(0)<0&&o.iadd(this.m),o},Red.prototype.shl=function shl(t,i){return this._verify1(t),this.imod(t.ushln(i))},Red.prototype.imul=function imul(t,i){return this._verify2(t,i),this.imod(t.imul(i))},Red.prototype.mul=function mul(t,i){return this._verify2(t,i),this.imod(t.mul(i))},Red.prototype.isqr=function isqr(t){return this.imul(t,t.clone())},Red.prototype.sqr=function sqr(t){return this.mul(t,t)},Red.prototype.sqrt=function sqrt(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(assert(i%2==1),3===i){var o=this.m.add(new BN(1)).iushrn(2);return this.pow(t,o)}for(var a=this.m.subn(1),u=0;!a.isZero()&&0===a.andln(1);)u++,a.iushrn(1);assert(!a.isZero());var c=new BN(1).toRed(this),h=c.redNeg(),l=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,l).cmp(h);)d.redIAdd(h);for(var p=this.pow(d,a),m=this.pow(t,a.addn(1).iushrn(1)),g=this.pow(t,a),v=u;0!==g.cmp(c);){for(var b=g,w=0;0!==b.cmp(c);w++)b=b.redSqr();assert(w<v);var _=this.pow(p,new BN(1).iushln(v-w-1));m=m.redMul(_),p=_.redSqr(),g=g.redMul(p),v=w}return m},Red.prototype.invm=function invm(t){var i=t._invmp(this.m);return 0!==i.negative?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},Red.prototype.pow=function pow(t,i){if(i.isZero())return new BN(1).toRed(this);if(0===i.cmpn(1))return t.clone();var o=new Array(16);o[0]=new BN(1).toRed(this),o[1]=t;for(var a=2;a<o.length;a++)o[a]=this.mul(o[a-1],t);var u=o[0],c=0,h=0,l=i.bitLength()%26;for(0===l&&(l=26),a=i.length-1;a>=0;a--){for(var d=i.words[a],p=l-1;p>=0;p--){var m=d>>p&1;u!==o[0]&&(u=this.sqr(u)),0!==m||0!==c?(c<<=1,c|=m,(4===++h||0===a&&0===p)&&(u=this.mul(u,o[c]),h=0,c=0)):h=0}l=26}return u},Red.prototype.convertTo=function convertTo(t){var i=t.umod(this.m);return i===t?i.clone():i},Red.prototype.convertFrom=function convertFrom(t){var i=t.clone();return i.red=null,i},BN.mont=function mont(t){return new Mont(t)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(t){return this.imod(t.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},Mont.prototype.imul=function imul(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var o=t.imul(i),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=o.isub(a).iushrn(this.shift),c=u;return u.cmp(this.m)>=0?c=u.isub(this.m):u.cmpn(0)<0&&(c=u.iadd(this.m)),c._forceRed(this)},Mont.prototype.mul=function mul(t,i){if(t.isZero()||i.isZero())return new BN(0)._forceRed(this);var o=t.mul(i),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=o.isub(a).iushrn(this.shift),c=u;return u.cmp(this.m)>=0?c=u.isub(this.m):u.cmpn(0)<0&&(c=u.iadd(this.m)),c._forceRed(this)},Mont.prototype.invm=function invm(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,o(60)(t))},function(t,i){},function(t,i,o){t.exports=o(539)},function(t,i,o){t.exports=o(586)},function(t,i,o){t.exports=o(641)},function(t,i,o){"use strict";var a={};o.r(a),o.d(a,"JsonPatchError",(function(){return xt})),o.d(a,"deepClone",(function(){return Tt})),o.d(a,"getValueByPointer",(function(){return getValueByPointer})),o.d(a,"applyOperation",(function(){return applyOperation})),o.d(a,"applyPatch",(function(){return applyPatch})),o.d(a,"applyReducer",(function(){return applyReducer})),o.d(a,"validator",(function(){return validator})),o.d(a,"validate",(function(){return validate})),o.d(a,"_areEquals",(function(){return _areEquals}));var u={};o.r(u),o.d(u,"unobserve",(function(){return unobserve})),o.d(u,"observe",(function(){return observe})),o.d(u,"generate",(function(){return generate})),o.d(u,"compare",(function(){return compare}));var c={};o.r(c),o.d(c,"path",(function(){return parameter_builders_path})),o.d(c,"query",(function(){return parameter_builders_query})),o.d(c,"header",(function(){return parameter_builders_header})),o.d(c,"cookie",(function(){return parameter_builders_cookie}));var h=o(6),l=o.n(h),d=o(23),p=o.n(d),m=o(102),g=o.n(m),v=o(32),b=o.n(v),w=o(43),_=o.n(w),M=o(7),k=o.n(M),B=o(26),P=o.n(B),x=o(88),I=o.n(x),N=o(29),A=o.n(N),C=o(50),O=o.n(C),j=o(192),L=o.n(j),q=o(131),U=o.n(q),z=o(73),H=o.n(z),W=o(5),V=o.n(W),G=o(3),J=o.n(G),$=o(0),Z=o.n($),Y=o(132),X=o.n(Y),Q=o(24),ee=o.n(Q),te=(o(246),o(135)),re=o.n(te);function isNothing(t){return null==t}var ne={isNothing:isNothing,isObject:function isObject(t){return"object"==typeof t&&null!==t},toArray:function toArray(t){return Array.isArray(t)?t:isNothing(t)?[]:[t]},repeat:function repeat(t,i){var o,a="";for(o=0;o<i;o+=1)a+=t;return a},isNegativeZero:function isNegativeZero(t){return 0===t&&Number.NEGATIVE_INFINITY===1/t},extend:function extend(t,i){var o,a,u,c;if(i)for(o=0,a=(c=Object.keys(i)).length;o<a;o+=1)t[u=c[o]]=i[u];return t}};function formatError(t,i){var o="",a=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(o+='in "'+t.mark.name+'" '),o+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!i&&t.mark.snippet&&(o+="\n\n"+t.mark.snippet),a+" "+o):a}function YAMLException$1(t,i){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=i,this.message=formatError(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}YAMLException$1.prototype=Object.create(Error.prototype),YAMLException$1.prototype.constructor=YAMLException$1,YAMLException$1.prototype.toString=function toString(t){return this.name+": "+formatError(this,t)};var ie=YAMLException$1;function getLine(t,i,o,a,u){var c="",h="",l=Math.floor(u/2)-1;return a-i>l&&(i=a-l+(c=" ... ").length),o-a>l&&(o=a+l-(h=" ...").length),{str:c+t.slice(i,o).replace(/\t/g,"→")+h,pos:a-i+c.length}}function padStart(t,i){return ne.repeat(" ",i-t.length)+t}var oe=function makeSnippet(t,i){if(i=Object.create(i||null),!t.buffer)return null;i.maxLength||(i.maxLength=79),"number"!=typeof i.indent&&(i.indent=1),"number"!=typeof i.linesBefore&&(i.linesBefore=3),"number"!=typeof i.linesAfter&&(i.linesAfter=2);for(var o,a=/\r?\n|\r|\0/g,u=[0],c=[],h=-1;o=a.exec(t.buffer);)c.push(o.index),u.push(o.index+o[0].length),t.position<=o.index&&h<0&&(h=u.length-2);h<0&&(h=u.length-1);var l,d,p="",m=Math.min(t.line+i.linesAfter,c.length).toString().length,g=i.maxLength-(i.indent+m+3);for(l=1;l<=i.linesBefore&&!(h-l<0);l++)d=getLine(t.buffer,u[h-l],c[h-l],t.position-(u[h]-u[h-l]),g),p=ne.repeat(" ",i.indent)+padStart((t.line-l+1).toString(),m)+" | "+d.str+"\n"+p;for(d=getLine(t.buffer,u[h],c[h],t.position,g),p+=ne.repeat(" ",i.indent)+padStart((t.line+1).toString(),m)+" | "+d.str+"\n",p+=ne.repeat("-",i.indent+m+3+d.pos)+"^\n",l=1;l<=i.linesAfter&&!(h+l>=c.length);l++)d=getLine(t.buffer,u[h+l],c[h+l],t.position-(u[h]-u[h+l]),g),p+=ne.repeat(" ",i.indent)+padStart((t.line+l+1).toString(),m)+" | "+d.str+"\n";return p.replace(/\n$/,"")},se=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],ae=["scalar","sequence","mapping"];var ue=function Type$1(t,i){if(i=i||{},Object.keys(i).forEach((function(i){if(-1===se.indexOf(i))throw new ie('Unknown option "'+i+'" is met in definition of "'+t+'" YAML type.')})),this.options=i,this.tag=t,this.kind=i.kind||null,this.resolve=i.resolve||function(){return!0},this.construct=i.construct||function(t){return t},this.instanceOf=i.instanceOf||null,this.predicate=i.predicate||null,this.represent=i.represent||null,this.representName=i.representName||null,this.defaultStyle=i.defaultStyle||null,this.multi=i.multi||!1,this.styleAliases=function compileStyleAliases(t){var i={};return null!==t&&Object.keys(t).forEach((function(o){t[o].forEach((function(t){i[String(t)]=o}))})),i}(i.styleAliases||null),-1===ae.indexOf(this.kind))throw new ie('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')};function compileList(t,i){var o=[];return t[i].forEach((function(t){var i=o.length;o.forEach((function(o,a){o.tag===t.tag&&o.kind===t.kind&&o.multi===t.multi&&(i=a)})),o[i]=t})),o}function Schema$1(t){return this.extend(t)}Schema$1.prototype.extend=function extend(t){var i=[],o=[];if(t instanceof ue)o.push(t);else if(Array.isArray(t))o=o.concat(t);else{if(!t||!Array.isArray(t.implicit)&&!Array.isArray(t.explicit))throw new ie("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.implicit&&(i=i.concat(t.implicit)),t.explicit&&(o=o.concat(t.explicit))}i.forEach((function(t){if(!(t instanceof ue))throw new ie("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(t.loadKind&&"scalar"!==t.loadKind)throw new ie("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(t.multi)throw new ie("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),o.forEach((function(t){if(!(t instanceof ue))throw new ie("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var a=Object.create(Schema$1.prototype);return a.implicit=(this.implicit||[]).concat(i),a.explicit=(this.explicit||[]).concat(o),a.compiledImplicit=compileList(a,"implicit"),a.compiledExplicit=compileList(a,"explicit"),a.compiledTypeMap=function compileMap(){var t,i,o={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function collectType(t){t.multi?(o.multi[t.kind].push(t),o.multi.fallback.push(t)):o[t.kind][t.tag]=o.fallback[t.tag]=t}for(t=0,i=arguments.length;t<i;t+=1)arguments[t].forEach(collectType);return o}(a.compiledImplicit,a.compiledExplicit),a};var ce=Schema$1,he=new ue("tag:yaml.org,2002:str",{kind:"scalar",construct:function(t){return null!==t?t:""}}),le=new ue("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(t){return null!==t?t:[]}}),fe=new ue("tag:yaml.org,2002:map",{kind:"mapping",construct:function(t){return null!==t?t:{}}}),de=new ce({explicit:[he,le,fe]});var pe=new ue("tag:yaml.org,2002:null",{kind:"scalar",resolve:function resolveYamlNull(t){if(null===t)return!0;var i=t.length;return 1===i&&"~"===t||4===i&&("null"===t||"Null"===t||"NULL"===t)},construct:function constructYamlNull(){return null},predicate:function isNull(t){return null===t},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});var me=new ue("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function resolveYamlBoolean(t){if(null===t)return!1;var i=t.length;return 4===i&&("true"===t||"True"===t||"TRUE"===t)||5===i&&("false"===t||"False"===t||"FALSE"===t)},construct:function constructYamlBoolean(t){return"true"===t||"True"===t||"TRUE"===t},predicate:function isBoolean(t){return"[object Boolean]"===Object.prototype.toString.call(t)},represent:{lowercase:function(t){return t?"true":"false"},uppercase:function(t){return t?"TRUE":"FALSE"},camelcase:function(t){return t?"True":"False"}},defaultStyle:"lowercase"});function isOctCode(t){return 48<=t&&t<=55}function isDecCode(t){return 48<=t&&t<=57}var ge=new ue("tag:yaml.org,2002:int",{kind:"scalar",resolve:function resolveYamlInteger(t){if(null===t)return!1;var i,o,a=t.length,u=0,c=!1;if(!a)return!1;if("-"!==(i=t[u])&&"+"!==i||(i=t[++u]),"0"===i){if(u+1===a)return!0;if("b"===(i=t[++u])){for(u++;u<a;u++)if("_"!==(i=t[u])){if("0"!==i&&"1"!==i)return!1;c=!0}return c&&"_"!==i}if("x"===i){for(u++;u<a;u++)if("_"!==(i=t[u])){if(!(48<=(o=t.charCodeAt(u))&&o<=57||65<=o&&o<=70||97<=o&&o<=102))return!1;c=!0}return c&&"_"!==i}if("o"===i){for(u++;u<a;u++)if("_"!==(i=t[u])){if(!isOctCode(t.charCodeAt(u)))return!1;c=!0}return c&&"_"!==i}}if("_"===i)return!1;for(;u<a;u++)if("_"!==(i=t[u])){if(!isDecCode(t.charCodeAt(u)))return!1;c=!0}return!(!c||"_"===i)},construct:function constructYamlInteger(t){var i,o=t,a=1;if(-1!==o.indexOf("_")&&(o=o.replace(/_/g,"")),"-"!==(i=o[0])&&"+"!==i||("-"===i&&(a=-1),i=(o=o.slice(1))[0]),"0"===o)return 0;if("0"===i){if("b"===o[1])return a*parseInt(o.slice(2),2);if("x"===o[1])return a*parseInt(o.slice(2),16);if("o"===o[1])return a*parseInt(o.slice(2),8)}return a*parseInt(o,10)},predicate:function isInteger(t){return"[object Number]"===Object.prototype.toString.call(t)&&t%1==0&&!ne.isNegativeZero(t)},represent:{binary:function(t){return t>=0?"0b"+t.toString(2):"-0b"+t.toString(2).slice(1)},octal:function(t){return t>=0?"0o"+t.toString(8):"-0o"+t.toString(8).slice(1)},decimal:function(t){return t.toString(10)},hexadecimal:function(t){return t>=0?"0x"+t.toString(16).toUpperCase():"-0x"+t.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),ve=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var ye=/^[-+]?[0-9]+e/;var be=new ue("tag:yaml.org,2002:float",{kind:"scalar",resolve:function resolveYamlFloat(t){return null!==t&&!(!ve.test(t)||"_"===t[t.length-1])},construct:function constructYamlFloat(t){var i,o;return o="-"===(i=t.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(i[0])>=0&&(i=i.slice(1)),".inf"===i?1===o?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===i?NaN:o*parseFloat(i,10)},predicate:function isFloat(t){return"[object Number]"===Object.prototype.toString.call(t)&&(t%1!=0||ne.isNegativeZero(t))},represent:function representYamlFloat(t,i){var o;if(isNaN(t))switch(i){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===t)switch(i){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===t)switch(i){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(ne.isNegativeZero(t))return"-0.0";return o=t.toString(10),ye.test(o)?o.replace("e",".e"):o},defaultStyle:"lowercase"}),we=de.extend({implicit:[pe,me,ge,be]}),_e=we,Me=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Se=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var ke=new ue("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function resolveYamlTimestamp(t){return null!==t&&(null!==Me.exec(t)||null!==Se.exec(t))},construct:function constructYamlTimestamp(t){var i,o,a,u,c,h,l,d,p=0,m=null;if(null===(i=Me.exec(t))&&(i=Se.exec(t)),null===i)throw new Error("Date resolve error");if(o=+i[1],a=+i[2]-1,u=+i[3],!i[4])return new Date(Date.UTC(o,a,u));if(c=+i[4],h=+i[5],l=+i[6],i[7]){for(p=i[7].slice(0,3);p.length<3;)p+="0";p=+p}return i[9]&&(m=6e4*(60*+i[10]+ +(i[11]||0)),"-"===i[9]&&(m=-m)),d=new Date(Date.UTC(o,a,u,c,h,l,p)),m&&d.setTime(d.getTime()-m),d},instanceOf:Date,represent:function representYamlTimestamp(t){return t.toISOString()}});var Ee=new ue("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function resolveYamlMerge(t){return"<<"===t||null===t}}),Be="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var Pe=new ue("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function resolveYamlBinary(t){if(null===t)return!1;var i,o,a=0,u=t.length,c=Be;for(o=0;o<u;o++)if(!((i=c.indexOf(t.charAt(o)))>64)){if(i<0)return!1;a+=6}return a%8==0},construct:function constructYamlBinary(t){var i,o,a=t.replace(/[\r\n=]/g,""),u=a.length,c=Be,h=0,l=[];for(i=0;i<u;i++)i%4==0&&i&&(l.push(h>>16&255),l.push(h>>8&255),l.push(255&h)),h=h<<6|c.indexOf(a.charAt(i));return 0===(o=u%4*6)?(l.push(h>>16&255),l.push(h>>8&255),l.push(255&h)):18===o?(l.push(h>>10&255),l.push(h>>2&255)):12===o&&l.push(h>>4&255),new Uint8Array(l)},predicate:function isBinary(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)},represent:function representYamlBinary(t){var i,o,a="",u=0,c=t.length,h=Be;for(i=0;i<c;i++)i%3==0&&i&&(a+=h[u>>18&63],a+=h[u>>12&63],a+=h[u>>6&63],a+=h[63&u]),u=(u<<8)+t[i];return 0===(o=c%3)?(a+=h[u>>18&63],a+=h[u>>12&63],a+=h[u>>6&63],a+=h[63&u]):2===o?(a+=h[u>>10&63],a+=h[u>>4&63],a+=h[u<<2&63],a+=h[64]):1===o&&(a+=h[u>>2&63],a+=h[u<<4&63],a+=h[64],a+=h[64]),a}}),xe=Object.prototype.hasOwnProperty,Te=Object.prototype.toString;var Ie=new ue("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function resolveYamlOmap(t){if(null===t)return!0;var i,o,a,u,c,h=[],l=t;for(i=0,o=l.length;i<o;i+=1){if(a=l[i],c=!1,"[object Object]"!==Te.call(a))return!1;for(u in a)if(xe.call(a,u)){if(c)return!1;c=!0}if(!c)return!1;if(-1!==h.indexOf(u))return!1;h.push(u)}return!0},construct:function constructYamlOmap(t){return null!==t?t:[]}}),Ne=Object.prototype.toString;var Ae=new ue("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function resolveYamlPairs(t){if(null===t)return!0;var i,o,a,u,c,h=t;for(c=new Array(h.length),i=0,o=h.length;i<o;i+=1){if(a=h[i],"[object Object]"!==Ne.call(a))return!1;if(1!==(u=Object.keys(a)).length)return!1;c[i]=[u[0],a[u[0]]]}return!0},construct:function constructYamlPairs(t){if(null===t)return[];var i,o,a,u,c,h=t;for(c=new Array(h.length),i=0,o=h.length;i<o;i+=1)a=h[i],u=Object.keys(a),c[i]=[u[0],a[u[0]]];return c}}),Re=Object.prototype.hasOwnProperty;var Ce=new ue("tag:yaml.org,2002:set",{kind:"mapping",resolve:function resolveYamlSet(t){if(null===t)return!0;var i,o=t;for(i in o)if(Re.call(o,i)&&null!==o[i])return!1;return!0},construct:function constructYamlSet(t){return null!==t?t:{}}}),Oe=_e.extend({implicit:[ke,Ee],explicit:[Pe,Ie,Ae,Ce]}),De=Object.prototype.hasOwnProperty,je=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Le=/[\x85\u2028\u2029]/,Fe=/[,\[\]\{\}]/,qe=/^(?:!|!!|![a-z\-]+!)$/i,Ue=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function _class(t){return Object.prototype.toString.call(t)}function is_EOL(t){return 10===t||13===t}function is_WHITE_SPACE(t){return 9===t||32===t}function is_WS_OR_EOL(t){return 9===t||32===t||10===t||13===t}function is_FLOW_INDICATOR(t){return 44===t||91===t||93===t||123===t||125===t}function fromHexCode(t){var i;return 48<=t&&t<=57?t-48:97<=(i=32|t)&&i<=102?i-97+10:-1}function simpleEscapeSequence(t){return 48===t?"\0":97===t?"":98===t?"\b":116===t||9===t?"\t":110===t?"\n":118===t?"\v":102===t?"\f":114===t?"\r":101===t?"":32===t?" ":34===t?'"':47===t?"/":92===t?"\\":78===t?"
":95===t?" ":76===t?"\u2028":80===t?"\u2029":""}function charFromCodepoint(t){return t<=65535?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10),56320+(t-65536&1023))}for(var ze=new Array(256),He=new Array(256),We=0;We<256;We++)ze[We]=simpleEscapeSequence(We)?1:0,He[We]=simpleEscapeSequence(We);function State$1(t,i){this.input=t,this.filename=i.filename||null,this.schema=i.schema||Oe,this.onWarning=i.onWarning||null,this.legacy=i.legacy||!1,this.json=i.json||!1,this.listener=i.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=t.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function generateError(t,i){var o={name:t.filename,buffer:t.input.slice(0,-1),position:t.position,line:t.line,column:t.position-t.lineStart};return o.snippet=oe(o),new ie(i,o)}function throwError(t,i){throw generateError(t,i)}function throwWarning(t,i){t.onWarning&&t.onWarning.call(null,generateError(t,i))}var Ke={YAML:function handleYamlDirective(t,i,o){var a,u,c;null!==t.version&&throwError(t,"duplication of %YAML directive"),1!==o.length&&throwError(t,"YAML directive accepts exactly one argument"),null===(a=/^([0-9]+)\.([0-9]+)$/.exec(o[0]))&&throwError(t,"ill-formed argument of the YAML directive"),u=parseInt(a[1],10),c=parseInt(a[2],10),1!==u&&throwError(t,"unacceptable YAML version of the document"),t.version=o[0],t.checkLineBreaks=c<2,1!==c&&2!==c&&throwWarning(t,"unsupported YAML version of the document")},TAG:function handleTagDirective(t,i,o){var a,u;2!==o.length&&throwError(t,"TAG directive accepts exactly two arguments"),a=o[0],u=o[1],qe.test(a)||throwError(t,"ill-formed tag handle (first argument) of the TAG directive"),De.call(t.tagMap,a)&&throwError(t,'there is a previously declared suffix for "'+a+'" tag handle'),Ue.test(u)||throwError(t,"ill-formed tag prefix (second argument) of the TAG directive");try{u=decodeURIComponent(u)}catch(i){throwError(t,"tag prefix is malformed: "+u)}t.tagMap[a]=u}};function captureSegment(t,i,o,a){var u,c,h,l;if(i<o){if(l=t.input.slice(i,o),a)for(u=0,c=l.length;u<c;u+=1)9===(h=l.charCodeAt(u))||32<=h&&h<=1114111||throwError(t,"expected valid JSON character");else je.test(l)&&throwError(t,"the stream contains non-printable characters");t.result+=l}}function mergeMappings(t,i,o,a){var u,c,h,l;for(ne.isObject(o)||throwError(t,"cannot merge mappings; the provided source object is unacceptable"),h=0,l=(u=Object.keys(o)).length;h<l;h+=1)c=u[h],De.call(i,c)||(i[c]=o[c],a[c]=!0)}function storeMappingPair(t,i,o,a,u,c,h,l,d){var p,m;if(Array.isArray(u))for(p=0,m=(u=Array.prototype.slice.call(u)).length;p<m;p+=1)Array.isArray(u[p])&&throwError(t,"nested arrays are not supported inside keys"),"object"==typeof u&&"[object Object]"===_class(u[p])&&(u[p]="[object Object]");if("object"==typeof u&&"[object Object]"===_class(u)&&(u="[object Object]"),u=String(u),null===i&&(i={}),"tag:yaml.org,2002:merge"===a)if(Array.isArray(c))for(p=0,m=c.length;p<m;p+=1)mergeMappings(t,i,c[p],o);else mergeMappings(t,i,c,o);else t.json||De.call(o,u)||!De.call(i,u)||(t.line=h||t.line,t.lineStart=l||t.lineStart,t.position=d||t.position,throwError(t,"duplicated mapping key")),"__proto__"===u?Object.defineProperty(i,u,{configurable:!0,enumerable:!0,writable:!0,value:c}):i[u]=c,delete o[u];return i}function readLineBreak(t){var i;10===(i=t.input.charCodeAt(t.position))?t.position++:13===i?(t.position++,10===t.input.charCodeAt(t.position)&&t.position++):throwError(t,"a line break is expected"),t.line+=1,t.lineStart=t.position,t.firstTabInLine=-1}function skipSeparationSpace(t,i,o){for(var a=0,u=t.input.charCodeAt(t.position);0!==u;){for(;is_WHITE_SPACE(u);)9===u&&-1===t.firstTabInLine&&(t.firstTabInLine=t.position),u=t.input.charCodeAt(++t.position);if(i&&35===u)do{u=t.input.charCodeAt(++t.position)}while(10!==u&&13!==u&&0!==u);if(!is_EOL(u))break;for(readLineBreak(t),u=t.input.charCodeAt(t.position),a++,t.lineIndent=0;32===u;)t.lineIndent++,u=t.input.charCodeAt(++t.position)}return-1!==o&&0!==a&&t.lineIndent<o&&throwWarning(t,"deficient indentation"),a}function testDocumentSeparator(t){var i,o=t.position;return!(45!==(i=t.input.charCodeAt(o))&&46!==i||i!==t.input.charCodeAt(o+1)||i!==t.input.charCodeAt(o+2)||(o+=3,0!==(i=t.input.charCodeAt(o))&&!is_WS_OR_EOL(i)))}function writeFoldedLines(t,i){1===i?t.result+=" ":i>1&&(t.result+=ne.repeat("\n",i-1))}function readBlockSequence(t,i){var o,a,u=t.tag,c=t.anchor,h=[],l=!1;if(-1!==t.firstTabInLine)return!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=h),a=t.input.charCodeAt(t.position);0!==a&&(-1!==t.firstTabInLine&&(t.position=t.firstTabInLine,throwError(t,"tab characters must not be used in indentation")),45===a)&&is_WS_OR_EOL(t.input.charCodeAt(t.position+1));)if(l=!0,t.position++,skipSeparationSpace(t,!0,-1)&&t.lineIndent<=i)h.push(null),a=t.input.charCodeAt(t.position);else if(o=t.line,composeNode(t,i,3,!1,!0),h.push(t.result),skipSeparationSpace(t,!0,-1),a=t.input.charCodeAt(t.position),(t.line===o||t.lineIndent>i)&&0!==a)throwError(t,"bad indentation of a sequence entry");else if(t.lineIndent<i)break;return!!l&&(t.tag=u,t.anchor=c,t.kind="sequence",t.result=h,!0)}function readTagProperty(t){var i,o,a,u,c=!1,h=!1;if(33!==(u=t.input.charCodeAt(t.position)))return!1;if(null!==t.tag&&throwError(t,"duplication of a tag property"),60===(u=t.input.charCodeAt(++t.position))?(c=!0,u=t.input.charCodeAt(++t.position)):33===u?(h=!0,o="!!",u=t.input.charCodeAt(++t.position)):o="!",i=t.position,c){do{u=t.input.charCodeAt(++t.position)}while(0!==u&&62!==u);t.position<t.length?(a=t.input.slice(i,t.position),u=t.input.charCodeAt(++t.position)):throwError(t,"unexpected end of the stream within a verbatim tag")}else{for(;0!==u&&!is_WS_OR_EOL(u);)33===u&&(h?throwError(t,"tag suffix cannot contain exclamation marks"):(o=t.input.slice(i-1,t.position+1),qe.test(o)||throwError(t,"named tag handle cannot contain such characters"),h=!0,i=t.position+1)),u=t.input.charCodeAt(++t.position);a=t.input.slice(i,t.position),Fe.test(a)&&throwError(t,"tag suffix cannot contain flow indicator characters")}a&&!Ue.test(a)&&throwError(t,"tag name cannot contain such characters: "+a);try{a=decodeURIComponent(a)}catch(i){throwError(t,"tag name is malformed: "+a)}return c?t.tag=a:De.call(t.tagMap,o)?t.tag=t.tagMap[o]+a:"!"===o?t.tag="!"+a:"!!"===o?t.tag="tag:yaml.org,2002:"+a:throwError(t,'undeclared tag handle "'+o+'"'),!0}function readAnchorProperty(t){var i,o;if(38!==(o=t.input.charCodeAt(t.position)))return!1;for(null!==t.anchor&&throwError(t,"duplication of an anchor property"),o=t.input.charCodeAt(++t.position),i=t.position;0!==o&&!is_WS_OR_EOL(o)&&!is_FLOW_INDICATOR(o);)o=t.input.charCodeAt(++t.position);return t.position===i&&throwError(t,"name of an anchor node must contain at least one character"),t.anchor=t.input.slice(i,t.position),!0}function composeNode(t,i,o,a,u){var c,h,l,d,p,m,g,v,b,w=1,_=!1,M=!1;if(null!==t.listener&&t.listener("open",t),t.tag=null,t.anchor=null,t.kind=null,t.result=null,c=h=l=4===o||3===o,a&&skipSeparationSpace(t,!0,-1)&&(_=!0,t.lineIndent>i?w=1:t.lineIndent===i?w=0:t.lineIndent<i&&(w=-1)),1===w)for(;readTagProperty(t)||readAnchorProperty(t);)skipSeparationSpace(t,!0,-1)?(_=!0,l=c,t.lineIndent>i?w=1:t.lineIndent===i?w=0:t.lineIndent<i&&(w=-1)):l=!1;if(l&&(l=_||u),1!==w&&4!==o||(v=1===o||2===o?i:i+1,b=t.position-t.lineStart,1===w?l&&(readBlockSequence(t,b)||function readBlockMapping(t,i,o){var a,u,c,h,l,d,p,m=t.tag,g=t.anchor,v={},b=Object.create(null),w=null,_=null,M=null,k=!1,B=!1;if(-1!==t.firstTabInLine)return!1;for(null!==t.anchor&&(t.anchorMap[t.anchor]=v),p=t.input.charCodeAt(t.position);0!==p;){if(k||-1===t.firstTabInLine||(t.position=t.firstTabInLine,throwError(t,"tab characters must not be used in indentation")),a=t.input.charCodeAt(t.position+1),c=t.line,63!==p&&58!==p||!is_WS_OR_EOL(a)){if(h=t.line,l=t.lineStart,d=t.position,!composeNode(t,o,2,!1,!0))break;if(t.line===c){for(p=t.input.charCodeAt(t.position);is_WHITE_SPACE(p);)p=t.input.charCodeAt(++t.position);if(58===p)is_WS_OR_EOL(p=t.input.charCodeAt(++t.position))||throwError(t,"a whitespace character is expected after the key-value separator within a block mapping"),k&&(storeMappingPair(t,v,b,w,_,null,h,l,d),w=_=M=null),B=!0,k=!1,u=!1,w=t.tag,_=t.result;else{if(!B)return t.tag=m,t.anchor=g,!0;throwError(t,"can not read an implicit mapping pair; a colon is missed")}}else{if(!B)return t.tag=m,t.anchor=g,!0;throwError(t,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===p?(k&&(storeMappingPair(t,v,b,w,_,null,h,l,d),w=_=M=null),B=!0,k=!0,u=!0):k?(k=!1,u=!0):throwError(t,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),t.position+=1,p=a;if((t.line===c||t.lineIndent>i)&&(k&&(h=t.line,l=t.lineStart,d=t.position),composeNode(t,i,4,!0,u)&&(k?_=t.result:M=t.result),k||(storeMappingPair(t,v,b,w,_,M,h,l,d),w=_=M=null),skipSeparationSpace(t,!0,-1),p=t.input.charCodeAt(t.position)),(t.line===c||t.lineIndent>i)&&0!==p)throwError(t,"bad indentation of a mapping entry");else if(t.lineIndent<i)break}return k&&storeMappingPair(t,v,b,w,_,null,h,l,d),B&&(t.tag=m,t.anchor=g,t.kind="mapping",t.result=v),B}(t,b,v))||function readFlowCollection(t,i){var o,a,u,c,h,l,d,p,m,g,v,b,w=!0,_=t.tag,M=t.anchor,k=Object.create(null);if(91===(b=t.input.charCodeAt(t.position)))h=93,p=!1,c=[];else{if(123!==b)return!1;h=125,p=!0,c={}}for(null!==t.anchor&&(t.anchorMap[t.anchor]=c),b=t.input.charCodeAt(++t.position);0!==b;){if(skipSeparationSpace(t,!0,i),(b=t.input.charCodeAt(t.position))===h)return t.position++,t.tag=_,t.anchor=M,t.kind=p?"mapping":"sequence",t.result=c,!0;w?44===b&&throwError(t,"expected the node content, but found ','"):throwError(t,"missed comma between flow collection entries"),v=null,l=d=!1,63===b&&is_WS_OR_EOL(t.input.charCodeAt(t.position+1))&&(l=d=!0,t.position++,skipSeparationSpace(t,!0,i)),o=t.line,a=t.lineStart,u=t.position,composeNode(t,i,1,!1,!0),g=t.tag,m=t.result,skipSeparationSpace(t,!0,i),b=t.input.charCodeAt(t.position),!d&&t.line!==o||58!==b||(l=!0,b=t.input.charCodeAt(++t.position),skipSeparationSpace(t,!0,i),composeNode(t,i,1,!1,!0),v=t.result),p?storeMappingPair(t,c,k,g,m,v,o,a,u):l?c.push(storeMappingPair(t,null,k,g,m,v,o,a,u)):c.push(m),skipSeparationSpace(t,!0,i),44===(b=t.input.charCodeAt(t.position))?(w=!0,b=t.input.charCodeAt(++t.position)):w=!1}throwError(t,"unexpected end of the stream within a flow collection")}(t,v)?M=!0:(h&&function readBlockScalar(t,i){var o,a,u,c,h,l=1,d=!1,p=!1,m=i,g=0,v=!1;if(124===(c=t.input.charCodeAt(t.position)))a=!1;else{if(62!==c)return!1;a=!0}for(t.kind="scalar",t.result="";0!==c;)if(43===(c=t.input.charCodeAt(++t.position))||45===c)1===l?l=43===c?3:2:throwError(t,"repeat of a chomping mode identifier");else{if(!((u=48<=(h=c)&&h<=57?h-48:-1)>=0))break;0===u?throwError(t,"bad explicit indentation width of a block scalar; it cannot be less than one"):p?throwError(t,"repeat of an indentation width identifier"):(m=i+u-1,p=!0)}if(is_WHITE_SPACE(c)){do{c=t.input.charCodeAt(++t.position)}while(is_WHITE_SPACE(c));if(35===c)do{c=t.input.charCodeAt(++t.position)}while(!is_EOL(c)&&0!==c)}for(;0!==c;){for(readLineBreak(t),t.lineIndent=0,c=t.input.charCodeAt(t.position);(!p||t.lineIndent<m)&&32===c;)t.lineIndent++,c=t.input.charCodeAt(++t.position);if(!p&&t.lineIndent>m&&(m=t.lineIndent),is_EOL(c))g++;else{if(t.lineIndent<m){3===l?t.result+=ne.repeat("\n",d?1+g:g):1===l&&d&&(t.result+="\n");break}for(a?is_WHITE_SPACE(c)?(v=!0,t.result+=ne.repeat("\n",d?1+g:g)):v?(v=!1,t.result+=ne.repeat("\n",g+1)):0===g?d&&(t.result+=" "):t.result+=ne.repeat("\n",g):t.result+=ne.repeat("\n",d?1+g:g),d=!0,p=!0,g=0,o=t.position;!is_EOL(c)&&0!==c;)c=t.input.charCodeAt(++t.position);captureSegment(t,o,t.position,!1)}}return!0}(t,v)||function readSingleQuotedScalar(t,i){var o,a,u;if(39!==(o=t.input.charCodeAt(t.position)))return!1;for(t.kind="scalar",t.result="",t.position++,a=u=t.position;0!==(o=t.input.charCodeAt(t.position));)if(39===o){if(captureSegment(t,a,t.position,!0),39!==(o=t.input.charCodeAt(++t.position)))return!0;a=t.position,t.position++,u=t.position}else is_EOL(o)?(captureSegment(t,a,u,!0),writeFoldedLines(t,skipSeparationSpace(t,!1,i)),a=u=t.position):t.position===t.lineStart&&testDocumentSeparator(t)?throwError(t,"unexpected end of the document within a single quoted scalar"):(t.position++,u=t.position);throwError(t,"unexpected end of the stream within a single quoted scalar")}(t,v)||function readDoubleQuotedScalar(t,i){var o,a,u,c,h,l,d;if(34!==(l=t.input.charCodeAt(t.position)))return!1;for(t.kind="scalar",t.result="",t.position++,o=a=t.position;0!==(l=t.input.charCodeAt(t.position));){if(34===l)return captureSegment(t,o,t.position,!0),t.position++,!0;if(92===l){if(captureSegment(t,o,t.position,!0),is_EOL(l=t.input.charCodeAt(++t.position)))skipSeparationSpace(t,!1,i);else if(l<256&&ze[l])t.result+=He[l],t.position++;else if((h=120===(d=l)?2:117===d?4:85===d?8:0)>0){for(u=h,c=0;u>0;u--)(h=fromHexCode(l=t.input.charCodeAt(++t.position)))>=0?c=(c<<4)+h:throwError(t,"expected hexadecimal character");t.result+=charFromCodepoint(c),t.position++}else throwError(t,"unknown escape sequence");o=a=t.position}else is_EOL(l)?(captureSegment(t,o,a,!0),writeFoldedLines(t,skipSeparationSpace(t,!1,i)),o=a=t.position):t.position===t.lineStart&&testDocumentSeparator(t)?throwError(t,"unexpected end of the document within a double quoted scalar"):(t.position++,a=t.position)}throwError(t,"unexpected end of the stream within a double quoted scalar")}(t,v)?M=!0:!function readAlias(t){var i,o,a;if(42!==(a=t.input.charCodeAt(t.position)))return!1;for(a=t.input.charCodeAt(++t.position),i=t.position;0!==a&&!is_WS_OR_EOL(a)&&!is_FLOW_INDICATOR(a);)a=t.input.charCodeAt(++t.position);return t.position===i&&throwError(t,"name of an alias node must contain at least one character"),o=t.input.slice(i,t.position),De.call(t.anchorMap,o)||throwError(t,'unidentified alias "'+o+'"'),t.result=t.anchorMap[o],skipSeparationSpace(t,!0,-1),!0}(t)?function readPlainScalar(t,i,o){var a,u,c,h,l,d,p,m,g=t.kind,v=t.result;if(is_WS_OR_EOL(m=t.input.charCodeAt(t.position))||is_FLOW_INDICATOR(m)||35===m||38===m||42===m||33===m||124===m||62===m||39===m||34===m||37===m||64===m||96===m)return!1;if((63===m||45===m)&&(is_WS_OR_EOL(a=t.input.charCodeAt(t.position+1))||o&&is_FLOW_INDICATOR(a)))return!1;for(t.kind="scalar",t.result="",u=c=t.position,h=!1;0!==m;){if(58===m){if(is_WS_OR_EOL(a=t.input.charCodeAt(t.position+1))||o&&is_FLOW_INDICATOR(a))break}else if(35===m){if(is_WS_OR_EOL(t.input.charCodeAt(t.position-1)))break}else{if(t.position===t.lineStart&&testDocumentSeparator(t)||o&&is_FLOW_INDICATOR(m))break;if(is_EOL(m)){if(l=t.line,d=t.lineStart,p=t.lineIndent,skipSeparationSpace(t,!1,-1),t.lineIndent>=i){h=!0,m=t.input.charCodeAt(t.position);continue}t.position=c,t.line=l,t.lineStart=d,t.lineIndent=p;break}}h&&(captureSegment(t,u,c,!1),writeFoldedLines(t,t.line-l),u=c=t.position,h=!1),is_WHITE_SPACE(m)||(c=t.position+1),m=t.input.charCodeAt(++t.position)}return captureSegment(t,u,c,!1),!!t.result||(t.kind=g,t.result=v,!1)}(t,v,1===o)&&(M=!0,null===t.tag&&(t.tag="?")):(M=!0,null===t.tag&&null===t.anchor||throwError(t,"alias node should not have any properties")),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):0===w&&(M=l&&readBlockSequence(t,b))),null===t.tag)null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);else if("?"===t.tag){for(null!==t.result&&"scalar"!==t.kind&&throwError(t,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+t.kind+'"'),d=0,p=t.implicitTypes.length;d<p;d+=1)if((g=t.implicitTypes[d]).resolve(t.result)){t.result=g.construct(t.result),t.tag=g.tag,null!==t.anchor&&(t.anchorMap[t.anchor]=t.result);break}}else if("!"!==t.tag){if(De.call(t.typeMap[t.kind||"fallback"],t.tag))g=t.typeMap[t.kind||"fallback"][t.tag];else for(g=null,d=0,p=(m=t.typeMap.multi[t.kind||"fallback"]).length;d<p;d+=1)if(t.tag.slice(0,m[d].tag.length)===m[d].tag){g=m[d];break}g||throwError(t,"unknown tag !<"+t.tag+">"),null!==t.result&&g.kind!==t.kind&&throwError(t,"unacceptable node kind for !<"+t.tag+'> tag; it should be "'+g.kind+'", not "'+t.kind+'"'),g.resolve(t.result,t.tag)?(t.result=g.construct(t.result,t.tag),null!==t.anchor&&(t.anchorMap[t.anchor]=t.result)):throwError(t,"cannot resolve a node with !<"+t.tag+"> explicit tag")}return null!==t.listener&&t.listener("close",t),null!==t.tag||null!==t.anchor||M}function readDocument(t){var i,o,a,u,c=t.position,h=!1;for(t.version=null,t.checkLineBreaks=t.legacy,t.tagMap=Object.create(null),t.anchorMap=Object.create(null);0!==(u=t.input.charCodeAt(t.position))&&(skipSeparationSpace(t,!0,-1),u=t.input.charCodeAt(t.position),!(t.lineIndent>0||37!==u));){for(h=!0,u=t.input.charCodeAt(++t.position),i=t.position;0!==u&&!is_WS_OR_EOL(u);)u=t.input.charCodeAt(++t.position);for(a=[],(o=t.input.slice(i,t.position)).length<1&&throwError(t,"directive name must not be less than one character in length");0!==u;){for(;is_WHITE_SPACE(u);)u=t.input.charCodeAt(++t.position);if(35===u){do{u=t.input.charCodeAt(++t.position)}while(0!==u&&!is_EOL(u));break}if(is_EOL(u))break;for(i=t.position;0!==u&&!is_WS_OR_EOL(u);)u=t.input.charCodeAt(++t.position);a.push(t.input.slice(i,t.position))}0!==u&&readLineBreak(t),De.call(Ke,o)?Ke[o](t,o,a):throwWarning(t,'unknown document directive "'+o+'"')}skipSeparationSpace(t,!0,-1),0===t.lineIndent&&45===t.input.charCodeAt(t.position)&&45===t.input.charCodeAt(t.position+1)&&45===t.input.charCodeAt(t.position+2)?(t.position+=3,skipSeparationSpace(t,!0,-1)):h&&throwError(t,"directives end mark is expected"),composeNode(t,t.lineIndent-1,4,!1,!0),skipSeparationSpace(t,!0,-1),t.checkLineBreaks&&Le.test(t.input.slice(c,t.position))&&throwWarning(t,"non-ASCII line breaks are interpreted as content"),t.documents.push(t.result),t.position===t.lineStart&&testDocumentSeparator(t)?46===t.input.charCodeAt(t.position)&&(t.position+=3,skipSeparationSpace(t,!0,-1)):t.position<t.length-1&&throwError(t,"end of the stream or a document separator is expected")}function loadDocuments(t,i){i=i||{},0!==(t=String(t)).length&&(10!==t.charCodeAt(t.length-1)&&13!==t.charCodeAt(t.length-1)&&(t+="\n"),65279===t.charCodeAt(0)&&(t=t.slice(1)));var o=new State$1(t,i),a=t.indexOf("\0");for(-1!==a&&(o.position=a,throwError(o,"null byte is not allowed in input")),o.input+="\0";32===o.input.charCodeAt(o.position);)o.lineIndent+=1,o.position+=1;for(;o.position<o.length-1;)readDocument(o);return o.documents}var Ve={loadAll:function loadAll$1(t,i,o){null!==i&&"object"==typeof i&&void 0===o&&(o=i,i=null);var a=loadDocuments(t,o);if("function"!=typeof i)return a;for(var u=0,c=a.length;u<c;u+=1)i(a[u])},load:function load$1(t,i){var o=loadDocuments(t,i);if(0!==o.length){if(1===o.length)return o[0];throw new ie("expected a single document in the stream, but found more")}}},Ge=Object.prototype.toString,Je=Object.prototype.hasOwnProperty,$e={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},Ze=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Ye=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function encodeHex(t){var i,o,a;if(i=t.toString(16).toUpperCase(),t<=255)o="x",a=2;else if(t<=65535)o="u",a=4;else{if(!(t<=4294967295))throw new ie("code point within a string may not be greater than 0xFFFFFFFF");o="U",a=8}return"\\"+o+ne.repeat("0",a-i.length)+i}function State(t){this.schema=t.schema||Oe,this.indent=Math.max(1,t.indent||2),this.noArrayIndent=t.noArrayIndent||!1,this.skipInvalid=t.skipInvalid||!1,this.flowLevel=ne.isNothing(t.flowLevel)?-1:t.flowLevel,this.styleMap=function compileStyleMap(t,i){var o,a,u,c,h,l,d;if(null===i)return{};for(o={},u=0,c=(a=Object.keys(i)).length;u<c;u+=1)h=a[u],l=String(i[h]),"!!"===h.slice(0,2)&&(h="tag:yaml.org,2002:"+h.slice(2)),(d=t.compiledTypeMap.fallback[h])&&Je.call(d.styleAliases,l)&&(l=d.styleAliases[l]),o[h]=l;return o}(this.schema,t.styles||null),this.sortKeys=t.sortKeys||!1,this.lineWidth=t.lineWidth||80,this.noRefs=t.noRefs||!1,this.noCompatMode=t.noCompatMode||!1,this.condenseFlow=t.condenseFlow||!1,this.quotingType='"'===t.quotingType?2:1,this.forceQuotes=t.forceQuotes||!1,this.replacer="function"==typeof t.replacer?t.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function indentString(t,i){for(var o,a=ne.repeat(" ",i),u=0,c=-1,h="",l=t.length;u<l;)-1===(c=t.indexOf("\n",u))?(o=t.slice(u),u=l):(o=t.slice(u,c+1),u=c+1),o.length&&"\n"!==o&&(h+=a),h+=o;return h}function generateNextLine(t,i){return"\n"+ne.repeat(" ",t.indent*i)}function isWhitespace(t){return 32===t||9===t}function isPrintable(t){return 32<=t&&t<=126||161<=t&&t<=55295&&8232!==t&&8233!==t||57344<=t&&t<=65533&&65279!==t||65536<=t&&t<=1114111}function isNsCharOrWhitespace(t){return isPrintable(t)&&65279!==t&&13!==t&&10!==t}function isPlainSafe(t,i,o){var a=isNsCharOrWhitespace(t),u=a&&!isWhitespace(t);return(o?a:a&&44!==t&&91!==t&&93!==t&&123!==t&&125!==t)&&35!==t&&!(58===i&&!u)||isNsCharOrWhitespace(i)&&!isWhitespace(i)&&35===t||58===i&&u}function codePointAt(t,i){var o,a=t.charCodeAt(i);return a>=55296&&a<=56319&&i+1<t.length&&(o=t.charCodeAt(i+1))>=56320&&o<=57343?1024*(a-55296)+o-56320+65536:a}function needIndentIndicator(t){return/^\n* /.test(t)}function chooseScalarStyle(t,i,o,a,u,c,h,l){var d,p=0,m=null,g=!1,v=!1,b=-1!==a,w=-1,_=function isPlainSafeFirst(t){return isPrintable(t)&&65279!==t&&!isWhitespace(t)&&45!==t&&63!==t&&58!==t&&44!==t&&91!==t&&93!==t&&123!==t&&125!==t&&35!==t&&38!==t&&42!==t&&33!==t&&124!==t&&61!==t&&62!==t&&39!==t&&34!==t&&37!==t&&64!==t&&96!==t}(codePointAt(t,0))&&function isPlainSafeLast(t){return!isWhitespace(t)&&58!==t}(codePointAt(t,t.length-1));if(i||h)for(d=0;d<t.length;p>=65536?d+=2:d++){if(!isPrintable(p=codePointAt(t,d)))return 5;_=_&&isPlainSafe(p,m,l),m=p}else{for(d=0;d<t.length;p>=65536?d+=2:d++){if(10===(p=codePointAt(t,d)))g=!0,b&&(v=v||d-w-1>a&&" "!==t[w+1],w=d);else if(!isPrintable(p))return 5;_=_&&isPlainSafe(p,m,l),m=p}v=v||b&&d-w-1>a&&" "!==t[w+1]}return g||v?o>9&&needIndentIndicator(t)?5:h?2===c?5:2:v?4:3:!_||h||u(t)?2===c?5:2:1}function writeScalar(t,i,o,a,u){t.dump=function(){if(0===i.length)return 2===t.quotingType?'""':"''";if(!t.noCompatMode&&(-1!==Ze.indexOf(i)||Ye.test(i)))return 2===t.quotingType?'"'+i+'"':"'"+i+"'";var c=t.indent*Math.max(1,o),h=-1===t.lineWidth?-1:Math.max(Math.min(t.lineWidth,40),t.lineWidth-c),l=a||t.flowLevel>-1&&o>=t.flowLevel;switch(chooseScalarStyle(i,l,t.indent,h,(function testAmbiguity(i){return function testImplicitResolving(t,i){var o,a;for(o=0,a=t.implicitTypes.length;o<a;o+=1)if(t.implicitTypes[o].resolve(i))return!0;return!1}(t,i)}),t.quotingType,t.forceQuotes&&!a,u)){case 1:return i;case 2:return"'"+i.replace(/'/g,"''")+"'";case 3:return"|"+blockHeader(i,t.indent)+dropEndingNewline(indentString(i,c));case 4:return">"+blockHeader(i,t.indent)+dropEndingNewline(indentString(function foldString(t,i){var o,a,u=/(\n+)([^\n]*)/g,c=(l=t.indexOf("\n"),l=-1!==l?l:t.length,u.lastIndex=l,foldLine(t.slice(0,l),i)),h="\n"===t[0]||" "===t[0];var l;for(;a=u.exec(t);){var d=a[1],p=a[2];o=" "===p[0],c+=d+(h||o||""===p?"":"\n")+foldLine(p,i),h=o}return c}(i,h),c));case 5:return'"'+function escapeString(t){for(var i,o="",a=0,u=0;u<t.length;a>=65536?u+=2:u++)a=codePointAt(t,u),!(i=$e[a])&&isPrintable(a)?(o+=t[u],a>=65536&&(o+=t[u+1])):o+=i||encodeHex(a);return o}(i)+'"';default:throw new ie("impossible error: invalid scalar style")}}()}function blockHeader(t,i){var o=needIndentIndicator(t)?String(i):"",a="\n"===t[t.length-1];return o+(a&&("\n"===t[t.length-2]||"\n"===t)?"+":a?"":"-")+"\n"}function dropEndingNewline(t){return"\n"===t[t.length-1]?t.slice(0,-1):t}function foldLine(t,i){if(""===t||" "===t[0])return t;for(var o,a,u=/ [^ ]/g,c=0,h=0,l=0,d="";o=u.exec(t);)(l=o.index)-c>i&&(a=h>c?h:l,d+="\n"+t.slice(c,a),c=a+1),h=l;return d+="\n",t.length-c>i&&h>c?d+=t.slice(c,h)+"\n"+t.slice(h+1):d+=t.slice(c),d.slice(1)}function writeBlockSequence(t,i,o,a){var u,c,h,l="",d=t.tag;for(u=0,c=o.length;u<c;u+=1)h=o[u],t.replacer&&(h=t.replacer.call(o,String(u),h)),(writeNode(t,i+1,h,!0,!0,!1,!0)||void 0===h&&writeNode(t,i+1,null,!0,!0,!1,!0))&&(a&&""===l||(l+=generateNextLine(t,i)),t.dump&&10===t.dump.charCodeAt(0)?l+="-":l+="- ",l+=t.dump);t.tag=d,t.dump=l||"[]"}function detectType(t,i,o){var a,u,c,h,l,d;for(c=0,h=(u=o?t.explicitTypes:t.implicitTypes).length;c<h;c+=1)if(((l=u[c]).instanceOf||l.predicate)&&(!l.instanceOf||"object"==typeof i&&i instanceof l.instanceOf)&&(!l.predicate||l.predicate(i))){if(o?l.multi&&l.representName?t.tag=l.representName(i):t.tag=l.tag:t.tag="?",l.represent){if(d=t.styleMap[l.tag]||l.defaultStyle,"[object Function]"===Ge.call(l.represent))a=l.represent(i,d);else{if(!Je.call(l.represent,d))throw new ie("!<"+l.tag+'> tag resolver accepts not "'+d+'" style');a=l.represent[d](i,d)}t.dump=a}return!0}return!1}function writeNode(t,i,o,a,u,c,h){t.tag=null,t.dump=o,detectType(t,o,!1)||detectType(t,o,!0);var l,d=Ge.call(t.dump),p=a;a&&(a=t.flowLevel<0||t.flowLevel>i);var m,g,v="[object Object]"===d||"[object Array]"===d;if(v&&(g=-1!==(m=t.duplicates.indexOf(o))),(null!==t.tag&&"?"!==t.tag||g||2!==t.indent&&i>0)&&(u=!1),g&&t.usedDuplicates[m])t.dump="*ref_"+m;else{if(v&&g&&!t.usedDuplicates[m]&&(t.usedDuplicates[m]=!0),"[object Object]"===d)a&&0!==Object.keys(t.dump).length?(!function writeBlockMapping(t,i,o,a){var u,c,h,l,d,p,m="",g=t.tag,v=Object.keys(o);if(!0===t.sortKeys)v.sort();else if("function"==typeof t.sortKeys)v.sort(t.sortKeys);else if(t.sortKeys)throw new ie("sortKeys must be a boolean or a function");for(u=0,c=v.length;u<c;u+=1)p="",a&&""===m||(p+=generateNextLine(t,i)),l=o[h=v[u]],t.replacer&&(l=t.replacer.call(o,h,l)),writeNode(t,i+1,h,!0,!0,!0)&&((d=null!==t.tag&&"?"!==t.tag||t.dump&&t.dump.length>1024)&&(t.dump&&10===t.dump.charCodeAt(0)?p+="?":p+="? "),p+=t.dump,d&&(p+=generateNextLine(t,i)),writeNode(t,i+1,l,!0,d)&&(t.dump&&10===t.dump.charCodeAt(0)?p+=":":p+=": ",m+=p+=t.dump));t.tag=g,t.dump=m||"{}"}(t,i,t.dump,u),g&&(t.dump="&ref_"+m+t.dump)):(!function writeFlowMapping(t,i,o){var a,u,c,h,l,d="",p=t.tag,m=Object.keys(o);for(a=0,u=m.length;a<u;a+=1)l="",""!==d&&(l+=", "),t.condenseFlow&&(l+='"'),h=o[c=m[a]],t.replacer&&(h=t.replacer.call(o,c,h)),writeNode(t,i,c,!1,!1)&&(t.dump.length>1024&&(l+="? "),l+=t.dump+(t.condenseFlow?'"':"")+":"+(t.condenseFlow?"":" "),writeNode(t,i,h,!1,!1)&&(d+=l+=t.dump));t.tag=p,t.dump="{"+d+"}"}(t,i,t.dump),g&&(t.dump="&ref_"+m+" "+t.dump));else if("[object Array]"===d)a&&0!==t.dump.length?(t.noArrayIndent&&!h&&i>0?writeBlockSequence(t,i-1,t.dump,u):writeBlockSequence(t,i,t.dump,u),g&&(t.dump="&ref_"+m+t.dump)):(!function writeFlowSequence(t,i,o){var a,u,c,h="",l=t.tag;for(a=0,u=o.length;a<u;a+=1)c=o[a],t.replacer&&(c=t.replacer.call(o,String(a),c)),(writeNode(t,i,c,!1,!1)||void 0===c&&writeNode(t,i,null,!1,!1))&&(""!==h&&(h+=","+(t.condenseFlow?"":" ")),h+=t.dump);t.tag=l,t.dump="["+h+"]"}(t,i,t.dump),g&&(t.dump="&ref_"+m+" "+t.dump));else{if("[object String]"!==d){if("[object Undefined]"===d)return!1;if(t.skipInvalid)return!1;throw new ie("unacceptable kind of an object to dump "+d)}"?"!==t.tag&&writeScalar(t,t.dump,i,c,p)}null!==t.tag&&"?"!==t.tag&&(l=encodeURI("!"===t.tag[0]?t.tag.slice(1):t.tag).replace(/!/g,"%21"),l="!"===t.tag[0]?"!"+l:"tag:yaml.org,2002:"===l.slice(0,18)?"!!"+l.slice(18):"!<"+l+">",t.dump=l+" "+t.dump)}return!0}function getDuplicateReferences(t,i){var o,a,u=[],c=[];for(function inspectNode(t,i,o){var a,u,c;if(null!==t&&"object"==typeof t)if(-1!==(u=i.indexOf(t)))-1===o.indexOf(u)&&o.push(u);else if(i.push(t),Array.isArray(t))for(u=0,c=t.length;u<c;u+=1)inspectNode(t[u],i,o);else for(a=Object.keys(t),u=0,c=a.length;u<c;u+=1)inspectNode(t[a[u]],i,o)}(t,u,c),o=0,a=c.length;o<a;o+=1)i.duplicates.push(u[c[o]]);i.usedDuplicates=new Array(a)}function renamed(t,i){return function(){throw new Error("Function yaml."+t+" is removed in js-yaml 4. Use yaml."+i+" instead, which is now safe by default.")}}var Xe={Type:ue,Schema:ce,FAILSAFE_SCHEMA:de,JSON_SCHEMA:we,CORE_SCHEMA:_e,DEFAULT_SCHEMA:Oe,load:Ve.load,loadAll:Ve.loadAll,dump:{dump:function dump$1(t,i){var o=new State(i=i||{});o.noRefs||getDuplicateReferences(t,o);var a=t;return o.replacer&&(a=o.replacer.call({"":a},"",a)),writeNode(o,0,a,!0,!0)?o.dump+"\n":""}}.dump,YAMLException:ie,types:{binary:Pe,float:be,map:fe,null:pe,pairs:Ae,set:Ce,timestamp:ke,bool:me,int:ge,merge:Ee,omap:Ie,seq:le,str:he},safeLoad:renamed("safeLoad","load"),safeLoadAll:renamed("safeLoadAll","loadAll"),safeDump:renamed("safeDump","dump")},Qe=o(52),et=o(39),tt=o.n(et),rt=o(22),nt=o.n(rt),it=function isRfc3986Reserved(t){return":/?#[]@!$&'()*+,;=".indexOf(t)>-1},ot=function isRrc3986Unreserved(t){return/^[a-z0-9\-._~]+$/i.test(t)};function encodeDisallowedCharacters(t){var i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=o.escape,u=arguments.length>2?arguments[2]:void 0;return"number"==typeof t&&(t=t.toString()),"string"==typeof t&&t.length&&a?u?JSON.parse(t):V()(i=tt()(t)).call(i,(function(t){var i,o;if(ot(t))return t;if(it(t)&&"unsafe"===a)return t;var u=new TextEncoder;return V()(i=V()(o=U()(u.encode(t))).call(o,(function(t){var i;return nt()(i="0".concat(t.toString(16).toUpperCase())).call(i,-2)}))).call(i,(function(t){return"%".concat(t)})).join("")})).join(""):t}function stylize(t){var i=t.value;return Array.isArray(i)?function encodeArray(t){var i=t.key,o=t.value,a=t.style,u=t.explode,c=t.escape,h=function valueEncoder(t){return encodeDisallowedCharacters(t,{escape:c})};if("simple"===a)return V()(o).call(o,(function(t){return h(t)})).join(",");if("label"===a)return".".concat(V()(o).call(o,(function(t){return h(t)})).join("."));if("matrix"===a)return V()(o).call(o,(function(t){return h(t)})).reduce((function(t,o){var a,c,h;return!t||u?Z()(c=Z()(h="".concat(t||"",";")).call(h,i,"=")).call(c,o):Z()(a="".concat(t,",")).call(a,o)}),"");if("form"===a){var l=u?"&".concat(i,"="):",";return V()(o).call(o,(function(t){return h(t)})).join(l)}if("spaceDelimited"===a){var d=u?"".concat(i,"="):"";return V()(o).call(o,(function(t){return h(t)})).join(" ".concat(d))}if("pipeDelimited"===a){var p=u?"".concat(i,"="):"";return V()(o).call(o,(function(t){return h(t)})).join("|".concat(p))}return}(t):"object"===k()(i)?function encodeObject(t){var i=t.key,o=t.value,a=t.style,u=t.explode,c=t.escape,h=function valueEncoder(t){return encodeDisallowedCharacters(t,{escape:c})},l=J()(o);if("simple"===a)return l.reduce((function(t,i){var a,c,l,d=h(o[i]),p=u?"=":",",m=t?"".concat(t,","):"";return Z()(a=Z()(c=Z()(l="".concat(m)).call(l,i)).call(c,p)).call(a,d)}),"");if("label"===a)return l.reduce((function(t,i){var a,c,l,d=h(o[i]),p=u?"=":".",m=t?"".concat(t,"."):".";return Z()(a=Z()(c=Z()(l="".concat(m)).call(l,i)).call(c,p)).call(a,d)}),"");if("matrix"===a&&u)return l.reduce((function(t,i){var a,u,c=h(o[i]),l=t?"".concat(t,";"):";";return Z()(a=Z()(u="".concat(l)).call(u,i,"=")).call(a,c)}),"");if("matrix"===a)return l.reduce((function(t,a){var u,c,l=h(o[a]),d=t?"".concat(t,","):";".concat(i,"=");return Z()(u=Z()(c="".concat(d)).call(c,a,",")).call(u,l)}),"");if("form"===a)return l.reduce((function(t,i){var a,c,l,d,p=h(o[i]),m=t?Z()(a="".concat(t)).call(a,u?"&":","):"",g=u?"=":",";return Z()(c=Z()(l=Z()(d="".concat(m)).call(d,i)).call(l,g)).call(c,p)}),"");return}(t):function encodePrimitive(t){var i,o=t.key,a=t.value,u=t.style,c=t.escape,h=function valueEncoder(t){return encodeDisallowedCharacters(t,{escape:c})};if("simple"===u)return h(a);if("label"===u)return".".concat(h(a));if("matrix"===u)return Z()(i=";".concat(o,"=")).call(i,h(a));if("form"===u)return h(a);if("deepObject"===u)return h(a);return}(t)}var st=function foldFormDataToRequest(t,i){i.body=t},at={serializeRes:serializeRes,mergeInQueryOrForm:mergeInQueryOrForm};function http_http(t){return _http.apply(this,arguments)}function _http(){return(_http=I()(A.a.mark((function _callee(t){var i,o,a,u,c,h=arguments;return A.a.wrap((function _callee$(l){for(;;)switch(l.prev=l.next){case 0:if(i=h.length>1&&void 0!==h[1]?h[1]:{},"object"===k()(t)&&(t=(i=t).url),i.headers=i.headers||{},at.mergeInQueryOrForm(i),i.headers&&J()(i.headers).forEach((function(t){var o=i.headers[t];"string"==typeof o&&(i.headers[t]=o.replace(/\n+/g," "))})),!i.requestInterceptor){l.next=12;break}return l.next=8,i.requestInterceptor(i);case 8:if(l.t0=l.sent,l.t0){l.next=11;break}l.t0=i;case 11:i=l.t0;case 12:return o=i.headers["content-type"]||i.headers["Content-Type"],/multipart\/form-data/i.test(o)&&i.body instanceof Qe.FormData&&(delete i.headers["content-type"],delete i.headers["Content-Type"]),l.prev=14,l.next=17,(i.userFetch||fetch)(i.url,i);case 17:return a=l.sent,l.next=20,at.serializeRes(a,t,i);case 20:if(a=l.sent,!i.responseInterceptor){l.next=28;break}return l.next=24,i.responseInterceptor(a);case 24:if(l.t1=l.sent,l.t1){l.next=27;break}l.t1=a;case 27:a=l.t1;case 28:l.next=39;break;case 30:if(l.prev=30,l.t2=l.catch(14),a){l.next=34;break}throw l.t2;case 34:throw(u=new Error(a.statusText||"response status is ".concat(a.status))).status=a.status,u.statusCode=a.status,u.responseError=l.t2,u;case 39:if(a.ok){l.next=45;break}throw(c=new Error(a.statusText||"response status is ".concat(a.status))).status=a.status,c.statusCode=a.status,c.response=a,c;case 45:return l.abrupt("return",a);case 46:case"end":return l.stop()}}),_callee,null,[[14,30]])})))).apply(this,arguments)}var ut=function shouldDownloadAsText(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/(json|xml|yaml|text)\b/.test(t)};function parseBody(t,i){return i&&(0===i.indexOf("application/json")||i.indexOf("+json")>0)?JSON.parse(t):Xe.load(t)}function serializeRes(t,i){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=o.loadSpec,u=void 0!==a&&a,c={ok:t.ok,url:t.url||i,status:t.status,statusText:t.statusText,headers:serializeHeaders(t.headers)},h=c.headers["content-type"],l=u||ut(h),d=l?t.text:t.blob||t.buffer;return d.call(t).then((function(t){if(c.text=t,c.data=t,l)try{var i=parseBody(t,h);c.body=i,c.obj=i}catch(t){c.parseError=t}return c}))}function serializeHeaderValue(t){return O()(t).call(t,", ")?t.split(", "):t}function serializeHeaders(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"function"!=typeof L()(t)?{}:U()(L()(t).call(t)).reduce((function(t,i){var o=P()(i,2),a=o[0],u=o[1];return t[a]=serializeHeaderValue(u),t}),{})}function isFile(t,i){return i||"undefined"==typeof navigator||(i=navigator),i&&"ReactNative"===i.product?!(!t||"object"!==k()(t)||"string"!=typeof t.uri):void 0!==Qe.File&&t instanceof Qe.File||(void 0!==Qe.Blob&&t instanceof Qe.Blob||(!!ArrayBuffer.isView(t)||null!==t&&"object"===k()(t)&&"function"==typeof t.pipe))}function isArrayOfFile(t,i){return Array.isArray(t)&&t.some((function(t){return isFile(t,i)}))}var ct={form:",",spaceDelimited:"%20",pipeDelimited:"|"},ht={csv:",",ssv:"%20",tsv:"%09",pipes:"|"};function formatKeyValue(t,i){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=i.collectionFormat,u=i.allowEmptyValue,c=i.serializationOption,h=i.encoding,l="object"!==k()(i)||Array.isArray(i)?i:i.value,d=o?function(t){return t.toString()}:function(t){return encodeURIComponent(t)},p=d(t);if(void 0===l&&u)return[[p,""]];if(isFile(l)||isArrayOfFile(l))return[[p,l]];if(c)return formatKeyValueBySerializationOption(t,l,o,c);if(h){if([k()(h.style),k()(h.explode),k()(h.allowReserved)].some((function(t){return"undefined"!==t}))){var m=h.style,g=h.explode,v=h.allowReserved;return formatKeyValueBySerializationOption(t,l,o,{style:m,explode:g,allowReserved:v})}if(h.contentType){if("application/json"===h.contentType){var b="string"==typeof l?l:H()(l);return[[p,d(b)]]}return[[p,d(l.toString())]]}return"object"!==k()(l)?[[p,d(l)]]:Array.isArray(l)&&l.every((function(t){return"object"!==k()(t)}))?[[p,V()(l).call(l,d).join(",")]]:[[p,d(H()(l))]]}return"object"!==k()(l)?[[p,d(l)]]:Array.isArray(l)?"multi"===a?[[p,V()(l).call(l,d)]]:[[p,V()(l).call(l,d).join(ht[a||"csv"])]]:[[p,""]]}function formatKeyValueBySerializationOption(t,i,o,a){var u,c,h,l=a.style||"form",d=void 0===a.explode?"form"===l:a.explode,p=!o&&(a&&a.allowReserved?"unsafe":"reserved"),m=function encodeFn(t){return encodeDisallowedCharacters(t,{escape:p})},g=o?function(t){return t}:function(t){return encodeDisallowedCharacters(t,{escape:p})};return"object"!==k()(i)?[[g(t),m(i)]]:Array.isArray(i)?d?[[g(t),V()(i).call(i,m)]]:[[g(t),V()(i).call(i,m).join(ct[l])]]:"deepObject"===l?V()(c=J()(i)).call(c,(function(o){var a;return[g(Z()(a="".concat(t,"[")).call(a,o,"]")),m(i[o])]})):d?V()(h=J()(i)).call(h,(function(t){return[g(t),m(i[t])]})):[[g(t),V()(u=J()(i)).call(u,(function(t){var o;return[Z()(o="".concat(g(t),",")).call(o,m(i[t]))]})).join(",")]]}function buildFormData(t){return X()(t).reduce((function(t,i){var o,a=P()(i,2),u=a[0],c=a[1],h=_()(formatKeyValue(u,c,!0));try{for(h.s();!(o=h.n()).done;){var l=P()(o.value,2),d=l[0],p=l[1];if(Array.isArray(p)){var m,g=_()(p);try{for(g.s();!(m=g.n()).done;){var v=m.value;if(ArrayBuffer.isView(v)){var b=new Qe.Blob([v]);t.append(d,b)}else t.append(d,v)}}catch(t){g.e(t)}finally{g.f()}}else if(ArrayBuffer.isView(p)){var w=new Qe.Blob([p]);t.append(d,w)}else t.append(d,p)}}catch(t){h.e(t)}finally{h.f()}return t}),new Qe.FormData)}function encodeFormOrQuery(t){var i=J()(t).reduce((function(i,o){var a,u=_()(formatKeyValue(o,t[o]));try{for(u.s();!(a=u.n()).done;){var c=P()(a.value,2),h=c[0],l=c[1];i[h]=l}}catch(t){u.e(t)}finally{u.f()}return i}),{});return re.a.stringify(i,{encode:!1,indices:!1})||""}function mergeInQueryOrForm(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.url,o=void 0===i?"":i,a=t.query,u=t.form,c=function joinSearch(){for(var t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];var a=ee()(i).call(i,(function(t){return t})).join("&");return a?"?".concat(a):""};if(u){var h=J()(u).some((function(t){var i=u[t].value;return isFile(i)||isArrayOfFile(i)})),l=t.headers["content-type"]||t.headers["Content-Type"];if(h||/multipart\/form-data/i.test(l)){var d=buildFormData(t.form);st(d,t)}else t.body=encodeFormOrQuery(u);delete t.form}if(a){var p=o.split("?"),m=P()(p,2),g=m[0],v=m[1],b="";if(v){var w=re.a.parse(v),_=J()(a);_.forEach((function(t){return delete w[t]})),b=re.a.stringify(w,{encode:!0})}var M=c(b,encodeFormOrQuery(a));t.url=g+M,delete t.query}return t}var dt,pt=o(133),mt=o.n(pt),vt=o(134),yt=o.n(vt),bt=o(318),wt=o.n(bt),_t=o(51),Mt=o.n(_t),St=o(319),kt=o.n(St),Et=(dt=function(t,i){return(dt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var o in i)i.hasOwnProperty(o)&&(t[o]=i[o])})(t,i)},function(t,i){function __(){this.constructor=t}dt(t,i),t.prototype=null===i?Object.create(i):(__.prototype=i.prototype,new __)}),Bt=Object.prototype.hasOwnProperty;function module_helpers_hasOwnProperty(t,i){return Bt.call(t,i)}function _objectKeys(t){if(Array.isArray(t)){for(var i=new Array(t.length),o=0;o<i.length;o++)i[o]=""+o;return i}if(Object.keys)return Object.keys(t);var a=[];for(var u in t)module_helpers_hasOwnProperty(t,u)&&a.push(u);return a}function _deepClone(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function helpers_isInteger(t){for(var i,o=0,a=t.length;o<a;){if(!((i=t.charCodeAt(o))>=48&&i<=57))return!1;o++}return!0}function escapePathComponent(t){return-1===t.indexOf("/")&&-1===t.indexOf("~")?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function unescapePathComponent(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function patchErrorMessageFormatter(t,i){var o=[t];for(var a in i){var u="object"==typeof i[a]?JSON.stringify(i[a],null,2):i[a];void 0!==u&&o.push(a+": "+u)}return o.join("\n")}var Pt=function(t){function PatchError(i,o,a,u,c){var h=this.constructor,l=t.call(this,patchErrorMessageFormatter(i,{name:o,index:a,operation:u,tree:c}))||this;return l.name=o,l.index=a,l.operation=u,l.tree=c,Object.setPrototypeOf(l,h.prototype),l.message=patchErrorMessageFormatter(i,{name:o,index:a,operation:u,tree:c}),l}return Et(PatchError,t),PatchError}(Error),xt=Pt,Tt=_deepClone,It={add:function(t,i,o){return t[i]=this.value,{newDocument:o}},remove:function(t,i,o){var a=t[i];return delete t[i],{newDocument:o,removed:a}},replace:function(t,i,o){var a=t[i];return t[i]=this.value,{newDocument:o,removed:a}},move:function(t,i,o){var a=getValueByPointer(o,this.path);a&&(a=_deepClone(a));var u=applyOperation(o,{op:"remove",path:this.from}).removed;return applyOperation(o,{op:"add",path:this.path,value:u}),{newDocument:o,removed:a}},copy:function(t,i,o){var a=getValueByPointer(o,this.from);return applyOperation(o,{op:"add",path:this.path,value:_deepClone(a)}),{newDocument:o}},test:function(t,i,o){return{newDocument:o,test:_areEquals(t[i],this.value)}},_get:function(t,i,o){return this.value=t[i],{newDocument:o}}},Nt={add:function(t,i,o){return helpers_isInteger(i)?t.splice(i,0,this.value):t[i]=this.value,{newDocument:o,index:i}},remove:function(t,i,o){return{newDocument:o,removed:t.splice(i,1)[0]}},replace:function(t,i,o){var a=t[i];return t[i]=this.value,{newDocument:o,removed:a}},move:It.move,copy:It.copy,test:It.test,_get:It._get};function getValueByPointer(t,i){if(""==i)return t;var o={op:"_get",path:i};return applyOperation(t,o),o.value}function applyOperation(t,i,o,a,u,c){if(void 0===o&&(o=!1),void 0===a&&(a=!0),void 0===u&&(u=!0),void 0===c&&(c=0),o&&("function"==typeof o?o(i,0,t,i.path):validator(i,0)),""===i.path){var h={newDocument:t};if("add"===i.op)return h.newDocument=i.value,h;if("replace"===i.op)return h.newDocument=i.value,h.removed=t,h;if("move"===i.op||"copy"===i.op)return h.newDocument=getValueByPointer(t,i.from),"move"===i.op&&(h.removed=t),h;if("test"===i.op){if(h.test=_areEquals(t,i.value),!1===h.test)throw new xt("Test operation failed","TEST_OPERATION_FAILED",c,i,t);return h.newDocument=t,h}if("remove"===i.op)return h.removed=t,h.newDocument=null,h;if("_get"===i.op)return i.value=t,h;if(o)throw new xt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",c,i,t);return h}a||(t=_deepClone(t));var l=(i.path||"").split("/"),d=t,p=1,m=l.length,g=void 0,v=void 0,b=void 0;for(b="function"==typeof o?o:validator;;){if((v=l[p])&&-1!=v.indexOf("~")&&(v=unescapePathComponent(v)),u&&("__proto__"==v||"prototype"==v&&p>0&&"constructor"==l[p-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(o&&void 0===g&&(void 0===d[v]?g=l.slice(0,p).join("/"):p==m-1&&(g=i.path),void 0!==g&&b(i,0,t,g)),p++,Array.isArray(d)){if("-"===v)v=d.length;else{if(o&&!helpers_isInteger(v))throw new xt("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",c,i,t);helpers_isInteger(v)&&(v=~~v)}if(p>=m){if(o&&"add"===i.op&&v>d.length)throw new xt("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",c,i,t);if(!1===(h=Nt[i.op].call(i,d,v,t)).test)throw new xt("Test operation failed","TEST_OPERATION_FAILED",c,i,t);return h}}else if(p>=m){if(!1===(h=It[i.op].call(i,d,v,t)).test)throw new xt("Test operation failed","TEST_OPERATION_FAILED",c,i,t);return h}if(d=d[v],o&&p<m&&(!d||"object"!=typeof d))throw new xt("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",c,i,t)}}function applyPatch(t,i,o,a,u){if(void 0===a&&(a=!0),void 0===u&&(u=!0),o&&!Array.isArray(i))throw new xt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");a||(t=_deepClone(t));for(var c=new Array(i.length),h=0,l=i.length;h<l;h++)c[h]=applyOperation(t,i[h],o,!0,u,h),t=c[h].newDocument;return c.newDocument=t,c}function applyReducer(t,i,o){var a=applyOperation(t,i);if(!1===a.test)throw new xt("Test operation failed","TEST_OPERATION_FAILED",o,i,t);return a.newDocument}function validator(t,i,o,a){if("object"!=typeof t||null===t||Array.isArray(t))throw new xt("Operation is not an object","OPERATION_NOT_AN_OBJECT",i,t,o);if(!It[t.op])throw new xt("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,o);if("string"!=typeof t.path)throw new xt("Operation `path` property is not a string","OPERATION_PATH_INVALID",i,t,o);if(0!==t.path.indexOf("/")&&t.path.length>0)throw new xt('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",i,t,o);if(("move"===t.op||"copy"===t.op)&&"string"!=typeof t.from)throw new xt("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",i,t,o);if(("add"===t.op||"replace"===t.op||"test"===t.op)&&void 0===t.value)throw new xt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",i,t,o);if(("add"===t.op||"replace"===t.op||"test"===t.op)&&function hasUndefined(t){if(void 0===t)return!0;if(t)if(Array.isArray(t)){for(var i=0,o=t.length;i<o;i++)if(hasUndefined(t[i]))return!0}else if("object"==typeof t)for(var a=_objectKeys(t),u=a.length,c=0;c<u;c++)if(hasUndefined(t[a[c]]))return!0;return!1}(t.value))throw new xt("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",i,t,o);if(o)if("add"==t.op){var u=t.path.split("/").length,c=a.split("/").length;if(u!==c+1&&u!==c)throw new xt("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",i,t,o)}else if("replace"===t.op||"remove"===t.op||"_get"===t.op){if(t.path!==a)throw new xt("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",i,t,o)}else if("move"===t.op||"copy"===t.op){var h=validate([{op:"_get",path:t.from,value:void 0}],o);if(h&&"OPERATION_PATH_UNRESOLVABLE"===h.name)throw new xt("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",i,t,o)}}function validate(t,i,o){try{if(!Array.isArray(t))throw new xt("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(i)applyPatch(_deepClone(i),_deepClone(t),o||!0);else{o=o||validator;for(var a=0;a<t.length;a++)o(t[a],a,i,void 0)}}catch(t){if(t instanceof xt)return t;throw t}}function _areEquals(t,i){if(t===i)return!0;if(t&&i&&"object"==typeof t&&"object"==typeof i){var o,a,u,c=Array.isArray(t),h=Array.isArray(i);if(c&&h){if((a=t.length)!=i.length)return!1;for(o=a;0!=o--;)if(!_areEquals(t[o],i[o]))return!1;return!0}if(c!=h)return!1;var l=Object.keys(t);if((a=l.length)!==Object.keys(i).length)return!1;for(o=a;0!=o--;)if(!i.hasOwnProperty(l[o]))return!1;for(o=a;0!=o--;)if(!_areEquals(t[u=l[o]],i[u]))return!1;return!0}return t!=t&&i!=i}var At=new WeakMap,Rt=function Rt(t){this.observers=new Map,this.obj=t},Ct=function Ct(t,i){this.callback=t,this.observer=i};function unobserve(t,i){i.unobserve()}function observe(t,i){var o,a=function getMirror(t){return At.get(t)}(t);if(a){var u=function getObserverFromMirror(t,i){return t.observers.get(i)}(a,i);o=u&&u.observer}else a=new Rt(t),At.set(t,a);if(o)return o;if(o={},a.value=_deepClone(t),i){o.callback=i,o.next=null;var dirtyCheck=function(){generate(o)},fastCheck=function(){clearTimeout(o.next),o.next=setTimeout(dirtyCheck)};"undefined"!=typeof window&&(window.addEventListener("mouseup",fastCheck),window.addEventListener("keyup",fastCheck),window.addEventListener("mousedown",fastCheck),window.addEventListener("keydown",fastCheck),window.addEventListener("change",fastCheck))}return o.patches=[],o.object=t,o.unobserve=function(){generate(o),clearTimeout(o.next),function removeObserverFromMirror(t,i){t.observers.delete(i.callback)}(a,o),"undefined"!=typeof window&&(window.removeEventListener("mouseup",fastCheck),window.removeEventListener("keyup",fastCheck),window.removeEventListener("mousedown",fastCheck),window.removeEventListener("keydown",fastCheck),window.removeEventListener("change",fastCheck))},a.observers.set(i,new Ct(i,o)),o}function generate(t,i){void 0===i&&(i=!1);var o=At.get(t.object);_generate(o.value,t.object,t.patches,"",i),t.patches.length&&applyPatch(o.value,t.patches);var a=t.patches;return a.length>0&&(t.patches=[],t.callback&&t.callback(a)),a}function _generate(t,i,o,a,u){if(i!==t){"function"==typeof i.toJSON&&(i=i.toJSON());for(var c=_objectKeys(i),h=_objectKeys(t),l=!1,d=h.length-1;d>=0;d--){var p=t[g=h[d]];if(!module_helpers_hasOwnProperty(i,g)||void 0===i[g]&&void 0!==p&&!1===Array.isArray(i))Array.isArray(t)===Array.isArray(i)?(u&&o.push({op:"test",path:a+"/"+escapePathComponent(g),value:_deepClone(p)}),o.push({op:"remove",path:a+"/"+escapePathComponent(g)}),l=!0):(u&&o.push({op:"test",path:a,value:t}),o.push({op:"replace",path:a,value:i}),!0);else{var m=i[g];"object"==typeof p&&null!=p&&"object"==typeof m&&null!=m&&Array.isArray(p)===Array.isArray(m)?_generate(p,m,o,a+"/"+escapePathComponent(g),u):p!==m&&(!0,u&&o.push({op:"test",path:a+"/"+escapePathComponent(g),value:_deepClone(p)}),o.push({op:"replace",path:a+"/"+escapePathComponent(g),value:_deepClone(m)}))}}if(l||c.length!=h.length)for(d=0;d<c.length;d++){var g;module_helpers_hasOwnProperty(t,g=c[d])||void 0===i[g]||o.push({op:"add",path:a+"/"+escapePathComponent(g),value:_deepClone(i[g])})}}}function compare(t,i,o){void 0===o&&(o=!1);var a=[];return _generate(t,i,a,"",o),a}Object.assign({},a,u,{JsonPatchError:Pt,deepClone:_deepClone,escapePathComponent:escapePathComponent,unescapePathComponent:unescapePathComponent});var Ot=o(320),Dt=o.n(Ot),jt={add:function add(t,i){return{op:"add",path:t,value:i}},replace:replace,remove:function remove(t){return{op:"remove",path:t}},merge:function lib_merge(t,i){return{type:"mutation",op:"merge",path:t,value:i}},mergeDeep:function mergeDeep(t,i){return{type:"mutation",op:"mergeDeep",path:t,value:i}},context:function context(t,i){return{type:"context",path:t,value:i}},getIn:function getIn(t,i){return i.reduce((function(t,i){return void 0!==i&&t?t[i]:t}),t)},applyPatch:function lib_applyPatch(t,i,o){if(o=o||{},"merge"===(i=l()(l()({},i),{},{path:i.path&&normalizeJSONPath(i.path)})).op){var a=getInByJsonPath(t,i.path);p()(a,i.value),applyPatch(t,[replace(i.path,a)])}else if("mergeDeep"===i.op){var u=getInByJsonPath(t,i.path),c=Dt()(u,i.value);t=applyPatch(t,[replace(i.path,c)]).newDocument}else if("add"===i.op&&""===i.path&&lib_isObject(i.value)){var h=J()(i.value).reduce((function(t,o){return t.push({op:"add",path:"/".concat(normalizeJSONPath(o)),value:i.value[o]}),t}),[]);applyPatch(t,h)}else if("replace"===i.op&&""===i.path){var d=i.value;o.allowMetaPatches&&i.meta&&isAdditiveMutation(i)&&(Array.isArray(i.value)||lib_isObject(i.value))&&(d=l()(l()({},d),i.meta)),t=d}else if(applyPatch(t,[i]),o.allowMetaPatches&&i.meta&&isAdditiveMutation(i)&&(Array.isArray(i.value)||lib_isObject(i.value))){var m=getInByJsonPath(t,i.path),g=l()(l()({},m),i.meta);applyPatch(t,[replace(i.path,g)])}return t},parentPathMatch:function parentPathMatch(t,i){if(!Array.isArray(i))return!1;for(var o=0,a=i.length;o<a;o+=1)if(i[o]!==t[o])return!1;return!0},flatten:flatten,fullyNormalizeArray:function fullyNormalizeArray(t){return cleanArray(flatten(normalizeArray(t)))},normalizeArray:normalizeArray,isPromise:function isPromise(t){return lib_isObject(t)&&isFunction(t.then)},forEachNew:function forEachNew(t,i){try{return forEachNewPatch(t,forEach,i)}catch(t){return t}},forEachNewPrimitive:function forEachNewPrimitive(t,i){try{return forEachNewPatch(t,forEachPrimitive,i)}catch(t){return t}},isJsonPatch:isJsonPatch,isContextPatch:function isContextPatch(t){return isPatch(t)&&"context"===t.type},isPatch:isPatch,isMutation:isMutation,isAdditiveMutation:isAdditiveMutation,isGenerator:function isGenerator(t){return"[object GeneratorFunction]"===Object.prototype.toString.call(t)},isFunction:isFunction,isObject:lib_isObject,isError:function isError(t){return t instanceof Error}};function normalizeJSONPath(t){return Array.isArray(t)?t.length<1?"":"/".concat(V()(t).call(t,(function(t){return(t+"").replace(/~/g,"~0").replace(/\//g,"~1")})).join("/")):t}function replace(t,i,o){return{op:"replace",path:t,value:i,meta:o}}function forEachNewPatch(t,i,o){var a;return cleanArray(flatten(V()(a=ee()(t).call(t,isAdditiveMutation)).call(a,(function(t){return i(t.value,o,t.path)}))||[]))}function forEachPrimitive(t,i,o){return o=o||[],Array.isArray(t)?V()(t).call(t,(function(t,a){return forEachPrimitive(t,i,Z()(o).call(o,a))})):lib_isObject(t)?V()(a=J()(t)).call(a,(function(a){return forEachPrimitive(t[a],i,Z()(o).call(o,a))})):i(t,o[o.length-1],o);var a}function forEach(t,i,o){var a=[];if((o=o||[]).length>0){var u=i(t,o[o.length-1],o);u&&(a=Z()(a).call(a,u))}if(Array.isArray(t)){var c=V()(t).call(t,(function(t,a){return forEach(t,i,Z()(o).call(o,a))}));c&&(a=Z()(a).call(a,c))}else if(lib_isObject(t)){var h,l=V()(h=J()(t)).call(h,(function(a){return forEach(t[a],i,Z()(o).call(o,a))}));l&&(a=Z()(a).call(a,l))}return a=flatten(a)}function normalizeArray(t){return Array.isArray(t)?t:[t]}function flatten(t){var i;return Z()(i=[]).apply(i,tt()(V()(t).call(t,(function(t){return Array.isArray(t)?flatten(t):t}))))}function cleanArray(t){return ee()(t).call(t,(function(t){return void 0!==t}))}function lib_isObject(t){return t&&"object"===k()(t)}function isFunction(t){return t&&"function"==typeof t}function isJsonPatch(t){if(isPatch(t)){var i=t.op;return"add"===i||"remove"===i||"replace"===i}return!1}function isMutation(t){return isJsonPatch(t)||isPatch(t)&&"mutation"===t.type}function isAdditiveMutation(t){return isMutation(t)&&("add"===t.op||"replace"===t.op||"merge"===t.op||"mergeDeep"===t.op)}function isPatch(t){return t&&"object"===k()(t)}function getInByJsonPath(t,i){try{return getValueByPointer(t,i)}catch(t){return console.error(t),{}}}var Lt=o(321),Ft=o.n(Lt),qt=o(193),Ut=o.n(qt);function createErrorType(t,i){function E(){Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack;for(var t=arguments.length,o=new Array(t),a=0;a<t;a++)o[a]=arguments[a];this.message=o[0],i&&i.apply(this,o)}return E.prototype=new Error,E.prototype.name=t,E.prototype.constructor=E,E}var zt=o(322),Ht=o.n(zt),Wt=["properties"],Kt=["properties"],Vt=["definitions","parameters","responses","securityDefinitions","components/schemas","components/responses","components/parameters","components/securitySchemes"],Gt=["schema/example","items/example"];function isFreelyNamed(t){var i=t[t.length-1],o=t[t.length-2],a=t.join("/");return Wt.indexOf(i)>-1&&-1===Kt.indexOf(o)||Vt.indexOf(a)>-1||Gt.some((function(t){return a.indexOf(t)>-1}))}function absolutifyPointer(t,i){var o,a=t.split("#"),u=P()(a,2),c=u[0],h=u[1],l=b.a.resolve(c||"",i||"");return h?Z()(o="".concat(l,"#")).call(o,h):l}var Jt=/^([a-z]+:\/\/|\/\/)/i,$t=createErrorType("JSONRefError",(function cb(t,i,o){this.originalError=o,p()(this,i||{})})),Zt={},Yt=new Ft.a,Xt=[function(t){return"paths"===t[0]&&"responses"===t[3]&&"examples"===t[5]},function(t){return"paths"===t[0]&&"responses"===t[3]&&"content"===t[5]&&"example"===t[7]},function(t){return"paths"===t[0]&&"responses"===t[3]&&"content"===t[5]&&"examples"===t[7]&&"value"===t[9]},function(t){return"paths"===t[0]&&"requestBody"===t[3]&&"content"===t[4]&&"example"===t[6]},function(t){return"paths"===t[0]&&"requestBody"===t[3]&&"content"===t[4]&&"examples"===t[6]&&"value"===t[8]},function(t){return"paths"===t[0]&&"parameters"===t[2]&&"example"===t[4]},function(t){return"paths"===t[0]&&"parameters"===t[3]&&"example"===t[5]},function(t){return"paths"===t[0]&&"parameters"===t[2]&&"examples"===t[4]&&"value"===t[6]},function(t){return"paths"===t[0]&&"parameters"===t[3]&&"examples"===t[5]&&"value"===t[7]},function(t){return"paths"===t[0]&&"parameters"===t[2]&&"content"===t[4]&&"example"===t[6]},function(t){return"paths"===t[0]&&"parameters"===t[2]&&"content"===t[4]&&"examples"===t[6]&&"value"===t[8]},function(t){return"paths"===t[0]&&"parameters"===t[3]&&"content"===t[4]&&"example"===t[7]},function(t){return"paths"===t[0]&&"parameters"===t[3]&&"content"===t[5]&&"examples"===t[7]&&"value"===t[9]}],Qt={key:"$ref",plugin:function plugin(t,i,o,a){var u=a.getInstance(),c=nt()(o).call(o,0,-1);if(!isFreelyNamed(c)&&!function shouldSkipResolution(t){return Xt.some((function(i){return i(t)}))}(c)){var h=a.getContext(o).baseDoc;if("string"!=typeof t)return new $t("$ref: must be a string (JSON-Ref)",{$ref:t,baseDoc:h,fullPath:o});var l,d,p,m=split(t),g=m[0],v=m[1]||"";try{l=h||g?absoluteify(g,h):null}catch(i){return wrapError(i,{pointer:v,$ref:t,basePath:l,fullPath:o})}if(function pointerAlreadyInPath(t,i,o,a){var u,c,h=Yt.get(a);h||(h={},Yt.set(a,h));var l=function arrayToJsonPointer(t){if(0===t.length)return"";return"/".concat(V()(t).call(t,escapeJsonPointerToken).join("/"))}(o),d=Z()(u="".concat(i||"<specmap-base>","#")).call(u,t),p=l.replace(/allOf\/\d+\/?/g,""),m=a.contextTree.get([]).baseDoc;if(i===m&&pointerIsAParent(p,t))return!0;var g="";if(o.some((function(t){var i;return g=Z()(i="".concat(g,"/")).call(i,escapeJsonPointerToken(t)),h[g]&&h[g].some((function(t){return pointerIsAParent(t,d)||pointerIsAParent(d,t)}))})))return!0;return void(h[p]=Z()(c=h[p]||[]).call(c,d))}(v,l,c,a)&&!u.useCircularStructures){var b=absolutifyPointer(t,l);return t===b?null:jt.replace(o,b)}if(null==l?(p=jsonPointerToArray(v),void 0===(d=a.get(p))&&(d=new $t("Could not resolve reference: ".concat(t),{pointer:v,$ref:t,baseDoc:h,fullPath:o}))):d=null!=(d=extractFromDoc(l,v)).__value?d.__value:d.catch((function(i){throw wrapError(i,{pointer:v,$ref:t,baseDoc:h,fullPath:o})})),d instanceof Error)return[jt.remove(o),d];var w=absolutifyPointer(t,l),_=jt.replace(c,d,{$$ref:w});if(l&&l!==h)return[_,jt.context(c,{baseDoc:l})];try{if(!function patchValueAlreadyInPath(t,i){var o=[t];return i.path.reduce((function(t,i){return o.push(t[i]),t[i]}),t),function pointToAncestor(t){return jt.isObject(t)&&(o.indexOf(t)>=0||J()(t).some((function(i){return pointToAncestor(t[i])})))}(i.value)}(a.state,_)||u.useCircularStructures)return _}catch(t){return null}}}},er=p()(Qt,{docCache:Zt,absoluteify:absoluteify,clearCache:function clearCache(t){void 0!==t?delete Zt[t]:J()(Zt).forEach((function(t){delete Zt[t]}))},JSONRefError:$t,wrapError:wrapError,getDoc:getDoc,split:split,extractFromDoc:extractFromDoc,fetchJSON:function fetchJSON(t){return fetch(t,{headers:{Accept:"application/json, application/yaml"},loadSpec:!0}).then((function(t){return t.text()})).then((function(t){return Xe.load(t)}))},extract:extract,jsonPointerToArray:jsonPointerToArray,unescapeJsonPointerToken:unescapeJsonPointerToken}),tr=er;function absoluteify(t,i){if(!Jt.test(t)){var o;if(!i)throw new $t(Z()(o="Tried to resolve a relative URL, without having a basePath. path: '".concat(t,"' basePath: '")).call(o,i,"'"));return b.a.resolve(i,t)}return t}function wrapError(t,i){var o,a;t&&t.response&&t.response.body?o=Z()(a="".concat(t.response.body.code," ")).call(a,t.response.body.message):o=t.message;return new $t("Could not resolve reference: ".concat(o),i,t)}function split(t){return(t+"").split("#")}function extractFromDoc(t,i){var o=Zt[t];if(o&&!jt.isPromise(o))try{var a=extract(i,o);return p()(Mt.a.resolve(a),{__value:a})}catch(t){return Mt.a.reject(t)}return getDoc(t).then((function(t){return extract(i,t)}))}function getDoc(t){var i=Zt[t];return i?jt.isPromise(i)?i:Mt.a.resolve(i):(Zt[t]=er.fetchJSON(t).then((function(i){return Zt[t]=i,i})),Zt[t])}function extract(t,i){var o=jsonPointerToArray(t);if(o.length<1)return i;var a=jt.getIn(i,o);if(void 0===a)throw new $t("Could not resolve pointer: ".concat(t," does not exist in document"),{pointer:t});return a}function jsonPointerToArray(t){var i;if("string"!=typeof t)throw new TypeError("Expected a string, got a ".concat(k()(t)));return"/"===t[0]&&(t=t.substr(1)),""===t?[]:V()(i=t.split("/")).call(i,unescapeJsonPointerToken)}function unescapeJsonPointerToken(t){return"string"!=typeof t?t:new Ut.a("=".concat(t.replace(/~1/g,"/").replace(/~0/g,"~"))).get("")}function escapeJsonPointerToken(t){var i,o=new Ut.a([["",t.replace(/~/g,"~0").replace(/\//g,"~1")]]);return nt()(i=o.toString()).call(i,1)}function pointerIsAParent(t,i){if(function pointerBoundaryChar(t){return!t||"/"===t||"#"===t}(i))return!0;var o=t.charAt(i.length),a=nt()(i).call(i,-1);return 0===t.indexOf(i)&&(!o||"/"===o||"#"===o)&&"#"!==a}var rr={key:"allOf",plugin:function plugin(t,i,o,a,u){if(!u.meta||!u.meta.$$ref){var c=nt()(o).call(o,0,-1);if(!isFreelyNamed(c)){if(!Array.isArray(t)){var h=new TypeError("allOf must be an array");return h.fullPath=o,h}var d=!1,p=u.value;if(c.forEach((function(t){p&&(p=p[t])})),p=l()({},p),0!==J()(p).length){delete p.allOf;var m,g,v=[];if(v.push(a.replace(c,{})),t.forEach((function(t,i){if(!a.isObject(t)){if(d)return null;d=!0;var u=new TypeError("Elements in allOf must be objects");return u.fullPath=o,v.push(u)}v.push(a.mergeDeep(c,t));var h=function generateAbsoluteRefPatches(t,i){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=o.specmap,u=o.getBaseUrlForNodePath,c=void 0===u?function(t){var o;return a.getContext(Z()(o=[]).call(o,tt()(i),tt()(t))).baseDoc}:u,h=o.targetKeys,l=void 0===h?["$ref","$$ref"]:h,d=[];return Ht()(t).forEach((function callback(){if(O()(l).call(l,this.key)&&"string"==typeof this.node){var t=this.path,o=Z()(i).call(i,this.path),u=absolutifyPointer(this.node,c(t));d.push(a.replace(o,u))}})),d}(t,nt()(o).call(o,0,-1),{getBaseUrlForNodePath:function getBaseUrlForNodePath(t){var u;return a.getContext(Z()(u=[]).call(u,tt()(o),[i],tt()(t))).baseDoc},specmap:a});v.push.apply(v,tt()(h))})),p.example)v.push(a.remove(Z()(m=[]).call(m,c,"example")));if(v.push(a.mergeDeep(c,p)),!p.$$ref)v.push(a.remove(Z()(g=[]).call(g,c,"$$ref")));return v}}}}},nr={key:"parameters",plugin:function plugin(t,i,o,a){if(Array.isArray(t)&&t.length){var u=p()([],t),c=nt()(o).call(o,0,-1),h=l()({},jt.getIn(a.spec,c));return t.forEach((function(t,i){try{u[i].default=a.parameterMacro(h,t)}catch(t){var c=new Error(t);return c.fullPath=o,c}})),jt.replace(o,u)}return jt.replace(o,t)}},ir={key:"properties",plugin:function plugin(t,i,o,a){var u=l()({},t);for(var c in t)try{u[c].default=a.modelPropertyMacro(u[c])}catch(t){var h=new Error(t);return h.fullPath=o,h}return jt.replace(o,u)}},sr=function(){function ContextTree(t){mt()(this,ContextTree),this.root=createNode(t||{})}return yt()(ContextTree,[{key:"set",value:function set(t,i){var o=this.getParent(t,!0);if(o){var a=t[t.length-1],u=o.children;u[a]?updateNode(u[a],i,o):u[a]=createNode(i,o)}else updateNode(this.root,i,null)}},{key:"get",value:function get(t){if((t=t||[]).length<1)return this.root.value;for(var i,o,a=this.root,u=0;u<t.length&&(o=t[u],(i=a.children)[o]);u+=1)a=i[o];return a&&a.protoValue}},{key:"getParent",value:function getParent(t,i){return!t||t.length<1?null:t.length<2?this.root:nt()(t).call(t,0,-1).reduce((function(t,o){if(!t)return t;var a=t.children;return!a[o]&&i&&(a[o]=createNode(null,t)),a[o]}),this.root)}}]),ContextTree}();function createNode(t,i){return updateNode({children:{}},t,i)}function updateNode(t,i,o){return t.value=i||{},t.protoValue=o?l()(l()({},o.protoValue),t.value):t.value,J()(t.children).forEach((function(i){var o=t.children[i];t.children[i]=updateNode(o,o.value,t)})),t}var ar=function noop(){},ur=function(){function SpecMap(t){var i,o,a=this;mt()(this,SpecMap),p()(this,{spec:"",debugLevel:"info",plugins:[],pluginHistory:{},errors:[],mutations:[],promisedPatches:[],state:{},patches:[],context:{},contextTree:new sr,showDebug:!1,allPatches:[],pluginProp:"specMap",libMethods:p()(Object.create(this),jt,{getInstance:function getInstance(){return a}}),allowMetaPatches:!1},t),this.get=this._get.bind(this),this.getContext=this._getContext.bind(this),this.hasRun=this._hasRun.bind(this),this.wrappedPlugins=ee()(i=V()(o=this.plugins).call(o,this.wrapPlugin.bind(this))).call(i,jt.isFunction),this.patches.push(jt.add([],this.spec)),this.patches.push(jt.context([],this.context)),this.updatePatches(this.patches)}return yt()(SpecMap,[{key:"debug",value:function debug(t){if(this.debugLevel===t){for(var i,o=arguments.length,a=new Array(o>1?o-1:0),u=1;u<o;u++)a[u-1]=arguments[u];(i=console).log.apply(i,a)}}},{key:"verbose",value:function verbose(t){if("verbose"===this.debugLevel){for(var i,o,a=arguments.length,u=new Array(a>1?a-1:0),c=1;c<a;c++)u[c-1]=arguments[c];(i=console).log.apply(i,Z()(o=["[".concat(t,"] ")]).call(o,u))}}},{key:"wrapPlugin",value:function wrapPlugin(t,i){var o,a=this.pathDiscriminator,u=null;return t[this.pluginProp]?(u=t,o=t[this.pluginProp]):jt.isFunction(t)?o=t:jt.isObject(t)&&(o=function createKeyBasedPlugin(t){var i=function isSubPath(t,i){return!Array.isArray(t)||t.every((function(t,o){return t===i[o]}))};return A.a.mark((function generator(o,u){var c,h,l,d,p,m;return A.a.wrap((function generator$(g){for(;;)switch(g.prev=g.next){case 0:m=function _traverse(o,l,d){var p,g,v,b,w,_,M,k,B,P,x,I,N;return A.a.wrap((function traverse$(c){for(;;)switch(c.prev=c.next){case 0:if(jt.isObject(o)){c.next=6;break}if(t.key!==l[l.length-1]){c.next=4;break}return c.next=4,t.plugin(o,t.key,l,u);case 4:c.next=30;break;case 6:p=l.length-1,g=l[p],v=l.indexOf("properties"),b="properties"===g&&p===v,w=u.allowMetaPatches&&h[o.$$ref],_=0,M=J()(o);case 12:if(!(_<M.length)){c.next=30;break}if(k=M[_],B=o[k],P=Z()(l).call(l,k),x=jt.isObject(B),I=o.$$ref,w){c.next=22;break}if(!x){c.next=22;break}return u.allowMetaPatches&&I&&(h[I]=!0),c.delegateYield(m(B,P,d),"t0",22);case 22:if(b||k!==t.key){c.next=27;break}if(N=i(a,l),a&&!N){c.next=27;break}return c.next=27,t.plugin(B,k,P,u,d);case 27:_++,c.next=12;break;case 30:case"end":return c.stop()}}),c)},c=A.a.mark(m),h={},l=_()(ee()(o).call(o,jt.isAdditiveMutation)),g.prev=4,l.s();case 6:if((d=l.n()).done){g.next=11;break}return p=d.value,g.delegateYield(m(p.value,p.path,p),"t0",9);case 9:g.next=6;break;case 11:g.next=16;break;case 13:g.prev=13,g.t1=g.catch(4),l.e(g.t1);case 16:return g.prev=16,l.f(),g.finish(16);case 19:case"end":return g.stop()}}),generator,null,[[4,13,16,19]])}))}(t)),p()(o.bind(u),{pluginName:t.name||i,isGenerator:jt.isGenerator(o)})}},{key:"nextPlugin",value:function nextPlugin(){var t,i=this;return wt()(t=this.wrappedPlugins).call(t,(function(t){return i.getMutationsForPlugin(t).length>0}))}},{key:"nextPromisedPatch",value:function nextPromisedPatch(){var t;if(this.promisedPatches.length>0)return Mt.a.race(V()(t=this.promisedPatches).call(t,(function(t){return t.value})))}},{key:"getPluginHistory",value:function getPluginHistory(t){var i=this.constructor.getPluginName(t);return this.pluginHistory[i]||[]}},{key:"getPluginRunCount",value:function getPluginRunCount(t){return this.getPluginHistory(t).length}},{key:"getPluginHistoryTip",value:function getPluginHistoryTip(t){var i=this.getPluginHistory(t);return i&&i[i.length-1]||{}}},{key:"getPluginMutationIndex",value:function getPluginMutationIndex(t){var i=this.getPluginHistoryTip(t).mutationIndex;return"number"!=typeof i?-1:i}},{key:"updatePluginHistory",value:function updatePluginHistory(t,i){var o=this.constructor.getPluginName(t);this.pluginHistory[o]=this.pluginHistory[o]||[],this.pluginHistory[o].push(i)}},{key:"updatePatches",value:function updatePatches(t){var i=this;jt.normalizeArray(t).forEach((function(t){if(t instanceof Error)i.errors.push(t);else try{if(!jt.isObject(t))return void i.debug("updatePatches","Got a non-object patch",t);if(i.showDebug&&i.allPatches.push(t),jt.isPromise(t.value))return i.promisedPatches.push(t),void i.promisedPatchThen(t);if(jt.isContextPatch(t))return void i.setContext(t.path,t.value);if(jt.isMutation(t))return void i.updateMutations(t)}catch(t){console.error(t),i.errors.push(t)}}))}},{key:"updateMutations",value:function updateMutations(t){"object"===k()(t.value)&&!Array.isArray(t.value)&&this.allowMetaPatches&&(t.value=l()({},t.value));var i=jt.applyPatch(this.state,t,{allowMetaPatches:this.allowMetaPatches});i&&(this.mutations.push(t),this.state=i)}},{key:"removePromisedPatch",value:function removePromisedPatch(t){var i,o=this.promisedPatches.indexOf(t);o<0?this.debug("Tried to remove a promisedPatch that isn't there!"):kt()(i=this.promisedPatches).call(i,o,1)}},{key:"promisedPatchThen",value:function promisedPatchThen(t){var i=this;return t.value=t.value.then((function(o){var a=l()(l()({},t),{},{value:o});i.removePromisedPatch(t),i.updatePatches(a)})).catch((function(o){i.removePromisedPatch(t),i.updatePatches(o)})),t.value}},{key:"getMutations",value:function getMutations(t,i){var o;return t=t||0,"number"!=typeof i&&(i=this.mutations.length),nt()(o=this.mutations).call(o,t,i)}},{key:"getCurrentMutations",value:function getCurrentMutations(){return this.getMutationsForPlugin(this.getCurrentPlugin())}},{key:"getMutationsForPlugin",value:function getMutationsForPlugin(t){var i=this.getPluginMutationIndex(t);return this.getMutations(i+1)}},{key:"getCurrentPlugin",value:function getCurrentPlugin(){return this.currentPlugin}},{key:"getLib",value:function getLib(){return this.libMethods}},{key:"_get",value:function _get(t){return jt.getIn(this.state,t)}},{key:"_getContext",value:function _getContext(t){return this.contextTree.get(t)}},{key:"setContext",value:function setContext(t,i){return this.contextTree.set(t,i)}},{key:"_hasRun",value:function _hasRun(t){return this.getPluginRunCount(this.getCurrentPlugin())>(t||0)}},{key:"dispatch",value:function dispatch(){var t,i=this,o=this,a=this.nextPlugin();if(!a){var u=this.nextPromisedPatch();if(u)return u.then((function(){return i.dispatch()})).catch((function(){return i.dispatch()}));var c={spec:this.state,errors:this.errors};return this.showDebug&&(c.patches=this.allPatches),Mt.a.resolve(c)}if(o.pluginCount=o.pluginCount||{},o.pluginCount[a]=(o.pluginCount[a]||0)+1,o.pluginCount[a]>100)return Mt.a.resolve({spec:o.state,errors:Z()(t=o.errors).call(t,new Error("We've reached a hard limit of ".concat(100," plugin runs")))});if(a!==this.currentPlugin&&this.promisedPatches.length){var h,l=V()(h=this.promisedPatches).call(h,(function(t){return t.value}));return Mt.a.all(V()(l).call(l,(function(t){return t.then(ar,ar)}))).then((function(){return i.dispatch()}))}return function executePlugin(){o.currentPlugin=a;var t=o.getCurrentMutations(),i=o.mutations.length-1;try{if(a.isGenerator){var u,c=_()(a(t,o.getLib()));try{for(c.s();!(u=c.n()).done;){updatePatches(u.value)}}catch(t){c.e(t)}finally{c.f()}}else{updatePatches(a(t,o.getLib()))}}catch(t){console.error(t),updatePatches([p()(Object.create(t),{plugin:a})])}finally{o.updatePluginHistory(a,{mutationIndex:i})}return o.dispatch()}();function updatePatches(t){t&&(t=jt.fullyNormalizeArray(t),o.updatePatches(t,a))}}}],[{key:"getPluginName",value:function getPluginName(t){return t.pluginName}},{key:"getPatchesOfType",value:function getPatchesOfType(t,i){return ee()(t).call(t,i)}}]),SpecMap}();var cr={refs:tr,allOf:rr,parameters:nr,properties:ir},hr=function toLower(t){return String.prototype.toLowerCase.call(t)},lr=function escapeString(t){return t.replace(/[^\w]/gi,"_")};function isOAS3(t){var i=t.openapi;return!!i&&g()(i).call(i,"3")}function opId(t,i){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},u=a.v2OperationIdCompatibilityMode;if(!t||"object"!==k()(t))return null;var c=(t.operationId||"").replace(/\s/g,"");return c.length?lr(t.operationId):idFromPathMethod(i,o,{v2OperationIdCompatibilityMode:u})}function idFromPathMethod(t,i){var o,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u=a.v2OperationIdCompatibilityMode;if(u){var c,h,l=Z()(c="".concat(i.toLowerCase(),"_")).call(c,t).replace(/[\s!@#$%^&*()_+=[{\]};:<>|./?,\\'""-]/g,"_");return(l=l||Z()(h="".concat(t.substring(1),"_")).call(h,i)).replace(/((_){2,})/g,"_").replace(/^(_)*/g,"").replace(/([_])*$/g,"")}return Z()(o="".concat(hr(i))).call(o,lr(t))}function legacyIdFromPathMethod(t,i){var o;return Z()(o="".concat(hr(i),"-")).call(o,t)}function getOperationRaw(t,i){return t&&t.paths?function findOperation(t,i){return eachOperation(t,i,!0)||null}(t,(function(t){var o=t.pathName,a=t.method,u=t.operation;if(!u||"object"!==k()(u))return!1;var c=u.operationId;return[opId(u,o,a),legacyIdFromPathMethod(o,a),c].some((function(t){return t&&t===i}))})):null}function eachOperation(t,i,o){if(!t||"object"!==k()(t)||!t.paths||"object"!==k()(t.paths))return null;var a=t.paths;for(var u in a)for(var c in a[u])if("PARAMETERS"!==c.toUpperCase()){var h=a[u][c];if(h&&"object"===k()(h)){var l={spec:t,pathName:u,method:c.toUpperCase(),operation:h},d=i(l);if(o&&d)return l}}}function normalizeSwagger(t){var i=t.spec,o=i.paths,a={};if(!o||i.$$normalized)return t;for(var u in o){var c,h=o[u];if(null!=h&&O()(c=["object","function"]).call(c,k()(h))){var l=h.parameters,d=function _loop(t){var o,c=h[t];if(null==c||!O()(o=["object","function"]).call(o,k()(c)))return"continue";var d=opId(c,u,t);if(d){a[d]?a[d].push(c):a[d]=[c];var p=a[d];if(p.length>1)p.forEach((function(t,i){var o;t.__originalOperationId=t.__originalOperationId||t.operationId,t.operationId=Z()(o="".concat(d)).call(o,i+1)}));else if(void 0!==c.operationId){var m=p[0];m.__originalOperationId=m.__originalOperationId||c.operationId,m.operationId=d}}if("parameters"!==t){var g=[],v={};for(var b in i)"produces"!==b&&"consumes"!==b&&"security"!==b||(v[b]=i[b],g.push(v));if(l&&(v.parameters=l,g.push(v)),g.length){var w,M=_()(g);try{for(M.s();!(w=M.n()).done;){var B=w.value;for(var P in B)if(c[P]){if("parameters"===P){var x,I=_()(B[P]);try{var N=function _loop2(){var t=x.value;c[P].some((function(i){return i.name&&i.name===t.name||i.$ref&&i.$ref===t.$ref||i.$$ref&&i.$$ref===t.$$ref||i===t}))||c[P].push(t)};for(I.s();!(x=I.n()).done;)N()}catch(t){I.e(t)}finally{I.f()}}}else c[P]=B[P]}}catch(t){M.e(t)}finally{M.f()}}}};for(var p in h)d(p)}}return i.$$normalized=!0,t}function makeFetchJSON(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=i.requestInterceptor,a=i.responseInterceptor,u=t.withCredentials?"include":"same-origin";return function(i){return t({url:i,loadSpec:!0,requestInterceptor:o,responseInterceptor:a,headers:{Accept:"application/json, application/yaml"},credentials:u}).then((function(t){return t.body}))}}function resolver_resolve(t){var i=t.fetch,o=t.spec,a=t.url,u=t.mode,c=t.allowMetaPatches,h=void 0===c||c,l=t.pathDiscriminator,d=t.modelPropertyMacro,p=t.parameterMacro,m=t.requestInterceptor,g=t.responseInterceptor,v=t.skipNormalization,b=t.useCircularStructures,w=t.http,_=t.baseDoc;return _=_||a,w=i||w||http_http,o?doResolve(o):makeFetchJSON(w,{requestInterceptor:m,responseInterceptor:g})(_).then(doResolve);function doResolve(t){_&&(cr.refs.docCache[_]=t),cr.refs.fetchJSON=makeFetchJSON(w,{requestInterceptor:m,responseInterceptor:g});var i=[cr.refs];return"function"==typeof p&&i.push(cr.parameters),"function"==typeof d&&i.push(cr.properties),"strict"!==u&&i.push(cr.allOf),function mapSpec(t){return new ur(t).dispatch()}({spec:t,context:{baseDoc:_},plugins:i,allowMetaPatches:h,pathDiscriminator:l,parameterMacro:p,modelPropertyMacro:d,useCircularStructures:b}).then(v?function(){var t=I()(A.a.mark((function _callee(t){return A.a.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:return i.abrupt("return",t);case 1:case"end":return i.stop()}}),_callee)})));return function(i){return t.apply(this,arguments)}}():normalizeSwagger)}}var fr=o(63),dr=o.n(fr);function _resolveSubtree(){return(_resolveSubtree=I()(A.a.mark((function _callee(t,i){var o,a,u,c,h,d,p,m,g,v,b,w,_=arguments;return A.a.wrap((function _callee$(M){for(;;)switch(M.prev=M.next){case 0:return o=_.length>2&&void 0!==_[2]?_[2]:{},a=o.returnEntireTree,u=o.baseDoc,c=o.requestInterceptor,h=o.responseInterceptor,d=o.parameterMacro,p=o.modelPropertyMacro,m=o.useCircularStructures,g={pathDiscriminator:i,baseDoc:u,requestInterceptor:c,responseInterceptor:h,parameterMacro:d,modelPropertyMacro:p,useCircularStructures:m},v=normalizeSwagger({spec:t}),b=v.spec,M.next=6,resolver_resolve(l()(l()({},g),{},{spec:b,allowMetaPatches:!0,skipNormalization:!0}));case 6:return w=M.sent,!a&&Array.isArray(i)&&i.length&&(w.spec=dr()(w.spec,i)||null),M.abrupt("return",w);case 9:case"end":return M.stop()}}),_callee)})))).apply(this,arguments)}var pr=function nullFn(){return null},mr={mapTagOperations:function mapTagOperations(t){var i=t.spec,o=t.cb,a=void 0===o?pr:o,u=t.defaultTag,c=void 0===u?"default":u,h=t.v2OperationIdCompatibilityMode,l={},d={};return eachOperation(i,(function(t){var o=t.pathName,u=t.method,p=t.operation;(p.tags?function normalizeArray(t){return Array.isArray(t)?t:[t]}(p.tags):[c]).forEach((function(t){if("string"==typeof t){d[t]=d[t]||{};var c,m=d[t],g=opId(p,o,u,{v2OperationIdCompatibilityMode:h}),v=a({spec:i,pathName:o,method:u,operation:p,operationId:g});if(l[g])l[g]+=1,m[Z()(c="".concat(g)).call(c,l[g])]=v;else if(void 0!==m[g]){var b,w,_=l[g]||1;l[g]=_+1,m[Z()(b="".concat(g)).call(b,l[g])]=v;var M=m[g];delete m[g],m[Z()(w="".concat(g)).call(w,_)]=M}else m[g]=v}}))})),d},makeExecute:function makeExecute(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(i){var o=i.pathName,a=i.method,u=i.operationId;return function(i){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},h=t.requestInterceptor,d=t.responseInterceptor,p=t.userFetch;return t.execute(l()({spec:t.spec,requestInterceptor:h,responseInterceptor:d,userFetch:p,pathName:o,method:a,parameters:i,operationId:u},c))}}}};var gr=o(323),vr=o.n(gr),yr=o(324),br=o.n(yr);function is_plain_object_isObject(t){return"[object Object]"===Object.prototype.toString.call(t)}function isPlainObject(t){var i,o;return!1!==is_plain_object_isObject(t)&&(void 0===(i=t.constructor)||!1!==is_plain_object_isObject(o=i.prototype)&&!1!==o.hasOwnProperty("isPrototypeOf"))}var wr={body:function bodyBuilder(t){var i=t.req,o=t.value;i.body=o},header:function headerBuilder(t){var i=t.req,o=t.parameter,a=t.value;i.headers=i.headers||{},void 0!==a&&(i.headers[o.name]=a)},query:function queryBuilder(t){var i=t.req,o=t.value,a=t.parameter;i.query=i.query||{},!1===o&&"boolean"===a.type&&(o="false");0===o&&["number","integer"].indexOf(a.type)>-1&&(o="0");if(o)i.query[a.name]={collectionFormat:a.collectionFormat,value:o};else if(a.allowEmptyValue&&void 0!==o){var u=a.name;i.query[u]=i.query[u]||{},i.query[u].allowEmptyValue=!0}},path:function pathBuilder(t){var i=t.req,o=t.value,a=t.parameter;i.url=i.url.split("{".concat(a.name,"}")).join(encodeURIComponent(o))},formData:function formDataBuilder(t){var i=t.req,o=t.value,a=t.parameter;(o||a.allowEmptyValue)&&(i.form=i.form||{},i.form[a.name]={value:o,allowEmptyValue:a.allowEmptyValue,collectionFormat:a.collectionFormat})}};function serialize(t,i){return O()(i).call(i,"application/json")?"string"==typeof t?t:H()(t):t.toString()}function parameter_builders_path(t){var i=t.req,o=t.value,a=t.parameter,u=a.name,c=a.style,h=a.explode,l=a.content;if(l){var d=J()(l)[0];i.url=i.url.split("{".concat(u,"}")).join(encodeDisallowedCharacters(serialize(o,d),{escape:!0}))}else{var p=stylize({key:a.name,value:o,style:c||"simple",explode:h||!1,escape:!0});i.url=i.url.split("{".concat(u,"}")).join(p)}}function parameter_builders_query(t){var i=t.req,o=t.value,a=t.parameter;if(i.query=i.query||{},a.content){var u=J()(a.content)[0];i.query[a.name]=serialize(o,u)}else if(!1===o&&(o="false"),0===o&&(o="0"),o){var c=a.style,h=a.explode,l=a.allowReserved;i.query[a.name]={value:o,serializationOption:{style:c,explode:h,allowReserved:l}}}else if(a.allowEmptyValue&&void 0!==o){var d=a.name;i.query[d]=i.query[d]||{},i.query[d].allowEmptyValue=!0}}var _r=["accept","authorization","content-type"];function parameter_builders_header(t){var i=t.req,o=t.parameter,a=t.value;if(i.headers=i.headers||{},!(_r.indexOf(o.name.toLowerCase())>-1))if(o.content){var u=J()(o.content)[0];i.headers[o.name]=serialize(a,u)}else void 0!==a&&(i.headers[o.name]=stylize({key:o.name,value:a,style:o.style||"simple",explode:void 0!==o.explode&&o.explode,escape:!1}))}function parameter_builders_cookie(t){var i=t.req,o=t.parameter,a=t.value;i.headers=i.headers||{};var u=k()(a);if(o.content){var c,h=J()(o.content)[0];i.headers.Cookie=Z()(c="".concat(o.name,"=")).call(c,serialize(a,h))}else if("undefined"!==u){var l="object"===u&&!Array.isArray(a)&&o.explode?"":"".concat(o.name,"=");i.headers.Cookie=l+stylize({key:o.name,value:a,escape:!1,style:o.style||"form",explode:void 0!==o.explode&&o.explode})}}var Mr=o(194),Sr=o.n(Mr),kr=(void 0!==Sr.a?Sr.a:"undefined"!=typeof self?self:window).btoa;function buildRequest(t,i){var o=t.operation,a=t.requestBody,u=t.securities,c=t.spec,h=t.attachContentTypeForEmptyPayload,d=t.requestContentType;i=function applySecurities(t){var i=t.request,o=t.securities,a=void 0===o?{}:o,u=t.operation,c=void 0===u?{}:u,h=t.spec,d=l()({},i),p=a.authorized,m=void 0===p?{}:p,g=c.security||h.security||[],v=m&&!!J()(m).length,b=dr()(h,["components","securitySchemes"])||{};if(d.headers=d.headers||{},d.query=d.query||{},!J()(a).length||!v||!g||Array.isArray(c.security)&&!c.security.length)return i;return g.forEach((function(t){J()(t).forEach((function(t){var i=m[t],o=b[t];if(i){var a=i.value||i,u=o.type;if(i)if("apiKey"===u)"query"===o.in&&(d.query[o.name]=a),"header"===o.in&&(d.headers[o.name]=a),"cookie"===o.in&&(d.cookies[o.name]=a);else if("http"===u){if(/^basic$/i.test(o.scheme)){var c,h=a.username||"",l=a.password||"",p=kr(Z()(c="".concat(h,":")).call(c,l));d.headers.Authorization="Basic ".concat(p)}/^bearer$/i.test(o.scheme)&&(d.headers.Authorization="Bearer ".concat(a))}else if("oauth2"===u||"openIdConnect"===u){var g,v=i.token||{},w=v[o["x-tokenName"]||"access_token"],_=v.token_type;_&&"bearer"!==_.toLowerCase()||(_="Bearer"),d.headers.Authorization=Z()(g="".concat(_," ")).call(g,w)}}}))})),d}({request:i,securities:u,operation:o,spec:c});var p=o.requestBody||{},m=J()(p.content||{}),g=d&&m.indexOf(d)>-1;if(a||h){if(d&&g)i.headers["Content-Type"]=d;else if(!d){var v=m[0];v&&(i.headers["Content-Type"]=v,d=v)}}else d&&g&&(i.headers["Content-Type"]=d);if(!t.responseContentType&&o.responses){var b,w=ee()(b=X()(o.responses)).call(b,(function(t){var i=P()(t,2),o=i[0],a=i[1],u=parseInt(o,10);return u>=200&&u<300&&isPlainObject(a.content)})).reduce((function(t,i){var o=P()(i,2)[1];return Z()(t).call(t,J()(o.content))}),[]);w.length>0&&(i.headers.accept=w.join(", "))}if(a)if(d){if(m.indexOf(d)>-1)if("application/x-www-form-urlencoded"===d||"multipart/form-data"===d)if("object"===k()(a)){var _=(p.content[d]||{}).encoding||{};i.form={},J()(a).forEach((function(t){i.form[t]={value:a[t],encoding:_[t]||{}}}))}else i.form=a;else i.body=a}else i.body=a;return i}function build_request_buildRequest(t,i){var o,a,u=t.spec,c=t.operation,h=t.securities,d=t.requestContentType,p=t.responseContentType,m=t.attachContentTypeForEmptyPayload;if((i=function build_request_applySecurities(t){var i=t.request,o=t.securities,a=void 0===o?{}:o,u=t.operation,c=void 0===u?{}:u,h=t.spec,d=l()({},i),p=a.authorized,m=void 0===p?{}:p,g=a.specSecurity,v=void 0===g?[]:g,b=c.security||v,w=m&&!!J()(m).length,_=h.securityDefinitions;if(d.headers=d.headers||{},d.query=d.query||{},!J()(a).length||!w||!b||Array.isArray(c.security)&&!c.security.length)return i;return b.forEach((function(t){J()(t).forEach((function(t){var i=m[t];if(i){var o=i.token,a=i.value||i,u=_[t],c=u.type,h=u["x-tokenName"]||"access_token",l=o&&o[h],p=o&&o.token_type;if(i)if("apiKey"===c){var g="query"===u.in?"query":"headers";d[g]=d[g]||{},d[g][u.name]=a}else if("basic"===c)if(a.header)d.headers.authorization=a.header;else{var v,b=a.username||"",w=a.password||"";a.base64=kr(Z()(v="".concat(b,":")).call(v,w)),d.headers.authorization="Basic ".concat(a.base64)}else if("oauth2"===c&&l){var M;p=p&&"bearer"!==p.toLowerCase()?p:"Bearer",d.headers.authorization=Z()(M="".concat(p," ")).call(M,l)}}}))})),d}({request:i,securities:h,operation:c,spec:u})).body||i.form||m)if(d)i.headers["Content-Type"]=d;else if(Array.isArray(c.consumes)){var g=P()(c.consumes,1);i.headers["Content-Type"]=g[0]}else if(Array.isArray(u.consumes)){var v=P()(u.consumes,1);i.headers["Content-Type"]=v[0]}else c.parameters&&ee()(o=c.parameters).call(o,(function(t){return"file"===t.type})).length?i.headers["Content-Type"]="multipart/form-data":c.parameters&&ee()(a=c.parameters).call(a,(function(t){return"formData"===t.in})).length&&(i.headers["Content-Type"]="application/x-www-form-urlencoded");else if(d){var b,w,_=c.parameters&&ee()(b=c.parameters).call(b,(function(t){return"body"===t.in})).length>0,M=c.parameters&&ee()(w=c.parameters).call(w,(function(t){return"formData"===t.in})).length>0;(_||M)&&(i.headers["Content-Type"]=d)}return!p&&Array.isArray(c.produces)&&c.produces.length>0&&(i.headers.accept=c.produces.join(", ")),i}var Er=["http","fetch","spec","operationId","pathName","method","parameters","securities"],Br=function arrayOrEmpty(t){return Array.isArray(t)?t:[]},Pr=createErrorType("OperationNotFoundError",(function cb(t,i,o){this.originalError=o,p()(this,i||{})})),xr={buildRequest:execute_buildRequest};function execute_buildRequest(t){var i,o,a=t.spec,u=t.operationId,h=t.responseContentType,d=t.scheme,p=t.requestInterceptor,m=t.responseInterceptor,g=t.contextUrl,v=t.userFetch,b=t.server,w=t.serverVariables,_=t.http,M=t.signal,k=t.parameters,B=t.parameterBuilders,P=isOAS3(a);B||(B=P?c:wr);var x={url:"",credentials:_&&_.withCredentials?"include":"same-origin",headers:{},cookies:{}};M&&(x.signal=M),p&&(x.requestInterceptor=p),m&&(x.responseInterceptor=m),v&&(x.userFetch=v);var I=getOperationRaw(a,u);if(!I)throw new Pr("Operation ".concat(u," not found"));var N=I.operation,A=void 0===N?{}:N,C=I.method,O=I.pathName;if(x.url+=execute_baseUrl({spec:a,scheme:d,contextUrl:g,server:b,serverVariables:w,pathName:O,method:C}),!u)return delete x.cookies,x;x.url+=O,x.method="".concat(C).toUpperCase(),k=k||{};var j=a.paths[O]||{};h&&(x.headers.accept=h);var L=function deduplicateParameters(t){var i={};t.forEach((function(t){i[t.in]||(i[t.in]={}),i[t.in][t.name]=t}));var o=[];return J()(i).forEach((function(t){J()(i[t]).forEach((function(a){o.push(i[t][a])}))})),o}(Z()(i=Z()(o=[]).call(o,Br(A.parameters))).call(i,Br(j.parameters)));L.forEach((function(t){var i,o,u=B[t.in];if("body"===t.in&&t.schema&&t.schema.properties&&(i=k),void 0===(i=t&&t.name&&k[t.name]))i=t&&t.name&&k[Z()(o="".concat(t.in,".")).call(o,t.name)];else if(function findParametersWithName(t,i){return ee()(i).call(i,(function(i){return i.name===t}))}(t.name,L).length>1){var c;console.warn(Z()(c="Parameter '".concat(t.name,"' is ambiguous because the defined spec has more than one parameter with the name: '")).call(c,t.name,"' and the passed-in parameter values did not define an 'in' value."))}if(null!==i){if(void 0!==t.default&&void 0===i&&(i=t.default),void 0===i&&t.required&&!t.allowEmptyValue)throw new Error("Required parameter ".concat(t.name," is not provided"));if(P&&t.schema&&"object"===t.schema.type&&"string"==typeof i)try{i=JSON.parse(i)}catch(t){throw new Error("Could not parse object parameter value string as JSON")}u&&u({req:x,parameter:t,value:i,operation:A,spec:a})}}));var q=l()(l()({},t),{},{operation:A});if((x=P?buildRequest(q,x):build_request_buildRequest(q,x)).cookies&&J()(x.cookies).length){var U=J()(x.cookies).reduce((function(t,i){var o=x.cookies[i];return t+(t?"&":"")+br.a.serialize(i,o)}),"");x.headers.Cookie=U}return x.cookies&&delete x.cookies,mergeInQueryOrForm(x),x}var Tr=function stripNonAlpha(t){return t?t.replace(/\W/g,""):null};function execute_baseUrl(t){return isOAS3(t.spec)?function oas3BaseUrl(t){var i=t.spec,o=t.pathName,a=t.method,u=t.server,c=t.contextUrl,h=t.serverVariables,l=void 0===h?{}:h,d=dr()(i,["paths",o,(a||"").toLowerCase(),"servers"])||dr()(i,["paths",o,"servers"])||dr()(i,["servers"]),p="",m=null;if(u&&d&&d.length){var g=V()(d).call(d,(function(t){return t.url}));g.indexOf(u)>-1&&(p=u,m=d[g.indexOf(u)])}if(!p&&d&&d.length){p=d[0].url;var v=P()(d,1);m=v[0]}if(p.indexOf("{")>-1){(function getVariableTemplateNames(t){var i,o=[],a=/{([^}]+)}/g;for(;i=a.exec(t);)o.push(i[1]);return o})(p).forEach((function(t){if(m.variables&&m.variables[t]){var i=m.variables[t],o=l[t]||i.default,a=new RegExp("{".concat(t,"}"),"g");p=p.replace(a,o)}}))}return function buildOas3UrlWithContext(){var t,i,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",u=o&&a?b.a.parse(b.a.resolve(a,o)):b.a.parse(o),c=b.a.parse(a),h=Tr(u.protocol)||Tr(c.protocol)||"",l=u.host||c.host,d=u.pathname||"";t=h&&l?Z()(i="".concat(h,"://")).call(i,l+d):d;return"/"===t[t.length-1]?nt()(t).call(t,0,-1):t}(p,c)}(t):function swagger2BaseUrl(t){var i,o,a=t.spec,u=t.scheme,c=t.contextUrl,h=void 0===c?"":c,l=b.a.parse(h),d=Array.isArray(a.schemes)?a.schemes[0]:null,p=u||d||Tr(l.protocol)||"http",m=a.host||l.host||"",g=a.basePath||"";i=p&&m?Z()(o="".concat(p,"://")).call(o,m+g):g;return"/"===i[i.length-1]?nt()(i).call(i,0,-1):i}(t)}function Swagger(t){var i=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof t?o.url=t:o=t,!(this instanceof Swagger))return new Swagger(o);p()(this,o);var a=this.resolve().then((function(){return i.disableInterfaces||p()(i,Swagger.makeApisTagOperation(i)),i}));return a.client=this,a}Swagger.http=http_http,Swagger.makeHttp=function makeHttp(t,i,o){return o=o||function(t){return t},i=i||function(t){return t},function(a){return"string"==typeof a&&(a={url:a}),at.mergeInQueryOrForm(a),a=i(a),o(t(a))}}.bind(null,Swagger.http),Swagger.resolve=resolver_resolve,Swagger.resolveSubtree=function resolveSubtree(t,i){return _resolveSubtree.apply(this,arguments)},Swagger.execute=function execute_execute(t){var i=t.http,o=t.fetch,a=t.spec,u=t.operationId,c=t.pathName,h=t.method,d=t.parameters,p=t.securities,m=vr()(t,Er),g=i||o||http_http;c&&h&&!u&&(u=legacyIdFromPathMethod(c,h));var v=xr.buildRequest(l()({spec:a,operationId:u,parameters:d,securities:p,http:g},m));return v.body&&(isPlainObject(v.body)||Array.isArray(v.body))&&(v.body=H()(v.body)),g(v)},Swagger.serializeRes=serializeRes,Swagger.serializeHeaders=serializeHeaders,Swagger.clearCache=function resolver_clearCache(){cr.refs.clearCache()},Swagger.makeApisTagOperation=function makeApisTagOperation(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=mr.makeExecute(t);return{apis:mr.mapTagOperations({v2OperationIdCompatibilityMode:t.v2OperationIdCompatibilityMode,spec:t.spec,cb:i})}},Swagger.buildRequest=execute_buildRequest,Swagger.helpers={opId:opId},Swagger.getBaseUrl=execute_baseUrl,Swagger.prototype={http:http_http,execute:function execute(t){return this.applyDefaults(),Swagger.execute(l()({spec:this.spec,http:this.http,securities:{authorized:this.authorizations},contextUrl:"string"==typeof this.url?this.url:void 0,requestInterceptor:this.requestInterceptor||null,responseInterceptor:this.responseInterceptor||null},t))},resolve:function resolve(){var t=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Swagger.resolve(l()({spec:this.spec,url:this.url,http:this.http||this.fetch,allowMetaPatches:this.allowMetaPatches,useCircularStructures:this.useCircularStructures,requestInterceptor:this.requestInterceptor||null,responseInterceptor:this.responseInterceptor||null,skipNormalization:this.skipNormalization||!1},i)).then((function(i){return t.originalSpec=t.spec,t.spec=i.spec,t.errors=i.errors,t}))}},Swagger.prototype.applyDefaults=function applyDefaults(){var t=this.spec,i=this.url;if(i&&g()(i).call(i,"http")){var o=b.a.parse(i);t.host||(t.host=o.host),t.schemes||(t.schemes=[o.protocol.replace(":","")]),t.basePath||(t.basePath="/")}};Swagger.helpers,i.a=Swagger},function(t,i,o){t.exports=o(330)},function(t,i,o){var a=o(333);t.exports=a},function(t,i,o){var a=o(75);t.exports=a&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(t,i,o){var a=o(18),u=o(8),c=o(140);t.exports=!a&&!u((function(){return 7!=Object.defineProperty(c("div"),"a",{get:function(){return 7}}).a}))},function(t,i,o){var a=o(8),u=o(14),c=/#|\.prototype\./,isForced=function(t,i){var o=l[h(t)];return o==p||o!=d&&(u(i)?a(i):!!i)},h=isForced.normalize=function(t){return String(t).replace(c,".").toLowerCase()},l=isForced.data={},d=isForced.NATIVE="N",p=isForced.POLYFILL="P";t.exports=isForced},function(t,i,o){var a=o(18),u=o(8);t.exports=a&&u((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},function(t,i,o){var a=o(9),u=o(21),c=o(38),h=o(141).indexOf,l=o(92),d=a([].push);t.exports=function(t,i){var o,a=c(t),p=0,m=[];for(o in a)!u(l,o)&&u(a,o)&&d(m,o);for(;i.length>p;)u(a,o=i[p++])&&(~h(m,o)||d(m,o));return m}},function(t,i,o){var a=o(112),u=Math.min;t.exports=function(t){return t>0?u(a(t),9007199254740991):0}},function(t,i,o){t.exports=o(339)},function(t,i,o){o(344),o(347),o(348),o(212),o(349)},function(t,i,o){var a=o(27);t.exports=a("document","documentElement")},function(t,i,o){var a=o(65),u=o(38),c=o(114).f,h=o(208),l="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function getOwnPropertyNames(t){return l&&"Window"==a(t)?function(t){try{return c(t)}catch(t){return h(l)}}(t):c(u(t))}},function(t,i,o){var a=o(111),u=o(54),c=o(78),h=Array,l=Math.max;t.exports=function(t,i,o){for(var d=u(t),p=a(i,d),m=a(void 0===o?d:o,d),g=h(l(m-p,0)),v=0;p<m;p++,v++)c(g,v,t[p]);return g.length=v,g}},function(t,i,o){var a=o(19),u=o(27),c=o(13),h=o(46);t.exports=function(){var t=u("Symbol"),i=t&&t.prototype,o=i&&i.valueOf,l=c("toPrimitive");i&&!i[l]&&h(i,l,(function(t){return a(o,this)}),{arity:1})}},function(t,i,o){var a=o(12),u=o(14),c=o(146),h=a.WeakMap;t.exports=u(h)&&/native code/.test(c(h))},function(t,i,o){var a=o(75);t.exports=a&&!!Symbol.for&&!!Symbol.keyFor},function(t,i,o){var a=o(2),u=o(27),c=o(103),h=o(19),l=o(9),d=o(8),p=o(79),m=o(14),g=o(20),v=o(107),b=o(148),w=o(75),_=u("JSON","stringify"),M=l(/./.exec),k=l("".charAt),B=l("".charCodeAt),P=l("".replace),x=l(1..toString),I=/[\uD800-\uDFFF]/g,N=/^[\uD800-\uDBFF]$/,A=/^[\uDC00-\uDFFF]$/,C=!w||d((function(){var t=u("Symbol")();return"[null]"!=_([t])||"{}"!=_({a:t})||"{}"!=_(Object(t))})),O=d((function(){return'"\\udf06\\ud834"'!==_("\udf06\ud834")||'"\\udead"'!==_("\udead")})),stringifyWithSymbolsFix=function(t,i){var o=b(arguments),a=i;if((g(i)||void 0!==t)&&!v(t))return p(i)||(i=function(t,i){if(m(a)&&(i=h(a,this,t,i)),!v(i))return i}),o[1]=i,c(_,null,o)},fixIllFormed=function(t,i,o){var a=k(o,i-1),u=k(o,i+1);return M(N,t)&&!M(A,u)||M(A,t)&&!M(N,a)?"\\u"+x(B(t,0),16):t};_&&a({target:"JSON",stat:!0,arity:3,forced:C||O},{stringify:function stringify(t,i,o){var a=b(arguments),u=c(C?stringifyWithSymbolsFix:_,null,a);return O&&"string"==typeof u?P(u,I,fixIllFormed):u}})},function(t,i,o){var a=o(354);t.exports=a},function(t,i,o){t.exports=o(364)},function(t,i,o){"use strict";var a=o(2),u=o(19),c=o(33),h=o(368),l=o(14),d=o(216),p=o(117),m=o(118),g=o(57),v=o(45),b=o(46),w=o(13),_=o(80),M=o(217),k=h.PROPER,B=h.CONFIGURABLE,P=M.IteratorPrototype,x=M.BUGGY_SAFARI_ITERATORS,I=w("iterator"),returnThis=function(){return this};t.exports=function(t,i,o,h,w,M,N){d(o,i,h);var A,C,O,getIterationMethod=function(t){if(t===w&&z)return z;if(!x&&t in q)return q[t];switch(t){case"keys":return function keys(){return new o(this,t)};case"values":return function values(){return new o(this,t)};case"entries":return function entries(){return new o(this,t)}}return function(){return new o(this)}},j=i+" Iterator",L=!1,q=t.prototype,U=q[I]||q["@@iterator"]||w&&q[w],z=!x&&U||getIterationMethod(w),H="Array"==i&&q.entries||U;if(H&&(A=p(H.call(new t)))!==Object.prototype&&A.next&&(c||p(A)===P||(m?m(A,P):l(A[I])||b(A,I,returnThis)),g(A,j,!0,!0),c&&(_[j]=returnThis)),k&&"values"==w&&U&&"values"!==U.name&&(!c&&B?v(q,"name","values"):(L=!0,z=function values(){return u(U,this)})),w)if(C={values:getIterationMethod("values"),keys:M?z:getIterationMethod("keys"),entries:getIterationMethod("entries")},N)for(O in C)(x||L||!(O in q))&&b(q,O,C[O]);else a({target:i,proto:!0,forced:x||L},C);return c&&!N||q[I]===z||b(q,I,z,{name:w}),_[i]=z,C}},function(t,i,o){"use strict";var a=o(217).IteratorPrototype,u=o(77),c=o(53),h=o(57),l=o(80),returnThis=function(){return this};t.exports=function(t,i,o,d){var p=i+" Iterator";return t.prototype=u(a,{next:c(+!d,o)}),h(t,p,!1,!0),l[p]=returnThis,t}},function(t,i,o){"use strict";var a,u,c,h=o(8),l=o(14),d=o(77),p=o(117),m=o(46),g=o(13),v=o(33),b=g("iterator"),w=!1;[].keys&&("next"in(c=[].keys())?(u=p(p(c)))!==Object.prototype&&(a=u):w=!0),null==a||h((function(){var t={};return a[b].call(t)!==t}))?a={}:v&&(a=d(a)),l(a[b])||m(a,b,(function(){return this})),t.exports={IteratorPrototype:a,BUGGY_SAFARI_ITERATORS:w}},function(t,i,o){var a=o(8);t.exports=!a((function(){function F(){}return F.prototype.constructor=null,Object.getPrototypeOf(new F)!==F.prototype}))},function(t,i,o){"use strict";var a=o(8);t.exports=function(t,i){var o=[][t];return!!o&&a((function(){o.call(null,i||function(){return 1},1)}))}},function(t,i,o){var a=o(27),u=o(9),c=o(114),h=o(115),l=o(28),d=u([].concat);t.exports=a("Reflect","ownKeys")||function ownKeys(t){var i=c.f(l(t)),o=h.f;return o?d(i,o(t)):i}},function(t,i,o){var a=o(404),u=TypeError;t.exports=function(t){if(a(t))throw u("The method doesn't accept regular expressions");return t}},function(t,i,o){var a=o(13)("match");t.exports=function(t){var i=/./;try{"/./"[t](i)}catch(o){try{return i[a]=!1,"/./"[t](i)}catch(t){}}return!1}},function(t,i,o){"use strict";var a=o(2),u=o(8),c=o(79),h=o(20),l=o(40),d=o(54),p=o(224),m=o(78),g=o(147),v=o(93),b=o(13),w=o(108),_=b("isConcatSpreadable"),M=w>=51||!u((function(){var t=[];return t[_]=!1,t.concat()[0]!==t})),k=v("concat"),isConcatSpreadable=function(t){if(!h(t))return!1;var i=t[_];return void 0!==i?!!i:c(t)};a({target:"Array",proto:!0,arity:1,forced:!M||!k},{concat:function concat(t){var i,o,a,u,c,h=l(this),v=g(h,0),b=0;for(i=-1,a=arguments.length;i<a;i++)if(isConcatSpreadable(c=-1===i?h:arguments[i]))for(u=d(c),p(b+u),o=0;o<u;o++,b++)o in c&&m(v,b,c[o]);else p(b+1),m(v,b++,c);return v.length=b,v}})},function(t,i){var o=TypeError;t.exports=function(t){if(t>9007199254740991)throw o("Maximum allowed index exceeded");return t}},function(t,i,o){o(16)("iterator")},function(t,i,o){t.exports=o(451)},function(t,i,o){var a=o(454);t.exports=a},function(t,i,o){t.exports=o(457)},function(t,i,o){var a=o(460);t.exports=a},function(t,i,o){var a=o(19),u=o(28),c=o(138);t.exports=function(t,i,o){var h,l;u(t);try{if(!(h=c(t,"return"))){if("throw"===i)throw o;return o}h=a(h,t)}catch(t){l=!0,h=t}if("throw"===i)throw o;if(l)throw h;return u(h),o}},function(t,i,o){var a=o(13),u=o(80),c=a("iterator"),h=Array.prototype;t.exports=function(t){return void 0!==t&&(u.Array===t||h[c]===t)}},function(t,i,o){var a=o(13)("iterator"),u=!1;try{var c=0,h={next:function(){return{done:!!c++}},return:function(){u=!0}};h[a]=function(){return this},Array.from(h,(function(){throw 2}))}catch(t){}t.exports=function(t,i){if(!i&&!u)return!1;var o=!1;try{var c={};c[a]=function(){return{next:function(){return{done:o=!0}}}},t(c)}catch(t){}return o}},function(t,i){t.exports=function _arrayLikeToArray(t,i){(null==i||i>t.length)&&(i=t.length);for(var o=0,a=new Array(i);o<i;o++)a[o]=t[o];return a},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i,o){t.exports=o(473)},function(t,i,o){var a=o(476);o(59),t.exports=a},function(t,i,o){o(477)},function(t,i,o){var a=o(28),u=o(486),c=o(13)("species");t.exports=function(t,i){var o,h=a(t).constructor;return void 0===h||null==(o=a(h)[c])?i:u(o)}},function(t,i,o){var a,u,c,h,l=o(12),d=o(103),p=o(66),m=o(14),g=o(21),v=o(8),b=o(206),w=o(148),_=o(140),M=o(239),k=o(240),B=o(121),P=l.setImmediate,x=l.clearImmediate,I=l.process,N=l.Dispatch,A=l.Function,C=l.MessageChannel,O=l.String,j=0,L={};try{a=l.location}catch(t){}var run=function(t){if(g(L,t)){var i=L[t];delete L[t],i()}},runner=function(t){return function(){run(t)}},listener=function(t){run(t.data)},post=function(t){l.postMessage(O(t),a.protocol+"//"+a.host)};P&&x||(P=function setImmediate(t){M(arguments.length,1);var i=m(t)?t:A(t),o=w(arguments,1);return L[++j]=function(){d(i,void 0,o)},u(j),j},x=function clearImmediate(t){delete L[t]},B?u=function(t){I.nextTick(runner(t))}:N&&N.now?u=function(t){N.now(runner(t))}:C&&!k?(h=(c=new C).port2,c.port1.onmessage=listener,u=p(h.postMessage,h)):l.addEventListener&&m(l.postMessage)&&!l.importScripts&&a&&"file:"!==a.protocol&&!v(post)?(u=post,l.addEventListener("message",listener,!1)):u="onreadystatechange"in _("script")?function(t){b.appendChild(_("script")).onreadystatechange=function(){b.removeChild(this),run(t)}}:function(t){setTimeout(runner(t),0)}),t.exports={set:P,clear:x}},function(t,i){var o=TypeError;t.exports=function(t,i){if(t<i)throw o("Not enough arguments");return t}},function(t,i,o){var a=o(109);t.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(a)},function(t,i){t.exports="object"==typeof Deno&&Deno&&"object"==typeof Deno.version},function(t,i,o){var a=o(82),u=o(232),c=o(97).CONSTRUCTOR;t.exports=c||!u((function(t){a.all(t).then(void 0,(function(){}))}))},function(t,i,o){var a=o(28),u=o(20),c=o(61);t.exports=function(t,i){if(a(t),u(i)&&i.constructor===t)return i;var o=c.f(t);return(0,o.resolve)(i),o.promise}},function(t,i,o){"use strict";var a=o(2),u=o(19),c=o(44),h=o(61),l=o(81),d=o(69);a({target:"Promise",stat:!0},{allSettled:function allSettled(t){var i=this,o=h.f(i),a=o.resolve,p=o.reject,m=l((function(){var o=c(i.resolve),h=[],l=0,p=1;d(t,(function(t){var c=l++,d=!1;p++,u(o,i,t).then((function(t){d||(d=!0,h[c]={status:"fulfilled",value:t},--p||a(h))}),(function(t){d||(d=!0,h[c]={status:"rejected",reason:t},--p||a(h))}))})),--p||a(h)}));return m.error&&p(m.value),o.promise}})},function(t,i,o){"use strict";var a=o(2),u=o(19),c=o(44),h=o(27),l=o(61),d=o(81),p=o(69);a({target:"Promise",stat:!0},{any:function any(t){var i=this,o=h("AggregateError"),a=l.f(i),m=a.resolve,g=a.reject,v=d((function(){var a=c(i.resolve),h=[],l=0,d=1,v=!1;p(t,(function(t){var c=l++,p=!1;d++,u(a,i,t).then((function(t){p||v||(v=!0,m(t))}),(function(t){p||v||(p=!0,h[c]=t,--d||g(new o(h,"No one promise resolved")))}))})),--d||g(new o(h,"No one promise resolved"))}));return v.error&&g(v.value),a.promise}})},function(t,i){!function(t){!function(i){var o="URLSearchParams"in t,a="Symbol"in t&&"iterator"in Symbol,u="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),c="FormData"in t,h="ArrayBuffer"in t;if(h)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(t){return t&&l.indexOf(Object.prototype.toString.call(t))>-1};function normalizeName(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function normalizeValue(t){return"string"!=typeof t&&(t=String(t)),t}function iteratorFor(t){var i={next:function(){var i=t.shift();return{done:void 0===i,value:i}}};return a&&(i[Symbol.iterator]=function(){return i}),i}function Headers(t){this.map={},t instanceof Headers?t.forEach((function(t,i){this.append(i,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(i){this.append(i,t[i])}),this)}function consumed(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function fileReaderReady(t){return new Promise((function(i,o){t.onload=function(){i(t.result)},t.onerror=function(){o(t.error)}}))}function readBlobAsArrayBuffer(t){var i=new FileReader,o=fileReaderReady(i);return i.readAsArrayBuffer(t),o}function bufferClone(t){if(t.slice)return t.slice(0);var i=new Uint8Array(t.byteLength);return i.set(new Uint8Array(t)),i.buffer}function Body(){return this.bodyUsed=!1,this._initBody=function(t){this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:u&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:c&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:o&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():h&&u&&function isDataView(t){return t&&DataView.prototype.isPrototypeOf(t)}(t)?(this._bodyArrayBuffer=bufferClone(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):h&&(ArrayBuffer.prototype.isPrototypeOf(t)||d(t))?this._bodyArrayBuffer=bufferClone(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):o&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},u&&(this.blob=function(){var t=consumed(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?consumed(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(readBlobAsArrayBuffer)}),this.text=function(){var t=consumed(this);if(t)return t;if(this._bodyBlob)return function readBlobAsText(t){var i=new FileReader,o=fileReaderReady(i);return i.readAsText(t),o}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function readArrayBufferAsText(t){for(var i=new Uint8Array(t),o=new Array(i.length),a=0;a<i.length;a++)o[a]=String.fromCharCode(i[a]);return o.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c&&(this.formData=function(){return this.text().then(decode)}),this.json=function(){return this.text().then(JSON.parse)},this}Headers.prototype.append=function(t,i){t=normalizeName(t),i=normalizeValue(i);var o=this.map[t];this.map[t]=o?o+", "+i:i},Headers.prototype.delete=function(t){delete this.map[normalizeName(t)]},Headers.prototype.get=function(t){return t=normalizeName(t),this.has(t)?this.map[t]:null},Headers.prototype.has=function(t){return this.map.hasOwnProperty(normalizeName(t))},Headers.prototype.set=function(t,i){this.map[normalizeName(t)]=normalizeValue(i)},Headers.prototype.forEach=function(t,i){for(var o in this.map)this.map.hasOwnProperty(o)&&t.call(i,this.map[o],o,this)},Headers.prototype.keys=function(){var t=[];return this.forEach((function(i,o){t.push(o)})),iteratorFor(t)},Headers.prototype.values=function(){var t=[];return this.forEach((function(i){t.push(i)})),iteratorFor(t)},Headers.prototype.entries=function(){var t=[];return this.forEach((function(i,o){t.push([o,i])})),iteratorFor(t)},a&&(Headers.prototype[Symbol.iterator]=Headers.prototype.entries);var p=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function Request(t,i){var o=(i=i||{}).body;if(t instanceof Request){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,i.headers||(this.headers=new Headers(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,o||null==t._bodyInit||(o=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=i.credentials||this.credentials||"same-origin",!i.headers&&this.headers||(this.headers=new Headers(i.headers)),this.method=function normalizeMethod(t){var i=t.toUpperCase();return p.indexOf(i)>-1?i:t}(i.method||this.method||"GET"),this.mode=i.mode||this.mode||null,this.signal=i.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function decode(t){var i=new FormData;return t.trim().split("&").forEach((function(t){if(t){var o=t.split("="),a=o.shift().replace(/\+/g," "),u=o.join("=").replace(/\+/g," ");i.append(decodeURIComponent(a),decodeURIComponent(u))}})),i}function Response(t,i){i||(i={}),this.type="default",this.status=void 0===i.status?200:i.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in i?i.statusText:"OK",this.headers=new Headers(i.headers),this.url=i.url||"",this._initBody(t)}Request.prototype.clone=function(){return new Request(this,{body:this._bodyInit})},Body.call(Request.prototype),Body.call(Response.prototype),Response.prototype.clone=function(){return new Response(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new Headers(this.headers),url:this.url})},Response.error=function(){var t=new Response(null,{status:0,statusText:""});return t.type="error",t};var m=[301,302,303,307,308];Response.redirect=function(t,i){if(-1===m.indexOf(i))throw new RangeError("Invalid status code");return new Response(null,{status:i,headers:{location:t}})},i.DOMException=t.DOMException;try{new i.DOMException}catch(t){i.DOMException=function(t,i){this.message=t,this.name=i;var o=Error(t);this.stack=o.stack},i.DOMException.prototype=Object.create(Error.prototype),i.DOMException.prototype.constructor=i.DOMException}function fetch(t,o){return new Promise((function(a,c){var h=new Request(t,o);if(h.signal&&h.signal.aborted)return c(new i.DOMException("Aborted","AbortError"));var l=new XMLHttpRequest;function abortXhr(){l.abort()}l.onload=function(){var t,i,o={status:l.status,statusText:l.statusText,headers:(t=l.getAllResponseHeaders()||"",i=new Headers,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var o=t.split(":"),a=o.shift().trim();if(a){var u=o.join(":").trim();i.append(a,u)}})),i)};o.url="responseURL"in l?l.responseURL:o.headers.get("X-Request-URL");var u="response"in l?l.response:l.responseText;a(new Response(u,o))},l.onerror=function(){c(new TypeError("Network request failed"))},l.ontimeout=function(){c(new TypeError("Network request failed"))},l.onabort=function(){c(new i.DOMException("Aborted","AbortError"))},l.open(h.method,h.url,!0),"include"===h.credentials?l.withCredentials=!0:"omit"===h.credentials&&(l.withCredentials=!1),"responseType"in l&&u&&(l.responseType="blob"),h.headers.forEach((function(t,i){l.setRequestHeader(i,t)})),h.signal&&(h.signal.addEventListener("abort",abortXhr),l.onreadystatechange=function(){4===l.readyState&&h.signal.removeEventListener("abort",abortXhr)}),l.send(void 0===h._bodyInit?null:h._bodyInit)}))}fetch.polyfill=!0,t.fetch||(t.fetch=fetch,t.Headers=Headers,t.Request=Request,t.Response=Response),i.Headers=Headers,i.Request=Request,i.Response=Response,i.fetch=fetch,Object.defineProperty(i,"__esModule",{value:!0})}({})}("undefined"!=typeof self?self:this)},function(t,i,o){"use strict";var a=o(156),u=Object.prototype.hasOwnProperty,c=Array.isArray,h=function(){for(var t=[],i=0;i<256;++i)t.push("%"+((i<16?"0":"")+i.toString(16)).toUpperCase());return t}(),l=function arrayToObject(t,i){for(var o=i&&i.plainObjects?Object.create(null):{},a=0;a<t.length;++a)void 0!==t[a]&&(o[a]=t[a]);return o};t.exports={arrayToObject:l,assign:function assignSingleSource(t,i){return Object.keys(i).reduce((function(t,o){return t[o]=i[o],t}),t)},combine:function combine(t,i){return[].concat(t,i)},compact:function compact(t){for(var i=[{obj:{o:t},prop:"o"}],o=[],a=0;a<i.length;++a)for(var u=i[a],h=u.obj[u.prop],l=Object.keys(h),d=0;d<l.length;++d){var p=l[d],m=h[p];"object"==typeof m&&null!==m&&-1===o.indexOf(m)&&(i.push({obj:h,prop:p}),o.push(m))}return function compactQueue(t){for(;t.length>1;){var i=t.pop(),o=i.obj[i.prop];if(c(o)){for(var a=[],u=0;u<o.length;++u)void 0!==o[u]&&a.push(o[u]);i.obj[i.prop]=a}}}(i),t},decode:function(t,i,o){var a=t.replace(/\+/g," ");if("iso-8859-1"===o)return a.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(a)}catch(t){return a}},encode:function encode(t,i,o,u,c){if(0===t.length)return t;var l=t;if("symbol"==typeof t?l=Symbol.prototype.toString.call(t):"string"!=typeof t&&(l=String(t)),"iso-8859-1"===o)return escape(l).replace(/%u[0-9a-f]{4}/gi,(function(t){return"%26%23"+parseInt(t.slice(2),16)+"%3B"}));for(var d="",p=0;p<l.length;++p){var m=l.charCodeAt(p);45===m||46===m||95===m||126===m||m>=48&&m<=57||m>=65&&m<=90||m>=97&&m<=122||c===a.RFC1738&&(40===m||41===m)?d+=l.charAt(p):m<128?d+=h[m]:m<2048?d+=h[192|m>>6]+h[128|63&m]:m<55296||m>=57344?d+=h[224|m>>12]+h[128|m>>6&63]+h[128|63&m]:(p+=1,m=65536+((1023&m)<<10|1023&l.charCodeAt(p)),d+=h[240|m>>18]+h[128|m>>12&63]+h[128|m>>6&63]+h[128|63&m])}return d},isBuffer:function isBuffer(t){return!(!t||"object"!=typeof t)&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isRegExp:function isRegExp(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function maybeMap(t,i){if(c(t)){for(var o=[],a=0;a<t.length;a+=1)o.push(i(t[a]));return o}return i(t)},merge:function merge(t,i,o){if(!i)return t;if("object"!=typeof i){if(c(t))t.push(i);else{if(!t||"object"!=typeof t)return[t,i];(o&&(o.plainObjects||o.allowPrototypes)||!u.call(Object.prototype,i))&&(t[i]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(i);var a=t;return c(t)&&!c(i)&&(a=l(t,o)),c(t)&&c(i)?(i.forEach((function(i,a){if(u.call(t,a)){var c=t[a];c&&"object"==typeof c&&i&&"object"==typeof i?t[a]=merge(c,i,o):t.push(i)}else t[a]=i})),t):Object.keys(i).reduce((function(t,a){var c=i[a];return u.call(t,a)?t[a]=merge(t[a],c,o):t[a]=c,t}),a)}}},function(t,i,o){var a=o(8),u=o(20),c=o(65),h=o(582),l=Object.isExtensible,d=a((function(){l(1)}));t.exports=d||h?function isExtensible(t){return!!u(t)&&((!h||"ArrayBuffer"!=c(t))&&(!l||l(t)))}:l},function(t,i,o){var a=o(161),u=o(596),c=o(597),h=a?a.toStringTag:void 0;t.exports=function baseGetTag(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":h&&h in Object(t)?u(t):c(t)}},function(t,i,o){var a=o(606),u=o(611);t.exports=function getNative(t,i){var o=u(t,i);return a(o)?o:void 0}},function(t,i){t.exports=function isObject(t){var i=typeof t;return null!=t&&("object"==i||"function"==i)}},function(t,i,o){t.exports=o(633)},function(t,i,o){o(2)({global:!0},{globalThis:o(12)})},function(t,i,o){"use strict";var a=o(165),u=o(47).Readable,c={objectMode:!0},h={clean:!0};function Store(t){if(!(this instanceof Store))return new Store(t);this.options=t||{},this.options=a(h,t),this._inflights=new Map}Store.prototype.put=function(t,i){return this._inflights.set(t.messageId,t),i&&i(),this},Store.prototype.createStream=function(){var t=new u(c),i=!1,o=[],a=0;return this._inflights.forEach((function(t,i){o.push(t)})),t._read=function(){!i&&a<o.length?this.push(o[a++]):this.push(null)},t.destroy=function(){if(!i){var t=this;i=!0,setTimeout((function(){t.emit("close")}),0)}},t},Store.prototype.del=function(t,i){return(t=this._inflights.get(t.messageId))?(this._inflights.delete(t.messageId),i(null,t)):i&&i(new Error("missing packet")),this},Store.prototype.get=function(t,i){return(t=this._inflights.get(t.messageId))?i(null,t):i&&i(new Error("missing packet")),this},Store.prototype.close=function(t){this.options.clean&&(this._inflights=null),t&&t()},t.exports=Store},function(t,i,o){"use strict";(function(i,a){var u;t.exports=Readable,Readable.ReadableState=ReadableState;o(31).EventEmitter;var c=function EElistenerCount(t,i){return t.listeners(i).length},h=o(256),l=o(10).Buffer,d=i.Uint8Array||function(){};var p,m=o(651);p=m&&m.debuglog?m.debuglog("stream"):function debug(){};var g,v,b,w=o(652),_=o(257),M=o(258).getHighWaterMark,k=o(83).codes,B=k.ERR_INVALID_ARG_TYPE,P=k.ERR_STREAM_PUSH_AFTER_EOF,x=k.ERR_METHOD_NOT_IMPLEMENTED,I=k.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;o(1)(Readable,h);var N=_.errorOrDestroy,A=["error","close","destroy","pause","resume"];function ReadableState(t,i,a){u=u||o(84),t=t||{},"boolean"!=typeof a&&(a=i instanceof u),this.objectMode=!!t.objectMode,a&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=M(this,t,"readableHighWaterMark",a),this.buffer=new w,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(g||(g=o(70).StringDecoder),this.decoder=new g(t.encoding),this.encoding=t.encoding)}function Readable(t){if(u=u||o(84),!(this instanceof Readable))return new Readable(t);var i=this instanceof u;this._readableState=new ReadableState(t,this,i),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),h.call(this)}function readableAddChunk(t,i,o,a,u){p("readableAddChunk",i);var c,h=t._readableState;if(null===i)h.reading=!1,function onEofChunk(t,i){if(p("onEofChunk"),i.ended)return;if(i.decoder){var o=i.decoder.end();o&&o.length&&(i.buffer.push(o),i.length+=i.objectMode?1:o.length)}i.ended=!0,i.sync?emitReadable(t):(i.needReadable=!1,i.emittedReadable||(i.emittedReadable=!0,emitReadable_(t)))}(t,h);else if(u||(c=function chunkInvalid(t,i){var o;(function _isUint8Array(t){return l.isBuffer(t)||t instanceof d})(i)||"string"==typeof i||void 0===i||t.objectMode||(o=new B("chunk",["string","Buffer","Uint8Array"],i));return o}(h,i)),c)N(t,c);else if(h.objectMode||i&&i.length>0)if("string"==typeof i||h.objectMode||Object.getPrototypeOf(i)===l.prototype||(i=function _uint8ArrayToBuffer(t){return l.from(t)}(i)),a)h.endEmitted?N(t,new I):addChunk(t,h,i,!0);else if(h.ended)N(t,new P);else{if(h.destroyed)return!1;h.reading=!1,h.decoder&&!o?(i=h.decoder.write(i),h.objectMode||0!==i.length?addChunk(t,h,i,!1):maybeReadMore(t,h)):addChunk(t,h,i,!1)}else a||(h.reading=!1,maybeReadMore(t,h));return!h.ended&&(h.length<h.highWaterMark||0===h.length)}function addChunk(t,i,o,a){i.flowing&&0===i.length&&!i.sync?(i.awaitDrain=0,t.emit("data",o)):(i.length+=i.objectMode?1:o.length,a?i.buffer.unshift(o):i.buffer.push(o),i.needReadable&&emitReadable(t)),maybeReadMore(t,i)}Object.defineProperty(Readable.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._readableState&&this._readableState.destroyed},set:function set(t){this._readableState&&(this._readableState.destroyed=t)}}),Readable.prototype.destroy=_.destroy,Readable.prototype._undestroy=_.undestroy,Readable.prototype._destroy=function(t,i){i(t)},Readable.prototype.push=function(t,i){var o,a=this._readableState;return a.objectMode?o=!0:"string"==typeof t&&((i=i||a.defaultEncoding)!==a.encoding&&(t=l.from(t,i),i=""),o=!0),readableAddChunk(this,t,i,!1,o)},Readable.prototype.unshift=function(t){return readableAddChunk(this,t,null,!0,!1)},Readable.prototype.isPaused=function(){return!1===this._readableState.flowing},Readable.prototype.setEncoding=function(t){g||(g=o(70).StringDecoder);var i=new g(t);this._readableState.decoder=i,this._readableState.encoding=this._readableState.decoder.encoding;for(var a=this._readableState.buffer.head,u="";null!==a;)u+=i.write(a.data),a=a.next;return this._readableState.buffer.clear(),""!==u&&this._readableState.buffer.push(u),this._readableState.length=u.length,this};function howMuchToRead(t,i){return t<=0||0===i.length&&i.ended?0:i.objectMode?1:t!=t?i.flowing&&i.length?i.buffer.head.data.length:i.length:(t>i.highWaterMark&&(i.highWaterMark=function computeNewHighWaterMark(t){return t>=1073741824?t=1073741824:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=i.length?t:i.ended?i.length:(i.needReadable=!0,0))}function emitReadable(t){var i=t._readableState;p("emitReadable",i.needReadable,i.emittedReadable),i.needReadable=!1,i.emittedReadable||(p("emitReadable",i.flowing),i.emittedReadable=!0,a.nextTick(emitReadable_,t))}function emitReadable_(t){var i=t._readableState;p("emitReadable_",i.destroyed,i.length,i.ended),i.destroyed||!i.length&&!i.ended||(t.emit("readable"),i.emittedReadable=!1),i.needReadable=!i.flowing&&!i.ended&&i.length<=i.highWaterMark,flow(t)}function maybeReadMore(t,i){i.readingMore||(i.readingMore=!0,a.nextTick(maybeReadMore_,t,i))}function maybeReadMore_(t,i){for(;!i.reading&&!i.ended&&(i.length<i.highWaterMark||i.flowing&&0===i.length);){var o=i.length;if(p("maybeReadMore read 0"),t.read(0),o===i.length)break}i.readingMore=!1}function updateReadableListening(t){var i=t._readableState;i.readableListening=t.listenerCount("readable")>0,i.resumeScheduled&&!i.paused?i.flowing=!0:t.listenerCount("data")>0&&t.resume()}function nReadingNextTick(t){p("readable nexttick read 0"),t.read(0)}function resume_(t,i){p("resume",i.reading),i.reading||t.read(0),i.resumeScheduled=!1,t.emit("resume"),flow(t),i.flowing&&!i.reading&&t.read(0)}function flow(t){var i=t._readableState;for(p("flow",i.flowing);i.flowing&&null!==t.read(););}function fromList(t,i){return 0===i.length?null:(i.objectMode?o=i.buffer.shift():!t||t>=i.length?(o=i.decoder?i.buffer.join(""):1===i.buffer.length?i.buffer.first():i.buffer.concat(i.length),i.buffer.clear()):o=i.buffer.consume(t,i.decoder),o);var o}function endReadable(t){var i=t._readableState;p("endReadable",i.endEmitted),i.endEmitted||(i.ended=!0,a.nextTick(endReadableNT,i,t))}function endReadableNT(t,i){if(p("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,i.readable=!1,i.emit("end"),t.autoDestroy)){var o=i._writableState;(!o||o.autoDestroy&&o.finished)&&i.destroy()}}function indexOf(t,i){for(var o=0,a=t.length;o<a;o++)if(t[o]===i)return o;return-1}Readable.prototype.read=function(t){p("read",t),t=parseInt(t,10);var i=this._readableState,o=t;if(0!==t&&(i.emittedReadable=!1),0===t&&i.needReadable&&((0!==i.highWaterMark?i.length>=i.highWaterMark:i.length>0)||i.ended))return p("read: emitReadable",i.length,i.ended),0===i.length&&i.ended?endReadable(this):emitReadable(this),null;if(0===(t=howMuchToRead(t,i))&&i.ended)return 0===i.length&&endReadable(this),null;var a,u=i.needReadable;return p("need readable",u),(0===i.length||i.length-t<i.highWaterMark)&&p("length less than watermark",u=!0),i.ended||i.reading?p("reading or ended",u=!1):u&&(p("do read"),i.reading=!0,i.sync=!0,0===i.length&&(i.needReadable=!0),this._read(i.highWaterMark),i.sync=!1,i.reading||(t=howMuchToRead(o,i))),null===(a=t>0?fromList(t,i):null)?(i.needReadable=i.length<=i.highWaterMark,t=0):(i.length-=t,i.awaitDrain=0),0===i.length&&(i.ended||(i.needReadable=!0),o!==t&&i.ended&&endReadable(this)),null!==a&&this.emit("data",a),a},Readable.prototype._read=function(t){N(this,new x("_read()"))},Readable.prototype.pipe=function(t,i){var o=this,u=this._readableState;switch(u.pipesCount){case 0:u.pipes=t;break;case 1:u.pipes=[u.pipes,t];break;default:u.pipes.push(t)}u.pipesCount+=1,p("pipe count=%d opts=%j",u.pipesCount,i);var h=(!i||!1!==i.end)&&t!==a.stdout&&t!==a.stderr?onend:unpipe;function onunpipe(i,a){p("onunpipe"),i===o&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,function cleanup(){p("cleanup"),t.removeListener("close",onclose),t.removeListener("finish",onfinish),t.removeListener("drain",l),t.removeListener("error",onerror),t.removeListener("unpipe",onunpipe),o.removeListener("end",onend),o.removeListener("end",unpipe),o.removeListener("data",ondata),d=!0,!u.awaitDrain||t._writableState&&!t._writableState.needDrain||l()}())}function onend(){p("onend"),t.end()}u.endEmitted?a.nextTick(h):o.once("end",h),t.on("unpipe",onunpipe);var l=function pipeOnDrain(t){return function pipeOnDrainFunctionResult(){var i=t._readableState;p("pipeOnDrain",i.awaitDrain),i.awaitDrain&&i.awaitDrain--,0===i.awaitDrain&&c(t,"data")&&(i.flowing=!0,flow(t))}}(o);t.on("drain",l);var d=!1;function ondata(i){p("ondata");var a=t.write(i);p("dest.write",a),!1===a&&((1===u.pipesCount&&u.pipes===t||u.pipesCount>1&&-1!==indexOf(u.pipes,t))&&!d&&(p("false write response, pause",u.awaitDrain),u.awaitDrain++),o.pause())}function onerror(i){p("onerror",i),unpipe(),t.removeListener("error",onerror),0===c(t,"error")&&N(t,i)}function onclose(){t.removeListener("finish",onfinish),unpipe()}function onfinish(){p("onfinish"),t.removeListener("close",onclose),unpipe()}function unpipe(){p("unpipe"),o.unpipe(t)}return o.on("data",ondata),function prependListener(t,i,o){if("function"==typeof t.prependListener)return t.prependListener(i,o);t._events&&t._events[i]?Array.isArray(t._events[i])?t._events[i].unshift(o):t._events[i]=[o,t._events[i]]:t.on(i,o)}(t,"error",onerror),t.once("close",onclose),t.once("finish",onfinish),t.emit("pipe",o),u.flowing||(p("pipe resume"),o.resume()),t},Readable.prototype.unpipe=function(t){var i=this._readableState,o={hasUnpiped:!1};if(0===i.pipesCount)return this;if(1===i.pipesCount)return t&&t!==i.pipes||(t||(t=i.pipes),i.pipes=null,i.pipesCount=0,i.flowing=!1,t&&t.emit("unpipe",this,o)),this;if(!t){var a=i.pipes,u=i.pipesCount;i.pipes=null,i.pipesCount=0,i.flowing=!1;for(var c=0;c<u;c++)a[c].emit("unpipe",this,{hasUnpiped:!1});return this}var h=indexOf(i.pipes,t);return-1===h||(i.pipes.splice(h,1),i.pipesCount-=1,1===i.pipesCount&&(i.pipes=i.pipes[0]),t.emit("unpipe",this,o)),this},Readable.prototype.on=function(t,i){var o=h.prototype.on.call(this,t,i),u=this._readableState;return"data"===t?(u.readableListening=this.listenerCount("readable")>0,!1!==u.flowing&&this.resume()):"readable"===t&&(u.endEmitted||u.readableListening||(u.readableListening=u.needReadable=!0,u.flowing=!1,u.emittedReadable=!1,p("on readable",u.length,u.reading),u.length?emitReadable(this):u.reading||a.nextTick(nReadingNextTick,this))),o},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.removeListener=function(t,i){var o=h.prototype.removeListener.call(this,t,i);return"readable"===t&&a.nextTick(updateReadableListening,this),o},Readable.prototype.removeAllListeners=function(t){var i=h.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||a.nextTick(updateReadableListening,this),i},Readable.prototype.resume=function(){var t=this._readableState;return t.flowing||(p("resume"),t.flowing=!t.readableListening,function resume(t,i){i.resumeScheduled||(i.resumeScheduled=!0,a.nextTick(resume_,t,i))}(this,t)),t.paused=!1,this},Readable.prototype.pause=function(){return p("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(p("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},Readable.prototype.wrap=function(t){var i=this,o=this._readableState,a=!1;for(var u in t.on("end",(function(){if(p("wrapped end"),o.decoder&&!o.ended){var t=o.decoder.end();t&&t.length&&i.push(t)}i.push(null)})),t.on("data",(function(u){(p("wrapped data"),o.decoder&&(u=o.decoder.write(u)),o.objectMode&&null==u)||(o.objectMode||u&&u.length)&&(i.push(u)||(a=!0,t.pause()))})),t)void 0===this[u]&&"function"==typeof t[u]&&(this[u]=function methodWrap(i){return function methodWrapReturnFunction(){return t[i].apply(t,arguments)}}(u));for(var c=0;c<A.length;c++)t.on(A[c],this.emit.bind(this,A[c]));return this._read=function(i){p("wrapped _read",i),a&&(a=!1,t.resume())},this},"function"==typeof Symbol&&(Readable.prototype[Symbol.asyncIterator]=function(){return void 0===v&&(v=o(654)),v(this)}),Object.defineProperty(Readable.prototype,"readableHighWaterMark",{enumerable:!1,get:function get(){return this._readableState.highWaterMark}}),Object.defineProperty(Readable.prototype,"readableBuffer",{enumerable:!1,get:function get(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(Readable.prototype,"readableFlowing",{enumerable:!1,get:function get(){return this._readableState.flowing},set:function set(t){this._readableState&&(this._readableState.flowing=t)}}),Readable._fromList=fromList,Object.defineProperty(Readable.prototype,"readableLength",{enumerable:!1,get:function get(){return this._readableState.length}}),"function"==typeof Symbol&&(Readable.from=function(t,i){return void 0===b&&(b=o(655)),b(Readable,t,i)})}).call(this,o(17),o(11))},function(t,i,o){t.exports=o(31).EventEmitter},function(t,i,o){"use strict";(function(i){function emitErrorAndCloseNT(t,i){emitErrorNT(t,i),emitCloseNT(t)}function emitCloseNT(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function emitErrorNT(t,i){t.emit("error",i)}t.exports={destroy:function destroy(t,o){var a=this,u=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return u||c?(o?o(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,i.nextTick(emitErrorNT,this,t)):i.nextTick(emitErrorNT,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!o&&t?a._writableState?a._writableState.errorEmitted?i.nextTick(emitCloseNT,a):(a._writableState.errorEmitted=!0,i.nextTick(emitErrorAndCloseNT,a,t)):i.nextTick(emitErrorAndCloseNT,a,t):o?(i.nextTick(emitCloseNT,a),o(t)):i.nextTick(emitCloseNT,a)})),this)},undestroy:function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function errorOrDestroy(t,i){var o=t._readableState,a=t._writableState;o&&o.autoDestroy||a&&a.autoDestroy?t.destroy(i):t.emit("error",i)}}}).call(this,o(11))},function(t,i,o){"use strict";var a=o(83).codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function getHighWaterMark(t,i,o,u){var c=function highWaterMarkFrom(t,i,o){return null!=t.highWaterMark?t.highWaterMark:i?t[o]:null}(i,u,o);if(null!=c){if(!isFinite(c)||Math.floor(c)!==c||c<0)throw new a(u?o:"highWaterMark",c);return Math.floor(c)}return t.objectMode?16:16384}}},function(t,i,o){"use strict";(function(i,a){function CorkedRequest(t){var i=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(t,i,o){var a=t.entry;t.entry=null;for(;a;){var u=a.callback;i.pendingcb--,u(o),a=a.next}i.corkedRequestsFree.next=t}(i,t)}}var u;t.exports=Writable,Writable.WritableState=WritableState;var c={deprecate:o(166)},h=o(256),l=o(10).Buffer,d=i.Uint8Array||function(){};var p,m=o(257),g=o(258).getHighWaterMark,v=o(83).codes,b=v.ERR_INVALID_ARG_TYPE,w=v.ERR_METHOD_NOT_IMPLEMENTED,_=v.ERR_MULTIPLE_CALLBACK,M=v.ERR_STREAM_CANNOT_PIPE,k=v.ERR_STREAM_DESTROYED,B=v.ERR_STREAM_NULL_VALUES,P=v.ERR_STREAM_WRITE_AFTER_END,x=v.ERR_UNKNOWN_ENCODING,I=m.errorOrDestroy;function nop(){}function WritableState(t,i,c){u=u||o(84),t=t||{},"boolean"!=typeof c&&(c=i instanceof u),this.objectMode=!!t.objectMode,c&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=g(this,t,"writableHighWaterMark",c),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===t.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function onwrite(t,i){var o=t._writableState,u=o.sync,c=o.writecb;if("function"!=typeof c)throw new _;if(function onwriteStateUpdate(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(o),i)!function onwriteError(t,i,o,u,c){--i.pendingcb,o?(a.nextTick(c,u),a.nextTick(finishMaybe,t,i),t._writableState.errorEmitted=!0,I(t,u)):(c(u),t._writableState.errorEmitted=!0,I(t,u),finishMaybe(t,i))}(t,o,u,i,c);else{var h=needFinish(o)||t.destroyed;h||o.corked||o.bufferProcessing||!o.bufferedRequest||clearBuffer(t,o),u?a.nextTick(afterWrite,t,o,h,c):afterWrite(t,o,h,c)}}(i,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new CorkedRequest(this)}function Writable(t){var i=this instanceof(u=u||o(84));if(!i&&!p.call(Writable,this))return new Writable(t);this._writableState=new WritableState(t,this,i),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),h.call(this)}function doWrite(t,i,o,a,u,c,h){i.writelen=a,i.writecb=h,i.writing=!0,i.sync=!0,i.destroyed?i.onwrite(new k("write")):o?t._writev(u,i.onwrite):t._write(u,c,i.onwrite),i.sync=!1}function afterWrite(t,i,o,a){o||function onwriteDrain(t,i){0===i.length&&i.needDrain&&(i.needDrain=!1,t.emit("drain"))}(t,i),i.pendingcb--,a(),finishMaybe(t,i)}function clearBuffer(t,i){i.bufferProcessing=!0;var o=i.bufferedRequest;if(t._writev&&o&&o.next){var a=i.bufferedRequestCount,u=new Array(a),c=i.corkedRequestsFree;c.entry=o;for(var h=0,l=!0;o;)u[h]=o,o.isBuf||(l=!1),o=o.next,h+=1;u.allBuffers=l,doWrite(t,i,!0,i.length,u,"",c.finish),i.pendingcb++,i.lastBufferedRequest=null,c.next?(i.corkedRequestsFree=c.next,c.next=null):i.corkedRequestsFree=new CorkedRequest(i),i.bufferedRequestCount=0}else{for(;o;){var d=o.chunk,p=o.encoding,m=o.callback;if(doWrite(t,i,!1,i.objectMode?1:d.length,d,p,m),o=o.next,i.bufferedRequestCount--,i.writing)break}null===o&&(i.lastBufferedRequest=null)}i.bufferedRequest=o,i.bufferProcessing=!1}function needFinish(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function callFinal(t,i){t._final((function(o){i.pendingcb--,o&&I(t,o),i.prefinished=!0,t.emit("prefinish"),finishMaybe(t,i)}))}function finishMaybe(t,i){var o=needFinish(i);if(o&&(function prefinish(t,i){i.prefinished||i.finalCalled||("function"!=typeof t._final||i.destroyed?(i.prefinished=!0,t.emit("prefinish")):(i.pendingcb++,i.finalCalled=!0,a.nextTick(callFinal,t,i)))}(t,i),0===i.pendingcb&&(i.finished=!0,t.emit("finish"),i.autoDestroy))){var u=t._readableState;(!u||u.autoDestroy&&u.endEmitted)&&t.destroy()}return o}o(1)(Writable,h),WritableState.prototype.getBuffer=function getBuffer(){for(var t=this.bufferedRequest,i=[];t;)i.push(t),t=t.next;return i},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:c.deprecate((function writableStateBufferGetter(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function value(t){return!!p.call(this,t)||this===Writable&&(t&&t._writableState instanceof WritableState)}})):p=function realHasInstance(t){return t instanceof this},Writable.prototype.pipe=function(){I(this,new M)},Writable.prototype.write=function(t,i,o){var u=this._writableState,c=!1,h=!u.objectMode&&function _isUint8Array(t){return l.isBuffer(t)||t instanceof d}(t);return h&&!l.isBuffer(t)&&(t=function _uint8ArrayToBuffer(t){return l.from(t)}(t)),"function"==typeof i&&(o=i,i=null),h?i="buffer":i||(i=u.defaultEncoding),"function"!=typeof o&&(o=nop),u.ending?function writeAfterEnd(t,i){var o=new P;I(t,o),a.nextTick(i,o)}(this,o):(h||function validChunk(t,i,o,u){var c;return null===o?c=new B:"string"==typeof o||i.objectMode||(c=new b("chunk",["string","Buffer"],o)),!c||(I(t,c),a.nextTick(u,c),!1)}(this,u,t,o))&&(u.pendingcb++,c=function writeOrBuffer(t,i,o,a,u,c){if(!o){var h=function decodeChunk(t,i,o){t.objectMode||!1===t.decodeStrings||"string"!=typeof i||(i=l.from(i,o));return i}(i,a,u);a!==h&&(o=!0,u="buffer",a=h)}var d=i.objectMode?1:a.length;i.length+=d;var p=i.length<i.highWaterMark;p||(i.needDrain=!0);if(i.writing||i.corked){var m=i.lastBufferedRequest;i.lastBufferedRequest={chunk:a,encoding:u,isBuf:o,callback:c,next:null},m?m.next=i.lastBufferedRequest:i.bufferedRequest=i.lastBufferedRequest,i.bufferedRequestCount+=1}else doWrite(t,i,!1,d,a,u,c);return p}(this,u,h,t,i,o)),c},Writable.prototype.cork=function(){this._writableState.corked++},Writable.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||clearBuffer(this,t))},Writable.prototype.setDefaultEncoding=function setDefaultEncoding(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new x(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(Writable.prototype,"writableBuffer",{enumerable:!1,get:function get(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function get(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(t,i,o){o(new w("_write()"))},Writable.prototype._writev=null,Writable.prototype.end=function(t,i,o){var u=this._writableState;return"function"==typeof t?(o=t,t=null,i=null):"function"==typeof i&&(o=i,i=null),null!=t&&this.write(t,i),u.corked&&(u.corked=1,this.uncork()),u.ending||function endWritable(t,i,o){i.ending=!0,finishMaybe(t,i),o&&(i.finished?a.nextTick(o):t.once("finish",o));i.ended=!0,t.writable=!1}(this,u,o),this},Object.defineProperty(Writable.prototype,"writableLength",{enumerable:!1,get:function get(){return this._writableState.length}}),Object.defineProperty(Writable.prototype,"destroyed",{enumerable:!1,get:function get(){return void 0!==this._writableState&&this._writableState.destroyed},set:function set(t){this._writableState&&(this._writableState.destroyed=t)}}),Writable.prototype.destroy=m.destroy,Writable.prototype._undestroy=m.undestroy,Writable.prototype._destroy=function(t,i){i(t)}}).call(this,o(17),o(11))},function(t,i,o){"use strict";t.exports=Transform;var a=o(83).codes,u=a.ERR_METHOD_NOT_IMPLEMENTED,c=a.ERR_MULTIPLE_CALLBACK,h=a.ERR_TRANSFORM_ALREADY_TRANSFORMING,l=a.ERR_TRANSFORM_WITH_LENGTH_0,d=o(84);function afterTransform(t,i){var o=this._transformState;o.transforming=!1;var a=o.writecb;if(null===a)return this.emit("error",new c);o.writechunk=null,o.writecb=null,null!=i&&this.push(i),a(t);var u=this._readableState;u.reading=!1,(u.needReadable||u.length<u.highWaterMark)&&this._read(u.highWaterMark)}function Transform(t){if(!(this instanceof Transform))return new Transform(t);d.call(this,t),this._transformState={afterTransform:afterTransform.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",prefinish)}function prefinish(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?done(this,null,null):this._flush((function(i,o){done(t,i,o)}))}function done(t,i,o){if(i)return t.emit("error",i);if(null!=o&&t.push(o),t._writableState.length)throw new l;if(t._transformState.transforming)throw new h;return t.push(null)}o(1)(Transform,d),Transform.prototype.push=function(t,i){return this._transformState.needTransform=!1,d.prototype.push.call(this,t,i)},Transform.prototype._transform=function(t,i,o){o(new u("_transform()"))},Transform.prototype._write=function(t,i,o){var a=this._transformState;if(a.writecb=o,a.writechunk=t,a.writeencoding=i,!a.transforming){var u=this._readableState;(a.needTransform||u.needReadable||u.length<u.highWaterMark)&&this._read(u.highWaterMark)}},Transform.prototype._read=function(t){var i=this._transformState;null===i.writechunk||i.transforming?i.needTransform=!0:(i.transforming=!0,this._transform(i.writechunk,i.writeencoding,i.afterTransform))},Transform.prototype._destroy=function(t,i){d.prototype._destroy.call(this,t,(function(t){i(t)}))}},function(t,i,o){(function(i){const o=t.exports;o.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},o.codes={};for(const t in o.types){const i=o.types[t];o.codes[i]=t}o.CMD_SHIFT=4,o.CMD_MASK=240,o.DUP_MASK=8,o.QOS_MASK=3,o.QOS_SHIFT=1,o.RETAIN_MASK=1,o.VARBYTEINT_MASK=127,o.VARBYTEINT_FIN_MASK=128,o.VARBYTEINT_MAX=268435455,o.SESSIONPRESENT_MASK=1,o.SESSIONPRESENT_HEADER=i.from([o.SESSIONPRESENT_MASK]),o.CONNACK_HEADER=i.from([o.codes.connack<<o.CMD_SHIFT]),o.USERNAME_MASK=128,o.PASSWORD_MASK=64,o.WILL_RETAIN_MASK=32,o.WILL_QOS_MASK=24,o.WILL_QOS_SHIFT=3,o.WILL_FLAG_MASK=4,o.CLEAN_SESSION_MASK=2,o.CONNECT_HEADER=i.from([o.codes.connect<<o.CMD_SHIFT]),o.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},o.propertiesCodes={};for(const t in o.properties){const i=o.properties[t];o.propertiesCodes[i]=t}function genHeader(t){return[0,1,2].map(a=>[0,1].map(u=>[0,1].map(c=>{const h=i.alloc(1);return h.writeUInt8(o.codes[t]<<o.CMD_SHIFT|(u?o.DUP_MASK:0)|a<<o.QOS_SHIFT|c,0,!0),h})))}o.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"},o.PUBLISH_HEADER=genHeader("publish"),o.SUBSCRIBE_HEADER=genHeader("subscribe"),o.SUBSCRIBE_OPTIONS_QOS_MASK=3,o.SUBSCRIBE_OPTIONS_NL_MASK=1,o.SUBSCRIBE_OPTIONS_NL_SHIFT=2,o.SUBSCRIBE_OPTIONS_RAP_MASK=1,o.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,o.SUBSCRIBE_OPTIONS_RH_MASK=3,o.SUBSCRIBE_OPTIONS_RH_SHIFT=4,o.SUBSCRIBE_OPTIONS_RH=[0,16,32],o.SUBSCRIBE_OPTIONS_NL=4,o.SUBSCRIBE_OPTIONS_RAP=8,o.SUBSCRIBE_OPTIONS_QOS=[0,1,2],o.UNSUBSCRIBE_HEADER=genHeader("unsubscribe"),o.ACKS={unsuback:genHeader("unsuback"),puback:genHeader("puback"),pubcomp:genHeader("pubcomp"),pubrel:genHeader("pubrel"),pubrec:genHeader("pubrec")},o.SUBACK_HEADER=i.from([o.codes.suback<<o.CMD_SHIFT]),o.VERSION3=i.from([3]),o.VERSION4=i.from([4]),o.VERSION5=i.from([5]),o.VERSION131=i.from([131]),o.VERSION132=i.from([132]),o.QOS=[0,1,2].map(t=>i.from([t])),o.EMPTY={pingreq:i.from([o.codes.pingreq<<4,0]),pingresp:i.from([o.codes.pingresp<<4,0]),disconnect:i.from([o.codes.disconnect<<4,0])}}).call(this,o(10).Buffer)},function(t,i,o){(function(i){const a=o(261),u=i.allocUnsafe(0),c=i.from([0]),h=o(666),l=o(48).nextTick,d=o(71)("mqtt-packet:writeToStream"),p=h.cache,m=h.generateNumber,g=h.generateCache,v=h.genBufVariableByteInt,b=h.generate4ByteBuffer;let w=writeNumberCached,_=!0;function generate(t,o,h){switch(d("generate called"),o.cork&&(o.cork(),l(uncork,o)),_&&(_=!1,g()),d("generate: packet.cmd: %s",t.cmd),t.cmd){case"connect":return function connect(t,o,u){const c=t||{},h=c.protocolId||"MQTT";let l=c.protocolVersion||4;const d=c.will;let p=c.clean;const m=c.keepalive||0,g=c.clientId||"",v=c.username,b=c.password,_=c.properties;void 0===p&&(p=!0);let M=0;if(!h||"string"!=typeof h&&!i.isBuffer(h))return o.emit("error",new Error("Invalid protocolId")),!1;M+=h.length+2;if(3!==l&&4!==l&&5!==l)return o.emit("error",new Error("Invalid protocol version")),!1;M+=1;if(("string"==typeof g||i.isBuffer(g))&&(g||l>=4)&&(g||p))M+=i.byteLength(g)+2;else{if(l<4)return o.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*p==0)return o.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if("number"!=typeof m||m<0||m>65535||m%1!=0)return o.emit("error",new Error("Invalid keepalive")),!1;M+=2;if(M+=1,5===l){var k=getProperties(o,_);if(!k)return!1;M+=k.length}if(d){if("object"!=typeof d)return o.emit("error",new Error("Invalid will")),!1;if(!d.topic||"string"!=typeof d.topic)return o.emit("error",new Error("Invalid will topic")),!1;if(M+=i.byteLength(d.topic)+2,M+=2,d.payload){if(!(d.payload.length>=0))return o.emit("error",new Error("Invalid will payload")),!1;"string"==typeof d.payload?M+=i.byteLength(d.payload):M+=d.payload.length}var B={};if(5===l){if(!(B=getProperties(o,d.properties)))return!1;M+=B.length}}let P=!1;if(null!=v){if(!isStringOrBuffer(v))return o.emit("error",new Error("Invalid username")),!1;P=!0,M+=i.byteLength(v)+2}if(null!=b){if(!P)return o.emit("error",new Error("Username is required to use password")),!1;if(!isStringOrBuffer(b))return o.emit("error",new Error("Invalid password")),!1;M+=byteLength(b)+2}o.write(a.CONNECT_HEADER),writeVarByteInt(o,M),writeStringOrBuffer(o,h),c.bridgeMode&&(l+=128);o.write(131===l?a.VERSION131:132===l?a.VERSION132:4===l?a.VERSION4:5===l?a.VERSION5:a.VERSION3);let x=0;x|=null!=v?a.USERNAME_MASK:0,x|=null!=b?a.PASSWORD_MASK:0,x|=d&&d.retain?a.WILL_RETAIN_MASK:0,x|=d&&d.qos?d.qos<<a.WILL_QOS_SHIFT:0,x|=d?a.WILL_FLAG_MASK:0,x|=p?a.CLEAN_SESSION_MASK:0,o.write(i.from([x])),w(o,m),5===l&&k.write();writeStringOrBuffer(o,g),d&&(5===l&&B.write(),writeString(o,d.topic),writeStringOrBuffer(o,d.payload));null!=v&&writeStringOrBuffer(o,v);null!=b&&writeStringOrBuffer(o,b);return!0}(t,o);case"connack":return function connack(t,o,u){const h=u?u.protocolVersion:4,l=t||{},d=5===h?l.reasonCode:l.returnCode,p=l.properties;let m=2;if("number"!=typeof d)return o.emit("error",new Error("Invalid return code")),!1;let g=null;if(5===h){if(g=getProperties(o,p),!g)return!1;m+=g.length}o.write(a.CONNACK_HEADER),writeVarByteInt(o,m),o.write(l.sessionPresent?a.SESSIONPRESENT_HEADER:c),o.write(i.from([d])),null!=g&&g.write();return!0}(t,o,h);case"publish":return function publish(t,o,c){d("publish: packet: %o",t);const h=c?c.protocolVersion:4,l=t||{},p=l.qos||0,m=l.retain?a.RETAIN_MASK:0,g=l.topic,v=l.payload||u,b=l.messageId,_=l.properties;let M=0;if("string"==typeof g)M+=i.byteLength(g)+2;else{if(!i.isBuffer(g))return o.emit("error",new Error("Invalid topic")),!1;M+=g.length+2}i.isBuffer(v)?M+=v.length:M+=i.byteLength(v);if(p&&"number"!=typeof b)return o.emit("error",new Error("Invalid messageId")),!1;p&&(M+=2);let k=null;if(5===h){if(k=getProperties(o,_),!k)return!1;M+=k.length}o.write(a.PUBLISH_HEADER[p][l.dup?1:0][m?1:0]),writeVarByteInt(o,M),w(o,byteLength(g)),o.write(g),p>0&&w(o,b);null!=k&&k.write();return d("publish: payload: %o",v),o.write(v)}(t,o,h);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function confirmation(t,o,u){const c=u?u.protocolVersion:4,h=t||{},l=h.cmd||"puback",d=h.messageId,p=h.dup&&"pubrel"===l?a.DUP_MASK:0;let m=0;const g=h.reasonCode,v=h.properties;let b=5===c?3:2;"pubrel"===l&&(m=1);if("number"!=typeof d)return o.emit("error",new Error("Invalid messageId")),!1;let _=null;if(5===c&&"object"==typeof v){if(_=getPropertiesByMaximumPacketSize(o,v,u,b),!_)return!1;b+=_.length}o.write(a.ACKS[l][m][p][0]),writeVarByteInt(o,b),w(o,d),5===c&&o.write(i.from([g]));null!==_&&_.write();return!0}(t,o,h);case"subscribe":return function subscribe(t,o,u){d("subscribe: packet: ");const c=u?u.protocolVersion:4,h=t||{},l=h.dup?a.DUP_MASK:0,p=h.messageId,m=h.subscriptions,g=h.properties;let v=0;if("number"!=typeof p)return o.emit("error",new Error("Invalid messageId")),!1;v+=2;let b=null;if(5===c){if(b=getProperties(o,g),!b)return!1;v+=b.length}if("object"!=typeof m||!m.length)return o.emit("error",new Error("Invalid subscriptions")),!1;for(let t=0;t<m.length;t+=1){const a=m[t].topic,u=m[t].qos;if("string"!=typeof a)return o.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if("number"!=typeof u)return o.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(5===c){if("boolean"!=typeof(m[t].nl||!1))return o.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if("boolean"!=typeof(m[t].rap||!1))return o.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const i=m[t].rh||0;if("number"!=typeof i||i>2)return o.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}v+=i.byteLength(a)+2+1}d("subscribe: writing to stream: %o",a.SUBSCRIBE_HEADER),o.write(a.SUBSCRIBE_HEADER[1][l?1:0][0]),writeVarByteInt(o,v),w(o,p),null!==b&&b.write();let _=!0;for(const t of m){const u=t.topic,h=t.qos,l=+t.nl,d=+t.rap,p=t.rh;let m;writeString(o,u),m=a.SUBSCRIBE_OPTIONS_QOS[h],5===c&&(m|=l?a.SUBSCRIBE_OPTIONS_NL:0,m|=d?a.SUBSCRIBE_OPTIONS_RAP:0,m|=p?a.SUBSCRIBE_OPTIONS_RH[p]:0),_=o.write(i.from([m]))}return _}(t,o,h);case"suback":return function suback(t,o,u){const c=u?u.protocolVersion:4,h=t||{},l=h.messageId,d=h.granted,p=h.properties;let m=0;if("number"!=typeof l)return o.emit("error",new Error("Invalid messageId")),!1;m+=2;if("object"!=typeof d||!d.length)return o.emit("error",new Error("Invalid qos vector")),!1;for(let t=0;t<d.length;t+=1){if("number"!=typeof d[t])return o.emit("error",new Error("Invalid qos vector")),!1;m+=1}let g=null;if(5===c){if(g=getPropertiesByMaximumPacketSize(o,p,u,m),!g)return!1;m+=g.length}o.write(a.SUBACK_HEADER),writeVarByteInt(o,m),w(o,l),null!==g&&g.write();return o.write(i.from(d))}(t,o,h);case"unsubscribe":return function unsubscribe(t,o,u){const c=u?u.protocolVersion:4,h=t||{},l=h.messageId,d=h.dup?a.DUP_MASK:0,p=h.unsubscriptions,m=h.properties;let g=0;if("number"!=typeof l)return o.emit("error",new Error("Invalid messageId")),!1;g+=2;if("object"!=typeof p||!p.length)return o.emit("error",new Error("Invalid unsubscriptions")),!1;for(let t=0;t<p.length;t+=1){if("string"!=typeof p[t])return o.emit("error",new Error("Invalid unsubscriptions")),!1;g+=i.byteLength(p[t])+2}let v=null;if(5===c){if(v=getProperties(o,m),!v)return!1;g+=v.length}o.write(a.UNSUBSCRIBE_HEADER[1][d?1:0][0]),writeVarByteInt(o,g),w(o,l),null!==v&&v.write();let b=!0;for(let t=0;t<p.length;t++)b=writeString(o,p[t]);return b}(t,o,h);case"unsuback":return function unsuback(t,o,u){const c=u?u.protocolVersion:4,h=t||{},l=h.messageId,d=h.dup?a.DUP_MASK:0,p=h.granted,m=h.properties,g=h.cmd;let v=2;if("number"!=typeof l)return o.emit("error",new Error("Invalid messageId")),!1;if(5===c){if("object"!=typeof p||!p.length)return o.emit("error",new Error("Invalid qos vector")),!1;for(let t=0;t<p.length;t+=1){if("number"!=typeof p[t])return o.emit("error",new Error("Invalid qos vector")),!1;v+=1}}let b=null;if(5===c){if(b=getPropertiesByMaximumPacketSize(o,m,u,v),!b)return!1;v+=b.length}o.write(a.ACKS[g][0][d][0]),writeVarByteInt(o,v),w(o,l),null!==b&&b.write();5===c&&o.write(i.from(p));return!0}(t,o,h);case"pingreq":case"pingresp":return function emptyPacket(t,i,o){return i.write(a.EMPTY[t.cmd])}(t,o);case"disconnect":return function disconnect(t,o,u){const c=u?u.protocolVersion:4,h=t||{},l=h.reasonCode,d=h.properties;let p=5===c?1:0,m=null;if(5===c){if(m=getPropertiesByMaximumPacketSize(o,d,u,p),!m)return!1;p+=m.length}o.write(i.from([a.codes.disconnect<<4])),writeVarByteInt(o,p),5===c&&o.write(i.from([l]));null!==m&&m.write();return!0}(t,o,h);case"auth":return function auth(t,o,u){const c=u?u.protocolVersion:4,h=t||{},l=h.reasonCode,d=h.properties;let p=5===c?1:0;5!==c&&o.emit("error",new Error("Invalid mqtt version for auth packet"));const m=getPropertiesByMaximumPacketSize(o,d,u,p);if(!m)return!1;p+=m.length,o.write(i.from([a.codes.auth<<4])),writeVarByteInt(o,p),o.write(i.from([l])),null!==m&&m.write();return!0}(t,o,h);default:return o.emit("error",new Error("Unknown command")),!1}}function uncork(t){t.uncork()}Object.defineProperty(generate,"cacheNumbers",{get:()=>w===writeNumberCached,set(t){t?(p&&0!==Object.keys(p).length||(_=!0),w=writeNumberCached):(_=!1,w=writeNumberGenerated)}});const M={};function writeVarByteInt(t,i){if(i>a.VARBYTEINT_MAX)return t.emit("error",new Error("Invalid variable byte integer: "+i)),!1;let o=M[i];return o||(o=v(i),i<16384&&(M[i]=o)),d("writeVarByteInt: writing to stream: %o",o),t.write(o)}function writeString(t,o){const a=i.byteLength(o);return w(t,a),d("writeString: %s",o),t.write(o,"utf8")}function writeStringPair(t,i,o){writeString(t,i),writeString(t,o)}function writeNumberCached(t,i){return d("writeNumberCached: number: %d",i),d("writeNumberCached: %o",p[i]),t.write(p[i])}function writeNumberGenerated(t,i){const o=m(i);return d("writeNumberGenerated: %o",o),t.write(o)}function writeStringOrBuffer(t,i){"string"==typeof i?writeString(t,i):i?(w(t,i.length),t.write(i)):w(t,0)}function getProperties(t,o){if("object"!=typeof o||null!=o.length)return{length:1,write(){writeProperties(t,{},0)}};let u=0;function getLengthProperty(o,u){let c=0;switch(a.propertiesTypes[o]){case"byte":if("boolean"!=typeof u)return t.emit("error",new Error(`Invalid ${o}: ${u}`)),!1;c+=2;break;case"int8":if("number"!=typeof u||u<0||u>255)return t.emit("error",new Error(`Invalid ${o}: ${u}`)),!1;c+=2;break;case"binary":if(u&&null===u)return t.emit("error",new Error(`Invalid ${o}: ${u}`)),!1;c+=1+i.byteLength(u)+2;break;case"int16":if("number"!=typeof u||u<0||u>65535)return t.emit("error",new Error(`Invalid ${o}: ${u}`)),!1;c+=3;break;case"int32":if("number"!=typeof u||u<0||u>4294967295)return t.emit("error",new Error(`Invalid ${o}: ${u}`)),!1;c+=5;break;case"var":if("number"!=typeof u||u<0||u>268435455)return t.emit("error",new Error(`Invalid ${o}: ${u}`)),!1;c+=1+i.byteLength(v(u));break;case"string":if("string"!=typeof u)return t.emit("error",new Error(`Invalid ${o}: ${u}`)),!1;c+=3+i.byteLength(u.toString());break;case"pair":if("object"!=typeof u)return t.emit("error",new Error(`Invalid ${o}: ${u}`)),!1;c+=Object.getOwnPropertyNames(u).reduce((t,o)=>{const a=u[o];return Array.isArray(a)?t+=a.reduce((t,a)=>t+=3+i.byteLength(o.toString())+2+i.byteLength(a.toString()),0):t+=3+i.byteLength(o.toString())+2+i.byteLength(u[o].toString()),t},0);break;default:return t.emit("error",new Error(`Invalid property ${o}: ${u}`)),!1}return c}if(o)for(const t in o){let i=0,a=0;const c=o[t];if(Array.isArray(c))for(let o=0;o<c.length;o++){if(a=getLengthProperty(t,c[o]),!a)return!1;i+=a}else{if(a=getLengthProperty(t,c),!a)return!1;i=a}if(!i)return!1;u+=i}return{length:i.byteLength(v(u))+u,write(){writeProperties(t,o,u)}}}function getPropertiesByMaximumPacketSize(t,i,o,a){const u=["reasonString","userProperties"],c=o&&o.properties&&o.properties.maximumPacketSize?o.properties.maximumPacketSize:0;let h=getProperties(t,i);if(c)for(;a+h.length>c;){const o=u.shift();if(!o||!i[o])return!1;delete i[o],h=getProperties(t,i)}return h}function writeProperty(t,o,u){switch(a.propertiesTypes[o]){case"byte":t.write(i.from([a.properties[o]])),t.write(i.from([+u]));break;case"int8":t.write(i.from([a.properties[o]])),t.write(i.from([u]));break;case"binary":t.write(i.from([a.properties[o]])),writeStringOrBuffer(t,u);break;case"int16":t.write(i.from([a.properties[o]])),w(t,u);break;case"int32":t.write(i.from([a.properties[o]])),function write4ByteNumber(t,i){const o=b(i);return d("write4ByteNumber: %o",o),t.write(o)}(t,u);break;case"var":t.write(i.from([a.properties[o]])),writeVarByteInt(t,u);break;case"string":t.write(i.from([a.properties[o]])),writeString(t,u);break;case"pair":Object.getOwnPropertyNames(u).forEach(c=>{const h=u[c];Array.isArray(h)?h.forEach(u=>{t.write(i.from([a.properties[o]])),writeStringPair(t,c.toString(),u.toString())}):(t.write(i.from([a.properties[o]])),writeStringPair(t,c.toString(),h.toString()))});break;default:return t.emit("error",new Error(`Invalid property ${o} value: ${u}`)),!1}}function writeProperties(t,i,o){writeVarByteInt(t,o);for(const o in i)if(Object.prototype.hasOwnProperty.call(i,o)&&null!==i[o]){const a=i[o];if(Array.isArray(a))for(let i=0;i<a.length;i++)writeProperty(t,o,a[i]);else writeProperty(t,o,a)}}function byteLength(t){return t?t instanceof i?t.length:i.byteLength(t):0}function isStringOrBuffer(t){return"string"==typeof t||t instanceof i}t.exports=generate}).call(this,o(10).Buffer)},function(t,i,o){"use strict";var a=o(669),u=o(71)("mqttjs:tcp");t.exports=function streamBuilder(t,i){var o,c;return i.port=i.port||1883,i.hostname=i.hostname||i.host||"localhost",o=i.port,c=i.hostname,u("port %d and host %s",o,c),a.createConnection(o,c)}},function(t,i,o){"use strict";(function(i){var a,u,c,h=o(47).Transform,l=o(169);t.exports=function buildStream(t,o){if(o.hostname=o.hostname||o.host,!o.hostname)throw new Error("Could not determine host. Specify host manually.");var d="MQIsdp"===o.protocolId&&3===o.protocolVersion?"mqttv3.1":"mqtt";!function setDefaultOpts(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}(o);var p=function buildUrl(t,i){var o="wxs"===t.protocol?"wss":"ws",a=o+"://"+t.hostname+t.path;return t.port&&80!==t.port&&443!==t.port&&(a=o+"://"+t.hostname+":"+t.port+t.path),"function"==typeof t.transformWsUrl&&(a=t.transformWsUrl(a,t,i)),a}(o,t);a=wx.connectSocket({url:p,protocols:[d]}),u=function buildProxy(){var t=new h;return t._write=function(t,i,o){a.send({data:t.buffer,success:function(){o()},fail:function(t){o(new Error(t))}})},t._flush=function socketEnd(t){a.close({success:function(){t()}})},t}(),(c=l.obj())._destroy=function(t,i){a.close({success:function(){i&&i(t)}})};var m=c.destroy;return c.destroy=function(){c.destroy=m;var t=this;setTimeout((function(){a.close({fail:function(){t._destroy(new Error)}})}),0)}.bind(c),function bindEventHandler(){a.onOpen((function(){c.setReadable(u),c.setWritable(u),c.emit("connect")})),a.onMessage((function(t){var o=t.data;o=o instanceof ArrayBuffer?i.from(o):i.from(o,"utf8"),u.push(o)})),a.onClose((function(){c.end(),c.destroy()})),a.onError((function(t){c.destroy(new Error(t.errMsg))}))}(),c}}).call(this,o(10).Buffer)},function(t,i,o){(function(i){var a=o(671),noop=function(){},eos=function(t,o,u){if("function"==typeof o)return eos(t,null,o);o||(o={}),u=a(u||noop);var c=t._writableState,h=t._readableState,l=o.readable||!1!==o.readable&&t.readable,d=o.writable||!1!==o.writable&&t.writable,p=!1,onlegacyfinish=function(){t.writable||onfinish()},onfinish=function(){d=!1,l||u.call(t)},onend=function(){l=!1,d||u.call(t)},onexit=function(i){u.call(t,i?new Error("exited with error code: "+i):null)},onerror=function(i){u.call(t,i)},onclose=function(){i.nextTick(onclosenexttick)},onclosenexttick=function(){if(!p)return(!l||h&&h.ended&&!h.destroyed)&&(!d||c&&c.ended&&!c.destroyed)?void 0:u.call(t,new Error("premature close"))},onrequest=function(){t.req.on("finish",onfinish)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(t)?d&&!c&&(t.on("end",onlegacyfinish),t.on("close",onlegacyfinish)):(t.on("complete",onfinish),t.on("abort",onclose),t.req?onrequest():t.on("request",onrequest)),function(t){return t.stdio&&Array.isArray(t.stdio)&&3===t.stdio.length}(t)&&t.on("exit",onexit),t.on("end",onend),t.on("finish",onfinish),!1!==o.error&&t.on("error",onerror),t.on("close",onclose),function(){p=!0,t.removeListener("complete",onfinish),t.removeListener("abort",onclose),t.removeListener("request",onrequest),t.req&&t.req.removeListener("finish",onfinish),t.removeListener("end",onlegacyfinish),t.removeListener("close",onlegacyfinish),t.removeListener("finish",onfinish),t.removeListener("exit",onexit),t.removeListener("end",onend),t.removeListener("error",onerror),t.removeListener("close",onclose)}};t.exports=eos}).call(this,o(11))},function(t,i){t.exports=function shift(t){var i=t._readableState;return i?i.objectMode||"number"==typeof t._duplexState?t.read():t.read(function getStateLength(t){if(t.buffer.length)return t.buffer.head?t.buffer.head.data.length:t.buffer[0].length;return t.length}(i)):null}},function(t,i,o){"use strict";(function(i){var a,u,c,h=o(47).Transform,l=o(169),d=!1;t.exports=function buildStream(t,o){if(o.hostname=o.hostname||o.host,!o.hostname)throw new Error("Could not determine host. Specify host manually.");var p="MQIsdp"===o.protocolId&&3===o.protocolVersion?"mqttv3.1":"mqtt";!function setDefaultOpts(t){t.hostname||(t.hostname="localhost"),t.path||(t.path="/"),t.wsOptions||(t.wsOptions={})}(o);var m=function buildUrl(t,i){var o="alis"===t.protocol?"wss":"ws",a=o+"://"+t.hostname+t.path;return t.port&&80!==t.port&&443!==t.port&&(a=o+"://"+t.hostname+":"+t.port+t.path),"function"==typeof t.transformWsUrl&&(a=t.transformWsUrl(a,t,i)),a}(o,t);return(a=o.my).connectSocket({url:m,protocols:p}),u=function buildProxy(){var t=new h;return t._write=function(t,i,o){a.sendSocketMessage({data:t.buffer,success:function(){o()},fail:function(){o(new Error)}})},t._flush=function socketEnd(t){a.closeSocket({success:function(){t()}})},t}(),c=l.obj(),function bindEventHandler(){d||(d=!0,a.onSocketOpen((function(){c.setReadable(u),c.setWritable(u),c.emit("connect")})),a.onSocketMessage((function(t){if("string"==typeof t.data){var o=i.from(t.data,"base64");u.push(o)}else{var a=new FileReader;a.addEventListener("load",(function(){var t=a.result;t=t instanceof ArrayBuffer?i.from(t):i.from(t,"utf8"),u.push(t)})),a.readAsArrayBuffer(t.data)}})),a.onSocketClose((function(){c.end(),c.destroy()})),a.onSocketError((function(t){c.destroy(t)})))}(),c}}).call(this,o(10).Buffer)},function(t,i,o){"use strict";(function(i,a){const u=o(673),c=o(71)("mqttjs:ws"),h=o(169),l=o(47).Transform;let d=["rejectUnauthorized","ca","cert","key","pfx","passphrase"];const p=void 0!==i&&"browser"===i.title||"function"==typeof o;function buildUrl(t,i){let o=t.protocol+"://"+t.hostname+":"+t.port+t.path;return"function"==typeof t.transformWsUrl&&(o=t.transformWsUrl(o,t,i)),o}function setDefaultOpts(t){let i=t;return t.hostname||(i.hostname="localhost"),t.port||("wss"===t.protocol?i.port=443:i.port=80),t.path||(i.path="/"),t.wsOptions||(i.wsOptions={}),p||"wss"!==t.protocol||d.forEach((function(o){t.hasOwnProperty(o)&&!t.wsOptions.hasOwnProperty(o)&&(i.wsOptions[o]=t[o])})),i}t.exports=p?function browserStreamBuilder(t,i){let o;c("browserStreamBuilder");const u=function setDefaultBrowserOpts(t){let i=setDefaultOpts(t);if(i.hostname||(i.hostname=i.host),!i.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");const t=new URL(document.URL);i.hostname=t.hostname,i.port||(i.port=t.port)}return void 0===i.objectMode&&(i.objectMode=!(!0===i.binary||void 0===i.binary)),i}(i).browserBufferSize||524288,d=i.browserBufferTimeout||1e3,p=!i.objectMode;let m=function createBrowserWebSocket(t,i){const o="MQIsdp"===i.protocolId&&3===i.protocolVersion?"mqttv3.1":"mqtt";let a=buildUrl(i,t),u=new WebSocket(a,[o]);return u.binaryType="arraybuffer",u}(t,i),g=function buildProxy(t,i,o){let a=new l({objectModeMode:t.objectMode});return a._write=i,a._flush=o,a}(i,(function socketWriteBrowser(t,i,o){m.bufferedAmount>u&&setTimeout(socketWriteBrowser,d,t,i,o);p&&"string"==typeof t&&(t=a.from(t,"utf8"));try{m.send(t)}catch(t){return o(t)}o()}),(function socketEndBrowser(t){m.close(),t()}));i.objectMode||(g._writev=writev),g.on("close",()=>{m.close()});const v=void 0!==m.addEventListener;function onopen(){o.setReadable(g),o.setWritable(g),o.emit("connect")}function onclose(){o.end(),o.destroy()}function onerror(t){o.destroy(t)}function onmessage(t){let i=t.data;i=i instanceof ArrayBuffer?a.from(i):a.from(i,"utf8"),g.push(i)}function writev(t,i){const o=new Array(t.length);for(let i=0;i<t.length;i++)"string"==typeof t[i].chunk?o[i]=a.from(t[i],"utf8"):o[i]=t[i].chunk;this._write(a.concat(o),"binary",i)}return m.readyState===m.OPEN?o=g:(o=o=h(void 0,void 0,i),i.objectMode||(o._writev=writev),v?m.addEventListener("open",onopen):m.onopen=onopen),o.socket=m,v?(m.addEventListener("close",onclose),m.addEventListener("error",onerror),m.addEventListener("message",onmessage)):(m.onclose=onclose,m.onerror=onerror,m.onmessage=onmessage),o}:function streamBuilder(t,i){c("streamBuilder");let o=setDefaultOpts(i);const a=buildUrl(o,t);let h=function createWebSocket(t,i,o){c("createWebSocket"),c("protocol: "+o.protocolId+" "+o.protocolVersion);const a="MQIsdp"===o.protocolId&&3===o.protocolVersion?"mqttv3.1":"mqtt";return c("creating new Websocket for url: "+i+" and protocol: "+a),new u(i,[a],o.wsOptions)}(0,a,o),l=u.createWebSocketStream(h,o.wsOptions);return l.url=a,h.on("close",()=>{l.destroy()}),l}}).call(this,o(11),o(10).Buffer)},function(t,i,o){"use strict";var a=o(676).Buffer,u=o(47).Transform;function HashBase(t){u.call(this),this._block=a.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}o(1)(HashBase,u),HashBase.prototype._transform=function(t,i,o){var a=null;try{this.update(t,i)}catch(t){a=t}o(a)},HashBase.prototype._flush=function(t){var i=null;try{this.push(this.digest())}catch(t){i=t}t(i)},HashBase.prototype.update=function(t,i){if(function throwIfNotStringOrBuffer(t,i){if(!a.isBuffer(t)&&"string"!=typeof t)throw new TypeError(i+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");a.isBuffer(t)||(t=a.from(t,i));for(var o=this._block,u=0;this._blockOffset+t.length-u>=this._blockSize;){for(var c=this._blockOffset;c<this._blockSize;)o[c++]=t[u++];this._update(),this._blockOffset=0}for(;u<t.length;)o[this._blockOffset++]=t[u++];for(var h=0,l=8*t.length;l>0;++h)this._length[h]+=l,(l=this._length[h]/4294967296|0)>0&&(this._length[h]-=4294967296*l);return this},HashBase.prototype._update=function(){throw new Error("_update is not implemented")},HashBase.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var i=this._digest();void 0!==t&&(i=i.toString(t)),this._block.fill(0),this._blockOffset=0;for(var o=0;o<4;++o)this._length[o]=0;return i},HashBase.prototype._digest=function(){throw new Error("_digest is not implemented")},t.exports=HashBase},function(t,i,o){var a=o(1),u=o(86),c=o(4).Buffer,h=[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],l=new Array(64);function Sha256(){this.init(),this._w=l,u.call(this,64,56)}function ch(t,i,o){return o^t&(i^o)}function maj(t,i,o){return t&i|o&(t|i)}function sigma0(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function sigma1(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function gamma0(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}a(Sha256,u),Sha256.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},Sha256.prototype._update=function(t){for(var i,o=this._w,a=0|this._a,u=0|this._b,c=0|this._c,l=0|this._d,d=0|this._e,p=0|this._f,m=0|this._g,g=0|this._h,v=0;v<16;++v)o[v]=t.readInt32BE(4*v);for(;v<64;++v)o[v]=0|(((i=o[v-2])>>>17|i<<15)^(i>>>19|i<<13)^i>>>10)+o[v-7]+gamma0(o[v-15])+o[v-16];for(var b=0;b<64;++b){var w=g+sigma1(d)+ch(d,p,m)+h[b]+o[b]|0,_=sigma0(a)+maj(a,u,c)|0;g=m,m=p,p=d,d=l+w|0,l=c,c=u,u=a,a=w+_|0}this._a=a+this._a|0,this._b=u+this._b|0,this._c=c+this._c|0,this._d=l+this._d|0,this._e=d+this._e|0,this._f=p+this._f|0,this._g=m+this._g|0,this._h=g+this._h|0},Sha256.prototype._hash=function(){var t=c.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},t.exports=Sha256},function(t,i,o){var a=o(1),u=o(86),c=o(4).Buffer,h=[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=new Array(160);function Sha512(){this.init(),this._w=l,u.call(this,128,112)}function Ch(t,i,o){return o^t&(i^o)}function maj(t,i,o){return t&i|o&(t|i)}function sigma0(t,i){return(t>>>28|i<<4)^(i>>>2|t<<30)^(i>>>7|t<<25)}function sigma1(t,i){return(t>>>14|i<<18)^(t>>>18|i<<14)^(i>>>9|t<<23)}function Gamma0(t,i){return(t>>>1|i<<31)^(t>>>8|i<<24)^t>>>7}function Gamma0l(t,i){return(t>>>1|i<<31)^(t>>>8|i<<24)^(t>>>7|i<<25)}function Gamma1(t,i){return(t>>>19|i<<13)^(i>>>29|t<<3)^t>>>6}function Gamma1l(t,i){return(t>>>19|i<<13)^(i>>>29|t<<3)^(t>>>6|i<<26)}function getCarry(t,i){return t>>>0<i>>>0?1:0}a(Sha512,u),Sha512.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},Sha512.prototype._update=function(t){for(var i=this._w,o=0|this._ah,a=0|this._bh,u=0|this._ch,c=0|this._dh,l=0|this._eh,d=0|this._fh,p=0|this._gh,m=0|this._hh,g=0|this._al,v=0|this._bl,b=0|this._cl,w=0|this._dl,_=0|this._el,M=0|this._fl,k=0|this._gl,B=0|this._hl,P=0;P<32;P+=2)i[P]=t.readInt32BE(4*P),i[P+1]=t.readInt32BE(4*P+4);for(;P<160;P+=2){var x=i[P-30],I=i[P-30+1],N=Gamma0(x,I),A=Gamma0l(I,x),C=Gamma1(x=i[P-4],I=i[P-4+1]),O=Gamma1l(I,x),j=i[P-14],L=i[P-14+1],q=i[P-32],U=i[P-32+1],z=A+L|0,H=N+j+getCarry(z,A)|0;H=(H=H+C+getCarry(z=z+O|0,O)|0)+q+getCarry(z=z+U|0,U)|0,i[P]=H,i[P+1]=z}for(var W=0;W<160;W+=2){H=i[W],z=i[W+1];var V=maj(o,a,u),G=maj(g,v,b),J=sigma0(o,g),$=sigma0(g,o),Z=sigma1(l,_),Y=sigma1(_,l),X=h[W],Q=h[W+1],ee=Ch(l,d,p),te=Ch(_,M,k),re=B+Y|0,ne=m+Z+getCarry(re,B)|0;ne=(ne=(ne=ne+ee+getCarry(re=re+te|0,te)|0)+X+getCarry(re=re+Q|0,Q)|0)+H+getCarry(re=re+z|0,z)|0;var ie=$+G|0,oe=J+V+getCarry(ie,$)|0;m=p,B=k,p=d,k=M,d=l,M=_,l=c+ne+getCarry(_=w+re|0,w)|0,c=u,w=b,u=a,b=v,a=o,v=g,o=ne+oe+getCarry(g=re+ie|0,re)|0}this._al=this._al+g|0,this._bl=this._bl+v|0,this._cl=this._cl+b|0,this._dl=this._dl+w|0,this._el=this._el+_|0,this._fl=this._fl+M|0,this._gl=this._gl+k|0,this._hl=this._hl+B|0,this._ah=this._ah+o+getCarry(this._al,g)|0,this._bh=this._bh+a+getCarry(this._bl,v)|0,this._ch=this._ch+u+getCarry(this._cl,b)|0,this._dh=this._dh+c+getCarry(this._dl,w)|0,this._eh=this._eh+l+getCarry(this._el,_)|0,this._fh=this._fh+d+getCarry(this._fl,M)|0,this._gh=this._gh+p+getCarry(this._gl,k)|0,this._hh=this._hh+m+getCarry(this._hl,B)|0},Sha512.prototype._hash=function(){var t=c.allocUnsafe(64);function writeInt64BE(i,o,a){t.writeInt32BE(i,a),t.writeInt32BE(o,a+4)}return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),writeInt64BE(this._gh,this._gl,48),writeInt64BE(this._hh,this._hl,56),t},t.exports=Sha512},function(t,i,o){"use strict";(function(i,a){var u=o(48);t.exports=Readable;var c,h=o(136);Readable.ReadableState=ReadableState;o(31).EventEmitter;var EElistenerCount=function(t,i){return t.listeners(i).length},l=o(273),d=o(4).Buffer,p=i.Uint8Array||function(){};var m=Object.create(o(41));m.inherits=o(1);var g=o(682),v=void 0;v=g&&g.debuglog?g.debuglog("stream"):function(){};var b,w=o(683),_=o(274);m.inherits(Readable,l);var M=["error","close","destroy","pause","resume"];function ReadableState(t,i){t=t||{};var a=i instanceof(c=c||o(72));this.objectMode=!!t.objectMode,a&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var u=t.highWaterMark,h=t.readableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=u||0===u?u:a&&(h||0===h)?h:l,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new w,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(b||(b=o(70).StringDecoder),this.decoder=new b(t.encoding),this.encoding=t.encoding)}function Readable(t){if(c=c||o(72),!(this instanceof Readable))return new Readable(t);this._readableState=new ReadableState(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),l.call(this)}function readableAddChunk(t,i,o,a,u){var c,h=t._readableState;null===i?(h.reading=!1,function onEofChunk(t,i){if(i.ended)return;if(i.decoder){var o=i.decoder.end();o&&o.length&&(i.buffer.push(o),i.length+=i.objectMode?1:o.length)}i.ended=!0,emitReadable(t)}(t,h)):(u||(c=function chunkInvalid(t,i){var o;(function _isUint8Array(t){return d.isBuffer(t)||t instanceof p})(i)||"string"==typeof i||void 0===i||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk"));return o}(h,i)),c?t.emit("error",c):h.objectMode||i&&i.length>0?("string"==typeof i||h.objectMode||Object.getPrototypeOf(i)===d.prototype||(i=function _uint8ArrayToBuffer(t){return d.from(t)}(i)),a?h.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):addChunk(t,h,i,!0):h.ended?t.emit("error",new Error("stream.push() after EOF")):(h.reading=!1,h.decoder&&!o?(i=h.decoder.write(i),h.objectMode||0!==i.length?addChunk(t,h,i,!1):maybeReadMore(t,h)):addChunk(t,h,i,!1))):a||(h.reading=!1));return function needMoreData(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(h)}function addChunk(t,i,o,a){i.flowing&&0===i.length&&!i.sync?(t.emit("data",o),t.read(0)):(i.length+=i.objectMode?1:o.length,a?i.buffer.unshift(o):i.buffer.push(o),i.needReadable&&emitReadable(t)),maybeReadMore(t,i)}Object.defineProperty(Readable.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),Readable.prototype.destroy=_.destroy,Readable.prototype._undestroy=_.undestroy,Readable.prototype._destroy=function(t,i){this.push(null),i(t)},Readable.prototype.push=function(t,i){var o,a=this._readableState;return a.objectMode?o=!0:"string"==typeof t&&((i=i||a.defaultEncoding)!==a.encoding&&(t=d.from(t,i),i=""),o=!0),readableAddChunk(this,t,i,!1,o)},Readable.prototype.unshift=function(t){return readableAddChunk(this,t,null,!0,!1)},Readable.prototype.isPaused=function(){return!1===this._readableState.flowing},Readable.prototype.setEncoding=function(t){return b||(b=o(70).StringDecoder),this._readableState.decoder=new b(t),this._readableState.encoding=t,this};function howMuchToRead(t,i){return t<=0||0===i.length&&i.ended?0:i.objectMode?1:t!=t?i.flowing&&i.length?i.buffer.head.data.length:i.length:(t>i.highWaterMark&&(i.highWaterMark=function computeNewHighWaterMark(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=i.length?t:i.ended?i.length:(i.needReadable=!0,0))}function emitReadable(t){var i=t._readableState;i.needReadable=!1,i.emittedReadable||(v("emitReadable",i.flowing),i.emittedReadable=!0,i.sync?u.nextTick(emitReadable_,t):emitReadable_(t))}function emitReadable_(t){v("emit readable"),t.emit("readable"),flow(t)}function maybeReadMore(t,i){i.readingMore||(i.readingMore=!0,u.nextTick(maybeReadMore_,t,i))}function maybeReadMore_(t,i){for(var o=i.length;!i.reading&&!i.flowing&&!i.ended&&i.length<i.highWaterMark&&(v("maybeReadMore read 0"),t.read(0),o!==i.length);)o=i.length;i.readingMore=!1}function nReadingNextTick(t){v("readable nexttick read 0"),t.read(0)}function resume_(t,i){i.reading||(v("resume read 0"),t.read(0)),i.resumeScheduled=!1,i.awaitDrain=0,t.emit("resume"),flow(t),i.flowing&&!i.reading&&t.read(0)}function flow(t){var i=t._readableState;for(v("flow",i.flowing);i.flowing&&null!==t.read(););}function fromList(t,i){return 0===i.length?null:(i.objectMode?o=i.buffer.shift():!t||t>=i.length?(o=i.decoder?i.buffer.join(""):1===i.buffer.length?i.buffer.head.data:i.buffer.concat(i.length),i.buffer.clear()):o=function fromListPartial(t,i,o){var a;t<i.head.data.length?(a=i.head.data.slice(0,t),i.head.data=i.head.data.slice(t)):a=t===i.head.data.length?i.shift():o?function copyFromBufferString(t,i){var o=i.head,a=1,u=o.data;t-=u.length;for(;o=o.next;){var c=o.data,h=t>c.length?c.length:t;if(h===c.length?u+=c:u+=c.slice(0,t),0===(t-=h)){h===c.length?(++a,o.next?i.head=o.next:i.head=i.tail=null):(i.head=o,o.data=c.slice(h));break}++a}return i.length-=a,u}(t,i):function copyFromBuffer(t,i){var o=d.allocUnsafe(t),a=i.head,u=1;a.data.copy(o),t-=a.data.length;for(;a=a.next;){var c=a.data,h=t>c.length?c.length:t;if(c.copy(o,o.length-t,0,h),0===(t-=h)){h===c.length?(++u,a.next?i.head=a.next:i.head=i.tail=null):(i.head=a,a.data=c.slice(h));break}++u}return i.length-=u,o}(t,i);return a}(t,i.buffer,i.decoder),o);var o}function endReadable(t){var i=t._readableState;if(i.length>0)throw new Error('"endReadable()" called on non-empty stream');i.endEmitted||(i.ended=!0,u.nextTick(endReadableNT,i,t))}function endReadableNT(t,i){t.endEmitted||0!==t.length||(t.endEmitted=!0,i.readable=!1,i.emit("end"))}function indexOf(t,i){for(var o=0,a=t.length;o<a;o++)if(t[o]===i)return o;return-1}Readable.prototype.read=function(t){v("read",t),t=parseInt(t,10);var i=this._readableState,o=t;if(0!==t&&(i.emittedReadable=!1),0===t&&i.needReadable&&(i.length>=i.highWaterMark||i.ended))return v("read: emitReadable",i.length,i.ended),0===i.length&&i.ended?endReadable(this):emitReadable(this),null;if(0===(t=howMuchToRead(t,i))&&i.ended)return 0===i.length&&endReadable(this),null;var a,u=i.needReadable;return v("need readable",u),(0===i.length||i.length-t<i.highWaterMark)&&v("length less than watermark",u=!0),i.ended||i.reading?v("reading or ended",u=!1):u&&(v("do read"),i.reading=!0,i.sync=!0,0===i.length&&(i.needReadable=!0),this._read(i.highWaterMark),i.sync=!1,i.reading||(t=howMuchToRead(o,i))),null===(a=t>0?fromList(t,i):null)?(i.needReadable=!0,t=0):i.length-=t,0===i.length&&(i.ended||(i.needReadable=!0),o!==t&&i.ended&&endReadable(this)),null!==a&&this.emit("data",a),a},Readable.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},Readable.prototype.pipe=function(t,i){var o=this,c=this._readableState;switch(c.pipesCount){case 0:c.pipes=t;break;case 1:c.pipes=[c.pipes,t];break;default:c.pipes.push(t)}c.pipesCount+=1,v("pipe count=%d opts=%j",c.pipesCount,i);var l=(!i||!1!==i.end)&&t!==a.stdout&&t!==a.stderr?onend:unpipe;function onunpipe(i,a){v("onunpipe"),i===o&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,function cleanup(){v("cleanup"),t.removeListener("close",onclose),t.removeListener("finish",onfinish),t.removeListener("drain",d),t.removeListener("error",onerror),t.removeListener("unpipe",onunpipe),o.removeListener("end",onend),o.removeListener("end",unpipe),o.removeListener("data",ondata),p=!0,!c.awaitDrain||t._writableState&&!t._writableState.needDrain||d()}())}function onend(){v("onend"),t.end()}c.endEmitted?u.nextTick(l):o.once("end",l),t.on("unpipe",onunpipe);var d=function pipeOnDrain(t){return function(){var i=t._readableState;v("pipeOnDrain",i.awaitDrain),i.awaitDrain&&i.awaitDrain--,0===i.awaitDrain&&EElistenerCount(t,"data")&&(i.flowing=!0,flow(t))}}(o);t.on("drain",d);var p=!1;var m=!1;function ondata(i){v("ondata"),m=!1,!1!==t.write(i)||m||((1===c.pipesCount&&c.pipes===t||c.pipesCount>1&&-1!==indexOf(c.pipes,t))&&!p&&(v("false write response, pause",o._readableState.awaitDrain),o._readableState.awaitDrain++,m=!0),o.pause())}function onerror(i){v("onerror",i),unpipe(),t.removeListener("error",onerror),0===EElistenerCount(t,"error")&&t.emit("error",i)}function onclose(){t.removeListener("finish",onfinish),unpipe()}function onfinish(){v("onfinish"),t.removeListener("close",onclose),unpipe()}function unpipe(){v("unpipe"),o.unpipe(t)}return o.on("data",ondata),function prependListener(t,i,o){if("function"==typeof t.prependListener)return t.prependListener(i,o);t._events&&t._events[i]?h(t._events[i])?t._events[i].unshift(o):t._events[i]=[o,t._events[i]]:t.on(i,o)}(t,"error",onerror),t.once("close",onclose),t.once("finish",onfinish),t.emit("pipe",o),c.flowing||(v("pipe resume"),o.resume()),t},Readable.prototype.unpipe=function(t){var i=this._readableState,o={hasUnpiped:!1};if(0===i.pipesCount)return this;if(1===i.pipesCount)return t&&t!==i.pipes||(t||(t=i.pipes),i.pipes=null,i.pipesCount=0,i.flowing=!1,t&&t.emit("unpipe",this,o)),this;if(!t){var a=i.pipes,u=i.pipesCount;i.pipes=null,i.pipesCount=0,i.flowing=!1;for(var c=0;c<u;c++)a[c].emit("unpipe",this,o);return this}var h=indexOf(i.pipes,t);return-1===h||(i.pipes.splice(h,1),i.pipesCount-=1,1===i.pipesCount&&(i.pipes=i.pipes[0]),t.emit("unpipe",this,o)),this},Readable.prototype.on=function(t,i){var o=l.prototype.on.call(this,t,i);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var a=this._readableState;a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.emittedReadable=!1,a.reading?a.length&&emitReadable(this):u.nextTick(nReadingNextTick,this))}return o},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.resume=function(){var t=this._readableState;return t.flowing||(v("resume"),t.flowing=!0,function resume(t,i){i.resumeScheduled||(i.resumeScheduled=!0,u.nextTick(resume_,t,i))}(this,t)),this},Readable.prototype.pause=function(){return v("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(v("pause"),this._readableState.flowing=!1,this.emit("pause")),this},Readable.prototype.wrap=function(t){var i=this,o=this._readableState,a=!1;for(var u in t.on("end",(function(){if(v("wrapped end"),o.decoder&&!o.ended){var t=o.decoder.end();t&&t.length&&i.push(t)}i.push(null)})),t.on("data",(function(u){(v("wrapped data"),o.decoder&&(u=o.decoder.write(u)),o.objectMode&&null==u)||(o.objectMode||u&&u.length)&&(i.push(u)||(a=!0,t.pause()))})),t)void 0===this[u]&&"function"==typeof t[u]&&(this[u]=function(i){return function(){return t[i].apply(t,arguments)}}(u));for(var c=0;c<M.length;c++)t.on(M[c],this.emit.bind(this,M[c]));return this._read=function(i){v("wrapped _read",i),a&&(a=!1,t.resume())},this},Object.defineProperty(Readable.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Readable._fromList=fromList}).call(this,o(17),o(11))},function(t,i,o){t.exports=o(31).EventEmitter},function(t,i,o){"use strict";var a=o(48);function emitErrorNT(t,i){t.emit("error",i)}t.exports={destroy:function destroy(t,i){var o=this,u=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return u||c?(i?i(t):!t||this._writableState&&this._writableState.errorEmitted||a.nextTick(emitErrorNT,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!i&&t?(a.nextTick(emitErrorNT,o,t),o._writableState&&(o._writableState.errorEmitted=!0)):i&&i(t)})),this)},undestroy:function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,i,o){(function(t){var a=void 0!==t&&t||"undefined"!=typeof self&&self||window,u=Function.prototype.apply;function Timeout(t,i){this._id=t,this._clearFn=i}i.setTimeout=function(){return new Timeout(u.call(setTimeout,a,arguments),clearTimeout)},i.setInterval=function(){return new Timeout(u.call(setInterval,a,arguments),clearInterval)},i.clearTimeout=i.clearInterval=function(t){t&&t.close()},Timeout.prototype.unref=Timeout.prototype.ref=function(){},Timeout.prototype.close=function(){this._clearFn.call(a,this._id)},i.enroll=function(t,i){clearTimeout(t._idleTimeoutId),t._idleTimeout=i},i.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},i._unrefActive=i.active=function(t){clearTimeout(t._idleTimeoutId);var i=t._idleTimeout;i>=0&&(t._idleTimeoutId=setTimeout((function onTimeout(){t._onTimeout&&t._onTimeout()}),i))},o(685),i.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,i.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,o(17))},function(t,i,o){"use strict";t.exports=Transform;var a=o(72),u=Object.create(o(41));function afterTransform(t,i){var o=this._transformState;o.transforming=!1;var a=o.writecb;if(!a)return this.emit("error",new Error("write callback called multiple times"));o.writechunk=null,o.writecb=null,null!=i&&this.push(i),a(t);var u=this._readableState;u.reading=!1,(u.needReadable||u.length<u.highWaterMark)&&this._read(u.highWaterMark)}function Transform(t){if(!(this instanceof Transform))return new Transform(t);a.call(this,t),this._transformState={afterTransform:afterTransform.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",prefinish)}function prefinish(){var t=this;"function"==typeof this._flush?this._flush((function(i,o){done(t,i,o)})):done(this,null,null)}function done(t,i,o){if(i)return t.emit("error",i);if(null!=o&&t.push(o),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}u.inherits=o(1),u.inherits(Transform,a),Transform.prototype.push=function(t,i){return this._transformState.needTransform=!1,a.prototype.push.call(this,t,i)},Transform.prototype._transform=function(t,i,o){throw new Error("_transform() is not implemented")},Transform.prototype._write=function(t,i,o){var a=this._transformState;if(a.writecb=o,a.writechunk=t,a.writeencoding=i,!a.transforming){var u=this._readableState;(a.needTransform||u.needReadable||u.length<u.highWaterMark)&&this._read(u.highWaterMark)}},Transform.prototype._read=function(t){var i=this._transformState;null!==i.writechunk&&i.writecb&&!i.transforming?(i.transforming=!0,this._transform(i.writechunk,i.writeencoding,i.afterTransform)):i.needTransform=!0},Transform.prototype._destroy=function(t,i){var o=this;a.prototype._destroy.call(this,t,(function(t){i(t),o.emit("close")}))}},function(t,i,o){"use strict";var a=o(1),u=o(691),c=o(62),h=o(4).Buffer,l=o(278),d=o(172),p=o(173),m=h.alloc(128);function Hmac(t,i){c.call(this,"digest"),"string"==typeof i&&(i=h.from(i));var o="sha512"===t||"sha384"===t?128:64;(this._alg=t,this._key=i,i.length>o)?i=("rmd160"===t?new d:p(t)).update(i).digest():i.length<o&&(i=h.concat([i,m],o));for(var a=this._ipad=h.allocUnsafe(o),u=this._opad=h.allocUnsafe(o),l=0;l<o;l++)a[l]=54^i[l],u[l]=92^i[l];this._hash="rmd160"===t?new d:p(t),this._hash.update(a)}a(Hmac,c),Hmac.prototype._update=function(t){this._hash.update(t)},Hmac.prototype._final=function(){var t=this._hash.digest();return("rmd160"===this._alg?new d:p(this._alg)).update(this._opad).update(t).digest()},t.exports=function createHmac(t,i){return"rmd160"===(t=t.toLowerCase())||"ripemd160"===t?new Hmac("rmd160",i):"md5"===t?new u(l,i):new Hmac(t,i)}},function(t,i,o){var a=o(171);t.exports=function(t){return(new a).update(t).digest()}},function(t){t.exports=JSON.parse('{"sha224WithRSAEncryption":{"sign":"rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"RSA-SHA224":{"sign":"ecdsa/rsa","hash":"sha224","id":"302d300d06096086480165030402040500041c"},"sha256WithRSAEncryption":{"sign":"rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"RSA-SHA256":{"sign":"ecdsa/rsa","hash":"sha256","id":"3031300d060960864801650304020105000420"},"sha384WithRSAEncryption":{"sign":"rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"RSA-SHA384":{"sign":"ecdsa/rsa","hash":"sha384","id":"3041300d060960864801650304020205000430"},"sha512WithRSAEncryption":{"sign":"rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA512":{"sign":"ecdsa/rsa","hash":"sha512","id":"3051300d060960864801650304020305000440"},"RSA-SHA1":{"sign":"rsa","hash":"sha1","id":"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{"sign":"ecdsa","hash":"sha1","id":""},"sha256":{"sign":"ecdsa","hash":"sha256","id":""},"sha224":{"sign":"ecdsa","hash":"sha224","id":""},"sha384":{"sign":"ecdsa","hash":"sha384","id":""},"sha512":{"sign":"ecdsa","hash":"sha512","id":""},"DSA-SHA":{"sign":"dsa","hash":"sha1","id":""},"DSA-SHA1":{"sign":"dsa","hash":"sha1","id":""},"DSA":{"sign":"dsa","hash":"sha1","id":""},"DSA-WITH-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-SHA224":{"sign":"dsa","hash":"sha224","id":""},"DSA-WITH-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-SHA256":{"sign":"dsa","hash":"sha256","id":""},"DSA-WITH-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-SHA384":{"sign":"dsa","hash":"sha384","id":""},"DSA-WITH-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-SHA512":{"sign":"dsa","hash":"sha512","id":""},"DSA-RIPEMD160":{"sign":"dsa","hash":"rmd160","id":""},"ripemd160WithRSA":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"RSA-RIPEMD160":{"sign":"rsa","hash":"rmd160","id":"3021300906052b2403020105000414"},"md5WithRSAEncryption":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"},"RSA-MD5":{"sign":"rsa","hash":"md5","id":"3020300c06082a864886f70d020505000410"}}')},function(t,i,o){i.pbkdf2=o(693),i.pbkdf2Sync=o(283)},function(t,i){var o=Math.pow(2,30)-1;t.exports=function(t,i){if("number"!=typeof t)throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if("number"!=typeof i)throw new TypeError("Key length not a number");if(i<0||i>o||i!=i)throw new TypeError("Bad key length")}},function(t,i,o){(function(i,o){var a;if(i.process&&i.process.browser)a="utf-8";else if(i.process&&i.process.version){a=parseInt(o.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary"}else a="utf-8";t.exports=a}).call(this,o(17),o(11))},function(t,i,o){var a=o(278),u=o(172),c=o(173),h=o(4).Buffer,l=o(281),d=o(282),p=o(284),m=h.alloc(128),g={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Hmac(t,i,o){var l=function getDigest(t){function shaFunc(i){return c(t).update(i).digest()}return"rmd160"===t||"ripemd160"===t?function rmd160Func(t){return(new u).update(t).digest()}:"md5"===t?a:shaFunc}(t),d="sha512"===t||"sha384"===t?128:64;i.length>d?i=l(i):i.length<d&&(i=h.concat([i,m],d));for(var p=h.allocUnsafe(d+g[t]),v=h.allocUnsafe(d+g[t]),b=0;b<d;b++)p[b]=54^i[b],v[b]=92^i[b];var w=h.allocUnsafe(d+o+4);p.copy(w,0,0,d),this.ipad1=w,this.ipad2=p,this.opad=v,this.alg=t,this.blocksize=d,this.hash=l,this.size=g[t]}Hmac.prototype.run=function(t,i){return t.copy(i,this.blocksize),this.hash(i).copy(this.opad,this.blocksize),this.hash(this.opad)},t.exports=function pbkdf2(t,i,o,a,u){l(o,a);var c=new Hmac(u=u||"sha1",t=p(t,d,"Password"),(i=p(i,d,"Salt")).length),m=h.allocUnsafe(a),v=h.allocUnsafe(i.length+4);i.copy(v,0,0,i.length);for(var b=0,w=g[u],_=Math.ceil(a/w),M=1;M<=_;M++){v.writeUInt32BE(M,i.length);for(var k=c.run(v,c.ipad1),B=k,P=1;P<o;P++){B=c.run(B,c.ipad2);for(var x=0;x<w;x++)k[x]^=B[x]}k.copy(m,b),b+=w}return m}},function(t,i,o){var a=o(4).Buffer;t.exports=function(t,i,o){if(a.isBuffer(t))return t;if("string"==typeof t)return a.from(t,i);if(ArrayBuffer.isView(t))return a.from(t.buffer);throw new TypeError(o+" must be a string, a Buffer, a typed array or a DataView")}},function(t,i,o){"use strict";i.readUInt32BE=function readUInt32BE(t,i){return(t[0+i]<<24|t[1+i]<<16|t[2+i]<<8|t[3+i])>>>0},i.writeUInt32BE=function writeUInt32BE(t,i,o){t[0+o]=i>>>24,t[1+o]=i>>>16&255,t[2+o]=i>>>8&255,t[3+o]=255&i},i.ip=function ip(t,i,o,a){for(var u=0,c=0,h=6;h>=0;h-=2){for(var l=0;l<=24;l+=8)u<<=1,u|=i>>>l+h&1;for(l=0;l<=24;l+=8)u<<=1,u|=t>>>l+h&1}for(h=6;h>=0;h-=2){for(l=1;l<=25;l+=8)c<<=1,c|=i>>>l+h&1;for(l=1;l<=25;l+=8)c<<=1,c|=t>>>l+h&1}o[a+0]=u>>>0,o[a+1]=c>>>0},i.rip=function rip(t,i,o,a){for(var u=0,c=0,h=0;h<4;h++)for(var l=24;l>=0;l-=8)u<<=1,u|=i>>>l+h&1,u<<=1,u|=t>>>l+h&1;for(h=4;h<8;h++)for(l=24;l>=0;l-=8)c<<=1,c|=i>>>l+h&1,c<<=1,c|=t>>>l+h&1;o[a+0]=u>>>0,o[a+1]=c>>>0},i.pc1=function pc1(t,i,o,a){for(var u=0,c=0,h=7;h>=5;h--){for(var l=0;l<=24;l+=8)u<<=1,u|=i>>l+h&1;for(l=0;l<=24;l+=8)u<<=1,u|=t>>l+h&1}for(l=0;l<=24;l+=8)u<<=1,u|=i>>l+h&1;for(h=1;h<=3;h++){for(l=0;l<=24;l+=8)c<<=1,c|=i>>l+h&1;for(l=0;l<=24;l+=8)c<<=1,c|=t>>l+h&1}for(l=0;l<=24;l+=8)c<<=1,c|=t>>l+h&1;o[a+0]=u>>>0,o[a+1]=c>>>0},i.r28shl=function r28shl(t,i){return t<<i&268435455|t>>>28-i};var a=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];i.pc2=function pc2(t,i,o,u){for(var c=0,h=0,l=a.length>>>1,d=0;d<l;d++)c<<=1,c|=t>>>a[d]&1;for(d=l;d<a.length;d++)h<<=1,h|=i>>>a[d]&1;o[u+0]=c>>>0,o[u+1]=h>>>0},i.expand=function expand(t,i,o){var a=0,u=0;a=(1&t)<<5|t>>>27;for(var c=23;c>=15;c-=4)a<<=6,a|=t>>>c&63;for(c=11;c>=3;c-=4)u|=t>>>c&63,u<<=6;u|=(31&t)<<1|t>>>31,i[o+0]=a>>>0,i[o+1]=u>>>0};var u=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];i.substitute=function substitute(t,i){for(var o=0,a=0;a<4;a++){o<<=4,o|=u[64*a+(t>>>18-6*a&63)]}for(a=0;a<4;a++){o<<=4,o|=u[256+64*a+(i>>>18-6*a&63)]}return o>>>0};var c=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];i.permute=function permute(t){for(var i=0,o=0;o<c.length;o++)i<<=1,i|=t>>>c[o]&1;return i>>>0},i.padSplit=function padSplit(t,i,o){for(var a=t.toString(2);a.length<i;)a="0"+a;for(var u=[],c=0;c<i;c+=o)u.push(a.slice(c,c+o));return u.join(" ")}},function(t,i,o){"use strict";var a=o(35),u=o(1),c=o(285),h=o(176);function DESState(){this.tmp=new Array(2),this.keys=null}function DES(t){h.call(this,t);var i=new DESState;this._desState=i,this.deriveKeys(i,t.key)}u(DES,h),t.exports=DES,DES.create=function create(t){return new DES(t)};var l=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];DES.prototype.deriveKeys=function deriveKeys(t,i){t.keys=new Array(32),a.equal(i.length,this.blockSize,"Invalid key length");var o=c.readUInt32BE(i,0),u=c.readUInt32BE(i,4);c.pc1(o,u,t.tmp,0),o=t.tmp[0],u=t.tmp[1];for(var h=0;h<t.keys.length;h+=2){var d=l[h>>>1];o=c.r28shl(o,d),u=c.r28shl(u,d),c.pc2(o,u,t.keys,h)}},DES.prototype._update=function _update(t,i,o,a){var u=this._desState,h=c.readUInt32BE(t,i),l=c.readUInt32BE(t,i+4);c.ip(h,l,u.tmp,0),h=u.tmp[0],l=u.tmp[1],"encrypt"===this.type?this._encrypt(u,h,l,u.tmp,0):this._decrypt(u,h,l,u.tmp,0),h=u.tmp[0],l=u.tmp[1],c.writeUInt32BE(o,h,a),c.writeUInt32BE(o,l,a+4)},DES.prototype._pad=function _pad(t,i){for(var o=t.length-i,a=i;a<t.length;a++)t[a]=o;return!0},DES.prototype._unpad=function _unpad(t){for(var i=t[t.length-1],o=t.length-i;o<t.length;o++)a.equal(t[o],i);return t.slice(0,t.length-i)},DES.prototype._encrypt=function _encrypt(t,i,o,a,u){for(var h=i,l=o,d=0;d<t.keys.length;d+=2){var p=t.keys[d],m=t.keys[d+1];c.expand(l,t.tmp,0),p^=t.tmp[0],m^=t.tmp[1];var g=c.substitute(p,m),v=l;l=(h^c.permute(g))>>>0,h=v}c.rip(l,h,a,u)},DES.prototype._decrypt=function _decrypt(t,i,o,a,u){for(var h=o,l=i,d=t.keys.length-2;d>=0;d-=2){var p=t.keys[d],m=t.keys[d+1];c.expand(h,t.tmp,0),p^=t.tmp[0],m^=t.tmp[1];var g=c.substitute(p,m),v=h;h=(l^c.permute(g))>>>0,l=v}c.rip(h,l,a,u)}},function(t,i,o){var a=o(99),u=o(4).Buffer,c=o(288);function getBlock(t){var i=t._cipher.encryptBlockRaw(t._prev);return c(t._prev),i}i.encrypt=function(t,i){var o=Math.ceil(i.length/16),c=t._cache.length;t._cache=u.concat([t._cache,u.allocUnsafe(16*o)]);for(var h=0;h<o;h++){var l=getBlock(t),d=c+16*h;t._cache.writeUInt32BE(l[0],d+0),t._cache.writeUInt32BE(l[1],d+4),t._cache.writeUInt32BE(l[2],d+8),t._cache.writeUInt32BE(l[3],d+12)}var p=t._cache.slice(0,i.length);return t._cache=t._cache.slice(i.length),a(i,p)}},function(t,i){t.exports=function incr32(t){for(var i,o=t.length;o--;){if(255!==(i=t.readUInt8(o))){i++,t.writeUInt8(i,o);break}t.writeUInt8(0,o)}}},function(t){t.exports=JSON.parse('{"aes-128-ecb":{"cipher":"AES","key":128,"iv":0,"mode":"ECB","type":"block"},"aes-192-ecb":{"cipher":"AES","key":192,"iv":0,"mode":"ECB","type":"block"},"aes-256-ecb":{"cipher":"AES","key":256,"iv":0,"mode":"ECB","type":"block"},"aes-128-cbc":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes-192-cbc":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes-256-cbc":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes128":{"cipher":"AES","key":128,"iv":16,"mode":"CBC","type":"block"},"aes192":{"cipher":"AES","key":192,"iv":16,"mode":"CBC","type":"block"},"aes256":{"cipher":"AES","key":256,"iv":16,"mode":"CBC","type":"block"},"aes-128-cfb":{"cipher":"AES","key":128,"iv":16,"mode":"CFB","type":"stream"},"aes-192-cfb":{"cipher":"AES","key":192,"iv":16,"mode":"CFB","type":"stream"},"aes-256-cfb":{"cipher":"AES","key":256,"iv":16,"mode":"CFB","type":"stream"},"aes-128-cfb8":{"cipher":"AES","key":128,"iv":16,"mode":"CFB8","type":"stream"},"aes-192-cfb8":{"cipher":"AES","key":192,"iv":16,"mode":"CFB8","type":"stream"},"aes-256-cfb8":{"cipher":"AES","key":256,"iv":16,"mode":"CFB8","type":"stream"},"aes-128-cfb1":{"cipher":"AES","key":128,"iv":16,"mode":"CFB1","type":"stream"},"aes-192-cfb1":{"cipher":"AES","key":192,"iv":16,"mode":"CFB1","type":"stream"},"aes-256-cfb1":{"cipher":"AES","key":256,"iv":16,"mode":"CFB1","type":"stream"},"aes-128-ofb":{"cipher":"AES","key":128,"iv":16,"mode":"OFB","type":"stream"},"aes-192-ofb":{"cipher":"AES","key":192,"iv":16,"mode":"OFB","type":"stream"},"aes-256-ofb":{"cipher":"AES","key":256,"iv":16,"mode":"OFB","type":"stream"},"aes-128-ctr":{"cipher":"AES","key":128,"iv":16,"mode":"CTR","type":"stream"},"aes-192-ctr":{"cipher":"AES","key":192,"iv":16,"mode":"CTR","type":"stream"},"aes-256-ctr":{"cipher":"AES","key":256,"iv":16,"mode":"CTR","type":"stream"},"aes-128-gcm":{"cipher":"AES","key":128,"iv":12,"mode":"GCM","type":"auth"},"aes-192-gcm":{"cipher":"AES","key":192,"iv":12,"mode":"GCM","type":"auth"},"aes-256-gcm":{"cipher":"AES","key":256,"iv":12,"mode":"GCM","type":"auth"}}')},function(t,i,o){var a=o(126),u=o(4).Buffer,c=o(62),h=o(1),l=o(706),d=o(99),p=o(288);function StreamCipher(t,i,o,h){c.call(this);var d=u.alloc(4,0);this._cipher=new a.AES(i);var m=this._cipher.encryptBlock(d);this._ghash=new l(m),o=function calcIv(t,i,o){if(12===i.length)return t._finID=u.concat([i,u.from([0,0,0,1])]),u.concat([i,u.from([0,0,0,2])]);var a=new l(o),c=i.length,h=c%16;a.update(i),h&&(h=16-h,a.update(u.alloc(h,0))),a.update(u.alloc(8,0));var d=8*c,m=u.alloc(8);m.writeUIntBE(d,0,8),a.update(m),t._finID=a.state;var g=u.from(t._finID);return p(g),g}(this,o,m),this._prev=u.from(o),this._cache=u.allocUnsafe(0),this._secCache=u.allocUnsafe(0),this._decrypt=h,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}h(StreamCipher,c),StreamCipher.prototype._update=function(t){if(!this._called&&this._alen){var i=16-this._alen%16;i<16&&(i=u.alloc(i,0),this._ghash.update(i))}this._called=!0;var o=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(o),this._len+=t.length,o},StreamCipher.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=d(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function xorTest(t,i){var o=0;t.length!==i.length&&o++;for(var a=Math.min(t.length,i.length),u=0;u<a;++u)o+=t[u]^i[u];return o}(t,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=t,this._cipher.scrub()},StreamCipher.prototype.getAuthTag=function getAuthTag(){if(this._decrypt||!u.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},StreamCipher.prototype.setAuthTag=function setAuthTag(t){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=t},StreamCipher.prototype.setAAD=function setAAD(t){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(t),this._alen+=t.length},t.exports=StreamCipher},function(t,i,o){var a=o(126),u=o(4).Buffer,c=o(62);function StreamCipher(t,i,o,h){c.call(this),this._cipher=new a.AES(i),this._prev=u.from(o),this._cache=u.allocUnsafe(0),this._secCache=u.allocUnsafe(0),this._decrypt=h,this._mode=t}o(1)(StreamCipher,c),StreamCipher.prototype._update=function(t){return this._mode.encrypt(this,t,this._decrypt)},StreamCipher.prototype._final=function(){this._cipher.scrub()},t.exports=StreamCipher},function(t,i,o){var a=o(85);t.exports=findPrime,findPrime.simpleSieve=simpleSieve,findPrime.fermatTest=fermatTest;var u=o(293),c=new u(24),h=new(o(294)),l=new u(1),d=new u(2),p=new u(5),m=(new u(16),new u(8),new u(10)),g=new u(3),v=(new u(7),new u(11)),b=new u(4),w=(new u(12),null);function _getPrimes(){if(null!==w)return w;var t=[];t[0]=2;for(var i=1,o=3;o<1048576;o+=2){for(var a=Math.ceil(Math.sqrt(o)),u=0;u<i&&t[u]<=a&&o%t[u]!=0;u++);i!==u&&t[u]<=a||(t[i++]=o)}return w=t,t}function simpleSieve(t){for(var i=_getPrimes(),o=0;o<i.length;o++)if(0===t.modn(i[o]))return 0===t.cmpn(i[o]);return!0}function fermatTest(t){var i=u.mont(t);return 0===d.toRed(i).redPow(t.subn(1)).fromRed().cmpn(1)}function findPrime(t,i){if(t<16)return new u(2===i||5===i?[140,123]:[140,39]);var o,w;for(i=new u(i);;){for(o=new u(a(Math.ceil(t/8)));o.bitLength()>t;)o.ishrn(1);if(o.isEven()&&o.iadd(l),o.testn(1)||o.iadd(d),i.cmp(d)){if(!i.cmp(p))for(;o.mod(m).cmp(g);)o.iadd(b)}else for(;o.mod(c).cmp(v);)o.iadd(b);if(simpleSieve(w=o.shrn(1))&&simpleSieve(o)&&fermatTest(w)&&fermatTest(o)&&h.test(w)&&h.test(o))return o}}},function(t,i,o){(function(t){!function(t,i){"use strict";function assert(t,i){if(!t)throw new Error(i||"Assertion failed")}function inherits(t,i){t.super_=i;var TempCtor=function(){};TempCtor.prototype=i.prototype,t.prototype=new TempCtor,t.prototype.constructor=t}function BN(t,i,o){if(BN.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(o=i,i=10),this._init(t||0,i||10,o||"be"))}var a;"object"==typeof t?t.exports=BN:i.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:o(710).Buffer}catch(t){}function parseHex4Bits(t,i){var o=t.charCodeAt(i);return o>=65&&o<=70?o-55:o>=97&&o<=102?o-87:o-48&15}function parseHexByte(t,i,o){var a=parseHex4Bits(t,o);return o-1>=i&&(a|=parseHex4Bits(t,o-1)<<4),a}function parseBase(t,i,o,a){for(var u=0,c=Math.min(t.length,o),h=i;h<c;h++){var l=t.charCodeAt(h)-48;u*=a,u+=l>=49?l-49+10:l>=17?l-17+10:l}return u}BN.isBN=function isBN(t){return t instanceof BN||null!==t&&"object"==typeof t&&t.constructor.wordSize===BN.wordSize&&Array.isArray(t.words)},BN.max=function max(t,i){return t.cmp(i)>0?t:i},BN.min=function min(t,i){return t.cmp(i)<0?t:i},BN.prototype._init=function init(t,i,o){if("number"==typeof t)return this._initNumber(t,i,o);if("object"==typeof t)return this._initArray(t,i,o);"hex"===i&&(i=16),assert(i===(0|i)&&i>=2&&i<=36);var a=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a<t.length&&(16===i?this._parseHex(t,a,o):(this._parseBase(t,i,a),"le"===o&&this._initArray(this.toArray(),i,o)))},BN.prototype._initNumber=function _initNumber(t,i,o){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(assert(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),i,o)},BN.prototype._initArray=function _initArray(t,i,o){if(assert("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var a=0;a<this.length;a++)this.words[a]=0;var u,c,h=0;if("be"===o)for(a=t.length-1,u=0;a>=0;a-=3)c=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[u]|=c<<h&67108863,this.words[u+1]=c>>>26-h&67108863,(h+=24)>=26&&(h-=26,u++);else if("le"===o)for(a=0,u=0;a<t.length;a+=3)c=t[a]|t[a+1]<<8|t[a+2]<<16,this.words[u]|=c<<h&67108863,this.words[u+1]=c>>>26-h&67108863,(h+=24)>=26&&(h-=26,u++);return this.strip()},BN.prototype._parseHex=function _parseHex(t,i,o){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var a=0;a<this.length;a++)this.words[a]=0;var u,c=0,h=0;if("be"===o)for(a=t.length-1;a>=i;a-=2)u=parseHexByte(t,i,a)<<c,this.words[h]|=67108863&u,c>=18?(c-=18,h+=1,this.words[h]|=u>>>26):c+=8;else for(a=(t.length-i)%2==0?i+1:i;a<t.length;a+=2)u=parseHexByte(t,i,a)<<c,this.words[h]|=67108863&u,c>=18?(c-=18,h+=1,this.words[h]|=u>>>26):c+=8;this.strip()},BN.prototype._parseBase=function _parseBase(t,i,o){this.words=[0],this.length=1;for(var a=0,u=1;u<=67108863;u*=i)a++;a--,u=u/i|0;for(var c=t.length-o,h=c%a,l=Math.min(c,c-h)+o,d=0,p=o;p<l;p+=a)d=parseBase(t,p,p+a,i),this.imuln(u),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d);if(0!==h){var m=1;for(d=parseBase(t,p,t.length,i),p=0;p<h;p++)m*=i;this.imuln(m),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d)}this.strip()},BN.prototype.copy=function copy(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},BN.prototype.clone=function clone(){var t=new BN(null);return this.copy(t),t},BN.prototype._expand=function _expand(t){for(;this.length<t;)this.words[this.length++]=0;return this},BN.prototype.strip=function strip(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(t,i,o){o.negative=i.negative^t.negative;var a=t.length+i.length|0;o.length=a,a=a-1|0;var u=0|t.words[0],c=0|i.words[0],h=u*c,l=67108863&h,d=h/67108864|0;o.words[0]=l;for(var p=1;p<a;p++){for(var m=d>>>26,g=67108863&d,v=Math.min(p,i.length-1),b=Math.max(0,p-t.length+1);b<=v;b++){var w=p-b|0;m+=(h=(u=0|t.words[w])*(c=0|i.words[b])+g)/67108864|0,g=67108863&h}o.words[p]=0|g,d=0|m}return 0!==d?o.words[p]=0|d:o.length--,o.strip()}BN.prototype.toString=function toString(t,i){var o;if(i=0|i||1,16===(t=t||10)||"hex"===t){o="";for(var a=0,l=0,d=0;d<this.length;d++){var p=this.words[d],m=(16777215&(p<<a|l)).toString(16);o=0!==(l=p>>>24-a&16777215)||d!==this.length-1?u[6-m.length]+m+o:m+o,(a+=2)>=26&&(a-=26,d--)}for(0!==l&&(o=l.toString(16)+o);o.length%i!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(t===(0|t)&&t>=2&&t<=36){var g=c[t],v=h[t];o="";var b=this.clone();for(b.negative=0;!b.isZero();){var w=b.modn(v).toString(t);o=(b=b.idivn(v)).isZero()?w+o:u[g-w.length]+w+o}for(this.isZero()&&(o="0"+o);o.length%i!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(t,i){return assert(void 0!==a),this.toArrayLike(a,t,i)},BN.prototype.toArray=function toArray(t,i){return this.toArrayLike(Array,t,i)},BN.prototype.toArrayLike=function toArrayLike(t,i,o){var a=this.byteLength(),u=o||Math.max(1,a);assert(a<=u,"byte array longer than desired length"),assert(u>0,"Requested array length <= 0"),this.strip();var c,h,l="le"===i,d=new t(u),p=this.clone();if(l){for(h=0;!p.isZero();h++)c=p.andln(255),p.iushrn(8),d[h]=c;for(;h<u;h++)d[h]=0}else{for(h=0;h<u-a;h++)d[h]=0;for(h=0;!p.isZero();h++)c=p.andln(255),p.iushrn(8),d[u-h-1]=c}return d},Math.clz32?BN.prototype._countBits=function _countBits(t){return 32-Math.clz32(t)}:BN.prototype._countBits=function _countBits(t){var i=t,o=0;return i>=4096&&(o+=13,i>>>=13),i>=64&&(o+=7,i>>>=7),i>=8&&(o+=4,i>>>=4),i>=2&&(o+=2,i>>>=2),o+i},BN.prototype._zeroBits=function _zeroBits(t){if(0===t)return 26;var i=t,o=0;return 0==(8191&i)&&(o+=13,i>>>=13),0==(127&i)&&(o+=7,i>>>=7),0==(15&i)&&(o+=4,i>>>=4),0==(3&i)&&(o+=2,i>>>=2),0==(1&i)&&o++,o},BN.prototype.bitLength=function bitLength(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var o=this._zeroBits(this.words[i]);if(t+=o,26!==o)break}return t},BN.prototype.byteLength=function byteLength(){return Math.ceil(this.bitLength()/8)},BN.prototype.toTwos=function toTwos(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},BN.prototype.fromTwos=function fromTwos(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},BN.prototype.isNeg=function isNeg(){return 0!==this.negative},BN.prototype.neg=function neg(){return this.clone().ineg()},BN.prototype.ineg=function ineg(){return this.isZero()||(this.negative^=1),this},BN.prototype.iuor=function iuor(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this.strip()},BN.prototype.ior=function ior(t){return assert(0==(this.negative|t.negative)),this.iuor(t)},BN.prototype.or=function or(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},BN.prototype.uor=function uor(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},BN.prototype.iuand=function iuand(t){var i;i=this.length>t.length?t:this;for(var o=0;o<i.length;o++)this.words[o]=this.words[o]&t.words[o];return this.length=i.length,this.strip()},BN.prototype.iand=function iand(t){return assert(0==(this.negative|t.negative)),this.iuand(t)},BN.prototype.and=function and(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},BN.prototype.uand=function uand(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},BN.prototype.iuxor=function iuxor(t){var i,o;this.length>t.length?(i=this,o=t):(i=t,o=this);for(var a=0;a<o.length;a++)this.words[a]=i.words[a]^o.words[a];if(this!==i)for(;a<i.length;a++)this.words[a]=i.words[a];return this.length=i.length,this.strip()},BN.prototype.ixor=function ixor(t){return assert(0==(this.negative|t.negative)),this.iuxor(t)},BN.prototype.xor=function xor(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},BN.prototype.uxor=function uxor(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},BN.prototype.inotn=function inotn(t){assert("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),o=t%26;this._expand(i),o>0&&i--;for(var a=0;a<i;a++)this.words[a]=67108863&~this.words[a];return o>0&&(this.words[a]=~this.words[a]&67108863>>26-o),this.strip()},BN.prototype.notn=function notn(t){return this.clone().inotn(t)},BN.prototype.setn=function setn(t,i){assert("number"==typeof t&&t>=0);var o=t/26|0,a=t%26;return this._expand(o+1),this.words[o]=i?this.words[o]|1<<a:this.words[o]&~(1<<a),this.strip()},BN.prototype.iadd=function iadd(t){var i,o,a;if(0!==this.negative&&0===t.negative)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();this.length>t.length?(o=this,a=t):(o=t,a=this);for(var u=0,c=0;c<a.length;c++)i=(0|o.words[c])+(0|a.words[c])+u,this.words[c]=67108863&i,u=i>>>26;for(;0!==u&&c<o.length;c++)i=(0|o.words[c])+u,this.words[c]=67108863&i,u=i>>>26;if(this.length=o.length,0!==u)this.words[this.length]=u,this.length++;else if(o!==this)for(;c<o.length;c++)this.words[c]=o.words[c];return this},BN.prototype.add=function add(t){var i;return 0!==t.negative&&0===this.negative?(t.negative=0,i=this.sub(t),t.negative^=1,i):0===t.negative&&0!==this.negative?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},BN.prototype.isub=function isub(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var o,a,u=this.cmp(t);if(0===u)return this.negative=0,this.length=1,this.words[0]=0,this;u>0?(o=this,a=t):(o=t,a=this);for(var c=0,h=0;h<a.length;h++)c=(i=(0|o.words[h])-(0|a.words[h])+c)>>26,this.words[h]=67108863&i;for(;0!==c&&h<o.length;h++)c=(i=(0|o.words[h])+c)>>26,this.words[h]=67108863&i;if(0===c&&h<o.length&&o!==this)for(;h<o.length;h++)this.words[h]=o.words[h];return this.length=Math.max(this.length,h),o!==this&&(this.negative=1),this.strip()},BN.prototype.sub=function sub(t){return this.clone().isub(t)};var l=function comb10MulTo(t,i,o){var a,u,c,h=t.words,l=i.words,d=o.words,p=0,m=0|h[0],g=8191&m,v=m>>>13,b=0|h[1],w=8191&b,_=b>>>13,M=0|h[2],k=8191&M,B=M>>>13,P=0|h[3],x=8191&P,I=P>>>13,N=0|h[4],A=8191&N,C=N>>>13,O=0|h[5],j=8191&O,L=O>>>13,q=0|h[6],U=8191&q,z=q>>>13,H=0|h[7],W=8191&H,V=H>>>13,G=0|h[8],J=8191&G,$=G>>>13,Z=0|h[9],Y=8191&Z,X=Z>>>13,Q=0|l[0],ee=8191&Q,te=Q>>>13,re=0|l[1],ne=8191&re,ie=re>>>13,oe=0|l[2],se=8191&oe,ae=oe>>>13,ue=0|l[3],ce=8191&ue,he=ue>>>13,le=0|l[4],fe=8191&le,de=le>>>13,pe=0|l[5],me=8191&pe,ge=pe>>>13,ve=0|l[6],ye=8191&ve,be=ve>>>13,we=0|l[7],_e=8191&we,Me=we>>>13,Se=0|l[8],ke=8191&Se,Ee=Se>>>13,Be=0|l[9],Pe=8191&Be,xe=Be>>>13;o.negative=t.negative^i.negative,o.length=19;var Te=(p+(a=Math.imul(g,ee))|0)+((8191&(u=(u=Math.imul(g,te))+Math.imul(v,ee)|0))<<13)|0;p=((c=Math.imul(v,te))+(u>>>13)|0)+(Te>>>26)|0,Te&=67108863,a=Math.imul(w,ee),u=(u=Math.imul(w,te))+Math.imul(_,ee)|0,c=Math.imul(_,te);var Ie=(p+(a=a+Math.imul(g,ne)|0)|0)+((8191&(u=(u=u+Math.imul(g,ie)|0)+Math.imul(v,ne)|0))<<13)|0;p=((c=c+Math.imul(v,ie)|0)+(u>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,a=Math.imul(k,ee),u=(u=Math.imul(k,te))+Math.imul(B,ee)|0,c=Math.imul(B,te),a=a+Math.imul(w,ne)|0,u=(u=u+Math.imul(w,ie)|0)+Math.imul(_,ne)|0,c=c+Math.imul(_,ie)|0;var Ne=(p+(a=a+Math.imul(g,se)|0)|0)+((8191&(u=(u=u+Math.imul(g,ae)|0)+Math.imul(v,se)|0))<<13)|0;p=((c=c+Math.imul(v,ae)|0)+(u>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,a=Math.imul(x,ee),u=(u=Math.imul(x,te))+Math.imul(I,ee)|0,c=Math.imul(I,te),a=a+Math.imul(k,ne)|0,u=(u=u+Math.imul(k,ie)|0)+Math.imul(B,ne)|0,c=c+Math.imul(B,ie)|0,a=a+Math.imul(w,se)|0,u=(u=u+Math.imul(w,ae)|0)+Math.imul(_,se)|0,c=c+Math.imul(_,ae)|0;var Ae=(p+(a=a+Math.imul(g,ce)|0)|0)+((8191&(u=(u=u+Math.imul(g,he)|0)+Math.imul(v,ce)|0))<<13)|0;p=((c=c+Math.imul(v,he)|0)+(u>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,a=Math.imul(A,ee),u=(u=Math.imul(A,te))+Math.imul(C,ee)|0,c=Math.imul(C,te),a=a+Math.imul(x,ne)|0,u=(u=u+Math.imul(x,ie)|0)+Math.imul(I,ne)|0,c=c+Math.imul(I,ie)|0,a=a+Math.imul(k,se)|0,u=(u=u+Math.imul(k,ae)|0)+Math.imul(B,se)|0,c=c+Math.imul(B,ae)|0,a=a+Math.imul(w,ce)|0,u=(u=u+Math.imul(w,he)|0)+Math.imul(_,ce)|0,c=c+Math.imul(_,he)|0;var Re=(p+(a=a+Math.imul(g,fe)|0)|0)+((8191&(u=(u=u+Math.imul(g,de)|0)+Math.imul(v,fe)|0))<<13)|0;p=((c=c+Math.imul(v,de)|0)+(u>>>13)|0)+(Re>>>26)|0,Re&=67108863,a=Math.imul(j,ee),u=(u=Math.imul(j,te))+Math.imul(L,ee)|0,c=Math.imul(L,te),a=a+Math.imul(A,ne)|0,u=(u=u+Math.imul(A,ie)|0)+Math.imul(C,ne)|0,c=c+Math.imul(C,ie)|0,a=a+Math.imul(x,se)|0,u=(u=u+Math.imul(x,ae)|0)+Math.imul(I,se)|0,c=c+Math.imul(I,ae)|0,a=a+Math.imul(k,ce)|0,u=(u=u+Math.imul(k,he)|0)+Math.imul(B,ce)|0,c=c+Math.imul(B,he)|0,a=a+Math.imul(w,fe)|0,u=(u=u+Math.imul(w,de)|0)+Math.imul(_,fe)|0,c=c+Math.imul(_,de)|0;var Ce=(p+(a=a+Math.imul(g,me)|0)|0)+((8191&(u=(u=u+Math.imul(g,ge)|0)+Math.imul(v,me)|0))<<13)|0;p=((c=c+Math.imul(v,ge)|0)+(u>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,a=Math.imul(U,ee),u=(u=Math.imul(U,te))+Math.imul(z,ee)|0,c=Math.imul(z,te),a=a+Math.imul(j,ne)|0,u=(u=u+Math.imul(j,ie)|0)+Math.imul(L,ne)|0,c=c+Math.imul(L,ie)|0,a=a+Math.imul(A,se)|0,u=(u=u+Math.imul(A,ae)|0)+Math.imul(C,se)|0,c=c+Math.imul(C,ae)|0,a=a+Math.imul(x,ce)|0,u=(u=u+Math.imul(x,he)|0)+Math.imul(I,ce)|0,c=c+Math.imul(I,he)|0,a=a+Math.imul(k,fe)|0,u=(u=u+Math.imul(k,de)|0)+Math.imul(B,fe)|0,c=c+Math.imul(B,de)|0,a=a+Math.imul(w,me)|0,u=(u=u+Math.imul(w,ge)|0)+Math.imul(_,me)|0,c=c+Math.imul(_,ge)|0;var Oe=(p+(a=a+Math.imul(g,ye)|0)|0)+((8191&(u=(u=u+Math.imul(g,be)|0)+Math.imul(v,ye)|0))<<13)|0;p=((c=c+Math.imul(v,be)|0)+(u>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,a=Math.imul(W,ee),u=(u=Math.imul(W,te))+Math.imul(V,ee)|0,c=Math.imul(V,te),a=a+Math.imul(U,ne)|0,u=(u=u+Math.imul(U,ie)|0)+Math.imul(z,ne)|0,c=c+Math.imul(z,ie)|0,a=a+Math.imul(j,se)|0,u=(u=u+Math.imul(j,ae)|0)+Math.imul(L,se)|0,c=c+Math.imul(L,ae)|0,a=a+Math.imul(A,ce)|0,u=(u=u+Math.imul(A,he)|0)+Math.imul(C,ce)|0,c=c+Math.imul(C,he)|0,a=a+Math.imul(x,fe)|0,u=(u=u+Math.imul(x,de)|0)+Math.imul(I,fe)|0,c=c+Math.imul(I,de)|0,a=a+Math.imul(k,me)|0,u=(u=u+Math.imul(k,ge)|0)+Math.imul(B,me)|0,c=c+Math.imul(B,ge)|0,a=a+Math.imul(w,ye)|0,u=(u=u+Math.imul(w,be)|0)+Math.imul(_,ye)|0,c=c+Math.imul(_,be)|0;var De=(p+(a=a+Math.imul(g,_e)|0)|0)+((8191&(u=(u=u+Math.imul(g,Me)|0)+Math.imul(v,_e)|0))<<13)|0;p=((c=c+Math.imul(v,Me)|0)+(u>>>13)|0)+(De>>>26)|0,De&=67108863,a=Math.imul(J,ee),u=(u=Math.imul(J,te))+Math.imul($,ee)|0,c=Math.imul($,te),a=a+Math.imul(W,ne)|0,u=(u=u+Math.imul(W,ie)|0)+Math.imul(V,ne)|0,c=c+Math.imul(V,ie)|0,a=a+Math.imul(U,se)|0,u=(u=u+Math.imul(U,ae)|0)+Math.imul(z,se)|0,c=c+Math.imul(z,ae)|0,a=a+Math.imul(j,ce)|0,u=(u=u+Math.imul(j,he)|0)+Math.imul(L,ce)|0,c=c+Math.imul(L,he)|0,a=a+Math.imul(A,fe)|0,u=(u=u+Math.imul(A,de)|0)+Math.imul(C,fe)|0,c=c+Math.imul(C,de)|0,a=a+Math.imul(x,me)|0,u=(u=u+Math.imul(x,ge)|0)+Math.imul(I,me)|0,c=c+Math.imul(I,ge)|0,a=a+Math.imul(k,ye)|0,u=(u=u+Math.imul(k,be)|0)+Math.imul(B,ye)|0,c=c+Math.imul(B,be)|0,a=a+Math.imul(w,_e)|0,u=(u=u+Math.imul(w,Me)|0)+Math.imul(_,_e)|0,c=c+Math.imul(_,Me)|0;var je=(p+(a=a+Math.imul(g,ke)|0)|0)+((8191&(u=(u=u+Math.imul(g,Ee)|0)+Math.imul(v,ke)|0))<<13)|0;p=((c=c+Math.imul(v,Ee)|0)+(u>>>13)|0)+(je>>>26)|0,je&=67108863,a=Math.imul(Y,ee),u=(u=Math.imul(Y,te))+Math.imul(X,ee)|0,c=Math.imul(X,te),a=a+Math.imul(J,ne)|0,u=(u=u+Math.imul(J,ie)|0)+Math.imul($,ne)|0,c=c+Math.imul($,ie)|0,a=a+Math.imul(W,se)|0,u=(u=u+Math.imul(W,ae)|0)+Math.imul(V,se)|0,c=c+Math.imul(V,ae)|0,a=a+Math.imul(U,ce)|0,u=(u=u+Math.imul(U,he)|0)+Math.imul(z,ce)|0,c=c+Math.imul(z,he)|0,a=a+Math.imul(j,fe)|0,u=(u=u+Math.imul(j,de)|0)+Math.imul(L,fe)|0,c=c+Math.imul(L,de)|0,a=a+Math.imul(A,me)|0,u=(u=u+Math.imul(A,ge)|0)+Math.imul(C,me)|0,c=c+Math.imul(C,ge)|0,a=a+Math.imul(x,ye)|0,u=(u=u+Math.imul(x,be)|0)+Math.imul(I,ye)|0,c=c+Math.imul(I,be)|0,a=a+Math.imul(k,_e)|0,u=(u=u+Math.imul(k,Me)|0)+Math.imul(B,_e)|0,c=c+Math.imul(B,Me)|0,a=a+Math.imul(w,ke)|0,u=(u=u+Math.imul(w,Ee)|0)+Math.imul(_,ke)|0,c=c+Math.imul(_,Ee)|0;var Le=(p+(a=a+Math.imul(g,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(g,xe)|0)+Math.imul(v,Pe)|0))<<13)|0;p=((c=c+Math.imul(v,xe)|0)+(u>>>13)|0)+(Le>>>26)|0,Le&=67108863,a=Math.imul(Y,ne),u=(u=Math.imul(Y,ie))+Math.imul(X,ne)|0,c=Math.imul(X,ie),a=a+Math.imul(J,se)|0,u=(u=u+Math.imul(J,ae)|0)+Math.imul($,se)|0,c=c+Math.imul($,ae)|0,a=a+Math.imul(W,ce)|0,u=(u=u+Math.imul(W,he)|0)+Math.imul(V,ce)|0,c=c+Math.imul(V,he)|0,a=a+Math.imul(U,fe)|0,u=(u=u+Math.imul(U,de)|0)+Math.imul(z,fe)|0,c=c+Math.imul(z,de)|0,a=a+Math.imul(j,me)|0,u=(u=u+Math.imul(j,ge)|0)+Math.imul(L,me)|0,c=c+Math.imul(L,ge)|0,a=a+Math.imul(A,ye)|0,u=(u=u+Math.imul(A,be)|0)+Math.imul(C,ye)|0,c=c+Math.imul(C,be)|0,a=a+Math.imul(x,_e)|0,u=(u=u+Math.imul(x,Me)|0)+Math.imul(I,_e)|0,c=c+Math.imul(I,Me)|0,a=a+Math.imul(k,ke)|0,u=(u=u+Math.imul(k,Ee)|0)+Math.imul(B,ke)|0,c=c+Math.imul(B,Ee)|0;var Fe=(p+(a=a+Math.imul(w,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(w,xe)|0)+Math.imul(_,Pe)|0))<<13)|0;p=((c=c+Math.imul(_,xe)|0)+(u>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,a=Math.imul(Y,se),u=(u=Math.imul(Y,ae))+Math.imul(X,se)|0,c=Math.imul(X,ae),a=a+Math.imul(J,ce)|0,u=(u=u+Math.imul(J,he)|0)+Math.imul($,ce)|0,c=c+Math.imul($,he)|0,a=a+Math.imul(W,fe)|0,u=(u=u+Math.imul(W,de)|0)+Math.imul(V,fe)|0,c=c+Math.imul(V,de)|0,a=a+Math.imul(U,me)|0,u=(u=u+Math.imul(U,ge)|0)+Math.imul(z,me)|0,c=c+Math.imul(z,ge)|0,a=a+Math.imul(j,ye)|0,u=(u=u+Math.imul(j,be)|0)+Math.imul(L,ye)|0,c=c+Math.imul(L,be)|0,a=a+Math.imul(A,_e)|0,u=(u=u+Math.imul(A,Me)|0)+Math.imul(C,_e)|0,c=c+Math.imul(C,Me)|0,a=a+Math.imul(x,ke)|0,u=(u=u+Math.imul(x,Ee)|0)+Math.imul(I,ke)|0,c=c+Math.imul(I,Ee)|0;var qe=(p+(a=a+Math.imul(k,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(k,xe)|0)+Math.imul(B,Pe)|0))<<13)|0;p=((c=c+Math.imul(B,xe)|0)+(u>>>13)|0)+(qe>>>26)|0,qe&=67108863,a=Math.imul(Y,ce),u=(u=Math.imul(Y,he))+Math.imul(X,ce)|0,c=Math.imul(X,he),a=a+Math.imul(J,fe)|0,u=(u=u+Math.imul(J,de)|0)+Math.imul($,fe)|0,c=c+Math.imul($,de)|0,a=a+Math.imul(W,me)|0,u=(u=u+Math.imul(W,ge)|0)+Math.imul(V,me)|0,c=c+Math.imul(V,ge)|0,a=a+Math.imul(U,ye)|0,u=(u=u+Math.imul(U,be)|0)+Math.imul(z,ye)|0,c=c+Math.imul(z,be)|0,a=a+Math.imul(j,_e)|0,u=(u=u+Math.imul(j,Me)|0)+Math.imul(L,_e)|0,c=c+Math.imul(L,Me)|0,a=a+Math.imul(A,ke)|0,u=(u=u+Math.imul(A,Ee)|0)+Math.imul(C,ke)|0,c=c+Math.imul(C,Ee)|0;var Ue=(p+(a=a+Math.imul(x,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(x,xe)|0)+Math.imul(I,Pe)|0))<<13)|0;p=((c=c+Math.imul(I,xe)|0)+(u>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,a=Math.imul(Y,fe),u=(u=Math.imul(Y,de))+Math.imul(X,fe)|0,c=Math.imul(X,de),a=a+Math.imul(J,me)|0,u=(u=u+Math.imul(J,ge)|0)+Math.imul($,me)|0,c=c+Math.imul($,ge)|0,a=a+Math.imul(W,ye)|0,u=(u=u+Math.imul(W,be)|0)+Math.imul(V,ye)|0,c=c+Math.imul(V,be)|0,a=a+Math.imul(U,_e)|0,u=(u=u+Math.imul(U,Me)|0)+Math.imul(z,_e)|0,c=c+Math.imul(z,Me)|0,a=a+Math.imul(j,ke)|0,u=(u=u+Math.imul(j,Ee)|0)+Math.imul(L,ke)|0,c=c+Math.imul(L,Ee)|0;var ze=(p+(a=a+Math.imul(A,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(A,xe)|0)+Math.imul(C,Pe)|0))<<13)|0;p=((c=c+Math.imul(C,xe)|0)+(u>>>13)|0)+(ze>>>26)|0,ze&=67108863,a=Math.imul(Y,me),u=(u=Math.imul(Y,ge))+Math.imul(X,me)|0,c=Math.imul(X,ge),a=a+Math.imul(J,ye)|0,u=(u=u+Math.imul(J,be)|0)+Math.imul($,ye)|0,c=c+Math.imul($,be)|0,a=a+Math.imul(W,_e)|0,u=(u=u+Math.imul(W,Me)|0)+Math.imul(V,_e)|0,c=c+Math.imul(V,Me)|0,a=a+Math.imul(U,ke)|0,u=(u=u+Math.imul(U,Ee)|0)+Math.imul(z,ke)|0,c=c+Math.imul(z,Ee)|0;var He=(p+(a=a+Math.imul(j,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(j,xe)|0)+Math.imul(L,Pe)|0))<<13)|0;p=((c=c+Math.imul(L,xe)|0)+(u>>>13)|0)+(He>>>26)|0,He&=67108863,a=Math.imul(Y,ye),u=(u=Math.imul(Y,be))+Math.imul(X,ye)|0,c=Math.imul(X,be),a=a+Math.imul(J,_e)|0,u=(u=u+Math.imul(J,Me)|0)+Math.imul($,_e)|0,c=c+Math.imul($,Me)|0,a=a+Math.imul(W,ke)|0,u=(u=u+Math.imul(W,Ee)|0)+Math.imul(V,ke)|0,c=c+Math.imul(V,Ee)|0;var We=(p+(a=a+Math.imul(U,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(U,xe)|0)+Math.imul(z,Pe)|0))<<13)|0;p=((c=c+Math.imul(z,xe)|0)+(u>>>13)|0)+(We>>>26)|0,We&=67108863,a=Math.imul(Y,_e),u=(u=Math.imul(Y,Me))+Math.imul(X,_e)|0,c=Math.imul(X,Me),a=a+Math.imul(J,ke)|0,u=(u=u+Math.imul(J,Ee)|0)+Math.imul($,ke)|0,c=c+Math.imul($,Ee)|0;var Ke=(p+(a=a+Math.imul(W,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(W,xe)|0)+Math.imul(V,Pe)|0))<<13)|0;p=((c=c+Math.imul(V,xe)|0)+(u>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,a=Math.imul(Y,ke),u=(u=Math.imul(Y,Ee))+Math.imul(X,ke)|0,c=Math.imul(X,Ee);var Ve=(p+(a=a+Math.imul(J,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(J,xe)|0)+Math.imul($,Pe)|0))<<13)|0;p=((c=c+Math.imul($,xe)|0)+(u>>>13)|0)+(Ve>>>26)|0,Ve&=67108863;var Ge=(p+(a=Math.imul(Y,Pe))|0)+((8191&(u=(u=Math.imul(Y,xe))+Math.imul(X,Pe)|0))<<13)|0;return p=((c=Math.imul(X,xe))+(u>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,d[0]=Te,d[1]=Ie,d[2]=Ne,d[3]=Ae,d[4]=Re,d[5]=Ce,d[6]=Oe,d[7]=De,d[8]=je,d[9]=Le,d[10]=Fe,d[11]=qe,d[12]=Ue,d[13]=ze,d[14]=He,d[15]=We,d[16]=Ke,d[17]=Ve,d[18]=Ge,0!==p&&(d[19]=p,o.length++),o};function jumboMulTo(t,i,o){return(new FFTM).mulp(t,i,o)}function FFTM(t,i){this.x=t,this.y=i}Math.imul||(l=smallMulTo),BN.prototype.mulTo=function mulTo(t,i){var o=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,i):o<63?smallMulTo(this,t,i):o<1024?function bigMulTo(t,i,o){o.negative=i.negative^t.negative,o.length=t.length+i.length;for(var a=0,u=0,c=0;c<o.length-1;c++){var h=u;u=0;for(var l=67108863&a,d=Math.min(c,i.length-1),p=Math.max(0,c-t.length+1);p<=d;p++){var m=c-p,g=(0|t.words[m])*(0|i.words[p]),v=67108863&g;l=67108863&(v=v+l|0),u+=(h=(h=h+(g/67108864|0)|0)+(v>>>26)|0)>>>26,h&=67108863}o.words[c]=l,a=h,h=u}return 0!==a?o.words[c]=a:o.length--,o.strip()}(this,t,i):jumboMulTo(this,t,i)},FFTM.prototype.makeRBT=function makeRBT(t){for(var i=new Array(t),o=BN.prototype._countBits(t)-1,a=0;a<t;a++)i[a]=this.revBin(a,o,t);return i},FFTM.prototype.revBin=function revBin(t,i,o){if(0===t||t===o-1)return t;for(var a=0,u=0;u<i;u++)a|=(1&t)<<i-u-1,t>>=1;return a},FFTM.prototype.permute=function permute(t,i,o,a,u,c){for(var h=0;h<c;h++)a[h]=i[t[h]],u[h]=o[t[h]]},FFTM.prototype.transform=function transform(t,i,o,a,u,c){this.permute(c,t,i,o,a,u);for(var h=1;h<u;h<<=1)for(var l=h<<1,d=Math.cos(2*Math.PI/l),p=Math.sin(2*Math.PI/l),m=0;m<u;m+=l)for(var g=d,v=p,b=0;b<h;b++){var w=o[m+b],_=a[m+b],M=o[m+b+h],k=a[m+b+h],B=g*M-v*k;k=g*k+v*M,M=B,o[m+b]=w+M,a[m+b]=_+k,o[m+b+h]=w-M,a[m+b+h]=_-k,b!==l&&(B=d*g-p*v,v=d*v+p*g,g=B)}},FFTM.prototype.guessLen13b=function guessLen13b(t,i){var o=1|Math.max(i,t),a=1&o,u=0;for(o=o/2|0;o;o>>>=1)u++;return 1<<u+1+a},FFTM.prototype.conjugate=function conjugate(t,i,o){if(!(o<=1))for(var a=0;a<o/2;a++){var u=t[a];t[a]=t[o-a-1],t[o-a-1]=u,u=i[a],i[a]=-i[o-a-1],i[o-a-1]=-u}},FFTM.prototype.normalize13b=function normalize13b(t,i){for(var o=0,a=0;a<i/2;a++){var u=8192*Math.round(t[2*a+1]/i)+Math.round(t[2*a]/i)+o;t[a]=67108863&u,o=u<67108864?0:u/67108864|0}return t},FFTM.prototype.convert13b=function convert13b(t,i,o,a){for(var u=0,c=0;c<i;c++)u+=0|t[c],o[2*c]=8191&u,u>>>=13,o[2*c+1]=8191&u,u>>>=13;for(c=2*i;c<a;++c)o[c]=0;assert(0===u),assert(0==(-8192&u))},FFTM.prototype.stub=function stub(t){for(var i=new Array(t),o=0;o<t;o++)i[o]=0;return i},FFTM.prototype.mulp=function mulp(t,i,o){var a=2*this.guessLen13b(t.length,i.length),u=this.makeRBT(a),c=this.stub(a),h=new Array(a),l=new Array(a),d=new Array(a),p=new Array(a),m=new Array(a),g=new Array(a),v=o.words;v.length=a,this.convert13b(t.words,t.length,h,a),this.convert13b(i.words,i.length,p,a),this.transform(h,c,l,d,a,u),this.transform(p,c,m,g,a,u);for(var b=0;b<a;b++){var w=l[b]*m[b]-d[b]*g[b];d[b]=l[b]*g[b]+d[b]*m[b],l[b]=w}return this.conjugate(l,d,a),this.transform(l,d,v,c,a,u),this.conjugate(v,c,a),this.normalize13b(v,a),o.negative=t.negative^i.negative,o.length=t.length+i.length,o.strip()},BN.prototype.mul=function mul(t){var i=new BN(null);return i.words=new Array(this.length+t.length),this.mulTo(t,i)},BN.prototype.mulf=function mulf(t){var i=new BN(null);return i.words=new Array(this.length+t.length),jumboMulTo(this,t,i)},BN.prototype.imul=function imul(t){return this.clone().mulTo(t,this)},BN.prototype.imuln=function imuln(t){assert("number"==typeof t),assert(t<67108864);for(var i=0,o=0;o<this.length;o++){var a=(0|this.words[o])*t,u=(67108863&a)+(67108863&i);i>>=26,i+=a/67108864|0,i+=u>>>26,this.words[o]=67108863&u}return 0!==i&&(this.words[o]=i,this.length++),this},BN.prototype.muln=function muln(t){return this.clone().imuln(t)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(t){var i=function toBitArray(t){for(var i=new Array(t.bitLength()),o=0;o<i.length;o++){var a=o/26|0,u=o%26;i[o]=(t.words[a]&1<<u)>>>u}return i}(t);if(0===i.length)return new BN(1);for(var o=this,a=0;a<i.length&&0===i[a];a++,o=o.sqr());if(++a<i.length)for(var u=o.sqr();a<i.length;a++,u=u.sqr())0!==i[a]&&(o=o.mul(u));return o},BN.prototype.iushln=function iushln(t){assert("number"==typeof t&&t>=0);var i,o=t%26,a=(t-o)/26,u=67108863>>>26-o<<26-o;if(0!==o){var c=0;for(i=0;i<this.length;i++){var h=this.words[i]&u,l=(0|this.words[i])-h<<o;this.words[i]=l|c,c=h>>>26-o}c&&(this.words[i]=c,this.length++)}if(0!==a){for(i=this.length-1;i>=0;i--)this.words[i+a]=this.words[i];for(i=0;i<a;i++)this.words[i]=0;this.length+=a}return this.strip()},BN.prototype.ishln=function ishln(t){return assert(0===this.negative),this.iushln(t)},BN.prototype.iushrn=function iushrn(t,i,o){var a;assert("number"==typeof t&&t>=0),a=i?(i-i%26)/26:0;var u=t%26,c=Math.min((t-u)/26,this.length),h=67108863^67108863>>>u<<u,l=o;if(a-=c,a=Math.max(0,a),l){for(var d=0;d<c;d++)l.words[d]=this.words[d];l.length=c}if(0===c);else if(this.length>c)for(this.length-=c,d=0;d<this.length;d++)this.words[d]=this.words[d+c];else this.words[0]=0,this.length=1;var p=0;for(d=this.length-1;d>=0&&(0!==p||d>=a);d--){var m=0|this.words[d];this.words[d]=p<<26-u|m>>>u,p=m&h}return l&&0!==p&&(l.words[l.length++]=p),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(t,i,o){return assert(0===this.negative),this.iushrn(t,i,o)},BN.prototype.shln=function shln(t){return this.clone().ishln(t)},BN.prototype.ushln=function ushln(t){return this.clone().iushln(t)},BN.prototype.shrn=function shrn(t){return this.clone().ishrn(t)},BN.prototype.ushrn=function ushrn(t){return this.clone().iushrn(t)},BN.prototype.testn=function testn(t){assert("number"==typeof t&&t>=0);var i=t%26,o=(t-i)/26,a=1<<i;return!(this.length<=o)&&!!(this.words[o]&a)},BN.prototype.imaskn=function imaskn(t){assert("number"==typeof t&&t>=0);var i=t%26,o=(t-i)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==i&&o++,this.length=Math.min(o,this.length),0!==i){var a=67108863^67108863>>>i<<i;this.words[this.length-1]&=a}return this.strip()},BN.prototype.maskn=function maskn(t){return this.clone().imaskn(t)},BN.prototype.iaddn=function iaddn(t){return assert("number"==typeof t),assert(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},BN.prototype._iaddn=function _iaddn(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},BN.prototype.isubn=function isubn(t){if(assert("number"==typeof t),assert(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this.strip()},BN.prototype.addn=function addn(t){return this.clone().iaddn(t)},BN.prototype.subn=function subn(t){return this.clone().isubn(t)},BN.prototype.iabs=function iabs(){return this.negative=0,this},BN.prototype.abs=function abs(){return this.clone().iabs()},BN.prototype._ishlnsubmul=function _ishlnsubmul(t,i,o){var a,u,c=t.length+o;this._expand(c);var h=0;for(a=0;a<t.length;a++){u=(0|this.words[a+o])+h;var l=(0|t.words[a])*i;h=((u-=67108863&l)>>26)-(l/67108864|0),this.words[a+o]=67108863&u}for(;a<this.length-o;a++)h=(u=(0|this.words[a+o])+h)>>26,this.words[a+o]=67108863&u;if(0===h)return this.strip();for(assert(-1===h),h=0,a=0;a<this.length;a++)h=(u=-(0|this.words[a])+h)>>26,this.words[a]=67108863&u;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(t,i){var o=(this.length,t.length),a=this.clone(),u=t,c=0|u.words[u.length-1];0!==(o=26-this._countBits(c))&&(u=u.ushln(o),a.iushln(o),c=0|u.words[u.length-1]);var h,l=a.length-u.length;if("mod"!==i){(h=new BN(null)).length=l+1,h.words=new Array(h.length);for(var d=0;d<h.length;d++)h.words[d]=0}var p=a.clone()._ishlnsubmul(u,1,l);0===p.negative&&(a=p,h&&(h.words[l]=1));for(var m=l-1;m>=0;m--){var g=67108864*(0|a.words[u.length+m])+(0|a.words[u.length+m-1]);for(g=Math.min(g/c|0,67108863),a._ishlnsubmul(u,g,m);0!==a.negative;)g--,a.negative=0,a._ishlnsubmul(u,1,m),a.isZero()||(a.negative^=1);h&&(h.words[m]=g)}return h&&h.strip(),a.strip(),"div"!==i&&0!==o&&a.iushrn(o),{div:h||null,mod:a}},BN.prototype.divmod=function divmod(t,i,o){return assert(!t.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===t.negative?(c=this.neg().divmod(t,i),"mod"!==i&&(a=c.div.neg()),"div"!==i&&(u=c.mod.neg(),o&&0!==u.negative&&u.iadd(t)),{div:a,mod:u}):0===this.negative&&0!==t.negative?(c=this.divmod(t.neg(),i),"mod"!==i&&(a=c.div.neg()),{div:a,mod:c.mod}):0!=(this.negative&t.negative)?(c=this.neg().divmod(t.neg(),i),"div"!==i&&(u=c.mod.neg(),o&&0!==u.negative&&u.isub(t)),{div:c.div,mod:u}):t.length>this.length||this.cmp(t)<0?{div:new BN(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new BN(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new BN(this.modn(t.words[0]))}:this._wordDiv(t,i);var a,u,c},BN.prototype.div=function div(t){return this.divmod(t,"div",!1).div},BN.prototype.mod=function mod(t){return this.divmod(t,"mod",!1).mod},BN.prototype.umod=function umod(t){return this.divmod(t,"mod",!0).mod},BN.prototype.divRound=function divRound(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var o=0!==i.div.negative?i.mod.isub(t):i.mod,a=t.ushrn(1),u=t.andln(1),c=o.cmp(a);return c<0||1===u&&0===c?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},BN.prototype.modn=function modn(t){assert(t<=67108863);for(var i=(1<<26)%t,o=0,a=this.length-1;a>=0;a--)o=(i*o+(0|this.words[a]))%t;return o},BN.prototype.idivn=function idivn(t){assert(t<=67108863);for(var i=0,o=this.length-1;o>=0;o--){var a=(0|this.words[o])+67108864*i;this.words[o]=a/t|0,i=a%t}return this.strip()},BN.prototype.divn=function divn(t){return this.clone().idivn(t)},BN.prototype.egcd=function egcd(t){assert(0===t.negative),assert(!t.isZero());var i=this,o=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var a=new BN(1),u=new BN(0),c=new BN(0),h=new BN(1),l=0;i.isEven()&&o.isEven();)i.iushrn(1),o.iushrn(1),++l;for(var d=o.clone(),p=i.clone();!i.isZero();){for(var m=0,g=1;0==(i.words[0]&g)&&m<26;++m,g<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(p)),a.iushrn(1),u.iushrn(1);for(var v=0,b=1;0==(o.words[0]&b)&&v<26;++v,b<<=1);if(v>0)for(o.iushrn(v);v-- >0;)(c.isOdd()||h.isOdd())&&(c.iadd(d),h.isub(p)),c.iushrn(1),h.iushrn(1);i.cmp(o)>=0?(i.isub(o),a.isub(c),u.isub(h)):(o.isub(i),c.isub(a),h.isub(u))}return{a:c,b:h,gcd:o.iushln(l)}},BN.prototype._invmp=function _invmp(t){assert(0===t.negative),assert(!t.isZero());var i=this,o=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var a,u=new BN(1),c=new BN(0),h=o.clone();i.cmpn(1)>0&&o.cmpn(1)>0;){for(var l=0,d=1;0==(i.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(i.iushrn(l);l-- >0;)u.isOdd()&&u.iadd(h),u.iushrn(1);for(var p=0,m=1;0==(o.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(o.iushrn(p);p-- >0;)c.isOdd()&&c.iadd(h),c.iushrn(1);i.cmp(o)>=0?(i.isub(o),u.isub(c)):(o.isub(i),c.isub(u))}return(a=0===i.cmpn(1)?u:c).cmpn(0)<0&&a.iadd(t),a},BN.prototype.gcd=function gcd(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),o=t.clone();i.negative=0,o.negative=0;for(var a=0;i.isEven()&&o.isEven();a++)i.iushrn(1),o.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;o.isEven();)o.iushrn(1);var u=i.cmp(o);if(u<0){var c=i;i=o,o=c}else if(0===u||0===o.cmpn(1))break;i.isub(o)}return o.iushln(a)},BN.prototype.invm=function invm(t){return this.egcd(t).a.umod(t)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(t){return this.words[0]&t},BN.prototype.bincn=function bincn(t){assert("number"==typeof t);var i=t%26,o=(t-i)/26,a=1<<i;if(this.length<=o)return this._expand(o+1),this.words[o]|=a,this;for(var u=a,c=o;0!==u&&c<this.length;c++){var h=0|this.words[c];u=(h+=u)>>>26,h&=67108863,this.words[c]=h}return 0!==u&&(this.words[c]=u,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(t){var i,o=t<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this.strip(),this.length>1)i=1;else{o&&(t=-t),assert(t<=67108863,"Number is too big");var a=0|this.words[0];i=a===t?0:a<t?-1:1}return 0!==this.negative?0|-i:i},BN.prototype.cmp=function cmp(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var i=this.ucmp(t);return 0!==this.negative?0|-i:i},BN.prototype.ucmp=function ucmp(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,o=this.length-1;o>=0;o--){var a=0|this.words[o],u=0|t.words[o];if(a!==u){a<u?i=-1:a>u&&(i=1);break}}return i},BN.prototype.gtn=function gtn(t){return 1===this.cmpn(t)},BN.prototype.gt=function gt(t){return 1===this.cmp(t)},BN.prototype.gten=function gten(t){return this.cmpn(t)>=0},BN.prototype.gte=function gte(t){return this.cmp(t)>=0},BN.prototype.ltn=function ltn(t){return-1===this.cmpn(t)},BN.prototype.lt=function lt(t){return-1===this.cmp(t)},BN.prototype.lten=function lten(t){return this.cmpn(t)<=0},BN.prototype.lte=function lte(t){return this.cmp(t)<=0},BN.prototype.eqn=function eqn(t){return 0===this.cmpn(t)},BN.prototype.eq=function eq(t){return 0===this.cmp(t)},BN.red=function red(t){return new Red(t)},BN.prototype.toRed=function toRed(t){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(t){return this.red=t,this},BN.prototype.forceRed=function forceRed(t){return assert(!this.red,"Already a number in reduction context"),this._forceRed(t)},BN.prototype.redAdd=function redAdd(t){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},BN.prototype.redIAdd=function redIAdd(t){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},BN.prototype.redSub=function redSub(t){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},BN.prototype.redISub=function redISub(t){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},BN.prototype.redShl=function redShl(t){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},BN.prototype.redMul=function redMul(t){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},BN.prototype.redIMul=function redIMul(t){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(t){return assert(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(t,i){this.name=t,this.p=new BN(i,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(t){if("string"==typeof t){var i=BN._prime(t);this.m=i.p,this.prime=i}else assert(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function Mont(t){Red.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var t=new BN(null);return t.words=new Array(Math.ceil(this.n/13)),t},MPrime.prototype.ireduce=function ireduce(t){var i,o=t;do{this.split(o,this.tmp),i=(o=(o=this.imulK(o)).iadd(this.tmp)).bitLength()}while(i>this.n);var a=i<this.n?-1:o.ucmp(this.p);return 0===a?(o.words[0]=0,o.length=1):a>0?o.isub(this.p):void 0!==o.strip?o.strip():o._strip(),o},MPrime.prototype.split=function split(t,i){t.iushrn(this.n,0,i)},MPrime.prototype.imulK=function imulK(t){return t.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(t,i){for(var o=Math.min(t.length,9),a=0;a<o;a++)i.words[a]=t.words[a];if(i.length=o,t.length<=9)return t.words[0]=0,void(t.length=1);var u=t.words[9];for(i.words[i.length++]=4194303&u,a=10;a<t.length;a++){var c=0|t.words[a];t.words[a-10]=(4194303&c)<<4|u>>>22,u=c}u>>>=22,t.words[a-10]=u,0===u&&t.length>10?t.length-=10:t.length-=9},K256.prototype.imulK=function imulK(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,o=0;o<t.length;o++){var a=0|t.words[o];i+=977*a,t.words[o]=67108863&i,i=64*a+(i/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},inherits(P224,MPrime),inherits(P192,MPrime),inherits(P25519,MPrime),P25519.prototype.imulK=function imulK(t){for(var i=0,o=0;o<t.length;o++){var a=19*(0|t.words[o])+i,u=67108863&a;a>>>=26,t.words[o]=u,i=a}return 0!==i&&(t.words[t.length++]=i),t},BN._prime=function prime(t){if(d[t])return d[t];var prime;if("k256"===t)prime=new K256;else if("p224"===t)prime=new P224;else if("p192"===t)prime=new P192;else{if("p25519"!==t)throw new Error("Unknown prime "+t);prime=new P25519}return d[t]=prime,prime},Red.prototype._verify1=function _verify1(t){assert(0===t.negative,"red works only with positives"),assert(t.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(t,i){assert(0==(t.negative|i.negative),"red works only with positives"),assert(t.red&&t.red===i.red,"red works only with red numbers")},Red.prototype.imod=function imod(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Red.prototype.add=function add(t,i){this._verify2(t,i);var o=t.add(i);return o.cmp(this.m)>=0&&o.isub(this.m),o._forceRed(this)},Red.prototype.iadd=function iadd(t,i){this._verify2(t,i);var o=t.iadd(i);return o.cmp(this.m)>=0&&o.isub(this.m),o},Red.prototype.sub=function sub(t,i){this._verify2(t,i);var o=t.sub(i);return o.cmpn(0)<0&&o.iadd(this.m),o._forceRed(this)},Red.prototype.isub=function isub(t,i){this._verify2(t,i);var o=t.isub(i);return o.cmpn(0)<0&&o.iadd(this.m),o},Red.prototype.shl=function shl(t,i){return this._verify1(t),this.imod(t.ushln(i))},Red.prototype.imul=function imul(t,i){return this._verify2(t,i),this.imod(t.imul(i))},Red.prototype.mul=function mul(t,i){return this._verify2(t,i),this.imod(t.mul(i))},Red.prototype.isqr=function isqr(t){return this.imul(t,t.clone())},Red.prototype.sqr=function sqr(t){return this.mul(t,t)},Red.prototype.sqrt=function sqrt(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(assert(i%2==1),3===i){var o=this.m.add(new BN(1)).iushrn(2);return this.pow(t,o)}for(var a=this.m.subn(1),u=0;!a.isZero()&&0===a.andln(1);)u++,a.iushrn(1);assert(!a.isZero());var c=new BN(1).toRed(this),h=c.redNeg(),l=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,l).cmp(h);)d.redIAdd(h);for(var p=this.pow(d,a),m=this.pow(t,a.addn(1).iushrn(1)),g=this.pow(t,a),v=u;0!==g.cmp(c);){for(var b=g,w=0;0!==b.cmp(c);w++)b=b.redSqr();assert(w<v);var _=this.pow(p,new BN(1).iushln(v-w-1));m=m.redMul(_),p=_.redSqr(),g=g.redMul(p),v=w}return m},Red.prototype.invm=function invm(t){var i=t._invmp(this.m);return 0!==i.negative?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},Red.prototype.pow=function pow(t,i){if(i.isZero())return new BN(1).toRed(this);if(0===i.cmpn(1))return t.clone();var o=new Array(16);o[0]=new BN(1).toRed(this),o[1]=t;for(var a=2;a<o.length;a++)o[a]=this.mul(o[a-1],t);var u=o[0],c=0,h=0,l=i.bitLength()%26;for(0===l&&(l=26),a=i.length-1;a>=0;a--){for(var d=i.words[a],p=l-1;p>=0;p--){var m=d>>p&1;u!==o[0]&&(u=this.sqr(u)),0!==m||0!==c?(c<<=1,c|=m,(4===++h||0===a&&0===p)&&(u=this.mul(u,o[c]),h=0,c=0)):h=0}l=26}return u},Red.prototype.convertTo=function convertTo(t){var i=t.umod(this.m);return i===t?i.clone():i},Red.prototype.convertFrom=function convertFrom(t){var i=t.clone();return i.red=null,i},BN.mont=function mont(t){return new Mont(t)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(t){return this.imod(t.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},Mont.prototype.imul=function imul(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var o=t.imul(i),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=o.isub(a).iushrn(this.shift),c=u;return u.cmp(this.m)>=0?c=u.isub(this.m):u.cmpn(0)<0&&(c=u.iadd(this.m)),c._forceRed(this)},Mont.prototype.mul=function mul(t,i){if(t.isZero()||i.isZero())return new BN(0)._forceRed(this);var o=t.mul(i),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=o.isub(a).iushrn(this.shift),c=u;return u.cmp(this.m)>=0?c=u.isub(this.m):u.cmpn(0)<0&&(c=u.iadd(this.m)),c._forceRed(this)},Mont.prototype.invm=function invm(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,o(60)(t))},function(t,i,o){var a=o(711),u=o(179);function MillerRabin(t){this.rand=t||new u.Rand}t.exports=MillerRabin,MillerRabin.create=function create(t){return new MillerRabin(t)},MillerRabin.prototype._randbelow=function _randbelow(t){var i=t.bitLength(),o=Math.ceil(i/8);do{var u=new a(this.rand.generate(o))}while(u.cmp(t)>=0);return u},MillerRabin.prototype._randrange=function _randrange(t,i){var o=i.sub(t);return t.add(this._randbelow(o))},MillerRabin.prototype.test=function test(t,i,o){var u=t.bitLength(),c=a.mont(t),h=new a(1).toRed(c);i||(i=Math.max(1,u/48|0));for(var l=t.subn(1),d=0;!l.testn(d);d++);for(var p=t.shrn(d),m=l.toRed(c);i>0;i--){var g=this._randrange(new a(2),l);o&&o(g);var v=g.toRed(c).redPow(p);if(0!==v.cmp(h)&&0!==v.cmp(m)){for(var b=1;b<d;b++){if(0===(v=v.redSqr()).cmp(h))return!1;if(0===v.cmp(m))break}if(b===d)return!1}}return!0},MillerRabin.prototype.getDivisor=function getDivisor(t,i){var o=t.bitLength(),u=a.mont(t),c=new a(1).toRed(u);i||(i=Math.max(1,o/48|0));for(var h=t.subn(1),l=0;!h.testn(l);l++);for(var d=t.shrn(l),p=h.toRed(u);i>0;i--){var m=this._randrange(new a(2),h),g=t.gcd(m);if(0!==g.cmpn(1))return g;var v=m.toRed(u).redPow(d);if(0!==v.cmp(c)&&0!==v.cmp(p)){for(var b=1;b<l;b++){if(0===(v=v.redSqr()).cmp(c))return v.fromRed().subn(1).gcd(t);if(0===v.cmp(p))break}if(b===l)return(v=v.redSqr()).fromRed().subn(1).gcd(t)}}return!1}},function(t,i,o){"use strict";var a=i;function zero2(t){return 1===t.length?"0"+t:t}function toHex(t){for(var i="",o=0;o<t.length;o++)i+=zero2(t[o].toString(16));return i}a.toArray=function toArray(t,i){if(Array.isArray(t))return t.slice();if(!t)return[];var o=[];if("string"!=typeof t){for(var a=0;a<t.length;a++)o[a]=0|t[a];return o}if("hex"===i){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(a=0;a<t.length;a+=2)o.push(parseInt(t[a]+t[a+1],16))}else for(a=0;a<t.length;a++){var u=t.charCodeAt(a),c=u>>8,h=255&u;c?o.push(c,h):o.push(h)}return o},a.zero2=zero2,a.toHex=toHex,a.encode=function encode(t,i){return"hex"===i?toHex(t):t}},function(t,i,o){"use strict";var a=i;a.base=o(128),a.short=o(721),a.mont=o(722),a.edwards=o(723)},function(t,i,o){"use strict";var a=o(42).rotr32;function ch32(t,i,o){return t&i^~t&o}function maj32(t,i,o){return t&i^t&o^i&o}function p32(t,i,o){return t^i^o}i.ft_1=function ft_1(t,i,o,a){return 0===t?ch32(i,o,a):1===t||3===t?p32(i,o,a):2===t?maj32(i,o,a):void 0},i.ch32=ch32,i.maj32=maj32,i.p32=p32,i.s0_256=function s0_256(t){return a(t,2)^a(t,13)^a(t,22)},i.s1_256=function s1_256(t){return a(t,6)^a(t,11)^a(t,25)},i.g0_256=function g0_256(t){return a(t,7)^a(t,18)^t>>>3},i.g1_256=function g1_256(t){return a(t,17)^a(t,19)^t>>>10}},function(t,i,o){"use strict";var a=o(42),u=o(100),c=o(297),h=o(35),l=a.sum32,d=a.sum32_4,p=a.sum32_5,m=c.ch32,g=c.maj32,v=c.s0_256,b=c.s1_256,w=c.g0_256,_=c.g1_256,M=u.BlockHash,k=[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 SHA256(){if(!(this instanceof SHA256))return new SHA256;M.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=k,this.W=new Array(64)}a.inherits(SHA256,M),t.exports=SHA256,SHA256.blockSize=512,SHA256.outSize=256,SHA256.hmacStrength=192,SHA256.padLength=64,SHA256.prototype._update=function _update(t,i){for(var o=this.W,a=0;a<16;a++)o[a]=t[i+a];for(;a<o.length;a++)o[a]=d(_(o[a-2]),o[a-7],w(o[a-15]),o[a-16]);var u=this.h[0],c=this.h[1],M=this.h[2],k=this.h[3],B=this.h[4],P=this.h[5],x=this.h[6],I=this.h[7];for(h(this.k.length===o.length),a=0;a<o.length;a++){var N=p(I,b(B),m(B,P,x),this.k[a],o[a]),A=l(v(u),g(u,c,M));I=x,x=P,P=B,B=l(k,N),k=M,M=c,c=u,u=l(N,A)}this.h[0]=l(this.h[0],u),this.h[1]=l(this.h[1],c),this.h[2]=l(this.h[2],M),this.h[3]=l(this.h[3],k),this.h[4]=l(this.h[4],B),this.h[5]=l(this.h[5],P),this.h[6]=l(this.h[6],x),this.h[7]=l(this.h[7],I)},SHA256.prototype._digest=function digest(t){return"hex"===t?a.toHex32(this.h,"big"):a.split32(this.h,"big")}},function(t,i,o){"use strict";var a=o(42),u=o(100),c=o(35),h=a.rotr64_hi,l=a.rotr64_lo,d=a.shr64_hi,p=a.shr64_lo,m=a.sum64,g=a.sum64_hi,v=a.sum64_lo,b=a.sum64_4_hi,w=a.sum64_4_lo,_=a.sum64_5_hi,M=a.sum64_5_lo,k=u.BlockHash,B=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function SHA512(){if(!(this instanceof SHA512))return new SHA512;k.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=B,this.W=new Array(160)}function ch64_hi(t,i,o,a,u){var c=t&o^~t&u;return c<0&&(c+=4294967296),c}function ch64_lo(t,i,o,a,u,c){var h=i&a^~i&c;return h<0&&(h+=4294967296),h}function maj64_hi(t,i,o,a,u){var c=t&o^t&u^o&u;return c<0&&(c+=4294967296),c}function maj64_lo(t,i,o,a,u,c){var h=i&a^i&c^a&c;return h<0&&(h+=4294967296),h}function s0_512_hi(t,i){var o=h(t,i,28)^h(i,t,2)^h(i,t,7);return o<0&&(o+=4294967296),o}function s0_512_lo(t,i){var o=l(t,i,28)^l(i,t,2)^l(i,t,7);return o<0&&(o+=4294967296),o}function s1_512_hi(t,i){var o=h(t,i,14)^h(t,i,18)^h(i,t,9);return o<0&&(o+=4294967296),o}function s1_512_lo(t,i){var o=l(t,i,14)^l(t,i,18)^l(i,t,9);return o<0&&(o+=4294967296),o}function g0_512_hi(t,i){var o=h(t,i,1)^h(t,i,8)^d(t,i,7);return o<0&&(o+=4294967296),o}function g0_512_lo(t,i){var o=l(t,i,1)^l(t,i,8)^p(t,i,7);return o<0&&(o+=4294967296),o}function g1_512_hi(t,i){var o=h(t,i,19)^h(i,t,29)^d(t,i,6);return o<0&&(o+=4294967296),o}function g1_512_lo(t,i){var o=l(t,i,19)^l(i,t,29)^p(t,i,6);return o<0&&(o+=4294967296),o}a.inherits(SHA512,k),t.exports=SHA512,SHA512.blockSize=1024,SHA512.outSize=512,SHA512.hmacStrength=192,SHA512.padLength=128,SHA512.prototype._prepareBlock=function _prepareBlock(t,i){for(var o=this.W,a=0;a<32;a++)o[a]=t[i+a];for(;a<o.length;a+=2){var u=g1_512_hi(o[a-4],o[a-3]),c=g1_512_lo(o[a-4],o[a-3]),h=o[a-14],l=o[a-13],d=g0_512_hi(o[a-30],o[a-29]),p=g0_512_lo(o[a-30],o[a-29]),m=o[a-32],g=o[a-31];o[a]=b(u,c,h,l,d,p,m,g),o[a+1]=w(u,c,h,l,d,p,m,g)}},SHA512.prototype._update=function _update(t,i){this._prepareBlock(t,i);var o=this.W,a=this.h[0],u=this.h[1],h=this.h[2],l=this.h[3],d=this.h[4],p=this.h[5],b=this.h[6],w=this.h[7],k=this.h[8],B=this.h[9],P=this.h[10],x=this.h[11],I=this.h[12],N=this.h[13],A=this.h[14],C=this.h[15];c(this.k.length===o.length);for(var O=0;O<o.length;O+=2){var j=A,L=C,q=s1_512_hi(k,B),U=s1_512_lo(k,B),z=ch64_hi(k,B,P,x,I),H=ch64_lo(k,B,P,x,I,N),W=this.k[O],V=this.k[O+1],G=o[O],J=o[O+1],$=_(j,L,q,U,z,H,W,V,G,J),Z=M(j,L,q,U,z,H,W,V,G,J);j=s0_512_hi(a,u),L=s0_512_lo(a,u),q=maj64_hi(a,u,h,l,d),U=maj64_lo(a,u,h,l,d,p);var Y=g(j,L,q,U),X=v(j,L,q,U);A=I,C=N,I=P,N=x,P=k,x=B,k=g(b,w,$,Z),B=v(w,w,$,Z),b=d,w=p,d=h,p=l,h=a,l=u,a=g($,Z,Y,X),u=v($,Z,Y,X)}m(this.h,0,a,u),m(this.h,2,h,l),m(this.h,4,d,p),m(this.h,6,b,w),m(this.h,8,k,B),m(this.h,10,P,x),m(this.h,12,I,N),m(this.h,14,A,C)},SHA512.prototype._digest=function digest(t){return"hex"===t?a.toHex32(this.h,"big"):a.split32(this.h,"big")}},function(t,i,o){"use strict";const a=i;a.bignum=o(301),a.define=o(740).define,a.base=o(743),a.constants=o(744),a.decoders=o(304),a.encoders=o(302)},function(t,i,o){(function(t){!function(t,i){"use strict";function assert(t,i){if(!t)throw new Error(i||"Assertion failed")}function inherits(t,i){t.super_=i;var TempCtor=function(){};TempCtor.prototype=i.prototype,t.prototype=new TempCtor,t.prototype.constructor=t}function BN(t,i,o){if(BN.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(o=i,i=10),this._init(t||0,i||10,o||"be"))}var a;"object"==typeof t?t.exports=BN:i.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:o(739).Buffer}catch(t){}function parseHex4Bits(t,i){var o=t.charCodeAt(i);return o>=65&&o<=70?o-55:o>=97&&o<=102?o-87:o-48&15}function parseHexByte(t,i,o){var a=parseHex4Bits(t,o);return o-1>=i&&(a|=parseHex4Bits(t,o-1)<<4),a}function parseBase(t,i,o,a){for(var u=0,c=Math.min(t.length,o),h=i;h<c;h++){var l=t.charCodeAt(h)-48;u*=a,u+=l>=49?l-49+10:l>=17?l-17+10:l}return u}BN.isBN=function isBN(t){return t instanceof BN||null!==t&&"object"==typeof t&&t.constructor.wordSize===BN.wordSize&&Array.isArray(t.words)},BN.max=function max(t,i){return t.cmp(i)>0?t:i},BN.min=function min(t,i){return t.cmp(i)<0?t:i},BN.prototype._init=function init(t,i,o){if("number"==typeof t)return this._initNumber(t,i,o);if("object"==typeof t)return this._initArray(t,i,o);"hex"===i&&(i=16),assert(i===(0|i)&&i>=2&&i<=36);var a=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a<t.length&&(16===i?this._parseHex(t,a,o):(this._parseBase(t,i,a),"le"===o&&this._initArray(this.toArray(),i,o)))},BN.prototype._initNumber=function _initNumber(t,i,o){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(assert(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),i,o)},BN.prototype._initArray=function _initArray(t,i,o){if(assert("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var a=0;a<this.length;a++)this.words[a]=0;var u,c,h=0;if("be"===o)for(a=t.length-1,u=0;a>=0;a-=3)c=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[u]|=c<<h&67108863,this.words[u+1]=c>>>26-h&67108863,(h+=24)>=26&&(h-=26,u++);else if("le"===o)for(a=0,u=0;a<t.length;a+=3)c=t[a]|t[a+1]<<8|t[a+2]<<16,this.words[u]|=c<<h&67108863,this.words[u+1]=c>>>26-h&67108863,(h+=24)>=26&&(h-=26,u++);return this.strip()},BN.prototype._parseHex=function _parseHex(t,i,o){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var a=0;a<this.length;a++)this.words[a]=0;var u,c=0,h=0;if("be"===o)for(a=t.length-1;a>=i;a-=2)u=parseHexByte(t,i,a)<<c,this.words[h]|=67108863&u,c>=18?(c-=18,h+=1,this.words[h]|=u>>>26):c+=8;else for(a=(t.length-i)%2==0?i+1:i;a<t.length;a+=2)u=parseHexByte(t,i,a)<<c,this.words[h]|=67108863&u,c>=18?(c-=18,h+=1,this.words[h]|=u>>>26):c+=8;this.strip()},BN.prototype._parseBase=function _parseBase(t,i,o){this.words=[0],this.length=1;for(var a=0,u=1;u<=67108863;u*=i)a++;a--,u=u/i|0;for(var c=t.length-o,h=c%a,l=Math.min(c,c-h)+o,d=0,p=o;p<l;p+=a)d=parseBase(t,p,p+a,i),this.imuln(u),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d);if(0!==h){var m=1;for(d=parseBase(t,p,t.length,i),p=0;p<h;p++)m*=i;this.imuln(m),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d)}this.strip()},BN.prototype.copy=function copy(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},BN.prototype.clone=function clone(){var t=new BN(null);return this.copy(t),t},BN.prototype._expand=function _expand(t){for(;this.length<t;)this.words[this.length++]=0;return this},BN.prototype.strip=function strip(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(t,i,o){o.negative=i.negative^t.negative;var a=t.length+i.length|0;o.length=a,a=a-1|0;var u=0|t.words[0],c=0|i.words[0],h=u*c,l=67108863&h,d=h/67108864|0;o.words[0]=l;for(var p=1;p<a;p++){for(var m=d>>>26,g=67108863&d,v=Math.min(p,i.length-1),b=Math.max(0,p-t.length+1);b<=v;b++){var w=p-b|0;m+=(h=(u=0|t.words[w])*(c=0|i.words[b])+g)/67108864|0,g=67108863&h}o.words[p]=0|g,d=0|m}return 0!==d?o.words[p]=0|d:o.length--,o.strip()}BN.prototype.toString=function toString(t,i){var o;if(i=0|i||1,16===(t=t||10)||"hex"===t){o="";for(var a=0,l=0,d=0;d<this.length;d++){var p=this.words[d],m=(16777215&(p<<a|l)).toString(16);o=0!==(l=p>>>24-a&16777215)||d!==this.length-1?u[6-m.length]+m+o:m+o,(a+=2)>=26&&(a-=26,d--)}for(0!==l&&(o=l.toString(16)+o);o.length%i!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(t===(0|t)&&t>=2&&t<=36){var g=c[t],v=h[t];o="";var b=this.clone();for(b.negative=0;!b.isZero();){var w=b.modn(v).toString(t);o=(b=b.idivn(v)).isZero()?w+o:u[g-w.length]+w+o}for(this.isZero()&&(o="0"+o);o.length%i!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(t,i){return assert(void 0!==a),this.toArrayLike(a,t,i)},BN.prototype.toArray=function toArray(t,i){return this.toArrayLike(Array,t,i)},BN.prototype.toArrayLike=function toArrayLike(t,i,o){var a=this.byteLength(),u=o||Math.max(1,a);assert(a<=u,"byte array longer than desired length"),assert(u>0,"Requested array length <= 0"),this.strip();var c,h,l="le"===i,d=new t(u),p=this.clone();if(l){for(h=0;!p.isZero();h++)c=p.andln(255),p.iushrn(8),d[h]=c;for(;h<u;h++)d[h]=0}else{for(h=0;h<u-a;h++)d[h]=0;for(h=0;!p.isZero();h++)c=p.andln(255),p.iushrn(8),d[u-h-1]=c}return d},Math.clz32?BN.prototype._countBits=function _countBits(t){return 32-Math.clz32(t)}:BN.prototype._countBits=function _countBits(t){var i=t,o=0;return i>=4096&&(o+=13,i>>>=13),i>=64&&(o+=7,i>>>=7),i>=8&&(o+=4,i>>>=4),i>=2&&(o+=2,i>>>=2),o+i},BN.prototype._zeroBits=function _zeroBits(t){if(0===t)return 26;var i=t,o=0;return 0==(8191&i)&&(o+=13,i>>>=13),0==(127&i)&&(o+=7,i>>>=7),0==(15&i)&&(o+=4,i>>>=4),0==(3&i)&&(o+=2,i>>>=2),0==(1&i)&&o++,o},BN.prototype.bitLength=function bitLength(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var o=this._zeroBits(this.words[i]);if(t+=o,26!==o)break}return t},BN.prototype.byteLength=function byteLength(){return Math.ceil(this.bitLength()/8)},BN.prototype.toTwos=function toTwos(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},BN.prototype.fromTwos=function fromTwos(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},BN.prototype.isNeg=function isNeg(){return 0!==this.negative},BN.prototype.neg=function neg(){return this.clone().ineg()},BN.prototype.ineg=function ineg(){return this.isZero()||(this.negative^=1),this},BN.prototype.iuor=function iuor(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this.strip()},BN.prototype.ior=function ior(t){return assert(0==(this.negative|t.negative)),this.iuor(t)},BN.prototype.or=function or(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},BN.prototype.uor=function uor(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},BN.prototype.iuand=function iuand(t){var i;i=this.length>t.length?t:this;for(var o=0;o<i.length;o++)this.words[o]=this.words[o]&t.words[o];return this.length=i.length,this.strip()},BN.prototype.iand=function iand(t){return assert(0==(this.negative|t.negative)),this.iuand(t)},BN.prototype.and=function and(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},BN.prototype.uand=function uand(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},BN.prototype.iuxor=function iuxor(t){var i,o;this.length>t.length?(i=this,o=t):(i=t,o=this);for(var a=0;a<o.length;a++)this.words[a]=i.words[a]^o.words[a];if(this!==i)for(;a<i.length;a++)this.words[a]=i.words[a];return this.length=i.length,this.strip()},BN.prototype.ixor=function ixor(t){return assert(0==(this.negative|t.negative)),this.iuxor(t)},BN.prototype.xor=function xor(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},BN.prototype.uxor=function uxor(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},BN.prototype.inotn=function inotn(t){assert("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),o=t%26;this._expand(i),o>0&&i--;for(var a=0;a<i;a++)this.words[a]=67108863&~this.words[a];return o>0&&(this.words[a]=~this.words[a]&67108863>>26-o),this.strip()},BN.prototype.notn=function notn(t){return this.clone().inotn(t)},BN.prototype.setn=function setn(t,i){assert("number"==typeof t&&t>=0);var o=t/26|0,a=t%26;return this._expand(o+1),this.words[o]=i?this.words[o]|1<<a:this.words[o]&~(1<<a),this.strip()},BN.prototype.iadd=function iadd(t){var i,o,a;if(0!==this.negative&&0===t.negative)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();this.length>t.length?(o=this,a=t):(o=t,a=this);for(var u=0,c=0;c<a.length;c++)i=(0|o.words[c])+(0|a.words[c])+u,this.words[c]=67108863&i,u=i>>>26;for(;0!==u&&c<o.length;c++)i=(0|o.words[c])+u,this.words[c]=67108863&i,u=i>>>26;if(this.length=o.length,0!==u)this.words[this.length]=u,this.length++;else if(o!==this)for(;c<o.length;c++)this.words[c]=o.words[c];return this},BN.prototype.add=function add(t){var i;return 0!==t.negative&&0===this.negative?(t.negative=0,i=this.sub(t),t.negative^=1,i):0===t.negative&&0!==this.negative?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},BN.prototype.isub=function isub(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var o,a,u=this.cmp(t);if(0===u)return this.negative=0,this.length=1,this.words[0]=0,this;u>0?(o=this,a=t):(o=t,a=this);for(var c=0,h=0;h<a.length;h++)c=(i=(0|o.words[h])-(0|a.words[h])+c)>>26,this.words[h]=67108863&i;for(;0!==c&&h<o.length;h++)c=(i=(0|o.words[h])+c)>>26,this.words[h]=67108863&i;if(0===c&&h<o.length&&o!==this)for(;h<o.length;h++)this.words[h]=o.words[h];return this.length=Math.max(this.length,h),o!==this&&(this.negative=1),this.strip()},BN.prototype.sub=function sub(t){return this.clone().isub(t)};var l=function comb10MulTo(t,i,o){var a,u,c,h=t.words,l=i.words,d=o.words,p=0,m=0|h[0],g=8191&m,v=m>>>13,b=0|h[1],w=8191&b,_=b>>>13,M=0|h[2],k=8191&M,B=M>>>13,P=0|h[3],x=8191&P,I=P>>>13,N=0|h[4],A=8191&N,C=N>>>13,O=0|h[5],j=8191&O,L=O>>>13,q=0|h[6],U=8191&q,z=q>>>13,H=0|h[7],W=8191&H,V=H>>>13,G=0|h[8],J=8191&G,$=G>>>13,Z=0|h[9],Y=8191&Z,X=Z>>>13,Q=0|l[0],ee=8191&Q,te=Q>>>13,re=0|l[1],ne=8191&re,ie=re>>>13,oe=0|l[2],se=8191&oe,ae=oe>>>13,ue=0|l[3],ce=8191&ue,he=ue>>>13,le=0|l[4],fe=8191&le,de=le>>>13,pe=0|l[5],me=8191&pe,ge=pe>>>13,ve=0|l[6],ye=8191&ve,be=ve>>>13,we=0|l[7],_e=8191&we,Me=we>>>13,Se=0|l[8],ke=8191&Se,Ee=Se>>>13,Be=0|l[9],Pe=8191&Be,xe=Be>>>13;o.negative=t.negative^i.negative,o.length=19;var Te=(p+(a=Math.imul(g,ee))|0)+((8191&(u=(u=Math.imul(g,te))+Math.imul(v,ee)|0))<<13)|0;p=((c=Math.imul(v,te))+(u>>>13)|0)+(Te>>>26)|0,Te&=67108863,a=Math.imul(w,ee),u=(u=Math.imul(w,te))+Math.imul(_,ee)|0,c=Math.imul(_,te);var Ie=(p+(a=a+Math.imul(g,ne)|0)|0)+((8191&(u=(u=u+Math.imul(g,ie)|0)+Math.imul(v,ne)|0))<<13)|0;p=((c=c+Math.imul(v,ie)|0)+(u>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,a=Math.imul(k,ee),u=(u=Math.imul(k,te))+Math.imul(B,ee)|0,c=Math.imul(B,te),a=a+Math.imul(w,ne)|0,u=(u=u+Math.imul(w,ie)|0)+Math.imul(_,ne)|0,c=c+Math.imul(_,ie)|0;var Ne=(p+(a=a+Math.imul(g,se)|0)|0)+((8191&(u=(u=u+Math.imul(g,ae)|0)+Math.imul(v,se)|0))<<13)|0;p=((c=c+Math.imul(v,ae)|0)+(u>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,a=Math.imul(x,ee),u=(u=Math.imul(x,te))+Math.imul(I,ee)|0,c=Math.imul(I,te),a=a+Math.imul(k,ne)|0,u=(u=u+Math.imul(k,ie)|0)+Math.imul(B,ne)|0,c=c+Math.imul(B,ie)|0,a=a+Math.imul(w,se)|0,u=(u=u+Math.imul(w,ae)|0)+Math.imul(_,se)|0,c=c+Math.imul(_,ae)|0;var Ae=(p+(a=a+Math.imul(g,ce)|0)|0)+((8191&(u=(u=u+Math.imul(g,he)|0)+Math.imul(v,ce)|0))<<13)|0;p=((c=c+Math.imul(v,he)|0)+(u>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,a=Math.imul(A,ee),u=(u=Math.imul(A,te))+Math.imul(C,ee)|0,c=Math.imul(C,te),a=a+Math.imul(x,ne)|0,u=(u=u+Math.imul(x,ie)|0)+Math.imul(I,ne)|0,c=c+Math.imul(I,ie)|0,a=a+Math.imul(k,se)|0,u=(u=u+Math.imul(k,ae)|0)+Math.imul(B,se)|0,c=c+Math.imul(B,ae)|0,a=a+Math.imul(w,ce)|0,u=(u=u+Math.imul(w,he)|0)+Math.imul(_,ce)|0,c=c+Math.imul(_,he)|0;var Re=(p+(a=a+Math.imul(g,fe)|0)|0)+((8191&(u=(u=u+Math.imul(g,de)|0)+Math.imul(v,fe)|0))<<13)|0;p=((c=c+Math.imul(v,de)|0)+(u>>>13)|0)+(Re>>>26)|0,Re&=67108863,a=Math.imul(j,ee),u=(u=Math.imul(j,te))+Math.imul(L,ee)|0,c=Math.imul(L,te),a=a+Math.imul(A,ne)|0,u=(u=u+Math.imul(A,ie)|0)+Math.imul(C,ne)|0,c=c+Math.imul(C,ie)|0,a=a+Math.imul(x,se)|0,u=(u=u+Math.imul(x,ae)|0)+Math.imul(I,se)|0,c=c+Math.imul(I,ae)|0,a=a+Math.imul(k,ce)|0,u=(u=u+Math.imul(k,he)|0)+Math.imul(B,ce)|0,c=c+Math.imul(B,he)|0,a=a+Math.imul(w,fe)|0,u=(u=u+Math.imul(w,de)|0)+Math.imul(_,fe)|0,c=c+Math.imul(_,de)|0;var Ce=(p+(a=a+Math.imul(g,me)|0)|0)+((8191&(u=(u=u+Math.imul(g,ge)|0)+Math.imul(v,me)|0))<<13)|0;p=((c=c+Math.imul(v,ge)|0)+(u>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,a=Math.imul(U,ee),u=(u=Math.imul(U,te))+Math.imul(z,ee)|0,c=Math.imul(z,te),a=a+Math.imul(j,ne)|0,u=(u=u+Math.imul(j,ie)|0)+Math.imul(L,ne)|0,c=c+Math.imul(L,ie)|0,a=a+Math.imul(A,se)|0,u=(u=u+Math.imul(A,ae)|0)+Math.imul(C,se)|0,c=c+Math.imul(C,ae)|0,a=a+Math.imul(x,ce)|0,u=(u=u+Math.imul(x,he)|0)+Math.imul(I,ce)|0,c=c+Math.imul(I,he)|0,a=a+Math.imul(k,fe)|0,u=(u=u+Math.imul(k,de)|0)+Math.imul(B,fe)|0,c=c+Math.imul(B,de)|0,a=a+Math.imul(w,me)|0,u=(u=u+Math.imul(w,ge)|0)+Math.imul(_,me)|0,c=c+Math.imul(_,ge)|0;var Oe=(p+(a=a+Math.imul(g,ye)|0)|0)+((8191&(u=(u=u+Math.imul(g,be)|0)+Math.imul(v,ye)|0))<<13)|0;p=((c=c+Math.imul(v,be)|0)+(u>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,a=Math.imul(W,ee),u=(u=Math.imul(W,te))+Math.imul(V,ee)|0,c=Math.imul(V,te),a=a+Math.imul(U,ne)|0,u=(u=u+Math.imul(U,ie)|0)+Math.imul(z,ne)|0,c=c+Math.imul(z,ie)|0,a=a+Math.imul(j,se)|0,u=(u=u+Math.imul(j,ae)|0)+Math.imul(L,se)|0,c=c+Math.imul(L,ae)|0,a=a+Math.imul(A,ce)|0,u=(u=u+Math.imul(A,he)|0)+Math.imul(C,ce)|0,c=c+Math.imul(C,he)|0,a=a+Math.imul(x,fe)|0,u=(u=u+Math.imul(x,de)|0)+Math.imul(I,fe)|0,c=c+Math.imul(I,de)|0,a=a+Math.imul(k,me)|0,u=(u=u+Math.imul(k,ge)|0)+Math.imul(B,me)|0,c=c+Math.imul(B,ge)|0,a=a+Math.imul(w,ye)|0,u=(u=u+Math.imul(w,be)|0)+Math.imul(_,ye)|0,c=c+Math.imul(_,be)|0;var De=(p+(a=a+Math.imul(g,_e)|0)|0)+((8191&(u=(u=u+Math.imul(g,Me)|0)+Math.imul(v,_e)|0))<<13)|0;p=((c=c+Math.imul(v,Me)|0)+(u>>>13)|0)+(De>>>26)|0,De&=67108863,a=Math.imul(J,ee),u=(u=Math.imul(J,te))+Math.imul($,ee)|0,c=Math.imul($,te),a=a+Math.imul(W,ne)|0,u=(u=u+Math.imul(W,ie)|0)+Math.imul(V,ne)|0,c=c+Math.imul(V,ie)|0,a=a+Math.imul(U,se)|0,u=(u=u+Math.imul(U,ae)|0)+Math.imul(z,se)|0,c=c+Math.imul(z,ae)|0,a=a+Math.imul(j,ce)|0,u=(u=u+Math.imul(j,he)|0)+Math.imul(L,ce)|0,c=c+Math.imul(L,he)|0,a=a+Math.imul(A,fe)|0,u=(u=u+Math.imul(A,de)|0)+Math.imul(C,fe)|0,c=c+Math.imul(C,de)|0,a=a+Math.imul(x,me)|0,u=(u=u+Math.imul(x,ge)|0)+Math.imul(I,me)|0,c=c+Math.imul(I,ge)|0,a=a+Math.imul(k,ye)|0,u=(u=u+Math.imul(k,be)|0)+Math.imul(B,ye)|0,c=c+Math.imul(B,be)|0,a=a+Math.imul(w,_e)|0,u=(u=u+Math.imul(w,Me)|0)+Math.imul(_,_e)|0,c=c+Math.imul(_,Me)|0;var je=(p+(a=a+Math.imul(g,ke)|0)|0)+((8191&(u=(u=u+Math.imul(g,Ee)|0)+Math.imul(v,ke)|0))<<13)|0;p=((c=c+Math.imul(v,Ee)|0)+(u>>>13)|0)+(je>>>26)|0,je&=67108863,a=Math.imul(Y,ee),u=(u=Math.imul(Y,te))+Math.imul(X,ee)|0,c=Math.imul(X,te),a=a+Math.imul(J,ne)|0,u=(u=u+Math.imul(J,ie)|0)+Math.imul($,ne)|0,c=c+Math.imul($,ie)|0,a=a+Math.imul(W,se)|0,u=(u=u+Math.imul(W,ae)|0)+Math.imul(V,se)|0,c=c+Math.imul(V,ae)|0,a=a+Math.imul(U,ce)|0,u=(u=u+Math.imul(U,he)|0)+Math.imul(z,ce)|0,c=c+Math.imul(z,he)|0,a=a+Math.imul(j,fe)|0,u=(u=u+Math.imul(j,de)|0)+Math.imul(L,fe)|0,c=c+Math.imul(L,de)|0,a=a+Math.imul(A,me)|0,u=(u=u+Math.imul(A,ge)|0)+Math.imul(C,me)|0,c=c+Math.imul(C,ge)|0,a=a+Math.imul(x,ye)|0,u=(u=u+Math.imul(x,be)|0)+Math.imul(I,ye)|0,c=c+Math.imul(I,be)|0,a=a+Math.imul(k,_e)|0,u=(u=u+Math.imul(k,Me)|0)+Math.imul(B,_e)|0,c=c+Math.imul(B,Me)|0,a=a+Math.imul(w,ke)|0,u=(u=u+Math.imul(w,Ee)|0)+Math.imul(_,ke)|0,c=c+Math.imul(_,Ee)|0;var Le=(p+(a=a+Math.imul(g,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(g,xe)|0)+Math.imul(v,Pe)|0))<<13)|0;p=((c=c+Math.imul(v,xe)|0)+(u>>>13)|0)+(Le>>>26)|0,Le&=67108863,a=Math.imul(Y,ne),u=(u=Math.imul(Y,ie))+Math.imul(X,ne)|0,c=Math.imul(X,ie),a=a+Math.imul(J,se)|0,u=(u=u+Math.imul(J,ae)|0)+Math.imul($,se)|0,c=c+Math.imul($,ae)|0,a=a+Math.imul(W,ce)|0,u=(u=u+Math.imul(W,he)|0)+Math.imul(V,ce)|0,c=c+Math.imul(V,he)|0,a=a+Math.imul(U,fe)|0,u=(u=u+Math.imul(U,de)|0)+Math.imul(z,fe)|0,c=c+Math.imul(z,de)|0,a=a+Math.imul(j,me)|0,u=(u=u+Math.imul(j,ge)|0)+Math.imul(L,me)|0,c=c+Math.imul(L,ge)|0,a=a+Math.imul(A,ye)|0,u=(u=u+Math.imul(A,be)|0)+Math.imul(C,ye)|0,c=c+Math.imul(C,be)|0,a=a+Math.imul(x,_e)|0,u=(u=u+Math.imul(x,Me)|0)+Math.imul(I,_e)|0,c=c+Math.imul(I,Me)|0,a=a+Math.imul(k,ke)|0,u=(u=u+Math.imul(k,Ee)|0)+Math.imul(B,ke)|0,c=c+Math.imul(B,Ee)|0;var Fe=(p+(a=a+Math.imul(w,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(w,xe)|0)+Math.imul(_,Pe)|0))<<13)|0;p=((c=c+Math.imul(_,xe)|0)+(u>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,a=Math.imul(Y,se),u=(u=Math.imul(Y,ae))+Math.imul(X,se)|0,c=Math.imul(X,ae),a=a+Math.imul(J,ce)|0,u=(u=u+Math.imul(J,he)|0)+Math.imul($,ce)|0,c=c+Math.imul($,he)|0,a=a+Math.imul(W,fe)|0,u=(u=u+Math.imul(W,de)|0)+Math.imul(V,fe)|0,c=c+Math.imul(V,de)|0,a=a+Math.imul(U,me)|0,u=(u=u+Math.imul(U,ge)|0)+Math.imul(z,me)|0,c=c+Math.imul(z,ge)|0,a=a+Math.imul(j,ye)|0,u=(u=u+Math.imul(j,be)|0)+Math.imul(L,ye)|0,c=c+Math.imul(L,be)|0,a=a+Math.imul(A,_e)|0,u=(u=u+Math.imul(A,Me)|0)+Math.imul(C,_e)|0,c=c+Math.imul(C,Me)|0,a=a+Math.imul(x,ke)|0,u=(u=u+Math.imul(x,Ee)|0)+Math.imul(I,ke)|0,c=c+Math.imul(I,Ee)|0;var qe=(p+(a=a+Math.imul(k,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(k,xe)|0)+Math.imul(B,Pe)|0))<<13)|0;p=((c=c+Math.imul(B,xe)|0)+(u>>>13)|0)+(qe>>>26)|0,qe&=67108863,a=Math.imul(Y,ce),u=(u=Math.imul(Y,he))+Math.imul(X,ce)|0,c=Math.imul(X,he),a=a+Math.imul(J,fe)|0,u=(u=u+Math.imul(J,de)|0)+Math.imul($,fe)|0,c=c+Math.imul($,de)|0,a=a+Math.imul(W,me)|0,u=(u=u+Math.imul(W,ge)|0)+Math.imul(V,me)|0,c=c+Math.imul(V,ge)|0,a=a+Math.imul(U,ye)|0,u=(u=u+Math.imul(U,be)|0)+Math.imul(z,ye)|0,c=c+Math.imul(z,be)|0,a=a+Math.imul(j,_e)|0,u=(u=u+Math.imul(j,Me)|0)+Math.imul(L,_e)|0,c=c+Math.imul(L,Me)|0,a=a+Math.imul(A,ke)|0,u=(u=u+Math.imul(A,Ee)|0)+Math.imul(C,ke)|0,c=c+Math.imul(C,Ee)|0;var Ue=(p+(a=a+Math.imul(x,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(x,xe)|0)+Math.imul(I,Pe)|0))<<13)|0;p=((c=c+Math.imul(I,xe)|0)+(u>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,a=Math.imul(Y,fe),u=(u=Math.imul(Y,de))+Math.imul(X,fe)|0,c=Math.imul(X,de),a=a+Math.imul(J,me)|0,u=(u=u+Math.imul(J,ge)|0)+Math.imul($,me)|0,c=c+Math.imul($,ge)|0,a=a+Math.imul(W,ye)|0,u=(u=u+Math.imul(W,be)|0)+Math.imul(V,ye)|0,c=c+Math.imul(V,be)|0,a=a+Math.imul(U,_e)|0,u=(u=u+Math.imul(U,Me)|0)+Math.imul(z,_e)|0,c=c+Math.imul(z,Me)|0,a=a+Math.imul(j,ke)|0,u=(u=u+Math.imul(j,Ee)|0)+Math.imul(L,ke)|0,c=c+Math.imul(L,Ee)|0;var ze=(p+(a=a+Math.imul(A,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(A,xe)|0)+Math.imul(C,Pe)|0))<<13)|0;p=((c=c+Math.imul(C,xe)|0)+(u>>>13)|0)+(ze>>>26)|0,ze&=67108863,a=Math.imul(Y,me),u=(u=Math.imul(Y,ge))+Math.imul(X,me)|0,c=Math.imul(X,ge),a=a+Math.imul(J,ye)|0,u=(u=u+Math.imul(J,be)|0)+Math.imul($,ye)|0,c=c+Math.imul($,be)|0,a=a+Math.imul(W,_e)|0,u=(u=u+Math.imul(W,Me)|0)+Math.imul(V,_e)|0,c=c+Math.imul(V,Me)|0,a=a+Math.imul(U,ke)|0,u=(u=u+Math.imul(U,Ee)|0)+Math.imul(z,ke)|0,c=c+Math.imul(z,Ee)|0;var He=(p+(a=a+Math.imul(j,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(j,xe)|0)+Math.imul(L,Pe)|0))<<13)|0;p=((c=c+Math.imul(L,xe)|0)+(u>>>13)|0)+(He>>>26)|0,He&=67108863,a=Math.imul(Y,ye),u=(u=Math.imul(Y,be))+Math.imul(X,ye)|0,c=Math.imul(X,be),a=a+Math.imul(J,_e)|0,u=(u=u+Math.imul(J,Me)|0)+Math.imul($,_e)|0,c=c+Math.imul($,Me)|0,a=a+Math.imul(W,ke)|0,u=(u=u+Math.imul(W,Ee)|0)+Math.imul(V,ke)|0,c=c+Math.imul(V,Ee)|0;var We=(p+(a=a+Math.imul(U,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(U,xe)|0)+Math.imul(z,Pe)|0))<<13)|0;p=((c=c+Math.imul(z,xe)|0)+(u>>>13)|0)+(We>>>26)|0,We&=67108863,a=Math.imul(Y,_e),u=(u=Math.imul(Y,Me))+Math.imul(X,_e)|0,c=Math.imul(X,Me),a=a+Math.imul(J,ke)|0,u=(u=u+Math.imul(J,Ee)|0)+Math.imul($,ke)|0,c=c+Math.imul($,Ee)|0;var Ke=(p+(a=a+Math.imul(W,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(W,xe)|0)+Math.imul(V,Pe)|0))<<13)|0;p=((c=c+Math.imul(V,xe)|0)+(u>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,a=Math.imul(Y,ke),u=(u=Math.imul(Y,Ee))+Math.imul(X,ke)|0,c=Math.imul(X,Ee);var Ve=(p+(a=a+Math.imul(J,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(J,xe)|0)+Math.imul($,Pe)|0))<<13)|0;p=((c=c+Math.imul($,xe)|0)+(u>>>13)|0)+(Ve>>>26)|0,Ve&=67108863;var Ge=(p+(a=Math.imul(Y,Pe))|0)+((8191&(u=(u=Math.imul(Y,xe))+Math.imul(X,Pe)|0))<<13)|0;return p=((c=Math.imul(X,xe))+(u>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,d[0]=Te,d[1]=Ie,d[2]=Ne,d[3]=Ae,d[4]=Re,d[5]=Ce,d[6]=Oe,d[7]=De,d[8]=je,d[9]=Le,d[10]=Fe,d[11]=qe,d[12]=Ue,d[13]=ze,d[14]=He,d[15]=We,d[16]=Ke,d[17]=Ve,d[18]=Ge,0!==p&&(d[19]=p,o.length++),o};function jumboMulTo(t,i,o){return(new FFTM).mulp(t,i,o)}function FFTM(t,i){this.x=t,this.y=i}Math.imul||(l=smallMulTo),BN.prototype.mulTo=function mulTo(t,i){var o=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,i):o<63?smallMulTo(this,t,i):o<1024?function bigMulTo(t,i,o){o.negative=i.negative^t.negative,o.length=t.length+i.length;for(var a=0,u=0,c=0;c<o.length-1;c++){var h=u;u=0;for(var l=67108863&a,d=Math.min(c,i.length-1),p=Math.max(0,c-t.length+1);p<=d;p++){var m=c-p,g=(0|t.words[m])*(0|i.words[p]),v=67108863&g;l=67108863&(v=v+l|0),u+=(h=(h=h+(g/67108864|0)|0)+(v>>>26)|0)>>>26,h&=67108863}o.words[c]=l,a=h,h=u}return 0!==a?o.words[c]=a:o.length--,o.strip()}(this,t,i):jumboMulTo(this,t,i)},FFTM.prototype.makeRBT=function makeRBT(t){for(var i=new Array(t),o=BN.prototype._countBits(t)-1,a=0;a<t;a++)i[a]=this.revBin(a,o,t);return i},FFTM.prototype.revBin=function revBin(t,i,o){if(0===t||t===o-1)return t;for(var a=0,u=0;u<i;u++)a|=(1&t)<<i-u-1,t>>=1;return a},FFTM.prototype.permute=function permute(t,i,o,a,u,c){for(var h=0;h<c;h++)a[h]=i[t[h]],u[h]=o[t[h]]},FFTM.prototype.transform=function transform(t,i,o,a,u,c){this.permute(c,t,i,o,a,u);for(var h=1;h<u;h<<=1)for(var l=h<<1,d=Math.cos(2*Math.PI/l),p=Math.sin(2*Math.PI/l),m=0;m<u;m+=l)for(var g=d,v=p,b=0;b<h;b++){var w=o[m+b],_=a[m+b],M=o[m+b+h],k=a[m+b+h],B=g*M-v*k;k=g*k+v*M,M=B,o[m+b]=w+M,a[m+b]=_+k,o[m+b+h]=w-M,a[m+b+h]=_-k,b!==l&&(B=d*g-p*v,v=d*v+p*g,g=B)}},FFTM.prototype.guessLen13b=function guessLen13b(t,i){var o=1|Math.max(i,t),a=1&o,u=0;for(o=o/2|0;o;o>>>=1)u++;return 1<<u+1+a},FFTM.prototype.conjugate=function conjugate(t,i,o){if(!(o<=1))for(var a=0;a<o/2;a++){var u=t[a];t[a]=t[o-a-1],t[o-a-1]=u,u=i[a],i[a]=-i[o-a-1],i[o-a-1]=-u}},FFTM.prototype.normalize13b=function normalize13b(t,i){for(var o=0,a=0;a<i/2;a++){var u=8192*Math.round(t[2*a+1]/i)+Math.round(t[2*a]/i)+o;t[a]=67108863&u,o=u<67108864?0:u/67108864|0}return t},FFTM.prototype.convert13b=function convert13b(t,i,o,a){for(var u=0,c=0;c<i;c++)u+=0|t[c],o[2*c]=8191&u,u>>>=13,o[2*c+1]=8191&u,u>>>=13;for(c=2*i;c<a;++c)o[c]=0;assert(0===u),assert(0==(-8192&u))},FFTM.prototype.stub=function stub(t){for(var i=new Array(t),o=0;o<t;o++)i[o]=0;return i},FFTM.prototype.mulp=function mulp(t,i,o){var a=2*this.guessLen13b(t.length,i.length),u=this.makeRBT(a),c=this.stub(a),h=new Array(a),l=new Array(a),d=new Array(a),p=new Array(a),m=new Array(a),g=new Array(a),v=o.words;v.length=a,this.convert13b(t.words,t.length,h,a),this.convert13b(i.words,i.length,p,a),this.transform(h,c,l,d,a,u),this.transform(p,c,m,g,a,u);for(var b=0;b<a;b++){var w=l[b]*m[b]-d[b]*g[b];d[b]=l[b]*g[b]+d[b]*m[b],l[b]=w}return this.conjugate(l,d,a),this.transform(l,d,v,c,a,u),this.conjugate(v,c,a),this.normalize13b(v,a),o.negative=t.negative^i.negative,o.length=t.length+i.length,o.strip()},BN.prototype.mul=function mul(t){var i=new BN(null);return i.words=new Array(this.length+t.length),this.mulTo(t,i)},BN.prototype.mulf=function mulf(t){var i=new BN(null);return i.words=new Array(this.length+t.length),jumboMulTo(this,t,i)},BN.prototype.imul=function imul(t){return this.clone().mulTo(t,this)},BN.prototype.imuln=function imuln(t){assert("number"==typeof t),assert(t<67108864);for(var i=0,o=0;o<this.length;o++){var a=(0|this.words[o])*t,u=(67108863&a)+(67108863&i);i>>=26,i+=a/67108864|0,i+=u>>>26,this.words[o]=67108863&u}return 0!==i&&(this.words[o]=i,this.length++),this},BN.prototype.muln=function muln(t){return this.clone().imuln(t)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(t){var i=function toBitArray(t){for(var i=new Array(t.bitLength()),o=0;o<i.length;o++){var a=o/26|0,u=o%26;i[o]=(t.words[a]&1<<u)>>>u}return i}(t);if(0===i.length)return new BN(1);for(var o=this,a=0;a<i.length&&0===i[a];a++,o=o.sqr());if(++a<i.length)for(var u=o.sqr();a<i.length;a++,u=u.sqr())0!==i[a]&&(o=o.mul(u));return o},BN.prototype.iushln=function iushln(t){assert("number"==typeof t&&t>=0);var i,o=t%26,a=(t-o)/26,u=67108863>>>26-o<<26-o;if(0!==o){var c=0;for(i=0;i<this.length;i++){var h=this.words[i]&u,l=(0|this.words[i])-h<<o;this.words[i]=l|c,c=h>>>26-o}c&&(this.words[i]=c,this.length++)}if(0!==a){for(i=this.length-1;i>=0;i--)this.words[i+a]=this.words[i];for(i=0;i<a;i++)this.words[i]=0;this.length+=a}return this.strip()},BN.prototype.ishln=function ishln(t){return assert(0===this.negative),this.iushln(t)},BN.prototype.iushrn=function iushrn(t,i,o){var a;assert("number"==typeof t&&t>=0),a=i?(i-i%26)/26:0;var u=t%26,c=Math.min((t-u)/26,this.length),h=67108863^67108863>>>u<<u,l=o;if(a-=c,a=Math.max(0,a),l){for(var d=0;d<c;d++)l.words[d]=this.words[d];l.length=c}if(0===c);else if(this.length>c)for(this.length-=c,d=0;d<this.length;d++)this.words[d]=this.words[d+c];else this.words[0]=0,this.length=1;var p=0;for(d=this.length-1;d>=0&&(0!==p||d>=a);d--){var m=0|this.words[d];this.words[d]=p<<26-u|m>>>u,p=m&h}return l&&0!==p&&(l.words[l.length++]=p),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(t,i,o){return assert(0===this.negative),this.iushrn(t,i,o)},BN.prototype.shln=function shln(t){return this.clone().ishln(t)},BN.prototype.ushln=function ushln(t){return this.clone().iushln(t)},BN.prototype.shrn=function shrn(t){return this.clone().ishrn(t)},BN.prototype.ushrn=function ushrn(t){return this.clone().iushrn(t)},BN.prototype.testn=function testn(t){assert("number"==typeof t&&t>=0);var i=t%26,o=(t-i)/26,a=1<<i;return!(this.length<=o)&&!!(this.words[o]&a)},BN.prototype.imaskn=function imaskn(t){assert("number"==typeof t&&t>=0);var i=t%26,o=(t-i)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==i&&o++,this.length=Math.min(o,this.length),0!==i){var a=67108863^67108863>>>i<<i;this.words[this.length-1]&=a}return this.strip()},BN.prototype.maskn=function maskn(t){return this.clone().imaskn(t)},BN.prototype.iaddn=function iaddn(t){return assert("number"==typeof t),assert(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},BN.prototype._iaddn=function _iaddn(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},BN.prototype.isubn=function isubn(t){if(assert("number"==typeof t),assert(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this.strip()},BN.prototype.addn=function addn(t){return this.clone().iaddn(t)},BN.prototype.subn=function subn(t){return this.clone().isubn(t)},BN.prototype.iabs=function iabs(){return this.negative=0,this},BN.prototype.abs=function abs(){return this.clone().iabs()},BN.prototype._ishlnsubmul=function _ishlnsubmul(t,i,o){var a,u,c=t.length+o;this._expand(c);var h=0;for(a=0;a<t.length;a++){u=(0|this.words[a+o])+h;var l=(0|t.words[a])*i;h=((u-=67108863&l)>>26)-(l/67108864|0),this.words[a+o]=67108863&u}for(;a<this.length-o;a++)h=(u=(0|this.words[a+o])+h)>>26,this.words[a+o]=67108863&u;if(0===h)return this.strip();for(assert(-1===h),h=0,a=0;a<this.length;a++)h=(u=-(0|this.words[a])+h)>>26,this.words[a]=67108863&u;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(t,i){var o=(this.length,t.length),a=this.clone(),u=t,c=0|u.words[u.length-1];0!==(o=26-this._countBits(c))&&(u=u.ushln(o),a.iushln(o),c=0|u.words[u.length-1]);var h,l=a.length-u.length;if("mod"!==i){(h=new BN(null)).length=l+1,h.words=new Array(h.length);for(var d=0;d<h.length;d++)h.words[d]=0}var p=a.clone()._ishlnsubmul(u,1,l);0===p.negative&&(a=p,h&&(h.words[l]=1));for(var m=l-1;m>=0;m--){var g=67108864*(0|a.words[u.length+m])+(0|a.words[u.length+m-1]);for(g=Math.min(g/c|0,67108863),a._ishlnsubmul(u,g,m);0!==a.negative;)g--,a.negative=0,a._ishlnsubmul(u,1,m),a.isZero()||(a.negative^=1);h&&(h.words[m]=g)}return h&&h.strip(),a.strip(),"div"!==i&&0!==o&&a.iushrn(o),{div:h||null,mod:a}},BN.prototype.divmod=function divmod(t,i,o){return assert(!t.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===t.negative?(c=this.neg().divmod(t,i),"mod"!==i&&(a=c.div.neg()),"div"!==i&&(u=c.mod.neg(),o&&0!==u.negative&&u.iadd(t)),{div:a,mod:u}):0===this.negative&&0!==t.negative?(c=this.divmod(t.neg(),i),"mod"!==i&&(a=c.div.neg()),{div:a,mod:c.mod}):0!=(this.negative&t.negative)?(c=this.neg().divmod(t.neg(),i),"div"!==i&&(u=c.mod.neg(),o&&0!==u.negative&&u.isub(t)),{div:c.div,mod:u}):t.length>this.length||this.cmp(t)<0?{div:new BN(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new BN(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new BN(this.modn(t.words[0]))}:this._wordDiv(t,i);var a,u,c},BN.prototype.div=function div(t){return this.divmod(t,"div",!1).div},BN.prototype.mod=function mod(t){return this.divmod(t,"mod",!1).mod},BN.prototype.umod=function umod(t){return this.divmod(t,"mod",!0).mod},BN.prototype.divRound=function divRound(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var o=0!==i.div.negative?i.mod.isub(t):i.mod,a=t.ushrn(1),u=t.andln(1),c=o.cmp(a);return c<0||1===u&&0===c?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},BN.prototype.modn=function modn(t){assert(t<=67108863);for(var i=(1<<26)%t,o=0,a=this.length-1;a>=0;a--)o=(i*o+(0|this.words[a]))%t;return o},BN.prototype.idivn=function idivn(t){assert(t<=67108863);for(var i=0,o=this.length-1;o>=0;o--){var a=(0|this.words[o])+67108864*i;this.words[o]=a/t|0,i=a%t}return this.strip()},BN.prototype.divn=function divn(t){return this.clone().idivn(t)},BN.prototype.egcd=function egcd(t){assert(0===t.negative),assert(!t.isZero());var i=this,o=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var a=new BN(1),u=new BN(0),c=new BN(0),h=new BN(1),l=0;i.isEven()&&o.isEven();)i.iushrn(1),o.iushrn(1),++l;for(var d=o.clone(),p=i.clone();!i.isZero();){for(var m=0,g=1;0==(i.words[0]&g)&&m<26;++m,g<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(p)),a.iushrn(1),u.iushrn(1);for(var v=0,b=1;0==(o.words[0]&b)&&v<26;++v,b<<=1);if(v>0)for(o.iushrn(v);v-- >0;)(c.isOdd()||h.isOdd())&&(c.iadd(d),h.isub(p)),c.iushrn(1),h.iushrn(1);i.cmp(o)>=0?(i.isub(o),a.isub(c),u.isub(h)):(o.isub(i),c.isub(a),h.isub(u))}return{a:c,b:h,gcd:o.iushln(l)}},BN.prototype._invmp=function _invmp(t){assert(0===t.negative),assert(!t.isZero());var i=this,o=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var a,u=new BN(1),c=new BN(0),h=o.clone();i.cmpn(1)>0&&o.cmpn(1)>0;){for(var l=0,d=1;0==(i.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(i.iushrn(l);l-- >0;)u.isOdd()&&u.iadd(h),u.iushrn(1);for(var p=0,m=1;0==(o.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(o.iushrn(p);p-- >0;)c.isOdd()&&c.iadd(h),c.iushrn(1);i.cmp(o)>=0?(i.isub(o),u.isub(c)):(o.isub(i),c.isub(u))}return(a=0===i.cmpn(1)?u:c).cmpn(0)<0&&a.iadd(t),a},BN.prototype.gcd=function gcd(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),o=t.clone();i.negative=0,o.negative=0;for(var a=0;i.isEven()&&o.isEven();a++)i.iushrn(1),o.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;o.isEven();)o.iushrn(1);var u=i.cmp(o);if(u<0){var c=i;i=o,o=c}else if(0===u||0===o.cmpn(1))break;i.isub(o)}return o.iushln(a)},BN.prototype.invm=function invm(t){return this.egcd(t).a.umod(t)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(t){return this.words[0]&t},BN.prototype.bincn=function bincn(t){assert("number"==typeof t);var i=t%26,o=(t-i)/26,a=1<<i;if(this.length<=o)return this._expand(o+1),this.words[o]|=a,this;for(var u=a,c=o;0!==u&&c<this.length;c++){var h=0|this.words[c];u=(h+=u)>>>26,h&=67108863,this.words[c]=h}return 0!==u&&(this.words[c]=u,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(t){var i,o=t<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this.strip(),this.length>1)i=1;else{o&&(t=-t),assert(t<=67108863,"Number is too big");var a=0|this.words[0];i=a===t?0:a<t?-1:1}return 0!==this.negative?0|-i:i},BN.prototype.cmp=function cmp(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var i=this.ucmp(t);return 0!==this.negative?0|-i:i},BN.prototype.ucmp=function ucmp(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,o=this.length-1;o>=0;o--){var a=0|this.words[o],u=0|t.words[o];if(a!==u){a<u?i=-1:a>u&&(i=1);break}}return i},BN.prototype.gtn=function gtn(t){return 1===this.cmpn(t)},BN.prototype.gt=function gt(t){return 1===this.cmp(t)},BN.prototype.gten=function gten(t){return this.cmpn(t)>=0},BN.prototype.gte=function gte(t){return this.cmp(t)>=0},BN.prototype.ltn=function ltn(t){return-1===this.cmpn(t)},BN.prototype.lt=function lt(t){return-1===this.cmp(t)},BN.prototype.lten=function lten(t){return this.cmpn(t)<=0},BN.prototype.lte=function lte(t){return this.cmp(t)<=0},BN.prototype.eqn=function eqn(t){return 0===this.cmpn(t)},BN.prototype.eq=function eq(t){return 0===this.cmp(t)},BN.red=function red(t){return new Red(t)},BN.prototype.toRed=function toRed(t){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(t){return this.red=t,this},BN.prototype.forceRed=function forceRed(t){return assert(!this.red,"Already a number in reduction context"),this._forceRed(t)},BN.prototype.redAdd=function redAdd(t){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},BN.prototype.redIAdd=function redIAdd(t){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},BN.prototype.redSub=function redSub(t){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},BN.prototype.redISub=function redISub(t){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},BN.prototype.redShl=function redShl(t){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},BN.prototype.redMul=function redMul(t){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},BN.prototype.redIMul=function redIMul(t){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(t){return assert(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(t,i){this.name=t,this.p=new BN(i,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(t){if("string"==typeof t){var i=BN._prime(t);this.m=i.p,this.prime=i}else assert(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function Mont(t){Red.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var t=new BN(null);return t.words=new Array(Math.ceil(this.n/13)),t},MPrime.prototype.ireduce=function ireduce(t){var i,o=t;do{this.split(o,this.tmp),i=(o=(o=this.imulK(o)).iadd(this.tmp)).bitLength()}while(i>this.n);var a=i<this.n?-1:o.ucmp(this.p);return 0===a?(o.words[0]=0,o.length=1):a>0?o.isub(this.p):void 0!==o.strip?o.strip():o._strip(),o},MPrime.prototype.split=function split(t,i){t.iushrn(this.n,0,i)},MPrime.prototype.imulK=function imulK(t){return t.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(t,i){for(var o=Math.min(t.length,9),a=0;a<o;a++)i.words[a]=t.words[a];if(i.length=o,t.length<=9)return t.words[0]=0,void(t.length=1);var u=t.words[9];for(i.words[i.length++]=4194303&u,a=10;a<t.length;a++){var c=0|t.words[a];t.words[a-10]=(4194303&c)<<4|u>>>22,u=c}u>>>=22,t.words[a-10]=u,0===u&&t.length>10?t.length-=10:t.length-=9},K256.prototype.imulK=function imulK(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,o=0;o<t.length;o++){var a=0|t.words[o];i+=977*a,t.words[o]=67108863&i,i=64*a+(i/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},inherits(P224,MPrime),inherits(P192,MPrime),inherits(P25519,MPrime),P25519.prototype.imulK=function imulK(t){for(var i=0,o=0;o<t.length;o++){var a=19*(0|t.words[o])+i,u=67108863&a;a>>>=26,t.words[o]=u,i=a}return 0!==i&&(t.words[t.length++]=i),t},BN._prime=function prime(t){if(d[t])return d[t];var prime;if("k256"===t)prime=new K256;else if("p224"===t)prime=new P224;else if("p192"===t)prime=new P192;else{if("p25519"!==t)throw new Error("Unknown prime "+t);prime=new P25519}return d[t]=prime,prime},Red.prototype._verify1=function _verify1(t){assert(0===t.negative,"red works only with positives"),assert(t.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(t,i){assert(0==(t.negative|i.negative),"red works only with positives"),assert(t.red&&t.red===i.red,"red works only with red numbers")},Red.prototype.imod=function imod(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Red.prototype.add=function add(t,i){this._verify2(t,i);var o=t.add(i);return o.cmp(this.m)>=0&&o.isub(this.m),o._forceRed(this)},Red.prototype.iadd=function iadd(t,i){this._verify2(t,i);var o=t.iadd(i);return o.cmp(this.m)>=0&&o.isub(this.m),o},Red.prototype.sub=function sub(t,i){this._verify2(t,i);var o=t.sub(i);return o.cmpn(0)<0&&o.iadd(this.m),o._forceRed(this)},Red.prototype.isub=function isub(t,i){this._verify2(t,i);var o=t.isub(i);return o.cmpn(0)<0&&o.iadd(this.m),o},Red.prototype.shl=function shl(t,i){return this._verify1(t),this.imod(t.ushln(i))},Red.prototype.imul=function imul(t,i){return this._verify2(t,i),this.imod(t.imul(i))},Red.prototype.mul=function mul(t,i){return this._verify2(t,i),this.imod(t.mul(i))},Red.prototype.isqr=function isqr(t){return this.imul(t,t.clone())},Red.prototype.sqr=function sqr(t){return this.mul(t,t)},Red.prototype.sqrt=function sqrt(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(assert(i%2==1),3===i){var o=this.m.add(new BN(1)).iushrn(2);return this.pow(t,o)}for(var a=this.m.subn(1),u=0;!a.isZero()&&0===a.andln(1);)u++,a.iushrn(1);assert(!a.isZero());var c=new BN(1).toRed(this),h=c.redNeg(),l=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,l).cmp(h);)d.redIAdd(h);for(var p=this.pow(d,a),m=this.pow(t,a.addn(1).iushrn(1)),g=this.pow(t,a),v=u;0!==g.cmp(c);){for(var b=g,w=0;0!==b.cmp(c);w++)b=b.redSqr();assert(w<v);var _=this.pow(p,new BN(1).iushln(v-w-1));m=m.redMul(_),p=_.redSqr(),g=g.redMul(p),v=w}return m},Red.prototype.invm=function invm(t){var i=t._invmp(this.m);return 0!==i.negative?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},Red.prototype.pow=function pow(t,i){if(i.isZero())return new BN(1).toRed(this);if(0===i.cmpn(1))return t.clone();var o=new Array(16);o[0]=new BN(1).toRed(this),o[1]=t;for(var a=2;a<o.length;a++)o[a]=this.mul(o[a-1],t);var u=o[0],c=0,h=0,l=i.bitLength()%26;for(0===l&&(l=26),a=i.length-1;a>=0;a--){for(var d=i.words[a],p=l-1;p>=0;p--){var m=d>>p&1;u!==o[0]&&(u=this.sqr(u)),0!==m||0!==c?(c<<=1,c|=m,(4===++h||0===a&&0===p)&&(u=this.mul(u,o[c]),h=0,c=0)):h=0}l=26}return u},Red.prototype.convertTo=function convertTo(t){var i=t.umod(this.m);return i===t?i.clone():i},Red.prototype.convertFrom=function convertFrom(t){var i=t.clone();return i.red=null,i},BN.mont=function mont(t){return new Mont(t)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(t){return this.imod(t.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},Mont.prototype.imul=function imul(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var o=t.imul(i),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=o.isub(a).iushrn(this.shift),c=u;return u.cmp(this.m)>=0?c=u.isub(this.m):u.cmpn(0)<0&&(c=u.iadd(this.m)),c._forceRed(this)},Mont.prototype.mul=function mul(t,i){if(t.isZero()||i.isZero())return new BN(0)._forceRed(this);var o=t.mul(i),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=o.isub(a).iushrn(this.shift),c=u;return u.cmp(this.m)>=0?c=u.isub(this.m):u.cmpn(0)<0&&(c=u.iadd(this.m)),c._forceRed(this)},Mont.prototype.invm=function invm(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,o(60)(t))},function(t,i,o){"use strict";const a=i;a.der=o(303),a.pem=o(741)},function(t,i,o){"use strict";const a=o(1),u=o(186).Buffer,c=o(187),h=o(189);function DEREncoder(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new DERNode,this.tree._init(t.body)}function DERNode(t){c.call(this,"der",t)}function two(t){return t<10?"0"+t:t}t.exports=DEREncoder,DEREncoder.prototype.encode=function encode(t,i){return this.tree._encode(t,i).join()},a(DERNode,c),DERNode.prototype._encodeComposite=function encodeComposite(t,i,o,a){const c=function encodeTag(t,i,o,a){let u;"seqof"===t?t="seq":"setof"===t&&(t="set");if(h.tagByName.hasOwnProperty(t))u=h.tagByName[t];else{if("number"!=typeof t||(0|t)!==t)return a.error("Unknown tag: "+t);u=t}if(u>=31)return a.error("Multi-octet tag encoding unsupported");i||(u|=32);return u|=h.tagClassByName[o||"universal"]<<6,u}(t,i,o,this.reporter);if(a.length<128){const t=u.alloc(2);return t[0]=c,t[1]=a.length,this._createEncoderBuffer([t,a])}let l=1;for(let t=a.length;t>=256;t>>=8)l++;const d=u.alloc(2+l);d[0]=c,d[1]=128|l;for(let t=1+l,i=a.length;i>0;t--,i>>=8)d[t]=255&i;return this._createEncoderBuffer([d,a])},DERNode.prototype._encodeStr=function encodeStr(t,i){if("bitstr"===i)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===i){const i=u.alloc(2*t.length);for(let o=0;o<t.length;o++)i.writeUInt16BE(t.charCodeAt(o),2*o);return this._createEncoderBuffer(i)}return"numstr"===i?this._isNumstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===i?this._isPrintstr(t)?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(i)||"objDesc"===i?this._createEncoderBuffer(t):this.reporter.error("Encoding of string type: "+i+" unsupported")},DERNode.prototype._encodeObjid=function encodeObjid(t,i,o){if("string"==typeof t){if(!i)return this.reporter.error("string objid given, but no values map found");if(!i.hasOwnProperty(t))return this.reporter.error("objid not found in values map");t=i[t].split(/[\s.]+/g);for(let i=0;i<t.length;i++)t[i]|=0}else if(Array.isArray(t)){t=t.slice();for(let i=0;i<t.length;i++)t[i]|=0}if(!Array.isArray(t))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(t));if(!o){if(t[1]>=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}let a=0;for(let i=0;i<t.length;i++){let o=t[i];for(a++;o>=128;o>>=7)a++}const c=u.alloc(a);let h=c.length-1;for(let i=t.length-1;i>=0;i--){let o=t[i];for(c[h--]=127&o;(o>>=7)>0;)c[h--]=128|127&o}return this._createEncoderBuffer(c)},DERNode.prototype._encodeTime=function encodeTime(t,i){let o;const a=new Date(t);return"gentime"===i?o=[two(a.getUTCFullYear()),two(a.getUTCMonth()+1),two(a.getUTCDate()),two(a.getUTCHours()),two(a.getUTCMinutes()),two(a.getUTCSeconds()),"Z"].join(""):"utctime"===i?o=[two(a.getUTCFullYear()%100),two(a.getUTCMonth()+1),two(a.getUTCDate()),two(a.getUTCHours()),two(a.getUTCMinutes()),two(a.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+i+" time is not supported yet"),this._encodeStr(o,"octstr")},DERNode.prototype._encodeNull=function encodeNull(){return this._createEncoderBuffer("")},DERNode.prototype._encodeInt=function encodeInt(t,i){if("string"==typeof t){if(!i)return this.reporter.error("String int or enum given, but no values map");if(!i.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=i[t]}if("number"!=typeof t&&!u.isBuffer(t)){const i=t.toArray();!t.sign&&128&i[0]&&i.unshift(0),t=u.from(i)}if(u.isBuffer(t)){let i=t.length;0===t.length&&i++;const o=u.alloc(i);return t.copy(o),0===t.length&&(o[0]=0),this._createEncoderBuffer(o)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);let o=1;for(let i=t;i>=256;i>>=8)o++;const a=new Array(o);for(let i=a.length-1;i>=0;i--)a[i]=255&t,t>>=8;return 128&a[0]&&a.unshift(0),this._createEncoderBuffer(u.from(a))},DERNode.prototype._encodeBool=function encodeBool(t){return this._createEncoderBuffer(t?255:0)},DERNode.prototype._use=function use(t,i){return"function"==typeof t&&(t=t(i)),t._getEncoder("der").tree},DERNode.prototype._skipDefault=function skipDefault(t,i,o){const a=this._baseState;let u;if(null===a.default)return!1;const c=t.join();if(void 0===a.defaultBuffer&&(a.defaultBuffer=this._encodeValue(a.default,i,o).join()),c.length!==a.defaultBuffer.length)return!1;for(u=0;u<c.length;u++)if(c[u]!==a.defaultBuffer[u])return!1;return!0}},function(t,i,o){"use strict";const a=i;a.der=o(305),a.pem=o(742)},function(t,i,o){"use strict";const a=o(1),u=o(301),c=o(101).DecoderBuffer,h=o(187),l=o(189);function DERDecoder(t){this.enc="der",this.name=t.name,this.entity=t,this.tree=new DERNode,this.tree._init(t.body)}function DERNode(t){h.call(this,"der",t)}function derDecodeTag(t,i){let o=t.readUInt8(i);if(t.isError(o))return o;const a=l.tagClass[o>>6],u=0==(32&o);if(31==(31&o)){let a=o;for(o=0;128==(128&a);){if(a=t.readUInt8(i),t.isError(a))return a;o<<=7,o|=127&a}}else o&=31;return{cls:a,primitive:u,tag:o,tagStr:l.tag[o]}}function derDecodeLen(t,i,o){let a=t.readUInt8(o);if(t.isError(a))return a;if(!i&&128===a)return null;if(0==(128&a))return a;const u=127&a;if(u>4)return t.error("length octect is too long");a=0;for(let i=0;i<u;i++){a<<=8;const i=t.readUInt8(o);if(t.isError(i))return i;a|=i}return a}t.exports=DERDecoder,DERDecoder.prototype.decode=function decode(t,i){return c.isDecoderBuffer(t)||(t=new c(t,i)),this.tree._decode(t,i)},a(DERNode,h),DERNode.prototype._peekTag=function peekTag(t,i,o){if(t.isEmpty())return!1;const a=t.save(),u=derDecodeTag(t,'Failed to peek tag: "'+i+'"');return t.isError(u)?u:(t.restore(a),u.tag===i||u.tagStr===i||u.tagStr+"of"===i||o)},DERNode.prototype._decodeTag=function decodeTag(t,i,o){const a=derDecodeTag(t,'Failed to decode tag of "'+i+'"');if(t.isError(a))return a;let u=derDecodeLen(t,a.primitive,'Failed to get length of "'+i+'"');if(t.isError(u))return u;if(!o&&a.tag!==i&&a.tagStr!==i&&a.tagStr+"of"!==i)return t.error('Failed to match tag: "'+i+'"');if(a.primitive||null!==u)return t.skip(u,'Failed to match body of: "'+i+'"');const c=t.save(),h=this._skipUntilEnd(t,'Failed to skip indefinite length body: "'+this.tag+'"');return t.isError(h)?h:(u=t.offset-c.offset,t.restore(c),t.skip(u,'Failed to match body of: "'+i+'"'))},DERNode.prototype._skipUntilEnd=function skipUntilEnd(t,i){for(;;){const o=derDecodeTag(t,i);if(t.isError(o))return o;const a=derDecodeLen(t,o.primitive,i);if(t.isError(a))return a;let u;if(u=o.primitive||null!==a?t.skip(a):this._skipUntilEnd(t,i),t.isError(u))return u;if("end"===o.tagStr)break}},DERNode.prototype._decodeList=function decodeList(t,i,o,a){const u=[];for(;!t.isEmpty();){const i=this._peekTag(t,"end");if(t.isError(i))return i;const c=o.decode(t,"der",a);if(t.isError(c)&&i)break;u.push(c)}return u},DERNode.prototype._decodeStr=function decodeStr(t,i){if("bitstr"===i){const i=t.readUInt8();return t.isError(i)?i:{unused:i,data:t.raw()}}if("bmpstr"===i){const i=t.raw();if(i.length%2==1)return t.error("Decoding of string type: bmpstr length mismatch");let o="";for(let t=0;t<i.length/2;t++)o+=String.fromCharCode(i.readUInt16BE(2*t));return o}if("numstr"===i){const i=t.raw().toString("ascii");return this._isNumstr(i)?i:t.error("Decoding of string type: numstr unsupported characters")}if("octstr"===i)return t.raw();if("objDesc"===i)return t.raw();if("printstr"===i){const i=t.raw().toString("ascii");return this._isPrintstr(i)?i:t.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(i)?t.raw().toString():t.error("Decoding of string type: "+i+" unsupported")},DERNode.prototype._decodeObjid=function decodeObjid(t,i,o){let a;const u=[];let c=0,h=0;for(;!t.isEmpty();)h=t.readUInt8(),c<<=7,c|=127&h,0==(128&h)&&(u.push(c),c=0);128&h&&u.push(c);const l=u[0]/40|0,d=u[0]%40;if(a=o?u:[l,d].concat(u.slice(1)),i){let t=i[a.join(" ")];void 0===t&&(t=i[a.join(".")]),void 0!==t&&(a=t)}return a},DERNode.prototype._decodeTime=function decodeTime(t,i){const o=t.raw().toString();let a,u,c,h,l,d;if("gentime"===i)a=0|o.slice(0,4),u=0|o.slice(4,6),c=0|o.slice(6,8),h=0|o.slice(8,10),l=0|o.slice(10,12),d=0|o.slice(12,14);else{if("utctime"!==i)return t.error("Decoding "+i+" time is not supported yet");a=0|o.slice(0,2),u=0|o.slice(2,4),c=0|o.slice(4,6),h=0|o.slice(6,8),l=0|o.slice(8,10),d=0|o.slice(10,12),a=a<70?2e3+a:1900+a}return Date.UTC(a,u-1,c,h,l,d,0)},DERNode.prototype._decodeNull=function decodeNull(){return null},DERNode.prototype._decodeBool=function decodeBool(t){const i=t.readUInt8();return t.isError(i)?i:0!==i},DERNode.prototype._decodeInt=function decodeInt(t,i){const o=t.raw();let a=new u(o);return i&&(a=i[a.toString(10)]||a),a},DERNode.prototype._use=function use(t,i){return"function"==typeof t&&(t=t(i)),t._getDecoder("der").tree}},function(t){t.exports=JSON.parse('{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}')},function(t,i,o){var a=o(98),u=o(4).Buffer;function i2ops(t){var i=u.allocUnsafe(4);return i.writeUInt32BE(t,0),i}t.exports=function(t,i){for(var o,c=u.alloc(0),h=0;c.length<i;)o=i2ops(h++),c=u.concat([c,a("sha1").update(t).update(o).digest()]);return c.slice(0,i)}},function(t,i){t.exports=function xor(t,i){for(var o=t.length,a=-1;++a<o;)t[a]^=i[a];return t}},function(t,i,o){var a=o(190),u=o(4).Buffer;t.exports=function withPublic(t,i){return u.from(t.toRed(a.mont(i.modulus)).redPow(new a(i.publicExponent)).fromRed().toArray())}},function(t,i,o){var a;t.exports=(a=o(170),function(t){var i=a,o=i.lib,u=o.WordArray,c=o.Hasher,h=i.algo,l=[],d=[];!function(){function isPrime(i){for(var o=t.sqrt(i),a=2;a<=o;a++)if(!(i%a))return!1;return!0}function getFractionalBits(t){return 4294967296*(t-(0|t))|0}for(var i=2,o=0;o<64;)isPrime(i)&&(o<8&&(l[o]=getFractionalBits(t.pow(i,.5))),d[o]=getFractionalBits(t.pow(i,1/3)),o++),i++}();var p=[],m=h.SHA256=c.extend({_doReset:function(){this._hash=new u.init(l.slice(0))},_doProcessBlock:function(t,i){for(var o=this._hash.words,a=o[0],u=o[1],c=o[2],h=o[3],l=o[4],m=o[5],g=o[6],v=o[7],b=0;b<64;b++){if(b<16)p[b]=0|t[i+b];else{var w=p[b-15],_=(w<<25|w>>>7)^(w<<14|w>>>18)^w>>>3,M=p[b-2],k=(M<<15|M>>>17)^(M<<13|M>>>19)^M>>>10;p[b]=_+p[b-7]+k+p[b-16]}var B=a&u^a&c^u&c,P=(a<<30|a>>>2)^(a<<19|a>>>13)^(a<<10|a>>>22),x=v+((l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25))+(l&m^~l&g)+d[b]+p[b];v=g,g=m,m=l,l=h+x|0,h=c,c=u,u=a,a=x+(P+B)|0}o[0]=o[0]+a|0,o[1]=o[1]+u|0,o[2]=o[2]+c|0,o[3]=o[3]+h|0,o[4]=o[4]+l|0,o[5]=o[5]+m|0,o[6]=o[6]+g|0,o[7]=o[7]+v|0},_doFinalize:function(){var i=this._data,o=i.words,a=8*this._nDataBytes,u=8*i.sigBytes;return o[u>>>5]|=128<<24-u%32,o[14+(u+64>>>9<<4)]=t.floor(a/4294967296),o[15+(u+64>>>9<<4)]=a,i.sigBytes=4*o.length,this._process(),this._hash},clone:function(){var t=c.clone.call(this);return t._hash=this._hash.clone(),t}});i.SHA256=c._createHelper(m),i.HmacSHA256=c._createHmacHelper(m)}(Math),a.SHA256)},function(t,i,o){(i=t.exports=o(312)).Stream=i,i.Readable=i,i.Writable=o(315),i.Duplex=o(87),i.Transform=o(316),i.PassThrough=o(769)},function(t,i,o){"use strict";(function(i,a){var u=o(48);t.exports=Readable;var c,h=o(136);Readable.ReadableState=ReadableState;o(31).EventEmitter;var EElistenerCount=function(t,i){return t.listeners(i).length},l=o(313),d=o(4).Buffer,p=i.Uint8Array||function(){};var m=Object.create(o(41));m.inherits=o(1);var g=o(766),v=void 0;v=g&&g.debuglog?g.debuglog("stream"):function(){};var b,w=o(767),_=o(314);m.inherits(Readable,l);var M=["error","close","destroy","pause","resume"];function ReadableState(t,i){t=t||{};var a=i instanceof(c=c||o(87));this.objectMode=!!t.objectMode,a&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var u=t.highWaterMark,h=t.readableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=u||0===u?u:a&&(h||0===h)?h:l,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new w,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(b||(b=o(70).StringDecoder),this.decoder=new b(t.encoding),this.encoding=t.encoding)}function Readable(t){if(c=c||o(87),!(this instanceof Readable))return new Readable(t);this._readableState=new ReadableState(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),l.call(this)}function readableAddChunk(t,i,o,a,u){var c,h=t._readableState;null===i?(h.reading=!1,function onEofChunk(t,i){if(i.ended)return;if(i.decoder){var o=i.decoder.end();o&&o.length&&(i.buffer.push(o),i.length+=i.objectMode?1:o.length)}i.ended=!0,emitReadable(t)}(t,h)):(u||(c=function chunkInvalid(t,i){var o;(function _isUint8Array(t){return d.isBuffer(t)||t instanceof p})(i)||"string"==typeof i||void 0===i||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk"));return o}(h,i)),c?t.emit("error",c):h.objectMode||i&&i.length>0?("string"==typeof i||h.objectMode||Object.getPrototypeOf(i)===d.prototype||(i=function _uint8ArrayToBuffer(t){return d.from(t)}(i)),a?h.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):addChunk(t,h,i,!0):h.ended?t.emit("error",new Error("stream.push() after EOF")):(h.reading=!1,h.decoder&&!o?(i=h.decoder.write(i),h.objectMode||0!==i.length?addChunk(t,h,i,!1):maybeReadMore(t,h)):addChunk(t,h,i,!1))):a||(h.reading=!1));return function needMoreData(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(h)}function addChunk(t,i,o,a){i.flowing&&0===i.length&&!i.sync?(t.emit("data",o),t.read(0)):(i.length+=i.objectMode?1:o.length,a?i.buffer.unshift(o):i.buffer.push(o),i.needReadable&&emitReadable(t)),maybeReadMore(t,i)}Object.defineProperty(Readable.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),Readable.prototype.destroy=_.destroy,Readable.prototype._undestroy=_.undestroy,Readable.prototype._destroy=function(t,i){this.push(null),i(t)},Readable.prototype.push=function(t,i){var o,a=this._readableState;return a.objectMode?o=!0:"string"==typeof t&&((i=i||a.defaultEncoding)!==a.encoding&&(t=d.from(t,i),i=""),o=!0),readableAddChunk(this,t,i,!1,o)},Readable.prototype.unshift=function(t){return readableAddChunk(this,t,null,!0,!1)},Readable.prototype.isPaused=function(){return!1===this._readableState.flowing},Readable.prototype.setEncoding=function(t){return b||(b=o(70).StringDecoder),this._readableState.decoder=new b(t),this._readableState.encoding=t,this};function howMuchToRead(t,i){return t<=0||0===i.length&&i.ended?0:i.objectMode?1:t!=t?i.flowing&&i.length?i.buffer.head.data.length:i.length:(t>i.highWaterMark&&(i.highWaterMark=function computeNewHighWaterMark(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=i.length?t:i.ended?i.length:(i.needReadable=!0,0))}function emitReadable(t){var i=t._readableState;i.needReadable=!1,i.emittedReadable||(v("emitReadable",i.flowing),i.emittedReadable=!0,i.sync?u.nextTick(emitReadable_,t):emitReadable_(t))}function emitReadable_(t){v("emit readable"),t.emit("readable"),flow(t)}function maybeReadMore(t,i){i.readingMore||(i.readingMore=!0,u.nextTick(maybeReadMore_,t,i))}function maybeReadMore_(t,i){for(var o=i.length;!i.reading&&!i.flowing&&!i.ended&&i.length<i.highWaterMark&&(v("maybeReadMore read 0"),t.read(0),o!==i.length);)o=i.length;i.readingMore=!1}function nReadingNextTick(t){v("readable nexttick read 0"),t.read(0)}function resume_(t,i){i.reading||(v("resume read 0"),t.read(0)),i.resumeScheduled=!1,i.awaitDrain=0,t.emit("resume"),flow(t),i.flowing&&!i.reading&&t.read(0)}function flow(t){var i=t._readableState;for(v("flow",i.flowing);i.flowing&&null!==t.read(););}function fromList(t,i){return 0===i.length?null:(i.objectMode?o=i.buffer.shift():!t||t>=i.length?(o=i.decoder?i.buffer.join(""):1===i.buffer.length?i.buffer.head.data:i.buffer.concat(i.length),i.buffer.clear()):o=function fromListPartial(t,i,o){var a;t<i.head.data.length?(a=i.head.data.slice(0,t),i.head.data=i.head.data.slice(t)):a=t===i.head.data.length?i.shift():o?function copyFromBufferString(t,i){var o=i.head,a=1,u=o.data;t-=u.length;for(;o=o.next;){var c=o.data,h=t>c.length?c.length:t;if(h===c.length?u+=c:u+=c.slice(0,t),0===(t-=h)){h===c.length?(++a,o.next?i.head=o.next:i.head=i.tail=null):(i.head=o,o.data=c.slice(h));break}++a}return i.length-=a,u}(t,i):function copyFromBuffer(t,i){var o=d.allocUnsafe(t),a=i.head,u=1;a.data.copy(o),t-=a.data.length;for(;a=a.next;){var c=a.data,h=t>c.length?c.length:t;if(c.copy(o,o.length-t,0,h),0===(t-=h)){h===c.length?(++u,a.next?i.head=a.next:i.head=i.tail=null):(i.head=a,a.data=c.slice(h));break}++u}return i.length-=u,o}(t,i);return a}(t,i.buffer,i.decoder),o);var o}function endReadable(t){var i=t._readableState;if(i.length>0)throw new Error('"endReadable()" called on non-empty stream');i.endEmitted||(i.ended=!0,u.nextTick(endReadableNT,i,t))}function endReadableNT(t,i){t.endEmitted||0!==t.length||(t.endEmitted=!0,i.readable=!1,i.emit("end"))}function indexOf(t,i){for(var o=0,a=t.length;o<a;o++)if(t[o]===i)return o;return-1}Readable.prototype.read=function(t){v("read",t),t=parseInt(t,10);var i=this._readableState,o=t;if(0!==t&&(i.emittedReadable=!1),0===t&&i.needReadable&&(i.length>=i.highWaterMark||i.ended))return v("read: emitReadable",i.length,i.ended),0===i.length&&i.ended?endReadable(this):emitReadable(this),null;if(0===(t=howMuchToRead(t,i))&&i.ended)return 0===i.length&&endReadable(this),null;var a,u=i.needReadable;return v("need readable",u),(0===i.length||i.length-t<i.highWaterMark)&&v("length less than watermark",u=!0),i.ended||i.reading?v("reading or ended",u=!1):u&&(v("do read"),i.reading=!0,i.sync=!0,0===i.length&&(i.needReadable=!0),this._read(i.highWaterMark),i.sync=!1,i.reading||(t=howMuchToRead(o,i))),null===(a=t>0?fromList(t,i):null)?(i.needReadable=!0,t=0):i.length-=t,0===i.length&&(i.ended||(i.needReadable=!0),o!==t&&i.ended&&endReadable(this)),null!==a&&this.emit("data",a),a},Readable.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},Readable.prototype.pipe=function(t,i){var o=this,c=this._readableState;switch(c.pipesCount){case 0:c.pipes=t;break;case 1:c.pipes=[c.pipes,t];break;default:c.pipes.push(t)}c.pipesCount+=1,v("pipe count=%d opts=%j",c.pipesCount,i);var l=(!i||!1!==i.end)&&t!==a.stdout&&t!==a.stderr?onend:unpipe;function onunpipe(i,a){v("onunpipe"),i===o&&a&&!1===a.hasUnpiped&&(a.hasUnpiped=!0,function cleanup(){v("cleanup"),t.removeListener("close",onclose),t.removeListener("finish",onfinish),t.removeListener("drain",d),t.removeListener("error",onerror),t.removeListener("unpipe",onunpipe),o.removeListener("end",onend),o.removeListener("end",unpipe),o.removeListener("data",ondata),p=!0,!c.awaitDrain||t._writableState&&!t._writableState.needDrain||d()}())}function onend(){v("onend"),t.end()}c.endEmitted?u.nextTick(l):o.once("end",l),t.on("unpipe",onunpipe);var d=function pipeOnDrain(t){return function(){var i=t._readableState;v("pipeOnDrain",i.awaitDrain),i.awaitDrain&&i.awaitDrain--,0===i.awaitDrain&&EElistenerCount(t,"data")&&(i.flowing=!0,flow(t))}}(o);t.on("drain",d);var p=!1;var m=!1;function ondata(i){v("ondata"),m=!1,!1!==t.write(i)||m||((1===c.pipesCount&&c.pipes===t||c.pipesCount>1&&-1!==indexOf(c.pipes,t))&&!p&&(v("false write response, pause",o._readableState.awaitDrain),o._readableState.awaitDrain++,m=!0),o.pause())}function onerror(i){v("onerror",i),unpipe(),t.removeListener("error",onerror),0===EElistenerCount(t,"error")&&t.emit("error",i)}function onclose(){t.removeListener("finish",onfinish),unpipe()}function onfinish(){v("onfinish"),t.removeListener("close",onclose),unpipe()}function unpipe(){v("unpipe"),o.unpipe(t)}return o.on("data",ondata),function prependListener(t,i,o){if("function"==typeof t.prependListener)return t.prependListener(i,o);t._events&&t._events[i]?h(t._events[i])?t._events[i].unshift(o):t._events[i]=[o,t._events[i]]:t.on(i,o)}(t,"error",onerror),t.once("close",onclose),t.once("finish",onfinish),t.emit("pipe",o),c.flowing||(v("pipe resume"),o.resume()),t},Readable.prototype.unpipe=function(t){var i=this._readableState,o={hasUnpiped:!1};if(0===i.pipesCount)return this;if(1===i.pipesCount)return t&&t!==i.pipes||(t||(t=i.pipes),i.pipes=null,i.pipesCount=0,i.flowing=!1,t&&t.emit("unpipe",this,o)),this;if(!t){var a=i.pipes,u=i.pipesCount;i.pipes=null,i.pipesCount=0,i.flowing=!1;for(var c=0;c<u;c++)a[c].emit("unpipe",this,o);return this}var h=indexOf(i.pipes,t);return-1===h||(i.pipes.splice(h,1),i.pipesCount-=1,1===i.pipesCount&&(i.pipes=i.pipes[0]),t.emit("unpipe",this,o)),this},Readable.prototype.on=function(t,i){var o=l.prototype.on.call(this,t,i);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var a=this._readableState;a.endEmitted||a.readableListening||(a.readableListening=a.needReadable=!0,a.emittedReadable=!1,a.reading?a.length&&emitReadable(this):u.nextTick(nReadingNextTick,this))}return o},Readable.prototype.addListener=Readable.prototype.on,Readable.prototype.resume=function(){var t=this._readableState;return t.flowing||(v("resume"),t.flowing=!0,function resume(t,i){i.resumeScheduled||(i.resumeScheduled=!0,u.nextTick(resume_,t,i))}(this,t)),this},Readable.prototype.pause=function(){return v("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(v("pause"),this._readableState.flowing=!1,this.emit("pause")),this},Readable.prototype.wrap=function(t){var i=this,o=this._readableState,a=!1;for(var u in t.on("end",(function(){if(v("wrapped end"),o.decoder&&!o.ended){var t=o.decoder.end();t&&t.length&&i.push(t)}i.push(null)})),t.on("data",(function(u){(v("wrapped data"),o.decoder&&(u=o.decoder.write(u)),o.objectMode&&null==u)||(o.objectMode||u&&u.length)&&(i.push(u)||(a=!0,t.pause()))})),t)void 0===this[u]&&"function"==typeof t[u]&&(this[u]=function(i){return function(){return t[i].apply(t,arguments)}}(u));for(var c=0;c<M.length;c++)t.on(M[c],this.emit.bind(this,M[c]));return this._read=function(i){v("wrapped _read",i),a&&(a=!1,t.resume())},this},Object.defineProperty(Readable.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Readable._fromList=fromList}).call(this,o(17),o(11))},function(t,i,o){t.exports=o(31).EventEmitter},function(t,i,o){"use strict";var a=o(48);function emitErrorNT(t,i){t.emit("error",i)}t.exports={destroy:function destroy(t,i){var o=this,u=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return u||c?(i?i(t):!t||this._writableState&&this._writableState.errorEmitted||a.nextTick(emitErrorNT,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!i&&t?(a.nextTick(emitErrorNT,o,t),o._writableState&&(o._writableState.errorEmitted=!0)):i&&i(t)})),this)},undestroy:function undestroy(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,i,o){"use strict";(function(i,a,u){var c=o(48);function CorkedRequest(t){var i=this;this.next=null,this.entry=null,this.finish=function(){!function onCorkedFinish(t,i,o){var a=t.entry;t.entry=null;for(;a;){var u=a.callback;i.pendingcb--,u(o),a=a.next}i.corkedRequestsFree?i.corkedRequestsFree.next=t:i.corkedRequestsFree=t}(i,t)}}t.exports=Writable;var h,l=!i.browser&&["v0.10","v0.9."].indexOf(i.version.slice(0,5))>-1?a:c.nextTick;Writable.WritableState=WritableState;var d=Object.create(o(41));d.inherits=o(1);var p={deprecate:o(166)},m=o(313),g=o(4).Buffer,v=u.Uint8Array||function(){};var b,w=o(314);function nop(){}function WritableState(t,i){h=h||o(87),t=t||{};var a=i instanceof h;this.objectMode=!!t.objectMode,a&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var u=t.highWaterMark,d=t.writableHighWaterMark,p=this.objectMode?16:16384;this.highWaterMark=u||0===u?u:a&&(d||0===d)?d:p,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var m=!1===t.decodeStrings;this.decodeStrings=!m,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function onwrite(t,i){var o=t._writableState,a=o.sync,u=o.writecb;if(function onwriteStateUpdate(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(o),i)!function onwriteError(t,i,o,a,u){--i.pendingcb,o?(c.nextTick(u,a),c.nextTick(finishMaybe,t,i),t._writableState.errorEmitted=!0,t.emit("error",a)):(u(a),t._writableState.errorEmitted=!0,t.emit("error",a),finishMaybe(t,i))}(t,o,a,i,u);else{var h=needFinish(o);h||o.corked||o.bufferProcessing||!o.bufferedRequest||clearBuffer(t,o),a?l(afterWrite,t,o,h,u):afterWrite(t,o,h,u)}}(i,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new CorkedRequest(this)}function Writable(t){if(h=h||o(87),!(b.call(Writable,this)||this instanceof h))return new Writable(t);this._writableState=new WritableState(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),m.call(this)}function doWrite(t,i,o,a,u,c,h){i.writelen=a,i.writecb=h,i.writing=!0,i.sync=!0,o?t._writev(u,i.onwrite):t._write(u,c,i.onwrite),i.sync=!1}function afterWrite(t,i,o,a){o||function onwriteDrain(t,i){0===i.length&&i.needDrain&&(i.needDrain=!1,t.emit("drain"))}(t,i),i.pendingcb--,a(),finishMaybe(t,i)}function clearBuffer(t,i){i.bufferProcessing=!0;var o=i.bufferedRequest;if(t._writev&&o&&o.next){var a=i.bufferedRequestCount,u=new Array(a),c=i.corkedRequestsFree;c.entry=o;for(var h=0,l=!0;o;)u[h]=o,o.isBuf||(l=!1),o=o.next,h+=1;u.allBuffers=l,doWrite(t,i,!0,i.length,u,"",c.finish),i.pendingcb++,i.lastBufferedRequest=null,c.next?(i.corkedRequestsFree=c.next,c.next=null):i.corkedRequestsFree=new CorkedRequest(i),i.bufferedRequestCount=0}else{for(;o;){var d=o.chunk,p=o.encoding,m=o.callback;if(doWrite(t,i,!1,i.objectMode?1:d.length,d,p,m),o=o.next,i.bufferedRequestCount--,i.writing)break}null===o&&(i.lastBufferedRequest=null)}i.bufferedRequest=o,i.bufferProcessing=!1}function needFinish(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function callFinal(t,i){t._final((function(o){i.pendingcb--,o&&t.emit("error",o),i.prefinished=!0,t.emit("prefinish"),finishMaybe(t,i)}))}function finishMaybe(t,i){var o=needFinish(i);return o&&(!function prefinish(t,i){i.prefinished||i.finalCalled||("function"==typeof t._final?(i.pendingcb++,i.finalCalled=!0,c.nextTick(callFinal,t,i)):(i.prefinished=!0,t.emit("prefinish")))}(t,i),0===i.pendingcb&&(i.finished=!0,t.emit("finish"))),o}d.inherits(Writable,m),WritableState.prototype.getBuffer=function getBuffer(){for(var t=this.bufferedRequest,i=[];t;)i.push(t),t=t.next;return i},function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:p.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(b=Function.prototype[Symbol.hasInstance],Object.defineProperty(Writable,Symbol.hasInstance,{value:function(t){return!!b.call(this,t)||this===Writable&&(t&&t._writableState instanceof WritableState)}})):b=function(t){return t instanceof this},Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},Writable.prototype.write=function(t,i,o){var a=this._writableState,u=!1,h=!a.objectMode&&function _isUint8Array(t){return g.isBuffer(t)||t instanceof v}(t);return h&&!g.isBuffer(t)&&(t=function _uint8ArrayToBuffer(t){return g.from(t)}(t)),"function"==typeof i&&(o=i,i=null),h?i="buffer":i||(i=a.defaultEncoding),"function"!=typeof o&&(o=nop),a.ended?function writeAfterEnd(t,i){var o=new Error("write after end");t.emit("error",o),c.nextTick(i,o)}(this,o):(h||function validChunk(t,i,o,a){var u=!0,h=!1;return null===o?h=new TypeError("May not write null values to stream"):"string"==typeof o||void 0===o||i.objectMode||(h=new TypeError("Invalid non-string/buffer chunk")),h&&(t.emit("error",h),c.nextTick(a,h),u=!1),u}(this,a,t,o))&&(a.pendingcb++,u=function writeOrBuffer(t,i,o,a,u,c){if(!o){var h=function decodeChunk(t,i,o){t.objectMode||!1===t.decodeStrings||"string"!=typeof i||(i=g.from(i,o));return i}(i,a,u);a!==h&&(o=!0,u="buffer",a=h)}var l=i.objectMode?1:a.length;i.length+=l;var d=i.length<i.highWaterMark;d||(i.needDrain=!0);if(i.writing||i.corked){var p=i.lastBufferedRequest;i.lastBufferedRequest={chunk:a,encoding:u,isBuf:o,callback:c,next:null},p?p.next=i.lastBufferedRequest:i.bufferedRequest=i.lastBufferedRequest,i.bufferedRequestCount+=1}else doWrite(t,i,!1,l,a,u,c);return d}(this,a,h,t,i,o)),u},Writable.prototype.cork=function(){this._writableState.corked++},Writable.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||clearBuffer(this,t))},Writable.prototype.setDefaultEncoding=function setDefaultEncoding(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(Writable.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Writable.prototype._write=function(t,i,o){o(new Error("_write() is not implemented"))},Writable.prototype._writev=null,Writable.prototype.end=function(t,i,o){var a=this._writableState;"function"==typeof t?(o=t,t=null,i=null):"function"==typeof i&&(o=i,i=null),null!=t&&this.write(t,i),a.corked&&(a.corked=1,this.uncork()),a.ending||a.finished||function endWritable(t,i,o){i.ending=!0,finishMaybe(t,i),o&&(i.finished?c.nextTick(o):t.once("finish",o));i.ended=!0,t.writable=!1}(this,a,o)},Object.defineProperty(Writable.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),Writable.prototype.destroy=w.destroy,Writable.prototype._undestroy=w.undestroy,Writable.prototype._destroy=function(t,i){this.end(),i(t)}}).call(this,o(11),o(275).setImmediate,o(17))},function(t,i,o){"use strict";t.exports=Transform;var a=o(87),u=Object.create(o(41));function afterTransform(t,i){var o=this._transformState;o.transforming=!1;var a=o.writecb;if(!a)return this.emit("error",new Error("write callback called multiple times"));o.writechunk=null,o.writecb=null,null!=i&&this.push(i),a(t);var u=this._readableState;u.reading=!1,(u.needReadable||u.length<u.highWaterMark)&&this._read(u.highWaterMark)}function Transform(t){if(!(this instanceof Transform))return new Transform(t);a.call(this,t),this._transformState={afterTransform:afterTransform.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",prefinish)}function prefinish(){var t=this;"function"==typeof this._flush?this._flush((function(i,o){done(t,i,o)})):done(this,null,null)}function done(t,i,o){if(i)return t.emit("error",i);if(null!=o&&t.push(o),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}u.inherits=o(1),u.inherits(Transform,a),Transform.prototype.push=function(t,i){return this._transformState.needTransform=!1,a.prototype.push.call(this,t,i)},Transform.prototype._transform=function(t,i,o){throw new Error("_transform() is not implemented")},Transform.prototype._write=function(t,i,o){var a=this._transformState;if(a.writecb=o,a.writechunk=t,a.writeencoding=i,!a.transforming){var u=this._readableState;(a.needTransform||u.needReadable||u.length<u.highWaterMark)&&this._read(u.highWaterMark)}},Transform.prototype._read=function(t){var i=this._transformState;null!==i.writechunk&&i.writecb&&!i.transforming?(i.transforming=!0,this._transform(i.writechunk,i.writeencoding,i.afterTransform)):i.needTransform=!0},Transform.prototype._destroy=function(t,i){var o=this;a.prototype._destroy.call(this,t,(function(t){i(t),o.emit("close")}))}},function(t,i,o){"use strict";(function(t){var a=o(195),u=o(325),c=o(37);class Auth{constructor(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-GB",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this.ID_TOKEN="".concat(""!==o?o+"_":"","rwt_idToken"),this.ACCESS_TOKEN="".concat(""!==o?o+"_":"","rwt_accessToken"),this.REFRESH_TOKEN="".concat(""!==o?o+"_":"","rwt_refreshToken"),Object.assign(this,Object(c.a)()),this.__log=Auth.noop,t&&this._enableDebug(),this.__language=i,this.__refreshTokenPromise=null,this.__isRefreshing=!1,this.__isLogged=null,this.__parsedJwt=null,this.__specUrl=a||u.a.apiUrl,this.__client=this.initialize(!0)}static noop(){}_enableDebug(){this.__log=console.log.bind(console)}_requestInterceptor(t){return t.headers||(t.headers={}),t.headers["Accept-Language"]=this.__language,t}_responseInterceptor(t,i){if(401===t.status&&this.__isLogged){let t=localStorage.getItem(this.REFRESH_TOKEN);return this.__refreshTokenPromise=this.__isRefreshing?this.__refreshTokenPromise:this.__client.then(t=>(this.__isRefreshing=!0,t.apis.auth.refreshToken({},{requestBody:{refreshToken:localStorage.getItem(this.REFRESH_TOKEN)}}))).then(i=>(this.__isRefreshing=!1,this.login(i.data.idToken,i.data.accessToken,t,!0))).catch(t=>(this.__isRefreshing=!1,this.logout(),Promise.reject(t))),this.__refreshTokenPromise.then(()=>a.a.http({...i,headers:{...i.headers,Authorization:"Bearer "+localStorage.getItem(this.ID_TOKEN)}})).then(t=>("object"==typeof t.obj&&null!==t.obj&&(t.data=t.obj),t))}return"object"==typeof t.obj&&null!==t.obj&&(t.data=t.obj),t}initialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=localStorage.getItem(this.ID_TOKEN),u={};o&&(u.bearer=""+o),this.__isLogged=!!o;let c=this;return new a.a(this.__specUrl,{authorizations:u,requestInterceptor:this._requestInterceptor.bind(this),responseInterceptor:function(t){return c._responseInterceptor(t,this)}}).then(a=>(this.__isLogged=!!o,this.__parsedJwt=this.parseJwt(o),this.emit(this.__isLogged?"login":"logout",{client:a,isInitialEvent:t,isLoggedInAsDevice:this.isLoggedInAs(this.__parsedJwt,"device"),isLoggedInAsObserver:this.isLoggedInAs(this.__parsedJwt,"observer"),isLoggedInAsInstanceAdmin:this.isLoggedInAs(this.__parsedJwt,"instanceAdmin"),isLoggedInAsAdmin:this.isLoggedInAs(this.__parsedJwt,"admin"),domain:this.getDomain(this.__parsedJwt),isReauth:i}),a)).catch(o=>(this.__isLogged=!1,this.emit("logout",{client:null,isInitialEvent:t,isLoggedInAsDevice:!1,isLoggedInAsObserver:!1,isLoggedInAsInstanceAdmin:!1,isLoggedInAsAdmin:!1,isReauth:i}),Promise.reject(o)))}login(t,i,o){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return localStorage.setItem(this.ID_TOKEN,t),localStorage.setItem(this.ACCESS_TOKEN,i),localStorage.setItem(this.REFRESH_TOKEN,o),this.__client=this.initialize(!1,a)}logout(){return localStorage.removeItem(this.ID_TOKEN),localStorage.removeItem(this.ACCESS_TOKEN),localStorage.removeItem(this.REFRESH_TOKEN),this.__client=this.initialize()}isLoggedIn(){return this.__isLogged}isLoggedInAs(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"device";return!!((t=t||this.__parsedJwt)&&t["cognito:groups"]&&t["cognito:groups"].includes(i))}setLanguage(t){return this.__language=t,this.__language}getDomain(t){return(t=t||this.__parsedJwt)["custom:domain"]}parseJwt(i){if(!i||"string"!=typeof i)return!1;let o=i.match(/^(([0-9a-zA-Z]*)\.){2}[\w-]*$/);if(!o||!o[2])return!1;try{return o=new t(o[2],"base64").toString("binary"),JSON.parse(o)}catch(t){return!1}}}i.a=Auth}).call(this,o(10).Buffer)},function(t,i,o){t.exports=o(569)},function(t,i,o){t.exports=o(573)},function(t,i,o){"use strict";var a=function isMergeableObject(t){return function isNonNullObject(t){return!!t&&"object"==typeof t}(t)&&!function isSpecial(t){var i=Object.prototype.toString.call(t);return"[object RegExp]"===i||"[object Date]"===i||function isReactElement(t){return t.$$typeof===u}(t)}(t)};var u="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function cloneUnlessOtherwiseSpecified(t,i){return!1!==i.clone&&i.isMergeableObject(t)?deepmerge(function emptyTarget(t){return Array.isArray(t)?[]:{}}(t),t,i):t}function defaultArrayMerge(t,i,o){return t.concat(i).map((function(t){return cloneUnlessOtherwiseSpecified(t,o)}))}function getKeys(t){return Object.keys(t).concat(function getEnumerableOwnPropertySymbols(t){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter((function(i){return t.propertyIsEnumerable(i)})):[]}(t))}function propertyIsOnObject(t,i){try{return i in t}catch(t){return!1}}function mergeObject(t,i,o){var a={};return o.isMergeableObject(t)&&getKeys(t).forEach((function(i){a[i]=cloneUnlessOtherwiseSpecified(t[i],o)})),getKeys(i).forEach((function(u){(function propertyIsUnsafe(t,i){return propertyIsOnObject(t,i)&&!(Object.hasOwnProperty.call(t,i)&&Object.propertyIsEnumerable.call(t,i))})(t,u)||(propertyIsOnObject(t,u)&&o.isMergeableObject(i[u])?a[u]=function getMergeFunction(t,i){if(!i.customMerge)return deepmerge;var o=i.customMerge(t);return"function"==typeof o?o:deepmerge}(u,o)(t[u],i[u],o):a[u]=cloneUnlessOtherwiseSpecified(i[u],o))})),a}function deepmerge(t,i,o){(o=o||{}).arrayMerge=o.arrayMerge||defaultArrayMerge,o.isMergeableObject=o.isMergeableObject||a,o.cloneUnlessOtherwiseSpecified=cloneUnlessOtherwiseSpecified;var u=Array.isArray(i);return u===Array.isArray(t)?u?o.arrayMerge(t,i,o):mergeObject(t,i,o):cloneUnlessOtherwiseSpecified(i,o)}deepmerge.all=function deepmergeAll(t,i){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce((function(t,o){return deepmerge(t,o,i)}),{})};var c=deepmerge;t.exports=c},function(t,i,o){t.exports=o(578)},function(t,i){var o=t.exports=function(t){return new Traverse(t)};function Traverse(t){this.value=t}function walk(t,i,o){var h=[],l=[],d=!0;return function walker(t){var p=o?copy(t):t,m={},g=!0,v={node:p,node_:t,path:[].concat(h),parent:l[l.length-1],parents:l,key:h.slice(-1)[0],isRoot:0===h.length,level:h.length,circular:null,update:function(t,i){v.isRoot||(v.parent.node[v.key]=t),v.node=t,i&&(g=!1)},delete:function(t){delete v.parent.node[v.key],t&&(g=!1)},remove:function(t){u(v.parent.node)?v.parent.node.splice(v.key,1):delete v.parent.node[v.key],t&&(g=!1)},keys:null,before:function(t){m.before=t},after:function(t){m.after=t},pre:function(t){m.pre=t},post:function(t){m.post=t},stop:function(){d=!1},block:function(){g=!1}};if(!d)return v;function updateState(){if("object"==typeof v.node&&null!==v.node){v.keys&&v.node_===v.node||(v.keys=a(v.node)),v.isLeaf=0==v.keys.length;for(var i=0;i<l.length;i++)if(l[i].node_===t){v.circular=l[i];break}}else v.isLeaf=!0,v.keys=null;v.notLeaf=!v.isLeaf,v.notRoot=!v.isRoot}updateState();var b=i.call(v,v.node);return void 0!==b&&v.update&&v.update(b),m.before&&m.before.call(v,v.node),g?("object"!=typeof v.node||null===v.node||v.circular||(l.push(v),updateState(),forEach(v.keys,(function(t,i){h.push(t),m.pre&&m.pre.call(v,v.node[t],t);var a=walker(v.node[t]);o&&c.call(v.node,t)&&(v.node[t]=a.node),a.isLast=i==v.keys.length-1,a.isFirst=0==i,m.post&&m.post.call(v,a),h.pop()})),l.pop()),m.after&&m.after.call(v,v.node),v):v}(t).node}function copy(t){if("object"==typeof t&&null!==t){var i;if(u(t))i=[];else if(function isDate(t){return"[object Date]"===toS(t)}(t))i=new Date(t.getTime?t.getTime():t);else if(function isRegExp(t){return"[object RegExp]"===toS(t)}(t))i=new RegExp(t);else if(function isError(t){return"[object Error]"===toS(t)}(t))i={message:t.message};else if(function isBoolean(t){return"[object Boolean]"===toS(t)}(t))i=new Boolean(t);else if(function isNumber(t){return"[object Number]"===toS(t)}(t))i=new Number(t);else if(function isString(t){return"[object String]"===toS(t)}(t))i=new String(t);else if(Object.create&&Object.getPrototypeOf)i=Object.create(Object.getPrototypeOf(t));else if(t.constructor===Object)i={};else{var o=t.constructor&&t.constructor.prototype||t.__proto__||{},T=function(){};T.prototype=o,i=new T}return forEach(a(t),(function(o){i[o]=t[o]})),i}return t}Traverse.prototype.get=function(t){for(var i=this.value,o=0;o<t.length;o++){var a=t[o];if(!i||!c.call(i,a)){i=void 0;break}i=i[a]}return i},Traverse.prototype.has=function(t){for(var i=this.value,o=0;o<t.length;o++){var a=t[o];if(!i||!c.call(i,a))return!1;i=i[a]}return!0},Traverse.prototype.set=function(t,i){for(var o=this.value,a=0;a<t.length-1;a++){var u=t[a];c.call(o,u)||(o[u]={}),o=o[u]}return o[t[a]]=i,i},Traverse.prototype.map=function(t){return walk(this.value,t,!0)},Traverse.prototype.forEach=function(t){return this.value=walk(this.value,t,!1),this.value},Traverse.prototype.reduce=function(t,i){var o=1===arguments.length,a=o?this.value:i;return this.forEach((function(i){this.isRoot&&o||(a=t.call(this,a,i))})),a},Traverse.prototype.paths=function(){var t=[];return this.forEach((function(i){t.push(this.path)})),t},Traverse.prototype.nodes=function(){var t=[];return this.forEach((function(i){t.push(this.node)})),t},Traverse.prototype.clone=function(){var t=[],i=[];return function clone(o){for(var u=0;u<t.length;u++)if(t[u]===o)return i[u];if("object"==typeof o&&null!==o){var c=copy(o);return t.push(o),i.push(c),forEach(a(o),(function(t){c[t]=clone(o[t])})),t.pop(),i.pop(),c}return o}(this.value)};var a=Object.keys||function keys(t){var i=[];for(var o in t)i.push(o);return i};function toS(t){return Object.prototype.toString.call(t)}var u=Array.isArray||function isArray(t){return"[object Array]"===Object.prototype.toString.call(t)},forEach=function(t,i){if(t.forEach)return t.forEach(i);for(var o=0;o<t.length;o++)i(t[o],o,t)};forEach(a(Traverse.prototype),(function(t){o[t]=function(i){var o=[].slice.call(arguments,1),a=new Traverse(i);return a[t].apply(a,o)}}));var c=Object.hasOwnProperty||function(t,i){return i in t}},function(t,i,o){var a=o(204),u=o(252),c=o(640);t.exports=function _objectWithoutProperties(t,i){if(null==t)return{};var o,h,l=c(t,i);if(a){var d=a(t);for(h=0;h<d.length;h++)o=d[h],u(i).call(i,o)>=0||Object.prototype.propertyIsEnumerable.call(t,o)&&(l[o]=t[o])}return l},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i,o){"use strict";i.parse=function parse(t,i){if("string"!=typeof t)throw new TypeError("argument str must be a string");var o={},a=(i||{}).decode||decode,u=0;for(;u<t.length;){var c=t.indexOf("=",u);if(-1===c)break;var h=t.indexOf(";",u);if(-1===h)h=t.length;else if(h<c){u=t.lastIndexOf(";",c-1)+1;continue}var l=t.slice(u,c).trim();if(void 0===o[l]){var d=t.slice(c+1,h).trim();34===d.charCodeAt(0)&&(d=d.slice(1,-1)),o[l]=tryDecode(d,a)}u=h+1}return o},i.serialize=function serialize(t,i,o){var c=o||{},h=c.encode||encode;if("function"!=typeof h)throw new TypeError("option encode is invalid");if(!u.test(t))throw new TypeError("argument name is invalid");var l=h(i);if(l&&!u.test(l))throw new TypeError("argument val is invalid");var d=t+"="+l;if(null!=c.maxAge){var p=c.maxAge-0;if(isNaN(p)||!isFinite(p))throw new TypeError("option maxAge is invalid");d+="; Max-Age="+Math.floor(p)}if(c.domain){if(!u.test(c.domain))throw new TypeError("option domain is invalid");d+="; Domain="+c.domain}if(c.path){if(!u.test(c.path))throw new TypeError("option path is invalid");d+="; Path="+c.path}if(c.expires){var m=c.expires;if(!function isDate(t){return"[object Date]"===a.call(t)||t instanceof Date}(m)||isNaN(m.valueOf()))throw new TypeError("option expires is invalid");d+="; Expires="+m.toUTCString()}c.httpOnly&&(d+="; HttpOnly");c.secure&&(d+="; Secure");if(c.priority){switch("string"==typeof c.priority?c.priority.toLowerCase():c.priority){case"low":d+="; Priority=Low";break;case"medium":d+="; Priority=Medium";break;case"high":d+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(c.sameSite){switch("string"==typeof c.sameSite?c.sameSite.toLowerCase():c.sameSite){case!0:d+="; SameSite=Strict";break;case"lax":d+="; SameSite=Lax";break;case"strict":d+="; SameSite=Strict";break;case"none":d+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return d};var a=Object.prototype.toString,u=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function decode(t){return-1!==t.indexOf("%")?decodeURIComponent(t):t}function encode(t){return encodeURIComponent(t)}function tryDecode(t,i){try{return i(t)}catch(i){return t}}},function(t,i,o){"use strict";i.a={apiUrl:"https://api.reactoo.com/v3/swagger.json",devApiUrl:"https://api.reactoo.com/dev3/swagger.json"}},function(t,i,o){t.exports.device=o(163),t.exports.thingShadow=o(772),t.exports.jobs=o(773)},function(t,i,o){"use strict";(function(t){o.d(i,"a",(function(){return serializeError}));Error;const a=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0}],u=Symbol(".toJSON was called"),destroyCircular=({from:i,seen:o,to_:c,forceEnumerable:h,maxDepth:l,depth:d})=>{const p=c||(Array.isArray(i)?[]:{});if(o.push(i),d>=l)return p;if("function"==typeof i.toJSON&&!0!==i[u])return(t=>{t[u]=!0;const i=t.toJSON();return delete t[u],i})(i);for(const[a,u]of Object.entries(i))"function"==typeof t&&t.isBuffer(u)?p[a]="[object Buffer]":"object"!=typeof u||"function"!=typeof u.pipe?"function"!=typeof u&&(u&&"object"==typeof u?o.includes(i[a])?p[a]="[Circular]":(d++,p[a]=destroyCircular({from:i[a],seen:[...o],forceEnumerable:h,maxDepth:l,depth:d})):p[a]=u):p[a]="[object Stream]";for(const{property:t,enumerable:o}of a)"string"==typeof i[t]&&Object.defineProperty(p,t,{value:i[t],enumerable:!!h||o,configurable:!0,writable:!0});return p};function serializeError(t,i={}){const{maxDepth:o=Number.POSITIVE_INFINITY}=i;return"object"==typeof t&&null!==t?destroyCircular({from:t,seen:[],forceEnumerable:!0,maxDepth:o,depth:0}):"function"==typeof t?`[Function: ${t.name||"anonymous"}]`:t}}).call(this,o(10).Buffer)},function(t,i,o){"use strict";i.byteLength=function byteLength(t){var i=getLens(t),o=i[0],a=i[1];return 3*(o+a)/4-a},i.toByteArray=function toByteArray(t){var i,o,a=getLens(t),h=a[0],l=a[1],d=new c(function _byteLength(t,i,o){return 3*(i+o)/4-o}(0,h,l)),p=0,m=l>0?h-4:h;for(o=0;o<m;o+=4)i=u[t.charCodeAt(o)]<<18|u[t.charCodeAt(o+1)]<<12|u[t.charCodeAt(o+2)]<<6|u[t.charCodeAt(o+3)],d[p++]=i>>16&255,d[p++]=i>>8&255,d[p++]=255&i;2===l&&(i=u[t.charCodeAt(o)]<<2|u[t.charCodeAt(o+1)]>>4,d[p++]=255&i);1===l&&(i=u[t.charCodeAt(o)]<<10|u[t.charCodeAt(o+1)]<<4|u[t.charCodeAt(o+2)]>>2,d[p++]=i>>8&255,d[p++]=255&i);return d},i.fromByteArray=function fromByteArray(t){for(var i,o=t.length,u=o%3,c=[],h=0,l=o-u;h<l;h+=16383)c.push(encodeChunk(t,h,h+16383>l?l:h+16383));1===u?(i=t[o-1],c.push(a[i>>2]+a[i<<4&63]+"==")):2===u&&(i=(t[o-2]<<8)+t[o-1],c.push(a[i>>10]+a[i>>4&63]+a[i<<2&63]+"="));return c.join("")};for(var a=[],u=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,d=h.length;l<d;++l)a[l]=h[l],u[h.charCodeAt(l)]=l;function getLens(t){var i=t.length;if(i%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var o=t.indexOf("=");return-1===o&&(o=i),[o,o===i?0:4-o%4]}function encodeChunk(t,i,o){for(var u,c,h=[],l=i;l<o;l+=3)u=(t[l]<<16&16711680)+(t[l+1]<<8&65280)+(255&t[l+2]),h.push(a[(c=u)>>18&63]+a[c>>12&63]+a[c>>6&63]+a[63&c]);return h.join("")}u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63},function(t,i){i.read=function(t,i,o,a,u){var c,h,l=8*u-a-1,d=(1<<l)-1,p=d>>1,m=-7,g=o?u-1:0,v=o?-1:1,b=t[i+g];for(g+=v,c=b&(1<<-m)-1,b>>=-m,m+=l;m>0;c=256*c+t[i+g],g+=v,m-=8);for(h=c&(1<<-m)-1,c>>=-m,m+=a;m>0;h=256*h+t[i+g],g+=v,m-=8);if(0===c)c=1-p;else{if(c===d)return h?NaN:1/0*(b?-1:1);h+=Math.pow(2,a),c-=p}return(b?-1:1)*h*Math.pow(2,c-a)},i.write=function(t,i,o,a,u,c){var h,l,d,p=8*c-u-1,m=(1<<p)-1,g=m>>1,v=23===u?Math.pow(2,-24)-Math.pow(2,-77):0,b=a?0:c-1,w=a?1:-1,_=i<0||0===i&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(l=isNaN(i)?1:0,h=m):(h=Math.floor(Math.log(i)/Math.LN2),i*(d=Math.pow(2,-h))<1&&(h--,d*=2),(i+=h+g>=1?v/d:v*Math.pow(2,1-g))*d>=2&&(h++,d/=2),h+g>=m?(l=0,h=m):h+g>=1?(l=(i*d-1)*Math.pow(2,u),h+=g):(l=i*Math.pow(2,g-1)*Math.pow(2,u),h=0));u>=8;t[o+b]=255&l,b+=w,l/=256,u-=8);for(h=h<<u|l,p+=u;p>0;t[o+b]=255&h,b+=w,h/=256,p-=8);t[o+b-w]|=128*_}},function(t,i,o){t.exports=o(331)},function(t,i,o){var a=o(332);t.exports=a},function(t,i,o){var a=o(197);t.exports=a},function(t,i,o){o(334);var a=o(15);t.exports=a.Object.keys},function(t,i,o){var a=o(2),u=o(40),c=o(91);a({target:"Object",stat:!0,forced:o(8)((function(){c(1)}))},{keys:function keys(t){return c(u(t))}})},function(t,i,o){var a=o(19),u=o(20),c=o(107),h=o(138),l=o(336),d=o(13),p=TypeError,m=d("toPrimitive");t.exports=function(t,i){if(!u(t)||c(t))return t;var o,d=h(t,m);if(d){if(void 0===i&&(i="default"),o=a(d,t,i),!u(o)||c(o))return o;throw p("Can't convert object to primitive value")}return void 0===i&&(i="number"),l(t,i)}},function(t,i,o){var a=o(19),u=o(14),c=o(20),h=TypeError;t.exports=function(t,i){var o,l;if("string"===i&&u(o=t.toString)&&!c(l=a(o,t)))return l;if(u(o=t.valueOf)&&!c(l=a(o,t)))return l;if("string"!==i&&u(o=t.toString)&&!c(l=a(o,t)))return l;throw h("Can't convert object to primitive value")}},function(t,i,o){var a=o(12),u=Object.defineProperty;t.exports=function(t,i){try{u(a,t,{value:i,configurable:!0,writable:!0})}catch(o){a[t]=i}return i}},function(t,i){var o=Math.ceil,a=Math.floor;t.exports=Math.trunc||function trunc(t){var i=+t;return(i>0?a:o)(i)}},function(t,i,o){t.exports=o(340)},function(t,i,o){var a=o(341);t.exports=a},function(t,i,o){var a=o(342);t.exports=a},function(t,i,o){var a=o(343);t.exports=a},function(t,i,o){o(205);var a=o(15);t.exports=a.Object.getOwnPropertySymbols},function(t,i,o){"use strict";var a=o(2),u=o(12),c=o(19),h=o(9),l=o(33),d=o(18),p=o(75),m=o(8),g=o(21),v=o(25),b=o(28),w=o(38),_=o(106),M=o(55),k=o(53),B=o(77),P=o(91),x=o(114),I=o(207),N=o(115),A=o(64),C=o(34),O=o(144),j=o(105),L=o(46),q=o(90),U=o(113),z=o(92),H=o(110),W=o(13),V=o(145),G=o(16),J=o(209),$=o(57),Z=o(58),Y=o(67).forEach,X=U("hidden"),Q=Z.set,ee=Z.getterFor("Symbol"),te=Object.prototype,re=u.Symbol,ne=re&&re.prototype,ie=u.TypeError,oe=u.QObject,se=A.f,ae=C.f,ue=I.f,ce=j.f,he=h([].push),le=q("symbols"),fe=q("op-symbols"),de=q("wks"),pe=!oe||!oe.prototype||!oe.prototype.findChild,me=d&&m((function(){return 7!=B(ae({},"a",{get:function(){return ae(this,"a",{value:7}).a}})).a}))?function(t,i,o){var a=se(te,i);a&&delete te[i],ae(t,i,o),a&&t!==te&&ae(te,i,a)}:ae,wrap=function(t,i){var o=le[t]=B(ne);return Q(o,{type:"Symbol",tag:t,description:i}),d||(o.description=i),o},ge=function defineProperty(t,i,o){t===te&&ge(fe,i,o),b(t);var a=_(i);return b(o),g(le,a)?(o.enumerable?(g(t,X)&&t[X][a]&&(t[X][a]=!1),o=B(o,{enumerable:k(0,!1)})):(g(t,X)||ae(t,X,k(1,{})),t[X][a]=!0),me(t,a,o)):ae(t,a,o)},ve=function defineProperties(t,i){b(t);var o=w(i),a=P(o).concat($getOwnPropertySymbols(o));return Y(a,(function(i){d&&!c(ye,o,i)||ge(t,i,o[i])})),t},ye=function propertyIsEnumerable(t){var i=_(t),o=c(ce,this,i);return!(this===te&&g(le,i)&&!g(fe,i))&&(!(o||!g(this,i)||!g(le,i)||g(this,X)&&this[X][i])||o)},be=function getOwnPropertyDescriptor(t,i){var o=w(t),a=_(i);if(o!==te||!g(le,a)||g(fe,a)){var u=se(o,a);return!u||!g(le,a)||g(o,X)&&o[X][a]||(u.enumerable=!0),u}},we=function getOwnPropertyNames(t){var i=ue(w(t)),o=[];return Y(i,(function(t){g(le,t)||g(z,t)||he(o,t)})),o},$getOwnPropertySymbols=function(t){var i=t===te,o=ue(i?fe:w(t)),a=[];return Y(o,(function(t){!g(le,t)||i&&!g(te,t)||he(a,le[t])})),a};p||(L(ne=(re=function Symbol(){if(v(ne,this))throw ie("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?M(arguments[0]):void 0,i=H(t),setter=function(t){this===te&&c(setter,fe,t),g(this,X)&&g(this[X],i)&&(this[X][i]=!1),me(this,i,k(1,t))};return d&&pe&&me(te,i,{configurable:!0,set:setter}),wrap(i,t)}).prototype,"toString",(function toString(){return ee(this).tag})),L(re,"withoutSetter",(function(t){return wrap(H(t),t)})),j.f=ye,C.f=ge,O.f=ve,A.f=be,x.f=I.f=we,N.f=$getOwnPropertySymbols,V.f=function(t){return wrap(W(t),t)},d&&(ae(ne,"description",{configurable:!0,get:function description(){return ee(this).description}}),l||L(te,"propertyIsEnumerable",ye,{unsafe:!0}))),a({global:!0,constructor:!0,wrap:!0,forced:!p,sham:!p},{Symbol:re}),Y(P(de),(function(t){G(t)})),a({target:"Symbol",stat:!0,forced:!p},{useSetter:function(){pe=!0},useSimple:function(){pe=!1}}),a({target:"Object",stat:!0,forced:!p,sham:!d},{create:function create(t,i){return void 0===i?B(t):ve(B(t),i)},defineProperty:ge,defineProperties:ve,getOwnPropertyDescriptor:be}),a({target:"Object",stat:!0,forced:!p},{getOwnPropertyNames:we}),J(),$(re,"Symbol"),z[X]=!0},function(t,i,o){"use strict";var a=o(143),u=o(56);t.exports=a?{}.toString:function toString(){return"[object "+u(this)+"]"}},function(t,i,o){var a=o(79),u=o(116),c=o(20),h=o(13)("species"),l=Array;t.exports=function(t){var i;return a(t)&&(i=t.constructor,(u(i)&&(i===l||a(i.prototype))||c(i)&&null===(i=i[h]))&&(i=void 0)),void 0===i?l:i}},function(t,i,o){var a=o(2),u=o(27),c=o(21),h=o(55),l=o(90),d=o(211),p=l("string-to-symbol-registry"),m=l("symbol-to-string-registry");a({target:"Symbol",stat:!0,forced:!d},{for:function(t){var i=h(t);if(c(p,i))return p[i];var o=u("Symbol")(i);return p[i]=o,m[o]=i,o}})},function(t,i,o){var a=o(2),u=o(21),c=o(107),h=o(76),l=o(90),d=o(211),p=l("symbol-to-string-registry");a({target:"Symbol",stat:!0,forced:!d},{keyFor:function keyFor(t){if(!c(t))throw TypeError(h(t)+" is not a symbol");if(u(p,t))return p[t]}})},function(t,i,o){var a=o(2),u=o(75),c=o(8),h=o(115),l=o(40);a({target:"Object",stat:!0,forced:!u||c((function(){h.f(1)}))},{getOwnPropertySymbols:function getOwnPropertySymbols(t){var i=h.f;return i?i(l(t)):[]}})},function(t,i,o){t.exports=o(351)},function(t,i,o){t.exports=o(352)},function(t,i,o){var a=o(353);t.exports=a},function(t,i,o){var a=o(213);t.exports=a},function(t,i,o){var a=o(25),u=o(355),c=Array.prototype;t.exports=function(t){var i=t.filter;return t===c||a(c,t)&&i===c.filter?u:i}},function(t,i,o){o(356);var a=o(30);t.exports=a("Array").filter},function(t,i,o){"use strict";var a=o(2),u=o(67).filter;a({target:"Array",proto:!0,forced:!o(93)("filter")},{filter:function filter(t){return u(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,i,o){t.exports=o(358)},function(t,i,o){t.exports=o(359)},function(t,i,o){var a=o(360);t.exports=a},function(t,i,o){var a=o(361);t.exports=a},function(t,i,o){var a=o(362);t.exports=a},function(t,i,o){o(363);var a=o(15).Object,u=t.exports=function getOwnPropertyDescriptor(t,i){return a.getOwnPropertyDescriptor(t,i)};a.getOwnPropertyDescriptor.sham&&(u.sham=!0)},function(t,i,o){var a=o(2),u=o(8),c=o(38),h=o(64).f,l=o(18),d=u((function(){h(1)}));a({target:"Object",stat:!0,forced:!l||d,sham:!l},{getOwnPropertyDescriptor:function getOwnPropertyDescriptor(t,i){return h(c(t),i)}})},function(t,i,o){t.exports=o(365)},function(t,i,o){var a=o(366);t.exports=a},function(t,i,o){var a=o(367);t.exports=a},function(t,i,o){o(59);var a=o(56),u=o(21),c=o(25),h=o(371),l=Array.prototype,d={DOMTokenList:!0,NodeList:!0};t.exports=function(t){var i=t.forEach;return t===l||c(l,t)&&i===l.forEach||u(d,a(t))?h:i}},function(t,i,o){var a=o(18),u=o(21),c=Function.prototype,h=a&&Object.getOwnPropertyDescriptor,l=u(c,"name"),d=l&&"something"===function something(){}.name,p=l&&(!a||a&&h(c,"name").configurable);t.exports={EXISTS:l,PROPER:d,CONFIGURABLE:p}},function(t,i,o){var a=o(14),u=String,c=TypeError;t.exports=function(t){if("object"==typeof t||a(t))return t;throw c("Can't set "+u(t)+" as a prototype")}},function(t,i){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(t,i,o){var a=o(372);t.exports=a},function(t,i,o){o(373);var a=o(30);t.exports=a("Array").forEach},function(t,i,o){"use strict";var a=o(2),u=o(374);a({target:"Array",proto:!0,forced:[].forEach!=u},{forEach:u})},function(t,i,o){"use strict";var a=o(67).forEach,u=o(219)("forEach");t.exports=u?[].forEach:function forEach(t){return a(this,t,arguments.length>1?arguments[1]:void 0)}},function(t,i,o){t.exports=o(376)},function(t,i,o){t.exports=o(377)},function(t,i,o){var a=o(378);t.exports=a},function(t,i,o){var a=o(379);t.exports=a},function(t,i,o){var a=o(380);t.exports=a},function(t,i,o){o(381);var a=o(15);t.exports=a.Object.getOwnPropertyDescriptors},function(t,i,o){var a=o(2),u=o(18),c=o(220),h=o(38),l=o(64),d=o(78);a({target:"Object",stat:!0,sham:!u},{getOwnPropertyDescriptors:function getOwnPropertyDescriptors(t){for(var i,o,a=h(t),u=l.f,p=c(a),m={},g=0;p.length>g;)void 0!==(o=u(a,i=p[g++]))&&d(m,i,o);return m}})},function(t,i,o){t.exports=o(383)},function(t,i,o){t.exports=o(384)},function(t,i,o){var a=o(385);t.exports=a},function(t,i,o){var a=o(386);t.exports=a},function(t,i,o){var a=o(387);t.exports=a},function(t,i,o){o(388);var a=o(15).Object,u=t.exports=function defineProperties(t,i){return a.defineProperties(t,i)};a.defineProperties.sham&&(u.sham=!0)},function(t,i,o){var a=o(2),u=o(18),c=o(144).f;a({target:"Object",stat:!0,forced:Object.defineProperties!==c,sham:!u},{defineProperties:c})},function(t,i,o){t.exports=o(390)},function(t,i,o){var a=o(391);t.exports=a},function(t,i,o){var a=o(392);t.exports=a},function(t,i,o){var a=o(393);t.exports=a},function(t,i,o){o(394);var a=o(15).Object,u=t.exports=function defineProperty(t,i,o){return a.defineProperty(t,i,o)};a.defineProperty.sham&&(u.sham=!0)},function(t,i,o){var a=o(2),u=o(18),c=o(34).f;a({target:"Object",stat:!0,forced:Object.defineProperty!==c,sham:!u},{defineProperty:c})},function(t,i,o){var a=o(119);t.exports=function _defineProperty(t,i,o){return i in t?a(t,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[i]=o,t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i,o){var a=o(397);t.exports=a},function(t,i,o){o(398);var a=o(15);t.exports=a.Object.assign},function(t,i,o){var a=o(2),u=o(399);a({target:"Object",stat:!0,arity:2,forced:Object.assign!==u},{assign:u})},function(t,i,o){"use strict";var a=o(18),u=o(9),c=o(19),h=o(8),l=o(91),d=o(115),p=o(105),m=o(40),g=o(137),v=Object.assign,b=Object.defineProperty,w=u([].concat);t.exports=!v||h((function(){if(a&&1!==v({b:1},v(b({},"a",{enumerable:!0,get:function(){b(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},i={},o=Symbol();return t[o]=7,"abcdefghijklmnopqrst".split("").forEach((function(t){i[t]=t})),7!=v({},t)[o]||"abcdefghijklmnopqrst"!=l(v({},i)).join("")}))?function assign(t,i){for(var o=m(t),u=arguments.length,h=1,v=d.f,b=p.f;u>h;)for(var _,M=g(arguments[h++]),k=v?w(l(M),v(M)):l(M),B=k.length,P=0;B>P;)_=k[P++],a&&!c(b,M,_)||(o[_]=M[_]);return o}:v},function(t,i,o){var a=o(401);t.exports=a},function(t,i,o){var a=o(25),u=o(402),c=String.prototype;t.exports=function(t){var i=t.startsWith;return"string"==typeof t||t===c||a(c,t)&&i===c.startsWith?u:i}},function(t,i,o){o(403);var a=o(30);t.exports=a("String").startsWith},function(t,i,o){"use strict";var a,u=o(2),c=o(9),h=o(64).f,l=o(203),d=o(55),p=o(221),m=o(89),g=o(222),v=o(33),b=c("".startsWith),w=c("".slice),_=Math.min,M=g("startsWith");u({target:"String",proto:!0,forced:!!(v||M||(a=h(String.prototype,"startsWith"),!a||a.writable))&&!M},{startsWith:function startsWith(t){var i=d(m(this));p(t);var o=l(_(arguments.length>1?arguments[1]:void 0,i.length)),a=d(t);return b?b(i,a,o):w(i,o,o+a.length)===a}})},function(t,i,o){var a=o(20),u=o(65),c=o(13)("match");t.exports=function(t){var i;return a(t)&&(void 0!==(i=t[c])?!!i:"RegExp"==u(t))}},function(t,i,o){(function(t,a){var u;!function(c){i&&i.nodeType,t&&t.nodeType;var h="object"==typeof a&&a;h.global!==h&&h.window!==h&&h.self;var l,d=2147483647,p=/^xn--/,m=/[^\x20-\x7E]/,g=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},b=Math.floor,w=String.fromCharCode;function error(t){throw new RangeError(v[t])}function map(t,i){for(var o=t.length,a=[];o--;)a[o]=i(t[o]);return a}function mapDomain(t,i){var o=t.split("@"),a="";return o.length>1&&(a=o[0]+"@",t=o[1]),a+map((t=t.replace(g,".")).split("."),i).join(".")}function ucs2decode(t){for(var i,o,a=[],u=0,c=t.length;u<c;)(i=t.charCodeAt(u++))>=55296&&i<=56319&&u<c?56320==(64512&(o=t.charCodeAt(u++)))?a.push(((1023&i)<<10)+(1023&o)+65536):(a.push(i),u--):a.push(i);return a}function ucs2encode(t){return map(t,(function(t){var i="";return t>65535&&(i+=w((t-=65536)>>>10&1023|55296),t=56320|1023&t),i+=w(t)})).join("")}function digitToBasic(t,i){return t+22+75*(t<26)-((0!=i)<<5)}function adapt(t,i,o){var a=0;for(t=o?b(t/700):t>>1,t+=b(t/i);t>455;a+=36)t=b(t/35);return b(a+36*t/(t+38))}function decode(t){var i,o,a,u,c,h,l,p,m,g,v,w=[],_=t.length,M=0,k=128,B=72;for((o=t.lastIndexOf("-"))<0&&(o=0),a=0;a<o;++a)t.charCodeAt(a)>=128&&error("not-basic"),w.push(t.charCodeAt(a));for(u=o>0?o+1:0;u<_;){for(c=M,h=1,l=36;u>=_&&error("invalid-input"),((p=(v=t.charCodeAt(u++))-48<10?v-22:v-65<26?v-65:v-97<26?v-97:36)>=36||p>b((d-M)/h))&&error("overflow"),M+=p*h,!(p<(m=l<=B?1:l>=B+26?26:l-B));l+=36)h>b(d/(g=36-m))&&error("overflow"),h*=g;B=adapt(M-c,i=w.length+1,0==c),b(M/i)>d-k&&error("overflow"),k+=b(M/i),M%=i,w.splice(M++,0,k)}return ucs2encode(w)}function encode(t){var i,o,a,u,c,h,l,p,m,g,v,_,M,k,B,P=[];for(_=(t=ucs2decode(t)).length,i=128,o=0,c=72,h=0;h<_;++h)(v=t[h])<128&&P.push(w(v));for(a=u=P.length,u&&P.push("-");a<_;){for(l=d,h=0;h<_;++h)(v=t[h])>=i&&v<l&&(l=v);for(l-i>b((d-o)/(M=a+1))&&error("overflow"),o+=(l-i)*M,i=l,h=0;h<_;++h)if((v=t[h])<i&&++o>d&&error("overflow"),v==i){for(p=o,m=36;!(p<(g=m<=c?1:m>=c+26?26:m-c));m+=36)B=p-g,k=36-g,P.push(w(digitToBasic(g+B%k,0))),p=b(B/k);P.push(w(digitToBasic(p,0))),c=adapt(o,M,a==u),o=0,++a}++o,++i}return P.join("")}l={version:"1.4.1",ucs2:{decode:ucs2decode,encode:ucs2encode},decode:decode,encode:encode,toASCII:function toASCII(t){return mapDomain(t,(function(t){return m.test(t)?"xn--"+encode(t):t}))},toUnicode:function toUnicode(t){return mapDomain(t,(function(t){return p.test(t)?decode(t.slice(4).toLowerCase()):t}))}},void 0===(u=function(){return l}.call(i,o,i,t))||(t.exports=u)}()}).call(this,o(60)(t),o(17))},function(t,i,o){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,i,o){"use strict";i.decode=i.parse=o(408),i.encode=i.stringify=o(409)},function(t,i,o){"use strict";function hasOwnProperty(t,i){return Object.prototype.hasOwnProperty.call(t,i)}t.exports=function(t,i,o,u){i=i||"&",o=o||"=";var c={};if("string"!=typeof t||0===t.length)return c;var h=/\+/g;t=t.split(i);var l=1e3;u&&"number"==typeof u.maxKeys&&(l=u.maxKeys);var d=t.length;l>0&&d>l&&(d=l);for(var p=0;p<d;++p){var m,g,v,b,w=t[p].replace(h,"%20"),_=w.indexOf(o);_>=0?(m=w.substr(0,_),g=w.substr(_+1)):(m=w,g=""),v=decodeURIComponent(m),b=decodeURIComponent(g),hasOwnProperty(c,v)?a(c[v])?c[v].push(b):c[v]=[c[v],b]:c[v]=b}return c};var a=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,i,o){"use strict";var stringifyPrimitive=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,i,o,c){return i=i||"&",o=o||"=",null===t&&(t=void 0),"object"==typeof t?map(u(t),(function(u){var c=encodeURIComponent(stringifyPrimitive(u))+o;return a(t[u])?map(t[u],(function(t){return c+encodeURIComponent(stringifyPrimitive(t))})).join(i):c+encodeURIComponent(stringifyPrimitive(t[u]))})).join(i):c?encodeURIComponent(stringifyPrimitive(c))+o+encodeURIComponent(stringifyPrimitive(t)):""};var a=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function map(t,i){if(t.map)return t.map(i);for(var o=[],a=0;a<t.length;a++)o.push(i(t[a],a));return o}var u=Object.keys||function(t){var i=[];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&i.push(o);return i}},function(t,i,o){t.exports=o(411)},function(t,i,o){var a=o(412);o(431),o(432),o(433),o(434),o(435),o(436),o(437),o(438),t.exports=a},function(t,i,o){var a=o(413);t.exports=a},function(t,i,o){var a=o(414);o(59),t.exports=a},function(t,i,o){o(223),o(95),o(205),o(415),o(416),o(417),o(418),o(225),o(419),o(420),o(421),o(422),o(423),o(424),o(425),o(426),o(427),o(428),o(429),o(430);var a=o(15);t.exports=a.Symbol},function(t,i,o){o(16)("asyncIterator")},function(t,i){},function(t,i,o){o(16)("hasInstance")},function(t,i,o){o(16)("isConcatSpreadable")},function(t,i,o){o(16)("match")},function(t,i,o){o(16)("matchAll")},function(t,i,o){o(16)("replace")},function(t,i,o){o(16)("search")},function(t,i,o){o(16)("species")},function(t,i,o){o(16)("split")},function(t,i,o){var a=o(16),u=o(209);a("toPrimitive"),u()},function(t,i,o){var a=o(27),u=o(16),c=o(57);u("toStringTag"),c(a("Symbol"),"Symbol")},function(t,i,o){o(16)("unscopables")},function(t,i,o){var a=o(12);o(57)(a.JSON,"JSON",!0)},function(t,i){},function(t,i){},function(t,i,o){o(16)("asyncDispose")},function(t,i,o){o(16)("dispose")},function(t,i,o){o(16)("matcher")},function(t,i,o){o(16)("metadataKey")},function(t,i,o){o(16)("observable")},function(t,i,o){o(16)("metadata")},function(t,i,o){o(16)("patternMatch")},function(t,i,o){o(16)("replaceAll")},function(t,i,o){t.exports=o(440)},function(t,i,o){var a=o(441);t.exports=a},function(t,i,o){var a=o(442);t.exports=a},function(t,i,o){var a=o(443);o(59),t.exports=a},function(t,i,o){o(68),o(120);var a=o(96);t.exports=a},function(t,i,o){var a=o(9),u=o(112),c=o(55),h=o(89),l=a("".charAt),d=a("".charCodeAt),p=a("".slice),createMethod=function(t){return function(i,o){var a,m,g=c(h(i)),v=u(o),b=g.length;return v<0||v>=b?t?"":void 0:(a=d(g,v))<55296||a>56319||v+1===b||(m=d(g,v+1))<56320||m>57343?t?l(g,v):a:t?p(g,v,v+2):m-56320+(a-55296<<10)+65536}};t.exports={codeAt:createMethod(!1),charAt:createMethod(!0)}},function(t,i,o){t.exports=o(446)},function(t,i,o){var a=o(447);t.exports=a},function(t,i,o){var a=o(448);t.exports=a},function(t,i,o){var a=o(449);t.exports=a},function(t,i,o){o(450);var a=o(15);t.exports=a.Array.isArray},function(t,i,o){o(2)({target:"Array",stat:!0},{isArray:o(79)})},function(t,i,o){t.exports=o(452)},function(t,i,o){var a=o(453);t.exports=a},function(t,i,o){var a=o(227);t.exports=a},function(t,i,o){var a=o(25),u=o(455),c=Array.prototype;t.exports=function(t){var i=t.slice;return t===c||a(c,t)&&i===c.slice?u:i}},function(t,i,o){o(456);var a=o(30);t.exports=a("Array").slice},function(t,i,o){"use strict";var a=o(2),u=o(79),c=o(116),h=o(20),l=o(111),d=o(54),p=o(38),m=o(78),g=o(13),v=o(93),b=o(148),w=v("slice"),_=g("species"),M=Array,k=Math.max;a({target:"Array",proto:!0,forced:!w},{slice:function slice(t,i){var o,a,g,v=p(this),w=d(v),B=l(t,w),P=l(void 0===i?w:i,w);if(u(v)&&(o=v.constructor,(c(o)&&(o===M||u(o.prototype))||h(o)&&null===(o=o[_]))&&(o=void 0),o===M||void 0===o))return b(v,B,P);for(a=new(void 0===o?M:o)(k(P-B,0)),g=0;B<P;B++,g++)B in v&&m(a,g,v[B]);return a.length=g,a}})},function(t,i,o){t.exports=o(458)},function(t,i,o){var a=o(459);t.exports=a},function(t,i,o){var a=o(229);t.exports=a},function(t,i,o){o(120),o(461);var a=o(15);t.exports=a.Array.from},function(t,i,o){var a=o(2),u=o(462);a({target:"Array",stat:!0,forced:!o(232)((function(t){Array.from(t)}))},{from:u})},function(t,i,o){"use strict";var a=o(66),u=o(19),c=o(40),h=o(463),l=o(231),d=o(116),p=o(54),m=o(78),g=o(153),v=o(96),b=Array;t.exports=function from(t){var i=c(t),o=d(this),w=arguments.length,_=w>1?arguments[1]:void 0,M=void 0!==_;M&&(_=a(_,w>2?arguments[2]:void 0));var k,B,P,x,I,N,A=v(i),C=0;if(!A||this===b&&l(A))for(k=p(i),B=o?new this(k):b(k);k>C;C++)N=M?_(i[C],C):i[C],m(B,C,N);else for(I=(x=g(i,A)).next,B=o?new this:[];!(P=u(I,x)).done;C++)N=M?h(x,_,[P.value,C],!0):P.value,m(B,C,N);return B.length=C,B}},function(t,i,o){var a=o(28),u=o(230);t.exports=function(t,i,o,c){try{return c?i(a(o)[0],o[1]):i(o)}catch(i){u(t,"throw",i)}}},function(t,i,o){t.exports=o(465)},function(t,i,o){t.exports=o(466)},function(t,i,o){var a=o(467);t.exports=a},function(t,i,o){var a=o(468);t.exports=a},function(t,i,o){var a=o(469);o(59),t.exports=a},function(t,i,o){o(68),o(95),o(120),o(225);var a=o(145);t.exports=a.f("iterator")},function(t,i,o){var a=o(151);t.exports=function _arrayWithHoles(t){if(a(t))return t},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i,o){var a=o(94),u=o(150);t.exports=function _iterableToArrayLimit(t,i){var o=null==t?null:void 0!==a&&u(t)||t["@@iterator"];if(null!=o){var c,h,l=[],d=!0,p=!1;try{for(o=o.call(t);!(d=(c=o.next()).done)&&(l.push(c.value),!i||l.length!==i);d=!0);}catch(t){p=!0,h=t}finally{try{d||null==o.return||o.return()}finally{if(p)throw h}}return l}},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i){t.exports=function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i,o){t.exports=o(474)},function(t,i,o){var a=o(475);o(499),o(500),o(501),o(502),t.exports=a},function(t,i,o){var a=o(235);t.exports=a},function(t,i,o){o(236),o(68),o(95),o(483),o(244),o(245),o(498),o(120);var a=o(15);t.exports=a.Promise},function(t,i,o){"use strict";var a=o(2),u=o(25),c=o(117),h=o(118),l=o(478),d=o(77),p=o(45),m=o(53),g=o(479),v=o(480),b=o(69),w=o(481),_=o(13),M=o(482),k=_("toStringTag"),B=Error,P=[].push,x=function AggregateError(t,i){var o,a=arguments.length>2?arguments[2]:void 0,l=u(I,this);h?o=h(new B,l?c(this):I):(o=l?this:d(I),p(o,k,"Error")),void 0!==i&&p(o,"message",w(i)),M&&p(o,"stack",g(o.stack,1)),v(o,a);var m=[];return b(t,P,{that:m}),p(o,"errors",m),o};h?h(x,B):l(x,B,{name:!0});var I=x.prototype=d(B.prototype,{constructor:m(1,x),message:m(1,""),name:m(1,"AggregateError")});a({global:!0,constructor:!0,arity:2},{AggregateError:x})},function(t,i,o){var a=o(21),u=o(220),c=o(64),h=o(34);t.exports=function(t,i,o){for(var l=u(i),d=h.f,p=c.f,m=0;m<l.length;m++){var g=l[m];a(t,g)||o&&a(o,g)||d(t,g,p(i,g))}}},function(t,i,o){var a=o(9),u=Error,c=a("".replace),h=String(u("zxcasd").stack),l=/\n\s*at [^:]*:[^\n]*/,d=l.test(h);t.exports=function(t,i){if(d&&"string"==typeof t&&!u.prepareStackTrace)for(;i--;)t=c(t,l,"");return t}},function(t,i,o){var a=o(20),u=o(45);t.exports=function(t,i){a(i)&&"cause"in i&&u(t,"cause",i.cause)}},function(t,i,o){var a=o(55);t.exports=function(t,i){return void 0===t?arguments.length<2?"":i:a(t)}},function(t,i,o){var a=o(8),u=o(53);t.exports=!a((function(){var t=Error("a");return!("stack"in t)||(Object.defineProperty(t,"stack",u(1,7)),7!==t.stack)}))},function(t,i,o){o(484),o(493),o(494),o(495),o(496),o(497)},function(t,i,o){"use strict";var a,u,c,h=o(2),l=o(33),d=o(121),p=o(12),m=o(19),g=o(46),v=o(118),b=o(57),w=o(485),_=o(44),M=o(14),k=o(20),B=o(122),P=o(237),x=o(238).set,I=o(487),N=o(490),A=o(81),C=o(491),O=o(58),j=o(82),L=o(97),q=o(61),U=L.CONSTRUCTOR,z=L.REJECTION_EVENT,H=L.SUBCLASSING,W=O.getterFor("Promise"),V=O.set,G=j&&j.prototype,J=j,$=G,Z=p.TypeError,Y=p.document,X=p.process,Q=q.f,ee=Q,te=!!(Y&&Y.createEvent&&p.dispatchEvent),isThenable=function(t){var i;return!(!k(t)||!M(i=t.then))&&i},callReaction=function(t,i){var o,a,u,c=i.value,h=1==i.state,l=h?t.ok:t.fail,d=t.resolve,p=t.reject,g=t.domain;try{l?(h||(2===i.rejection&&onHandleUnhandled(i),i.rejection=1),!0===l?o=c:(g&&g.enter(),o=l(c),g&&(g.exit(),u=!0)),o===t.promise?p(Z("Promise-chain cycle")):(a=isThenable(o))?m(a,o,d,p):d(o)):p(c)}catch(t){g&&!u&&g.exit(),p(t)}},notify=function(t,i){t.notified||(t.notified=!0,I((function(){for(var o,a=t.reactions;o=a.get();)callReaction(o,t);t.notified=!1,i&&!t.rejection&&onUnhandled(t)})))},dispatchEvent=function(t,i,o){var a,u;te?((a=Y.createEvent("Event")).promise=i,a.reason=o,a.initEvent(t,!1,!0),p.dispatchEvent(a)):a={promise:i,reason:o},!z&&(u=p["on"+t])?u(a):"unhandledrejection"===t&&N("Unhandled promise rejection",o)},onUnhandled=function(t){m(x,p,(function(){var i,o=t.facade,a=t.value;if(isUnhandled(t)&&(i=A((function(){d?X.emit("unhandledRejection",a,o):dispatchEvent("unhandledrejection",o,a)})),t.rejection=d||isUnhandled(t)?2:1,i.error))throw i.value}))},isUnhandled=function(t){return 1!==t.rejection&&!t.parent},onHandleUnhandled=function(t){m(x,p,(function(){var i=t.facade;d?X.emit("rejectionHandled",i):dispatchEvent("rejectionhandled",i,t.value)}))},bind=function(t,i,o){return function(a){t(i,a,o)}},internalReject=function(t,i,o){t.done||(t.done=!0,o&&(t=o),t.value=i,t.state=2,notify(t,!0))},internalResolve=function(t,i,o){if(!t.done){t.done=!0,o&&(t=o);try{if(t.facade===i)throw Z("Promise can't be resolved itself");var a=isThenable(i);a?I((function(){var o={done:!1};try{m(a,i,bind(internalResolve,o,t),bind(internalReject,o,t))}catch(i){internalReject(o,i,t)}})):(t.value=i,t.state=1,notify(t,!1))}catch(i){internalReject({done:!1},i,t)}}};if(U&&($=(J=function Promise(t){B(this,$),_(t),m(a,this);var i=W(this);try{t(bind(internalResolve,i),bind(internalReject,i))}catch(t){internalReject(i,t)}}).prototype,(a=function Promise(t){V(this,{type:"Promise",done:!1,notified:!1,parent:!1,reactions:new C,rejection:!1,state:0,value:void 0})}).prototype=g($,"then",(function then(t,i){var o=W(this),a=Q(P(this,J));return o.parent=!0,a.ok=!M(t)||t,a.fail=M(i)&&i,a.domain=d?X.domain:void 0,0==o.state?o.reactions.add(a):I((function(){callReaction(a,o)})),a.promise})),u=function(){var t=new a,i=W(t);this.promise=t,this.resolve=bind(internalResolve,i),this.reject=bind(internalReject,i)},q.f=Q=function(t){return t===J||void 0===t?new u(t):ee(t)},!l&&M(j)&&G!==Object.prototype)){c=G.then,H||g(G,"then",(function then(t,i){var o=this;return new J((function(t,i){m(c,o,t,i)})).then(t,i)}),{unsafe:!0});try{delete G.constructor}catch(t){}v&&v(G,$)}h({global:!0,constructor:!0,wrap:!0,forced:U},{Promise:J}),b(J,"Promise",!1,!0),w("Promise")},function(t,i,o){"use strict";var a=o(27),u=o(34),c=o(13),h=o(18),l=c("species");t.exports=function(t){var i=a(t),o=u.f;h&&i&&!i[l]&&o(i,l,{configurable:!0,get:function(){return this}})}},function(t,i,o){var a=o(116),u=o(76),c=TypeError;t.exports=function(t){if(a(t))return t;throw c(u(t)+" is not a constructor")}},function(t,i,o){var a,u,c,h,l,d,p,m,g=o(12),v=o(66),b=o(64).f,w=o(238).set,_=o(240),M=o(488),k=o(489),B=o(121),P=g.MutationObserver||g.WebKitMutationObserver,x=g.document,I=g.process,N=g.Promise,A=b(g,"queueMicrotask"),C=A&&A.value;C||(a=function(){var t,i;for(B&&(t=I.domain)&&t.exit();u;){i=u.fn,u=u.next;try{i()}catch(t){throw u?h():c=void 0,t}}c=void 0,t&&t.enter()},_||B||k||!P||!x?!M&&N&&N.resolve?((p=N.resolve(void 0)).constructor=N,m=v(p.then,p),h=function(){m(a)}):B?h=function(){I.nextTick(a)}:(w=v(w,g),h=function(){w(a)}):(l=!0,d=x.createTextNode(""),new P(a).observe(d,{characterData:!0}),h=function(){d.data=l=!l})),t.exports=C||function(t){var i={fn:t,next:void 0};c&&(c.next=i),u||(u=i,h()),c=i}},function(t,i,o){var a=o(109),u=o(12);t.exports=/ipad|iphone|ipod/i.test(a)&&void 0!==u.Pebble},function(t,i,o){var a=o(109);t.exports=/web0s(?!.*chrome)/i.test(a)},function(t,i,o){var a=o(12);t.exports=function(t,i){var o=a.console;o&&o.error&&(1==arguments.length?o.error(t):o.error(t,i))}},function(t,i){var Queue=function(){this.head=null,this.tail=null};Queue.prototype={add:function(t){var i={item:t,next:null};this.head?this.tail.next=i:this.head=i,this.tail=i},get:function(){var t=this.head;if(t)return this.head=t.next,this.tail===t&&(this.tail=null),t.item}},t.exports=Queue},function(t,i,o){var a=o(241),u=o(121);t.exports=!a&&!u&&"object"==typeof window&&"object"==typeof document},function(t,i,o){"use strict";var a=o(2),u=o(19),c=o(44),h=o(61),l=o(81),d=o(69);a({target:"Promise",stat:!0,forced:o(242)},{all:function all(t){var i=this,o=h.f(i),a=o.resolve,p=o.reject,m=l((function(){var o=c(i.resolve),h=[],l=0,m=1;d(t,(function(t){var c=l++,d=!1;m++,u(o,i,t).then((function(t){d||(d=!0,h[c]=t,--m||a(h))}),p)})),--m||a(h)}));return m.error&&p(m.value),o.promise}})},function(t,i,o){"use strict";var a=o(2),u=o(33),c=o(97).CONSTRUCTOR,h=o(82),l=o(27),d=o(14),p=o(46),m=h&&h.prototype;if(a({target:"Promise",proto:!0,forced:c,real:!0},{catch:function(t){return this.then(void 0,t)}}),!u&&d(h)){var g=l("Promise").prototype.catch;m.catch!==g&&p(m,"catch",g,{unsafe:!0})}},function(t,i,o){"use strict";var a=o(2),u=o(19),c=o(44),h=o(61),l=o(81),d=o(69);a({target:"Promise",stat:!0,forced:o(242)},{race:function race(t){var i=this,o=h.f(i),a=o.reject,p=l((function(){var h=c(i.resolve);d(t,(function(t){u(h,i,t).then(o.resolve,a)}))}));return p.error&&a(p.value),o.promise}})},function(t,i,o){"use strict";var a=o(2),u=o(19),c=o(61);a({target:"Promise",stat:!0,forced:o(97).CONSTRUCTOR},{reject:function reject(t){var i=c.f(this);return u(i.reject,void 0,t),i.promise}})},function(t,i,o){"use strict";var a=o(2),u=o(27),c=o(33),h=o(82),l=o(97).CONSTRUCTOR,d=o(243),p=u("Promise"),m=c&&!l;a({target:"Promise",stat:!0,forced:c||l},{resolve:function resolve(t){return d(m&&this===p?h:this,t)}})},function(t,i,o){"use strict";var a=o(2),u=o(33),c=o(82),h=o(8),l=o(27),d=o(14),p=o(237),m=o(243),g=o(46),v=c&&c.prototype;if(a({target:"Promise",proto:!0,real:!0,forced:!!c&&h((function(){v.finally.call({then:function(){}},(function(){}))}))},{finally:function(t){var i=p(this,l("Promise")),o=d(t);return this.then(o?function(o){return m(i,t()).then((function(){return o}))}:t,o?function(o){return m(i,t()).then((function(){throw o}))}:t)}}),!u&&d(c)){var b=l("Promise").prototype.finally;v.finally!==b&&g(v,"finally",b,{unsafe:!0})}},function(t,i,o){o(236)},function(t,i,o){o(244)},function(t,i,o){"use strict";var a=o(2),u=o(61),c=o(81);a({target:"Promise",stat:!0,forced:!0},{try:function(t){var i=u.f(this),o=c(t);return(o.error?i.reject:i.resolve)(o.value),i.promise}})},function(t,i,o){o(245)},function(t,i,o){var a=o(7).default,u=o(94),c=o(119),h=o(504),l=o(511),d=o(214),p=o(518),m=o(234),g=o(525),v=o(226);function _regeneratorRuntime(){"use strict";t.exports=_regeneratorRuntime=function _regeneratorRuntime(){return i},t.exports.__esModule=!0,t.exports.default=t.exports;var i={},o=Object.prototype,b=o.hasOwnProperty,w="function"==typeof u?u:{},_=w.iterator||"@@iterator",M=w.asyncIterator||"@@asyncIterator",k=w.toStringTag||"@@toStringTag";function define(t,i,o){return c(t,i,{value:o,enumerable:!0,configurable:!0,writable:!0}),t[i]}try{define({},"")}catch(t){define=function define(t,i,o){return t[i]=o}}function wrap(t,i,o,a){var u=i&&i.prototype instanceof Generator?i:Generator,c=h(u.prototype),l=new Context(a||[]);return c._invoke=function(t,i,o){var a="suspendedStart";return function(u,c){if("executing"===a)throw new Error("Generator is already running");if("completed"===a){if("throw"===u)throw c;return doneResult()}for(o.method=u,o.arg=c;;){var h=o.delegate;if(h){var l=maybeInvokeDelegate(h,o);if(l){if(l===B)continue;return l}}if("next"===o.method)o.sent=o._sent=o.arg;else if("throw"===o.method){if("suspendedStart"===a)throw a="completed",o.arg;o.dispatchException(o.arg)}else"return"===o.method&&o.abrupt("return",o.arg);a="executing";var d=tryCatch(t,i,o);if("normal"===d.type){if(a=o.done?"completed":"suspendedYield",d.arg===B)continue;return{value:d.arg,done:o.done}}"throw"===d.type&&(a="completed",o.method="throw",o.arg=d.arg)}}}(t,o,l),c}function tryCatch(t,i,o){try{return{type:"normal",arg:t.call(i,o)}}catch(t){return{type:"throw",arg:t}}}i.wrap=wrap;var B={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var P={};define(P,_,(function(){return this}));var x=l&&l(l(values([])));x&&x!==o&&b.call(x,_)&&(P=x);var I=GeneratorFunctionPrototype.prototype=Generator.prototype=h(P);function defineIteratorMethods(t){var i;d(i=["next","throw","return"]).call(i,(function(i){define(t,i,(function(t){return this._invoke(i,t)}))}))}function AsyncIterator(t,i){var o;this._invoke=function(u,c){function callInvokeWithMethodAndArg(){return new i((function(o,h){!function invoke(o,u,c,h){var l=tryCatch(t[o],t,u);if("throw"!==l.type){var d=l.arg,p=d.value;return p&&"object"==a(p)&&b.call(p,"__await")?i.resolve(p.__await).then((function(t){invoke("next",t,c,h)}),(function(t){invoke("throw",t,c,h)})):i.resolve(p).then((function(t){d.value=t,c(d)}),(function(t){return invoke("throw",t,c,h)}))}h(l.arg)}(u,c,o,h)}))}return o=o?o.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(t,i){var o=t.iterator[i.method];if(void 0===o){if(i.delegate=null,"throw"===i.method){if(t.iterator.return&&(i.method="return",i.arg=void 0,maybeInvokeDelegate(t,i),"throw"===i.method))return B;i.method="throw",i.arg=new TypeError("The iterator does not provide a 'throw' method")}return B}var a=tryCatch(o,t.iterator,i.arg);if("throw"===a.type)return i.method="throw",i.arg=a.arg,i.delegate=null,B;var u=a.arg;return u?u.done?(i[t.resultName]=u.value,i.next=t.nextLoc,"return"!==i.method&&(i.method="next",i.arg=void 0),i.delegate=null,B):u:(i.method="throw",i.arg=new TypeError("iterator result is not an object"),i.delegate=null,B)}function pushTryEntry(t){var i={tryLoc:t[0]};1 in t&&(i.catchLoc=t[1]),2 in t&&(i.finallyLoc=t[2],i.afterLoc=t[3]),this.tryEntries.push(i)}function resetTryEntry(t){var i=t.completion||{};i.type="normal",delete i.arg,t.completion=i}function Context(t){this.tryEntries=[{tryLoc:"root"}],d(t).call(t,pushTryEntry,this),this.reset(!0)}function values(t){if(t){var i=t[_];if(i)return i.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function next(){for(;++o<t.length;)if(b.call(t,o))return next.value=t[o],next.done=!1,next;return next.value=void 0,next.done=!0,next};return a.next=a}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(I,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,k,"GeneratorFunction"),i.isGeneratorFunction=function(t){var i="function"==typeof t&&t.constructor;return!!i&&(i===GeneratorFunction||"GeneratorFunction"===(i.displayName||i.name))},i.mark=function(t){return p?p(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,k,"GeneratorFunction")),t.prototype=h(I),t},i.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,M,(function(){return this})),i.AsyncIterator=AsyncIterator,i.async=function(t,o,a,u,c){void 0===c&&(c=m);var h=new AsyncIterator(wrap(t,o,a,u),c);return i.isGeneratorFunction(o)?h:h.next().then((function(t){return t.done?t.value:h.next()}))},defineIteratorMethods(I),define(I,k,"Generator"),define(I,_,(function(){return this})),define(I,"toString",(function(){return"[object Generator]"})),i.keys=function(t){var i=[];for(var o in t)i.push(o);return g(i).call(i),function next(){for(;i.length;){var o=i.pop();if(o in t)return next.value=o,next.done=!1,next}return next.done=!0,next}},i.values=values,Context.prototype={constructor:Context,reset:function reset(t){var i;if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,d(i=this.tryEntries).call(i,resetTryEntry),!t)for(var o in this)"t"===o.charAt(0)&&b.call(this,o)&&!isNaN(+v(o).call(o,1))&&(this[o]=void 0)},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function dispatchException(t){if(this.done)throw t;var i=this;function handle(o,a){return u.type="throw",u.arg=t,i.next=o,a&&(i.method="next",i.arg=void 0),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],u=a.completion;if("root"===a.tryLoc)return handle("end");if(a.tryLoc<=this.prev){var c=b.call(a,"catchLoc"),h=b.call(a,"finallyLoc");if(c&&h){if(this.prev<a.catchLoc)return handle(a.catchLoc,!0);if(this.prev<a.finallyLoc)return handle(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return handle(a.catchLoc,!0)}else{if(!h)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return handle(a.finallyLoc)}}}},abrupt:function abrupt(t,i){for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o];if(a.tryLoc<=this.prev&&b.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var u=a;break}}u&&("break"===t||"continue"===t)&&u.tryLoc<=i&&i<=u.finallyLoc&&(u=null);var c=u?u.completion:{};return c.type=t,c.arg=i,u?(this.method="next",this.next=u.finallyLoc,B):this.complete(c)},complete:function complete(t,i){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&i&&(this.next=i),B},finish:function finish(t){for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i];if(o.finallyLoc===t)return this.complete(o.completion,o.afterLoc),resetTryEntry(o),B}},catch:function _catch(t){for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i];if(o.tryLoc===t){var a=o.completion;if("throw"===a.type){var u=a.arg;resetTryEntry(o)}return u}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(t,i,o){return this.delegate={iterator:values(t),resultName:i,nextLoc:o},"next"===this.method&&(this.arg=void 0),B}},i}t.exports=_regeneratorRuntime,t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i,o){t.exports=o(505)},function(t,i,o){t.exports=o(506)},function(t,i,o){var a=o(507);t.exports=a},function(t,i,o){var a=o(508);t.exports=a},function(t,i,o){var a=o(509);t.exports=a},function(t,i,o){o(510);var a=o(15).Object;t.exports=function create(t,i){return a.create(t,i)}},function(t,i,o){o(2)({target:"Object",stat:!0,sham:!o(18)},{create:o(77)})},function(t,i,o){t.exports=o(512)},function(t,i,o){t.exports=o(513)},function(t,i,o){var a=o(514);t.exports=a},function(t,i,o){var a=o(515);t.exports=a},function(t,i,o){var a=o(516);t.exports=a},function(t,i,o){o(517);var a=o(15);t.exports=a.Object.getPrototypeOf},function(t,i,o){var a=o(2),u=o(8),c=o(40),h=o(117),l=o(218);a({target:"Object",stat:!0,forced:u((function(){h(1)})),sham:!l},{getPrototypeOf:function getPrototypeOf(t){return h(c(t))}})},function(t,i,o){t.exports=o(519)},function(t,i,o){t.exports=o(520)},function(t,i,o){var a=o(521);t.exports=a},function(t,i,o){var a=o(522);t.exports=a},function(t,i,o){var a=o(523);t.exports=a},function(t,i,o){o(524);var a=o(15);t.exports=a.Object.setPrototypeOf},function(t,i,o){o(2)({target:"Object",stat:!0},{setPrototypeOf:o(118)})},function(t,i,o){t.exports=o(526)},function(t,i,o){t.exports=o(527)},function(t,i,o){var a=o(528);t.exports=a},function(t,i,o){var a=o(529);t.exports=a},function(t,i,o){var a=o(530);t.exports=a},function(t,i,o){var a=o(25),u=o(531),c=Array.prototype;t.exports=function(t){var i=t.reverse;return t===c||a(c,t)&&i===c.reverse?u:i}},function(t,i,o){o(532);var a=o(30);t.exports=a("Array").reverse},function(t,i,o){"use strict";var a=o(2),u=o(9),c=o(79),h=u([].reverse),l=[1,2];a({target:"Array",proto:!0,forced:String(l)===String(l.reverse())},{reverse:function reverse(){return c(this)&&(this.length=this.length),h(this)}})},function(t,i,o){var a=o(534);t.exports=a},function(t,i,o){var a=o(25),u=o(535),c=o(537),h=Array.prototype,l=String.prototype;t.exports=function(t){var i=t.includes;return t===h||a(h,t)&&i===h.includes?u:"string"==typeof t||t===l||a(l,t)&&i===l.includes?c:i}},function(t,i,o){o(536);var a=o(30);t.exports=a("Array").includes},function(t,i,o){"use strict";var a=o(2),u=o(141).includes,c=o(8),h=o(149);a({target:"Array",proto:!0,forced:c((function(){return!Array(1).includes()}))},{includes:function includes(t){return u(this,t,arguments.length>1?arguments[1]:void 0)}}),h("includes")},function(t,i,o){o(538);var a=o(30);t.exports=a("String").includes},function(t,i,o){"use strict";var a=o(2),u=o(9),c=o(221),h=o(89),l=o(55),d=o(222),p=u("".indexOf);a({target:"String",proto:!0,forced:!d("includes")},{includes:function includes(t){return!!~p(l(h(this)),l(c(t)),arguments.length>1?arguments[1]:void 0)}})},function(t,i,o){o(59);var a=o(56),u=o(21),c=o(25),h=o(540),l=Array.prototype,d={DOMTokenList:!0,NodeList:!0};t.exports=function(t){var i=t.entries;return t===l||c(l,t)&&i===l.entries||u(d,a(t))?h:i}},function(t,i,o){var a=o(541);t.exports=a},function(t,i,o){o(68),o(95);var a=o(30);t.exports=a("Array").entries},function(t,i,o){var a=o(543);t.exports=a},function(t,i,o){o(212);var a=o(15),u=o(103);a.JSON||(a.JSON={stringify:JSON.stringify}),t.exports=function stringify(t,i,o){return u(a.JSON.stringify,null,arguments)}},function(t,i,o){var a=o(545);t.exports=a},function(t,i,o){var a=o(25),u=o(546),c=Array.prototype;t.exports=function(t){var i=t.map;return t===c||a(c,t)&&i===c.map?u:i}},function(t,i,o){o(547);var a=o(30);t.exports=a("Array").map},function(t,i,o){"use strict";var a=o(2),u=o(67).map;a({target:"Array",proto:!0,forced:!o(93)("map")},{map:function map(t){return u(this,t,arguments.length>1?arguments[1]:void 0)}})},function(t,i,o){var a=o(549);t.exports=a},function(t,i,o){var a=o(25),u=o(550),c=Array.prototype;t.exports=function(t){var i=t.concat;return t===c||a(c,t)&&i===c.concat?u:i}},function(t,i,o){o(223);var a=o(30);t.exports=a("Array").concat},function(t,i,o){var a=o(552);t.exports=a},function(t,i,o){o(553);var a=o(15);t.exports=a.Object.entries},function(t,i,o){var a=o(2),u=o(554).entries;a({target:"Object",stat:!0},{entries:function entries(t){return u(t)}})},function(t,i,o){var a=o(18),u=o(9),c=o(91),h=o(38),l=u(o(105).f),d=u([].push),createMethod=function(t){return function(i){for(var o,u=h(i),p=c(u),m=p.length,g=0,v=[];m>g;)o=p[g++],a&&!l(u,o)||d(v,t?[o,u[o]]:u[o]);return v}};t.exports={entries:createMethod(!0),values:createMethod(!1)}},function(t,i,o){"use strict";var a=o(556),u=o(247),c=o(156),h=Object.prototype.hasOwnProperty,l={brackets:function brackets(t){return t+"[]"},comma:"comma",indices:function indices(t,i){return t+"["+i+"]"},repeat:function repeat(t){return t}},d=Array.isArray,p=String.prototype.split,m=Array.prototype.push,pushToArray=function(t,i){m.apply(t,d(i)?i:[i])},g=Date.prototype.toISOString,v=c.default,b={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:u.encode,encodeValuesOnly:!1,format:v,formatter:c.formatters[v],indices:!1,serializeDate:function serializeDate(t){return g.call(t)},skipNulls:!1,strictNullHandling:!1},w={},_=function stringify(t,i,o,c,h,l,m,g,v,_,M,k,B,P,x,I){for(var N=t,A=I,C=0,O=!1;void 0!==(A=A.get(w))&&!O;){var j=A.get(t);if(C+=1,void 0!==j){if(j===C)throw new RangeError("Cyclic object value");O=!0}void 0===A.get(w)&&(C=0)}if("function"==typeof g?N=g(i,N):N instanceof Date?N=M(N):"comma"===o&&d(N)&&(N=u.maybeMap(N,(function(t){return t instanceof Date?M(t):t}))),null===N){if(h)return m&&!P?m(i,b.encoder,x,"key",k):i;N=""}if(function isNonNullishPrimitive(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t||"symbol"==typeof t||"bigint"==typeof t}(N)||u.isBuffer(N)){if(m){var L=P?i:m(i,b.encoder,x,"key",k);if("comma"===o&&P){for(var q=p.call(String(N),","),U="",z=0;z<q.length;++z)U+=(0===z?"":",")+B(m(q[z],b.encoder,x,"value",k));return[B(L)+(c&&d(N)&&1===q.length?"[]":"")+"="+U]}return[B(L)+"="+B(m(N,b.encoder,x,"value",k))]}return[B(i)+"="+B(String(N))]}var H,W=[];if(void 0===N)return W;if("comma"===o&&d(N))H=[{value:N.length>0?N.join(",")||null:void 0}];else if(d(g))H=g;else{var V=Object.keys(N);H=v?V.sort(v):V}for(var G=c&&d(N)&&1===N.length?i+"[]":i,J=0;J<H.length;++J){var $=H[J],Z="object"==typeof $&&void 0!==$.value?$.value:N[$];if(!l||null!==Z){var Y=d(N)?"function"==typeof o?o(G,$):G:G+(_?"."+$:"["+$+"]");I.set(t,C);var X=a();X.set(w,I),pushToArray(W,stringify(Z,Y,o,c,h,l,m,g,v,_,M,k,B,P,x,X))}}return W};t.exports=function(t,i){var o,u=t,p=function normalizeStringifyOptions(t){if(!t)return b;if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var i=t.charset||b.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var o=c.default;if(void 0!==t.format){if(!h.call(c.formatters,t.format))throw new TypeError("Unknown format option provided.");o=t.format}var a=c.formatters[o],u=b.filter;return("function"==typeof t.filter||d(t.filter))&&(u=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:b.addQueryPrefix,allowDots:void 0===t.allowDots?b.allowDots:!!t.allowDots,charset:i,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:b.charsetSentinel,delimiter:void 0===t.delimiter?b.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:b.encode,encoder:"function"==typeof t.encoder?t.encoder:b.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:b.encodeValuesOnly,filter:u,format:o,formatter:a,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:b.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:b.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:b.strictNullHandling}}(i);"function"==typeof p.filter?u=(0,p.filter)("",u):d(p.filter)&&(o=p.filter);var m,g=[];if("object"!=typeof u||null===u)return"";m=i&&i.arrayFormat in l?i.arrayFormat:i&&"indices"in i?i.indices?"indices":"repeat":"indices";var v=l[m];if(i&&"commaRoundTrip"in i&&"boolean"!=typeof i.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var w="comma"===v&&i&&i.commaRoundTrip;o||(o=Object.keys(u)),p.sort&&o.sort(p.sort);for(var M=a(),k=0;k<o.length;++k){var B=o[k];p.skipNulls&&null===u[B]||pushToArray(g,_(u[B],B,v,w,p.strictNullHandling,p.skipNulls,p.encode?p.encoder:null,p.filter,p.sort,p.allowDots,p.serializeDate,p.format,p.formatter,p.encodeValuesOnly,p.charset,M))}var P=g.join(p.delimiter),x=!0===p.addQueryPrefix?"?":"";return p.charsetSentinel&&("iso-8859-1"===p.charset?x+="utf8=%26%2310003%3B&":x+="utf8=%E2%9C%93&"),P.length>0?x+P:""}},function(t,i,o){"use strict";var a=o(154),u=o(561),c=o(563),h=a("%TypeError%"),l=a("%WeakMap%",!0),d=a("%Map%",!0),p=u("WeakMap.prototype.get",!0),m=u("WeakMap.prototype.set",!0),g=u("WeakMap.prototype.has",!0),v=u("Map.prototype.get",!0),b=u("Map.prototype.set",!0),w=u("Map.prototype.has",!0),listGetNode=function(t,i){for(var o,a=t;null!==(o=a.next);a=o)if(o.key===i)return a.next=o.next,o.next=t.next,t.next=o,o};t.exports=function getSideChannel(){var t,i,o,a={assert:function(t){if(!a.has(t))throw new h("Side channel does not contain "+c(t))},get:function(a){if(l&&a&&("object"==typeof a||"function"==typeof a)){if(t)return p(t,a)}else if(d){if(i)return v(i,a)}else if(o)return function(t,i){var o=listGetNode(t,i);return o&&o.value}(o,a)},has:function(a){if(l&&a&&("object"==typeof a||"function"==typeof a)){if(t)return g(t,a)}else if(d){if(i)return w(i,a)}else if(o)return function(t,i){return!!listGetNode(t,i)}(o,a);return!1},set:function(a,u){l&&a&&("object"==typeof a||"function"==typeof a)?(t||(t=new l),m(t,a,u)):d?(i||(i=new d),b(i,a,u)):(o||(o={key:{},next:null}),function(t,i,o){var a=listGetNode(t,i);a?a.value=o:t.next={key:i,next:t.next,value:o}}(o,a,u))}};return a}},function(t,i,o){"use strict";var a="undefined"!=typeof Symbol&&Symbol,u=o(558);t.exports=function hasNativeSymbols(){return"function"==typeof a&&("function"==typeof Symbol&&("symbol"==typeof a("foo")&&("symbol"==typeof Symbol("bar")&&u())))}},function(t,i,o){"use strict";t.exports=function hasSymbols(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var t={},i=Symbol("test"),o=Object(i);if("string"==typeof i)return!1;if("[object Symbol]"!==Object.prototype.toString.call(i))return!1;if("[object Symbol]"!==Object.prototype.toString.call(o))return!1;for(i in t[i]=42,t)return!1;if("function"==typeof Object.keys&&0!==Object.keys(t).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(t).length)return!1;var a=Object.getOwnPropertySymbols(t);if(1!==a.length||a[0]!==i)return!1;if(!Object.prototype.propertyIsEnumerable.call(t,i))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var u=Object.getOwnPropertyDescriptor(t,i);if(42!==u.value||!0!==u.enumerable)return!1}return!0}},function(t,i,o){"use strict";var a="Function.prototype.bind called on incompatible ",u=Array.prototype.slice,c=Object.prototype.toString;t.exports=function bind(t){var i=this;if("function"!=typeof i||"[object Function]"!==c.call(i))throw new TypeError(a+i);for(var o,h=u.call(arguments,1),binder=function(){if(this instanceof o){var a=i.apply(this,h.concat(u.call(arguments)));return Object(a)===a?a:this}return i.apply(t,h.concat(u.call(arguments)))},l=Math.max(0,i.length-h.length),d=[],p=0;p<l;p++)d.push("$"+p);if(o=Function("binder","return function ("+d.join(",")+"){ return binder.apply(this,arguments); }")(binder),i.prototype){var m=function Empty(){};m.prototype=i.prototype,o.prototype=new m,m.prototype=null}return o}},function(t,i,o){"use strict";var a=o(155);t.exports=a.call(Function.call,Object.prototype.hasOwnProperty)},function(t,i,o){"use strict";var a=o(154),u=o(562),c=u(a("String.prototype.indexOf"));t.exports=function callBoundIntrinsic(t,i){var o=a(t,!!i);return"function"==typeof o&&c(t,".prototype.")>-1?u(o):o}},function(t,i,o){"use strict";var a=o(155),u=o(154),c=u("%Function.prototype.apply%"),h=u("%Function.prototype.call%"),l=u("%Reflect.apply%",!0)||a.call(h,c),d=u("%Object.getOwnPropertyDescriptor%",!0),p=u("%Object.defineProperty%",!0),m=u("%Math.max%");if(p)try{p({},"a",{value:1})}catch(t){p=null}t.exports=function callBind(t){var i=l(a,h,arguments);if(d&&p){var o=d(i,"length");o.configurable&&p(i,"length",{value:1+m(0,t.length-(arguments.length-1))})}return i};var g=function applyBind(){return l(a,c,arguments)};p?p(t.exports,"apply",{value:g}):t.exports.apply=g},function(t,i,o){var a="function"==typeof Map&&Map.prototype,u=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,c=a&&u&&"function"==typeof u.get?u.get:null,h=a&&Map.prototype.forEach,l="function"==typeof Set&&Set.prototype,d=Object.getOwnPropertyDescriptor&&l?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,p=l&&d&&"function"==typeof d.get?d.get:null,m=l&&Set.prototype.forEach,g="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,v="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,b="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,w=Boolean.prototype.valueOf,_=Object.prototype.toString,M=Function.prototype.toString,k=String.prototype.match,B=String.prototype.slice,P=String.prototype.replace,x=String.prototype.toUpperCase,I=String.prototype.toLowerCase,N=RegExp.prototype.test,A=Array.prototype.concat,C=Array.prototype.join,O=Array.prototype.slice,j=Math.floor,L="function"==typeof BigInt?BigInt.prototype.valueOf:null,q=Object.getOwnPropertySymbols,U="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,z="function"==typeof Symbol&&"object"==typeof Symbol.iterator,H="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===z||"symbol")?Symbol.toStringTag:null,W=Object.prototype.propertyIsEnumerable,V=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function addNumericSeparator(t,i){if(t===1/0||t===-1/0||t!=t||t&&t>-1e3&&t<1e3||N.call(/e/,i))return i;var o=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var a=t<0?-j(-t):j(t);if(a!==t){var u=String(a),c=B.call(i,u.length+1);return P.call(u,o,"$&_")+"."+P.call(P.call(c,/([0-9]{3})/g,"$&_"),/_$/,"")}}return P.call(i,o,"$&_")}var G=o(564),J=G.custom,$=isSymbol(J)?J:null;function wrapQuotes(t,i,o){var a="double"===(o.quoteStyle||i)?'"':"'";return a+t+a}function quote(t){return P.call(String(t),/"/g,""")}function isArray(t){return!("[object Array]"!==toStr(t)||H&&"object"==typeof t&&H in t)}function isRegExp(t){return!("[object RegExp]"!==toStr(t)||H&&"object"==typeof t&&H in t)}function isSymbol(t){if(z)return t&&"object"==typeof t&&t instanceof Symbol;if("symbol"==typeof t)return!0;if(!t||"object"!=typeof t||!U)return!1;try{return U.call(t),!0}catch(t){}return!1}t.exports=function inspect_(t,i,o,a){var u=i||{};if(has(u,"quoteStyle")&&"single"!==u.quoteStyle&&"double"!==u.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(has(u,"maxStringLength")&&("number"==typeof u.maxStringLength?u.maxStringLength<0&&u.maxStringLength!==1/0:null!==u.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var l=!has(u,"customInspect")||u.customInspect;if("boolean"!=typeof l&&"symbol"!==l)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(has(u,"indent")&&null!==u.indent&&"\t"!==u.indent&&!(parseInt(u.indent,10)===u.indent&&u.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(has(u,"numericSeparator")&&"boolean"!=typeof u.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var d=u.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return function inspectString(t,i){if(t.length>i.maxStringLength){var o=t.length-i.maxStringLength,a="... "+o+" more character"+(o>1?"s":"");return inspectString(B.call(t,0,i.maxStringLength),i)+a}return wrapQuotes(P.call(P.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,lowbyte),"single",i)}(t,u);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var _=String(t);return d?addNumericSeparator(t,_):_}if("bigint"==typeof t){var x=String(t)+"n";return d?addNumericSeparator(t,x):x}var N=void 0===u.depth?5:u.depth;if(void 0===o&&(o=0),o>=N&&N>0&&"object"==typeof t)return isArray(t)?"[Array]":"[Object]";var j=function getIndent(t,i){var o;if("\t"===t.indent)o="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;o=C.call(Array(t.indent+1)," ")}return{base:o,prev:C.call(Array(i+1),o)}}(u,o);if(void 0===a)a=[];else if(indexOf(a,t)>=0)return"[Circular]";function inspect(t,i,c){if(i&&(a=O.call(a)).push(i),c){var h={depth:u.depth};return has(u,"quoteStyle")&&(h.quoteStyle=u.quoteStyle),inspect_(t,h,o+1,a)}return inspect_(t,u,o+1,a)}if("function"==typeof t&&!isRegExp(t)){var q=function nameOf(t){if(t.name)return t.name;var i=k.call(M.call(t),/^function\s*([\w$]+)/);if(i)return i[1];return null}(t),J=arrObjKeys(t,inspect);return"[Function"+(q?": "+q:" (anonymous)")+"]"+(J.length>0?" { "+C.call(J,", ")+" }":"")}if(isSymbol(t)){var Z=z?P.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):U.call(t);return"object"!=typeof t||z?Z:markBoxed(Z)}if(function isElement(t){if(!t||"object"!=typeof t)return!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return!0;return"string"==typeof t.nodeName&&"function"==typeof t.getAttribute}(t)){for(var Y="<"+I.call(String(t.nodeName)),X=t.attributes||[],Q=0;Q<X.length;Q++)Y+=" "+X[Q].name+"="+wrapQuotes(quote(X[Q].value),"double",u);return Y+=">",t.childNodes&&t.childNodes.length&&(Y+="..."),Y+="</"+I.call(String(t.nodeName))+">"}if(isArray(t)){if(0===t.length)return"[]";var ee=arrObjKeys(t,inspect);return j&&!function singleLineValues(t){for(var i=0;i<t.length;i++)if(indexOf(t[i],"\n")>=0)return!1;return!0}(ee)?"["+indentedJoin(ee,j)+"]":"[ "+C.call(ee,", ")+" ]"}if(function isError(t){return!("[object Error]"!==toStr(t)||H&&"object"==typeof t&&H in t)}(t)){var te=arrObjKeys(t,inspect);return"cause"in Error.prototype||!("cause"in t)||W.call(t,"cause")?0===te.length?"["+String(t)+"]":"{ ["+String(t)+"] "+C.call(te,", ")+" }":"{ ["+String(t)+"] "+C.call(A.call("[cause]: "+inspect(t.cause),te),", ")+" }"}if("object"==typeof t&&l){if($&&"function"==typeof t[$]&&G)return G(t,{depth:N-o});if("symbol"!==l&&"function"==typeof t.inspect)return t.inspect()}if(function isMap(t){if(!c||!t||"object"!=typeof t)return!1;try{c.call(t);try{p.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(t)){var re=[];return h.call(t,(function(i,o){re.push(inspect(o,t,!0)+" => "+inspect(i,t))})),collectionOf("Map",c.call(t),re,j)}if(function isSet(t){if(!p||!t||"object"!=typeof t)return!1;try{p.call(t);try{c.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(t)){var ne=[];return m.call(t,(function(i){ne.push(inspect(i,t))})),collectionOf("Set",p.call(t),ne,j)}if(function isWeakMap(t){if(!g||!t||"object"!=typeof t)return!1;try{g.call(t,g);try{v.call(t,v)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(t))return weakCollectionOf("WeakMap");if(function isWeakSet(t){if(!v||!t||"object"!=typeof t)return!1;try{v.call(t,v);try{g.call(t,g)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(t))return weakCollectionOf("WeakSet");if(function isWeakRef(t){if(!b||!t||"object"!=typeof t)return!1;try{return b.call(t),!0}catch(t){}return!1}(t))return weakCollectionOf("WeakRef");if(function isNumber(t){return!("[object Number]"!==toStr(t)||H&&"object"==typeof t&&H in t)}(t))return markBoxed(inspect(Number(t)));if(function isBigInt(t){if(!t||"object"!=typeof t||!L)return!1;try{return L.call(t),!0}catch(t){}return!1}(t))return markBoxed(inspect(L.call(t)));if(function isBoolean(t){return!("[object Boolean]"!==toStr(t)||H&&"object"==typeof t&&H in t)}(t))return markBoxed(w.call(t));if(function isString(t){return!("[object String]"!==toStr(t)||H&&"object"==typeof t&&H in t)}(t))return markBoxed(inspect(String(t)));if(!function isDate(t){return!("[object Date]"!==toStr(t)||H&&"object"==typeof t&&H in t)}(t)&&!isRegExp(t)){var ie=arrObjKeys(t,inspect),oe=V?V(t)===Object.prototype:t instanceof Object||t.constructor===Object,se=t instanceof Object?"":"null prototype",ae=!oe&&H&&Object(t)===t&&H in t?B.call(toStr(t),8,-1):se?"Object":"",ue=(oe||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(ae||se?"["+C.call(A.call([],ae||[],se||[]),": ")+"] ":"");return 0===ie.length?ue+"{}":j?ue+"{"+indentedJoin(ie,j)+"}":ue+"{ "+C.call(ie,", ")+" }"}return String(t)};var Z=Object.prototype.hasOwnProperty||function(t){return t in this};function has(t,i){return Z.call(t,i)}function toStr(t){return _.call(t)}function indexOf(t,i){if(t.indexOf)return t.indexOf(i);for(var o=0,a=t.length;o<a;o++)if(t[o]===i)return o;return-1}function lowbyte(t){var i=t.charCodeAt(0),o={8:"b",9:"t",10:"n",12:"f",13:"r"}[i];return o?"\\"+o:"\\x"+(i<16?"0":"")+x.call(i.toString(16))}function markBoxed(t){return"Object("+t+")"}function weakCollectionOf(t){return t+" { ? }"}function collectionOf(t,i,o,a){return t+" ("+i+") {"+(a?indentedJoin(o,a):C.call(o,", "))+"}"}function indentedJoin(t,i){if(0===t.length)return"";var o="\n"+i.prev+i.base;return o+C.call(t,","+o)+"\n"+i.prev}function arrObjKeys(t,i){var o=isArray(t),a=[];if(o){a.length=t.length;for(var u=0;u<t.length;u++)a[u]=has(t,u)?i(t[u],t):""}var c,h="function"==typeof q?q(t):[];if(z){c={};for(var l=0;l<h.length;l++)c["$"+h[l]]=h[l]}for(var d in t)has(t,d)&&(o&&String(Number(d))===d&&d<t.length||z&&c["$"+d]instanceof Symbol||(N.call(/[^\w$]/,d)?a.push(i(d,t)+": "+i(t[d],t)):a.push(d+": "+i(t[d],t))));if("function"==typeof q)for(var p=0;p<h.length;p++)W.call(t,h[p])&&a.push("["+i(h[p])+"]: "+i(t[h[p]],t));return a}},function(t,i){},function(t,i,o){"use strict";var a=o(247),u=Object.prototype.hasOwnProperty,c=Array.isArray,h={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:a.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},interpretNumericEntities=function(t){return t.replace(/&#(\d+);/g,(function(t,i){return String.fromCharCode(parseInt(i,10))}))},parseArrayValue=function(t,i){return t&&"string"==typeof t&&i.comma&&t.indexOf(",")>-1?t.split(","):t},l=function parseQueryStringKeys(t,i,o,a){if(t){var c=o.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,h=/(\[[^[\]]*])/g,l=o.depth>0&&/(\[[^[\]]*])/.exec(c),d=l?c.slice(0,l.index):c,p=[];if(d){if(!o.plainObjects&&u.call(Object.prototype,d)&&!o.allowPrototypes)return;p.push(d)}for(var m=0;o.depth>0&&null!==(l=h.exec(c))&&m<o.depth;){if(m+=1,!o.plainObjects&&u.call(Object.prototype,l[1].slice(1,-1))&&!o.allowPrototypes)return;p.push(l[1])}return l&&p.push("["+c.slice(l.index)+"]"),function(t,i,o,a){for(var u=a?i:parseArrayValue(i,o),c=t.length-1;c>=0;--c){var h,l=t[c];if("[]"===l&&o.parseArrays)h=[].concat(u);else{h=o.plainObjects?Object.create(null):{};var d="["===l.charAt(0)&&"]"===l.charAt(l.length-1)?l.slice(1,-1):l,p=parseInt(d,10);o.parseArrays||""!==d?!isNaN(p)&&l!==d&&String(p)===d&&p>=0&&o.parseArrays&&p<=o.arrayLimit?(h=[])[p]=u:"__proto__"!==d&&(h[d]=u):h={0:u}}u=h}return u}(p,i,o,a)}};t.exports=function(t,i){var o=function normalizeParseOptions(t){if(!t)return h;if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var i=void 0===t.charset?h.charset:t.charset;return{allowDots:void 0===t.allowDots?h.allowDots:!!t.allowDots,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:h.allowPrototypes,allowSparse:"boolean"==typeof t.allowSparse?t.allowSparse:h.allowSparse,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:h.arrayLimit,charset:i,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:h.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:h.comma,decoder:"function"==typeof t.decoder?t.decoder:h.decoder,delimiter:"string"==typeof t.delimiter||a.isRegExp(t.delimiter)?t.delimiter:h.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:h.depth,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:h.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:h.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:h.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:h.strictNullHandling}}(i);if(""===t||null==t)return o.plainObjects?Object.create(null):{};for(var d="string"==typeof t?function parseQueryStringValues(t,i){var o,l={},d=i.ignoreQueryPrefix?t.replace(/^\?/,""):t,p=i.parameterLimit===1/0?void 0:i.parameterLimit,m=d.split(i.delimiter,p),g=-1,v=i.charset;if(i.charsetSentinel)for(o=0;o<m.length;++o)0===m[o].indexOf("utf8=")&&("utf8=%E2%9C%93"===m[o]?v="utf-8":"utf8=%26%2310003%3B"===m[o]&&(v="iso-8859-1"),g=o,o=m.length);for(o=0;o<m.length;++o)if(o!==g){var b,w,_=m[o],M=_.indexOf("]="),k=-1===M?_.indexOf("="):M+1;-1===k?(b=i.decoder(_,h.decoder,v,"key"),w=i.strictNullHandling?null:""):(b=i.decoder(_.slice(0,k),h.decoder,v,"key"),w=a.maybeMap(parseArrayValue(_.slice(k+1),i),(function(t){return i.decoder(t,h.decoder,v,"value")}))),w&&i.interpretNumericEntities&&"iso-8859-1"===v&&(w=interpretNumericEntities(w)),_.indexOf("[]=")>-1&&(w=c(w)?[w]:w),u.call(l,b)?l[b]=a.combine(l[b],w):l[b]=w}return l}(t,o):t,p=o.plainObjects?Object.create(null):{},m=Object.keys(d),g=0;g<m.length;++g){var v=m[g],b=l(v,d[v],o,"string"==typeof t);p=a.merge(p,b,o)}return!0===o.allowSparse?p:a.compact(p)}},function(t,i,o){var a=o(151),u=o(233);t.exports=function _arrayWithoutHoles(t){if(a(t))return u(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i,o){var a=o(94),u=o(150),c=o(228);t.exports=function _iterableToArray(t){if(void 0!==a&&null!=u(t)||null!=t["@@iterator"])return c(t)},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i){t.exports=function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i,o){var a=o(570);t.exports=a},function(t,i,o){var a=o(25),u=o(571),c=Array.prototype;t.exports=function(t){var i=t.find;return t===c||a(c,t)&&i===c.find?u:i}},function(t,i,o){o(572);var a=o(30);t.exports=a("Array").find},function(t,i,o){"use strict";var a=o(2),u=o(67).find,c=o(149),h=!0;"find"in[]&&Array(1).find((function(){h=!1})),a({target:"Array",proto:!0,forced:h},{find:function find(t){return u(this,t,arguments.length>1?arguments[1]:void 0)}}),c("find")},function(t,i,o){var a=o(574);t.exports=a},function(t,i,o){var a=o(25),u=o(575),c=Array.prototype;t.exports=function(t){var i=t.splice;return t===c||a(c,t)&&i===c.splice?u:i}},function(t,i,o){o(576);var a=o(30);t.exports=a("Array").splice},function(t,i,o){"use strict";var a=o(2),u=o(40),c=o(111),h=o(112),l=o(54),d=o(224),p=o(147),m=o(78),g=o(577),v=o(93)("splice"),b=Math.max,w=Math.min;a({target:"Array",proto:!0,forced:!v},{splice:function splice(t,i){var o,a,v,_,M,k,B=u(this),P=l(B),x=c(t,P),I=arguments.length;for(0===I?o=a=0:1===I?(o=0,a=P-x):(o=I-2,a=w(b(h(i),0),P-x)),d(P+o-a),v=p(B,a),_=0;_<a;_++)(M=x+_)in B&&m(v,_,B[M]);if(v.length=a,o<a){for(_=x;_<P-a;_++)k=_+o,(M=_+a)in B?B[k]=B[M]:g(B,k);for(_=P;_>P-a+o;_--)g(B,_-1)}else if(o>a)for(_=P-a;_>x;_--)k=_+o-1,(M=_+a-1)in B?B[k]=B[M]:g(B,k);for(_=0;_<o;_++)B[_+x]=arguments[_+2];return B.length=P-a+o,v}})},function(t,i,o){"use strict";var a=o(76),u=TypeError;t.exports=function(t,i){if(!delete t[i])throw u("Cannot delete property "+a(i)+" of "+a(t))}},function(t,i,o){var a=o(579);o(59),t.exports=a},function(t,i,o){o(68),o(95),o(580);var a=o(15);t.exports=a.WeakMap},function(t,i,o){o(581)},function(t,i,o){"use strict";var a,u=o(12),c=o(9),h=o(157),l=o(158),d=o(584),p=o(585),m=o(20),g=o(248),v=o(58).enforce,b=o(210),w=!u.ActiveXObject&&"ActiveXObject"in u,wrapper=function(t){return function WeakMap(){return t(this,arguments.length?arguments[0]:void 0)}},_=d("WeakMap",wrapper,p);if(b&&w){a=p.getConstructor(wrapper,"WeakMap",!0),l.enable();var M=_.prototype,k=c(M.delete),B=c(M.has),P=c(M.get),x=c(M.set);h(M,{delete:function(t){if(m(t)&&!g(t)){var i=v(this);return i.frozen||(i.frozen=new a),k(this,t)||i.frozen.delete(t)}return k(this,t)},has:function has(t){if(m(t)&&!g(t)){var i=v(this);return i.frozen||(i.frozen=new a),B(this,t)||i.frozen.has(t)}return B(this,t)},get:function get(t){if(m(t)&&!g(t)){var i=v(this);return i.frozen||(i.frozen=new a),B(this,t)?P(this,t):i.frozen.get(t)}return P(this,t)},set:function set(t,i){if(m(t)&&!g(t)){var o=v(this);o.frozen||(o.frozen=new a),B(this,t)?x(this,t,i):o.frozen.set(t,i)}else x(this,t,i);return this}})}},function(t,i,o){var a=o(8);t.exports=a((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}}))},function(t,i,o){var a=o(8);t.exports=!a((function(){return Object.isExtensible(Object.preventExtensions({}))}))},function(t,i,o){"use strict";var a=o(2),u=o(12),c=o(158),h=o(8),l=o(45),d=o(69),p=o(122),m=o(14),g=o(20),v=o(57),b=o(34).f,w=o(67).forEach,_=o(18),M=o(58),k=M.set,B=M.getterFor;t.exports=function(t,i,o){var M,P=-1!==t.indexOf("Map"),x=-1!==t.indexOf("Weak"),I=P?"set":"add",N=u[t],A=N&&N.prototype,C={};if(_&&m(N)&&(x||A.forEach&&!h((function(){(new N).entries().next()})))){var O=(M=i((function(i,o){k(p(i,O),{type:t,collection:new N}),null!=o&&d(o,i[I],{that:i,AS_ENTRIES:P})}))).prototype,j=B(t);w(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(t){var i="add"==t||"set"==t;!(t in A)||x&&"clear"==t||l(O,t,(function(o,a){var u=j(this).collection;if(!i&&x&&!g(o))return"get"==t&&void 0;var c=u[t](0===o?0:o,a);return i?this:c}))})),x||b(O,"size",{configurable:!0,get:function(){return j(this).collection.size}})}else M=o.getConstructor(i,t,P,I),c.enable();return v(M,t,!1,!0),C[t]=M,a({global:!0,forced:!0},C),x||o.setStrong(M,t,P),M}},function(t,i,o){"use strict";var a=o(9),u=o(157),c=o(158).getWeakData,h=o(28),l=o(20),d=o(122),p=o(69),m=o(67),g=o(21),v=o(58),b=v.set,w=v.getterFor,_=m.find,M=m.findIndex,k=a([].splice),B=0,uncaughtFrozenStore=function(t){return t.frozen||(t.frozen=new UncaughtFrozenStore)},UncaughtFrozenStore=function(){this.entries=[]},findUncaughtFrozen=function(t,i){return _(t.entries,(function(t){return t[0]===i}))};UncaughtFrozenStore.prototype={get:function(t){var i=findUncaughtFrozen(this,t);if(i)return i[1]},has:function(t){return!!findUncaughtFrozen(this,t)},set:function(t,i){var o=findUncaughtFrozen(this,t);o?o[1]=i:this.entries.push([t,i])},delete:function(t){var i=M(this.entries,(function(i){return i[0]===t}));return~i&&k(this.entries,i,1),!!~i}},t.exports={getConstructor:function(t,i,o,a){var m=t((function(t,u){d(t,v),b(t,{type:i,id:B++,frozen:void 0}),null!=u&&p(u,t[a],{that:t,AS_ENTRIES:o})})),v=m.prototype,_=w(i),define=function(t,i,o){var a=_(t),u=c(h(i),!0);return!0===u?uncaughtFrozenStore(a).set(i,o):u[a.id]=o,t};return u(v,{delete:function(t){var i=_(this);if(!l(t))return!1;var o=c(t);return!0===o?uncaughtFrozenStore(i).delete(t):o&&g(o,i.id)&&delete o[i.id]},has:function has(t){var i=_(this);if(!l(t))return!1;var o=c(t);return!0===o?uncaughtFrozenStore(i).has(t):o&&g(o,i.id)}}),u(v,o?{get:function get(t){var i=_(this);if(l(t)){var o=c(t);return!0===o?uncaughtFrozenStore(i).get(t):o?o[i.id]:void 0}},set:function set(t,i){return define(this,t,i)}}:{add:function add(t){return define(this,t,!0)}}),m}}},function(t,i,o){var a=o(587);o(59),t.exports=a},function(t,i,o){o(588);var a=o(15);t.exports=a.URLSearchParams},function(t,i,o){o(589)},function(t,i,o){"use strict";o(68);var a=o(2),u=o(12),c=o(19),h=o(9),l=o(18),d=o(590),p=o(46),m=o(157),g=o(57),v=o(216),b=o(58),w=o(122),_=o(14),M=o(21),k=o(66),B=o(56),P=o(28),x=o(20),I=o(55),N=o(77),A=o(53),C=o(153),O=o(96),j=o(239),L=o(13),q=o(591),U=L("iterator"),z=b.set,H=b.getterFor("URLSearchParams"),W=b.getterFor("URLSearchParamsIterator"),V=Object.getOwnPropertyDescriptor,safeGetBuiltIn=function(t){if(!l)return u[t];var i=V(u,t);return i&&i.value},G=safeGetBuiltIn("fetch"),J=safeGetBuiltIn("Request"),$=safeGetBuiltIn("Headers"),Z=J&&J.prototype,Y=$&&$.prototype,X=u.RegExp,Q=u.TypeError,ee=u.decodeURIComponent,te=u.encodeURIComponent,re=h("".charAt),ne=h([].join),ie=h([].push),oe=h("".replace),se=h([].shift),ae=h([].splice),ue=h("".split),ce=h("".slice),he=/\+/g,le=Array(4),percentSequence=function(t){return le[t-1]||(le[t-1]=X("((?:%[\\da-f]{2}){"+t+"})","gi"))},percentDecode=function(t){try{return ee(t)}catch(i){return t}},deserialize=function(t){var i=oe(t,he," "),o=4;try{return ee(i)}catch(t){for(;o;)i=oe(i,percentSequence(o--),percentDecode);return i}},fe=/[!'()~]|%20/g,de={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},replacer=function(t){return de[t]},serialize=function(t){return oe(te(t),fe,replacer)},pe=v((function Iterator(t,i){z(this,{type:"URLSearchParamsIterator",iterator:C(H(t).entries),kind:i})}),"Iterator",(function next(){var t=W(this),i=t.kind,o=t.iterator.next(),a=o.value;return o.done||(o.value="keys"===i?a.key:"values"===i?a.value:[a.key,a.value]),o}),!0),URLSearchParamsState=function(t){this.entries=[],this.url=null,void 0!==t&&(x(t)?this.parseObject(t):this.parseQuery("string"==typeof t?"?"===re(t,0)?ce(t,1):t:I(t)))};URLSearchParamsState.prototype={type:"URLSearchParams",bindURL:function(t){this.url=t,this.update()},parseObject:function(t){var i,o,a,u,h,l,d,p=O(t);if(p)for(o=(i=C(t,p)).next;!(a=c(o,i)).done;){if(h=(u=C(P(a.value))).next,(l=c(h,u)).done||(d=c(h,u)).done||!c(h,u).done)throw Q("Expected sequence with length 2");ie(this.entries,{key:I(l.value),value:I(d.value)})}else for(var m in t)M(t,m)&&ie(this.entries,{key:m,value:I(t[m])})},parseQuery:function(t){if(t)for(var i,o,a=ue(t,"&"),u=0;u<a.length;)(i=a[u++]).length&&(o=ue(i,"="),ie(this.entries,{key:deserialize(se(o)),value:deserialize(ne(o,"="))}))},serialize:function(){for(var t,i=this.entries,o=[],a=0;a<i.length;)t=i[a++],ie(o,serialize(t.key)+"="+serialize(t.value));return ne(o,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var me=function URLSearchParams(){w(this,ge);var t=arguments.length>0?arguments[0]:void 0;z(this,new URLSearchParamsState(t))},ge=me.prototype;if(m(ge,{append:function append(t,i){j(arguments.length,2);var o=H(this);ie(o.entries,{key:I(t),value:I(i)}),o.updateURL()},delete:function(t){j(arguments.length,1);for(var i=H(this),o=i.entries,a=I(t),u=0;u<o.length;)o[u].key===a?ae(o,u,1):u++;i.updateURL()},get:function get(t){j(arguments.length,1);for(var i=H(this).entries,o=I(t),a=0;a<i.length;a++)if(i[a].key===o)return i[a].value;return null},getAll:function getAll(t){j(arguments.length,1);for(var i=H(this).entries,o=I(t),a=[],u=0;u<i.length;u++)i[u].key===o&&ie(a,i[u].value);return a},has:function has(t){j(arguments.length,1);for(var i=H(this).entries,o=I(t),a=0;a<i.length;)if(i[a++].key===o)return!0;return!1},set:function set(t,i){j(arguments.length,1);for(var o,a=H(this),u=a.entries,c=!1,h=I(t),l=I(i),d=0;d<u.length;d++)(o=u[d]).key===h&&(c?ae(u,d--,1):(c=!0,o.value=l));c||ie(u,{key:h,value:l}),a.updateURL()},sort:function sort(){var t=H(this);q(t.entries,(function(t,i){return t.key>i.key?1:-1})),t.updateURL()},forEach:function forEach(t){for(var i,o=H(this).entries,a=k(t,arguments.length>1?arguments[1]:void 0),u=0;u<o.length;)a((i=o[u++]).value,i.key,this)},keys:function keys(){return new pe(this,"keys")},values:function values(){return new pe(this,"values")},entries:function entries(){return new pe(this,"entries")}},{enumerable:!0}),p(ge,U,ge.entries,{name:"entries"}),p(ge,"toString",(function toString(){return H(this).serialize()}),{enumerable:!0}),g(me,"URLSearchParams"),a({global:!0,constructor:!0,forced:!d},{URLSearchParams:me}),!d&&_($)){var ve=h(Y.has),ye=h(Y.set),wrapRequestOptions=function(t){if(x(t)){var i,o=t.body;if("URLSearchParams"===B(o))return i=t.headers?new $(t.headers):new $,ve(i,"content-type")||ye(i,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),N(t,{body:A(0,I(o)),headers:A(0,i)})}return t};if(_(G)&&a({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function fetch(t){return G(t,arguments.length>1?wrapRequestOptions(arguments[1]):{})}}),_(J)){var be=function Request(t){return w(this,Z),new J(t,arguments.length>1?wrapRequestOptions(arguments[1]):{})};Z.constructor=be,be.prototype=Z,a({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:be})}}t.exports={URLSearchParams:me,getState:H}},function(t,i,o){var a=o(8),u=o(13),c=o(33),h=u("iterator");t.exports=!a((function(){var t=new URL("b?a=1&b=2&c=3","http://a"),i=t.searchParams,o="";return t.pathname="c%20d",i.forEach((function(t,a){i.delete("b"),o+=a+t})),c&&!t.toJSON||!i.sort||"http://a/c%20d?a=1&c=3"!==t.href||"3"!==i.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!i[h]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==o||"x"!==new URL("http://x",void 0).host}))},function(t,i,o){var a=o(208),u=Math.floor,mergeSort=function(t,i){var o=t.length,c=u(o/2);return o<8?insertionSort(t,i):merge(t,mergeSort(a(t,0,c),i),mergeSort(a(t,c),i),i)},insertionSort=function(t,i){for(var o,a,u=t.length,c=1;c<u;){for(a=c,o=t[c];a&&i(t[a-1],o)>0;)t[a]=t[--a];a!==c++&&(t[a]=o)}return t},merge=function(t,i,o,a){for(var u=i.length,c=o.length,h=0,l=0;h<u||l<c;)t[h+l]=h<u&&l<c?a(i[h],o[l])<=0?i[h++]:o[l++]:h<u?i[h++]:o[l++];return t};t.exports=mergeSort},function(t,i,o){var a=o(593),u=o(632);t.exports=function baseGet(t,i){for(var o=0,c=(i=a(i,t)).length;null!=t&&o<c;)t=t[u(i[o++])];return o&&o==c?t:void 0}},function(t,i,o){var a=o(159),u=o(594),c=o(599),h=o(629);t.exports=function castPath(t,i){return a(t)?t:u(t,i)?[t]:c(h(t))}},function(t,i,o){var a=o(159),u=o(160),c=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,h=/^\w*$/;t.exports=function isKey(t,i){if(a(t))return!1;var o=typeof t;return!("number"!=o&&"symbol"!=o&&"boolean"!=o&&null!=t&&!u(t))||(h.test(t)||!c.test(t)||null!=i&&t in Object(i))}},function(t,i,o){(function(i){var o="object"==typeof i&&i&&i.Object===Object&&i;t.exports=o}).call(this,o(17))},function(t,i,o){var a=o(161),u=Object.prototype,c=u.hasOwnProperty,h=u.toString,l=a?a.toStringTag:void 0;t.exports=function getRawTag(t){var i=c.call(t,l),o=t[l];try{t[l]=void 0;var a=!0}catch(t){}var u=h.call(t);return a&&(i?t[l]=o:delete t[l]),u}},function(t,i){var o=Object.prototype.toString;t.exports=function objectToString(t){return o.call(t)}},function(t,i){t.exports=function isObjectLike(t){return null!=t&&"object"==typeof t}},function(t,i,o){var a=o(600),u=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,c=/\\(\\)?/g,h=a((function(t){var i=[];return 46===t.charCodeAt(0)&&i.push(""),t.replace(u,(function(t,o,a,u){i.push(a?u.replace(c,"$1"):o||t)})),i}));t.exports=h},function(t,i,o){var a=o(601);t.exports=function memoizeCapped(t){var i=a(t,(function(t){return 500===o.size&&o.clear(),t})),o=i.cache;return i}},function(t,i,o){var a=o(602);function memoize(t,i){if("function"!=typeof t||null!=i&&"function"!=typeof i)throw new TypeError("Expected a function");var memoized=function(){var o=arguments,a=i?i.apply(this,o):o[0],u=memoized.cache;if(u.has(a))return u.get(a);var c=t.apply(this,o);return memoized.cache=u.set(a,c)||u,c};return memoized.cache=new(memoize.Cache||a),memoized}memoize.Cache=a,t.exports=memoize},function(t,i,o){var a=o(603),u=o(624),c=o(626),h=o(627),l=o(628);function MapCache(t){var i=-1,o=null==t?0:t.length;for(this.clear();++i<o;){var a=t[i];this.set(a[0],a[1])}}MapCache.prototype.clear=a,MapCache.prototype.delete=u,MapCache.prototype.get=c,MapCache.prototype.has=h,MapCache.prototype.set=l,t.exports=MapCache},function(t,i,o){var a=o(604),u=o(616),c=o(623);t.exports=function mapCacheClear(){this.size=0,this.__data__={hash:new a,map:new(c||u),string:new a}}},function(t,i,o){var a=o(605),u=o(612),c=o(613),h=o(614),l=o(615);function Hash(t){var i=-1,o=null==t?0:t.length;for(this.clear();++i<o;){var a=t[i];this.set(a[0],a[1])}}Hash.prototype.clear=a,Hash.prototype.delete=u,Hash.prototype.get=c,Hash.prototype.has=h,Hash.prototype.set=l,t.exports=Hash},function(t,i,o){var a=o(123);t.exports=function hashClear(){this.__data__=a?a(null):{},this.size=0}},function(t,i,o){var a=o(607),u=o(608),c=o(251),h=o(610),l=/^\[object .+?Constructor\]$/,d=Function.prototype,p=Object.prototype,m=d.toString,g=p.hasOwnProperty,v=RegExp("^"+m.call(g).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function baseIsNative(t){return!(!c(t)||u(t))&&(a(t)?v:l).test(h(t))}},function(t,i,o){var a=o(249),u=o(251);t.exports=function isFunction(t){if(!u(t))return!1;var i=a(t);return"[object Function]"==i||"[object GeneratorFunction]"==i||"[object AsyncFunction]"==i||"[object Proxy]"==i}},function(t,i,o){var a,u=o(609),c=(a=/[^.]+$/.exec(u&&u.keys&&u.keys.IE_PROTO||""))?"Symbol(src)_1."+a:"";t.exports=function isMasked(t){return!!c&&c in t}},function(t,i,o){var a=o(162)["__core-js_shared__"];t.exports=a},function(t,i){var o=Function.prototype.toString;t.exports=function toSource(t){if(null!=t){try{return o.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},function(t,i){t.exports=function getValue(t,i){return null==t?void 0:t[i]}},function(t,i){t.exports=function hashDelete(t){var i=this.has(t)&&delete this.__data__[t];return this.size-=i?1:0,i}},function(t,i,o){var a=o(123),u=Object.prototype.hasOwnProperty;t.exports=function hashGet(t){var i=this.__data__;if(a){var o=i[t];return"__lodash_hash_undefined__"===o?void 0:o}return u.call(i,t)?i[t]:void 0}},function(t,i,o){var a=o(123),u=Object.prototype.hasOwnProperty;t.exports=function hashHas(t){var i=this.__data__;return a?void 0!==i[t]:u.call(i,t)}},function(t,i,o){var a=o(123);t.exports=function hashSet(t,i){var o=this.__data__;return this.size+=this.has(t)?0:1,o[t]=a&&void 0===i?"__lodash_hash_undefined__":i,this}},function(t,i,o){var a=o(617),u=o(618),c=o(620),h=o(621),l=o(622);function ListCache(t){var i=-1,o=null==t?0:t.length;for(this.clear();++i<o;){var a=t[i];this.set(a[0],a[1])}}ListCache.prototype.clear=a,ListCache.prototype.delete=u,ListCache.prototype.get=c,ListCache.prototype.has=h,ListCache.prototype.set=l,t.exports=ListCache},function(t,i){t.exports=function listCacheClear(){this.__data__=[],this.size=0}},function(t,i,o){var a=o(124),u=Array.prototype.splice;t.exports=function listCacheDelete(t){var i=this.__data__,o=a(i,t);return!(o<0)&&(o==i.length-1?i.pop():u.call(i,o,1),--this.size,!0)}},function(t,i){t.exports=function eq(t,i){return t===i||t!=t&&i!=i}},function(t,i,o){var a=o(124);t.exports=function listCacheGet(t){var i=this.__data__,o=a(i,t);return o<0?void 0:i[o][1]}},function(t,i,o){var a=o(124);t.exports=function listCacheHas(t){return a(this.__data__,t)>-1}},function(t,i,o){var a=o(124);t.exports=function listCacheSet(t,i){var o=this.__data__,u=a(o,t);return u<0?(++this.size,o.push([t,i])):o[u][1]=i,this}},function(t,i,o){var a=o(250)(o(162),"Map");t.exports=a},function(t,i,o){var a=o(125);t.exports=function mapCacheDelete(t){var i=a(this,t).delete(t);return this.size-=i?1:0,i}},function(t,i){t.exports=function isKeyable(t){var i=typeof t;return"string"==i||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==t:null===t}},function(t,i,o){var a=o(125);t.exports=function mapCacheGet(t){return a(this,t).get(t)}},function(t,i,o){var a=o(125);t.exports=function mapCacheHas(t){return a(this,t).has(t)}},function(t,i,o){var a=o(125);t.exports=function mapCacheSet(t,i){var o=a(this,t),u=o.size;return o.set(t,i),this.size+=o.size==u?0:1,this}},function(t,i,o){var a=o(630);t.exports=function toString(t){return null==t?"":a(t)}},function(t,i,o){var a=o(161),u=o(631),c=o(159),h=o(160),l=a?a.prototype:void 0,d=l?l.toString:void 0;t.exports=function baseToString(t){if("string"==typeof t)return t;if(c(t))return u(t,baseToString)+"";if(h(t))return d?d.call(t):"";var i=t+"";return"0"==i&&1/t==-1/0?"-0":i}},function(t,i){t.exports=function arrayMap(t,i){for(var o=-1,a=null==t?0:t.length,u=Array(a);++o<a;)u[o]=i(t[o],o,t);return u}},function(t,i,o){var a=o(160);t.exports=function toKey(t){if("string"==typeof t||a(t))return t;var i=t+"";return"0"==i&&1/t==-1/0?"-0":i}},function(t,i,o){t.exports=o(634)},function(t,i,o){var a=o(635);t.exports=a},function(t,i,o){var a=o(636);t.exports=a},function(t,i,o){var a=o(637);t.exports=a},function(t,i,o){var a=o(25),u=o(638),c=Array.prototype;t.exports=function(t){var i=t.indexOf;return t===c||a(c,t)&&i===c.indexOf?u:i}},function(t,i,o){o(639);var a=o(30);t.exports=a("Array").indexOf},function(t,i,o){"use strict";var a=o(2),u=o(9),c=o(141).indexOf,h=o(219),l=u([].indexOf),d=!!l&&1/l([1],1,-0)<0,p=h("indexOf");a({target:"Array",proto:!0,forced:d||!p},{indexOf:function indexOf(t){var i=arguments.length>1?arguments[1]:void 0;return d?l(this,t,i)||0:c(this,t,i)}})},function(t,i,o){var a=o(196),u=o(252);t.exports=function _objectWithoutPropertiesLoose(t,i){if(null==t)return{};var o,c,h={},l=a(t);for(c=0;c<l.length;c++)o=l[c],u(i).call(i,o)>=0||(h[o]=t[o]);return h},t.exports.__esModule=!0,t.exports.default=t.exports},function(t,i,o){t.exports=o(642)},function(t,i,o){o(643);var a=o(644);t.exports=a},function(t,i,o){o(253)},function(t,i,o){var a=o(645);t.exports=a},function(t,i,o){var a=o(646);t.exports=a},function(t,i,o){o(253),t.exports=o(12)},function(t,i){t.exports=function isBuffer(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(t,i){"function"==typeof Object.create?t.exports=function inherits(t,i){t.super_=i,t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function inherits(t,i){t.super_=i;var TempCtor=function(){};TempCtor.prototype=i.prototype,t.prototype=new TempCtor,t.prototype.constructor=t}},function(t,i,o){"use strict";(function(i){var a=o(650),u=o(254),c=o(32),h=o(165),l=o(71)("mqttjs"),d={};function connect(t,i){if(l("connecting to an MQTT broker..."),"object"!=typeof t||i||(i=t,t=null),i=i||{},t){var o=c.parse(t,!0);if(null!=o.port&&(o.port=Number(o.port)),null===(i=h(o,i)).protocol)throw new Error("Missing protocol");i.protocol=i.protocol.replace(/:$/,"")}if(function parseAuthOptions(t){var i;t.auth&&((i=t.auth.match(/^(.+):(.+)$/))?(t.username=i[1],t.password=i[2]):t.username=t.auth)}(i),i.query&&"string"==typeof i.query.clientId&&(i.clientId=i.query.clientId),i.cert&&i.key){if(!i.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs","alis"].indexOf(i.protocol))switch(i.protocol){case"mqtt":i.protocol="mqtts";break;case"ws":i.protocol="wss";break;case"wx":i.protocol="wxs";break;case"ali":i.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+i.protocol+'"!')}}if(!d[i.protocol]){var u=-1!==["mqtts","wss"].indexOf(i.protocol);i.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((function(t,i){return(!u||i%2!=0)&&"function"==typeof d[t]}))[0]}if(!1===i.clean&&!i.clientId)throw new Error("Missing clientId for unclean clients");i.protocol&&(i.defaultProtocol=i.protocol);var p=new a((function wrapper(t){return i.servers&&(t._reconnectCount&&t._reconnectCount!==i.servers.length||(t._reconnectCount=0),i.host=i.servers[t._reconnectCount].host,i.port=i.servers[t._reconnectCount].port,i.protocol=i.servers[t._reconnectCount].protocol?i.servers[t._reconnectCount].protocol:i.defaultProtocol,i.hostname=i.host,t._reconnectCount++),l("calling streambuilder for",i.protocol),d[i.protocol](t,i)}),i);return p.on("error",(function(){})),p}void 0!==i&&"browser"!==i.title||"function"!=typeof o?(d.mqtt=o(263),d.tcp=o(263),d.ssl=o(168),d.tls=o(168),d.mqtts=o(168)):(d.wx=o(264),d.wxs=o(264),d.ali=o(267),d.alis=o(267)),d.ws=o(268),d.wss=o(268),t.exports=connect,t.exports.connect=connect,t.exports.MqttClient=a,t.exports.Store=u}).call(this,o(11))},function(t,i,o){"use strict";(function(i,a){var u=o(31).EventEmitter,c=o(254),h=o(658),l=o(47).Writable,d=o(1),p=o(667),m=o(668),g=o(165),v=o(71)("mqttjs:client"),b=i?i.nextTick:function(t){setTimeout(t,0)},w=a.setImmediate||function(t){b(t)},_={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},M=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],k={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};function sendPacket(t,i,o){v("sendPacket :: packet: %O",i),v("sendPacket :: emitting `packetsend`"),t.emit("packetsend",i),v("sendPacket :: writing to stream");var a=h.writeToStream(i,t.stream,t.options);v("sendPacket :: writeToStream result %s",a),!a&&o?(v("sendPacket :: handle events on `drain` once through callback."),t.stream.once("drain",o)):o&&(v("sendPacket :: invoking cb"),o())}function flush(t){t&&(v("flush: queue exists? %b",!!t),Object.keys(t).forEach((function(i){"function"==typeof t[i].cb&&(t[i].cb(new Error("Connection closed")),delete t[i])})))}function storeAndSend(t,i,o,a){v("storeAndSend :: store packet with cmd %s to outgoingStore",i.cmd),t.outgoingStore.put(i,(function storedPacket(u){if(u)return o&&o(u);a(),sendPacket(t,i,o)}))}function nop(t){v("nop ::",t)}function MqttClient(t,i){var o,a=this;if(!(this instanceof MqttClient))return new MqttClient(t,i);for(o in this.options=i||{},_)void 0===this.options[o]?this.options[o]=_[o]:this.options[o]=i[o];v("MqttClient :: options.protocol",i.protocol),v("MqttClient :: options.protocolVersion",i.protocolVersion),v("MqttClient :: options.username",i.username),v("MqttClient :: options.keepalive",i.keepalive),v("MqttClient :: options.reconnectPeriod",i.reconnectPeriod),v("MqttClient :: options.rejectUnauthorized",i.rejectUnauthorized),this.options.clientId="string"==typeof i.clientId?i.clientId:function defaultId(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}(),v("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=5===i.protocolVersion&&i.customHandleAcks?i.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=t,this.outgoingStore=i.outgoingStore||new c,this.incomingStore=i.incomingStore||new c,this.queueQoSZero=void 0===i.queueQoSZero||i.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this.nextId=Math.max(1,Math.floor(65535*Math.random())),this.outgoing={},this._firstConnection=!0,this.on("connect",(function(){var t=this.queue;v("connect :: sending queued packets"),function deliver(){var i,o=t.shift();v("deliver :: entry %o",o),o&&(i=o.packet,v("deliver :: call _sendPacket for %o",i),a._sendPacket(i,(function(t){o.cb&&o.cb(t),deliver()})))}()})),this.on("close",(function(){v("close :: connected set to `false`"),this.connected=!1,v("close :: clearing connackTimer"),clearTimeout(this.connackTimer),v("close :: clearing ping timer"),null!==a.pingTimer&&(a.pingTimer.clear(),a.pingTimer=null),v("close :: calling _setupReconnect"),this._setupReconnect()})),u.call(this),v("MqttClient :: setting up stream"),this._setupStream()}d(MqttClient,u),MqttClient.prototype._setupStream=function(){var t,i=this,o=new l,a=h.parser(this.options),u=null,c=[];function nextTickWork(){if(c.length)b(work);else{var t=u;u=null,t()}}function work(){v("work :: getting next packet in queue");var t=c.shift();if(t)v("work :: packet pulled from queue"),i._handlePacket(t,nextTickWork);else{v("work :: no packets in queue");var o=u;u=null,v("work :: done flag is %s",!!o),o&&o()}}if(v("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),v("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),a.on("packet",(function(t){v("parser :: on packet push to packets array."),c.push(t)})),o._write=function(t,i,o){u=o,v("writable stream :: parsing buffer"),a.parse(t),work()},v("_setupStream :: pipe stream to writable stream"),this.stream.pipe(o),this.stream.on("error",(function streamErrorHandler(t){v("streamErrorHandler :: error",t.message),M.includes(t.code)?(v("streamErrorHandler :: emitting error"),i.emit("error",t)):nop(t)})),this.stream.on("close",(function(){v("(%s)stream :: on close",i.options.clientId),function flushVolatile(t){t&&(v("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(t).forEach((function(i){t[i].volatile&&"function"==typeof t[i].cb&&(t[i].cb(new Error("Connection closed")),delete t[i])})))}(i.outgoing),v("stream: emit close to MqttClient"),i.emit("close")})),v("_setupStream: sending packet `connect`"),(t=Object.create(this.options)).cmd="connect",sendPacket(this,t),a.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return i.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&"object"==typeof this.options.authPacket)sendPacket(this,g({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((function(){v("!!connectTimeout hit!! Calling _cleanUp with force `true`"),i._cleanUp(!0)}),this.options.connectTimeout)},MqttClient.prototype._handlePacket=function(t,i){var o=this.options;if(5===o.protocolVersion&&o.properties&&o.properties.maximumPacketSize&&o.properties.maximumPacketSize<t.length)return this.emit("error",new Error("exceeding packets size "+t.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(v("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",t),t.cmd){case"publish":this._handlePublish(t,i);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(t),i();break;case"pubrel":this._handlePubrel(t,i);break;case"connack":this._handleConnack(t),i();break;case"pingresp":this._handlePingresp(t),i();break;case"disconnect":this._handleDisconnect(t),i()}},MqttClient.prototype._checkDisconnecting=function(t){return this.disconnecting&&(t?t(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},MqttClient.prototype.publish=function(t,i,o,a){var u;v("publish :: message `%s` to topic `%s`",i,t);var c=this.options;"function"==typeof o&&(a=o,o=null);if(o=g({qos:0,retain:!1,dup:!1},o),this._checkDisconnecting(a))return this;switch(u={cmd:"publish",topic:t,payload:i,qos:o.qos,retain:o.retain,messageId:this._nextId(),dup:o.dup},5===c.protocolVersion&&(u.properties=o.properties,(!c.properties&&u.properties&&u.properties.topicAlias||o.properties&&c.properties&&(o.properties.topicAlias&&c.properties.topicAliasMaximum&&o.properties.topicAlias>c.properties.topicAliasMaximum||!c.properties.topicAliasMaximum&&o.properties.topicAlias))&&delete u.properties.topicAlias),v("publish :: qos",o.qos),o.qos){case 1:case 2:this.outgoing[u.messageId]={volatile:!1,cb:a||nop},this._storeProcessing?(v("_storeProcessing enabled"),this._packetIdsDuringStoreProcessing[u.messageId]=!1,this._storePacket(u,void 0,o.cbStorePut)):(v("MqttClient:publish: packet cmd: %s",u.cmd),this._sendPacket(u,void 0,o.cbStorePut));break;default:this._storeProcessing?(v("_storeProcessing enabled"),this._storePacket(u,a,o.cbStorePut)):(v("MqttClient:publish: packet cmd: %s",u.cmd),this._sendPacket(u,a,o.cbStorePut))}return this},MqttClient.prototype.subscribe=function(){for(var t,i=new Array(arguments.length),o=0;o<arguments.length;o++)i[o]=arguments[o];var a,u=[],c=i.shift(),h=c.resubscribe,l=i.pop()||nop,d=i.pop(),p=this,b=this.options.protocolVersion;if(delete c.resubscribe,"string"==typeof c&&(c=[c]),"function"!=typeof l&&(d=l,l=nop),null!==(a=m.validateTopics(c)))return w(l,new Error("Invalid topic "+a)),this;if(this._checkDisconnecting(l))return v("subscribe: discconecting true"),this;var _={qos:0};if(5===b&&(_.nl=!1,_.rap=!1,_.rh=0),d=g(_,d),Array.isArray(c)?c.forEach((function(t){if(v("subscribe: array topic %s",t),!p._resubscribeTopics.hasOwnProperty(t)||p._resubscribeTopics[t].qos<d.qos||h){var i={topic:t,qos:d.qos};5===b&&(i.nl=d.nl,i.rap=d.rap,i.rh=d.rh,i.properties=d.properties),v("subscribe: pushing topic `%s` and qos `%s` to subs list",i.topic,i.qos),u.push(i)}})):Object.keys(c).forEach((function(t){if(v("subscribe: object topic %s",t),!p._resubscribeTopics.hasOwnProperty(t)||p._resubscribeTopics[t].qos<c[t].qos||h){var i={topic:t,qos:c[t].qos};5===b&&(i.nl=c[t].nl,i.rap=c[t].rap,i.rh=c[t].rh,i.properties=d.properties),v("subscribe: pushing `%s` to subs list",i),u.push(i)}})),t={cmd:"subscribe",subscriptions:u,qos:1,retain:!1,dup:!1,messageId:this._nextId()},d.properties&&(t.properties=d.properties),u.length){if(this.options.resubscribe){v("subscribe :: resubscribe true");var M=[];u.forEach((function(t){if(p.options.reconnectPeriod>0){var i={qos:t.qos};5===b&&(i.nl=t.nl||!1,i.rap=t.rap||!1,i.rh=t.rh||0,i.properties=t.properties),p._resubscribeTopics[t.topic]=i,M.push(t.topic)}})),p.messageIdToTopic[t.messageId]=M}return this.outgoing[t.messageId]={volatile:!0,cb:function(t,i){if(!t)for(var o=i.granted,a=0;a<o.length;a+=1)u[a].qos=o[a];l(t,u)}},v("subscribe :: call _sendPacket"),this._sendPacket(t),this}l(null,[])},MqttClient.prototype.unsubscribe=function(){for(var t={cmd:"unsubscribe",qos:1,messageId:this._nextId()},i=this,o=new Array(arguments.length),a=0;a<arguments.length;a++)o[a]=arguments[a];var u=o.shift(),c=o.pop()||nop,h=o.pop();return"string"==typeof u&&(u=[u]),"function"!=typeof c&&(h=c,c=nop),this._checkDisconnecting(c)||("string"==typeof u?t.unsubscriptions=[u]:Array.isArray(u)&&(t.unsubscriptions=u),this.options.resubscribe&&t.unsubscriptions.forEach((function(t){delete i._resubscribeTopics[t]})),"object"==typeof h&&h.properties&&(t.properties=h.properties),this.outgoing[t.messageId]={volatile:!0,cb:c},v("unsubscribe: call _sendPacket"),this._sendPacket(t)),this},MqttClient.prototype.end=function(t,i,o){var a=this;function closeStores(){v("end :: closeStores: closing incoming and outgoing stores"),a.disconnected=!0,a.incomingStore.close((function(t){a.outgoingStore.close((function(i){if(v("end :: closeStores: emitting end"),a.emit("end"),o){let a=t||i;v("end :: closeStores: invoking callback with args"),o(a)}}))})),a._deferredReconnect&&a._deferredReconnect()}function finish(){v("end :: (%s) :: finish :: calling _cleanUp with force %s",a.options.clientId,t),a._cleanUp(t,()=>{v("end :: finish :: calling process.nextTick on closeStores"),b(closeStores.bind(a))},i)}return v("end :: (%s)",this.options.clientId),null!=t&&"boolean"==typeof t||(o=i||nop,i=t,t=!1,"object"!=typeof i&&(o=i,i=null,"function"!=typeof o&&(o=nop))),"object"!=typeof i&&(o=i,i=null),v("end :: cb? %s",!!o),o=o||nop,this.disconnecting?(o(),this):(this._clearReconnect(),this.disconnecting=!0,!t&&Object.keys(this.outgoing).length>0?(v("end :: (%s) :: calling finish in 10ms once outgoing is empty",a.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,finish,10))):(v("end :: (%s) :: immediately calling finish",a.options.clientId),finish()),this)},MqttClient.prototype.removeOutgoingMessage=function(t){var i=this.outgoing[t]?this.outgoing[t].cb:null;return delete this.outgoing[t],this.outgoingStore.del({messageId:t},(function(){i(new Error("Message removed"))})),this},MqttClient.prototype.reconnect=function(t){v("client reconnect");var i=this,f=function(){t?(i.options.incomingStore=t.incomingStore,i.options.outgoingStore=t.outgoingStore):(i.options.incomingStore=null,i.options.outgoingStore=null),i.incomingStore=i.options.incomingStore||new c,i.outgoingStore=i.options.outgoingStore||new c,i.disconnecting=!1,i.disconnected=!1,i._deferredReconnect=null,i._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=f:f(),this},MqttClient.prototype._reconnect=function(){v("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),v("client already connected. disconnecting first.")):(v("_reconnect: calling _setupStream"),this._setupStream())},MqttClient.prototype._setupReconnect=function(){var t=this;!t.disconnecting&&!t.reconnectTimer&&t.options.reconnectPeriod>0?(this.reconnecting||(v("_setupReconnect :: emit `offline` state"),this.emit("offline"),v("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),v("_setupReconnect :: setting reconnectTimer for %d ms",t.options.reconnectPeriod),t.reconnectTimer=setInterval((function(){v("reconnectTimer :: reconnect triggered!"),t._reconnect()}),t.options.reconnectPeriod)):v("_setupReconnect :: doing nothing...")},MqttClient.prototype._clearReconnect=function(){v("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},MqttClient.prototype._cleanUp=function(t,i){var o=arguments[2];if(i&&(v("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",i)),v("_cleanUp :: forced? %s",t),t)0===this.options.reconnectPeriod&&this.options.clean&&flush(this.outgoing),v("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{var a=g({cmd:"disconnect"},o);v("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(a,w.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(v("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(v("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),i&&!this.connected&&(v("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",i),i())},MqttClient.prototype._sendPacket=function(t,i,o){if(v("_sendPacket :: (%s) :: start",this.options.clientId),o=o||nop,!this.connected)return v("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(t,i,o);switch(this._shiftPingInterval(),t.cmd){case"publish":break;case"pubrel":return void storeAndSend(this,t,i,o);default:return void sendPacket(this,t,i)}switch(t.qos){case 2:case 1:storeAndSend(this,t,i,o);break;case 0:default:sendPacket(this,t,i)}v("_sendPacket :: (%s) :: end",this.options.clientId)},MqttClient.prototype._storePacket=function(t,i,o){v("_storePacket :: packet: %o",t),v("_storePacket :: cb? %s",!!i),o=o||nop,0===(t.qos||0)&&this.queueQoSZero||"publish"!==t.cmd?this.queue.push({packet:t,cb:i}):t.qos>0?(i=this.outgoing[t.messageId]?this.outgoing[t.messageId].cb:null,this.outgoingStore.put(t,(function(t){if(t)return i&&i(t);o()}))):i&&i(new Error("No connection to broker"))},MqttClient.prototype._setupPingTimer=function(){v("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);var t=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=p((function(){t._checkPing()}),1e3*this.options.keepalive))},MqttClient.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},MqttClient.prototype._checkPing=function(){v("_checkPing :: checking ping..."),this.pingResp?(v("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(v("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},MqttClient.prototype._handlePingresp=function(){this.pingResp=!0},MqttClient.prototype._handleConnack=function(t){v("_handleConnack");var i=this.options,o=5===i.protocolVersion?t.reasonCode:t.returnCode;if(clearTimeout(this.connackTimer),t.properties&&(t.properties.topicAliasMaximum&&(i.properties||(i.properties={}),i.properties.topicAliasMaximum=t.properties.topicAliasMaximum),t.properties.serverKeepAlive&&i.keepalive&&(i.keepalive=t.properties.serverKeepAlive,this._shiftPingInterval()),t.properties.maximumPacketSize&&(i.properties||(i.properties={}),i.properties.maximumPacketSize=t.properties.maximumPacketSize)),0===o)this.reconnecting=!1,this._onConnect(t);else if(o>0){var a=new Error("Connection refused: "+k[o]);a.code=o,this.emit("error",a)}},MqttClient.prototype._handlePublish=function(t,i){v("_handlePublish: packet %o",t),i=void 0!==i?i:nop;var o=t.topic.toString(),a=t.payload,u=t.qos,c=t.messageId,h=this,l=this.options,d=[0,16,128,131,135,144,145,151,153];switch(v("_handlePublish: qos %d",u),u){case 2:l.customHandleAcks(o,a,t,(function(o,a){return o instanceof Error||(a=o,o=null),o?h.emit("error",o):-1===d.indexOf(a)?h.emit("error",new Error("Wrong reason code for pubrec")):void(a?h._sendPacket({cmd:"pubrec",messageId:c,reasonCode:a},i):h.incomingStore.put(t,(function(){h._sendPacket({cmd:"pubrec",messageId:c},i)})))}));break;case 1:l.customHandleAcks(o,a,t,(function(u,l){return u instanceof Error||(l=u,u=null),u?h.emit("error",u):-1===d.indexOf(l)?h.emit("error",new Error("Wrong reason code for puback")):(l||h.emit("message",o,a,t),void h.handleMessage(t,(function(t){if(t)return i&&i(t);h._sendPacket({cmd:"puback",messageId:c,reasonCode:l},i)})))}));break;case 0:this.emit("message",o,a,t),this.handleMessage(t,i);break;default:v("_handlePublish: unknown QoS. Doing nothing.")}},MqttClient.prototype.handleMessage=function(t,i){i()},MqttClient.prototype._handleAck=function(t){var i,o=t.messageId,a=t.cmd,u=null,c=this.outgoing[o]?this.outgoing[o].cb:null,h=this;if(c){switch(v("_handleAck :: packet type",a),a){case"pubcomp":case"puback":var l=t.reasonCode;l&&l>0&&16!==l&&((i=new Error("Publish error: "+k[l])).code=l,c(i,t)),delete this.outgoing[o],this.outgoingStore.del(t,c);break;case"pubrec":u={cmd:"pubrel",qos:2,messageId:o};var d=t.reasonCode;d&&d>0&&16!==d?((i=new Error("Publish error: "+k[d])).code=d,c(i,t)):this._sendPacket(u);break;case"suback":delete this.outgoing[o];for(var p=0;p<t.granted.length;p++)if(0!=(128&t.granted[p])){var m=this.messageIdToTopic[o];m&&m.forEach((function(t){delete h._resubscribeTopics[t]}))}c(null,t);break;case"unsuback":delete this.outgoing[o],c(null);break;default:h.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}else v("_handleAck :: Server sent an ack in error. Ignoring.")},MqttClient.prototype._handlePubrel=function(t,i){v("handling pubrel packet"),i=void 0!==i?i:nop;var o=t.messageId,a=this,u={cmd:"pubcomp",messageId:o};a.incomingStore.get(t,(function(t,o){t?a._sendPacket(u,i):(a.emit("message",o.topic,o.payload,o),a.handleMessage(o,(function(t){if(t)return i(t);a.incomingStore.del(o,nop),a._sendPacket(u,i)})))}))},MqttClient.prototype._handleDisconnect=function(t){this.emit("disconnect",t)},MqttClient.prototype._nextId=function(){var t=this.nextId++;return 65536===this.nextId&&(this.nextId=1),t},MqttClient.prototype.getLastMessageId=function(){return 1===this.nextId?65535:this.nextId-1},MqttClient.prototype._resubscribe=function(t){v("_resubscribe");var i=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||5===this.options.protocolVersion&&!t.sessionPresent)&&i.length>0)if(this.options.resubscribe)if(5===this.options.protocolVersion){v("_resubscribe: protocolVersion 5");for(var o=0;o<i.length;o++){var a={};a[i[o]]=this._resubscribeTopics[i[o]],a.resubscribe=!0,this.subscribe(a,{properties:a[i[o]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},MqttClient.prototype._onConnect=function(t){if(this.disconnected)this.emit("connect",t);else{var i=this;this._setupPingTimer(),this._resubscribe(t),this.connected=!0,function startStreamProcess(){var o=i.outgoingStore.createStream();function clearStoreProcessing(){i._storeProcessing=!1,i._packetIdsDuringStoreProcessing={}}function remove(){o.destroy(),o=null,clearStoreProcessing()}i.once("close",remove),o.on("error",(function(t){clearStoreProcessing(),i.removeListener("close",remove),i.emit("error",t)})),o.on("end",(function(){var o=!0;for(var a in i._packetIdsDuringStoreProcessing)if(!i._packetIdsDuringStoreProcessing[a]){o=!1;break}o?(clearStoreProcessing(),i.removeListener("close",remove),i.emit("connect",t)):startStreamProcess()})),function storeDeliver(){if(o){i._storeProcessing=!0;var t,a=o.read(1);a?i._packetIdsDuringStoreProcessing[a.messageId]?storeDeliver():i.disconnecting||i.reconnectTimer?o.destroy&&o.destroy():(t=i.outgoing[a.messageId]?i.outgoing[a.messageId].cb:null,i.outgoing[a.messageId]={volatile:!1,cb:function(i,o){t&&t(i,o),storeDeliver()}},i._packetIdsDuringStoreProcessing[a.messageId]=!0,i._sendPacket(a)):o.once("readable",storeDeliver)}}()}()}},t.exports=MqttClient}).call(this,o(11),o(17))},function(t,i){},function(t,i,o){"use strict";function ownKeys(t,i){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);i&&(a=a.filter((function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable}))),o.push.apply(o,a)}return o}function _defineProperty(t,i,o){return i in t?Object.defineProperty(t,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[i]=o,t}function _defineProperties(t,i){for(var o=0;o<i.length;o++){var a=i[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}var a=o(10).Buffer,u=o(653).inspect,c=u&&u.custom||"inspect";t.exports=function(){function BufferList(){!function _classCallCheck(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}(this,BufferList),this.head=null,this.tail=null,this.length=0}return function _createClass(t,i,o){return i&&_defineProperties(t.prototype,i),o&&_defineProperties(t,o),t}(BufferList,[{key:"push",value:function push(t){var i={data:t,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length}},{key:"unshift",value:function unshift(t){var i={data:t,next:this.head};0===this.length&&(this.tail=i),this.head=i,++this.length}},{key:"shift",value:function shift(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function clear(){this.head=this.tail=null,this.length=0}},{key:"join",value:function join(t){if(0===this.length)return"";for(var i=this.head,o=""+i.data;i=i.next;)o+=t+i.data;return o}},{key:"concat",value:function concat(t){if(0===this.length)return a.alloc(0);for(var i,o,u,c=a.allocUnsafe(t>>>0),h=this.head,l=0;h;)i=h.data,o=c,u=l,a.prototype.copy.call(i,o,u),l+=h.data.length,h=h.next;return c}},{key:"consume",value:function consume(t,i){var o;return t<this.head.data.length?(o=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):o=t===this.head.data.length?this.shift():i?this._getString(t):this._getBuffer(t),o}},{key:"first",value:function first(){return this.head.data}},{key:"_getString",value:function _getString(t){var i=this.head,o=1,a=i.data;for(t-=a.length;i=i.next;){var u=i.data,c=t>u.length?u.length:t;if(c===u.length?a+=u:a+=u.slice(0,t),0===(t-=c)){c===u.length?(++o,i.next?this.head=i.next:this.head=this.tail=null):(this.head=i,i.data=u.slice(c));break}++o}return this.length-=o,a}},{key:"_getBuffer",value:function _getBuffer(t){var i=a.allocUnsafe(t),o=this.head,u=1;for(o.data.copy(i),t-=o.data.length;o=o.next;){var c=o.data,h=t>c.length?c.length:t;if(c.copy(i,i.length-t,0,h),0===(t-=h)){h===c.length?(++u,o.next?this.head=o.next:this.head=this.tail=null):(this.head=o,o.data=c.slice(h));break}++u}return this.length-=u,i}},{key:c,value:function value(t,i){return u(this,function _objectSpread(t){for(var i=1;i<arguments.length;i++){var o=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(o),!0).forEach((function(i){_defineProperty(t,i,o[i])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):ownKeys(Object(o)).forEach((function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(o,i))}))}return t}({},i,{depth:0,customInspect:!1}))}}]),BufferList}()},function(t,i){},function(t,i,o){"use strict";(function(i){var a;function _defineProperty(t,i,o){return i in t?Object.defineProperty(t,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[i]=o,t}var u=o(167),c=Symbol("lastResolve"),h=Symbol("lastReject"),l=Symbol("error"),d=Symbol("ended"),p=Symbol("lastPromise"),m=Symbol("handlePromise"),g=Symbol("stream");function createIterResult(t,i){return{value:t,done:i}}function readAndResolve(t){var i=t[c];if(null!==i){var o=t[g].read();null!==o&&(t[p]=null,t[c]=null,t[h]=null,i(createIterResult(o,!1)))}}function onReadable(t){i.nextTick(readAndResolve,t)}var v=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((_defineProperty(a={get stream(){return this[g]},next:function next(){var t=this,o=this[l];if(null!==o)return Promise.reject(o);if(this[d])return Promise.resolve(createIterResult(void 0,!0));if(this[g].destroyed)return new Promise((function(o,a){i.nextTick((function(){t[l]?a(t[l]):o(createIterResult(void 0,!0))}))}));var a,u=this[p];if(u)a=new Promise(function wrapForNext(t,i){return function(o,a){t.then((function(){i[d]?o(createIterResult(void 0,!0)):i[m](o,a)}),a)}}(u,this));else{var c=this[g].read();if(null!==c)return Promise.resolve(createIterResult(c,!1));a=new Promise(this[m])}return this[p]=a,a}},Symbol.asyncIterator,(function(){return this})),_defineProperty(a,"return",(function _return(){var t=this;return new Promise((function(i,o){t[g].destroy(null,(function(t){t?o(t):i(createIterResult(void 0,!0))}))}))})),a),v);t.exports=function createReadableStreamAsyncIterator(t){var i,o=Object.create(b,(_defineProperty(i={},g,{value:t,writable:!0}),_defineProperty(i,c,{value:null,writable:!0}),_defineProperty(i,h,{value:null,writable:!0}),_defineProperty(i,l,{value:null,writable:!0}),_defineProperty(i,d,{value:t._readableState.endEmitted,writable:!0}),_defineProperty(i,m,{value:function value(t,i){var a=o[g].read();a?(o[p]=null,o[c]=null,o[h]=null,t(createIterResult(a,!1))):(o[c]=t,o[h]=i)},writable:!0}),i));return o[p]=null,u(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var i=o[h];return null!==i&&(o[p]=null,o[c]=null,o[h]=null,i(t)),void(o[l]=t)}var a=o[c];null!==a&&(o[p]=null,o[c]=null,o[h]=null,a(createIterResult(void 0,!0))),o[d]=!0})),t.on("readable",onReadable.bind(null,o)),o}}).call(this,o(11))},function(t,i){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},function(t,i,o){"use strict";t.exports=PassThrough;var a=o(260);function PassThrough(t){if(!(this instanceof PassThrough))return new PassThrough(t);a.call(this,t)}o(1)(PassThrough,a),PassThrough.prototype._transform=function(t,i,o){o(null,t)}},function(t,i,o){"use strict";var a;var u=o(83).codes,c=u.ERR_MISSING_ARGS,h=u.ERR_STREAM_DESTROYED;function noop(t){if(t)throw t}function destroyer(t,i,u,c){c=function once(t){var i=!1;return function(){i||(i=!0,t.apply(void 0,arguments))}}(c);var l=!1;t.on("close",(function(){l=!0})),void 0===a&&(a=o(167)),a(t,{readable:i,writable:u},(function(t){if(t)return c(t);l=!0,c()}));var d=!1;return function(i){if(!l&&!d)return d=!0,function isRequest(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void c(i||new h("pipe"))}}function call(t){t()}function pipe(t,i){return t.pipe(i)}function popCallback(t){return t.length?"function"!=typeof t[t.length-1]?noop:t.pop():noop}t.exports=function pipeline(){for(var t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];var a,u=popCallback(i);if(Array.isArray(i[0])&&(i=i[0]),i.length<2)throw new c("streams");var h=i.map((function(t,o){var c=o<i.length-1;return destroyer(t,c,o>0,(function(t){a||(a=t),t&&h.forEach(call),c||(h.forEach(call),u(a))}))}));return i.reduce(pipe)}},function(t,i,o){i.parser=o(659).parser,i.generate=o(665),i.writeToStream=o(262)},function(t,i,o){const a=o(660),u=o(31),c=o(662),h=o(261),l=o(71)("mqtt-packet:parser");class Parser extends u{constructor(){super(),this.parser=this.constructor.parser}static parser(t){return this instanceof Parser?(this.settings=t||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):(new Parser).parser(t)}_resetState(){l("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new c,this.error=null,this._list=a(),this._stateCounter=0}parse(t){for(this.error&&this._resetState(),this._list.append(t),l("parse: current state: %s",this._states[this._stateCounter]);(-1!==this.packet.length||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,l("parse: state complete. _stateCounter is now: %d",this._stateCounter),l("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return l("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const t=this._list.readUInt8(0);return this.packet.cmd=h.types[t>>h.CMD_SHIFT],this.packet.retain=0!=(t&h.RETAIN_MASK),this.packet.qos=t>>h.QOS_SHIFT&h.QOS_MASK,this.packet.dup=0!=(t&h.DUP_MASK),l("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const t=this._parseVarByteNum(!0);return t&&(this.packet.length=t.value,this._list.consume(t.bytes)),l("_parseLength %d",t.value),!!t}_parsePayload(){l("_parsePayload: payload %O",this._list);let t=!1;if(0===this.packet.length||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}t=!0}return l("_parsePayload complete result: %s",t),t}_parseConnect(){let t,i,o,a;l("_parseConnect");const u={},c=this.packet,d=this._parseString();if(null===d)return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==d&&"MQIsdp"!==d)return this._emitError(new Error("Invalid protocolId"));if(c.protocolId=d,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(c.protocolVersion=this._list.readUInt8(this._pos),c.protocolVersion>=128&&(c.bridgeMode=!0,c.protocolVersion=c.protocolVersion-128),3!==c.protocolVersion&&4!==c.protocolVersion&&5!==c.protocolVersion)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(u.username=this._list.readUInt8(this._pos)&h.USERNAME_MASK,u.password=this._list.readUInt8(this._pos)&h.PASSWORD_MASK,u.will=this._list.readUInt8(this._pos)&h.WILL_FLAG_MASK,u.will&&(c.will={},c.will.retain=0!=(this._list.readUInt8(this._pos)&h.WILL_RETAIN_MASK),c.will.qos=(this._list.readUInt8(this._pos)&h.WILL_QOS_MASK)>>h.WILL_QOS_SHIFT),c.clean=0!=(this._list.readUInt8(this._pos)&h.CLEAN_SESSION_MASK),this._pos++,c.keepalive=this._parseNum(),-1===c.keepalive)return this._emitError(new Error("Packet too short"));if(5===c.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(c.properties=t)}const p=this._parseString();if(null===p)return this._emitError(new Error("Packet too short"));if(c.clientId=p,l("_parseConnect: packet.clientId: %s",c.clientId),u.will){if(5===c.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(c.will.properties=t)}if(t=this._parseString(),null===t)return this._emitError(new Error("Cannot parse will topic"));if(c.will.topic=t,l("_parseConnect: packet.will.topic: %s",c.will.topic),i=this._parseBuffer(),null===i)return this._emitError(new Error("Cannot parse will payload"));c.will.payload=i,l("_parseConnect: packet.will.paylaod: %s",c.will.payload)}if(u.username){if(a=this._parseString(),null===a)return this._emitError(new Error("Cannot parse username"));c.username=a,l("_parseConnect: packet.username: %s",c.username)}if(u.password){if(o=this._parseBuffer(),null===o)return this._emitError(new Error("Cannot parse password"));c.password=o}return this.settings=c,l("_parseConnect: complete"),c}_parseConnack(){l("_parseConnack");const t=this.packet;if(this._list.length<1)return null;if(t.sessionPresent=!!(this._list.readUInt8(this._pos++)&h.SESSIONPRESENT_MASK),5===this.settings.protocolVersion)this._list.length>=2?t.reasonCode=this._list.readUInt8(this._pos++):t.reasonCode=0;else{if(this._list.length<2)return null;t.returnCode=this._list.readUInt8(this._pos++)}if(-1===t.returnCode||-1===t.reasonCode)return this._emitError(new Error("Cannot parse return code"));if(5===this.settings.protocolVersion){const i=this._parseProperties();Object.getOwnPropertyNames(i).length&&(t.properties=i)}l("_parseConnack: complete")}_parsePublish(){l("_parsePublish");const t=this.packet;if(t.topic=this._parseString(),null===t.topic)return this._emitError(new Error("Cannot parse topic"));if(!(t.qos>0)||this._parseMessageId()){if(5===this.settings.protocolVersion){const i=this._parseProperties();Object.getOwnPropertyNames(i).length&&(t.properties=i)}t.payload=this._list.slice(this._pos,t.length),l("_parsePublish: payload from buffer list: %o",t.payload)}}_parseSubscribe(){l("_parseSubscribe");const t=this.packet;let i,o,a,u,c,d,p;if(1!==t.qos)return this._emitError(new Error("Wrong subscribe header"));if(t.subscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const i=this._parseProperties();Object.getOwnPropertyNames(i).length&&(t.properties=i)}for(;this._pos<t.length;){if(i=this._parseString(),null===i)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=t.length)return this._emitError(new Error("Malformed Subscribe Payload"));o=this._parseByte(),a=o&h.SUBSCRIBE_OPTIONS_QOS_MASK,d=0!=(o>>h.SUBSCRIBE_OPTIONS_NL_SHIFT&h.SUBSCRIBE_OPTIONS_NL_MASK),c=0!=(o>>h.SUBSCRIBE_OPTIONS_RAP_SHIFT&h.SUBSCRIBE_OPTIONS_RAP_MASK),u=o>>h.SUBSCRIBE_OPTIONS_RH_SHIFT&h.SUBSCRIBE_OPTIONS_RH_MASK,p={topic:i,qos:a},5===this.settings.protocolVersion?(p.nl=d,p.rap=c,p.rh=u):this.settings.bridgeMode&&(p.rh=0,p.rap=!0,p.nl=!0),l("_parseSubscribe: push subscription `%s` to subscription",p),t.subscriptions.push(p)}}}_parseSuback(){l("_parseSuback");const t=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const i=this._parseProperties();Object.getOwnPropertyNames(i).length&&(t.properties=i)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){l("_parseUnsubscribe");const t=this.packet;if(t.unsubscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const i=this._parseProperties();Object.getOwnPropertyNames(i).length&&(t.properties=i)}for(;this._pos<t.length;){const i=this._parseString();if(null===i)return this._emitError(new Error("Cannot parse topic"));l("_parseUnsubscribe: push topic `%s` to unsubscriptions",i),t.unsubscriptions.push(i)}}}_parseUnsuback(){l("_parseUnsuback");const t=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(5===this.settings.protocolVersion){const i=this._parseProperties();for(Object.getOwnPropertyNames(i).length&&(t.properties=i),t.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){l("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const t=this.packet;if(this._parseMessageId(),5===this.settings.protocolVersion&&(t.length>2?(t.reasonCode=this._parseByte(),l("_parseConfirmation: packet.reasonCode `%d`",t.reasonCode)):t.reasonCode=0,t.length>3)){const i=this._parseProperties();Object.getOwnPropertyNames(i).length&&(t.properties=i)}return!0}_parseDisconnect(){const t=this.packet;if(l("_parseDisconnect"),5===this.settings.protocolVersion){this._list.length>0?t.reasonCode=this._parseByte():t.reasonCode=0;const i=this._parseProperties();Object.getOwnPropertyNames(i).length&&(t.properties=i)}return l("_parseDisconnect result: true"),!0}_parseAuth(){l("_parseAuth");const t=this.packet;if(5!==this.settings.protocolVersion)return this._emitError(new Error("Not supported auth packet for this version MQTT"));t.reasonCode=this._parseByte();const i=this._parseProperties();return Object.getOwnPropertyNames(i).length&&(t.properties=i),l("_parseAuth: result: true"),!0}_parseMessageId(){const t=this.packet;return t.messageId=this._parseNum(),null===t.messageId?(this._emitError(new Error("Cannot parse messageId")),!1):(l("_parseMessageId: packet.messageId %d",t.messageId),!0)}_parseString(t){const i=this._parseNum(),o=i+this._pos;if(-1===i||o>this._list.length||o>this.packet.length)return null;const a=this._list.toString("utf8",this._pos,o);return this._pos+=i,l("_parseString: result: %s",a),a}_parseStringPair(){return l("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const t=this._parseNum(),i=t+this._pos;if(-1===t||i>this._list.length||i>this.packet.length)return null;const o=this._list.slice(this._pos,i);return this._pos+=t,l("_parseBuffer: result: %o",o),o}_parseNum(){if(this._list.length-this._pos<2)return-1;const t=this._list.readUInt16BE(this._pos);return this._pos+=2,l("_parseNum: result: %s",t),t}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const t=this._list.readUInt32BE(this._pos);return this._pos+=4,l("_parse4ByteNum: result: %s",t),t}_parseVarByteNum(t){l("_parseVarByteNum");let i,o=0,a=1,u=0,c=!1;const d=this._pos?this._pos:0;for(;o<4&&d+o<this._list.length;){if(i=this._list.readUInt8(d+o++),u+=a*(i&h.VARBYTEINT_MASK),a*=128,0==(i&h.VARBYTEINT_FIN_MASK)){c=!0;break}if(this._list.length<=o)break}return!c&&4===o&&this._list.length>=o&&this._emitError(new Error("Invalid variable byte integer")),d&&(this._pos+=o),c=!!c&&(t?{bytes:o,value:u}:u),l("_parseVarByteNum: result: %o",c),c}_parseByte(){let t;return this._pos<this._list.length&&(t=this._list.readUInt8(this._pos),this._pos++),l("_parseByte: result: %o",t),t}_parseByType(t){switch(l("_parseByType: type: %s",t),t){case"byte":return 0!==this._parseByte();case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){l("_parseProperties");const t=this._parseVarByteNum(),i=this._pos+t,o={};for(;this._pos<i;){const t=this._parseByte();if(!t)return this._emitError(new Error("Cannot parse property code type")),!1;const i=h.propertiesCodes[t];if(!i)return this._emitError(new Error("Unknown property")),!1;if("userProperties"!==i)o[i]?(Array.isArray(o[i])||(o[i]=[o[i]]),o[i].push(this._parseByType(h.propertiesTypes[i]))):o[i]=this._parseByType(h.propertiesTypes[i]);else{o[i]||(o[i]=Object.create(null));const t=this._parseByType(h.propertiesTypes[i]);if(o[i][t.name])if(Array.isArray(o[i][t.name]))o[i][t.name].push(t.value);else{const a=o[i][t.name];o[i][t.name]=[a],o[i][t.name].push(t.value)}else o[i][t.name]=t.value}}return o}_newPacket(){return l("_newPacket"),this.packet&&(this._list.consume(this.packet.length),l("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),l("_newPacket: new packet"),this.packet=new c,this._pos=0,!0}_emitError(t){l("_emitError"),this.error=t,this.emit("error",t)}}t.exports=Parser},function(t,i,o){"use strict";const a=o(47).Duplex,u=o(1),c=o(661);function BufferListStream(t){if(!(this instanceof BufferListStream))return new BufferListStream(t);if("function"==typeof t){this._callback=t;const i=function piper(t){this._callback&&(this._callback(t),this._callback=null)}.bind(this);this.on("pipe",(function onPipe(t){t.on("error",i)})),this.on("unpipe",(function onUnpipe(t){t.removeListener("error",i)})),t=null}c._init.call(this,t),a.call(this)}u(BufferListStream,a),Object.assign(BufferListStream.prototype,c.prototype),BufferListStream.prototype._new=function _new(t){return new BufferListStream(t)},BufferListStream.prototype._write=function _write(t,i,o){this._appendBuffer(t),"function"==typeof o&&o()},BufferListStream.prototype._read=function _read(t){if(!this.length)return this.push(null);t=Math.min(t,this.length),this.push(this.slice(0,t)),this.consume(t)},BufferListStream.prototype.end=function end(t){a.prototype.end.call(this,t),this._callback&&(this._callback(null,this.slice()),this._callback=null)},BufferListStream.prototype._destroy=function _destroy(t,i){this._bufs.length=0,this.length=0,i(t)},BufferListStream.prototype._isBufferList=function _isBufferList(t){return t instanceof BufferListStream||t instanceof c||BufferListStream.isBufferList(t)},BufferListStream.isBufferList=c.isBufferList,t.exports=BufferListStream,t.exports.BufferListStream=BufferListStream,t.exports.BufferList=c},function(t,i,o){"use strict";const{Buffer:a}=o(10),u=Symbol.for("BufferList");function BufferList(t){if(!(this instanceof BufferList))return new BufferList(t);BufferList._init.call(this,t)}BufferList._init=function _init(t){Object.defineProperty(this,u,{value:!0}),this._bufs=[],this.length=0,t&&this.append(t)},BufferList.prototype._new=function _new(t){return new BufferList(t)},BufferList.prototype._offset=function _offset(t){if(0===t)return[0,0];let i=0;for(let o=0;o<this._bufs.length;o++){const a=i+this._bufs[o].length;if(t<a||o===this._bufs.length-1)return[o,t-i];i=a}},BufferList.prototype._reverseOffset=function(t){const i=t[0];let o=t[1];for(let t=0;t<i;t++)o+=this._bufs[t].length;return o},BufferList.prototype.get=function get(t){if(t>this.length||t<0)return;const i=this._offset(t);return this._bufs[i[0]][i[1]]},BufferList.prototype.slice=function slice(t,i){return"number"==typeof t&&t<0&&(t+=this.length),"number"==typeof i&&i<0&&(i+=this.length),this.copy(null,0,t,i)},BufferList.prototype.copy=function copy(t,i,o,u){if(("number"!=typeof o||o<0)&&(o=0),("number"!=typeof u||u>this.length)&&(u=this.length),o>=this.length)return t||a.alloc(0);if(u<=0)return t||a.alloc(0);const copy=!!t,c=this._offset(o),h=u-o;let l=h,d=copy&&i||0,p=c[1];if(0===o&&u===this.length){if(!copy)return 1===this._bufs.length?this._bufs[0]:a.concat(this._bufs,this.length);for(let i=0;i<this._bufs.length;i++)this._bufs[i].copy(t,d),d+=this._bufs[i].length;return t}if(l<=this._bufs[c[0]].length-p)return copy?this._bufs[c[0]].copy(t,i,p,p+l):this._bufs[c[0]].slice(p,p+l);copy||(t=a.allocUnsafe(h));for(let i=c[0];i<this._bufs.length;i++){const o=this._bufs[i].length-p;if(!(l>o)){this._bufs[i].copy(t,d,p,p+l),d+=o;break}this._bufs[i].copy(t,d,p),d+=o,l-=o,p&&(p=0)}return t.length>d?t.slice(0,d):t},BufferList.prototype.shallowSlice=function shallowSlice(t,i){if(t=t||0,i="number"!=typeof i?this.length:i,t<0&&(t+=this.length),i<0&&(i+=this.length),t===i)return this._new();const o=this._offset(t),a=this._offset(i),u=this._bufs.slice(o[0],a[0]+1);return 0===a[1]?u.pop():u[u.length-1]=u[u.length-1].slice(0,a[1]),0!==o[1]&&(u[0]=u[0].slice(o[1])),this._new(u)},BufferList.prototype.toString=function toString(t,i,o){return this.slice(i,o).toString(t)},BufferList.prototype.consume=function consume(t){if(t=Math.trunc(t),Number.isNaN(t)||t<=0)return this;for(;this._bufs.length;){if(!(t>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(t),this.length-=t;break}t-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},BufferList.prototype.duplicate=function duplicate(){const t=this._new();for(let i=0;i<this._bufs.length;i++)t.append(this._bufs[i]);return t},BufferList.prototype.append=function append(t){if(null==t)return this;if(t.buffer)this._appendBuffer(a.from(t.buffer,t.byteOffset,t.byteLength));else if(Array.isArray(t))for(let i=0;i<t.length;i++)this.append(t[i]);else if(this._isBufferList(t))for(let i=0;i<t._bufs.length;i++)this.append(t._bufs[i]);else"number"==typeof t&&(t=t.toString()),this._appendBuffer(a.from(t));return this},BufferList.prototype._appendBuffer=function appendBuffer(t){this._bufs.push(t),this.length+=t.length},BufferList.prototype.indexOf=function(t,i,o){if(void 0===o&&"string"==typeof i&&(o=i,i=void 0),"function"==typeof t||Array.isArray(t))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof t?t=a.from([t]):"string"==typeof t?t=a.from(t,o):this._isBufferList(t)?t=t.slice():Array.isArray(t.buffer)?t=a.from(t.buffer,t.byteOffset,t.byteLength):a.isBuffer(t)||(t=a.from(t)),i=Number(i||0),isNaN(i)&&(i=0),i<0&&(i=this.length+i),i<0&&(i=0),0===t.length)return i>this.length?this.length:i;const u=this._offset(i);let c=u[0],h=u[1];for(;c<this._bufs.length;c++){const i=this._bufs[c];for(;h<i.length;){if(i.length-h>=t.length){const o=i.indexOf(t,h);if(-1!==o)return this._reverseOffset([c,o]);h=i.length-t.length+1}else{const i=this._reverseOffset([c,h]);if(this._match(i,t))return i;h++}}h=0}return-1},BufferList.prototype._match=function(t,i){if(this.length-t<i.length)return!1;for(let o=0;o<i.length;o++)if(this.get(t+o)!==i[o])return!1;return!0},function(){const t={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const i in t)!function(i){BufferList.prototype[i]=null===t[i]?function(t,o){return this.slice(t,t+o)[i](0,o)}:function(o=0){return this.slice(o,o+t[i])[i](0)}}(i)}(),BufferList.prototype._isBufferList=function _isBufferList(t){return t instanceof BufferList||BufferList.isBufferList(t)},BufferList.isBufferList=function isBufferList(t){return null!=t&&t[u]},t.exports=BufferList},function(t,i){t.exports=class Packet{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}},function(t,i,o){t.exports=function setup(t){function createDebug(t){let i,o,a,u=null;function debug(...t){if(!debug.enabled)return;const o=debug,a=Number(new Date),u=a-(i||a);o.diff=u,o.prev=i,o.curr=a,i=a,t[0]=createDebug.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let c=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,(i,a)=>{if("%%"===i)return"%";c++;const u=createDebug.formatters[a];if("function"==typeof u){const a=t[c];i=u.call(o,a),t.splice(c,1),c--}return i}),createDebug.formatArgs.call(o,t);(o.log||createDebug.log).apply(o,t)}return debug.namespace=t,debug.useColors=createDebug.useColors(),debug.color=createDebug.selectColor(t),debug.extend=extend,debug.destroy=createDebug.destroy,Object.defineProperty(debug,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==u?u:(o!==createDebug.namespaces&&(o=createDebug.namespaces,a=createDebug.enabled(t)),a),set:t=>{u=t}}),"function"==typeof createDebug.init&&createDebug.init(debug),debug}function extend(t,i){const o=createDebug(this.namespace+(void 0===i?":":i)+t);return o.log=this.log,o}function toNamespace(t){return t.toString().substring(2,t.toString().length-2).replace(/\.\*\?$/,"*")}return createDebug.debug=createDebug,createDebug.default=createDebug,createDebug.coerce=function coerce(t){if(t instanceof Error)return t.stack||t.message;return t},createDebug.disable=function disable(){const t=[...createDebug.names.map(toNamespace),...createDebug.skips.map(toNamespace).map(t=>"-"+t)].join(",");return createDebug.enable(""),t},createDebug.enable=function enable(t){let i;createDebug.save(t),createDebug.namespaces=t,createDebug.names=[],createDebug.skips=[];const o=("string"==typeof t?t:"").split(/[\s,]+/),a=o.length;for(i=0;i<a;i++)o[i]&&("-"===(t=o[i].replace(/\*/g,".*?"))[0]?createDebug.skips.push(new RegExp("^"+t.slice(1)+"$")):createDebug.names.push(new RegExp("^"+t+"$")))},createDebug.enabled=function enabled(t){if("*"===t[t.length-1])return!0;let i,o;for(i=0,o=createDebug.skips.length;i<o;i++)if(createDebug.skips[i].test(t))return!1;for(i=0,o=createDebug.names.length;i<o;i++)if(createDebug.names[i].test(t))return!0;return!1},createDebug.humanize=o(664),createDebug.destroy=function destroy(){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(t).forEach(i=>{createDebug[i]=t[i]}),createDebug.names=[],createDebug.skips=[],createDebug.formatters={},createDebug.selectColor=function selectColor(t){let i=0;for(let o=0;o<t.length;o++)i=(i<<5)-i+t.charCodeAt(o),i|=0;return createDebug.colors[Math.abs(i)%createDebug.colors.length]},createDebug.enable(createDebug.load()),createDebug}},function(t,i){var o=1e3,a=6e4,u=60*a,c=24*u;function plural(t,i,o,a){var u=i>=1.5*o;return Math.round(t/o)+" "+a+(u?"s":"")}t.exports=function(t,i){i=i||{};var h=typeof t;if("string"===h&&t.length>0)return function parse(t){if((t=String(t)).length>100)return;var i=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(!i)return;var h=parseFloat(i[1]);switch((i[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*h;case"weeks":case"week":case"w":return 6048e5*h;case"days":case"day":case"d":return h*c;case"hours":case"hour":case"hrs":case"hr":case"h":return h*u;case"minutes":case"minute":case"mins":case"min":case"m":return h*a;case"seconds":case"second":case"secs":case"sec":case"s":return h*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}(t);if("number"===h&&isFinite(t))return i.long?function fmtLong(t){var i=Math.abs(t);if(i>=c)return plural(t,i,c,"day");if(i>=u)return plural(t,i,u,"hour");if(i>=a)return plural(t,i,a,"minute");if(i>=o)return plural(t,i,o,"second");return t+" ms"}(t):function fmtShort(t){var i=Math.abs(t);if(i>=c)return Math.round(t/c)+"d";if(i>=u)return Math.round(t/u)+"h";if(i>=a)return Math.round(t/a)+"m";if(i>=o)return Math.round(t/o)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,i,o){(function(i){const a=o(262),u=o(31);class Accumulator extends u{constructor(){super(),this._array=new Array(20),this._i=0}write(t){return this._array[this._i++]=t,!0}concat(){let t=0;const o=new Array(this._array.length),a=this._array;let u,c=0;for(u=0;u<a.length&&void 0!==a[u];u++)"string"!=typeof a[u]?o[u]=a[u].length:o[u]=i.byteLength(a[u]),t+=o[u];const h=i.allocUnsafe(t);for(u=0;u<a.length&&void 0!==a[u];u++)"string"!=typeof a[u]?(a[u].copy(h,c),c+=o[u]):(h.write(a[u],c),c+=o[u]);return h}}t.exports=function generate(t,i){const o=new Accumulator;return a(t,o,i),o.concat()}}).call(this,o(10).Buffer)},function(t,i,o){(function(i){const o={},a=i.isBuffer(i.from([1,2]).subarray(0,1));function generateBuffer(t){const o=i.allocUnsafe(2);return o.writeUInt8(t>>8,0),o.writeUInt8(255&t,1),o}t.exports={cache:o,generateCache:function generateCache(){for(let t=0;t<65536;t++)o[t]=generateBuffer(t)},generateNumber:generateBuffer,genBufVariableByteInt:function genBufVariableByteInt(t){let o=0,u=0;const c=i.allocUnsafe(4);do{o=t%128|0,(t=t/128|0)>0&&(o|=128),c.writeUInt8(o,u++)}while(t>0&&u<4);return t>0&&(u=0),a?c.subarray(0,u):c.slice(0,u)},generate4ByteBuffer:function generate4ByteBuffer(t){const o=i.allocUnsafe(4);return o.writeUInt32BE(t,0),o}}}).call(this,o(10).Buffer)},function(t,i,o){"use strict";function ReInterval(t,i,o){var a=this;this._callback=t,this._args=o,this._interval=setInterval(t,i,this._args),this.reschedule=function(t){t||(t=a._interval),a._interval&&clearInterval(a._interval),a._interval=setInterval(a._callback,t,a._args)},this.clear=function(){a._interval&&(clearInterval(a._interval),a._interval=void 0)},this.destroy=function(){a._interval&&clearInterval(a._interval),a._callback=void 0,a._interval=void 0,a._args=void 0}}t.exports=function reInterval(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("interval needed");var t;if(arguments.length>0){t=new Array(arguments.length-2);for(var i=0;i<t.length;i++)t[i]=arguments[i+2]}return new ReInterval(arguments[0],arguments[1],t)}},function(t,i,o){"use strict";function validateTopic(t){for(var i=t.split("/"),o=0;o<i.length;o++)if("+"!==i[o]){if("#"===i[o])return o===i.length-1;if(-1!==i[o].indexOf("+")||-1!==i[o].indexOf("#"))return!1}return!0}t.exports={validateTopics:function validateTopics(t){if(0===t.length)return"empty_topic_list";for(var i=0;i<t.length;i++)if(!validateTopic(t[i]))return t[i];return null}}},function(t,i){},function(t,i){},function(t,i,o){var a=o(672);function once(t){var f=function(){return f.called?f.value:(f.called=!0,f.value=t.apply(this,arguments))};return f.called=!1,f}function onceStrict(t){var f=function(){if(f.called)throw new Error(f.onceError);return f.called=!0,f.value=t.apply(this,arguments)},i=t.name||"Function wrapped with `once`";return f.onceError=i+" shouldn't be called more than once",f.called=!1,f}t.exports=a(once),t.exports.strict=a(onceStrict),once.proto=once((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:!0})}))},function(t,i){t.exports=function wrappy(t,i){if(t&&i)return wrappy(t)(i);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(i){wrapper[i]=t[i]})),wrapper;function wrapper(){for(var i=new Array(arguments.length),o=0;o<i.length;o++)i[o]=arguments[o];var a=t.apply(this,i),u=i[i.length-1];return"function"==typeof a&&a!==u&&Object.keys(u).forEach((function(t){a[t]=u[t]})),a}}},function(t,i,o){"use strict";t.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},function(t,i,o){var a;t.exports=(a=o(170),o(310),o(757),a.HmacSHA256)},function(t,i,o){"use strict";i.randomBytes=i.rng=i.pseudoRandomBytes=i.prng=o(85),i.createHash=i.Hash=o(98),i.createHmac=i.Hmac=o(277);var a=o(692),u=Object.keys(a),c=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(u);i.getHashes=function(){return c};var h=o(280);i.pbkdf2=h.pbkdf2,i.pbkdf2Sync=h.pbkdf2Sync;var l=o(694);i.Cipher=l.Cipher,i.createCipher=l.createCipher,i.Cipheriv=l.Cipheriv,i.createCipheriv=l.createCipheriv,i.Decipher=l.Decipher,i.createDecipher=l.createDecipher,i.Decipheriv=l.Decipheriv,i.createDecipheriv=l.createDecipheriv,i.getCiphers=l.getCiphers,i.listCiphers=l.listCiphers;var d=o(709);i.DiffieHellmanGroup=d.DiffieHellmanGroup,i.createDiffieHellmanGroup=d.createDiffieHellmanGroup,i.getDiffieHellman=d.getDiffieHellman,i.createDiffieHellman=d.createDiffieHellman,i.DiffieHellman=d.DiffieHellman;var p=o(716);i.createSign=p.createSign,i.Sign=p.Sign,i.createVerify=p.createVerify,i.Verify=p.Verify,i.createECDH=o(749);var m=o(752);i.publicEncrypt=m.publicEncrypt,i.privateEncrypt=m.privateEncrypt,i.publicDecrypt=m.publicDecrypt,i.privateDecrypt=m.privateDecrypt;var g=o(756);i.randomFill=g.randomFill,i.randomFillSync=g.randomFillSync,i.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))},i.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}},function(t,i,o){var a=o(10),u=a.Buffer;function copyProps(t,i){for(var o in t)i[o]=t[o]}function SafeBuffer(t,i,o){return u(t,i,o)}u.from&&u.alloc&&u.allocUnsafe&&u.allocUnsafeSlow?t.exports=a:(copyProps(a,i),i.Buffer=SafeBuffer),SafeBuffer.prototype=Object.create(u.prototype),copyProps(u,SafeBuffer),SafeBuffer.from=function(t,i,o){if("number"==typeof t)throw new TypeError("Argument must not be a number");return u(t,i,o)},SafeBuffer.alloc=function(t,i,o){if("number"!=typeof t)throw new TypeError("Argument must be a number");var a=u(t);return void 0!==i?"string"==typeof o?a.fill(i,o):a.fill(i):a.fill(0),a},SafeBuffer.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return u(t)},SafeBuffer.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return a.SlowBuffer(t)}},function(t,i,o){var a=o(1),u=o(86),c=o(4).Buffer,h=[1518500249,1859775393,-1894007588,-899497514],l=new Array(80);function Sha(){this.init(),this._w=l,u.call(this,64,56)}function rotl30(t){return t<<30|t>>>2}function ft(t,i,o,a){return 0===t?i&o|~i&a:2===t?i&o|i&a|o&a:i^o^a}a(Sha,u),Sha.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Sha.prototype._update=function(t){for(var i,o=this._w,a=0|this._a,u=0|this._b,c=0|this._c,l=0|this._d,d=0|this._e,p=0;p<16;++p)o[p]=t.readInt32BE(4*p);for(;p<80;++p)o[p]=o[p-3]^o[p-8]^o[p-14]^o[p-16];for(var m=0;m<80;++m){var g=~~(m/20),v=0|((i=a)<<5|i>>>27)+ft(g,u,c,l)+d+o[m]+h[g];d=l,l=c,c=rotl30(u),u=a,a=v}this._a=a+this._a|0,this._b=u+this._b|0,this._c=c+this._c|0,this._d=l+this._d|0,this._e=d+this._e|0},Sha.prototype._hash=function(){var t=c.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=Sha},function(t,i,o){var a=o(1),u=o(86),c=o(4).Buffer,h=[1518500249,1859775393,-1894007588,-899497514],l=new Array(80);function Sha1(){this.init(),this._w=l,u.call(this,64,56)}function rotl5(t){return t<<5|t>>>27}function rotl30(t){return t<<30|t>>>2}function ft(t,i,o,a){return 0===t?i&o|~i&a:2===t?i&o|i&a|o&a:i^o^a}a(Sha1,u),Sha1.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},Sha1.prototype._update=function(t){for(var i,o=this._w,a=0|this._a,u=0|this._b,c=0|this._c,l=0|this._d,d=0|this._e,p=0;p<16;++p)o[p]=t.readInt32BE(4*p);for(;p<80;++p)o[p]=(i=o[p-3]^o[p-8]^o[p-14]^o[p-16])<<1|i>>>31;for(var m=0;m<80;++m){var g=~~(m/20),v=rotl5(a)+ft(g,u,c,l)+d+o[m]+h[g]|0;d=l,l=c,c=rotl30(u),u=a,a=v}this._a=a+this._a|0,this._b=u+this._b|0,this._c=c+this._c|0,this._d=l+this._d|0,this._e=d+this._e|0},Sha1.prototype._hash=function(){var t=c.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},t.exports=Sha1},function(t,i,o){var a=o(1),u=o(270),c=o(86),h=o(4).Buffer,l=new Array(64);function Sha224(){this.init(),this._w=l,c.call(this,64,56)}a(Sha224,u),Sha224.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},Sha224.prototype._hash=function(){var t=h.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},t.exports=Sha224},function(t,i,o){var a=o(1),u=o(271),c=o(86),h=o(4).Buffer,l=new Array(160);function Sha384(){this.init(),this._w=l,c.call(this,128,112)}a(Sha384,u),Sha384.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},Sha384.prototype._hash=function(){var t=h.allocUnsafe(48);function writeInt64BE(i,o,a){t.writeInt32BE(i,a),t.writeInt32BE(o,a+4)}return writeInt64BE(this._ah,this._al,0),writeInt64BE(this._bh,this._bl,8),writeInt64BE(this._ch,this._cl,16),writeInt64BE(this._dh,this._dl,24),writeInt64BE(this._eh,this._el,32),writeInt64BE(this._fh,this._fl,40),t},t.exports=Sha384},function(t,i,o){t.exports=Stream;var a=o(31).EventEmitter;function Stream(){a.call(this)}o(1)(Stream,a),Stream.Readable=o(174),Stream.Writable=o(687),Stream.Duplex=o(688),Stream.Transform=o(689),Stream.PassThrough=o(690),Stream.Stream=Stream,Stream.prototype.pipe=function(t,i){var o=this;function ondata(i){t.writable&&!1===t.write(i)&&o.pause&&o.pause()}function ondrain(){o.readable&&o.resume&&o.resume()}o.on("data",ondata),t.on("drain",ondrain),t._isStdio||i&&!1===i.end||(o.on("end",onend),o.on("close",onclose));var u=!1;function onend(){u||(u=!0,t.end())}function onclose(){u||(u=!0,"function"==typeof t.destroy&&t.destroy())}function onerror(t){if(cleanup(),0===a.listenerCount(this,"error"))throw t}function cleanup(){o.removeListener("data",ondata),t.removeListener("drain",ondrain),o.removeListener("end",onend),o.removeListener("close",onclose),o.removeListener("error",onerror),t.removeListener("error",onerror),o.removeListener("end",cleanup),o.removeListener("close",cleanup),t.removeListener("close",cleanup)}return o.on("error",onerror),t.on("error",onerror),o.on("end",cleanup),o.on("close",cleanup),t.on("close",cleanup),t.emit("pipe",o),t}},function(t,i){},function(t,i,o){"use strict";var a=o(4).Buffer,u=o(684);t.exports=function(){function BufferList(){!function _classCallCheck(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}(this,BufferList),this.head=null,this.tail=null,this.length=0}return BufferList.prototype.push=function push(t){var i={data:t,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length},BufferList.prototype.unshift=function unshift(t){var i={data:t,next:this.head};0===this.length&&(this.tail=i),this.head=i,++this.length},BufferList.prototype.shift=function shift(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},BufferList.prototype.clear=function clear(){this.head=this.tail=null,this.length=0},BufferList.prototype.join=function join(t){if(0===this.length)return"";for(var i=this.head,o=""+i.data;i=i.next;)o+=t+i.data;return o},BufferList.prototype.concat=function concat(t){if(0===this.length)return a.alloc(0);if(1===this.length)return this.head.data;for(var i,o,u,c=a.allocUnsafe(t>>>0),h=this.head,l=0;h;)i=h.data,o=c,u=l,i.copy(o,u),l+=h.data.length,h=h.next;return c},BufferList}(),u&&u.inspect&&u.inspect.custom&&(t.exports.prototype[u.inspect.custom]=function(){var t=u.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,i){},function(t,i,o){(function(t,i){!function(t,o){"use strict";if(!t.setImmediate){var a,u=1,c={},h=!1,l=t.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(t);d=d&&d.setTimeout?d:t,"[object process]"==={}.toString.call(t.process)?function installNextTickImplementation(){a=function(t){i.nextTick((function(){runIfPresent(t)}))}}():!function canUsePostMessage(){if(t.postMessage&&!t.importScripts){var i=!0,o=t.onmessage;return t.onmessage=function(){i=!1},t.postMessage("","*"),t.onmessage=o,i}}()?t.MessageChannel?function installMessageChannelImplementation(){var t=new MessageChannel;t.port1.onmessage=function(t){runIfPresent(t.data)},a=function(i){t.port2.postMessage(i)}}():l&&"onreadystatechange"in l.createElement("script")?function installReadyStateChangeImplementation(){var t=l.documentElement;a=function(i){var o=l.createElement("script");o.onreadystatechange=function(){runIfPresent(i),o.onreadystatechange=null,t.removeChild(o),o=null},t.appendChild(o)}}():function installSetTimeoutImplementation(){a=function(t){setTimeout(runIfPresent,0,t)}}():function installPostMessageImplementation(){var i="setImmediate$"+Math.random()+"$",onGlobalMessage=function(o){o.source===t&&"string"==typeof o.data&&0===o.data.indexOf(i)&&runIfPresent(+o.data.slice(i.length))};t.addEventListener?t.addEventListener("message",onGlobalMessage,!1):t.attachEvent("onmessage",onGlobalMessage),a=function(o){t.postMessage(i+o,"*")}}(),d.setImmediate=function setImmediate(t){"function"!=typeof t&&(t=new Function(""+t));for(var i=new Array(arguments.length-1),o=0;o<i.length;o++)i[o]=arguments[o+1];var h={callback:t,args:i};return c[u]=h,a(u),u++},d.clearImmediate=clearImmediate}function clearImmediate(t){delete c[t]}function runIfPresent(t){if(h)setTimeout(runIfPresent,0,t);else{var i=c[t];if(i){h=!0;try{!function run(t){var i=t.callback,o=t.args;switch(o.length){case 0:i();break;case 1:i(o[0]);break;case 2:i(o[0],o[1]);break;case 3:i(o[0],o[1],o[2]);break;default:i.apply(void 0,o)}}(i)}finally{clearImmediate(t),h=!1}}}}}("undefined"==typeof self?void 0===t?this:t:self)}).call(this,o(17),o(11))},function(t,i,o){"use strict";t.exports=PassThrough;var a=o(276),u=Object.create(o(41));function PassThrough(t){if(!(this instanceof PassThrough))return new PassThrough(t);a.call(this,t)}u.inherits=o(1),u.inherits(PassThrough,a),PassThrough.prototype._transform=function(t,i,o){o(null,t)}},function(t,i,o){t.exports=o(175)},function(t,i,o){t.exports=o(72)},function(t,i,o){t.exports=o(174).Transform},function(t,i,o){t.exports=o(174).PassThrough},function(t,i,o){"use strict";var a=o(1),u=o(4).Buffer,c=o(62),h=u.alloc(128);function Hmac(t,i){c.call(this,"digest"),"string"==typeof i&&(i=u.from(i)),this._alg=t,this._key=i,i.length>64?i=t(i):i.length<64&&(i=u.concat([i,h],64));for(var o=this._ipad=u.allocUnsafe(64),a=this._opad=u.allocUnsafe(64),l=0;l<64;l++)o[l]=54^i[l],a[l]=92^i[l];this._hash=[o]}a(Hmac,c),Hmac.prototype._update=function(t){this._hash.push(t)},Hmac.prototype._final=function(){var t=this._alg(u.concat(this._hash));return this._alg(u.concat([this._opad,t]))},t.exports=Hmac},function(t,i,o){t.exports=o(279)},function(t,i,o){(function(i){var a,u,c=o(4).Buffer,h=o(281),l=o(282),d=o(283),p=o(284),m=i.crypto&&i.crypto.subtle,g={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},v=[];function getNextTick(){return u||(u=i.process&&i.process.nextTick?i.process.nextTick:i.queueMicrotask?i.queueMicrotask:i.setImmediate?i.setImmediate:i.setTimeout)}function browserPbkdf2(t,i,o,a,u){return m.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then((function(t){return m.deriveBits({name:"PBKDF2",salt:i,iterations:o,hash:{name:u}},t,a<<3)})).then((function(t){return c.from(t)}))}t.exports=function(t,o,u,b,w,_){"function"==typeof w&&(_=w,w=void 0);var M=g[(w=w||"sha1").toLowerCase()];if(M&&"function"==typeof i.Promise){if(h(u,b),t=p(t,l,"Password"),o=p(o,l,"Salt"),"function"!=typeof _)throw new Error("No callback provided to pbkdf2");!function resolvePromise(t,i){t.then((function(t){getNextTick()((function(){i(null,t)}))}),(function(t){getNextTick()((function(){i(t)}))}))}(function checkNative(t){if(i.process&&!i.process.browser)return Promise.resolve(!1);if(!m||!m.importKey||!m.deriveBits)return Promise.resolve(!1);if(void 0!==v[t])return v[t];var o=browserPbkdf2(a=a||c.alloc(8),a,10,128,t).then((function(){return!0})).catch((function(){return!1}));return v[t]=o,o}(M).then((function(i){return i?browserPbkdf2(t,o,u,b,M):d(t,o,u,b,w)})),_)}else getNextTick()((function(){var i;try{i=d(t,o,u,b,w)}catch(t){return _(t)}_(null,i)}))}}).call(this,o(17))},function(t,i,o){var a=o(695),u=o(177),c=o(178),h=o(708),l=o(127);function createCipheriv(t,i,o){if(t=t.toLowerCase(),c[t])return u.createCipheriv(t,i,o);if(h[t])return new a({key:i,iv:o,mode:t});throw new TypeError("invalid suite type")}function createDecipheriv(t,i,o){if(t=t.toLowerCase(),c[t])return u.createDecipheriv(t,i,o);if(h[t])return new a({key:i,iv:o,mode:t,decrypt:!0});throw new TypeError("invalid suite type")}i.createCipher=i.Cipher=function createCipher(t,i){var o,a;if(t=t.toLowerCase(),c[t])o=c[t].key,a=c[t].iv;else{if(!h[t])throw new TypeError("invalid suite type");o=8*h[t].key,a=h[t].iv}var u=l(i,!1,o,a);return createCipheriv(t,u.key,u.iv)},i.createCipheriv=i.Cipheriv=createCipheriv,i.createDecipher=i.Decipher=function createDecipher(t,i){var o,a;if(t=t.toLowerCase(),c[t])o=c[t].key,a=c[t].iv;else{if(!h[t])throw new TypeError("invalid suite type");o=8*h[t].key,a=h[t].iv}var u=l(i,!1,o,a);return createDecipheriv(t,u.key,u.iv)},i.createDecipheriv=i.Decipheriv=createDecipheriv,i.listCiphers=i.getCiphers=function getCiphers(){return Object.keys(h).concat(u.getCiphers())}},function(t,i,o){var a=o(62),u=o(696),c=o(1),h=o(4).Buffer,l={"des-ede3-cbc":u.CBC.instantiate(u.EDE),"des-ede3":u.EDE,"des-ede-cbc":u.CBC.instantiate(u.EDE),"des-ede":u.EDE,"des-cbc":u.CBC.instantiate(u.DES),"des-ecb":u.DES};function DES(t){a.call(this);var i,o=t.mode.toLowerCase(),u=l[o];i=t.decrypt?"decrypt":"encrypt";var c=t.key;h.isBuffer(c)||(c=h.from(c)),"des-ede"!==o&&"des-ede-cbc"!==o||(c=h.concat([c,c.slice(0,8)]));var d=t.iv;h.isBuffer(d)||(d=h.from(d)),this._des=u.create({key:c,iv:d,type:i})}l.des=l["des-cbc"],l.des3=l["des-ede3-cbc"],t.exports=DES,c(DES,a),DES.prototype._update=function(t){return h.from(this._des.update(t))},DES.prototype._final=function(){return h.from(this._des.final())}},function(t,i,o){"use strict";i.utils=o(285),i.Cipher=o(176),i.DES=o(286),i.CBC=o(697),i.EDE=o(698)},function(t,i,o){"use strict";var a=o(35),u=o(1),c={};function CBCState(t){a.equal(t.length,8,"Invalid IV length"),this.iv=new Array(8);for(var i=0;i<this.iv.length;i++)this.iv[i]=t[i]}i.instantiate=function instantiate(t){function CBC(i){t.call(this,i),this._cbcInit()}u(CBC,t);for(var i=Object.keys(c),o=0;o<i.length;o++){var a=i[o];CBC.prototype[a]=c[a]}return CBC.create=function create(t){return new CBC(t)},CBC},c._cbcInit=function _cbcInit(){var t=new CBCState(this.options.iv);this._cbcState=t},c._update=function _update(t,i,o,a){var u=this._cbcState,c=this.constructor.super_.prototype,h=u.iv;if("encrypt"===this.type){for(var l=0;l<this.blockSize;l++)h[l]^=t[i+l];c._update.call(this,h,0,o,a);for(l=0;l<this.blockSize;l++)h[l]=o[a+l]}else{c._update.call(this,t,i,o,a);for(l=0;l<this.blockSize;l++)o[a+l]^=h[l];for(l=0;l<this.blockSize;l++)h[l]=t[i+l]}}},function(t,i,o){"use strict";var a=o(35),u=o(1),c=o(176),h=o(286);function EDEState(t,i){a.equal(i.length,24,"Invalid key length");var o=i.slice(0,8),u=i.slice(8,16),c=i.slice(16,24);this.ciphers="encrypt"===t?[h.create({type:"encrypt",key:o}),h.create({type:"decrypt",key:u}),h.create({type:"encrypt",key:c})]:[h.create({type:"decrypt",key:c}),h.create({type:"encrypt",key:u}),h.create({type:"decrypt",key:o})]}function EDE(t){c.call(this,t);var i=new EDEState(this.type,this.options.key);this._edeState=i}u(EDE,c),t.exports=EDE,EDE.create=function create(t){return new EDE(t)},EDE.prototype._update=function _update(t,i,o,a){var u=this._edeState;u.ciphers[0]._update(t,i,o,a),u.ciphers[1]._update(o,a,o,a),u.ciphers[2]._update(o,a,o,a)},EDE.prototype._pad=h.prototype._pad,EDE.prototype._unpad=h.prototype._unpad},function(t,i,o){var a=o(178),u=o(290),c=o(4).Buffer,h=o(291),l=o(62),d=o(126),p=o(127);function Cipher(t,i,o){l.call(this),this._cache=new Splitter,this._cipher=new d.AES(i),this._prev=c.from(o),this._mode=t,this._autopadding=!0}o(1)(Cipher,l),Cipher.prototype._update=function(t){var i,o;this._cache.add(t);for(var a=[];i=this._cache.get();)o=this._mode.encrypt(this,i),a.push(o);return c.concat(a)};var m=c.alloc(16,16);function Splitter(){this.cache=c.allocUnsafe(0)}function createCipheriv(t,i,o){var l=a[t.toLowerCase()];if(!l)throw new TypeError("invalid suite type");if("string"==typeof i&&(i=c.from(i)),i.length!==l.key/8)throw new TypeError("invalid key length "+i.length);if("string"==typeof o&&(o=c.from(o)),"GCM"!==l.mode&&o.length!==l.iv)throw new TypeError("invalid iv length "+o.length);return"stream"===l.type?new h(l.module,i,o):"auth"===l.type?new u(l.module,i,o):new Cipher(l.module,i,o)}Cipher.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(m))throw this._cipher.scrub(),new Error("data not multiple of block length")},Cipher.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},Splitter.prototype.add=function(t){this.cache=c.concat([this.cache,t])},Splitter.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},Splitter.prototype.flush=function(){for(var t=16-this.cache.length,i=c.allocUnsafe(t),o=-1;++o<t;)i.writeUInt8(t,o);return c.concat([this.cache,i])},i.createCipheriv=createCipheriv,i.createCipher=function createCipher(t,i){var o=a[t.toLowerCase()];if(!o)throw new TypeError("invalid suite type");var u=p(i,!1,o.key,o.iv);return createCipheriv(t,u.key,u.iv)}},function(t,i){i.encrypt=function(t,i){return t._cipher.encryptBlock(i)},i.decrypt=function(t,i){return t._cipher.decryptBlock(i)}},function(t,i,o){var a=o(99);i.encrypt=function(t,i){var o=a(i,t._prev);return t._prev=t._cipher.encryptBlock(o),t._prev},i.decrypt=function(t,i){var o=t._prev;t._prev=i;var u=t._cipher.decryptBlock(i);return a(u,o)}},function(t,i,o){var a=o(4).Buffer,u=o(99);function encryptStart(t,i,o){var c=i.length,h=u(i,t._cache);return t._cache=t._cache.slice(c),t._prev=a.concat([t._prev,o?i:h]),h}i.encrypt=function(t,i,o){for(var u,c=a.allocUnsafe(0);i.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=a.allocUnsafe(0)),!(t._cache.length<=i.length)){c=a.concat([c,encryptStart(t,i,o)]);break}u=t._cache.length,c=a.concat([c,encryptStart(t,i.slice(0,u),o)]),i=i.slice(u)}return c}},function(t,i,o){var a=o(4).Buffer;function encryptByte(t,i,o){var u=t._cipher.encryptBlock(t._prev)[0]^i;return t._prev=a.concat([t._prev.slice(1),a.from([o?i:u])]),u}i.encrypt=function(t,i,o){for(var u=i.length,c=a.allocUnsafe(u),h=-1;++h<u;)c[h]=encryptByte(t,i[h],o);return c}},function(t,i,o){var a=o(4).Buffer;function encryptByte(t,i,o){for(var a,u,c=-1,h=0;++c<8;)a=i&1<<7-c?128:0,h+=(128&(u=t._cipher.encryptBlock(t._prev)[0]^a))>>c%8,t._prev=shiftIn(t._prev,o?a:u);return h}function shiftIn(t,i){var o=t.length,u=-1,c=a.allocUnsafe(t.length);for(t=a.concat([t,a.from([i])]);++u<o;)c[u]=t[u]<<1|t[u+1]>>7;return c}i.encrypt=function(t,i,o){for(var u=i.length,c=a.allocUnsafe(u),h=-1;++h<u;)c[h]=encryptByte(t,i[h],o);return c}},function(t,i,o){(function(t){var a=o(99);function getBlock(t){return t._prev=t._cipher.encryptBlock(t._prev),t._prev}i.encrypt=function(i,o){for(;i._cache.length<o.length;)i._cache=t.concat([i._cache,getBlock(i)]);var u=i._cache.slice(0,o.length);return i._cache=i._cache.slice(o.length),a(o,u)}}).call(this,o(10).Buffer)},function(t,i,o){var a=o(4).Buffer,u=a.alloc(16,0);function fromArray(t){var i=a.allocUnsafe(16);return i.writeUInt32BE(t[0]>>>0,0),i.writeUInt32BE(t[1]>>>0,4),i.writeUInt32BE(t[2]>>>0,8),i.writeUInt32BE(t[3]>>>0,12),i}function GHASH(t){this.h=t,this.state=a.alloc(16,0),this.cache=a.allocUnsafe(0)}GHASH.prototype.ghash=function(t){for(var i=-1;++i<t.length;)this.state[i]^=t[i];this._multiply()},GHASH.prototype._multiply=function(){for(var t,i,o=function toArray(t){return[t.readUInt32BE(0),t.readUInt32BE(4),t.readUInt32BE(8),t.readUInt32BE(12)]}(this.h),a=[0,0,0,0],u=-1;++u<128;){for(0!=(this.state[~~(u/8)]&1<<7-u%8)&&(a[0]^=o[0],a[1]^=o[1],a[2]^=o[2],a[3]^=o[3]),i=0!=(1&o[3]),t=3;t>0;t--)o[t]=o[t]>>>1|(1&o[t-1])<<31;o[0]=o[0]>>>1,i&&(o[0]=o[0]^225<<24)}this.state=fromArray(a)},GHASH.prototype.update=function(t){var i;for(this.cache=a.concat([this.cache,t]);this.cache.length>=16;)i=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(i)},GHASH.prototype.final=function(t,i){return this.cache.length&&this.ghash(a.concat([this.cache,u],16)),this.ghash(fromArray([0,t,0,i])),this.state},t.exports=GHASH},function(t,i,o){var a=o(290),u=o(4).Buffer,c=o(178),h=o(291),l=o(62),d=o(126),p=o(127);function Decipher(t,i,o){l.call(this),this._cache=new Splitter,this._last=void 0,this._cipher=new d.AES(i),this._prev=u.from(o),this._mode=t,this._autopadding=!0}function Splitter(){this.cache=u.allocUnsafe(0)}function createDecipheriv(t,i,o){var l=c[t.toLowerCase()];if(!l)throw new TypeError("invalid suite type");if("string"==typeof o&&(o=u.from(o)),"GCM"!==l.mode&&o.length!==l.iv)throw new TypeError("invalid iv length "+o.length);if("string"==typeof i&&(i=u.from(i)),i.length!==l.key/8)throw new TypeError("invalid key length "+i.length);return"stream"===l.type?new h(l.module,i,o,!0):"auth"===l.type?new a(l.module,i,o,!0):new Decipher(l.module,i,o)}o(1)(Decipher,l),Decipher.prototype._update=function(t){var i,o;this._cache.add(t);for(var a=[];i=this._cache.get(this._autopadding);)o=this._mode.decrypt(this,i),a.push(o);return u.concat(a)},Decipher.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return function unpad(t){var i=t[15];if(i<1||i>16)throw new Error("unable to decrypt data");var o=-1;for(;++o<i;)if(t[o+(16-i)]!==i)throw new Error("unable to decrypt data");if(16===i)return;return t.slice(0,16-i)}(this._mode.decrypt(this,t));if(t)throw new Error("data not multiple of block length")},Decipher.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},Splitter.prototype.add=function(t){this.cache=u.concat([this.cache,t])},Splitter.prototype.get=function(t){var i;if(t){if(this.cache.length>16)return i=this.cache.slice(0,16),this.cache=this.cache.slice(16),i}else if(this.cache.length>=16)return i=this.cache.slice(0,16),this.cache=this.cache.slice(16),i;return null},Splitter.prototype.flush=function(){if(this.cache.length)return this.cache},i.createDecipher=function createDecipher(t,i){var o=c[t.toLowerCase()];if(!o)throw new TypeError("invalid suite type");var a=p(i,!1,o.key,o.iv);return createDecipheriv(t,a.key,a.iv)},i.createDecipheriv=createDecipheriv},function(t,i){i["des-ecb"]={key:8,iv:0},i["des-cbc"]=i.des={key:8,iv:8},i["des-ede3-cbc"]=i.des3={key:24,iv:8},i["des-ede3"]={key:24,iv:0},i["des-ede-cbc"]={key:16,iv:8},i["des-ede"]={key:16,iv:0}},function(t,i,o){(function(t){var a=o(292),u=o(714),c=o(715);var h={binary:!0,hex:!0,base64:!0};i.DiffieHellmanGroup=i.createDiffieHellmanGroup=i.getDiffieHellman=function getDiffieHellman(i){var o=new t(u[i].prime,"hex"),a=new t(u[i].gen,"hex");return new c(o,a)},i.createDiffieHellman=i.DiffieHellman=function createDiffieHellman(i,o,u,l){return t.isBuffer(o)||void 0===h[o]?createDiffieHellman(i,"binary",o,u):(o=o||"binary",l=l||"binary",u=u||new t([2]),t.isBuffer(u)||(u=new t(u,l)),"number"==typeof i?new c(a(i,u),u,!0):(t.isBuffer(i)||(i=new t(i,o)),new c(i,u,!0)))}}).call(this,o(10).Buffer)},function(t,i){},function(t,i,o){(function(t){!function(t,i){"use strict";function assert(t,i){if(!t)throw new Error(i||"Assertion failed")}function inherits(t,i){t.super_=i;var TempCtor=function(){};TempCtor.prototype=i.prototype,t.prototype=new TempCtor,t.prototype.constructor=t}function BN(t,i,o){if(BN.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(o=i,i=10),this._init(t||0,i||10,o||"be"))}var a;"object"==typeof t?t.exports=BN:i.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:o(712).Buffer}catch(t){}function parseHex4Bits(t,i){var o=t.charCodeAt(i);return o>=65&&o<=70?o-55:o>=97&&o<=102?o-87:o-48&15}function parseHexByte(t,i,o){var a=parseHex4Bits(t,o);return o-1>=i&&(a|=parseHex4Bits(t,o-1)<<4),a}function parseBase(t,i,o,a){for(var u=0,c=Math.min(t.length,o),h=i;h<c;h++){var l=t.charCodeAt(h)-48;u*=a,u+=l>=49?l-49+10:l>=17?l-17+10:l}return u}BN.isBN=function isBN(t){return t instanceof BN||null!==t&&"object"==typeof t&&t.constructor.wordSize===BN.wordSize&&Array.isArray(t.words)},BN.max=function max(t,i){return t.cmp(i)>0?t:i},BN.min=function min(t,i){return t.cmp(i)<0?t:i},BN.prototype._init=function init(t,i,o){if("number"==typeof t)return this._initNumber(t,i,o);if("object"==typeof t)return this._initArray(t,i,o);"hex"===i&&(i=16),assert(i===(0|i)&&i>=2&&i<=36);var a=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a<t.length&&(16===i?this._parseHex(t,a,o):(this._parseBase(t,i,a),"le"===o&&this._initArray(this.toArray(),i,o)))},BN.prototype._initNumber=function _initNumber(t,i,o){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(assert(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),i,o)},BN.prototype._initArray=function _initArray(t,i,o){if(assert("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var a=0;a<this.length;a++)this.words[a]=0;var u,c,h=0;if("be"===o)for(a=t.length-1,u=0;a>=0;a-=3)c=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[u]|=c<<h&67108863,this.words[u+1]=c>>>26-h&67108863,(h+=24)>=26&&(h-=26,u++);else if("le"===o)for(a=0,u=0;a<t.length;a+=3)c=t[a]|t[a+1]<<8|t[a+2]<<16,this.words[u]|=c<<h&67108863,this.words[u+1]=c>>>26-h&67108863,(h+=24)>=26&&(h-=26,u++);return this.strip()},BN.prototype._parseHex=function _parseHex(t,i,o){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var a=0;a<this.length;a++)this.words[a]=0;var u,c=0,h=0;if("be"===o)for(a=t.length-1;a>=i;a-=2)u=parseHexByte(t,i,a)<<c,this.words[h]|=67108863&u,c>=18?(c-=18,h+=1,this.words[h]|=u>>>26):c+=8;else for(a=(t.length-i)%2==0?i+1:i;a<t.length;a+=2)u=parseHexByte(t,i,a)<<c,this.words[h]|=67108863&u,c>=18?(c-=18,h+=1,this.words[h]|=u>>>26):c+=8;this.strip()},BN.prototype._parseBase=function _parseBase(t,i,o){this.words=[0],this.length=1;for(var a=0,u=1;u<=67108863;u*=i)a++;a--,u=u/i|0;for(var c=t.length-o,h=c%a,l=Math.min(c,c-h)+o,d=0,p=o;p<l;p+=a)d=parseBase(t,p,p+a,i),this.imuln(u),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d);if(0!==h){var m=1;for(d=parseBase(t,p,t.length,i),p=0;p<h;p++)m*=i;this.imuln(m),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d)}this.strip()},BN.prototype.copy=function copy(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},BN.prototype.clone=function clone(){var t=new BN(null);return this.copy(t),t},BN.prototype._expand=function _expand(t){for(;this.length<t;)this.words[this.length++]=0;return this},BN.prototype.strip=function strip(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(t,i,o){o.negative=i.negative^t.negative;var a=t.length+i.length|0;o.length=a,a=a-1|0;var u=0|t.words[0],c=0|i.words[0],h=u*c,l=67108863&h,d=h/67108864|0;o.words[0]=l;for(var p=1;p<a;p++){for(var m=d>>>26,g=67108863&d,v=Math.min(p,i.length-1),b=Math.max(0,p-t.length+1);b<=v;b++){var w=p-b|0;m+=(h=(u=0|t.words[w])*(c=0|i.words[b])+g)/67108864|0,g=67108863&h}o.words[p]=0|g,d=0|m}return 0!==d?o.words[p]=0|d:o.length--,o.strip()}BN.prototype.toString=function toString(t,i){var o;if(i=0|i||1,16===(t=t||10)||"hex"===t){o="";for(var a=0,l=0,d=0;d<this.length;d++){var p=this.words[d],m=(16777215&(p<<a|l)).toString(16);o=0!==(l=p>>>24-a&16777215)||d!==this.length-1?u[6-m.length]+m+o:m+o,(a+=2)>=26&&(a-=26,d--)}for(0!==l&&(o=l.toString(16)+o);o.length%i!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(t===(0|t)&&t>=2&&t<=36){var g=c[t],v=h[t];o="";var b=this.clone();for(b.negative=0;!b.isZero();){var w=b.modn(v).toString(t);o=(b=b.idivn(v)).isZero()?w+o:u[g-w.length]+w+o}for(this.isZero()&&(o="0"+o);o.length%i!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(t,i){return assert(void 0!==a),this.toArrayLike(a,t,i)},BN.prototype.toArray=function toArray(t,i){return this.toArrayLike(Array,t,i)},BN.prototype.toArrayLike=function toArrayLike(t,i,o){var a=this.byteLength(),u=o||Math.max(1,a);assert(a<=u,"byte array longer than desired length"),assert(u>0,"Requested array length <= 0"),this.strip();var c,h,l="le"===i,d=new t(u),p=this.clone();if(l){for(h=0;!p.isZero();h++)c=p.andln(255),p.iushrn(8),d[h]=c;for(;h<u;h++)d[h]=0}else{for(h=0;h<u-a;h++)d[h]=0;for(h=0;!p.isZero();h++)c=p.andln(255),p.iushrn(8),d[u-h-1]=c}return d},Math.clz32?BN.prototype._countBits=function _countBits(t){return 32-Math.clz32(t)}:BN.prototype._countBits=function _countBits(t){var i=t,o=0;return i>=4096&&(o+=13,i>>>=13),i>=64&&(o+=7,i>>>=7),i>=8&&(o+=4,i>>>=4),i>=2&&(o+=2,i>>>=2),o+i},BN.prototype._zeroBits=function _zeroBits(t){if(0===t)return 26;var i=t,o=0;return 0==(8191&i)&&(o+=13,i>>>=13),0==(127&i)&&(o+=7,i>>>=7),0==(15&i)&&(o+=4,i>>>=4),0==(3&i)&&(o+=2,i>>>=2),0==(1&i)&&o++,o},BN.prototype.bitLength=function bitLength(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var o=this._zeroBits(this.words[i]);if(t+=o,26!==o)break}return t},BN.prototype.byteLength=function byteLength(){return Math.ceil(this.bitLength()/8)},BN.prototype.toTwos=function toTwos(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},BN.prototype.fromTwos=function fromTwos(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},BN.prototype.isNeg=function isNeg(){return 0!==this.negative},BN.prototype.neg=function neg(){return this.clone().ineg()},BN.prototype.ineg=function ineg(){return this.isZero()||(this.negative^=1),this},BN.prototype.iuor=function iuor(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this.strip()},BN.prototype.ior=function ior(t){return assert(0==(this.negative|t.negative)),this.iuor(t)},BN.prototype.or=function or(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},BN.prototype.uor=function uor(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},BN.prototype.iuand=function iuand(t){var i;i=this.length>t.length?t:this;for(var o=0;o<i.length;o++)this.words[o]=this.words[o]&t.words[o];return this.length=i.length,this.strip()},BN.prototype.iand=function iand(t){return assert(0==(this.negative|t.negative)),this.iuand(t)},BN.prototype.and=function and(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},BN.prototype.uand=function uand(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},BN.prototype.iuxor=function iuxor(t){var i,o;this.length>t.length?(i=this,o=t):(i=t,o=this);for(var a=0;a<o.length;a++)this.words[a]=i.words[a]^o.words[a];if(this!==i)for(;a<i.length;a++)this.words[a]=i.words[a];return this.length=i.length,this.strip()},BN.prototype.ixor=function ixor(t){return assert(0==(this.negative|t.negative)),this.iuxor(t)},BN.prototype.xor=function xor(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},BN.prototype.uxor=function uxor(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},BN.prototype.inotn=function inotn(t){assert("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),o=t%26;this._expand(i),o>0&&i--;for(var a=0;a<i;a++)this.words[a]=67108863&~this.words[a];return o>0&&(this.words[a]=~this.words[a]&67108863>>26-o),this.strip()},BN.prototype.notn=function notn(t){return this.clone().inotn(t)},BN.prototype.setn=function setn(t,i){assert("number"==typeof t&&t>=0);var o=t/26|0,a=t%26;return this._expand(o+1),this.words[o]=i?this.words[o]|1<<a:this.words[o]&~(1<<a),this.strip()},BN.prototype.iadd=function iadd(t){var i,o,a;if(0!==this.negative&&0===t.negative)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();this.length>t.length?(o=this,a=t):(o=t,a=this);for(var u=0,c=0;c<a.length;c++)i=(0|o.words[c])+(0|a.words[c])+u,this.words[c]=67108863&i,u=i>>>26;for(;0!==u&&c<o.length;c++)i=(0|o.words[c])+u,this.words[c]=67108863&i,u=i>>>26;if(this.length=o.length,0!==u)this.words[this.length]=u,this.length++;else if(o!==this)for(;c<o.length;c++)this.words[c]=o.words[c];return this},BN.prototype.add=function add(t){var i;return 0!==t.negative&&0===this.negative?(t.negative=0,i=this.sub(t),t.negative^=1,i):0===t.negative&&0!==this.negative?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},BN.prototype.isub=function isub(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var o,a,u=this.cmp(t);if(0===u)return this.negative=0,this.length=1,this.words[0]=0,this;u>0?(o=this,a=t):(o=t,a=this);for(var c=0,h=0;h<a.length;h++)c=(i=(0|o.words[h])-(0|a.words[h])+c)>>26,this.words[h]=67108863&i;for(;0!==c&&h<o.length;h++)c=(i=(0|o.words[h])+c)>>26,this.words[h]=67108863&i;if(0===c&&h<o.length&&o!==this)for(;h<o.length;h++)this.words[h]=o.words[h];return this.length=Math.max(this.length,h),o!==this&&(this.negative=1),this.strip()},BN.prototype.sub=function sub(t){return this.clone().isub(t)};var l=function comb10MulTo(t,i,o){var a,u,c,h=t.words,l=i.words,d=o.words,p=0,m=0|h[0],g=8191&m,v=m>>>13,b=0|h[1],w=8191&b,_=b>>>13,M=0|h[2],k=8191&M,B=M>>>13,P=0|h[3],x=8191&P,I=P>>>13,N=0|h[4],A=8191&N,C=N>>>13,O=0|h[5],j=8191&O,L=O>>>13,q=0|h[6],U=8191&q,z=q>>>13,H=0|h[7],W=8191&H,V=H>>>13,G=0|h[8],J=8191&G,$=G>>>13,Z=0|h[9],Y=8191&Z,X=Z>>>13,Q=0|l[0],ee=8191&Q,te=Q>>>13,re=0|l[1],ne=8191&re,ie=re>>>13,oe=0|l[2],se=8191&oe,ae=oe>>>13,ue=0|l[3],ce=8191&ue,he=ue>>>13,le=0|l[4],fe=8191&le,de=le>>>13,pe=0|l[5],me=8191&pe,ge=pe>>>13,ve=0|l[6],ye=8191&ve,be=ve>>>13,we=0|l[7],_e=8191&we,Me=we>>>13,Se=0|l[8],ke=8191&Se,Ee=Se>>>13,Be=0|l[9],Pe=8191&Be,xe=Be>>>13;o.negative=t.negative^i.negative,o.length=19;var Te=(p+(a=Math.imul(g,ee))|0)+((8191&(u=(u=Math.imul(g,te))+Math.imul(v,ee)|0))<<13)|0;p=((c=Math.imul(v,te))+(u>>>13)|0)+(Te>>>26)|0,Te&=67108863,a=Math.imul(w,ee),u=(u=Math.imul(w,te))+Math.imul(_,ee)|0,c=Math.imul(_,te);var Ie=(p+(a=a+Math.imul(g,ne)|0)|0)+((8191&(u=(u=u+Math.imul(g,ie)|0)+Math.imul(v,ne)|0))<<13)|0;p=((c=c+Math.imul(v,ie)|0)+(u>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,a=Math.imul(k,ee),u=(u=Math.imul(k,te))+Math.imul(B,ee)|0,c=Math.imul(B,te),a=a+Math.imul(w,ne)|0,u=(u=u+Math.imul(w,ie)|0)+Math.imul(_,ne)|0,c=c+Math.imul(_,ie)|0;var Ne=(p+(a=a+Math.imul(g,se)|0)|0)+((8191&(u=(u=u+Math.imul(g,ae)|0)+Math.imul(v,se)|0))<<13)|0;p=((c=c+Math.imul(v,ae)|0)+(u>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,a=Math.imul(x,ee),u=(u=Math.imul(x,te))+Math.imul(I,ee)|0,c=Math.imul(I,te),a=a+Math.imul(k,ne)|0,u=(u=u+Math.imul(k,ie)|0)+Math.imul(B,ne)|0,c=c+Math.imul(B,ie)|0,a=a+Math.imul(w,se)|0,u=(u=u+Math.imul(w,ae)|0)+Math.imul(_,se)|0,c=c+Math.imul(_,ae)|0;var Ae=(p+(a=a+Math.imul(g,ce)|0)|0)+((8191&(u=(u=u+Math.imul(g,he)|0)+Math.imul(v,ce)|0))<<13)|0;p=((c=c+Math.imul(v,he)|0)+(u>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,a=Math.imul(A,ee),u=(u=Math.imul(A,te))+Math.imul(C,ee)|0,c=Math.imul(C,te),a=a+Math.imul(x,ne)|0,u=(u=u+Math.imul(x,ie)|0)+Math.imul(I,ne)|0,c=c+Math.imul(I,ie)|0,a=a+Math.imul(k,se)|0,u=(u=u+Math.imul(k,ae)|0)+Math.imul(B,se)|0,c=c+Math.imul(B,ae)|0,a=a+Math.imul(w,ce)|0,u=(u=u+Math.imul(w,he)|0)+Math.imul(_,ce)|0,c=c+Math.imul(_,he)|0;var Re=(p+(a=a+Math.imul(g,fe)|0)|0)+((8191&(u=(u=u+Math.imul(g,de)|0)+Math.imul(v,fe)|0))<<13)|0;p=((c=c+Math.imul(v,de)|0)+(u>>>13)|0)+(Re>>>26)|0,Re&=67108863,a=Math.imul(j,ee),u=(u=Math.imul(j,te))+Math.imul(L,ee)|0,c=Math.imul(L,te),a=a+Math.imul(A,ne)|0,u=(u=u+Math.imul(A,ie)|0)+Math.imul(C,ne)|0,c=c+Math.imul(C,ie)|0,a=a+Math.imul(x,se)|0,u=(u=u+Math.imul(x,ae)|0)+Math.imul(I,se)|0,c=c+Math.imul(I,ae)|0,a=a+Math.imul(k,ce)|0,u=(u=u+Math.imul(k,he)|0)+Math.imul(B,ce)|0,c=c+Math.imul(B,he)|0,a=a+Math.imul(w,fe)|0,u=(u=u+Math.imul(w,de)|0)+Math.imul(_,fe)|0,c=c+Math.imul(_,de)|0;var Ce=(p+(a=a+Math.imul(g,me)|0)|0)+((8191&(u=(u=u+Math.imul(g,ge)|0)+Math.imul(v,me)|0))<<13)|0;p=((c=c+Math.imul(v,ge)|0)+(u>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,a=Math.imul(U,ee),u=(u=Math.imul(U,te))+Math.imul(z,ee)|0,c=Math.imul(z,te),a=a+Math.imul(j,ne)|0,u=(u=u+Math.imul(j,ie)|0)+Math.imul(L,ne)|0,c=c+Math.imul(L,ie)|0,a=a+Math.imul(A,se)|0,u=(u=u+Math.imul(A,ae)|0)+Math.imul(C,se)|0,c=c+Math.imul(C,ae)|0,a=a+Math.imul(x,ce)|0,u=(u=u+Math.imul(x,he)|0)+Math.imul(I,ce)|0,c=c+Math.imul(I,he)|0,a=a+Math.imul(k,fe)|0,u=(u=u+Math.imul(k,de)|0)+Math.imul(B,fe)|0,c=c+Math.imul(B,de)|0,a=a+Math.imul(w,me)|0,u=(u=u+Math.imul(w,ge)|0)+Math.imul(_,me)|0,c=c+Math.imul(_,ge)|0;var Oe=(p+(a=a+Math.imul(g,ye)|0)|0)+((8191&(u=(u=u+Math.imul(g,be)|0)+Math.imul(v,ye)|0))<<13)|0;p=((c=c+Math.imul(v,be)|0)+(u>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,a=Math.imul(W,ee),u=(u=Math.imul(W,te))+Math.imul(V,ee)|0,c=Math.imul(V,te),a=a+Math.imul(U,ne)|0,u=(u=u+Math.imul(U,ie)|0)+Math.imul(z,ne)|0,c=c+Math.imul(z,ie)|0,a=a+Math.imul(j,se)|0,u=(u=u+Math.imul(j,ae)|0)+Math.imul(L,se)|0,c=c+Math.imul(L,ae)|0,a=a+Math.imul(A,ce)|0,u=(u=u+Math.imul(A,he)|0)+Math.imul(C,ce)|0,c=c+Math.imul(C,he)|0,a=a+Math.imul(x,fe)|0,u=(u=u+Math.imul(x,de)|0)+Math.imul(I,fe)|0,c=c+Math.imul(I,de)|0,a=a+Math.imul(k,me)|0,u=(u=u+Math.imul(k,ge)|0)+Math.imul(B,me)|0,c=c+Math.imul(B,ge)|0,a=a+Math.imul(w,ye)|0,u=(u=u+Math.imul(w,be)|0)+Math.imul(_,ye)|0,c=c+Math.imul(_,be)|0;var De=(p+(a=a+Math.imul(g,_e)|0)|0)+((8191&(u=(u=u+Math.imul(g,Me)|0)+Math.imul(v,_e)|0))<<13)|0;p=((c=c+Math.imul(v,Me)|0)+(u>>>13)|0)+(De>>>26)|0,De&=67108863,a=Math.imul(J,ee),u=(u=Math.imul(J,te))+Math.imul($,ee)|0,c=Math.imul($,te),a=a+Math.imul(W,ne)|0,u=(u=u+Math.imul(W,ie)|0)+Math.imul(V,ne)|0,c=c+Math.imul(V,ie)|0,a=a+Math.imul(U,se)|0,u=(u=u+Math.imul(U,ae)|0)+Math.imul(z,se)|0,c=c+Math.imul(z,ae)|0,a=a+Math.imul(j,ce)|0,u=(u=u+Math.imul(j,he)|0)+Math.imul(L,ce)|0,c=c+Math.imul(L,he)|0,a=a+Math.imul(A,fe)|0,u=(u=u+Math.imul(A,de)|0)+Math.imul(C,fe)|0,c=c+Math.imul(C,de)|0,a=a+Math.imul(x,me)|0,u=(u=u+Math.imul(x,ge)|0)+Math.imul(I,me)|0,c=c+Math.imul(I,ge)|0,a=a+Math.imul(k,ye)|0,u=(u=u+Math.imul(k,be)|0)+Math.imul(B,ye)|0,c=c+Math.imul(B,be)|0,a=a+Math.imul(w,_e)|0,u=(u=u+Math.imul(w,Me)|0)+Math.imul(_,_e)|0,c=c+Math.imul(_,Me)|0;var je=(p+(a=a+Math.imul(g,ke)|0)|0)+((8191&(u=(u=u+Math.imul(g,Ee)|0)+Math.imul(v,ke)|0))<<13)|0;p=((c=c+Math.imul(v,Ee)|0)+(u>>>13)|0)+(je>>>26)|0,je&=67108863,a=Math.imul(Y,ee),u=(u=Math.imul(Y,te))+Math.imul(X,ee)|0,c=Math.imul(X,te),a=a+Math.imul(J,ne)|0,u=(u=u+Math.imul(J,ie)|0)+Math.imul($,ne)|0,c=c+Math.imul($,ie)|0,a=a+Math.imul(W,se)|0,u=(u=u+Math.imul(W,ae)|0)+Math.imul(V,se)|0,c=c+Math.imul(V,ae)|0,a=a+Math.imul(U,ce)|0,u=(u=u+Math.imul(U,he)|0)+Math.imul(z,ce)|0,c=c+Math.imul(z,he)|0,a=a+Math.imul(j,fe)|0,u=(u=u+Math.imul(j,de)|0)+Math.imul(L,fe)|0,c=c+Math.imul(L,de)|0,a=a+Math.imul(A,me)|0,u=(u=u+Math.imul(A,ge)|0)+Math.imul(C,me)|0,c=c+Math.imul(C,ge)|0,a=a+Math.imul(x,ye)|0,u=(u=u+Math.imul(x,be)|0)+Math.imul(I,ye)|0,c=c+Math.imul(I,be)|0,a=a+Math.imul(k,_e)|0,u=(u=u+Math.imul(k,Me)|0)+Math.imul(B,_e)|0,c=c+Math.imul(B,Me)|0,a=a+Math.imul(w,ke)|0,u=(u=u+Math.imul(w,Ee)|0)+Math.imul(_,ke)|0,c=c+Math.imul(_,Ee)|0;var Le=(p+(a=a+Math.imul(g,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(g,xe)|0)+Math.imul(v,Pe)|0))<<13)|0;p=((c=c+Math.imul(v,xe)|0)+(u>>>13)|0)+(Le>>>26)|0,Le&=67108863,a=Math.imul(Y,ne),u=(u=Math.imul(Y,ie))+Math.imul(X,ne)|0,c=Math.imul(X,ie),a=a+Math.imul(J,se)|0,u=(u=u+Math.imul(J,ae)|0)+Math.imul($,se)|0,c=c+Math.imul($,ae)|0,a=a+Math.imul(W,ce)|0,u=(u=u+Math.imul(W,he)|0)+Math.imul(V,ce)|0,c=c+Math.imul(V,he)|0,a=a+Math.imul(U,fe)|0,u=(u=u+Math.imul(U,de)|0)+Math.imul(z,fe)|0,c=c+Math.imul(z,de)|0,a=a+Math.imul(j,me)|0,u=(u=u+Math.imul(j,ge)|0)+Math.imul(L,me)|0,c=c+Math.imul(L,ge)|0,a=a+Math.imul(A,ye)|0,u=(u=u+Math.imul(A,be)|0)+Math.imul(C,ye)|0,c=c+Math.imul(C,be)|0,a=a+Math.imul(x,_e)|0,u=(u=u+Math.imul(x,Me)|0)+Math.imul(I,_e)|0,c=c+Math.imul(I,Me)|0,a=a+Math.imul(k,ke)|0,u=(u=u+Math.imul(k,Ee)|0)+Math.imul(B,ke)|0,c=c+Math.imul(B,Ee)|0;var Fe=(p+(a=a+Math.imul(w,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(w,xe)|0)+Math.imul(_,Pe)|0))<<13)|0;p=((c=c+Math.imul(_,xe)|0)+(u>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,a=Math.imul(Y,se),u=(u=Math.imul(Y,ae))+Math.imul(X,se)|0,c=Math.imul(X,ae),a=a+Math.imul(J,ce)|0,u=(u=u+Math.imul(J,he)|0)+Math.imul($,ce)|0,c=c+Math.imul($,he)|0,a=a+Math.imul(W,fe)|0,u=(u=u+Math.imul(W,de)|0)+Math.imul(V,fe)|0,c=c+Math.imul(V,de)|0,a=a+Math.imul(U,me)|0,u=(u=u+Math.imul(U,ge)|0)+Math.imul(z,me)|0,c=c+Math.imul(z,ge)|0,a=a+Math.imul(j,ye)|0,u=(u=u+Math.imul(j,be)|0)+Math.imul(L,ye)|0,c=c+Math.imul(L,be)|0,a=a+Math.imul(A,_e)|0,u=(u=u+Math.imul(A,Me)|0)+Math.imul(C,_e)|0,c=c+Math.imul(C,Me)|0,a=a+Math.imul(x,ke)|0,u=(u=u+Math.imul(x,Ee)|0)+Math.imul(I,ke)|0,c=c+Math.imul(I,Ee)|0;var qe=(p+(a=a+Math.imul(k,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(k,xe)|0)+Math.imul(B,Pe)|0))<<13)|0;p=((c=c+Math.imul(B,xe)|0)+(u>>>13)|0)+(qe>>>26)|0,qe&=67108863,a=Math.imul(Y,ce),u=(u=Math.imul(Y,he))+Math.imul(X,ce)|0,c=Math.imul(X,he),a=a+Math.imul(J,fe)|0,u=(u=u+Math.imul(J,de)|0)+Math.imul($,fe)|0,c=c+Math.imul($,de)|0,a=a+Math.imul(W,me)|0,u=(u=u+Math.imul(W,ge)|0)+Math.imul(V,me)|0,c=c+Math.imul(V,ge)|0,a=a+Math.imul(U,ye)|0,u=(u=u+Math.imul(U,be)|0)+Math.imul(z,ye)|0,c=c+Math.imul(z,be)|0,a=a+Math.imul(j,_e)|0,u=(u=u+Math.imul(j,Me)|0)+Math.imul(L,_e)|0,c=c+Math.imul(L,Me)|0,a=a+Math.imul(A,ke)|0,u=(u=u+Math.imul(A,Ee)|0)+Math.imul(C,ke)|0,c=c+Math.imul(C,Ee)|0;var Ue=(p+(a=a+Math.imul(x,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(x,xe)|0)+Math.imul(I,Pe)|0))<<13)|0;p=((c=c+Math.imul(I,xe)|0)+(u>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,a=Math.imul(Y,fe),u=(u=Math.imul(Y,de))+Math.imul(X,fe)|0,c=Math.imul(X,de),a=a+Math.imul(J,me)|0,u=(u=u+Math.imul(J,ge)|0)+Math.imul($,me)|0,c=c+Math.imul($,ge)|0,a=a+Math.imul(W,ye)|0,u=(u=u+Math.imul(W,be)|0)+Math.imul(V,ye)|0,c=c+Math.imul(V,be)|0,a=a+Math.imul(U,_e)|0,u=(u=u+Math.imul(U,Me)|0)+Math.imul(z,_e)|0,c=c+Math.imul(z,Me)|0,a=a+Math.imul(j,ke)|0,u=(u=u+Math.imul(j,Ee)|0)+Math.imul(L,ke)|0,c=c+Math.imul(L,Ee)|0;var ze=(p+(a=a+Math.imul(A,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(A,xe)|0)+Math.imul(C,Pe)|0))<<13)|0;p=((c=c+Math.imul(C,xe)|0)+(u>>>13)|0)+(ze>>>26)|0,ze&=67108863,a=Math.imul(Y,me),u=(u=Math.imul(Y,ge))+Math.imul(X,me)|0,c=Math.imul(X,ge),a=a+Math.imul(J,ye)|0,u=(u=u+Math.imul(J,be)|0)+Math.imul($,ye)|0,c=c+Math.imul($,be)|0,a=a+Math.imul(W,_e)|0,u=(u=u+Math.imul(W,Me)|0)+Math.imul(V,_e)|0,c=c+Math.imul(V,Me)|0,a=a+Math.imul(U,ke)|0,u=(u=u+Math.imul(U,Ee)|0)+Math.imul(z,ke)|0,c=c+Math.imul(z,Ee)|0;var He=(p+(a=a+Math.imul(j,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(j,xe)|0)+Math.imul(L,Pe)|0))<<13)|0;p=((c=c+Math.imul(L,xe)|0)+(u>>>13)|0)+(He>>>26)|0,He&=67108863,a=Math.imul(Y,ye),u=(u=Math.imul(Y,be))+Math.imul(X,ye)|0,c=Math.imul(X,be),a=a+Math.imul(J,_e)|0,u=(u=u+Math.imul(J,Me)|0)+Math.imul($,_e)|0,c=c+Math.imul($,Me)|0,a=a+Math.imul(W,ke)|0,u=(u=u+Math.imul(W,Ee)|0)+Math.imul(V,ke)|0,c=c+Math.imul(V,Ee)|0;var We=(p+(a=a+Math.imul(U,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(U,xe)|0)+Math.imul(z,Pe)|0))<<13)|0;p=((c=c+Math.imul(z,xe)|0)+(u>>>13)|0)+(We>>>26)|0,We&=67108863,a=Math.imul(Y,_e),u=(u=Math.imul(Y,Me))+Math.imul(X,_e)|0,c=Math.imul(X,Me),a=a+Math.imul(J,ke)|0,u=(u=u+Math.imul(J,Ee)|0)+Math.imul($,ke)|0,c=c+Math.imul($,Ee)|0;var Ke=(p+(a=a+Math.imul(W,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(W,xe)|0)+Math.imul(V,Pe)|0))<<13)|0;p=((c=c+Math.imul(V,xe)|0)+(u>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,a=Math.imul(Y,ke),u=(u=Math.imul(Y,Ee))+Math.imul(X,ke)|0,c=Math.imul(X,Ee);var Ve=(p+(a=a+Math.imul(J,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(J,xe)|0)+Math.imul($,Pe)|0))<<13)|0;p=((c=c+Math.imul($,xe)|0)+(u>>>13)|0)+(Ve>>>26)|0,Ve&=67108863;var Ge=(p+(a=Math.imul(Y,Pe))|0)+((8191&(u=(u=Math.imul(Y,xe))+Math.imul(X,Pe)|0))<<13)|0;return p=((c=Math.imul(X,xe))+(u>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,d[0]=Te,d[1]=Ie,d[2]=Ne,d[3]=Ae,d[4]=Re,d[5]=Ce,d[6]=Oe,d[7]=De,d[8]=je,d[9]=Le,d[10]=Fe,d[11]=qe,d[12]=Ue,d[13]=ze,d[14]=He,d[15]=We,d[16]=Ke,d[17]=Ve,d[18]=Ge,0!==p&&(d[19]=p,o.length++),o};function jumboMulTo(t,i,o){return(new FFTM).mulp(t,i,o)}function FFTM(t,i){this.x=t,this.y=i}Math.imul||(l=smallMulTo),BN.prototype.mulTo=function mulTo(t,i){var o=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,i):o<63?smallMulTo(this,t,i):o<1024?function bigMulTo(t,i,o){o.negative=i.negative^t.negative,o.length=t.length+i.length;for(var a=0,u=0,c=0;c<o.length-1;c++){var h=u;u=0;for(var l=67108863&a,d=Math.min(c,i.length-1),p=Math.max(0,c-t.length+1);p<=d;p++){var m=c-p,g=(0|t.words[m])*(0|i.words[p]),v=67108863&g;l=67108863&(v=v+l|0),u+=(h=(h=h+(g/67108864|0)|0)+(v>>>26)|0)>>>26,h&=67108863}o.words[c]=l,a=h,h=u}return 0!==a?o.words[c]=a:o.length--,o.strip()}(this,t,i):jumboMulTo(this,t,i)},FFTM.prototype.makeRBT=function makeRBT(t){for(var i=new Array(t),o=BN.prototype._countBits(t)-1,a=0;a<t;a++)i[a]=this.revBin(a,o,t);return i},FFTM.prototype.revBin=function revBin(t,i,o){if(0===t||t===o-1)return t;for(var a=0,u=0;u<i;u++)a|=(1&t)<<i-u-1,t>>=1;return a},FFTM.prototype.permute=function permute(t,i,o,a,u,c){for(var h=0;h<c;h++)a[h]=i[t[h]],u[h]=o[t[h]]},FFTM.prototype.transform=function transform(t,i,o,a,u,c){this.permute(c,t,i,o,a,u);for(var h=1;h<u;h<<=1)for(var l=h<<1,d=Math.cos(2*Math.PI/l),p=Math.sin(2*Math.PI/l),m=0;m<u;m+=l)for(var g=d,v=p,b=0;b<h;b++){var w=o[m+b],_=a[m+b],M=o[m+b+h],k=a[m+b+h],B=g*M-v*k;k=g*k+v*M,M=B,o[m+b]=w+M,a[m+b]=_+k,o[m+b+h]=w-M,a[m+b+h]=_-k,b!==l&&(B=d*g-p*v,v=d*v+p*g,g=B)}},FFTM.prototype.guessLen13b=function guessLen13b(t,i){var o=1|Math.max(i,t),a=1&o,u=0;for(o=o/2|0;o;o>>>=1)u++;return 1<<u+1+a},FFTM.prototype.conjugate=function conjugate(t,i,o){if(!(o<=1))for(var a=0;a<o/2;a++){var u=t[a];t[a]=t[o-a-1],t[o-a-1]=u,u=i[a],i[a]=-i[o-a-1],i[o-a-1]=-u}},FFTM.prototype.normalize13b=function normalize13b(t,i){for(var o=0,a=0;a<i/2;a++){var u=8192*Math.round(t[2*a+1]/i)+Math.round(t[2*a]/i)+o;t[a]=67108863&u,o=u<67108864?0:u/67108864|0}return t},FFTM.prototype.convert13b=function convert13b(t,i,o,a){for(var u=0,c=0;c<i;c++)u+=0|t[c],o[2*c]=8191&u,u>>>=13,o[2*c+1]=8191&u,u>>>=13;for(c=2*i;c<a;++c)o[c]=0;assert(0===u),assert(0==(-8192&u))},FFTM.prototype.stub=function stub(t){for(var i=new Array(t),o=0;o<t;o++)i[o]=0;return i},FFTM.prototype.mulp=function mulp(t,i,o){var a=2*this.guessLen13b(t.length,i.length),u=this.makeRBT(a),c=this.stub(a),h=new Array(a),l=new Array(a),d=new Array(a),p=new Array(a),m=new Array(a),g=new Array(a),v=o.words;v.length=a,this.convert13b(t.words,t.length,h,a),this.convert13b(i.words,i.length,p,a),this.transform(h,c,l,d,a,u),this.transform(p,c,m,g,a,u);for(var b=0;b<a;b++){var w=l[b]*m[b]-d[b]*g[b];d[b]=l[b]*g[b]+d[b]*m[b],l[b]=w}return this.conjugate(l,d,a),this.transform(l,d,v,c,a,u),this.conjugate(v,c,a),this.normalize13b(v,a),o.negative=t.negative^i.negative,o.length=t.length+i.length,o.strip()},BN.prototype.mul=function mul(t){var i=new BN(null);return i.words=new Array(this.length+t.length),this.mulTo(t,i)},BN.prototype.mulf=function mulf(t){var i=new BN(null);return i.words=new Array(this.length+t.length),jumboMulTo(this,t,i)},BN.prototype.imul=function imul(t){return this.clone().mulTo(t,this)},BN.prototype.imuln=function imuln(t){assert("number"==typeof t),assert(t<67108864);for(var i=0,o=0;o<this.length;o++){var a=(0|this.words[o])*t,u=(67108863&a)+(67108863&i);i>>=26,i+=a/67108864|0,i+=u>>>26,this.words[o]=67108863&u}return 0!==i&&(this.words[o]=i,this.length++),this},BN.prototype.muln=function muln(t){return this.clone().imuln(t)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(t){var i=function toBitArray(t){for(var i=new Array(t.bitLength()),o=0;o<i.length;o++){var a=o/26|0,u=o%26;i[o]=(t.words[a]&1<<u)>>>u}return i}(t);if(0===i.length)return new BN(1);for(var o=this,a=0;a<i.length&&0===i[a];a++,o=o.sqr());if(++a<i.length)for(var u=o.sqr();a<i.length;a++,u=u.sqr())0!==i[a]&&(o=o.mul(u));return o},BN.prototype.iushln=function iushln(t){assert("number"==typeof t&&t>=0);var i,o=t%26,a=(t-o)/26,u=67108863>>>26-o<<26-o;if(0!==o){var c=0;for(i=0;i<this.length;i++){var h=this.words[i]&u,l=(0|this.words[i])-h<<o;this.words[i]=l|c,c=h>>>26-o}c&&(this.words[i]=c,this.length++)}if(0!==a){for(i=this.length-1;i>=0;i--)this.words[i+a]=this.words[i];for(i=0;i<a;i++)this.words[i]=0;this.length+=a}return this.strip()},BN.prototype.ishln=function ishln(t){return assert(0===this.negative),this.iushln(t)},BN.prototype.iushrn=function iushrn(t,i,o){var a;assert("number"==typeof t&&t>=0),a=i?(i-i%26)/26:0;var u=t%26,c=Math.min((t-u)/26,this.length),h=67108863^67108863>>>u<<u,l=o;if(a-=c,a=Math.max(0,a),l){for(var d=0;d<c;d++)l.words[d]=this.words[d];l.length=c}if(0===c);else if(this.length>c)for(this.length-=c,d=0;d<this.length;d++)this.words[d]=this.words[d+c];else this.words[0]=0,this.length=1;var p=0;for(d=this.length-1;d>=0&&(0!==p||d>=a);d--){var m=0|this.words[d];this.words[d]=p<<26-u|m>>>u,p=m&h}return l&&0!==p&&(l.words[l.length++]=p),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(t,i,o){return assert(0===this.negative),this.iushrn(t,i,o)},BN.prototype.shln=function shln(t){return this.clone().ishln(t)},BN.prototype.ushln=function ushln(t){return this.clone().iushln(t)},BN.prototype.shrn=function shrn(t){return this.clone().ishrn(t)},BN.prototype.ushrn=function ushrn(t){return this.clone().iushrn(t)},BN.prototype.testn=function testn(t){assert("number"==typeof t&&t>=0);var i=t%26,o=(t-i)/26,a=1<<i;return!(this.length<=o)&&!!(this.words[o]&a)},BN.prototype.imaskn=function imaskn(t){assert("number"==typeof t&&t>=0);var i=t%26,o=(t-i)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==i&&o++,this.length=Math.min(o,this.length),0!==i){var a=67108863^67108863>>>i<<i;this.words[this.length-1]&=a}return this.strip()},BN.prototype.maskn=function maskn(t){return this.clone().imaskn(t)},BN.prototype.iaddn=function iaddn(t){return assert("number"==typeof t),assert(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},BN.prototype._iaddn=function _iaddn(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},BN.prototype.isubn=function isubn(t){if(assert("number"==typeof t),assert(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this.strip()},BN.prototype.addn=function addn(t){return this.clone().iaddn(t)},BN.prototype.subn=function subn(t){return this.clone().isubn(t)},BN.prototype.iabs=function iabs(){return this.negative=0,this},BN.prototype.abs=function abs(){return this.clone().iabs()},BN.prototype._ishlnsubmul=function _ishlnsubmul(t,i,o){var a,u,c=t.length+o;this._expand(c);var h=0;for(a=0;a<t.length;a++){u=(0|this.words[a+o])+h;var l=(0|t.words[a])*i;h=((u-=67108863&l)>>26)-(l/67108864|0),this.words[a+o]=67108863&u}for(;a<this.length-o;a++)h=(u=(0|this.words[a+o])+h)>>26,this.words[a+o]=67108863&u;if(0===h)return this.strip();for(assert(-1===h),h=0,a=0;a<this.length;a++)h=(u=-(0|this.words[a])+h)>>26,this.words[a]=67108863&u;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(t,i){var o=(this.length,t.length),a=this.clone(),u=t,c=0|u.words[u.length-1];0!==(o=26-this._countBits(c))&&(u=u.ushln(o),a.iushln(o),c=0|u.words[u.length-1]);var h,l=a.length-u.length;if("mod"!==i){(h=new BN(null)).length=l+1,h.words=new Array(h.length);for(var d=0;d<h.length;d++)h.words[d]=0}var p=a.clone()._ishlnsubmul(u,1,l);0===p.negative&&(a=p,h&&(h.words[l]=1));for(var m=l-1;m>=0;m--){var g=67108864*(0|a.words[u.length+m])+(0|a.words[u.length+m-1]);for(g=Math.min(g/c|0,67108863),a._ishlnsubmul(u,g,m);0!==a.negative;)g--,a.negative=0,a._ishlnsubmul(u,1,m),a.isZero()||(a.negative^=1);h&&(h.words[m]=g)}return h&&h.strip(),a.strip(),"div"!==i&&0!==o&&a.iushrn(o),{div:h||null,mod:a}},BN.prototype.divmod=function divmod(t,i,o){return assert(!t.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===t.negative?(c=this.neg().divmod(t,i),"mod"!==i&&(a=c.div.neg()),"div"!==i&&(u=c.mod.neg(),o&&0!==u.negative&&u.iadd(t)),{div:a,mod:u}):0===this.negative&&0!==t.negative?(c=this.divmod(t.neg(),i),"mod"!==i&&(a=c.div.neg()),{div:a,mod:c.mod}):0!=(this.negative&t.negative)?(c=this.neg().divmod(t.neg(),i),"div"!==i&&(u=c.mod.neg(),o&&0!==u.negative&&u.isub(t)),{div:c.div,mod:u}):t.length>this.length||this.cmp(t)<0?{div:new BN(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new BN(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new BN(this.modn(t.words[0]))}:this._wordDiv(t,i);var a,u,c},BN.prototype.div=function div(t){return this.divmod(t,"div",!1).div},BN.prototype.mod=function mod(t){return this.divmod(t,"mod",!1).mod},BN.prototype.umod=function umod(t){return this.divmod(t,"mod",!0).mod},BN.prototype.divRound=function divRound(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var o=0!==i.div.negative?i.mod.isub(t):i.mod,a=t.ushrn(1),u=t.andln(1),c=o.cmp(a);return c<0||1===u&&0===c?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},BN.prototype.modn=function modn(t){assert(t<=67108863);for(var i=(1<<26)%t,o=0,a=this.length-1;a>=0;a--)o=(i*o+(0|this.words[a]))%t;return o},BN.prototype.idivn=function idivn(t){assert(t<=67108863);for(var i=0,o=this.length-1;o>=0;o--){var a=(0|this.words[o])+67108864*i;this.words[o]=a/t|0,i=a%t}return this.strip()},BN.prototype.divn=function divn(t){return this.clone().idivn(t)},BN.prototype.egcd=function egcd(t){assert(0===t.negative),assert(!t.isZero());var i=this,o=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var a=new BN(1),u=new BN(0),c=new BN(0),h=new BN(1),l=0;i.isEven()&&o.isEven();)i.iushrn(1),o.iushrn(1),++l;for(var d=o.clone(),p=i.clone();!i.isZero();){for(var m=0,g=1;0==(i.words[0]&g)&&m<26;++m,g<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(p)),a.iushrn(1),u.iushrn(1);for(var v=0,b=1;0==(o.words[0]&b)&&v<26;++v,b<<=1);if(v>0)for(o.iushrn(v);v-- >0;)(c.isOdd()||h.isOdd())&&(c.iadd(d),h.isub(p)),c.iushrn(1),h.iushrn(1);i.cmp(o)>=0?(i.isub(o),a.isub(c),u.isub(h)):(o.isub(i),c.isub(a),h.isub(u))}return{a:c,b:h,gcd:o.iushln(l)}},BN.prototype._invmp=function _invmp(t){assert(0===t.negative),assert(!t.isZero());var i=this,o=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var a,u=new BN(1),c=new BN(0),h=o.clone();i.cmpn(1)>0&&o.cmpn(1)>0;){for(var l=0,d=1;0==(i.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(i.iushrn(l);l-- >0;)u.isOdd()&&u.iadd(h),u.iushrn(1);for(var p=0,m=1;0==(o.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(o.iushrn(p);p-- >0;)c.isOdd()&&c.iadd(h),c.iushrn(1);i.cmp(o)>=0?(i.isub(o),u.isub(c)):(o.isub(i),c.isub(u))}return(a=0===i.cmpn(1)?u:c).cmpn(0)<0&&a.iadd(t),a},BN.prototype.gcd=function gcd(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),o=t.clone();i.negative=0,o.negative=0;for(var a=0;i.isEven()&&o.isEven();a++)i.iushrn(1),o.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;o.isEven();)o.iushrn(1);var u=i.cmp(o);if(u<0){var c=i;i=o,o=c}else if(0===u||0===o.cmpn(1))break;i.isub(o)}return o.iushln(a)},BN.prototype.invm=function invm(t){return this.egcd(t).a.umod(t)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(t){return this.words[0]&t},BN.prototype.bincn=function bincn(t){assert("number"==typeof t);var i=t%26,o=(t-i)/26,a=1<<i;if(this.length<=o)return this._expand(o+1),this.words[o]|=a,this;for(var u=a,c=o;0!==u&&c<this.length;c++){var h=0|this.words[c];u=(h+=u)>>>26,h&=67108863,this.words[c]=h}return 0!==u&&(this.words[c]=u,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(t){var i,o=t<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this.strip(),this.length>1)i=1;else{o&&(t=-t),assert(t<=67108863,"Number is too big");var a=0|this.words[0];i=a===t?0:a<t?-1:1}return 0!==this.negative?0|-i:i},BN.prototype.cmp=function cmp(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var i=this.ucmp(t);return 0!==this.negative?0|-i:i},BN.prototype.ucmp=function ucmp(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,o=this.length-1;o>=0;o--){var a=0|this.words[o],u=0|t.words[o];if(a!==u){a<u?i=-1:a>u&&(i=1);break}}return i},BN.prototype.gtn=function gtn(t){return 1===this.cmpn(t)},BN.prototype.gt=function gt(t){return 1===this.cmp(t)},BN.prototype.gten=function gten(t){return this.cmpn(t)>=0},BN.prototype.gte=function gte(t){return this.cmp(t)>=0},BN.prototype.ltn=function ltn(t){return-1===this.cmpn(t)},BN.prototype.lt=function lt(t){return-1===this.cmp(t)},BN.prototype.lten=function lten(t){return this.cmpn(t)<=0},BN.prototype.lte=function lte(t){return this.cmp(t)<=0},BN.prototype.eqn=function eqn(t){return 0===this.cmpn(t)},BN.prototype.eq=function eq(t){return 0===this.cmp(t)},BN.red=function red(t){return new Red(t)},BN.prototype.toRed=function toRed(t){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(t){return this.red=t,this},BN.prototype.forceRed=function forceRed(t){return assert(!this.red,"Already a number in reduction context"),this._forceRed(t)},BN.prototype.redAdd=function redAdd(t){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},BN.prototype.redIAdd=function redIAdd(t){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},BN.prototype.redSub=function redSub(t){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},BN.prototype.redISub=function redISub(t){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},BN.prototype.redShl=function redShl(t){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},BN.prototype.redMul=function redMul(t){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},BN.prototype.redIMul=function redIMul(t){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(t){return assert(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(t,i){this.name=t,this.p=new BN(i,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(t){if("string"==typeof t){var i=BN._prime(t);this.m=i.p,this.prime=i}else assert(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function Mont(t){Red.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var t=new BN(null);return t.words=new Array(Math.ceil(this.n/13)),t},MPrime.prototype.ireduce=function ireduce(t){var i,o=t;do{this.split(o,this.tmp),i=(o=(o=this.imulK(o)).iadd(this.tmp)).bitLength()}while(i>this.n);var a=i<this.n?-1:o.ucmp(this.p);return 0===a?(o.words[0]=0,o.length=1):a>0?o.isub(this.p):void 0!==o.strip?o.strip():o._strip(),o},MPrime.prototype.split=function split(t,i){t.iushrn(this.n,0,i)},MPrime.prototype.imulK=function imulK(t){return t.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(t,i){for(var o=Math.min(t.length,9),a=0;a<o;a++)i.words[a]=t.words[a];if(i.length=o,t.length<=9)return t.words[0]=0,void(t.length=1);var u=t.words[9];for(i.words[i.length++]=4194303&u,a=10;a<t.length;a++){var c=0|t.words[a];t.words[a-10]=(4194303&c)<<4|u>>>22,u=c}u>>>=22,t.words[a-10]=u,0===u&&t.length>10?t.length-=10:t.length-=9},K256.prototype.imulK=function imulK(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,o=0;o<t.length;o++){var a=0|t.words[o];i+=977*a,t.words[o]=67108863&i,i=64*a+(i/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},inherits(P224,MPrime),inherits(P192,MPrime),inherits(P25519,MPrime),P25519.prototype.imulK=function imulK(t){for(var i=0,o=0;o<t.length;o++){var a=19*(0|t.words[o])+i,u=67108863&a;a>>>=26,t.words[o]=u,i=a}return 0!==i&&(t.words[t.length++]=i),t},BN._prime=function prime(t){if(d[t])return d[t];var prime;if("k256"===t)prime=new K256;else if("p224"===t)prime=new P224;else if("p192"===t)prime=new P192;else{if("p25519"!==t)throw new Error("Unknown prime "+t);prime=new P25519}return d[t]=prime,prime},Red.prototype._verify1=function _verify1(t){assert(0===t.negative,"red works only with positives"),assert(t.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(t,i){assert(0==(t.negative|i.negative),"red works only with positives"),assert(t.red&&t.red===i.red,"red works only with red numbers")},Red.prototype.imod=function imod(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Red.prototype.add=function add(t,i){this._verify2(t,i);var o=t.add(i);return o.cmp(this.m)>=0&&o.isub(this.m),o._forceRed(this)},Red.prototype.iadd=function iadd(t,i){this._verify2(t,i);var o=t.iadd(i);return o.cmp(this.m)>=0&&o.isub(this.m),o},Red.prototype.sub=function sub(t,i){this._verify2(t,i);var o=t.sub(i);return o.cmpn(0)<0&&o.iadd(this.m),o._forceRed(this)},Red.prototype.isub=function isub(t,i){this._verify2(t,i);var o=t.isub(i);return o.cmpn(0)<0&&o.iadd(this.m),o},Red.prototype.shl=function shl(t,i){return this._verify1(t),this.imod(t.ushln(i))},Red.prototype.imul=function imul(t,i){return this._verify2(t,i),this.imod(t.imul(i))},Red.prototype.mul=function mul(t,i){return this._verify2(t,i),this.imod(t.mul(i))},Red.prototype.isqr=function isqr(t){return this.imul(t,t.clone())},Red.prototype.sqr=function sqr(t){return this.mul(t,t)},Red.prototype.sqrt=function sqrt(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(assert(i%2==1),3===i){var o=this.m.add(new BN(1)).iushrn(2);return this.pow(t,o)}for(var a=this.m.subn(1),u=0;!a.isZero()&&0===a.andln(1);)u++,a.iushrn(1);assert(!a.isZero());var c=new BN(1).toRed(this),h=c.redNeg(),l=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,l).cmp(h);)d.redIAdd(h);for(var p=this.pow(d,a),m=this.pow(t,a.addn(1).iushrn(1)),g=this.pow(t,a),v=u;0!==g.cmp(c);){for(var b=g,w=0;0!==b.cmp(c);w++)b=b.redSqr();assert(w<v);var _=this.pow(p,new BN(1).iushln(v-w-1));m=m.redMul(_),p=_.redSqr(),g=g.redMul(p),v=w}return m},Red.prototype.invm=function invm(t){var i=t._invmp(this.m);return 0!==i.negative?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},Red.prototype.pow=function pow(t,i){if(i.isZero())return new BN(1).toRed(this);if(0===i.cmpn(1))return t.clone();var o=new Array(16);o[0]=new BN(1).toRed(this),o[1]=t;for(var a=2;a<o.length;a++)o[a]=this.mul(o[a-1],t);var u=o[0],c=0,h=0,l=i.bitLength()%26;for(0===l&&(l=26),a=i.length-1;a>=0;a--){for(var d=i.words[a],p=l-1;p>=0;p--){var m=d>>p&1;u!==o[0]&&(u=this.sqr(u)),0!==m||0!==c?(c<<=1,c|=m,(4===++h||0===a&&0===p)&&(u=this.mul(u,o[c]),h=0,c=0)):h=0}l=26}return u},Red.prototype.convertTo=function convertTo(t){var i=t.umod(this.m);return i===t?i.clone():i},Red.prototype.convertFrom=function convertFrom(t){var i=t.clone();return i.red=null,i},BN.mont=function mont(t){return new Mont(t)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(t){return this.imod(t.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},Mont.prototype.imul=function imul(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var o=t.imul(i),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=o.isub(a).iushrn(this.shift),c=u;return u.cmp(this.m)>=0?c=u.isub(this.m):u.cmpn(0)<0&&(c=u.iadd(this.m)),c._forceRed(this)},Mont.prototype.mul=function mul(t,i){if(t.isZero()||i.isZero())return new BN(0)._forceRed(this);var o=t.mul(i),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=o.isub(a).iushrn(this.shift),c=u;return u.cmp(this.m)>=0?c=u.isub(this.m):u.cmpn(0)<0&&(c=u.iadd(this.m)),c._forceRed(this)},Mont.prototype.invm=function invm(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,o(60)(t))},function(t,i){},function(t,i){},function(t){t.exports=JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}')},function(t,i,o){(function(i){var a=o(293),u=new(o(294)),c=new a(24),h=new a(11),l=new a(10),d=new a(3),p=new a(7),m=o(292),g=o(85);function setPublicKey(t,o){return o=o||"utf8",i.isBuffer(t)||(t=new i(t,o)),this._pub=new a(t),this}function setPrivateKey(t,o){return o=o||"utf8",i.isBuffer(t)||(t=new i(t,o)),this._priv=new a(t),this}t.exports=DH;var v={};function DH(t,i,o){this.setGenerator(i),this.__prime=new a(t),this._prime=a.mont(this.__prime),this._primeLen=t.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,o?(this.setPublicKey=setPublicKey,this.setPrivateKey=setPrivateKey):this._primeCode=8}function formatReturnValue(t,o){var a=new i(t.toArray());return o?a.toString(o):a}Object.defineProperty(DH.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function checkPrime(t,i){var o=i.toString("hex"),a=[o,t.toString(16)].join("_");if(a in v)return v[a];var g,b=0;if(t.isEven()||!m.simpleSieve||!m.fermatTest(t)||!u.test(t))return b+=1,b+="02"===o||"05"===o?8:4,v[a]=b,b;switch(u.test(t.shrn(1))||(b+=2),o){case"02":t.mod(c).cmp(h)&&(b+=8);break;case"05":(g=t.mod(l)).cmp(d)&&g.cmp(p)&&(b+=8);break;default:b+=4}return v[a]=b,b}(this.__prime,this.__gen)),this._primeCode}}),DH.prototype.generateKeys=function(){return this._priv||(this._priv=new a(g(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},DH.prototype.computeSecret=function(t){var o=(t=(t=new a(t)).toRed(this._prime)).redPow(this._priv).fromRed(),u=new i(o.toArray()),c=this.getPrime();if(u.length<c.length){var h=new i(c.length-u.length);h.fill(0),u=i.concat([h,u])}return u},DH.prototype.getPublicKey=function getPublicKey(t){return formatReturnValue(this._pub,t)},DH.prototype.getPrivateKey=function getPrivateKey(t){return formatReturnValue(this._priv,t)},DH.prototype.getPrime=function(t){return formatReturnValue(this.__prime,t)},DH.prototype.getGenerator=function(t){return formatReturnValue(this._gen,t)},DH.prototype.setGenerator=function(t,o){return o=o||"utf8",i.isBuffer(t)||(t=new i(t,o)),this.__gen=t,this._gen=new a(t),this}}).call(this,o(10).Buffer)},function(t,i,o){var a=o(180).Buffer,u=o(98),c=o(47),h=o(1),l=o(717),d=o(748),p=o(279);function Sign(t){c.Writable.call(this);var i=p[t];if(!i)throw new Error("Unknown message digest");this._hashType=i.hash,this._hash=u(i.hash),this._tag=i.id,this._signType=i.sign}function Verify(t){c.Writable.call(this);var i=p[t];if(!i)throw new Error("Unknown message digest");this._hash=u(i.hash),this._tag=i.id,this._signType=i.sign}function createSign(t){return new Sign(t)}function createVerify(t){return new Verify(t)}Object.keys(p).forEach((function(t){p[t].id=a.from(p[t].id,"hex"),p[t.toLowerCase()]=p[t]})),h(Sign,c.Writable),Sign.prototype._write=function _write(t,i,o){this._hash.update(t),o()},Sign.prototype.update=function update(t,i){return"string"==typeof t&&(t=a.from(t,i)),this._hash.update(t),this},Sign.prototype.sign=function signMethod(t,i){this.end();var o=this._hash.digest(),a=l(o,t,this._hashType,this._signType,this._tag);return i?a.toString(i):a},h(Verify,c.Writable),Verify.prototype._write=function _write(t,i,o){this._hash.update(t),o()},Verify.prototype.update=function update(t,i){return"string"==typeof t&&(t=a.from(t,i)),this._hash.update(t),this},Verify.prototype.verify=function verifyMethod(t,i,o){"string"==typeof i&&(i=a.from(i,o)),this.end();var u=this._hash.digest();return d(i,u,t,this._signType,this._tag)},t.exports={Sign:createSign,Verify:createVerify,createSign:createSign,createVerify:createVerify}},function(t,i,o){var a=o(180).Buffer,u=o(277),c=o(181),h=o(183).ec,l=o(182),d=o(129),p=o(306);function getKey(t,i,o,c){if((t=a.from(t.toArray())).length<i.byteLength()){var h=a.alloc(i.byteLength()-t.length);t=a.concat([h,t])}var l=o.length,d=function bits2octets(t,i){t=(t=bits2int(t,i)).mod(i);var o=a.from(t.toArray());if(o.length<i.byteLength()){var u=a.alloc(i.byteLength()-o.length);o=a.concat([u,o])}return o}(o,i),p=a.alloc(l);p.fill(1);var m=a.alloc(l);return m=u(c,m).update(p).update(a.from([0])).update(t).update(d).digest(),p=u(c,m).update(p).digest(),{k:m=u(c,m).update(p).update(a.from([1])).update(t).update(d).digest(),v:p=u(c,m).update(p).digest()}}function bits2int(t,i){var o=new l(t),a=(t.length<<3)-i.bitLength();return a>0&&o.ishrn(a),o}function makeKey(t,i,o){var c,h;do{for(c=a.alloc(0);8*c.length<t.bitLength();)i.v=u(o,i.k).update(i.v).digest(),c=a.concat([c,i.v]);h=bits2int(c,t),i.k=u(o,i.k).update(i.v).update(a.from([0])).digest(),i.v=u(o,i.k).update(i.v).digest()}while(-1!==h.cmp(t));return h}function makeR(t,i,o,a){return t.toRed(l.mont(o)).redPow(i).fromRed().mod(a)}t.exports=function sign(t,i,o,u,m){var g=d(i);if(g.curve){if("ecdsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong private key type");return function ecSign(t,i){var o=p[i.curve.join(".")];if(!o)throw new Error("unknown curve "+i.curve.join("."));var u=new h(o).keyFromPrivate(i.privateKey).sign(t);return a.from(u.toDER())}(t,g)}if("dsa"===g.type){if("dsa"!==u)throw new Error("wrong private key type");return function dsaSign(t,i,o){var u,c=i.params.priv_key,h=i.params.p,d=i.params.q,p=i.params.g,m=new l(0),g=bits2int(t,d).mod(d),v=!1,b=getKey(c,d,t,o);for(;!1===v;)u=makeKey(d,b,o),m=makeR(p,u,h,d),0===(v=u.invm(d).imul(g.add(c.mul(m))).mod(d)).cmpn(0)&&(v=!1,m=new l(0));return function toDER(t,i){t=t.toArray(),i=i.toArray(),128&t[0]&&(t=[0].concat(t));128&i[0]&&(i=[0].concat(i));var o=[48,t.length+i.length+4,2,t.length];return o=o.concat(t,[2,i.length],i),a.from(o)}(m,v)}(t,g,o)}if("rsa"!==u&&"ecdsa/rsa"!==u)throw new Error("wrong private key type");t=a.concat([m,t]);for(var v=g.modulus.byteLength(),b=[0,1];t.length+b.length+1<v;)b.push(255);b.push(0);for(var w=-1;++w<t.length;)b.push(t[w]);return c(b,g)},t.exports.getKey=getKey,t.exports.makeKey=makeKey},function(t,i){},function(t){t.exports=JSON.parse('{"name":"elliptic","version":"6.5.4","description":"EC cryptography","main":"lib/elliptic.js","files":["lib"],"scripts":{"lint":"eslint lib test","lint:fix":"npm run lint -- --fix","unit":"istanbul test _mocha --reporter=spec test/index.js","test":"npm run lint && npm run unit","version":"grunt dist && git add dist/"},"repository":{"type":"git","url":"git@github.com:indutny/elliptic"},"keywords":["EC","Elliptic","curve","Cryptography"],"author":"Fedor Indutny <fedor@indutny.com>","license":"MIT","bugs":{"url":"https://github.com/indutny/elliptic/issues"},"homepage":"https://github.com/indutny/elliptic","devDependencies":{"brfs":"^2.0.2","coveralls":"^3.1.0","eslint":"^7.6.0","grunt":"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.5","mocha":"^8.0.1"},"dependencies":{"bn.js":"^4.11.9","brorand":"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1","inherits":"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}')},function(t,i){},function(t,i,o){"use strict";var a=o(36),u=o(49),c=o(1),h=o(128),l=a.assert;function ShortCurve(t){h.call(this,"short",t),this.a=new u(t.a,16).toRed(this.red),this.b=new u(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function Point(t,i,o,a){h.BasePoint.call(this,t,"affine"),null===i&&null===o?(this.x=null,this.y=null,this.inf=!0):(this.x=new u(i,16),this.y=new u(o,16),a&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function JPoint(t,i,o,a){h.BasePoint.call(this,t,"jacobian"),null===i&&null===o&&null===a?(this.x=this.curve.one,this.y=this.curve.one,this.z=new u(0)):(this.x=new u(i,16),this.y=new u(o,16),this.z=new u(a,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}c(ShortCurve,h),t.exports=ShortCurve,ShortCurve.prototype._getEndomorphism=function _getEndomorphism(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var i,o;if(t.beta)i=new u(t.beta,16).toRed(this.red);else{var a=this._getEndoRoots(this.p);i=(i=a[0].cmp(a[1])<0?a[0]:a[1]).toRed(this.red)}if(t.lambda)o=new u(t.lambda,16);else{var c=this._getEndoRoots(this.n);0===this.g.mul(c[0]).x.cmp(this.g.x.redMul(i))?o=c[0]:(o=c[1],l(0===this.g.mul(o).x.cmp(this.g.x.redMul(i))))}return{beta:i,lambda:o,basis:t.basis?t.basis.map((function(t){return{a:new u(t.a,16),b:new u(t.b,16)}})):this._getEndoBasis(o)}}},ShortCurve.prototype._getEndoRoots=function _getEndoRoots(t){var i=t===this.p?this.red:u.mont(t),o=new u(2).toRed(i).redInvm(),a=o.redNeg(),c=new u(3).toRed(i).redNeg().redSqrt().redMul(o);return[a.redAdd(c).fromRed(),a.redSub(c).fromRed()]},ShortCurve.prototype._getEndoBasis=function _getEndoBasis(t){for(var i,o,a,c,h,l,d,p,m,g=this.n.ushrn(Math.floor(this.n.bitLength()/2)),v=t,b=this.n.clone(),w=new u(1),_=new u(0),M=new u(0),k=new u(1),B=0;0!==v.cmpn(0);){var P=b.div(v);p=b.sub(P.mul(v)),m=M.sub(P.mul(w));var x=k.sub(P.mul(_));if(!a&&p.cmp(g)<0)i=d.neg(),o=w,a=p.neg(),c=m;else if(a&&2==++B)break;d=p,b=v,v=p,M=w,w=m,k=_,_=x}h=p.neg(),l=m;var I=a.sqr().add(c.sqr());return h.sqr().add(l.sqr()).cmp(I)>=0&&(h=i,l=o),a.negative&&(a=a.neg(),c=c.neg()),h.negative&&(h=h.neg(),l=l.neg()),[{a:a,b:c},{a:h,b:l}]},ShortCurve.prototype._endoSplit=function _endoSplit(t){var i=this.endo.basis,o=i[0],a=i[1],u=a.b.mul(t).divRound(this.n),c=o.b.neg().mul(t).divRound(this.n),h=u.mul(o.a),l=c.mul(a.a),d=u.mul(o.b),p=c.mul(a.b);return{k1:t.sub(h).sub(l),k2:d.add(p).neg()}},ShortCurve.prototype.pointFromX=function pointFromX(t,i){(t=new u(t,16)).red||(t=t.toRed(this.red));var o=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var c=a.fromRed().isOdd();return(i&&!c||!i&&c)&&(a=a.redNeg()),this.point(t,a)},ShortCurve.prototype.validate=function validate(t){if(t.inf)return!0;var i=t.x,o=t.y,a=this.a.redMul(i),u=i.redSqr().redMul(i).redIAdd(a).redIAdd(this.b);return 0===o.redSqr().redISub(u).cmpn(0)},ShortCurve.prototype._endoWnafMulAdd=function _endoWnafMulAdd(t,i,o){for(var a=this._endoWnafT1,u=this._endoWnafT2,c=0;c<t.length;c++){var h=this._endoSplit(i[c]),l=t[c],d=l._getBeta();h.k1.negative&&(h.k1.ineg(),l=l.neg(!0)),h.k2.negative&&(h.k2.ineg(),d=d.neg(!0)),a[2*c]=l,a[2*c+1]=d,u[2*c]=h.k1,u[2*c+1]=h.k2}for(var p=this._wnafMulAdd(1,a,u,2*c,o),m=0;m<2*c;m++)a[m]=null,u[m]=null;return p},c(Point,h.BasePoint),ShortCurve.prototype.point=function point(t,i,o){return new Point(this,t,i,o)},ShortCurve.prototype.pointFromJSON=function pointFromJSON(t,i){return Point.fromJSON(this,t,i)},Point.prototype._getBeta=function _getBeta(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var i=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var o=this.curve,endoMul=function(t){return o.point(t.x.redMul(o.endo.beta),t.y)};t.beta=i,i.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(endoMul)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(endoMul)}}}return i}},Point.prototype.toJSON=function toJSON(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Point.fromJSON=function fromJSON(t,i,o){"string"==typeof i&&(i=JSON.parse(i));var a=t.point(i[0],i[1],o);if(!i[2])return a;function obj2point(i){return t.point(i[0],i[1],o)}var u=i[2];return a.precomputed={beta:null,doubles:u.doubles&&{step:u.doubles.step,points:[a].concat(u.doubles.points.map(obj2point))},naf:u.naf&&{wnd:u.naf.wnd,points:[a].concat(u.naf.points.map(obj2point))}},a},Point.prototype.inspect=function inspect(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Point.prototype.isInfinity=function isInfinity(){return this.inf},Point.prototype.add=function add(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var i=this.y.redSub(t.y);0!==i.cmpn(0)&&(i=i.redMul(this.x.redSub(t.x).redInvm()));var o=i.redSqr().redISub(this.x).redISub(t.x),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Point.prototype.dbl=function dbl(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var i=this.curve.a,o=this.x.redSqr(),a=t.redInvm(),u=o.redAdd(o).redIAdd(o).redIAdd(i).redMul(a),c=u.redSqr().redISub(this.x.redAdd(this.x)),h=u.redMul(this.x.redSub(c)).redISub(this.y);return this.curve.point(c,h)},Point.prototype.getX=function getX(){return this.x.fromRed()},Point.prototype.getY=function getY(){return this.y.fromRed()},Point.prototype.mul=function mul(t){return t=new u(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Point.prototype.mulAdd=function mulAdd(t,i,o){var a=[this,i],u=[t,o];return this.curve.endo?this.curve._endoWnafMulAdd(a,u):this.curve._wnafMulAdd(1,a,u,2)},Point.prototype.jmulAdd=function jmulAdd(t,i,o){var a=[this,i],u=[t,o];return this.curve.endo?this.curve._endoWnafMulAdd(a,u,!0):this.curve._wnafMulAdd(1,a,u,2,!0)},Point.prototype.eq=function eq(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},Point.prototype.neg=function neg(t){if(this.inf)return this;var i=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var o=this.precomputed,negate=function(t){return t.neg()};i.precomputed={naf:o.naf&&{wnd:o.naf.wnd,points:o.naf.points.map(negate)},doubles:o.doubles&&{step:o.doubles.step,points:o.doubles.points.map(negate)}}}return i},Point.prototype.toJ=function toJ(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},c(JPoint,h.BasePoint),ShortCurve.prototype.jpoint=function jpoint(t,i,o){return new JPoint(this,t,i,o)},JPoint.prototype.toP=function toP(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),i=t.redSqr(),o=this.x.redMul(i),a=this.y.redMul(i).redMul(t);return this.curve.point(o,a)},JPoint.prototype.neg=function neg(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},JPoint.prototype.add=function add(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var i=t.z.redSqr(),o=this.z.redSqr(),a=this.x.redMul(i),u=t.x.redMul(o),c=this.y.redMul(i.redMul(t.z)),h=t.y.redMul(o.redMul(this.z)),l=a.redSub(u),d=c.redSub(h);if(0===l.cmpn(0))return 0!==d.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var p=l.redSqr(),m=p.redMul(l),g=a.redMul(p),v=d.redSqr().redIAdd(m).redISub(g).redISub(g),b=d.redMul(g.redISub(v)).redISub(c.redMul(m)),w=this.z.redMul(t.z).redMul(l);return this.curve.jpoint(v,b,w)},JPoint.prototype.mixedAdd=function mixedAdd(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var i=this.z.redSqr(),o=this.x,a=t.x.redMul(i),u=this.y,c=t.y.redMul(i).redMul(this.z),h=o.redSub(a),l=u.redSub(c);if(0===h.cmpn(0))return 0!==l.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var d=h.redSqr(),p=d.redMul(h),m=o.redMul(d),g=l.redSqr().redIAdd(p).redISub(m).redISub(m),v=l.redMul(m.redISub(g)).redISub(u.redMul(p)),b=this.z.redMul(h);return this.curve.jpoint(g,v,b)},JPoint.prototype.dblp=function dblp(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var i;if(this.curve.zeroA||this.curve.threeA){var o=this;for(i=0;i<t;i++)o=o.dbl();return o}var a=this.curve.a,u=this.curve.tinv,c=this.x,h=this.y,l=this.z,d=l.redSqr().redSqr(),p=h.redAdd(h);for(i=0;i<t;i++){var m=c.redSqr(),g=p.redSqr(),v=g.redSqr(),b=m.redAdd(m).redIAdd(m).redIAdd(a.redMul(d)),w=c.redMul(g),_=b.redSqr().redISub(w.redAdd(w)),M=w.redISub(_),k=b.redMul(M);k=k.redIAdd(k).redISub(v);var B=p.redMul(l);i+1<t&&(d=d.redMul(v)),c=_,l=B,p=k}return this.curve.jpoint(c,p.redMul(u),l)},JPoint.prototype.dbl=function dbl(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},JPoint.prototype._zeroDbl=function _zeroDbl(){var t,i,o;if(this.zOne){var a=this.x.redSqr(),u=this.y.redSqr(),c=u.redSqr(),h=this.x.redAdd(u).redSqr().redISub(a).redISub(c);h=h.redIAdd(h);var l=a.redAdd(a).redIAdd(a),d=l.redSqr().redISub(h).redISub(h),p=c.redIAdd(c);p=(p=p.redIAdd(p)).redIAdd(p),t=d,i=l.redMul(h.redISub(d)).redISub(p),o=this.y.redAdd(this.y)}else{var m=this.x.redSqr(),g=this.y.redSqr(),v=g.redSqr(),b=this.x.redAdd(g).redSqr().redISub(m).redISub(v);b=b.redIAdd(b);var w=m.redAdd(m).redIAdd(m),_=w.redSqr(),M=v.redIAdd(v);M=(M=M.redIAdd(M)).redIAdd(M),t=_.redISub(b).redISub(b),i=w.redMul(b.redISub(t)).redISub(M),o=(o=this.y.redMul(this.z)).redIAdd(o)}return this.curve.jpoint(t,i,o)},JPoint.prototype._threeDbl=function _threeDbl(){var t,i,o;if(this.zOne){var a=this.x.redSqr(),u=this.y.redSqr(),c=u.redSqr(),h=this.x.redAdd(u).redSqr().redISub(a).redISub(c);h=h.redIAdd(h);var l=a.redAdd(a).redIAdd(a).redIAdd(this.curve.a),d=l.redSqr().redISub(h).redISub(h);t=d;var p=c.redIAdd(c);p=(p=p.redIAdd(p)).redIAdd(p),i=l.redMul(h.redISub(d)).redISub(p),o=this.y.redAdd(this.y)}else{var m=this.z.redSqr(),g=this.y.redSqr(),v=this.x.redMul(g),b=this.x.redSub(m).redMul(this.x.redAdd(m));b=b.redAdd(b).redIAdd(b);var w=v.redIAdd(v),_=(w=w.redIAdd(w)).redAdd(w);t=b.redSqr().redISub(_),o=this.y.redAdd(this.z).redSqr().redISub(g).redISub(m);var M=g.redSqr();M=(M=(M=M.redIAdd(M)).redIAdd(M)).redIAdd(M),i=b.redMul(w.redISub(t)).redISub(M)}return this.curve.jpoint(t,i,o)},JPoint.prototype._dbl=function _dbl(){var t=this.curve.a,i=this.x,o=this.y,a=this.z,u=a.redSqr().redSqr(),c=i.redSqr(),h=o.redSqr(),l=c.redAdd(c).redIAdd(c).redIAdd(t.redMul(u)),d=i.redAdd(i),p=(d=d.redIAdd(d)).redMul(h),m=l.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),v=h.redSqr();v=(v=(v=v.redIAdd(v)).redIAdd(v)).redIAdd(v);var b=l.redMul(g).redISub(v),w=o.redAdd(o).redMul(a);return this.curve.jpoint(m,b,w)},JPoint.prototype.trpl=function trpl(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),i=this.y.redSqr(),o=this.z.redSqr(),a=i.redSqr(),u=t.redAdd(t).redIAdd(t),c=u.redSqr(),h=this.x.redAdd(i).redSqr().redISub(t).redISub(a),l=(h=(h=(h=h.redIAdd(h)).redAdd(h).redIAdd(h)).redISub(c)).redSqr(),d=a.redIAdd(a);d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var p=u.redIAdd(h).redSqr().redISub(c).redISub(l).redISub(d),m=i.redMul(p);m=(m=m.redIAdd(m)).redIAdd(m);var g=this.x.redMul(l).redISub(m);g=(g=g.redIAdd(g)).redIAdd(g);var v=this.y.redMul(p.redMul(d.redISub(p)).redISub(h.redMul(l)));v=(v=(v=v.redIAdd(v)).redIAdd(v)).redIAdd(v);var b=this.z.redAdd(h).redSqr().redISub(o).redISub(l);return this.curve.jpoint(g,v,b)},JPoint.prototype.mul=function mul(t,i){return t=new u(t,i),this.curve._wnafMul(this,t)},JPoint.prototype.eq=function eq(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var i=this.z.redSqr(),o=t.z.redSqr();if(0!==this.x.redMul(o).redISub(t.x.redMul(i)).cmpn(0))return!1;var a=i.redMul(this.z),u=o.redMul(t.z);return 0===this.y.redMul(u).redISub(t.y.redMul(a)).cmpn(0)},JPoint.prototype.eqXToP=function eqXToP(t){var i=this.z.redSqr(),o=t.toRed(this.curve.red).redMul(i);if(0===this.x.cmp(o))return!0;for(var a=t.clone(),u=this.curve.redN.redMul(i);;){if(a.iadd(this.curve.n),a.cmp(this.curve.p)>=0)return!1;if(o.redIAdd(u),0===this.x.cmp(o))return!0}},JPoint.prototype.inspect=function inspect(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},JPoint.prototype.isInfinity=function isInfinity(){return 0===this.z.cmpn(0)}},function(t,i,o){"use strict";var a=o(49),u=o(1),c=o(128),h=o(36);function MontCurve(t){c.call(this,"mont",t),this.a=new a(t.a,16).toRed(this.red),this.b=new a(t.b,16).toRed(this.red),this.i4=new a(4).toRed(this.red).redInvm(),this.two=new a(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function Point(t,i,o){c.BasePoint.call(this,t,"projective"),null===i&&null===o?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new a(i,16),this.z=new a(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}u(MontCurve,c),t.exports=MontCurve,MontCurve.prototype.validate=function validate(t){var i=t.normalize().x,o=i.redSqr(),a=o.redMul(i).redAdd(o.redMul(this.a)).redAdd(i);return 0===a.redSqrt().redSqr().cmp(a)},u(Point,c.BasePoint),MontCurve.prototype.decodePoint=function decodePoint(t,i){return this.point(h.toArray(t,i),1)},MontCurve.prototype.point=function point(t,i){return new Point(this,t,i)},MontCurve.prototype.pointFromJSON=function pointFromJSON(t){return Point.fromJSON(this,t)},Point.prototype.precompute=function precompute(){},Point.prototype._encode=function _encode(){return this.getX().toArray("be",this.curve.p.byteLength())},Point.fromJSON=function fromJSON(t,i){return new Point(t,i[0],i[1]||t.one)},Point.prototype.inspect=function inspect(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Point.prototype.isInfinity=function isInfinity(){return 0===this.z.cmpn(0)},Point.prototype.dbl=function dbl(){var t=this.x.redAdd(this.z).redSqr(),i=this.x.redSub(this.z).redSqr(),o=t.redSub(i),a=t.redMul(i),u=o.redMul(i.redAdd(this.curve.a24.redMul(o)));return this.curve.point(a,u)},Point.prototype.add=function add(){throw new Error("Not supported on Montgomery curve")},Point.prototype.diffAdd=function diffAdd(t,i){var o=this.x.redAdd(this.z),a=this.x.redSub(this.z),u=t.x.redAdd(t.z),c=t.x.redSub(t.z).redMul(o),h=u.redMul(a),l=i.z.redMul(c.redAdd(h).redSqr()),d=i.x.redMul(c.redISub(h).redSqr());return this.curve.point(l,d)},Point.prototype.mul=function mul(t){for(var i=t.clone(),o=this,a=this.curve.point(null,null),u=[];0!==i.cmpn(0);i.iushrn(1))u.push(i.andln(1));for(var c=u.length-1;c>=0;c--)0===u[c]?(o=o.diffAdd(a,this),a=a.dbl()):(a=o.diffAdd(a,this),o=o.dbl());return a},Point.prototype.mulAdd=function mulAdd(){throw new Error("Not supported on Montgomery curve")},Point.prototype.jumlAdd=function jumlAdd(){throw new Error("Not supported on Montgomery curve")},Point.prototype.eq=function eq(t){return 0===this.getX().cmp(t.getX())},Point.prototype.normalize=function normalize(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Point.prototype.getX=function getX(){return this.normalize(),this.x.fromRed()}},function(t,i,o){"use strict";var a=o(36),u=o(49),c=o(1),h=o(128),l=a.assert;function EdwardsCurve(t){this.twisted=1!=(0|t.a),this.mOneA=this.twisted&&-1==(0|t.a),this.extended=this.mOneA,h.call(this,"edwards",t),this.a=new u(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new u(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new u(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),l(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|t.c)}function Point(t,i,o,a,c){h.BasePoint.call(this,t,"projective"),null===i&&null===o&&null===a?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new u(i,16),this.y=new u(o,16),this.z=a?new u(a,16):this.curve.one,this.t=c&&new u(c,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}c(EdwardsCurve,h),t.exports=EdwardsCurve,EdwardsCurve.prototype._mulA=function _mulA(t){return this.mOneA?t.redNeg():this.a.redMul(t)},EdwardsCurve.prototype._mulC=function _mulC(t){return this.oneC?t:this.c.redMul(t)},EdwardsCurve.prototype.jpoint=function jpoint(t,i,o,a){return this.point(t,i,o,a)},EdwardsCurve.prototype.pointFromX=function pointFromX(t,i){(t=new u(t,16)).red||(t=t.toRed(this.red));var o=t.redSqr(),a=this.c2.redSub(this.a.redMul(o)),c=this.one.redSub(this.c2.redMul(this.d).redMul(o)),h=a.redMul(c.redInvm()),l=h.redSqrt();if(0!==l.redSqr().redSub(h).cmp(this.zero))throw new Error("invalid point");var d=l.fromRed().isOdd();return(i&&!d||!i&&d)&&(l=l.redNeg()),this.point(t,l)},EdwardsCurve.prototype.pointFromY=function pointFromY(t,i){(t=new u(t,16)).red||(t=t.toRed(this.red));var o=t.redSqr(),a=o.redSub(this.c2),c=o.redMul(this.d).redMul(this.c2).redSub(this.a),h=a.redMul(c.redInvm());if(0===h.cmp(this.zero)){if(i)throw new Error("invalid point");return this.point(this.zero,t)}var l=h.redSqrt();if(0!==l.redSqr().redSub(h).cmp(this.zero))throw new Error("invalid point");return l.fromRed().isOdd()!==i&&(l=l.redNeg()),this.point(l,t)},EdwardsCurve.prototype.validate=function validate(t){if(t.isInfinity())return!0;t.normalize();var i=t.x.redSqr(),o=t.y.redSqr(),a=i.redMul(this.a).redAdd(o),u=this.c2.redMul(this.one.redAdd(this.d.redMul(i).redMul(o)));return 0===a.cmp(u)},c(Point,h.BasePoint),EdwardsCurve.prototype.pointFromJSON=function pointFromJSON(t){return Point.fromJSON(this,t)},EdwardsCurve.prototype.point=function point(t,i,o,a){return new Point(this,t,i,o,a)},Point.fromJSON=function fromJSON(t,i){return new Point(t,i[0],i[1],i[2])},Point.prototype.inspect=function inspect(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},Point.prototype.isInfinity=function isInfinity(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},Point.prototype._extDbl=function _extDbl(){var t=this.x.redSqr(),i=this.y.redSqr(),o=this.z.redSqr();o=o.redIAdd(o);var a=this.curve._mulA(t),u=this.x.redAdd(this.y).redSqr().redISub(t).redISub(i),c=a.redAdd(i),h=c.redSub(o),l=a.redSub(i),d=u.redMul(h),p=c.redMul(l),m=u.redMul(l),g=h.redMul(c);return this.curve.point(d,p,g,m)},Point.prototype._projDbl=function _projDbl(){var t,i,o,a,u,c,h=this.x.redAdd(this.y).redSqr(),l=this.x.redSqr(),d=this.y.redSqr();if(this.curve.twisted){var p=(a=this.curve._mulA(l)).redAdd(d);this.zOne?(t=h.redSub(l).redSub(d).redMul(p.redSub(this.curve.two)),i=p.redMul(a.redSub(d)),o=p.redSqr().redSub(p).redSub(p)):(u=this.z.redSqr(),c=p.redSub(u).redISub(u),t=h.redSub(l).redISub(d).redMul(c),i=p.redMul(a.redSub(d)),o=p.redMul(c))}else a=l.redAdd(d),u=this.curve._mulC(this.z).redSqr(),c=a.redSub(u).redSub(u),t=this.curve._mulC(h.redISub(a)).redMul(c),i=this.curve._mulC(a).redMul(l.redISub(d)),o=a.redMul(c);return this.curve.point(t,i,o)},Point.prototype.dbl=function dbl(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Point.prototype._extAdd=function _extAdd(t){var i=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),o=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),a=this.t.redMul(this.curve.dd).redMul(t.t),u=this.z.redMul(t.z.redAdd(t.z)),c=o.redSub(i),h=u.redSub(a),l=u.redAdd(a),d=o.redAdd(i),p=c.redMul(h),m=l.redMul(d),g=c.redMul(d),v=h.redMul(l);return this.curve.point(p,m,v,g)},Point.prototype._projAdd=function _projAdd(t){var i,o,a=this.z.redMul(t.z),u=a.redSqr(),c=this.x.redMul(t.x),h=this.y.redMul(t.y),l=this.curve.d.redMul(c).redMul(h),d=u.redSub(l),p=u.redAdd(l),m=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(c).redISub(h),g=a.redMul(d).redMul(m);return this.curve.twisted?(i=a.redMul(p).redMul(h.redSub(this.curve._mulA(c))),o=d.redMul(p)):(i=a.redMul(p).redMul(h.redSub(c)),o=this.curve._mulC(d).redMul(p)),this.curve.point(g,i,o)},Point.prototype.add=function add(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},Point.prototype.mul=function mul(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},Point.prototype.mulAdd=function mulAdd(t,i,o){return this.curve._wnafMulAdd(1,[this,i],[t,o],2,!1)},Point.prototype.jmulAdd=function jmulAdd(t,i,o){return this.curve._wnafMulAdd(1,[this,i],[t,o],2,!0)},Point.prototype.normalize=function normalize(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},Point.prototype.neg=function neg(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Point.prototype.getX=function getX(){return this.normalize(),this.x.fromRed()},Point.prototype.getY=function getY(){return this.normalize(),this.y.fromRed()},Point.prototype.eq=function eq(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},Point.prototype.eqXToP=function eqXToP(t){var i=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(i))return!0;for(var o=t.clone(),a=this.curve.redN.redMul(this.z);;){if(o.iadd(this.curve.n),o.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(a),0===this.x.cmp(i))return!0}},Point.prototype.toP=Point.prototype.normalize,Point.prototype.mixedAdd=Point.prototype.add},function(t,i,o){"use strict";i.sha1=o(725),i.sha224=o(726),i.sha256=o(298),i.sha384=o(727),i.sha512=o(299)},function(t,i,o){"use strict";var a=o(42),u=o(100),c=o(297),h=a.rotl32,l=a.sum32,d=a.sum32_5,p=c.ft_1,m=u.BlockHash,g=[1518500249,1859775393,2400959708,3395469782];function SHA1(){if(!(this instanceof SHA1))return new SHA1;m.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}a.inherits(SHA1,m),t.exports=SHA1,SHA1.blockSize=512,SHA1.outSize=160,SHA1.hmacStrength=80,SHA1.padLength=64,SHA1.prototype._update=function _update(t,i){for(var o=this.W,a=0;a<16;a++)o[a]=t[i+a];for(;a<o.length;a++)o[a]=h(o[a-3]^o[a-8]^o[a-14]^o[a-16],1);var u=this.h[0],c=this.h[1],m=this.h[2],v=this.h[3],b=this.h[4];for(a=0;a<o.length;a++){var w=~~(a/20),_=d(h(u,5),p(w,c,m,v),b,o[a],g[w]);b=v,v=m,m=h(c,30),c=u,u=_}this.h[0]=l(this.h[0],u),this.h[1]=l(this.h[1],c),this.h[2]=l(this.h[2],m),this.h[3]=l(this.h[3],v),this.h[4]=l(this.h[4],b)},SHA1.prototype._digest=function digest(t){return"hex"===t?a.toHex32(this.h,"big"):a.split32(this.h,"big")}},function(t,i,o){"use strict";var a=o(42),u=o(298);function SHA224(){if(!(this instanceof SHA224))return new SHA224;u.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}a.inherits(SHA224,u),t.exports=SHA224,SHA224.blockSize=512,SHA224.outSize=224,SHA224.hmacStrength=192,SHA224.padLength=64,SHA224.prototype._digest=function digest(t){return"hex"===t?a.toHex32(this.h.slice(0,7),"big"):a.split32(this.h.slice(0,7),"big")}},function(t,i,o){"use strict";var a=o(42),u=o(299);function SHA384(){if(!(this instanceof SHA384))return new SHA384;u.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}a.inherits(SHA384,u),t.exports=SHA384,SHA384.blockSize=1024,SHA384.outSize=384,SHA384.hmacStrength=192,SHA384.padLength=128,SHA384.prototype._digest=function digest(t){return"hex"===t?a.toHex32(this.h.slice(0,12),"big"):a.split32(this.h.slice(0,12),"big")}},function(t,i,o){"use strict";var a=o(42),u=o(100),c=a.rotl32,h=a.sum32,l=a.sum32_3,d=a.sum32_4,p=u.BlockHash;function RIPEMD160(){if(!(this instanceof RIPEMD160))return new RIPEMD160;p.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function f(t,i,o,a){return t<=15?i^o^a:t<=31?i&o|~i&a:t<=47?(i|~o)^a:t<=63?i&a|o&~a:i^(o|~a)}function K(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function Kh(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}a.inherits(RIPEMD160,p),i.ripemd160=RIPEMD160,RIPEMD160.blockSize=512,RIPEMD160.outSize=160,RIPEMD160.hmacStrength=192,RIPEMD160.padLength=64,RIPEMD160.prototype._update=function update(t,i){for(var o=this.h[0],a=this.h[1],u=this.h[2],p=this.h[3],w=this.h[4],_=o,M=a,k=u,B=p,P=w,x=0;x<80;x++){var I=h(c(d(o,f(x,a,u,p),t[m[x]+i],K(x)),v[x]),w);o=w,w=p,p=c(u,10),u=a,a=I,I=h(c(d(_,f(79-x,M,k,B),t[g[x]+i],Kh(x)),b[x]),P),_=P,P=B,B=c(k,10),k=M,M=I}I=l(this.h[1],u,B),this.h[1]=l(this.h[2],p,P),this.h[2]=l(this.h[3],w,_),this.h[3]=l(this.h[4],o,M),this.h[4]=l(this.h[0],a,k),this.h[0]=I},RIPEMD160.prototype._digest=function digest(t){return"hex"===t?a.toHex32(this.h,"little"):a.split32(this.h,"little")};var m=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],g=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],v=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],b=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]},function(t,i,o){"use strict";var a=o(42),u=o(35);function Hmac(t,i,o){if(!(this instanceof Hmac))return new Hmac(t,i,o);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(a.toArray(i,o))}t.exports=Hmac,Hmac.prototype._init=function init(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),u(t.length<=this.blockSize);for(var i=t.length;i<this.blockSize;i++)t.push(0);for(i=0;i<t.length;i++)t[i]^=54;for(this.inner=(new this.Hash).update(t),i=0;i<t.length;i++)t[i]^=106;this.outer=(new this.Hash).update(t)},Hmac.prototype.update=function update(t,i){return this.inner.update(t,i),this},Hmac.prototype.digest=function digest(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)}},function(t,i){t.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}},function(t,i,o){"use strict";var a=o(49),u=o(732),c=o(36),h=o(184),l=o(179),d=c.assert,p=o(733),m=o(734);function EC(t){if(!(this instanceof EC))return new EC(t);"string"==typeof t&&(d(Object.prototype.hasOwnProperty.call(h,t),"Unknown curve "+t),t=h[t]),t instanceof h.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}t.exports=EC,EC.prototype.keyPair=function keyPair(t){return new p(this,t)},EC.prototype.keyFromPrivate=function keyFromPrivate(t,i){return p.fromPrivate(this,t,i)},EC.prototype.keyFromPublic=function keyFromPublic(t,i){return p.fromPublic(this,t,i)},EC.prototype.genKeyPair=function genKeyPair(t){t||(t={});for(var i=new u({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||l(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),o=this.n.byteLength(),c=this.n.sub(new a(2));;){var h=new a(i.generate(o));if(!(h.cmp(c)>0))return h.iaddn(1),this.keyFromPrivate(h)}},EC.prototype._truncateToN=function _truncateToN(t,i){var o=8*t.byteLength()-this.n.bitLength();return o>0&&(t=t.ushrn(o)),!i&&t.cmp(this.n)>=0?t.sub(this.n):t},EC.prototype.sign=function sign(t,i,o,c){"object"==typeof o&&(c=o,o=null),c||(c={}),i=this.keyFromPrivate(i,o),t=this._truncateToN(new a(t,16));for(var h=this.n.byteLength(),l=i.getPrivate().toArray("be",h),d=t.toArray("be",h),p=new u({hash:this.hash,entropy:l,nonce:d,pers:c.pers,persEnc:c.persEnc||"utf8"}),g=this.n.sub(new a(1)),v=0;;v++){var b=c.k?c.k(v):new a(p.generate(this.n.byteLength()));if(!((b=this._truncateToN(b,!0)).cmpn(1)<=0||b.cmp(g)>=0)){var w=this.g.mul(b);if(!w.isInfinity()){var _=w.getX(),M=_.umod(this.n);if(0!==M.cmpn(0)){var k=b.invm(this.n).mul(M.mul(i.getPrivate()).iadd(t));if(0!==(k=k.umod(this.n)).cmpn(0)){var B=(w.getY().isOdd()?1:0)|(0!==_.cmp(M)?2:0);return c.canonical&&k.cmp(this.nh)>0&&(k=this.n.sub(k),B^=1),new m({r:M,s:k,recoveryParam:B})}}}}}},EC.prototype.verify=function verify(t,i,o,u){t=this._truncateToN(new a(t,16)),o=this.keyFromPublic(o,u);var c=(i=new m(i,"hex")).r,h=i.s;if(c.cmpn(1)<0||c.cmp(this.n)>=0)return!1;if(h.cmpn(1)<0||h.cmp(this.n)>=0)return!1;var l,d=h.invm(this.n),p=d.mul(t).umod(this.n),g=d.mul(c).umod(this.n);return this.curve._maxwellTrick?!(l=this.g.jmulAdd(p,o.getPublic(),g)).isInfinity()&&l.eqXToP(c):!(l=this.g.mulAdd(p,o.getPublic(),g)).isInfinity()&&0===l.getX().umod(this.n).cmp(c)},EC.prototype.recoverPubKey=function(t,i,o,u){d((3&o)===o,"The recovery param is more than two bits"),i=new m(i,u);var c=this.n,h=new a(t),l=i.r,p=i.s,g=1&o,v=o>>1;if(l.cmp(this.curve.p.umod(this.curve.n))>=0&&v)throw new Error("Unable to find sencond key candinate");l=v?this.curve.pointFromX(l.add(this.curve.n),g):this.curve.pointFromX(l,g);var b=i.r.invm(c),w=c.sub(h).mul(b).umod(c),_=p.mul(b).umod(c);return this.g.mulAdd(w,l,_)},EC.prototype.getKeyRecoveryParam=function(t,i,o,a){if(null!==(i=new m(i,a)).recoveryParam)return i.recoveryParam;for(var u=0;u<4;u++){var c;try{c=this.recoverPubKey(t,i,u)}catch(t){continue}if(c.eq(o))return u}throw new Error("Unable to find valid recovery factor")}},function(t,i,o){"use strict";var a=o(185),u=o(295),c=o(35);function HmacDRBG(t){if(!(this instanceof HmacDRBG))return new HmacDRBG(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var i=u.toArray(t.entropy,t.entropyEnc||"hex"),o=u.toArray(t.nonce,t.nonceEnc||"hex"),a=u.toArray(t.pers,t.persEnc||"hex");c(i.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(i,o,a)}t.exports=HmacDRBG,HmacDRBG.prototype._init=function init(t,i,o){var a=t.concat(i).concat(o);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var u=0;u<this.V.length;u++)this.K[u]=0,this.V[u]=1;this._update(a),this._reseed=1,this.reseedInterval=281474976710656},HmacDRBG.prototype._hmac=function hmac(){return new a.hmac(this.hash,this.K)},HmacDRBG.prototype._update=function update(t){var i=this._hmac().update(this.V).update([0]);t&&(i=i.update(t)),this.K=i.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},HmacDRBG.prototype.reseed=function reseed(t,i,o,a){"string"!=typeof i&&(a=o,o=i,i=null),t=u.toArray(t,i),o=u.toArray(o,a),c(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(o||[])),this._reseed=1},HmacDRBG.prototype.generate=function generate(t,i,o,a){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof i&&(a=o,o=i,i=null),o&&(o=u.toArray(o,a||"hex"),this._update(o));for(var c=[];c.length<t;)this.V=this._hmac().update(this.V).digest(),c=c.concat(this.V);var h=c.slice(0,t);return this._update(o),this._reseed++,u.encode(h,i)}},function(t,i,o){"use strict";var a=o(49),u=o(36).assert;function KeyPair(t,i){this.ec=t,this.priv=null,this.pub=null,i.priv&&this._importPrivate(i.priv,i.privEnc),i.pub&&this._importPublic(i.pub,i.pubEnc)}t.exports=KeyPair,KeyPair.fromPublic=function fromPublic(t,i,o){return i instanceof KeyPair?i:new KeyPair(t,{pub:i,pubEnc:o})},KeyPair.fromPrivate=function fromPrivate(t,i,o){return i instanceof KeyPair?i:new KeyPair(t,{priv:i,privEnc:o})},KeyPair.prototype.validate=function validate(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},KeyPair.prototype.getPublic=function getPublic(t,i){return"string"==typeof t&&(i=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),i?this.pub.encode(i,t):this.pub},KeyPair.prototype.getPrivate=function getPrivate(t){return"hex"===t?this.priv.toString(16,2):this.priv},KeyPair.prototype._importPrivate=function _importPrivate(t,i){this.priv=new a(t,i||16),this.priv=this.priv.umod(this.ec.curve.n)},KeyPair.prototype._importPublic=function _importPublic(t,i){if(t.x||t.y)return"mont"===this.ec.curve.type?u(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||u(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,i)},KeyPair.prototype.derive=function derive(t){return t.validate()||u(t.validate(),"public point not validated"),t.mul(this.priv).getX()},KeyPair.prototype.sign=function sign(t,i,o){return this.ec.sign(t,this,i,o)},KeyPair.prototype.verify=function verify(t,i){return this.ec.verify(t,i,this)},KeyPair.prototype.inspect=function inspect(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}},function(t,i,o){"use strict";var a=o(49),u=o(36),c=u.assert;function Signature(t,i){if(t instanceof Signature)return t;this._importDER(t,i)||(c(t.r&&t.s,"Signature without r or s"),this.r=new a(t.r,16),this.s=new a(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function Position(){this.place=0}function getLength(t,i){var o=t[i.place++];if(!(128&o))return o;var a=15&o;if(0===a||a>4)return!1;for(var u=0,c=0,h=i.place;c<a;c++,h++)u<<=8,u|=t[h],u>>>=0;return!(u<=127)&&(i.place=h,u)}function rmPadding(t){for(var i=0,o=t.length-1;!t[i]&&!(128&t[i+1])&&i<o;)i++;return 0===i?t:t.slice(i)}function constructLength(t,i){if(i<128)t.push(i);else{var o=1+(Math.log(i)/Math.LN2>>>3);for(t.push(128|o);--o;)t.push(i>>>(o<<3)&255);t.push(i)}}t.exports=Signature,Signature.prototype._importDER=function _importDER(t,i){t=u.toArray(t,i);var o=new Position;if(48!==t[o.place++])return!1;var c=getLength(t,o);if(!1===c)return!1;if(c+o.place!==t.length)return!1;if(2!==t[o.place++])return!1;var h=getLength(t,o);if(!1===h)return!1;var l=t.slice(o.place,h+o.place);if(o.place+=h,2!==t[o.place++])return!1;var d=getLength(t,o);if(!1===d)return!1;if(t.length!==d+o.place)return!1;var p=t.slice(o.place,d+o.place);if(0===l[0]){if(!(128&l[1]))return!1;l=l.slice(1)}if(0===p[0]){if(!(128&p[1]))return!1;p=p.slice(1)}return this.r=new a(l),this.s=new a(p),this.recoveryParam=null,!0},Signature.prototype.toDER=function toDER(t){var i=this.r.toArray(),o=this.s.toArray();for(128&i[0]&&(i=[0].concat(i)),128&o[0]&&(o=[0].concat(o)),i=rmPadding(i),o=rmPadding(o);!(o[0]||128&o[1]);)o=o.slice(1);var a=[2];constructLength(a,i.length),(a=a.concat(i)).push(2),constructLength(a,o.length);var c=a.concat(o),h=[48];return constructLength(h,c.length),h=h.concat(c),u.encode(h,t)}},function(t,i,o){"use strict";var a=o(185),u=o(184),c=o(36),h=c.assert,l=c.parseBytes,d=o(736),p=o(737);function EDDSA(t){if(h("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof EDDSA))return new EDDSA(t);t=u[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=a.sha512}t.exports=EDDSA,EDDSA.prototype.sign=function sign(t,i){t=l(t);var o=this.keyFromSecret(i),a=this.hashInt(o.messagePrefix(),t),u=this.g.mul(a),c=this.encodePoint(u),h=this.hashInt(c,o.pubBytes(),t).mul(o.priv()),d=a.add(h).umod(this.curve.n);return this.makeSignature({R:u,S:d,Rencoded:c})},EDDSA.prototype.verify=function verify(t,i,o){t=l(t),i=this.makeSignature(i);var a=this.keyFromPublic(o),u=this.hashInt(i.Rencoded(),a.pubBytes(),t),c=this.g.mul(i.S());return i.R().add(a.pub().mul(u)).eq(c)},EDDSA.prototype.hashInt=function hashInt(){for(var t=this.hash(),i=0;i<arguments.length;i++)t.update(arguments[i]);return c.intFromLE(t.digest()).umod(this.curve.n)},EDDSA.prototype.keyFromPublic=function keyFromPublic(t){return d.fromPublic(this,t)},EDDSA.prototype.keyFromSecret=function keyFromSecret(t){return d.fromSecret(this,t)},EDDSA.prototype.makeSignature=function makeSignature(t){return t instanceof p?t:new p(this,t)},EDDSA.prototype.encodePoint=function encodePoint(t){var i=t.getY().toArray("le",this.encodingLength);return i[this.encodingLength-1]|=t.getX().isOdd()?128:0,i},EDDSA.prototype.decodePoint=function decodePoint(t){var i=(t=c.parseBytes(t)).length-1,o=t.slice(0,i).concat(-129&t[i]),a=0!=(128&t[i]),u=c.intFromLE(o);return this.curve.pointFromY(u,a)},EDDSA.prototype.encodeInt=function encodeInt(t){return t.toArray("le",this.encodingLength)},EDDSA.prototype.decodeInt=function decodeInt(t){return c.intFromLE(t)},EDDSA.prototype.isPoint=function isPoint(t){return t instanceof this.pointClass}},function(t,i,o){"use strict";var a=o(36),u=a.assert,c=a.parseBytes,h=a.cachedProperty;function KeyPair(t,i){this.eddsa=t,this._secret=c(i.secret),t.isPoint(i.pub)?this._pub=i.pub:this._pubBytes=c(i.pub)}KeyPair.fromPublic=function fromPublic(t,i){return i instanceof KeyPair?i:new KeyPair(t,{pub:i})},KeyPair.fromSecret=function fromSecret(t,i){return i instanceof KeyPair?i:new KeyPair(t,{secret:i})},KeyPair.prototype.secret=function secret(){return this._secret},h(KeyPair,"pubBytes",(function pubBytes(){return this.eddsa.encodePoint(this.pub())})),h(KeyPair,"pub",(function pub(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),h(KeyPair,"privBytes",(function privBytes(){var t=this.eddsa,i=this.hash(),o=t.encodingLength-1,a=i.slice(0,t.encodingLength);return a[0]&=248,a[o]&=127,a[o]|=64,a})),h(KeyPair,"priv",(function priv(){return this.eddsa.decodeInt(this.privBytes())})),h(KeyPair,"hash",(function hash(){return this.eddsa.hash().update(this.secret()).digest()})),h(KeyPair,"messagePrefix",(function messagePrefix(){return this.hash().slice(this.eddsa.encodingLength)})),KeyPair.prototype.sign=function sign(t){return u(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)},KeyPair.prototype.verify=function verify(t,i){return this.eddsa.verify(t,i,this)},KeyPair.prototype.getSecret=function getSecret(t){return u(this._secret,"KeyPair is public only"),a.encode(this.secret(),t)},KeyPair.prototype.getPublic=function getPublic(t){return a.encode(this.pubBytes(),t)},t.exports=KeyPair},function(t,i,o){"use strict";var a=o(49),u=o(36),c=u.assert,h=u.cachedProperty,l=u.parseBytes;function Signature(t,i){this.eddsa=t,"object"!=typeof i&&(i=l(i)),Array.isArray(i)&&(i={R:i.slice(0,t.encodingLength),S:i.slice(t.encodingLength)}),c(i.R&&i.S,"Signature without R or S"),t.isPoint(i.R)&&(this._R=i.R),i.S instanceof a&&(this._S=i.S),this._Rencoded=Array.isArray(i.R)?i.R:i.Rencoded,this._Sencoded=Array.isArray(i.S)?i.S:i.Sencoded}h(Signature,"S",(function S(){return this.eddsa.decodeInt(this.Sencoded())})),h(Signature,"R",(function R(){return this.eddsa.decodePoint(this.Rencoded())})),h(Signature,"Rencoded",(function Rencoded(){return this.eddsa.encodePoint(this.R())})),h(Signature,"Sencoded",(function Sencoded(){return this.eddsa.encodeInt(this.S())})),Signature.prototype.toBytes=function toBytes(){return this.Rencoded().concat(this.Sencoded())},Signature.prototype.toHex=function toHex(){return u.encode(this.toBytes(),"hex").toUpperCase()},t.exports=Signature},function(t,i,o){"use strict";var a=o(300);i.certificate=o(745);var u=a.define("RSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())}));i.RSAPrivateKey=u;var c=a.define("RSAPublicKey",(function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())}));i.RSAPublicKey=c;var h=a.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(l),this.key("subjectPublicKey").bitstr())}));i.PublicKey=h;var l=a.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())})),d=a.define("PrivateKeyInfo",(function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(l),this.key("subjectPrivateKey").octstr())}));i.PrivateKey=d;var p=a.define("EncryptedPrivateKeyInfo",(function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())}));i.EncryptedPrivateKey=p;var m=a.define("DSAPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())}));i.DSAPrivateKey=m,i.DSAparam=a.define("DSAparam",(function(){this.int()}));var g=a.define("ECPrivateKey",(function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(v),this.key("publicKey").optional().explicit(1).bitstr())}));i.ECPrivateKey=g;var v=a.define("ECParameters",(function(){this.choice({namedCurve:this.objid()})}));i.signature=a.define("signature",(function(){this.seq().obj(this.key("r").int(),this.key("s").int())}))},function(t,i){},function(t,i,o){"use strict";const a=o(302),u=o(304),c=o(1);function Entity(t,i){this.name=t,this.body=i,this.decoders={},this.encoders={}}i.define=function define(t,i){return new Entity(t,i)},Entity.prototype._createNamed=function createNamed(t){const i=this.name;function Generated(t){this._initNamed(t,i)}return c(Generated,t),Generated.prototype._initNamed=function _initNamed(i,o){t.call(this,i,o)},new Generated(this)},Entity.prototype._getDecoder=function _getDecoder(t){return t=t||"der",this.decoders.hasOwnProperty(t)||(this.decoders[t]=this._createNamed(u[t])),this.decoders[t]},Entity.prototype.decode=function decode(t,i,o){return this._getDecoder(i).decode(t,o)},Entity.prototype._getEncoder=function _getEncoder(t){return t=t||"der",this.encoders.hasOwnProperty(t)||(this.encoders[t]=this._createNamed(a[t])),this.encoders[t]},Entity.prototype.encode=function encode(t,i,o){return this._getEncoder(i).encode(t,o)}},function(t,i,o){"use strict";const a=o(1),u=o(303);function PEMEncoder(t){u.call(this,t),this.enc="pem"}a(PEMEncoder,u),t.exports=PEMEncoder,PEMEncoder.prototype.encode=function encode(t,i){const o=u.prototype.encode.call(this,t).toString("base64"),a=["-----BEGIN "+i.label+"-----"];for(let t=0;t<o.length;t+=64)a.push(o.slice(t,t+64));return a.push("-----END "+i.label+"-----"),a.join("\n")}},function(t,i,o){"use strict";const a=o(1),u=o(186).Buffer,c=o(305);function PEMDecoder(t){c.call(this,t),this.enc="pem"}a(PEMDecoder,c),t.exports=PEMDecoder,PEMDecoder.prototype.decode=function decode(t,i){const o=t.toString().split(/[\r\n]+/g),a=i.label.toUpperCase(),h=/^-----(BEGIN|END) ([^-]+)-----$/;let l=-1,d=-1;for(let t=0;t<o.length;t++){const i=o[t].match(h);if(null!==i&&i[2]===a){if(-1!==l){if("END"!==i[1])break;d=t;break}if("BEGIN"!==i[1])break;l=t}}if(-1===l||-1===d)throw new Error("PEM section not found for: "+a);const p=o.slice(l+1,d).join("");p.replace(/[^a-z0-9+/=]+/gi,"");const m=u.from(p,"base64");return c.prototype.decode.call(this,m,i)}},function(t,i,o){"use strict";const a=i;a.Reporter=o(188).Reporter,a.DecoderBuffer=o(101).DecoderBuffer,a.EncoderBuffer=o(101).EncoderBuffer,a.Node=o(187)},function(t,i,o){"use strict";const a=i;a._reverse=function reverse(t){const i={};return Object.keys(t).forEach((function(o){(0|o)==o&&(o|=0);const a=t[o];i[a]=o})),i},a.der=o(189)},function(t,i,o){"use strict";var a=o(300),u=a.define("Time",(function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})})),c=a.define("AttributeTypeValue",(function(){this.seq().obj(this.key("type").objid(),this.key("value").any())})),h=a.define("AlgorithmIdentifier",(function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())})),l=a.define("SubjectPublicKeyInfo",(function(){this.seq().obj(this.key("algorithm").use(h),this.key("subjectPublicKey").bitstr())})),d=a.define("RelativeDistinguishedName",(function(){this.setof(c)})),p=a.define("RDNSequence",(function(){this.seqof(d)})),m=a.define("Name",(function(){this.choice({rdnSequence:this.use(p)})})),g=a.define("Validity",(function(){this.seq().obj(this.key("notBefore").use(u),this.key("notAfter").use(u))})),v=a.define("Extension",(function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())})),b=a.define("TBSCertificate",(function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(h),this.key("issuer").use(m),this.key("validity").use(g),this.key("subject").use(m),this.key("subjectPublicKeyInfo").use(l),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(v).optional())})),w=a.define("X509Certificate",(function(){this.seq().obj(this.key("tbsCertificate").use(b),this.key("signatureAlgorithm").use(h),this.key("signatureValue").bitstr())}));t.exports=w},function(t){t.exports=JSON.parse('{"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}')},function(t,i,o){var a=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,u=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,c=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,h=o(127),l=o(177),d=o(4).Buffer;t.exports=function(t,i){var o,p=t.toString(),m=p.match(a);if(m){var g="aes"+m[1],v=d.from(m[2],"hex"),b=d.from(m[3].replace(/[\r\n]/g,""),"base64"),w=h(i,v.slice(0,8),parseInt(m[1],10)).key,_=[],M=l.createDecipheriv(g,w,v);_.push(M.update(b)),_.push(M.final()),o=d.concat(_)}else{var k=p.match(c);o=d.from(k[2].replace(/[\r\n]/g,""),"base64")}return{tag:p.match(u)[1],data:o}}},function(t,i,o){var a=o(180).Buffer,u=o(182),c=o(183).ec,h=o(129),l=o(306);function checkValue(t,i){if(t.cmpn(0)<=0)throw new Error("invalid sig");if(t.cmp(i)>=i)throw new Error("invalid sig")}t.exports=function verify(t,i,o,d,p){var m=h(o);if("ec"===m.type){if("ecdsa"!==d&&"ecdsa/rsa"!==d)throw new Error("wrong public key type");return function ecVerify(t,i,o){var a=l[o.data.algorithm.curve.join(".")];if(!a)throw new Error("unknown curve "+o.data.algorithm.curve.join("."));var u=new c(a),h=o.data.subjectPrivateKey.data;return u.verify(i,t,h)}(t,i,m)}if("dsa"===m.type){if("dsa"!==d)throw new Error("wrong public key type");return function dsaVerify(t,i,o){var a=o.data.p,c=o.data.q,l=o.data.g,d=o.data.pub_key,p=h.signature.decode(t,"der"),m=p.s,g=p.r;checkValue(m,c),checkValue(g,c);var v=u.mont(a),b=m.invm(c);return 0===l.toRed(v).redPow(new u(i).mul(b).mod(c)).fromRed().mul(d.toRed(v).redPow(g.mul(b).mod(c)).fromRed()).mod(a).mod(c).cmp(g)}(t,i,m)}if("rsa"!==d&&"ecdsa/rsa"!==d)throw new Error("wrong public key type");i=a.concat([p,i]);for(var g=m.modulus.byteLength(),v=[1],b=0;i.length+v.length+2<g;)v.push(255),b++;v.push(0);for(var w=-1;++w<i.length;)v.push(i[w]);v=a.from(v);var _=u.mont(m.modulus);t=(t=new u(t).toRed(_)).redPow(new u(m.publicExponent)),t=a.from(t.fromRed().toArray());var M=b<8?1:0;for(g=Math.min(t.length,v.length),t.length!==v.length&&(M=1),w=-1;++w<g;)M|=t[w]^v[w];return 0===M}},function(t,i,o){(function(i){var a=o(183),u=o(750);t.exports=function createECDH(t){return new ECDH(t)};var c={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function ECDH(t){this.curveType=c[t],this.curveType||(this.curveType={name:t}),this.curve=new a.ec(this.curveType.name),this.keys=void 0}function formatReturnValue(t,o,a){Array.isArray(t)||(t=t.toArray());var u=new i(t);if(a&&u.length<a){var c=new i(a-u.length);c.fill(0),u=i.concat([c,u])}return o?u.toString(o):u}c.p224=c.secp224r1,c.p256=c.secp256r1=c.prime256v1,c.p192=c.secp192r1=c.prime192v1,c.p384=c.secp384r1,c.p521=c.secp521r1,ECDH.prototype.generateKeys=function(t,i){return this.keys=this.curve.genKeyPair(),this.getPublicKey(t,i)},ECDH.prototype.computeSecret=function(t,o,a){return o=o||"utf8",i.isBuffer(t)||(t=new i(t,o)),formatReturnValue(this.curve.keyFromPublic(t).getPublic().mul(this.keys.getPrivate()).getX(),a,this.curveType.byteLength)},ECDH.prototype.getPublicKey=function(t,i){var o=this.keys.getPublic("compressed"===i,!0);return"hybrid"===i&&(o[o.length-1]%2?o[0]=7:o[0]=6),formatReturnValue(o,t)},ECDH.prototype.getPrivateKey=function(t){return formatReturnValue(this.keys.getPrivate(),t)},ECDH.prototype.setPublicKey=function(t,o){return o=o||"utf8",i.isBuffer(t)||(t=new i(t,o)),this.keys._importPublic(t),this},ECDH.prototype.setPrivateKey=function(t,o){o=o||"utf8",i.isBuffer(t)||(t=new i(t,o));var a=new u(t);return a=a.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(a),this}}).call(this,o(10).Buffer)},function(t,i,o){(function(t){!function(t,i){"use strict";function assert(t,i){if(!t)throw new Error(i||"Assertion failed")}function inherits(t,i){t.super_=i;var TempCtor=function(){};TempCtor.prototype=i.prototype,t.prototype=new TempCtor,t.prototype.constructor=t}function BN(t,i,o){if(BN.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==i&&"be"!==i||(o=i,i=10),this._init(t||0,i||10,o||"be"))}var a;"object"==typeof t?t.exports=BN:i.BN=BN,BN.BN=BN,BN.wordSize=26;try{a="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:o(751).Buffer}catch(t){}function parseHex4Bits(t,i){var o=t.charCodeAt(i);return o>=65&&o<=70?o-55:o>=97&&o<=102?o-87:o-48&15}function parseHexByte(t,i,o){var a=parseHex4Bits(t,o);return o-1>=i&&(a|=parseHex4Bits(t,o-1)<<4),a}function parseBase(t,i,o,a){for(var u=0,c=Math.min(t.length,o),h=i;h<c;h++){var l=t.charCodeAt(h)-48;u*=a,u+=l>=49?l-49+10:l>=17?l-17+10:l}return u}BN.isBN=function isBN(t){return t instanceof BN||null!==t&&"object"==typeof t&&t.constructor.wordSize===BN.wordSize&&Array.isArray(t.words)},BN.max=function max(t,i){return t.cmp(i)>0?t:i},BN.min=function min(t,i){return t.cmp(i)<0?t:i},BN.prototype._init=function init(t,i,o){if("number"==typeof t)return this._initNumber(t,i,o);if("object"==typeof t)return this._initArray(t,i,o);"hex"===i&&(i=16),assert(i===(0|i)&&i>=2&&i<=36);var a=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a<t.length&&(16===i?this._parseHex(t,a,o):(this._parseBase(t,i,a),"le"===o&&this._initArray(this.toArray(),i,o)))},BN.prototype._initNumber=function _initNumber(t,i,o){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(assert(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===o&&this._initArray(this.toArray(),i,o)},BN.prototype._initArray=function _initArray(t,i,o){if(assert("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var a=0;a<this.length;a++)this.words[a]=0;var u,c,h=0;if("be"===o)for(a=t.length-1,u=0;a>=0;a-=3)c=t[a]|t[a-1]<<8|t[a-2]<<16,this.words[u]|=c<<h&67108863,this.words[u+1]=c>>>26-h&67108863,(h+=24)>=26&&(h-=26,u++);else if("le"===o)for(a=0,u=0;a<t.length;a+=3)c=t[a]|t[a+1]<<8|t[a+2]<<16,this.words[u]|=c<<h&67108863,this.words[u+1]=c>>>26-h&67108863,(h+=24)>=26&&(h-=26,u++);return this.strip()},BN.prototype._parseHex=function _parseHex(t,i,o){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var a=0;a<this.length;a++)this.words[a]=0;var u,c=0,h=0;if("be"===o)for(a=t.length-1;a>=i;a-=2)u=parseHexByte(t,i,a)<<c,this.words[h]|=67108863&u,c>=18?(c-=18,h+=1,this.words[h]|=u>>>26):c+=8;else for(a=(t.length-i)%2==0?i+1:i;a<t.length;a+=2)u=parseHexByte(t,i,a)<<c,this.words[h]|=67108863&u,c>=18?(c-=18,h+=1,this.words[h]|=u>>>26):c+=8;this.strip()},BN.prototype._parseBase=function _parseBase(t,i,o){this.words=[0],this.length=1;for(var a=0,u=1;u<=67108863;u*=i)a++;a--,u=u/i|0;for(var c=t.length-o,h=c%a,l=Math.min(c,c-h)+o,d=0,p=o;p<l;p+=a)d=parseBase(t,p,p+a,i),this.imuln(u),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d);if(0!==h){var m=1;for(d=parseBase(t,p,t.length,i),p=0;p<h;p++)m*=i;this.imuln(m),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d)}this.strip()},BN.prototype.copy=function copy(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},BN.prototype.clone=function clone(){var t=new BN(null);return this.copy(t),t},BN.prototype._expand=function _expand(t){for(;this.length<t;)this.words[this.length++]=0;return this},BN.prototype.strip=function strip(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},BN.prototype._normSign=function _normSign(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},BN.prototype.inspect=function inspect(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function smallMulTo(t,i,o){o.negative=i.negative^t.negative;var a=t.length+i.length|0;o.length=a,a=a-1|0;var u=0|t.words[0],c=0|i.words[0],h=u*c,l=67108863&h,d=h/67108864|0;o.words[0]=l;for(var p=1;p<a;p++){for(var m=d>>>26,g=67108863&d,v=Math.min(p,i.length-1),b=Math.max(0,p-t.length+1);b<=v;b++){var w=p-b|0;m+=(h=(u=0|t.words[w])*(c=0|i.words[b])+g)/67108864|0,g=67108863&h}o.words[p]=0|g,d=0|m}return 0!==d?o.words[p]=0|d:o.length--,o.strip()}BN.prototype.toString=function toString(t,i){var o;if(i=0|i||1,16===(t=t||10)||"hex"===t){o="";for(var a=0,l=0,d=0;d<this.length;d++){var p=this.words[d],m=(16777215&(p<<a|l)).toString(16);o=0!==(l=p>>>24-a&16777215)||d!==this.length-1?u[6-m.length]+m+o:m+o,(a+=2)>=26&&(a-=26,d--)}for(0!==l&&(o=l.toString(16)+o);o.length%i!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}if(t===(0|t)&&t>=2&&t<=36){var g=c[t],v=h[t];o="";var b=this.clone();for(b.negative=0;!b.isZero();){var w=b.modn(v).toString(t);o=(b=b.idivn(v)).isZero()?w+o:u[g-w.length]+w+o}for(this.isZero()&&(o="0"+o);o.length%i!=0;)o="0"+o;return 0!==this.negative&&(o="-"+o),o}assert(!1,"Base should be between 2 and 36")},BN.prototype.toNumber=function toNumber(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&assert(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},BN.prototype.toJSON=function toJSON(){return this.toString(16)},BN.prototype.toBuffer=function toBuffer(t,i){return assert(void 0!==a),this.toArrayLike(a,t,i)},BN.prototype.toArray=function toArray(t,i){return this.toArrayLike(Array,t,i)},BN.prototype.toArrayLike=function toArrayLike(t,i,o){var a=this.byteLength(),u=o||Math.max(1,a);assert(a<=u,"byte array longer than desired length"),assert(u>0,"Requested array length <= 0"),this.strip();var c,h,l="le"===i,d=new t(u),p=this.clone();if(l){for(h=0;!p.isZero();h++)c=p.andln(255),p.iushrn(8),d[h]=c;for(;h<u;h++)d[h]=0}else{for(h=0;h<u-a;h++)d[h]=0;for(h=0;!p.isZero();h++)c=p.andln(255),p.iushrn(8),d[u-h-1]=c}return d},Math.clz32?BN.prototype._countBits=function _countBits(t){return 32-Math.clz32(t)}:BN.prototype._countBits=function _countBits(t){var i=t,o=0;return i>=4096&&(o+=13,i>>>=13),i>=64&&(o+=7,i>>>=7),i>=8&&(o+=4,i>>>=4),i>=2&&(o+=2,i>>>=2),o+i},BN.prototype._zeroBits=function _zeroBits(t){if(0===t)return 26;var i=t,o=0;return 0==(8191&i)&&(o+=13,i>>>=13),0==(127&i)&&(o+=7,i>>>=7),0==(15&i)&&(o+=4,i>>>=4),0==(3&i)&&(o+=2,i>>>=2),0==(1&i)&&o++,o},BN.prototype.bitLength=function bitLength(){var t=this.words[this.length-1],i=this._countBits(t);return 26*(this.length-1)+i},BN.prototype.zeroBits=function zeroBits(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var o=this._zeroBits(this.words[i]);if(t+=o,26!==o)break}return t},BN.prototype.byteLength=function byteLength(){return Math.ceil(this.bitLength()/8)},BN.prototype.toTwos=function toTwos(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},BN.prototype.fromTwos=function fromTwos(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},BN.prototype.isNeg=function isNeg(){return 0!==this.negative},BN.prototype.neg=function neg(){return this.clone().ineg()},BN.prototype.ineg=function ineg(){return this.isZero()||(this.negative^=1),this},BN.prototype.iuor=function iuor(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this.strip()},BN.prototype.ior=function ior(t){return assert(0==(this.negative|t.negative)),this.iuor(t)},BN.prototype.or=function or(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},BN.prototype.uor=function uor(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},BN.prototype.iuand=function iuand(t){var i;i=this.length>t.length?t:this;for(var o=0;o<i.length;o++)this.words[o]=this.words[o]&t.words[o];return this.length=i.length,this.strip()},BN.prototype.iand=function iand(t){return assert(0==(this.negative|t.negative)),this.iuand(t)},BN.prototype.and=function and(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},BN.prototype.uand=function uand(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},BN.prototype.iuxor=function iuxor(t){var i,o;this.length>t.length?(i=this,o=t):(i=t,o=this);for(var a=0;a<o.length;a++)this.words[a]=i.words[a]^o.words[a];if(this!==i)for(;a<i.length;a++)this.words[a]=i.words[a];return this.length=i.length,this.strip()},BN.prototype.ixor=function ixor(t){return assert(0==(this.negative|t.negative)),this.iuxor(t)},BN.prototype.xor=function xor(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},BN.prototype.uxor=function uxor(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},BN.prototype.inotn=function inotn(t){assert("number"==typeof t&&t>=0);var i=0|Math.ceil(t/26),o=t%26;this._expand(i),o>0&&i--;for(var a=0;a<i;a++)this.words[a]=67108863&~this.words[a];return o>0&&(this.words[a]=~this.words[a]&67108863>>26-o),this.strip()},BN.prototype.notn=function notn(t){return this.clone().inotn(t)},BN.prototype.setn=function setn(t,i){assert("number"==typeof t&&t>=0);var o=t/26|0,a=t%26;return this._expand(o+1),this.words[o]=i?this.words[o]|1<<a:this.words[o]&~(1<<a),this.strip()},BN.prototype.iadd=function iadd(t){var i,o,a;if(0!==this.negative&&0===t.negative)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();this.length>t.length?(o=this,a=t):(o=t,a=this);for(var u=0,c=0;c<a.length;c++)i=(0|o.words[c])+(0|a.words[c])+u,this.words[c]=67108863&i,u=i>>>26;for(;0!==u&&c<o.length;c++)i=(0|o.words[c])+u,this.words[c]=67108863&i,u=i>>>26;if(this.length=o.length,0!==u)this.words[this.length]=u,this.length++;else if(o!==this)for(;c<o.length;c++)this.words[c]=o.words[c];return this},BN.prototype.add=function add(t){var i;return 0!==t.negative&&0===this.negative?(t.negative=0,i=this.sub(t),t.negative^=1,i):0===t.negative&&0!==this.negative?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},BN.prototype.isub=function isub(t){if(0!==t.negative){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var o,a,u=this.cmp(t);if(0===u)return this.negative=0,this.length=1,this.words[0]=0,this;u>0?(o=this,a=t):(o=t,a=this);for(var c=0,h=0;h<a.length;h++)c=(i=(0|o.words[h])-(0|a.words[h])+c)>>26,this.words[h]=67108863&i;for(;0!==c&&h<o.length;h++)c=(i=(0|o.words[h])+c)>>26,this.words[h]=67108863&i;if(0===c&&h<o.length&&o!==this)for(;h<o.length;h++)this.words[h]=o.words[h];return this.length=Math.max(this.length,h),o!==this&&(this.negative=1),this.strip()},BN.prototype.sub=function sub(t){return this.clone().isub(t)};var l=function comb10MulTo(t,i,o){var a,u,c,h=t.words,l=i.words,d=o.words,p=0,m=0|h[0],g=8191&m,v=m>>>13,b=0|h[1],w=8191&b,_=b>>>13,M=0|h[2],k=8191&M,B=M>>>13,P=0|h[3],x=8191&P,I=P>>>13,N=0|h[4],A=8191&N,C=N>>>13,O=0|h[5],j=8191&O,L=O>>>13,q=0|h[6],U=8191&q,z=q>>>13,H=0|h[7],W=8191&H,V=H>>>13,G=0|h[8],J=8191&G,$=G>>>13,Z=0|h[9],Y=8191&Z,X=Z>>>13,Q=0|l[0],ee=8191&Q,te=Q>>>13,re=0|l[1],ne=8191&re,ie=re>>>13,oe=0|l[2],se=8191&oe,ae=oe>>>13,ue=0|l[3],ce=8191&ue,he=ue>>>13,le=0|l[4],fe=8191&le,de=le>>>13,pe=0|l[5],me=8191&pe,ge=pe>>>13,ve=0|l[6],ye=8191&ve,be=ve>>>13,we=0|l[7],_e=8191&we,Me=we>>>13,Se=0|l[8],ke=8191&Se,Ee=Se>>>13,Be=0|l[9],Pe=8191&Be,xe=Be>>>13;o.negative=t.negative^i.negative,o.length=19;var Te=(p+(a=Math.imul(g,ee))|0)+((8191&(u=(u=Math.imul(g,te))+Math.imul(v,ee)|0))<<13)|0;p=((c=Math.imul(v,te))+(u>>>13)|0)+(Te>>>26)|0,Te&=67108863,a=Math.imul(w,ee),u=(u=Math.imul(w,te))+Math.imul(_,ee)|0,c=Math.imul(_,te);var Ie=(p+(a=a+Math.imul(g,ne)|0)|0)+((8191&(u=(u=u+Math.imul(g,ie)|0)+Math.imul(v,ne)|0))<<13)|0;p=((c=c+Math.imul(v,ie)|0)+(u>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,a=Math.imul(k,ee),u=(u=Math.imul(k,te))+Math.imul(B,ee)|0,c=Math.imul(B,te),a=a+Math.imul(w,ne)|0,u=(u=u+Math.imul(w,ie)|0)+Math.imul(_,ne)|0,c=c+Math.imul(_,ie)|0;var Ne=(p+(a=a+Math.imul(g,se)|0)|0)+((8191&(u=(u=u+Math.imul(g,ae)|0)+Math.imul(v,se)|0))<<13)|0;p=((c=c+Math.imul(v,ae)|0)+(u>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,a=Math.imul(x,ee),u=(u=Math.imul(x,te))+Math.imul(I,ee)|0,c=Math.imul(I,te),a=a+Math.imul(k,ne)|0,u=(u=u+Math.imul(k,ie)|0)+Math.imul(B,ne)|0,c=c+Math.imul(B,ie)|0,a=a+Math.imul(w,se)|0,u=(u=u+Math.imul(w,ae)|0)+Math.imul(_,se)|0,c=c+Math.imul(_,ae)|0;var Ae=(p+(a=a+Math.imul(g,ce)|0)|0)+((8191&(u=(u=u+Math.imul(g,he)|0)+Math.imul(v,ce)|0))<<13)|0;p=((c=c+Math.imul(v,he)|0)+(u>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,a=Math.imul(A,ee),u=(u=Math.imul(A,te))+Math.imul(C,ee)|0,c=Math.imul(C,te),a=a+Math.imul(x,ne)|0,u=(u=u+Math.imul(x,ie)|0)+Math.imul(I,ne)|0,c=c+Math.imul(I,ie)|0,a=a+Math.imul(k,se)|0,u=(u=u+Math.imul(k,ae)|0)+Math.imul(B,se)|0,c=c+Math.imul(B,ae)|0,a=a+Math.imul(w,ce)|0,u=(u=u+Math.imul(w,he)|0)+Math.imul(_,ce)|0,c=c+Math.imul(_,he)|0;var Re=(p+(a=a+Math.imul(g,fe)|0)|0)+((8191&(u=(u=u+Math.imul(g,de)|0)+Math.imul(v,fe)|0))<<13)|0;p=((c=c+Math.imul(v,de)|0)+(u>>>13)|0)+(Re>>>26)|0,Re&=67108863,a=Math.imul(j,ee),u=(u=Math.imul(j,te))+Math.imul(L,ee)|0,c=Math.imul(L,te),a=a+Math.imul(A,ne)|0,u=(u=u+Math.imul(A,ie)|0)+Math.imul(C,ne)|0,c=c+Math.imul(C,ie)|0,a=a+Math.imul(x,se)|0,u=(u=u+Math.imul(x,ae)|0)+Math.imul(I,se)|0,c=c+Math.imul(I,ae)|0,a=a+Math.imul(k,ce)|0,u=(u=u+Math.imul(k,he)|0)+Math.imul(B,ce)|0,c=c+Math.imul(B,he)|0,a=a+Math.imul(w,fe)|0,u=(u=u+Math.imul(w,de)|0)+Math.imul(_,fe)|0,c=c+Math.imul(_,de)|0;var Ce=(p+(a=a+Math.imul(g,me)|0)|0)+((8191&(u=(u=u+Math.imul(g,ge)|0)+Math.imul(v,me)|0))<<13)|0;p=((c=c+Math.imul(v,ge)|0)+(u>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,a=Math.imul(U,ee),u=(u=Math.imul(U,te))+Math.imul(z,ee)|0,c=Math.imul(z,te),a=a+Math.imul(j,ne)|0,u=(u=u+Math.imul(j,ie)|0)+Math.imul(L,ne)|0,c=c+Math.imul(L,ie)|0,a=a+Math.imul(A,se)|0,u=(u=u+Math.imul(A,ae)|0)+Math.imul(C,se)|0,c=c+Math.imul(C,ae)|0,a=a+Math.imul(x,ce)|0,u=(u=u+Math.imul(x,he)|0)+Math.imul(I,ce)|0,c=c+Math.imul(I,he)|0,a=a+Math.imul(k,fe)|0,u=(u=u+Math.imul(k,de)|0)+Math.imul(B,fe)|0,c=c+Math.imul(B,de)|0,a=a+Math.imul(w,me)|0,u=(u=u+Math.imul(w,ge)|0)+Math.imul(_,me)|0,c=c+Math.imul(_,ge)|0;var Oe=(p+(a=a+Math.imul(g,ye)|0)|0)+((8191&(u=(u=u+Math.imul(g,be)|0)+Math.imul(v,ye)|0))<<13)|0;p=((c=c+Math.imul(v,be)|0)+(u>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,a=Math.imul(W,ee),u=(u=Math.imul(W,te))+Math.imul(V,ee)|0,c=Math.imul(V,te),a=a+Math.imul(U,ne)|0,u=(u=u+Math.imul(U,ie)|0)+Math.imul(z,ne)|0,c=c+Math.imul(z,ie)|0,a=a+Math.imul(j,se)|0,u=(u=u+Math.imul(j,ae)|0)+Math.imul(L,se)|0,c=c+Math.imul(L,ae)|0,a=a+Math.imul(A,ce)|0,u=(u=u+Math.imul(A,he)|0)+Math.imul(C,ce)|0,c=c+Math.imul(C,he)|0,a=a+Math.imul(x,fe)|0,u=(u=u+Math.imul(x,de)|0)+Math.imul(I,fe)|0,c=c+Math.imul(I,de)|0,a=a+Math.imul(k,me)|0,u=(u=u+Math.imul(k,ge)|0)+Math.imul(B,me)|0,c=c+Math.imul(B,ge)|0,a=a+Math.imul(w,ye)|0,u=(u=u+Math.imul(w,be)|0)+Math.imul(_,ye)|0,c=c+Math.imul(_,be)|0;var De=(p+(a=a+Math.imul(g,_e)|0)|0)+((8191&(u=(u=u+Math.imul(g,Me)|0)+Math.imul(v,_e)|0))<<13)|0;p=((c=c+Math.imul(v,Me)|0)+(u>>>13)|0)+(De>>>26)|0,De&=67108863,a=Math.imul(J,ee),u=(u=Math.imul(J,te))+Math.imul($,ee)|0,c=Math.imul($,te),a=a+Math.imul(W,ne)|0,u=(u=u+Math.imul(W,ie)|0)+Math.imul(V,ne)|0,c=c+Math.imul(V,ie)|0,a=a+Math.imul(U,se)|0,u=(u=u+Math.imul(U,ae)|0)+Math.imul(z,se)|0,c=c+Math.imul(z,ae)|0,a=a+Math.imul(j,ce)|0,u=(u=u+Math.imul(j,he)|0)+Math.imul(L,ce)|0,c=c+Math.imul(L,he)|0,a=a+Math.imul(A,fe)|0,u=(u=u+Math.imul(A,de)|0)+Math.imul(C,fe)|0,c=c+Math.imul(C,de)|0,a=a+Math.imul(x,me)|0,u=(u=u+Math.imul(x,ge)|0)+Math.imul(I,me)|0,c=c+Math.imul(I,ge)|0,a=a+Math.imul(k,ye)|0,u=(u=u+Math.imul(k,be)|0)+Math.imul(B,ye)|0,c=c+Math.imul(B,be)|0,a=a+Math.imul(w,_e)|0,u=(u=u+Math.imul(w,Me)|0)+Math.imul(_,_e)|0,c=c+Math.imul(_,Me)|0;var je=(p+(a=a+Math.imul(g,ke)|0)|0)+((8191&(u=(u=u+Math.imul(g,Ee)|0)+Math.imul(v,ke)|0))<<13)|0;p=((c=c+Math.imul(v,Ee)|0)+(u>>>13)|0)+(je>>>26)|0,je&=67108863,a=Math.imul(Y,ee),u=(u=Math.imul(Y,te))+Math.imul(X,ee)|0,c=Math.imul(X,te),a=a+Math.imul(J,ne)|0,u=(u=u+Math.imul(J,ie)|0)+Math.imul($,ne)|0,c=c+Math.imul($,ie)|0,a=a+Math.imul(W,se)|0,u=(u=u+Math.imul(W,ae)|0)+Math.imul(V,se)|0,c=c+Math.imul(V,ae)|0,a=a+Math.imul(U,ce)|0,u=(u=u+Math.imul(U,he)|0)+Math.imul(z,ce)|0,c=c+Math.imul(z,he)|0,a=a+Math.imul(j,fe)|0,u=(u=u+Math.imul(j,de)|0)+Math.imul(L,fe)|0,c=c+Math.imul(L,de)|0,a=a+Math.imul(A,me)|0,u=(u=u+Math.imul(A,ge)|0)+Math.imul(C,me)|0,c=c+Math.imul(C,ge)|0,a=a+Math.imul(x,ye)|0,u=(u=u+Math.imul(x,be)|0)+Math.imul(I,ye)|0,c=c+Math.imul(I,be)|0,a=a+Math.imul(k,_e)|0,u=(u=u+Math.imul(k,Me)|0)+Math.imul(B,_e)|0,c=c+Math.imul(B,Me)|0,a=a+Math.imul(w,ke)|0,u=(u=u+Math.imul(w,Ee)|0)+Math.imul(_,ke)|0,c=c+Math.imul(_,Ee)|0;var Le=(p+(a=a+Math.imul(g,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(g,xe)|0)+Math.imul(v,Pe)|0))<<13)|0;p=((c=c+Math.imul(v,xe)|0)+(u>>>13)|0)+(Le>>>26)|0,Le&=67108863,a=Math.imul(Y,ne),u=(u=Math.imul(Y,ie))+Math.imul(X,ne)|0,c=Math.imul(X,ie),a=a+Math.imul(J,se)|0,u=(u=u+Math.imul(J,ae)|0)+Math.imul($,se)|0,c=c+Math.imul($,ae)|0,a=a+Math.imul(W,ce)|0,u=(u=u+Math.imul(W,he)|0)+Math.imul(V,ce)|0,c=c+Math.imul(V,he)|0,a=a+Math.imul(U,fe)|0,u=(u=u+Math.imul(U,de)|0)+Math.imul(z,fe)|0,c=c+Math.imul(z,de)|0,a=a+Math.imul(j,me)|0,u=(u=u+Math.imul(j,ge)|0)+Math.imul(L,me)|0,c=c+Math.imul(L,ge)|0,a=a+Math.imul(A,ye)|0,u=(u=u+Math.imul(A,be)|0)+Math.imul(C,ye)|0,c=c+Math.imul(C,be)|0,a=a+Math.imul(x,_e)|0,u=(u=u+Math.imul(x,Me)|0)+Math.imul(I,_e)|0,c=c+Math.imul(I,Me)|0,a=a+Math.imul(k,ke)|0,u=(u=u+Math.imul(k,Ee)|0)+Math.imul(B,ke)|0,c=c+Math.imul(B,Ee)|0;var Fe=(p+(a=a+Math.imul(w,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(w,xe)|0)+Math.imul(_,Pe)|0))<<13)|0;p=((c=c+Math.imul(_,xe)|0)+(u>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,a=Math.imul(Y,se),u=(u=Math.imul(Y,ae))+Math.imul(X,se)|0,c=Math.imul(X,ae),a=a+Math.imul(J,ce)|0,u=(u=u+Math.imul(J,he)|0)+Math.imul($,ce)|0,c=c+Math.imul($,he)|0,a=a+Math.imul(W,fe)|0,u=(u=u+Math.imul(W,de)|0)+Math.imul(V,fe)|0,c=c+Math.imul(V,de)|0,a=a+Math.imul(U,me)|0,u=(u=u+Math.imul(U,ge)|0)+Math.imul(z,me)|0,c=c+Math.imul(z,ge)|0,a=a+Math.imul(j,ye)|0,u=(u=u+Math.imul(j,be)|0)+Math.imul(L,ye)|0,c=c+Math.imul(L,be)|0,a=a+Math.imul(A,_e)|0,u=(u=u+Math.imul(A,Me)|0)+Math.imul(C,_e)|0,c=c+Math.imul(C,Me)|0,a=a+Math.imul(x,ke)|0,u=(u=u+Math.imul(x,Ee)|0)+Math.imul(I,ke)|0,c=c+Math.imul(I,Ee)|0;var qe=(p+(a=a+Math.imul(k,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(k,xe)|0)+Math.imul(B,Pe)|0))<<13)|0;p=((c=c+Math.imul(B,xe)|0)+(u>>>13)|0)+(qe>>>26)|0,qe&=67108863,a=Math.imul(Y,ce),u=(u=Math.imul(Y,he))+Math.imul(X,ce)|0,c=Math.imul(X,he),a=a+Math.imul(J,fe)|0,u=(u=u+Math.imul(J,de)|0)+Math.imul($,fe)|0,c=c+Math.imul($,de)|0,a=a+Math.imul(W,me)|0,u=(u=u+Math.imul(W,ge)|0)+Math.imul(V,me)|0,c=c+Math.imul(V,ge)|0,a=a+Math.imul(U,ye)|0,u=(u=u+Math.imul(U,be)|0)+Math.imul(z,ye)|0,c=c+Math.imul(z,be)|0,a=a+Math.imul(j,_e)|0,u=(u=u+Math.imul(j,Me)|0)+Math.imul(L,_e)|0,c=c+Math.imul(L,Me)|0,a=a+Math.imul(A,ke)|0,u=(u=u+Math.imul(A,Ee)|0)+Math.imul(C,ke)|0,c=c+Math.imul(C,Ee)|0;var Ue=(p+(a=a+Math.imul(x,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(x,xe)|0)+Math.imul(I,Pe)|0))<<13)|0;p=((c=c+Math.imul(I,xe)|0)+(u>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,a=Math.imul(Y,fe),u=(u=Math.imul(Y,de))+Math.imul(X,fe)|0,c=Math.imul(X,de),a=a+Math.imul(J,me)|0,u=(u=u+Math.imul(J,ge)|0)+Math.imul($,me)|0,c=c+Math.imul($,ge)|0,a=a+Math.imul(W,ye)|0,u=(u=u+Math.imul(W,be)|0)+Math.imul(V,ye)|0,c=c+Math.imul(V,be)|0,a=a+Math.imul(U,_e)|0,u=(u=u+Math.imul(U,Me)|0)+Math.imul(z,_e)|0,c=c+Math.imul(z,Me)|0,a=a+Math.imul(j,ke)|0,u=(u=u+Math.imul(j,Ee)|0)+Math.imul(L,ke)|0,c=c+Math.imul(L,Ee)|0;var ze=(p+(a=a+Math.imul(A,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(A,xe)|0)+Math.imul(C,Pe)|0))<<13)|0;p=((c=c+Math.imul(C,xe)|0)+(u>>>13)|0)+(ze>>>26)|0,ze&=67108863,a=Math.imul(Y,me),u=(u=Math.imul(Y,ge))+Math.imul(X,me)|0,c=Math.imul(X,ge),a=a+Math.imul(J,ye)|0,u=(u=u+Math.imul(J,be)|0)+Math.imul($,ye)|0,c=c+Math.imul($,be)|0,a=a+Math.imul(W,_e)|0,u=(u=u+Math.imul(W,Me)|0)+Math.imul(V,_e)|0,c=c+Math.imul(V,Me)|0,a=a+Math.imul(U,ke)|0,u=(u=u+Math.imul(U,Ee)|0)+Math.imul(z,ke)|0,c=c+Math.imul(z,Ee)|0;var He=(p+(a=a+Math.imul(j,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(j,xe)|0)+Math.imul(L,Pe)|0))<<13)|0;p=((c=c+Math.imul(L,xe)|0)+(u>>>13)|0)+(He>>>26)|0,He&=67108863,a=Math.imul(Y,ye),u=(u=Math.imul(Y,be))+Math.imul(X,ye)|0,c=Math.imul(X,be),a=a+Math.imul(J,_e)|0,u=(u=u+Math.imul(J,Me)|0)+Math.imul($,_e)|0,c=c+Math.imul($,Me)|0,a=a+Math.imul(W,ke)|0,u=(u=u+Math.imul(W,Ee)|0)+Math.imul(V,ke)|0,c=c+Math.imul(V,Ee)|0;var We=(p+(a=a+Math.imul(U,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(U,xe)|0)+Math.imul(z,Pe)|0))<<13)|0;p=((c=c+Math.imul(z,xe)|0)+(u>>>13)|0)+(We>>>26)|0,We&=67108863,a=Math.imul(Y,_e),u=(u=Math.imul(Y,Me))+Math.imul(X,_e)|0,c=Math.imul(X,Me),a=a+Math.imul(J,ke)|0,u=(u=u+Math.imul(J,Ee)|0)+Math.imul($,ke)|0,c=c+Math.imul($,Ee)|0;var Ke=(p+(a=a+Math.imul(W,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(W,xe)|0)+Math.imul(V,Pe)|0))<<13)|0;p=((c=c+Math.imul(V,xe)|0)+(u>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,a=Math.imul(Y,ke),u=(u=Math.imul(Y,Ee))+Math.imul(X,ke)|0,c=Math.imul(X,Ee);var Ve=(p+(a=a+Math.imul(J,Pe)|0)|0)+((8191&(u=(u=u+Math.imul(J,xe)|0)+Math.imul($,Pe)|0))<<13)|0;p=((c=c+Math.imul($,xe)|0)+(u>>>13)|0)+(Ve>>>26)|0,Ve&=67108863;var Ge=(p+(a=Math.imul(Y,Pe))|0)+((8191&(u=(u=Math.imul(Y,xe))+Math.imul(X,Pe)|0))<<13)|0;return p=((c=Math.imul(X,xe))+(u>>>13)|0)+(Ge>>>26)|0,Ge&=67108863,d[0]=Te,d[1]=Ie,d[2]=Ne,d[3]=Ae,d[4]=Re,d[5]=Ce,d[6]=Oe,d[7]=De,d[8]=je,d[9]=Le,d[10]=Fe,d[11]=qe,d[12]=Ue,d[13]=ze,d[14]=He,d[15]=We,d[16]=Ke,d[17]=Ve,d[18]=Ge,0!==p&&(d[19]=p,o.length++),o};function jumboMulTo(t,i,o){return(new FFTM).mulp(t,i,o)}function FFTM(t,i){this.x=t,this.y=i}Math.imul||(l=smallMulTo),BN.prototype.mulTo=function mulTo(t,i){var o=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,i):o<63?smallMulTo(this,t,i):o<1024?function bigMulTo(t,i,o){o.negative=i.negative^t.negative,o.length=t.length+i.length;for(var a=0,u=0,c=0;c<o.length-1;c++){var h=u;u=0;for(var l=67108863&a,d=Math.min(c,i.length-1),p=Math.max(0,c-t.length+1);p<=d;p++){var m=c-p,g=(0|t.words[m])*(0|i.words[p]),v=67108863&g;l=67108863&(v=v+l|0),u+=(h=(h=h+(g/67108864|0)|0)+(v>>>26)|0)>>>26,h&=67108863}o.words[c]=l,a=h,h=u}return 0!==a?o.words[c]=a:o.length--,o.strip()}(this,t,i):jumboMulTo(this,t,i)},FFTM.prototype.makeRBT=function makeRBT(t){for(var i=new Array(t),o=BN.prototype._countBits(t)-1,a=0;a<t;a++)i[a]=this.revBin(a,o,t);return i},FFTM.prototype.revBin=function revBin(t,i,o){if(0===t||t===o-1)return t;for(var a=0,u=0;u<i;u++)a|=(1&t)<<i-u-1,t>>=1;return a},FFTM.prototype.permute=function permute(t,i,o,a,u,c){for(var h=0;h<c;h++)a[h]=i[t[h]],u[h]=o[t[h]]},FFTM.prototype.transform=function transform(t,i,o,a,u,c){this.permute(c,t,i,o,a,u);for(var h=1;h<u;h<<=1)for(var l=h<<1,d=Math.cos(2*Math.PI/l),p=Math.sin(2*Math.PI/l),m=0;m<u;m+=l)for(var g=d,v=p,b=0;b<h;b++){var w=o[m+b],_=a[m+b],M=o[m+b+h],k=a[m+b+h],B=g*M-v*k;k=g*k+v*M,M=B,o[m+b]=w+M,a[m+b]=_+k,o[m+b+h]=w-M,a[m+b+h]=_-k,b!==l&&(B=d*g-p*v,v=d*v+p*g,g=B)}},FFTM.prototype.guessLen13b=function guessLen13b(t,i){var o=1|Math.max(i,t),a=1&o,u=0;for(o=o/2|0;o;o>>>=1)u++;return 1<<u+1+a},FFTM.prototype.conjugate=function conjugate(t,i,o){if(!(o<=1))for(var a=0;a<o/2;a++){var u=t[a];t[a]=t[o-a-1],t[o-a-1]=u,u=i[a],i[a]=-i[o-a-1],i[o-a-1]=-u}},FFTM.prototype.normalize13b=function normalize13b(t,i){for(var o=0,a=0;a<i/2;a++){var u=8192*Math.round(t[2*a+1]/i)+Math.round(t[2*a]/i)+o;t[a]=67108863&u,o=u<67108864?0:u/67108864|0}return t},FFTM.prototype.convert13b=function convert13b(t,i,o,a){for(var u=0,c=0;c<i;c++)u+=0|t[c],o[2*c]=8191&u,u>>>=13,o[2*c+1]=8191&u,u>>>=13;for(c=2*i;c<a;++c)o[c]=0;assert(0===u),assert(0==(-8192&u))},FFTM.prototype.stub=function stub(t){for(var i=new Array(t),o=0;o<t;o++)i[o]=0;return i},FFTM.prototype.mulp=function mulp(t,i,o){var a=2*this.guessLen13b(t.length,i.length),u=this.makeRBT(a),c=this.stub(a),h=new Array(a),l=new Array(a),d=new Array(a),p=new Array(a),m=new Array(a),g=new Array(a),v=o.words;v.length=a,this.convert13b(t.words,t.length,h,a),this.convert13b(i.words,i.length,p,a),this.transform(h,c,l,d,a,u),this.transform(p,c,m,g,a,u);for(var b=0;b<a;b++){var w=l[b]*m[b]-d[b]*g[b];d[b]=l[b]*g[b]+d[b]*m[b],l[b]=w}return this.conjugate(l,d,a),this.transform(l,d,v,c,a,u),this.conjugate(v,c,a),this.normalize13b(v,a),o.negative=t.negative^i.negative,o.length=t.length+i.length,o.strip()},BN.prototype.mul=function mul(t){var i=new BN(null);return i.words=new Array(this.length+t.length),this.mulTo(t,i)},BN.prototype.mulf=function mulf(t){var i=new BN(null);return i.words=new Array(this.length+t.length),jumboMulTo(this,t,i)},BN.prototype.imul=function imul(t){return this.clone().mulTo(t,this)},BN.prototype.imuln=function imuln(t){assert("number"==typeof t),assert(t<67108864);for(var i=0,o=0;o<this.length;o++){var a=(0|this.words[o])*t,u=(67108863&a)+(67108863&i);i>>=26,i+=a/67108864|0,i+=u>>>26,this.words[o]=67108863&u}return 0!==i&&(this.words[o]=i,this.length++),this},BN.prototype.muln=function muln(t){return this.clone().imuln(t)},BN.prototype.sqr=function sqr(){return this.mul(this)},BN.prototype.isqr=function isqr(){return this.imul(this.clone())},BN.prototype.pow=function pow(t){var i=function toBitArray(t){for(var i=new Array(t.bitLength()),o=0;o<i.length;o++){var a=o/26|0,u=o%26;i[o]=(t.words[a]&1<<u)>>>u}return i}(t);if(0===i.length)return new BN(1);for(var o=this,a=0;a<i.length&&0===i[a];a++,o=o.sqr());if(++a<i.length)for(var u=o.sqr();a<i.length;a++,u=u.sqr())0!==i[a]&&(o=o.mul(u));return o},BN.prototype.iushln=function iushln(t){assert("number"==typeof t&&t>=0);var i,o=t%26,a=(t-o)/26,u=67108863>>>26-o<<26-o;if(0!==o){var c=0;for(i=0;i<this.length;i++){var h=this.words[i]&u,l=(0|this.words[i])-h<<o;this.words[i]=l|c,c=h>>>26-o}c&&(this.words[i]=c,this.length++)}if(0!==a){for(i=this.length-1;i>=0;i--)this.words[i+a]=this.words[i];for(i=0;i<a;i++)this.words[i]=0;this.length+=a}return this.strip()},BN.prototype.ishln=function ishln(t){return assert(0===this.negative),this.iushln(t)},BN.prototype.iushrn=function iushrn(t,i,o){var a;assert("number"==typeof t&&t>=0),a=i?(i-i%26)/26:0;var u=t%26,c=Math.min((t-u)/26,this.length),h=67108863^67108863>>>u<<u,l=o;if(a-=c,a=Math.max(0,a),l){for(var d=0;d<c;d++)l.words[d]=this.words[d];l.length=c}if(0===c);else if(this.length>c)for(this.length-=c,d=0;d<this.length;d++)this.words[d]=this.words[d+c];else this.words[0]=0,this.length=1;var p=0;for(d=this.length-1;d>=0&&(0!==p||d>=a);d--){var m=0|this.words[d];this.words[d]=p<<26-u|m>>>u,p=m&h}return l&&0!==p&&(l.words[l.length++]=p),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},BN.prototype.ishrn=function ishrn(t,i,o){return assert(0===this.negative),this.iushrn(t,i,o)},BN.prototype.shln=function shln(t){return this.clone().ishln(t)},BN.prototype.ushln=function ushln(t){return this.clone().iushln(t)},BN.prototype.shrn=function shrn(t){return this.clone().ishrn(t)},BN.prototype.ushrn=function ushrn(t){return this.clone().iushrn(t)},BN.prototype.testn=function testn(t){assert("number"==typeof t&&t>=0);var i=t%26,o=(t-i)/26,a=1<<i;return!(this.length<=o)&&!!(this.words[o]&a)},BN.prototype.imaskn=function imaskn(t){assert("number"==typeof t&&t>=0);var i=t%26,o=(t-i)/26;if(assert(0===this.negative,"imaskn works only with positive numbers"),this.length<=o)return this;if(0!==i&&o++,this.length=Math.min(o,this.length),0!==i){var a=67108863^67108863>>>i<<i;this.words[this.length-1]&=a}return this.strip()},BN.prototype.maskn=function maskn(t){return this.clone().imaskn(t)},BN.prototype.iaddn=function iaddn(t){return assert("number"==typeof t),assert(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},BN.prototype._iaddn=function _iaddn(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},BN.prototype.isubn=function isubn(t){if(assert("number"==typeof t),assert(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this.strip()},BN.prototype.addn=function addn(t){return this.clone().iaddn(t)},BN.prototype.subn=function subn(t){return this.clone().isubn(t)},BN.prototype.iabs=function iabs(){return this.negative=0,this},BN.prototype.abs=function abs(){return this.clone().iabs()},BN.prototype._ishlnsubmul=function _ishlnsubmul(t,i,o){var a,u,c=t.length+o;this._expand(c);var h=0;for(a=0;a<t.length;a++){u=(0|this.words[a+o])+h;var l=(0|t.words[a])*i;h=((u-=67108863&l)>>26)-(l/67108864|0),this.words[a+o]=67108863&u}for(;a<this.length-o;a++)h=(u=(0|this.words[a+o])+h)>>26,this.words[a+o]=67108863&u;if(0===h)return this.strip();for(assert(-1===h),h=0,a=0;a<this.length;a++)h=(u=-(0|this.words[a])+h)>>26,this.words[a]=67108863&u;return this.negative=1,this.strip()},BN.prototype._wordDiv=function _wordDiv(t,i){var o=(this.length,t.length),a=this.clone(),u=t,c=0|u.words[u.length-1];0!==(o=26-this._countBits(c))&&(u=u.ushln(o),a.iushln(o),c=0|u.words[u.length-1]);var h,l=a.length-u.length;if("mod"!==i){(h=new BN(null)).length=l+1,h.words=new Array(h.length);for(var d=0;d<h.length;d++)h.words[d]=0}var p=a.clone()._ishlnsubmul(u,1,l);0===p.negative&&(a=p,h&&(h.words[l]=1));for(var m=l-1;m>=0;m--){var g=67108864*(0|a.words[u.length+m])+(0|a.words[u.length+m-1]);for(g=Math.min(g/c|0,67108863),a._ishlnsubmul(u,g,m);0!==a.negative;)g--,a.negative=0,a._ishlnsubmul(u,1,m),a.isZero()||(a.negative^=1);h&&(h.words[m]=g)}return h&&h.strip(),a.strip(),"div"!==i&&0!==o&&a.iushrn(o),{div:h||null,mod:a}},BN.prototype.divmod=function divmod(t,i,o){return assert(!t.isZero()),this.isZero()?{div:new BN(0),mod:new BN(0)}:0!==this.negative&&0===t.negative?(c=this.neg().divmod(t,i),"mod"!==i&&(a=c.div.neg()),"div"!==i&&(u=c.mod.neg(),o&&0!==u.negative&&u.iadd(t)),{div:a,mod:u}):0===this.negative&&0!==t.negative?(c=this.divmod(t.neg(),i),"mod"!==i&&(a=c.div.neg()),{div:a,mod:c.mod}):0!=(this.negative&t.negative)?(c=this.neg().divmod(t.neg(),i),"div"!==i&&(u=c.mod.neg(),o&&0!==u.negative&&u.isub(t)),{div:c.div,mod:u}):t.length>this.length||this.cmp(t)<0?{div:new BN(0),mod:this}:1===t.length?"div"===i?{div:this.divn(t.words[0]),mod:null}:"mod"===i?{div:null,mod:new BN(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new BN(this.modn(t.words[0]))}:this._wordDiv(t,i);var a,u,c},BN.prototype.div=function div(t){return this.divmod(t,"div",!1).div},BN.prototype.mod=function mod(t){return this.divmod(t,"mod",!1).mod},BN.prototype.umod=function umod(t){return this.divmod(t,"mod",!0).mod},BN.prototype.divRound=function divRound(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var o=0!==i.div.negative?i.mod.isub(t):i.mod,a=t.ushrn(1),u=t.andln(1),c=o.cmp(a);return c<0||1===u&&0===c?i.div:0!==i.div.negative?i.div.isubn(1):i.div.iaddn(1)},BN.prototype.modn=function modn(t){assert(t<=67108863);for(var i=(1<<26)%t,o=0,a=this.length-1;a>=0;a--)o=(i*o+(0|this.words[a]))%t;return o},BN.prototype.idivn=function idivn(t){assert(t<=67108863);for(var i=0,o=this.length-1;o>=0;o--){var a=(0|this.words[o])+67108864*i;this.words[o]=a/t|0,i=a%t}return this.strip()},BN.prototype.divn=function divn(t){return this.clone().idivn(t)},BN.prototype.egcd=function egcd(t){assert(0===t.negative),assert(!t.isZero());var i=this,o=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var a=new BN(1),u=new BN(0),c=new BN(0),h=new BN(1),l=0;i.isEven()&&o.isEven();)i.iushrn(1),o.iushrn(1),++l;for(var d=o.clone(),p=i.clone();!i.isZero();){for(var m=0,g=1;0==(i.words[0]&g)&&m<26;++m,g<<=1);if(m>0)for(i.iushrn(m);m-- >0;)(a.isOdd()||u.isOdd())&&(a.iadd(d),u.isub(p)),a.iushrn(1),u.iushrn(1);for(var v=0,b=1;0==(o.words[0]&b)&&v<26;++v,b<<=1);if(v>0)for(o.iushrn(v);v-- >0;)(c.isOdd()||h.isOdd())&&(c.iadd(d),h.isub(p)),c.iushrn(1),h.iushrn(1);i.cmp(o)>=0?(i.isub(o),a.isub(c),u.isub(h)):(o.isub(i),c.isub(a),h.isub(u))}return{a:c,b:h,gcd:o.iushln(l)}},BN.prototype._invmp=function _invmp(t){assert(0===t.negative),assert(!t.isZero());var i=this,o=t.clone();i=0!==i.negative?i.umod(t):i.clone();for(var a,u=new BN(1),c=new BN(0),h=o.clone();i.cmpn(1)>0&&o.cmpn(1)>0;){for(var l=0,d=1;0==(i.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(i.iushrn(l);l-- >0;)u.isOdd()&&u.iadd(h),u.iushrn(1);for(var p=0,m=1;0==(o.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(o.iushrn(p);p-- >0;)c.isOdd()&&c.iadd(h),c.iushrn(1);i.cmp(o)>=0?(i.isub(o),u.isub(c)):(o.isub(i),c.isub(u))}return(a=0===i.cmpn(1)?u:c).cmpn(0)<0&&a.iadd(t),a},BN.prototype.gcd=function gcd(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),o=t.clone();i.negative=0,o.negative=0;for(var a=0;i.isEven()&&o.isEven();a++)i.iushrn(1),o.iushrn(1);for(;;){for(;i.isEven();)i.iushrn(1);for(;o.isEven();)o.iushrn(1);var u=i.cmp(o);if(u<0){var c=i;i=o,o=c}else if(0===u||0===o.cmpn(1))break;i.isub(o)}return o.iushln(a)},BN.prototype.invm=function invm(t){return this.egcd(t).a.umod(t)},BN.prototype.isEven=function isEven(){return 0==(1&this.words[0])},BN.prototype.isOdd=function isOdd(){return 1==(1&this.words[0])},BN.prototype.andln=function andln(t){return this.words[0]&t},BN.prototype.bincn=function bincn(t){assert("number"==typeof t);var i=t%26,o=(t-i)/26,a=1<<i;if(this.length<=o)return this._expand(o+1),this.words[o]|=a,this;for(var u=a,c=o;0!==u&&c<this.length;c++){var h=0|this.words[c];u=(h+=u)>>>26,h&=67108863,this.words[c]=h}return 0!==u&&(this.words[c]=u,this.length++),this},BN.prototype.isZero=function isZero(){return 1===this.length&&0===this.words[0]},BN.prototype.cmpn=function cmpn(t){var i,o=t<0;if(0!==this.negative&&!o)return-1;if(0===this.negative&&o)return 1;if(this.strip(),this.length>1)i=1;else{o&&(t=-t),assert(t<=67108863,"Number is too big");var a=0|this.words[0];i=a===t?0:a<t?-1:1}return 0!==this.negative?0|-i:i},BN.prototype.cmp=function cmp(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var i=this.ucmp(t);return 0!==this.negative?0|-i:i},BN.prototype.ucmp=function ucmp(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,o=this.length-1;o>=0;o--){var a=0|this.words[o],u=0|t.words[o];if(a!==u){a<u?i=-1:a>u&&(i=1);break}}return i},BN.prototype.gtn=function gtn(t){return 1===this.cmpn(t)},BN.prototype.gt=function gt(t){return 1===this.cmp(t)},BN.prototype.gten=function gten(t){return this.cmpn(t)>=0},BN.prototype.gte=function gte(t){return this.cmp(t)>=0},BN.prototype.ltn=function ltn(t){return-1===this.cmpn(t)},BN.prototype.lt=function lt(t){return-1===this.cmp(t)},BN.prototype.lten=function lten(t){return this.cmpn(t)<=0},BN.prototype.lte=function lte(t){return this.cmp(t)<=0},BN.prototype.eqn=function eqn(t){return 0===this.cmpn(t)},BN.prototype.eq=function eq(t){return 0===this.cmp(t)},BN.red=function red(t){return new Red(t)},BN.prototype.toRed=function toRed(t){return assert(!this.red,"Already a number in reduction context"),assert(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},BN.prototype.fromRed=function fromRed(){return assert(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},BN.prototype._forceRed=function _forceRed(t){return this.red=t,this},BN.prototype.forceRed=function forceRed(t){return assert(!this.red,"Already a number in reduction context"),this._forceRed(t)},BN.prototype.redAdd=function redAdd(t){return assert(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},BN.prototype.redIAdd=function redIAdd(t){return assert(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},BN.prototype.redSub=function redSub(t){return assert(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},BN.prototype.redISub=function redISub(t){return assert(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},BN.prototype.redShl=function redShl(t){return assert(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},BN.prototype.redMul=function redMul(t){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},BN.prototype.redIMul=function redIMul(t){return assert(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},BN.prototype.redSqr=function redSqr(){return assert(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},BN.prototype.redISqr=function redISqr(){return assert(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},BN.prototype.redSqrt=function redSqrt(){return assert(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},BN.prototype.redInvm=function redInvm(){return assert(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},BN.prototype.redNeg=function redNeg(){return assert(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},BN.prototype.redPow=function redPow(t){return assert(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var d={k256:null,p224:null,p192:null,p25519:null};function MPrime(t,i){this.name=t,this.p=new BN(i,16),this.n=this.p.bitLength(),this.k=new BN(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function K256(){MPrime.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function P224(){MPrime.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function P192(){MPrime.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function P25519(){MPrime.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function Red(t){if("string"==typeof t){var i=BN._prime(t);this.m=i.p,this.prime=i}else assert(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function Mont(t){Red.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new BN(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}MPrime.prototype._tmp=function _tmp(){var t=new BN(null);return t.words=new Array(Math.ceil(this.n/13)),t},MPrime.prototype.ireduce=function ireduce(t){var i,o=t;do{this.split(o,this.tmp),i=(o=(o=this.imulK(o)).iadd(this.tmp)).bitLength()}while(i>this.n);var a=i<this.n?-1:o.ucmp(this.p);return 0===a?(o.words[0]=0,o.length=1):a>0?o.isub(this.p):void 0!==o.strip?o.strip():o._strip(),o},MPrime.prototype.split=function split(t,i){t.iushrn(this.n,0,i)},MPrime.prototype.imulK=function imulK(t){return t.imul(this.k)},inherits(K256,MPrime),K256.prototype.split=function split(t,i){for(var o=Math.min(t.length,9),a=0;a<o;a++)i.words[a]=t.words[a];if(i.length=o,t.length<=9)return t.words[0]=0,void(t.length=1);var u=t.words[9];for(i.words[i.length++]=4194303&u,a=10;a<t.length;a++){var c=0|t.words[a];t.words[a-10]=(4194303&c)<<4|u>>>22,u=c}u>>>=22,t.words[a-10]=u,0===u&&t.length>10?t.length-=10:t.length-=9},K256.prototype.imulK=function imulK(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,o=0;o<t.length;o++){var a=0|t.words[o];i+=977*a,t.words[o]=67108863&i,i=64*a+(i/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},inherits(P224,MPrime),inherits(P192,MPrime),inherits(P25519,MPrime),P25519.prototype.imulK=function imulK(t){for(var i=0,o=0;o<t.length;o++){var a=19*(0|t.words[o])+i,u=67108863&a;a>>>=26,t.words[o]=u,i=a}return 0!==i&&(t.words[t.length++]=i),t},BN._prime=function prime(t){if(d[t])return d[t];var prime;if("k256"===t)prime=new K256;else if("p224"===t)prime=new P224;else if("p192"===t)prime=new P192;else{if("p25519"!==t)throw new Error("Unknown prime "+t);prime=new P25519}return d[t]=prime,prime},Red.prototype._verify1=function _verify1(t){assert(0===t.negative,"red works only with positives"),assert(t.red,"red works only with red numbers")},Red.prototype._verify2=function _verify2(t,i){assert(0==(t.negative|i.negative),"red works only with positives"),assert(t.red&&t.red===i.red,"red works only with red numbers")},Red.prototype.imod=function imod(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},Red.prototype.neg=function neg(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Red.prototype.add=function add(t,i){this._verify2(t,i);var o=t.add(i);return o.cmp(this.m)>=0&&o.isub(this.m),o._forceRed(this)},Red.prototype.iadd=function iadd(t,i){this._verify2(t,i);var o=t.iadd(i);return o.cmp(this.m)>=0&&o.isub(this.m),o},Red.prototype.sub=function sub(t,i){this._verify2(t,i);var o=t.sub(i);return o.cmpn(0)<0&&o.iadd(this.m),o._forceRed(this)},Red.prototype.isub=function isub(t,i){this._verify2(t,i);var o=t.isub(i);return o.cmpn(0)<0&&o.iadd(this.m),o},Red.prototype.shl=function shl(t,i){return this._verify1(t),this.imod(t.ushln(i))},Red.prototype.imul=function imul(t,i){return this._verify2(t,i),this.imod(t.imul(i))},Red.prototype.mul=function mul(t,i){return this._verify2(t,i),this.imod(t.mul(i))},Red.prototype.isqr=function isqr(t){return this.imul(t,t.clone())},Red.prototype.sqr=function sqr(t){return this.mul(t,t)},Red.prototype.sqrt=function sqrt(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(assert(i%2==1),3===i){var o=this.m.add(new BN(1)).iushrn(2);return this.pow(t,o)}for(var a=this.m.subn(1),u=0;!a.isZero()&&0===a.andln(1);)u++,a.iushrn(1);assert(!a.isZero());var c=new BN(1).toRed(this),h=c.redNeg(),l=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new BN(2*d*d).toRed(this);0!==this.pow(d,l).cmp(h);)d.redIAdd(h);for(var p=this.pow(d,a),m=this.pow(t,a.addn(1).iushrn(1)),g=this.pow(t,a),v=u;0!==g.cmp(c);){for(var b=g,w=0;0!==b.cmp(c);w++)b=b.redSqr();assert(w<v);var _=this.pow(p,new BN(1).iushln(v-w-1));m=m.redMul(_),p=_.redSqr(),g=g.redMul(p),v=w}return m},Red.prototype.invm=function invm(t){var i=t._invmp(this.m);return 0!==i.negative?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},Red.prototype.pow=function pow(t,i){if(i.isZero())return new BN(1).toRed(this);if(0===i.cmpn(1))return t.clone();var o=new Array(16);o[0]=new BN(1).toRed(this),o[1]=t;for(var a=2;a<o.length;a++)o[a]=this.mul(o[a-1],t);var u=o[0],c=0,h=0,l=i.bitLength()%26;for(0===l&&(l=26),a=i.length-1;a>=0;a--){for(var d=i.words[a],p=l-1;p>=0;p--){var m=d>>p&1;u!==o[0]&&(u=this.sqr(u)),0!==m||0!==c?(c<<=1,c|=m,(4===++h||0===a&&0===p)&&(u=this.mul(u,o[c]),h=0,c=0)):h=0}l=26}return u},Red.prototype.convertTo=function convertTo(t){var i=t.umod(this.m);return i===t?i.clone():i},Red.prototype.convertFrom=function convertFrom(t){var i=t.clone();return i.red=null,i},BN.mont=function mont(t){return new Mont(t)},inherits(Mont,Red),Mont.prototype.convertTo=function convertTo(t){return this.imod(t.ushln(this.shift))},Mont.prototype.convertFrom=function convertFrom(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},Mont.prototype.imul=function imul(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var o=t.imul(i),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=o.isub(a).iushrn(this.shift),c=u;return u.cmp(this.m)>=0?c=u.isub(this.m):u.cmpn(0)<0&&(c=u.iadd(this.m)),c._forceRed(this)},Mont.prototype.mul=function mul(t,i){if(t.isZero()||i.isZero())return new BN(0)._forceRed(this);var o=t.mul(i),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),u=o.isub(a).iushrn(this.shift),c=u;return u.cmp(this.m)>=0?c=u.isub(this.m):u.cmpn(0)<0&&(c=u.iadd(this.m)),c._forceRed(this)},Mont.prototype.invm=function invm(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,o(60)(t))},function(t,i){},function(t,i,o){i.publicEncrypt=o(753),i.privateDecrypt=o(755),i.privateEncrypt=function privateEncrypt(t,o){return i.publicEncrypt(t,o,!0)},i.publicDecrypt=function publicDecrypt(t,o){return i.privateDecrypt(t,o,!0)}},function(t,i,o){var a=o(129),u=o(85),c=o(98),h=o(307),l=o(308),d=o(190),p=o(309),m=o(181),g=o(4).Buffer;t.exports=function publicEncrypt(t,i,o){var v;v=t.padding?t.padding:o?1:4;var b,w=a(t);if(4===v)b=function oaep(t,i){var o=t.modulus.byteLength(),a=i.length,p=c("sha1").update(g.alloc(0)).digest(),m=p.length,v=2*m;if(a>o-v-2)throw new Error("message too long");var b=g.alloc(o-a-v-2),w=o-m-1,_=u(m),M=l(g.concat([p,b,g.alloc(1,1),i],w),h(_,w)),k=l(_,h(M,m));return new d(g.concat([g.alloc(1),k,M],o))}(w,i);else if(1===v)b=function pkcs1(t,i,o){var a,c=i.length,h=t.modulus.byteLength();if(c>h-11)throw new Error("message too long");a=o?g.alloc(h-c-3,255):function nonZero(t){var i,o=g.allocUnsafe(t),a=0,c=u(2*t),h=0;for(;a<t;)h===c.length&&(c=u(2*t),h=0),(i=c[h++])&&(o[a++]=i);return o}(h-c-3);return new d(g.concat([g.from([0,o?1:2]),a,g.alloc(1),i],h))}(w,i,o);else{if(3!==v)throw new Error("unknown padding");if((b=new d(i)).cmp(w.modulus)>=0)throw new Error("data too long for modulus")}return o?m(b,w):p(b,w)}},function(t,i){},function(t,i,o){var a=o(129),u=o(307),c=o(308),h=o(190),l=o(181),d=o(98),p=o(309),m=o(4).Buffer;t.exports=function privateDecrypt(t,i,o){var g;g=t.padding?t.padding:o?1:4;var v,b=a(t),w=b.modulus.byteLength();if(i.length>w||new h(i).cmp(b.modulus)>=0)throw new Error("decryption error");v=o?p(new h(i),b):l(i,b);var _=m.alloc(w-v.length);if(v=m.concat([_,v],w),4===g)return function oaep(t,i){var o=t.modulus.byteLength(),a=d("sha1").update(m.alloc(0)).digest(),h=a.length;if(0!==i[0])throw new Error("decryption error");var l=i.slice(1,h+1),p=i.slice(h+1),g=c(l,u(p,h)),v=c(p,u(g,o-h-1));if(function compare(t,i){t=m.from(t),i=m.from(i);var o=0,a=t.length;t.length!==i.length&&(o++,a=Math.min(t.length,i.length));var u=-1;for(;++u<a;)o+=t[u]^i[u];return o}(a,v.slice(0,h)))throw new Error("decryption error");var b=h;for(;0===v[b];)b++;if(1!==v[b++])throw new Error("decryption error");return v.slice(b)}(b,v);if(1===g)return function pkcs1(t,i,o){var a=i.slice(0,2),u=2,c=0;for(;0!==i[u++];)if(u>=i.length){c++;break}var h=i.slice(2,u-1);("0002"!==a.toString("hex")&&!o||"0001"!==a.toString("hex")&&o)&&c++;h.length<8&&c++;if(c)throw new Error("decryption error");return i.slice(u)}(0,v,o);if(3===g)return v;throw new Error("unknown padding")}},function(t,i,o){"use strict";(function(t,a){function oldBrowser(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var u=o(4),c=o(85),h=u.Buffer,l=u.kMaxLength,d=t.crypto||t.msCrypto,p=Math.pow(2,32)-1;function assertOffset(t,i){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>p||t<0)throw new TypeError("offset must be a uint32");if(t>l||t>i)throw new RangeError("offset out of range")}function assertSize(t,i,o){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>p||t<0)throw new TypeError("size must be a uint32");if(t+i>o||t>l)throw new RangeError("buffer too small")}function actualFill(t,i,o,u){if(a.browser){var h=t.buffer,l=new Uint8Array(h,i,o);return d.getRandomValues(l),u?void a.nextTick((function(){u(null,t)})):t}if(!u)return c(o).copy(t,i),t;c(o,(function(o,a){if(o)return u(o);a.copy(t,i),u(null,t)}))}d&&d.getRandomValues||!a.browser?(i.randomFill=function randomFill(i,o,a,u){if(!(h.isBuffer(i)||i instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof o)u=o,o=0,a=i.length;else if("function"==typeof a)u=a,a=i.length-o;else if("function"!=typeof u)throw new TypeError('"cb" argument must be a function');return assertOffset(o,i.length),assertSize(a,o,i.length),actualFill(i,o,a,u)},i.randomFillSync=function randomFillSync(i,o,a){void 0===o&&(o=0);if(!(h.isBuffer(i)||i instanceof t.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');assertOffset(o,i.length),void 0===a&&(a=i.length-o);return assertSize(a,o,i.length),actualFill(i,o,a)}):(i.randomFill=oldBrowser,i.randomFillSync=oldBrowser)}).call(this,o(17),o(11))},function(t,i,o){var a,u,c,h;t.exports=(a=o(170),c=(u=a).lib.Base,h=u.enc.Utf8,void(u.algo.HMAC=c.extend({init:function(t,i){t=this._hasher=new t.init,"string"==typeof i&&(i=h.parse(i));var o=t.blockSize,a=4*o;i.sigBytes>a&&(i=t.finalize(i)),i.clamp();for(var u=this._oKey=i.clone(),c=this._iKey=i.clone(),l=u.words,d=c.words,p=0;p<o;p++)l[p]^=1549556828,d[p]^=909522486;u.sigBytes=c.sigBytes=a,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var i=this._hasher,o=i.finalize(t);return i.reset(),i.finalize(this._oKey.clone().concat(o))}})))},function(t,i){t.exports={INVALID_CONNECT_OPTIONS:"Invalid connect options supplied.",INVALID_CLIENT_ID_OPTION:'Invalid "clientId" (mqtt client id) option supplied.',INVALID_RECONNECT_TIMING:"Invalid reconnect timing options supplied.",INVALID_OFFLINE_QUEUEING_PARAMETERS:"Invalid offline queueing options supplied."}},function(t,i,o){(function(i){var a=o(191),u=o(130),c=o(760);t.exports=function(t){if(u(t.keyPath)&&u(t.privateKey))throw new Error(c.NO_KEY_OPTION);if(u(t.certPath)&&u(t.clientCert))throw new Error(c.NO_CERT_OPTION);if(u(t.caPath)&&u(t.caCert))throw new Error(c.NO_CA_OPTION);if(!u(t.caCert))if(i.isBuffer(t.caCert))t.ca=t.caCert;else{if(!a.existsSync(t.caCert))throw new Error(c.INVALID_CA_CERT_OPTION);t.ca=a.readFileSync(t.caCert)}if(!u(t.privateKey))if(i.isBuffer(t.privateKey))t.key=t.privateKey;else{if(!a.existsSync(t.privateKey))throw new Error(c.INVALID_PRIVATE_KEY_OPTION);t.key=a.readFileSync(t.privateKey)}if(!u(t.clientCert))if(i.isBuffer(t.clientCert))t.cert=t.clientCert;else{if(!a.existsSync(t.clientCert))throw new Error(c.INVALID_CLIENT_CERT_OPTION);t.cert=a.readFileSync(t.clientCert)}if(a.existsSync(t.keyPath))t.key=a.readFileSync(t.keyPath);else if(!u(t.keyPath))throw new Error(c.INVALID_KEY_PATH_OPTION);if(a.existsSync(t.certPath))t.cert=a.readFileSync(t.certPath);else if(!u(t.certPath))throw new Error(c.INVALID_CERT_PATH_OPTION);if(a.existsSync(t.caPath))t.ca=a.readFileSync(t.caPath);else if(!u(t.caPath))throw new Error(c.INVALID_CA_PATH_OPTION);t.requestCert=!0,t.rejectUnauthorized=!0}}).call(this,o(10).Buffer)},function(t,i){t.exports={NO_KEY_OPTION:'No "keyPath" or "privateKey" option supplied.',NO_CERT_OPTION:'No "certPath" or "clientCert" option supplied.',NO_CA_OPTION:'No "caPath" or "caCert" option supplied.',INVALID_KEY_PATH_OPTION:'Invalid "keyPath" option supplied.',INVALID_CERT_PATH_OPTION:'Invalid "certPath" option supplied.',INVALID_CA_PATH_OPTION:'Invalid "caPath" option supplied.',INVALID_CLIENT_CERT_OPTION:'Invalid "clientCert" option supplied.',INVALID_PRIVATE_KEY_OPTION:'Invalid "privateKey" option supplied.',INVALID_CA_CERT_OPTION:'Invalid "caCert" option supplied.'}},function(t,i,o){(function(t){function normalizeArray(t,i){for(var o=0,a=t.length-1;a>=0;a--){var u=t[a];"."===u?t.splice(a,1):".."===u?(t.splice(a,1),o++):o&&(t.splice(a,1),o--)}if(i)for(;o--;o)t.unshift("..");return t}function filter(t,i){if(t.filter)return t.filter(i);for(var o=[],a=0;a<t.length;a++)i(t[a],a,t)&&o.push(t[a]);return o}i.resolve=function(){for(var i="",o=!1,a=arguments.length-1;a>=-1&&!o;a--){var u=a>=0?arguments[a]:t.cwd();if("string"!=typeof u)throw new TypeError("Arguments to path.resolve must be strings");u&&(i=u+"/"+i,o="/"===u.charAt(0))}return(o?"/":"")+(i=normalizeArray(filter(i.split("/"),(function(t){return!!t})),!o).join("/"))||"."},i.normalize=function(t){var a=i.isAbsolute(t),u="/"===o(t,-1);return(t=normalizeArray(filter(t.split("/"),(function(t){return!!t})),!a).join("/"))||a||(t="."),t&&u&&(t+="/"),(a?"/":"")+t},i.isAbsolute=function(t){return"/"===t.charAt(0)},i.join=function(){var t=Array.prototype.slice.call(arguments,0);return i.normalize(filter(t,(function(t,i){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))},i.relative=function(t,o){function trim(t){for(var i=0;i<t.length&&""===t[i];i++);for(var o=t.length-1;o>=0&&""===t[o];o--);return i>o?[]:t.slice(i,o-i+1)}t=i.resolve(t).substr(1),o=i.resolve(o).substr(1);for(var a=trim(t.split("/")),u=trim(o.split("/")),c=Math.min(a.length,u.length),h=c,l=0;l<c;l++)if(a[l]!==u[l]){h=l;break}var d=[];for(l=h;l<a.length;l++)d.push("..");return(d=d.concat(u.slice(h))).join("/")},i.sep="/",i.delimiter=":",i.dirname=function(t){if("string"!=typeof t&&(t+=""),0===t.length)return".";for(var i=t.charCodeAt(0),o=47===i,a=-1,u=!0,c=t.length-1;c>=1;--c)if(47===(i=t.charCodeAt(c))){if(!u){a=c;break}}else u=!1;return-1===a?o?"/":".":o&&1===a?"/":t.slice(0,a)},i.basename=function(t,i){var o=function basename(t){"string"!=typeof t&&(t+="");var i,o=0,a=-1,u=!0;for(i=t.length-1;i>=0;--i)if(47===t.charCodeAt(i)){if(!u){o=i+1;break}}else-1===a&&(u=!1,a=i+1);return-1===a?"":t.slice(o,a)}(t);return i&&o.substr(-1*i.length)===i&&(o=o.substr(0,o.length-i.length)),o},i.extname=function(t){"string"!=typeof t&&(t+="");for(var i=-1,o=0,a=-1,u=!0,c=0,h=t.length-1;h>=0;--h){var l=t.charCodeAt(h);if(47!==l)-1===a&&(u=!1,a=h+1),46===l?-1===i?i=h:1!==c&&(c=1):-1!==i&&(c=-1);else if(!u){o=h+1;break}}return-1===i||-1===a||0===c||1===c&&i===a-1&&i===o+1?"":t.slice(i,a)};var o="b"==="ab".substr(-1)?function(t,i,o){return t.substr(i,o)}:function(t,i,o){return i<0&&(i=t.length+i),t.substr(i,o)}}).call(this,o(11))},function(t){t.exports=JSON.parse('{"name":"aws-iot-device-sdk","description":"AWS IoT Node.js SDK for Embedded Devices","version":"2.2.12","author":{"name":"Amazon Web Services","email":"","url":"http://aws.amazon.com"},"homepage":"https://github.com/aws/aws-iot-device-sdk-js","main":"index.js","engines":{"node":">=4.0.0"},"repository":{"type":"git","url":"git://github.com/aws/aws-iot-device-sdk-js"},"bugs":{"url":"http://github.com/aws/aws-iot-device-sdk-js/issues"},"license":"Apache-2.0","keywords":["api","amazon","aws","iot","mqtt"],"dependencies":{"crypto-js":"4.0.0","minimist":"1.2.6","mqtt":"4.2.8","websocket-stream":"^5.5.2"},"devDependencies":{"gulp":"^3.9.0","gulp-beautify":"^2.0.0","gulp-concat":"^2.6.0","gulp-coverage":"^0.3.38","gulp-jscs":"^4.0.0","gulp-jshint":"^2.0.0","gulp-mocha":"^3.0.1","jshint":"^2.9.1","jshint-stylish":"^2.2.1","rewire":"^2.5.1","sinon":"^1.17.3"},"scripts":{"test":"node ./node_modules/gulp/bin/gulp.js test --verbose","browserize":"./scripts/browserize.sh","beautify":"node ./node_modules/gulp/bin/gulp.js beautify"}}')},function(t,i,o){var a=o(191);t.exports=function buildBuilder(t,i){var o;function handleTLSerrors(i){t.emit("error",i),o.end()}return(o=a.connect(i)).on("secureConnect",(function(){o.authorized?o.removeListener("error",handleTLSerrors):o.emit("error",new Error("TLS not authorized"))})),o.on("error",handleTLSerrors),o}},function(t,i,o){const a=o(765);t.exports=function buildBuilder(t,i){return a(i.url,["mqttv3.1"],i.websocketOptions)}},function(t,i,o){"use strict";(function(i,a){var u=o(311).Transform,c=o(770),h=o(771),l=o(4).Buffer;t.exports=function WebSocketStream(t,o,d){var p,m,g="browser"===i.title,v=!!a.WebSocket,b=g?function socketWriteBrowser(t,i,o){if(m.bufferedAmount>_)return void setTimeout(socketWriteBrowser,M,t,i,o);B&&"string"==typeof t&&(t=l.from(t,"utf8"));try{m.send(t)}catch(t){return o(t)}o()}:function socketWriteNode(t,i,o){if(m.readyState!==m.OPEN)return void o();B&&"string"==typeof t&&(t=l.from(t,"utf8"));m.send(t,o)};o&&!Array.isArray(o)&&"object"==typeof o&&(d=o,o=null,("string"==typeof d.protocol||Array.isArray(d.protocol))&&(o=d.protocol));d||(d={});void 0===d.objectMode&&(d.objectMode=!(!0===d.binary||void 0===d.binary));var w=function buildProxy(t,i,o){var a=new u({objectMode:t.objectMode});return a._write=i,a._flush=o,a}(d,b,(function socketEnd(t){m.close(),t()}));d.objectMode||(w._writev=writev);var _=d.browserBufferSize||524288,M=d.browserBufferTimeout||1e3;"object"==typeof t?m=t:(m=v&&g?new h(t,o):new h(t,o,d)).binaryType="arraybuffer";var k=void 0===m.addEventListener;m.readyState===m.OPEN?p=w:(p=p=c(void 0,void 0,d),d.objectMode||(p._writev=writev),k?m.addEventListener("open",onopen):m.onopen=onopen);p.socket=m,k?(m.addEventListener("close",onclose),m.addEventListener("error",onerror),m.addEventListener("message",onmessage)):(m.onclose=onclose,m.onerror=onerror,m.onmessage=onmessage);w.on("close",(function destroy(){m.close()}));var B=!d.objectMode;function onopen(){p.setReadable(w),p.setWritable(w),p.emit("connect")}function onclose(){p.end(),p.destroy()}function onerror(t){p.destroy(t)}function onmessage(t){var i=t.data;i=i instanceof ArrayBuffer?l.from(i):l.from(i,"utf8"),w.push(i)}function writev(t,i){for(var o=new Array(t.length),a=0;a<t.length;a++)"string"==typeof t[a].chunk?o[a]=l.from(t[a],"utf8"):o[a]=t[a].chunk;this._write(l.concat(o),"binary",i)}return p}}).call(this,o(11),o(17))},function(t,i){},function(t,i,o){"use strict";var a=o(4).Buffer,u=o(768);t.exports=function(){function BufferList(){!function _classCallCheck(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}(this,BufferList),this.head=null,this.tail=null,this.length=0}return BufferList.prototype.push=function push(t){var i={data:t,next:null};this.length>0?this.tail.next=i:this.head=i,this.tail=i,++this.length},BufferList.prototype.unshift=function unshift(t){var i={data:t,next:this.head};0===this.length&&(this.tail=i),this.head=i,++this.length},BufferList.prototype.shift=function shift(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},BufferList.prototype.clear=function clear(){this.head=this.tail=null,this.length=0},BufferList.prototype.join=function join(t){if(0===this.length)return"";for(var i=this.head,o=""+i.data;i=i.next;)o+=t+i.data;return o},BufferList.prototype.concat=function concat(t){if(0===this.length)return a.alloc(0);if(1===this.length)return this.head.data;for(var i,o,u,c=a.allocUnsafe(t>>>0),h=this.head,l=0;h;)i=h.data,o=c,u=l,i.copy(o,u),l+=h.data.length,h=h.next;return c},BufferList}(),u&&u.inspect&&u.inspect.custom&&(t.exports.prototype[u.inspect.custom]=function(){var t=u.inspect({length:this.length});return this.constructor.name+" "+t})},function(t,i){},function(t,i,o){"use strict";t.exports=PassThrough;var a=o(316),u=Object.create(o(41));function PassThrough(t){if(!(this instanceof PassThrough))return new PassThrough(t);a.call(this,t)}u.inherits=o(1),u.inherits(PassThrough,a),PassThrough.prototype._transform=function(t,i,o){o(null,t)}},function(t,i,o){(function(i,a){var u=o(311),c=o(265),h=o(1),l=o(266),d=i.from&&i.from!==Uint8Array.from?i.from([0]):new i([0]),onuncork=function(t,i){t._corked?t.once("uncork",i):i()},destroyer=function(t,i){return function(o){o?function(t,i){t._autoDestroy&&t.destroy(i)}(t,"premature close"===o.message?null:o):i&&!t._ended&&t.end()}},Duplexify=function(t,i,o){if(!(this instanceof Duplexify))return new Duplexify(t,i,o);u.Duplex.call(this,o),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!o||!1!==o.autoDestroy,this._forwardDestroy=!o||!1!==o.destroy,this._forwardEnd=!o||!1!==o.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,t&&this.setWritable(t),i&&this.setReadable(i)};h(Duplexify,u.Duplex),Duplexify.obj=function(t,i,o){return o||(o={}),o.objectMode=!0,o.highWaterMark=16,new Duplexify(t,i,o)},Duplexify.prototype.cork=function(){1==++this._corked&&this.emit("cork")},Duplexify.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},Duplexify.prototype.setWritable=function(t){if(this._unwrite&&this._unwrite(),this.destroyed)t&&t.destroy&&t.destroy();else if(null!==t&&!1!==t){var i=this,o=c(t,{writable:!0,readable:!1},destroyer(this,this._forwardEnd)),ondrain=function(){var t=i._ondrain;i._ondrain=null,t&&t()};this._unwrite&&a.nextTick(ondrain),this._writable=t,this._writable.on("drain",ondrain),this._unwrite=function(){i._writable.removeListener("drain",ondrain),o()},this.uncork()}else this.end()},Duplexify.prototype.setReadable=function(t){if(this._unread&&this._unread(),this.destroyed)t&&t.destroy&&t.destroy();else{if(null===t||!1===t)return this.push(null),void this.resume();var i,o=this,a=c(t,{writable:!1,readable:!0},destroyer(this)),onreadable=function(){o._forward()},onend=function(){o.push(null)};this._drained=!0,this._readable=t,this._readable2=t._readableState?t:(i=t,new u.Readable({objectMode:!0,highWaterMark:16}).wrap(i)),this._readable2.on("readable",onreadable),this._readable2.on("end",onend),this._unread=function(){o._readable2.removeListener("readable",onreadable),o._readable2.removeListener("end",onend),a()},this._forward()}},Duplexify.prototype._read=function(){this._drained=!0,this._forward()},Duplexify.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var t;for(this._forwarding=!0;this._drained&&null!==(t=l(this._readable2));)this.destroyed||(this._drained=this.push(t));this._forwarding=!1}},Duplexify.prototype.destroy=function(t){if(!this.destroyed){this.destroyed=!0;var i=this;a.nextTick((function(){i._destroy(t)}))}},Duplexify.prototype._destroy=function(t){if(t){var i=this._ondrain;this._ondrain=null,i?i(t):this.emit("error",t)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},Duplexify.prototype._write=function(t,i,o){return this.destroyed?o():this._corked?onuncork(this,this._write.bind(this,t,i,o)):t===d?this._finish(o):this._writable?void(!1===this._writable.write(t)?this._ondrain=o:o()):o()},Duplexify.prototype._finish=function(t){var i=this;this.emit("preend"),onuncork(this,(function(){var o,a;o=i._forwardEnd&&i._writable,a=function(){!1===i._writableState.prefinished&&(i._writableState.prefinished=!0),i.emit("prefinish"),onuncork(i,t)},o?o._writableState&&o._writableState.finished?a():o._writableState?o.end(a):(o.end(),a()):a()}))},Duplexify.prototype.end=function(t,i,o){return"function"==typeof t?this.end(null,null,t):"function"==typeof i?this.end(t,null,i):(this._ended=!0,t&&this.write(t),this._writableState.ending||this.write(d),u.Writable.prototype.end.call(this,o))},t.exports=Duplexify}).call(this,o(10).Buffer,o(11))},function(t,i){var o=null;"undefined"!=typeof WebSocket?o=WebSocket:"undefined"!=typeof MozWebSocket?o=MozWebSocket:"undefined"!=typeof window&&(o=window.WebSocket||window.MozWebSocket),t.exports=o},function(t,i,o){var a=o(31),u=o(164).inherits,c=o(163),h=o(130);function buildThingShadowTopic(t,i,o){return h(o)?"$aws/things/"+t+"/shadow/"+i:"$aws/things/"+t+"/shadow/"+i+"/"+o}function ThingShadowsClient(t,i){if(!(this instanceof ThingShadowsClient))return new ThingShadowsClient(t,i);var o=this,u=[{}],l=0,d=1e4,p=!0,m=c.DeviceClient(t);h(i)||h(i.operationTimeout)||(d=i.operationTimeout),this._handleSubscriptions=function(t,i,o,a){for(var c=[],l=0,d=i.length;l<d;l++)for(var p=0,g=i[l].operations.length;p<g;p++)for(var v=0,b=i[l].statii.length;v<b;v++)c.push(buildThingShadowTopic(t,i[l].operations[p],i[l].statii[v]));!0===u[t].debug&&console.log(o+" on "+c);var w=[];w.push(c),"subscribe"===o?(w.push({qos:u[t].qos}),w.push((function(t,i){if(!h(a)){if(t)return void a(t);for(var o=[],u=0,c=i.length;u<c;u++)128===i[u].qos&&o.push(i[u]);if(o.length>0)return void a("Not all subscriptions were granted",o);a()}}))):h(a)||w.push(a),m[o].apply(m,w)},this._handleMessages=function(i,o,a,c){var l={};try{l=JSON.parse(c.toString())}catch(i){return void(!0===t.debug&&console.error("failed parsing JSON '"+c.toString()+"', "+i))}var d=l.clientToken,p=l.version;if(delete l.clientToken,!h(p)&&"rejected"!==a)if(h(u[i].version)||p>=u[i].version)u[i].version=p;else if("delete"!==o&&!0===u[i].discardStale)return void(!0===t.debug&&console.warn("out-of-date version '"+p+"' on '"+i+"' (local version '"+u[i].version+"')"));"delta"!==a?h(u[i].clientToken)||u[i].clientToken!==d?"accepted"===a&&"get"!==o&&this.emit("foreignStateChange",i,o,l):(clearTimeout(u[i].timeout),delete u[i].timeout,delete u[i].clientToken,u[i].pending=!1,!1===u[i].persistentSubscribe&&this._handleSubscriptions(i,[{operations:[o],statii:["accepted","rejected"]}],"unsubscribe"),this.emit("status",i,a,d,l)):this.emit("delta",i,l)},m.on("connect",(function(){o.emit("connect")})),m.on("close",(function(){o.emit("close")})),m.on("reconnect",(function(){o.emit("reconnect")})),m.on("offline",(function(){o.emit("offline")})),m.on("error",(function(t){o.emit("error",t)})),m.on("packetsend",(function(t){o.emit("packetsend",t)})),m.on("packetreceive",(function(t){o.emit("packetreceive",t)})),m.on("message",(function(t,i){if(!0===p){var a=t.split("/");!function isThingShadowTopic(t,i){var o=!1;return"$aws"===t[0]&&("things"!==t[1]||"shadow"!==t[3]||"update"!==t[4]&&"get"!==t[4]&&"delete"!==t[4]||("subscribe"===i?"accepted"!==t[5]&&"rejected"!==t[5]&&"delta"!==t[5]||6!==t.length||(o=!0):5===t.length&&(o=!0))),o}(a,"subscribe")?o.emit("message",t,i):u.hasOwnProperty(a[2])&&o._handleMessages(a[2],a[4],a[5],i)}})),this._thingOperation=function(i,a,c){var p=null;if(u.hasOwnProperty(i))if(!1===u[i].pending){var g;if(u[i].pending=!0,h(c.clientToken)){var v=t.clientId.length;g=v>48?t.clientId.substr(v-48)+"-"+l++:t.clientId+"-"+l++}else g=c.clientToken;u[i].clientToken=g;var b=buildThingShadowTopic(i,a);u[i].timeout=setTimeout((function(t,i){!1===u[t].persistentSubscribe&&o._handleSubscriptions(t,[{operations:[a],statii:["accepted","rejected"]}],"unsubscribe"),u[t].pending=!1,delete u[t].timeout,delete u[t].clientToken,o.emit("timeout",t,i)}),d,i,g),!1===u[i].persistentSubscribe?this._handleSubscriptions(i,[{operations:[a],statii:["accepted","rejected"]}],"subscribe",(function(t,o){h(t)&&h(o)?h(c)||(!h(u[i].version)&&u[i].enableVersioning&&(c.version=u[i].version),c.clientToken=g,m.publish(b,JSON.stringify(c),{qos:u[i].qos}),h(u[i])||!0!==u[i].debug||console.log("publishing '"+JSON.stringify(c)+" on '"+b+"'")):console.warn("failed subscription to accepted/rejected topics")})):(!h(u[i].version)&&u[i].enableVersioning&&(c.version=u[i].version),c.clientToken=g,m.publish(b,JSON.stringify(c),{qos:u[i].qos}),!0===u[i].debug&&console.log("publishing '"+JSON.stringify(c)+" on '"+b+"'")),p=g}else!0===t.debug&&console.error(a+" still in progress on thing: ",i);else!0===t.debug&&console.error("attempting to "+a+" unknown thing: ",i);return p},this.register=function(i,o,a){if(u.hasOwnProperty(i))!0===t.debug&&console.error("thing already registered: ",i);else{var c=!1,l=[];u[i]={persistentSubscribe:!0,debug:!1,discardStale:!0,enableVersioning:!0,qos:0,pending:!0},"function"==typeof o&&(a=o,o=null),h(o)||(h(o.ignoreDeltas)||(c=o.ignoreDeltas),h(o.persistentSubscribe)||(u[i].persistentSubscribe=o.persistentSubscribe),h(o.debug)||(u[i].debug=o.debug),h(o.discardStale)||(u[i].discardStale=o.discardStale),h(o.enableVersioning)||(u[i].enableVersioning=o.enableVersioning),h(o.qos)||(u[i].qos=o.qos)),!1===c&&l.push({operations:["update"],statii:["delta"]}),!0===u[i].persistentSubscribe&&l.push({operations:["update","get","delete"],statii:["accepted","rejected"]}),l.length>0?this._handleSubscriptions(i,l,"subscribe",(function(t,o){h(t)&&h(o)&&(u[i].pending=!1),h(a)||a(t,o)})):(u[i].pending=!1,h(a)||a())}},this.unregister=function(i){if(u.hasOwnProperty(i)){var o=[];o.push({operations:["update"],statii:["delta"]}),!0===u[i].persistentSubscribe&&o.push({operations:["update","get","delete"],statii:["accepted","rejected"]}),this._handleSubscriptions(i,o,"unsubscribe"),h(u[i].timeout)||clearTimeout(u[i].timeout),delete u[i]}else!0===t.debug&&console.error("attempting to unregister unknown thing: ",i)},this.update=function(t,i){var a=null;return h(i.version)?a=o._thingOperation(t,"update",i):console.error("message can't contain 'version' property"),a},this.get=function(t,i){var a={};return h(i)||(a.clientToken=i),o._thingOperation(t,"get",a)},this.delete=function(t,i){var a={};return h(i)||(a.clientToken=i),o._thingOperation(t,"delete",a)},this.publish=function(t,i,o,a){m.publish(t,i,o,a)},this.subscribe=function(t,i,o){var a=[];"string"==typeof t?a.push(t):"object"==typeof t&&t.length&&(a=t),m.subscribe(a,i,o)},this.unsubscribe=function(t,i){var o=[];"string"==typeof t?o.push(t):"object"==typeof t&&t.length&&(o=t),m.unsubscribe(o,i)},this.end=function(t,i){m.end(t,i)},this.updateWebSocketCredentials=function(t,i,o,a){m.updateWebSocketCredentials(t,i,o,a)},this.updateCustomAuthHeaders=function(t){m.updateCustomAuthHeaders(t)},this.setConnectionStatus=function(t){p=t},a.EventEmitter.call(this)}u(ThingShadowsClient,a.EventEmitter),t.exports=ThingShadowsClient},function(t,i,o){var a=o(31),u=o(164).inherits,c=o(163),h=o(130);function buildJobTopic(t,i,o){var a="$aws/things/"+t+"/jobs/";return h(o)?o=i:a+=i.toString()+"/",a+=o}function jobsClient(t){if(!(this instanceof jobsClient))return new jobsClient(t);var i=this,o=[],a=c.DeviceClient(t);this._updateJobStatus=function(i,o,u,c,l){"function"==typeof c&&(l=c,c=void 0),h(t)||!0!==t.debug||console.log("updateJobStatus:",{thingName:i,jobId:o.id,status:u,statusDetails:c}),a.publish(buildJobTopic(i,o.id,"update"),JSON.stringify({status:u,statusDetails:c}),null,(function(t){h(t)&&(o.status={status:u,statusDetails:c}),h(l)||l(t)}))},this._buildJobObject=function(t,o){if(h(o)||h(o.jobId))return null;var a={};return a.id=o.jobId,a.document=o.jobDocument,a.operation=a.document.operation,a.status={status:o.status,statusDetails:o.statusDetails},a.inProgress=function(o,u){i._updateJobStatus(t,a,"IN_PROGRESS",o,u)},a.failed=function(o,u){i._updateJobStatus(t,a,"FAILED",o,u)},a.succeeded=function(o,u){i._updateJobStatus(t,a,"SUCCEEDED",o,u)},a},this._handleMessages=function(a,u){var c=a.split("/");if(function isJobTopic(t){return"$aws"===t[0]&&"things"===t[1]&&"jobs"===t[3]}(c)){var l=c[2],d=o.find((function(t){return t.thingName===l}));if(!h(d)){var p={};try{p=JSON.parse(u.toString())}catch(i){return void(!0===t.debug&&console.error("failed parsing JSON '"+u.toString()+"', "+i))}if(!(h(p.execution)||h(p.execution.jobId)||h(p.execution.jobDocument))){var m=p.execution.jobDocument.operation,g=d.operations.find((function(t){return h(m)?h(t.operationName):m===t.operationName}));h(g)&&(g=d.operations.find((function(t){return h(t.operationName)})),h(g))||g.callback(null,i._buildJobObject(l,p.execution))}}}else i.emit("message",a,u)},this.subscribeToJobs=function(i,u,c){h(c)&&(c=u,u=null),h(t)||!0!==t.debug||console.log("subscribeToJobs:",{thingName:i,operationName:u});var l=o.find((function(t){return t.thingName===i}));h(l)&&(l={thingName:i,operations:[]},o.push(l),a.subscribe([buildJobTopic(i,"$next/get/accepted"),buildJobTopic(i,"notify-next")],(function(t,i){h(t)||c(t)})));var d=l.operations.find((function(t){return h(u)?h(t.operationName):u===t.operationName}));h(d)?(d={operationName:u,callback:c},l.operations.push(d)):d.callback=c},this.unsubscribeFromJobs=function(i,u,c){h(c)&&(c=u,u=null),h(t)||!0!==t.debug||console.log("unsubscribeFromJobs:",{thingName:i,operationName:u});var l=o.findIndex((function(t){return t.thingName===i})),d=new Error("subscription not found for given thing");if(l<0)c(d);else{var p=o[l].operations.findIndex((function(t){return h(u)?h(t.operationName):u===t.operationName}));if(p<0)c(d);else{if(o[l].operations.splice(p,1),0===o[l].operations.length)return o.splice(l,1),void a.unsubscribe([buildJobTopic(i,"$next/get/accepted"),buildJobTopic(i,"notify-next")],c);c()}}},this.startJobNotifications=function(i,o){h(t)||!0!==t.debug||console.log("startJobNotifications:",{thingName:i}),a.publish(buildJobTopic(i,"$next","get"),"{}",o)},a.on("connect",(function(){i.emit("connect")})),a.on("close",(function(){i.emit("close")})),a.on("reconnect",(function(){i.emit("reconnect")})),a.on("offline",(function(){i.emit("offline")})),a.on("error",(function(t){i.emit("error",t)})),a.on("message",i._handleMessages),this.publish=a.publish,this.subscribe=a.subscribe,this.unsubscribe=a.unsubscribe,this.end=a.end,this.handleMessage=a.handleMessage,this.updateWebSocketCredentials=a.updateWebSocketCredentials,this.simulateNetworkFailure=a.simulateNetworkFailure}u(jobsClient,a.EventEmitter),t.exports=jobsClient},function(t,i,o){"use strict";o.r(i);var a={};o.r(a),o.d(a,"shimGetUserMedia",(function(){return shimGetUserMedia})),o.d(a,"shimGetDisplayMedia",(function(){return shimGetDisplayMedia})),o.d(a,"shimMediaStream",(function(){return shimMediaStream})),o.d(a,"shimOnTrack",(function(){return shimOnTrack})),o.d(a,"shimGetSendersWithDtmf",(function(){return shimGetSendersWithDtmf})),o.d(a,"shimGetStats",(function(){return shimGetStats})),o.d(a,"shimSenderReceiverGetStats",(function(){return shimSenderReceiverGetStats})),o.d(a,"shimAddTrackRemoveTrackWithNative",(function(){return shimAddTrackRemoveTrackWithNative})),o.d(a,"shimAddTrackRemoveTrack",(function(){return shimAddTrackRemoveTrack})),o.d(a,"shimPeerConnection",(function(){return shimPeerConnection})),o.d(a,"fixNegotiationNeeded",(function(){return fixNegotiationNeeded}));var u={};o.r(u),o.d(u,"shimGetUserMedia",(function(){return getusermedia_shimGetUserMedia})),o.d(u,"shimGetDisplayMedia",(function(){return getdisplaymedia_shimGetDisplayMedia})),o.d(u,"shimOnTrack",(function(){return firefox_shim_shimOnTrack})),o.d(u,"shimPeerConnection",(function(){return firefox_shim_shimPeerConnection})),o.d(u,"shimSenderGetStats",(function(){return shimSenderGetStats})),o.d(u,"shimReceiverGetStats",(function(){return shimReceiverGetStats})),o.d(u,"shimRemoveStream",(function(){return shimRemoveStream})),o.d(u,"shimRTCDataChannel",(function(){return shimRTCDataChannel})),o.d(u,"shimAddTransceiver",(function(){return shimAddTransceiver})),o.d(u,"shimGetParameters",(function(){return shimGetParameters})),o.d(u,"shimCreateOffer",(function(){return shimCreateOffer})),o.d(u,"shimCreateAnswer",(function(){return shimCreateAnswer}));var c={};o.r(c),o.d(c,"shimLocalStreamsAPI",(function(){return shimLocalStreamsAPI})),o.d(c,"shimRemoteStreamsAPI",(function(){return shimRemoteStreamsAPI})),o.d(c,"shimCallbacksAPI",(function(){return shimCallbacksAPI})),o.d(c,"shimGetUserMedia",(function(){return safari_shim_shimGetUserMedia})),o.d(c,"shimConstraints",(function(){return shimConstraints})),o.d(c,"shimRTCIceServerUrls",(function(){return shimRTCIceServerUrls})),o.d(c,"shimTrackEventTransceiver",(function(){return shimTrackEventTransceiver})),o.d(c,"shimCreateOfferLegacy",(function(){return shimCreateOfferLegacy})),o.d(c,"shimAudioContext",(function(){return shimAudioContext}));var h={};o.r(h),o.d(h,"shimRTCIceCandidate",(function(){return shimRTCIceCandidate})),o.d(h,"shimMaxMessageSize",(function(){return shimMaxMessageSize})),o.d(h,"shimSendThrowTypeError",(function(){return shimSendThrowTypeError})),o.d(h,"shimConnectionState",(function(){return shimConnectionState})),o.d(h,"removeExtmapAllowMixed",(function(){return removeExtmapAllowMixed})),o.d(h,"shimAddIceCandidateNullOrEmpty",(function(){return shimAddIceCandidateNullOrEmpty})),o.d(h,"shimParameterlessSetLocalDescription",(function(){return shimParameterlessSetLocalDescription}));let l=!0,d=!0;function extractVersion(t,i,o){const a=t.match(i);return a&&a.length>=o&&parseInt(a[o],10)}function wrapPeerConnectionEvent(t,i,o){if(!t.RTCPeerConnection)return;const a=t.RTCPeerConnection.prototype,u=a.addEventListener;a.addEventListener=function(t,a){if(t!==i)return u.apply(this,arguments);const wrappedCallback=t=>{const i=o(t);i&&(a.handleEvent?a.handleEvent(i):a(i))};return this._eventMap=this._eventMap||{},this._eventMap[i]||(this._eventMap[i]=new Map),this._eventMap[i].set(a,wrappedCallback),u.apply(this,[t,wrappedCallback])};const c=a.removeEventListener;a.removeEventListener=function(t,o){if(t!==i||!this._eventMap||!this._eventMap[i])return c.apply(this,arguments);if(!this._eventMap[i].has(o))return c.apply(this,arguments);const a=this._eventMap[i].get(o);return this._eventMap[i].delete(o),0===this._eventMap[i].size&&delete this._eventMap[i],0===Object.keys(this._eventMap).length&&delete this._eventMap,c.apply(this,[t,a])},Object.defineProperty(a,"on"+i,{get(){return this["_on"+i]},set(t){this["_on"+i]&&(this.removeEventListener(i,this["_on"+i]),delete this["_on"+i]),t&&this.addEventListener(i,this["_on"+i]=t)},enumerable:!0,configurable:!0})}function disableLog(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(l=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function disableWarnings(t){return"boolean"!=typeof t?new Error("Argument type: "+typeof t+". Please use a boolean."):(d=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function log(){if("object"==typeof window){if(l)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function deprecated(t,i){d&&console.warn(t+" is deprecated, please use "+i+" instead.")}function isObject(t){return"[object Object]"===Object.prototype.toString.call(t)}function compactObject(t){return isObject(t)?Object.keys(t).reduce((function(i,o){const a=isObject(t[o]),u=a?compactObject(t[o]):t[o],c=a&&!Object.keys(u).length;return void 0===u||c?i:Object.assign(i,{[o]:u})}),{}):t}function filterStats(t,i,o){const a=o?"outbound-rtp":"inbound-rtp",u=new Map;if(null===i)return u;const c=[];return t.forEach(t=>{"track"===t.type&&t.trackIdentifier===i.id&&c.push(t)}),c.forEach(i=>{t.forEach(o=>{o.type===a&&o.trackId===i.id&&function walkStats(t,i,o){i&&!o.has(i.id)&&(o.set(i.id,i),Object.keys(i).forEach(a=>{a.endsWith("Id")?walkStats(t,t.get(i[a]),o):a.endsWith("Ids")&&i[a].forEach(i=>{walkStats(t,t.get(i),o)})}))}(t,o,u)})}),u}const p=log;function shimGetUserMedia(t,i){const o=t&&t.navigator;if(!o.mediaDevices)return;const constraintsToChrome_=function(t){if("object"!=typeof t||t.mandatory||t.optional)return t;const i={};return Object.keys(t).forEach(o=>{if("require"===o||"advanced"===o||"mediaSource"===o)return;const a="object"==typeof t[o]?t[o]:{ideal:t[o]};void 0!==a.exact&&"number"==typeof a.exact&&(a.min=a.max=a.exact);const oldname_=function(t,i){return t?t+i.charAt(0).toUpperCase()+i.slice(1):"deviceId"===i?"sourceId":i};if(void 0!==a.ideal){i.optional=i.optional||[];let t={};"number"==typeof a.ideal?(t[oldname_("min",o)]=a.ideal,i.optional.push(t),t={},t[oldname_("max",o)]=a.ideal,i.optional.push(t)):(t[oldname_("",o)]=a.ideal,i.optional.push(t))}void 0!==a.exact&&"number"!=typeof a.exact?(i.mandatory=i.mandatory||{},i.mandatory[oldname_("",o)]=a.exact):["min","max"].forEach(t=>{void 0!==a[t]&&(i.mandatory=i.mandatory||{},i.mandatory[oldname_(t,o)]=a[t])})}),t.advanced&&(i.optional=(i.optional||[]).concat(t.advanced)),i},shimConstraints_=function(t,a){if(i.version>=61)return a(t);if((t=JSON.parse(JSON.stringify(t)))&&"object"==typeof t.audio){const remap=function(t,i,o){i in t&&!(o in t)&&(t[o]=t[i],delete t[i])};remap((t=JSON.parse(JSON.stringify(t))).audio,"autoGainControl","googAutoGainControl"),remap(t.audio,"noiseSuppression","googNoiseSuppression"),t.audio=constraintsToChrome_(t.audio)}if(t&&"object"==typeof t.video){let u=t.video.facingMode;u=u&&("object"==typeof u?u:{ideal:u});const c=i.version<66;if(u&&("user"===u.exact||"environment"===u.exact||"user"===u.ideal||"environment"===u.ideal)&&(!o.mediaDevices.getSupportedConstraints||!o.mediaDevices.getSupportedConstraints().facingMode||c)){let i;if(delete t.video.facingMode,"environment"===u.exact||"environment"===u.ideal?i=["back","rear"]:"user"!==u.exact&&"user"!==u.ideal||(i=["front"]),i)return o.mediaDevices.enumerateDevices().then(o=>{let c=(o=o.filter(t=>"videoinput"===t.kind)).find(t=>i.some(i=>t.label.toLowerCase().includes(i)));return!c&&o.length&&i.includes("back")&&(c=o[o.length-1]),c&&(t.video.deviceId=u.exact?{exact:c.deviceId}:{ideal:c.deviceId}),t.video=constraintsToChrome_(t.video),p("chrome: "+JSON.stringify(t)),a(t)})}t.video=constraintsToChrome_(t.video)}return p("chrome: "+JSON.stringify(t)),a(t)},shimError_=function(t){return i.version>=64?t:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[t.name]||t.name,message:t.message,constraint:t.constraint||t.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(o.getUserMedia=function(t,i,a){shimConstraints_(t,t=>{o.webkitGetUserMedia(t,i,t=>{a&&a(shimError_(t))})})}.bind(o),o.mediaDevices.getUserMedia){const t=o.mediaDevices.getUserMedia.bind(o.mediaDevices);o.mediaDevices.getUserMedia=function(i){return shimConstraints_(i,i=>t(i).then(t=>{if(i.audio&&!t.getAudioTracks().length||i.video&&!t.getVideoTracks().length)throw t.getTracks().forEach(t=>{t.stop()}),new DOMException("","NotFoundError");return t},t=>Promise.reject(shimError_(t))))}}}function shimGetDisplayMedia(t,i){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&("function"==typeof i?t.navigator.mediaDevices.getDisplayMedia=function getDisplayMedia(o){return i(o).then(i=>{const a=o.video&&o.video.width,u=o.video&&o.video.height,c=o.video&&o.video.frameRate;return o.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:i,maxFrameRate:c||3}},a&&(o.video.mandatory.maxWidth=a),u&&(o.video.mandatory.maxHeight=u),t.navigator.mediaDevices.getUserMedia(o)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function shimMediaStream(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function shimOnTrack(t){if("object"==typeof t&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(t){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=t)},enumerable:!0,configurable:!0});const i=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function setRemoteDescription(){return this._ontrackpoly||(this._ontrackpoly=i=>{i.stream.addEventListener("addtrack",o=>{let a;a=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(t=>t.track&&t.track.id===o.track.id):{track:o.track};const u=new Event("track");u.track=o.track,u.receiver=a,u.transceiver={receiver:a},u.streams=[i.stream],this.dispatchEvent(u)}),i.stream.getTracks().forEach(o=>{let a;a=t.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(t=>t.track&&t.track.id===o.id):{track:o};const u=new Event("track");u.track=o,u.receiver=a,u.transceiver={receiver:a},u.streams=[i.stream],this.dispatchEvent(u)})},this.addEventListener("addstream",this._ontrackpoly)),i.apply(this,arguments)}}else wrapPeerConnectionEvent(t,"track",t=>(t.transceiver||Object.defineProperty(t,"transceiver",{value:{receiver:t.receiver}}),t))}function shimGetSendersWithDtmf(t){if("object"==typeof t&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const shimSenderWithDtmf=function(t,i){return{track:i,get dtmf(){return void 0===this._dtmf&&("audio"===i.kind?this._dtmf=t.createDTMFSender(i):this._dtmf=null),this._dtmf},_pc:t}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function getSenders(){return this._senders=this._senders||[],this._senders.slice()};const i=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function addTrack(t,o){let a=i.apply(this,arguments);return a||(a=shimSenderWithDtmf(this,t),this._senders.push(a)),a};const o=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function removeTrack(t){o.apply(this,arguments);const i=this._senders.indexOf(t);-1!==i&&this._senders.splice(i,1)}}const i=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function addStream(t){this._senders=this._senders||[],i.apply(this,[t]),t.getTracks().forEach(t=>{this._senders.push(shimSenderWithDtmf(this,t))})};const o=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function removeStream(t){this._senders=this._senders||[],o.apply(this,[t]),t.getTracks().forEach(t=>{const i=this._senders.find(i=>i.track===t);i&&this._senders.splice(this._senders.indexOf(i),1)})}}else if("object"==typeof t&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const i=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function getSenders(){const t=i.apply(this,[]);return t.forEach(t=>t._pc=this),t},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function shimGetStats(t){if(!t.RTCPeerConnection)return;const i=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function getStats(){const[t,o,a]=arguments;if(arguments.length>0&&"function"==typeof t)return i.apply(this,arguments);if(0===i.length&&(0===arguments.length||"function"!=typeof t))return i.apply(this,[]);const fixChromeStats_=function(t){const i={};return t.result().forEach(t=>{const o={id:t.id,timestamp:t.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[t.type]||t.type};t.names().forEach(i=>{o[i]=t.stat(i)}),i[o.id]=o}),i},makeMapStats=function(t){return new Map(Object.keys(t).map(i=>[i,t[i]]))};if(arguments.length>=2){const successCallbackWrapper_=function(t){o(makeMapStats(fixChromeStats_(t)))};return i.apply(this,[successCallbackWrapper_,t])}return new Promise((t,o)=>{i.apply(this,[function(i){t(makeMapStats(fixChromeStats_(i)))},o])}).then(o,a)}}function shimSenderReceiverGetStats(t){if(!("object"==typeof t&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const i=t.RTCPeerConnection.prototype.getSenders;i&&(t.RTCPeerConnection.prototype.getSenders=function getSenders(){const t=i.apply(this,[]);return t.forEach(t=>t._pc=this),t});const o=t.RTCPeerConnection.prototype.addTrack;o&&(t.RTCPeerConnection.prototype.addTrack=function addTrack(){const t=o.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function getStats(){const t=this;return this._pc.getStats().then(i=>filterStats(i,t.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const i=t.RTCPeerConnection.prototype.getReceivers;i&&(t.RTCPeerConnection.prototype.getReceivers=function getReceivers(){const t=i.apply(this,[]);return t.forEach(t=>t._pc=this),t}),wrapPeerConnectionEvent(t,"track",t=>(t.receiver._pc=t.srcElement,t)),t.RTCRtpReceiver.prototype.getStats=function getStats(){const t=this;return this._pc.getStats().then(i=>filterStats(i,t.track,!1))}}if(!("getStats"in t.RTCRtpSender.prototype)||!("getStats"in t.RTCRtpReceiver.prototype))return;const i=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function getStats(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const t=arguments[0];let i,o,a;return this.getSenders().forEach(o=>{o.track===t&&(i?a=!0:i=o)}),this.getReceivers().forEach(i=>(i.track===t&&(o?a=!0:o=i),i.track===t)),a||i&&o?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():o?o.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}function shimAddTrackRemoveTrackWithNative(t){t.RTCPeerConnection.prototype.getLocalStreams=function getLocalStreams(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(t=>this._shimmedLocalStreams[t][0])};const i=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function addTrack(t,o){if(!o)return i.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const a=i.apply(this,arguments);return this._shimmedLocalStreams[o.id]?-1===this._shimmedLocalStreams[o.id].indexOf(a)&&this._shimmedLocalStreams[o.id].push(a):this._shimmedLocalStreams[o.id]=[o,a],a};const o=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function addStream(t){this._shimmedLocalStreams=this._shimmedLocalStreams||{},t.getTracks().forEach(t=>{if(this.getSenders().find(i=>i.track===t))throw new DOMException("Track already exists.","InvalidAccessError")});const i=this.getSenders();o.apply(this,arguments);const a=this.getSenders().filter(t=>-1===i.indexOf(t));this._shimmedLocalStreams[t.id]=[t].concat(a)};const a=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function removeStream(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[t.id],a.apply(this,arguments)};const u=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function removeTrack(t){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},t&&Object.keys(this._shimmedLocalStreams).forEach(i=>{const o=this._shimmedLocalStreams[i].indexOf(t);-1!==o&&this._shimmedLocalStreams[i].splice(o,1),1===this._shimmedLocalStreams[i].length&&delete this._shimmedLocalStreams[i]}),u.apply(this,arguments)}}function shimAddTrackRemoveTrack(t,i){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&i.version>=65)return shimAddTrackRemoveTrackWithNative(t);const o=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function getLocalStreams(){const t=o.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map(t=>this._reverseStreams[t.id])};const a=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function addStream(i){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.getTracks().forEach(t=>{if(this.getSenders().find(i=>i.track===t))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[i.id]){const o=new t.MediaStream(i.getTracks());this._streams[i.id]=o,this._reverseStreams[o.id]=i,i=o}a.apply(this,[i])};const u=t.RTCPeerConnection.prototype.removeStream;function replaceInternalStreamId(t,i){let o=i.sdp;return Object.keys(t._reverseStreams||[]).forEach(i=>{const a=t._reverseStreams[i],u=t._streams[a.id];o=o.replace(new RegExp(u.id,"g"),a.id)}),new RTCSessionDescription({type:i.type,sdp:o})}function replaceExternalStreamId(t,i){let o=i.sdp;return Object.keys(t._reverseStreams||[]).forEach(i=>{const a=t._reverseStreams[i],u=t._streams[a.id];o=o.replace(new RegExp(a.id,"g"),u.id)}),new RTCSessionDescription({type:i.type,sdp:o})}t.RTCPeerConnection.prototype.removeStream=function removeStream(t){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},u.apply(this,[this._streams[t.id]||t]),delete this._reverseStreams[this._streams[t.id]?this._streams[t.id].id:t.id],delete this._streams[t.id]},t.RTCPeerConnection.prototype.addTrack=function addTrack(i,o){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const a=[].slice.call(arguments,1);if(1!==a.length||!a[0].getTracks().find(t=>t===i))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");const u=this.getSenders().find(t=>t.track===i);if(u)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const c=this._streams[o.id];if(c)c.addTrack(i),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const a=new t.MediaStream([i]);this._streams[o.id]=a,this._reverseStreams[a.id]=o,this.addStream(a)}return this.getSenders().find(t=>t.track===i)},["createOffer","createAnswer"].forEach((function(i){const o=t.RTCPeerConnection.prototype[i],a={[i](){const t=arguments;return arguments.length&&"function"==typeof arguments[0]?o.apply(this,[i=>{const o=replaceInternalStreamId(this,i);t[0].apply(null,[o])},i=>{t[1]&&t[1].apply(null,i)},arguments[2]]):o.apply(this,arguments).then(t=>replaceInternalStreamId(this,t))}};t.RTCPeerConnection.prototype[i]=a[i]}));const c=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function setLocalDescription(){return arguments.length&&arguments[0].type?(arguments[0]=replaceExternalStreamId(this,arguments[0]),c.apply(this,arguments)):c.apply(this,arguments)};const h=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const t=h.get.apply(this);return""===t.type?t:replaceInternalStreamId(this,t)}}),t.RTCPeerConnection.prototype.removeTrack=function removeTrack(t){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!t._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(t._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let i;this._streams=this._streams||{},Object.keys(this._streams).forEach(o=>{this._streams[o].getTracks().find(i=>t.track===i)&&(i=this._streams[o])}),i&&(1===i.getTracks().length?this.removeStream(this._reverseStreams[i.id]):i.removeTrack(t.track),this.dispatchEvent(new Event("negotiationneeded")))}}function shimPeerConnection(t,i){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&i.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(i){const o=t.RTCPeerConnection.prototype[i],a={[i](){return arguments[0]=new("addIceCandidate"===i?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),o.apply(this,arguments)}};t.RTCPeerConnection.prototype[i]=a[i]}))}function fixNegotiationNeeded(t,i){wrapPeerConnectionEvent(t,"negotiationneeded",t=>{const o=t.target;if(!(i.version<72||o.getConfiguration&&"plan-b"===o.getConfiguration().sdpSemantics)||"stable"===o.signalingState)return t})}function getusermedia_shimGetUserMedia(t,i){const o=t&&t.navigator,a=t&&t.MediaStreamTrack;if(o.getUserMedia=function(t,i,a){deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),o.mediaDevices.getUserMedia(t).then(i,a)},!(i.version>55&&"autoGainControl"in o.mediaDevices.getSupportedConstraints())){const remap=function(t,i,o){i in t&&!(o in t)&&(t[o]=t[i],delete t[i])},t=o.mediaDevices.getUserMedia.bind(o.mediaDevices);if(o.mediaDevices.getUserMedia=function(i){return"object"==typeof i&&"object"==typeof i.audio&&(i=JSON.parse(JSON.stringify(i)),remap(i.audio,"autoGainControl","mozAutoGainControl"),remap(i.audio,"noiseSuppression","mozNoiseSuppression")),t(i)},a&&a.prototype.getSettings){const t=a.prototype.getSettings;a.prototype.getSettings=function(){const i=t.apply(this,arguments);return remap(i,"mozAutoGainControl","autoGainControl"),remap(i,"mozNoiseSuppression","noiseSuppression"),i}}if(a&&a.prototype.applyConstraints){const t=a.prototype.applyConstraints;a.prototype.applyConstraints=function(i){return"audio"===this.kind&&"object"==typeof i&&(i=JSON.parse(JSON.stringify(i)),remap(i,"autoGainControl","mozAutoGainControl"),remap(i,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[i])}}}}function getdisplaymedia_shimGetDisplayMedia(t,i){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function getDisplayMedia(o){if(!o||!o.video){const t=new DOMException("getDisplayMedia without video constraints is undefined");return t.name="NotFoundError",t.code=8,Promise.reject(t)}return!0===o.video?o.video={mediaSource:i}:o.video.mediaSource=i,t.navigator.mediaDevices.getUserMedia(o)})}function firefox_shim_shimOnTrack(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function firefox_shim_shimPeerConnection(t,i){if("object"!=typeof t||!t.RTCPeerConnection&&!t.mozRTCPeerConnection)return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),i.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(i){const o=t.RTCPeerConnection.prototype[i],a={[i](){return arguments[0]=new("addIceCandidate"===i?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),o.apply(this,arguments)}};t.RTCPeerConnection.prototype[i]=a[i]}));const o={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},a=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function getStats(){const[t,u,c]=arguments;return a.apply(this,[t||null]).then(t=>{if(i.version<53&&!u)try{t.forEach(t=>{t.type=o[t.type]||t.type})}catch(i){if("TypeError"!==i.name)throw i;t.forEach((i,a)=>{t.set(a,Object.assign({},i,{type:o[i.type]||i.type}))})}return t}).then(u,c)}}function shimSenderGetStats(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const i=t.RTCPeerConnection.prototype.getSenders;i&&(t.RTCPeerConnection.prototype.getSenders=function getSenders(){const t=i.apply(this,[]);return t.forEach(t=>t._pc=this),t});const o=t.RTCPeerConnection.prototype.addTrack;o&&(t.RTCPeerConnection.prototype.addTrack=function addTrack(){const t=o.apply(this,arguments);return t._pc=this,t}),t.RTCRtpSender.prototype.getStats=function getStats(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function shimReceiverGetStats(t){if("object"!=typeof t||!t.RTCPeerConnection||!t.RTCRtpSender)return;if(t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const i=t.RTCPeerConnection.prototype.getReceivers;i&&(t.RTCPeerConnection.prototype.getReceivers=function getReceivers(){const t=i.apply(this,[]);return t.forEach(t=>t._pc=this),t}),wrapPeerConnectionEvent(t,"track",t=>(t.receiver._pc=t.srcElement,t)),t.RTCRtpReceiver.prototype.getStats=function getStats(){return this._pc.getStats(this.track)}}function shimRemoveStream(t){t.RTCPeerConnection&&!("removeStream"in t.RTCPeerConnection.prototype)&&(t.RTCPeerConnection.prototype.removeStream=function removeStream(t){deprecated("removeStream","removeTrack"),this.getSenders().forEach(i=>{i.track&&t.getTracks().includes(i.track)&&this.removeTrack(i)})})}function shimRTCDataChannel(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function shimAddTransceiver(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const i=t.RTCPeerConnection.prototype.addTransceiver;i&&(t.RTCPeerConnection.prototype.addTransceiver=function addTransceiver(){this.setParametersPromises=[];const t=arguments[1],o=t&&"sendEncodings"in t;o&&t.sendEncodings.forEach(t=>{if("rid"in t){if(!/^[a-z0-9]{0,16}$/i.test(t.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in t&&!(parseFloat(t.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in t&&!(parseFloat(t.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const a=i.apply(this,arguments);if(o){const{sender:i}=a,o=i.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=t.sendEncodings,i.sendEncodings=t.sendEncodings,this.setParametersPromises.push(i.setParameters(o).then(()=>{delete i.sendEncodings}).catch(()=>{delete i.sendEncodings})))}return a})}function shimGetParameters(t){if("object"!=typeof t||!t.RTCRtpSender)return;const i=t.RTCRtpSender.prototype.getParameters;i&&(t.RTCRtpSender.prototype.getParameters=function getParameters(){const t=i.apply(this,arguments);return"encodings"in t||(t.encodings=[].concat(this.sendEncodings||[{}])),t})}function shimCreateOffer(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const i=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function createOffer(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>i.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):i.apply(this,arguments)}}function shimCreateAnswer(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const i=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function createAnswer(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>i.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):i.apply(this,arguments)}}function shimLocalStreamsAPI(t){if("object"==typeof t&&t.RTCPeerConnection){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function getLocalStreams(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const i=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function addStream(t){this._localStreams||(this._localStreams=[]),this._localStreams.includes(t)||this._localStreams.push(t),t.getAudioTracks().forEach(o=>i.call(this,o,t)),t.getVideoTracks().forEach(o=>i.call(this,o,t))},t.RTCPeerConnection.prototype.addTrack=function addTrack(t,...o){return o&&o.forEach(t=>{this._localStreams?this._localStreams.includes(t)||this._localStreams.push(t):this._localStreams=[t]}),i.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function removeStream(t){this._localStreams||(this._localStreams=[]);const i=this._localStreams.indexOf(t);if(-1===i)return;this._localStreams.splice(i,1);const o=t.getTracks();this.getSenders().forEach(t=>{o.includes(t.track)&&this.removeTrack(t)})})}}function shimRemoteStreamsAPI(t){if("object"==typeof t&&t.RTCPeerConnection&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function getRemoteStreams(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(t){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=t),this.addEventListener("track",this._onaddstreampoly=t=>{t.streams.forEach(t=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(t))return;this._remoteStreams.push(t);const i=new Event("addstream");i.stream=t,this.dispatchEvent(i)})})}});const i=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function setRemoteDescription(){const t=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(i){i.streams.forEach(i=>{if(t._remoteStreams||(t._remoteStreams=[]),t._remoteStreams.indexOf(i)>=0)return;t._remoteStreams.push(i);const o=new Event("addstream");o.stream=i,t.dispatchEvent(o)})}),i.apply(t,arguments)}}}function shimCallbacksAPI(t){if("object"!=typeof t||!t.RTCPeerConnection)return;const i=t.RTCPeerConnection.prototype,o=i.createOffer,a=i.createAnswer,u=i.setLocalDescription,c=i.setRemoteDescription,h=i.addIceCandidate;i.createOffer=function createOffer(t,i){const a=arguments.length>=2?arguments[2]:arguments[0],u=o.apply(this,[a]);return i?(u.then(t,i),Promise.resolve()):u},i.createAnswer=function createAnswer(t,i){const o=arguments.length>=2?arguments[2]:arguments[0],u=a.apply(this,[o]);return i?(u.then(t,i),Promise.resolve()):u};let withCallback=function(t,i,o){const a=u.apply(this,[t]);return o?(a.then(i,o),Promise.resolve()):a};i.setLocalDescription=withCallback,withCallback=function(t,i,o){const a=c.apply(this,[t]);return o?(a.then(i,o),Promise.resolve()):a},i.setRemoteDescription=withCallback,withCallback=function(t,i,o){const a=h.apply(this,[t]);return o?(a.then(i,o),Promise.resolve()):a},i.addIceCandidate=withCallback}function safari_shim_shimGetUserMedia(t){const i=t&&t.navigator;if(i.mediaDevices&&i.mediaDevices.getUserMedia){const t=i.mediaDevices,o=t.getUserMedia.bind(t);i.mediaDevices.getUserMedia=t=>o(shimConstraints(t))}!i.getUserMedia&&i.mediaDevices&&i.mediaDevices.getUserMedia&&(i.getUserMedia=function getUserMedia(t,o,a){i.mediaDevices.getUserMedia(t).then(o,a)}.bind(i))}function shimConstraints(t){return t&&void 0!==t.video?Object.assign({},t,{video:compactObject(t.video)}):t}function shimRTCIceServerUrls(t){if(!t.RTCPeerConnection)return;const i=t.RTCPeerConnection;t.RTCPeerConnection=function RTCPeerConnection(t,o){if(t&&t.iceServers){const i=[];for(let o=0;o<t.iceServers.length;o++){let a=t.iceServers[o];!a.hasOwnProperty("urls")&&a.hasOwnProperty("url")?(deprecated("RTCIceServer.url","RTCIceServer.urls"),a=JSON.parse(JSON.stringify(a)),a.urls=a.url,delete a.url,i.push(a)):i.push(t.iceServers[o])}t.iceServers=i}return new i(t,o)},t.RTCPeerConnection.prototype=i.prototype,"generateCertificate"in i&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get:()=>i.generateCertificate})}function shimTrackEventTransceiver(t){"object"==typeof t&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function shimCreateOfferLegacy(t){const i=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function createOffer(t){if(t){void 0!==t.offerToReceiveAudio&&(t.offerToReceiveAudio=!!t.offerToReceiveAudio);const i=this.getTransceivers().find(t=>"audio"===t.receiver.track.kind);!1===t.offerToReceiveAudio&&i?"sendrecv"===i.direction?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":"recvonly"===i.direction&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):!0!==t.offerToReceiveAudio||i||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==t.offerToReceiveVideo&&(t.offerToReceiveVideo=!!t.offerToReceiveVideo);const o=this.getTransceivers().find(t=>"video"===t.receiver.track.kind);!1===t.offerToReceiveVideo&&o?"sendrecv"===o.direction?o.setDirection?o.setDirection("sendonly"):o.direction="sendonly":"recvonly"===o.direction&&(o.setDirection?o.setDirection("inactive"):o.direction="inactive"):!0!==t.offerToReceiveVideo||o||this.addTransceiver("video",{direction:"recvonly"})}return i.apply(this,arguments)}}function shimAudioContext(t){"object"!=typeof t||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var m=o(74),g=o.n(m);function shimRTCIceCandidate(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const i=t.RTCIceCandidate;t.RTCIceCandidate=function RTCIceCandidate(t){if("object"==typeof t&&t.candidate&&0===t.candidate.indexOf("a=")&&((t=JSON.parse(JSON.stringify(t))).candidate=t.candidate.substr(2)),t.candidate&&t.candidate.length){const o=new i(t),a=g.a.parseCandidate(t.candidate),u=Object.assign(o,a);return u.toJSON=function toJSON(){return{candidate:u.candidate,sdpMid:u.sdpMid,sdpMLineIndex:u.sdpMLineIndex,usernameFragment:u.usernameFragment}},u}return new i(t)},t.RTCIceCandidate.prototype=i.prototype,wrapPeerConnectionEvent(t,"icecandidate",i=>(i.candidate&&Object.defineProperty(i,"candidate",{value:new t.RTCIceCandidate(i.candidate),writable:"false"}),i))}function shimMaxMessageSize(t,i){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const sctpInDescription=function(t){if(!t||!t.sdp)return!1;const i=g.a.splitSections(t.sdp);return i.shift(),i.some(t=>{const i=g.a.parseMLine(t);return i&&"application"===i.kind&&-1!==i.protocol.indexOf("SCTP")})},getRemoteFirefoxVersion=function(t){const i=t.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===i||i.length<2)return-1;const o=parseInt(i[1],10);return o!=o?-1:o},getCanSendMaxMessageSize=function(t){let o=65536;return"firefox"===i.browser&&(o=i.version<57?-1===t?16384:2147483637:i.version<60?57===i.version?65535:65536:2147483637),o},getMaxMessageSize=function(t,o){let a=65536;"firefox"===i.browser&&57===i.version&&(a=65535);const u=g.a.matchPrefix(t.sdp,"a=max-message-size:");return u.length>0?a=parseInt(u[0].substr(19),10):"firefox"===i.browser&&-1!==o&&(a=2147483637),a},o=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function setRemoteDescription(){if(this._sctp=null,"chrome"===i.browser&&i.version>=76){const{sdpSemantics:t}=this.getConfiguration();"plan-b"===t&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(sctpInDescription(arguments[0])){const t=getRemoteFirefoxVersion(arguments[0]),i=getCanSendMaxMessageSize(t),o=getMaxMessageSize(arguments[0],t);let a;a=0===i&&0===o?Number.POSITIVE_INFINITY:0===i||0===o?Math.max(i,o):Math.min(i,o);const u={};Object.defineProperty(u,"maxMessageSize",{get:()=>a}),this._sctp=u}return o.apply(this,arguments)}}function shimSendThrowTypeError(t){if(!t.RTCPeerConnection||!("createDataChannel"in t.RTCPeerConnection.prototype))return;function wrapDcSend(t,i){const o=t.send;t.send=function send(){const a=arguments[0],u=a.length||a.size||a.byteLength;if("open"===t.readyState&&i.sctp&&u>i.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+i.sctp.maxMessageSize+" bytes)");return o.apply(t,arguments)}}const i=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function createDataChannel(){const t=i.apply(this,arguments);return wrapDcSend(t,this),t},wrapPeerConnectionEvent(t,"datachannel",t=>(wrapDcSend(t.channel,t.target),t))}function shimConnectionState(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const i=t.RTCPeerConnection.prototype;Object.defineProperty(i,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(i,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(t){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),t&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=t)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(t=>{const o=i[t];i[t]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=t=>{const i=t.target;if(i._lastConnectionState!==i.connectionState){i._lastConnectionState=i.connectionState;const o=new Event("connectionstatechange",t);i.dispatchEvent(o)}return t},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),o.apply(this,arguments)}})}function removeExtmapAllowMixed(t,i){if(!t.RTCPeerConnection)return;if("chrome"===i.browser&&i.version>=71)return;if("safari"===i.browser&&i.version>=605)return;const o=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function setRemoteDescription(i){if(i&&i.sdp&&-1!==i.sdp.indexOf("\na=extmap-allow-mixed")){const o=i.sdp.split("\n").filter(t=>"a=extmap-allow-mixed"!==t.trim()).join("\n");t.RTCSessionDescription&&i instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:i.type,sdp:o}):i.sdp=o}return o.apply(this,arguments)}}function shimAddIceCandidateNullOrEmpty(t,i){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const o=t.RTCPeerConnection.prototype.addIceCandidate;o&&0!==o.length&&(t.RTCPeerConnection.prototype.addIceCandidate=function addIceCandidate(){return arguments[0]?("chrome"===i.browser&&i.version<78||"firefox"===i.browser&&i.version<68||"safari"===i.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():o.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function shimParameterlessSetLocalDescription(t,i){if(!t.RTCPeerConnection||!t.RTCPeerConnection.prototype)return;const o=t.RTCPeerConnection.prototype.setLocalDescription;o&&0!==o.length&&(t.RTCPeerConnection.prototype.setLocalDescription=function setLocalDescription(){let t=arguments[0]||{};if("object"!=typeof t||t.type&&t.sdp)return o.apply(this,arguments);if(t={type:t.type,sdp:t.sdp},!t.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return o.apply(this,[t]);const i="offer"===t.type?this.createOffer:this.createAnswer;return i.apply(this).then(t=>o.apply(this,[t]))})}var v=function adapterFactory({window:t}={},i={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const o=log,l=function detectBrowser(t){const i={browser:null,version:null};if(void 0===t||!t.navigator)return i.browser="Not a browser.",i;const{navigator:o}=t;if(o.mozGetUserMedia)i.browser="firefox",i.version=extractVersion(o.userAgent,/Firefox\/(\d+)\./,1);else if(o.webkitGetUserMedia||!1===t.isSecureContext&&t.webkitRTCPeerConnection&&!t.RTCIceGatherer)i.browser="chrome",i.version=extractVersion(o.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!t.RTCPeerConnection||!o.userAgent.match(/AppleWebKit\/(\d+)\./))return i.browser="Not a supported browser.",i;i.browser="safari",i.version=extractVersion(o.userAgent,/AppleWebKit\/(\d+)\./,1),i.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype}return i}(t),d={browserDetails:l,commonShim:h,extractVersion:extractVersion,disableLog:disableLog,disableWarnings:disableWarnings,sdp:m};switch(l.browser){case"chrome":if(!a||!shimPeerConnection||!i.shimChrome)return o("Chrome shim is not included in this adapter release."),d;if(null===l.version)return o("Chrome shim can not determine version, not shimming."),d;o("adapter.js shimming chrome."),d.browserShim=a,shimAddIceCandidateNullOrEmpty(t,l),shimParameterlessSetLocalDescription(t),shimGetUserMedia(t,l),shimMediaStream(t),shimPeerConnection(t,l),shimOnTrack(t),shimAddTrackRemoveTrack(t,l),shimGetSendersWithDtmf(t),shimGetStats(t),shimSenderReceiverGetStats(t),fixNegotiationNeeded(t,l),shimRTCIceCandidate(t),shimConnectionState(t),shimMaxMessageSize(t,l),shimSendThrowTypeError(t),removeExtmapAllowMixed(t,l);break;case"firefox":if(!u||!firefox_shim_shimPeerConnection||!i.shimFirefox)return o("Firefox shim is not included in this adapter release."),d;o("adapter.js shimming firefox."),d.browserShim=u,shimAddIceCandidateNullOrEmpty(t,l),shimParameterlessSetLocalDescription(t),getusermedia_shimGetUserMedia(t,l),firefox_shim_shimPeerConnection(t,l),firefox_shim_shimOnTrack(t),shimRemoveStream(t),shimSenderGetStats(t),shimReceiverGetStats(t),shimRTCDataChannel(t),shimAddTransceiver(t),shimGetParameters(t),shimCreateOffer(t),shimCreateAnswer(t),shimRTCIceCandidate(t),shimConnectionState(t),shimMaxMessageSize(t,l),shimSendThrowTypeError(t);break;case"safari":if(!c||!i.shimSafari)return o("Safari shim is not included in this adapter release."),d;o("adapter.js shimming safari."),d.browserShim=c,shimAddIceCandidateNullOrEmpty(t,l),shimParameterlessSetLocalDescription(t),shimRTCIceServerUrls(t),shimCreateOfferLegacy(t),shimCallbacksAPI(t),shimLocalStreamsAPI(t),shimRemoteStreamsAPI(t),shimTrackEventTransceiver(t),safari_shim_shimGetUserMedia(t),shimAudioContext(t),shimRTCIceCandidate(t),shimMaxMessageSize(t,l),shimSendThrowTypeError(t),removeExtmapAllowMixed(t,l);break;default:o("Unsupported browser!")}return d}({window:"undefined"==typeof window?void 0:window}),b=o(37);var __assign=function(){return(__assign=Object.assign||function __assign(t){for(var i,o=1,a=arguments.length;o<a;o++)for(var u in i=arguments[o])Object.prototype.hasOwnProperty.call(i,u)&&(t[u]=i[u]);return t}).apply(this,arguments)};function __awaiter(t,i,o,a){return new(o||(o=Promise))((function(u,c){function fulfilled(t){try{step(a.next(t))}catch(t){c(t)}}function rejected(t){try{step(a.throw(t))}catch(t){c(t)}}function step(t){t.done?u(t.value):function adopt(t){return t instanceof o?t:new o((function(i){i(t)}))}(t.value).then(fulfilled,rejected)}step((a=a.apply(t,i||[])).next())}))}function __generator(t,i){var o,a,u,c,h={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return c={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function verb(c){return function(l){return function step(c){if(o)throw new TypeError("Generator is already executing.");for(;h;)try{if(o=1,a&&(u=2&c[0]?a.return:c[0]?a.throw||((u=a.return)&&u.call(a),0):a.next)&&!(u=u.call(a,c[1])).done)return u;switch(a=0,u&&(c=[2&c[0],u.value]),c[0]){case 0:case 1:u=c;break;case 4:return h.label++,{value:c[1],done:!1};case 5:h.label++,a=c[1],c=[0];continue;case 7:c=h.ops.pop(),h.trys.pop();continue;default:if(!(u=h.trys,(u=u.length>0&&u[u.length-1])||6!==c[0]&&2!==c[0])){h=0;continue}if(3===c[0]&&(!u||c[1]>u[0]&&c[1]<u[3])){h.label=c[1];break}if(6===c[0]&&h.label<u[1]){h.label=u[1],u=c;break}if(u&&h.label<u[2]){h.label=u[2],h.ops.push(c);break}u[2]&&h.ops.pop(),h.trys.pop();continue}c=i.call(t,h)}catch(t){c=[6,t],a=0}finally{o=u=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,l])}}}Object.create;function __spreadArrays(){for(var t=0,i=0,o=arguments.length;i<o;i++)t+=arguments[i].length;var a=Array(t),u=0;for(i=0;i<o;i++)for(var c=arguments[i],h=0,l=c.length;h<l;h++,u++)a[u]=c[h];return a}Object.create;function wait(t,i){return new Promise((function(o){return setTimeout(o,t,i)}))}function isPromise(t){return t&&"function"==typeof t.then}function awaitIfAsync(t,i){try{var o=t();isPromise(o)?o.then((function(t){return i(!0,t)}),(function(t){return i(!1,t)})):i(!0,o)}catch(t){i(!1,t)}}function forEachWithBreaks(t,i,o){return void 0===o&&(o=16),__awaiter(this,void 0,void 0,(function(){var a,u,c;return __generator(this,(function(h){switch(h.label){case 0:a=Date.now(),u=0,h.label=1;case 1:return u<t.length?(i(t[u],u),(c=Date.now())>=a+o?(a=c,[4,wait(0)]):[3,3]):[3,4];case 2:h.sent(),h.label=3;case 3:return++u,[3,1];case 4:return[2]}}))}))}function suppressUnhandledRejectionWarning(t){t.then(void 0,(function(){}))}function x64Add(t,i){t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]],i=[i[0]>>>16,65535&i[0],i[1]>>>16,65535&i[1]];var o=[0,0,0,0];return o[3]+=t[3]+i[3],o[2]+=o[3]>>>16,o[3]&=65535,o[2]+=t[2]+i[2],o[1]+=o[2]>>>16,o[2]&=65535,o[1]+=t[1]+i[1],o[0]+=o[1]>>>16,o[1]&=65535,o[0]+=t[0]+i[0],o[0]&=65535,[o[0]<<16|o[1],o[2]<<16|o[3]]}function x64Multiply(t,i){t=[t[0]>>>16,65535&t[0],t[1]>>>16,65535&t[1]],i=[i[0]>>>16,65535&i[0],i[1]>>>16,65535&i[1]];var o=[0,0,0,0];return o[3]+=t[3]*i[3],o[2]+=o[3]>>>16,o[3]&=65535,o[2]+=t[2]*i[3],o[1]+=o[2]>>>16,o[2]&=65535,o[2]+=t[3]*i[2],o[1]+=o[2]>>>16,o[2]&=65535,o[1]+=t[1]*i[3],o[0]+=o[1]>>>16,o[1]&=65535,o[1]+=t[2]*i[2],o[0]+=o[1]>>>16,o[1]&=65535,o[1]+=t[3]*i[1],o[0]+=o[1]>>>16,o[1]&=65535,o[0]+=t[0]*i[3]+t[1]*i[2]+t[2]*i[1]+t[3]*i[0],o[0]&=65535,[o[0]<<16|o[1],o[2]<<16|o[3]]}function x64Rotl(t,i){return 32===(i%=64)?[t[1],t[0]]:i<32?[t[0]<<i|t[1]>>>32-i,t[1]<<i|t[0]>>>32-i]:(i-=32,[t[1]<<i|t[0]>>>32-i,t[0]<<i|t[1]>>>32-i])}function x64LeftShift(t,i){return 0===(i%=64)?t:i<32?[t[0]<<i|t[1]>>>32-i,t[1]<<i]:[t[1]<<i-32,0]}function x64Xor(t,i){return[t[0]^i[0],t[1]^i[1]]}function x64Fmix(t){return t=x64Xor(t,[0,t[0]>>>1]),t=x64Xor(t=x64Multiply(t,[4283543511,3981806797]),[0,t[0]>>>1]),t=x64Xor(t=x64Multiply(t,[3301882366,444984403]),[0,t[0]>>>1])}function x64hash128(t,i){i=i||0;var o,a=(t=t||"").length%16,u=t.length-a,c=[0,i],h=[0,i],l=[0,0],d=[0,0],p=[2277735313,289559509],m=[1291169091,658871167];for(o=0;o<u;o+=16)l=[255&t.charCodeAt(o+4)|(255&t.charCodeAt(o+5))<<8|(255&t.charCodeAt(o+6))<<16|(255&t.charCodeAt(o+7))<<24,255&t.charCodeAt(o)|(255&t.charCodeAt(o+1))<<8|(255&t.charCodeAt(o+2))<<16|(255&t.charCodeAt(o+3))<<24],d=[255&t.charCodeAt(o+12)|(255&t.charCodeAt(o+13))<<8|(255&t.charCodeAt(o+14))<<16|(255&t.charCodeAt(o+15))<<24,255&t.charCodeAt(o+8)|(255&t.charCodeAt(o+9))<<8|(255&t.charCodeAt(o+10))<<16|(255&t.charCodeAt(o+11))<<24],l=x64Rotl(l=x64Multiply(l,p),31),c=x64Add(c=x64Rotl(c=x64Xor(c,l=x64Multiply(l,m)),27),h),c=x64Add(x64Multiply(c,[0,5]),[0,1390208809]),d=x64Rotl(d=x64Multiply(d,m),33),h=x64Add(h=x64Rotl(h=x64Xor(h,d=x64Multiply(d,p)),31),c),h=x64Add(x64Multiply(h,[0,5]),[0,944331445]);switch(l=[0,0],d=[0,0],a){case 15:d=x64Xor(d,x64LeftShift([0,t.charCodeAt(o+14)],48));case 14:d=x64Xor(d,x64LeftShift([0,t.charCodeAt(o+13)],40));case 13:d=x64Xor(d,x64LeftShift([0,t.charCodeAt(o+12)],32));case 12:d=x64Xor(d,x64LeftShift([0,t.charCodeAt(o+11)],24));case 11:d=x64Xor(d,x64LeftShift([0,t.charCodeAt(o+10)],16));case 10:d=x64Xor(d,x64LeftShift([0,t.charCodeAt(o+9)],8));case 9:d=x64Multiply(d=x64Xor(d,[0,t.charCodeAt(o+8)]),m),h=x64Xor(h,d=x64Multiply(d=x64Rotl(d,33),p));case 8:l=x64Xor(l,x64LeftShift([0,t.charCodeAt(o+7)],56));case 7:l=x64Xor(l,x64LeftShift([0,t.charCodeAt(o+6)],48));case 6:l=x64Xor(l,x64LeftShift([0,t.charCodeAt(o+5)],40));case 5:l=x64Xor(l,x64LeftShift([0,t.charCodeAt(o+4)],32));case 4:l=x64Xor(l,x64LeftShift([0,t.charCodeAt(o+3)],24));case 3:l=x64Xor(l,x64LeftShift([0,t.charCodeAt(o+2)],16));case 2:l=x64Xor(l,x64LeftShift([0,t.charCodeAt(o+1)],8));case 1:l=x64Multiply(l=x64Xor(l,[0,t.charCodeAt(o)]),p),c=x64Xor(c,l=x64Multiply(l=x64Rotl(l,31),m))}return c=x64Add(c=x64Xor(c,[0,t.length]),h=x64Xor(h,[0,t.length])),h=x64Add(h,c),c=x64Add(c=x64Fmix(c),h=x64Fmix(h)),h=x64Add(h,c),("00000000"+(c[0]>>>0).toString(16)).slice(-8)+("00000000"+(c[1]>>>0).toString(16)).slice(-8)+("00000000"+(h[0]>>>0).toString(16)).slice(-8)+("00000000"+(h[1]>>>0).toString(16)).slice(-8)}function toInt(t){return parseInt(t)}function toFloat(t){return parseFloat(t)}function replaceNaN(t,i){return"number"==typeof t&&isNaN(t)?i:t}function countTruthy(t){return t.reduce((function(t,i){return t+(i?1:0)}),0)}function round(t,i){if(void 0===i&&(i=1),Math.abs(i)>=1)return Math.round(t/i)*i;var o=1/i;return Math.round(t*o)/o}function ensureErrorWithMessage(t){return t&&"object"==typeof t&&"message"in t?t:{message:t}}function isFinalResultLoaded(t){return"function"!=typeof t}function loadSources(t,i,o){var a=Object.keys(t).filter((function(t){return function excludes(t,i){return!function includes(t,i){for(var o=0,a=t.length;o<a;++o)if(t[o]===i)return!0;return!1}(t,i)}(o,t)})),u=Array(a.length);return forEachWithBreaks(a,(function(o,a){u[a]=function loadSource(t,i){var o=new Promise((function(o){var a=Date.now();awaitIfAsync(t.bind(null,i),(function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var u=Date.now()-a;if(!t[0])return o((function(){return{error:ensureErrorWithMessage(t[1]),duration:u}}));var c=t[1];if(isFinalResultLoaded(c))return o((function(){return{value:c,duration:u}}));o((function(){return new Promise((function(t){var i=Date.now();awaitIfAsync(c,(function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var c=u+Date.now()-i;if(!o[0])return t({error:ensureErrorWithMessage(o[1]),duration:c});t({value:o[1],duration:c})}))}))}))}))}));return suppressUnhandledRejectionWarning(o),function getComponent(){return o.then((function(t){return t()}))}}(t[o],i)})),function getComponents(){return __awaiter(this,void 0,void 0,(function(){var t,i,o,c,h,l;return __generator(this,(function(d){switch(d.label){case 0:for(t={},i=0,o=a;i<o.length;i++)c=o[i],t[c]=void 0;h=Array(a.length),l=function(){var i;return __generator(this,(function(o){switch(o.label){case 0:return i=!0,[4,forEachWithBreaks(a,(function(o,a){if(!h[a])if(u[a]){var c=u[a]().then((function(i){return t[o]=i}));suppressUnhandledRejectionWarning(c),h[a]=c}else i=!1}))];case 1:return o.sent(),i?[2,"break"]:[4,wait(1)];case 2:return o.sent(),[2]}}))},d.label=1;case 1:return[5,l()];case 2:if("break"===d.sent())return[3,4];d.label=3;case 3:return[3,1];case 4:return[4,Promise.all(h)];case 5:return d.sent(),[2,t]}}))}))}}function isTrident(){var t=window,i=navigator;return countTruthy(["MSCSSMatrix"in t,"msSetImmediate"in t,"msIndexedDB"in t,"msMaxTouchPoints"in i,"msPointerEnabled"in i])>=4}function isChromium(){var t=window,i=navigator;return countTruthy(["webkitPersistentStorage"in i,"webkitTemporaryStorage"in i,0===i.vendor.indexOf("Google"),"webkitResolveLocalFileSystemURL"in t,"BatteryManager"in t,"webkitMediaStream"in t,"webkitSpeechGrammar"in t])>=5}function isWebKit(){var t=window,i=navigator;return countTruthy(["ApplePayError"in t,"CSSPrimitiveValue"in t,"Counter"in t,0===i.vendor.indexOf("Apple"),"getStorageUpdates"in i,"WebKitMediaKeys"in t])>=4}function isDesktopSafari(){var t=window;return countTruthy(["safari"in t,!("DeviceMotionEvent"in t),!("ongestureend"in t),!("standalone"in navigator)])>=3}function isAndroid(){var t=isChromium(),i=function isGecko(){var t,i,o=window;return countTruthy(["buildID"in navigator,"MozAppearance"in(null!==(i=null===(t=document.documentElement)||void 0===t?void 0:t.style)&&void 0!==i?i:{}),"onmozfullscreenchange"in o,"mozInnerScreenX"in o,"CSSMozDocumentRule"in o,"CanvasCaptureMediaStream"in o])>=4}();if(!t&&!i)return!1;var o=window;return countTruthy(["onorientationchange"in o,"orientation"in o,t&&!("SharedWorker"in o),i&&/android/i.test(navigator.appVersion)])>=2}function makeInnerError(t){var i=new Error(t);return i.name=t,i}function withIframe(t,i,o){var a,u,c;return void 0===o&&(o=50),__awaiter(this,void 0,void 0,(function(){var h,l;return __generator(this,(function(d){switch(d.label){case 0:h=document,d.label=1;case 1:return h.body?[3,3]:[4,wait(o)];case 2:return d.sent(),[3,1];case 3:l=h.createElement("iframe"),d.label=4;case 4:return d.trys.push([4,,10,11]),[4,new Promise((function(t,o){var a=!1,resolve=function(){a=!0,t()};l.onload=resolve,l.onerror=function(t){a=!0,o(t)};var u=l.style;u.setProperty("display","block","important"),u.position="absolute",u.top="0",u.left="0",u.visibility="hidden",i&&"srcdoc"in l?l.srcdoc=i:l.src="about:blank",h.body.appendChild(l);var checkReadyState=function(){var t,i;a||("complete"===(null===(i=null===(t=l.contentWindow)||void 0===t?void 0:t.document)||void 0===i?void 0:i.readyState)?resolve():setTimeout(checkReadyState,10))};checkReadyState()}))];case 5:d.sent(),d.label=6;case 6:return(null===(u=null===(a=l.contentWindow)||void 0===a?void 0:a.document)||void 0===u?void 0:u.body)?[3,8]:[4,wait(o)];case 7:return d.sent(),[3,6];case 8:return[4,t(l,l.contentWindow)];case 9:return[2,d.sent()];case 10:return null===(c=l.parentNode)||void 0===c||c.removeChild(l),[7];case 11:return[2]}}))}))}function selectorToElement(t){for(var i=function parseSimpleCssSelector(t){for(var i,o,a="Unexpected syntax '"+t+"'",u=/^\s*([a-z-]*)(.*)$/i.exec(t),c=u[1]||void 0,h={},l=/([.:#][\w-]+|\[.+?\])/gi,addAttribute=function(t,i){h[t]=h[t]||[],h[t].push(i)};;){var d=l.exec(u[2]);if(!d)break;var p=d[0];switch(p[0]){case".":addAttribute("class",p.slice(1));break;case"#":addAttribute("id",p.slice(1));break;case"[":var m=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(p);if(!m)throw new Error(a);addAttribute(m[1],null!==(o=null!==(i=m[4])&&void 0!==i?i:m[5])&&void 0!==o?o:"");break;default:throw new Error(a)}}return[c,h]}(t),o=i[0],a=i[1],u=document.createElement(null!=o?o:"div"),c=0,h=Object.keys(a);c<h.length;c++){var l=h[c],d=a[l].join(" ");"style"===l?addStyleString(u.style,d):u.setAttribute(l,d)}return u}function addStyleString(t,i){for(var o=0,a=i.split(";");o<a.length;o++){var u=a[o],c=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(u);if(c){var h=c[1],l=c[2],d=c[4];t.setProperty(h,l,d||"")}}}var w=["monospace","sans-serif","serif"],_=["sans-serif-thin","ARNO PRO","Agency FB","Arabic Typesetting","Arial Unicode MS","AvantGarde Bk BT","BankGothic Md BT","Batang","Bitstream Vera Sans Mono","Calibri","Century","Century Gothic","Clarendon","EUROSTILE","Franklin Gothic","Futura Bk BT","Futura Md BT","GOTHAM","Gill Sans","HELV","Haettenschweiler","Helvetica Neue","Humanst521 BT","Leelawadee","Letter Gothic","Levenim MT","Lucida Bright","Lucida Sans","Menlo","MS Mincho","MS Outlook","MS Reference Specialty","MS UI Gothic","MT Extra","MYRIAD PRO","Marlett","Meiryo UI","Microsoft Uighur","Minion Pro","Monotype Corsiva","PMingLiU","Pristina","SCRIPTINA","Segoe UI Light","Serifa","SimHei","Small Fonts","Staccato222 BT","TRAJAN PRO","Univers CE 55 Medium","Vrinda","ZWAdobeF"];function doesSupportWinding(t){return t.rect(0,0,10,10),t.rect(2,2,6,6),!t.isPointInPath(5,5,"evenodd")}function makeTextImage(t,i){t.width=240,t.height=60,i.textBaseline="alphabetic",i.fillStyle="#f60",i.fillRect(100,1,62,20),i.fillStyle="#069",i.font='11pt "Times New Roman"';var o="Cwm fjordbank gly "+String.fromCharCode(55357,56835);return i.fillText(o,2,15),i.fillStyle="rgba(102, 204, 0, 0.2)",i.font="18pt Arial",i.fillText(o,4,45),save(t)}function makeGeometryImage(t,i){t.width=122,t.height=110,i.globalCompositeOperation="multiply";for(var o=0,a=[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]];o<a.length;o++){var u=a[o],c=u[0],h=u[1],l=u[2];i.fillStyle=c,i.beginPath(),i.arc(h,l,40,0,2*Math.PI,!0),i.closePath(),i.fill()}return i.fillStyle="#f9c",i.arc(60,60,60,0,2*Math.PI,!0),i.arc(60,60,20,0,2*Math.PI,!0),i.fill("evenodd"),save(t)}function save(t){return t.toDataURL()}var M,k;function getScreenFrame(){var t=this;return function watchScreenFrame(){if(void 0===k){var checkScreenFrame=function(){var t=getCurrentScreenFrame();isFrameSizeNull(t)?k=setTimeout(checkScreenFrame,2500):(M=t,k=void 0)};checkScreenFrame()}}(),function(){return __awaiter(t,void 0,void 0,(function(){var t;return __generator(this,(function(i){switch(i.label){case 0:return isFrameSizeNull(t=getCurrentScreenFrame())?M?[2,__spreadArrays(M)]:function getFullscreenElement(){var t=document;return t.fullscreenElement||t.msFullscreenElement||t.mozFullScreenElement||t.webkitFullscreenElement||null}()?[4,(o=document,(o.exitFullscreen||o.msExitFullscreen||o.mozCancelFullScreen||o.webkitExitFullscreen).call(o))]:[3,2]:[3,2];case 1:i.sent(),t=getCurrentScreenFrame(),i.label=2;case 2:return isFrameSizeNull(t)||(M=t),[2,t]}var o}))}))}}function getCurrentScreenFrame(){var t=screen;return[replaceNaN(toFloat(t.availTop),null),replaceNaN(toFloat(t.width)-toFloat(t.availWidth)-replaceNaN(toFloat(t.availLeft),0),null),replaceNaN(toFloat(t.height)-toFloat(t.availHeight)-replaceNaN(toFloat(t.availTop),0),null),replaceNaN(toFloat(t.availLeft),null)]}function isFrameSizeNull(t){for(var i=0;i<4;++i)if(t[i])return!1;return!0}var B={abpIndo:["#Iklan-Melayang","#Kolom-Iklan-728","#SidebarIklan-wrapper",'a[title="7naga poker" i]','[title="ALIENBOLA" i]'],abpvn:["#quangcaomb",".iosAdsiosAds-layout",".quangcao",'[href^="https://r88.vn/"]','[href^="https://zbet.vn/"]'],adBlockFinland:[".mainostila",".sponsorit",".ylamainos",'a[href*="/clickthrgh.asp?"]','a[href^="https://app.readpeak.com/ads"]'],adBlockPersian:["#navbar_notice_50",".kadr",'TABLE[width="140px"]',"#divAgahi","#ad2_inline"],adBlockWarningRemoval:["#adblock-honeypot",".adblocker-root",".wp_adblock_detect",".header-blocked-ad","#ad_blocker"],adGuardAnnoyances:['amp-embed[type="zen"]',".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil"],adGuardBase:[".BetterJsPopOverlay","#ad_300X250","#bannerfloat22","#ad-banner","#campaign-banner"],adGuardChinese:[".Zi_ad_a_H",'a[href*="/od005.com"]','a[href*=".hthbet34.com"]',".qq_nr_lad","#widget-quan"],adGuardFrench:["#block-views-ads-sidebar-block-block","#pavePub",".ad-desktop-rectangle",".mobile_adhesion",".widgetadv"],adGuardGerman:[".banneritemwerbung_head_1",".boxstartwerbung",".werbung3",'a[href^="http://www.eis.de/index.phtml?refid="]','a[href^="https://www.tipico.com/?affiliateId="]'],adGuardJapanese:["#kauli_yad_1",'a[href^="http://ad2.trafficgate.net/"]',"._popIn_infinite_ad",".adgoogle",".ad_regular3"],adGuardMobile:["amp-auto-ads",".amp_ad",'amp-embed[type="24smi"]',"#mgid_iframe1","#ad_inview_area"],adGuardRussian:['a[href^="https://ad.letmeads.com/"]',".reclama",'div[id^="smi2adblock"]','div[id^="AdFox_banner_"]',"#ad_square"],adGuardSocial:['a[href^="//www.stumbleupon.com/submit?url="]','a[href^="//telegram.me/share/url?"]',".etsy-tweet","#inlineShare",".popup-social"],adGuardSpanishPortuguese:["#barraPublicidade","#Publicidade","#publiEspecial","#queTooltip",'[href^="http://ads.glispa.com/"]'],adGuardTrackingProtection:["#qoo-counter",'a[href^="http://click.hotlog.ru/"]','a[href^="http://hitcounter.ru/top/stat.php"]','a[href^="http://top.mail.ru/jump"]',"#top100counter"],adGuardTurkish:["#backkapat","#reklami",'a[href^="http://adserv.ontek.com.tr/"]','a[href^="http://izlenzi.com/campaign/"]','a[href^="http://www.installads.net/"]'],bulgarian:["td#freenet_table_ads","#ea_intext_div",".lapni-pop-over","#xenium_hot_offers","#newAd"],easyList:["#AD_CONTROL_28",".second-post-ads-wrapper",".universalboxADVBOX03",".advertisement-728x90",".square_ads"],easyListChina:['a[href*=".wensixuetang.com/"]','.appguide-wrap[onclick*="bcebos.com"]',".frontpageAdvM","#taotaole","#aafoot.top_box"],easyListCookie:["#AdaCompliance.app-notice",".text-center.rgpd",".panel--cookie",".js-cookies-andromeda",".elxtr-consent"],easyListCzechSlovak:["#onlajny-stickers","#reklamni-box",".reklama-megaboard",".sklik",'[id^="sklikReklama"]'],easyListDutch:["#advertentie","#vipAdmarktBannerBlock",".adstekst",'a[href^="https://xltube.nl/click/"]',"#semilo-lrectangle"],easyListGermany:["#Ad_Win2day","#werbungsbox300",'a[href^="http://www.rotlichtkartei.com/?sc="]',"#werbung_wideskyscraper_screen",'a[href^="http://landing.parkplatzkartei.com/?ag="]'],easyListItaly:[".box_adv_annunci",".sb-box-pubbliredazionale",'a[href^="http://affiliazioniads.snai.it/"]','a[href^="https://adserver.html.it/"]','a[href^="https://affiliazioniads.snai.it/"]'],easyListLithuania:[".reklamos_tarpas",".reklamos_nuorodos",'img[alt="Reklaminis skydelis"]','img[alt="Dedikuoti.lt serveriai"]','img[alt="Hostingas Serveriai.lt"]'],estonian:['A[href*="http://pay4results24.eu"]'],fanboyAnnoyances:["#feedback-tab","#taboola-below-article",".feedburnerFeedBlock",".widget-feedburner-counter",'[title="Subscribe to our blog"]'],fanboyAntiFacebook:[".util-bar-module-firefly-visible"],fanboyEnhancedTrackers:[".open.pushModal","#issuem-leaky-paywall-articles-zero-remaining-nag","#sovrn_container",'div[class$="-hide"][zoompage-fontsize][style="display: block;"]',".BlockNag__Card"],fanboySocial:[".td-tags-and-social-wrapper-box",".twitterContainer",".youtube-social",'a[title^="Like us on Facebook"]','img[alt^="Share on Digg"]'],frellwitSwedish:['a[href*="casinopro.se"][target="_blank"]','a[href*="doktor-se.onelink.me"]',"article.category-samarbete","div.holidAds","ul.adsmodern"],greekAdBlock:['A[href*="adman.otenet.gr/click?"]','A[href*="http://axiabanners.exodus.gr/"]','A[href*="http://interactive.forthnet.gr/click?"]',"DIV.agores300","TABLE.advright"],hungarian:["#cemp_doboz",".optimonk-iframe-container",".ad__main",'[class*="GoogleAds"]',"#hirdetesek_box"],iDontCareAboutCookies:['.alert-info[data-block-track*="CookieNotice"]',".ModuleTemplateCookieIndicator",".o--cookies--container",".cookie-msg-info-container","#cookies-policy-sticky"],icelandicAbp:['A[href^="/framework/resources/forms/ads.aspx"]'],latvian:['a[href="http://www.salidzini.lv/"][style="display: block; width: 120px; height: 40px; overflow: hidden; position: relative;"]','a[href="http://www.salidzini.lv/"][style="display: block; width: 88px; height: 31px; overflow: hidden; position: relative;"]'],listKr:['a[href*="//ad.planbplus.co.kr/"]',"#livereAdWrapper",'a[href*="//adv.imadrep.co.kr/"]',"ins.fastview-ad",".revenue_unit_item.dable"],listeAr:[".geminiLB1Ad",".right-and-left-sponsers",'a[href*=".aflam.info"]','a[href*="booraq.org"]','a[href*="dubizzle.com/ar/?utm_source="]'],listeFr:['a[href^="http://promo.vador.com/"]',"#adcontainer_recherche",'a[href*="weborama.fr/fcgi-bin/"]',".site-pub-interstitiel",'div[id^="crt-"][data-criteo-id]'],officialPolish:["#ceneo-placeholder-ceneo-12",'[href^="https://aff.sendhub.pl/"]','a[href^="http://advmanager.techfun.pl/redirect/"]','a[href^="http://www.trizer.pl/?utm_source"]',"div#skapiec_ad"],ro:['a[href^="//afftrk.altex.ro/Counter/Click"]','a[href^="/magazin/"]','a[href^="https://blackfridaysales.ro/trk/shop/"]','a[href^="https://event.2performant.com/events/click"]','a[href^="https://l.profitshare.ro/"]'],ruAd:['a[href*="//febrare.ru/"]','a[href*="//utimg.ru/"]','a[href*="://chikidiki.ru"]',"#pgeldiz",".yandex-rtb-block"],thaiAds:["a[href*=macau-uta-popup]","#ads-google-middle_rectangle-group",".ads300s",".bumq",".img-kosana"],webAnnoyancesUltralist:["#mod-social-share-2","#social-tools",".ctpl-fullbanner",".zergnet-recommend",".yt.btn-link.btn-md.btn"]};function getBlockedSelectors(t){var i;return __awaiter(this,void 0,void 0,(function(){var o,a,u,c,h,l,d;return __generator(this,(function(p){switch(p.label){case 0:for(o=document,a=o.createElement("div"),u=new Array(t.length),c={},forceShow(a),d=0;d<t.length;++d)h=selectorToElement(t[d]),forceShow(l=o.createElement("div")),l.appendChild(h),a.appendChild(l),u[d]=h;p.label=1;case 1:return o.body?[3,3]:[4,wait(50)];case 2:return p.sent(),[3,1];case 3:o.body.appendChild(a);try{for(d=0;d<t.length;++d)u[d].offsetParent||(c[t[d]]=!0)}finally{null===(i=a.parentNode)||void 0===i||i.removeChild(a)}return[2,c]}}))}))}function forceShow(t){t.style.setProperty("display","block","important")}function doesMatch$4(t){return matchMedia("(inverted-colors: "+t+")").matches}function doesMatch$3(t){return matchMedia("(forced-colors: "+t+")").matches}function doesMatch$2(t){return matchMedia("(prefers-contrast: "+t+")").matches}function doesMatch$1(t){return matchMedia("(prefers-reduced-motion: "+t+")").matches}function doesMatch(t){return matchMedia("(dynamic-range: "+t+")").matches}var P=Math,fallbackFn=function(){return 0};var x={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};var I={fonts:function getFonts(){return withIframe((function(t,i){var o=i.document,a=o.body;a.style.fontSize="48px";var u=o.createElement("div"),c={},h={},createSpan=function(t){var i=o.createElement("span"),a=i.style;return a.position="absolute",a.top="0",a.left="0",a.fontFamily=t,i.textContent="mmMwWLliI0O&1",u.appendChild(i),i},l=w.map(createSpan),d=function(){for(var t={},_loop_1=function(i){t[i]=w.map((function(t){return function(t,i){return createSpan("'"+t+"',"+i)}(i,t)}))},i=0,o=_;i<o.length;i++){_loop_1(o[i])}return t}();a.appendChild(u);for(var p=0;p<w.length;p++)c[w[p]]=l[p].offsetWidth,h[w[p]]=l[p].offsetHeight;return _.filter((function(t){return i=d[t],w.some((function(t,o){return i[o].offsetWidth!==c[t]||i[o].offsetHeight!==h[t]}));var i}))}))},domBlockers:function getDomBlockers(t){var i=(void 0===t?{}:t).debug;return __awaiter(this,void 0,void 0,(function(){var t,o,a,u;return __generator(this,(function(c){switch(c.label){case 0:return function isApplicable(){return isWebKit()||isAndroid()}()?(t=Object.keys(B),[4,getBlockedSelectors((u=[]).concat.apply(u,t.map((function(t){return B[t]}))))]):[2,void 0];case 1:return o=c.sent(),i&&function printDebug(t){for(var i="DOM blockers debug:\n```",o=0,a=Object.keys(B);o<a.length;o++){var u=a[o];i+="\n"+u+":";for(var c=0,h=B[u];c<h.length;c++){var l=h[c];i+="\n "+l+" "+(t[l]?"🚫":"➡️")}}console.log(i+"\n```")}(o),(a=t.filter((function(t){var i=B[t];return countTruthy(i.map((function(t){return o[t]})))>.6*i.length}))).sort(),[2,a]}}))}))},fontPreferences:function getFontPreferences(){return function withNaturalFonts(t,i){void 0===i&&(i=4e3);return withIframe((function(o,a){var u=a.document,c=u.body,h=c.style;h.width=i+"px",h.webkitTextSizeAdjust=h.textSizeAdjust="none",isChromium()?c.style.zoom=""+1/a.devicePixelRatio:isWebKit()&&(c.style.zoom="reset");var l=u.createElement("div");return l.textContent=__spreadArrays(Array(i/20<<0)).map((function(){return"word"})).join(" "),c.appendChild(l),t(u,c)}),'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}((function(t,i){for(var o={},a={},u=0,c=Object.keys(x);u<c.length;u++){var h=c[u],l=x[h],d=l[0],p=void 0===d?{}:d,m=l[1],g=void 0===m?"mmMwWLliI0fiflO&1":m,v=t.createElement("span");v.textContent=g,v.style.whiteSpace="nowrap";for(var b=0,w=Object.keys(p);b<w.length;b++){var _=w[b],M=p[_];void 0!==M&&(v.style[_]=M)}o[h]=v,i.appendChild(t.createElement("br")),i.appendChild(v)}for(var k=0,B=Object.keys(x);k<B.length;k++){a[h=B[k]]=o[h].getBoundingClientRect().width}return a}))},audio:function getAudioFingerprint(){var t=window,i=t.OfflineAudioContext||t.webkitOfflineAudioContext;if(!i)return-2;if(function doesCurrentBrowserSuspendAudioContext(){return isWebKit()&&!isDesktopSafari()&&!function isWebKit606OrNewer(){var t=window;return countTruthy(["DOMRectList"in t,"RTCPeerConnectionIceEvent"in t,"SVGGeometryElement"in t,"ontransitioncancel"in t])>=3}()}())return-1;var o=new i(1,5e3,44100),a=o.createOscillator();a.type="triangle",a.frequency.value=1e4;var u=o.createDynamicsCompressor();u.threshold.value=-50,u.knee.value=40,u.ratio.value=12,u.attack.value=0,u.release.value=.25,a.connect(u),u.connect(o.destination),a.start(0);var c=function startRenderingAudio(t){var finalize=function(){};return[new Promise((function(i,o){var a=!1,u=0,c=0;t.oncomplete=function(t){return i(t.renderedBuffer)};var startRunningTimeout=function(){setTimeout((function(){return o(makeInnerError("timeout"))}),Math.min(500,c+5e3-Date.now()))},tryRender=function(){try{switch(t.startRendering(),t.state){case"running":c=Date.now(),a&&startRunningTimeout();break;case"suspended":document.hidden||u++,a&&u>=3?o(makeInnerError("suspended")):setTimeout(tryRender,500)}}catch(t){o(t)}};tryRender(),finalize=function(){a||(a=!0,c>0&&startRunningTimeout())}})),finalize]}(o),h=c[0],l=c[1],d=h.then((function(t){return function getHash(t){for(var i=0,o=0;o<t.length;++o)i+=Math.abs(t[o]);return i}(t.getChannelData(0).subarray(4500))}),(function(t){if("timeout"===t.name||"suspended"===t.name)return-3;throw t}));return suppressUnhandledRejectionWarning(d),function(){return l(),d}},screenFrame:function getRoundedScreenFrame(){var t=this,i=getScreenFrame();return function(){return __awaiter(t,void 0,void 0,(function(){var t,o;return __generator(this,(function(a){switch(a.label){case 0:return[4,i()];case 1:return t=a.sent(),[2,[(o=function(t){return null===t?null:round(t,10)})(t[0]),o(t[1]),o(t[2]),o(t[3])]]}}))}))}},osCpu:function getOsCpu(){return navigator.oscpu},languages:function getLanguages(){var t=navigator,i=[],o=t.language||t.userLanguage||t.browserLanguage||t.systemLanguage;if(void 0!==o&&i.push([o]),Array.isArray(t.languages))isChromium()&&function isChromium86OrNewer(){var t=window;return countTruthy([!("MediaSettingsRange"in t),"RTCEncodedAudioFrame"in t,""+t.Intl=="[object Intl]",""+t.Reflect=="[object Reflect]"])>=3}()||i.push(t.languages);else if("string"==typeof t.languages){var a=t.languages;a&&i.push(a.split(","))}return i},colorDepth:function getColorDepth(){return window.screen.colorDepth},deviceMemory:function getDeviceMemory(){return replaceNaN(toFloat(navigator.deviceMemory),void 0)},screenResolution:function getScreenResolution(){var t=screen,parseDimension=function(t){return replaceNaN(toInt(t),null)},i=[parseDimension(t.width),parseDimension(t.height)];return i.sort().reverse(),i},hardwareConcurrency:function getHardwareConcurrency(){return replaceNaN(toInt(navigator.hardwareConcurrency),void 0)},timezone:function getTimezone(){var t,i=null===(t=window.Intl)||void 0===t?void 0:t.DateTimeFormat;if(i){var o=(new i).resolvedOptions().timeZone;if(o)return o}var a=-function getTimezoneOffset(){var t=(new Date).getFullYear();return Math.max(toFloat(new Date(t,0,1).getTimezoneOffset()),toFloat(new Date(t,6,1).getTimezoneOffset()))}();return"UTC"+(a>=0?"+":"")+Math.abs(a)},sessionStorage:function getSessionStorage(){try{return!!window.sessionStorage}catch(t){return!0}},localStorage:function getLocalStorage(){try{return!!window.localStorage}catch(t){return!0}},indexedDB:function getIndexedDB(){if(!isTrident()&&!function isEdgeHTML(){var t=window,i=navigator;return countTruthy(["msWriteProfilerMark"in t,"MSStream"in t,"msLaunchUri"in i,"msSaveBlob"in i])>=3&&!isTrident()}())try{return!!window.indexedDB}catch(t){return!0}},openDatabase:function getOpenDatabase(){return!!window.openDatabase},cpuClass:function getCpuClass(){return navigator.cpuClass},platform:function getPlatform(){var t=navigator.platform;return"MacIntel"===t&&isWebKit()&&!isDesktopSafari()?function isIPad(){if("iPad"===navigator.platform)return!0;var t=screen,i=t.width/t.height;return countTruthy(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,i>.65&&i<1.53])>=2}()?"iPad":"iPhone":t},plugins:function getPlugins(){var t=navigator.plugins;if(t){for(var i=[],o=0;o<t.length;++o){var a=t[o];if(a){for(var u=[],c=0;c<a.length;++c){var h=a[c];u.push({type:h.type,suffixes:h.suffixes})}i.push({name:a.name,description:a.description,mimeTypes:u})}}return i}},canvas:function getCanvasFingerprint(){var t=function makeCanvasContext(){var t=document.createElement("canvas");return t.width=1,t.height=1,[t,t.getContext("2d")]}(),i=t[0],o=t[1];return function isSupported(t,i){return!(!i||!t.toDataURL)}(i,o)?{winding:doesSupportWinding(o),geometry:makeGeometryImage(i,o),text:makeTextImage(i,o)}:{winding:!1,geometry:"",text:""}},touchSupport:function getTouchSupport(){var t,i=navigator,o=0;void 0!==i.maxTouchPoints?o=toInt(i.maxTouchPoints):void 0!==i.msMaxTouchPoints&&(o=i.msMaxTouchPoints);try{document.createEvent("TouchEvent"),t=!0}catch(i){t=!1}return{maxTouchPoints:o,touchEvent:t,touchStart:"ontouchstart"in window}},vendor:function getVendor(){return navigator.vendor||""},vendorFlavors:function getVendorFlavors(){for(var t=[],i=0,o=["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"];i<o.length;i++){var a=o[i],u=window[a];u&&"object"==typeof u&&t.push(a)}return t.sort()},cookiesEnabled:function areCookiesEnabled(){var t=document;try{t.cookie="cookietest=1; SameSite=Strict;";var i=-1!==t.cookie.indexOf("cookietest=");return t.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",i}catch(t){return!1}},colorGamut:function getColorGamut(){for(var t=0,i=["rec2020","p3","srgb"];t<i.length;t++){var o=i[t];if(matchMedia("(color-gamut: "+o+")").matches)return o}},invertedColors:function areColorsInverted(){return!!doesMatch$4("inverted")||!doesMatch$4("none")&&void 0},forcedColors:function areColorsForced(){return!!doesMatch$3("active")||!doesMatch$3("none")&&void 0},monochrome:function getMonochromeDepth(){if(matchMedia("(min-monochrome: 0)").matches){for(var t=0;t<=100;++t)if(matchMedia("(max-monochrome: "+t+")").matches)return t;throw new Error("Too high value")}},contrast:function getContrastPreference(){return doesMatch$2("no-preference")?0:doesMatch$2("high")||doesMatch$2("more")?1:doesMatch$2("low")||doesMatch$2("less")?-1:doesMatch$2("forced")?10:void 0},reducedMotion:function isMotionReduced(){return!!doesMatch$1("reduce")||!doesMatch$1("no-preference")&&void 0},hdr:function isHDR(){return!!doesMatch("high")||!doesMatch("standard")&&void 0},math:function getMathFingerprint(){var t,i=P.acos||fallbackFn,o=P.acosh||fallbackFn,a=P.asin||fallbackFn,u=P.asinh||fallbackFn,c=P.atanh||fallbackFn,h=P.atan||fallbackFn,l=P.sin||fallbackFn,d=P.sinh||fallbackFn,p=P.cos||fallbackFn,m=P.cosh||fallbackFn,g=P.tan||fallbackFn,v=P.tanh||fallbackFn,b=P.exp||fallbackFn,w=P.expm1||fallbackFn,_=P.log1p||fallbackFn;return{acos:i(.12312423423423424),acosh:o(1e308),acoshPf:(t=1e154,P.log(t+P.sqrt(t*t-1))),asin:a(.12312423423423424),asinh:u(1),asinhPf:function(t){return P.log(t+P.sqrt(t*t+1))}(1),atanh:c(.5),atanhPf:function(t){return P.log((1+t)/(1-t))/2}(.5),atan:h(.5),sin:l(-1e300),sinh:d(1),sinhPf:function(t){return P.exp(t)-1/P.exp(t)/2}(1),cos:p(10.000000000123),cosh:m(1),coshPf:function(t){return(P.exp(t)+1/P.exp(t))/2}(1),tan:g(-1e300),tanh:v(1),tanhPf:function(t){return(P.exp(2*t)-1)/(P.exp(2*t)+1)}(1),exp:b(1),expm1:w(1),expm1Pf:function(t){return P.exp(t)-1}(1),log1p:_(10),log1pPf:function(t){return P.log(1+t)}(10),powPI:function(t){return P.pow(P.PI,t)}(-100)}}};function getConfidence(t){var i=function getOpenConfidenceScore(t){if(isAndroid())return.4;if(isWebKit())return isDesktopSafari()?.5:.3;var i=t.platform.value||"";if(/^Win/.test(i))return.6;if(/^Mac/.test(i))return.5;return.7}(t),o=function deriveProConfidenceScore(t){return round(.99+.01*t,1e-4)}(i);return{score:i,comment:"$ if upgrade to Pro: https://fpjs.dev/pro".replace(/\$/g,""+o)}}function componentsToDebugString(t){return JSON.stringify(t,(function(t,i){return i instanceof Error?function errorToObject(t){var i;return __assign({name:t.name,message:t.message,stack:null===(i=t.stack)||void 0===i?void 0:i.split("\n")},t)}(i):i}),2)}function hashComponents(t){return x64hash128(function componentsToCanonicalString(t){for(var i="",o=0,a=Object.keys(t).sort();o<a.length;o++){var u=a[o],c=t[u],h=c.error?"error":JSON.stringify(c.value);i+=(i?"|":"")+u.replace(/([:|\\])/g,"\\$1")+":"+h}return i}(t))}function prepareForSources(t){return void 0===t&&(t=50),function requestIdleCallbackIfAvailable(t,i){void 0===i&&(i=1/0);var o=window.requestIdleCallback;return o?new Promise((function(t){return o.call(window,(function(){return t()}),{timeout:i})})):wait(Math.min(t,i))}(t,2*t)}function makeAgent(t,i){var o=Date.now();return{get:function(a){return __awaiter(this,void 0,void 0,(function(){var u,c,h;return __generator(this,(function(l){switch(l.label){case 0:return u=Date.now(),[4,t()];case 1:return c=l.sent(),h=function makeLazyGetResult(t){var i;return{get visitorId(){return void 0===i&&(i=hashComponents(this.components)),i},set visitorId(t){i=t},confidence:getConfidence(t),components:t,version:"3.3.4"}}(c),(i||(null==a?void 0:a.debug))&&console.log("Copy the text below to get the debug data:\n\n```\nversion: "+h.version+"\nuserAgent: "+navigator.userAgent+"\ntimeBetweenLoadAndGet: "+(u-o)+"\nvisitorId: "+h.visitorId+"\ncomponents: "+componentsToDebugString(c)+"\n```"),[2,h]}}))}))}}}var N={load:function load(t){var i=void 0===t?{}:t,o=i.delayFallback,a=i.debug,u=i.monitoring,c=void 0===u||u;return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return c&&function monitor(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var t=new XMLHttpRequest;t.open("get","https://m1.openfpcdn.io/fingerprintjs/v3.3.4/npm-monitoring",!0),t.send()}catch(t){console.error(t)}}(),[4,prepareForSources(o)];case 1:return t.sent(),[2,makeAgent(function loadBuiltinSources(t){return loadSources(I,t,[])}({debug:a}),a)]}}))}))},hashComponents:hashComponents,componentsToDebugString:componentsToDebugString};function fp_esm_min_r(t){for(var i="",o=0;o<t.length;++o)if(o>0){var a=t[o].toLowerCase();a!==t[o]?i+=" "+a:i+=t[o]}else i+=t[o].toUpperCase();return i}var A=fp_esm_min_r("WrongRegion"),C=fp_esm_min_r("SubscriptionNotActive"),O=fp_esm_min_r("UnsupportedVersion"),j=fp_esm_min_r("InstallationMethodRestricted");var L="Failed to load the JS script of the agent";var q={load:function D(t){var i,o=t.scriptUrlPattern,a=t.token,u=t.apiKey,c=void 0===u?a:u,h=function __rest(t,i){var o={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&i.indexOf(a)<0&&(o[a]=t[a]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var u=0;for(a=Object.getOwnPropertySymbols(t);u<a.length;u++)i.indexOf(a[u])<0&&Object.prototype.propertyIsEnumerable.call(t,a[u])&&(o[a[u]]=t[a[u]])}return o}(t,["scriptUrlPattern","token","apiKey"]),l=(i=t,"scriptUrlPattern",Object.prototype.hasOwnProperty.call(i,"scriptUrlPattern")?o:void 0),d=[];return Promise.resolve().then((function(){if(!c||"string"!=typeof c)throw new Error("API key required");return function y(t,i,o){return void 0===o&&(o=0),i(o).catch((function(a){if(o>=t.maxRetries)throw a;var u,c,h,l,d=(u=t.baseDelay,c=t.maxDelay,h=t.baseDelay*Math.pow(2,o),Math.max(u,Math.min(c,h)));return(l=d,new Promise((function(t){return setTimeout(t,l)}))).then((function(){return y(t,i,o+1)}))}))}({maxRetries:5,baseDelay:100,maxDelay:3e3},(function(){var t,i=new Date,r=function(){return d.push({startedAt:i,finishedAt:new Date})},o=(t=function(t,i){void 0===i&&(i="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js");var o=encodeURIComponent;return i.replace(/<[^<>]+>/g,(function(i){return"<version>"===i?"3":"<apiKey>"===i?o(t):"<loaderVersion>"===i?o("3.7.0"):i}))}(c,l),new Promise((function(i,o){var a=document.createElement("script"),n=function(){var t;return null===(t=a.parentNode)||void 0===t?void 0:t.removeChild(a)},u=document.head||document.getElementsByTagName("head")[0];a.onload=function(){n(),i()},a.onerror=function(){n(),o(new Error(L))},a.async=!0,a.src=t,u.appendChild(a)})));return o.then(r,r),o}))})).then((function(){var t=window,i="__fpjs_p_l_b",o=t[i];if(function(t,i){var o,a=null===(o=Object.getOwnPropertyDescriptor)||void 0===o?void 0:o.call(Object,t,i);(null==a?void 0:a.configurable)?delete t[i]:a&&!a.writable||(t[i]=void 0)}(t,i),"function"!=typeof(null==o?void 0:o.load))throw new Error(L);return o.load(__assign(__assign({},h),{ldi:{attempts:d}}))}))},ERROR_SCRIPT_LOAD_FAIL:L,ERROR_API_KEY_EXPIRED:"API key expired",ERROR_API_KEY_INVALID:"API key not found",ERROR_API_KEY_MISSING:"API key required",ERROR_BAD_REQUEST_FORMAT:"Request cannot be parsed",ERROR_BAD_RESPONSE_FORMAT:"Response cannot be parsed",ERROR_CLIENT_TIMEOUT:"Client timeout",ERROR_FORBIDDEN_ENDPOINT:fp_esm_min_r("HostnameRestricted"),ERROR_FORBIDDEN_HEADER:"Not available with restricted header",ERROR_FORBIDDEN_ORIGIN:"Not available for this origin",ERROR_GENERAL_SERVER_FAILURE:"Request failed",ERROR_INSTALLATION_METHOD_RESTRICTED:j,ERROR_NETWORK_ABORT:"Network request aborted",ERROR_NETWORK_CONNECTION:"Network connection error",ERROR_RATE_LIMIT:"Too many requests, rate limit exceeded",ERROR_SERVER_TIMEOUT:"Request failed to process",ERROR_SUBSCRIPTION_NOT_ACTIVE:C,ERROR_TOKEN_EXPIRED:"API key expired",ERROR_TOKEN_INVALID:"API key not found",ERROR_TOKEN_MISSING:"API key required",ERROR_UNSUPPORTED_VERSION:O,ERROR_WRONG_REGION:A};let wt_utils_wait=function(t){return new Promise(i=>setTimeout(i,t))},U=N.load({monitoring:!1}),z=q.load({monitoring:!1,apiKey:"5UHdpSuX3wHr3CjyEiSP",endpoint:"https://fingerprint.reactoo.com"}),getBrowserFingerprint=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return i?z.then(t=>t.get()).then(t=>{let i=t.visitorId.padEnd(32,"0");return[8,13,18,23].reduce((t,i)=>t.slice(0,i)+"-"+t.slice(i),i).substring(0,36)}):U.then(t=>t.get()).then(i=>{const a={...i.components,instanceType:{value:t+"_"+o}};return[8,13,18,23].reduce((t,i)=>t.slice(0,i)+"-"+t.slice(i),N.hashComponents(a)).substring(0,36)})},generateUUID=function(){var t=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(i){var o=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==i?o:3&o|8).toString(16)}))};const decodeJanusDisplay=t=>{let i={userId:null,role:"participant",start:Date.now(),displayName:"?"};if(t&&"string"==typeof t){if(t.indexOf(",")>=0){let o=t.split(new RegExp("\\".concat(",",'(?=(?:(?:[^"]*"){2})*[^"]*$)'),"mi")).map(t=>t&&t.startsWith('"')||t.endsWith('"')?t.substring(1,t.length-1):/^\d+$/.test(t)?parseInt(t):t);Object.keys(i).forEach((t,a)=>o[a]?i[t]=o[a]:null)}else i.userId=t;return i}return t&&"object"==typeof t?Object.assign({},i,t):null},setExactTimeout=function(t,i,o){const a=(new Date).getTime(),u=setInterval((function(){(new Date).getTime()-a>i&&(t(),clearInterval(u))}),o);return u};function _defineProperty(t,i,o){return i in t?Object.defineProperty(t,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[i]=o,t}class wt_room_Room{constructor(t){this.debug=t,this.sessions=[],this.safariVp8=!1,this.browser=v.browserDetails.browser,this.browserDetails=v.browserDetails,this.webrtcSupported=wt_room_Room.isWebrtcSupported(),this.safariVp8TestPromise=wt_room_Room.testSafariVp8(),this.safariVp8=null,this.safariVp8TestPromise.then(t=>{this.safariVp8=t}),this.whenInitialized=this.initialize()}initialize(){return this.safariVp8TestPromise.then(()=>this)}createSession(){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new wt_room_RoomSession(arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"reactooroom",{debug:this.debug,...t})}static testSafariVp8(){return new Promise(t=>{if("safari"===v.browserDetails.browser&&v.browserDetails.version>=605)if(RTCRtpSender&&RTCRtpSender.getCapabilities&&RTCRtpSender.getCapabilities("video")&&RTCRtpSender.getCapabilities("video").codecs&&RTCRtpSender.getCapabilities("video").codecs.length){var i=!1;for(var o in RTCRtpSender.getCapabilities("video").codecs){var a=RTCRtpSender.getCapabilities("video").codecs[o];if(a&&a.mimeType&&"video/vp8"===a.mimeType.toLowerCase()){i=!0;break}}t(i)}else{var u=new RTCPeerConnection({},{});u.createOffer({offerToReceiveVideo:!0}).then((function(i){let o=-1!==i.sdp.indexOf("VP8");u.close(),u=null,t(o)}))}else t(!1)})}static isWebrtcSupported(){return void 0!==window.RTCPeerConnection&&null!==window.RTCPeerConnection&&void 0!==navigator.mediaDevices&&null!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia&&null!==navigator.mediaDevices.getUserMedia}}class wt_room_RoomSession{static noop(){}static randomString(t){for(var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o="",a=0;a<t;a++){var u=Math.floor(Math.random()*i.length);o+=i.substring(u,u+1)}return o}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"reactooroom",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.assign(this,Object(b.a)()),this.defaultDataChannelLabel="JanusDataChannel",this.server=null,this.iceServers=null,this.token=null,this.roomId=null,this.streamId=null,this.pin=null,this.userId=null,this.sessiontype=i,this.initialBitrate=0,this.recordingFilename=null,this.pluginName=wt_room_RoomSession.sessionTypes[i],this.options=o,this.id=null,this.privateId=null,this.constructId=t||wt_room_RoomSession.randomString(16),this.sessionId=null,this.handleId=null,this.ws=null,this.isRestarting=!1,this.isConnecting=!1,this.isDisconnecting=!1,this.isConnected=!1,this.isPublished=!1,this.isReclaiming=!1,this.isStreaming=!1,this._ipv6Support=!1,this._retries=0,this._maxRetries=3,this._keepAliveId=null,this._participants=[],this._roomType="watchparty",this._isDataChannelOpen=!1,this._abortController=null,this.isAudioMuted=!1,this.isVideoMuted=!1,this.isVideoEnabled=!1,this.isAudioEnabed=!1,this.isUnifiedPlan=wt_room_RoomSession.checkUnifiedPlan(),this.subscriptionRules={...wt_room_RoomSession.subscriptionRules,...this.options.subscriptionRules||{}},this._log=wt_room_RoomSession.noop,this.options.debug&&this._enableDebug()}static checkUnifiedPlan(){let t=!1;if("firefox"===v.browserDetails.browser&&v.browserDetails.version>=59)t=!0;else if("chrome"===v.browserDetails.browser&&v.browserDetails.version>=72)t=!0;else if(window.RTCRtpTransceiver&&"currentDirection"in RTCRtpTransceiver.prototype){const i=new RTCPeerConnection;try{i.addTransceiver("audio"),t=!0}catch(t){}i.close()}else t=!1;return t}_participantShouldSubscribe(t){const i=decodeJanusDisplay(this.display),o=decodeJanusDisplay(t);let a=(null==i?void 0:i.role)||"participant",u=(null==o?void 0:o.role)||"participant";return this.subscriptionRules[a][this._roomType||"watchparty"].indexOf(u)>-1}_getAddParticipantEventName(t){var i;let o=this._getHandle(t);o||this.emit("error",{type:"warning",id:15,message:"id non-existent",data:[t,"getParticipantEventName"]});switch(null===(i=decodeJanusDisplay(o.userId))||void 0===i?void 0:i.role){case"participant":return"addRemoteParticipant";case"talkback":case"monitor":return"addRemoteTalkback";case"observer":case"observerSolo1":case"observerSolo2":case"observerSolo3":return"addRemoteObserver";case"host":return"addRemoteInstructor";case"companionTV":return"addRemoteCompanionTV";case"companionPhone":return"addRemoteCompanionPhone";default:return"addRemoteParticipant"}}_getRemoveParticipantEventName(t){var i;let o=this._getHandle(t);o||this.emit("error",{type:"warning",id:15,message:"id non-existent",data:[t,"getParticipantEventName"]});switch(null===(i=decodeJanusDisplay(o.userId))||void 0===i?void 0:i.role){case"participant":return"removeRemoteParticipant";case"talkback":return"addRemoteTalkback";case"monitor":return"removeRemoteTalkback";case"observer":case"observerSolo1":case"observerSolo2":case"observerSolo3":return"removeRemoteObserver";case"host":return"removeRemoteInstructor";case"companionTV":return"removeRemoteCompanionTV";case"companionPhone":return"removeRemoteCompanionPhone";default:return"removeRemoteParticipant"}}sendMessage(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{body:"Example Body"},o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return this._send({janus:"message",handle_id:t,...i},o,a).then(t=>{if(t&&"success"===t.janus){let i=(t.plugindata||{}).data;return Promise.resolve(i)}return Promise.resolve()}).catch(t=>t&&t.error?Promise.reject({type:"warning",id:1,message:"sendMessage failed",data:t.error}):Promise.reject({type:"warning",id:1,message:"sendMessage failed",data:t}))}_send(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=wt_room_RoomSession.randomString(12),u={...t,transaction:a,token:this.token,...this.sessionId&&{session_id:this.sessionId}||{}};return this._log(u),new Promise((t,c)=>{let h=null,abortResponse=()=>{this._abortController.signal.removeEventListener("abort",abortResponse),clearTimeout(h),this.ws.removeEventListener("message",parseResponse),c({type:"warning",id:17,message:"connection cancelled"})},parseResponse=i=>{let l=JSON.parse(i.data);var d;l.transaction!==a||o&&"ack"===l.janus||(clearTimeout(h),this._abortController.signal.removeEventListener("abort",abortResponse),this.ws.removeEventListener("message",parseResponse),"error"===l.janus?(403==(null==l||null===(d=l.error)||void 0===d?void 0:d.code)&&this.disconnect(!0),c({type:"error",id:2,message:"send failed",data:l,requestData:u})):t(l))};i?(this.ws&&1===this.ws.readyState&&this.ws.send(JSON.stringify(u)),t()):this.ws&&1===this.ws.readyState?(this.ws.addEventListener("message",parseResponse),h=setTimeout(()=>{this.ws.removeEventListener("message",parseResponse),this._abortController.signal.removeEventListener("abort",abortResponse),c({type:"error",id:3,message:"send timeout",data:u})},1e4),this._abortController.signal.addEventListener("abort",abortResponse),this.ws.send(JSON.stringify(u))):c({type:"warning",id:29,message:"No connection to WebSockets",data:u})})}_connectionClosed(){!this.isConnected||this.isConnecting||this.isDisconnecting||(this._retries<this._maxRetries?setTimeout(()=>{this._retries++,this._reconnect().catch(t=>{this.emit("error",t)})},3e3*this._retries):("reactooroom"===this.sessiontype?this.disconnect(!0):"streaming"===this.sessiontype&&this.stopStream(),this.emit("error",{type:"error",id:4,message:"Lost connection to WebSockets",data:null})))}_wipeListeners(){this.ws&&(this.ws.removeEventListener("close",this.__connectionClosedBoundFn),this.ws.removeEventListener("message",this.__handleWsEventsBoundFn))}_startKeepAlive(){this._send({janus:"keepalive"}).then(t=>{"ack"!==t.janus&&this.emit("error",{type:"warning",id:5,message:"keepalive response suspicious",data:t.janus})}).catch(t=>{this.emit("error",{type:"warning",id:6,message:"keepalive dead",data:t}),this._connectionClosed()}),this._keepAliveId=setTimeout(()=>{this._startKeepAlive()},3e4)}_stopKeepAlive(){clearTimeout(this._keepAliveId)}_handleWsEvents(t){let i=JSON.parse(t.data);var o=i.sender,a=i.janus;let u=this._getHandle(o);if(u){if("trickle"===a){let t=i.candidate,o=u.webrtcStuff;o.pc&&o.remoteSdp?t&&!0!==t.completed?o.pc.addIceCandidate(t):o.pc.addIceCandidate(null):(o.candidates||(o.candidates=[]),o.candidates.push(t))}else"webrtcup"===a||("hangup"===a?(this._log("hangup on",u.handleId),this._removeParticipant(u.handleId,null,!1)):"detached"===a?(this._log("detached on",u.handleId),this._removeParticipant(u.handleId,null,!0)):"media"===a?this._log("Media event:",u.handleId,i.type,i.receiving,i.mid):"slowlink"===a?this._log("Slowlink",u.handleId,i.uplink,i.lost,i.mid):"event"===a||("timeout"===a?this.ws.close(3504,"Gateway timeout"):"success"===a||"error"===a||this._log("Unknown event: ".concat(a," on session: ").concat(this.sessionId))));if(o===this.handleId)if("event"===a){var c=(i.plugindata||{}).data||{},h=i.jsep;let t=c.result||null,a=c.videoroom||null,u=c.publishers||{},l=c.leaving,d=c.unpublished,p=c.error;if("joined"===a){this.id=c.id,this.privateId=c.private_id,this.isConnected=!0,this.emit("joined",!0),this._log("We have successfully joined Room");for(let t in u){let i=u[t].display,o=u[t].streams||[],a=u[t].id;for(let t in o)o[t].id=a,o[t].display=i;this._log("Remote userId: ",i),this._participantShouldSubscribe(i)&&(this._log("Creating user: ",i),this._createParticipant(i,a).then(t=>this.sendMessage(t.handleId,{body:{request:"join",room:this.roomId,ptype:"subscriber",feed:a,private_id:this.privateId,...this.webrtcVersion>1e3?{id:this.userId}:{},pin:this.pin}})).catch(t=>{this.emit("error",t)}))}}else if("event"===a){void 0!==c.streams&&null!==c.streams&&this._log("Got my own streams back",c.streams);for(let t in u){let i=u[t].display,o=u[t].streams||[],a=u[t].id;for(let t in o)o[t].id=a,o[t].display=i;this._log("Remote userId: ",i),this._participantShouldSubscribe(i)&&(this._log("Creating user: ",i),this._createParticipant(i,a).then(t=>this.sendMessage(t.handleId,{body:{request:"join",room:this.roomId,ptype:"subscriber",feed:a,private_id:this.privateId,...this.webrtcVersion>1e3?{id:this.userId}:{},pin:this.pin}})).catch(t=>{this.emit("error",t)}))}"ok"===l?(this._log("leaving",this.handleId,"this is us"),this._removeParticipant(this.handleId),"kicked"===c.reason&&(this.emit("kicked"),this.disconnect().catch(()=>{}))):l&&(this._log("leaving",l),this._removeParticipant(null,l)),"ok"===d?(this._log("unpublished",this.handleId,"this is us"),this._removeParticipant(this.handleId,null,!1)):d&&(this._log("unpublished",d),this._removeParticipant(null,d,!0)),p&&this.emit("error",{type:"error",id:7,message:"local participant error",data:[o,c]})}else t&&t.status&&(this.emit("streamingStatus",t.status),"stopped"===t.status&&this.stopStream(),"started"===t.status&&(this.emit("streaming",!0),this.isStreaming=!0));null!=h&&("reactooroom"===this.sessiontype?this._webrtcPeer(this.handleId,h).catch(t=>{this.emit("error",t)}):"streaming"===this.sessiontype&&this._publishRemote(this.handleId,h).catch(t=>{this.emit("error",t)}))}else"webrtcup"===a&&(this._log("Configuring bitrate: "+this.initialBitrate),this.initialBitrate>0&&this.sendMessage(this.handleId,{body:{request:"configure",bitrate:this.initialBitrate}}).catch(()=>null));else{let t=(i.plugindata||{}).data||{},a=i.jsep,c=t.videoroom,h=t.error;var l,d;if("attached"===c)this._log("Remote have successfully joined Room",t),this.emit(this._getAddParticipantEventName(u.handleId),{tid:generateUUID(),id:u.handleId,userId:null===(l=decodeJanusDisplay(u.userId))||void 0===l?void 0:l.userId,role:null===(d=decodeJanusDisplay(u.userId))||void 0===d?void 0:d.role,stream:null,track:null,adding:!1,constructId:this.constructId,metaData:this.options.metaData,hasAudioTrack:!1,hasVideoTrack:!1});h&&this.emit("error",{type:"warning",id:8,message:"remote participant error",data:[o,t]}),a&&this._publishRemote(u.handleId,a).catch(t=>{this.emit("error",t)})}}}_handleDataEvents(t,i,o){let a=this._getHandle(t);if("state"===i){if(this._log(" - Data channel status - ","UID: ".concat(t),"STATUS: ".concat(JSON.stringify(o)),"ME: ".concat(t===this.handleId)),a){a.webrtcStuff.dataChannelOpen=this.defaultDataChannelLabel===(null==o?void 0:o.label)&&"open"===(null==o?void 0:o.state)}t===this.handleId&&this.defaultDataChannelLabel===(null==o?void 0:o.label)&&(this._isDataChannelOpen="open"===(null==o?void 0:o.state),this.emit("dataChannel","open"===(null==o?void 0:o.state)))}if("error"===i){if(this.emit("error",{type:"warning",id:9,message:"data event warning",data:[t,o]}),a){let t=a.webrtcStuff;this.defaultDataChannelLabel===o.label&&(t.dataChannelOpen=!1)}t===this.handleId&&this.defaultDataChannelLabel===o.label&&(this._isDataChannelOpen=!1,this.emit("dataChannel",!1))}if(t===this.handleId&&"message"===i){let i=null;try{i=JSON.parse(o)}catch(i){return void this.emit("error",{type:"warning",id:10,message:"data message parse error",data:[t,i]})}this.emit("data",i)}}_removeParticipant(t,i){let o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=this._getHandle(t,i);return a?(t=a.handleId,this._send({janus:"hangup",handle_id:t},!0).then(()=>o?this._send({janus:"detach",handle_id:t},!0):Promise.resolve()).finally(()=>{try{a.webrtcStuff.stream&&!this.isRestarting&&a.webrtcStuff.stream.getTracks().forEach(t=>t.stop())}catch(t){}a.webrtcStuff.stream=null,a.webrtcStuff.dataChannel&&Object.keys(a.webrtcStuff.dataChannel).forEach(t=>{a.webrtcStuff.dataChannel[t].onmessage=null,a.webrtcStuff.dataChannel[t].onopen=null,a.webrtcStuff.dataChannel[t].onclose=null,a.webrtcStuff.dataChannel[t].onerror=null}),a.webrtcStuff.pc&&(a.webrtcStuff.pc.onicecandidate=null,a.webrtcStuff.pc.ontrack=null,a.webrtcStuff.pc.ondatachannel=null,a.webrtcStuff.pc.onconnectionstatechange=null,a.webrtcStuff.pc.oniceconnectionstatechange=null);try{a.webrtcStuff.pc.close()}catch(t){}var i,u,c,h;(a.webrtcStuff={stream:null,mySdp:null,mediaConstraints:null,pc:null,dataChannelOpen:!1,dataChannel:null,dtmfSender:null,trickle:!0,iceDone:!1},t===this.handleId)?(this._isDataChannelOpen=!1,this.isPublished=!1,this.emit("published",{status:!1,hasStream:!1}),this.emit("removeLocalParticipant",{id:t,userId:null===(i=decodeJanusDisplay(a.userId))||void 0===i?void 0:i.userId,role:null===(u=decodeJanusDisplay(a.userId))||void 0===u?void 0:u.role})):this.emit(this._getRemoveParticipantEventName(t),{id:t,userId:null===(c=decodeJanusDisplay(a.userId))||void 0===c?void 0:c.userId,role:null===(h=decodeJanusDisplay(a.userId))||void 0===h?void 0:h.role});if(o){let i=this._participants.findIndex(i=>i.handleId===t);this._participants.splice(i,1)}return!0})):Promise.resolve()}_createParticipant(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._send({janus:"attach",plugin:this.pluginName}).then(o=>{let a={handleId:o.data.id,rfid:i,userId:t,webrtcStuff:{stream:null,mySdp:null,mediaConstraints:null,pc:null,dataChannelOpen:!1,dataChannel:null,dtmfSender:null,trickle:!0,iceDone:!1,isIceRestarting:!1}};return this._participants.push(a),a})}_joinRoom(t,i,o,a){return this.sendMessage(this.handleId,{body:{request:"join",room:t,pin:i,ptype:"publisher",display:a,...this.webrtcVersion>1e3?{id:o}:{}}},!1,!0)}_watchStream(t){return this.sendMessage(this.handleId,{body:{request:"watch",id:parseInt(t)}},!1,!0)}_leaveRoom(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.isConnected?this.sendMessage(this.handleId,{body:{request:"leave"}},t).finally(()=>{this.isConnected=!1,this.emit("joined",!1)}):Promise.resolve()}_reconnect(){return this.isReclaiming?Promise.resolve():(this.ws&&(this._wipeListeners(),1===this.ws.readyState&&this.ws.close()),this._stopKeepAlive(),this.isReclaiming=!0,this.emit("joining",!0),new Promise((t,i)=>{let abortReconnect=()=>{this._abortController.signal.removeEventListener("abort",abortReconnect),this.ws.removeEventListener("close",this.__connectionClosedBoundFn),this.ws.removeEventListener("message",this.__handleWsEventsBoundFn),this.ws.onopen=null,this.ws.onerror=null,this.isReclaiming=!1,this.emit("joining",!1),i({type:"warning",id:17,message:"Connection cancelled",data:e})};this.ws=new WebSocket(this.server,"janus-protocol"),this.__connectionClosedBoundFn=this._connectionClosed.bind(this),this.__handleWsEventsBoundFn=this._handleWsEvents.bind(this),this.ws.addEventListener("close",this.__connectionClosedBoundFn),this.ws.addEventListener("message",this.__handleWsEventsBoundFn),this.ws.onopen=()=>{this._abortController.signal.removeEventListener("abort",abortReconnect),this._send({janus:"claim"}).then(i=>{this.sessionId=i.session_id?i.session_id:i.data.id,this._startKeepAlive(),this.isReclaiming=!1,this.emit("joining",!1),this._retries=0,t(i)}).catch(t=>{this.isReclaiming=!1,this.emit("joining",!1),i({type:"error",id:11,message:"reconnection error",data:t})})},this.ws.onerror=t=>{this._abortController.signal.removeEventListener("abort",abortReconnect),this.isReclaiming=!1,this.emit("joining",!1),i({type:"warning",id:12,message:"ws reconnection error",data:t})},this._abortController.signal.addEventListener("abort",abortReconnect)}))}connect(t,i,o,a,u,c,h){let l=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0,d=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0,p=arguments.length>9?arguments[9]:void 0;return this.isConnecting?Promise.reject({type:"warning",id:16,message:"connection already in progress"}):(this.ws&&this._wipeListeners(),this._stopKeepAlive(),this._abortController=new AbortController,this.sessionId=null,this.server=o,this.iceServers=a,this.token=u,this.roomId=t,this.pin=i,this.display=c,this.userId=h,this.webrtcVersion=l,this.initialBitrate=d,this.recordingFilename=p,this.isConnecting=!0,this.emit("joining",!0),new Promise((o,a)=>{this.ws=new WebSocket(this.server,"janus-protocol"),this.__connectionClosedBoundFn=this._connectionClosed.bind(this),this.__handleWsEventsBoundFn=this._handleWsEvents.bind(this);let abortConnect=()=>{this._abortController.signal.removeEventListener("abort",abortConnect),this.ws.removeEventListener("close",this.__connectionClosedBoundFn),this.ws.removeEventListener("message",this.__handleWsEventsBoundFn),this.ws.onopen=null,this.ws.onerror=null,this.isConnecting=!1,this.emit("joining",!1),a({type:"warning",id:17,message:"Connection cancelled"})};this.ws.addEventListener("close",this.__connectionClosedBoundFn),this.ws.addEventListener("message",this.__handleWsEventsBoundFn),this.ws.onopen=()=>{this._abortController.signal.removeEventListener("abort",abortConnect),this._retries=0,this._send({janus:"create"}).then(t=>(this.sessionId=t.session_id?t.session_id:t.data.id,this._startKeepAlive(),1)).then(()=>this._createParticipant(h)).then(t=>(this.handleId=t.handleId,1)).then(()=>this._joinRoom(t,i,h,c)).then(()=>{this.isConnecting=!1,this.emit("joining",!1),o(this)}).catch(t=>{this.isConnecting=!1,this.emit("joining",!1),a({type:"warning"===(null==t?void 0:t.type)?"warning":"error",id:13,message:"connection error",data:t})})},this.ws.onerror=t=>{this._abortController.signal.removeEventListener("abort",abortConnect),this.isConnecting=!1,this.emit("joining",!1),a({type:"error",id:14,message:"ws connection error",data:t})},this._abortController.signal.addEventListener("abort",abortConnect)}))}disconnect(){var t,i;if(this.isDisconnecting)return Promise.resolve();null===(t=this._abortController)||void 0===t||null===(i=t.abort)||void 0===i||i.call(t),this._stopKeepAlive();let o=this.isConnected;return this.isDisconnecting=!0,Promise.all(this._participants.map(t=>this._removeParticipant(t.handleId))).finally(()=>(this._wipeListeners(),this.ws&&1===this.ws.readyState&&(this._send({janus:"destroy"},!0),this.ws.close()),this.sessionId=null,this.isPublished=!1,this.isConnected=!1,this.isDisconnecting=!1,this.emit("publishing",!1),this.emit("published",{status:!1,hasStream:!1}),this.emit("joining",!1),this.emit("joined",!1),this.emit("disconnect",o),Promise.resolve("Disconnected")))}startStream(t,i,o,a,u){return this.isConnecting?Promise.reject({type:"warning",id:16,message:"connection error",data:"Connection is in progress"}):(this.ws&&this._wipeListeners(),this._stopKeepAlive(),this._abortController=new AbortController,this.server=i,this.iceServers=o,this.token=a,this.streamId=t,this.userId=u,this.sessionId=null,this.isConnecting=!0,this.emit("streamStarting",!0),new Promise((i,o)=>{this.ws=new WebSocket(this.server,"janus-protocol"),this.__connectionClosedBoundFn=this._connectionClosed.bind(this),this.__handleWsEventsBoundFn=this._handleWsEvents.bind(this);let abortConnect=()=>{this._abortController.signal.removeEventListener("abort",abortConnect),this.ws.removeEventListener("close",this.__connectionClosedBoundFn),this.ws.removeEventListener("message",this.__handleWsEventsBoundFn),this.ws.onopen=null,this.ws.onerror=null,this.isConnecting=!1,this.emit("streamStarting",!1),o({type:"warning",id:17,message:"Connection cancelled"})};this.ws.addEventListener("close",this.__connectionClosedBoundFn),this.ws.addEventListener("message",this.__handleWsEventsBoundFn),this.ws.onopen=()=>{this._abortController.signal.removeEventListener("abort",abortConnect),this._retries=0,this._send({janus:"create"}).then(t=>(this.sessionId=t.session_id?t.session_id:t.data.id,this._startKeepAlive(),1)).then(()=>this._createParticipant(u)).then(t=>(this.handleId=t.handleId,1)).then(()=>this._watchStream(t)).then(()=>{this.isConnecting=!1,this.emit("streamStarting",!1),i(this)}).catch(t=>{this.isConnecting=!1,this.emit("streamStarting",!1),o({type:"error",id:13,message:"connection error",data:t})})},this.ws.onerror=t=>{this._abortController.signal.removeEventListener("abort",abortConnect),this.isConnecting=!1,this.emit("streamStarting",!1),o({type:"error",id:14,message:"ws connection error",data:t})},this._abortController.signal.addEventListener("abort",abortConnect)}))}stopStream(){var t,i;if(this.isDisconnecting)return Promise.resolve();null===(t=this._abortController)||void 0===t||null===(i=t.abort)||void 0===i||i.call(t),this._stopKeepAlive();let o=this.isStreaming;return this.isDisconnecting=!0,this.sendMessage(this.handleId,{body:{request:"stop"}},!1,!0).then(()=>this._removeParticipant(this.handleId)).finally(()=>(this._wipeListeners(),this._send({janus:"destroy"},!0),this.ws&&1===this.ws.readyState&&this.ws.close(),this.sessionId=null,this.isDisconnecting=!1,this.isStreaming=!1,this.emit("streamStarting",!1),this.emit("streaming",!1),this.emit("disconnect",o),Promise.resolve("Disconnected")))}destroy(){return"reactooroom"===this.sessiontype?this.disconnect().then(()=>(this.clear(),!0)):"streaming"===this.sessiontype?this.stopStream().then(()=>(this.clear(),!0)):void 0}_enableDebug(){this._log=console.log.bind(console)}_getHandle(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._participants.find(o=>o.handleId===t||i&&o.rfid===i)}_getStats(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return Promise.all(this._participants.map(i=>{let o=null;return"video"===t?o=i.webrtcStuff&&i.webrtcStuff.stream&&i.webrtcStuff.stream.getVideoTracks().length&&i.webrtcStuff.stream.getVideoTracks()[0]:"audio"===t&&(o=i.webrtcStuff&&i.webrtcStuff.stream&&i.webrtcStuff.stream.getAudioTracks().length&&i.webrtcStuff.stream.getAudioTracks()[0]),i.webrtcStuff&&i.webrtcStuff.pc&&i.webrtcStuff.pc.getStats(o).then(t=>({handle:i,stats:t})).catch(t=>Promise.resolve({handle:i,stats:t}))}))}_sendTrickleCandidate(t,i){return this._send({janus:"trickle",candidate:i,handle_id:t})}_webrtc(t){let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=this._getHandle(t);o||this.emit("error",{type:"warning",id:15,message:"id non-existent",data:[t,"create rtc connection"]});let a=o.webrtcStuff;if(!a.pc){let u={iceServers:this.iceServers,iceTransportPolicy:"all",bundlePolicy:void 0};u.sdpSemantics=this.isUnifiedPlan?"unified-plan":"plan-b";let c={optional:[{DtlsSrtpKeyAgreement:!0}]};!0===this._ipv6Support&&c.optional.push({googIPv6:!0}),"edge"===v.browserDetails.browser&&(u.bundlePolicy="max-bundle"),this._log("new RTCPeerConnection",u,c),a.pc=new RTCPeerConnection(u,c),a.pc.onconnectionstatechange=()=>{var i,u;("failed"===a.pc.connectionState&&this._iceRestart(t),this.emit("connectionState",[t,t===this.handleId,a.pc.connectionState]),t!==this.handleId&&"connected"===a.pc.connectionState)&&this.emit(this._getAddParticipantEventName(o.handleId),{tid:generateUUID(),id:o.handleId,userId:null===(i=decodeJanusDisplay(o.userId))||void 0===i?void 0:i.userId,role:null===(u=decodeJanusDisplay(o.userId))||void 0===u?void 0:u.role,stream:a.stream,track:null,optional:!0,constructId:this.constructId,metaData:this.options.metaData,adding:!1,hasAudioTrack:!(!a.stream||!a.stream.getAudioTracks().length),hasVideoTrack:!(!a.stream||!a.stream.getVideoTracks().length)})},a.pc.oniceconnectionstatechange=()=>{var i,u;("failed"===a.pc.iceConnectionState&&this._iceRestart(t),this.emit("iceState",[t,t===this.handleId,a.pc.iceConnectionState]),t===this.handleId||"completed"!==a.pc.iceConnectionState&&"connected"!==a.pc.iceConnectionState)||this.emit(this._getAddParticipantEventName(o.handleId),{tid:generateUUID(),id:o.handleId,userId:null===(i=decodeJanusDisplay(o.userId))||void 0===i?void 0:i.userId,role:null===(u=decodeJanusDisplay(o.userId))||void 0===u?void 0:u.role,stream:a.stream,track:null,optional:!0,constructId:this.constructId,metaData:this.options.metaData,adding:!1,hasAudioTrack:!(!a.stream||!a.stream.getAudioTracks().length),hasVideoTrack:!(!a.stream||!a.stream.getVideoTracks().length)})},a.pc.onicecandidate=i=>{if(null==i.candidate||"edge"===v.browserDetails.browser&&i.candidate.candidate.indexOf("endOfCandidates")>0)a.iceDone=!0,this._sendTrickleCandidate(t,{completed:!0}).catch(t=>{this.emit("error",t)});else{var o={candidate:i.candidate.candidate,sdpMid:i.candidate.sdpMid,sdpMLineIndex:i.candidate.sdpMLineIndex};this._sendTrickleCandidate(t,o).catch(t=>{this.emit("error",t)})}},i&&(a.pc.ontrack=t=>{if(t.streams&&(a.stream||(a.stream=new MediaStream),t.track)){var i,u;let c=t.transceiver?t.transceiver.mid:t.track.id;if(a.stream.addTrack(t.track),this.emit(this._getAddParticipantEventName(o.handleId),{tid:generateUUID(),mid:c,id:o.handleId,userId:null===(i=decodeJanusDisplay(o.userId))||void 0===i?void 0:i.userId,role:null===(u=decodeJanusDisplay(o.userId))||void 0===u?void 0:u.role,stream:a.stream,track:t.track,constructId:this.constructId,metaData:this.options.metaData,adding:!0,hasAudioTrack:!(!a.stream||!a.stream.getAudioTracks().length),hasVideoTrack:!(!a.stream||!a.stream.getVideoTracks().length)}),t.track.onended)return;t.track.onended=t=>{let i=t.target.id;if(this.isUnifiedPlan){i=a.pc.getTransceivers().find(i=>i.receiver.track===t.target).mid}var u,c;a.stream&&(a.stream&&a.stream.removeTrack(t.target),this.emit(this._getAddParticipantEventName(o.handleId),{tid:generateUUID(),id:o.handleId,mid:i,userId:null===(u=decodeJanusDisplay(o.userId))||void 0===u?void 0:u.userId,role:null===(c=decodeJanusDisplay(o.userId))||void 0===c?void 0:c.role,stream:a.stream,track:t.target,constructId:this.constructId,metaData:this.options.metaData,adding:!1,removing:!0,hasAudioTrack:!(!a.stream||!a.stream.getAudioTracks().length),hasVideoTrack:!(!a.stream||!a.stream.getVideoTracks().length)}))},t.track.onmute=t=>{var i,u;this._log("remoteTrackMuted","onmute");let c=t.target.id;if(this.isUnifiedPlan){c=a.pc.getTransceivers().find(i=>i.receiver.track===t.target).mid}this.emit("remoteTrackMuted",{id:o.handleId,mid:c,userId:null===(i=decodeJanusDisplay(o.userId))||void 0===i?void 0:i.userId,role:null===(u=decodeJanusDisplay(o.userId))||void 0===u?void 0:u.role,stream:a.stream,kind:t.target.kind,track:t.target,muted:!0})},t.track.onunmute=t=>{var i,u;this._log("remoteTrackMuted","onunmute");let c=t.target.id;if(this.isUnifiedPlan){c=a.pc.getTransceivers().find(i=>i.receiver.track===t.target).mid}this.emit("remoteTrackMuted",{id:o.handleId,mid:c,userId:null===(i=decodeJanusDisplay(o.userId))||void 0===i?void 0:i.userId,role:null===(u=decodeJanusDisplay(o.userId))||void 0===u?void 0:u.role,stream:a.stream,kind:t.target.kind,track:t.target,muted:!1})}}})}if(!a.dataChannel||!a.dataChannelOpen){a.dataChannel={};var onDataChannelMessage=i=>{this._handleDataEvents(t,"message",i.data)},onDataChannelStateChange=i=>{let o=i.target.label,u=(i.target.protocol,a.dataChannel[o]?a.dataChannel[o].readyState:"null");this._handleDataEvents(t,"state",{state:u,label:o})},onDataChannelError=i=>{var o;this._handleDataEvents(t,"error",{label:null==i||null===(o=i.channel)||void 0===o?void 0:o.label,error:i})};const createDataChannel=(t,i,o)=>{let u={ordered:!0};o?a.dataChannel[t]=o:(i&&(u={...u,protocol:i}),a.dataChannel[t]=a.pc.createDataChannel(t,u)),a.dataChannel[t].onmessage=onDataChannelMessage,a.dataChannel[t].onopen=onDataChannelStateChange,a.dataChannel[t].onclose=onDataChannelStateChange,a.dataChannel[t].onerror=onDataChannelError};createDataChannel(this.defaultDataChannelLabel,null,null),a.pc.ondatachannel=function(t){createDataChannel(t.channel.label,t.channel.protocol,t.channel)}}}_webrtcPeer(t,i){let o=this._getHandle(t);if(!o)return Promise.reject({type:"warning",id:15,message:"id non-existent",data:[t,"rtc peer"]});var a=o.webrtcStuff;return null!=i?null===a.pc?(this._log("No PeerConnection: if this is an answer, use createAnswer and not _webrtcPeer"),Promise.resolve(null)):a.pc.setRemoteDescription(i).then(()=>{if(a.remoteSdp=i.sdp,a.candidates&&a.candidates.length>0){for(var t=0;t<a.candidates.length;t++){var o=a.candidates[t];o&&!0!==o.completed?a.pc.addIceCandidate(o):a.pc.addIceCandidate(null)}a.candidates=[]}return!0}):Promise.reject({type:"warning",id:22,message:"rtc peer",data:[t,"invalid jsep"]})}_iceRestart(t){let i=this._getHandle(t);if(i){var o=i.webrtcStuff;if(!o.isIceRestarting){if(this.handleId!==t)return this._log("Performing remote ICE restart",t),o.isIceRestarting=!0,this.sendMessage(t,{body:{request:"configure",restart:!0}}).then(()=>{o.isIceRestarting=!1}).catch(()=>{o.isIceRestarting=!1});{this._log("Performing local ICE restart"),o.isIceRestarting=!0;let i=!!(o.stream&&o.stream.getAudioTracks().length>0),a=!!(o.stream&&o.stream.getVideoTracks().length>0);this._createAO("offer",t,!0,[i,!1,a,!1]).then(o=>o?this.sendMessage(t,{body:{request:"configure",audio:i,video:a,data:!0,...this.recordingFilename?{filename:this.recordingFilename}:{}},jsep:o}):null).then(t=>{o.isIceRestarting=!1,this._log("ICE restart success")}).catch(t=>{o.isIceRestarting=!1,this.emit("warning",{type:"error",id:28,message:"iceRestart failed",data:t})})}}}}_createAO(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"offer",i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],[a,u,c,h]=arguments.length>3?arguments[3]:void 0,l=this._getHandle(i);if(!l)return Promise.reject({type:"warning",id:15,message:"id non-existent",data:[i,"createAO",t]});let d=null;d="offer"===t?"createOffer":"createAnswer";var p=l.webrtcStuff,m={};if(this.isUnifiedPlan){var g=null,b=null,w=p.pc.getTransceivers();if(w&&w.length>0)for(var _ in w){var M=w[_];M.sender&&M.sender.track&&"audio"===M.sender.track.kind&&!1===M.stopped||M.receiver&&M.receiver.track&&"audio"===M.receiver.track.kind&&!1===M.stopped?g||(g=M):(M.sender&&M.sender.track&&"video"===M.sender.track.kind&&!1===M.stopped||M.receiver&&M.receiver.track&&"video"===M.receiver.track.kind&&!1===M.stopped)&&(b||(b=M))}a||u?a&&u?g&&(g.setDirection?g.setDirection("sendrecv"):g.direction="sendrecv"):a&&!u?g&&(g.setDirection?g.setDirection("sendonly"):g.direction="sendonly"):!a&&u&&(g?g.setDirection?g.setDirection("recvonly"):g.direction="recvonly":g=p.pc.addTransceiver("audio",{direction:"recvonly"})):g&&(g.setDirection?g.setDirection("inactive"):g.direction="inactive"),c||h?c&&h?b&&(b.setDirection?b.setDirection("sendrecv"):b.direction="sendrecv"):c&&!h?b&&(b.setDirection?b.setDirection("sendonly"):b.direction="sendonly"):!c&&h&&(b?b.setDirection?b.setDirection("recvonly"):b.direction="recvonly":b=p.pc.addTransceiver("video",{direction:"recvonly"})):b&&(b.setDirection?b.setDirection("inactive"):b.direction="inactive")}else m="firefox"===v.browserDetails.browser||"edge"===v.browserDetails.browser?{offerToReceiveAudio:u,offerToReceiveVideo:h}:{mandatory:{OfferToReceiveAudio:u,OfferToReceiveVideo:h}};return o&&(m.iceRestart=!0),p.pc[d](m).then((function(t){p.mySdp=t.sdp;let o=p.pc.setLocalDescription(t).catch(t=>Promise.reject({type:"warning",id:24,message:"setLocalDescription",data:[i,t]}));if(p.mediaConstraints=m,!p.iceDone&&!p.trickle)return Promise.resolve(null);var a={type:t.type,sdp:t.sdp};return o.then(()=>a)}),t=>Promise.reject({type:"warning",id:25,message:d,data:[i,t]}))}_publishRemote(t,i){let o=this._getHandle(t);if(!o)return Promise.reject({type:"warning",id:15,message:"id non-existent",data:[t,"publish remote participant"]});this._webrtc(t,!0);let a=o.webrtcStuff;return i?a.pc.setRemoteDescription(i).then(()=>{if(a.remoteSdp=i.sdp,a.candidates&&a.candidates.length>0){for(var o=0;o<a.candidates.length;o++){var u=a.candidates[o];u&&!0!==u.completed?a.pc.addIceCandidate(u):a.pc.addIceCandidate(null)}a.candidates=[]}return this._createAO("answer",t,!1,[!1,!0,!1,!0]).then(i=>i?this.sendMessage(t,{body:{request:"start",...this.roomId&&{room:this.roomId},...this.pin&&{pin:this.pin}},jsep:i}):(this.emit("error",{type:"warning",id:19,message:"publish remote participant",data:[t,"no jsep"]}),Promise.resolve()))},i=>Promise.reject({type:"warning",id:23,message:"setRemoteDescription",data:[t,i]})):Promise.resolve()}publishLocal(t){let{keepAudio:i=!1,keepVideo:o=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.isDisconnecting||!this.isConnected)return Promise.reject({type:"warning",id:18,message:"Either not connected or disconnecting"});this.emit("publishing",!0);let a=this._getHandle(this.handleId);if(!a)return Promise.reject({type:"error",id:21,message:"no local id, connect before publishing",data:null});this._webrtc(this.handleId);let u=a.webrtcStuff;if(t)if(u.stream){let a=t.getAudioTracks().length;if(a||!i){let t=u.stream.getAudioTracks()[0];if(t){u.stream.removeTrack(t);try{t.stop()}catch(t){this._log(t)}}}if(u.pc.getSenders()&&u.pc.getSenders().length)if(a&&this.isUnifiedPlan);else for(let t in u.pc.getSenders()){let i=u.pc.getSenders()[t];i&&i.track&&"audio"===i.track.kind&&u.pc.removeTrack(i)}if(a){u.stream.addTrack(t.getAudioTracks()[0]);var c=null;if(this.isUnifiedPlan){let t=u.pc.getTransceivers();if(t&&t.length>0)for(let i in t){let o=t[i];if(o.sender&&o.sender.track&&"audio"===o.sender.track.kind&&!1===o.stopped||o.receiver&&o.receiver.track&&"audio"===o.receiver.track.kind&&!1===o.stopped){c=o;break}}}c&&c.sender?c.sender.replaceTrack(t.getAudioTracks()[0]):u.pc.addTrack(t.getAudioTracks()[0],t)}let l=t.getVideoTracks().length;if(l||!o){let t=u.stream.getVideoTracks()[0];if(t){u.stream.removeTrack(t);try{t.stop()}catch(t){this._log(t)}}}if(u.pc.getSenders()&&u.pc.getSenders().length)if(l&&this.isUnifiedPlan);else for(let t in u.pc.getSenders()){let i=u.pc.getSenders()[t];i&&i.track&&"video"===i.track.kind&&u.pc.removeTrack(i)}if(l){u.stream.addTrack(t.getVideoTracks()[0]);var h=null;if(this.isUnifiedPlan){let t=u.pc.getTransceivers();if(t&&t.length>0)for(let i in t){let o=t[i];if(o.sender&&o.sender.track&&"video"===o.sender.track.kind&&!1===o.stopped||o.receiver&&o.receiver.track&&"video"===o.receiver.track.kind&&!1===o.stopped){h=o;break}}}h&&h.sender?h.sender.replaceTrack(t.getVideoTracks()[0]):u.pc.addTrack(t.getVideoTracks()[0],t)}}else u.stream=t,t.getTracks().forEach((function(i){u.pc.addTrack(i,t)}));let l=!!(t&&t.getAudioTracks().length>0),d=!!(t&&t.getVideoTracks().length>0),p=!t||0===t.getAudioTracks().length||!t.getAudioTracks()[0].enabled,m=!t||0===t.getVideoTracks().length||!t.getVideoTracks()[0].enabled;return this.isAudioEnabed=l,this.isVideoEnabled=d,this.isAudioMuted=p,this.isVideoMuted=m,this._createAO("offer",this.handleId,!1,[l,!1,d,!1]).then(t=>t?(t.sdp&&-1===t.sdp.indexOf("\r\na=ice-ufrag")&&(t.sdp=t.sdp.replace("\na=ice-ufrag","\r\na=ice-ufrag")),this.sendMessage(this.handleId,{body:{request:"configure",audio:l,video:d,data:!0,...this.recordingFilename?{filename:this.recordingFilename}:{}},jsep:t})):null).then(t=>this._isDataChannelOpen?Promise.resolve(t):new Promise((t,i)=>{let o=null,_resolve=i=>{i&&(clearTimeout(o),this._abortController.signal.removeEventListener("abort",_rejectAbort),this.off("dataChannel",_resolve,this),t(this))},_rejectAbort=()=>{this._abortController.signal.removeEventListener("abort",_rejectAbort),clearTimeout(o),this.off("dataChannel",_resolve,this),i({type:"warning",id:17,message:"Connection cancelled"})};o=setTimeout(()=>{this.off("dataChannel",_resolve,this),this._abortController.signal.removeEventListener("abort",_rejectAbort),i({type:"error",id:27,message:"Data channel did not open",data:null})},5e3),this._abortController.signal.addEventListener("abort",_rejectAbort),this.on("dataChannel",_resolve,this)})).then(t=>{if(this.isPublished=!0,u.stream){u.stream.getTracks().forEach(t=>{var i,o;t.onended||(this.emit("addLocalParticipant",{tid:generateUUID(),id:a.handleId,userId:null===(i=decodeJanusDisplay(a.userId))||void 0===i?void 0:i.userId,role:null===(o=decodeJanusDisplay(a.userId))||void 0===o?void 0:o.role,track:t,stream:u.stream,adding:!0,constructId:this.constructId,metaData:this.options.metaData,hasAudioTrack:l,hasVideoTrack:d}),t.onended=t=>{var i,o;this.emit("addLocalParticipant",{tid:generateUUID(),id:a.handleId,userId:null===(i=decodeJanusDisplay(a.userId))||void 0===i?void 0:i.userId,role:null===(o=decodeJanusDisplay(a.userId))||void 0===o?void 0:o.role,track:t.target,stream:u.stream,adding:!1,removing:!0,constructId:this.constructId,metaData:this.options.metaData,hasAudioTrack:l,hasVideoTrack:d})})})}else{var i,o;this.emit("addLocalParticipant",{tid:generateUUID(),id:a.handleId,userId:null===(i=decodeJanusDisplay(a.userId))||void 0===i?void 0:i.userId,role:null===(o=decodeJanusDisplay(a.userId))||void 0===o?void 0:o.role,stream:null,adding:!1,constructId:this.constructId,metaData:this.options.metaData,hasAudioTrack:l,hasVideoTrack:d})}return this.emit("published",{status:!0,hasStream:!!u.stream}),this.emit("publishing",!1),this.emit("localHasVideo",d),this.emit("localHasAudio",l),this.emit("localMuted",{type:"video",value:m}),this.emit("localMuted",{type:"audio",value:p}),t}).catch(t=>(this.emit("publishing",!1),Promise.reject(t)))}unpublishLocal(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.isPublished?this.sendMessage(this.handleId,{body:{request:"unpublish"}},t).finally(t=>(this.isPublished=!1,this.emit("published",{status:!1,hasStream:!1}),t)):Promise.resolve()}toggleAudio(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1?arguments[1]:void 0,o=this._getHandle(this.handleId);if(!o)return Promise.reject({type:"error",id:21,message:"no local id, connect first",data:null});let a=o.webrtcStuff;if(this.isUnifiedPlan){let o=a.pc.getTransceivers().find(t=>t.sender&&t.sender.track&&"audio"===t.receiver.track.kind&&!1===t.stopped&&(!i||t.mid===i));o&&(o.sender.track.enabled=null!==t?!!t:!o.sender.track.enabled),this.isAudioMuted=!o||!o.sender.track.enabled}else a.stream&&a.stream.getAudioTracks().length&&(a.stream.getAudioTracks()[0].enabled=null!==t?!!t:!a.stream.getAudioTracks()[0].enabled),this.isAudioMuted=0===a.stream.getAudioTracks().length||!a.stream.getAudioTracks()[0].enabled;this.emit("localMuted",{type:"audio",value:this.isAudioMuted,mid:i})}toggleVideo(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1?arguments[1]:void 0,o=this._getHandle(this.handleId);if(!o)return Promise.reject({type:"error",id:21,message:"no local id, connect first",data:null});let a=o.webrtcStuff;if(this.isUnifiedPlan){let o=a.pc.getTransceivers().find(t=>t.sender&&t.sender.track&&"video"===t.receiver.track.kind&&!1===t.stopped&&(!i||t.mid===i));o&&(o.sender.track.enabled=null!==t?!!t:!o.sender.track.enabled),this.isVideoMuted=!o||!o.sender.track.enabled}else a.stream&&a.stream.getVideoTracks().length&&(a.stream.getVideoTracks()[0].enabled=null!==t?!!t:!a.stream.getVideoTracks()[0].enabled),this.isVideoMuted=0===a.stream.getVideoTracks().length||!a.stream.getVideoTracks()[0].enabled;this.emit("localMuted",{type:"video",value:this.isVideoMuted,mid:i})}setRoomType(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"watchparty";return this._roomType=t,this._roomType}}_defineProperty(wt_room_RoomSession,"sessionTypes",{reactooroom:"janus.plugin.reactooroom",streaming:"janus.plugin.streaming"}),_defineProperty(wt_room_RoomSession,"subscriptionRules",{participant:{watchparty:["participant","talkback"],commentary:["participant","talkback"],videowall:["host","talkback","observer","observerSolo1","observerSolo2","observerSolo3"],"videowall-queue":["host","talkback","observer","observerSolo1","observerSolo2","observerSolo3"],"videowall-queue-video":["host","talkback","observer","observerSolo1","observerSolo2","observerSolo3"]},monitor:{watchparty:["participant"],commentary:["participant"],videowall:["host","participant"],"videowall-queue":["host","participant"],"videowall-queue-video":["host","participant"]},talkback:{watchparty:["participant"],commentary:["participant"],videowall:["host","participant"],"videowall-queue":["host","participant"],"videowall-queue-video":["host","participant"]},observer:{watchparty:["participant"],commentary:["participant"],videowall:["participant"],"videowall-queue":["participant"],"videowall-queue-video":["participant"]},observerSolo1:{watchparty:["participant"],commentary:["participant"],videowall:["participant"],"videowall-queue":["participant"],"videowall-queue-video":["participant"]},observerSolo2:{watchparty:["participant"],commentary:["participant"],videowall:["participant"],"videowall-queue":["participant"],"videowall-queue-video":["participant"]},observerSolo3:{watchparty:["participant"],commentary:["participant"],videowall:["participant"],"videowall-queue":["participant"],"videowall-queue-video":["participant"]},host:{watchparty:[],commentary:[],videowall:[],"videowall-queue":[],"videowall-queue-video":[]},companionTV:{},companionPhone:{}});var H=wt_room_Room,W=o(317),V=o(326);class wt_iot_Iot{constructor(t){Object.assign(this,Object(b.a)()),this.device=null,this.decoder=new TextDecoder("utf-8"),this.connectionActive=!1,this.log=wt_iot_Iot.noop,this.debugFlag=t,this.credentialsExpirationCheckIntervalId=null,this.currentCredentialsExpirationStamp=null,t&&this.enableDebug()}static noop(){}enableDebug(){this.log=console.log.bind(console)}startCredentialsExpirationCheck(t){this.stopCredentialsExpirationCheck(),this.currentCredentialsExpirationStamp=new Date(t).getTime(),this.credentialsExpirationCheckIntervalId=setInterval(()=>{const t=(new Date).getTime();this.currentCredentialsExpirationStamp-t<=3e5&&this.emit("updateCredentials")},5e3)}stopCredentialsExpirationCheck(){clearInterval(this.credentialsExpirationCheckIntervalId),this.credentialsExpirationCheckIntervalId=null}updateWebSocketCredentials(t,i,o,a){this.device&&(this.device.updateWebSocketCredentials(t,i,o),this.startCredentialsExpirationCheck(a))}connect(t,i,o,a,u,c,h){let l=arguments.length>7&&void 0!==arguments[7]&&arguments[7];return this.disconnect(l).then(()=>new Promise((l,d)=>{this.device=Object(V.device)({protocol:"wss",clientId:i,region:o,host:t,accessKeyId:a,secretKey:u,sessionToken:c,keepalive:15,maximumReconnectTimeMs:8e3,enableMetrics:!1,debug:this.debugFlag,autoResubscribe:!0}),this.startCredentialsExpirationCheck(h);let __s=()=>{var t,i;null===(t=this.device)||void 0===t||t.off("connect",__s),null===(i=this.device)||void 0===i||i.off("error",__e),l(this.device)},__e=t=>{var i,o;null===(i=this.device)||void 0===i||i.off("connect",__s),null===(o=this.device)||void 0===o||o.off("error",__e),d(t)};this.device.once("connect",__s),this.device.once("error",__e),this.device.on("message",this.__messageCb.bind(this)),this.device.on("connect",this.__connectCb.bind(this)),this.device.on("reconnect",this.__reconnectCb.bind(this)),this.device.on("error",this.__failureCb.bind(this)),this.device.on("close",this.__closeCb.bind(this)),this.device.on("offline",this.__offlineCb.bind(this))}))}disconnect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.stopCredentialsExpirationCheck(),new Promise((i,o)=>{if(!this.device)return void i();let a=null,__c=()=>{clearTimeout(a),this.device=null,i()};a=setTimeout(__c,4e3),this.device.off("message",this.__messageCb.bind(this)),this.device.off("connect",this.__connectCb.bind(this)),this.device.off("reconnect",this.__reconnectCb.bind(this)),this.device.off("error",this.__failureCb.bind(this)),this.device.off("close",this.__closeCb.bind(this)),this.device.off("offline",this.__offlineCb.bind(this)),this.device.end(t,__c)})}isConnected(){return this.connectionActive}subscribe(t){return this.device&&this.device.subscribe(t)}unsubscribe(t){return this.device&&this.device.unsubscribe(t)}send(t,i){let o="object"==typeof i?JSON.stringify(i):i;return this.device&&this.device.publish(t,o)}__reconnectCb(){this.emit("reconnect")}__connectCb(){this.connectionActive=!0,this.emit("connect")}__failureCb(t){this.emit("error",t)}__closeCb(t){this.connectionActive=!1,this.emit("close")}__offlineCb(t){this.emit("offline")}__messageCb(t,i,o){const a=t.split("/");let u=JSON.parse(this.decoder.decode(i));if(u.display){const t=decodeJanusDisplay(u.display);t.userId&&(u={...u,userId:t.userId,role:t.role})}if("user"===a[0]){const t=a[1].replace("_",":");this.emit("message",{userId:t,...u,event:u.event?"user:".concat(u.event):"user"})}else if("wt"===a[0]){const t=u.event,i=a[2];if("room"===a[1])"message"===t||"template_updated"===t||"record_start"===t||"record_stop"===t||"record_configured"===t||"record_livestream_available"===t||"record_livestream_kick"===t||"user_update_displayname"===t||"user_update_avatar"===t||"user_update_customattributes"===t||"user_update_privateattributes"===t||"channel_changed"===t||"instance_homepage_changed"===t||"instance_settings_changed"===t||"externalmix_changed"===t||"video_uploaded"===t||"change_user_devices"===t||"queue"===t||"title_changed"===t?this.emit("message",{event:t,...u,roomId:i}):"joined"===t||"leaving"===t?this.emit("message",{event:t,...u,isObserver:!!u.isObserver,roomId:i}):("left"===t||"kicked"===t||"banned"===t||"unbanned"===t||"approved"===t||"muted"===t||"unmuted"===t||"messageRemoved"===t||"messageReported"===t||"chatClear"===t||"handRaised"===t||"handLowered"===t||"handsCleared"===t||"volume_set"===t)&&this.emit("message",{event:t,...u});else if("instanceroom"===a[1])"add_room"!==t&&"remove_room"!==t&&"set_room"!==t&&"instance_homepage_changed"!==t&&"instance_settings_changed"!==t||this.emit("message",{event:t,...u});else if("externalmix"===a[1]){const t=u.event;this.emit("message",{event:t,...u})}}else if("wtr"===a[0]){const t=a[1],i=a[2];"control"===a[3]?this.emit("message",{event:"recorder_control",...u,recorderId:t,sessionId:i}):"monitor"===a[3]&&this.emit("message",{event:"recorder_monitor",...u,recorderId:t,sessionId:i})}}}var G=wt_iot_Iot;var models_auth=function(){var t=this;return{login:(t,i)=>this.__privates.auth.__client.then(o=>o.apis.auth.signIn({},{requestBody:{username:t,password:i}})).then(t=>(this.userId=t.data.userId,this.username=t.data.username,this.__privates.auth.login(t.data.idToken,t.data.accessToken,t.data.refreshToken))),providerLogin:(t,i,o,a)=>(i||"function"!=typeof this.__privates.providerAuth||({token:i,displayname:o}=this.__privates.providerAuth()),this.__privates.auth.__client.then(u=>u.apis.auth.providerSignIn({},{requestBody:{domain:t,token:i,...o&&{displayname:o},...a&&{deviceId:a}}})).then(t=>(this.userId=t.data.userId,this.username=t.data.username,this.__privates.auth.login(t.data.idToken,t.data.accessToken,t.data.refreshToken)))),getProviderAuth:()=>this.__privates.providerAuth,deviceLogin:function(){let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ThisIsSaltyAF";return getBrowserFingerprint(t.__instanceType,i,o).then(i=>Promise.all([i,t.__privates.auth.__client])).then(t=>{let[i,o]=t;return o.apis.auth.deviceSignIn({},{requestBody:{deviceId:i,domain:location.hostname}})}).then(i=>(t.userId=i.data.userId,t.username=i.data.username,t.__privates.auth.login(i.data.idToken,i.data.accessToken,i.data.refreshToken)))},logout:()=>this.__privates.auth.logout(),isLoggedIn:()=>this.__privates.auth.isLoggedIn(),setLanguage:t=>this.__privates.auth.setLanguage(t),getLanguage:()=>this.__privates.auth.__language,signUp:(t,i,o,a)=>this.__privates.auth.__client.then(u=>u.apis.auth.signUp({},{requestBody:{username:t,password:i,email:o,phone:a}})),confirmSignUp:function(i,o,a){let u=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return t.__privates.auth.__client.then(t=>t.apis.auth.confirmSignUp({},{requestBody:{confirmationCode:i,username:o,displayname:a,isPublic:u}})).then(i=>(t.userId=i.data.userId,t.username=i.data.username,t.__privates.auth.login(i.data.idToken,i.data.accessToken,i.data.refreshToken)))},resendConfirmationCode:t=>this.__privates.auth.__client.then(i=>i.apis.auth.resendConfirmationCode({},{requestBody:{username:t}})),forgotPassword:t=>this.__privates.auth.__client.then(i=>i.apis.auth.forgotPassword({},{requestBody:{username:t}})),confirmForgotPassword:(t,i,o)=>this.__privates.auth.__client.then(a=>a.apis.auth.confirmForgotPassword({},{requestBody:{password:o,confirmationCode:i,username:t}})),$on:(t,i,o)=>this.__privates.auth.on(t,i,o||this),$off:(t,i,o)=>this.__privates.auth.off(t,i,o||this),$clear:()=>this.__privates.auth.clear()}};var sync_hls=function(){let{room:t,wt:i,roomSession:o,emitter:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=null,c=null,h=null;const l=6e4,d=1e4,p=.5,m=3;let g=0,v=null,b=null,w=!1,_=!1,M=2,k=!1,B=!0,P=!1,x=!1;const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(v)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),w=!1;const loop=()=>{_=!0,a.emit("playerSyncing",!0),sync().finally(()=>{_=!1,a.emit("playerSyncing",!1),isConnected()&&!w?v=setTimeout(loop,b):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(v),v=null,g=0,w=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];i?(g++,g>m?(b=l,g=0):b=d):(b=l,g=0),t._log("--- Next sync will occur in "+b/1e3+" seconds ---")},sync=()=>getSyncData().then(i=>{if(i.isMaster)return c.paused&&c.play(),setNextWaitTime(!1),Promise.resolve();if(x)return setNextWaitTime(!1),propagateMasterFunc();{const o=Date.now(),{position:a,isBufferSufficient:u}=calculateSyncDifferenceTime(i.masterFragmentSn,i.masterFragmentPos,i.ping);return a&&Math.abs(a)<=p?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==a?seekBy(a).then(()=>{const a=Date.now()-o,{position:u,isBufferSufficient:c}=calculateSyncDifferenceTime(i.masterFragmentSn,i.masterFragmentPos+a,i.ping),h=Math.abs(u);t._log("Insufficient buffer: ",!c),t._log("Seek duration is ".concat(a/1e3)),t._log("Sync precision should be ".concat(h));return setNextWaitTime(h>p),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{x&&propagateMasterFunc(),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},handleAddRemoteParticipant=()=>{x&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,buffering=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"bufferStalledError"===i.details&&handleStalledWaiting()},hlsFragChanged=(t,i)=>{h=i.frag.sn},parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?a.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{var t;let i=u.streamController.fragmentTracker.fragments;if(!i)return 0;let o=i[Object.keys(i).find(t=>t.indexOf(h)>-1)];return o?Math.max(1e3*(u.streamController.lastCurrentTime-((null===(t=o.body)||void 0===t?void 0:t.startPTS)||0)),0):0},calculateSyncDifferenceTime=(i,o,a)=>{var c;let l=u.streamController.fragmentTracker.fragments,d=Object.keys(l).map(t=>parseInt(t.slice(t.lastIndexOf("_")+1))).sort((function(t,i){return t-i})),p=l[Object.keys(l).find(t=>t.indexOf(h)>-1)];if(!p)return t._log("Current fragment not found, what now?",h),{position:null,isBufferSufficient:!1};let m=Math.max(1e3*(u.streamController.lastCurrentTime-((null===(c=p.body)||void 0===c?void 0:c.startPTS)||0)),0),g=1e3*p.body.duration;t._log("Our current fragment is: ".concat(h)),t._log("Our current fragment position is: ".concat(m)),t._log("Our current fragment length is: ".concat(g));let v=i,b=Math.max(a/2+o,0),w=!1,_=d.indexOf(i)>-1?d.slice(d.indexOf(i)):[];for(let i=0,o=_.length;i<o;i++){let o=_[i],a=1e3*l[Object.keys(l).find(t=>t.indexOf(o)>-1)].body.duration;if(t._log("Correction diff: ".concat(b-a)),v=o,!(b-a>0)){t._log("Enough at fragment ".concat(o)),w=!0;break}t._log("Not enough at fragment ".concat(o)),b-=a}if(!w)return t._log("We don't have required fragment ".concat(v," yet")),{position:null,isBufferSufficient:!1};if(v<h){t._log("We are ahead of master..."),t._log("Real master fragment: ".concat(v)),t._log("Our fragment: ".concat(h));let i=m-b,o=d.slice(d.indexOf(v));for(let t=0,a=o.length;t<a;t++){let a=o[t],u=1e3*l[Object.keys(l).find(t=>t.indexOf(a)>-1)].body.duration;if(a>=h)break;i+=u}return t._log("Sync difference is: ".concat(i)),{position:i/1e3*-1,isBufferSufficient:!0}}{t._log("We're behind or spot on master..."),t._log("Real master fragment: ".concat(v)),t._log("Our fragment: ".concat(h));let i=b-m,o=d.slice(d.indexOf(h));for(let t=0,a=o.length;t<a;t++){let a=o[t],u=1e3*l[Object.keys(l).find(t=>t.indexOf(a)>-1)].body.duration;if(a>=v)break;i+=u}return t._log("We can proceed with seek time: ".concat(i)),{position:i/1e3,isBufferSufficient:!0}}},seekBy=i=>new Promise((o,a)=>{if(0!==i)if(i>0&&i<4){t._log("Fast forward to seek...");let u=!1,__=()=>{u&&c.pause(),c.playbackRate=1,P=!1,a("Stalled")},h=i;c.addEventListener("stalled",__,{once:!0}),setExactTimeout(()=>{u&&c.pause(),c.playbackRate=1,P=!1,c.removeEventListener("stalled",__,{once:!0}),o()},1e3*h/(M-1),20),P=!0,c.paused?(u=!0,c.play().then(()=>{c.playbackRate=M})):c.playbackRate=M}else{t._log("Jump to seek...");let a=Date.now();P=!0,c.addEventListener("playing",()=>{t._log("It took the player ".concat((Date.now()-a)/1e3," seconds to seek ")),P=!1,o()},{once:!0}),c.currentTime+=i}else o()}),handlePlaying=()=>{P||(t._log("Handle playing"),startSyncLoop()),P=!1,B=c.paused,k=!c.paused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),k=!c.paused},handleStalledWaiting=()=>{t._log("handleStalledWaiting"),P||(stopSyncLoop(),clientPaused().catch(()=>{}),B=c.paused)},roomSyncSend=i=>{if(!u||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let o=h,a=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to ".concat(i)),t._log("Fragment: ".concat(o)),t._log("Fragment position: ".concat(a)),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String(o),fragment_pos:Number(a),slave_id:t.webrtcVersion>1e3?String(i):Number(i)}})},getSyncData=()=>{t._log("Sending roomSync request");let i=t.roomId,o=h,a=parseInt(getCurrentSegmentPosition());return new Promise((u,c)=>{let h=(new Date).getTime(),l=null,d=setTimeout(()=>{t.off("data",fn,this),c("Timeout")},3e3),p={request:"sync",room:i,timestamp:(new Date).getTime(),fragment:String(o),fragment_pos:Number(a)},fn=i=>{i.videoroom&&["sync","sync_response"].includes(i.videoroom)&&(i.sync_master_await?(t._log("Waiting for master position"),l||(l=(new Date).getTime()-h)):i.sync_master_fragment||i.sync_master_fragment_pos?(t._log("Got master position data"),l||(l=(new Date).getTime()-h),t._log("I'm master: ".concat(!!i.sync_master_self)),t._log("Ping: ".concat(l)),t._log("Master fragment: ".concat(i.sync_master_fragment)),t._log("Master fragment position: ".concat(i.sync_master_fragment_pos)),t.off("data",fn,this),clearTimeout(d),u({isMaster:!!i.sync_master_self,ping:l,masterFragmentPos:parseInt(i.sync_master_fragment_pos),masterFragmentSn:parseInt(i.sync_master_fragment)})):(clearTimeout(d),c("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:p}).then(fn).catch(i=>{t.off("data",fn,this),clearTimeout(d),c(i)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{hlsInstance:i,libraryInstance:o,propagateMaster:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u=i||o,c=u.media,u?(x=a,k=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),x&&propagateMasterFunc().catch(()=>{}),c&&!1===c.paused&&u.once("hlsFragChanged",()=>{restartSyncLoop()}),u.on("hlsError",buffering),u.on("hlsFragChanged",hlsFragChanged),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause)):t._log("No hls.js player instance!")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),u&&(u.off("hlsError",buffering),u.off("hlsFragChanged",hlsFragChanged)),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause)),u=null}}};var sync_hls_vod=function(){let{room:t,wt:i,roomSession:o,emitter:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=null,c=null,h=null,l=!1;const d=6e4,p=1e4,m=.5,g=3;let v=0,b=null,w=null,_=!1,M=!1,k=null,B=300,P=!1,x=!1,I=!1;const startSyncLoop=()=>{if(l)return void t._log("--- Sync loop will not start due to sync force disabled ---");if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(b)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),_=!1;const loop=()=>{M=!0,a.emit("playerSyncing",!0),sync().finally(()=>{M=!1,a.emit("playerSyncing",!1),isConnected()&&!_?b=setTimeout(loop,w):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(b),b=null,v=0,_=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];i?(v++,v>g?(w=d,v=0):w=p):(w=d,v=0),t._log("--- Next sync will occur in "+w/1e3+" seconds ---")},sync=()=>getSyncData().then(i=>{if(i.isMaster||_)return setNextWaitTime(!1),Promise.resolve();if(I)return setNextWaitTime(!1),propagateMasterFunc();{const o=Date.now(),{position:a,isBufferSufficient:u}=calculateSyncDifferenceTime(i.masterFragmentSn,i.masterFragmentPos,i.ping),c=getCurrentSegmentPosition()/1e3;return i.masterFragmentSn?playMedia():pauseMedia(),a&&Math.abs(a-c)<=m?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==a?seekTo(a).then(()=>{const i=(Date.now()-o)/1e3,c=Math.abs(a+(P?i:0)-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!u),t._log("Seek duration is ".concat(i)),t._log("Sync precision should be ".concat(c));return setNextWaitTime(c>m),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>{setNextWaitTime(!0)}),handleAddLocalParticipant=()=>{I&&propagateMasterFunc(),c&&setTimeout(()=>{c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},1e3)},handleAddRemoteParticipant=()=>{I&&propagateMasterFunc()},handleRemoveRemoteParticipant=()=>{I&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,buffering=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"bufferStalledError"===i.details&&handleStalledWaiting()},executePlayerIotEvents=i=>{let o=h||t.roomId;"playerReplay"!==i.attributeName||o&&(null==i?void 0:i.roomId)!==o||seekTo(0).then(()=>playMedia()),"playerPlay"!==i.attributeName||o&&(null==i?void 0:i.roomId)!==o||playMedia(),"playerPause"!==i.attributeName||o&&(null==i?void 0:i.roomId)!==o||pauseMedia()},parseIotEvents=t=>{"template_updated"===t.event&&("multi"===t.operation&&(t.value||[]).forEach(i=>{"sendMessage"===i.operation&&executePlayerIotEvents({...i,roomId:t.roomId,userId:t.userId})}),"sendMessage"===t.operation&&executePlayerIotEvents(t))},parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("sync_source_set"===t.videoroom&&""!=t.wt_channel_id)a.emit("changePlayerSource",t.wt_channel_id);else if("sync_request"===t.videoroom)roomSyncSend(t.sync_slave_id).catch(()=>{});else if("message"===t.videoroom){if(I&&null!==t.from)return;if(l)return;"sync_seeking"===t.user_action?seekMedia(t).catch(()=>{}):"sync_seeked"===t.user_action||("sync_play"===t.user_action||"sync_play"===t.action?playMedia():"sync_pause"!==t.user_action&&"sync_pause"!==t.action||pauseMedia())}},getCurrentSegmentPosition=()=>{let t=c&&c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2?arguments[2]:void 0;return{position:(i+o/2)/1e3,isBufferSufficient:!0}},seekMedia=i=>{if((i={userId:i.from,...i.text&&JSON.parse(i.text)}).handleId!==t.handleId){const{position:t,isBufferSufficient:o}=calculateSyncDifferenceTime(i.fragment,i.fragment_pos,0);return t?seekTo(t).then(()=>{I&&propagateMasterFunc()}):Promise.resolve()}return Promise.resolve()},prePlay=()=>{if(c.currentTime>0||!1===c.paused)return Promise.resolve();x=!0;let t=c.muted;return c.muted=!0,c.play().then(()=>(c.pause(),c.currentTime=0,wt_utils_wait(100))).catch(()=>!0).finally(()=>(c.muted=t,x=!1,!0))},playMedia=()=>{c&&c.paused&&(x=!0,c.play().finally(()=>{x=!1}))},pauseMedia=()=>{c&&!c.paused&&(x=!0,c.addEventListener("pause",()=>{x=!1},{once:!0}),c.pause())},seekTo=t=>new Promise(i=>{c.currentTime!==t?(x=!0,c.addEventListener("seeked",()=>{x=!1,i()},{once:!0}),c.currentTime=t):i()}),handlePlaying=()=>{x||o.sendSystemMessage("sync_play",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),P=!c.paused},handlePause=()=>{x||o.sendSystemMessage("sync_pause",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),P=!c.paused},handleStalledWaiting=()=>{x||clientPaused().catch(()=>{})},handleSeeking=()=>{clearTimeout(k),x||(k=setTimeout(()=>{let i=parseInt(getCurrentSegmentPosition());o.sendSystemMessage("sync_seeking",{timestamp:(new Date).getTime(),handleId:t.handleId,fragment:"0",fragment_pos:Number(i)},void 0,null).catch(()=>{}),I||l||pauseMedia()},B))},handleSeeked=()=>{},handleEnded=()=>{},roomSyncSend=i=>{if(!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let o=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to ".concat(i)),t._log("Current time: ".concat(o)),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:P?"1":"0",fragment_pos:Number(o),slave_id:t.webrtcVersion>1e3?String(i):Number(i)}})},getSyncData=()=>{t._log("Sending roomSync request");let i=t.roomId,o=parseInt(getCurrentSegmentPosition());return new Promise((a,u)=>{let c=(new Date).getTime(),h=null,l=setTimeout(()=>{t.off("data",fn,this),u("Timeout")},3e3),d={request:"sync",room:i,timestamp:(new Date).getTime(),fragment:P?"1":"0",fragment_pos:Number(o)},fn=i=>{i.videoroom&&["sync","sync_response"].includes(i.videoroom)&&(i.sync_master_await?(t._log("Waiting for master position"),h||(h=(new Date).getTime()-c)):i.sync_master_fragment||i.sync_master_fragment_pos?(t._log("Got master position data"),h||(h=(new Date).getTime()-c),t._log("I'm master: ".concat(!!i.sync_master_self)),t._log("Ping: ".concat(h)),t._log("Master fragment: ".concat(i.sync_master_fragment)),t._log("Master fragment position: ".concat(i.sync_master_fragment_pos)),t.off("data",fn,this),clearTimeout(l),a({isMaster:!!i.sync_master_self,ping:h,masterFragmentPos:parseInt(i.sync_master_fragment_pos),masterFragmentSn:parseInt(i.sync_master_fragment)})):(clearTimeout(l),u("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(i=>{t.off("data",fn,this),clearTimeout(l),u(i)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{hlsInstance:o,libraryInstance:d,propagateMaster:p=!1,isStudio:m=!1,roomId:g,syncDisabled:v}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u=o||d,c=u.media,h=g,l=v,u?(a.emit("playerSyncing",!1),I=p,P=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("removeLocalParticipant",stopSyncLoop),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("removeRemoteParticipant",handleRemoveRemoteParticipant),t.on("data",parseDataEvents),i.iot.$on("message",parseIotEvents),I&&propagateMasterFunc().catch(()=>{}),u&&c&&(p||m?Promise.resolve():prePlay()).then(()=>{u.on("hlsError",buffering),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause),c.addEventListener("seeking",handleSeeking),c.addEventListener("seeked",handleSeeked),c.addEventListener("ended",handleEnded),startSyncLoop()})):t._log("No hls.js player instance!")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("removeLocalParticipant",stopSyncLoop),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("removeRemoteParticipant",handleRemoveRemoteParticipant),t.off("data",parseDataEvents),i.iot.$off("message",parseIotEvents),u&&u.off("hlsError",buffering),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause),c.removeEventListener("seeking",handleSeeking),c.removeEventListener("seeked",handleSeeked),c.removeEventListener("ended",handleEnded)),u=null,c=null}}};var sync_native_hls_vod=function(){let{room:t,wt:i,roomSession:o,emitter:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=null,c=null,h=!1;const l=6e4,d=1e4,p=.5,m=3;let g=0,v=null,b=null,w=!1,_=!1,M=null,k=300,B=!1,P=!1,x=!1;const startSyncLoop=()=>{if(h)return void t._log("--- Sync loop will not start due to sync force disabled ---");if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(v)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),w=!1;const loop=()=>{_=!0,a.emit("playerSyncing",!0),sync().finally(()=>{_=!1,a.emit("playerSyncing",!1),isConnected()&&!w?v=setTimeout(loop,b):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(v),v=null,g=0,w=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];i?(g++,g>m?(b=l,g=0):b=d):(b=l,g=0),t._log("--- Next sync will occur in "+b/1e3+" seconds ---")},sync=()=>getSyncData().then(i=>{if(i.isMaster||w)return setNextWaitTime(!1),Promise.resolve();if(x)return setNextWaitTime(!1),propagateMasterFunc();{const o=Date.now(),{position:a,isBufferSufficient:u}=calculateSyncDifferenceTime(i.masterFragmentSn,i.masterFragmentPos,i.ping),c=getCurrentSegmentPosition()/1e3;return i.masterFragmentSn?playMedia():pauseMedia(),a&&Math.abs(a-c)<=p?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==a?seekTo(a).then(()=>{const i=(Date.now()-o)/1e3,c=Math.abs(a+(B?i:0)-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!u),t._log("Seek duration is ".concat(i)),t._log("Sync precision should be ".concat(c));return setNextWaitTime(c>p),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>{setNextWaitTime(!0)}),handleAddLocalParticipant=()=>{x&&propagateMasterFunc(),u&&setTimeout(()=>{restartSyncLoop()},1e3)},handleAddRemoteParticipant=()=>{x&&propagateMasterFunc()},handleRemoveRemoteParticipant=()=>{x&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,executePlayerIotEvents=i=>{let o=c||t.roomId;"playerReplay"!==i.attributeName||o&&(null==i?void 0:i.roomId)!==o||seekTo(0).then(()=>playMedia()),"playerPlay"!==i.attributeName||o&&(null==i?void 0:i.roomId)!==o||playMedia(),"playerPause"!==i.attributeName||o&&(null==i?void 0:i.roomId)!==o||pauseMedia()},parseIotEvents=t=>{"template_updated"===t.event&&("multi"===t.operation&&(t.value||[]).forEach(i=>{"sendMessage"===i.operation&&executePlayerIotEvents({...i,roomId:t.roomId,userId:t.userId})}),"sendMessage"===t.operation&&executePlayerIotEvents(t))},parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("sync_source_set"===t.videoroom&&""!=t.wt_channel_id)a.emit("changePlayerSource",t.wt_channel_id);else if("sync_request"===t.videoroom)roomSyncSend(t.sync_slave_id).catch(()=>{});else if("message"===t.videoroom){if(x&&null!==t.from)return;if(h)return;"sync_seeking"===t.user_action?seekMedia(t).catch(()=>{}):"sync_seeked"===t.user_action||("sync_play"===t.user_action||"sync_play"===t.action?playMedia():"sync_pause"!==t.user_action&&"sync_pause"!==t.action||pauseMedia())}},getCurrentSegmentPosition=()=>{let t=u&&u.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2?arguments[2]:void 0;return{position:(i+o/2)/1e3,isBufferSufficient:!0}},seekMedia=i=>{if((i={userId:i.from,...i.text&&JSON.parse(i.text)}).handleId!==t.handleId){const{position:t,isBufferSufficient:o}=calculateSyncDifferenceTime(i.fragment,i.fragment_pos,0);return t?seekTo(t).then(()=>{x&&propagateMasterFunc()}):Promise.resolve()}return Promise.resolve()},prePlay=()=>{if(u.currentTime>0||!1===u.paused)return Promise.resolve();P=!0;let t=u.muted;return u.muted=!0,u.play().then(()=>(u.pause(),u.currentTime=0,wt_utils_wait(100))).catch(()=>!0).finally(()=>(u.muted=t,P=!1,!0))},playMedia=()=>{u&&u.paused&&(P=!0,u.play().finally(()=>{P=!1}))},pauseMedia=()=>{u&&!u.paused&&(P=!0,u.addEventListener("pause",()=>{P=!1},{once:!0}),u.pause())},seekTo=t=>new Promise(i=>{u.currentTime!==t?(P=!0,u.addEventListener("seeked",()=>{P=!1,i()},{once:!0}),u.currentTime=t):i()}),handlePlaying=()=>{P||o.sendSystemMessage("sync_play",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),B=!u.paused},handlePause=()=>{P||o.sendSystemMessage("sync_pause",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),B=!u.paused},handleStalledWaiting=()=>{P||clientPaused().catch(()=>{})},handleSeeking=()=>{clearTimeout(M),P||(M=setTimeout(()=>{let i=parseInt(getCurrentSegmentPosition());o.sendSystemMessage("sync_seeking",{timestamp:(new Date).getTime(),handleId:t.handleId,fragment:"0",fragment_pos:Number(i)},void 0,null).catch(()=>{}),x||h||pauseMedia()},k))},handleSeeked=()=>{},handleEnded=()=>{},roomSyncSend=i=>{if(!u)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let o=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to ".concat(i)),t._log("Current time: ".concat(o)),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:B?"1":"0",fragment_pos:Number(o),slave_id:t.webrtcVersion>1e3?String(i):Number(i)}})},getSyncData=()=>{t._log("Sending roomSync request");let i=t.roomId,o=parseInt(getCurrentSegmentPosition());return new Promise((a,u)=>{let c=(new Date).getTime(),h=null,l=setTimeout(()=>{t.off("data",fn,this),u("Timeout")},3e3),d={request:"sync",room:i,timestamp:(new Date).getTime(),fragment:B?"1":"0",fragment_pos:Number(o)},fn=i=>{i.videoroom&&["sync","sync_response"].includes(i.videoroom)&&(i.sync_master_await?(t._log("Waiting for master position"),h||(h=(new Date).getTime()-c)):i.sync_master_fragment||i.sync_master_fragment_pos?(t._log("Got master position data"),h||(h=(new Date).getTime()-c),t._log("I'm master: ".concat(!!i.sync_master_self)),t._log("Ping: ".concat(h)),t._log("Master fragment: ".concat(i.sync_master_fragment)),t._log("Master fragment position: ".concat(i.sync_master_fragment_pos)),t.off("data",fn,this),clearTimeout(l),a({isMaster:!!i.sync_master_self,ping:h,masterFragmentPos:parseInt(i.sync_master_fragment_pos),masterFragmentSn:parseInt(i.sync_master_fragment)})):(clearTimeout(l),u("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(i=>{t.off("data",fn,this),clearTimeout(l),u(i)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{videoElement:o,propagateMaster:l=!1,isStudio:d=!1,roomId:p,syncDisabled:m}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u=o,c=p,h=m,u?(a.emit("playerSyncing",!1),x=l,B=!1===u.paused,t.on("disconnect",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("removeLocalParticipant",stopSyncLoop),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("removeRemoteParticipant",handleRemoveRemoteParticipant),t.on("data",parseDataEvents),i.iot.$on("message",parseIotEvents),x&&propagateMasterFunc().catch(()=>{}),u&&(l||d?Promise.resolve():prePlay()).then(()=>{u.addEventListener("stalled",handleStalledWaiting),u.addEventListener("playing",handlePlaying),u.addEventListener("pause",handlePause),u.addEventListener("seeking",handleSeeking),u.addEventListener("seeked",handleSeeked),u.addEventListener("ended",handleEnded),startSyncLoop()})):t._log("No video element present!")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("removeLocalParticipant",stopSyncLoop),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("removeRemoteParticipant",handleRemoveRemoteParticipant),t.off("data",parseDataEvents),i.iot.$off("message",parseIotEvents),u&&(u.removeEventListener("stalled",handleStalledWaiting),u.removeEventListener("playing",handlePlaying),u.removeEventListener("pause",handlePause),u.removeEventListener("seeking",handleSeeking),u.removeEventListener("seeked",handleSeeked),u.removeEventListener("ended",handleEnded)),u=null}}};var sync_native_hls=function(){let{room:t,wt:i,roomSession:o,emitter:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=null;const c=6e4,h=1e4,l=.5,d=3;let p=0,m=null,g=null,v=!1,b=!1,w=2,_=!1,M=!0,k=!1,B=!1;const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(m)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),v=!1;const loop=()=>{b=!0,a.emit("playerSyncing",!0),sync().finally(()=>{b=!1,a.emit("playerSyncing",!1),isConnected()&&!v?m=setTimeout(loop,g):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(m),m=null,p=0,v=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];i?(p++,p>d?(g=c,p=0):g=h):(g=c,p=0),t._log("--- Next sync will occur in "+g/1e3+" seconds ---")},sync=()=>getSyncData().then(i=>{if(i.isMaster)return u.paused&&u.play(),setNextWaitTime(!1),Promise.resolve();if(B)return setNextWaitTime(!1),propagateMasterFunc();{const o=Date.now(),{position:a,realPosition:u,isBufferSufficient:c}=calculateSyncDifferenceTime(i.masterFragmentSn,i.masterFragmentPos,i.ping),h=getCurrentSegmentPosition()/1e3;return a&&Math.abs(a-h)<=l?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==a?seekTo(a).then(()=>{const i=(Date.now()-o)/1e3,a=Math.abs(u+i-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!c),t._log("Seek duration is ".concat(i)),t._log("Sync precision should be ".concat(a));return setNextWaitTime(a>l),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{B&&propagateMasterFunc(),u&&!1===u.paused&&u.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},handleAddRemoteParticipant=()=>{B&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?a.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{let t=u&&u.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=(i,o,a)=>{let c=u.buffered,h={};for(let t=0;t<c.length;t++){let i=c.start(t),o=c.end(t);(!h.start||i<h.start)&&(h.start=i),(!h.end||o>h.end)&&(h.end=o)}let l=(o+a/2)/1e3;return l>h.start&&l<h.end?{position:l,isBufferSufficient:!0}:l<h.start?(t._log("Syncing to ".concat(h.start," instead of ").concat(l," due to lack of buffered data")),{position:h.start+.5,realPosition:l,isBufferSufficient:!1}):l>h.end?(t._log("Syncing to ".concat(h.end," instead of ").concat(l," due to lack of buffered data")),{position:h.end-.5,realPosition:l,isBufferSufficient:!1}):{position:null,realPosition:l,isBufferSufficient:!1}},seekTo=i=>new Promise((o,a)=>{if(u.currentTime!==i){let c=i-u.currentTime;if(u.currentTime<i&&c<4){t._log("Fast forward to seek...");let i=!1,__=()=>{i&&u.pause(),u.playbackRate=1,k=!1,a("Stalled")};u.addEventListener("stalled",__,{once:!0}),setExactTimeout(()=>{i&&u.pause(),u.playbackRate=1,k=!1,u.removeEventListener("stalled",__,{once:!0}),o()},1e3*c/(w-1),20),k=!0,u.paused?(i=!0,u.play().then(()=>{u.playbackRate=w})):u.playbackRate=w}else{t._log("Jump to seek...");let a=Date.now();k=!0,u.addEventListener("playing",()=>{t._log("It took the player ".concat((Date.now()-a)/1e3," seconds to seek ")),k=!1,o()},{once:!0}),u.currentTime=i}}else o()}),handlePlaying=()=>{k||(t._log("Handle playing"),startSyncLoop()),k=!1,M=u.paused,_=!u.paused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),_=!u.paused},handleStalledWaiting=()=>{t._log("handleStalledWaiting"),k||(stopSyncLoop(),clientPaused().catch(()=>{}),M=u.paused)};let P=null;const stalledGenerator=()=>{clearTimeout(P),P=setTimeout(()=>{!1===u.paused&&handleStalledWaiting()},1e3)},roomSyncSend=i=>{if(!u)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let o=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to ".concat(i)),t._log("Current time: ".concat(o)),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(o),slave_id:t.webrtcVersion>1e3?String(i):Number(i)}})},getSyncData=()=>{t._log("Sending roomSync request");let i=t.roomId,o=parseInt(getCurrentSegmentPosition());return new Promise((a,u)=>{let c=(new Date).getTime(),h=null,l=setTimeout(()=>{t.off("data",fn,this),u("Timeout")},3e3),d={request:"sync",room:i,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(o)},fn=i=>{i.videoroom&&["sync","sync_response"].includes(i.videoroom)&&(i.sync_master_await?(t._log("Waiting for master position"),h||(h=(new Date).getTime()-c)):i.sync_master_fragment||i.sync_master_fragment_pos?(t._log("Got master position data"),h||(h=(new Date).getTime()-c),t._log("I'm master: ".concat(!!i.sync_master_self)),t._log("Ping: ".concat(h)),t._log("Master fragment: ".concat(i.sync_master_fragment)),t._log("Master fragment position: ".concat(i.sync_master_fragment_pos)),t.off("data",fn,this),clearTimeout(l),a({isMaster:!!i.sync_master_self,ping:h,masterFragmentPos:parseInt(i.sync_master_fragment_pos),masterFragmentSn:parseInt(i.sync_master_fragment)})):(clearTimeout(l),u("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(i=>{t.off("data",fn,this),clearTimeout(l),u(i)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{videoElement:i,syncOnLevelSwitch:o=!1,propagateMaster:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u=i,B=a,_=!1===u.paused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),B&&propagateMasterFunc().catch(()=>{}),u&&!1===u.paused&&u.addEventListener("progress",()=>{restartSyncLoop()},{once:!0}),u.addEventListener("timeupdate",stalledGenerator),u.addEventListener("playing",handlePlaying),u.addEventListener("pause",handlePause)},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),u&&(u.removeEventListener("timeupdate",stalledGenerator),u.removeEventListener("playing",handlePlaying),u.removeEventListener("pause",handlePause))}}};var sync_shaka_dash=function(){let{room:t,wt:i,roomSession:o,emitter:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=null,c=null;const h=6e4,l=1e4,d=.5,p=3;let m=0,g=null,v=null,b=!1,w=!1,_=2,M=!1,k=!0,B=!1,P=!1;const buffering=t=>{t.buffering&&handleStalledWaiting()},startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(g)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),b=!1;const loop=()=>{w=!0,a.emit("playerSyncing",!0),sync().finally(()=>{w=!1,a.emit("playerSyncing",!1),isConnected()&&!b?g=setTimeout(loop,v):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(g),g=null,m=0,b=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];i?(m++,m>p?(v=h,m=0):v=l):(v=h,m=0),t._log("--- Next sync will occur in "+v/1e3+" seconds ---")},sync=()=>getSyncData().then(i=>{if(i.isMaster)return c.paused&&c.play(),setNextWaitTime(!1),Promise.resolve();if(P)return setNextWaitTime(!1),propagateMasterFunc();{const o=Date.now(),{position:a,realPosition:u,isBufferSufficient:c}=calculateSyncDifferenceTime(i.masterFragmentSn,i.masterFragmentPos,i.ping),h=getCurrentSegmentPosition()/1e3;return a&&Math.abs(a-h)<=d?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==a?seekTo(a).then(()=>{const i=(Date.now()-o)/1e3,a=Math.abs(u+i-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!c),t._log("Seek duration is ".concat(i)),t._log("Sync precision should be ".concat(a));return setNextWaitTime(a>d),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{P&&propagateMasterFunc(),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},handleAddRemoteParticipant=()=>{P&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?a.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{let t=c&&c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=(i,o,a)=>{let u=c.buffered,h={};for(let t=0;t<u.length;t++){let i=u.start(t),o=u.end(t);(!h.start||i<h.start)&&(h.start=i),(!h.end||o>h.end)&&(h.end=o)}let l=(o+a/2)/1e3;return l>h.start&&l<h.end?{position:l,isBufferSufficient:!0}:l<h.start?(t._log("Syncing to ".concat(h.start," instead of ").concat(l," due to lack of buffered data")),{position:h.start+.5,realPosition:l,isBufferSufficient:!1}):l>h.end?(t._log("Syncing to ".concat(h.end," instead of ").concat(l," due to lack of buffered data")),{position:h.end-.5,realPosition:l,isBufferSufficient:!1}):{position:null,realPosition:l,isBufferSufficient:!1}},seekTo=i=>new Promise((o,a)=>{if(c.currentTime!==i){let u=i-c.currentTime;if(c.currentTime<i&&u<4){t._log("Fast forward to seek...");let i=!1,__=()=>{i&&c.pause(),c.playbackRate=1,B=!1,a("Stalled")};c.addEventListener("stalled",__,{once:!0}),setExactTimeout(()=>{i&&c.pause(),c.playbackRate=1,B=!1,c.removeEventListener("stalled",__,{once:!0}),o()},1e3*u/(_-1),20),B=!0,c.paused?(i=!0,c.play().then(()=>{c.playbackRate=_})):c.playbackRate=_}else{t._log("Jump to seek...");let a=Date.now();B=!0,c.addEventListener("playing",()=>{t._log("It took the player ".concat((Date.now()-a)/1e3," seconds to seek ")),B=!1,o()},{once:!0}),c.currentTime=i}}else o()}),handlePlaying=()=>{B||(t._log("Handle playing"),startSyncLoop()),B=!1,k=c.paused,M=!c.paused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),M=!c.paused},handleStalledWaiting=()=>{t._log("handleStalledWaiting"),B||(stopSyncLoop(),clientPaused().catch(()=>{}),k=c.paused)},roomSyncSend=i=>{if(!u||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let o=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to ".concat(i)),t._log("Current time: ".concat(o)),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(o),slave_id:t.webrtcVersion>1e3?String(i):Number(i)}})},getSyncData=()=>{t._log("Sending roomSync request");let i=t.roomId,o=parseInt(getCurrentSegmentPosition());return new Promise((a,u)=>{let c=(new Date).getTime(),h=null,l=setTimeout(()=>{t.off("data",fn,this),u("Timeout")},3e3),d={request:"sync",room:i,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(o)},fn=i=>{i.videoroom&&["sync","sync_response"].includes(i.videoroom)&&(i.sync_master_await?(t._log("Waiting for master position"),h||(h=(new Date).getTime()-c)):i.sync_master_fragment||i.sync_master_fragment_pos?(t._log("Got master position data"),h||(h=(new Date).getTime()-c),t._log("I'm master: ".concat(!!i.sync_master_self)),t._log("Ping: ".concat(h)),t._log("Master fragment: ".concat(i.sync_master_fragment)),t._log("Master fragment position: ".concat(i.sync_master_fragment_pos)),t.off("data",fn,this),clearTimeout(l),a({isMaster:!!i.sync_master_self,ping:h,masterFragmentPos:parseInt(i.sync_master_fragment_pos),masterFragmentSn:parseInt(i.sync_master_fragment)})):(clearTimeout(l),u("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(i=>{t.off("data",fn,this),clearTimeout(l),u(i)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{libraryInstance:i,shakaInstance:o,propagateMaster:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u=i||o,c=u.getMediaElement(),P=a,M=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),P&&propagateMasterFunc().catch(()=>{}),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0}),u.addEventListener("buffering",buffering),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause)},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),u&&u.removeEventListener("buffering",buffering),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause)),u=null}}};var sync_shaka_dash_vod=function(){let{room:t,wt:i,roomSession:o,emitter:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=null,c=null,h=null,l=!1;const d=6e4,p=1e4,m=.5,g=3;let v=0,b=null,w=null,_=!1,M=!1,k=null,B=300,P=!1,x=!1,I=!1;const startSyncLoop=()=>{if(l)return void t._log("--- Sync loop will not start due to sync force disabled ---");if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(b)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),_=!1;const loop=()=>{M=!0,a.emit("playerSyncing",!0),sync().finally(()=>{M=!1,a.emit("playerSyncing",!1),isConnected()&&!_?b=setTimeout(loop,w):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(b),b=null,v=0,_=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];i?(v++,v>g?(w=d,v=0):w=p):(w=d,v=0),t._log("--- Next sync will occur in "+w/1e3+" seconds ---")},sync=()=>getSyncData().then(i=>{if(i.isMaster||_)return setNextWaitTime(!1),Promise.resolve();if(I)return setNextWaitTime(!1),propagateMasterFunc();{const o=Date.now(),{position:a,isBufferSufficient:u}=calculateSyncDifferenceTime(i.masterFragmentSn,i.masterFragmentPos,i.ping),c=getCurrentSegmentPosition()/1e3;return i.masterFragmentSn?playMedia():pauseMedia(),a&&Math.abs(a-c)<=m?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==a?seekTo(a).then(()=>{const i=(Date.now()-o)/1e3,c=Math.abs(a+(P?i:0)-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!u),t._log("Seek duration is ".concat(i)),t._log("Sync precision should be ".concat(c));return setNextWaitTime(c>m),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>{setNextWaitTime(!0)}),handleAddLocalParticipant=()=>{I&&propagateMasterFunc(),c&&setTimeout(()=>{restartSyncLoop()},1e3)},handleAddRemoteParticipant=()=>{I&&propagateMasterFunc()},handleRemoveRemoteParticipant=()=>{I&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,buffering=t=>{t.buffering&&handleStalledWaiting()},executePlayerIotEvents=i=>{let o=h||t.roomId;"playerReplay"!==i.attributeName||o&&(null==i?void 0:i.roomId)!==o||seekTo(0).then(()=>playMedia()),"playerPlay"!==i.attributeName||o&&(null==i?void 0:i.roomId)!==o||playMedia(),"playerPause"!==i.attributeName||o&&(null==i?void 0:i.roomId)!==o||pauseMedia()},parseIotEvents=t=>{"template_updated"===t.event&&("multi"===t.operation&&(t.value||[]).forEach(i=>{"sendMessage"===i.operation&&executePlayerIotEvents({...i,roomId:t.roomId,userId:t.userId})}),"sendMessage"===t.operation&&executePlayerIotEvents(t))},parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("sync_source_set"===t.videoroom&&""!=t.wt_channel_id)a.emit("changePlayerSource",t.wt_channel_id);else if("sync_request"===t.videoroom)roomSyncSend(t.sync_slave_id).catch(()=>{});else if("message"===t.videoroom){if(I&&null!==t.from)return;if(l)return;"sync_seeking"===t.user_action?seekMedia(t).catch(()=>{}):"sync_seeked"===t.user_action||("sync_play"===t.user_action||"sync_play"===t.action?playMedia():"sync_pause"!==t.user_action&&"sync_pause"!==t.action||pauseMedia())}},getCurrentSegmentPosition=()=>{let t=c&&c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2?arguments[2]:void 0;return{position:(i+o/2)/1e3,isBufferSufficient:!0}},seekMedia=i=>{if((i={userId:i.from,...i.text&&JSON.parse(i.text)}).handleId!==t.handleId){const{position:t,isBufferSufficient:o}=calculateSyncDifferenceTime(i.fragment,i.fragment_pos,0);return t?seekTo(t).then(()=>{I&&propagateMasterFunc()}):Promise.resolve()}return Promise.resolve()},prePlay=()=>{if(c.currentTime>0||!1===c.paused)return Promise.resolve();x=!0;let t=c.muted;return c.muted=!0,c.play().then(()=>(c.pause(),c.currentTime=0,wt_utils_wait(100))).catch(()=>!0).finally(()=>(c.muted=t,x=!1,!0))},playMedia=()=>{c&&c.paused&&(x=!0,c.play().finally(()=>{x=!1}))},pauseMedia=()=>{c&&!c.paused&&(x=!0,c.addEventListener("pause",()=>{x=!1},{once:!0}),c.pause())},seekTo=t=>new Promise(i=>{c.currentTime!==t?(x=!0,c.addEventListener("seeked",()=>{x=!1,i()},{once:!0}),c.currentTime=t):i()}),handlePlaying=()=>{x||o.sendSystemMessage("sync_play",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),P=!c.paused},handlePause=()=>{x||o.sendSystemMessage("sync_pause",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),P=!c.paused},handleStalledWaiting=()=>{x||clientPaused().catch(()=>{})},handleSeeking=()=>{clearTimeout(k),x||(k=setTimeout(()=>{let i=parseInt(getCurrentSegmentPosition());o.sendSystemMessage("sync_seeking",{timestamp:(new Date).getTime(),handleId:t.handleId,fragment:"0",fragment_pos:Number(i)},void 0,null).catch(()=>{}),I||l||pauseMedia()},B))},handleSeeked=()=>{},handleEnded=()=>{},roomSyncSend=i=>{if(!u||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let o=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to ".concat(i)),t._log("Current time: ".concat(o)),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:P?"1":"0",fragment_pos:Number(o),slave_id:t.webrtcVersion>1e3?String(i):Number(i)}})},getSyncData=()=>{t._log("Sending roomSync request");let i=t.roomId,o=parseInt(getCurrentSegmentPosition());return new Promise((a,u)=>{let c=(new Date).getTime(),h=null,l=setTimeout(()=>{t.off("data",fn,this),u("Timeout")},3e3),d={request:"sync",room:i,timestamp:(new Date).getTime(),fragment:P?"1":"0",fragment_pos:Number(o)},fn=i=>{i.videoroom&&["sync","sync_response"].includes(i.videoroom)&&(i.sync_master_await?(t._log("Waiting for master position"),h||(h=(new Date).getTime()-c)):i.sync_master_fragment||i.sync_master_fragment_pos?(t._log("Got master position data"),h||(h=(new Date).getTime()-c),t._log("I'm master: ".concat(!!i.sync_master_self)),t._log("Ping: ".concat(h)),t._log("Master fragment: ".concat(i.sync_master_fragment)),t._log("Master fragment position: ".concat(i.sync_master_fragment_pos)),t.off("data",fn,this),clearTimeout(l),a({isMaster:!!i.sync_master_self,ping:h,masterFragmentPos:parseInt(i.sync_master_fragment_pos),masterFragmentSn:parseInt(i.sync_master_fragment)})):(clearTimeout(l),u("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(i=>{t.off("data",fn,this),clearTimeout(l),u(i)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{shakaInstance:o,libraryInstance:d,propagateMaster:p=!1,isStudio:m=!1,roomId:g,syncDisabled:v}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u=o||d,c=u.getMediaElement(),h=g,l=v,u?(a.emit("playerSyncing",!1),I=p,P=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("removeLocalParticipant",stopSyncLoop),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("removeRemoteParticipant",handleRemoveRemoteParticipant),t.on("data",parseDataEvents),i.iot.$on("message",parseIotEvents),I&&propagateMasterFunc().catch(()=>{}),u&&c&&(p||m?Promise.resolve():prePlay()).then(()=>{u.addEventListener("buffering",buffering),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause),c.addEventListener("seeking",handleSeeking),c.addEventListener("seeked",handleSeeked),c.addEventListener("ended",handleEnded),startSyncLoop()})):console.log("No shaka player instance")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("removeLocalParticipant",stopSyncLoop),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("removeRemoteParticipant",handleRemoveRemoteParticipant),t.off("data",parseDataEvents),i.iot.$off("message",parseIotEvents),u&&u.removeEventListener("buffering",buffering),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause),c.removeEventListener("seeking",handleSeeking),c.removeEventListener("seeked",handleSeeked),c.removeEventListener("ended",handleEnded)),u=null,c=null}}};var sync_dash=function(){let{room:t,wt:i,roomSession:o,emitter:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=null,c=null;const h=6e4,l=1e4,d=.5,p=3;let m=0,g=null,v=null,b=!1,w=!1,_=2,M=!1,k=!0,B=!1,P=!1;const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(g)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),b=!1;const loop=()=>{w=!0,a.emit("playerSyncing",!0),sync().finally(()=>{w=!1,a.emit("playerSyncing",!1),isConnected()&&!b?g=setTimeout(loop,v):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(g),g=null,m=0,b=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];i?(m++,m>p?(v=h,m=0):v=l):(v=h,m=0),t._log("--- Next sync will occur in "+v/1e3+" seconds ---")},sync=()=>getSyncData().then(i=>{if(i.isMaster)return c.paused&&c.play(),setNextWaitTime(!1),Promise.resolve();if(P)return setNextWaitTime(!1),propagateMasterFunc();{const o=Date.now(),{position:a,realPosition:u,isBufferSufficient:c}=calculateSyncDifferenceTime(i.masterFragmentSn,i.masterFragmentPos,i.ping),h=getCurrentSegmentPosition()/1e3;return a&&Math.abs(a-h)<=d?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==a?seekTo(a).then(()=>{const i=(Date.now()-o)/1e3,a=Math.abs(u+i-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!c),t._log("Seek duration is ".concat(i)),t._log("Sync precision should be ".concat(a));return setNextWaitTime(a>d),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{P&&propagateMasterFunc(),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},handleAddRemoteParticipant=()=>{P&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,buffering=t=>{"video"!==t.mediaType&&"audio"!==t.mediaType||"bufferStalled"===t.state&&handleStalledWaiting()},parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?a.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{let t=c&&c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=(i,o,a)=>{let u=c.buffered,h={};for(let t=0;t<u.length;t++){let i=u.start(t),o=u.end(t);(!h.start||i<h.start)&&(h.start=i),(!h.end||o>h.end)&&(h.end=o)}let l=(o+a/2)/1e3;return l>h.start&&l<h.end?{position:l,realPosition:l,isBufferSufficient:!0}:l<h.start?(t._log("Syncing to ".concat(h.start," instead of ").concat(l," due to lack of buffered data")),{position:h.start+.5,realPosition:l,isBufferSufficient:!1}):l>h.end?(t._log("Syncing to ".concat(h.end," instead of ").concat(l," due to lack of buffered data")),{position:h.end-.5,realPosition:l,isBufferSufficient:!1}):{position:null,realPosition:l,isBufferSufficient:!1}},seekTo=i=>new Promise((o,a)=>{if(c.currentTime!==i){let u=i-c.currentTime;if(c.currentTime<i&&u<4){t._log("Fast forward to seek...");let i=!1,__=()=>{i&&c.pause(),c.playbackRate=1,B=!1,a("Stalled")};c.addEventListener("stalled",__,{once:!0}),setExactTimeout(()=>{i&&c.pause(),c.playbackRate=1,B=!1,c.removeEventListener("stalled",__,{once:!0}),o()},1e3*u/(_-1),20),B=!0,c.paused?(i=!0,c.play().then(()=>{c.playbackRate=_})):c.playbackRate=_}else{t._log("Jump to seek...");let a=Date.now();B=!0,c.addEventListener("playing",()=>{t._log("It took the player ".concat((Date.now()-a)/1e3," seconds to seek ")),B=!1,o()},{once:!0}),c.currentTime=i}}else o()}),handlePlaying=()=>{B||(t._log("Handle playing"),startSyncLoop()),B=!1,k=c.paused,M=!c.paused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),M=!c.paused},handleStalledWaiting=()=>{t._log("handleStalledWaiting"),B||(stopSyncLoop(),clientPaused().catch(()=>{}),k=c.paused)},roomSyncSend=i=>{if(!u||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let o=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to ".concat(i)),t._log("Current time: ".concat(o)),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(o),slave_id:t.webrtcVersion>1e3?String(i):Number(i)}})},getSyncData=()=>{t._log("Sending roomSync request");let i=t.roomId,o=parseInt(getCurrentSegmentPosition());return new Promise((a,u)=>{let c=(new Date).getTime(),h=null,l=setTimeout(()=>{t.off("data",fn,this),u("Timeout")},3e3),d={request:"sync",room:i,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(o)},fn=i=>{i.videoroom&&["sync","sync_response"].includes(i.videoroom)&&(i.sync_master_await?(t._log("Waiting for master position"),h||(h=(new Date).getTime()-c)):i.sync_master_fragment||i.sync_master_fragment_pos?(t._log("Got master position data"),h||(h=(new Date).getTime()-c),t._log("I'm master: ".concat(!!i.sync_master_self)),t._log("Ping: ".concat(h)),t._log("Master fragment: ".concat(i.sync_master_fragment)),t._log("Master fragment position: ".concat(i.sync_master_fragment_pos)),t.off("data",fn,this),clearTimeout(l),a({isMaster:!!i.sync_master_self,ping:h,masterFragmentPos:parseInt(i.sync_master_fragment_pos),masterFragmentSn:parseInt(i.sync_master_fragment)})):(clearTimeout(l),u("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(i=>{t.off("data",fn,this),clearTimeout(l),u(i)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{dashInstance:i,libraryInstance:o,propagateMaster:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u=i||o,c=u.getVideoElement(),u?(P=a,M=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),P&&propagateMasterFunc().catch(()=>{}),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0}),u.on("bufferStateChanged",buffering),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause)):t._log("No dash player instance!")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),u&&u.off("bufferStateChanged",buffering),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause)),u=null}}};var sync_dash_vod=function(){let{room:t,wt:i,roomSession:o,emitter:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=null,c=null,h=null,l=!1;const d=6e4,p=1e4,m=.5,g=3;let v=0,b=null,w=null,_=!1,M=!1,k=null,B=300,P=!1,x=!1,I=!1;const startSyncLoop=()=>{if(l)return void t._log("--- Sync loop will not start due to sync force disabled ---");if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(b)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),_=!1;const loop=()=>{M=!0,a.emit("playerSyncing",!0),sync().finally(()=>{M=!1,a.emit("playerSyncing",!1),isConnected()&&!_?b=setTimeout(loop,w):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(b),b=null,v=0,_=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];i?(v++,v>g?(w=d,v=0):w=p):(w=d,v=0),t._log("--- Next sync will occur in "+w/1e3+" seconds ---")},sync=()=>getSyncData().then(i=>{if(i.isMaster||_)return setNextWaitTime(!1),Promise.resolve();if(I)return setNextWaitTime(!1),propagateMasterFunc();{const o=Date.now(),{position:a,isBufferSufficient:u}=calculateSyncDifferenceTime(i.masterFragmentSn,i.masterFragmentPos,i.ping),c=getCurrentSegmentPosition()/1e3;return i.masterFragmentSn?playMedia():pauseMedia(),a&&Math.abs(a-c)<=m?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==a?seekTo(a).then(()=>{const i=(Date.now()-o)/1e3,c=Math.abs(a+(P?i:0)-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!u),t._log("Seek duration is ".concat(i)),t._log("Sync precision should be ".concat(c));return setNextWaitTime(c>m),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>{setNextWaitTime(!0)}),handleAddLocalParticipant=()=>{I&&propagateMasterFunc(),c&&setTimeout(()=>{restartSyncLoop()},1e3)},handleAddRemoteParticipant=()=>{I&&propagateMasterFunc()},handleRemoveRemoteParticipant=()=>{I&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,buffering=t=>{"video"!==t.mediaType&&"audio"!==t.mediaType||"bufferStalled"===t.state&&handleStalledWaiting()},executePlayerIotEvents=i=>{let o=h||t.roomId;"playerReplay"!==i.attributeName||o&&(null==i?void 0:i.roomId)!==o||seekTo(0).then(()=>playMedia()),"playerPlay"!==i.attributeName||o&&(null==i?void 0:i.roomId)!==o||playMedia(),"playerPause"!==i.attributeName||o&&(null==i?void 0:i.roomId)!==o||pauseMedia()},parseIotEvents=t=>{"template_updated"===t.event&&("multi"===t.operation&&(t.value||[]).forEach(i=>{"sendMessage"===i.operation&&executePlayerIotEvents({...i,roomId:t.roomId,userId:t.userId})}),"sendMessage"===t.operation&&executePlayerIotEvents(t))},parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("sync_source_set"===t.videoroom&&""!=t.wt_channel_id)a.emit("changePlayerSource",t.wt_channel_id);else if("sync_request"===t.videoroom)roomSyncSend(t.sync_slave_id).catch(()=>{});else if("message"===t.videoroom){if(I&&null!==t.from)return;if(l)return;"sync_seeking"===t.user_action?seekMedia(t).catch(()=>{}):"sync_seeked"===t.user_action||("sync_play"===t.user_action||"sync_play"===t.action?playMedia():"sync_pause"!==t.user_action&&"sync_pause"!==t.action||pauseMedia())}},getCurrentSegmentPosition=()=>{let t=c&&c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2?arguments[2]:void 0;return{position:(i+o/2)/1e3,isBufferSufficient:!0}},seekMedia=i=>{if((i={userId:i.from,...i.text&&JSON.parse(i.text)}).handleId!==t.handleId){const{position:t,isBufferSufficient:o}=calculateSyncDifferenceTime(i.fragment,i.fragment_pos,0);return t?seekTo(t).then(()=>{I&&propagateMasterFunc()}):Promise.resolve()}return Promise.resolve()},prePlay=()=>{if(c.currentTime>0||!1===c.paused)return Promise.resolve();x=!0;let t=c.muted;return c.muted=!0,c.play().then(()=>(c.pause(),c.currentTime=0,wt_utils_wait(100))).catch(()=>!0).finally(()=>(c.muted=t,x=!1,!0))},playMedia=()=>{c&&c.paused&&(x=!0,c.play().finally(()=>{x=!1}))},pauseMedia=()=>{c&&!c.paused&&(x=!0,c.addEventListener("pause",()=>{x=!1},{once:!0}),c.pause())},seekTo=t=>new Promise(i=>{c.currentTime!==t?(x=!0,c.addEventListener("seeked",()=>{x=!1,i()},{once:!0}),c.currentTime=t):i()}),handlePlaying=()=>{x||o.sendSystemMessage("sync_play",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),P=!c.paused},handlePause=()=>{x||o.sendSystemMessage("sync_pause",{timestamp:(new Date).getTime(),handleId:t.handleId},void 0,null).catch(()=>{}),P=!c.paused},handleStalledWaiting=()=>{x||clientPaused().catch(()=>{})},handleSeeking=()=>{clearTimeout(k),x||(k=setTimeout(()=>{let i=parseInt(getCurrentSegmentPosition());o.sendSystemMessage("sync_seeking",{timestamp:(new Date).getTime(),handleId:t.handleId,fragment:"0",fragment_pos:Number(i)},void 0,null).catch(()=>{}),I||l||pauseMedia()},B))},handleSeeked=()=>{},handleEnded=()=>{},roomSyncSend=i=>{if(!u||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let o=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to ".concat(i)),t._log("Current time: ".concat(o)),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:P?"1":"0",fragment_pos:Number(o),slave_id:t.webrtcVersion>1e3?String(i):Number(i)}})},getSyncData=()=>{t._log("Sending roomSync request");let i=t.roomId,o=parseInt(getCurrentSegmentPosition());return new Promise((a,u)=>{let c=(new Date).getTime(),h=null,l=setTimeout(()=>{t.off("data",fn,this),u("Timeout")},3e3),d={request:"sync",room:i,timestamp:(new Date).getTime(),fragment:P?"1":"0",fragment_pos:Number(o)},fn=i=>{i.videoroom&&["sync","sync_response"].includes(i.videoroom)&&(i.sync_master_await?(t._log("Waiting for master position"),h||(h=(new Date).getTime()-c)):i.sync_master_fragment||i.sync_master_fragment_pos?(t._log("Got master position data"),h||(h=(new Date).getTime()-c),t._log("I'm master: ".concat(!!i.sync_master_self)),t._log("Ping: ".concat(h)),t._log("Master fragment: ".concat(i.sync_master_fragment)),t._log("Master fragment position: ".concat(i.sync_master_fragment_pos)),t.off("data",fn,this),clearTimeout(l),a({isMaster:!!i.sync_master_self,ping:h,masterFragmentPos:parseInt(i.sync_master_fragment_pos),masterFragmentSn:parseInt(i.sync_master_fragment)})):(clearTimeout(l),u("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(i=>{t.off("data",fn,this),clearTimeout(l),u(i)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{dashInstance:o,libraryInstance:d,propagateMaster:p=!1,isStudio:m=!1,roomId:g,syncDisabled:v}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u=o||d,c=u.getVideoElement(),h=g,l=v,u?(a.emit("playerSyncing",!1),I=p,P=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("removeLocalParticipant",stopSyncLoop),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("removeRemoteParticipant",handleRemoveRemoteParticipant),t.on("data",parseDataEvents),i.iot.$on("message",parseIotEvents),I&&propagateMasterFunc().catch(()=>{}),u&&c&&(p||m?Promise.resolve():prePlay()).then(()=>{u.on("bufferStateChanged",buffering),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause),c.addEventListener("seeking",handleSeeking),c.addEventListener("seeked",handleSeeked),c.addEventListener("ended",handleEnded),startSyncLoop()})):console.log("No player instance")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("removeLocalParticipant",stopSyncLoop),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("removeRemoteParticipant",handleRemoveRemoteParticipant),t.off("data",parseDataEvents),i.iot.$off("message",parseIotEvents),u&&u.off("bufferStateChanged",buffering),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause),c.removeEventListener("seeking",handleSeeking),c.removeEventListener("seeked",handleSeeked),c.removeEventListener("ended",handleEnded)),u=null,c=null}}};var sync_doris=function(){let{room:t,wt:i,roomSession:o,emitter:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=null,c=null;const h=6e4,l=1e4,d=.5,p=3;let m=0,g=null,v=null,b=!1,w=!1,_=2,M=!1,k=!0,B=!1,P=!1,x=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(g)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),b=!1;const loop=()=>{w=!0,a.emit("playerSyncing",!0),sync().finally(()=>{w=!1,a.emit("playerSyncing",!1),isConnected()&&!b?g=setTimeout(loop,v):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(g),g=null,m=0,b=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];i?(m++,m>p?(v=h,m=0):v=l):(v=h,m=0),t._log("--- Next sync will occur in "+v/1e3+" seconds ---")},sync=()=>getSyncData().then(i=>{if(i.isMaster)return c.paused&&c.play(),setNextWaitTime(!1),Promise.resolve();if(P)return setNextWaitTime(!1),propagateMasterFunc();{const o=Date.now(),{position:a,act:u,isBufferSufficient:c}=calculateSyncDifferenceTime(i.masterFragmentSn,i.masterFragmentPos,i.ping);return a&&Math.abs(a)<=d?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==a?seekDoris(a,u).then(()=>{const a=Date.now()-o,{position:u}=calculateSyncDifferenceTime(i.masterFragmentSn,i.masterFragmentPos+a,i.ping),h=Math.abs(u);t._log("Insufficient buffer: ",!c),t._log("Seek duration is ".concat(a)),t._log("Sync precision should be ".concat(h));return setNextWaitTime(h>d),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{P&&propagateMasterFunc(),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},handleAddRemoteParticipant=()=>{P&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?a.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{var t;return null===(t=u.getCurrentDate())||void 0===t?0:t.getTime()},calculateSyncDifferenceTime=function(t,i){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;var a;let c=null===(a=u.getCurrentDate())||void 0===a?null:a.getTime();return c&&i?{position:(i+o/2-c)/1e3,act:i+o/2,isBufferSufficient:!0}:{position:null,isBufferSufficient:!1}},seekDoris=(i,o)=>new Promise((a,h)=>{if(0!==i)if(x)B=!0,c.addEventListener("playing",()=>{B=!1,a()},{once:!0}),u.seekTo(new Date(o));else if(i>0&&i<4){t._log("Fast forward to seek...");let o=!1,__=()=>{o&&c.pause(),c.playbackRate=1,B=!1,h("Stalled")},u=i;c.addEventListener("stalled",__,{once:!0}),setExactTimeout(()=>{o&&c.pause(),c.playbackRate=1,B=!1,c.removeEventListener("stalled",__,{once:!0}),a()},1e3*u/(_-1),20),B=!0,c.paused?(o=!0,c.play().then(()=>{c.playbackRate=_})):c.playbackRate=_}else{t._log("Jump to seek...");let o=Date.now();B=!0,c.addEventListener("playing",()=>{t._log("It took the player ".concat((Date.now()-o)/1e3," seconds to seek ")),B=!1,a()},{once:!0}),c.currentTime+=i}else a()}),handlePlaying=()=>{B||(t._log("Handle playing"),startSyncLoop()),B=!1,k=c.paused,M=!c.paused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),M=!c.paused},handleStalledWaiting=()=>{t._log("handleStalledWaiting"),B||(stopSyncLoop(),clientPaused().catch(()=>{}),k=c.paused)};let I=null;const stalledGenerator=()=>{clearTimeout(I),I=setTimeout(()=>{!1===c.paused&&handleStalledWaiting()},1e3)},roomSyncSend=i=>{if(!u||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let o=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to ".concat(i)),t._log("Current time: ".concat(o)),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(o),slave_id:t.webrtcVersion>1e3?String(i):Number(i)}})},getSyncData=()=>{t._log("Sending roomSync request");let i=t.roomId,o=parseInt(getCurrentSegmentPosition());return new Promise((a,u)=>{let c=(new Date).getTime(),h=null,l=setTimeout(()=>{t.off("data",fn,this),u("Timeout")},3e3),d={request:"sync",room:i,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(o)},fn=i=>{i.videoroom&&["sync","sync_response"].includes(i.videoroom)&&(i.sync_master_await?(t._log("Waiting for master position"),h||(h=(new Date).getTime()-c)):i.sync_master_fragment||i.sync_master_fragment_pos?(t._log("Got master position data"),h||(h=(new Date).getTime()-c),t._log("I'm master: ".concat(!!i.sync_master_self)),t._log("Ping: ".concat(h)),t._log("Master fragment: ".concat(i.sync_master_fragment)),t._log("Master fragment position: ".concat(i.sync_master_fragment_pos)),t.off("data",fn,this),clearTimeout(l),a({isMaster:!!i.sync_master_self,ping:h,masterFragmentPos:parseInt(i.sync_master_fragment_pos),masterFragmentSn:parseInt(i.sync_master_fragment)})):(clearTimeout(l),u("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(i=>{t.off("data",fn,this),clearTimeout(l),u(i)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{dorisInstance:i,libraryInstance:o,propagateMaster:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u=i||o,c=u.sourceHandler.getElement(),P=a,M=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),P&&propagateMasterFunc().catch(()=>{}),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0}),c.addEventListener("timeupdate",stalledGenerator),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause)},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),c&&(c.removeEventListener("timeupdate",stalledGenerator),c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause)),u=null}}};var sync_disabled=function(){let{room:t,wt:i,roomSession:o,emitter:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const handleAddLocalParticipant=()=>{removeMaster()},handleAddRemoteParticipant=()=>{removeMaster()},handleRemoveRemoteParticipant=()=>{removeMaster()},removeMaster=()=>t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}});return{__events:[],initialize:function(){let{}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("removeRemoteParticipant",handleRemoveRemoteParticipant)},destroy:()=>{t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("removeRemoteParticipant",handleRemoveRemoteParticipant)}}};var sync_dazn_dash=function(){let{room:t,wt:i,roomSession:o,emitter:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=null,c=null;const h=6e4,l=1e4,d=.5,p=3;let m=0,g=null,v=null,b=!1,w=!1,_=2,M=!1,k=!0,B=!1,P=!1;const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(g)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),b=!1;const loop=()=>{w=!0,a.emit("playerSyncing",!0),sync().finally(()=>{w=!1,a.emit("playerSyncing",!1),isConnected()&&!b?g=setTimeout(loop,v):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(g),g=null,m=0,b=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];i?(m++,m>p?(v=h,m=0):v=l):(v=h,m=0),t._log("--- Next sync will occur in "+v/1e3+" seconds ---")},sync=()=>getSyncData().then(i=>{if(i.isMaster)return c.paused&&c.play(),setNextWaitTime(!1),Promise.resolve();if(P)return setNextWaitTime(!1),propagateMasterFunc();{const o=Date.now(),{position:a,realPosition:u,isBufferSufficient:c}=calculateSyncDifferenceTime(i.masterFragmentSn,i.masterFragmentPos,i.ping),h=getCurrentSegmentPosition()/1e3;return a&&Math.abs(a-h)<=d?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==a?seekTo(a).then(()=>{const i=(Date.now()-o)/1e3,a=Math.abs(u+i-getCurrentSegmentPosition()/1e3);t._log("Insufficient buffer: ",!c),t._log("Seek duration is ".concat(i)),t._log("Sync precision should be ".concat(a));return setNextWaitTime(a>d),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{P&&propagateMasterFunc(),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0})},handleAddRemoteParticipant=()=>{P&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?a.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{let t=c&&c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=(i,o,a)=>{let u=c.buffered,h={};for(let t=0;t<u.length;t++){let i=u.start(t),o=u.end(t);(!h.start||i<h.start)&&(h.start=i),(!h.end||o>h.end)&&(h.end=o)}let l=(o+a/2)/1e3;return l>h.start&&l<h.end?{position:l,realPostion:l,isBufferSufficient:!0}:l<h.start?(t._log("Syncing to ".concat(h.start," instead of ").concat(l," due to lack of buffered data")),{position:h.start+.5,realPostion:l,isBufferSufficient:!1}):l>h.end?(t._log("Syncing to ".concat(h.end," instead of ").concat(l," due to lack of buffered data")),{position:h.end-.5,realPostion:l,isBufferSufficient:!1}):{position:null,realPostion:l,isBufferSufficient:!1}},seekTo=i=>new Promise((o,a)=>{if(c.currentTime!==i){let u=i-c.currentTime;if(c.currentTime<i&&u<4){t._log("Fast forward to seek...");let i=!1,__=()=>{i&&c.pause(),c.playbackRate=1,B=!1,a("Stalled")};c.addEventListener("stalled",__,{once:!0}),setExactTimeout(()=>{i&&c.pause(),c.playbackRate=1,B=!1,c.removeEventListener("stalled",__,{once:!0}),o()},1e3*u/(_-1),20),B=!0,c.paused?(i=!0,c.play().then(()=>{c.playbackRate=_})):c.playbackRate=_}else{t._log("Jump to seek...");let a=Date.now();B=!0,c.addEventListener("playing",()=>{t._log("It took the player ".concat((Date.now()-a)/1e3," seconds to seek ")),B=!1,o()},{once:!0}),c.currentTime=i}}else o()}),handlePlaying=()=>{B||(t._log("Handle playing"),startSyncLoop()),B=!1,k=c.paused,M=!c.paused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),M=!c.paused},handleStalledWaiting=()=>{t._log("handleStalledWaiting"),B||(stopSyncLoop(),clientPaused().catch(()=>{}),k=c.paused)},roomSyncSend=i=>{if(!u||!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let o=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to ".concat(i)),t._log("Current time: ".concat(o)),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(o),slave_id:t.webrtcVersion>1e3?String(i):Number(i)}})},getSyncData=()=>{t._log("Sending roomSync request");let i=t.roomId,o=parseInt(getCurrentSegmentPosition());return new Promise((a,u)=>{let c=(new Date).getTime(),h=null,l=setTimeout(()=>{t.off("data",fn,this),u("Timeout")},3e3),d={request:"sync",room:i,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(o)},fn=i=>{i.videoroom&&["sync","sync_response"].includes(i.videoroom)&&(i.sync_master_await?(t._log("Waiting for master position"),h||(h=(new Date).getTime()-c)):i.sync_master_fragment||i.sync_master_fragment_pos?(t._log("Got master position data"),h||(h=(new Date).getTime()-c),t._log("I'm master: ".concat(!!i.sync_master_self)),t._log("Ping: ".concat(h)),t._log("Master fragment: ".concat(i.sync_master_fragment)),t._log("Master fragment position: ".concat(i.sync_master_fragment_pos)),t.off("data",fn,this),clearTimeout(l),a({isMaster:!!i.sync_master_self,ping:h,masterFragmentPos:parseInt(i.sync_master_fragment_pos),masterFragmentSn:parseInt(i.sync_master_fragment)})):(clearTimeout(l),u("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(i=>{t.off("data",fn,this),clearTimeout(l),u(i)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{libraryInstance:i,propagateMaster:o=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};u=i,c=u.videoElement,P=o,M=!1===c.paused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),P&&propagateMasterFunc().catch(()=>{}),c&&!1===c.paused&&c.addEventListener("progress",()=>{restartSyncLoop()},{once:!0}),u.addEventListener("buffer",handleStalledWaiting),c.addEventListener("playing",handlePlaying),c.addEventListener("pause",handlePause)},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),u&&u.removeEventListener("buffer",handleStalledWaiting),c&&(c.removeEventListener("playing",handlePlaying),c.removeEventListener("pause",handlePause)),u=null}}};var sync_universal=function(){let{room:t,wt:i,roomSession:o,emitter:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=Object(b.a)(),c=null,h={isLive:!0,ignoreBufferedTimeRanges:!0,useSeekBy:!1,syncBySegments:!1,disableFastSeek:!1};const l=6e4,d=1e4,p=.5,m=3,g=5e3;let v=0,w=null,_=null,M=!1,k=!1,B=2,P=!1,x=!0,I=!1,N=!1;const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(w)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),M=!1;const loop=()=>{k=!0,a.emit("playerSyncing",!0),sync().finally(()=>{k=!1,a.emit("playerSyncing",!1),isConnected()&&!M?w=setTimeout(loop,_):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=()=>{t._log("--- Sync disabled ---"),clearTimeout(w),w=null,v=0,M=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];i?(v++,v>m?(_=l,v=0):_=d):(_=l,v=0),t._log("--- Next sync will occur in "+_/1e3+" seconds ---")},sync=()=>getSyncData().then(i=>{if(i.isMaster)return c.isPaused&&c.play(),setNextWaitTime(!1),Promise.resolve();if(N)return setNextWaitTime(!1),propagateMasterFunc();{const o=Date.now(),{position:a,realPosition:u,isBufferSufficient:c}=calculateSyncDifferenceTime(i.masterFragmentSn,i.masterFragmentPos,i.ping),h=getCurrentSegmentPosition()/1e3;return a&&Math.abs(a-h)<=p?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null!==a?seekTo(a).then(()=>{const i=(Date.now()-o)/1e3,a=Math.abs(u+i-getCurrentSegmentPosition()/1e3);t._log(u,i,getCurrentSegmentPosition()),t._log("Insufficient buffer: ",!c),t._log("Seek duration is ".concat(i," seconds")),t._log("Sync precision should be ".concat(a));return setNextWaitTime(a>p),Promise.resolve()}).catch(t=>(setNextWaitTime(!0),Promise.reject(t))):(setNextWaitTime(!0),Promise.reject())}}).catch(()=>(setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{N&&propagateMasterFunc(),!1===c.isPaused&&u.once("timeupdate",restartSyncLoop)},handleAddRemoteParticipant=()=>{N&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_source_set"===t.videoroom&&""!=t.wt_channel_id?a.emit("changePlayerSource",t.wt_channel_id):"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentSegmentPosition=()=>{let t=c.currentTime;return isNaN(t)?0:1e3*t},calculateSyncDifferenceTime=(i,o,a)=>{let u=c.buffered,l=(o+a/2)/1e3;if(u&&!h.ignoreBufferedTimeRanges){let i={};for(let t=0;t<u.length;t++){let o=u.start(t),a=u.end(t);(!i.start||o<i.start)&&(i.start=o),(!i.end||a>i.end)&&(i.end=a)}return l>i.start&&l<i.end?{position:l,realPosition:l,isBufferSufficient:!0}:l<i.start?(t._log("Syncing to ".concat(i.start," instead of ").concat(l," due to lack of buffered data")),{position:i.start+.5,realPosition:l,isBufferSufficient:!1}):l>i.end?(t._log("Syncing to ".concat(i.end," instead of ").concat(l," due to lack of buffered data")),{position:i.end-.5,realPosition:l,isBufferSufficient:!1}):{position:null,isBufferSufficient:!1}}return{position:l,realPosition:l,isBufferSufficient:!0}},seekTo=i=>new Promise((o,a)=>{if(c.currentTime!==i){let l=i-c.currentTime;if(c.currentTime<i&&l<4){t._log("Fast forward to seek...");let i=!1,_handleFailed=()=>{i&&c.pause(),c.setPlaybackRate(1),I=!1,a("Stalled")},_fastForward=()=>{I=!0,setExactTimeout(()=>{u.off("stalled",_handleFailed),i&&!h.isLive&&c.pause(),c.setPlaybackRate(1),I=!1,o()},1e3*l/(B-1),20),c.setPlaybackRate(B)};u.once("stalled",_handleFailed),c.isPaused?(i=!0,c.play().then(()=>{_fastForward()}).catch(_handleFailed)):_fastForward()}else{t._log("Jump to seek...");let a=Date.now(),h=null,_resolve=()=>{clearTimeout(h),h=null,I=!1,t._log("It took the player ".concat((Date.now()-a)/1e3," seconds to seek ")),o()};I=!0,u.once("playing",_resolve),h=setTimeout(_resolve,g),c.seek(i)}}else o()}),handlePlaying=()=>{I||(t._log("Handle playing"),startSyncLoop()),I=!1,x=c.isPaused,P=!c.isPaused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),P=!c.isPaused},handleBuffering=()=>{t._log("handleBuffering"),I||(stopSyncLoop(),clientPaused().catch(()=>{}),x=c.isPaused)},roomSyncSend=i=>{if(!c)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();let o=parseInt(getCurrentSegmentPosition());return t._log("Sending my position to ".concat(i)),t._log("Current time: ".concat(o)),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(o),slave_id:t.webrtcVersion>1e3?String(i):Number(i)}})},getSyncData=()=>{t._log("Sending roomSync request");let i=t.roomId,o=parseInt(getCurrentSegmentPosition());return new Promise((a,u)=>{let c=(new Date).getTime(),h=null,l=setTimeout(()=>{t.off("data",fn,this),u("Timeout")},3e3),d={request:"sync",room:i,timestamp:(new Date).getTime(),fragment:String("0"),fragment_pos:Number(o)},fn=i=>{i.videoroom&&["sync","sync_response"].includes(i.videoroom)&&(i.sync_master_await?(t._log("Waiting for master position"),h||(h=(new Date).getTime()-c)):i.sync_master_fragment||i.sync_master_fragment_pos?(t._log("Got master position data"),h||(h=(new Date).getTime()-c),t._log("I'm master: ".concat(!!i.sync_master_self)),t._log("Ping: ".concat(h)),t._log("Master fragment: ".concat(i.sync_master_fragment)),t._log("Master fragment position: ".concat(i.sync_master_fragment_pos)),t.off("data",fn,this),clearTimeout(l),a({isMaster:!!i.sync_master_self,ping:h,masterFragmentPos:parseInt(i.sync_master_fragment_pos),masterFragmentSn:parseInt(i.sync_master_fragment)})):(clearTimeout(l),u("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(i=>{t.off("data",fn,this),clearTimeout(l),u(i)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],getHandlers:()=>({handlePause:i=>{t._log("handlePause"),u.emit("pause",i)},handlePlaying:i=>{t._log("handlePlaying"),u.emit("playing",i)},handleBuffering:i=>{t._log("handleBuffering"),u.emit("buffering",i)},handleStalled:i=>{t._log("handleBuffering"),t._log("handleStalled"),u.emit("buffering",i),u.emit("stalled",i)},handleTimeupdate:i=>{t._log("handleTimeupdate"),u.emit("timeupdate",i)}}),initialize:function(){let{playerInterface:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c=i,h={...h,...c.options||{}},t._log("Interface options passed: ",c.options||{}),t._log("All interface options: ",h),N=!1,P=!1===c.isPaused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),N&&propagateMasterFunc().catch(()=>{}),!1===c.isPaused&&u.once("timeupdate",restartSyncLoop),u.on("buffering",handleBuffering),u.on("playing",handlePlaying),u.on("pause",handlePause)},destroy:()=>{var i,o;(stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),"function"==typeof(null===(i=c)||void 0===i?void 0:i.destroy))&&(null===(o=c)||void 0===o||o.destroy());c=null,u.clear()}}};var sync_module=function(){let{room:t,emitter:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=Object(b.a)(),a=null,u=!1,c={type:"none",ignoreBufferedTimeRanges:!0,disableFastSeek:!1};const h=6e4,l=1e4,d=.5,p=3,m=5e3,g=4;let v=0,w=null,_=null,M=!1,k=!1,B=2,P=!1,x=!0,I=!1;const startSyncLoop=()=>{if(!isConnected())return void t._log("--- Sync loop will not start due to user not connected yet ---");if(w)return void t._log("--- Sync loop already running ---");t._log("--- Sync enabled ---"),M=!1;const loop=()=>{k=!0,i.emit("playerSyncing",!0),sync().finally(()=>{k=!1,i.emit("playerSyncing",!1),isConnected()&&!M?w=setTimeout(loop,_):(t._log("--- Automatic stop due to user not connected or stop flag enabled ---"),stopSyncLoop())})};loop()},stopSyncLoop=i=>{t._log("--- Sync disabled ---"),clearTimeout(w),w=null,i||(v=0),M=!0},restartSyncLoop=()=>{t._log("--- Sync restarting ---"),stopSyncLoop(),startSyncLoop()},setNextWaitTime=function(){let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0];i?(v++,v>p?(_=h,v=0):_=l):(_=h,v=0),t._log("--- Next sync will occur in "+_/1e3+" seconds ---")},sync=()=>getSyncData().then(i=>{if(i.isMaster)return a.isPaused&&a.play(),setNextWaitTime(!1),Promise.resolve();if(u)return setNextWaitTime(!1),propagateMasterFunc();{const o=Date.now(),{position:u,realPosition:c,isBufferSufficient:h}=a.getTimeDifference?a.getTimeDifference(i.masterFragmentSn,i.masterFragmentPos,i.ping):getTimeDifference(i.masterFragmentSn,i.masterFragmentPos,i.ping);return u&&Math.abs(u)<=d?(t._log("We're within max sync threshold, no need to resync now"),setNextWaitTime(!1),Promise.resolve()):null===u||isNaN(u)?(t._log("Position in not a number: ",u),setNextWaitTime(!0),Promise.reject()):seekBy(u).then(()=>{const u=Date.now()-o,{position:c,realPosition:h,isBufferSufficient:l}=a.getTimeDifference?a.getTimeDifference(i.masterFragmentSn,i.masterFragmentPos+u,i.ping):getTimeDifference(i.masterFragmentSn,i.masterFragmentPos+u,i.ping),p=Math.abs(h);t._log("Insufficient buffer: ",!l),t._log("Seek duration is ".concat(u/1e3," seconds")),t._log("Sync precision should be ".concat(p));return setNextWaitTime(p>d),Promise.resolve()}).catch(i=>(t._log("Seek failed: ",i),setNextWaitTime(!0),Promise.reject(i)))}}).catch(i=>(t._log("getSyncData() failed: ",i),setNextWaitTime(!0),Promise.reject())),handleAddLocalParticipant=()=>{u&&propagateMasterFunc(),!1===a.isPaused&&o.once("timeupdate",restartSyncLoop)},handleAddRemoteParticipant=()=>{u&&propagateMasterFunc()},isConnected=()=>t._isDataChannelOpen&&t.isConnected,parseDataEvents=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"sync_request"===t.videoroom&&roomSyncSend(t.sync_slave_id).catch(()=>{})},getCurrentPlayerPosition=()=>{let t=a.currentTime;return isNaN(t)?0:1e3*t},getTimeDifference=(i,o,u)=>{let h=a.buffered,l=(o+u/2)/1e3,d=getCurrentPlayerPosition()/1e3;if(h&&!c.ignoreBufferedTimeRanges){let i={};for(let t=0;t<h.length;t++){let o=h.start(t),a=h.end(t);(!i.start||o<i.start)&&(i.start=o),(!i.end||a>i.end)&&(i.end=a)}return l>i.start&&l<i.end?{position:l-d,realPosition:l-d,isBufferSufficient:!0}:l<i.start?(t._log("Syncing to ".concat(i.start," instead of ").concat(l," due to lack of buffered data")),{position:i.start+.5-d,realPosition:l-d,isBufferSufficient:!1}):l>i.end?(t._log("Syncing to ".concat(i.end," instead of ").concat(l," due to lack of buffered data")),{position:i.end-.5-d,realPosition:l-d,isBufferSufficient:!1}):{position:null,isBufferSufficient:!1}}return{position:l-d,realPosition:l-d,isBufferSufficient:!0}},seekBy=i=>new Promise((u,h)=>{if(a.currentTime!==i)if(i>0&&i<g&&!c.disableFastSeek){t._log("Fast forward to seek...");let c=!1,_handleFailed=()=>{c&&a.pause(),a.setPlaybackRate(1),I=!1,h("Stalled")},_fastForward=()=>{I=!0,setExactTimeout(()=>{o.off("stalled",_handleFailed),c&&a.isVod&&a.pause(),a.setPlaybackRate(1),I=!1,u()},1e3*i/(B-1),20),a.setPlaybackRate(B)};o.once("stalled",_handleFailed),a.isPaused?(c=!0,a.play().then(()=>{_fastForward()}).catch(_handleFailed)):_fastForward()}else{t._log("Jump to seek...");let c=Date.now(),h=null,_resolve=()=>{clearTimeout(h),h=null,I=!1,t._log("It took the player ".concat((Date.now()-c)/1e3," seconds to seek ")),u()};I=!0,o.once("playing",_resolve),h=setTimeout(_resolve,m),a.seek(a.currentTime+i)}else u()}),handlePlaying=()=>{I||(t._log("Handle playing"),startSyncLoop()),I=!1,x=a.isPaused,P=!a.isPaused},handlePause=()=>{stopSyncLoop(),clientPaused().catch(()=>{}),P=!a.isPaused},handleBuffering=()=>{t._log("handleBuffering"),I||(stopSyncLoop(!0),clientPaused().catch(()=>{}),x=a.isPaused)},roomSyncSend=i=>{var o;if(!a)return t._log("I've been asked for position even if we don't have player attached.\n Does it mean I'm the master?"),Promise.resolve();var u=(null===(o=a)||void 0===o?void 0:o.currentFragment)||{fragment:String("0"),fragment_pos:Number(parseInt(getCurrentPlayerPosition()))};return t._log("Sending my position to ".concat(i)),t._log("Current time: ".concat(u.fragment," # ").concat(u.fragment_pos)),t.sendMessage(t.handleId,{body:{request:"sync_response",room:t.roomId,timestamp:(new Date).getTime(),slave_id:t.webrtcVersion>1e3?String(i):Number(i),...u}})},getSyncData=()=>{var i;t._log("Sending roomSync request");let o=t.roomId;var u=(null===(i=a)||void 0===i?void 0:i.currentFragment)||{fragment:String("0"),fragment_pos:Number(parseInt(getCurrentPlayerPosition()))};return new Promise((i,a)=>{let c=(new Date).getTime(),h=null,l=setTimeout(()=>{t.off("data",fn,this),a("Timeout")},3e3),d={request:"sync",room:o,timestamp:(new Date).getTime(),...u},fn=o=>{o.videoroom&&["sync","sync_response"].includes(o.videoroom)&&(o.sync_master_await?(t._log("Waiting for master position"),h||(h=(new Date).getTime()-c)):o.sync_master_fragment||o.sync_master_fragment_pos?(t._log("Got master position data"),h||(h=(new Date).getTime()-c),t._log("I'm master: ".concat(!!o.sync_master_self)),t._log("Ping: ".concat(h)),t._log("Master fragment: ".concat(o.sync_master_fragment)),t._log("Master fragment position: ".concat(o.sync_master_fragment_pos)),t.off("data",fn,this),clearTimeout(l),i({isMaster:!!o.sync_master_self,ping:h,masterFragmentPos:parseInt(o.sync_master_fragment_pos),masterFragmentSn:parseInt(o.sync_master_fragment)})):(clearTimeout(l),a("Master lost connection")))};t.on("data",fn,this),t.sendMessage(t.handleId,{body:d}).then(fn).catch(i=>{t.off("data",fn,this),clearTimeout(l),a(i)})})},clientPaused=()=>(t._log("Sending client paused"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_paused",room:t.roomId,timestamp:(new Date).getTime(),fragment:"0",fragment_pos:0}}):Promise.resolve()),propagateMasterFunc=()=>(t._log("Propagating master"),isConnected()?t.sendMessage(t.handleId,{body:{request:"sync_source_set",room:t.roomId,timestamp:(new Date).getTime(),wt_channel_id:"",fragment:"0",fragment_pos:0}}):Promise.resolve());return{__events:["playerSyncing"],initialize:function(){let{playerInterface:i,propagateMaster:h=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};a=i,c={...c,...a.syncSettings||{}},u=h,t._log("Interface options passed: ",a.syncSettings||{}),t._log("All interface options: ",c),"none"!==c.type?"push"!==c.type?a.isVod?t._log("VOD sync is not implemented in this sync module yet"):(i.addHandlers({handlePause:i=>{t._log("handlePause"),o.emit("pause",i)},handlePlaying:i=>{t._log("handlePlaying"),o.emit("playing",i)},handleBuffering:i=>{t._log("handleBuffering"),o.emit("buffering",i),o.emit("stalled",i)},handleTimeupdate:i=>{t._log("handleTimeupdate"),o.emit("timeupdate",i)}}),P=!1===a.isPaused,t.on("disconnect",stopSyncLoop),t.on("removeLocalParticipant",stopSyncLoop),t.on("addLocalParticipant",handleAddLocalParticipant),t.on("addRemoteParticipant",handleAddRemoteParticipant),t.on("data",parseDataEvents),u&&propagateMasterFunc().catch(()=>{}),!1===a.isPaused&&o.once("timeupdate",restartSyncLoop),o.on("buffering",handleBuffering),o.on("playing",handlePlaying),o.on("pause",handlePause)):t._log("Push sync is not implemented in this sync module yet"):t._log("Sync module has been disabled via type:none")},destroy:()=>{stopSyncLoop(),t.off("disconnect",stopSyncLoop),t.off("removeLocalParticipant",stopSyncLoop),t.off("addLocalParticipant",handleAddLocalParticipant),t.off("addRemoteParticipant",handleAddRemoteParticipant),t.off("data",parseDataEvents),a=null,o.clear()}}};var room_session=function(t,i,o){let{roomId:a,pinHash:u,role:c}=t,h=a,l=["changePlayerSource","chatMessage","userUpdate","reconnecting","connecting","remoteMuted","scaling"];const addEvents=t=>{l=[...l,...t]},d=Object(b.a)();let p,m=null,g=null;return i.on("addLocalParticipant",()=>{clearTimeout(m),m=setTimeout(()=>{p.__requestMuteStatus()},2e3)}),i.on("localMuted",t=>{let{type:i,value:o}=t;p.sendSystemMessage("remote_muted",{type:i,value:o})}),i.on("data",t=>{p.__parseDataEvents(t)}),p={syncModule:null,playerInterface:null,get userId(){return i.userId},get roomId(){return a},get sessionId(){return i.sessionId},get constructId(){return i.constructId},destroy:function(){return clearTimeout(m),this.detachPlayer(),i.destroy().finally(()=>(this.$clear(),!0))},iceRestart:function(){return i._iceRestart(i.handleId)},connect:function(){var t;let{reactooRoomId:l=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return d.emit("connecting",!0),clearTimeout(m),g=new AbortController,o.room.__joinRoom({roomId:l||h,pinHash:u,role:c},null===(t=g)||void 0===t?void 0:t.signal).then(t=>{var o;return(null==t||null===(o=t.data)||void 0===o?void 0:o.reactooRoomId)!==a&&(a=t.data.reactooRoomId,d.emit("changeRoomId",a)),i.setRoomType(t.data.roomType),i.connect(t.data.roomId,t.data.pin,t.data.href,t.data.iceServers,t.data.accessToken,t.data.display,t.data.userId,t.data.webrtcVersion,t.data.bitrate?parseInt(t.data.bitrate):0,t.data.recordingFilename)}).finally(()=>{d.emit("connecting",!1)})},disconnect:function(t){var o,a;return clearTimeout(m),null===(o=g)||void 0===o||null===(a=o.abort)||void 0===a||a.call(o),i.disconnect(t)},restart:function(){var t;let{isObserver:o=!1,reactooRoomId:a=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};d.emit("reconnecting",!0),i.isRestarting=!0;let u=i.isPublished,c=i._getHandle(i.handleId),h=null;return null!=c&&null!==(t=c.webrtcStuff)&&void 0!==t&&t.stream&&u&&(h=c.webrtcStuff.stream),this.disconnect().then(()=>wt_utils_wait(1e3)).then(()=>this.connect({reactooRoomId:a})).then(()=>o?this.publishLocal(null):h?this.publishLocal(h):Promise.resolve()).then(()=>(i.isRestarting=!1,d.emit("reconnecting",!1),1)).catch(t=>(i.isRestarting=!1,d.emit("reconnecting",!1),d.emit("error",{type:"error",id:26,message:"reconnecting failed",data:t}),Promise.reject(0)))},getStats:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return i._getStats(t)},getRoomParticipants:function(){return i._participants},__parseDataEvents:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("message"===t.videoroom)if("pending_shutdown"===t.action||"shutting_down"===t.action)d.emit("scaling"),this.restart();else if("force_restart"===t.action)this.restart();else if("user_update_displayname"===t.action||"user_update_avatar"===t.action||"user_update_customattributes"===t.action||"user_update_privateattributes"===t.action)d.emit("userUpdate",t.text);else if("bitrate_changed"===t.action)this.setBitrateCap(t.text);else if("chat_message"===t.user_action)d.emit("chatMessage",t);else if("remote_muted"===t.user_action){var o,a;var u,c;if((null===(o=decodeJanusDisplay(t.from))||void 0===o?void 0:o.userId)!==(null===(a=decodeJanusDisplay(i.userId))||void 0===a?void 0:a.userId))d.emit("remoteMuted",{role:null===(u=decodeJanusDisplay(t.from))||void 0===u?void 0:u.role,userId:null===(c=decodeJanusDisplay(t.from))||void 0===c?void 0:c.userId,...t.text&&JSON.parse(t.text)})}else if("remote_muted_request"===t.user_action){var h,l;(null===(h=decodeJanusDisplay(t.from))||void 0===h?void 0:h.userId)!==(null===(l=decodeJanusDisplay(i.userId))||void 0===l?void 0:l.userId)&&this.__sendMuteStatus()}},renderPlayer:function(t,a,u){try{return this.syncModule=sync_universal({room:i,wt:o,roomSession:this,emitter:d}),this.playerInterface=o.__privates.playerFactory(t,a,this.syncModule.getHandlers(),{roomId:u}),this.syncModule.initialize({playerInterface:this.playerInterface}),!0}catch(t){return!1}},attachPlayer:function(t,a){this.detachPlayer(),"universal"===t?(this.syncModule=sync_module({room:i,emitter:d}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(a)):"hlsjs"===t?(this.syncModule=sync_hls({room:i,wt:o,roomSession:this,emitter:d}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(a)):"hlsjs-vod"===t?(this.syncModule=sync_hls_vod({room:i,wt:o,roomSession:this,emitter:d}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(a)):"hlsnative-vod"===t?(this.syncModule=sync_native_hls_vod({room:i,wt:o,roomSession:this,emitter:d}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(a)):"hlsnative"===t?(this.syncModule=sync_native_hls({room:i,wt:o,roomSession:this,emitter:d}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(a)):"shaka-dash-vod"===t?(this.syncModule=sync_shaka_dash_vod({room:i,wt:o,roomSession:this,emitter:d}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(a)):"shaka-dash"===t?(this.syncModule=sync_shaka_dash({room:i,wt:o,roomSession:this,emitter:d}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(a)):"dashjs"===t?(this.syncModule=sync_dash({room:i,wt:o,roomSession:this,emitter:d}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(a)):"dashjs-vod"===t?(this.syncModule=sync_dash_vod({room:i,wt:o,roomSession:this,emitter:d}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(a)):"doris"===t?(this.syncModule=sync_doris({room:i,wt:o,roomSession:this,emitter:d}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(a)):"dazn-dash"===t?(this.syncModule=sync_dazn_dash({room:i,wt:o,roomSession:this,emitter:d}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(a)):"disabled"===t?(this.syncModule=sync_disabled({room:i,wt:o,roomSession:this,emitter:d}),this.syncModule.__events&&addEvents(this.syncModule.__events),this.syncModule.initialize(a)):i._log("Synchronisation type not recognised")},detachPlayer:function(){var t;this.syncModule&&(this.playerInterface=null,this.syncModule.destroy(),this.syncModule.__events&&(t=this.syncModule.__events,l=l.filter(i=>-1===t.indexOf(i))),this.syncModule=null)},publishLocal:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,{keepAudio:o=!1,keepVideo:a=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i.publishLocal(t,{keepAudio:o,keepVideo:a})},unpublishLocal:()=>i.unpublishLocal(),toggleAudio:t=>i.toggleAudio(t),toggleVideo:()=>i.toggleVideo(),setBitrateCap:t=>{if("host"!==c)return i.sendMessage(i.handleId,{body:{request:"configure",bitrate:parseInt(t)}}).catch(()=>null)},sendSystemMessage:function(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments.length>2?arguments[2]:void 0,u=arguments.length>3?arguments[3]:void 0;return i.sendMessage(i.handleId,{body:{action:t,request:"message",room:i.roomId,timestamp:(new Date).getTime(),text:JSON.stringify(o),...a&&Array.isArray(a)?{tos:a}:{to:a},...u&&{set_master:u}}})},sendChatMessage:(t,o)=>i.sendMessage(i.handleId,{body:{action:"chat_message",request:"message",room:i.roomId,timestamp:(new Date).getTime(),text:t,...o&&Array.isArray(o)?{tos:o}:{to:o}}}),__requestMuteStatus:function(){this.sendSystemMessage("remote_muted_request")},__sendMuteStatus:function(){this.sendSystemMessage("remote_muted",{type:"video",value:i.isVideoMuted}),this.sendSystemMessage("remote_muted",{type:"audio",value:i.isAudioMuted})},$on:(t,o,a)=>{d.on(t,o,a||this),i.on(t,o,a||this)},$off:(t,o,a)=>{d.on(t,o,a||this),i.on(t,o,a||this)},$clear:function(){i.clear(),d.clear()}}};var streaming_session=function(){let{roomId:t,pinHash:i,streamId:o,href:a,iceServers:u,accessToken:c}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},h=arguments.length>1?arguments[1]:void 0,l=arguments.length>2?arguments[2]:void 0;return{destroy:function(){return l.room.destroySession(h.constructId).finally(()=>{this.$clear()})},connect:function(){return t?Promise.all([l.room.getRoomById(t,i),l.user.getUserSelf()]).then(t=>{let[i,o]=t;return h.startStream(i.data.wtChannel.streamId,i.data.wtChannel.href,i.data.wtChannel.iceServers,i.data.wtChannel.accessToken,o.data._id)}):a?l.user.getUserSelf().then(t=>h.startStream(o,a,u,c,t.data._id)):Promise.reject("Bad Input")},disconnect:function(){return h.stopStream()},$on:(t,i,o)=>h.on(t,i,o||this),$off:(t,i,o)=>h.off(t,i,o||this),$clear:function(){h.clear()}}};var models_room=function(){var t=this;let i=[];return(()=>{window.addEventListener("pagehide",t=>{t.persisted||this.room.destroySessions()}),window.addEventListener("beforeunload",()=>{this.room.destroySessions()})})(),{integration:function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(o=>o.apis.system.integration({type:t.__instanceType},{requestBody:{...i},requestInterceptor:t=>(t.headers||(t.headers={}),t.headers.Authorization="Bearer "+localStorage.getItem("rwt_idToken"),t)}))},getAnalytics:function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(o=>o.apis.system.getAnalytics({instanceType:t.__instanceType,...i}))},sendChatMessage:t=>{let{roomId:i,message:o,options:a,senderUserId:u}=t;return this.__privates.auth.__client.then(t=>t.apis.wt.sendRoomMessage({},{requestBody:{roomId:i,message:o,options:a,senderUserId:u}}))},createRoom:function(){let{title:i,description:o,isPublic:a,isRouter:u,isStudioLayout:c,wtChannelId:h,isHd:l,disableSync:d,reduceRoomControls:p,hasStudioChat:m,maxParticipants:g,customAttributes:v,chatRoomId:b,linkedRoomId:w,type:_,dotAttribute:M}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},k=M?Array.isArray(M)?M.reduce((t,i)=>(t[i.name]=i.value)&&t||t,{}):{[M.name]:M.value}:{};return t.__privates.auth.__client.then(M=>M.apis.wt.createRoom({},{requestBody:{title:i,description:o,isRouter:u,isPublic:a,isStudioLayout:c,wtChannelId:h,isHd:l,disableSync:d,reduceRoomControls:p,chatRoomId:b,linkedRoomId:w,hasStudioChat:m,maxParticipants:g,type:_,customAttributes:v,...k,instanceType:t.__instanceType}}))},updateRoom:function(){let{roomId:i,title:o,description:a,isPublic:u,isRouter:c,recordings:h,slug:l,password:d,maxParticipants:p,setInstanceType:m=!1,wtChannelId:g,isHd:v,isStudioLayout:b,hasStudioChat:w,reduceRoomControls:_,chatRoomId:M,linkedRoomId:k,type:B,disableSync:P,defaultRegion:x,customAttributes:I,dotAttribute:N}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},A=N?Array.isArray(N)?N.reduce((t,i)=>(t[i.name]=i.value)&&t||t,{}):{[N.name]:N.value}:{};return t.__privates.auth.__client.then(N=>N.apis.wt.updateRoom({id:i},{requestBody:{title:o,description:a,slug:l,password:d,isPublic:u,isRouter:c,isHd:v,isStudioLayout:b,hasStudioChat:w,maxParticipants:p,reduceRoomControls:_,chatRoomId:M,linkedRoomId:k,type:B,disableSync:P,defaultRegion:x,customAttributes:I,wtChannelId:g,...A,...m&&{instanceType:!0===m?t.__instanceType:m},...h&&{recordings:h}}}))},deleteRoom:t=>this.__privates.auth.__client.then(i=>i.apis.wt.deleteRoom({id:t})),leaveRoom:t=>this.__privates.auth.__client.then(i=>i.apis.wt.leave({roomId:t})),updateLayout:t=>{let{roomId:i,operation:o,name:a,attributeName:u,value:c,target:h}=t;return this.__privates.auth.__client.then(t=>t.apis.wt.updateLayout({},{requestBody:{roomId:i,operation:o,name:a,attributeName:u,value:c,target:h}}))},getInviteUrl:(t,i,o)=>this.__privates.auth.__client.then(a=>a.apis.wt.invite({},{requestBody:{roomId:t,domain:i||location.host,url:o||location.href}})),getRoomChatList:function(){let{roomId:i,type:o="normal",size:a=50,startKey:u=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c={roomId:i,type:o,size:a,...u&&{startKey:u}};return t.__privates.auth.__client.then(t=>t.apis.wt.getRoomChatList(c))},getRoomsList:function(){let{type:i="participant",activeOnly:o=null,instanceType:a=t.__instanceType,size:u=20,startKey:c=null,includeWtEventModels:h=!1,demo:l=!1,viewType:d="list",wtChannelId:p}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},m={type:i,instanceType:a,size:u,includeWtEventModels:h,demo:l,viewType:d,...p&&{wtChannelId:p},...o&&{activeOnly:o},...c&&{startKey:c}};return t.__privates.auth.__client.then(t=>t.apis.wt.getRoomList(m))},setUser:t=>{let{messageId:i,userId:o,roomId:a,flag:u,timestamp:c,option:h}=t;return this.__privates.auth.__client.then(t=>t.apis.wt.setUser({messageId:i,userId:o,roomId:a,flag:u,timestamp:c,option:h}))},getRoomById:function(i){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,u=arguments.length>3&&void 0!==arguments[3]&&arguments[3],c=arguments.length>4?arguments[4]:void 0;return t.__privates.auth.__client.then(t=>t.apis.wt.getRoom({id:i,pinHash:o,public:a,demo:u},{...c?{requestInterceptor:t=>(t.signal=c,t)}:{}}))},getRoomBySlug:function(i){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,u=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return t.__privates.auth.__client.then(t=>t.apis.wt.getRoom({slug:i,password:o,public:a,demo:u}))},roomRecorder:function(){let{roomId:i,operation:o="get",config:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.wt.recordRoom({},{requestBody:{roomId:i,operation:o,config:a}}))},__joinRoom:function(){let{roomId:i,pinHash:o,instanceType:a=t.__instanceType,role:u="participant",customBearer:c}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},h=arguments.length>1?arguments[1]:void 0;return t.__privates.auth.__client.then(c=>c.apis.wt.join({roomId:i,pinHash:o,instanceType:a,role:u,platform:"firefox"===t.browser?"web-firefox":"web"},{...h?{requestInterceptor:t=>(t.signal=h,t)}:{}}))},isSafariSupported:()=>this.__privates.room.safariVp8,isWebrtcSupported:()=>this.__privates.room.isWebrtcSupported,createStreamingSession:function(){let{constructId:o,roomId:a,pinHash:u,streamId:c,href:h,iceServers:l,accessToken:d}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.room.whenInitialized.then(i=>streaming_session.call(t,{roomId:a,pinHash:u,streamId:c,href:h,iceServers:l,accessToken:d},i.createSession(o,"streaming"),t)).then(o=>i.findIndex(t=>t.constructId===o.constructId)>-1?t.room.destroySession(o.constructId).then(()=>(i.push(o),o)):(i.push(o),o))},createSession:t=>{let{constructId:o,roomId:a,pinHash:u,role:c,options:h}=t;return this.__privates.room.whenInitialized.then(t=>room_session.call(this,{roomId:a,pinHash:u,role:c},t.createSession(o,"reactooroom",h),this)).then(t=>i.findIndex(i=>i.constructId===t.constructId)>-1?this.room.destroySession(t.constructId).then(()=>(i.push(t),t)):(i.push(t),t))},getSessions:()=>i,getSessionByConstructId:t=>i.find(i=>i.constructId===t)||null,getSessionBySessionId:t=>i.find(i=>i.sessionId===t)||null,getSessionByRoomId:t=>i.find(i=>i.roomId===t)||null,getSessionByUserId:t=>i.find(i=>{var o;return(null===(o=decodeJanusDisplay(i.userId))||void 0===o?void 0:o.userId)===t})||null,getSessionByStreamId:t=>i.find(i=>i.streamId===t)||null,destroySession:t=>{let o=i.findIndex(i=>i.constructId===t);return o>-1?i[o].destroy().finally(()=>(i.splice(o,1),!0)):Promise.resolve()},destroySessionBySessionId:t=>{let o=i.findIndex(i=>i.sessionId===t);return o>-1?i[o].destroy().finally(()=>(i.splice(o,1),!0)):Promise.resolve()},destroySessions:()=>{i.forEach(t=>t.destroy().catch(t=>this.log(t))),i.length=0},queue:function(){let{roomId:i,operation:o,userId:a}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.wt.queue({},{requestBody:{roomId:i,operation:o,userId:a}}))},getDefaultRegions:()=>this.__privates.auth.__client.then(t=>{var i,o,a,u,c,h;return[...(null===(i=t.spec)||void 0===i||null===(o=i.components)||void 0===o||null===(a=o.schemas)||void 0===a||null===(u=a.WtRoom)||void 0===u||null===(c=u.properties)||void 0===c||null===(h=c.defaultRegion)||void 0===h?void 0:h.enum)||[""]]})}},J=o(327);var models_user=function(){var t=this;return{updateUserSelf:function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.user.updateMyself({...i.lastRoomId&&{lastRoomId:i.lastRoomId}},{requestBody:{...i}}))},updateUser:function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.user.updateUser({...i},{requestBody:{...i}}))},uploadAvatar:(t,i)=>{let o=generateUUID();return this.__privates.auth.__client.then(t=>Promise.all([t,t.apis.user.initiateMyAvatarUpload({id:o})])).then(i=>{let[o,a]=i;return Promise.all([o,o.http({url:a.data.signedUrl,method:a.data.httpMethod,headers:{"Content-Type":t.type},body:t})])}).then(t=>{let[a,u]=t;return a.apis.user.publishMyAvatar({id:o,lastRoomId:i})})},uploadReaction:t=>{let i=generateUUID();return this.__privates.auth.__client.then(o=>Promise.all([o,o.apis.reaction.initiateReactionUpload({id:i,segmentCount:t.length||0})])).then(i=>{let[o,a]=i;return Promise.all([o,...a.data.signedUrlSegments.map((i,u)=>o.http({url:i,method:a.data.httpMethod,headers:{"Content-Type":t[u].type},body:t[u]}))])}).then(t=>{let[o]=t;return o.apis.reaction.processReaction({id:i,type:"concat"})}).then(t=>t.data.key)},uploadVideo:function(i,o){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u=generateUUID();return t.__privates.auth.__client.then(t=>Promise.all([t,t.apis.video.initiateVideoUpload({id:u,segmentCount:o.length||0})])).then(t=>{let[i,a]=t;return Promise.all([i,a.data.signedUrlSegments.reduce((t,u,c)=>t.then(()=>i.http({url:u,method:a.data.httpMethod,headers:{"Content-Type":o[c].type},body:o[c]})),Promise.resolve())])}).then(t=>{let[o]=t;return o.apis.video.publishVideo({_id:u,roomId:i},{requestBody:{_id:u,roomId:i,privateAttributes:a}})})},getReactionById:t=>this.__privates.auth.__client.then(i=>i.apis.reaction.getReactionById({id:t})),getReactions:function(){let{userId:i,roomId:o,type:a,size:u,startKey:c,includeUserModels:h=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},l={...o&&{roomId:o},...i&&{userId:i},...u&&{size:u},...c&&{startKey:c},includeUserModels:h,type:a};return t.__privates.auth.__client.then(t=>t.apis.reaction.getReactions(l))},getVideoById:t=>this.__privates.auth.__client.then(i=>i.apis.video.getVideoById({id:t})),getVideos:function(){let{roomId:i,userId:o,type:a,size:u,startKey:c,includeUserModels:h=!1,includeRoomQueueStatus:l}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},d={...i&&{roomId:i},...o&&{userId:o},...u&&{size:u},...c&&{startKey:c},...l&&{includeRoomQueueStatus:l},includeUserModels:h,type:a};return t.__privates.auth.__client.then(t=>t.apis.video.getVideos(d))},getUserSelf:()=>this.__privates.auth.__client.then(t=>t.apis.user.getUserMyself()),getUserById:t=>this.__privates.auth.__client.then(i=>i.apis.user.getUserById({id:t})),getUsersByIds:function(){let{ids:i=[],size:o=null,startKey:a=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u={type:"ids",...o&&{size:o},...i&&{ids:i.join(",")},...a&&{startKey:a}};return t.__privates.auth.__client.then(t=>t.apis.user.getUsers(u))},getUsers:function(){let{type:i,userId:o,roomId:a,size:u=20,startKey:c=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},h={type:i,size:u,...a&&{roomId:a},...o&&{userId:o},...c&&{startKey:c}};return t.__privates.auth.__client.then(t=>t.apis.user.getUsers(h))},track:function(){let{eventType:i="ERROR",message:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.wt.track({},{requestBody:{eventType:i,appType:"web",deviceType:"desktop".concat(navigator.maxTouchPoints?"/touch":""),os:navigator.platform,browser:navigator.userAgent,domain:location.host,url:location.href,message:Object(J.a)(o)}}))},getTranslation:function(){let{namespace:i="wt"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.system.getTranslation({namespace:i}))},getConfig:function(){let{instanceType:i=t.__instanceType,domain:o=location.hostname}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.system.getConfig({instanceType:i,domain:o}))},getIntegrationPublic:function(i){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.__privates.auth.__client.then(t=>t.apis.system.integrationPublic({type:i},{requestBody:{...o}}))},updateConfig:function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(o=>o.apis.wt.updateConfig({id:i.instanceType||t.__instanceType},{requestBody:{...i}}))},admin:function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(o=>o.apis.wt.admin({},{requestBody:{instanceType:t.__instanceType,...i}}))},analytics:function(){let{action:i,startKey:o=null,limit:a=20}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u={action:i,limit:a,...o&&{startKey:o}};return t.__privates.auth.__client.then(i=>i.apis.wt.analytics({},{requestBody:{instanceType:t.__instanceType,...u}}))}}};var models_asset=function(){var t=this;return{getAssetList:t=>{let{type:i="instanceType",instanceType:o,size:a=20,startKey:u=null,roomId:c}=t,h={...o&&{instanceType:!0===o?this.__instanceType:o},type:i,size:a,...c&&{roomId:c},...u&&{startKey:u}};return this.__privates.auth.__client.then(t=>t.apis.asset.getAssetList(h))},updateAsset:function(){let{id:i,assetType:o,title:a,roomIds:u}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.asset.updateAsset({id:i},{requestBody:{assetType:o,title:a,roomIds:u}}))},deleteAsset:t=>this.__privates.auth.__client.then(i=>i.apis.asset.deleteAsset({id:t})),uploadAsset:(t,i)=>{let o=generateUUID();return this.__privates.auth.__client.then(t=>Promise.all([t,t.apis.asset.initiateAssetUpload({id:o})])).then(i=>{let[o,a]=i;return Promise.all([o,o.http({url:a.data.signedUrl,method:a.data.httpMethod,headers:{"Content-Type":t.type},body:t}),a.data.id])}).then(o=>{let[a,u,c]=o;return a.apis.asset.publishAsset({id:c},{requestBody:{title:t.name,...i?{roomIds:i}:{}}})})},downloadAsset:function(i){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.__privates.auth.__client.then(t=>t.http({url:i,method:"GET",...o}))}}};var models_system=function(){var t=this;return{integration:function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(o=>o.apis.system.integration({type:t.__instanceType},{requestBody:{...i},requestInterceptor:t=>(t.headers||(t.headers={}),t.headers.Authorization="Bearer "+localStorage.getItem("rwt_idToken"),t)}))},getAnalytics:function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(o=>o.apis.system.getAnalytics({instanceType:t.__instanceType,...i}))},getTranslation:function(){let{namespace:i="wt"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.system.getTranslation({namespace:i}))},getConfig:function(){let{instanceType:i=t.__instanceType,domain:o=location.hostname}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(t=>t.apis.system.getConfig({instanceType:i,domain:o}))},updateConfig:function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.__privates.auth.__client.then(o=>o.apis.system.updateConfig({id:i.instanceType||t.__instanceType},{requestBody:{...i}}))},getIntegrationPublic:function(i){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.__privates.auth.__client.then(t=>t.apis.system.integrationPublic({type:i},{requestBody:{...o}}))}}},$={getUserStream(){let{hasVideo:t,isHd:i,aDeviceId:o,vDeviceId:a,lfps:u,autoGainControl:c=!1,muteAudio:h=!1,muteVideo:l=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},d={audio:{...o&&{deviceId:{exact:o}},autoGainControl:c,echoCancellation:!0,noiseSuppression:!0,channelCount:1},video:{...a&&{deviceId:{exact:a}},facingMode:{ideal:"user"},...u?{frameRate:{ideal:10,max:30}}:{frameRate:{ideal:24,max:30}},width:{ideal:i?1280:320},height:{ideal:i?720:240}}},p={audio:{...o&&{deviceId:{exact:o}},autoGainControl:c,echoCancellation:!0,noiseSuppression:!0,channelCount:1}};return navigator.mediaDevices.getUserMedia(t?d:p).then(t=>(h&&t.getAudioTracks().forEach(t=>t.enabled=!1),l&&t.getVideoTracks().forEach(t=>t.enabled=!1),t))}};var models_iot=function(){var t=this;let i=[],o=null;return{__promise:null,__reconnect:t=>{this.__privates.iot.log("MQTT Error:",t,"Is event error: ".concat(t instanceof Event)),t instanceof Event&&"error"===t.type&&(this.__privates.iot.log("SDK MQTT Reconnection attempt"),clearTimeout(o),o=setTimeout(()=>{this.iot.iotLogin(!0,!0).catch(t=>this.__privates.iot.log("MQTT Connection Error:",t))},1e3))},__updateCredentials:()=>{this.iot.getCredentials().then(t=>this.__privates.iot.updateWebSocketCredentials(t.data.credentials.accessKeyId,t.data.credentials.secretAccessKey,t.data.credentials.sessionToken,t.data.credentials.expiration))},getCredentials:()=>this.__privates.auth.__client.then(t=>t.apis.auth.iotSignIn({},{requestBody:{suggestedTopics:!0,domain:location.hostname}})),iotLogin:function(){let o=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t.iot.$off("error",t.iot.__reconnect,t),t.iot.__promise=new Promise((i,o)=>{t.iot.getCredentials().then(i=>Promise.all([i.data.suggestedTopics,t.__privates.iot.connect(i.data.endpoint,i.data.clientId,i.data.region,i.data.credentials.accessKeyId,i.data.credentials.secretAccessKey,i.data.credentials.sessionToken,i.data.credentials.expiration,a)])).then(i).catch(o)});let u=[...i];return i.length=0,t.iot.__promise.then(i=>{let[a,c]=i;return o?Promise.all([...a,...u].map(i=>t.iot.subscribe(i))).then(()=>c):Promise.resolve(c)}).then(i=>(t.iot.$on("error",t.iot.__reconnect,t),t.iot.$on("updateCredentials",t.iot.__updateCredentials,t),i)),t.iot.__promise},iotLogout:function(){let o=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return t.iot.$off("error",t.iot.__reconnect,t),t.iot.$off("updateCredentials",t.iot.__updateCredentials,t),o||(i.length=0),t.__privates.iot.disconnect().then(()=>(t.iot.__promise=null,!0))},isConnected:()=>this.__privates.iot.isConnected(),subscribe:t=>{if(-1===i.indexOf(t))return i.push(t),this.iot.__promise?this.iot.__promise.then(()=>this.__privates.iot.subscribe(t)):Promise.resolve("not_connected")},unsubscribe:t=>{let o=i.indexOf(t);return o>-1&&i.splice(o,1),this.iot.__promise?this.iot.__promise.then(()=>this.__privates.iot.unsubscribe(t)):Promise.resolve("not_connected")},send:(t,i)=>this.iot.__promise.then(()=>this.__privates.iot.send(t,i)),$once:(t,i,o)=>this.__privates.iot.once(t,i,o||this),$on:(t,i,o)=>this.__privates.iot.on(t,i,o||this),$off:(t,i,o)=>this.__privates.iot.off(t,i,o||this),$clear:()=>this.__privates.iot.clear()}};function WatchTogether(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0,o=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,u=arguments.length>4?arguments[4]:void 0;this.username=null,this.userId=null,this.__instanceType=i,this.__debug=o,this.__privates={playerFactory:a,providerAuth:u,room:t.room,auth:t.auth,iot:t.iot},this.setInstanceType=t=>this.__instanceType=t,this.isReady=t.room.whenInitialized,this.browser=t.room.browser,this.browserDetails=t.room.browserDetails,this.auth={...models_auth.call(this)},this.user={...models_user.call(this)},this.room={...models_room.call(this)},this.asset={...models_asset.call(this)},this.system={...models_system.call(this)},this.iot={...models_iot.call(this)},this.utils=$}i.default=function(){let{debug:t=!0,language:i="en-GB",storagePrefix:o="reactoo_",apiUrl:a=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=new H(t),c=new W.a(t,i,o,a),h=new G(t);return function(){let{instanceType:i="reactooDemo",playerFactory:o=null,providerAuth:a=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new WatchTogether({room:u,auth:c,iot:h},i,t,o,a)}}}]).default}));
|