forked from feross/simple-peer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimplepeer.min.js
3 lines (3 loc) · 75.5 KB
/
simplepeer.min.js
1
2
3
(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.SimplePeer=e()}})(function(){var e,t,r;return function e(t,r,n){function i(a,s){if(!r[a]){if(!t[a]){var f=typeof require=="function"&&require;if(!s&&f)return f(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(e){var r=t[a][1][e];return i(r?r:e)},c,c.exports,e,t,r,n)}return r[a].exports}var o=typeof require=="function"&&require;for(var a=0;a<n.length;a++)i(n[a]);return i}({1:[function(e,t,r){"use strict";r.byteLength=c;r.toByteArray=l;r.fromByteArray=p;var n=[];var i=[];var o=typeof Uint8Array!=="undefined"?Uint8Array:Array;var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var s=0,f=a.length;s<f;++s){n[s]=a[s];i[a.charCodeAt(s)]=s}i["-".charCodeAt(0)]=62;i["_".charCodeAt(0)]=63;function u(e){var t=e.length;if(t%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}return e[t-2]==="="?2:e[t-1]==="="?1:0}function c(e){return e.length*3/4-u(e)}function l(e){var t,r,n,a,s,f;var c=e.length;s=u(e);f=new o(c*3/4-s);n=s>0?c-4:c;var l=0;for(t=0,r=0;t<n;t+=4,r+=3){a=i[e.charCodeAt(t)]<<18|i[e.charCodeAt(t+1)]<<12|i[e.charCodeAt(t+2)]<<6|i[e.charCodeAt(t+3)];f[l++]=a>>16&255;f[l++]=a>>8&255;f[l++]=a&255}if(s===2){a=i[e.charCodeAt(t)]<<2|i[e.charCodeAt(t+1)]>>4;f[l++]=a&255}else if(s===1){a=i[e.charCodeAt(t)]<<10|i[e.charCodeAt(t+1)]<<4|i[e.charCodeAt(t+2)]>>2;f[l++]=a>>8&255;f[l++]=a&255}return f}function h(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[e&63]}function d(e,t,r){var n;var i=[];for(var o=t;o<r;o+=3){n=(e[o]<<16)+(e[o+1]<<8)+e[o+2];i.push(h(n))}return i.join("")}function p(e){var t;var r=e.length;var i=r%3;var o="";var a=[];var s=16383;for(var f=0,u=r-i;f<u;f+=s){a.push(d(e,f,f+s>u?u:f+s))}if(i===1){t=e[r-1];o+=n[t>>2];o+=n[t<<4&63];o+="=="}else if(i===2){t=(e[r-2]<<8)+e[r-1];o+=n[t>>10];o+=n[t>>4&63];o+=n[t<<2&63];o+="="}a.push(o);return a.join("")}},{}],2:[function(e,t,r){},{}],3:[function(e,t,r){(function(t){"use strict";var n=e("buffer");var i=n.Buffer;var o=n.SlowBuffer;var a=n.kMaxLength||2147483647;r.alloc=function e(t,r,n){if(typeof i.alloc==="function"){return i.alloc(t,r,n)}if(typeof n==="number"){throw new TypeError("encoding must not be number")}if(typeof t!=="number"){throw new TypeError("size must be a number")}if(t>a){throw new RangeError("size is too large")}var o=n;var s=r;if(s===undefined){o=undefined;s=0}var f=new i(t);if(typeof s==="string"){var u=new i(s,o);var c=u.length;var l=-1;while(++l<t){f[l]=u[l%c]}}else{f.fill(s)}return f};r.allocUnsafe=function e(t){if(typeof i.allocUnsafe==="function"){return i.allocUnsafe(t)}if(typeof t!=="number"){throw new TypeError("size must be a number")}if(t>a){throw new RangeError("size is too large")}return new i(t)};r.from=function e(r,n,o){if(typeof i.from==="function"&&(!t.Uint8Array||Uint8Array.from!==i.from)){return i.from(r,n,o)}if(typeof r==="number"){throw new TypeError('"value" argument must not be a number')}if(typeof r==="string"){return new i(r,n)}if(typeof ArrayBuffer!=="undefined"&&r instanceof ArrayBuffer){var a=n;if(arguments.length===1){return new i(r)}if(typeof a==="undefined"){a=0}var s=o;if(typeof s==="undefined"){s=r.byteLength-a}if(a>=r.byteLength){throw new RangeError("'offset' is out of bounds")}if(s>r.byteLength-a){throw new RangeError("'length' is out of bounds")}return new i(r.slice(a,a+s))}if(i.isBuffer(r)){var f=new i(r.length);r.copy(f,0,0,r.length);return f}if(r){if(Array.isArray(r)||typeof ArrayBuffer!=="undefined"&&r.buffer instanceof ArrayBuffer||"length"in r){return new i(r)}if(r.type==="Buffer"&&Array.isArray(r.data)){return new i(r.data)}}throw new TypeError("First argument must be a string, Buffer, "+"ArrayBuffer, Array, or array-like object.")};r.allocUnsafeSlow=function e(t){if(typeof i.allocUnsafeSlow==="function"){return i.allocUnsafeSlow(t)}if(typeof t!=="number"){throw new TypeError("size must be a number")}if(t>=a){throw new RangeError("size is too large")}return new o(t)}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{buffer:4}],4:[function(e,t,r){"use strict";var n=e("base64-js");var i=e("ieee754");r.Buffer=f;r.SlowBuffer=w;r.INSPECT_MAX_BYTES=50;var o=2147483647;r.kMaxLength=o;f.TYPED_ARRAY_SUPPORT=a();if(!f.TYPED_ARRAY_SUPPORT&&typeof console!=="undefined"&&typeof console.error==="function"){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.")}function a(){try{var e=new Uint8Array(1);e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}};return e.foo()===42}catch(e){return false}}function s(e){if(e>o){throw new RangeError("Invalid typed array length")}var t=new Uint8Array(e);t.__proto__=f.prototype;return t}function f(e,t,r){if(typeof e==="number"){if(typeof t==="string"){throw new Error("If encoding is specified then the first argument must be a string")}return h(e)}return u(e,t,r)}if(typeof Symbol!=="undefined"&&Symbol.species&&f[Symbol.species]===f){Object.defineProperty(f,Symbol.species,{value:null,configurable:true,enumerable:false,writable:false})}f.poolSize=8192;function u(e,t,r){if(typeof e==="number"){throw new TypeError('"value" argument must not be a number')}if(e instanceof ArrayBuffer){return g(e,t,r)}if(typeof e==="string"){return d(e,t)}return v(e)}f.from=function(e,t,r){return u(e,t,r)};f.prototype.__proto__=Uint8Array.prototype;f.__proto__=Uint8Array;function c(e){if(typeof e!=="number"){throw new TypeError('"size" argument must be a number')}else if(e<0){throw new RangeError('"size" argument must not be negative')}}function l(e,t,r){c(e);if(e<=0){return s(e)}if(t!==undefined){return typeof r==="string"?s(e).fill(t,r):s(e).fill(t)}return s(e)}f.alloc=function(e,t,r){return l(e,t,r)};function h(e){c(e);return s(e<0?0:y(e)|0)}f.allocUnsafe=function(e){return h(e)};f.allocUnsafeSlow=function(e){return h(e)};function d(e,t){if(typeof t!=="string"||t===""){t="utf8"}if(!f.isEncoding(t)){throw new TypeError('"encoding" must be a valid string encoding')}var r=m(e,t)|0;var n=s(r);var i=n.write(e,t);if(i!==r){n=n.slice(0,i)}return n}function p(e){var t=e.length<0?0:y(e.length)|0;var r=s(t);for(var n=0;n<t;n+=1){r[n]=e[n]&255}return r}function g(e,t,r){if(t<0||e.byteLength<t){throw new RangeError("'offset' is out of bounds")}if(e.byteLength<t+(r||0)){throw new RangeError("'length' is out of bounds")}var n;if(t===undefined&&r===undefined){n=new Uint8Array(e)}else if(r===undefined){n=new Uint8Array(e,t)}else{n=new Uint8Array(e,t,r)}n.__proto__=f.prototype;return n}function v(e){if(f.isBuffer(e)){var t=y(e.length)|0;var r=s(t);if(r.length===0){return r}e.copy(r,0,0,t);return r}if(e){if(ArrayBuffer.isView(e)||"length"in e){if(typeof e.length!=="number"||K(e.length)){return s(0)}return p(e)}if(e.type==="Buffer"&&Array.isArray(e.data)){return p(e.data)}}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function y(e){if(e>=o){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+o.toString(16)+" bytes")}return e|0}function w(e){if(+e!=e){e=0}return f.alloc(+e)}f.isBuffer=function e(t){return t!=null&&t._isBuffer===true};f.compare=function e(t,r){if(!f.isBuffer(t)||!f.isBuffer(r)){throw new TypeError("Arguments must be Buffers")}if(t===r)return 0;var n=t.length;var i=r.length;for(var o=0,a=Math.min(n,i);o<a;++o){if(t[o]!==r[o]){n=t[o];i=r[o];break}}if(n<i)return-1;if(i<n)return 1;return 0};f.isEncoding=function e(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};f.concat=function e(t,r){if(!Array.isArray(t)){throw new TypeError('"list" argument must be an Array of Buffers')}if(t.length===0){return f.alloc(0)}var n;if(r===undefined){r=0;for(n=0;n<t.length;++n){r+=t[n].length}}var i=f.allocUnsafe(r);var o=0;for(n=0;n<t.length;++n){var a=t[n];if(!f.isBuffer(a)){throw new TypeError('"list" argument must be an Array of Buffers')}a.copy(i,o);o+=a.length}return i};function m(e,t){if(f.isBuffer(e)){return e.length}if(ArrayBuffer.isView(e)||e instanceof ArrayBuffer){return e.byteLength}if(typeof e!=="string"){e=""+e}var r=e.length;if(r===0)return 0;var n=false;for(;;){switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case undefined:return J(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return G(e).length;default:if(n)return J(e).length;t=(""+t).toLowerCase();n=true}}}f.byteLength=m;function b(e,t,r){var n=false;if(t===undefined||t<0){t=0}if(t>this.length){return""}if(r===undefined||r>this.length){r=this.length}if(r<=0){return""}r>>>=0;t>>>=0;if(r<=t){return""}if(!e)e="utf8";while(true){switch(e){case"hex":return O(this,t,r);case"utf8":case"utf-8":return B(this,t,r);case"ascii":return j(this,t,r);case"latin1":case"binary":return U(this,t,r);case"base64":return L(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase();n=true}}}f.prototype._isBuffer=true;function _(e,t,r){var n=e[t];e[t]=e[r];e[r]=n}f.prototype.swap16=function e(){var t=this.length;if(t%2!==0){throw new RangeError("Buffer size must be a multiple of 16-bits")}for(var r=0;r<t;r+=2){_(this,r,r+1)}return this};f.prototype.swap32=function e(){var t=this.length;if(t%4!==0){throw new RangeError("Buffer size must be a multiple of 32-bits")}for(var r=0;r<t;r+=4){_(this,r,r+3);_(this,r+1,r+2)}return this};f.prototype.swap64=function e(){var t=this.length;if(t%8!==0){throw new RangeError("Buffer size must be a multiple of 64-bits")}for(var r=0;r<t;r+=8){_(this,r,r+7);_(this,r+1,r+6);_(this,r+2,r+5);_(this,r+3,r+4)}return this};f.prototype.toString=function e(){var t=this.length;if(t===0)return"";if(arguments.length===0)return B(this,0,t);return b.apply(this,arguments)};f.prototype.equals=function e(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(this===t)return true;return f.compare(this,t)===0};f.prototype.inspect=function e(){var t="";var n=r.INSPECT_MAX_BYTES;if(this.length>0){t=this.toString("hex",0,n).match(/.{2}/g).join(" ");if(this.length>n)t+=" ... "}return"<Buffer "+t+">"};f.prototype.compare=function e(t,r,n,i,o){if(!f.isBuffer(t)){throw new TypeError("Argument must be a Buffer")}if(r===undefined){r=0}if(n===undefined){n=t?t.length:0}if(i===undefined){i=0}if(o===undefined){o=this.length}if(r<0||n>t.length||i<0||o>this.length){throw new RangeError("out of range index")}if(i>=o&&r>=n){return 0}if(i>=o){return-1}if(r>=n){return 1}r>>>=0;n>>>=0;i>>>=0;o>>>=0;if(this===t)return 0;var a=o-i;var s=n-r;var u=Math.min(a,s);var c=this.slice(i,o);var l=t.slice(r,n);for(var h=0;h<u;++h){if(c[h]!==l[h]){a=c[h];s=l[h];break}}if(a<s)return-1;if(s<a)return 1;return 0};function E(e,t,r,n,i){if(e.length===0)return-1;if(typeof r==="string"){n=r;r=0}else if(r>2147483647){r=2147483647}else if(r<-2147483648){r=-2147483648}r=+r;if(isNaN(r)){r=i?0:e.length-1}if(r<0)r=e.length+r;if(r>=e.length){if(i)return-1;else r=e.length-1}else if(r<0){if(i)r=0;else return-1}if(typeof t==="string"){t=f.from(t,n)}if(f.isBuffer(t)){if(t.length===0){return-1}return C(e,t,r,n,i)}else if(typeof t==="number"){t=t&255;if(typeof Uint8Array.prototype.indexOf==="function"){if(i){return Uint8Array.prototype.indexOf.call(e,t,r)}else{return Uint8Array.prototype.lastIndexOf.call(e,t,r)}}return C(e,[t],r,n,i)}throw new TypeError("val must be string, number or Buffer")}function C(e,t,r,n,i){var o=1;var a=e.length;var s=t.length;if(n!==undefined){n=String(n).toLowerCase();if(n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le"){if(e.length<2||t.length<2){return-1}o=2;a/=2;s/=2;r/=2}}function f(e,t){if(o===1){return e[t]}else{return e.readUInt16BE(t*o)}}var u;if(i){var c=-1;for(u=r;u<a;u++){if(f(e,u)===f(t,c===-1?0:u-c)){if(c===-1)c=u;if(u-c+1===s)return c*o}else{if(c!==-1)u-=u-c;c=-1}}}else{if(r+s>a)r=a-s;for(u=r;u>=0;u--){var l=true;for(var h=0;h<s;h++){if(f(e,u+h)!==f(t,h)){l=false;break}}if(l)return u}}return-1}f.prototype.includes=function e(t,r,n){return this.indexOf(t,r,n)!==-1};f.prototype.indexOf=function e(t,r,n){return E(this,t,r,n,true)};f.prototype.lastIndexOf=function e(t,r,n){return E(this,t,r,n,false)};function R(e,t,r,n){r=Number(r)||0;var i=e.length-r;if(!n){n=i}else{n=Number(n);if(n>i){n=i}}var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");if(n>o/2){n=o/2}for(var a=0;a<n;++a){var s=parseInt(t.substr(a*2,2),16);if(isNaN(s))return a;e[r+a]=s}return a}function S(e,t,r,n){return X(J(t,e.length-r),e,r,n)}function A(e,t,r,n){return X($(t),e,r,n)}function k(e,t,r,n){return A(e,t,r,n)}function T(e,t,r,n){return X(G(t),e,r,n)}function x(e,t,r,n){return X(Z(t,e.length-r),e,r,n)}f.prototype.write=function e(t,r,n,i){if(r===undefined){i="utf8";n=this.length;r=0}else if(n===undefined&&typeof r==="string"){i=r;n=this.length;r=0}else if(isFinite(r)){r=r>>>0;if(isFinite(n)){n=n>>>0;if(i===undefined)i="utf8"}else{i=n;n=undefined}}else{throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported")}var o=this.length-r;if(n===undefined||n>o)n=o;if(t.length>0&&(n<0||r<0)||r>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!i)i="utf8";var a=false;for(;;){switch(i){case"hex":return R(this,t,r,n);case"utf8":case"utf-8":return S(this,t,r,n);case"ascii":return A(this,t,r,n);case"latin1":case"binary":return k(this,t,r,n);case"base64":return T(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,r,n);default:if(a)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase();a=true}}};f.prototype.toJSON=function e(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function L(e,t,r){if(t===0&&r===e.length){return n.fromByteArray(e)}else{return n.fromByteArray(e.slice(t,r))}}function B(e,t,r){r=Math.min(e.length,r);var n=[];var i=t;while(i<r){var o=e[i];var a=null;var s=o>239?4:o>223?3:o>191?2:1;if(i+s<=r){var f,u,c,l;switch(s){case 1:if(o<128){a=o}break;case 2:f=e[i+1];if((f&192)===128){l=(o&31)<<6|f&63;if(l>127){a=l}}break;case 3:f=e[i+1];u=e[i+2];if((f&192)===128&&(u&192)===128){l=(o&15)<<12|(f&63)<<6|u&63;if(l>2047&&(l<55296||l>57343)){a=l}}break;case 4:f=e[i+1];u=e[i+2];c=e[i+3];if((f&192)===128&&(u&192)===128&&(c&192)===128){l=(o&15)<<18|(f&63)<<12|(u&63)<<6|c&63;if(l>65535&&l<1114112){a=l}}}}if(a===null){a=65533;s=1}else if(a>65535){a-=65536;n.push(a>>>10&1023|55296);a=56320|a&1023}n.push(a);i+=s}return I(n)}var M=4096;function I(e){var t=e.length;if(t<=M){return String.fromCharCode.apply(String,e)}var r="";var n=0;while(n<t){r+=String.fromCharCode.apply(String,e.slice(n,n+=M))}return r}function j(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i){n+=String.fromCharCode(e[i]&127)}return n}function U(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 O(e,t,r){var n=e.length;if(!t||t<0)t=0;if(!r||r<0||r>n)r=n;var i="";for(var o=t;o<r;++o){i+=H(e[o])}return i}function D(e,t,r){var n=e.slice(t,r);var i="";for(var o=0;o<n.length;o+=2){i+=String.fromCharCode(n[o]+n[o+1]*256)}return i}f.prototype.slice=function e(t,r){var n=this.length;t=~~t;r=r===undefined?n:~~r;if(t<0){t+=n;if(t<0)t=0}else if(t>n){t=n}if(r<0){r+=n;if(r<0)r=0}else if(r>n){r=n}if(r<t)r=t;var i=this.subarray(t,r);i.__proto__=f.prototype;return i};function N(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")}f.prototype.readUIntLE=function e(t,r,n){t=t>>>0;r=r>>>0;if(!n)N(t,r,this.length);var i=this[t];var o=1;var a=0;while(++a<r&&(o*=256)){i+=this[t+a]*o}return i};f.prototype.readUIntBE=function e(t,r,n){t=t>>>0;r=r>>>0;if(!n){N(t,r,this.length)}var i=this[t+--r];var o=1;while(r>0&&(o*=256)){i+=this[t+--r]*o}return i};f.prototype.readUInt8=function e(t,r){t=t>>>0;if(!r)N(t,1,this.length);return this[t]};f.prototype.readUInt16LE=function e(t,r){t=t>>>0;if(!r)N(t,2,this.length);return this[t]|this[t+1]<<8};f.prototype.readUInt16BE=function e(t,r){t=t>>>0;if(!r)N(t,2,this.length);return this[t]<<8|this[t+1]};f.prototype.readUInt32LE=function e(t,r){t=t>>>0;if(!r)N(t,4,this.length);return(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};f.prototype.readUInt32BE=function e(t,r){t=t>>>0;if(!r)N(t,4,this.length);return this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};f.prototype.readIntLE=function e(t,r,n){t=t>>>0;r=r>>>0;if(!n)N(t,r,this.length);var i=this[t];var o=1;var a=0;while(++a<r&&(o*=256)){i+=this[t+a]*o}o*=128;if(i>=o)i-=Math.pow(2,8*r);return i};f.prototype.readIntBE=function e(t,r,n){t=t>>>0;r=r>>>0;if(!n)N(t,r,this.length);var i=r;var o=1;var a=this[t+--i];while(i>0&&(o*=256)){a+=this[t+--i]*o}o*=128;if(a>=o)a-=Math.pow(2,8*r);return a};f.prototype.readInt8=function e(t,r){t=t>>>0;if(!r)N(t,1,this.length);if(!(this[t]&128))return this[t];return(255-this[t]+1)*-1};f.prototype.readInt16LE=function e(t,r){t=t>>>0;if(!r)N(t,2,this.length);var n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};f.prototype.readInt16BE=function e(t,r){t=t>>>0;if(!r)N(t,2,this.length);var n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};f.prototype.readInt32LE=function e(t,r){t=t>>>0;if(!r)N(t,4,this.length);return this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};f.prototype.readInt32BE=function e(t,r){t=t>>>0;if(!r)N(t,4,this.length);return this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};f.prototype.readFloatLE=function e(t,r){t=t>>>0;if(!r)N(t,4,this.length);return i.read(this,t,true,23,4)};f.prototype.readFloatBE=function e(t,r){t=t>>>0;if(!r)N(t,4,this.length);return i.read(this,t,false,23,4)};f.prototype.readDoubleLE=function e(t,r){t=t>>>0;if(!r)N(t,8,this.length);return i.read(this,t,true,52,8)};f.prototype.readDoubleBE=function e(t,r){t=t>>>0;if(!r)N(t,8,this.length);return i.read(this,t,false,52,8)};function P(e,t,r,n,i,o){if(!f.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")}f.prototype.writeUIntLE=function e(t,r,n,i){t=+t;r=r>>>0;n=n>>>0;if(!i){var o=Math.pow(2,8*n)-1;P(this,t,r,n,o,0)}var a=1;var s=0;this[r]=t&255;while(++s<n&&(a*=256)){this[r+s]=t/a&255}return r+n};f.prototype.writeUIntBE=function e(t,r,n,i){t=+t;r=r>>>0;n=n>>>0;if(!i){var o=Math.pow(2,8*n)-1;P(this,t,r,n,o,0)}var a=n-1;var s=1;this[r+a]=t&255;while(--a>=0&&(s*=256)){this[r+a]=t/s&255}return r+n};f.prototype.writeUInt8=function e(t,r,n){t=+t;r=r>>>0;if(!n)P(this,t,r,1,255,0);this[r]=t&255;return r+1};f.prototype.writeUInt16LE=function e(t,r,n){t=+t;r=r>>>0;if(!n)P(this,t,r,2,65535,0);this[r]=t&255;this[r+1]=t>>>8;return r+2};f.prototype.writeUInt16BE=function e(t,r,n){t=+t;r=r>>>0;if(!n)P(this,t,r,2,65535,0);this[r]=t>>>8;this[r+1]=t&255;return r+2};f.prototype.writeUInt32LE=function e(t,r,n){t=+t;r=r>>>0;if(!n)P(this,t,r,4,4294967295,0);this[r+3]=t>>>24;this[r+2]=t>>>16;this[r+1]=t>>>8;this[r]=t&255;return r+4};f.prototype.writeUInt32BE=function e(t,r,n){t=+t;r=r>>>0;if(!n)P(this,t,r,4,4294967295,0);this[r]=t>>>24;this[r+1]=t>>>16;this[r+2]=t>>>8;this[r+3]=t&255;return r+4};f.prototype.writeIntLE=function e(t,r,n,i){t=+t;r=r>>>0;if(!i){var o=Math.pow(2,8*n-1);P(this,t,r,n,o-1,-o)}var a=0;var s=1;var f=0;this[r]=t&255;while(++a<n&&(s*=256)){if(t<0&&f===0&&this[r+a-1]!==0){f=1}this[r+a]=(t/s>>0)-f&255}return r+n};f.prototype.writeIntBE=function e(t,r,n,i){t=+t;r=r>>>0;if(!i){var o=Math.pow(2,8*n-1);P(this,t,r,n,o-1,-o)}var a=n-1;var s=1;var f=0;this[r+a]=t&255;while(--a>=0&&(s*=256)){if(t<0&&f===0&&this[r+a+1]!==0){f=1}this[r+a]=(t/s>>0)-f&255}return r+n};f.prototype.writeInt8=function e(t,r,n){t=+t;r=r>>>0;if(!n)P(this,t,r,1,127,-128);if(t<0)t=255+t+1;this[r]=t&255;return r+1};f.prototype.writeInt16LE=function e(t,r,n){t=+t;r=r>>>0;if(!n)P(this,t,r,2,32767,-32768);this[r]=t&255;this[r+1]=t>>>8;return r+2};f.prototype.writeInt16BE=function e(t,r,n){t=+t;r=r>>>0;if(!n)P(this,t,r,2,32767,-32768);this[r]=t>>>8;this[r+1]=t&255;return r+2};f.prototype.writeInt32LE=function e(t,r,n){t=+t;r=r>>>0;if(!n)P(this,t,r,4,2147483647,-2147483648);this[r]=t&255;this[r+1]=t>>>8;this[r+2]=t>>>16;this[r+3]=t>>>24;return r+4};f.prototype.writeInt32BE=function e(t,r,n){t=+t;r=r>>>0;if(!n)P(this,t,r,4,2147483647,-2147483648);if(t<0)t=4294967295+t+1;this[r]=t>>>24;this[r+1]=t>>>16;this[r+2]=t>>>8;this[r+3]=t&255;return r+4};function q(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 F(e,t,r,n,o){t=+t;r=r>>>0;if(!o){q(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38)}i.write(e,t,r,n,23,4);return r+4}f.prototype.writeFloatLE=function e(t,r,n){return F(this,t,r,true,n)};f.prototype.writeFloatBE=function e(t,r,n){return F(this,t,r,false,n)};function W(e,t,r,n,o){t=+t;r=r>>>0;if(!o){q(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308)}i.write(e,t,r,n,52,8);return r+8}f.prototype.writeDoubleLE=function e(t,r,n){return W(this,t,r,true,n)};f.prototype.writeDoubleBE=function e(t,r,n){return W(this,t,r,false,n)};f.prototype.copy=function e(t,r,n,i){if(!n)n=0;if(!i&&i!==0)i=this.length;if(r>=t.length)r=t.length;if(!r)r=0;if(i>0&&i<n)i=n;if(i===n)return 0;if(t.length===0||this.length===0)return 0;if(r<0){throw new RangeError("targetStart out of bounds")}if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");if(i>this.length)i=this.length;if(t.length-r<i-n){i=t.length-r+n}var o=i-n;var a;if(this===t&&n<r&&r<i){for(a=o-1;a>=0;--a){t[a+r]=this[a+n]}}else if(o<1e3){for(a=0;a<o;++a){t[a+r]=this[a+n]}}else{Uint8Array.prototype.set.call(t,this.subarray(n,n+o),r)}return o};f.prototype.fill=function e(t,r,n,i){if(typeof t==="string"){if(typeof r==="string"){i=r;r=0;n=this.length}else if(typeof n==="string"){i=n;n=this.length}if(t.length===1){var o=t.charCodeAt(0);if(o<256){t=o}}if(i!==undefined&&typeof i!=="string"){throw new TypeError("encoding must be a string")}if(typeof i==="string"&&!f.isEncoding(i)){throw new TypeError("Unknown encoding: "+i)}}else if(typeof t==="number"){t=t&255}if(r<0||this.length<r||this.length<n){throw new RangeError("Out of range index")}if(n<=r){return this}r=r>>>0;n=n===undefined?this.length:n>>>0;if(!t)t=0;var a;if(typeof t==="number"){for(a=r;a<n;++a){this[a]=t}}else{var s=f.isBuffer(t)?t:new f(t,i);var u=s.length;for(a=0;a<n-r;++a){this[a+r]=s[a%u]}}return this};var z=/[^+\/0-9A-Za-z-_]/g;function V(e){e=Y(e).replace(z,"");if(e.length<2)return"";while(e.length%4!==0){e=e+"="}return e}function Y(e){if(e.trim)return e.trim();return e.replace(/^\s+|\s+$/g,"")}function H(e){if(e<16)return"0"+e.toString(16);return e.toString(16)}function J(e,t){t=t||Infinity;var r;var n=e.length;var i=null;var o=[];for(var a=0;a<n;++a){r=e.charCodeAt(a);if(r>55295&&r<57344){if(!i){if(r>56319){if((t-=3)>-1)o.push(239,191,189);continue}else if(a+1===n){if((t-=3)>-1)o.push(239,191,189);continue}i=r;continue}if(r<56320){if((t-=3)>-1)o.push(239,191,189);i=r;continue}r=(i-55296<<10|r-56320)+65536}else if(i){if((t-=3)>-1)o.push(239,191,189)}i=null;if(r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else{throw new Error("Invalid code point")}}return o}function $(e){var t=[];for(var r=0;r<e.length;++r){t.push(e.charCodeAt(r)&255)}return t}function Z(e,t){var r,n,i;var o=[];for(var a=0;a<e.length;++a){if((t-=2)<0)break;r=e.charCodeAt(a);n=r>>8;i=r%256;o.push(i);o.push(n)}return o}function G(e){return n.toByteArray(V(e))}function X(e,t,r,n){for(var i=0;i<n;++i){if(i+r>=t.length||i>=e.length)break;t[i+r]=e[i]}return i}function K(e){return e!==e}},{"base64-js":1,ieee754:10}],5:[function(e,t,r){(function(e){function t(e){if(Array.isArray){return Array.isArray(e)}return v(e)==="[object Array]"}r.isArray=t;function n(e){return typeof e==="boolean"}r.isBoolean=n;function i(e){return e===null}r.isNull=i;function o(e){return e==null}r.isNullOrUndefined=o;function a(e){return typeof e==="number"}r.isNumber=a;function s(e){return typeof e==="string"}r.isString=s;function f(e){return typeof e==="symbol"}r.isSymbol=f;function u(e){return e===void 0}r.isUndefined=u;function c(e){return v(e)==="[object RegExp]"}r.isRegExp=c;function l(e){return typeof e==="object"&&e!==null}r.isObject=l;function h(e){return v(e)==="[object Date]"}r.isDate=h;function d(e){return v(e)==="[object Error]"||e instanceof Error}r.isError=d;function p(e){return typeof e==="function"}r.isFunction=p;function g(e){return e===null||typeof e==="boolean"||typeof e==="number"||typeof e==="string"||typeof e==="symbol"||typeof e==="undefined"}r.isPrimitive=g;r.isBuffer=e.isBuffer;function v(e){return Object.prototype.toString.call(e)}}).call(this,{isBuffer:e("../../is-buffer/index.js")})},{"../../is-buffer/index.js":12}],6:[function(e,t,r){(function(n){r=t.exports=e("./debug");r.log=a;r.formatArgs=o;r.save=s;r.load=f;r.useColors=i;r.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u();r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"];function i(){if(typeof window!=="undefined"&&window&&typeof window.process!=="undefined"&&window.process.type==="renderer"){return true}return typeof document!=="undefined"&&document&&"WebkitAppearance"in document.documentElement.style||typeof window!=="undefined"&&window&&window.console&&(console.firebug||console.exception&&console.table)||typeof navigator!=="undefined"&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!=="undefined"&&navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}r.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}};function o(e){var t=this.useColors;e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+r.humanize(this.diff);if(!t)return;var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0;var o=0;e[0].replace(/%[a-zA-Z%]/g,function(e){if("%%"===e)return;i++;if("%c"===e){o=i}});e.splice(o,0,n)}function a(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function s(e){try{if(null==e){r.storage.removeItem("debug")}else{r.storage.debug=e}}catch(e){}}function f(){try{return r.storage.debug}catch(e){}if(typeof n!=="undefined"&&"env"in n){return n.env.DEBUG}}r.enable(f());function u(){try{return window.localStorage}catch(e){}}}).call(this,e("_process"))},{"./debug":7,_process:16}],7:[function(e,t,r){r=t.exports=o.debug=o["default"]=o;r.coerce=u;r.disable=s;r.enable=a;r.enabled=f;r.humanize=e("ms");r.names=[];r.skips=[];r.formatters={};var n;function i(e){var t=0,n;for(n in e){t=(t<<5)-t+e.charCodeAt(n);t|=0}return r.colors[Math.abs(t)%r.colors.length]}function o(e){function t(){if(!t.enabled)return;var e=t;var i=+new Date;var o=i-(n||i);e.diff=o;e.prev=n;e.curr=i;n=i;var a=new Array(arguments.length);for(var s=0;s<a.length;s++){a[s]=arguments[s]}a[0]=r.coerce(a[0]);if("string"!==typeof a[0]){a.unshift("%O")}var f=0;a[0]=a[0].replace(/%([a-zA-Z%])/g,function(t,n){if(t==="%%")return t;f++;var i=r.formatters[n];if("function"===typeof i){var o=a[f];t=i.call(e,o);a.splice(f,1);f--}return t});r.formatArgs.call(e,a);var u=t.log||r.log||console.log.bind(console);u.apply(e,a)}t.namespace=e;t.enabled=r.enabled(e);t.useColors=r.useColors();t.color=i(e);if("function"===typeof r.init){r.init(t)}return t}function a(e){r.save(e);r.names=[];r.skips=[];var t=(e||"").split(/[\s,]+/);var n=t.length;for(var i=0;i<n;i++){if(!t[i])continue;e=t[i].replace(/\*/g,".*?");if(e[0]==="-"){r.skips.push(new RegExp("^"+e.substr(1)+"$"))}else{r.names.push(new RegExp("^"+e+"$"))}}}function s(){r.enable("")}function f(e){var t,n;for(t=0,n=r.skips.length;t<n;t++){if(r.skips[t].test(e)){return false}}for(t=0,n=r.names.length;t<n;t++){if(r.names[t].test(e)){return true}}return false}function u(e){if(e instanceof Error)return e.stack||e.message;return e}},{ms:14}],8:[function(e,t,r){function n(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}t.exports=n;n.EventEmitter=n;n.prototype._events=undefined;n.prototype._maxListeners=undefined;n.defaultMaxListeners=10;n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");this._maxListeners=e;return this};n.prototype.emit=function(e){var t,r,n,o,f,u;if(!this._events)this._events={};if(e==="error"){if(!this._events.error||a(this._events.error)&&!this._events.error.length){t=arguments[1];if(t instanceof Error){throw t}else{var c=new Error('Uncaught, unspecified "error" event. ('+t+")");c.context=t;throw c}}}r=this._events[e];if(s(r))return false;if(i(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:o=Array.prototype.slice.call(arguments,1);r.apply(this,o)}}else if(a(r)){o=Array.prototype.slice.call(arguments,1);u=r.slice();n=u.length;for(f=0;f<n;f++)u[f].apply(this,o)}return true};n.prototype.addListener=function(e,t){var r;if(!i(t))throw TypeError("listener must be a function");if(!this._events)this._events={};if(this._events.newListener)this.emit("newListener",e,i(t.listener)?t.listener:t);if(!this._events[e])this._events[e]=t;else if(a(this._events[e]))this._events[e].push(t);else this._events[e]=[this._events[e],t];if(a(this._events[e])&&!this._events[e].warned){if(!s(this._maxListeners)){r=this._maxListeners}else{r=n.defaultMaxListeners}if(r&&r>0&&this._events[e].length>r){this._events[e].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[e].length);if(typeof console.trace==="function"){console.trace()}}}return this};n.prototype.on=n.prototype.addListener;n.prototype.once=function(e,t){if(!i(t))throw TypeError("listener must be a function");var r=false;function n(){this.removeListener(e,n);if(!r){r=true;t.apply(this,arguments)}}n.listener=t;this.on(e,n);return this};n.prototype.removeListener=function(e,t){var r,n,o,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;r=this._events[e];o=r.length;n=-1;if(r===t||i(r.listener)&&r.listener===t){delete this._events[e];if(this._events.removeListener)this.emit("removeListener",e,t)}else if(a(r)){for(s=o;s-- >0;){if(r[s]===t||r[s].listener&&r[s].listener===t){n=s;break}}if(n<0)return this;if(r.length===1){r.length=0;delete this._events[e]}else{r.splice(n,1)}if(this._events.removeListener)this.emit("removeListener",e,t)}return this};n.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[e])delete this._events[e];return this}if(arguments.length===0){for(t in this._events){if(t==="removeListener")continue;this.removeAllListeners(t)}this.removeAllListeners("removeListener");this._events={};return this}r=this._events[e];if(i(r)){this.removeListener(e,r)}else if(r){while(r.length)this.removeListener(e,r[r.length-1]);
}delete this._events[e];return this};n.prototype.listeners=function(e){var t;if(!this._events||!this._events[e])t=[];else if(i(this._events[e]))t=[this._events[e]];else t=this._events[e].slice();return t};n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;else if(t)return t.length}return 0};n.listenerCount=function(e,t){return e.listenerCount(t)};function i(e){return typeof e==="function"}function o(e){return typeof e==="number"}function a(e){return typeof e==="object"&&e!==null}function s(e){return e===void 0}},{}],9:[function(e,t,r){t.exports=function e(){if(typeof window==="undefined")return null;var t={RTCPeerConnection:window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection,RTCSessionDescription:window.RTCSessionDescription||window.mozRTCSessionDescription||window.webkitRTCSessionDescription,RTCIceCandidate:window.RTCIceCandidate||window.mozRTCIceCandidate||window.webkitRTCIceCandidate};if(!t.RTCPeerConnection)return null;return t}},{}],10:[function(e,t,r){r.read=function(e,t,r,n,i){var o,a;var s=i*8-n-1;var f=(1<<s)-1;var u=f>>1;var c=-7;var l=r?i-1:0;var h=r?-1:1;var d=e[t+l];l+=h;o=d&(1<<-c)-1;d>>=-c;c+=s;for(;c>0;o=o*256+e[t+l],l+=h,c-=8){}a=o&(1<<-c)-1;o>>=-c;c+=n;for(;c>0;a=a*256+e[t+l],l+=h,c-=8){}if(o===0){o=1-u}else if(o===f){return a?NaN:(d?-1:1)*Infinity}else{a=a+Math.pow(2,n);o=o-u}return(d?-1:1)*a*Math.pow(2,o-n)};r.write=function(e,t,r,n,i,o){var a,s,f;var u=o*8-i-1;var c=(1<<u)-1;var l=c>>1;var h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0;var d=n?0:o-1;var p=n?1:-1;var g=t<0||t===0&&1/t<0?1:0;t=Math.abs(t);if(isNaN(t)||t===Infinity){s=isNaN(t)?1:0;a=c}else{a=Math.floor(Math.log(t)/Math.LN2);if(t*(f=Math.pow(2,-a))<1){a--;f*=2}if(a+l>=1){t+=h/f}else{t+=h*Math.pow(2,1-l)}if(t*f>=2){a++;f/=2}if(a+l>=c){s=0;a=c}else if(a+l>=1){s=(t*f-1)*Math.pow(2,i);a=a+l}else{s=t*Math.pow(2,l-1)*Math.pow(2,i);a=0}}for(;i>=8;e[r+d]=s&255,d+=p,s/=256,i-=8){}a=a<<i|s;u+=i;for(;u>0;e[r+d]=a&255,d+=p,a/=256,u-=8){}e[r+d-p]|=g*128}},{}],11:[function(e,t,r){if(typeof Object.create==="function"){t.exports=function e(t,r){t.super_=r;t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:false,writable:true,configurable:true}})}}else{t.exports=function e(t,r){t.super_=r;var n=function(){};n.prototype=r.prototype;t.prototype=new n;t.prototype.constructor=t}}},{}],12:[function(e,t,r){t.exports=function(e){return e!=null&&(n(e)||i(e)||!!e._isBuffer)};function n(e){return!!e.constructor&&typeof e.constructor.isBuffer==="function"&&e.constructor.isBuffer(e)}function i(e){return typeof e.readFloatLE==="function"&&typeof e.slice==="function"&&n(e.slice(0,0))}},{}],13:[function(e,t,r){var n={}.toString;t.exports=Array.isArray||function(e){return n.call(e)=="[object Array]"}},{}],14:[function(e,t,r){var n=1e3;var i=n*60;var o=i*60;var a=o*24;var s=a*365.25;t.exports=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0){return f(e)}else if(r==="number"&&isNaN(e)===false){return t.long?c(e):u(e)}throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function f(e){e=String(e);if(e.length>1e4){return}var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t){return}var r=parseFloat(t[1]);var f=(t[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return r*s;case"days":case"day":case"d":return r*a;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 undefined}}function u(e){if(e>=a){return Math.round(e/a)+"d"}if(e>=o){return Math.round(e/o)+"h"}if(e>=i){return Math.round(e/i)+"m"}if(e>=n){return Math.round(e/n)+"s"}return e+"ms"}function c(e){return l(e,a,"day")||l(e,o,"hour")||l(e,i,"minute")||l(e,n,"second")||e+" ms"}function l(e,t,r){if(e<t){return}if(e<t*1.5){return Math.floor(e/t)+" "+r}return Math.ceil(e/t)+" "+r+"s"}},{}],15:[function(e,t,r){(function(e){"use strict";if(!e.version||e.version.indexOf("v0.")===0||e.version.indexOf("v1.")===0&&e.version.indexOf("v1.8.")!==0){t.exports=r}else{t.exports=e.nextTick}function r(t,r,n,i){if(typeof t!=="function"){throw new TypeError('"callback" argument must be a function')}var o=arguments.length;var a,s;switch(o){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function e(){t.call(null,r)});case 3:return e.nextTick(function e(){t.call(null,r,n)});case 4:return e.nextTick(function e(){t.call(null,r,n,i)});default:a=new Array(o-1);s=0;while(s<a.length){a[s++]=arguments[s]}return e.nextTick(function e(){t.apply(null,a)})}}}).call(this,e("_process"))},{_process:16}],16:[function(e,t,r){var n=t.exports={};var i;var o;function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){i=setTimeout}else{i=a}}catch(e){i=a}try{if(typeof clearTimeout==="function"){o=clearTimeout}else{o=s}}catch(e){o=s}})();function f(e){if(i===setTimeout){return setTimeout(e,0)}if((i===a||!i)&&setTimeout){i=setTimeout;return setTimeout(e,0)}try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}function u(e){if(o===clearTimeout){return clearTimeout(e)}if((o===s||!o)&&clearTimeout){o=clearTimeout;return clearTimeout(e)}try{return o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}var c=[];var l=false;var h;var d=-1;function p(){if(!l||!h){return}l=false;if(h.length){c=h.concat(c)}else{d=-1}if(c.length){g()}}function g(){if(l){return}var e=f(p);l=true;var t=c.length;while(t){h=c;c=[];while(++d<t){if(h){h[d].run()}}d=-1;t=c.length}h=null;l=false;u(e)}n.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]}}c.push(new v(e,t));if(c.length===1&&!l){f(g)}};function v(e,t){this.fun=e;this.array=t}v.prototype.run=function(){this.fun.apply(null,this.array)};n.title="browser";n.browser=true;n.env={};n.argv=[];n.version="";n.versions={};function y(){}n.on=y;n.addListener=y;n.once=y;n.off=y;n.removeListener=y;n.removeAllListeners=y;n.emit=y;n.binding=function(e){throw new Error("process.binding is not supported")};n.cwd=function(){return"/"};n.chdir=function(e){throw new Error("process.chdir is not supported")};n.umask=function(){return 0}},{}],17:[function(e,t,r){(function(e,r,n){"use strict";function i(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var o=r.crypto||r.msCrypto;if(o&&o.getRandomValues){t.exports=a}else{t.exports=i}function a(t,i){if(t>65536)throw new Error("requested too many random bytes");var a=new r.Uint8Array(t);if(t>0){o.getRandomValues(a)}var s=new n(a.buffer);if(typeof i==="function"){return e.nextTick(function(){i(null,s)})}return s}}).call(this,e("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},e("buffer").Buffer)},{_process:16,buffer:4}],18:[function(e,t,r){"use strict";var n=Object.keys||function(e){var t=[];for(var r in e){t.push(r)}return t};t.exports=l;var i=e("process-nextick-args");var o=e("core-util-is");o.inherits=e("inherits");var a=e("./_stream_readable");var s=e("./_stream_writable");o.inherits(l,a);var f=n(s.prototype);for(var u=0;u<f.length;u++){var c=f[u];if(!l.prototype[c])l.prototype[c]=s.prototype[c]}function l(e){if(!(this instanceof l))return new l(e);a.call(this,e);s.call(this,e);if(e&&e.readable===false)this.readable=false;if(e&&e.writable===false)this.writable=false;this.allowHalfOpen=true;if(e&&e.allowHalfOpen===false)this.allowHalfOpen=false;this.once("end",h)}function h(){if(this.allowHalfOpen||this._writableState.ended)return;i(d,this)}function d(e){e.end()}function p(e,t){for(var r=0,n=e.length;r<n;r++){t(e[r],r)}}},{"./_stream_readable":20,"./_stream_writable":22,"core-util-is":5,inherits:11,"process-nextick-args":15}],19:[function(e,t,r){"use strict";t.exports=o;var n=e("./_stream_transform");var i=e("core-util-is");i.inherits=e("inherits");i.inherits(o,n);function o(e){if(!(this instanceof o))return new o(e);n.call(this,e)}o.prototype._transform=function(e,t,r){r(null,e)}},{"./_stream_transform":21,"core-util-is":5,inherits:11}],20:[function(e,t,r){(function(r){"use strict";t.exports=w;var n=e("process-nextick-args");var i=e("isarray");var o;w.ReadableState=y;var a=e("events").EventEmitter;var s=function(e,t){return e.listeners(t).length};var f;(function(){try{f=e("st"+"ream")}catch(e){}finally{if(!f)f=e("events").EventEmitter}})();var u=e("buffer").Buffer;var c=e("buffer-shims");var l=e("core-util-is");l.inherits=e("inherits");var h=e("util");var d=void 0;if(h&&h.debuglog){d=h.debuglog("stream")}else{d=function(){}}var p=e("./internal/streams/BufferList");var g;l.inherits(w,f);function v(e,t,r){if(typeof e.prependListener==="function"){return e.prependListener(t,r)}else{if(!e._events||!e._events[t])e.on(t,r);else if(i(e._events[t]))e._events[t].unshift(r);else e._events[t]=[r,e._events[t]]}}function y(t,r){o=o||e("./_stream_duplex");t=t||{};this.objectMode=!!t.objectMode;if(r instanceof o)this.objectMode=this.objectMode||!!t.readableObjectMode;var n=t.highWaterMark;var i=this.objectMode?16:16*1024;this.highWaterMark=n||n===0?n:i;this.highWaterMark=~~this.highWaterMark;this.buffer=new p;this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=null;this.ended=false;this.endEmitted=false;this.reading=false;this.sync=true;this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.resumeScheduled=false;this.defaultEncoding=t.defaultEncoding||"utf8";this.ranOut=false;this.awaitDrain=0;this.readingMore=false;this.decoder=null;this.encoding=null;if(t.encoding){if(!g)g=e("string_decoder/").StringDecoder;this.decoder=new g(t.encoding);this.encoding=t.encoding}}function w(t){o=o||e("./_stream_duplex");if(!(this instanceof w))return new w(t);this._readableState=new y(t,this);this.readable=true;if(t&&typeof t.read==="function")this._read=t.read;f.call(this)}w.prototype.push=function(e,t){var r=this._readableState;if(!r.objectMode&&typeof e==="string"){t=t||r.defaultEncoding;if(t!==r.encoding){e=c.from(e,t);t=""}}return m(this,r,e,t,false)};w.prototype.unshift=function(e){var t=this._readableState;return m(this,t,e,"",true)};w.prototype.isPaused=function(){return this._readableState.flowing===false};function m(e,t,r,n,i){var o=R(t,r);if(o){e.emit("error",o)}else if(r===null){t.reading=false;S(e,t)}else if(t.objectMode||r&&r.length>0){if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var f;if(t.decoder&&!i&&!n){r=t.decoder.write(r);f=!t.objectMode&&r.length===0}if(!i)t.reading=false;if(!f){if(t.flowing&&t.length===0&&!t.sync){e.emit("data",r);e.read(0)}else{t.length+=t.objectMode?1:r.length;if(i)t.buffer.unshift(r);else t.buffer.push(r);if(t.needReadable)A(e)}}T(e,t)}}else if(!i){t.reading=false}return b(t)}function b(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}w.prototype.setEncoding=function(t){if(!g)g=e("string_decoder/").StringDecoder;this._readableState.decoder=new g(t);this._readableState.encoding=t;return this};var _=8388608;function E(e){if(e>=_){e=_}else{e--;e|=e>>>1;e|=e>>>2;e|=e>>>4;e|=e>>>8;e|=e>>>16;e++}return e}function C(e,t){if(e<=0||t.length===0&&t.ended)return 0;if(t.objectMode)return 1;if(e!==e){if(t.flowing&&t.length)return t.buffer.head.data.length;else return t.length}if(e>t.highWaterMark)t.highWaterMark=E(e);if(e<=t.length)return e;if(!t.ended){t.needReadable=true;return 0}return t.length}w.prototype.read=function(e){d("read",e);e=parseInt(e,10);var t=this._readableState;var r=e;if(e!==0)t.emittedReadable=false;if(e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended)){d("read: emitReadable",t.length,t.ended);if(t.length===0&&t.ended)P(this);else A(this);return null}e=C(e,t);if(e===0&&t.ended){if(t.length===0)P(this);return null}var n=t.needReadable;d("need readable",n);if(t.length===0||t.length-e<t.highWaterMark){n=true;d("length less than watermark",n)}if(t.ended||t.reading){n=false;d("reading or ended",n)}else if(n){d("do read");t.reading=true;t.sync=true;if(t.length===0)t.needReadable=true;this._read(t.highWaterMark);t.sync=false;if(!t.reading)e=C(r,t)}var i;if(e>0)i=U(e,t);else i=null;if(i===null){t.needReadable=true;e=0}else{t.length-=e}if(t.length===0){if(!t.ended)t.needReadable=true;if(r!==e&&t.ended)P(this)}if(i!==null)this.emit("data",i);return i};function R(e,t){var r=null;if(!u.isBuffer(t)&&typeof t!=="string"&&t!==null&&t!==undefined&&!e.objectMode){r=new TypeError("Invalid non-string/buffer chunk")}return r}function S(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();if(r&&r.length){t.buffer.push(r);t.length+=t.objectMode?1:r.length}}t.ended=true;A(e)}function A(e){var t=e._readableState;t.needReadable=false;if(!t.emittedReadable){d("emitReadable",t.flowing);t.emittedReadable=true;if(t.sync)n(k,e);else k(e)}}function k(e){d("emit readable");e.emit("readable");j(e)}function T(e,t){if(!t.readingMore){t.readingMore=true;n(x,e,t)}}function x(e,t){var r=t.length;while(!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark){d("maybeReadMore read 0");e.read(0);if(r===t.length)break;else r=t.length}t.readingMore=false}w.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))};w.prototype.pipe=function(e,t){var i=this;var o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e);break}o.pipesCount+=1;d("pipe count=%d opts=%j",o.pipesCount,t);var a=(!t||t.end!==false)&&e!==r.stdout&&e!==r.stderr;var f=a?c:p;if(o.endEmitted)n(f);else i.once("end",f);e.on("unpipe",u);function u(e){d("onunpipe");if(e===i){p()}}function c(){d("onend");e.end()}var l=L(i);e.on("drain",l);var h=false;function p(){d("cleanup");e.removeListener("close",m);e.removeListener("finish",b);e.removeListener("drain",l);e.removeListener("error",w);e.removeListener("unpipe",u);i.removeListener("end",c);i.removeListener("end",p);i.removeListener("data",y);h=true;if(o.awaitDrain&&(!e._writableState||e._writableState.needDrain))l()}var g=false;i.on("data",y);function y(t){d("ondata");g=false;var r=e.write(t);if(false===r&&!g){if((o.pipesCount===1&&o.pipes===e||o.pipesCount>1&&W(o.pipes,e)!==-1)&&!h){d("false write response, pause",i._readableState.awaitDrain);i._readableState.awaitDrain++;g=true}i.pause()}}function w(t){d("onerror",t);_();e.removeListener("error",w);if(s(e,"error")===0)e.emit("error",t)}v(e,"error",w);function m(){e.removeListener("finish",b);_()}e.once("close",m);function b(){d("onfinish");e.removeListener("close",m);_()}e.once("finish",b);function _(){d("unpipe");i.unpipe(e)}e.emit("pipe",i);if(!o.flowing){d("pipe resume");i.resume()}return e};function L(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain);if(t.awaitDrain)t.awaitDrain--;if(t.awaitDrain===0&&s(e,"data")){t.flowing=true;j(e)}}}w.prototype.unpipe=function(e){var t=this._readableState;if(t.pipesCount===0)return this;if(t.pipesCount===1){if(e&&e!==t.pipes)return this;if(!e)e=t.pipes;t.pipes=null;t.pipesCount=0;t.flowing=false;if(e)e.emit("unpipe",this);return this}if(!e){var r=t.pipes;var n=t.pipesCount;t.pipes=null;t.pipesCount=0;t.flowing=false;for(var i=0;i<n;i++){r[i].emit("unpipe",this)}return this}var o=W(t.pipes,e);if(o===-1)return this;t.pipes.splice(o,1);t.pipesCount-=1;if(t.pipesCount===1)t.pipes=t.pipes[0];e.emit("unpipe",this);return this};w.prototype.on=function(e,t){var r=f.prototype.on.call(this,e,t);if(e==="data"){if(this._readableState.flowing!==false)this.resume()}else if(e==="readable"){var i=this._readableState;if(!i.endEmitted&&!i.readableListening){i.readableListening=i.needReadable=true;i.emittedReadable=false;if(!i.reading){n(B,this)}else if(i.length){A(this,i)}}}return r};w.prototype.addListener=w.prototype.on;function B(e){d("readable nexttick read 0");e.read(0)}w.prototype.resume=function(){var e=this._readableState;if(!e.flowing){d("resume");e.flowing=true;M(this,e)}return this};function M(e,t){if(!t.resumeScheduled){t.resumeScheduled=true;n(I,e,t)}}function I(e,t){if(!t.reading){d("resume read 0");e.read(0)}t.resumeScheduled=false;t.awaitDrain=0;e.emit("resume");j(e);if(t.flowing&&!t.reading)e.read(0)}w.prototype.pause=function(){d("call pause flowing=%j",this._readableState.flowing);if(false!==this._readableState.flowing){d("pause");this._readableState.flowing=false;this.emit("pause")}return this};function j(e){var t=e._readableState;d("flow",t.flowing);while(t.flowing&&e.read()!==null){}}w.prototype.wrap=function(e){var t=this._readableState;var r=false;var n=this;e.on("end",function(){d("wrapped end");if(t.decoder&&!t.ended){var e=t.decoder.end();if(e&&e.length)n.push(e)}n.push(null)});e.on("data",function(i){d("wrapped data");if(t.decoder)i=t.decoder.write(i);if(t.objectMode&&(i===null||i===undefined))return;else if(!t.objectMode&&(!i||!i.length))return;var o=n.push(i);if(!o){r=true;e.pause()}});for(var i in e){if(this[i]===undefined&&typeof e[i]==="function"){this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i)}}var o=["error","close","destroy","pause","resume"];F(o,function(t){e.on(t,n.emit.bind(n,t))});n._read=function(t){d("wrapped _read",t);if(r){r=false;e.resume()}};return n};w._fromList=U;function U(e,t){if(t.length===0)return null;var r;if(t.objectMode)r=t.buffer.shift();else if(!e||e>=t.length){if(t.decoder)r=t.buffer.join("");else if(t.buffer.length===1)r=t.buffer.head.data;else r=t.buffer.concat(t.length);t.buffer.clear()}else{r=O(e,t.buffer,t.decoder)}return r}function O(e,t,r){var n;if(e<t.head.data.length){n=t.head.data.slice(0,e);t.head.data=t.head.data.slice(e)}else if(e===t.head.data.length){n=t.shift()}else{n=r?D(e,t):N(e,t)}return n}function D(e,t){var r=t.head;var n=1;var i=r.data;e-=i.length;while(r=r.next){var o=r.data;var a=e>o.length?o.length:e;if(a===o.length)i+=o;else i+=o.slice(0,e);e-=a;if(e===0){if(a===o.length){++n;if(r.next)t.head=r.next;else t.head=t.tail=null}else{t.head=r;r.data=o.slice(a)}break}++n}t.length-=n;return i}function N(e,t){var r=c.allocUnsafe(e);var n=t.head;var i=1;n.data.copy(r);e-=n.data.length;while(n=n.next){var o=n.data;var a=e>o.length?o.length:e;o.copy(r,r.length-e,0,a);e-=a;if(e===0){if(a===o.length){++i;if(n.next)t.head=n.next;else t.head=t.tail=null}else{t.head=n;n.data=o.slice(a)}break}++i}t.length-=i;return r}function P(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');if(!t.endEmitted){t.ended=true;n(q,t,e)}}function q(e,t){if(!e.endEmitted&&e.length===0){e.endEmitted=true;t.readable=false;t.emit("end")}}function F(e,t){for(var r=0,n=e.length;r<n;r++){t(e[r],r)}}function W(e,t){for(var r=0,n=e.length;r<n;r++){if(e[r]===t)return r}return-1}}).call(this,e("_process"))},{"./_stream_duplex":18,"./internal/streams/BufferList":23,_process:16,buffer:4,"buffer-shims":3,"core-util-is":5,events:8,inherits:11,isarray:13,"process-nextick-args":15,"string_decoder/":25,util:2}],21:[function(e,t,r){"use strict";t.exports=s;var n=e("./_stream_duplex");var i=e("core-util-is");i.inherits=e("inherits");i.inherits(s,n);function o(e){this.afterTransform=function(t,r){return a(e,t,r)};this.needTransform=false;this.transforming=false;this.writecb=null;this.writechunk=null;this.writeencoding=null}function a(e,t,r){var n=e._transformState;n.transforming=false;var i=n.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));n.writechunk=null;n.writecb=null;if(r!==null&&r!==undefined)e.push(r);i(t);var o=e._readableState;o.reading=false;if(o.needReadable||o.length<o.highWaterMark){e._read(o.highWaterMark)}}function s(e){if(!(this instanceof s))return new s(e);n.call(this,e);this._transformState=new o(this);var t=this;this._readableState.needReadable=true;this._readableState.sync=false;if(e){if(typeof e.transform==="function")this._transform=e.transform;if(typeof e.flush==="function")this._flush=e.flush}this.once("prefinish",function(){if(typeof this._flush==="function")this._flush(function(e,r){f(t,e,r)});else f(t)})}s.prototype.push=function(e,t){this._transformState.needTransform=false;return n.prototype.push.call(this,e,t)};s.prototype._transform=function(e,t,r){throw new Error("_transform() is not implemented")};s.prototype._write=function(e,t,r){var n=this._transformState;n.writecb=r;n.writechunk=e;n.writeencoding=t;if(!n.transforming){var i=this._readableState;if(n.needTransform||i.needReadable||i.length<i.highWaterMark)this._read(i.highWaterMark)}};s.prototype._read=function(e){var t=this._transformState;if(t.writechunk!==null&&t.writecb&&!t.transforming){t.transforming=true;this._transform(t.writechunk,t.writeencoding,t.afterTransform)}else{t.needTransform=true}};function f(e,t,r){if(t)return e.emit("error",t);if(r!==null&&r!==undefined)e.push(r);var n=e._writableState;var i=e._transformState;if(n.length)throw new Error("Calling transform done when ws.length != 0");if(i.transforming)throw new Error("Calling transform done when still transforming");return e.push(null)}},{"./_stream_duplex":18,"core-util-is":5,inherits:11}],22:[function(e,t,r){(function(r){"use strict";t.exports=g;var n=e("process-nextick-args");var i=!r.browser&&["v0.10","v0.9."].indexOf(r.version.slice(0,5))>-1?setImmediate:n;var o;g.WritableState=d;var a=e("core-util-is");a.inherits=e("inherits");var s={deprecate:e("util-deprecate")};var f;(function(){try{f=e("st"+"ream")}catch(e){}finally{if(!f)f=e("events").EventEmitter}})();var u=e("buffer").Buffer;var c=e("buffer-shims");a.inherits(g,f);function l(){}function h(e,t,r){this.chunk=e;this.encoding=t;this.callback=r;this.next=null}function d(t,r){o=o||e("./_stream_duplex");t=t||{};this.objectMode=!!t.objectMode;if(r instanceof o)this.objectMode=this.objectMode||!!t.writableObjectMode;var n=t.highWaterMark;var i=this.objectMode?16:16*1024;this.highWaterMark=n||n===0?n:i;this.highWaterMark=~~this.highWaterMark;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;var a=t.decodeStrings===false;this.decodeStrings=!a;this.defaultEncoding=t.defaultEncoding||"utf8";this.length=0;this.writing=false;this.corked=0;this.sync=true;this.bufferProcessing=false;this.onwrite=function(e){C(r,e)};this.writecb=null;this.writelen=0;this.bufferedRequest=null;this.lastBufferedRequest=null;this.pendingcb=0;this.prefinished=false;this.errorEmitted=false;this.bufferedRequestCount=0;this.corkedRequestsFree=new B(this)}d.prototype.getBuffer=function e(){var t=this.bufferedRequest;var r=[];while(t){r.push(t);t=t.next}return r};(function(){try{Object.defineProperty(d.prototype,"buffer",{get:s.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer "+"instead.")})}catch(e){}})();var p;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function"){p=Function.prototype[Symbol.hasInstance];Object.defineProperty(g,Symbol.hasInstance,{value:function(e){if(p.call(this,e))return true;return e&&e._writableState instanceof d}})}else{p=function(e){return e instanceof this}}function g(t){o=o||e("./_stream_duplex");if(!p.call(g,this)&&!(this instanceof o)){return new g(t)}this._writableState=new d(t,this);this.writable=true;if(t){if(typeof t.write==="function")this._write=t.write;if(typeof t.writev==="function")this._writev=t.writev}f.call(this)}g.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function v(e,t){var r=new Error("write after end");e.emit("error",r);n(t,r)}function y(e,t,r,i){var o=true;var a=false;if(r===null){a=new TypeError("May not write null values to stream")}else if(!u.isBuffer(r)&&typeof r!=="string"&&r!==undefined&&!t.objectMode){a=new TypeError("Invalid non-string/buffer chunk")}if(a){e.emit("error",a);n(i,a);o=false}return o}g.prototype.write=function(e,t,r){var n=this._writableState;var i=false;if(typeof t==="function"){r=t;t=null}if(u.isBuffer(e))t="buffer";else if(!t)t=n.defaultEncoding;if(typeof r!=="function")r=l;if(n.ended)v(this,r);else if(y(this,n,e,r)){n.pendingcb++;i=m(this,n,e,t,r)}return i};g.prototype.cork=function(){var e=this._writableState;e.corked++};g.prototype.uncork=function(){var e=this._writableState;if(e.corked){e.corked--;if(!e.writing&&!e.corked&&!e.finished&&!e.bufferProcessing&&e.bufferedRequest)A(this,e)}};g.prototype.setDefaultEncoding=function e(t){if(typeof t==="string")t=t.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);this._writableState.defaultEncoding=t;return this};function w(e,t,r){if(!e.objectMode&&e.decodeStrings!==false&&typeof t==="string"){t=c.from(t,r)}return t}function m(e,t,r,n,i){r=w(t,r,n);if(u.isBuffer(r))n="buffer";var o=t.objectMode?1:r.length;t.length+=o;var a=t.length<t.highWaterMark;if(!a)t.needDrain=true;if(t.writing||t.corked){var s=t.lastBufferedRequest;t.lastBufferedRequest=new h(r,n,i);if(s){s.next=t.lastBufferedRequest}else{t.bufferedRequest=t.lastBufferedRequest}t.bufferedRequestCount+=1}else{b(e,t,false,o,r,n,i)}return a}function b(e,t,r,n,i,o,a){t.writelen=n;t.writecb=a;t.writing=true;t.sync=true;if(r)e._writev(i,t.onwrite);else e._write(i,o,t.onwrite);t.sync=false}function _(e,t,r,i,o){--t.pendingcb;if(r)n(o,i);else o(i);e._writableState.errorEmitted=true;e.emit("error",i)}function E(e){e.writing=false;e.writecb=null;e.length-=e.writelen;e.writelen=0}function C(e,t){var r=e._writableState;var n=r.sync;var o=r.writecb;E(r);if(t)_(e,r,n,t,o);else{var a=k(r);if(!a&&!r.corked&&!r.bufferProcessing&&r.bufferedRequest){A(e,r)}if(n){i(R,e,r,a,o)}else{R(e,r,a,o)}}}function R(e,t,r,n){if(!r)S(e,t);t.pendingcb--;n();x(e,t)}function S(e,t){if(t.length===0&&t.needDrain){t.needDrain=false;e.emit("drain")}}function A(e,t){t.bufferProcessing=true;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount;var i=new Array(n);var o=t.corkedRequestsFree;o.entry=r;var a=0;while(r){i[a]=r;r=r.next;a+=1}b(e,t,true,t.length,i,"",o.finish);t.pendingcb++;t.lastBufferedRequest=null;if(o.next){t.corkedRequestsFree=o.next;o.next=null}else{t.corkedRequestsFree=new B(t)}}else{while(r){var s=r.chunk;var f=r.encoding;var u=r.callback;var c=t.objectMode?1:s.length;b(e,t,false,c,s,f,u);r=r.next;if(t.writing){break}}if(r===null)t.lastBufferedRequest=null}t.bufferedRequestCount=0;t.bufferedRequest=r;t.bufferProcessing=false}g.prototype._write=function(e,t,r){r(new Error("_write() is not implemented"))};g.prototype._writev=null;g.prototype.end=function(e,t,r){var n=this._writableState;if(typeof e==="function"){r=e;e=null;t=null}else if(typeof t==="function"){r=t;t=null}if(e!==null&&e!==undefined)this.write(e,t);if(n.corked){n.corked=1;this.uncork()}if(!n.ending&&!n.finished)L(this,n,r)};function k(e){return e.ending&&e.length===0&&e.bufferedRequest===null&&!e.finished&&!e.writing}function T(e,t){if(!t.prefinished){t.prefinished=true;e.emit("prefinish")}}function x(e,t){var r=k(t);if(r){if(t.pendingcb===0){T(e,t);t.finished=true;e.emit("finish")}else{T(e,t)}}return r}function L(e,t,r){t.ending=true;x(e,t);if(r){if(t.finished)n(r);else e.once("finish",r)}t.ended=true;e.writable=false}function B(e){var t=this;this.next=null;this.entry=null;this.finish=function(r){var n=t.entry;t.entry=null;while(n){var i=n.callback;e.pendingcb--;i(r);n=n.next}if(e.corkedRequestsFree){e.corkedRequestsFree.next=t}else{e.corkedRequestsFree=t}}}}).call(this,e("_process"))},{"./_stream_duplex":18,_process:16,buffer:4,"buffer-shims":3,"core-util-is":5,events:8,inherits:11,"process-nextick-args":15,"util-deprecate":26}],23:[function(e,t,r){"use strict";var n=e("buffer").Buffer;var i=e("buffer-shims");t.exports=o;function o(){this.head=null;this.tail=null;this.length=0}o.prototype.push=function(e){var t={data:e,next:null};if(this.length>0)this.tail.next=t;else this.head=t;this.tail=t;++this.length};o.prototype.unshift=function(e){var t={data:e,next:this.head};if(this.length===0)this.tail=t;this.head=t;++this.length};o.prototype.shift=function(){if(this.length===0)return;var e=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return e};o.prototype.clear=function(){this.head=this.tail=null;this.length=0};o.prototype.join=function(e){if(this.length===0)return"";var t=this.head;var r=""+t.data;while(t=t.next){r+=e+t.data}return r};o.prototype.concat=function(e){if(this.length===0)return i.alloc(0);if(this.length===1)return this.head.data;var t=i.allocUnsafe(e>>>0);var r=this.head;var n=0;while(r){r.data.copy(t,n);n+=r.data.length;r=r.next}return t}},{buffer:4,"buffer-shims":3}],24:[function(e,t,r){(function(n){var i=function(){try{return e("st"+"ream")}catch(e){}}();r=t.exports=e("./lib/_stream_readable.js");r.Stream=i||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");if(!n.browser&&n.env.READABLE_STREAM==="disable"&&i){t.exports=i}}).call(this,e("_process"))},{"./lib/_stream_duplex.js":18,"./lib/_stream_passthrough.js":19,"./lib/_stream_readable.js":20,"./lib/_stream_transform.js":21,"./lib/_stream_writable.js":22,_process:16}],25:[function(e,t,r){var n=e("buffer").Buffer;var i=n.isEncoding||function(e){switch(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 true;default:return false}};function o(e){if(e&&!i(e)){throw new Error("Unknown encoding: "+e)}}var a=r.StringDecoder=function(e){this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,"");o(e);switch(this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2;this.detectIncompleteChar=f;break;case"base64":this.surrogateSize=3;this.detectIncompleteChar=u;break;default:this.write=s;return}this.charBuffer=new n(6);this.charReceived=0;this.charLength=0};a.prototype.write=function(e){var t="";while(this.charLength){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;e.copy(this.charBuffer,this.charReceived,0,r);this.charReceived+=r;if(this.charReceived<this.charLength){return""}e=e.slice(r,e.length);t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var n=t.charCodeAt(t.length-1);if(n>=55296&&n<=56319){this.charLength+=this.surrogateSize;t="";continue}this.charReceived=this.charLength=0;if(e.length===0){return t}break}this.detectIncompleteChar(e);var i=e.length;if(this.charLength){e.copy(this.charBuffer,0,e.length-this.charReceived,i);i-=this.charReceived}t+=e.toString(this.encoding,0,i);var i=t.length-1;var n=t.charCodeAt(i);if(n>=55296&&n<=56319){var o=this.surrogateSize;this.charLength+=o;this.charReceived+=o;this.charBuffer.copy(this.charBuffer,o,0,o);e.copy(this.charBuffer,0,0,o);return t.substring(0,i)}return t};a.prototype.detectIncompleteChar=function(e){var t=e.length>=3?3:e.length;for(;t>0;t--){var r=e[e.length-t];if(t==1&&r>>5==6){this.charLength=2;break}if(t<=2&&r>>4==14){this.charLength=3;break}if(t<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=t};a.prototype.end=function(e){var t="";if(e&&e.length)t=this.write(e);if(this.charReceived){var r=this.charReceived;var n=this.charBuffer;var i=this.encoding;t+=n.slice(0,r).toString(i)}return t};function s(e){return e.toString(this.encoding)}function f(e){this.charReceived=e.length%2;this.charLength=this.charReceived?2:0}function u(e){this.charReceived=e.length%3;this.charLength=this.charReceived?3:0;
}},{buffer:4}],26:[function(e,t,r){(function(e){t.exports=r;function r(e,t){if(n("noDeprecation")){return e}var r=false;function i(){if(!r){if(n("throwDeprecation")){throw new Error(t)}else if(n("traceDeprecation")){console.trace(t)}else{console.warn(t)}r=true}return e.apply(this,arguments)}return i}function n(t){try{if(!e.localStorage)return false}catch(e){return false}var r=e.localStorage[t];if(null==r)return false;return String(r).toLowerCase()==="true"}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],"/":[function(e,t,r){(function(r){t.exports=u;var n=e("debug")("simple-peer");var i=e("get-browser-rtc");var o=e("inherits");var a=e("randombytes");var s=e("readable-stream");var f=64*1024;o(u,s.Duplex);function u(e){var t=this;if(!(t instanceof u))return new u(e);t._id=a(4).toString("hex").slice(0,7);t._debug("new peer %o",e);e=Object.assign({allowHalfOpen:false},e);s.Duplex.call(t,e);t.channelName=e.initiator?e.channelName||a(20).toString("hex"):null;t._isChromium=typeof window!=="undefined"&&!!window.webkitRTCPeerConnection;t.initiator=e.initiator||false;t.channelConfig=e.channelConfig||u.channelConfig;t.config=e.config||u.config;t.constraints=t._transformConstraints(e.constraints||u.constraints);t.offerConstraints=t._transformConstraints(e.offerConstraints||{});t.answerConstraints=t._transformConstraints(e.answerConstraints||{});t.reconnectTimer=e.reconnectTimer||false;t.sdpTransform=e.sdpTransform||function(e){return e};t.stream=e.stream||false;t.trickle=e.trickle!==undefined?e.trickle:true;t.destroyed=false;t.connected=false;t.remoteAddress=undefined;t.remoteFamily=undefined;t.remotePort=undefined;t.localAddress=undefined;t.localPort=undefined;t._wrtc=e.wrtc&&typeof e.wrtc==="object"?e.wrtc:i();if(!t._wrtc){if(typeof window==="undefined"){throw new Error("No WebRTC support: Specify `opts.wrtc` option in this environment")}else{throw new Error("No WebRTC support: Not a supported browser")}}t._pcReady=false;t._channelReady=false;t._iceComplete=false;t._channel=null;t._pendingCandidates=[];t._previousStreams=[];t._chunk=null;t._cb=null;t._interval=null;t._reconnectTimeout=null;t._pc=new t._wrtc.RTCPeerConnection(t.config,t.constraints);t._isWrtc=Array.isArray(t._pc.RTCIceConnectionStates);t._isReactNativeWebrtc=typeof t._pc._peerConnectionId==="number";t._pc.oniceconnectionstatechange=function(){t._onIceConnectionStateChange()};t._pc.onsignalingstatechange=function(){t._onSignalingStateChange()};t._pc.onicecandidate=function(e){t._onIceCandidate(e)};if(t.initiator){var r=false;t._pc.onnegotiationneeded=function(){if(!r)t._createOffer();r=true};t._setupData({channel:t._pc.createDataChannel(t.channelName,t.channelConfig)})}else{t._pc.ondatachannel=function(e){t._setupData(e)}}if("addTrack"in t._pc){if(t.stream){t.stream.getTracks().forEach(function(e){t._pc.addTrack(e,t.stream)})}t._pc.ontrack=function(e){t._onTrack(e)}}else{if(t.stream)t._pc.addStream(t.stream);t._pc.onaddstream=function(e){t._onAddStream(e)}}if(t.initiator&&t._isWrtc){t._pc.onnegotiationneeded()}t._onFinishBound=function(){t._onFinish()};t.once("finish",t._onFinishBound)}u.WEBRTC_SUPPORT=!!i();u.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}]};u.constraints={};u.channelConfig={};Object.defineProperty(u.prototype,"bufferSize",{get:function(){var e=this;return e._channel&&e._channel.bufferedAmount||0}});u.prototype.address=function(){var e=this;return{port:e.localPort,family:"IPv4",address:e.localAddress}};u.prototype.signal=function(e){var t=this;if(t.destroyed)throw new Error("cannot signal after peer is destroyed");if(typeof e==="string"){try{e=JSON.parse(e)}catch(t){e={}}}t._debug("signal()");if(e.candidate){if(t._pc.remoteDescription)t._addIceCandidate(e.candidate);else t._pendingCandidates.push(e.candidate)}if(e.sdp){t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e),function(){if(t.destroyed)return;t._pendingCandidates.forEach(function(e){t._addIceCandidate(e)});t._pendingCandidates=[];if(t._pc.remoteDescription.type==="offer")t._createAnswer()},function(e){t._onError(e)})}if(!e.sdp&&!e.candidate){t._destroy(new Error("signal() called with invalid signal data"))}};u.prototype._addIceCandidate=function(e){var t=this;try{t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e),c,function(e){t._onError(e)})}catch(e){t._destroy(new Error("error adding candidate: "+e.message))}};u.prototype.send=function(e){var t=this;if(t._isWrtc&&r.isBuffer(e)){e=new Uint8Array(e)}t._channel.send(e)};u.prototype.destroy=function(e){var t=this;t._destroy(null,e)};u.prototype._destroy=function(e,t){var r=this;if(r.destroyed)return;if(t)r.once("close",t);r._debug("destroy (error: %s)",e&&e.message);r.readable=r.writable=false;if(!r._readableState.ended)r.push(null);if(!r._writableState.finished)r.end();r.destroyed=true;r.connected=false;r._pcReady=false;r._channelReady=false;r._previousStreams=null;clearInterval(r._interval);clearTimeout(r._reconnectTimeout);r._interval=null;r._reconnectTimeout=null;r._chunk=null;r._cb=null;if(r._onFinishBound)r.removeListener("finish",r._onFinishBound);r._onFinishBound=null;if(r._pc){try{r._pc.close()}catch(e){}r._pc.oniceconnectionstatechange=null;r._pc.onsignalingstatechange=null;r._pc.onicecandidate=null;if("addTrack"in r._pc){r._pc.ontrack=null}else{r._pc.onaddstream=null}r._pc.onnegotiationneeded=null;r._pc.ondatachannel=null}if(r._channel){try{r._channel.close()}catch(e){}r._channel.onmessage=null;r._channel.onopen=null;r._channel.onclose=null}r._pc=null;r._channel=null;if(e)r.emit("error",e);r.emit("close")};u.prototype._setupData=function(e){var t=this;t._channel=e.channel;t._channel.binaryType="arraybuffer";if(typeof t._channel.bufferedAmountLowThreshold==="number"){t._channel.bufferedAmountLowThreshold=f}t.channelName=t._channel.label;t._channel.onmessage=function(e){t._onChannelMessage(e)};t._channel.onbufferedamountlow=function(){t._onChannelBufferedAmountLow()};t._channel.onopen=function(){t._onChannelOpen()};t._channel.onclose=function(){t._onChannelClose()}};u.prototype._read=function(){};u.prototype._write=function(e,t,r){var n=this;if(n.destroyed)return r(new Error("cannot write after peer is destroyed"));if(n.connected){try{n.send(e)}catch(e){return n._onError(e)}if(n._channel.bufferedAmount>f){n._debug("start backpressure: bufferedAmount %d",n._channel.bufferedAmount);n._cb=r}else{r(null)}}else{n._debug("write before connect");n._chunk=e;n._cb=r}};u.prototype._onFinish=function(){var e=this;if(e.destroyed)return;if(e.connected){t()}else{e.once("connect",t)}function t(){setTimeout(function(){e._destroy()},100)}};u.prototype._createOffer=function(){var e=this;if(e.destroyed)return;e._pc.createOffer(function(t){if(e.destroyed)return;t.sdp=e.sdpTransform(t.sdp);e._pc.setLocalDescription(t,c,function(t){e._onError(t)});var r=function(){var r=e._pc.localDescription||t;e._debug("signal");e.emit("signal",{type:r.type,sdp:r.sdp})};if(e.trickle||e._iceComplete)r();else e.once("_iceComplete",r)},function(t){e._onError(t)},e.offerConstraints)};u.prototype._createAnswer=function(){var e=this;if(e.destroyed)return;e._pc.createAnswer(function(t){if(e.destroyed)return;t.sdp=e.sdpTransform(t.sdp);e._pc.setLocalDescription(t,c,function(t){e._onError(t)});if(e.trickle||e._iceComplete)r();else e.once("_iceComplete",r);function r(){var r=e._pc.localDescription||t;e._debug("signal");e.emit("signal",{type:r.type,sdp:r.sdp})}},function(t){e._onError(t)},e.answerConstraints)};u.prototype._onIceConnectionStateChange=function(){var e=this;if(e.destroyed)return;var t=e._pc.iceGatheringState;var r=e._pc.iceConnectionState;e._debug("iceConnectionStateChange %s %s",t,r);e.emit("iceConnectionStateChange",t,r);if(r==="connected"||r==="completed"){clearTimeout(e._reconnectTimeout);e._pcReady=true;e._maybeReady()}if(r==="disconnected"){if(e.reconnectTimer){clearTimeout(e._reconnectTimeout);e._reconnectTimeout=setTimeout(function(){e._destroy()},e.reconnectTimer)}else{e._destroy()}}if(r==="failed"){e._destroy(new Error("Ice connection failed."))}if(r==="closed"){e._destroy()}};u.prototype.getStats=function(e){var t=this;if(t._pc.getStats.length===0){t._pc.getStats().then(function(t){var r=[];t.forEach(function(e){r.push(e)});e(r)},function(e){t._onError(e)})}else if(t._isReactNativeWebrtc){t._pc.getStats(null,function(t){var r=[];t.forEach(function(e){r.push(e)});e(r)},function(e){t._onError(e)})}else if(t._pc.getStats.length>0){t._pc.getStats(function(t){var r=[];t.result().forEach(function(e){var t={};e.names().forEach(function(r){t[r]=e.stat(r)});t.id=e.id;t.type=e.type;t.timestamp=e.timestamp;r.push(t)});e(r)},function(e){t._onError(e)})}else{e([])}};u.prototype._maybeReady=function(){var e=this;e._debug("maybeReady pc %s channel %s",e._pcReady,e._channelReady);if(e.connected||e._connecting||!e._pcReady||!e._channelReady)return;e._connecting=true;e.getStats(function(t){e._connecting=false;e.connected=true;var r={};var n={};var i={};t.forEach(function(e){if(e.type==="remotecandidate"||e.type==="remote-candidate"){r[e.id]=e}if(e.type==="localcandidate"||e.type==="local-candidate"){n[e.id]=e}if(e.type==="candidatepair"||e.type==="candidate-pair"){i[e.id]=e}});t.forEach(function(e){if(e.type==="transport"){o(i[e.selectedCandidatePairId])}if(e.type==="googCandidatePair"&&e.googActiveConnection==="true"||(e.type==="candidatepair"||e.type==="candidate-pair")&&e.selected){o(e)}});function o(t){var i=n[t.localCandidateId];if(i&&i.ip){e.localAddress=i.ip;e.localPort=Number(i.port)}else if(i&&i.ipAddress){e.localAddress=i.ipAddress;e.localPort=Number(i.portNumber)}else if(typeof t.googLocalAddress==="string"){i=t.googLocalAddress.split(":");e.localAddress=i[0];e.localPort=Number(i[1])}var o=r[t.remoteCandidateId];if(o&&o.ip){e.remoteAddress=o.ip;e.remotePort=Number(o.port)}else if(o&&o.ipAddress){e.remoteAddress=o.ipAddress;e.remotePort=Number(o.portNumber)}else if(typeof t.googRemoteAddress==="string"){o=t.googRemoteAddress.split(":");e.remoteAddress=o[0];e.remotePort=Number(o[1])}e.remoteFamily="IPv4";e._debug("connect local: %s:%s remote: %s:%s",e.localAddress,e.localPort,e.remoteAddress,e.remotePort)}if(e._chunk){try{e.send(e._chunk)}catch(t){return e._onError(t)}e._chunk=null;e._debug('sent chunk from "write before connect"');var a=e._cb;e._cb=null;a(null)}if(typeof e._channel.bufferedAmountLowThreshold!=="number"){e._interval=setInterval(function(){e._onInterval()},150);if(e._interval.unref)e._interval.unref()}e._debug("connect");e.emit("connect")})};u.prototype._onInterval=function(){if(!this._cb||!this._channel||this._channel.bufferedAmount>f){return}this._onChannelBufferedAmountLow()};u.prototype._onSignalingStateChange=function(){var e=this;if(e.destroyed)return;e._debug("signalingStateChange %s",e._pc.signalingState);e.emit("signalingStateChange",e._pc.signalingState)};u.prototype._onIceCandidate=function(e){var t=this;if(t.destroyed)return;if(e.candidate&&t.trickle){t.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}})}else if(!e.candidate){t._iceComplete=true;t.emit("_iceComplete")}};u.prototype._onChannelMessage=function(e){var t=this;if(t.destroyed)return;var n=e.data;if(n instanceof ArrayBuffer)n=new r(n);t.push(n)};u.prototype._onChannelBufferedAmountLow=function(){var e=this;if(e.destroyed||!e._cb)return;e._debug("ending backpressure: bufferedAmount %d",e._channel.bufferedAmount);var t=e._cb;e._cb=null;t(null)};u.prototype._onChannelOpen=function(){var e=this;if(e.connected||e.destroyed)return;e._debug("on channel open");e._channelReady=true;e._maybeReady()};u.prototype._onChannelClose=function(){var e=this;if(e.destroyed)return;e._debug("on channel close");e._destroy()};u.prototype._onAddStream=function(e){var t=this;if(t.destroyed)return;t._debug("on add stream");t.emit("stream",e.stream)};u.prototype._onTrack=function(e){var t=this;if(t.destroyed)return;t._debug("on track");var r=e.streams[0].id;if(t._previousStreams.indexOf(r)!==-1)return;t._previousStreams.push(r);t.emit("stream",e.streams[0])};u.prototype._onError=function(e){var t=this;if(t.destroyed)return;t._debug("error %s",e.message||e);t._destroy(e)};u.prototype._debug=function(){var e=this;var t=[].slice.call(arguments);t[0]="["+e._id+"] "+t[0];n.apply(null,t)};u.prototype._transformConstraints=function(e){var t=this;if(Object.keys(e).length===0){return e}if((e.mandatory||e.optional)&&!t._isChromium){var r=Object.assign({},e.optional,e.mandatory);if(r.OfferToReceiveVideo!==undefined){r.offerToReceiveVideo=r.OfferToReceiveVideo;delete r["OfferToReceiveVideo"]}if(r.OfferToReceiveAudio!==undefined){r.offerToReceiveAudio=r.OfferToReceiveAudio;delete r["OfferToReceiveAudio"]}return r}else if(!e.mandatory&&!e.optional&&t._isChromium){if(e.offerToReceiveVideo!==undefined){e.OfferToReceiveVideo=e.offerToReceiveVideo;delete e["offerToReceiveVideo"]}if(e.offerToReceiveAudio!==undefined){e.OfferToReceiveAudio=e.offerToReceiveAudio;delete e["offerToReceiveAudio"]}return{mandatory:e}}return e};function c(){}}).call(this,e("buffer").Buffer)},{buffer:4,debug:6,"get-browser-rtc":9,inherits:11,randombytes:17,"readable-stream":24}]},{},[])("/")});