-
Notifications
You must be signed in to change notification settings - Fork 0
/
592.bundle.js
2 lines (2 loc) · 317 KB
/
592.bundle.js
1
2
/*! For license information please see 592.bundle.js.LICENSE.txt */
(self.webpackChunk_bbc_audio_orchestration_template=self.webpackChunk_bbc_audio_orchestration_template||[]).push([[592],{7592:function(e){self,e.exports=function(){var e={470:function(e,t,r){var n,i,o,s;function a(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||c(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){if(e){if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function p(e,t,r){return t&&f(e.prototype,t),r&&f(e,r),e}function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}function d(e,t){return d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},d(e,t)}function m(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v(e);if(t){var i=v(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return g(this,r)}}function g(e,t){if(t&&("object"===b(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}function b(e){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(e)}e=r.nmd(e),self,s=function(){return function(){var e={5766:function(e,t){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,o=c(e),s=o[0],a=o[1],u=new i(function(e,t,r){return 3*(t+r)/4-r}(0,s,a)),l=0,f=a>0?s-4:s;for(r=0;r<f;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;return 2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[l++]=255&t),1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],s=16383,a=0,c=n-i;a<c;a+=s)o.push(u(e,a,a+s>c?c:a+s));return 1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),o.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=o.length;s<a;++s)r[s]=o[s],n[o.charCodeAt(s)]=s;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,n){for(var i,o,s=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[(o=i)>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},8834:function(e,t,r){"use strict";var n=r(5766),i=r(2333),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;var s=2147483647;function a(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|_(e,t),n=a(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(te(e,Uint8Array)){var t=new Uint8Array(e);return v(t.buffer,t.byteOffset,t.byteLength)}return g(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+b(e));if(te(e,ArrayBuffer)||e&&te(e.buffer,ArrayBuffer))return v(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(te(e,SharedArrayBuffer)||e&&te(e.buffer,SharedArrayBuffer)))return v(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);var i=function(e){if(c.isBuffer(e)){var t=0|w(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||re(e.length)?a(0):g(e):"Buffer"===e.type&&Array.isArray(e.data)?g(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+b(e))}function f(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return f(e),a(e<0?0:0|w(e))}function g(e){for(var t=e.length<0?0:0|w(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function v(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,c.prototype),n}function w(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function _(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||te(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+b(e));var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(e).length;default:if(i)return n?-1:Z(e).length;t=(""+t).toLowerCase(),i=!0}}function S(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return U(this,t,r);case"utf8":case"utf-8":return P(this,t,r);case"ascii":return j(this,t,r);case"latin1":case"binary":return N(this,t,r);case"base64":return O(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function E(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function k(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),re(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:T(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):T(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function T(e,t,r,n,i){var o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===c)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){for(var f=!0,p=0;p<c;p++)if(u(e,o+p)!==u(t,p)){f=!1;break}if(f)return o}return-1}function C(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o,s=t.length;for(n>s/2&&(n=s/2),o=0;o<n;++o){var a=parseInt(t.substr(2*o,2),16);if(re(a))return o;e[r+o]=a}return o}function I(e,t,r,n){return ee(Z(t,e.length-r),e,r,n)}function R(e,t,r,n){return ee(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function x(e,t,r,n){return ee(X(t),e,r,n)}function A(e,t,r,n){return ee(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function O(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function P(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o=e[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=r){var c=void 0,u=void 0,l=void 0,f=void 0;switch(a){case 1:o<128&&(s=o);break;case 2:128==(192&(c=e[i+1]))&&(f=(31&o)<<6|63&c)>127&&(s=f);break;case 3:c=e[i+1],u=e[i+2],128==(192&c)&&128==(192&u)&&(f=(15&o)<<12|(63&c)<<6|63&u)>2047&&(f<55296||f>57343)&&(s=f);break;case 4:c=e[i+1],u=e[i+2],l=e[i+3],128==(192&c)&&128==(192&u)&&128==(192&l)&&(f=(15&o)<<18|(63&c)<<12|(63&u)<<6|63&l)>65535&&f<1114112&&(s=f)}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return function(e){var t=e.length;if(t<=L)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=L));return r}(n)}t.kMaxLength=s,c.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(e,t,r){return function(e,t,r){return f(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},c.allocUnsafe=function(e){return d(e)},c.allocUnsafeSlow=function(e){return d(e)},c.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==c.prototype},c.compare=function(e,t){if(te(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),te(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},c.isEncoding=function(e){switch(String(e).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}},c.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=c.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(te(o,Uint8Array))i+o.length>n.length?(c.isBuffer(o)||(o=c.from(o)),o.copy(n,i)):Uint8Array.prototype.set.call(n,o,i);else{if(!c.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i)}i+=o.length}return n},c.byteLength=_,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)E(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)E(this,t,t+3),E(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)E(this,t,t+7),E(this,t+1,t+6),E(this,t+2,t+5),E(this,t+3,t+4);return this},c.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?P(this,0,e):S.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},o&&(c.prototype[o]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(te(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+b(e));if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(n,i),l=e.slice(t,r),f=0;f<a;++f)if(u[f]!==l[f]){o=u[f],s=l[f];break}return o<s?-1:s<o?1:0},c.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},c.prototype.indexOf=function(e,t,r){return k(this,e,t,r,!0)},c.prototype.lastIndexOf=function(e,t,r){return k(this,e,t,r,!1)},c.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return C(this,e,t,r);case"utf8":case"utf-8":return I(this,e,t,r);case"ascii":case"latin1":case"binary":return R(this,e,t,r);case"base64":return x(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var L=4096;function j(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function N(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function U(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=ne[e[o]];return i}function M(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function B(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function q(e,t,r,n,i,o){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function F(e,t,r,n,i){G(t,n,i,e,r,7);var o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;var s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,r}function D(e,t,r,n,i){G(t,n,i,e,r,7);var o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;var s=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=s,s>>=8,e[r+2]=s,s>>=8,e[r+1]=s,s>>=8,e[r]=s,r+8}function H(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function W(e,t,r,n,o){return t=+t,r>>>=0,o||H(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function V(e,t,r,n,o){return t=+t,r>>>=0,o||H(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,c.prototype),n},c.prototype.readUintLE=c.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},c.prototype.readUintBE=c.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=ie((function(e){Y(e>>>=0,"offset");var t=this[e],r=this[e+7];void 0!==t&&void 0!==r||J(e,this.length-8);var n=t+256*this[++e]+65536*this[++e]+this[++e]*Math.pow(2,24),i=this[++e]+256*this[++e]+65536*this[++e]+r*Math.pow(2,24);return BigInt(n)+(BigInt(i)<<BigInt(32))})),c.prototype.readBigUInt64BE=ie((function(e){Y(e>>>=0,"offset");var t=this[e],r=this[e+7];void 0!==t&&void 0!==r||J(e,this.length-8);var n=t*Math.pow(2,24)+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*Math.pow(2,24)+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),c.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},c.prototype.readInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||B(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||B(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=ie((function(e){Y(e>>>=0,"offset");var t=this[e],r=this[e+7];void 0!==t&&void 0!==r||J(e,this.length-8);var n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*Math.pow(2,24))})),c.prototype.readBigInt64BE=ie((function(e){Y(e>>>=0,"offset");var t=this[e],r=this[e+7];void 0!==t&&void 0!==r||J(e,this.length-8);var n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*Math.pow(2,24)+65536*this[++e]+256*this[++e]+r)})),c.prototype.readFloatLE=function(e,t){return e>>>=0,t||B(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||B(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||B(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||B(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||q(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||q(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||q(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||q(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||q(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||q(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||q(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=ie((function(e){return F(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=ie((function(e){return D(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);q(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},c.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);q(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||q(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||q(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||q(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||q(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||q(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=ie((function(e){return F(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=ie((function(e){return D(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(e,t,r){return W(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return W(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return V(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return V(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},c.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!c.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=c.isBuffer(e)?e:c.from(e,n),a=s.length;if(0===a)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=s[o%a]}return this};var z={};function Q(e,t,r){z[e]=function(r){h(i,r);var n=m(i);function i(){var r;return l(this,i),r=n.call(this),Object.defineProperty(y(r),"message",{value:t.apply(y(r),arguments),writable:!0,configurable:!0}),r.name="".concat(r.name," [").concat(e,"]"),r.stack,delete r.name,r}return p(i,[{key:"code",get:function(){return e},set:function(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}},{key:"toString",value:function(){return"".concat(this.name," [").concat(e,"]: ").concat(this.message)}}]),i}(r)}function K(e){for(var t="",r=e.length,n="-"===e[0]?1:0;r>=n+4;r-=3)t="_".concat(e.slice(r-3,r)).concat(t);return"".concat(e.slice(0,r)).concat(t)}function G(e,t,r,n,i,o){if(e>r||e<t){var s,a="bigint"==typeof t?"n":"";throw s=o>3?0===t||t===BigInt(0)?">= 0".concat(a," and < 2").concat(a," ** ").concat(8*(o+1)).concat(a):">= -(2".concat(a," ** ").concat(8*(o+1)-1).concat(a,") and < 2 ** ").concat(8*(o+1)-1).concat(a):">= ".concat(t).concat(a," and <= ").concat(r).concat(a),new z.ERR_OUT_OF_RANGE("value",s,e)}!function(e,t,r){Y(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||J(t,e.length-(r+1))}(n,i,o)}function Y(e,t){if("number"!=typeof e)throw new z.ERR_INVALID_ARG_TYPE(t,"number",e)}function J(e,t,r){if(Math.floor(e)!==e)throw Y(e,r),new z.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new z.ERR_BUFFER_OUT_OF_BOUNDS;throw new z.ERR_OUT_OF_RANGE(r||"offset",">= ".concat(r?1:0," and <= ").concat(t),e)}Q("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?"".concat(e," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"}),RangeError),Q("ERR_INVALID_ARG_TYPE",(function(e,t){return'The "'.concat(e,'" argument must be of type number. Received type ').concat(b(t))}),TypeError),Q("ERR_OUT_OF_RANGE",(function(e,t,r){var n='The value of "'.concat(e,'" is out of range.'),i=r;return Number.isInteger(r)&&Math.abs(r)>Math.pow(2,32)?i=K(String(r)):"bigint"==typeof r&&(i=String(r),(r>Math.pow(BigInt(2),BigInt(32))||r<-Math.pow(BigInt(2),BigInt(32)))&&(i=K(i)),i+="n"),n+" It must be ".concat(t,". Received ").concat(i)}),RangeError);var $=/[^+/0-9A-Za-z-_]/g;function Z(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function X(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace($,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ee(e,t,r,n){var i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function te(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function re(e){return e!=e}var ne=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}();function ie(e){return"undefined"==typeof BigInt?oe:e}function oe(){throw new Error("BigInt not supported")}},6244:function(e){var t;t=function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}return r.m=e,r.c=t,r.p="",r(0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){var n=r(2),i=r(6),o=r(8),s=r(9),a=r(10);e.exports={ClockBase:n,DateNowClock:i,CorrelatedClock:o,Correlation:s,OffsetClock:a}},function(e,t,r){var n=r(3),i=r(4),o=new(r(5)),s=0,a=0,c=function(){n.call(this),o.set(this,{});var e=o.get(this);this._availability=!0,this.id="clock_"+s,s+=1,e.timerHandles={},this.on("change",this._rescheduleTimers.bind(this)),e.availablePrev=this._availability};i(c,n),c.prototype.now=function(){throw"Unimplemented"},Object.defineProperty(c.prototype,"speed",{get:function(){return this.getSpeed()},set:function(e){return this.setSpeed(e)}}),Object.defineProperty(c.prototype,"tickRate",{get:function(){return this.getTickRate()},set:function(e){return this.setTickRate(e)}}),Object.defineProperty(c.prototype,"parent",{get:function(){return this.getParent()},set:function(e){return this.setParent(e)}}),Object.defineProperty(c.prototype,"availabilityFlag",{get:function(){return this.getAvailabilityFlag()},set:function(e){return this.setAvailabilityFlag(e)}}),c.prototype.getSpeed=function(){return 1},c.prototype.setSpeed=function(e){throw"Unimplemented"},c.prototype.getEffectiveSpeed=function(){for(var e=1,t=this;null!==t;)e*=t.getSpeed(),t=t.getParent();return e},c.prototype.getTickRate=function(){throw"Unimplemented"},c.prototype.setTickRate=function(e){throw"Unimplemented"},c.prototype.getNanos=function(){return 1e9*this.now()/this.getTickRate()},c.prototype.fromNanos=function(e){return e*this.getTickRate()/1e9},c.prototype.isAvailable=function(){var e=this.getParent();return this._availability&&(!e||e.isAvailable())},c.prototype.setAvailabilityFlag=function(e){this._availability=e,this.notifyAvailabilityChange()},c.prototype.notifyAvailabilityChange=function(){var e=o.get(this),t=this.isAvailable();Boolean(t)!=Boolean(e.availablePrev)&&(e.availablePrev=t,this.emit(t?"available":"unavailable",this))},c.prototype.getAvailabilityFlag=function(){return this._availability},c.prototype.calcWhen=function(e){throw"Unimplemented"},c.prototype.getRoot=function(){for(var e=this,t=e.getParent();t;)t=(e=t).getParent();return e},c.prototype.fromRootTime=function(e){var t=this.getParent();if(t){var r=t.fromRootTime(e);return this.fromParentTime(r)}return e},c.prototype.toRootTime=function(e){var t=this.getParent();if(t){var r=this.toParentTime(e);return t.toRootTime(r)}return e},c.prototype.toOtherClockTime=function(e,t){for(var r=this.getAncestry(),n=e.getAncestry(),i=!1;r.length&&n.length&&r[r.length-1]===n[n.length-1];)r.pop(),n.pop(),i=!0;if(!i)throw"No common ancestor clock.";return r.forEach((function(e){t=e.toParentTime(t)})),n.reverse(),n.forEach((function(e){t=e.fromParentTime(t)})),t},c.prototype.getAncestry=function(){for(var e=[this],t=this;t;){var r=t.getParent();r&&e.push(r),t=r}return e},c.prototype.toParentTime=function(e){throw"Unimplemented"},c.prototype.fromParentTime=function(e){throw"Unimplemented"},c.prototype.getParent=function(){throw"Unimplemented"},c.prototype.setParent=function(e){throw"Unimplemented"},c.prototype.clockDiff=function(e){if(this.getEffectiveSpeed()!==e.getEffectiveSpeed())return Number.POSITIVE_INFINITY;if(this.getTickRate()!==e.getTickRate())return Number.POSITIVE_INFINITY;var t=this.getRoot().now(),r=this.fromRootTime(t),n=e.fromRootTime(t);return Math.abs(r-n)/this.getTickRate()},c.prototype.dispersionAtTime=function(e){var t=this._errorAtTime(e),r=this.getParent();if(r){var n=this.toParentTime(e);t+=r.dispersionAtTime(n)}return t},c.prototype._errorAtTime=function(e){throw"Unimplemented"},c.prototype.getRootMaxFreqError=function(){var e=this.getRoot();if(e===this)throw"Unimplemented";return e.getRootMaxFreqError()},c.prototype.setTimeout=function(e,t){return arguments[1]=arguments[1]+this.now(),this.setAtTime.apply(this,arguments)},c.prototype.setAtTime=function(e,t){var r=o.get(this),n=this,i=n.id+":timeout-"+a++,s=n.getRoot();null===s&&(s=n);for(var c=new Array(arguments.length-2),u=2;u<arguments.length;u++)c[u-2]=arguments[u];var l=function(){delete r.timerHandles[i],e.apply(n,c)},f=n.toRootTime(t)-s.now();0!==f&&(f=0!==s.getSpeed()?f/s.getSpeed():NaN);var p,h=f*(1e3/s.getTickRate());return isNaN(h)||(p=setTimeout(l,h)),r.timerHandles[i]={realHandle:p,when:t,callback:l},i},c.prototype._rescheduleTimers=function(){var e=o.get(this),t=this.getRoot();for(var r in e.timerHandles)if(e.timerHandles.hasOwnProperty(r)){var n=e.timerHandles[r];null!==n.realHandle&&void 0!==n.realHandle&&clearTimeout(n.realHandle);var i=this.toRootTime(n.when)-t.now();0!==i&&(i=0!==t.getSpeed()?i/t.getSpeed():NaN);var s=i*(1e3/t.getTickRate());isNaN(s)?delete n.realHandle:n.realHandle=setTimeout(n.callback,Math.max(0,s))}},c.prototype.clearTimeout=function(e){var t=o.get(this),r=t.timerHandles[e];void 0!==r&&(clearTimeout(r.realHandle),delete t.timerHandles[e])},e.exports=c},function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function i(e){return"object"==b(e)&&null!==e}function o(e){return void 0===e}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,s,a,c,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}if(o(r=this._events[e]))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),r.apply(this,a)}else if(i(r))for(a=Array.prototype.slice.call(arguments,1),s=(u=r.slice()).length,c=0;c<s;c++)u[c].apply(this,a);return!0},r.prototype.addListener=function(e,t){var s;if(!n(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,n(t.listener)?t.listener:t),this._events[e]?i(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,i(this._events[e])&&!this._events[e].warned&&(s=o(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&s>0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){if(!n(t))throw TypeError("listener must be a function");var r=!1;function i(){this.removeListener(e,i),r||(r=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},r.prototype.removeListener=function(e,t){var r,o,s,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=(r=this._events[e]).length,o=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(r)){for(a=s;a-- >0;)if(r[a]===t||r[a].listener&&r[a].listener===t){o=a;break}if(o<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n(r=this._events[e]))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},function(e,t){!function(){"use strict";if("undefined"==typeof ses||!ses.ok||ses.ok()){"undefined"!=typeof ses&&(ses.weakMapPermitHostObjects=g);var t=!1;if("function"==typeof WeakMap){var r=WeakMap;if("undefined"!=typeof navigator&&/Firefox/.test(navigator.userAgent));else{var n=new r,i=Object.freeze({});if(n.set(i,1),1===n.get(i))return void(e.exports=WeakMap);t=!0}}Object.prototype.hasOwnProperty;var o=Object.getOwnPropertyNames,s=Object.defineProperty,a=Object.isExtensible,c="weakmap:",u="weakmap:ident:"+Math.random()+"___";if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues&&"function"==typeof ArrayBuffer&&"function"==typeof Uint8Array){var l=new ArrayBuffer(25),f=new Uint8Array(l);crypto.getRandomValues(f),u="weakmap:rand:"+Array.prototype.map.call(f,(function(e){return(e%36).toString(36)})).join("")+"___"}if(s(Object,"getOwnPropertyNames",{value:function(e){return o(e).filter(y)}}),"getPropertyNames"in Object){var p=Object.getPropertyNames;s(Object,"getPropertyNames",{value:function(e){return p(e).filter(y)}})}!function(){var e=Object.freeze;s(Object,"freeze",{value:function(t){return v(t),e(t)}});var t=Object.seal;s(Object,"seal",{value:function(e){return v(e),t(e)}});var r=Object.preventExtensions;s(Object,"preventExtensions",{value:function(e){return v(e),r(e)}})}();var h=!1,d=0,m=function e(){this instanceof e||w();var t=[],r=[],n=d++;return Object.create(e.prototype,{get___:{value:b((function(e,i){var o,s=v(e);return s?n in s?s[n]:i:(o=t.indexOf(e))>=0?r[o]:i}))},has___:{value:b((function(e){var r=v(e);return r?n in r:t.indexOf(e)>=0}))},set___:{value:b((function(e,i){var o,s=v(e);return s?s[n]=i:(o=t.indexOf(e))>=0?r[o]=i:(o=t.length,r[o]=i,t[o]=e),this}))},delete___:{value:b((function(e){var i,o,s=v(e);return s?n in s&&delete s[n]:!((i=t.indexOf(e))<0||(o=t.length-1,t[i]=void 0,r[i]=r[o],t[i]=t[o],t.length=o,r.length=o,0))}))}})};m.prototype=Object.create(Object.prototype,{get:{value:function(e,t){return this.get___(e,t)},writable:!0,configurable:!0},has:{value:function(e){return this.has___(e)},writable:!0,configurable:!0},set:{value:function(e,t){return this.set___(e,t)},writable:!0,configurable:!0},delete:{value:function(e){return this.delete___(e)},writable:!0,configurable:!0}}),"function"==typeof r?function(){function n(){this instanceof m||w();var e,n=new r,i=void 0,o=!1;return e=t?function(e,t){return n.set(e,t),n.has(e)||(i||(i=new m),i.set(e,t)),this}:function(e,t){if(o)try{n.set(e,t)}catch(r){i||(i=new m),i.set___(e,t)}else n.set(e,t);return this},Object.create(m.prototype,{get___:{value:b((function(e,t){return i?n.has(e)?n.get(e):i.get___(e,t):n.get(e,t)}))},has___:{value:b((function(e){return n.has(e)||!!i&&i.has___(e)}))},set___:{value:b(e)},delete___:{value:b((function(e){var t=!!n.delete(e);return i&&i.delete___(e)||t}))},permitHostObjects___:{value:b((function(e){if(e!==g)throw new Error("bogus call to permitHostObjects___");o=!0}))}})}t&&"undefined"!=typeof Proxy&&(Proxy=void 0),n.prototype=m.prototype,e.exports=n,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=m)}function g(e){e.permitHostObjects___&&e.permitHostObjects___(g)}function y(e){return!(e.substr(0,c.length)==c&&"___"===e.substr(e.length-3))}function v(e){if(e!==Object(e))throw new TypeError("Not an object: "+e);var t=e[u];if(t&&t.key===e)return t;if(a(e)){t={key:e};try{return s(e,u,{value:t,writable:!1,enumerable:!1,configurable:!1}),t}catch(e){return}}}function b(e){return e.prototype=null,Object.freeze(e)}function w(){h||"undefined"==typeof console||(h=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}}()},function(e,t,r){var n=r(4),i=r(2),o=r(7),s=new(r(5)),a=o(Date.now.bind(Date),100)/1e3,c=function(e){i.call(this),s.set(this,{});var t=s.get(this);if(e&&void 0!==e.tickRate){if(e.tickRate<=0)throw"Cannot have tickrate of zero or less";t.freq=e.tickRate}else t.freq=1e3;e&&void 0!==e.maxFreqErrorPpm?t.maxFreqErrorPpm=e.maxFreqErrorPpm:t.maxFreqErrorPpm=50,t.precision=a};n(c,i),c.prototype.now=function(){return Date.now()/1e3*s.get(this).freq},c.prototype.getTickRate=function(){return s.get(this).freq},c.prototype.calcWhen=function(e){return e/s.get(this).freq*1e3},c.prototype.toString=function(){var e=s.get(this);return"DateNowClock({tickRate:"+e.freq+", maxFreqErrorPpm:"+e.maxFreqErrorPpm+"}) ["+this.id+"]"},c.prototype.toParentTime=function(e){throw"Clock has no parent."},c.prototype.fromParentTime=function(e){throw"Clock has no parent."},c.prototype.getParent=function(){return null},c.prototype.setParent=function(e){throw"Cannot set a parent for this clock."},c.prototype.setAvailabilityFlag=function(e){if(!e)throw"Cannot change availability of this clock."},c.prototype._errorAtTime=function(e){return s.get(this).precision},c.prototype.getRootMaxFreqError=function(){return s.get(this).maxFreqErrorPpm},e.exports=c},function(e,t){e.exports=function(e,t){for(var r=[];r.length<t;){var n=e(),i=e();n<i&&r.push(i-n)}return Math.min.apply(this,r)}},function(e,t,r){var n=r(4),i=r(2),o=r(9),s=new(r(5)),a=function(e,t){i.call(this),s.set(this,{});var r=s.get(this);if(t&&void 0!==t.tickRate){if(t.tickRate<=0)throw"Cannot have tickrate of zero or less";r.freq=t.tickRate}else r.freq=1e3;t&&void 0!==t.speed?r.speed=t.speed:r.speed=1,r.parent=e,t&&void 0!==t.correlation?r.corr=new o(t.correlation):r.corr=new o(0,0,0,0),r.parentHandlers={change:function(e){this.emit("change",this)}.bind(this),available:this.notifyAvailabilityChange.bind(this),unavailable:this.notifyAvailabilityChange.bind(this)},r.parent=null,this.setParent(e)};n(a,i),a.prototype.now=function(){var e=s.get(this),t=e.corr;return null===e.parent||void 0===e.parent?NaN:t.childTime+(e.parent.now()-t.parentTime)*e.freq*e.speed/e.parent.getTickRate()},a.prototype.toString=function(){var e=s.get(this);return"CorrelatedClock("+(e.parent?e.parent.id:"<<no-parent>>")+", {tickRate:"+e.freq+", speed:"+e.speed+", correlation:"+e.corr+"}) ["+this.id+"]"},a.prototype.getSpeed=function(){return s.get(this).speed},a.prototype.setSpeed=function(e){var t=s.get(this);t.speed!=e&&(t.speed=e,this.emit("change",this))},a.prototype.getTickRate=function(){return s.get(this).freq},a.prototype.setTickRate=function(e){var t=s.get(this);t.freq!=e&&(t.freq=e,this.emit("change",this))},a.prototype.rebaseCorrelationAt=function(e){var t=s.get(this);t.corr=t.corr.butWith({parentTime:this.toParentTime(e),childTime:e,initialError:this._errorAtTime(e)})},Object.defineProperty(a.prototype,"correlation",{get:function(){return this.getCorrelation()},set:function(e){return this.setCorrelation(e)}}),a.prototype.getCorrelation=function(){return s.get(this).corr},a.prototype.setCorrelation=function(e){s.get(this).corr=new o(e),this.emit("change",this)},a.prototype.setCorrelationAndSpeed=function(e,t){var r=s.get(this);r.corr=new o(e),r.speed=t,this.emit("change",this)},a.prototype.calcWhen=function(e){return s.get(this).parent.calcWhen(this.toParentTime(e))},a.prototype.toParentTime=function(e){var t=s.get(this);return null===t.parent||void 0===t.parent?NaN:0===t.speed?e===t.corr.childTime?t.corr.parentTime:NaN:t.corr.parentTime+(e-t.corr.childTime)*t.parent.getTickRate()/t.freq/t.speed},i.prototype.fromParentTime=function(e){var t=s.get(this);return null===t.parent||void 0===t.parent?NaN:t.corr.childTime+(e-t.corr.parentTime)*t.freq*t.speed/t.parent.getTickRate()},a.prototype.getParent=function(){return s.get(this).parent},a.prototype.setParent=function(e){var t,r=s.get(this);if(r.parent!=e){if(r.parent)for(t in r.parentHandlers)r.parent.removeListener(t,r.parentHandlers[t]);if(r.parent=e,r.parent)for(t in r.parentHandlers)r.parent.on(t,r.parentHandlers[t]);this.emit("change",this)}},a.prototype.quantifySignedChange=function(e,t){var r=s.get(this);if(e=new o(e),t!=r.speed)return t>r.speed?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;var n=e.parentTime,i=e.childTime;return 0!==t?(n-this.toParentTime(i))/r.parent.getTickRate():(i-this.fromParentTime(n))/r.freq},a.prototype.quantifyChange=function(e,t){return Math.abs(this.quantifySignedChange(e,t))},a.prototype.isChangeSignificant=function(e,t,r){return this.quantifyChange(e,t)>r},a.prototype._errorAtTime=function(e){var t=s.get(this),r=this.toParentTime(e),n=Math.abs(r-t.corr.parentTime)/t.parent.getTickRate();return t.corr.initialError+n*t.corr.errorGrowthRate},e.exports=a},function(e,t,r){var n=new(r(5)),i=function(e,t,r,i){n.set(this,{});var o,s=n.get(this);Array.isArray(e)?(o=e[0],t=e[1],r=e[2],i=e[3]):"object"==b(e)?(o=e.parentTime,t=e.childTime,r=e.initialError,i=e.errorGrowthRate):o=e,s.parentTime=void 0!==o?o:0,s.childTime=void 0!==t?t:0,s.initialError=void 0!==r?r:0,s.errorGrowthRate=void 0!==i?i:0};i.prototype.butWith=function(e){var t=n.get(this);if(void 0===e)return this;var r=e.parentTime,o=e.childTime,s=e.initialError,a=e.errorGrowthRate;return void 0===r&&(r=t.parentTime),void 0===o&&(o=t.childTime),void 0===s&&(s=t.initialError),void 0===a&&(a=t.errorGrowthRate),new i(r,o,s,a)},Object.defineProperty(i.prototype,"parentTime",{get:function(){return n.get(this).parentTime},set:function(e){throw"Cannot set this property, object is immutable. Use butWith() method."}}),Object.defineProperty(i.prototype,"childTime",{get:function(){return n.get(this).childTime},set:function(e){throw"Cannot set this property, object is immutable. Use butWith() method."}}),Object.defineProperty(i.prototype,"initialError",{get:function(){return n.get(this).initialError},set:function(e){throw"Cannot set this property, object is immutable. Use butWith() method."}}),Object.defineProperty(i.prototype,"errorGrowthRate",{get:function(){return n.get(this).errorGrowthRate},set:function(e){throw"Cannot set this property, object is immutable. Use butWith() method."}}),i.prototype.equals=function(e){var t=n.get(this);return t.parentTime===e.parentTime&&t.childTime===e.childTime&&t.initialError===e.initialError&&t.errorGrowthRate===e.errorGrowthRate},i.prototype.toJSON=function(){var e=n.get(this);return JSON.stringify({parentTime:e.parentTime,childTime:e.childTime,initialError:e.initialError,errorGrowthRate:e.errorGrowthRate})},e.exports=i},function(e,t,r){var n=r(4),i=r(2),o=new(r(5)),s=function(e,t){i.call(this),o.set(this,{});var r=o.get(this);if(t&&void 0!==t.offset){if("number"!=typeof t.offset)throw"'offset' option must be a number (in milliseconds)";r.offset=t.offset}else r.offset=0;r.parent=e,r.parentHandlers={change:function(e){this.emit("change",this)}.bind(this),available:this.notifyAvailabilityChange.bind(this),unavailable:this.notifyAvailabilityChange.bind(this)},r.parent=null,this.setParent(e)};n(s,i),s.prototype.now=function(){var e=o.get(this);return e.parent.now()+e.offset*this.getEffectiveSpeed()*e.parent.tickRate/1e3},s.prototype.toString=function(){var e=o.get(this);return"OffsetClock("+(e.parent?e.parent.id:"<<no-parent>>")+", {offset:"+e.offset+"}) ["+this.id+"]"},s.prototype.getSpeed=function(){return 1},s.prototype.setSpeed=function(e){throw"Cannot change the speed of this clock."},s.prototype.getTickRate=function(){return o.get(this).parent.tickRate},s.prototype.setTickRate=function(e){throw"Cannot change the tick rate of this clock."},Object.defineProperty(s.prototype,"offset",{get:function(){return this.getOffset()},set:function(e){return this.setOffset(e)}}),s.prototype.getOffset=function(){return o.get(this).offset},s.prototype.setOffset=function(e){var t=o.get(this),r=e!=t.offset;t.offset=e,r&&this.emit("change",this)},s.prototype.calcWhen=function(e){var t=o.get(this),r=e+t.offset*this.getEffectiveSpeed()*t.parent.tickRate/1e3;return t.parent.calcWhen(this.toParentTime(r))},s.prototype.getParent=function(){return o.get(this).parent},s.prototype.setParent=function(e){var t,r=o.get(this);if(r.parent!=e){if(r.parent)for(t in r.parentHandlers)r.parent.removeListener(t,r.parentHandlers[t]);if(r.parent=e,r.parent)for(t in r.parentHandlers)r.parent.on(t,r.parentHandlers[t]);this.emit("change",this)}},s.prototype.toParentTime=function(e){return e-o.get(this).offset*this.getEffectiveSpeed()*this.tickRate/1e3},s.prototype.fromParentTime=function(e){return e+o.get(this).offset*this.getEffectiveSpeed()*this.tickRate/1e3},e.exports=s}])},e.exports=t()},1743:function(e){function t(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function n(e){return"object"==b(e)&&null!==e}function i(e){return void 0===e}e.exports=t,t.EventEmitter=t,t.prototype._events=void 0,t.prototype._maxListeners=void 0,t.defaultMaxListeners=10,t.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},t.prototype.emit=function(e){var t,o,s,a,c,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||n(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}if(i(o=this._events[e]))return!1;if(r(o))switch(arguments.length){case 1:o.call(this);break;case 2:o.call(this,arguments[1]);break;case 3:o.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),o.apply(this,a)}else if(n(o))for(a=Array.prototype.slice.call(arguments,1),s=(u=o.slice()).length,c=0;c<s;c++)u[c].apply(this,a);return!0},t.prototype.addListener=function(e,o){var s;if(!r(o))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(o.listener)?o.listener:o),this._events[e]?n(this._events[e])?this._events[e].push(o):this._events[e]=[this._events[e],o]:this._events[e]=o,n(this._events[e])&&!this._events[e].warned&&(s=i(this._maxListeners)?t.defaultMaxListeners:this._maxListeners)&&s>0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},t.prototype.removeListener=function(e,t){var i,o,s,a;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=(i=this._events[e]).length,o=-1,i===t||r(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(n(i)){for(a=s;a-- >0;)if(i[a]===t||i[a].listener&&i[a].listener===t){o=a;break}if(o<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},t.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},t.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},t.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},t.listenerCount=function(e,t){return e.listenerCount(t)}},2942:function(e,t,r){var n=r(1743),i=r(1285),o=r(4770),s=new("undefined"!=typeof window&&window.WeakMap||r(405));function a(e){n.EventEmitter.call(this),s.set(this,{});var t=s.get(this);t.cii=new o(null,null,null,null,null,null,null,null),e instanceof Object&&(t.CIIChangeCallback=e.callback),Object.defineProperty(this,"cii",{enumerable:!0,get:function(){return t.cii}})}i(a,n.EventEmitter),a.prototype.start=function(){s.get(this).started=!0},a.prototype.stop=function(){s.get(this).started=!1},a.prototype.handleMessage=function(e){var t,r=s.get(this),n={},i=o.deserialise(e);void 0!==i&&(t=r.cii.compare(i,n),void 0===r.lastCII&&(t|=o.prototype.CIIChangeMask.FIRST_CII_RECEIVED),r.lastCII=i,r.cii=r.cii.merge(i),0!=t&&(void 0!==r.CIIChangeCallback&&r.CIIChangeCallback(r.cii,t),this.emit("change",r.cii,n,t)))},a.prototype.isStarted=function(){return!!s.get(this).started},e.exports=a},4770:function(e,t,r){var n=r(568),i=function(e,t,r,n,i,o,s,a){var c=this;Object.defineProperty(c,"protocolVersion",{enumerable:!0,value:e}),Object.defineProperty(c,"mrsUrl",{enumerable:!0,value:t}),Object.defineProperty(c,"contentId",{enumerable:!0,value:r}),Object.defineProperty(c,"contentIdStatus",{enumerable:!0,value:n}),Object.defineProperty(c,"presentationStatus",{enumerable:!0,value:i}),Object.defineProperty(c,"wcUrl",{enumerable:!0,value:o}),Object.defineProperty(c,"tsUrl",{enumerable:!0,value:s}),Object.defineProperty(c,"timelines",{enumerable:!0,value:a})};i.prototype.serialise=function(){return JSON.stringify(this)},i.deserialise=function(e){e instanceof ArrayBuffer&&(e=String.fromCharCode.apply(null,new Uint8Array(e)));var t,r=JSON.parse(e),o=[];return Array.isArray(r.timelines)&&r.timelines.forEach((function(e){void 0!==(t=n.getFromObj(e))&&o.push(t)})),new i(r.protocolVersion,r.msrUrl,r.contentId,r.contentIdStatus,r.presentationStatus,r.wcUrl,r.tsUrl,o)},i.CIIChangeMask=i.prototype.CIIChangeMask={FIRST_CII_RECEIVED:1,MRS_URL_CHANGED:2,CONTENTID_CHANGED:4,CONTENTID_STATUS_CHANGED:8,PRES_STATUS_CHANGED:16,WC_URL_CHANGED:32,TS_URL_CHANGED:64,TIMELINES_CHANGED:128,PROTOCOL_VERSION_CHANGED:256};var o=["protocolVersion","mrsUrl","contentId","contentIdStatus","presentationStatus","tsUrl","wcUrl","timelines"],s={protocolVersion:i.CIIChangeMask.PROTOCOL_VERSION_CHANGED,mrsUrl:i.CIIChangeMask.MRS_URL_CHANGED,contentId:i.CIIChangeMask.CONTENTID_CHANGED,contentIdStatus:i.CIIChangeMask.CONTENTID_STATUS_CHANGED,presentationStatus:i.CIIChangeMask.PRES_STATUS_CHANGED,tsUrl:i.CIIChangeMask.WC_URL_CHANGED,wcUrl:i.CIIChangeMask.TS_URL_CHANGED,timelines:i.CIIChangeMask.TIMELINES_CHANGED};function a(e,t){return e===t||e instanceof Array&&t instanceof Array&&e.length===t.length&&e.map((function(e,r){return e.equals(t[r])})).reduce((function(e,t){return e&&t}),!0)}i.prototype.equals=function(e){try{return"object"==b(e)&&this.protocolVersion===e.protocolVersion&&this.mrsUrl===e.mrsUrl&&this.contentId===e.contentId&&this.contentIdStatus===e.contentIdStatus&&this.presentationStatus===e.presentationStatus&&this.wcUrl===e.wcUrl&&this.tsUrl===e.tsUrl&&a(this.timelines,e.timelines)}catch(e){return!1}},i.prototype.compare=function(e,t){var r,n,i=0;for(t=void 0===t?{}:t,n=0;n<o.length;n++)void 0===e[r=o[n]]?t[r]=!1:(t[r]="timelines"===r?!a(this[r],e[r]):e[r]!==this[r],t[r]&&(i|=s[r]));return i},i.prototype.merge=function(e){var t,r,n={};for(t=0;t<o.length;t++)void 0!==e[r=o[t]]?n[r]=e[r]:n[r]=this[r];return new i(n.protocolVersion,n.mrsUrl,n.contentId,n.contentIdStatus,n.presentationStatus,n.wcUrl,n.tsUrl,n.timelines)},e.exports=i},568:function(e){var t=function(e,t,r,n){var i=this;Object.defineProperty(i,"timelineSelector",{enumerable:!0,value:e}),Object.defineProperty(i,"unitsPerTick",{enumerable:!0,value:Number(t)}),Object.defineProperty(i,"unitsPerSecond",{enumerable:!0,value:Number(r)}),Object.defineProperty(i,"accuracy",{enumerable:!0,value:Number(n)})};t.getFromObj=function(e){return new t(e.timelineSelector,void 0!==e.timelineProperties?e.timelineProperties.unitsPerTick:e.unitsPerTick,void 0!==e.timelineProperties?e.timelineProperties.unitsPerSecond:e.unitsPerSecond,void 0!==e.timelineProperties?e.timelineProperties.accuracy:e.accuracy)},t.prototype.serialise=function(){return JSON.stringify(this)},t.deserialise=function(e){e instanceof ArrayBuffer&&(e=String.fromCharCode.apply(null,new Uint8Array(e)));var r=JSON.parse(e);return new t(r.timelineSelector,r.unitsPerTick,r.unitsPerSecond,r.accuracy)},t.prototype.equals=function(e){return e instanceof Object&&this.timelineSelector===e.timelineSelector&&(this.unitsPerTick===e.unitsPerTick||isNaN(this.unitsPerTick)&&isNaN(e.unitsPerTick))&&(this.unitsPerSecond===e.unitsPerSecond||isNaN(this.unitsPerSecond)&&isNaN(e.unitsPerSecond))&&(this.accuracy===e.accuracy||isNaN(this.accuracy)&&isNaN(e.accuracy))},e.exports=t},9606:function(e,t,r){var n=r(1743),i=r(1285),o=r(9599),s=(r(4770),r(2942));function a(e,t){n.EventEmitter.call(this);var r=this;e.on("change",(function(e,t,n){r.emit("change",e,t,n)})),this.stop=function(){return t.stop()},this.isStarted=function(){return t.isStarted()}}i(a,n.EventEmitter),e.exports=function(e,t){var r=new s(t);return new a(r,new o(r,e))}},9599:function(e){e.exports=function(e,t){var r={open:function(t){e.start()}.bind(this),close:function(t){e.stop()}.bind(this),message:function(r){var n;try{n=r.binary||"string"!=typeof r.data?new Uint8Array(r.data).buffer:r.data,e.handleMessage(n,null)}catch(e){t.close()}}.bind(this)};t.addEventListener("open",r.open),t.addEventListener("close",r.close),t.addEventListener("message",r.message);var n=function(e,r){var n=e instanceof ArrayBuffer;t.send(e,{binary:n})};e.on("send",n),1==t.readyState&&e.start(),this.stop=function(){t.removeEventListener("open",r.open),t.removeEventListener("close",r.close),t.removeEventListener("message",r.message),e.removeListener("send",n),e.stop()},this.isStarted=function(){return e.isStarted()}}},5707:function(e){var t=function(e,t,r){if(this.contentTime=null!==e?Number(e):null,this.wallClockTime=Number(t),this.timelineSpeedMultiplier=null!==r?Number(r):null,!(Number.NaN!==this.contentTime&&Number.NaN!==this.timelineSpeedMultiplier||null===this.contentTime&&null===this.timelineSpeedMultiplier)&&Number.isInteger(this.wallClockTime))throw"Invalid parameters"};t.prototype.serialise=function(){return JSON.stringify({contentTime:this.contentTime.toString(),wallClockTime:this.wallClockTime.toString(),timelineSpeedMultiplier:this.timelineSpeedMultiplier})},t.deserialise=function(e){e instanceof ArrayBuffer&&(e=String.fromCharCode.apply(null,new Uint8Array(e)));var r=JSON.parse(e);return new t(r.contentTime,r.wallClockTime,r.timelineSpeedMultiplier)},t.prototype.toJson=function(){return this.serialise.call(this)},e.exports=t},5987:function(e){var t=function(e,t){if(this.contentTime=Number(e).toString(),this.wallClockTime=Number(t).toString(),isNaN(this.contentTime)||isNaN(this.wallClockTime))throw"PresentationTimestamp(): Invalid parameters: not a number."};t.getFromObj=function(e){return new t(e.contentTime,e.wallClockTime)},t.prototype.equals=function(e){return this.contentTime===e.contentTime&&this.wallClockTime===e.wallClockTime},e.exports=t},3456:function(e,t,r){var n=r(5987),i=function(e,t,r){if(this.earliest=e,this.latest=t,this.actual=r,!(this.earliest instanceof n&&this.latest instanceof n&&(this.actual instanceof n||void 0!==this.actual)))throw"PresentationTimestamps(): Invalid parameters."};i.prototype.serialise=function(){return JSON.stringify(this)},i.deserialise=function(e){e instanceof ArrayBuffer&&(e=String.fromCharCode.apply(null,new Uint8Array(e)));var t=JSON.parse(e);return new i(n.getFromObj(t.earliest),n.getFromObj(t.latest),t.actual?n.getFromObj(t.actual):void 0)},e.exports=i},8081:function(e,t,r){var n=r(1743),i=r(1285),o=r(901),s=r(5707),a=(r(5987),r(3456),r(6244)),c=a.Correlation,u=(a.CorrelatedClock,new("undefined"!=typeof window&&window.WeakMap||r(405)));function l(e,t){if("function"!=typeof e.setCorrelation||"string"!=typeof t.contentIdStem||"string"!=typeof t.timelineSelector)throw"TSClientProtocol(): Invalid parameters";n.EventEmitter.call(this),u.set(this,{});var r=u.get(this);r.syncTLClock=e,r.contentIdStem=t.contentIdStem,r.timelineSelector=t.timelineSelector;var i=Number(t.tickRate);!isNaN(i)&&i>0&&(e.tickRate=i),r.dest=t.dest?t.dest:null,r.syncTLClock.setAvailabilityFlag(!1)}i(l,n.EventEmitter),l.prototype.start=function(){this._sendSetupMessage()},l.prototype.stop=function(){u.get(this).syncTLClock.setAvailabilityFlag(!1)},l.prototype._sendSetupMessage=function(){var e=u.get(this),t=new o(e.contentIdStem,e.timelineSelector);this.emit("send",t.serialise(),e.dest)},l.prototype.handleMessage=function(e){var t=u.get(this),r=t.syncTLClock;try{var n=s.deserialise(e);t.prevControlTimestamp=n;var i=null!==n.contentTime;if(i){var o=new c(r.parent.fromNanos(n.wallClockTime),n.contentTime),a=n.timelineSpeedMultiplier;r.availabilityFlag&&!r.isChangeSignificant(o,a,.01)||r.setCorrelationAndSpeed(o,a)}r.setAvailabilityFlag(i)}catch(t){throw"TSCP handleMessage: exception: "+t+" -- msg: "+e}},e.exports=l},901:function(e){function t(e,t){if(this.contentIdStem=e,this.timelineSelector=t,"string"!=typeof e||"string"!=typeof t)throw"TSSetupMessage(): Invalid parameters."}t.prototype.serialise=function(){return JSON.stringify(this)},t.deserialise=function(e){e instanceof ArrayBuffer&&(e=String.fromCharCode.apply(null,new Uint8Array(e)));var r=JSON.parse(e);return new t(r.contentIdStem,r.timelineSelector)},e.exports=t},108:function(e,t,r){var n=r(9599),i=r(8081);e.exports=function(e,t,r){return new n(new i(t,r),e)}},3233:function(e,t,r){var n=r(6577);Math.log2=Math.log2||function(e){return Math.log(e)/Math.LN2},Math.trunc=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};var i={pack:function(e){if(0!=e.version)throw"Invalid message version";var t=new Uint8Array(32),r=new DataView(t.buffer);r.setUint8(0,e.version),r.setUint8(1,e.type),r.setUint8(2,Math.ceil(Math.log2(e.precision))),r.setUint8(3,0),r.setUint32(4,256*e.max_freq_error),r.setUint32(8,e.originate_timevalue_secs),r.setUint32(12,e.originate_timevalue_nanos);var i=n.nanosToSecsAndNanos(e.receive_timevalue);r.setUint32(16,i[0]),r.setUint32(20,i[1]);var o=n.nanosToSecsAndNanos(e.transmit_timevalue);return r.setUint32(24,o[0]),r.setUint32(28,o[1]),t.buffer},unpack:function(e){var t=new DataView(e),r=t.getUint8(0);if(0!=r)throw"Invalid message version";return new n(r,t.getUint8(1),Math.pow(2,t.getInt8(2)),t.getUint32(4)/256,t.getUint32(8),t.getUint32(12),t.getUint32(16)+t.getUint32(20)/1e9,t.getUint32(24)+t.getUint32(28)/1e9)},toHex:function(e){if(e instanceof ArrayBuffer){for(var t=new Uint8Array(e),r=[],n=0;n<t.length;n++){var i=("00"+t[n].toString(16)).slice(-2);r.push(i)}return r.join("")}}};e.exports=i},5729:function(e,t,r){var n=r(6244).Correlation,i=r(6577),o=function(e,t){if(!e.isResponse())throw"Not a response message";this.t1=i.secsAndNanosToNanos(e.originate_timevalue_secs,e.originate_timevalue_nanos),this.t2=1e9*e.receive_timevalue,this.t3=1e9*e.transmit_timevalue,this.t4=t,this.precision=1e9*e.precision,this.mfe=e.max_freq_error,this.msg=e};o.prototype.toCorrelation=function(e){var t=e.parent.fromNanos(this.t1),r=e.parent.fromNanos(this.t4),i=e.fromNanos(this.t2),o=e.fromNanos(this.t3),s=this.t4-this.t1-(this.t3-this.t2),a=e.getRootMaxFreqError()/1e6,c=this.mfe/1e6;return new n({parentTime:(t+r)/2,childTime:(i+o)/2,initialError:(this.precision+s/2+a*(this.t4-this.t1)+c*(this.t3-this.t2))/1e9,errorGrowthRate:a+c})},e.exports=o},3476:function(e,t,r){var n=r(6577),i={pack:function(e){if(0!=e.version)throw"Invalid message version";return JSON.stringify({v:Number(e.version),t:Number(e.type),p:Number(e.precision),mfe:Number(e.max_freq_error),otvs:Number(e.originate_timevalue_secs),otvn:Number(e.originate_timevalue_nanos),rt:Number(e.receive_timevalue),tt:Number(e.transmit_timevalue)})},unpack:function(e){e instanceof ArrayBuffer&&(e=String.fromCharCode.apply(null,new Uint8Array(e)));var t=JSON.parse(e);if(0!=t.v)throw"Invalid message version";return new n(parseInt(t.v),parseInt(t.t),Number(t.p),Number(t.mfe),parseInt(t.otvs),parseInt(t.otvn),Number(t.rt),Number(t.tt))}};e.exports=i},6678:function(e,t,r){var n=r(1743),i=r(1285),o=r(6577),s=r(5729),a=r(6244).CorrelatedClock,c=new("undefined"!=typeof window&&window.WeakMap||r(405)),u=function(e,t,r){n.EventEmitter.call(this),c.set(this,{});var i=c.get(this);i.serialiser=t,i.wallClock=e,i.parentClock=e.parent,i.wallClock.correlation=i.wallClock.correlation.butWith({initialError:Number.POSITIVE_INFINITY}),i.wallClock.speed=1,i.wallClock.availabilityFlag=!1,i.altClock=new a(i.parentClock,{tickRate:e.tickRate,correlation:e.correlation}),i.sendTimer=null,i.requestInterval=r.requestInterval>0?r.requestInterval:1e3,i.followupTimeout=r.followupTimeout>0?r.followupTimeout:3e3,i.log="function"==typeof r.logFunction?r.logFunction:function(){},i.log("WallClockClientProtocol constructor: ",r),i.dest=r.dest?r.dest:null,i.responseCache=new Map,i.started=!1};i(u,n.EventEmitter),u.prototype.start=function(){var e=c.get(this);e.log("in WallClockClientProtocol.prototype.start"),this._sendRequest(),e.started=!0},u.prototype.stop=function(){var e=c.get(this);e.sendTimer&&(clearTimeout(e.sendTimer),e.sendTimer=null),e.started=!1,e.wallClock.setAvailabilityFlag(!1)},u.prototype._sendRequest=function(){var e=c.get(this);e.sendTimer&&(clearTimeout(e.sendTimer),e.sendTimer=null);var t=o.nanosToSecsAndNanos(e.parentClock.getNanos()),r=o.makeRequest(t[0],t[1]);r=e.serialiser.pack(r),this.emit("send",r,e.dest),e.sendTimer=setTimeout(this._sendRequest.bind(this),e.requestInterval)},u.prototype.handleMessage=function(e,t){var r=c.get(this),n=r.parentClock.getNanos(),i=(e=r.serialiser.unpack(e)).originate_timevalue_secs+":"+e.originate_timevalue_nanos;if(e.type==o.TYPES.responseWithFollowUp){var s=setTimeout(function(){r.responseCache.delete(i),this._updateClockIfCandidateIsImprovement(e,n)}.bind(this),r.followupTimeout);r.responseCache.set(i,s)}else e.type==o.TYPES.followUp&&r.responseCache.has(i)&&(s=r.responseCache.get(i),clearTimeout(s),r.responseCache.delete(i)),this._updateClockIfCandidateIsImprovement(e,n)},u.prototype._updateClockIfCandidateIsImprovement=function(e,t){var r=c.get(this),n=new s(e,t).toCorrelation(r.wallClock);r.altClock.setCorrelation(n);var i=r.wallClock.now();r.altClock.dispersionAtTime(i)<r.wallClock.dispersionAtTime(i)&&(r.wallClock.correlation=r.altClock.correlation,r.wallClock.availabilityFlag=!0)},u.prototype.isStarted=function(){return!!c.get(this).started},e.exports=u},6577:function(e){var t=function(e,t,r,n,i,o,s,a){this.version=e,this.type=t,this.precision=r,this.max_freq_error=n,this.originate_timevalue_secs=i,this.originate_timevalue_nanos=o,this.receive_timevalue=s,this.transmit_timevalue=a};t.TYPES={request:0,response:1,responseWithFollowUp:2,followUp:3},t.prototype.isResponse=function(){switch(this.type){case t.TYPES.response:case t.TYPES.responseWithFollowUp:case t.TYPES.followUp:return!0;default:return!1}},t.makeRequest=function(e,r){return new t(0,t.TYPES.request,0,0,e,r,0,0)},t.prototype.toResponse=function(e,r,n,i,o){return new t(this.version,e,r,n,this.originate_timevalue_secs,this.originate_timevalue_nanos,i,o)},t.prototype.equals=function(e){return void 0!==e&&null!=e&&this.version===e.version&&this.type===e.type&&this.precision===e.precision&&this.max_freq_error===e.max_freq_error&&this.originate_timevalue_secs===e.originate_timevalue_secs&&this.originate_timevalue_nanos===e.originate_timevalue_nanos&&this.receive_timevalue===e.receive_timevalue&&this.transmit_timevalue===e.transmit_timevalue},t.nanosToSecsAndNanos=function(e){return[Math.trunc(e/1e9),Math.trunc(e%1e9)]},t.secsAndNanosToNanos=function(e,t){return 1e9*Math.trunc(e)+Math.trunc(t%1e9)},e.exports=t},8286:function(e,t,r){var n=r(9599),i=r(6678),o=r(3233);e.exports=function(e,t,r){return new n(new i(t,o,r),e)}},9170:function(e){e.exports=function(e,t,r,n,i){return new t(new WallClockClientProtocol(n,r,i),e)}},6715:function(e,t,r){var n=r(9599),i=r(6678),o=r(3476);e.exports=function(e,t,r){return new n(new i(t,o,r),e)}},8438:function(e,t,r){e.exports={WallClock:{createClient:r(9170),createBinaryWebSocketClient:r(8286),createJsonWebSocketClient:r(6715),WallClockClientProtocol:r(6678),Candidate:r(5729),WallClockMessage:r(6577),JsonSerialiser:r(3476),BinarySerialiser:r(3233)},TimelineSynchronisation:{PresentationTimestamps:r(3456),PresentationTimestamp:r(5987),ControlTimestamp:r(5707),TSSetupMessage:r(901),TSClientProtocol:r(8081),createTSClient:r(108)},CII:{CIIMessage:r(4770),TimelineProperties:r(568),CIIClientProtocol:r(2942),createCIIClient:r(9606)},SocketAdaptors:{WebSocketAdaptor:r(9599)}}},2699:function(e){"use strict";var t,r="object"==("undefined"==typeof Reflect?"undefined":b(Reflect))?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}m(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+b(e))}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var i,o,s,u;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){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 f(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=l.bind(n);return i.listener=r,n.wrapFn=i,i}function p(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):d(i,i.length)}function h(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function d(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function m(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+b(e));e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var u=c.length,l=d(c,u);for(r=0;r<u;++r)n(l[r],this,t)}return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,f(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,f(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,o,s;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return p(this,e,!0)},o.prototype.rawListeners=function(e){return p(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},o.prototype.listenerCount=h,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},2333:function(e,t){t.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,u=c>>1,l=-7,f=r?i-1:0,p=r?-1:1,h=e[t+f];for(f+=p,o=h&(1<<-l)-1,h>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=p,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+f],f+=p,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,n),o-=u}return(h?-1:1)*s*Math.pow(2,o-n)},t.write=function(e,t,r,n,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,f=l>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,d=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+f>=1?p/c:p*Math.pow(2,1-f))*c>=2&&(s++,c/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*c-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[r+h]=255&a,h+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[r+h]=255&s,h+=d,s/=256,u-=8);e[r+h-d]|=128*m}},1285:function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},4421:function(e,t,r){e.exports=function e(t,r,n){function i(s,a){if(!r[s]){if(!t[s]){if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var u=r[s]={exports:{}};t[s][0].call(u.exports,(function(e){return i(t[s][1][e]||e)}),u,u.exports,e,t,r,n)}return r[s].exports}for(var o=void 0,s=0;s<n.length;s++)i(n[s]);return i}({1:[function(e,t,n){(function(r,n){(function(){"use strict";var i=e("events").EventEmitter,o=e("./store"),s=e("mqtt-packet"),a=e("readable-stream").Writable,c=e("inherits"),u=e("reinterval"),l=e("./validations"),f=e("xtend"),p=e("debug")("mqttjs:client"),h=r?r.nextTick:function(e){setTimeout(e,0)},d=n.setImmediate||function(e){h(e)},m={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},g=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],y={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 v(e,t,r){p("sendPacket :: packet: %O",t),p("sendPacket :: emitting `packetsend`"),e.emit("packetsend",t),p("sendPacket :: writing to stream");var n=s.writeToStream(t,e.stream,e.options);p("sendPacket :: writeToStream result %s",n),!n&&r?(p("sendPacket :: handle events on `drain` once through callback."),e.stream.once("drain",r)):r&&(p("sendPacket :: invoking cb"),r())}function w(e,t,r,n){p("storeAndSend :: store packet with cmd %s to outgoingStore",t.cmd),e.outgoingStore.put(t,(function(i){if(i)return r&&r(i);n(),v(e,t,r)}))}function _(e){p("nop ::",e)}function S(e,t){var r,n=this;if(!(this instanceof S))return new S(e,t);for(r in this.options=t||{},m)void 0===this.options[r]?this.options[r]=m[r]:this.options[r]=t[r];p("MqttClient :: options.protocol",t.protocol),p("MqttClient :: options.protocolVersion",t.protocolVersion),p("MqttClient :: options.username",t.username),p("MqttClient :: options.keepalive",t.keepalive),p("MqttClient :: options.reconnectPeriod",t.reconnectPeriod),p("MqttClient :: options.rejectUnauthorized",t.rejectUnauthorized),this.options.clientId="string"==typeof t.clientId?t.clientId:"mqttjs_"+Math.random().toString(16).substr(2,8),p("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=5===t.protocolVersion&&t.customHandleAcks?t.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=e,this.outgoingStore=t.outgoingStore||new o,this.incomingStore=t.incomingStore||new o,this.queueQoSZero=void 0===t.queueQoSZero||t.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 e=this.queue;p("connect :: sending queued packets"),function t(){var r,i=e.shift();p("deliver :: entry %o",i),i&&(r=i.packet,p("deliver :: call _sendPacket for %o",r),n._sendPacket(r,(function(e){i.cb&&i.cb(e),t()})))}()})),this.on("close",(function(){p("close :: connected set to `false`"),this.connected=!1,p("close :: clearing connackTimer"),clearTimeout(this.connackTimer),p("close :: clearing ping timer"),null!==n.pingTimer&&(n.pingTimer.clear(),n.pingTimer=null),p("close :: calling _setupReconnect"),this._setupReconnect()})),i.call(this),p("MqttClient :: setting up stream"),this._setupStream()}c(S,i),S.prototype._setupStream=function(){var e,t=this,r=this,n=new a,i=s.parser(this.options),o=null,c=[];function u(){if(c.length)h(l);else{var e=o;o=null,e()}}function l(){p("work :: getting next packet in queue");var e=c.shift();if(e)p("work :: packet pulled from queue"),r._handlePacket(e,u);else{p("work :: no packets in queue");var t=o;o=null,p("work :: done flag is %s",!!t),t&&t()}}if(p("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),p("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),i.on("packet",(function(e){p("parser :: on packet push to packets array."),c.push(e)})),n._write=function(e,t,r){o=r,p("writable stream :: parsing buffer"),i.parse(e),l()},p("_setupStream :: pipe stream to writable stream"),this.stream.pipe(n),this.stream.on("error",(function(e){p("streamErrorHandler :: error",e.message),g.includes(e.code)?(p("streamErrorHandler :: emitting error"),r.emit("error",e)):_(e)})),this.stream.on("close",(function(){var e;p("(%s)stream :: on close",r.options.clientId),(e=r.outgoing)&&(p("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(e).forEach((function(t){e[t].volatile&&"function"==typeof e[t].cb&&(e[t].cb(new Error("Connection closed")),delete e[t])}))),p("stream: emit close to MqttClient"),r.emit("close")})),p("_setupStream: sending packet `connect`"),(e=Object.create(this.options)).cmd="connect",v(this,e),i.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return r.end((function(){return t.emit("error",new Error("Packet has no Authentication Method"))})),this;this.options.properties.authenticationMethod&&this.options.authPacket&&"object"==b(this.options.authPacket)&&v(this,f({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((function(){p("!!connectTimeout hit!! Calling _cleanUp with force `true`"),r._cleanUp(!0)}),this.options.connectTimeout)},S.prototype._handlePacket=function(e,t){var r=this.options;if(5===r.protocolVersion&&r.properties&&r.properties.maximumPacketSize&&r.properties.maximumPacketSize<e.length)return this.emit("error",new Error("exceeding packets size "+e.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(p("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",e),e.cmd){case"publish":this._handlePublish(e,t);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(e),t();break;case"pubrel":this._handlePubrel(e,t);break;case"connack":this._handleConnack(e),t();break;case"pingresp":this._handlePingresp(e),t();break;case"disconnect":this._handleDisconnect(e),t()}},S.prototype._checkDisconnecting=function(e){return this.disconnecting&&(e?e(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},S.prototype.publish=function(e,t,r,n){var i;p("publish :: message `%s` to topic `%s`",t,e);var o=this.options;if("function"==typeof r&&(n=r,r=null),r=f({qos:0,retain:!1,dup:!1},r),this._checkDisconnecting(n))return this;switch(i={cmd:"publish",topic:e,payload:t,qos:r.qos,retain:r.retain,messageId:this._nextId(),dup:r.dup},5===o.protocolVersion&&(i.properties=r.properties,(!o.properties&&i.properties&&i.properties.topicAlias||r.properties&&o.properties&&(r.properties.topicAlias&&o.properties.topicAliasMaximum&&r.properties.topicAlias>o.properties.topicAliasMaximum||!o.properties.topicAliasMaximum&&r.properties.topicAlias))&&delete i.properties.topicAlias),p("publish :: qos",r.qos),r.qos){case 1:case 2:this.outgoing[i.messageId]={volatile:!1,cb:n||_},this._storeProcessing?(p("_storeProcessing enabled"),this._packetIdsDuringStoreProcessing[i.messageId]=!1,this._storePacket(i,void 0,r.cbStorePut)):(p("MqttClient:publish: packet cmd: %s",i.cmd),this._sendPacket(i,void 0,r.cbStorePut));break;default:this._storeProcessing?(p("_storeProcessing enabled"),this._storePacket(i,n,r.cbStorePut)):(p("MqttClient:publish: packet cmd: %s",i.cmd),this._sendPacket(i,n,r.cbStorePut))}return this},S.prototype.subscribe=function(){for(var e,t=new Array(arguments.length),r=0;r<arguments.length;r++)t[r]=arguments[r];var n,i=[],o=t.shift(),s=o.resubscribe,a=t.pop()||_,c=t.pop(),u=this,h=this.options.protocolVersion;if(delete o.resubscribe,"string"==typeof o&&(o=[o]),"function"!=typeof a&&(c=a,a=_),null!==(n=l.validateTopics(o)))return d(a,new Error("Invalid topic "+n)),this;if(this._checkDisconnecting(a))return p("subscribe: discconecting true"),this;var m={qos:0};if(5===h&&(m.nl=!1,m.rap=!1,m.rh=0),c=f(m,c),Array.isArray(o)?o.forEach((function(e){if(p("subscribe: array topic %s",e),!u._resubscribeTopics.hasOwnProperty(e)||u._resubscribeTopics[e].qos<c.qos||s){var t={topic:e,qos:c.qos};5===h&&(t.nl=c.nl,t.rap=c.rap,t.rh=c.rh,t.properties=c.properties),p("subscribe: pushing topic `%s` and qos `%s` to subs list",t.topic,t.qos),i.push(t)}})):Object.keys(o).forEach((function(e){if(p("subscribe: object topic %s",e),!u._resubscribeTopics.hasOwnProperty(e)||u._resubscribeTopics[e].qos<o[e].qos||s){var t={topic:e,qos:o[e].qos};5===h&&(t.nl=o[e].nl,t.rap=o[e].rap,t.rh=o[e].rh,t.properties=c.properties),p("subscribe: pushing `%s` to subs list",t),i.push(t)}})),e={cmd:"subscribe",subscriptions:i,qos:1,retain:!1,dup:!1,messageId:this._nextId()},c.properties&&(e.properties=c.properties),i.length){if(this.options.resubscribe){p("subscribe :: resubscribe true");var g=[];i.forEach((function(e){if(u.options.reconnectPeriod>0){var t={qos:e.qos};5===h&&(t.nl=e.nl||!1,t.rap=e.rap||!1,t.rh=e.rh||0,t.properties=e.properties),u._resubscribeTopics[e.topic]=t,g.push(e.topic)}})),u.messageIdToTopic[e.messageId]=g}return this.outgoing[e.messageId]={volatile:!0,cb:function(e,t){if(!e)for(var r=t.granted,n=0;n<r.length;n+=1)i[n].qos=r[n];a(e,i)}},p("subscribe :: call _sendPacket"),this._sendPacket(e),this}a(null,[])},S.prototype.unsubscribe=function(){for(var e={cmd:"unsubscribe",qos:1,messageId:this._nextId()},t=this,r=new Array(arguments.length),n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r.shift(),o=r.pop()||_,s=r.pop();return"string"==typeof i&&(i=[i]),"function"!=typeof o&&(s=o,o=_),this._checkDisconnecting(o)||("string"==typeof i?e.unsubscriptions=[i]:Array.isArray(i)&&(e.unsubscriptions=i),this.options.resubscribe&&e.unsubscriptions.forEach((function(e){delete t._resubscribeTopics[e]})),"object"==b(s)&&s.properties&&(e.properties=s.properties),this.outgoing[e.messageId]={volatile:!0,cb:o},p("unsubscribe: call _sendPacket"),this._sendPacket(e)),this},S.prototype.end=function(e,t,r){var n=this;function i(){p("end :: (%s) :: finish :: calling _cleanUp with force %s",n.options.clientId,e),n._cleanUp(e,(function(){p("end :: finish :: calling process.nextTick on closeStores"),h(function(){p("end :: closeStores: closing incoming and outgoing stores"),n.disconnected=!0,n.incomingStore.close((function(e){n.outgoingStore.close((function(t){if(p("end :: closeStores: emitting end"),n.emit("end"),r){var i=e||t;p("end :: closeStores: invoking callback with args"),r(i)}}))})),n._deferredReconnect&&n._deferredReconnect()}.bind(n))}),t)}return p("end :: (%s)",this.options.clientId),null!=e&&"boolean"==typeof e||(r=t||_,t=e,e=!1,"object"!=b(t)&&(r=t,t=null,"function"!=typeof r&&(r=_))),"object"!=b(t)&&(r=t,t=null),p("end :: cb? %s",!!r),r=r||_,this.disconnecting?(r(),this):(this._clearReconnect(),this.disconnecting=!0,!e&&Object.keys(this.outgoing).length>0?(p("end :: (%s) :: calling finish in 10ms once outgoing is empty",n.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,i,10))):(p("end :: (%s) :: immediately calling finish",n.options.clientId),i()),this)},S.prototype.removeOutgoingMessage=function(e){var t=this.outgoing[e]?this.outgoing[e].cb:null;return delete this.outgoing[e],this.outgoingStore.del({messageId:e},(function(){t(new Error("Message removed"))})),this},S.prototype.reconnect=function(e){p("client reconnect");var t=this,r=function(){e?(t.options.incomingStore=e.incomingStore,t.options.outgoingStore=e.outgoingStore):(t.options.incomingStore=null,t.options.outgoingStore=null),t.incomingStore=t.options.incomingStore||new o,t.outgoingStore=t.options.outgoingStore||new o,t.disconnecting=!1,t.disconnected=!1,t._deferredReconnect=null,t._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),this},S.prototype._reconnect=function(){var e=this;p("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end((function(){e._setupStream()})),p("client already connected. disconnecting first.")):(p("_reconnect: calling _setupStream"),this._setupStream())},S.prototype._setupReconnect=function(){var e=this;!e.disconnecting&&!e.reconnectTimer&&e.options.reconnectPeriod>0?(this.reconnecting||(p("_setupReconnect :: emit `offline` state"),this.emit("offline"),p("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),p("_setupReconnect :: setting reconnectTimer for %d ms",e.options.reconnectPeriod),e.reconnectTimer=setInterval((function(){p("reconnectTimer :: reconnect triggered!"),e._reconnect()}),e.options.reconnectPeriod)):p("_setupReconnect :: doing nothing...")},S.prototype._clearReconnect=function(){p("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},S.prototype._cleanUp=function(e,t){var r,n=arguments[2];if(t&&(p("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",t)),p("_cleanUp :: forced? %s",e),e)0===this.options.reconnectPeriod&&this.options.clean&&(r=this.outgoing)&&(p("flush: queue exists? %b",!!r),Object.keys(r).forEach((function(e){"function"==typeof r[e].cb&&(r[e].cb(new Error("Connection closed")),delete r[e])}))),p("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{var i=f({cmd:"disconnect"},n);p("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(i,d.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(p("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(p("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),t&&!this.connected&&(p("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",t),t())},S.prototype._sendPacket=function(e,t,r){if(p("_sendPacket :: (%s) :: start",this.options.clientId),r=r||_,!this.connected)return p("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(e,t,r);switch(this._shiftPingInterval(),e.cmd){case"publish":break;case"pubrel":return void w(this,e,t,r);default:return void v(this,e,t)}switch(e.qos){case 2:case 1:w(this,e,t,r);break;default:v(this,e,t)}p("_sendPacket :: (%s) :: end",this.options.clientId)},S.prototype._storePacket=function(e,t,r){p("_storePacket :: packet: %o",e),p("_storePacket :: cb? %s",!!t),r=r||_,0===(e.qos||0)&&this.queueQoSZero||"publish"!==e.cmd?this.queue.push({packet:e,cb:t}):e.qos>0?(t=this.outgoing[e.messageId]?this.outgoing[e.messageId].cb:null,this.outgoingStore.put(e,(function(e){if(e)return t&&t(e);r()}))):t&&t(new Error("No connection to broker"))},S.prototype._setupPingTimer=function(){p("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);var e=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=u((function(){e._checkPing()}),1e3*this.options.keepalive))},S.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},S.prototype._checkPing=function(){p("_checkPing :: checking ping..."),this.pingResp?(p("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(p("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},S.prototype._handlePingresp=function(){this.pingResp=!0},S.prototype._handleConnack=function(e){p("_handleConnack");var t=this.options,r=5===t.protocolVersion?e.reasonCode:e.returnCode;if(clearTimeout(this.connackTimer),e.properties&&(e.properties.topicAliasMaximum&&(t.properties||(t.properties={}),t.properties.topicAliasMaximum=e.properties.topicAliasMaximum),e.properties.serverKeepAlive&&t.keepalive&&(t.keepalive=e.properties.serverKeepAlive,this._shiftPingInterval()),e.properties.maximumPacketSize&&(t.properties||(t.properties={}),t.properties.maximumPacketSize=e.properties.maximumPacketSize)),0===r)this.reconnecting=!1,this._onConnect(e);else if(r>0){var n=new Error("Connection refused: "+y[r]);n.code=r,this.emit("error",n)}},S.prototype._handlePublish=function(e,t){p("_handlePublish: packet %o",e),t=void 0!==t?t:_;var r=e.topic.toString(),n=e.payload,i=e.qos,o=e.messageId,s=this,a=this.options,c=[0,16,128,131,135,144,145,151,153];switch(p("_handlePublish: qos %d",i),i){case 2:a.customHandleAcks(r,n,e,(function(r,n){return r instanceof Error||(n=r,r=null),r?s.emit("error",r):-1===c.indexOf(n)?s.emit("error",new Error("Wrong reason code for pubrec")):void(n?s._sendPacket({cmd:"pubrec",messageId:o,reasonCode:n},t):s.incomingStore.put(e,(function(){s._sendPacket({cmd:"pubrec",messageId:o},t)})))}));break;case 1:a.customHandleAcks(r,n,e,(function(i,a){return i instanceof Error||(a=i,i=null),i?s.emit("error",i):-1===c.indexOf(a)?s.emit("error",new Error("Wrong reason code for puback")):(a||s.emit("message",r,n,e),void s.handleMessage(e,(function(e){if(e)return t&&t(e);s._sendPacket({cmd:"puback",messageId:o,reasonCode:a},t)})))}));break;case 0:this.emit("message",r,n,e),this.handleMessage(e,t);break;default:p("_handlePublish: unknown QoS. Doing nothing.")}},S.prototype.handleMessage=function(e,t){t()},S.prototype._handleAck=function(e){var t,r=e.messageId,n=e.cmd,i=null,o=this.outgoing[r]?this.outgoing[r].cb:null,s=this;if(o){switch(p("_handleAck :: packet type",n),n){case"pubcomp":case"puback":var a=e.reasonCode;a&&a>0&&16!==a&&((t=new Error("Publish error: "+y[a])).code=a,o(t,e)),delete this.outgoing[r],this.outgoingStore.del(e,o);break;case"pubrec":i={cmd:"pubrel",qos:2,messageId:r};var c=e.reasonCode;c&&c>0&&16!==c?((t=new Error("Publish error: "+y[c])).code=c,o(t,e)):this._sendPacket(i);break;case"suback":delete this.outgoing[r];for(var u=0;u<e.granted.length;u++)if(0!=(128&e.granted[u])){var l=this.messageIdToTopic[r];l&&l.forEach((function(e){delete s._resubscribeTopics[e]}))}o(null,e);break;case"unsuback":delete this.outgoing[r],o(null);break;default:s.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}else p("_handleAck :: Server sent an ack in error. Ignoring.")},S.prototype._handlePubrel=function(e,t){p("handling pubrel packet"),t=void 0!==t?t:_;var r=this,n={cmd:"pubcomp",messageId:e.messageId};r.incomingStore.get(e,(function(e,i){e?r._sendPacket(n,t):(r.emit("message",i.topic,i.payload,i),r.handleMessage(i,(function(e){if(e)return t(e);r.incomingStore.del(i,_),r._sendPacket(n,t)})))}))},S.prototype._handleDisconnect=function(e){this.emit("disconnect",e)},S.prototype._nextId=function(){var e=this.nextId++;return 65536===this.nextId&&(this.nextId=1),e},S.prototype.getLastMessageId=function(){return 1===this.nextId?65535:this.nextId-1},S.prototype._resubscribe=function(e){p("_resubscribe");var t=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||5===this.options.protocolVersion&&!e.sessionPresent)&&t.length>0)if(this.options.resubscribe)if(5===this.options.protocolVersion){p("_resubscribe: protocolVersion 5");for(var r=0;r<t.length;r++){var n={};n[t[r]]=this._resubscribeTopics[t[r]],n.resubscribe=!0,this.subscribe(n,{properties:n[t[r]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},S.prototype._onConnect=function(e){if(this.disconnected)this.emit("connect",e);else{var t=this;this._setupPingTimer(),this._resubscribe(e),this.connected=!0,function r(){var n=t.outgoingStore.createStream();function i(){t._storeProcessing=!1,t._packetIdsDuringStoreProcessing={}}function o(){n.destroy(),n=null,i()}t.once("close",o),n.on("error",(function(e){i(),t.removeListener("close",o),t.emit("error",e)})),n.on("end",(function(){var n=!0;for(var s in t._packetIdsDuringStoreProcessing)if(!t._packetIdsDuringStoreProcessing[s]){n=!1;break}n?(i(),t.removeListener("close",o),t.emit("connect",e)):r()})),function e(){if(n){t._storeProcessing=!0;var r,i=n.read(1);i?t._packetIdsDuringStoreProcessing[i.messageId]?e():t.disconnecting||t.reconnectTimer?n.destroy&&n.destroy():(r=t.outgoing[i.messageId]?t.outgoing[i.messageId].cb:null,t.outgoing[i.messageId]={volatile:!1,cb:function(t,n){r&&r(t,n),e()}},t._packetIdsDuringStoreProcessing[i.messageId]=!0,t._sendPacket(i)):n.once("readable",e)}}()}()}},t.exports=S}).call(this)}).call(this,e("_process"),void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./store":7,"./validations":8,_process:32,debug:15,events:19,inherits:21,"mqtt-packet":24,"readable-stream":51,reinterval:52,xtend:61}],2:[function(e,t,r){(function(r){(function(){"use strict";var n,i,o,s=e("readable-stream").Transform,a=e("duplexify"),c=!1;t.exports=function(e,t){if(t.hostname=t.hostname||t.host,!t.hostname)throw new Error("Could not determine host. Specify host manually.");var u="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(t);var l=function(e,t){var r="alis"===e.protocol?"wss":"ws",n=r+"://"+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(n=r+"://"+e.hostname+":"+e.port+e.path),"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}(t,e);return(n=t.my).connectSocket({url:l,protocols:u}),i=function(){var e=new s;return e._write=function(e,t,r){n.sendSocketMessage({data:e.buffer,success:function(){r()},fail:function(){r(new Error)}})},e._flush=function(e){n.closeSocket({success:function(){e()}})},e}(),o=a.obj(),c||(c=!0,n.onSocketOpen((function(){o.setReadable(i),o.setWritable(i),o.emit("connect")})),n.onSocketMessage((function(e){if("string"==typeof e.data){var t=r.from(e.data,"base64");i.push(t)}else{var n=new FileReader;n.addEventListener("load",(function(){var e=n.result;e=e instanceof ArrayBuffer?r.from(e):r.from(e,"utf8"),i.push(e)})),n.readAsArrayBuffer(e.data)}})),n.onSocketClose((function(){o.end(),o.destroy()})),n.onSocketError((function(e){o.destroy(e)}))),o}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:14,duplexify:17,"readable-stream":51}],3:[function(e,t,r){"use strict";var n=e("net"),i=e("debug")("mqttjs:tcp");t.exports=function(e,t){var r,o;return t.port=t.port||1883,t.hostname=t.hostname||t.host||"localhost",r=t.port,o=t.hostname,i("port %d and host %s",r,o),n.createConnection(r,o)}},{debug:15,net:13}],4:[function(e,t,r){"use strict";var n=e("tls"),i=e("debug")("mqttjs:tls");t.exports=function(e,t){var r;function o(n){t.rejectUnauthorized&&e.emit("error",n),r.end()}return t.port=t.port||8883,t.host=t.hostname||t.host||"localhost",t.servername=t.host,t.rejectUnauthorized=!1!==t.rejectUnauthorized,delete t.path,i("port %d host %s rejectUnauthorized %b",t.port,t.host,t.rejectUnauthorized),(r=n.connect(t)).on("secureConnect",(function(){t.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",o)})),r.on("error",o),r}},{debug:15,tls:13}],5:[function(e,t,n){(function(n,i){(function(){"use strict";var o=e("ws"),s=e("debug")("mqttjs:ws"),a=e("duplexify"),c=e("readable-stream").Transform,u=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],l=void 0!==n&&"browser"===n.title||"function"==typeof r;function f(e,t){var r=e.protocol+"://"+e.hostname+":"+e.port+e.path;return"function"==typeof e.transformWsUrl&&(r=e.transformWsUrl(r,e,t)),r}function p(e){var t=e;return e.hostname||(t.hostname="localhost"),e.port||("wss"===e.protocol?t.port=443:t.port=80),e.path||(t.path="/"),e.wsOptions||(t.wsOptions={}),l||"wss"!==e.protocol||u.forEach((function(r){e.hasOwnProperty(r)&&!e.wsOptions.hasOwnProperty(r)&&(t.wsOptions[r]=e[r])})),t}t.exports=l?function(e,t){var r;s("browserStreamBuilder");var n=function(e){var t=p(e);if(t.hostname||(t.hostname=t.host),!t.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");var r=new URL(document.URL);t.hostname=r.hostname,t.port||(t.port=r.port)}return void 0===t.objectMode&&(t.objectMode=!(!0===t.binary||void 0===t.binary)),t}(t).browserBufferSize||524288,o=t.browserBufferTimeout||1e3,u=!t.objectMode,l=function(e,t){var r="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt",n=f(t,e),i=new WebSocket(n,[r]);return i.binaryType="arraybuffer",i}(e,t),h=function(e,t,r){var n=new c({objectModeMode:e.objectMode});return n._write=t,n._flush=function(e){l.close(),e()},n}(t,(function e(t,r,s){l.bufferedAmount>n&&setTimeout(e,o,t,r,s),u&&"string"==typeof t&&(t=i.from(t,"utf8"));try{l.send(t)}catch(e){return s(e)}s()}));t.objectMode||(h._writev=b),h.on("close",(function(){l.close()}));var d=void 0!==l.addEventListener;function m(){r.setReadable(h),r.setWritable(h),r.emit("connect")}function g(){r.end(),r.destroy()}function y(e){r.destroy(e)}function v(e){var t=e.data;t=t instanceof ArrayBuffer?i.from(t):i.from(t,"utf8"),h.push(t)}function b(e,t){for(var r=new Array(e.length),n=0;n<e.length;n++)"string"==typeof e[n].chunk?r[n]=i.from(e[n],"utf8"):r[n]=e[n].chunk;this._write(i.concat(r),"binary",t)}return l.readyState===l.OPEN?r=h:(r=r=a(void 0,void 0,t),t.objectMode||(r._writev=b),d?l.addEventListener("open",m):l.onopen=m),r.socket=l,d?(l.addEventListener("close",g),l.addEventListener("error",y),l.addEventListener("message",v)):(l.onclose=g,l.onerror=y,l.onmessage=v),r}:function(e,t){s("streamBuilder");var r=p(t),n=f(r,e),i=function(e,t,r){s("createWebSocket"),s("protocol: "+r.protocolId+" "+r.protocolVersion);var n="MQIsdp"===r.protocolId&&3===r.protocolVersion?"mqttv3.1":"mqtt";return s("creating new Websocket for url: "+t+" and protocol: "+n),new o(t,[n],r.wsOptions)}(0,n,r),a=o.createWebSocketStream(i,r.wsOptions);return a.url=n,i.on("close",(function(){a.destroy()})),a}}).call(this)}).call(this,e("_process"),e("buffer").Buffer)},{_process:32,buffer:14,debug:15,duplexify:17,"readable-stream":51,ws:60}],6:[function(e,t,r){(function(r){(function(){"use strict";var n,i,o,s=e("readable-stream").Transform,a=e("duplexify");t.exports=function(e,t){if(t.hostname=t.hostname||t.host,!t.hostname)throw new Error("Could not determine host. Specify host manually.");var c="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";!function(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}(t);var u=function(e,t){var r="wxs"===e.protocol?"wss":"ws",n=r+"://"+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(n=r+"://"+e.hostname+":"+e.port+e.path),"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}(t,e);n=wx.connectSocket({url:u,protocols:[c]}),i=function(){var e=new s;return e._write=function(e,t,r){n.send({data:e.buffer,success:function(){r()},fail:function(e){r(new Error(e))}})},e._flush=function(e){n.close({success:function(){e()}})},e}(),(o=a.obj())._destroy=function(e,t){n.close({success:function(){t&&t(e)}})};var l=o.destroy;return o.destroy=function(){o.destroy=l;var e=this;setTimeout((function(){n.close({fail:function(){e._destroy(new Error)}})}),0)}.bind(o),n.onOpen((function(){o.setReadable(i),o.setWritable(i),o.emit("connect")})),n.onMessage((function(e){var t=e.data;t=t instanceof ArrayBuffer?r.from(t):r.from(t,"utf8"),i.push(t)})),n.onClose((function(){o.end(),o.destroy()})),n.onError((function(e){o.destroy(new Error(e.errMsg))})),o}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:14,duplexify:17,"readable-stream":51}],7:[function(e,t,r){"use strict";var n=e("xtend"),i=e("readable-stream").Readable,o={objectMode:!0},s={clean:!0};function a(e){if(!(this instanceof a))return new a(e);this.options=e||{},this.options=n(s,e),this._inflights=new Map}a.prototype.put=function(e,t){return this._inflights.set(e.messageId,e),t&&t(),this},a.prototype.createStream=function(){var e=new i(o),t=!1,r=[],n=0;return this._inflights.forEach((function(e,t){r.push(e)})),e._read=function(){!t&&n<r.length?this.push(r[n++]):this.push(null)},e.destroy=function(){if(!t){var e=this;t=!0,setTimeout((function(){e.emit("close")}),0)}},e},a.prototype.del=function(e,t){return(e=this._inflights.get(e.messageId))?(this._inflights.delete(e.messageId),t(null,e)):t&&t(new Error("missing packet")),this},a.prototype.get=function(e,t){return(e=this._inflights.get(e.messageId))?t(null,e):t&&t(new Error("missing packet")),this},a.prototype.close=function(e){this.options.clean&&(this._inflights=null),e&&e()},t.exports=a},{"readable-stream":51,xtend:61}],8:[function(e,t,r){"use strict";function n(e){for(var t=e.split("/"),r=0;r<t.length;r++)if("+"!==t[r]){if("#"===t[r])return r===t.length-1;if(-1!==t[r].indexOf("+")||-1!==t[r].indexOf("#"))return!1}return!0}t.exports={validateTopics:function(e){if(0===e.length)return"empty_topic_list";for(var t=0;t<e.length;t++)if(!n(e[t]))return e[t];return null}}},{}],9:[function(e,t,n){(function(n){(function(){"use strict";var i=e("../client"),o=e("../store"),s=e("url"),a=e("xtend"),c=e("debug")("mqttjs"),u={};function l(e,t){if(c("connecting to an MQTT broker..."),"object"!=b(e)||t||(t=e,e=null),t=t||{},e){var r=s.parse(e,!0);if(null!=r.port&&(r.port=Number(r.port)),null===(t=a(r,t)).protocol)throw new Error("Missing protocol");t.protocol=t.protocol.replace(/:$/,"")}if(function(e){var t;e.auth&&((t=e.auth.match(/^(.+):(.+)$/))?(e.username=t[1],e.password=t[2]):e.username=e.auth)}(t),t.query&&"string"==typeof t.query.clientId&&(t.clientId=t.query.clientId),t.cert&&t.key){if(!t.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs","alis"].indexOf(t.protocol))switch(t.protocol){case"mqtt":t.protocol="mqtts";break;case"ws":t.protocol="wss";break;case"wx":t.protocol="wxs";break;case"ali":t.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+t.protocol+'"!')}}if(!u[t.protocol]){var n=-1!==["mqtts","wss"].indexOf(t.protocol);t.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((function(e,t){return(!n||t%2!=0)&&"function"==typeof u[e]}))[0]}if(!1===t.clean&&!t.clientId)throw new Error("Missing clientId for unclean clients");t.protocol&&(t.defaultProtocol=t.protocol);var o=new i((function(e){return t.servers&&(e._reconnectCount&&e._reconnectCount!==t.servers.length||(e._reconnectCount=0),t.host=t.servers[e._reconnectCount].host,t.port=t.servers[e._reconnectCount].port,t.protocol=t.servers[e._reconnectCount].protocol?t.servers[e._reconnectCount].protocol:t.defaultProtocol,t.hostname=t.host,e._reconnectCount++),c("calling streambuilder for",t.protocol),u[t.protocol](e,t)}),t);return o.on("error",(function(){})),o}void 0!==n&&"browser"!==n.title||"function"!=typeof r?(u.mqtt=e("./tcp"),u.tcp=e("./tcp"),u.ssl=e("./tls"),u.tls=e("./tls"),u.mqtts=e("./tls")):(u.wx=e("./wx"),u.wxs=e("./wx"),u.ali=e("./ali"),u.alis=e("./ali")),u.ws=e("./ws"),u.wss=e("./ws"),t.exports=l,t.exports.connect=l,t.exports.MqttClient=i,t.exports.Store=o}).call(this)}).call(this,e("_process"))},{"../client":1,"../store":7,"./ali":2,"./tcp":3,"./tls":4,"./ws":5,"./wx":6,_process:32,debug:15,url:56,xtend:61}],10:[function(e,t,r){"use strict";r.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return 3*(r+n)/4-n},r.toByteArray=function(e){var t,r,n=u(e),s=n[0],a=n[1],c=new o(function(e,t,r){return 3*(t+r)/4-r}(0,s,a)),l=0,f=a>0?s-4:s;for(r=0;r<f;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],c[l++]=t>>16&255,c[l++]=t>>8&255,c[l++]=255&t;return 2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,c[l++]=255&t),1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t),c},r.fromByteArray=function(e){for(var t,r=e.length,i=r%3,o=[],s=0,a=r-i;s<a;s+=16383)o.push(l(e,s,s+16383>a?a:s+16383));return 1===i?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a<c;++a)n[a]=s[a],i[s.charCodeAt(a)]=a;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var i,o,s=[],a=t;a<r;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],11:[function(e,t,r){"use strict";var n=e("buffer").Buffer,i=Symbol.for("BufferList");function o(e){if(!(this instanceof o))return new o(e);o._init.call(this,e)}o._init=function(e){Object.defineProperty(this,i,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},o.prototype._new=function(e){return new o(e)},o.prototype._offset=function(e){if(0===e)return[0,0];for(var t=0,r=0;r<this._bufs.length;r++){var n=t+this._bufs[r].length;if(e<n||r===this._bufs.length-1)return[r,e-t];t=n}},o.prototype._reverseOffset=function(e){for(var t=e[0],r=e[1],n=0;n<t;n++)r+=this._bufs[n].length;return r},o.prototype.get=function(e){if(!(e>this.length||e<0)){var t=this._offset(e);return this._bufs[t[0]][t[1]]}},o.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},o.prototype.copy=function(e,t,r,i){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof i||i>this.length)&&(i=this.length),r>=this.length)return e||n.alloc(0);if(i<=0)return e||n.alloc(0);var o=!!e,s=this._offset(r),a=i-r,c=a,u=o&&t||0,l=s[1];if(0===r&&i===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(var f=0;f<this._bufs.length;f++)this._bufs[f].copy(e,u),u+=this._bufs[f].length;return e}if(c<=this._bufs[s[0]].length-l)return o?this._bufs[s[0]].copy(e,t,l,l+c):this._bufs[s[0]].slice(l,l+c);o||(e=n.allocUnsafe(a));for(var p=s[0];p<this._bufs.length;p++){var h=this._bufs[p].length-l;if(!(c>h)){this._bufs[p].copy(e,u,l,l+c),u+=h;break}this._bufs[p].copy(e,u,l),u+=h,c-=h,l&&(l=0)}return e.length>u?e.slice(0,u):e},o.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();var r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!==r[1]&&(i[0]=i[0].slice(r[1])),this._new(i)},o.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},o.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},o.prototype.duplicate=function(){for(var e=this._new(),t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},o.prototype.append=function(e){if(null==e)return this;if(e.buffer)this._appendBuffer(n.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(var t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(var r=0;r<e._bufs.length;r++)this.append(e._bufs[r]);else"number"==typeof e&&(e=e.toString()),this._appendBuffer(n.from(e));return this},o.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},o.prototype.indexOf=function(e,t,r){if(void 0===r&&"string"==typeof t&&(r=t,t=void 0),"function"==typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof e?e=n.from([e]):"string"==typeof e?e=n.from(e,r):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=n.from(e.buffer,e.byteOffset,e.byteLength):n.isBuffer(e)||(e=n.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;for(var i=this._offset(t),o=i[0],s=i[1];o<this._bufs.length;o++){for(var a=this._bufs[o];s<a.length;)if(a.length-s>=e.length){var c=a.indexOf(e,s);if(-1!==c)return this._reverseOffset([o,c]);s=a.length-e.length+1}else{var u=this._reverseOffset([o,s]);if(this._match(u,e))return u;s++}s=0}return-1},o.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(var r=0;r<t.length;r++)if(this.get(e+r)!==t[r])return!1;return!0},function(){var e={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(var t in e)!function(t){o.prototype[t]=null===e[t]?function(e,r){return this.slice(e,e+r)[t](0,r)}:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.slice(r,r+e[t])[t](0)}}(t)}(),o.prototype._isBufferList=function(e){return e instanceof o||o.isBufferList(e)},o.isBufferList=function(e){return null!=e&&e[i]},t.exports=o},{buffer:14}],12:[function(e,t,r){"use strict";var n=e("readable-stream").Duplex,i=e("inherits"),o=e("./BufferList");function s(e){if(!(this instanceof s))return new s(e);if("function"==typeof e){this._callback=e;var t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",(function(e){e.on("error",t)})),this.on("unpipe",(function(e){e.removeListener("error",t)})),e=null}o._init.call(this,e),n.call(this)}i(s,n),Object.assign(s.prototype,o.prototype),s.prototype._new=function(e){return new s(e)},s.prototype._write=function(e,t,r){this._appendBuffer(e),"function"==typeof r&&r()},s.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)},s.prototype.end=function(e){n.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},s.prototype._destroy=function(e,t){this._bufs.length=0,this.length=0,t(e)},s.prototype._isBufferList=function(e){return e instanceof s||e instanceof o||s.isBufferList(e)},s.isBufferList=o.isBufferList,t.exports=s,t.exports.BufferListStream=s,t.exports.BufferList=o},{"./BufferList":11,inherits:21,"readable-stream":51}],13:[function(e,t,r){},{}],14:[function(e,t,r){(function(t){(function(){"use strict";var t=e("base64-js"),n=e("ieee754");r.Buffer=s,r.SlowBuffer=function(e){return+e!=e&&(e=0),s.alloc(+e)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function o(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=s.prototype,t}function s(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return a(e,t,r)}function a(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|p(e,t),n=o(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return l(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+b(e));if(F(e,ArrayBuffer)||e&&F(e.buffer,ArrayBuffer))return function(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r)).__proto__=s.prototype,n}(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return s.from(n,t,r);var i=function(e){if(s.isBuffer(e)){var t=0|f(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||D(e.length)?o(0):l(e):"Buffer"===e.type&&Array.isArray(e.data)?l(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+b(e))}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return c(e),o(e<0?0:0|f(e))}function l(e){for(var t=e.length<0?0:0|f(e.length),r=o(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function f(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function p(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||F(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+b(e));var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return M(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return B(e).length;default:if(i)return n?-1:M(e).length;t=(""+t).toLowerCase(),i=!0}}function h(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function d(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),D(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,i){var o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===c)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){for(var f=!0,p=0;p<c;p++)if(u(e,o+p)!==u(t,p)){f=!1;break}if(f)return o}return-1}function g(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(D(a))return s;e[r+s]=a}return s}function y(e,t,r,n){return q(M(t,e.length-r),e,r,n)}function v(e,t,r,n){return q(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function w(e,t,r,n){return v(e,t,r,n)}function _(e,t,r,n){return q(B(t),e,r,n)}function S(e,t,r,n){return q(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function E(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function k(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,c,u=e[i],l=null,f=u>239?4:u>223?3:u>191?2:1;if(i+f<=r)switch(f){case 1:u<128&&(l=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(e){var t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=T));return r}(n)}r.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),s.poolSize=8192,s.from=function(e,t,r){return a(e,t,r)},s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,s.alloc=function(e,t,r){return function(e,t,r){return c(e),e<=0?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)}(e,t,r)},s.allocUnsafe=function(e){return u(e)},s.allocUnsafeSlow=function(e){return u(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(F(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),F(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},s.isEncoding=function(e){switch(String(e).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}},s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=s.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(F(o,Uint8Array)&&(o=s.from(o)),!s.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},s.byteLength=p,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)h(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)h(this,t,t+3),h(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)h(this,t,t+7),h(this,t+1,t+6),h(this,t+2,t+5),h(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?k(this,0,e):function(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return C(this,t,r);case"latin1":case"binary":return I(this,t,r);case"base64":return E(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s.prototype.compare=function(e,t,r,n,i){if(F(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+b(e));if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),c=Math.min(o,a),u=this.slice(n,i),l=e.slice(t,r),f=0;f<c;++f)if(u[f]!==l[f]){o=u[f],a=l[f];break}return o<a?-1:a<o?1:0},s.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},s.prototype.indexOf=function(e,t,r){return d(this,e,t,r,!0)},s.prototype.lastIndexOf=function(e,t,r){return d(this,e,t,r,!1)},s.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return g(this,e,t,r);case"utf8":case"utf-8":return y(this,e,t,r);case"ascii":return v(this,e,t,r);case"latin1":case"binary":return w(this,e,t,r);case"base64":return _(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function C(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function I(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function R(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=U(e[o]);return i}function x(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function A(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function O(e,t,r,n,i,o){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function P(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,i,o){return t=+t,r>>>=0,o||P(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function j(e,t,r,i,o){return t=+t,r>>>=0,o||P(e,0,r,8),n.write(e,t,r,i,52,8),r+8}s.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return n.__proto__=s.prototype,n},s.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},s.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},s.prototype.readUInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||A(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||A(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},s.prototype.readInt8=function(e,t){return e>>>=0,t||A(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||A(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){e>>>=0,t||A(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||A(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||A(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||A(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||A(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||A(e,8,this.length),n.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||O(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},s.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||O(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},s.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);O(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);O(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||O(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return j(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return j(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var o=i-1;o>=0;--o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},s.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var a=s.isBuffer(e)?e:s.from(e,n),c=a.length;if(0===c)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=a[o%c]}return this};var N=/[^+/0-9A-Za-z-_]/g;function U(e){return e<16?"0"+e.toString(16):e.toString(16)}function M(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function B(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(N,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function F(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function D(e){return e!=e}}).call(this)}).call(this,e("buffer").Buffer)},{"base64-js":10,buffer:14,ieee754:20}],15:[function(e,t,r){(function(n){(function(){r.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),this.useColors){var r="color: "+this.color;e.splice(1,0,r,"color: inherit");var n=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&"%c"===e&&(i=++n)})),e.splice(i,0,r)}},r.save=function(e){try{e?r.storage.setItem("debug",e):r.storage.removeItem("debug")}catch(e){}},r.load=function(){var e;try{e=r.storage.getItem("debug")}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e},r.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("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+)/))},r.storage=function(){try{return localStorage}catch(e){}}(),r.destroy=function(){var e=!1;return function(){e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}}(),r.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"],r.log=console.debug||console.log||function(){},t.exports=e("./common")(r),t.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this)}).call(this,e("_process"))},{"./common":16,_process:32}],16:[function(e,t,r){t.exports=function(t){function r(e){var t,i=null;function o(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];if(o.enabled){var s=o,a=Number(new Date),c=a-(t||a);s.diff=c,s.prev=t,s.curr=a,t=a,n[0]=r.coerce(n[0]),"string"!=typeof n[0]&&n.unshift("%O");var u=0;n[0]=n[0].replace(/%([a-zA-Z%])/g,(function(e,t){if("%%"===e)return"%";u++;var i=r.formatters[t];if("function"==typeof i){var o=n[u];e=i.call(s,o),n.splice(u,1),u--}return e})),r.formatArgs.call(s,n),(s.log||r.log).apply(s,n)}}return o.namespace=e,o.useColors=r.useColors(),o.color=r.selectColor(e),o.extend=n,o.destroy=r.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:function(){return null===i?r.enabled(e):i},set:function(e){i=e}}),"function"==typeof r.init&&r.init(o),o}function n(e,t){var n=r(this.namespace+(void 0===t?":":t)+e);return n.log=this.log,n}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return r.debug=r,r.default=r,r.coerce=function(e){return e instanceof Error?e.stack||e.message:e},r.disable=function(){var e=[].concat(a(r.names.map(i)),a(r.skips.map(i).map((function(e){return"-"+e})))).join(",");return r.enable(""),e},r.enable=function(e){var t;r.save(e),r.names=[],r.skips=[];var n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(t=0;t<i;t++)n[t]&&("-"===(e=n[t].replace(/\*/g,".*?"))[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")))},r.enabled=function(e){if("*"===e[e.length-1])return!0;var t,n;for(t=0,n=r.skips.length;t<n;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;t<n;t++)if(r.names[t].test(e))return!0;return!1},r.humanize=e("ms"),r.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach((function(e){r[e]=t[e]})),r.names=[],r.skips=[],r.formatters={},r.selectColor=function(e){for(var t=0,n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return r.colors[Math.abs(t)%r.colors.length]},r.enable(r.load()),r}},{ms:29}],17:[function(e,t,r){(function(r,n){(function(){var i=e("readable-stream"),o=e("end-of-stream"),s=e("inherits"),a=e("stream-shift"),c=n.from&&n.from!==Uint8Array.from?n.from([0]):new n([0]),u=function(e,t){e._corked?e.once("uncork",t):t()},l=function(e,t){return function(r){r?function(e,t){e._autoDestroy&&e.destroy(t)}(e,"premature close"===r.message?null:r):t&&!e._ended&&e.end()}},f=function(){},p=function e(t,r,n){if(!(this instanceof e))return new e(t,r,n);i.Duplex.call(this,n),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!n||!1!==n.autoDestroy,this._forwardDestroy=!n||!1!==n.destroy,this._forwardEnd=!n||!1!==n.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),r&&this.setReadable(r)};s(p,i.Duplex),p.obj=function(e,t,r){return r||(r={}),r.objectMode=!0,r.highWaterMark=16,new p(e,t,r)},p.prototype.cork=function(){1==++this._corked&&this.emit("cork")},p.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},p.prototype.setWritable=function(e){if(this._unwrite&&this._unwrite(),this.destroyed)e&&e.destroy&&e.destroy();else if(null!==e&&!1!==e){var t=this,n=o(e,{writable:!0,readable:!1},l(this,this._forwardEnd)),i=function(){var e=t._ondrain;t._ondrain=null,e&&e()};this._unwrite&&r.nextTick(i),this._writable=e,this._writable.on("drain",i),this._unwrite=function(){t._writable.removeListener("drain",i),n()},this.uncork()}else this.end()},p.prototype.setReadable=function(e){if(this._unread&&this._unread(),this.destroyed)e&&e.destroy&&e.destroy();else{if(null===e||!1===e)return this.push(null),void this.resume();var t,r=this,n=o(e,{writable:!1,readable:!0},l(this)),s=function(){r._forward()},a=function(){r.push(null)};this._drained=!0,this._readable=e,this._readable2=e._readableState?e:(t=e,new i.Readable({objectMode:!0,highWaterMark:16}).wrap(t)),this._readable2.on("readable",s),this._readable2.on("end",a),this._unread=function(){r._readable2.removeListener("readable",s),r._readable2.removeListener("end",a),n()},this._forward()}},p.prototype._read=function(){this._drained=!0,this._forward()},p.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var e;for(this._forwarding=!0;this._drained&&null!==(e=a(this._readable2));)this.destroyed||(this._drained=this.push(e));this._forwarding=!1}},p.prototype.destroy=function(e,t){if(t||(t=f),this.destroyed)return t(null);this.destroyed=!0;var n=this;r.nextTick((function(){n._destroy(e),t(null)}))},p.prototype._destroy=function(e){if(e){var t=this._ondrain;this._ondrain=null,t?t(e):this.emit("error",e)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},p.prototype._write=function(e,t,r){if(!this.destroyed)return this._corked?u(this,this._write.bind(this,e,t,r)):e===c?this._finish(r):this._writable?void(!1===this._writable.write(e)?this._ondrain=r:this.destroyed||r()):r()},p.prototype._finish=function(e){var t=this;this.emit("preend"),u(this,(function(){var r,n;n=function(){!1===t._writableState.prefinished&&(t._writableState.prefinished=!0),t.emit("prefinish"),u(t,e)},(r=t._forwardEnd&&t._writable)?r._writableState&&r._writableState.finished?n():r._writableState?r.end(n):(r.end(),n()):n()}))},p.prototype.end=function(e,t,r){return"function"==typeof e?this.end(null,null,e):"function"==typeof t?this.end(e,null,t):(this._ended=!0,e&&this.write(e),this._writableState.ending||this.write(c),i.Writable.prototype.end.call(this,r))},t.exports=p}).call(this)}).call(this,e("_process"),e("buffer").Buffer)},{_process:32,buffer:14,"end-of-stream":18,inherits:21,"readable-stream":51,"stream-shift":54}],18:[function(e,t,r){(function(r){(function(){var n=e("once"),i=function(){};t.exports=function e(t,o,s){if("function"==typeof o)return e(t,null,o);o||(o={}),s=n(s||i);var a=t._writableState,c=t._readableState,u=o.readable||!1!==o.readable&&t.readable,l=o.writable||!1!==o.writable&&t.writable,f=!1,p=function(){t.writable||h()},h=function(){l=!1,u||s.call(t)},d=function(){u=!1,l||s.call(t)},m=function(e){s.call(t,e?new Error("exited with error code: "+e):null)},g=function(e){s.call(t,e)},y=function(){r.nextTick(v)},v=function(){if(!f)return(!u||c&&c.ended&&!c.destroyed)&&(!l||a&&a.ended&&!a.destroyed)?void 0:s.call(t,new Error("premature close"))},b=function(){t.req.on("finish",h)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",h),t.on("abort",y),t.req?b():t.on("request",b)):l&&!a&&(t.on("end",p),t.on("close",p)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(t)&&t.on("exit",m),t.on("end",d),t.on("finish",h),!1!==o.error&&t.on("error",g),t.on("close",y),function(){f=!0,t.removeListener("complete",h),t.removeListener("abort",y),t.removeListener("request",b),t.req&&t.req.removeListener("finish",h),t.removeListener("end",p),t.removeListener("close",p),t.removeListener("finish",h),t.removeListener("exit",m),t.removeListener("end",d),t.removeListener("error",g),t.removeListener("close",y)}}}).call(this)}).call(this,e("_process"))},{_process:32,once:30}],19:[function(e,t,r){var n=Object.create||function(e){var t=function(){};return t.prototype=e,new t},i=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return r},o=Function.prototype.bind||function(e){var t=this;return function(){return t.apply(e,arguments)}};function s(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=n(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=s,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._maxListeners=void 0;var a,c=10;try{var u={};Object.defineProperty&&Object.defineProperty(u,"x",{value:0}),a=0===u.x}catch(e){a=!1}function l(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function f(e,t,r,i){var o,s,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((s=e._events)?(s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),a=s[t]):(s=e._events=n(null),e._eventsCount=0),a){if("function"==typeof a?a=s[t]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),!a.warned&&(o=l(e))&&o>0&&a.length>o){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,"object"==("undefined"==typeof console?"undefined":b(console))&&console.warn&&console.warn("%s: %s",c.name,c.message)}}else a=s[t]=r,++e._eventsCount;return e}function p(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function h(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=o.call(p,n);return i.listener=r,n.wrapFn=i,i}function d(e,t,r){var n=e._events;if(!n)return[];var i=n[t];return i?"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):g(i,i.length):[]}function m(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function g(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}a?Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');c=e}}):s.defaultMaxListeners=c,s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(e){var t,r,n,i,o,s,a="error"===e;if(s=this._events)a=a&&null==s.error;else if(!a)return!1;if(a){if(arguments.length>1&&(t=arguments[1]),t instanceof Error)throw t;var c=new Error('Unhandled "error" event. ('+t+")");throw c.context=t,c}if(!(r=s[e]))return!1;var u="function"==typeof r;switch(n=arguments.length){case 1:!function(e,t,r){if(t)e.call(r);else for(var n=e.length,i=g(e,n),o=0;o<n;++o)i[o].call(r)}(r,u,this);break;case 2:!function(e,t,r,n){if(t)e.call(r,n);else for(var i=e.length,o=g(e,i),s=0;s<i;++s)o[s].call(r,n)}(r,u,this,arguments[1]);break;case 3:!function(e,t,r,n,i){if(t)e.call(r,n,i);else for(var o=e.length,s=g(e,o),a=0;a<o;++a)s[a].call(r,n,i)}(r,u,this,arguments[1],arguments[2]);break;case 4:!function(e,t,r,n,i,o){if(t)e.call(r,n,i,o);else for(var s=e.length,a=g(e,s),c=0;c<s;++c)a[c].call(r,n,i,o)}(r,u,this,arguments[1],arguments[2],arguments[3]);break;default:for(i=new Array(n-1),o=1;o<n;o++)i[o-1]=arguments[o];!function(e,t,r,n){if(t)e.apply(r,n);else for(var i=e.length,o=g(e,i),s=0;s<i;++s)o[s].apply(r,n)}(r,u,this,i)}return!0},s.prototype.addListener=function(e,t){return f(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return f(this,e,t,!0)},s.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,h(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,h(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,i,o,s,a;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(i=this._events))return this;if(!(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=n(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){a=r[s].listener,o=s;break}if(o<0)return this;0===o?r.shift():function(e,t){for(var r=t,n=r+1,i=e.length;n<i;r+=1,n+=1)e[r]=e[n];e.pop()}(r,o),1===r.length&&(i[e]=r[0]),i.removeListener&&this.emit("removeListener",e,a||t)}return this},s.prototype.removeAllListeners=function(e){var t,r,o;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=n(null),this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=n(null):delete r[e]),this;if(0===arguments.length){var s,a=i(r);for(o=0;o<a.length;++o)"removeListener"!==(s=a[o])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=n(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)for(o=t.length-1;o>=0;o--)this.removeListener(e,t[o]);return this},s.prototype.listeners=function(e){return d(this,e,!0)},s.prototype.rawListeners=function(e){return d(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},s.prototype.listenerCount=m,s.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],20:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,u=c>>1,l=-7,f=r?i-1:0,p=r?-1:1,h=e[t+f];for(f+=p,o=h&(1<<-l)-1,h>>=-l,l+=a;l>0;o=256*o+e[t+f],f+=p,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+f],f+=p,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,n),o-=u}return(h?-1:1)*s*Math.pow(2,o-n)},r.write=function(e,t,r,n,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,f=l>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,d=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+f>=1?p/c:p*Math.pow(2,1-f))*c>=2&&(s++,c/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*c-1)*Math.pow(2,i),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;e[r+h]=255&a,h+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[r+h]=255&s,h+=d,s/=256,u-=8);e[r+h-d]|=128*m}},{}],21:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},{}],22:[function(e,t,r){(function(e){(function(){var r=t.exports;for(var n in r.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"},r.codes={},r.types){var i=r.types[n];r.codes[i]=n}for(var o in r.CMD_SHIFT=4,r.CMD_MASK=240,r.DUP_MASK=8,r.QOS_MASK=3,r.QOS_SHIFT=1,r.RETAIN_MASK=1,r.VARBYTEINT_MASK=127,r.VARBYTEINT_FIN_MASK=128,r.VARBYTEINT_MAX=268435455,r.SESSIONPRESENT_MASK=1,r.SESSIONPRESENT_HEADER=e.from([r.SESSIONPRESENT_MASK]),r.CONNACK_HEADER=e.from([r.codes.connack<<r.CMD_SHIFT]),r.USERNAME_MASK=128,r.PASSWORD_MASK=64,r.WILL_RETAIN_MASK=32,r.WILL_QOS_MASK=24,r.WILL_QOS_SHIFT=3,r.WILL_FLAG_MASK=4,r.CLEAN_SESSION_MASK=2,r.CONNECT_HEADER=e.from([r.codes.connect<<r.CMD_SHIFT]),r.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},r.propertiesCodes={},r.properties){var s=r.properties[o];r.propertiesCodes[s]=o}function a(t){return[0,1,2].map((function(n){return[0,1].map((function(i){return[0,1].map((function(o){var s=e.alloc(1);return s.writeUInt8(r.codes[t]<<r.CMD_SHIFT|(i?r.DUP_MASK:0)|n<<r.QOS_SHIFT|o,0,!0),s}))}))}))}r.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"},r.PUBLISH_HEADER=a("publish"),r.SUBSCRIBE_HEADER=a("subscribe"),r.SUBSCRIBE_OPTIONS_QOS_MASK=3,r.SUBSCRIBE_OPTIONS_NL_MASK=1,r.SUBSCRIBE_OPTIONS_NL_SHIFT=2,r.SUBSCRIBE_OPTIONS_RAP_MASK=1,r.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,r.SUBSCRIBE_OPTIONS_RH_MASK=3,r.SUBSCRIBE_OPTIONS_RH_SHIFT=4,r.SUBSCRIBE_OPTIONS_RH=[0,16,32],r.SUBSCRIBE_OPTIONS_NL=4,r.SUBSCRIBE_OPTIONS_RAP=8,r.SUBSCRIBE_OPTIONS_QOS=[0,1,2],r.UNSUBSCRIBE_HEADER=a("unsubscribe"),r.ACKS={unsuback:a("unsuback"),puback:a("puback"),pubcomp:a("pubcomp"),pubrel:a("pubrel"),pubrec:a("pubrec")},r.SUBACK_HEADER=e.from([r.codes.suback<<r.CMD_SHIFT]),r.VERSION3=e.from([3]),r.VERSION4=e.from([4]),r.VERSION5=e.from([5]),r.VERSION131=e.from([131]),r.VERSION132=e.from([132]),r.QOS=[0,1,2].map((function(t){return e.from([t])})),r.EMPTY={pingreq:e.from([r.codes.pingreq<<4,0]),pingresp:e.from([r.codes.pingresp<<4,0]),disconnect:e.from([r.codes.disconnect<<4,0])}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:14}],23:[function(e,t,r){(function(r){(function(){var n=e("./writeToStream"),i=function(e){h(n,e);var t=m(n);function n(){var e;return l(this,n),(e=t.call(this))._array=new Array(20),e._i=0,e}return p(n,[{key:"write",value:function(e){return this._array[this._i++]=e,!0}},{key:"concat",value:function(){var e,t=0,n=new Array(this._array.length),i=this._array,o=0;for(e=0;e<i.length&&void 0!==i[e];e++)"string"!=typeof i[e]?n[e]=i[e].length:n[e]=r.byteLength(i[e]),t+=n[e];var s=r.allocUnsafe(t);for(e=0;e<i.length&&void 0!==i[e];e++)"string"!=typeof i[e]?(i[e].copy(s,o),o+=n[e]):(s.write(i[e],o),o+=n[e]);return s}}]),n}(e("events"));t.exports=function(e,t){var r=new i;return n(e,r,t),r.concat()}}).call(this)}).call(this,e("buffer").Buffer)},{"./writeToStream":28,buffer:14,events:19}],24:[function(e,t,r){r.parser=e("./parser").parser,r.generate=e("./generate"),r.writeToStream=e("./writeToStream")},{"./generate":23,"./parser":27,"./writeToStream":28}],25:[function(e,t,r){(function(e){(function(){var r={},n=e.isBuffer(e.from([1,2]).subarray(0,1));function i(t){var r=e.allocUnsafe(2);return r.writeUInt8(t>>8,0),r.writeUInt8(255&t,1),r}t.exports={cache:r,generateCache:function(){for(var e=0;e<65536;e++)r[e]=i(e)},generateNumber:i,genBufVariableByteInt:function(t){var r=0,i=0,o=e.allocUnsafe(4);do{r=t%128|0,(t=t/128|0)>0&&(r|=128),o.writeUInt8(r,i++)}while(t>0&&i<4);return t>0&&(i=0),n?o.subarray(0,i):o.slice(0,i)},generate4ByteBuffer:function(t){var r=e.allocUnsafe(4);return r.writeUInt32BE(t,0),r}}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:14}],26:[function(e,t,r){t.exports=function e(){l(this,e),this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}},{}],27:[function(e,t,r){var n=e("bl"),i=e("events"),o=e("./packet"),s=e("./constants"),a=e("debug")("mqtt-packet:parser"),c=function(e){h(r,e);var t=m(r);function r(){var e;return l(this,r),(e=t.call(this)).parser=e.constructor.parser,e}return p(r,[{key:"_resetState",value:function(){a("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new o,this.error=null,this._list=n(),this._stateCounter=0}},{key:"parse",value:function(e){for(this.error&&this._resetState(),this._list.append(e),a("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++,a("parse: state complete. _stateCounter is now: %d",this._stateCounter),a("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return a("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}},{key:"_parseHeader",value:function(){var e=this._list.readUInt8(0);return this.packet.cmd=s.types[e>>s.CMD_SHIFT],this.packet.retain=0!=(e&s.RETAIN_MASK),this.packet.qos=e>>s.QOS_SHIFT&s.QOS_MASK,this.packet.dup=0!=(e&s.DUP_MASK),a("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}},{key:"_parseLength",value:function(){var e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),a("_parseLength %d",e.value),!!e}},{key:"_parsePayload",value:function(){a("_parsePayload: payload %O",this._list);var e=!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"))}e=!0}return a("_parsePayload complete result: %s",e),e}},{key:"_parseConnect",value:function(){var e,t,r,n;a("_parseConnect");var i={},o=this.packet,c=this._parseString();if(null===c)return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==c&&"MQIsdp"!==c)return this._emitError(new Error("Invalid protocolId"));if(o.protocolId=c,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(o.protocolVersion=this._list.readUInt8(this._pos),o.protocolVersion>=128&&(o.bridgeMode=!0,o.protocolVersion=o.protocolVersion-128),3!==o.protocolVersion&&4!==o.protocolVersion&&5!==o.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(i.username=this._list.readUInt8(this._pos)&s.USERNAME_MASK,i.password=this._list.readUInt8(this._pos)&s.PASSWORD_MASK,i.will=this._list.readUInt8(this._pos)&s.WILL_FLAG_MASK,i.will&&(o.will={},o.will.retain=0!=(this._list.readUInt8(this._pos)&s.WILL_RETAIN_MASK),o.will.qos=(this._list.readUInt8(this._pos)&s.WILL_QOS_MASK)>>s.WILL_QOS_SHIFT),o.clean=0!=(this._list.readUInt8(this._pos)&s.CLEAN_SESSION_MASK),this._pos++,o.keepalive=this._parseNum(),-1===o.keepalive)return this._emitError(new Error("Packet too short"));if(5===o.protocolVersion){var u=this._parseProperties();Object.getOwnPropertyNames(u).length&&(o.properties=u)}var l=this._parseString();if(null===l)return this._emitError(new Error("Packet too short"));if(o.clientId=l,a("_parseConnect: packet.clientId: %s",o.clientId),i.will){if(5===o.protocolVersion){var f=this._parseProperties();Object.getOwnPropertyNames(f).length&&(o.will.properties=f)}if(null===(e=this._parseString()))return this._emitError(new Error("Cannot parse will topic"));if(o.will.topic=e,a("_parseConnect: packet.will.topic: %s",o.will.topic),null===(t=this._parseBuffer()))return this._emitError(new Error("Cannot parse will payload"));o.will.payload=t,a("_parseConnect: packet.will.paylaod: %s",o.will.payload)}if(i.username){if(null===(n=this._parseString()))return this._emitError(new Error("Cannot parse username"));o.username=n,a("_parseConnect: packet.username: %s",o.username)}if(i.password){if(null===(r=this._parseBuffer()))return this._emitError(new Error("Cannot parse password"));o.password=r}return this.settings=o,a("_parseConnect: complete"),o}},{key:"_parseConnack",value:function(){a("_parseConnack");var e=this.packet;if(this._list.length<1)return null;if(e.sessionPresent=!!(this._list.readUInt8(this._pos++)&s.SESSIONPRESENT_MASK),5===this.settings.protocolVersion)this._list.length>=2?e.reasonCode=this._list.readUInt8(this._pos++):e.reasonCode=0;else{if(this._list.length<2)return null;e.returnCode=this._list.readUInt8(this._pos++)}if(-1===e.returnCode||-1===e.reasonCode)return this._emitError(new Error("Cannot parse return code"));if(5===this.settings.protocolVersion){var t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}a("_parseConnack: complete")}},{key:"_parsePublish",value:function(){a("_parsePublish");var e=this.packet;if(e.topic=this._parseString(),null===e.topic)return this._emitError(new Error("Cannot parse topic"));if(!(e.qos>0)||this._parseMessageId()){if(5===this.settings.protocolVersion){var t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}e.payload=this._list.slice(this._pos,e.length),a("_parsePublish: payload from buffer list: %o",e.payload)}}},{key:"_parseSubscribe",value:function(){a("_parseSubscribe");var e,t,r,n,i,o,c,u=this.packet;if(1!==u.qos)return this._emitError(new Error("Wrong subscribe header"));if(u.subscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){var l=this._parseProperties();Object.getOwnPropertyNames(l).length&&(u.properties=l)}for(;this._pos<u.length;){if(null===(e=this._parseString()))return this._emitError(new Error("Cannot parse topic"));if(this._pos>=u.length)return this._emitError(new Error("Malformed Subscribe Payload"));r=(t=this._parseByte())&s.SUBSCRIBE_OPTIONS_QOS_MASK,o=0!=(t>>s.SUBSCRIBE_OPTIONS_NL_SHIFT&s.SUBSCRIBE_OPTIONS_NL_MASK),i=0!=(t>>s.SUBSCRIBE_OPTIONS_RAP_SHIFT&s.SUBSCRIBE_OPTIONS_RAP_MASK),n=t>>s.SUBSCRIBE_OPTIONS_RH_SHIFT&s.SUBSCRIBE_OPTIONS_RH_MASK,c={topic:e,qos:r},5===this.settings.protocolVersion?(c.nl=o,c.rap=i,c.rh=n):this.settings.bridgeMode&&(c.rh=0,c.rap=!0,c.nl=!0),a("_parseSubscribe: push subscription `%s` to subscription",c),u.subscriptions.push(c)}}}},{key:"_parseSuback",value:function(){a("_parseSuback");var e=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(5===this.settings.protocolVersion){var t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}},{key:"_parseUnsubscribe",value:function(){a("_parseUnsubscribe");var e=this.packet;if(e.unsubscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){var t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<e.length;){var r=this._parseString();if(null===r)return this._emitError(new Error("Cannot parse topic"));a("_parseUnsubscribe: push topic `%s` to unsubscriptions",r),e.unsubscriptions.push(r)}}}},{key:"_parseUnsuback",value:function(){a("_parseUnsuback");var e=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(5===this.settings.protocolVersion){var t=this._parseProperties();for(Object.getOwnPropertyNames(t).length&&(e.properties=t),e.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}},{key:"_parseConfirmation",value:function(){a("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);var e=this.packet;if(this._parseMessageId(),5===this.settings.protocolVersion&&(e.length>2?(e.reasonCode=this._parseByte(),a("_parseConfirmation: packet.reasonCode `%d`",e.reasonCode)):e.reasonCode=0,e.length>3)){var t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return!0}},{key:"_parseDisconnect",value:function(){var e=this.packet;if(a("_parseDisconnect"),5===this.settings.protocolVersion){this._list.length>0?e.reasonCode=this._parseByte():e.reasonCode=0;var t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return a("_parseDisconnect result: true"),!0}},{key:"_parseAuth",value:function(){a("_parseAuth");var e=this.packet;if(5!==this.settings.protocolVersion)return this._emitError(new Error("Not supported auth packet for this version MQTT"));e.reasonCode=this._parseByte();var t=this._parseProperties();return Object.getOwnPropertyNames(t).length&&(e.properties=t),a("_parseAuth: result: true"),!0}},{key:"_parseMessageId",value:function(){var e=this.packet;return e.messageId=this._parseNum(),null===e.messageId?(this._emitError(new Error("Cannot parse messageId")),!1):(a("_parseMessageId: packet.messageId %d",e.messageId),!0)}},{key:"_parseString",value:function(e){var t=this._parseNum(),r=t+this._pos;if(-1===t||r>this._list.length||r>this.packet.length)return null;var n=this._list.toString("utf8",this._pos,r);return this._pos+=t,a("_parseString: result: %s",n),n}},{key:"_parseStringPair",value:function(){return a("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}},{key:"_parseBuffer",value:function(){var e=this._parseNum(),t=e+this._pos;if(-1===e||t>this._list.length||t>this.packet.length)return null;var r=this._list.slice(this._pos,t);return this._pos+=e,a("_parseBuffer: result: %o",r),r}},{key:"_parseNum",value:function(){if(this._list.length-this._pos<2)return-1;var e=this._list.readUInt16BE(this._pos);return this._pos+=2,a("_parseNum: result: %s",e),e}},{key:"_parse4ByteNum",value:function(){if(this._list.length-this._pos<4)return-1;var e=this._list.readUInt32BE(this._pos);return this._pos+=4,a("_parse4ByteNum: result: %s",e),e}},{key:"_parseVarByteNum",value:function(e){a("_parseVarByteNum");for(var t,r=0,n=1,i=0,o=!1,c=this._pos?this._pos:0;r<4&&c+r<this._list.length;){if(i+=n*((t=this._list.readUInt8(c+r++))&s.VARBYTEINT_MASK),n*=128,0==(t&s.VARBYTEINT_FIN_MASK)){o=!0;break}if(this._list.length<=r)break}return!o&&4===r&&this._list.length>=r&&this._emitError(new Error("Invalid variable byte integer")),c&&(this._pos+=r),a("_parseVarByteNum: result: %o",o=!!o&&(e?{bytes:r,value:i}:i)),o}},{key:"_parseByte",value:function(){var e;return this._pos<this._list.length&&(e=this._list.readUInt8(this._pos),this._pos++),a("_parseByte: result: %o",e),e}},{key:"_parseByType",value:function(e){switch(a("_parseByType: type: %s",e),e){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()}}},{key:"_parseProperties",value:function(){a("_parseProperties");for(var e=this._parseVarByteNum(),t=this._pos+e,r={};this._pos<t;){var n=this._parseByte();if(!n)return this._emitError(new Error("Cannot parse property code type")),!1;var i=s.propertiesCodes[n];if(!i)return this._emitError(new Error("Unknown property")),!1;if("userProperties"!==i)r[i]?(Array.isArray(r[i])||(r[i]=[r[i]]),r[i].push(this._parseByType(s.propertiesTypes[i]))):r[i]=this._parseByType(s.propertiesTypes[i]);else{r[i]||(r[i]=Object.create(null));var o=this._parseByType(s.propertiesTypes[i]);if(r[i][o.name])if(Array.isArray(r[i][o.name]))r[i][o.name].push(o.value);else{var c=r[i][o.name];r[i][o.name]=[c],r[i][o.name].push(o.value)}else r[i][o.name]=o.value}}return r}},{key:"_newPacket",value:function(){return a("_newPacket"),this.packet&&(this._list.consume(this.packet.length),a("_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)),a("_newPacket: new packet"),this.packet=new o,this._pos=0,!0}},{key:"_emitError",value:function(e){a("_emitError"),this.error=e,this.emit("error",e)}}],[{key:"parser",value:function(e){return this instanceof r?(this.settings=e||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):(new r).parser(e)}}]),r}(i);t.exports=c},{"./constants":22,"./packet":26,bl:12,debug:15,events:19}],28:[function(e,t,r){(function(r){(function(){var n=e("./constants"),i=r.allocUnsafe(0),o=r.from([0]),s=e("./numbers"),a=e("process-nextick-args").nextTick,u=e("debug")("mqtt-packet:writeToStream"),l=s.cache,f=s.generateNumber,p=s.generateCache,h=s.genBufVariableByteInt,d=s.generate4ByteBuffer,m=k,g=!0;function y(e,t,s){switch(u("generate called"),t.cork&&(t.cork(),a(v,t)),g&&(g=!1,p()),u("generate: packet.cmd: %s",e.cmd),e.cmd){case"connect":return function(e,t,i){var o=e||{},s=o.protocolId||"MQTT",a=o.protocolVersion||4,c=o.will,u=o.clean,l=o.keepalive||0,f=o.clientId||"",p=o.username,h=o.password,d=o.properties;void 0===u&&(u=!0);var g=0;if(!s||"string"!=typeof s&&!r.isBuffer(s))return t.emit("error",new Error("Invalid protocolId")),!1;if(g+=s.length+2,3!==a&&4!==a&&5!==a)return t.emit("error",new Error("Invalid protocol version")),!1;if(g+=1,("string"==typeof f||r.isBuffer(f))&&(f||a>=4)&&(f||u))g+=r.byteLength(f)+2;else{if(a<4)return t.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*u==0)return t.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if("number"!=typeof l||l<0||l>65535||l%1!=0)return t.emit("error",new Error("Invalid keepalive")),!1;if(g+=2,g+=1,5===a){var y=I(t,d);if(!y)return!1;g+=y.length}if(c){if("object"!=b(c))return t.emit("error",new Error("Invalid will")),!1;if(!c.topic||"string"!=typeof c.topic)return t.emit("error",new Error("Invalid will topic")),!1;if(g+=r.byteLength(c.topic)+2,g+=2,c.payload){if(!(c.payload.length>=0))return t.emit("error",new Error("Invalid will payload")),!1;"string"==typeof c.payload?g+=r.byteLength(c.payload):g+=c.payload.length}var v={};if(5===a){if(!(v=I(t,c.properties)))return!1;g+=v.length}}var w=!1;if(null!=p){if(!P(p))return t.emit("error",new Error("Invalid username")),!1;w=!0,g+=r.byteLength(p)+2}if(null!=h){if(!w)return t.emit("error",new Error("Username is required to use password")),!1;if(!P(h))return t.emit("error",new Error("Invalid password")),!1;g+=O(h)+2}t.write(n.CONNECT_HEADER),_(t,g),C(t,s),o.bridgeMode&&(a+=128),t.write(131===a?n.VERSION131:132===a?n.VERSION132:4===a?n.VERSION4:5===a?n.VERSION5:n.VERSION3);var E=0;return E|=null!=p?n.USERNAME_MASK:0,E|=null!=h?n.PASSWORD_MASK:0,E|=c&&c.retain?n.WILL_RETAIN_MASK:0,E|=c&&c.qos?c.qos<<n.WILL_QOS_SHIFT:0,E|=c?n.WILL_FLAG_MASK:0,E|=u?n.CLEAN_SESSION_MASK:0,t.write(r.from([E])),m(t,l),5===a&&y.write(),C(t,f),c&&(5===a&&v.write(),S(t,c.topic),C(t,c.payload)),null!=p&&C(t,p),null!=h&&C(t,h),!0}(e,t);case"connack":return function(e,t,i){var s=i?i.protocolVersion:4,a=e||{},c=5===s?a.reasonCode:a.returnCode,u=a.properties,l=2;if("number"!=typeof c)return t.emit("error",new Error("Invalid return code")),!1;var f=null;if(5===s){if(!(f=I(t,u)))return!1;l+=f.length}return t.write(n.CONNACK_HEADER),_(t,l),t.write(a.sessionPresent?n.SESSIONPRESENT_HEADER:o),t.write(r.from([c])),null!=f&&f.write(),!0}(e,t,s);case"publish":return function(e,t,o){u("publish: packet: %o",e);var s=o?o.protocolVersion:4,a=e||{},c=a.qos||0,l=a.retain?n.RETAIN_MASK:0,f=a.topic,p=a.payload||i,h=a.messageId,d=a.properties,g=0;if("string"==typeof f)g+=r.byteLength(f)+2;else{if(!r.isBuffer(f))return t.emit("error",new Error("Invalid topic")),!1;g+=f.length+2}if(r.isBuffer(p)?g+=p.length:g+=r.byteLength(p),c&&"number"!=typeof h)return t.emit("error",new Error("Invalid messageId")),!1;c&&(g+=2);var y=null;if(5===s){if(!(y=I(t,d)))return!1;g+=y.length}return t.write(n.PUBLISH_HEADER[c][a.dup?1:0][l?1:0]),_(t,g),m(t,O(f)),t.write(f),c>0&&m(t,h),null!=y&&y.write(),u("publish: payload: %o",p),t.write(p)}(e,t,s);case"puback":case"pubrec":case"pubrel":case"pubcomp":return function(e,t,i){var o=i?i.protocolVersion:4,s=e||{},a=s.cmd||"puback",c=s.messageId,u=s.dup&&"pubrel"===a?n.DUP_MASK:0,l=0,f=s.reasonCode,p=s.properties,h=5===o?3:2;if("pubrel"===a&&(l=1),"number"!=typeof c)return t.emit("error",new Error("Invalid messageId")),!1;var d=null;if(5===o&&"object"==b(p)){if(!(d=R(t,p,i,h)))return!1;h+=d.length}return t.write(n.ACKS[a][l][u][0]),_(t,h),m(t,c),5===o&&t.write(r.from([f])),null!==d&&d.write(),!0}(e,t,s);case"subscribe":return function(e,t,i){u("subscribe: packet: ");var o=i?i.protocolVersion:4,s=e||{},a=s.dup?n.DUP_MASK:0,l=s.messageId,f=s.subscriptions,p=s.properties,h=0;if("number"!=typeof l)return t.emit("error",new Error("Invalid messageId")),!1;h+=2;var d=null;if(5===o){if(!(d=I(t,p)))return!1;h+=d.length}if("object"!=b(f)||!f.length)return t.emit("error",new Error("Invalid subscriptions")),!1;for(var g=0;g<f.length;g+=1){var y=f[g].topic,v=f[g].qos;if("string"!=typeof y)return t.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if("number"!=typeof v)return t.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(5===o){if("boolean"!=typeof(f[g].nl||!1))return t.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if("boolean"!=typeof(f[g].rap||!1))return t.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;var w=f[g].rh||0;if("number"!=typeof w||w>2)return t.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}h+=r.byteLength(y)+2+1}u("subscribe: writing to stream: %o",n.SUBSCRIBE_HEADER),t.write(n.SUBSCRIBE_HEADER[1][a?1:0][0]),_(t,h),m(t,l),null!==d&&d.write();var E,k=!0,T=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=c(e))){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}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 o,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}(f);try{for(T.s();!(E=T.n()).done;){var C=E.value,R=C.topic,x=C.qos,A=+C.nl,O=+C.rap,P=C.rh,L=void 0;S(t,R),L=n.SUBSCRIBE_OPTIONS_QOS[x],5===o&&(L|=A?n.SUBSCRIBE_OPTIONS_NL:0,L|=O?n.SUBSCRIBE_OPTIONS_RAP:0,L|=P?n.SUBSCRIBE_OPTIONS_RH[P]:0),k=t.write(r.from([L]))}}catch(e){T.e(e)}finally{T.f()}return k}(e,t,s);case"suback":return function(e,t,i){var o=i?i.protocolVersion:4,s=e||{},a=s.messageId,c=s.granted,u=s.properties,l=0;if("number"!=typeof a)return t.emit("error",new Error("Invalid messageId")),!1;if(l+=2,"object"!=b(c)||!c.length)return t.emit("error",new Error("Invalid qos vector")),!1;for(var f=0;f<c.length;f+=1){if("number"!=typeof c[f])return t.emit("error",new Error("Invalid qos vector")),!1;l+=1}var p=null;if(5===o){if(!(p=R(t,u,i,l)))return!1;l+=p.length}return t.write(n.SUBACK_HEADER),_(t,l),m(t,a),null!==p&&p.write(),t.write(r.from(c))}(e,t,s);case"unsubscribe":return function(e,t,i){var o=i?i.protocolVersion:4,s=e||{},a=s.messageId,c=s.dup?n.DUP_MASK:0,u=s.unsubscriptions,l=s.properties,f=0;if("number"!=typeof a)return t.emit("error",new Error("Invalid messageId")),!1;if(f+=2,"object"!=b(u)||!u.length)return t.emit("error",new Error("Invalid unsubscriptions")),!1;for(var p=0;p<u.length;p+=1){if("string"!=typeof u[p])return t.emit("error",new Error("Invalid unsubscriptions")),!1;f+=r.byteLength(u[p])+2}var h=null;if(5===o){if(!(h=I(t,l)))return!1;f+=h.length}t.write(n.UNSUBSCRIBE_HEADER[1][c?1:0][0]),_(t,f),m(t,a),null!==h&&h.write();for(var d=!0,g=0;g<u.length;g++)d=S(t,u[g]);return d}(e,t,s);case"unsuback":return function(e,t,i){var o=i?i.protocolVersion:4,s=e||{},a=s.messageId,c=s.dup?n.DUP_MASK:0,u=s.granted,l=s.properties,f=s.cmd,p=2;if("number"!=typeof a)return t.emit("error",new Error("Invalid messageId")),!1;if(5===o){if("object"!=b(u)||!u.length)return t.emit("error",new Error("Invalid qos vector")),!1;for(var h=0;h<u.length;h+=1){if("number"!=typeof u[h])return t.emit("error",new Error("Invalid qos vector")),!1;p+=1}}var d=null;if(5===o){if(!(d=R(t,l,i,p)))return!1;p+=d.length}return t.write(n.ACKS[f][0][c][0]),_(t,p),m(t,a),null!==d&&d.write(),5===o&&t.write(r.from(u)),!0}(e,t,s);case"pingreq":case"pingresp":return function(e,t,r){return t.write(n.EMPTY[e.cmd])}(e,t);case"disconnect":return function(e,t,i){var o=i?i.protocolVersion:4,s=e||{},a=s.reasonCode,c=s.properties,u=5===o?1:0,l=null;if(5===o){if(!(l=R(t,c,i,u)))return!1;u+=l.length}return t.write(r.from([n.codes.disconnect<<4])),_(t,u),5===o&&t.write(r.from([a])),null!==l&&l.write(),!0}(e,t,s);case"auth":return function(e,t,i){var o=i?i.protocolVersion:4,s=e||{},a=s.reasonCode,c=s.properties,u=5===o?1:0;5!==o&&t.emit("error",new Error("Invalid mqtt version for auth packet"));var l=R(t,c,i,u);return!!l&&(u+=l.length,t.write(r.from([n.codes.auth<<4])),_(t,u),t.write(r.from([a])),null!==l&&l.write(),!0)}(e,t,s);default:return t.emit("error",new Error("Unknown command")),!1}}function v(e){e.uncork()}Object.defineProperty(y,"cacheNumbers",{get:function(){return m===k},set:function(e){e?(l&&0!==Object.keys(l).length||(g=!0),m=k):(g=!1,m=T)}});var w={};function _(e,t){if(t>n.VARBYTEINT_MAX)return e.emit("error",new Error("Invalid variable byte integer: ".concat(t))),!1;var r=w[t];return r||(r=h(t),t<16384&&(w[t]=r)),u("writeVarByteInt: writing to stream: %o",r),e.write(r)}function S(e,t){var n=r.byteLength(t);return m(e,n),u("writeString: %s",t),e.write(t,"utf8")}function E(e,t,r){S(e,t),S(e,r)}function k(e,t){return u("writeNumberCached: number: %d",t),u("writeNumberCached: %o",l[t]),e.write(l[t])}function T(e,t){var r=f(t);return u("writeNumberGenerated: %o",r),e.write(r)}function C(e,t){"string"==typeof t?S(e,t):t?(m(e,t.length),e.write(t)):m(e,0)}function I(e,t){if("object"!=b(t)||null!=t.length)return{length:1,write:function(){A(e,{},0)}};var i=0;function o(t,i){var o=0;switch(n.propertiesTypes[t]){case"byte":if("boolean"!=typeof i)return e.emit("error",new Error("Invalid ".concat(t,": ").concat(i))),!1;o+=2;break;case"int8":if("number"!=typeof i||i<0||i>255)return e.emit("error",new Error("Invalid ".concat(t,": ").concat(i))),!1;o+=2;break;case"binary":if(i&&null===i)return e.emit("error",new Error("Invalid ".concat(t,": ").concat(i))),!1;o+=1+r.byteLength(i)+2;break;case"int16":if("number"!=typeof i||i<0||i>65535)return e.emit("error",new Error("Invalid ".concat(t,": ").concat(i))),!1;o+=3;break;case"int32":if("number"!=typeof i||i<0||i>4294967295)return e.emit("error",new Error("Invalid ".concat(t,": ").concat(i))),!1;o+=5;break;case"var":if("number"!=typeof i||i<0||i>268435455)return e.emit("error",new Error("Invalid ".concat(t,": ").concat(i))),!1;o+=1+r.byteLength(h(i));break;case"string":if("string"!=typeof i)return e.emit("error",new Error("Invalid ".concat(t,": ").concat(i))),!1;o+=3+r.byteLength(i.toString());break;case"pair":if("object"!=b(i))return e.emit("error",new Error("Invalid ".concat(t,": ").concat(i))),!1;o+=Object.getOwnPropertyNames(i).reduce((function(e,t){var n=i[t];return Array.isArray(n)?e+=n.reduce((function(e,n){return e+(3+r.byteLength(t.toString())+2+r.byteLength(n.toString()))}),0):e+=3+r.byteLength(t.toString())+2+r.byteLength(i[t].toString()),e}),0);break;default:return e.emit("error",new Error("Invalid property ".concat(t,": ").concat(i))),!1}return o}if(t)for(var s in t){var a=0,c=0,u=t[s];if(Array.isArray(u))for(var l=0;l<u.length;l++){if(!(c=o(s,u[l])))return!1;a+=c}else{if(!(c=o(s,u)))return!1;a=c}if(!a)return!1;i+=a}return{length:r.byteLength(h(i))+i,write:function(){A(e,t,i)}}}function R(e,t,r,n){var i=["reasonString","userProperties"],o=r&&r.properties&&r.properties.maximumPacketSize?r.properties.maximumPacketSize:0,s=I(e,t);if(o)for(;n+s.length>o;){var a=i.shift();if(!a||!t[a])return!1;delete t[a],s=I(e,t)}return s}function x(e,t,i){switch(n.propertiesTypes[t]){case"byte":e.write(r.from([n.properties[t]])),e.write(r.from([+i]));break;case"int8":e.write(r.from([n.properties[t]])),e.write(r.from([i]));break;case"binary":e.write(r.from([n.properties[t]])),C(e,i);break;case"int16":e.write(r.from([n.properties[t]])),m(e,i);break;case"int32":e.write(r.from([n.properties[t]])),function(e,t){var r=d(t);u("write4ByteNumber: %o",r),e.write(r)}(e,i);break;case"var":e.write(r.from([n.properties[t]])),_(e,i);break;case"string":e.write(r.from([n.properties[t]])),S(e,i);break;case"pair":Object.getOwnPropertyNames(i).forEach((function(o){var s=i[o];Array.isArray(s)?s.forEach((function(i){e.write(r.from([n.properties[t]])),E(e,o.toString(),i.toString())})):(e.write(r.from([n.properties[t]])),E(e,o.toString(),s.toString()))}));break;default:return e.emit("error",new Error("Invalid property ".concat(t," value: ").concat(i))),!1}}function A(e,t,r){for(var n in _(e,r),t)if(Object.prototype.hasOwnProperty.call(t,n)&&null!==t[n]){var i=t[n];if(Array.isArray(i))for(var o=0;o<i.length;o++)x(e,n,i[o]);else x(e,n,i)}}function O(e){return e?e instanceof r?e.length:r.byteLength(e):0}function P(e){return"string"==typeof e||e instanceof r}t.exports=y}).call(this)}).call(this,e("buffer").Buffer)},{"./constants":22,"./numbers":25,buffer:14,debug:15,"process-nextick-args":31}],29:[function(e,t,r){var n=1e3,i=60*n,o=60*i,s=24*o;function a(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}t.exports=function(e,t){t=t||{};var r=b(e);if("string"===r&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*r;case"weeks":case"week":case"w":return 6048e5*r;case"days":case"day":case"d":return r*s;case"hours":case"hour":case"hrs":case"hr":case"h":return r*o;case"minutes":case"minute":case"mins":case"min":case"m":return r*i;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}(e);if("number"===r&&isFinite(e))return t.long?function(e){var t=Math.abs(e);return t>=s?a(e,t,s,"day"):t>=o?a(e,t,o,"hour"):t>=i?a(e,t,i,"minute"):t>=n?a(e,t,n,"second"):e+" ms"}(e):function(e){var t=Math.abs(e);return t>=s?Math.round(e/s)+"d":t>=o?Math.round(e/o)+"h":t>=i?Math.round(e/i)+"m":t>=n?Math.round(e/n)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],30:[function(e,t,r){var n=e("wrappy");function i(e){var t=function t(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function o(e){var t=function t(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},r=e.name||"Function wrapped with `once`";return t.onceError=r+" shouldn't be called more than once",t.called=!1,t}t.exports=n(i),t.exports.strict=n(o),i.proto=i((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})}))},{wrappy:59}],31:[function(e,t,r){(function(e){(function(){"use strict";void 0===e||!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,r,n,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick((function(){t.call(null,r)}));case 3:return e.nextTick((function(){t.call(null,r,n)}));case 4:return e.nextTick((function(){t.call(null,r,n,i)}));default:for(o=new Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return e.nextTick((function(){t.apply(null,o)}))}}}:t.exports=e}).call(this)}).call(this,e("_process"))},{_process:32}],32:[function(e,t,r){var n,i,o=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(e){i=a}}();var u,l=[],f=!1,p=-1;function h(){f&&u&&(f=!1,u.length?l=u.concat(l):p=-1,l.length&&d())}function d(){if(!f){var e=c(h);f=!0;for(var t=l.length;t;){for(u=l,l=[];++p<t;)u&&u[p].run();p=-1,t=l.length}u=null,f=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function g(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new m(e,t)),1!==l.length||f||c(d)},m.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=g,o.addListener=g,o.once=g,o.off=g,o.removeListener=g,o.removeAllListeners=g,o.emit=g,o.prependListener=g,o.prependOnceListener=g,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],33:[function(e,t,n){(function(e){(function(){!function(r){var i="object"==b(n)&&n&&!n.nodeType&&n,o="object"==b(t)&&t&&!t.nodeType&&t,s="object"==b(e)&&e;s.global!==s&&s.window!==s&&s.self!==s||(r=s);var a,c,u=2147483647,l=36,f=/^xn--/,p=/[^\x20-\x7E]/,h=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},m=Math.floor,g=String.fromCharCode;function y(e){throw new RangeError(d[e])}function v(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function w(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+v((e=e.replace(h,".")).split("."),t).join(".")}function _(e){for(var t,r,n=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}function S(e){return v(e,(function(e){var t="";return e>65535&&(t+=g((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+g(e)})).join("")}function E(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function k(e,t,r){var n=0;for(e=r?m(e/700):e>>1,e+=m(e/t);e>455;n+=l)e=m(e/35);return m(n+36*e/(e+38))}function T(e){var t,r,n,i,o,s,a,c,f,p,h,d=[],g=e.length,v=0,b=128,w=72;for((r=e.lastIndexOf("-"))<0&&(r=0),n=0;n<r;++n)e.charCodeAt(n)>=128&&y("not-basic"),d.push(e.charCodeAt(n));for(i=r>0?r+1:0;i<g;){for(o=v,s=1,a=l;i>=g&&y("invalid-input"),((c=(h=e.charCodeAt(i++))-48<10?h-22:h-65<26?h-65:h-97<26?h-97:l)>=l||c>m((u-v)/s))&&y("overflow"),v+=c*s,!(c<(f=a<=w?1:a>=w+26?26:a-w));a+=l)s>m(u/(p=l-f))&&y("overflow"),s*=p;w=k(v-o,t=d.length+1,0==o),m(v/t)>u-b&&y("overflow"),b+=m(v/t),v%=t,d.splice(v++,0,b)}return S(d)}function C(e){var t,r,n,i,o,s,a,c,f,p,h,d,v,b,w,S=[];for(d=(e=_(e)).length,t=128,r=0,o=72,s=0;s<d;++s)(h=e[s])<128&&S.push(g(h));for(n=i=S.length,i&&S.push("-");n<d;){for(a=u,s=0;s<d;++s)(h=e[s])>=t&&h<a&&(a=h);for(a-t>m((u-r)/(v=n+1))&&y("overflow"),r+=(a-t)*v,t=a,s=0;s<d;++s)if((h=e[s])<t&&++r>u&&y("overflow"),h==t){for(c=r,f=l;!(c<(p=f<=o?1:f>=o+26?26:f-o));f+=l)w=c-p,b=l-p,S.push(g(E(p+w%b,0))),c=m(w/b);S.push(g(E(c,0))),o=k(r,v,n==i),r=0,++n}++r,++t}return S.join("")}if(a={version:"1.4.1",ucs2:{decode:_,encode:S},decode:T,encode:C,toASCII:function(e){return w(e,(function(e){return p.test(e)?"xn--"+C(e):e}))},toUnicode:function(e){return w(e,(function(e){return f.test(e)?T(e.slice(4).toLowerCase()):e}))}},i&&o)if(t.exports==i)o.exports=a;else for(c in a)a.hasOwnProperty(c)&&(i[c]=a[c]);else r.punycode=a}(this)}).call(this)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],34:[function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,r,o){t=t||"&",r=r||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var c=1e3;o&&"number"==typeof o.maxKeys&&(c=o.maxKeys);var u=e.length;c>0&&u>c&&(u=c);for(var l=0;l<u;++l){var f,p,h,d,m=e[l].replace(a,"%20"),g=m.indexOf(r);g>=0?(f=m.substr(0,g),p=m.substr(g+1)):(f=m,p=""),h=decodeURIComponent(f),d=decodeURIComponent(p),n(s,h)?i(s[h])?s[h].push(d):s[h]=[s[h],d]:s[h]=d}return s};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],35:[function(e,t,r){"use strict";var n=function(e){switch(b(e)){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,r,a){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==b(e)?o(s(e),(function(s){var a=encodeURIComponent(n(s))+r;return i(e[s])?o(e[s],(function(e){return a+encodeURIComponent(n(e))})).join(t):a+encodeURIComponent(n(e[s]))})).join(t):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n<e.length;n++)r.push(t(e[n],n));return r}var s=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t}},{}],36:[function(e,t,r){"use strict";r.decode=r.parse=e("./decode"),r.encode=r.stringify=e("./encode")},{"./decode":34,"./encode":35}],37:[function(e,t,r){"use strict";var n={};function i(e,t,r){r||(r=Error);var i=function(e){var r,n;function i(r,n,i){return e.call(this,function(e,r,n){return"string"==typeof t?t:t(e,r,n)}(r,n,i))||this}return n=e,(r=i).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,i}(r);i.prototype.name=r.name,i.prototype.code=e,n[e]=i}function o(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}i("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,i,s;if("string"==typeof t&&(i="not ",t.substr(0,i.length)===i)?(n="must not be",t=t.replace(/^not /,"")):n="must be",function(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}(e," argument"))s="The ".concat(e," ").concat(n," ").concat(o(t,"type"));else{var a=function(e,t,r){return"number"!=typeof r&&(r=0),!(r+".".length>e.length)&&-1!==e.indexOf(".",r)}(e)?"property":"argument";s='The "'.concat(e,'" ').concat(a," ").concat(n," ").concat(o(t,"type"))}return s+". Received type ".concat(b(r))}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=n},{}],38:[function(e,t,r){(function(r){(function(){"use strict";var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=u;var i=e("./_stream_readable"),o=e("./_stream_writable");e("inherits")(u,i);for(var s=n(o.prototype),a=0;a<s.length;a++){var c=s[a];u.prototype[c]||(u.prototype[c]=o.prototype[c])}function u(e){if(!(this instanceof u))return new u(e);i.call(this,e),o.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",l)))}function l(){this._writableState.ended||r.nextTick(f,this)}function f(e){e.end()}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(u.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(u.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(u.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})}).call(this)}).call(this,e("_process"))},{"./_stream_readable":40,"./_stream_writable":42,_process:32,inherits:21}],39:[function(e,t,r){"use strict";t.exports=i;var n=e("./_stream_transform");function i(e){if(!(this instanceof i))return new i(e);n.call(this,e)}e("inherits")(i,n),i.prototype._transform=function(e,t,r){r(null,e)}},{"./_stream_transform":41,inherits:21}],40:[function(e,t,n){(function(r,n){(function(){"use strict";var i;t.exports=T,T.ReadableState=k,e("events").EventEmitter;var o,s=function(e,t){return e.listeners(t).length},a=e("./internal/streams/stream"),c=e("buffer").Buffer,u=n.Uint8Array||function(){},l=e("util");o=l&&l.debuglog?l.debuglog("stream"):function(){};var f,p,h,d=e("./internal/streams/buffer_list"),m=e("./internal/streams/destroy"),g=e("./internal/streams/state").getHighWaterMark,y=e("../errors").codes,v=y.ERR_INVALID_ARG_TYPE,b=y.ERR_STREAM_PUSH_AFTER_EOF,w=y.ERR_METHOD_NOT_IMPLEMENTED,_=y.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;e("inherits")(T,a);var S=m.errorOrDestroy,E=["error","close","destroy","pause","resume"];function k(t,r,n){i=i||e("./_stream_duplex"),t=t||{},"boolean"!=typeof n&&(n=r instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=g(this,t,"readableHighWaterMark",n),this.buffer=new d,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&&(f||(f=e("string_decoder/").StringDecoder),this.decoder=new f(t.encoding),this.encoding=t.encoding)}function T(t){if(i=i||e("./_stream_duplex"),!(this instanceof T))return new T(t);var r=this instanceof i;this._readableState=new k(t,this,r),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function C(e,t,r,n,i){o("readableAddChunk",t);var s,a=e._readableState;if(null===t)a.reading=!1,function(e,t){if(o("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?A(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,O(e)))}}(e,a);else if(i||(s=function(e,t){var r,n;return n=t,c.isBuffer(n)||n instanceof u||"string"==typeof t||void 0===t||e.objectMode||(r=new v("chunk",["string","Buffer","Uint8Array"],t)),r}(a,t)),s)S(e,s);else if(a.objectMode||t&&t.length>0)if("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),n)a.endEmitted?S(e,new _):I(e,a,t,!0);else if(a.ended)S(e,new b);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||0!==t.length?I(e,a,t,!1):P(e,a)):I(e,a,t,!1)}else n||(a.reading=!1,P(e,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function I(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&A(e)),P(e,t)}Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),T.prototype.destroy=m.destroy,T.prototype._undestroy=m.undestroy,T.prototype._destroy=function(e,t){t(e)},T.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=c.from(e,t),t=""),r=!0),C(this,e,t,!1,r)},T.prototype.unshift=function(e){return C(this,e,null,!0,!1)},T.prototype.isPaused=function(){return!1===this._readableState.flowing},T.prototype.setEncoding=function(t){f||(f=e("string_decoder/").StringDecoder);var r=new f(t);this._readableState.decoder=r,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=r.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var R=1073741824;function x(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=R?e=R:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;o("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(o("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(O,e))}function O(e){var t=e._readableState;o("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,M(e)}function P(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(L,e,t))}function L(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(o("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function j(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function N(e){o("readable nexttick read 0"),e.read(0)}function U(e,t){o("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),M(e),t.flowing&&!t.reading&&e.read(0)}function M(e){var t=e._readableState;for(o("flow",t.flowing);t.flowing&&null!==e.read(););}function B(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function q(e){var t=e._readableState;o("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(F,t,e))}function F(e,t){if(o("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function D(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}T.prototype.read=function(e){o("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return o("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?q(this):A(this),null;if(0===(e=x(e,t))&&t.ended)return 0===t.length&&q(this),null;var n,i=t.needReadable;return o("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&o("length less than watermark",i=!0),t.ended||t.reading?o("reading or ended",i=!1):i&&(o("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=x(r,t))),null===(n=e>0?B(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&q(this)),null!==n&&this.emit("data",n),n},T.prototype._read=function(e){S(this,new w("_read()"))},T.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,o("pipe count=%d opts=%j",i.pipesCount,t);var a=t&&!1===t.end||e===r.stdout||e===r.stderr?m:c;function c(){o("onend"),e.end()}i.endEmitted?r.nextTick(a):n.once("end",a),e.on("unpipe",(function t(r,s){o("onunpipe"),r===n&&s&&!1===s.hasUnpiped&&(s.hasUnpiped=!0,o("cleanup"),e.removeListener("close",h),e.removeListener("finish",d),e.removeListener("drain",u),e.removeListener("error",p),e.removeListener("unpipe",t),n.removeListener("end",c),n.removeListener("end",m),n.removeListener("data",f),l=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||u())}));var u=function(e){return function(){var t=e._readableState;o("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,M(e))}}(n);e.on("drain",u);var l=!1;function f(t){o("ondata");var r=e.write(t);o("dest.write",r),!1===r&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==D(i.pipes,e))&&!l&&(o("false write response, pause",i.awaitDrain),i.awaitDrain++),n.pause())}function p(t){o("onerror",t),m(),e.removeListener("error",p),0===s(e,"error")&&S(e,t)}function h(){e.removeListener("finish",d),m()}function d(){o("onfinish"),e.removeListener("close",h),m()}function m(){o("unpipe"),n.unpipe(e)}return n.on("data",f),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",p),e.once("close",h),e.once("finish",d),e.emit("pipe",n),i.flowing||(o("pipe resume"),n.resume()),e},T.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=D(t.pipes,e);return-1===s||(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},T.prototype.on=function(e,t){var n=a.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,o("on readable",i.length,i.reading),i.length?A(this):i.reading||r.nextTick(N,this))),n},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(e,t){var n=a.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(j,this),n},T.prototype.removeAllListeners=function(e){var t=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(j,this),t},T.prototype.resume=function(){var e=this._readableState;return e.flowing||(o("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(U,e,t))}(this,e)),e.paused=!1,this},T.prototype.pause=function(){return o("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(o("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",(function(){if(o("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(i){o("wrapped data"),r.decoder&&(i=r.decoder.write(i)),(!r.objectMode||null!=i)&&(r.objectMode||i&&i.length)&&(t.push(i)||(n=!0,e.pause()))})),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var s=0;s<E.length;s++)e.on(E[s],this.emit.bind(this,E[s]));return this._read=function(t){o("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(T.prototype[Symbol.asyncIterator]=function(){return void 0===p&&(p=e("./internal/streams/async_iterator")),p(this)}),Object.defineProperty(T.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(T.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(T.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),T._fromList=B,Object.defineProperty(T.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(T.from=function(t,r){return void 0===h&&(h=e("./internal/streams/from")),h(T,t,r)})}).call(this)}).call(this,e("_process"),void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":37,"./_stream_duplex":38,"./internal/streams/async_iterator":43,"./internal/streams/buffer_list":44,"./internal/streams/destroy":45,"./internal/streams/from":47,"./internal/streams/state":49,"./internal/streams/stream":50,_process:32,buffer:14,events:19,inherits:21,"string_decoder/":55,util:13}],41:[function(e,t,r){"use strict";t.exports=u;var n=e("../errors").codes,i=n.ERR_METHOD_NOT_IMPLEMENTED,o=n.ERR_MULTIPLE_CALLBACK,s=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,c=e("./_stream_duplex");function u(e){if(!(this instanceof u))return new u(e);c.call(this,e),this._transformState={afterTransform:function(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new o);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",l)}function l(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?f(this,null,null):this._flush((function(t,r){f(e,t,r)}))}function f(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new a;if(e._transformState.transforming)throw new s;return e.push(null)}e("inherits")(u,c),u.prototype.push=function(e,t){return this._transformState.needTransform=!1,c.prototype.push.call(this,e,t)},u.prototype._transform=function(e,t,r){r(new i("_transform()"))},u.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},u.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},u.prototype._destroy=function(e,t){c.prototype._destroy.call(this,e,(function(e){t(e)}))}},{"../errors":37,"./_stream_duplex":38,inherits:21}],42:[function(e,t,n){(function(r,n){(function(){"use strict";function i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(void 0),n=n.next}t.corkedRequestsFree.next=e}(t,e)}}var o;t.exports=T,T.WritableState=k;var s,a={deprecate:e("util-deprecate")},c=e("./internal/streams/stream"),u=e("buffer").Buffer,l=n.Uint8Array||function(){},f=e("./internal/streams/destroy"),p=e("./internal/streams/state").getHighWaterMark,h=e("../errors").codes,d=h.ERR_INVALID_ARG_TYPE,m=h.ERR_METHOD_NOT_IMPLEMENTED,g=h.ERR_MULTIPLE_CALLBACK,y=h.ERR_STREAM_CANNOT_PIPE,v=h.ERR_STREAM_DESTROYED,b=h.ERR_STREAM_NULL_VALUES,w=h.ERR_STREAM_WRITE_AFTER_END,_=h.ERR_UNKNOWN_ENCODING,S=f.errorOrDestroy;function E(){}function k(t,n,s){o=o||e("./_stream_duplex"),t=t||{},"boolean"!=typeof s&&(s=n instanceof o),this.objectMode=!!t.objectMode,s&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=p(this,t,"writableHighWaterMark",s),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,i=n.sync,o=n.writecb;if("function"!=typeof o)throw new g;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,i,o){--t.pendingcb,n?(r.nextTick(o,i),r.nextTick(O,e,t),e._writableState.errorEmitted=!0,S(e,i)):(o(i),e._writableState.errorEmitted=!0,S(e,i),O(e,t))}(e,n,i,t,o);else{var s=x(n)||e.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||R(e,n),i?r.nextTick(I,e,n,s,o):I(e,n,s,o)}}(n,e)},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 i(this)}function T(t){var r=this instanceof(o=o||e("./_stream_duplex"));if(!r&&!s.call(T,this))return new T(t);this._writableState=new k(t,this,r),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)),c.call(this)}function C(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new v("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function I(e,t,r,n){r||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,n(),O(e,t)}function R(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,o=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var a=0,c=!0;r;)o[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;o.allBuffers=c,C(e,t,!0,t.length,o,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new i(t),t.bufferedRequestCount=0}else{for(;r;){var u=r.chunk,l=r.encoding,f=r.callback;if(C(e,t,!1,t.objectMode?1:u.length,u,l,f),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function x(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function A(e,t){e._final((function(r){t.pendingcb--,r&&S(e,r),t.prefinished=!0,e.emit("prefinish"),O(e,t)}))}function O(e,t){var n=x(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,r.nextTick(A,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var i=e._readableState;(!i||i.autoDestroy&&i.endEmitted)&&e.destroy()}return n}e("inherits")(T,c),k.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(k.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(s=Function.prototype[Symbol.hasInstance],Object.defineProperty(T,Symbol.hasInstance,{value:function(e){return!!s.call(this,e)||this===T&&e&&e._writableState instanceof k}})):s=function(e){return e instanceof this},T.prototype.pipe=function(){S(this,new y)},T.prototype.write=function(e,t,n){var i,o=this._writableState,s=!1,a=!o.objectMode&&(i=e,u.isBuffer(i)||i instanceof l);return a&&!u.isBuffer(e)&&(e=function(e){return u.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof n&&(n=E),o.ending?function(e,t){var n=new w;S(e,n),r.nextTick(t,n)}(this,n):(a||function(e,t,n,i){var o;return null===n?o=new b:"string"==typeof n||t.objectMode||(o=new d("chunk",["string","Buffer"],n)),!o||(S(e,o),r.nextTick(i,o),!1)}(this,o,e,n))&&(o.pendingcb++,s=function(e,t,r,n,i,o){if(!r){var s=function(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=u.from(t,r)),t}(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var c=t.length<t.highWaterMark;if(c||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else C(e,t,!1,a,n,i,o);return c}(this,o,a,e,t,n)),s},T.prototype.cork=function(){this._writableState.corked++},T.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||R(this,e))},T.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new _(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),T.prototype._write=function(e,t,r){r(new m("_write()"))},T.prototype._writev=null,T.prototype.end=function(e,t,n){var i=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),i.corked&&(i.corked=1,this.uncork()),i.ending||function(e,t,n){t.ending=!0,O(e,t),n&&(t.finished?r.nextTick(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,i,n),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),T.prototype.destroy=f.destroy,T.prototype._undestroy=f.undestroy,T.prototype._destroy=function(e,t){t(e)}}).call(this)}).call(this,e("_process"),void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":37,"./_stream_duplex":38,"./internal/streams/destroy":45,"./internal/streams/state":49,"./internal/streams/stream":50,_process:32,buffer:14,inherits:21,"util-deprecate":58}],43:[function(e,t,r){(function(r){(function(){"use strict";var n;function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=e("./end-of-stream"),s=Symbol("lastResolve"),a=Symbol("lastReject"),c=Symbol("error"),u=Symbol("ended"),l=Symbol("lastPromise"),f=Symbol("handlePromise"),p=Symbol("stream");function h(e,t){return{value:e,done:t}}function d(e){var t=e[s];if(null!==t){var r=e[p].read();null!==r&&(e[l]=null,e[s]=null,e[a]=null,t(h(r,!1)))}}var m=Object.getPrototypeOf((function(){})),g=Object.setPrototypeOf((i(n={get stream(){return this[p]},next:function(){var e=this,t=this[c];if(null!==t)return Promise.reject(t);if(this[u])return Promise.resolve(h(void 0,!0));if(this[p].destroyed)return new Promise((function(t,n){r.nextTick((function(){e[c]?n(e[c]):t(h(void 0,!0))}))}));var n,i=this[l];if(i)n=new Promise(function(e,t){return function(r,n){e.then((function(){t[u]?r(h(void 0,!0)):t[f](r,n)}),n)}}(i,this));else{var o=this[p].read();if(null!==o)return Promise.resolve(h(o,!1));n=new Promise(this[f])}return this[l]=n,n}},Symbol.asyncIterator,(function(){return this})),i(n,"return",(function(){var e=this;return new Promise((function(t,r){e[p].destroy(null,(function(e){e?r(e):t(h(void 0,!0))}))}))})),n),m);t.exports=function(e){var t,n=Object.create(g,(i(t={},p,{value:e,writable:!0}),i(t,s,{value:null,writable:!0}),i(t,a,{value:null,writable:!0}),i(t,c,{value:null,writable:!0}),i(t,u,{value:e._readableState.endEmitted,writable:!0}),i(t,f,{value:function(e,t){var r=n[p].read();r?(n[l]=null,n[s]=null,n[a]=null,e(h(r,!1))):(n[s]=e,n[a]=t)},writable:!0}),t));return n[l]=null,o(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[a];return null!==t&&(n[l]=null,n[s]=null,n[a]=null,t(e)),void(n[c]=e)}var r=n[s];null!==r&&(n[l]=null,n[s]=null,n[a]=null,r(h(void 0,!0))),n[u]=!0})),e.on("readable",function(e){r.nextTick(d,e)}.bind(null,n)),n}}).call(this)}).call(this,e("_process"))},{"./end-of-stream":46,_process:32}],44:[function(e,t,r){"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var o=e("buffer").Buffer,s=e("util").inspect,a=s&&s.custom||"inspect";t.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t;return(t=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,r,n,i=o.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,r=i,n=a,o.prototype.copy.call(t,r,n),a+=s.data.length,s=s.next;return i}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),0==(e-=o)){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,s=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,s),0==(e-=s)){s===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(s));break}++n}return this.length-=n,t}},{key:a,value:function(e,t){return s(this,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},t,{depth:0,customInspect:!1}))}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(e.prototype,t),e}()},{buffer:14,util:13}],45:[function(e,t,r){(function(e){(function(){"use strict";function r(e,t){i(e,t),n(e)}function n(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function i(e,t){e.emit("error",t)}t.exports={destroy:function(t,o){var s=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(o?o(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(i,this,t)):e.nextTick(i,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!o&&t?s._writableState?s._writableState.errorEmitted?e.nextTick(n,s):(s._writableState.errorEmitted=!0,e.nextTick(r,s,t)):e.nextTick(r,s,t):o?(e.nextTick(n,s),o(t)):e.nextTick(n,s)})),this)},undestroy:function(){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(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}}}).call(this)}).call(this,e("_process"))},{_process:32}],46:[function(e,t,r){"use strict";var n=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function e(t,r,o){if("function"==typeof r)return e(t,null,r);r||(r={}),o=function(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}(o||i);var s=r.readable||!1!==r.readable&&t.readable,a=r.writable||!1!==r.writable&&t.writable,c=function(){t.writable||l()},u=t._writableState&&t._writableState.finished,l=function(){a=!1,u=!0,s||o.call(t)},f=t._readableState&&t._readableState.endEmitted,p=function(){s=!1,f=!0,a||o.call(t)},h=function(e){o.call(t,e)},d=function(){var e;return s&&!f?(t._readableState&&t._readableState.ended||(e=new n),o.call(t,e)):a&&!u?(t._writableState&&t._writableState.ended||(e=new n),o.call(t,e)):void 0},m=function(){t.req.on("finish",l)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",l),t.on("abort",d),t.req?m():t.on("request",m)):a&&!t._writableState&&(t.on("end",c),t.on("close",c)),t.on("end",p),t.on("finish",l),!1!==r.error&&t.on("error",h),t.on("close",d),function(){t.removeListener("complete",l),t.removeListener("abort",d),t.removeListener("request",m),t.req&&t.req.removeListener("finish",l),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",l),t.removeListener("end",p),t.removeListener("error",h),t.removeListener("close",d)}}},{"../../../errors":37}],47:[function(e,t,r){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],48:[function(e,t,r){"use strict";var n,i=e("../../../errors").codes,o=i.ERR_MISSING_ARGS,s=i.ERR_STREAM_DESTROYED;function a(e){if(e)throw e}function c(e){e()}function u(e,t){return e.pipe(t)}t.exports=function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];var l,f=function(e){return e.length?"function"!=typeof e[e.length-1]?a:e.pop():a}(r);if(Array.isArray(r[0])&&(r=r[0]),r.length<2)throw new o("streams");var p=r.map((function(t,i){var o=i<r.length-1;return function(t,r,i,o){o=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(o);var a=!1;t.on("close",(function(){a=!0})),void 0===n&&(n=e("./end-of-stream")),n(t,{readable:r,writable:i},(function(e){if(e)return o(e);a=!0,o()}));var c=!1;return function(e){if(!a&&!c)return c=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new s("pipe"))}}(t,o,i>0,(function(e){l||(l=e),e&&p.forEach(c),o||(p.forEach(c),f(l))}))}));return r.reduce(u)}},{"../../../errors":37,"./end-of-stream":46}],49:[function(e,t,r){"use strict";var n=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(e,t,r,i){var o=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}}},{"../../../errors":37}],50:[function(e,t,r){t.exports=e("events").EventEmitter},{events:19}],51:[function(e,t,r){(r=t.exports=e("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js"),r.finished=e("./lib/internal/streams/end-of-stream.js"),r.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":38,"./lib/_stream_passthrough.js":39,"./lib/_stream_readable.js":40,"./lib/_stream_transform.js":41,"./lib/_stream_writable.js":42,"./lib/internal/streams/end-of-stream.js":46,"./lib/internal/streams/pipeline.js":48}],52:[function(e,t,r){"use strict";t.exports=function(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("interval needed");var e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t<e.length;t++)e[t]=arguments[t+2]}return new function(e,t,r){var n=this;this._callback=e,this._args=r,this._interval=setInterval(e,t,this._args),this.reschedule=function(e){e||(e=n._interval),n._interval&&clearInterval(n._interval),n._interval=setInterval(n._callback,e,n._args)},this.clear=function(){n._interval&&(clearInterval(n._interval),n._interval=void 0)},this.destroy=function(){n._interval&&clearInterval(n._interval),n._callback=void 0,n._interval=void 0,n._args=void 0}}(arguments[0],arguments[1],e)}},{}],53:[function(e,t,r){var n=e("buffer"),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=n:(o(n,r),r.Buffer=s),s.prototype=Object.create(i.prototype),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},{buffer:14}],54:[function(e,t,r){t.exports=function(e){var t,r=e._readableState;return r?r.objectMode||"number"==typeof e._duplexState?e.read():e.read((t=r).buffer.length?t.buffer.head?t.buffer.head.data.length:t.buffer[0].length:t.length):null}},{}],55:[function(e,t,r){"use strict";var n=e("safe-buffer").Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.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 o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){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 e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=f,t=3;break;default:return this.write=p,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function l(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function p(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}r.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},o.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},o.prototype.text=function(e,t){var r=function(e,t,r){var n=t.length-1;if(n<r)return 0;var i=s(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=s(t[n]))>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=s(t[n]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)},o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":53}],56:[function(e,t,r){"use strict";var n=e("punycode"),i=e("./util");function o(){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}r.parse=w,r.resolve=function(e,t){return w(e,!1,!0).resolve(t)},r.resolveObject=function(e,t){return e?w(e,!1,!0).resolveObject(t):t},r.format=function(e){return i.isString(e)&&(e=w(e)),e instanceof o?e.format():o.prototype.format.call(e)},r.Url=o;var s=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,c=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(u),f=["%","/","?",";","#"].concat(l),p=["/","?","#"],h=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=e("querystring");function w(e,t,r){if(e&&i.isObject(e)&&e instanceof o)return e;var n=new o;return n.parse(e,t,r),n}o.prototype.parse=function(e,t,r){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+b(e));var o=e.indexOf("?"),a=-1!==o&&o<e.indexOf("#")?"?":"#",u=e.split(a);u[0]=u[0].replace(/\\/g,"/");var w=e=u.join(a);if(w=w.trim(),!r&&1===e.split("#").length){var _=c.exec(w);if(_)return this.path=w,this.href=w,this.pathname=_[1],_[2]?(this.search=_[2],this.query=t?v.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var S=s.exec(w);if(S){var E=(S=S[0]).toLowerCase();this.protocol=E,w=w.substr(S.length)}if(r||S||w.match(/^\/\/[^@\/]+@[^@\/]+/)){var k="//"===w.substr(0,2);!k||S&&g[S]||(w=w.substr(2),this.slashes=!0)}if(!g[S]&&(k||S&&!y[S])){for(var T,C,I=-1,R=0;R<p.length;R++)-1!==(x=w.indexOf(p[R]))&&(-1===I||x<I)&&(I=x);for(-1!==(C=-1===I?w.lastIndexOf("@"):w.lastIndexOf("@",I))&&(T=w.slice(0,C),w=w.slice(C+1),this.auth=decodeURIComponent(T)),I=-1,R=0;R<f.length;R++){var x;-1!==(x=w.indexOf(f[R]))&&(-1===I||x<I)&&(I=x)}-1===I&&(I=w.length),this.host=w.slice(0,I),w=w.slice(I),this.parseHost(),this.hostname=this.hostname||"";var A="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!A)for(var O=this.hostname.split(/\./),P=(R=0,O.length);R<P;R++){var L=O[R];if(L&&!L.match(h)){for(var j="",N=0,U=L.length;N<U;N++)L.charCodeAt(N)>127?j+="x":j+=L[N];if(!j.match(h)){var M=O.slice(0,R),B=O.slice(R+1),q=L.match(d);q&&(M.push(q[1]),B.unshift(q[2])),B.length&&(w="/"+B.join(".")+w),this.hostname=M.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),A||(this.hostname=n.toASCII(this.hostname));var F=this.port?":"+this.port:"",D=this.hostname||"";this.host=D+F,this.href+=this.host,A&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==w[0]&&(w="/"+w))}if(!m[E])for(R=0,P=l.length;R<P;R++){var H=l[R];if(-1!==w.indexOf(H)){var W=encodeURIComponent(H);W===H&&(W=escape(H)),w=w.split(H).join(W)}}var V=w.indexOf("#");-1!==V&&(this.hash=w.substr(V),w=w.slice(0,V));var z=w.indexOf("?");if(-1!==z?(this.search=w.substr(z),this.query=w.substr(z+1),t&&(this.query=v.parse(this.query)),w=w.slice(0,z)):t&&(this.search="",this.query={}),w&&(this.pathname=w),y[E]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){F=this.pathname||"";var Q=this.search||"";this.path=F+Q}return this.href=this.format(),this},o.prototype.format=function(){var e=this.auth||"";e&&(e=(e=encodeURIComponent(e)).replace(/%3A/i,":"),e+="@");var t=this.protocol||"",r=this.pathname||"",n=this.hash||"",o=!1,s="";this.host?o=e+this.host:this.hostname&&(o=e+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(s=v.stringify(this.query));var a=this.search||s&&"?"+s||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||y[t])&&!1!==o?(o="//"+(o||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):o||(o=""),n&&"#"!==n.charAt(0)&&(n="#"+n),a&&"?"!==a.charAt(0)&&(a="?"+a),t+o+(r=r.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(a=a.replace("#","%23"))+n},o.prototype.resolve=function(e){return this.resolveObject(w(e,!1,!0)).format()},o.prototype.resolveObject=function(e){if(i.isString(e)){var t=new o;t.parse(e,!1,!0),e=t}for(var r=new o,n=Object.keys(this),s=0;s<n.length;s++){var a=n[s];r[a]=this[a]}if(r.hash=e.hash,""===e.href)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var c=Object.keys(e),u=0;u<c.length;u++){var l=c[u];"protocol"!==l&&(r[l]=e[l])}return y[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!y[e.protocol]){for(var f=Object.keys(e),p=0;p<f.length;p++){var h=f[p];r[h]=e[h]}return r.href=r.format(),r}if(r.protocol=e.protocol,e.host||g[e.protocol])r.pathname=e.pathname;else{for(var d=(e.pathname||"").split("/");d.length&&!(e.host=d.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),r.pathname=d.join("/")}if(r.search=e.search,r.query=e.query,r.host=e.host||"",r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,r.pathname||r.search){var m=r.pathname||"",v=r.search||"";r.path=m+v}return r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var b=r.pathname&&"/"===r.pathname.charAt(0),w=e.host||e.pathname&&"/"===e.pathname.charAt(0),_=w||b||r.host&&e.pathname,S=_,E=r.pathname&&r.pathname.split("/")||[],k=(d=e.pathname&&e.pathname.split("/")||[],r.protocol&&!y[r.protocol]);if(k&&(r.hostname="",r.port=null,r.host&&(""===E[0]?E[0]=r.host:E.unshift(r.host)),r.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===d[0]?d[0]=e.host:d.unshift(e.host)),e.host=null),_=_&&(""===d[0]||""===E[0])),w)r.host=e.host||""===e.host?e.host:r.host,r.hostname=e.hostname||""===e.hostname?e.hostname:r.hostname,r.search=e.search,r.query=e.query,E=d;else if(d.length)E||(E=[]),E.pop(),E=E.concat(d),r.search=e.search,r.query=e.query;else if(!i.isNullOrUndefined(e.search))return k&&(r.hostname=r.host=E.shift(),(x=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=x.shift(),r.host=r.hostname=x.shift())),r.search=e.search,r.query=e.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!E.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var T=E.slice(-1)[0],C=(r.host||e.host||E.length>1)&&("."===T||".."===T)||""===T,I=0,R=E.length;R>=0;R--)"."===(T=E[R])?E.splice(R,1):".."===T?(E.splice(R,1),I++):I&&(E.splice(R,1),I--);if(!_&&!S)for(;I--;I)E.unshift("..");!_||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),C&&"/"!==E.join("/").substr(-1)&&E.push("");var x,A=""===E[0]||E[0]&&"/"===E[0].charAt(0);return k&&(r.hostname=r.host=A?"":E.length?E.shift():"",(x=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=x.shift(),r.host=r.hostname=x.shift())),(_=_||r.host&&E.length)&&!A&&E.unshift(""),E.length?r.pathname=E.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":57,punycode:33,querystring:36}],57:[function(e,t,r){"use strict";t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==b(e)&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],58:[function(e,t,n){(function(e){(function(){function r(t){try{if(!e.localStorage)return!1}catch(e){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=function(e,t){if(r("noDeprecation"))return e;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}}).call(this)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],59:[function(e,t,r){t.exports=function e(t,r){if(t&&r)return e(t)(r);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(e){n[e]=t[e]})),n;function n(){for(var e=new Array(arguments.length),r=0;r<e.length;r++)e[r]=arguments[r];var n=t.apply(this,e),i=e[e.length-1];return"function"==typeof n&&n!==i&&Object.keys(i).forEach((function(e){n[e]=i[e]})),n}}},{}],60:[function(e,t,r){"use strict";t.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],61:[function(e,t,r){t.exports=function(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var i in r)n.call(r,i)&&(e[i]=r[i])}return e};var n=Object.prototype.hasOwnProperty},{}]},{},[9])(9)},7375:function(e,t){"use strict";var r=Object.prototype.hasOwnProperty;function n(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function i(e){try{return encodeURIComponent(e)}catch(e){return null}}t.stringify=function(e,t){t=t||"";var n,o,s=[];for(o in"string"!=typeof t&&(t="?"),e)if(r.call(e,o)){if((n=e[o])||null!=n&&!isNaN(n)||(n=""),o=i(o),n=i(n),null===o||null===n)continue;s.push(o+"="+n)}return s.length?t+s.join("&"):""},t.parse=function(e){for(var t,r=/([^=?#&]+)=?([^&]*)/g,i={};t=r.exec(e);){var o=n(t[1]),s=n(t[2]);null===o||null===s||o in i||(i[o]=s)}return i}},7245:function(e){"use strict";e.exports=function(e,t){if(t=t.split(":")[0],!(e=+e))return!1;switch(t){case"http":case"ws":return 80!==e;case"https":case"wss":return 443!==e;case"ftp":return 21!==e;case"gopher":return 70!==e;case"file":return!1}return 0!==e}},4846:function(e,t,r){"use strict";var n=r(7245),i=r(7375),o=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,s=/[\n\r\t]/g,a=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,c=/:\d+$/,u=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,l=/^[a-zA-Z]:/;function f(e){return(e||"").toString().replace(o,"")}var p=[["#","hash"],["?","query"],function(e,t){return m(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],h={hash:1,query:1};function d(e){var t,n=("undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:{}).location||{},i={},o=b(e=e||n);if("blob:"===e.protocol)i=new y(unescape(e.pathname),{});else if("string"===o)for(t in i=new y(e,{}),h)delete i[t];else if("object"===o){for(t in e)t in h||(i[t]=e[t]);void 0===i.slashes&&(i.slashes=a.test(e.href))}return i}function m(e){return"file:"===e||"ftp:"===e||"http:"===e||"https:"===e||"ws:"===e||"wss:"===e}function g(e,t){e=(e=f(e)).replace(s,""),t=t||{};var r,n=u.exec(e),i=n[1]?n[1].toLowerCase():"",o=!!n[2],a=!!n[3],c=0;return o?a?(r=n[2]+n[3]+n[4],c=n[2].length+n[3].length):(r=n[2]+n[4],c=n[2].length):a?(r=n[3]+n[4],c=n[3].length):r=n[4],"file:"===i?c>=2&&(r=r.slice(2)):m(i)?r=n[4]:i?o&&(r=r.slice(2)):c>=2&&m(t.protocol)&&(r=n[4]),{protocol:i,slashes:o||m(i),slashesCount:c,rest:r}}function y(e,t,r){if(e=(e=f(e)).replace(s,""),!(this instanceof y))return new y(e,t,r);var o,a,c,u,h,v,w=p.slice(),_=b(t),S=this,E=0;for("object"!==_&&"string"!==_&&(r=t,t=null),r&&"function"!=typeof r&&(r=i.parse),o=!(a=g(e||"",t=d(t))).protocol&&!a.slashes,S.slashes=a.slashes||o&&t.slashes,S.protocol=a.protocol||t.protocol||"",e=a.rest,("file:"===a.protocol&&(2!==a.slashesCount||l.test(e))||!a.slashes&&(a.protocol||a.slashesCount<2||!m(S.protocol)))&&(w[3]=[/(.*)/,"pathname"]);E<w.length;E++)"function"!=typeof(u=w[E])?(c=u[0],v=u[1],c!=c?S[v]=e:"string"==typeof c?~(h="@"===c?e.lastIndexOf(c):e.indexOf(c))&&("number"==typeof u[2]?(S[v]=e.slice(0,h),e=e.slice(h+u[2])):(S[v]=e.slice(h),e=e.slice(0,h))):(h=c.exec(e))&&(S[v]=h[1],e=e.slice(0,h.index)),S[v]=S[v]||o&&u[3]&&t[v]||"",u[4]&&(S[v]=S[v].toLowerCase())):e=u(e,S);r&&(S.query=r(S.query)),o&&t.slashes&&"/"!==S.pathname.charAt(0)&&(""!==S.pathname||""!==t.pathname)&&(S.pathname=function(e,t){if(""===e)return t;for(var r=(t||"/").split("/").slice(0,-1).concat(e.split("/")),n=r.length,i=r[n-1],o=!1,s=0;n--;)"."===r[n]?r.splice(n,1):".."===r[n]?(r.splice(n,1),s++):s&&(0===n&&(o=!0),r.splice(n,1),s--);return o&&r.unshift(""),"."!==i&&".."!==i||r.push(""),r.join("/")}(S.pathname,t.pathname)),"/"!==S.pathname.charAt(0)&&m(S.protocol)&&(S.pathname="/"+S.pathname),n(S.port,S.protocol)||(S.host=S.hostname,S.port=""),S.username=S.password="",S.auth&&(~(h=S.auth.indexOf(":"))?(S.username=S.auth.slice(0,h),S.username=encodeURIComponent(decodeURIComponent(S.username)),S.password=S.auth.slice(h+1),S.password=encodeURIComponent(decodeURIComponent(S.password))):S.username=encodeURIComponent(decodeURIComponent(S.auth)),S.auth=S.password?S.username+":"+S.password:S.username),S.origin="file:"!==S.protocol&&m(S.protocol)&&S.host?S.protocol+"//"+S.host:"null",S.href=S.toString()}y.prototype={set:function(e,t,r){var o=this;switch(e){case"query":"string"==typeof t&&t.length&&(t=(r||i.parse)(t)),o[e]=t;break;case"port":o[e]=t,n(t,o.protocol)?t&&(o.host=o.hostname+":"+t):(o.host=o.hostname,o[e]="");break;case"hostname":o[e]=t,o.port&&(t+=":"+o.port),o.host=t;break;case"host":o[e]=t,c.test(t)?(t=t.split(":"),o.port=t.pop(),o.hostname=t.join(":")):(o.hostname=t,o.port="");break;case"protocol":o.protocol=t.toLowerCase(),o.slashes=!r;break;case"pathname":case"hash":if(t){var s="pathname"===e?"/":"#";o[e]=t.charAt(0)!==s?s+t:t}else o[e]=t;break;case"username":case"password":o[e]=encodeURIComponent(t);break;case"auth":var a=t.indexOf(":");~a?(o.username=t.slice(0,a),o.username=encodeURIComponent(decodeURIComponent(o.username)),o.password=t.slice(a+1),o.password=encodeURIComponent(decodeURIComponent(o.password))):o.username=encodeURIComponent(decodeURIComponent(t))}for(var u=0;u<p.length;u++){var l=p[u];l[4]&&(o[l[1]]=o[l[1]].toLowerCase())}return o.auth=o.password?o.username+":"+o.password:o.username,o.origin="file:"!==o.protocol&&m(o.protocol)&&o.host?o.protocol+"//"+o.host:"null",o.href=o.toString(),o},toString:function(e){e&&"function"==typeof e||(e=i.stringify);var t,r=this,n=r.host,o=r.protocol;o&&":"!==o.charAt(o.length-1)&&(o+=":");var s=o+(r.protocol&&r.slashes||m(r.protocol)?"//":"");return r.username?(s+=r.username,r.password&&(s+=":"+r.password),s+="@"):r.password?(s+=":"+r.password,s+="@"):"file:"!==r.protocol&&m(r.protocol)&&!n&&"/"!==r.pathname&&(s+="@"),(":"===n[n.length-1]||c.test(r.hostname)&&!r.port)&&(n+=":"),s+=n+r.pathname,(t="object"==b(r.query)?e(r.query):r.query)&&(s+="?"!==t.charAt(0)?"?"+t:t),r.hash&&(s+=r.hash),s}},y.extractProtocol=g,y.location=d,y.trimLeft=f,y.qs=i,e.exports=y},405:function(e){!function(){"use strict";if("undefined"==typeof ses||!ses.ok||ses.ok()){"undefined"!=typeof ses&&(ses.weakMapPermitHostObjects=g);var t=!1;if("function"==typeof WeakMap){var r=WeakMap;if("undefined"!=typeof navigator&&/Firefox/.test(navigator.userAgent));else{var n=new r,i=Object.freeze({});if(n.set(i,1),1===n.get(i))return void(e.exports=WeakMap);t=!0}}Object.prototype.hasOwnProperty;var o=Object.getOwnPropertyNames,s=Object.defineProperty,a=Object.isExtensible,c="weakmap:",u="weakmap:ident:"+Math.random()+"___";if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues&&"function"==typeof ArrayBuffer&&"function"==typeof Uint8Array){var l=new ArrayBuffer(25),f=new Uint8Array(l);crypto.getRandomValues(f),u="weakmap:rand:"+Array.prototype.map.call(f,(function(e){return(e%36).toString(36)})).join("")+"___"}if(s(Object,"getOwnPropertyNames",{value:function(e){return o(e).filter(y)}}),"getPropertyNames"in Object){var p=Object.getPropertyNames;s(Object,"getPropertyNames",{value:function(e){return p(e).filter(y)}})}!function(){var e=Object.freeze;s(Object,"freeze",{value:function(t){return v(t),e(t)}});var t=Object.seal;s(Object,"seal",{value:function(e){return v(e),t(e)}});var r=Object.preventExtensions;s(Object,"preventExtensions",{value:function(e){return v(e),r(e)}})}();var h=!1,d=0,m=function e(){this instanceof e||w();var t=[],r=[],n=d++;return Object.create(e.prototype,{get___:{value:b((function(e,i){var o,s=v(e);return s?n in s?s[n]:i:(o=t.indexOf(e))>=0?r[o]:i}))},has___:{value:b((function(e){var r=v(e);return r?n in r:t.indexOf(e)>=0}))},set___:{value:b((function(e,i){var o,s=v(e);return s?s[n]=i:(o=t.indexOf(e))>=0?r[o]=i:(o=t.length,r[o]=i,t[o]=e),this}))},delete___:{value:b((function(e){var i,o,s=v(e);return s?n in s&&delete s[n]:!((i=t.indexOf(e))<0||(o=t.length-1,t[i]=void 0,r[i]=r[o],t[i]=t[o],t.length=o,r.length=o,0))}))}})};m.prototype=Object.create(Object.prototype,{get:{value:function(e,t){return this.get___(e,t)},writable:!0,configurable:!0},has:{value:function(e){return this.has___(e)},writable:!0,configurable:!0},set:{value:function(e,t){return this.set___(e,t)},writable:!0,configurable:!0},delete:{value:function(e){return this.delete___(e)},writable:!0,configurable:!0}}),"function"==typeof r?function(){function n(){this instanceof m||w();var e,n=new r,i=void 0,o=!1;return e=t?function(e,t){return n.set(e,t),n.has(e)||(i||(i=new m),i.set(e,t)),this}:function(e,t){if(o)try{n.set(e,t)}catch(r){i||(i=new m),i.set___(e,t)}else n.set(e,t);return this},Object.create(m.prototype,{get___:{value:b((function(e,t){return i?n.has(e)?n.get(e):i.get___(e,t):n.get(e,t)}))},has___:{value:b((function(e){return n.has(e)||!!i&&i.has___(e)}))},set___:{value:b(e)},delete___:{value:b((function(e){var t=!!n.delete(e);return i&&i.delete___(e)||t}))},permitHostObjects___:{value:b((function(e){if(e!==g)throw new Error("bogus call to permitHostObjects___");o=!0}))}})}t&&"undefined"!=typeof Proxy&&(Proxy=void 0),n.prototype=m.prototype,e.exports=n,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=m)}function g(e){e.permitHostObjects___&&e.permitHostObjects___(g)}function y(e){return!(e.substr(0,c.length)==c&&"___"===e.substr(e.length-3))}function v(e){if(e!==Object(e))throw new TypeError("Not an object: "+e);var t=e[u];if(t&&t.key===e)return t;if(a(e)){t={key:e};try{return s(e,u,{value:t,writable:!1,enumerable:!1,configurable:!1}),t}catch(e){return}}}function b(e){return e.prototype=null,Object.freeze(e)}function w(){h||"undefined"==typeof console||(h=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}}()},9602:function(e,t,r){var n,i;n=r(1625);var o=r(3485);e.exports={getCloudSynchroniser:function(e,t,r,o,s){return null!==i&&(i=new n(e,t,r,o,s)),i},SyncTLElection:o}},1625:function(e,t,r){var n,i=r(1285),o=r(2699),s=new(r(405)),a=r(4419),c=r(8525),u=r(4116),l=r(1959),f=r(5336),p=r(6244),h=r(8450),d=r(7196),m=r(2108),g=r(3565),y=r(3897),v=r(3485);function w(){var e,t;return e=s.get(this),(t={}).sessionId=e.sessionId,t.contextId=e.contextId,e.adapter=new c(e.syncUrl.hostname,e.syncUrl.port,e.deviceId,t),e.adapter.on("connectionlost",E.bind(this)),e.messenger=new a(e.adapter),e.messenger.on("message",_.bind(this)),e.messenger.on("request",S.bind(this)),new Promise((function(t,r){e.adapter.on("connectionestablished",t),e.adapter.on("connectionfailure",r)}))}function _(e){switch(e.type){case"TimelineUpdate":D.call(this,e);break;case"SyncTimelinesAvailable":P.call(this,e);break;case"DeviceStatus":j.call(this,e);break;case"ApplicationBroadcast":L.call(this,e)}}function S(e){switch(e.type){case"TimelineUpdateREQ":N.call(this,e);break;case"StopTimelineUpdateREQ":M.call(this,e);break;case"PingREQ":z.call(this,e)}}function E(e){this.emit("SyncServiceUnavailable",{errorCode:1,errorMessage:"Sync-Service connection terminated"})}function k(e){this.emit("DeviceRegistrationError",{errorCode:1,errorMessage:e})}function T(){var e,t;return t=this,(e=s.get(this)).messenger.listen(e.respTopic),e.messenger.listen(e.sessionStateTopic),e.messenger.listen(e.sessionApplicationBroadcastTopic),new Promise((function(r,n){Q.call(t,"JoinREQ",e.onboardingTopic,r,{onMaxRetryFailed:console.error},e.respTopic,e.syncTimelineElection)}))}function C(e){var t=s.get(this);return new Promise((function(r,n){"string"!=typeof e.wallclockUrl||e.wallclockUrl.length<"ws://".length?n({errorCode:3,errorMessage:"Invalid wallclock url '"+e.wallclock+"'"}):"string"!=typeof e.sessionSyncControllerUrl||e.sessionSyncControllerUrl.length<"ws://".length?n({errorCode:4,errorMessage:"Invalid SessionSyncController url '"+e.sessionSyncControllerUrl+"'"}):("object"==b(e.rateLimit)&&("number"==typeof e.rateLimit.numUpdates&&(e.rateLimit.numUpdates=e.rateLimit.numUpdates),"number"==typeof e.rateLimit.interval&&(e.rateLimit.interval=e.rateLimit.interval)),t.wcUrl=e.wallclockUrl,r())}))}function I(){var e;(e=s.get(this)).wallclock=new p.CorrelatedClock(e.sysClock),e.wallclock.on("available",this.emit.bind(this,"WallClockAvailable")),e.wallclock.on("unavailable",this.emit.bind(this,"WallClockUnAvailable")),e.wallclockSynchroniser=new f(e.wcUrl,e.wallclock),e.wallclockSynchroniser.start()}function R(e,t,r){0===e.responseCode?t(e):r(e)}function x(e,t,r){var n=s.get(this).deviceId;R(r,(function(t){var r=t.devices;r=r.filter((function(e){return e!==n})),e(r)}),t)}function A(e,t,r){R(r,(function(t){e(t.contexts)}),t)}function O(e,t,r,n){s.get(this).ownTimelines.getById(r).updateChannel=n.timelineUpdateChannel,R(n,e,t)}function P(e){e.timelineInfo,this.emit("SyncTimelinesAvailable",e.timelineInfo)}function L(e){e.broadcastTopic,e.broadcastContent,this.emit("ApplicationBroadcast",{deviceId:e.deviceId,topic:e.broadcastTopic,content:e.broadcastContent})}function j(e){this.emit("DeviceStatus",{deviceId:e.deviceId,status:e.status})}function N(e){var t;null!==(t=s.get(this).ownTimelines.getById(e.timelineId))&&(t.clock.listeners("change").indexOf(B.bind(this,t))>-1||t.clock.on("change",function(e){e.clock.id,(null===e.syncTimeline||Math.abs(e.clock.now()-e.syncTimeline.clock.now())>40||e.clock.getEffectiveSpeed()!==e.syncTimeline.clock.getEffectiveSpeed())&&B.call(this,e)}.bind(this,t)),t.clock.id,U.call(this,e),B.call(this,t))}function U(e){var t,r;t=s.get(this),r=l.create("TimelineUpdateRESP",t.sessionId,0,e.id,t.version),t.messenger.send(r,e.responseChannel)}function M(){var e;null!==(e=s.get(this).ownTimelines.getById(request.timelineId))&&e.clock.remove("change",B.bind(this,e))}function B(e){var t,r;t=s.get(this),null!==e.tokenBucket.getToken()&&(r=l.create("TimelineUpdate",t.sessionId,t.deviceId,e.timelineId,e.timelineType,e.contentId,new g(e.clock,t.wallclock,0,0),{timeS:e.clock.getNanos()/Math.pow(10,9),dispersionS:e.clock.dispersionAtTime(e.clock.now())},null,t.version),t.messenger.send(r,e.updateChannel))}function q(e,t,r){R(r,(function(t){e(t.timelineInfo)}),t)}function F(e,t,r,n){var i,o;i=s.get(this),0===n.responseCode?(e(0),(o=H.call(this,r)).updateChannel=n.providerChannel,i.messenger.listen(o.updateChannel),null!==n.presentationTimestamp&&W.call(this,r,n.presentationTimestamp)):(console.error("enableTimelineSync:",n),t())}function D(e){W.call(this,e.timelineId,e.presentationTimestamp)}function H(e){var t,r;return null===(r=(t=s.get(this)).timelineShadows.getById(e))&&((r=new h(e)).clock=new p.CorrelatedClock(t.wallclock),r.clock.id=e,r.clock.setAvailabilityFlag(!1),r.clock.on("available",this.emit.bind(this,"TimelineAvailable",e)),r.clock.id,t.timelineShadows.add(r)),r}function W(e,t){var r;s.get(this),(r=H.call(this,e)).update(t.actual),r.clock.setAvailabilityFlag(!0)}function V(e,t){var r,n;n=this,t.forEach((function(t){e.contentId===t.contentId&&e.timelineType===t.timelineType&&1===e.pairingState&&((r=H.call(n,t.timelineId)).update(t.lastTimestamp),r.clock.setAvailabilityFlag(!0),t.lastTimestamp,n.syncClockToThisTimeline(e.clock,t.timelineId),n.subscribeTimeline(t.timelineId),e.syncTimeline=r,e.pairingState=2)}))}function z(e){var t,r;t=s.get(this),r=l.create("PingRESP",t.sessionId,0,e.id,t.version),t.messenger.send(r,e.responseChannel)}function Q(e,t,r,n){var i,o,a,c;if(o=s.get(this),(i=[])[0]=e,i[1]=o.sessionId,i[2]=o.contextId,i[3]=o.deviceId,i[4]=o.respTopic,a=4,arguments.length>4)for(;a<arguments.length;a++)i[a+1]=arguments[a];return i[a+1]=u.getNewId(),i[a+2]=o.version,c=l.create.apply(null,i),o.messenger.sendRequest(c,t,r,n),c}i(n=function(e,t,r,n,i){var o=i||{};s.set(this,{ownTimelines:new m,timelineShadows:new m,wallclock:null,wcUrl:null,wallclockSynchroniser:null,syncUrl:e||null,sessionId:t||null,contextId:r||null,deviceId:n||null,contentId:null,version:"0.0.1",availableTimelines:null,messenger:null,onboardingTopic:"Sessions/REQ",reqTopic:"Sessions/REQ",respTopic:"Sessions/"+t+"/"+n+"/RESP",rateLimit:{numUpdates:10,interval:5},syncTimelineElection:o.syncTimelineElection||v.EARLIEST_FIRST,sessionStateTopic:"Sessions/"+t+"/state",sessionApplicationBroadcastTopic:"Sessions/"+t+"/application-broadcast",sysClock:i.sysClock||new p.DateNowClock}),w.call(this).catch(k.bind(this)).then(T.bind(this)).catch(this.emit.bind(this,"DeviceRegistrationFailure")).then(C.bind(this)).catch(this.emit.bind(this,"DeviceRegistrationFailure")).then(this.emit.bind(this,"DeviceRegistrationSuccess")).then(I.bind(this))},o),Object.defineProperties(n.prototype,{wallclock:{get:function(){return s.get(this).wallclock}},sessionId:{get:function(){return s.get(this).sessionId}},contextId:{get:function(){return s.get(this).contextId}},contentId:{get:function(){return this.getContentId()},set:function(e){return this.setContentId(e)}},availableTimelines:{get:function(){return s.get(this).availableTimelines}}}),n.prototype.destroy=function(){var e=s.get(this);e.wallclockSynchroniser.stop(),Q.call(this,"LeaveREQ",e.reqTopic,(function(){}),{}),e.messenger.stopListenAll(),e.messenger.disconnect()},n.prototype.getAvailableDevices=function(){var e=this;return new Promise((function(t,r){Q.call(e,"DeviceREQ",s.get(e).reqTopic,x.bind(e,t,r),{})}))},n.prototype.getAvailableContexts=function(){var e=this;return new Promise((function(t,r){Q.call(e,"ContextREQ",s.get(e).reqTopic,A.bind(null,t,r),{})}))},n.prototype.allDevicesInContext=function(e){return new Promise((function(e,t){}))},n.prototype.getContentId=function(){return s.get(this).contentId},n.prototype.setContentId=function(e){var t,r;(t=s.get(this)).contentId=e,r=l.create("ContentIdChange",t.sessionId,t.deviceId,t.contentId,u.getNewId(),t.version),t.messenger.send(r,t.reqTopic)},n.prototype.addTimelineSource=function(e,t,r,n){throw"Not implemented"},n.prototype.addTimelineClock=function(e,t,r,n){var i,o,a,c;return i=s.get(this),c=n||{},a=new d(i.contextId,i.deviceId,r).toUrnString(),timeline=new h(a),timeline.timelineType=t,timeline.contentId=r,timeline.clock=e,timeline.clock.id=a,timeline.useForSessionSync="boolean"==typeof c.useForSessionSync&&c.useForSessionSync,timeline.writable="boolean"!=typeof c.writable||c.writable,timeline.syncTimeline=null,timeline.useForSessionSync?timeline.pairingState=1:timeline.pairingState=0,timeline.tokenBucket=new y(i.rateLimit.numUpdates,i.rateLimit.interval),i.ownTimelines.add(timeline),o=this,i.wallclock.now(),e.now(),new Promise((function(t,r){var n=i.wallclock.now();e.now(),e.getNanos();var s=i.wallclock.dispersionAtTime(n),c=new p.Correlation(i.wallclock.now(),e.now(),s,0),u={parentTime:c.parentTime,childTime:c.childTime,initialError:s,errorGrowthRate:0,speed:e.getEffectiveSpeed()};Q.call(o,"TimelineRegistrationREQ",i.reqTopic,O.bind(o,t,r,a),{},u,timeline.timelineId,timeline.contentId,timeline.timelineType,timeline.frequency,timeline.updateChannel,timeline.useForSessionSync,timeline.writable)}))},n.prototype.sendApplicationBroadcast=function(e,t){var r,n;r=s.get(this),n=l.create("ApplicationBroadcast",r.sessionId,r.deviceId,e,t),r.messenger.send(n,r.sessionApplicationBroadcastTopic,{qos:1})},n.prototype.removeTimeline=function(e){return new Promise((function(e,t){}))},n.prototype.getAvailableTimelines=function(){var e,t;return e=s.get(this),t=this,new Promise((function(r,n){Q.call(t,"TimelineREQ",e.reqTopic,q.bind(null,r,n),{})}))},n.prototype.getAvailableSyncTimelines=function(){var e,t;return t=s.get(this),e=l.create("TimelineREQ",t.sessionId,t.contextId,t.deviceId,t.respTopic,u.getNewId(),t.version,null,null,null,null,!0),new Promise((function(r,n){t.messenger.sendRequest(e,t.reqTopic,q.bind(null,r,n),{})}))},n.prototype.subscribeTimeline=function(e){var t,r;return t=s.get(this),r=this,new Promise((function(n,i){Q.call(r,"TimelineSubscriptionREQ",t.reqTopic,F.bind(r,n,i,e),{},e)}))},n.prototype.synchronise=function(e,t,r){var n,i=s.get(this),o=new d(i.contextId,i.deviceId,r).toUrnString();this.addTimelineClock(e,t,r,{useForSessionSync:!0}),n=i.ownTimelines.getById(o),this.on("SyncTimelinesAvailable",V.bind(this,n))},n.prototype.syncClockToThisTimeline=function(e,t,r){var n,i;n=s.get(this),i=n.timelineShadows.getById(t),r||new p.Correlation({parentTime:0,childTime:0,errorGrowthRate:0,initialError:0}),e.setCorrelationAndSpeed(i.clock.getCorrelation(),i.clock.speed),i.clock.on("change",(function(){e.setCorrelationAndSpeed(i.clock.getCorrelation(),i.clock.speed)})),e.id},n.prototype.getTimelineClockById=function(e){var t;return((t=s.get(this)).timelineShadows.getById(e)||t.ownTimelines.getById(e)).clock},n.prototype.createSyncController=function(e,t,r){},e.exports=n},5336:function(e,t,r){var n=r(2699),i=r(1285),o=r(8438).WallClock.createBinaryWebSocketClient,s=(r(6244),r(405)),a=r(4846),c=new s,u=function(e,t){n.call(this),c.set(this,{});var r=c.get(this),i=a(e);Object.defineProperty(this,"wallclock",{value:t}),r.wsserver_url=i.origin+i.pathname};i(u,n),u.prototype.start=function(){var e=c.get(this);e.ws=new WebSocket(e.wsserver_url),e.ws.binaryType="arraybuffer",e.ws.addEventListener("open",function(){var e=c.get(this);e.wcSyncClient=o(e.ws,this.wallclock,{})}.bind(this))},u.prototype.stop=function(){c.get(this).wcSyncClient.stop()},e.exports=u},1959:function(e,t,r){var n,i=(n=r(2311)).keys().map(n),o={};function s(e){var t,r;for(t=0,r=[];t<e.length;t++)r.push(e[t]);return r}i.forEach((function(e){e.hasOwnProperty("type")&&(o[e.type]=e)})),e.exports={create:function(){var e=s(arguments).slice(1);if(o.hasOwnProperty(arguments[0]))return new(Function.prototype.bind.apply(o[arguments[0]],[null].concat(e)));throw"Unknown message type"},deserialise:function(e){var t=JSON.parse(e);if(t&&t.type&&o.hasOwnProperty(t.type))return o[t.type].deserialise(e);throw"Unknown message type"}}},4116:function(e,t,r){var n,i,o,s=r(8569).encodeUnicode,a=r(8569).decodeUnicode;i=(new Date).getTime(),o=0,n=function(e,t){this.startTime=e,this.count=t},e.exports={getNewId:function(){return o++,id=new n(i,o),function(e){var t=e.startTime+"-"+e.count;return s(t)}(id)},deserialise:function(e){var t=a(e);return t=t.split("-"),new n(t[0],t[1])}}},9554:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(4460);n=a().extend([{name:"deviceId",type:"string",writable:!1,optional:!1},{name:"broadcastTopic",type:"string",writable:!1,optional:!1},{name:"broadcastContent",type:"object",writable:!1,optional:!1}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="ApplicationBroadcast",o(i,s),e.exports=i},3258:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(4460);n=a().extend([{name:"deviceId",type:"string",writable:!1,optional:!1},{name:"contentId",type:"string",writable:!1,optional:!1}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="ContentIdChange",o(i,s),e.exports=i},752:function(e,t,r){var n,i=r(1285),o=r(8771),s=r(1239)().get();n=function(){o.call(this,n.type,arguments,s)},n.deserialise=o.deserialise.bind(null,n,s),n.type="ContextREQ",i(n,o),e.exports=n},4864:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(8072);n=a().extend([{name:"contexts",type:"object",writable:!1,optional:!1}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="ContextRESP",o(i,s),e.exports=i},1805:function(e,t,r){var n,i=r(1285),o=r(8771),s=r(1239)().get();n=function(){o.call(this,n.type,arguments,s)},n.deserialise=o.deserialise.bind(null,n,s),n.type="DeviceREQ",i(n,o),e.exports=n},9801:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(8072);n=a().extend([{name:"devices",type:"object",writable:!1,optional:!1}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="DeviceRESP",o(i,s),e.exports=i},9959:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(4460);n=a().extend([{name:"deviceId",type:"string",writable:!1,optional:!1},{name:"status",type:"string",writable:!1,optional:!1},{name:"contextId",type:"string",writable:!1,optional:!0,default:null}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="DeviceStatus",o(i,s),e.exports=i},535:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(1239);n=a().extend([{name:"requestChannel",type:"string",writable:!1,optional:!1},{name:"syncTLStrategy",type:"number",writable:!1,optional:!1}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="JoinREQ",o(i,s),e.exports=i},348:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(8072);n=a().extend([{name:"wallclockUrl",type:"string",writable:!1,optional:!1},{name:"sessionSyncControllerUrl",type:"string",writable:!1,optional:!1},{name:"rateLimit",type:"object",writable:!1,optional:!0,default:{numUpdates:10,interval:5}}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="JoinRESP",o(i,s),e.exports=i},398:function(e,t,r){var n,i=r(1285),o=r(8771),s=r(1239)().get();n=function(){o.call(this,n.type,arguments,s)},n.deserialise=o.deserialise.bind(null,n,s),n.type="LeaveREQ",i(n,o),e.exports=n},6583:function(e,t,r){var n,i=r(1285),o=r(8771),s=r(8072)().get();n=function(){o.call(this,n.type,arguments,s)},n.deserialise=o.deserialise.bind(null,n,s),n.type="LeaveRESP",i(n,o),e.exports=n},8771:function(e){var t;(t=function(e,t,r){return function(e,t){var r=0,n=function(e){for(var t=0,r=0;t<e.length;t++)e[t].optional||r++;return r}(t);if(e.length<n)throw"Expected minimum of "+n+" arguments. Saw "+e.length+" instead.";for(;r<e.length;r++)if(b(e[r])!==t[r].type&&null!==e[r])throw"Expected' "+t[r].name+"' to be of type '"+t[r].type+"', instead: '"+b(e[r])+"'"}(t=function(e,t){for(var r=0,n=[];r<t.length;r++)n.push(t[r]);return[e].concat(n)}(e,t),r),function(e,t,r){for(var n=0;n<t.length;n++)Object.defineProperty(e,r[n].name,{enumerable:!0,value:t[n],writable:r[n].writable||!1});for(;n<r.length;n++)Object.defineProperty(e,r[n].name,{enumerable:!0,value:r[n].default,writable:r[n].writable||!1})}(this,t,r),this}).prototype.serialise=function(){return JSON.stringify(this)},t.deserialise=function(e,t,r){var n=[];return r=JSON.parse(r),t.forEach((function(t){var i=function(e,t){if(e.hasOwnProperty(t))return e[t];throw"Property '"+t+"' not defined"}(r,t.name);if("type"!==t.name)n.push(i);else if(i!==e.type)throw"'"+e.type+"' cannot deserialise Message of type '"+i+"'"})),new(Function.prototype.bind.apply(e,[null].concat(n)))},e.exports=t},4460:function(e,t,r){var n=r(5287);e.exports=function(){return new n([{name:"type",type:"string",writable:!1,optional:!1},{name:"sessionId",type:"string",writable:!1,optional:!1},{name:"id",type:"string",writable:!1,optional:!0,default:null},{name:"version",type:"string",writable:!1,optional:!0,default:"0.0.1"}])}},5287:function(e,t,r){var n,i=new(r(405));(n=function(e){var t;i.set(this,{}),(t=i.get(this)).mandatory=[],t.optional=[],this.extend(e)}).prototype.extend=function(e){var t=i.get(this);return e.forEach((function(e){e.optional?t.optional.push(e):t.mandatory.push(e)})),this},n.prototype.get=function(){var e=i.get(this);return e.mandatory.concat(e.optional)},e.exports=n},1168:function(e,t,r){var n,i=r(1285),o=r(8771),s=r(1239)().get();n=function(){o.call(this,n.type,arguments,s)},n.deserialise=o.deserialise.bind(null,n,s),n.type="PingREQ",i(n,o),e.exports=n},2836:function(e,t,r){var n,i=r(1285),o=r(8771),s=r(8072)().get();n=function(){o.call(this,n.type,arguments,s)},n.deserialise=o.deserialise.bind(null,n,s),n.type="PingRESP",i(n,o),e.exports=n},1239:function(e,t,r){var n=r(4460);e.exports=function(){return n().extend([{name:"contextId",type:"string",writable:!1,optional:!1},{name:"deviceId",type:"string",writable:!1,optional:!1},{name:"responseChannel",type:"string",writable:!1,optional:!1}])}},8072:function(e,t,r){var n=r(4460);e.exports=function(){return n().extend([{name:"responseCode",type:"number",writable:!1,optional:!1}])}},2:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(1239);n=a().extend([{name:"timelineId",type:"string",writable:!1,optional:!1},{name:"timelineType",type:"string",writable:!1,optional:!1},{name:"contentId",type:"string",writable:!1,optional:!1}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="StopTimelineUpdateREQ",o(i,s),e.exports=i},9666:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(4460);n=a().extend([{name:"timelineInfo",type:"object",writable:!1,optional:!1}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="SyncTimelinesAvailable",o(i,s),e.exports=i},4775:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(8072);n=a().extend([{name:"timelineInfo",type:"object",writable:!1,optional:!1}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="SyncTimelinesRESP",o(i,s),e.exports=i},1582:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(1239);n=a().extend([{name:"timelineId",type:"string",writable:!1,optional:!1}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="TimelineDeRegistrationREQ",o(i,s),e.exports=i},9673:function(e,t,r){var n,i=r(1285),o=r(8771),s=r(8072)().get();n=function(){o.call(this,n.type,arguments,s)},n.deserialise=o.deserialise.bind(null,n,s),n.type="TimelineDeRegistrationRESP",i(n,o),e.exports=n},3763:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(1239);n=a().extend([{name:"timelineId",type:"string",writable:!1,optional:!1}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="TimelineEndSubscriptionREQ",o(i,s),e.exports=i},8143:function(e,t,r){var n,i=r(1285),o=r(8771),s=r(8072)().get();n=function(){o.call(this,n.type,arguments,s)},n.deserialise=o.deserialise.bind(null,n,s),n.type="TimelineEndSubscriptionRESP",i(n,o),e.exports=n},7027:function(){},5744:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(4460);n=a().extend([{name:"contentId",type:"string",writable:!1,optional:!0,default:"*"},{name:"timelineType",type:"string",writable:!1,optional:!0,default:"*"}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="TimelineQuery",o(i,s),e.exports=i},5445:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(1239);n=a().extend([{name:"providerContextId",type:"string",writable:!1,optional:!0,default:null},{name:"providerId",type:"string",writable:!1,optional:!0,default:null},{name:"timelineType",type:"string",writable:!1,optional:!0,default:null},{name:"contentId",type:"string",writable:!1,optional:!0,default:null},{name:"syncTimeline",type:"boolean",writable:!1,optional:!0,default:!1}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="TimelineREQ",o(i,s),e.exports=i},9288:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(8072);n=a().extend([{name:"timelineInfo",type:"object",writable:!1,optional:!1}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="TimelineRESP",o(i,s),e.exports=i},9285:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(1239);n=a().extend([{name:"correlation",type:"object",writable:!1,optional:!1},{name:"timelineId",type:"string",writable:!1,optional:!1},{name:"contentId",type:"string",writable:!1,optional:!1},{name:"timelineType",type:"string",writable:!1,optional:!1},{name:"frequency",type:"number",writable:!1,optional:!1},{name:"channel",type:"string",writable:!1,optional:!1},{name:"useForSessionSync",type:"boolean",writable:!1,optional:!1},{name:"writable",type:"boolean",writable:!1,optional:!1}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="TimelineRegistrationREQ",o(i,s),e.exports=i},9295:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(8072);n=a().extend([{name:"timelineUpdateChannel",type:"string",writable:!1,optional:!0}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="TimelineRegistrationRESP",o(i,s),e.exports=i},1528:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(1239);n=a().extend([{name:"timelineId",type:"string",writable:!1,optional:!1}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="TimelineSubscriptionREQ",o(i,s),e.exports=i},664:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(8072);n=a().extend([{name:"providerChannel",type:"string",writable:!1,optional:!1},{name:"presentationTimestamp",type:"object",writable:!1,optional:!0,default:null}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="TimelineSubscriptionRESP",o(i,s),e.exports=i},5658:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(4460);n=a().extend([{name:"deviceId",type:"string",writable:!1,optional:!1},{name:"timelineId",type:"string",writable:!1,optional:!1},{name:"timelineType",type:"string",writable:!1,optional:!1},{name:"contentId",type:"string",writable:!1,optional:!1},{name:"presentationTimestamp",type:"object",writable:!1,optional:!1},{name:"dispersionAt",type:"object",writable:!1,optional:!1}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="TimelineUpdate",o(i,s),e.exports=i},3577:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(1239);n=a().extend([{name:"timelineId",type:"string",writable:!1,optional:!1},{name:"timelineType",type:"string",writable:!1,optional:!1},{name:"contentId",type:"string",writable:!1,optional:!1}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="TimelineUpdateREQ",o(i,s),e.exports=i},6471:function(e,t,r){var n,i=r(1285),o=r(8771),s=r(8072)().get();n=function(){o.call(this,n.type,arguments,s)},n.deserialise=o.deserialise.bind(null,n,s),n.type="TimelineUpdateRESP",i(n,o),e.exports=n},9557:function(e,t,r){var n,i,o=r(1285),s=r(8771),a=r(4460);n=a().extend([{name:"contextId",type:"string",writable:!1,optional:!1},{name:"deviceId",type:"string",writable:!1,optional:!1}]).get(),i=function(){s.call(this,i.type,arguments,n)},i.deserialise=s.deserialise.bind(null,i,n),i.type="UnexpectedDeviceExit",o(i,s),e.exports=i},2311:function(e,t,r){var n={"./ApplicationBroadcast.js":9554,"./ContentIdChange.js":3258,"./ContextREQ.js":752,"./ContextRESP.js":4864,"./DeviceREQ.js":1805,"./DeviceRESP.js":9801,"./DeviceStatus.js":9959,"./JoinREQ.js":535,"./JoinRESP.js":348,"./LeaveREQ.js":398,"./LeaveRESP.js":6583,"./Message.js":8771,"./MessageParams.js":4460,"./ParameterList.js":5287,"./PingREQ.js":1168,"./PingRESP.js":2836,"./REQParams.js":1239,"./RESPParams.js":8072,"./StopTimelineUpdateREQ.js":2,"./SyncTimelinesAvailable.js":9666,"./SyncTimelinesRESP.js":4775,"./TimelineDeRegistrationREQ.js":1582,"./TimelineDeRegistrationRESP.js":9673,"./TimelineEndSubscriptionREQ.js":3763,"./TimelineEndSubscriptionRESP.js":8143,"./TimelineInfo.js":7027,"./TimelineQuery.js":5744,"./TimelineREQ.js":5445,"./TimelineRESP.js":9288,"./TimelineRegistrationREQ.js":9285,"./TimelineRegistrationRESP.js":9295,"./TimelineSubscriptionREQ.js":1528,"./TimelineSubscriptionRESP.js":664,"./TimelineUpdate.js":5658,"./TimelineUpdateREQ.js":3577,"./TimelineUpdateRESP.js":6471,"./UnexpectedDeviceExit.js":9557};function i(e){var t=o(e);return r(t)}function o(e){if(!r.o(n,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return n[e]}i.keys=function(){return Object.keys(n)},i.resolve=o,e.exports=i,i.id=2311},4419:function(e,t,r){var n,i,o,s,a,c,u,l;function f(e){e=o.deserialise(e),l.get(this).dispatcher.call(e)||(e.hasOwnProperty("responseChannel")?this.emit("request",e):this.emit("message",e))}function p(e,t,r,n,i){var o;o=l.get(this),n<=r.maxRetry?(o.dispatcher.set(e,i,p.bind(this,e,t,r,++n,i),r.responseTimeoutMS,!r.updates),o.client.send(e.serialise(),t)):r.onMaxRetryFailed(new s(e,t,n))}a=r(405),c=r(2699),u=r(1285),o=r(1959),i=r(2711),l=new a,u(n=function(e){l.set(this,{dispatcher:new i,client:e}),e.on("message",f.bind(this))},c),n.prototype.getClientId=function(){l.get(this).client.getClientId()},n.prototype.send=function(e,t,r){l.get(this).client.send(e.serialise(),t,r)},n.prototype.sendRequest=function(e,t,r,n){var i;(i=n||{}).maxRetry=i.maxRetry||0,i.responseTimeoutMS=i.responseTimeoutMS||2e3,i.updates=i.updates||!1,i.onMaxRetryFailed=i.onMaxRetryFailed||function(){},p.call(this,e,t,i,0,r)},n.prototype.listen=function(e){l.get(this).client.listen(e)},n.prototype.stopListen=function(e){l.get(this).client.stopListen(e)},n.prototype.stopListenAll=function(){l.get(this).client.stopListenAll()},n.prototype.disconnect=function(){l.get(this).client.disconnect()},n.prototype.broadcast=function(e,t){l.get(this).client.send(e,t)},u(s=function(e,t,r){this.name="MaxRequestRetryExceedError",this.message="Saw no response to any of "+r+" requests.",this.requestMessage=e,this.requestChannel=t},Error),e.exports=n},2711:function(e,t,r){var n,i=new(r(405));function o(e){var t,r;r=(t=i.get(this)).messageMap[e].onresponsetimeout,t.messageMap.hasOwnProperty(e)&&(delete t.messageMap[e],r())}(n=function(e){var t;i.set(this,{}),(t=i.get(this)).messageMap={},t.responseTimeout=e||2e3}).prototype.set=function(e,t,r,n,s){var a,c,u;if(a=i.get(this),"function"!=(c=b(t)))throw new Error("Expected 'onresponse' to be of type function. Saw '"+c+"' instead");if("function"!=(c=b(u=r||function(){})))throw new Error("Expected 'onresponsetimeout' to be of type function. Saw '"+c+"' instead");a.messageMap[e.id]={onresponse:t,onresponsetimeout:u,timeout:setTimeout(o.bind(this,e.id),n||a.responseTimeout),once:s||!1}},n.prototype.setOnce=function(e,t,r,n){var o=i.get(this);this.set(e,t,r||function(){},n||o.responseTimeoutMS,!0)},n.prototype.call=function(e){var t=i.get(this);return!!t.messageMap.hasOwnProperty(e.id)&&(t.messageMap[e.id].onresponse(e),clearTimeout(t.messageMap[e.id].timeout),!0===t.messageMap[e.id].once&&delete t.messageMap[e.id],!0)},e.exports=n},1176:function(e,t,r){var n,i,o;i=r(405),o=new i,(n=function(){o.set(this,{map:[]})}).prototype.addIfNew=function(e){var t=o.get(this).map;if(t.indexOf(e)<0)return t.push(e),!0},n.prototype.removeIfContained=function(e){var t,r;return(r=(t=o.get(this).map).indexOf(e))>-1&&(t.splice(r,1),!0)},n.prototype.removeAll=function(){var e,t;return e=o.get(this).map,t=[].concat(e),e=[],t},e.exports=n},735:function(e,t,r){var n;n=r(2699);var i=function(e,t,r){throw new Error("Can not create instance of abstract class MessagingAdapter")};r(1285)(i,n),i.prototype.getClientId=function(){throw"Not implemented"},i.prototype.send=function(e,t,r){throw"Not implemented"},i.prototype.listen=function(e){throw"Not implemented"},i.prototype.stopListen=function(e){throw"Not implemented"},i.prototype.stopListenAll=function(e){throw"Not implemented"},i.prototype.disconnect=function(e){throw"Not implemented"},e.exports=i},8525:function(e,t,r){var n,i,o,s,a,c,u;function l(e,t){this.emit.call(this,"message",t)}u=r(1176),s=r(4421),o=r(405),i=r(735),n=r(1285),UnexpectedDeviceExit=r(9557),c=new o,n(a=function(e,t,r,n){var i,o,a,f,p;if(c.set(this,{}),i=c.get(this),f=(a=n||{}).sessionId||"default",p=a.contextId||"default",i.host=e,i.port=t,i.user=r,i.subscribedChannels=new u,(o={}).topic="Sessions/lastwill",o.payload=new UnexpectedDeviceExit(f,p,r).serialise(),o.qos=2,o.retain=!1,void 0!==t)i.client=s.connect({host:e,port:t,keepalive:60,clientId:r,will:o});else{var h="wss://"+e;i.client=s.connect(h,{keepalive:60,clientId:r,will:o})}i.client.on("connect",this.emit.bind(this,"connectionestablished")),i.client.on("error",this.emit.bind(this,"connectionfailure")),i.client.on("close",this.emit.bind(this,"connectionlost")),i.client.on("message",l.bind(this))},i),a.prototype.getClientId=function(){return c.get(this).client.options.clientId},a.prototype.send=function(e,t,r){var n;void 0!==r?(n={qos:r.qos||0,retain:r.retain||!1,dup:r.dup||!1},c.get(this).client.publish(t,e,n)):c.get(this).client.publish(t,e)},a.prototype.listen=function(e){var t=c.get(this);t.subscribedChannels.addIfNew(e)&&t.client.subscribe(e)},a.prototype.stopListen=function(e){priv.subscribedChannels.removeIfContained(e)&&c.get(this).client.unsubscribe(e)},a.prototype.stopListenAll=function(){var e;(e=c.get(this)).subscribedChannels.removeAll().forEach((function(t){e.client.unsubscribe(t)}))},a.prototype.disconnect=function(){c.get(this).client.end()},e.exports=a},3485:function(e){SyncTLElection={EARLIEST_FIRST:1,LOWEST_DISPERSION:2,USE_ALL:3,DYNAMIC:4},e.exports=SyncTLElection},3565:function(e,t,r){var n=r(9711);e.exports=function(e,t,r,i){var o,s,a,c;"function"!=typeof(c=e).getSpeed||"function"!=typeof c.now||"function"!=typeof c.setAtTime||"function"!=typeof c.setTickRate?(o=new n(e.earliest.contentTime,e.earliest.wallclockTime,e.earliest.speed),s=new n(e.actual.contentTime,e.actual.wallclockTime,e.actual.speed),a=new n(e.latest.contentTime,e.latest.wallclockTime,e.latest.speed)):(o=new n(e.now()+r,t.now(),e.getEffectiveSpeed()),s=new n(e.now(),t.now(),e.getEffectiveSpeed()),a=new n(e.now()+i,t.now(),e.getEffectiveSpeed())),Object.defineProperties(this,{earliest:{value:o,enumerable:!0},actual:{value:s,enumerable:!0},latest:{value:a,enumerable:!0}})}},8450:function(e,t,r){r(3565);var n=r(6244).Correlation,i=function(e,t){var r=t||{};if("string"!=typeof e)throw"Missing one or more mandatory parameters or saw one or more wrong parameter types.";Object.defineProperties(this,{timelineId:{enumerable:!0,value:e},timelineType:{enumerable:!0,writable:!0,value:r.timelineType||null},frequency:{enumerable:!0,writable:!0,value:r.frequency||1e3},contentId:{enumerable:!0,writable:!0,value:r.contentId||null},clock:{enumerable:!0,writable:!0,value:r.clock||null},updateChannel:{enumerable:!0,writable:!0,value:r.updateChannel||null},thresholdSecs:{enumerable:!0,writable:!0,value:r.thresholdSecs||.02},useForSessionSync:{enumerable:!0,writable:!0,value:r.useForSessionSync||!1},writable:{enumerable:!0,writable:!0,value:r.writable||!0}})};i.prototype.update=function(e){var t=new n({parentTime:e.wallclockTime,childTime:e.contentTime});return!(!this.writable||!this.clock.isChangeSignificant(t,e.speed,this.thresholdSecs)||(this.clock.setCorrelationAndSpeed(t,e.speed),0))},e.exports=i},2108:function(e,t,r){var n,i,o;o=r(1285),i=r(8450),o(n=function(){},Array),n.prototype.getById=function(e){var t=null;return this.forEach((function(r){r.timelineId===e&&(t=r)})),t},n.prototype.getByContentId=function(e){var t=new n;return this.forEach((function(r){r.contentId===e&&t.push(r)})),t},n.prototype.getByTimelineType=function(e){var t=new n;return this.forEach((function(r){r.timelineType===e&&t.push(r)})),t},n.prototype.add=function(e){if(!(e instanceof i))throw"Timeline.add: Did not add item to Timelines, as item is not recognised as an instance of Timeline";this.contains(e)<0&&this.push(e)},n.prototype.remove=function(e){var t;if(!(e instanceof i))throw"Timeline.remove: Did not remove item from Timelines, as item is not recognised as an instance of Timeline";(t=this.contains(e))>-1&&this.splice(t,1)},n.prototype.contains=function(e){var t=-1;return this.forEach((function(r,n){r.timelineId===e.timelineId&&(t=n)})),t},e.exports=n},7196:function(e,t,r){var n,i=r(8569),o=r(3549);(n=function(e,t,r){e=e,t=t,r=r,Object.defineProperties(this,{contextId:{get:function(){return e},enumerable:!0},deviceId:{get:function(){return t},enumerable:!0},sourceId:{get:function(){return r},enumerable:!0}})}).prototype.toUrnString=function(){var e=[];return e.push(this.contextId),e.push(this.deviceId),e.push(i.encodeUnicode(this.sourceId)),o.stringify(e)},n.fromUrnString=function(e){var t;return(t=o.parse(e))[2]=t[2]&&i.decodeUnicode(t[2])||null,new(Function.prototype.bind.apply(n,[null].concat(t)))},e.exports=n},9711:function(e){e.exports=function(e,t,r){var n,i,o,s=b(e),a=b(t);if("object"===s&&"object"===a)n=e.now(),i=t.now(),o=e.getSpeed();else{if("number"!==s||"number"!==a)throw"Unexpected type";n=e,i=t,o="number"!=typeof r?1:r}Object.defineProperties(this,{contentTime:{value:n,enumerable:!0},wallclockTime:{value:i,enumerable:!0},speed:{value:o,enumerable:!0}})}},3897:function(e,t,r){var n=new(r(405)),i=function(e,t){n.set(this,{size:e,restockInterval:1e3*t,lastBucketRestock:null,numTokensInBucket:0})};function o(){var e=n.get(this);return(null===e.lastBucketRestock||Date.now()-e.lastBucketRestock>e.restockInterval)&&s.call(this),!(e.numTokensInBucket<1)}function s(){var e=n.get(this);e.numTokensInBucket=e.size,e.lastBucketRestock=Date.now()}function a(){return"token"}i.prototype.getToken=function(){var e=n.get(this);return o.call(this)?(e.numTokensInBucket-=1,a.call(this)):null},e.exports=i},3549:function(e){e.exports={stringify:function(e){var t;return t="urn",e.forEach((function(e){t+=":"+e})),t},parse:function(e){return e.split(":").splice(1)}}},8569:function(e,t,r){var n=r(8834).Buffer;e.exports={encodeUnicode:function(e){return function(e){return n.from(e).toString("base64")}(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(function(e,t){return String.fromCharCode("0x"+t)})))},decodeUnicode:function(e){return decodeURIComponent(function(e){return n.from(e,"base64").toString()}(e).split("").map((function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)})).join(""))}}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}return r.g=function(){if("object"==("undefined"==typeof globalThis?"undefined":b(globalThis)))return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==("undefined"==typeof window?"undefined":b(window)))return window}}(),r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r(9602)}()},"object"==b(t)&&"object"==b(e)?e.exports=s():(i=[],void 0===(o="function"==typeof(n=s)?n.apply(t,i):n)||(e.exports=o))},441:function(e){function t(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function n(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=t,t.EventEmitter=t,t.prototype._events=void 0,t.prototype._maxListeners=void 0,t.defaultMaxListeners=10,t.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},t.prototype.emit=function(e){var t,o,s,a,c,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||n(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}if(i(o=this._events[e]))return!1;if(r(o))switch(arguments.length){case 1:o.call(this);break;case 2:o.call(this,arguments[1]);break;case 3:o.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),o.apply(this,a)}else if(n(o))for(a=Array.prototype.slice.call(arguments,1),s=(u=o.slice()).length,c=0;c<s;c++)u[c].apply(this,a);return!0},t.prototype.addListener=function(e,o){var s;if(!r(o))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(o.listener)?o.listener:o),this._events[e]?n(this._events[e])?this._events[e].push(o):this._events[e]=[this._events[e],o]:this._events[e]=o,n(this._events[e])&&!this._events[e].warned&&(s=i(this._maxListeners)?t.defaultMaxListeners:this._maxListeners)&&s>0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},t.prototype.removeListener=function(e,t){var i,o,s,a;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=(i=this._events[e]).length,o=-1,i===t||r(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(n(i)){for(a=s;a-- >0;)if(i[a]===t||i[a].listener&&i[a].listener===t){o=a;break}if(o<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},t.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},t.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},t.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},t.listenerCount=function(e,t){return e.listenerCount(t)}},520:function(e,t,r){var n=r(441),i=r(105),o=new(r(272)),s=0,a=0,c=function(){n.call(this),o.set(this,{});var e=o.get(this);this._availability=!0,this.id="clock_"+s,s+=1,e.timerHandles={},this.on("change",this._rescheduleTimers.bind(this)),e.availablePrev=this._availability};i(c,n),c.prototype.now=function(){throw"Unimplemented"},Object.defineProperty(c.prototype,"speed",{get:function(){return this.getSpeed()},set:function(e){return this.setSpeed(e)}}),Object.defineProperty(c.prototype,"tickRate",{get:function(){return this.getTickRate()},set:function(e){return this.setTickRate(e)}}),Object.defineProperty(c.prototype,"parent",{get:function(){return this.getParent()},set:function(e){return this.setParent(e)}}),Object.defineProperty(c.prototype,"availabilityFlag",{get:function(){return this.getAvailabilityFlag()},set:function(e){return this.setAvailabilityFlag(e)}}),c.prototype.getSpeed=function(){return 1},c.prototype.setSpeed=function(e){throw"Unimplemented"},c.prototype.getEffectiveSpeed=function(){for(var e=1,t=this;null!==t;)e*=t.getSpeed(),t=t.getParent();return e},c.prototype.getTickRate=function(){throw"Unimplemented"},c.prototype.setTickRate=function(e){throw"Unimplemented"},c.prototype.getNanos=function(){return 1e9*this.now()/this.getTickRate()},c.prototype.fromNanos=function(e){return e*this.getTickRate()/1e9},c.prototype.isAvailable=function(){var e=this.getParent();return this._availability&&(!e||e.isAvailable())},c.prototype.setAvailabilityFlag=function(e){this._availability=e,this.notifyAvailabilityChange()},c.prototype.notifyAvailabilityChange=function(){var e=o.get(this),t=this.isAvailable();Boolean(t)!=Boolean(e.availablePrev)&&(e.availablePrev=t,this.emit(t?"available":"unavailable",this))},c.prototype.getAvailabilityFlag=function(){return this._availability},c.prototype.calcWhen=function(e){throw"Unimplemented"},c.prototype.getRoot=function(){for(var e=this,t=e.getParent();t;)t=(e=t).getParent();return e},c.prototype.fromRootTime=function(e){var t=this.getParent();if(t){var r=t.fromRootTime(e);return this.fromParentTime(r)}return e},c.prototype.toRootTime=function(e){var t=this.getParent();if(t){var r=this.toParentTime(e);return t.toRootTime(r)}return e},c.prototype.toOtherClockTime=function(e,t){for(var r=this.getAncestry(),n=e.getAncestry(),i=!1;r.length&&n.length&&r[r.length-1]===n[n.length-1];)r.pop(),n.pop(),i=!0;if(!i)throw"No common ancestor clock.";return r.forEach((function(e){t=e.toParentTime(t)})),n.reverse(),n.forEach((function(e){t=e.fromParentTime(t)})),t},c.prototype.getAncestry=function(){for(var e=[this],t=this;t;){var r=t.getParent();r&&e.push(r),t=r}return e},c.prototype.toParentTime=function(e){throw"Unimplemented"},c.prototype.fromParentTime=function(e){throw"Unimplemented"},c.prototype.getParent=function(){throw"Unimplemented"},c.prototype.setParent=function(e){throw"Unimplemented"},c.prototype.clockDiff=function(e){if(this.getEffectiveSpeed()!==e.getEffectiveSpeed())return Number.POSITIVE_INFINITY;if(this.getTickRate()!==e.getTickRate())return Number.POSITIVE_INFINITY;var t=this.getRoot().now(),r=this.fromRootTime(t),n=e.fromRootTime(t);return Math.abs(r-n)/this.getTickRate()},c.prototype.dispersionAtTime=function(e){var t=this._errorAtTime(e),r=this.getParent();if(r){var n=this.toParentTime(e);t+=r.dispersionAtTime(n)}return t},c.prototype._errorAtTime=function(e){throw"Unimplemented"},c.prototype.getRootMaxFreqError=function(){var e=this.getRoot();if(e===this)throw"Unimplemented";return e.getRootMaxFreqError()},c.prototype.setTimeout=function(e,t){return arguments[1]=arguments[1]+this.now(),this.setAtTime.apply(this,arguments)},c.prototype.setAtTime=function(e,t){var r=o.get(this),n=this,i=n.id+":timeout-"+a++,s=n.getRoot();null===s&&(s=n);for(var c=new Array(arguments.length-2),u=2;u<arguments.length;u++)c[u-2]=arguments[u];var l=function(){delete r.timerHandles[i],e.apply(n,c)},f=n.toRootTime(t)-s.now();0!==f&&(f=0!==s.getSpeed()?f/s.getSpeed():NaN);var p,h=f*(1e3/s.getTickRate());return isNaN(h)||(p=setTimeout(l,h)),r.timerHandles[i]={realHandle:p,when:t,callback:l},i},c.prototype._rescheduleTimers=function(){var e=o.get(this),t=this.getRoot();for(var r in e.timerHandles)if(e.timerHandles.hasOwnProperty(r)){var n=e.timerHandles[r];null!==n.realHandle&&void 0!==n.realHandle&&clearTimeout(n.realHandle);var i=this.toRootTime(n.when)-t.now();0!==i&&(i=0!==t.getSpeed()?i/t.getSpeed():NaN);var s=i*(1e3/t.getTickRate());isNaN(s)?delete n.realHandle:n.realHandle=setTimeout(n.callback,Math.max(0,s))}},c.prototype.clearTimeout=function(e){var t=o.get(this),r=t.timerHandles[e];void 0!==r&&(clearTimeout(r.realHandle),delete t.timerHandles[e])},e.exports=c},835:function(e,t,r){var n=r(105),i=r(520),o=r(336),s=new(r(272)),a=function(e,t){i.call(this),s.set(this,{});var r=s.get(this);if(t&&void 0!==t.tickRate){if(t.tickRate<=0)throw"Cannot have tickrate of zero or less";r.freq=t.tickRate}else r.freq=1e3;t&&void 0!==t.speed?r.speed=t.speed:r.speed=1,r.parent=e,t&&void 0!==t.correlation?r.corr=new o(t.correlation):r.corr=new o(0,0,0,0),r.parentHandlers={change:function(e){this.emit("change",this)}.bind(this),available:this.notifyAvailabilityChange.bind(this),unavailable:this.notifyAvailabilityChange.bind(this)},r.parent=null,this.setParent(e)};n(a,i),a.prototype.now=function(){var e=s.get(this),t=e.corr;return null===e.parent||void 0===e.parent?NaN:t.childTime+(e.parent.now()-t.parentTime)*e.freq*e.speed/e.parent.getTickRate()},a.prototype.toString=function(){var e=s.get(this);return"CorrelatedClock("+(e.parent?e.parent.id:"<<no-parent>>")+", {tickRate:"+e.freq+", speed:"+e.speed+", correlation:"+e.corr+"}) ["+this.id+"]"},a.prototype.getSpeed=function(){return s.get(this).speed},a.prototype.setSpeed=function(e){var t=s.get(this);t.speed!=e&&(t.speed=e,this.emit("change",this))},a.prototype.getTickRate=function(){return s.get(this).freq},a.prototype.setTickRate=function(e){var t=s.get(this);t.freq!=e&&(t.freq=e,this.emit("change",this))},a.prototype.rebaseCorrelationAt=function(e){var t=s.get(this);t.corr=t.corr.butWith({parentTime:this.toParentTime(e),childTime:e,initialError:this._errorAtTime(e)})},Object.defineProperty(a.prototype,"correlation",{get:function(){return this.getCorrelation()},set:function(e){return this.setCorrelation(e)}}),a.prototype.getCorrelation=function(){return s.get(this).corr},a.prototype.setCorrelation=function(e){s.get(this).corr=new o(e),this.emit("change",this)},a.prototype.setCorrelationAndSpeed=function(e,t){var r=s.get(this);r.corr=new o(e),r.speed=t,this.emit("change",this)},a.prototype.calcWhen=function(e){return s.get(this).parent.calcWhen(this.toParentTime(e))},a.prototype.toParentTime=function(e){var t=s.get(this);return null===t.parent||void 0===t.parent?NaN:0===t.speed?e===t.corr.childTime?t.corr.parentTime:NaN:t.corr.parentTime+(e-t.corr.childTime)*t.parent.getTickRate()/t.freq/t.speed},i.prototype.fromParentTime=function(e){var t=s.get(this);return null===t.parent||void 0===t.parent?NaN:t.corr.childTime+(e-t.corr.parentTime)*t.freq*t.speed/t.parent.getTickRate()},a.prototype.getParent=function(){return s.get(this).parent},a.prototype.setParent=function(e){var t,r=s.get(this);if(r.parent!=e){if(r.parent)for(t in r.parentHandlers)r.parent.removeListener(t,r.parentHandlers[t]);if(r.parent=e,r.parent)for(t in r.parentHandlers)r.parent.on(t,r.parentHandlers[t]);this.emit("change",this)}},a.prototype.quantifySignedChange=function(e,t){var r=s.get(this);if(e=new o(e),t!=r.speed)return t>r.speed?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;var n=e.parentTime,i=e.childTime;return 0!==t?(n-this.toParentTime(i))/r.parent.getTickRate():(i-this.fromParentTime(n))/r.freq},a.prototype.quantifyChange=function(e,t){return Math.abs(this.quantifySignedChange(e,t))},a.prototype.isChangeSignificant=function(e,t,r){return this.quantifyChange(e,t)>r},a.prototype._errorAtTime=function(e){var t=s.get(this),r=this.toParentTime(e),n=Math.abs(r-t.corr.parentTime)/t.parent.getTickRate();return t.corr.initialError+n*t.corr.errorGrowthRate},e.exports=a},336:function(e,t,r){var n=new(r(272)),i=function(e,t,r,i){n.set(this,{});var o,s=n.get(this);Array.isArray(e)?(o=e[0],t=e[1],r=e[2],i=e[3]):"object"==typeof e?(o=e.parentTime,t=e.childTime,r=e.initialError,i=e.errorGrowthRate):o=e,s.parentTime=void 0!==o?o:0,s.childTime=void 0!==t?t:0,s.initialError=void 0!==r?r:0,s.errorGrowthRate=void 0!==i?i:0};i.prototype.butWith=function(e){var t=n.get(this);if(void 0===e)return this;var r=e.parentTime,o=e.childTime,s=e.initialError,a=e.errorGrowthRate;return void 0===r&&(r=t.parentTime),void 0===o&&(o=t.childTime),void 0===s&&(s=t.initialError),void 0===a&&(a=t.errorGrowthRate),new i(r,o,s,a)},Object.defineProperty(i.prototype,"parentTime",{get:function(){return n.get(this).parentTime},set:function(e){throw"Cannot set this property, object is immutable. Use butWith() method."}}),Object.defineProperty(i.prototype,"childTime",{get:function(){return n.get(this).childTime},set:function(e){throw"Cannot set this property, object is immutable. Use butWith() method."}}),Object.defineProperty(i.prototype,"initialError",{get:function(){return n.get(this).initialError},set:function(e){throw"Cannot set this property, object is immutable. Use butWith() method."}}),Object.defineProperty(i.prototype,"errorGrowthRate",{get:function(){return n.get(this).errorGrowthRate},set:function(e){throw"Cannot set this property, object is immutable. Use butWith() method."}}),i.prototype.equals=function(e){var t=n.get(this);return t.parentTime===e.parentTime&&t.childTime===e.childTime&&t.initialError===e.initialError&&t.errorGrowthRate===e.errorGrowthRate},i.prototype.toJSON=function(){var e=n.get(this);return JSON.stringify({parentTime:e.parentTime,childTime:e.childTime,initialError:e.initialError,errorGrowthRate:e.errorGrowthRate})},e.exports=i},981:function(e,t,r){var n=r(105),i=r(520),o=r(928),s=new(r(272)),a=o(Date.now.bind(Date),100)/1e3,c=function(e){i.call(this),s.set(this,{});var t=s.get(this);if(e&&void 0!==e.tickRate){if(e.tickRate<=0)throw"Cannot have tickrate of zero or less";t.freq=e.tickRate}else t.freq=1e3;e&&void 0!==e.maxFreqErrorPpm?t.maxFreqErrorPpm=e.maxFreqErrorPpm:t.maxFreqErrorPpm=50,t.precision=a};n(c,i),c.prototype.now=function(){return Date.now()/1e3*s.get(this).freq},c.prototype.getTickRate=function(){return s.get(this).freq},c.prototype.calcWhen=function(e){return e/s.get(this).freq*1e3},c.prototype.toString=function(){var e=s.get(this);return"DateNowClock({tickRate:"+e.freq+", maxFreqErrorPpm:"+e.maxFreqErrorPpm+"}) ["+this.id+"]"},c.prototype.toParentTime=function(e){throw"Clock has no parent."},c.prototype.fromParentTime=function(e){throw"Clock has no parent."},c.prototype.getParent=function(){return null},c.prototype.setParent=function(e){throw"Cannot set a parent for this clock."},c.prototype.setAvailabilityFlag=function(e){if(!e)throw"Cannot change availability of this clock."},c.prototype._errorAtTime=function(e){return s.get(this).precision},c.prototype.getRootMaxFreqError=function(){return s.get(this).maxFreqErrorPpm},e.exports=c},928:function(e){e.exports=function(e,t){for(var r=[];r.length<t;){var n=e(),i=e();n<i&&r.push(i-n)}return Math.min.apply(this,r)}},725:function(e){"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}e.exports=o,e.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}m(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,i)}))},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var s=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function u(e,t,r,n){var i,o,s,u;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=c(e))>0&&s.length>i&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){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 f(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=l.bind(n);return i.listener=r,n.wrapFn=i,i}function p(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):d(i,i.length)}function h(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function d(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function m(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");s=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return c(this)},o.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var u=c.length,l=d(c,u);for(r=0;r<u;++r)n(l[r],this,t)}return!0},o.prototype.addListener=function(e,t){return u(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return u(this,e,t,!0)},o.prototype.once=function(e,t){return a(t),this.on(e,f(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,f(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,n,i,o,s;if(a(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,s||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},o.prototype.listeners=function(e){return p(this,e,!0)},o.prototype.rawListeners=function(e){return p(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},o.prototype.listenerCount=h,o.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},105:function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},272:function(e){!function(){"use strict";if("undefined"==typeof ses||!ses.ok||ses.ok()){"undefined"!=typeof ses&&(ses.weakMapPermitHostObjects=g);var t=!1;if("function"==typeof WeakMap){var r=WeakMap;if("undefined"!=typeof navigator&&/Firefox/.test(navigator.userAgent));else{var n=new r,i=Object.freeze({});if(n.set(i,1),1===n.get(i))return void(e.exports=WeakMap);t=!0}}Object.prototype.hasOwnProperty;var o=Object.getOwnPropertyNames,s=Object.defineProperty,a=Object.isExtensible,c="weakmap:",u="weakmap:ident:"+Math.random()+"___";if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues&&"function"==typeof ArrayBuffer&&"function"==typeof Uint8Array){var l=new ArrayBuffer(25),f=new Uint8Array(l);crypto.getRandomValues(f),u="weakmap:rand:"+Array.prototype.map.call(f,(function(e){return(e%36).toString(36)})).join("")+"___"}if(s(Object,"getOwnPropertyNames",{value:function(e){return o(e).filter(y)}}),"getPropertyNames"in Object){var p=Object.getPropertyNames;s(Object,"getPropertyNames",{value:function(e){return p(e).filter(y)}})}!function(){var e=Object.freeze;s(Object,"freeze",{value:function(t){return v(t),e(t)}});var t=Object.seal;s(Object,"seal",{value:function(e){return v(e),t(e)}});var r=Object.preventExtensions;s(Object,"preventExtensions",{value:function(e){return v(e),r(e)}})}();var h=!1,d=0,m=function(){this instanceof m||w();var e=[],t=[],r=d++;return Object.create(m.prototype,{get___:{value:b((function(n,i){var o,s=v(n);return s?r in s?s[r]:i:(o=e.indexOf(n))>=0?t[o]:i}))},has___:{value:b((function(t){var n=v(t);return n?r in n:e.indexOf(t)>=0}))},set___:{value:b((function(n,i){var o,s=v(n);return s?s[r]=i:(o=e.indexOf(n))>=0?t[o]=i:(o=e.length,t[o]=i,e[o]=n),this}))},delete___:{value:b((function(n){var i,o,s=v(n);return s?r in s&&delete s[r]:!((i=e.indexOf(n))<0||(o=e.length-1,e[i]=void 0,t[i]=t[o],e[i]=e[o],e.length=o,t.length=o,0))}))}})};m.prototype=Object.create(Object.prototype,{get:{value:function(e,t){return this.get___(e,t)},writable:!0,configurable:!0},has:{value:function(e){return this.has___(e)},writable:!0,configurable:!0},set:{value:function(e,t){return this.set___(e,t)},writable:!0,configurable:!0},delete:{value:function(e){return this.delete___(e)},writable:!0,configurable:!0}}),"function"==typeof r?function(){function n(){this instanceof m||w();var e,n=new r,i=void 0,o=!1;return e=t?function(e,t){return n.set(e,t),n.has(e)||(i||(i=new m),i.set(e,t)),this}:function(e,t){if(o)try{n.set(e,t)}catch(r){i||(i=new m),i.set___(e,t)}else n.set(e,t);return this},Object.create(m.prototype,{get___:{value:b((function(e,t){return i?n.has(e)?n.get(e):i.get___(e,t):n.get(e,t)}))},has___:{value:b((function(e){return n.has(e)||!!i&&i.has___(e)}))},set___:{value:b(e)},delete___:{value:b((function(e){var t=!!n.delete(e);return i&&i.delete___(e)||t}))},permitHostObjects___:{value:b((function(e){if(e!==g)throw new Error("bogus call to permitHostObjects___");o=!0}))}})}t&&"undefined"!=typeof Proxy&&(Proxy=void 0),n.prototype=m.prototype,e.exports=n,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=m)}function g(e){e.permitHostObjects___&&e.permitHostObjects___(g)}function y(e){return!(e.substr(0,c.length)==c&&"___"===e.substr(e.length-3))}function v(e){if(e!==Object(e))throw new TypeError("Not an object: "+e);var t=e[u];if(t&&t.key===e)return t;if(a(e)){t={key:e};try{return s(e,u,{value:t,writable:!1,enumerable:!1,configurable:!1}),t}catch(e){return}}}function b(e){return e.prototype=null,Object.freeze(e)}function w(){h||"undefined"==typeof console||(h=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}}()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={id:n,loaded:!1,exports:{}};return e[n](o,o.exports,r),o.loaded=!0,o.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e};var n={};return function(){"use strict";r.r(n),r.d(n,{CloudSyncAdapter:function(){return _}});var e=r(470),t=r.n(e),i=r(835),o=r.n(i),s=r(981),a=r.n(s),c=r(725);function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){return f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},f(e,t)}function p(e,t){if(t&&("object"===u(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}var d=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(o,e);var t,r,n,i=(r=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=h(r);if(n){var i=h(this).constructor;e=Reflect.construct(t,arguments,i)}else e=t.apply(this,arguments);return p(this,e)});function o(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).sysClock,l(this,o),i.call(this)}return(t=[{key:"wallClock",get:function(){}},{key:"connect",value:function(e,t){return t.sessionId,t.deviceId,t.startSession,Promise.resolve(this)}},{key:"provideTimelineClock",value:function(e,t,r){}},{key:"requestTimelineClock",value:function(e,t){}},{key:"sendMessage",value:function(e,t){}},{key:"destroy",value:function(){}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(o.prototype,t),o}(r.n(c)());function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(e,t){return y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},y(e,t)}function v(e,t){if(t&&("object"===m(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}var w=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&y(e,t)}(c,e);var r,n,i,s=(n=c,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=b(n);if(i){var r=b(this).constructor;e=Reflect.construct(t,arguments,r)}else e=t.apply(this,arguments);return v(this,e)});function c(){var e,t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).sysClock,r=void 0===t?null:t;return g(this,c),(e=s.call(this))._sysClock=r,null===e._sysClock&&(e._sysClock=new(a())),e._connected=!1,e._connectPromise=null,e._synchroniser=null,e._wallClock=new(o())(e._sysClock,{tickRate:1e3}),e._wallClock.id="adapter-wallClock",e}return r=[{key:"connect",value:function(e,r){var n=this,i=r.sessionId,o=r.deviceId;return null!==this._connectPromise||(this._syncUrl="string"==typeof e?{hostname:e}:{hostname:e.hostname,port:e.port},this._connectPromise=new Promise((function(e,r){n._synchroniser=t().getCloudSynchroniser(n._syncUrl,i,"default",o,{syncTimelineElection:t().SyncTLElection.EARLIEST_FIRST,sysClock:n._sysClock}),n._synchroniser.on("WallClockAvailable",(function(){n._wallClock.setParent(n._synchroniser.wallclock),n.emit("connected"),e(n)})),n._synchroniser.on("SyncServiceUnavailable",(function(){n.emit("disconnected","CloudSyncAdapter: connect failed."),r()})),n._synchroniser.on("ApplicationBroadcast",(function(e){var t=e.topic,r=e.content;n.emit("broadcast",{deviceId:e.deviceId,topic:t,content:r})})),n._synchroniser.on("DeviceStatus",(function(e){var t=e.status;n.emit("presence",{deviceId:e.deviceId,status:t})}))}))),this._connectPromise}},{key:"wallClock",get:function(){return this._wallClock}},{key:"provideTimelineClock",value:function(e,t,r){var n=this;if(null===this._connectPromise)throw new Error("CloudSyncAdapter: provideTimelineClock: Not connected. Call connect() first.");return this._connectPromise.then((function(){return n._synchroniser.synchronise(e,t,r),e}))}},{key:"requestTimelineClock",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(null===this._connectPromise)throw new Error("CloudSyncAdapter: requestTimelineClock: Not connected. Call connect() first.");var i=function(r){return r.timelineType===e&&r.contentId===t},s=new(o())(this.wallClock,{available:!1});return s.id="timelineClock_".concat(t),this._connectPromise.then((function(){return new Promise((function(e,t){var a=function(n){var a=n.find(i);if(void 0!==a){var c=a.timelineId;r._synchroniser.subscribeTimeline(c).then((function(n){0!==n&&t(new Error("synchroniser.subscribeTimeline failed with code: ".concat(n)));var i=new(o())(r.wallClock);r._synchroniser.syncClockToThisTimeline(i,c),s.setParent(i),s.setAvailabilityFlag(!0),e(s)}))}else s.setAvailabilityFlag(!1)};r._synchroniser.on("SyncTimelinesAvailable",a),r._synchroniser.getAvailableSyncTimelines().then(a),n>0&&setTimeout((function(){return t(new Error("cloud-sync-adapter: requestTimelineClock: timeout"))}),n)}))})).catch((function(e){throw new Error("cloud-sync-adapter: requestTimelineClock: ".concat(e.message))}))}},{key:"sendMessage",value:function(e,t){return this._synchroniser.sendApplicationBroadcast(e,t),Promise.resolve()}},{key:"destroy",value:function(){this._synchroniser.destroy()}}],r&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(c.prototype,r),c}(d),_=w}(),n}()}}]);