forked from feross/simple-peer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
simplepeer.min.js
3 lines (2 loc) · 59.2 KB
/
simplepeer.min.js
1
2
3
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.SimplePeer=e()}}(function(){return function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var f=n[a]={exports:{}};t[a][0].call(f.exports,function(e){var n=t[a][1][e];return i(n?n:e)},f,f.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,n){},{}],2:[function(e,t,n){function r(e,t){var n=this;if(!(n instanceof r))return new r(e,t);var i,o=typeof e;if("number"===o)i=+e;else if("string"===o)i=r.byteLength(e,t);else{if("object"!==o||null===e)throw new TypeError("must start with number, buffer, array or string");"Buffer"===e.type&&P(e.data)&&(e=e.data),i=+e.length}if(i>D)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+D.toString(16)+" bytes");0>i?i=0:i>>>=0,r.TYPED_ARRAY_SUPPORT?n=r._augment(new Uint8Array(i)):(n.length=i,n._isBuffer=!0);var a;if(r.TYPED_ARRAY_SUPPORT&&"number"==typeof e.byteLength)n._set(e);else if(L(e))if(r.isBuffer(e))for(a=0;i>a;a++)n[a]=e.readUInt8(a);else for(a=0;i>a;a++)n[a]=(e[a]%256+256)%256;else if("string"===o)n.write(e,0,t);else if("number"===o&&!r.TYPED_ARRAY_SUPPORT)for(a=0;i>a;a++)n[a]=0;return i>0&&i<=r.poolSize&&(n.parent=O),n}function i(e,t){if(!(this instanceof i))return new i(e,t);var n=new r(e,t);return delete n.parent,n}function o(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;var o=t.length;if(o%2!==0)throw new Error("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;r>a;a++){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))throw new Error("Invalid hex string");e[n+a]=s}return a}function a(e,t,n,r){var i=B(k(t,e.length-n),e,n,r);return i}function s(e,t,n,r){var i=B(x(t),e,n,r);return i}function c(e,t,n,r){return s(e,t,n,r)}function u(e,t,n,r){var i=B(M(t),e,n,r);return i}function f(e,t,n,r){var i=B(C(t,e.length-n),e,n,r);return i}function h(e,t,n){return U.fromByteArray(0===t&&n===e.length?e:e.slice(t,n))}function l(e,t,n){var r="",i="";n=Math.min(e.length,n);for(var o=t;n>o;o++)e[o]<=127?(r+=T(i)+String.fromCharCode(e[o]),i=""):i+="%"+e[o].toString(16);return r+T(i)}function d(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;n>i;i++)r+=String.fromCharCode(127&e[i]);return r}function p(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;n>i;i++)r+=String.fromCharCode(e[i]);return r}function g(e,t,n){var r=e.length;(!t||0>t)&&(t=0),(!n||0>n||n>r)&&(n=r);for(var i="",o=t;n>o;o++)i+=I(e[o]);return i}function b(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function w(e,t,n){if(e%1!==0||0>e)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function y(e,t,n,i,o,a){if(!r.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(t>o||a>t)throw new RangeError("value is out of bounds");if(n+i>e.length)throw new RangeError("index out of range")}function m(e,t,n,r){0>t&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);o>i;i++)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function v(e,t,n,r){0>t&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);o>i;i++)e[n+i]=t>>>8*(r?i:3-i)&255}function _(e,t,n,r,i,o){if(t>i||o>t)throw new RangeError("value is out of bounds");if(n+r>e.length)throw new RangeError("index out of range");if(0>n)throw new RangeError("index out of range")}function E(e,t,n,r,i){return i||_(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),j.write(e,t,n,r,23,4),n+4}function S(e,t,n,r,i){return i||_(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),j.write(e,t,n,r,52,8),n+8}function A(e){if(e=R(e).replace(Y,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function R(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function L(e){return P(e)||r.isBuffer(e)||e&&"object"==typeof e&&"number"==typeof e.length}function I(e){return 16>e?"0"+e.toString(16):e.toString(16)}function k(e,t){t=t||1/0;for(var n,r=e.length,i=null,o=[],a=0;r>a;a++){if(n=e.charCodeAt(a),n>55295&&57344>n){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(56320>n){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&((t-=3)>-1&&o.push(239,191,189),i=null);if(128>n){if((t-=1)<0)break;o.push(n)}else if(2048>n){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(65536>n){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(2097152>n))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function x(e){for(var t=[],n=0;n<e.length;n++)t.push(255&e.charCodeAt(n));return t}function C(e,t){for(var n,r,i,o=[],a=0;a<e.length&&!((t-=2)<0);a++)n=e.charCodeAt(a),r=n>>8,i=n%256,o.push(i),o.push(r);return o}function M(e){return U.toByteArray(A(e))}function B(e,t,n,r){for(var i=0;r>i&&!(i+n>=t.length||i>=e.length);i++)t[i+n]=e[i];return i}function T(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}var U=e("base64-js"),j=e("ieee754"),P=e("is-array");n.Buffer=r,n.SlowBuffer=i,n.INSPECT_MAX_BYTES=50,r.poolSize=8192;var D=1073741823,O={};r.TYPED_ARRAY_SUPPORT=function(){try{var e=new ArrayBuffer(0),t=new Uint8Array(e);return t.foo=function(){return 42},42===t.foo()&&"function"==typeof t.subarray&&0===new Uint8Array(1).subarray(1,1).byteLength}catch(n){return!1}}(),r.isBuffer=function(e){return!(null==e||!e._isBuffer)},r.compare=function(e,t){if(!r.isBuffer(e)||!r.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,i=t.length,o=0,a=Math.min(n,i);a>o&&e[o]===t[o];o++);return o!==a&&(n=e[o],i=t[o]),i>n?-1:n>i?1:0},r.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},r.concat=function(e,t){if(!P(e))throw new TypeError("list argument must be an Array of Buffers.");if(0===e.length)return new r(0);if(1===e.length)return e[0];var n;if(void 0===t)for(t=0,n=0;n<e.length;n++)t+=e[n].length;var i=new r(t),o=0;for(n=0;n<e.length;n++){var a=e[n];a.copy(i,o),o+=a.length}return i},r.byteLength=function(e,t){var n;switch(e+="",t||"utf8"){case"ascii":case"binary":case"raw":n=e.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*e.length;break;case"hex":n=e.length>>>1;break;case"utf8":case"utf-8":n=k(e).length;break;case"base64":n=M(e).length;break;default:n=e.length}return n},r.prototype.length=void 0,r.prototype.parent=void 0,r.prototype.toString=function(e,t,n){var r=!1;if(t>>>=0,n=void 0===n||n===1/0?this.length:n>>>0,e||(e="utf8"),0>t&&(t=0),n>this.length&&(n=this.length),t>=n)return"";for(;;)switch(e){case"hex":return g(this,t,n);case"utf8":case"utf-8":return l(this,t,n);case"ascii":return d(this,t,n);case"binary":return p(this,t,n);case"base64":return h(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}},r.prototype.equals=function(e){if(!r.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:0===r.compare(this,e)},r.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},r.prototype.compare=function(e){if(!r.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?0:r.compare(this,e)},r.prototype.indexOf=function(e,t){function n(e,t,n){for(var r=-1,i=0;n+i<e.length;i++)if(e[n+i]===t[-1===r?0:i-r]){if(-1===r&&(r=i),i-r+1===t.length)return n+r}else r=-1;return-1}if(t>2147483647?t=2147483647:-2147483648>t&&(t=-2147483648),t>>=0,0===this.length)return-1;if(t>=this.length)return-1;if(0>t&&(t=Math.max(this.length+t,0)),"string"==typeof e)return 0===e.length?-1:String.prototype.indexOf.call(this,e,t);if(r.isBuffer(e))return n(this,e,t);if("number"==typeof e)return r.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,e,t):n(this,[e],t);throw new TypeError("val must be string, number or Buffer")},r.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},r.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},r.prototype.write=function(e,t,n,r){if(isFinite(t))isFinite(n)||(r=n,n=void 0);else{var i=r;r=t,t=n,n=i}if(t=Number(t)||0,0>n||0>t||t>this.length)throw new RangeError("attempt to write outside buffer bounds");var h=this.length-t;n?(n=Number(n),n>h&&(n=h)):n=h,r=String(r||"utf8").toLowerCase();var l;switch(r){case"hex":l=o(this,e,t,n);break;case"utf8":case"utf-8":l=a(this,e,t,n);break;case"ascii":l=s(this,e,t,n);break;case"binary":l=c(this,e,t,n);break;case"base64":l=u(this,e,t,n);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":l=f(this,e,t,n);break;default:throw new TypeError("Unknown encoding: "+r)}return l},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},r.prototype.slice=function(e,t){var n=this.length;e=~~e,t=void 0===t?n:~~t,0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),0>t?(t+=n,0>t&&(t=0)):t>n&&(t=n),e>t&&(t=e);var i;if(r.TYPED_ARRAY_SUPPORT)i=r._augment(this.subarray(e,t));else{var o=t-e;i=new r(o,void 0);for(var a=0;o>a;a++)i[a]=this[a+e]}return i.length&&(i.parent=this.parent||this),i},r.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||w(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},r.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||w(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},r.prototype.readUInt8=function(e,t){return t||w(e,1,this.length),this[e]},r.prototype.readUInt16LE=function(e,t){return t||w(e,2,this.length),this[e]|this[e+1]<<8},r.prototype.readUInt16BE=function(e,t){return t||w(e,2,this.length),this[e]<<8|this[e+1]},r.prototype.readUInt32LE=function(e,t){return t||w(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},r.prototype.readUInt32BE=function(e,t){return t||w(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},r.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||w(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*t)),r},r.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||w(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},r.prototype.readInt8=function(e,t){return t||w(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},r.prototype.readInt16LE=function(e,t){t||w(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},r.prototype.readInt16BE=function(e,t){t||w(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},r.prototype.readInt32LE=function(e,t){return t||w(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},r.prototype.readInt32BE=function(e,t){return t||w(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},r.prototype.readFloatLE=function(e,t){return t||w(e,4,this.length),j.read(this,e,!0,23,4)},r.prototype.readFloatBE=function(e,t){return t||w(e,4,this.length),j.read(this,e,!1,23,4)},r.prototype.readDoubleLE=function(e,t){return t||w(e,8,this.length),j.read(this,e,!0,52,8)},r.prototype.readDoubleBE=function(e,t){return t||w(e,8,this.length),j.read(this,e,!1,52,8)},r.prototype.writeUIntLE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||y(this,e,t,n,Math.pow(2,8*n),0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i>>>0&255;return t+n},r.prototype.writeUIntBE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||y(this,e,t,n,Math.pow(2,8*n),0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o>>>0&255;return t+n},r.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||y(this,e,t,1,255,0),r.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e,t+1},r.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||y(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e,this[t+1]=e>>>8):m(this,e,t,!0),t+2},r.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||y(this,e,t,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e):m(this,e,t,!1),t+2},r.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||y(this,e,t,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e):v(this,e,t,!0),t+4},r.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||y(this,e,t,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e):v(this,e,t,!1),t+4},r.prototype.writeIntLE=function(e,t,n,r){e=+e,t>>>=0,r||y(this,e,t,n,Math.pow(2,8*n-1)-1,-Math.pow(2,8*n-1));var i=0,o=1,a=0>e?1:0;for(this[t]=255&e;++i<n&&(o*=256);)this[t+i]=(e/o>>0)-a&255;return t+n},r.prototype.writeIntBE=function(e,t,n,r){e=+e,t>>>=0,r||y(this,e,t,n,Math.pow(2,8*n-1)-1,-Math.pow(2,8*n-1));var i=n-1,o=1,a=0>e?1:0;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=(e/o>>0)-a&255;return t+n},r.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||y(this,e,t,1,127,-128),r.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[t]=e,t+1},r.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||y(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=e,this[t+1]=e>>>8):m(this,e,t,!0),t+2},r.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||y(this,e,t,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e):m(this,e,t,!1),t+2},r.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||y(this,e,t,4,2147483647,-2147483648),r.TYPED_ARRAY_SUPPORT?(this[t]=e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):v(this,e,t,!0),t+4},r.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||y(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),r.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e):v(this,e,t,!1),t+4},r.prototype.writeFloatLE=function(e,t,n){return E(this,e,t,!0,n)},r.prototype.writeFloatBE=function(e,t,n){return E(this,e,t,!1,n)},r.prototype.writeDoubleLE=function(e,t,n){return S(this,e,t,!0,n)},r.prototype.writeDoubleBE=function(e,t,n){return S(this,e,t,!1,n)},r.prototype.copy=function(e,t,n,i){if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&n>i&&(i=n),i===n)return 0;if(0===e.length||0===this.length)return 0;if(0>t)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("sourceStart out of bounds");if(0>i)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);var o=i-n;if(1e3>o||!r.TYPED_ARRAY_SUPPORT)for(var a=0;o>a;a++)e[a+t]=this[a+n];else e._set(this.subarray(n,n+o),t);return o},r.prototype.fill=function(e,t,n){if(e||(e=0),t||(t=0),n||(n=this.length),t>n)throw new RangeError("end < start");if(n!==t&&0!==this.length){if(0>t||t>=this.length)throw new RangeError("start out of bounds");if(0>n||n>this.length)throw new RangeError("end out of bounds");var r;if("number"==typeof e)for(r=t;n>r;r++)this[r]=e;else{var i=k(e.toString()),o=i.length;for(r=t;n>r;r++)this[r]=i[r%o]}return this}},r.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(r.TYPED_ARRAY_SUPPORT)return new r(this).buffer;for(var e=new Uint8Array(this.length),t=0,n=e.length;n>t;t+=1)e[t]=this[t];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var N=r.prototype;r._augment=function(e){return e.constructor=r,e._isBuffer=!0,e._set=e.set,e.get=N.get,e.set=N.set,e.write=N.write,e.toString=N.toString,e.toLocaleString=N.toString,e.toJSON=N.toJSON,e.equals=N.equals,e.compare=N.compare,e.indexOf=N.indexOf,e.copy=N.copy,e.slice=N.slice,e.readUIntLE=N.readUIntLE,e.readUIntBE=N.readUIntBE,e.readUInt8=N.readUInt8,e.readUInt16LE=N.readUInt16LE,e.readUInt16BE=N.readUInt16BE,e.readUInt32LE=N.readUInt32LE,e.readUInt32BE=N.readUInt32BE,e.readIntLE=N.readIntLE,e.readIntBE=N.readIntBE,e.readInt8=N.readInt8,e.readInt16LE=N.readInt16LE,e.readInt16BE=N.readInt16BE,e.readInt32LE=N.readInt32LE,e.readInt32BE=N.readInt32BE,e.readFloatLE=N.readFloatLE,e.readFloatBE=N.readFloatBE,e.readDoubleLE=N.readDoubleLE,e.readDoubleBE=N.readDoubleBE,e.writeUInt8=N.writeUInt8,e.writeUIntLE=N.writeUIntLE,e.writeUIntBE=N.writeUIntBE,e.writeUInt16LE=N.writeUInt16LE,e.writeUInt16BE=N.writeUInt16BE,e.writeUInt32LE=N.writeUInt32LE,e.writeUInt32BE=N.writeUInt32BE,e.writeIntLE=N.writeIntLE,e.writeIntBE=N.writeIntBE,e.writeInt8=N.writeInt8,e.writeInt16LE=N.writeInt16LE,e.writeInt16BE=N.writeInt16BE,e.writeInt32LE=N.writeInt32LE,e.writeInt32BE=N.writeInt32BE,e.writeFloatLE=N.writeFloatLE,e.writeFloatBE=N.writeFloatBE,e.writeDoubleLE=N.writeDoubleLE,e.writeDoubleBE=N.writeDoubleBE,e.fill=N.fill,e.inspect=N.inspect,e.toArrayBuffer=N.toArrayBuffer,e};var Y=/[^+\/0-9A-z\-]/g},{"base64-js":3,ieee754:4,"is-array":5}],3:[function(e,t,n){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(e){"use strict";function t(e){var t=e.charCodeAt(0);return t===a||t===h?62:t===s||t===l?63:c>t?-1:c+10>t?t-c+26+26:f+26>t?t-f:u+26>t?t-u+26:void 0}function n(e){function n(e){u[h++]=e}var r,i,a,s,c,u;if(e.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var f=e.length;c="="===e.charAt(f-2)?2:"="===e.charAt(f-1)?1:0,u=new o(3*e.length/4-c),a=c>0?e.length-4:e.length;var h=0;for(r=0,i=0;a>r;r+=4,i+=3)s=t(e.charAt(r))<<18|t(e.charAt(r+1))<<12|t(e.charAt(r+2))<<6|t(e.charAt(r+3)),n((16711680&s)>>16),n((65280&s)>>8),n(255&s);return 2===c?(s=t(e.charAt(r))<<2|t(e.charAt(r+1))>>4,n(255&s)):1===c&&(s=t(e.charAt(r))<<10|t(e.charAt(r+1))<<4|t(e.charAt(r+2))>>2,n(s>>8&255),n(255&s)),u}function i(e){function t(e){return r.charAt(e)}function n(e){return t(e>>18&63)+t(e>>12&63)+t(e>>6&63)+t(63&e)}var i,o,a,s=e.length%3,c="";for(i=0,a=e.length-s;a>i;i+=3)o=(e[i]<<16)+(e[i+1]<<8)+e[i+2],c+=n(o);switch(s){case 1:o=e[e.length-1],c+=t(o>>2),c+=t(o<<4&63),c+="==";break;case 2:o=(e[e.length-2]<<8)+e[e.length-1],c+=t(o>>10),c+=t(o>>4&63),c+=t(o<<2&63),c+="="}return c}var o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="+".charCodeAt(0),s="/".charCodeAt(0),c="0".charCodeAt(0),u="a".charCodeAt(0),f="A".charCodeAt(0),h="-".charCodeAt(0),l="_".charCodeAt(0);e.toByteArray=n,e.fromByteArray=i}("undefined"==typeof n?this.base64js={}:n)},{}],4:[function(e,t,n){n.read=function(e,t,n,r,i){var o,a,s=8*i-r-1,c=(1<<s)-1,u=c>>1,f=-7,h=n?i-1:0,l=n?-1:1,d=e[t+h];for(h+=l,o=d&(1<<-f)-1,d>>=-f,f+=s;f>0;o=256*o+e[t+h],h+=l,f-=8);for(a=o&(1<<-f)-1,o>>=-f,f+=r;f>0;a=256*a+e[t+h],h+=l,f-=8);if(0===o)o=1-u;else{if(o===c)return a?0/0:(d?-1:1)*(1/0);a+=Math.pow(2,r),o-=u}return(d?-1:1)*a*Math.pow(2,o-r)},n.write=function(e,t,n,r,i,o){var a,s,c,u=8*o-i-1,f=(1<<u)-1,h=f>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:o-1,p=r?1:-1,g=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=f):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),t+=a+h>=1?l/c:l*Math.pow(2,1-h),t*c>=2&&(a++,c/=2),a+h>=f?(s=0,a=f):a+h>=1?(s=(t*c-1)*Math.pow(2,i),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[n+d]=255&s,d+=p,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;e[n+d]=255&a,d+=p,a/=256,u-=8);e[n+d-p]|=128*g}},{}],5:[function(e,t,n){var r=Array.isArray,i=Object.prototype.toString;t.exports=r||function(e){return!!e&&"[object Array]"==i.call(e)}},{}],6:[function(e,t,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!o(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,o,c,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[e],s(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:for(r=arguments.length,o=new Array(r-1),c=1;r>c;c++)o[c-1]=arguments[c];n.apply(this,o)}else if(a(n)){for(r=arguments.length,o=new Array(r-1),c=1;r>c;c++)o[c-1]=arguments[c];for(u=n.slice(),r=u.length,c=0;r>c;c++)u[c].apply(this,o)}return!0},r.prototype.addListener=function(e,t){var n;if(!i(t))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,i(t.listener)?t.listener:t),this._events[e]?a(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,a(this._events[e])&&!this._events[e].warned){var n;n=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[e].length>n&&(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())}return this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,o,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],o=n.length,r=-1,n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=o;s-->0;)if(n[s]===t||n[s].listener&&n[s].listener===t){r=s;break}if(0>r)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.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(n=this._events[e],i(n))this.removeListener(e,n);else for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.listenerCount=function(e,t){var n;return n=e._events&&e._events[t]?i(e._events[t])?1:e._events[t].length:0}},{}],7:[function(e,t,n){t.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{}],8:[function(e,t,n){function r(){if(!s){s=!0;for(var e,t=a.length;t;){e=a,a=[];for(var n=-1;++n<t;)e[n]();t=a.length}s=!1}}function i(){}var o=t.exports={},a=[],s=!1;o.nextTick=function(e){a.push(e),s||setTimeout(r,0)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=i,o.addListener=i,o.once=i,o.off=i,o.removeListener=i,o.removeAllListeners=i,o.emit=i,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}},{}],9:[function(e,t,n){t.exports=e("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":10}],10:[function(e,t,n){(function(n){function r(e){return this instanceof r?(c.call(this,e),u.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",i)):new r(e)}function i(){this.allowHalfOpen||this._writableState.ended||n.nextTick(this.end.bind(this))}function o(e,t){for(var n=0,r=e.length;r>n;n++)t(e[n],n)}t.exports=r;var a=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t},s=e("core-util-is");s.inherits=e("inherits");var c=e("./_stream_readable"),u=e("./_stream_writable");s.inherits(r,c),o(a(u.prototype),function(e){r.prototype[e]||(r.prototype[e]=u.prototype[e])})}).call(this,e("_process"))},{"./_stream_readable":12,"./_stream_writable":14,_process:8,"core-util-is":15,inherits:29}],11:[function(e,t,n){function r(e){return this instanceof r?void i.call(this,e):new r(e)}t.exports=r;var i=e("./_stream_transform"),o=e("core-util-is");o.inherits=e("inherits"),o.inherits(r,i),r.prototype._transform=function(e,t,n){n(null,e)}},{"./_stream_transform":13,"core-util-is":15,inherits:29}],12:[function(e,t,n){(function(n){function r(t,n){var r=e("./_stream_duplex");t=t||{};var i=t.highWaterMark,o=t.objectMode?16:16384;this.highWaterMark=i||0===i?i:o,this.highWaterMark=~~this.highWaterMark,this.buffer=[],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.objectMode=!!t.objectMode,n instanceof r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(k||(k=e("string_decoder/").StringDecoder),this.decoder=new k(t.encoding),this.encoding=t.encoding)}function i(t){e("./_stream_duplex");return this instanceof i?(this._readableState=new r(t,this),this.readable=!0,void L.call(this)):new i(t)}function o(e,t,n,r,i){var o=u(t,n);if(o)e.emit("error",o);else if(I.isNullOrUndefined(n))t.reading=!1,t.ended||f(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else!t.decoder||i||r||(n=t.decoder.write(n)),i||(t.reading=!1),t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,i?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&h(e)),d(e,t);else i||(t.reading=!1);return a(t)}function a(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function s(e){if(e>=C)e=C;else{e--;for(var t=1;32>t;t<<=1)e|=e>>t;e++}return e}function c(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:isNaN(e)||I.isNull(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:0>=e?0:(e>t.highWaterMark&&(t.highWaterMark=s(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function u(e,t){var n=null;return I.isBuffer(t)||I.isString(t)||I.isNullOrUndefined(t)||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function f(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,h(e)}function h(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(x("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?n.nextTick(function(){l(e)}):l(e))}function l(e){x("emit readable"),e.emit("readable"),y(e)}function d(e,t){t.readingMore||(t.readingMore=!0,n.nextTick(function(){p(e,t)}))}function p(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(x("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function g(e){return function(){var t=e._readableState;x("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&R.listenerCount(e,"data")&&(t.flowing=!0,y(e))}}function b(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(function(){w(e,t)}))}function w(e,t){t.resumeScheduled=!1,e.emit("resume"),y(e),t.flowing&&!t.reading&&e.read(0)}function y(e){var t=e._readableState;if(x("flow",t.flowing),t.flowing)do var n=e.read();while(null!==n&&t.flowing)}function m(e,t){var n,r=t.buffer,i=t.length,o=!!t.decoder,a=!!t.objectMode;if(0===r.length)return null;if(0===i)n=null;else if(a)n=r.shift();else if(!e||e>=i)n=o?r.join(""):A.concat(r,i),r.length=0;else if(e<r[0].length){var s=r[0];n=s.slice(0,e),r[0]=s.slice(e)}else if(e===r[0].length)n=r.shift();else{n=o?"":new A(e);for(var c=0,u=0,f=r.length;f>u&&e>c;u++){var s=r[0],h=Math.min(e-c,s.length);o?n+=s.slice(0,h):s.copy(n,c,0,h),h<s.length?r[0]=s.slice(h):r.shift(),c+=h}}return n}function v(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,n.nextTick(function(){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function _(e,t){for(var n=0,r=e.length;r>n;n++)t(e[n],n)}function E(e,t){for(var n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1}t.exports=i;var S=e("isarray"),A=e("buffer").Buffer;i.ReadableState=r;var R=e("events").EventEmitter;R.listenerCount||(R.listenerCount=function(e,t){return e.listeners(t).length});var L=e("stream"),I=e("core-util-is");I.inherits=e("inherits");var k,x=e("util");x=x&&x.debuglog?x.debuglog("stream"):function(){},I.inherits(i,L),i.prototype.push=function(e,t){var n=this._readableState;return I.isString(e)&&!n.objectMode&&(t=t||n.defaultEncoding,t!==n.encoding&&(e=new A(e,t),t="")),o(this,n,e,t,!1)},i.prototype.unshift=function(e){var t=this._readableState;return o(this,t,e,"",!0)},i.prototype.setEncoding=function(t){return k||(k=e("string_decoder/").StringDecoder),this._readableState.decoder=new k(t),this._readableState.encoding=t,this};var C=8388608;i.prototype.read=function(e){x("read",e);var t=this._readableState,n=e;if((!I.isNumber(e)||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return x("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?v(this):h(this),null;if(e=c(e,t),0===e&&t.ended)return 0===t.length&&v(this),null;var r=t.needReadable;x("need readable",r),(0===t.length||t.length-e<t.highWaterMark)&&(r=!0,x("length less than watermark",r)),(t.ended||t.reading)&&(r=!1,x("reading or ended",r)),r&&(x("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),r&&!t.reading&&(e=c(n,t));var i;return i=e>0?m(e,t):null,I.isNull(i)&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),n!==e&&t.ended&&0===t.length&&v(this),I.isNull(i)||this.emit("data",i),i},i.prototype._read=function(e){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(e,t){function r(e){x("onunpipe"),e===h&&o()}function i(){x("onend"),e.end()}function o(){x("cleanup"),e.removeListener("close",c),e.removeListener("finish",u),e.removeListener("drain",b),e.removeListener("error",s),e.removeListener("unpipe",r),h.removeListener("end",i),h.removeListener("end",o),h.removeListener("data",a),!l.awaitDrain||e._writableState&&!e._writableState.needDrain||b()}function a(t){x("ondata");var n=e.write(t);!1===n&&(x("false write response, pause",h._readableState.awaitDrain),h._readableState.awaitDrain++,h.pause())}function s(t){x("onerror",t),f(),e.removeListener("error",s),0===R.listenerCount(e,"error")&&e.emit("error",t)}function c(){e.removeListener("finish",u),f()}function u(){x("onfinish"),e.removeListener("close",c),f()}function f(){x("unpipe"),h.unpipe(e);
}var h=this,l=this._readableState;switch(l.pipesCount){case 0:l.pipes=e;break;case 1:l.pipes=[l.pipes,e];break;default:l.pipes.push(e)}l.pipesCount+=1,x("pipe count=%d opts=%j",l.pipesCount,t);var d=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr,p=d?i:o;l.endEmitted?n.nextTick(p):h.once("end",p),e.on("unpipe",r);var b=g(h);return e.on("drain",b),h.on("data",a),e._events&&e._events.error?S(e._events.error)?e._events.error.unshift(s):e._events.error=[s,e._events.error]:e.on("error",s),e.once("close",c),e.once("finish",u),e.emit("pipe",h),l.flowing||(x("pipe resume"),h.resume()),e},i.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;r>i;i++)n[i].emit("unpipe",this);return this}var i=E(t.pipes,e);return-1===i?this:(t.pipes.splice(i,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this),this)},i.prototype.on=function(e,t){var r=L.prototype.on.call(this,e,t);if("data"===e&&!1!==this._readableState.flowing&&this.resume(),"readable"===e&&this.readable){var i=this._readableState;if(!i.readableListening)if(i.readableListening=!0,i.emittedReadable=!1,i.needReadable=!0,i.reading)i.length&&h(this,i);else{var o=this;n.nextTick(function(){x("readable nexttick read 0"),o.read(0)})}}return r},i.prototype.addListener=i.prototype.on,i.prototype.resume=function(){var e=this._readableState;return e.flowing||(x("resume"),e.flowing=!0,e.reading||(x("resume read 0"),this.read(0)),b(this,e)),this},i.prototype.pause=function(){return x("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(x("pause"),this._readableState.flowing=!1,this.emit("pause")),this},i.prototype.wrap=function(e){var t=this._readableState,n=!1,r=this;e.on("end",function(){if(x("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&r.push(e)}r.push(null)}),e.on("data",function(i){if(x("wrapped data"),t.decoder&&(i=t.decoder.write(i)),i&&(t.objectMode||i.length)){var o=r.push(i);o||(n=!0,e.pause())}});for(var i in e)I.isFunction(e[i])&&I.isUndefined(this[i])&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));var o=["error","close","destroy","pause","resume"];return _(o,function(t){e.on(t,r.emit.bind(r,t))}),r._read=function(t){x("wrapped _read",t),n&&(n=!1,e.resume())},r},i._fromList=m}).call(this,e("_process"))},{"./_stream_duplex":10,_process:8,buffer:2,"core-util-is":15,events:6,inherits:29,isarray:7,stream:20,"string_decoder/":21,util:1}],13:[function(e,t,n){function r(e,t){this.afterTransform=function(e,n){return i(t,e,n)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function i(e,t,n){var r=e._transformState;r.transforming=!1;var i=r.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));r.writechunk=null,r.writecb=null,c.isNullOrUndefined(n)||e.push(n),i&&i(t);var o=e._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&e._read(o.highWaterMark)}function o(e){if(!(this instanceof o))return new o(e);s.call(this,e),this._transformState=new r(e,this);var t=this;this._readableState.needReadable=!0,this._readableState.sync=!1,this.once("prefinish",function(){c.isFunction(this._flush)?this._flush(function(e){a(t,e)}):a(t)})}function a(e,t){if(t)return e.emit("error",t);var n=e._writableState,r=e._transformState;if(n.length)throw new Error("calling transform done when ws.length != 0");if(r.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}t.exports=o;var s=e("./_stream_duplex"),c=e("core-util-is");c.inherits=e("inherits"),c.inherits(o,s),o.prototype.push=function(e,t){return this._transformState.needTransform=!1,s.prototype.push.call(this,e,t)},o.prototype._transform=function(e,t,n){throw new Error("not implemented")},o.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},o.prototype._read=function(e){var t=this._transformState;c.isNull(t.writechunk)||!t.writecb||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))}},{"./_stream_duplex":10,"core-util-is":15,inherits:29}],14:[function(e,t,n){(function(n){function r(e,t,n){this.chunk=e,this.encoding=t,this.callback=n}function i(t,n){var r=e("./_stream_duplex");t=t||{};var i=t.highWaterMark,o=t.objectMode?16:16384;this.highWaterMark=i||0===i?i:o,this.objectMode=!!t.objectMode,n instanceof r&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var a=t.decodeStrings===!1;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){d(n,e)},this.writecb=null,this.writelen=0,this.buffer=[],this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1}function o(t){var n=e("./_stream_duplex");return this instanceof o||this instanceof n?(this._writableState=new i(t,this),this.writable=!0,void S.call(this)):new o(t)}function a(e,t,r){var i=new Error("write after end");e.emit("error",i),n.nextTick(function(){r(i)})}function s(e,t,r,i){var o=!0;if(!(E.isBuffer(r)||E.isString(r)||E.isNullOrUndefined(r)||t.objectMode)){var a=new TypeError("Invalid non-string/buffer chunk");e.emit("error",a),n.nextTick(function(){i(a)}),o=!1}return o}function c(e,t,n){return!e.objectMode&&e.decodeStrings!==!1&&E.isString(t)&&(t=new _(t,n)),t}function u(e,t,n,i,o){n=c(t,n,i),E.isBuffer(n)&&(i="buffer");var a=t.objectMode?1:n.length;t.length+=a;var s=t.length<t.highWaterMark;return s||(t.needDrain=!0),t.writing||t.corked?t.buffer.push(new r(n,i,o)):f(e,t,!1,a,n,i,o),s}function f(e,t,n,r,i,o,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function h(e,t,r,i,o){r?n.nextTick(function(){t.pendingcb--,o(i)}):(t.pendingcb--,o(i)),e._writableState.errorEmitted=!0,e.emit("error",i)}function l(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function d(e,t){var r=e._writableState,i=r.sync,o=r.writecb;if(l(r),t)h(e,r,i,t,o);else{var a=w(e,r);a||r.corked||r.bufferProcessing||!r.buffer.length||b(e,r),i?n.nextTick(function(){p(e,r,a,o)}):p(e,r,a,o)}}function p(e,t,n,r){n||g(e,t),t.pendingcb--,r(),m(e,t)}function g(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function b(e,t){if(t.bufferProcessing=!0,e._writev&&t.buffer.length>1){for(var n=[],r=0;r<t.buffer.length;r++)n.push(t.buffer[r].callback);t.pendingcb++,f(e,t,!0,t.length,t.buffer,"",function(e){for(var r=0;r<n.length;r++)t.pendingcb--,n[r](e)}),t.buffer=[]}else{for(var r=0;r<t.buffer.length;r++){var i=t.buffer[r],o=i.chunk,a=i.encoding,s=i.callback,c=t.objectMode?1:o.length;if(f(e,t,!1,c,o,a,s),t.writing){r++;break}}r<t.buffer.length?t.buffer=t.buffer.slice(r):t.buffer.length=0}t.bufferProcessing=!1}function w(e,t){return t.ending&&0===t.length&&!t.finished&&!t.writing}function y(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}function m(e,t){var n=w(e,t);return n&&(0===t.pendingcb?(y(e,t),t.finished=!0,e.emit("finish")):y(e,t)),n}function v(e,t,r){t.ending=!0,m(e,t),r&&(t.finished?n.nextTick(r):e.once("finish",r)),t.ended=!0}t.exports=o;var _=e("buffer").Buffer;o.WritableState=i;var E=e("core-util-is");E.inherits=e("inherits");var S=e("stream");E.inherits(o,S),o.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},o.prototype.write=function(e,t,n){var r=this._writableState,i=!1;return E.isFunction(t)&&(n=t,t=null),E.isBuffer(e)?t="buffer":t||(t=r.defaultEncoding),E.isFunction(n)||(n=function(){}),r.ended?a(this,r,n):s(this,r,e,n)&&(r.pendingcb++,i=u(this,r,e,t,n)),i},o.prototype.cork=function(){var e=this._writableState;e.corked++},o.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.buffer.length||b(this,e))},o.prototype._write=function(e,t,n){n(new Error("not implemented"))},o.prototype._writev=null,o.prototype.end=function(e,t,n){var r=this._writableState;E.isFunction(e)?(n=e,e=null,t=null):E.isFunction(t)&&(n=t,t=null),E.isNullOrUndefined(e)||this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||v(this,r,n)}}).call(this,e("_process"))},{"./_stream_duplex":10,_process:8,buffer:2,"core-util-is":15,inherits:29,stream:20}],15:[function(e,t,n){(function(e){function t(e){return Array.isArray(e)}function r(e){return"boolean"==typeof e}function i(e){return null===e}function o(e){return null==e}function a(e){return"number"==typeof e}function s(e){return"string"==typeof e}function c(e){return"symbol"==typeof e}function u(e){return void 0===e}function f(e){return h(e)&&"[object RegExp]"===w(e)}function h(e){return"object"==typeof e&&null!==e}function l(e){return h(e)&&"[object Date]"===w(e)}function d(e){return h(e)&&("[object Error]"===w(e)||e instanceof Error)}function p(e){return"function"==typeof e}function g(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function b(t){return e.isBuffer(t)}function w(e){return Object.prototype.toString.call(e)}n.isArray=t,n.isBoolean=r,n.isNull=i,n.isNullOrUndefined=o,n.isNumber=a,n.isString=s,n.isSymbol=c,n.isUndefined=u,n.isRegExp=f,n.isObject=h,n.isDate=l,n.isError=d,n.isFunction=p,n.isPrimitive=g,n.isBuffer=b}).call(this,e("buffer").Buffer)},{buffer:2}],16:[function(e,t,n){t.exports=e("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":11}],17:[function(e,t,n){n=t.exports=e("./lib/_stream_readable.js"),n.Stream=e("stream"),n.Readable=n,n.Writable=e("./lib/_stream_writable.js"),n.Duplex=e("./lib/_stream_duplex.js"),n.Transform=e("./lib/_stream_transform.js"),n.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":10,"./lib/_stream_passthrough.js":11,"./lib/_stream_readable.js":12,"./lib/_stream_transform.js":13,"./lib/_stream_writable.js":14,stream:20}],18:[function(e,t,n){t.exports=e("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":13}],19:[function(e,t,n){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":14}],20:[function(e,t,n){function r(){i.call(this)}t.exports=r;var i=e("events").EventEmitter,o=e("inherits");o(r,i),r.Readable=e("readable-stream/readable.js"),r.Writable=e("readable-stream/writable.js"),r.Duplex=e("readable-stream/duplex.js"),r.Transform=e("readable-stream/transform.js"),r.PassThrough=e("readable-stream/passthrough.js"),r.Stream=r,r.prototype.pipe=function(e,t){function n(t){e.writable&&!1===e.write(t)&&u.pause&&u.pause()}function r(){u.readable&&u.resume&&u.resume()}function o(){f||(f=!0,e.end())}function a(){f||(f=!0,"function"==typeof e.destroy&&e.destroy())}function s(e){if(c(),0===i.listenerCount(this,"error"))throw e}function c(){u.removeListener("data",n),e.removeListener("drain",r),u.removeListener("end",o),u.removeListener("close",a),u.removeListener("error",s),e.removeListener("error",s),u.removeListener("end",c),u.removeListener("close",c),e.removeListener("close",c)}var u=this;u.on("data",n),e.on("drain",r),e._isStdio||t&&t.end===!1||(u.on("end",o),u.on("close",a));var f=!1;return u.on("error",s),e.on("error",s),u.on("end",c),u.on("close",c),e.on("close",c),e.emit("pipe",u),e}},{events:6,inherits:29,"readable-stream/duplex.js":9,"readable-stream/passthrough.js":16,"readable-stream/readable.js":17,"readable-stream/transform.js":18,"readable-stream/writable.js":19}],21:[function(e,t,n){function r(e){if(e&&!c(e))throw new Error("Unknown encoding: "+e)}function i(e){return e.toString(this.encoding)}function o(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function a(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var s=e("buffer").Buffer,c=s.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!0;default:return!1}},u=n.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),r(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=o;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=a;break;default:return void(this.write=i)}this.charBuffer=new s(6),this.charReceived=0,this.charLength=0};u.prototype.write=function(e){for(var t="";this.charLength;){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";e=e.slice(n,e.length),t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var r=t.charCodeAt(t.length-1);if(!(r>=55296&&56319>=r)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var i=e.length;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,r=t.charCodeAt(i);if(r>=55296&&56319>=r){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,i)}return t},u.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var n=e[e.length-t];if(1==t&&n>>5==6){this.charLength=2;break}if(2>=t&&n>>4==14){this.charLength=3;break}if(3>=t&&n>>3==30){this.charLength=4;break}}this.charReceived=t},u.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var n=this.charReceived,r=this.charBuffer,i=this.encoding;t+=r.slice(0,n).toString(i)}return t}},{buffer:2}],22:[function(e,t,n){function r(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function i(){var e=arguments,t=this.useColors;if(e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff),!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0,o=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r),e}function o(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?u.removeItem("debug"):u.debug=e}catch(t){}}function s(){var e;try{e=u.debug}catch(t){}return e}function c(){try{return window.localStorage}catch(e){}}n=t.exports=e("./debug"),n.log=o,n.formatArgs=i,n.save=a,n.load=s,n.useColors=r;var u;u="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:c(),n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(e){return JSON.stringify(e)},n.enable(s())},{"./debug":23}],23:[function(e,t,n){function r(){return n.colors[f++%n.colors.length]}function i(e){function t(){}function i(){var e=i,t=+new Date,o=t-(u||t);e.diff=o,e.prev=u,e.curr=t,u=t,null==e.useColors&&(e.useColors=n.useColors()),null==e.color&&e.useColors&&(e.color=r());var a=Array.prototype.slice.call(arguments);a[0]=n.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var s=0;a[0]=a[0].replace(/%([a-z%])/g,function(t,r){if("%%"===t)return t;s++;var i=n.formatters[r];if("function"==typeof i){var o=a[s];t=i.call(e,o),a.splice(s,1),s--}return t}),"function"==typeof n.formatArgs&&(a=n.formatArgs.apply(e,a));var c=i.log||n.log||console.log.bind(console);c.apply(e,a)}t.enabled=!1,i.enabled=!0;var o=n.enabled(e)?i:t;return o.namespace=e,o}function o(e){n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,i=0;r>i;i++)t[i]&&(e=t[i].replace(/\*/g,".*?"),"-"===e[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))}function a(){n.enable("")}function s(e){var t,r;for(t=0,r=n.skips.length;r>t;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;r>t;t++)if(n.names[t].test(e))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}n=t.exports=i,n.coerce=c,n.disable=a,n.enable=o,n.enabled=s,n.humanize=e("ms"),n.names=[],n.skips=[],n.formatters={};var u,f=0},{ms:24}],24:[function(e,t,n){function r(e){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){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*h;case"days":case"day":case"d":return n*f;case"hours":case"hour":case"hrs":case"hr":case"h":return n*u;case"minutes":case"minute":case"mins":case"min":case"m":return n*c;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}function i(e){return e>=f?Math.round(e/f)+"d":e>=u?Math.round(e/u)+"h":e>=c?Math.round(e/c)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function o(e){return a(e,f,"day")||a(e,u,"hour")||a(e,c,"minute")||a(e,s,"second")||e+" ms"}function a(e,t,n){return t>e?void 0:1.5*t>e?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var s=1e3,c=60*s,u=60*c,f=24*u,h=365.25*f;t.exports=function(e,t){return t=t||{},"string"==typeof e?r(e):t["long"]?o(e):i(e)}},{}],25:[function(e,t,n){function r(e){var t=!0;return o(function(){t=!1}),function(){var n=arguments,r=this;t?o(function(){e.apply(r,n)}):e.apply(r,n)}}var i=e("wrappy");t.exports=i(r);var o=e("asap")},{asap:26,wrappy:27}],26:[function(e,t,n){(function(e){function n(){for(;i.next;){i=i.next;var e=i.task;i.task=void 0;var t=i.domain;t&&(i.domain=void 0,t.enter());try{e()}catch(r){if(c)throw t&&t.exit(),setTimeout(n,0),t&&t.enter(),r;setTimeout(function(){throw r},0)}t&&t.exit()}a=!1}function r(t){o=o.next={task:t,domain:c&&e.domain,next:null},a||(a=!0,s())}var i={task:void 0,next:null},o=i,a=!1,s=void 0,c=!1;if("undefined"!=typeof e&&e.nextTick)c=!0,s=function(){e.nextTick(n)};else if("function"==typeof setImmediate)s="undefined"!=typeof window?setImmediate.bind(window,n):function(){setImmediate(n)};else if("undefined"!=typeof MessageChannel){var u=new MessageChannel;u.port1.onmessage=n,s=function(){u.port2.postMessage(0)}}else s=function(){setTimeout(n,0)};t.exports=r}).call(this,e("_process"))},{_process:8}],27:[function(e,t,n){function r(e,t){function n(){for(var t=new Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),i=t[t.length-1];return"function"==typeof r&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}if(e&&t)return r(e)(t);if("function"!=typeof e)throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(t){n[t]=e[t]}),n}t.exports=r},{}],28:[function(e,t,n){var r=t.exports=function(e,t){if(t||(t=16),void 0===e&&(e=128),0>=e)return"0";for(var n=Math.log(Math.pow(2,e))/Math.log(t),i=2;n===1/0;i*=2)n=Math.log(Math.pow(2,e/i))/Math.log(t)*i;for(var o=n-Math.floor(n),a="",i=0;i<Math.floor(n);i++){var s=Math.floor(Math.random()*t).toString(t);a=s+a}if(o){var c=Math.pow(t,o),s=Math.floor(Math.random()*c).toString(t);a=s+a}var u=parseInt(a,t);return u!==1/0&&u>=Math.pow(2,e)?r(e,t):a};r.rack=function(e,t,n){var i=function(i){var a=0;do{if(a++>10){if(!n)throw new Error("too many ID collisions, use more bits");e+=n}var s=r(e,t)}while(Object.hasOwnProperty.call(o,s));return o[s]=i,s},o=i.hats={};return i.get=function(e){return i.hats[e]},i.set=function(e,t){return i.hats[e]=t,i},i.bits=e||128,i.base=t||16,i}},{}],29:[function(e,t,n){t.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],30:[function(e,t,n){function r(e){return i(e)||o(e)}function i(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function o(e){return s[a.call(e)]}t.exports=r,r.strict=i,r.loose=o;var a=Object.prototype.toString,s={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0}},{}],31:[function(e,t,n){arguments[4][27][0].apply(n,arguments)},{dup:27}],32:[function(e,t,n){function r(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}var i=e("wrappy");t.exports=i(r),r.proto=r(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return r(this)},configurable:!0})})},{wrappy:31}],33:[function(e,t,n){(function(n){var r=e("is-typedarray").strict;t.exports=function(e){var t=n.TYPED_ARRAY_SUPPORT?n._augment:function(e){return new n(e)};return e instanceof Uint8Array?t(e):e instanceof ArrayBuffer?t(new Uint8Array(e)):r(e)?t(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):new n(e)}}).call(this,e("buffer").Buffer)},{buffer:2,"is-typedarray":30}],34:[function(e,t,n){function r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}t.exports=r},{}],"/":[function(e,t,n){(function(n){function r(e){var t=this;return t instanceof r?(e||(e={}),e.allowHalfOpen=!1,d.Duplex.call(t,e),c(t,{initiator:!1,stream:!1,config:r.config,constraints:r.constraints,channelName:e&&e.initiator?u(160):null,trickle:!0},e),t._debug("new peer (initiator: %s)",t.initiator),t.destroyed=!1,t.connected=!1,t._pcReady=!1,t._channelReady=!1,t._iceComplete=!1,t._channel=null,t._buffer=[],t._pc=new g(t.config,t.constraints),t._pc.oniceconnectionstatechange=t._onIceConnectionStateChange.bind(t),t._pc.onsignalingstatechange=t._onSignalingStateChange.bind(t),t._pc.onicecandidate=t._onIceCandidate.bind(t),t.stream&&t._setupVideo(t.stream),t._pc.onaddstream=t._onAddStream.bind(t),t.initiator?(t._setupData({channel:t._pc.createDataChannel(t.channelName)}),t._pc.onnegotiationneeded=l(t._createOffer.bind(t)),window.mozRTCPeerConnection&&setTimeout(function(){t._pc.onnegotiationneeded()},0)):t._pc.ondatachannel=t._setupData.bind(t),void t.on("finish",function(){t.connected?t._destroy():t.once("connect",function(){setTimeout(function(){t._destroy()},100)})})):new r(e)}function i(e){var t=e.sdp.split("b=AS:30");t.length>1&&(e.sdp=t[0]+"b=AS:1638400"+t[1])}function o(){}t.exports=r;var a=e("debug")("simple-peer"),s=e("dezalgo"),c=e("xtend/mutable"),u=e("hat"),f=e("inherits"),h=e("is-typedarray"),l=e("once"),d=e("stream"),p=e("typedarray-to-buffer"),g="undefined"!=typeof window&&(window.mozRTCPeerConnection||window.RTCPeerConnection||window.webkitRTCPeerConnection),b="undefined"!=typeof window&&(window.mozRTCSessionDescription||window.RTCSessionDescription||window.webkitRTCSessionDescription),w="undefined"!=typeof window&&(window.mozRTCIceCandidate||window.RTCIceCandidate||window.webkitRTCIceCandidate);f(r,d.Duplex),r.config={iceServers:[{url:"stun:23.21.150.121",urls:"stun:23.21.150.121"}]},r.constraints={},r.prototype.send=function(e,t){var n=this;t=t?s(t):o,n._write(e,void 0,t)},r.prototype.signal=function(e){var t=this;if(t.destroyed)throw new Error("cannot signal after peer is destroyed");if("string"==typeof e)try{e=JSON.parse(e)}catch(n){e={}}if(t._debug("signal"),e.sdp&&t._pc.setRemoteDescription(new b(e),function(){"offer"===t._pc.remoteDescription.type&&t._createAnswer()},t._onError.bind(t)),e.candidate)try{t._pc.addIceCandidate(new w(e.candidate),o,t._onError.bind(t))}catch(n){t._destroy(new Error("error adding candidate: "+n.message))}e.sdp||e.candidate||t._destroy(new Error("signal() called with invalid signal data"))},r.prototype.destroy=function(e){var t=this;t._destroy(null,e)},r.prototype._destroy=function(e,t){var n=this;if(!n.destroyed){if(t&&n.once("close",t),n._debug("destroy (error: %s)",e&&e.message),n.destroyed=!0,n.connected=!1,n._pcReady=!1,n._channelReady=!1,n._pc){try{n._pc.close()}catch(e){}n._pc.oniceconnectionstatechange=null,n._pc.onsignalingstatechange=null,n._pc.onicecandidate=null}if(n._channel){try{n._channel.close()}catch(e){}n._channel.onmessage=null,n._channel.onopen=null,n._channel.onclose=null}n._pc=null,n._channel=null,this.readable=this.writable=!1,n._readableState.ended||n.push(null),n._writableState.finished||n.end(),e&&n.emit("error",e),n.emit("close")}},r.prototype._setupData=function(e){var t=this;t._channel=e.channel,t.channelName=t._channel.label,t._channel.binaryType="arraybuffer",t._channel.onmessage=t._onChannelMessage.bind(t),t._channel.onopen=t._onChannelOpen.bind(t),t._channel.onclose=t._onChannelClose.bind(t)},r.prototype._setupVideo=function(e){var t=this;t._pc.addStream(e)},r.prototype._read=function(){},r.prototype._write=function(e,t,r){var i=this;if(i.destroyed)return r(new Error("cannot write after peer is destroyed"));var o=e.length||e.byteLength||e.size;return i._channelReady?(i._debug("_write: length %d",o),i._channel.send(h.strict(e)||e instanceof ArrayBuffer||"string"==typeof e||n.Blob&&e instanceof n.Blob?e:JSON.stringify(e)),void r(null)):(i._debug("_write before ready: length %d",o),i._buffer.push(e),void r(null))},r.prototype._createOffer=function(){var e=this;e.destroyed||e._pc.createOffer(function(t){if(!e.destroyed){i(t),e._pc.setLocalDescription(t,o,e._onError.bind(e));var n=function(){e.emit("signal",e._pc.localDescription||t)};e.trickle||e._iceComplete?n():e.once("_iceComplete",n)}},e._onError.bind(e),e.offerConstraints)},r.prototype._createAnswer=function(){var e=this;e.destroyed||e._pc.createAnswer(function(t){if(!e.destroyed){i(t),e._pc.setLocalDescription(t,o,e._onError.bind(e));var n=function(){e.emit("signal",e._pc.localDescription||t)};e.trickle||e._iceComplete?n():e.once("_iceComplete",n)}},e._onError.bind(e),e.answerConstraints)},r.prototype._onIceConnectionStateChange=function(){var e=this;if(!e.destroyed){var t=e._pc.iceGatheringState,n=e._pc.iceConnectionState;e.emit("iceConnectionStateChange",t,n),e._debug("iceConnectionStateChange %s %s",t,n),("connected"===n||"completed"===n)&&(e._pcReady=!0,e._maybeReady()),("disconnected"===n||"closed"===n)&&e._destroy()}},r.prototype._maybeReady=function(){var e=this;e._debug("maybeReady pc %s channel %s",e._pcReady,e._channelReady),!e.connected&&e._pcReady&&e._channelReady&&(e.connected=!0,e._buffer.forEach(function(t){e.send(t)}),e._buffer=[],e._debug("connect"),e.emit("connect"))},r.prototype._onSignalingStateChange=function(){var e=this;e.destroyed||(e.emit("signalingStateChange",e._pc.signalingState),e._debug("signalingStateChange %s",e._pc.signalingState))},r.prototype._onIceCandidate=function(e){var t=this;t.destroyed||(e.candidate&&t.trickle?t.emit("signal",{candidate:e.candidate}):e.candidate||(t._iceComplete=!0,t.emit("_iceComplete")))},r.prototype._onChannelMessage=function(e){var t=this;if(!t.destroyed){var n=e.data;if(t._debug("on channel message: length %d",n.byteLength||n.length),n instanceof ArrayBuffer)n=p(new Uint8Array(n)),t.push(n);else{try{n=JSON.parse(n)}catch(r){}t.emit("data",n)}}},r.prototype._onChannelOpen=function(){var e=this;e.destroyed||(e._debug("on channel open"),e._channelReady=!0,e._maybeReady())},r.prototype._onChannelClose=function(){var e=this;e.destroyed||(e._debug("on channel close"),e._destroy())},r.prototype._onAddStream=function(e){var t=this;t.destroyed||(t._debug("on add stream"),t.emit("stream",e.stream))},r.prototype._onError=function(e){var t=this;t.destroyed||(t._debug("error %s",e.message||e),t._destroy(e))},r.prototype._debug=function(){var e=this,t=[].slice.call(arguments),n=e.channelName&&e.channelName.substring(0,7);t[0]="["+n+"] "+t[0],a.apply(null,t)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{debug:22,dezalgo:25,hat:28,inherits:29,"is-typedarray":30,once:32,stream:20,"typedarray-to-buffer":33,"xtend/mutable":34}]},{},[])("/")});