You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

4 lines
85 KiB

(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.P2P=e()}})(function(){var e,t,r;return function n(e,t,r){function i(a,s){if(!t[a]){if(!e[a]){var f=typeof require=="function"&&require;if(!s&&f)return f(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=t[a]={exports:{}};e[a][0].call(u.exports,function(t){var r=e[a][1][t];return i(r?r:t)},u,u.exports,n,e,t,r)}return t[a].exports}var o=typeof require=="function"&&require;for(var a=0;a<r.length;a++)i(r[a]);return i}({1:[function(e,t,r){},{}],2:[function(e,t,r){var n=e("base64-js");var i=e("ieee754");var o=e("is-array");r.Buffer=f;r.SlowBuffer=c;r.INSPECT_MAX_BYTES=50;f.poolSize=8192;var a=1073741823;var s={};f.TYPED_ARRAY_SUPPORT=function(){try{var e=new ArrayBuffer(0);var t=new Uint8Array(e);t.foo=function(){return 42};return t.foo()===42&&typeof t.subarray==="function"&&new Uint8Array(1).subarray(1,1).byteLength===0}catch(r){return false}}();function f(e,t,r){if(!(this instanceof f))return new f(e,t,r);var n=typeof e;var i;if(n==="number"){i=+e}else if(n==="string"){i=f.byteLength(e,t)}else if(n==="object"&&e!==null){if(e.type==="Buffer"&&o(e.data))e=e.data;i=+e.length}else{throw new TypeError("must start with number, buffer, array or string")}if(i>a)throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+a.toString(16)+" bytes");if(i<0)i=0;else i>>>=0;var c=this;if(f.TYPED_ARRAY_SUPPORT){c=f._augment(new Uint8Array(i))}else{c.length=i;c._isBuffer=true}var u;if(f.TYPED_ARRAY_SUPPORT&&typeof e.byteLength==="number"){c._set(e)}else if(P(e)){if(f.isBuffer(e)){for(u=0;u<i;u++)c[u]=e.readUInt8(u)}else{for(u=0;u<i;u++)c[u]=(e[u]%256+256)%256}}else if(n==="string"){c.write(e,0,t)}else if(n==="number"&&!f.TYPED_ARRAY_SUPPORT&&!r){for(u=0;u<i;u++){c[u]=0}}if(i>0&&i<=f.poolSize)c.parent=s;return c}function c(e,t,r){if(!(this instanceof c))return new c(e,t,r);var n=new f(e,t,r);delete n.parent;return n}f.isBuffer=function(e){return!!(e!=null&&e._isBuffer)};f.compare=function(e,t){if(!f.isBuffer(e)||!f.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;var r=e.length;var n=t.length;for(var i=0,o=Math.min(r,n);i<o&&e[i]===t[i];i++){}if(i!==o){r=e[i];n=t[i]}if(r<n)return-1;if(n<r)return 1;return 0};f.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 true;default:return false}};f.concat=function(e,t){if(!o(e))throw new TypeError("Usage: Buffer.concat(list[, length])");if(e.length===0){return new f(0)}else if(e.length===1){return e[0]}var r;if(t===undefined){t=0;for(r=0;r<e.length;r++){t+=e[r].length}}var n=new f(t);var i=0;for(r=0;r<e.length;r++){var a=e[r];a.copy(n,i);i+=a.length}return n};f.byteLength=function(e,t){var r;e=e+"";switch(t||"utf8"){case"ascii":case"binary":case"raw":r=e.length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r=e.length*2;break;case"hex":r=e.length>>>1;break;case"utf8":case"utf-8":r=j(e).length;break;case"base64":r=O(e).length;break;default:r=e.length}return r};f.prototype.length=undefined;f.prototype.parent=undefined;f.prototype.toString=function(e,t,r){var n=false;t=t>>>0;r=r===undefined||r===Infinity?this.length:r>>>0;if(!e)e="utf8";if(t<0)t=0;if(r>this.length)r=this.length;if(r<=t)return"";while(true){switch(e){case"hex":return w(this,t,r);case"utf8":case"utf-8":return b(this,t,r);case"ascii":return y(this,t,r);case"binary":return m(this,t,r);case"base64":return v(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase();n=true}}};f.prototype.equals=function(e){if(!f.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(this===e)return true;return f.compare(this,e)===0};f.prototype.inspect=function(){var e="";var t=r.INSPECT_MAX_BYTES;if(this.length>0){e=this.toString("hex",0,t).match(/.{2}/g).join(" ");if(this.length>t)e+=" ... "}return"<Buffer "+e+">"};f.prototype.compare=function(e){if(!f.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(this===e)return 0;return f.compare(this,e)};f.prototype.get=function(e){console.log(".get() is deprecated. Access using array indexes instead.");return this.readUInt8(e)};f.prototype.set=function(e,t){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(e,t)};function u(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 Error("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))throw new Error("Invalid hex string");e[r+a]=s}return a}function l(e,t,r,n){var i=D(j(t,e.length-r),e,r,n);return i}function h(e,t,r,n){var i=D(U(t),e,r,n);return i}function d(e,t,r,n){return h(e,t,r,n)}function p(e,t,r,n){var i=D(O(t),e,r,n);return i}function g(e,t,r,n){var i=D(N(t,e.length-r),e,r,n);return i}f.prototype.write=function(e,t,r,n){if(isFinite(t)){if(!isFinite(r)){n=r;r=undefined}}else{var i=n;n=t;t=r;r=i}t=Number(t)||0;if(r<0||t<0||t>this.length)throw new RangeError("attempt to write outside buffer bounds");var o=this.length-t;if(!r){r=o}else{r=Number(r);if(r>o){r=o}}n=String(n||"utf8").toLowerCase();var a;switch(n){case"hex":a=u(this,e,t,r);break;case"utf8":case"utf-8":a=l(this,e,t,r);break;case"ascii":a=h(this,e,t,r);break;case"binary":a=d(this,e,t,r);break;case"base64":a=p(this,e,t,r);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":a=g(this,e,t,r);break;default:throw new TypeError("Unknown encoding: "+n)}return a};f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function v(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){var n="";var i="";r=Math.min(e.length,r);for(var o=t;o<r;o++){if(e[o]<=127){n+=Y(i)+String.fromCharCode(e[o]);i=""}else{i+="%"+e[o].toString(16)}}return n+Y(i)}function y(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 m(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 w(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+=x(e[o])}return i}function _(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){var r=this.length;e=~~e;t=t===undefined?r:~~t;if(e<0){e+=r;if(e<0)e=0}else if(e>r){e=r}if(t<0){t+=r;if(t<0)t=0}else if(t>r){t=r}if(t<e)t=e;var n;if(f.TYPED_ARRAY_SUPPORT){n=f._augment(this.subarray(e,t))}else{var i=t-e;n=new f(i,undefined,true);for(var o=0;o<i;o++){n[o]=this[o+e]}}if(n.length)n.parent=this.parent||this;return n};function E(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){e=e>>>0;t=t>>>0;if(!r)E(e,t,this.length);var n=this[e];var i=1;var o=0;while(++o<t&&(i*=256))n+=this[e+o]*i;return n};f.prototype.readUIntBE=function(e,t,r){e=e>>>0;t=t>>>0;if(!r)E(e,t,this.length);var n=this[e+--t];var i=1;while(t>0&&(i*=256))n+=this[e+--t]*i;return n};f.prototype.readUInt8=function(e,t){if(!t)E(e,1,this.length);return this[e]};f.prototype.readUInt16LE=function(e,t){if(!t)E(e,2,this.length);return this[e]|this[e+1]<<8};f.prototype.readUInt16BE=function(e,t){if(!t)E(e,2,this.length);return this[e]<<8|this[e+1]};f.prototype.readUInt32LE=function(e,t){if(!t)E(e,4,this.length);return(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};f.prototype.readUInt32BE=function(e,t){if(!t)E(e,4,this.length);return this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};f.prototype.readIntLE=function(e,t,r){e=e>>>0;t=t>>>0;if(!r)E(e,t,this.length);var n=this[e];var i=1;var o=0;while(++o<t&&(i*=256))n+=this[e+o]*i;i*=128;if(n>=i)n-=Math.pow(2,8*t);return n};f.prototype.readIntBE=function(e,t,r){e=e>>>0;t=t>>>0;if(!r)E(e,t,this.length);var n=t;var i=1;var o=this[e+--n];while(n>0&&(i*=256))o+=this[e+--n]*i;i*=128;if(o>=i)o-=Math.pow(2,8*t);return o};f.prototype.readInt8=function(e,t){if(!t)E(e,1,this.length);if(!(this[e]&128))return this[e];return(255-this[e]+1)*-1};f.prototype.readInt16LE=function(e,t){if(!t)E(e,2,this.length);var r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r};f.prototype.readInt16BE=function(e,t){if(!t)E(e,2,this.length);var r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r};f.prototype.readInt32LE=function(e,t){if(!t)E(e,4,this.length);return this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};f.prototype.readInt32BE=function(e,t){if(!t)E(e,4,this.length);return this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};f.prototype.readFloatLE=function(e,t){if(!t)E(e,4,this.length);return i.read(this,e,true,23,4)};f.prototype.readFloatBE=function(e,t){if(!t)E(e,4,this.length);return i.read(this,e,false,23,4)};f.prototype.readDoubleLE=function(e,t){if(!t)E(e,8,this.length);return i.read(this,e,true,52,8)};f.prototype.readDoubleBE=function(e,t){if(!t)E(e,8,this.length);return i.read(this,e,false,52,8)};function A(e,t,r,n,i,o){if(!f.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(t>i||t<o)throw new RangeError("value is out of bounds");if(r+n>e.length)throw new RangeError("index out of range")}f.prototype.writeUIntLE=function(e,t,r,n){e=+e;t=t>>>0;r=r>>>0;if(!n)A(this,e,t,r,Math.pow(2,8*r),0);var i=1;var o=0;this[t]=e&255;while(++o<r&&(i*=256))this[t+o]=e/i>>>0&255;return t+r};f.prototype.writeUIntBE=function(e,t,r,n){e=+e;t=t>>>0;r=r>>>0;if(!n)A(this,e,t,r,Math.pow(2,8*r),0);var i=r-1;var o=1;this[t+i]=e&255;while(--i>=0&&(o*=256))this[t+i]=e/o>>>0&255;return t+r};f.prototype.writeUInt8=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,1,255,0);if(!f.TYPED_ARRAY_SUPPORT)e=Math.floor(e);this[t]=e;return t+1};function C(e,t,r,n){if(t<0)t=65535+t+1;for(var i=0,o=Math.min(e.length-r,2);i<o;i++){e[r+i]=(t&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}}f.prototype.writeUInt16LE=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,2,65535,0);if(f.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8}else C(this,e,t,true);return t+2};f.prototype.writeUInt16BE=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,2,65535,0);if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>8;this[t+1]=e}else C(this,e,t,false);return t+2};function k(e,t,r,n){if(t<0)t=4294967295+t+1;for(var i=0,o=Math.min(e.length-r,4);i<o;i++){e[r+i]=t>>>(n?i:3-i)*8&255}}f.prototype.writeUInt32LE=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,4,4294967295,0);if(f.TYPED_ARRAY_SUPPORT){this[t+3]=e>>>24;this[t+2]=e>>>16;this[t+1]=e>>>8;this[t]=e}else k(this,e,t,true);return t+4};f.prototype.writeUInt32BE=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,4,4294967295,0);if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>24;this[t+1]=e>>>16;this[t+2]=e>>>8;this[t+3]=e}else k(this,e,t,false);return t+4};f.prototype.writeIntLE=function(e,t,r,n){e=+e;t=t>>>0;if(!n){A(this,e,t,r,Math.pow(2,8*r-1)-1,-Math.pow(2,8*r-1))}var i=0;var o=1;var a=e<0?1:0;this[t]=e&255;while(++i<r&&(o*=256))this[t+i]=(e/o>>0)-a&255;return t+r};f.prototype.writeIntBE=function(e,t,r,n){e=+e;t=t>>>0;if(!n){A(this,e,t,r,Math.pow(2,8*r-1)-1,-Math.pow(2,8*r-1))}var i=r-1;var o=1;var a=e<0?1:0;this[t+i]=e&255;while(--i>=0&&(o*=256))this[t+i]=(e/o>>0)-a&255;return t+r};f.prototype.writeInt8=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,1,127,-128);if(!f.TYPED_ARRAY_SUPPORT)e=Math.floor(e);if(e<0)e=255+e+1;this[t]=e;return t+1};f.prototype.writeInt16LE=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,2,32767,-32768);if(f.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8}else C(this,e,t,true);return t+2};f.prototype.writeInt16BE=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,2,32767,-32768);if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>8;this[t+1]=e}else C(this,e,t,false);return t+2};f.prototype.writeInt32LE=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,4,2147483647,-2147483648);if(f.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8;this[t+2]=e>>>16;this[t+3]=e>>>24}else k(this,e,t,true);return t+4};f.prototype.writeInt32BE=function(e,t,r){e=+e;t=t>>>0;if(!r)A(this,e,t,4,2147483647,-2147483648);if(e<0)e=4294967295+e+1;if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>24;this[t+1]=e>>>16;this[t+2]=e>>>8;this[t+3]=e}else k(this,e,t,false);return t+4};function S(e,t,r,n,i,o){if(t>i||t<o)throw new RangeError("value is out of bounds");if(r+n>e.length)throw new RangeError("index out of range");if(r<0)throw new RangeError("index out of range")}function R(e,t,r,n,o){if(!o)S(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){return R(this,e,t,true,r)};f.prototype.writeFloatBE=function(e,t,r){return R(this,e,t,false,r)};function T(e,t,r,n,o){if(!o)S(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){return T(this,e,t,true,r)};f.prototype.writeDoubleBE=function(e,t,r){return T(this,e,t,false,r)};f.prototype.copy=function(e,t,r,n){var i=this;if(!r)r=0;if(!n&&n!==0)n=this.length;if(t>=e.length)t=e.length;if(!t)t=0;if(n>0&&n<r)n=r;if(n===r)return 0;if(e.length===0||i.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=i.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");if(n>this.length)n=this.length;if(e.length-t<n-r)n=e.length-t+r;var o=n-r;if(o<1e3||!f.TYPED_ARRAY_SUPPORT){for(var a=0;a<o;a++){e[a+t]=this[a+r]}}else{e._set(this.subarray(r,r+o),t)}return o};f.prototype.fill=function(e,t,r){if(!e)e=0;if(!t)t=0;if(!r)r=this.length;if(r<t)throw new RangeError("end < start");if(r===t)return;if(this.length===0)return;if(t<0||t>=this.length)throw new RangeError("start out of bounds");if(r<0||r>this.length)throw new RangeError("end out of bounds");var n;if(typeof e==="number"){for(n=t;n<r;n++){this[n]=e}}else{var i=j(e.toString());var o=i.length;for(n=t;n<r;n++){this[n]=i[n%o]}}return this};f.prototype.toArrayBuffer=function(){if(typeof Uint8Array!=="undefined"){if(f.TYPED_ARRAY_SUPPORT){return new f(this).buffer}else{var e=new Uint8Array(this.length);for(var t=0,r=e.length;t<r;t+=1){e[t]=this[t]}return e.buffer}}else{throw new TypeError("Buffer.toArrayBuffer not supported in this browser")}};var I=f.prototype;f._augment=function(e){e.constructor=f;e._isBuffer=true;e._get=e.get;e._set=e.set;e.get=I.get;e.set=I.set;e.write=I.write;e.toString=I.toString;e.toLocaleString=I.toString;e.toJSON=I.toJSON;e.equals=I.equals;e.compare=I.compare;e.copy=I.copy;e.slice=I.slice;e.readUIntLE=I.readUIntLE;e.readUIntBE=I.readUIntBE;e.readUInt8=I.readUInt8;e.readUInt16LE=I.readUInt16LE;e.readUInt16BE=I.readUInt16BE;e.readUInt32LE=I.readUInt32LE;e.readUInt32BE=I.readUInt32BE;e.readIntLE=I.readIntLE;e.readIntBE=I.readIntBE;e.readInt8=I.readInt8;e.readInt16LE=I.readInt16LE;e.readInt16BE=I.readInt16BE;e.readInt32LE=I.readInt32LE;e.readInt32BE=I.readInt32BE;e.readFloatLE=I.readFloatLE;e.readFloatBE=I.readFloatBE;e.readDoubleLE=I.readDoubleLE;e.readDoubleBE=I.readDoubleBE;e.writeUInt8=I.writeUInt8;e.writeUIntLE=I.writeUIntLE;e.writeUIntBE=I.writeUIntBE;e.writeUInt16LE=I.writeUInt16LE;e.writeUInt16BE=I.writeUInt16BE;e.writeUInt32LE=I.writeUInt32LE;e.writeUInt32BE=I.writeUInt32BE;e.writeIntLE=I.writeIntLE;e.writeIntBE=I.writeIntBE;e.writeInt8=I.writeInt8;e.writeInt16LE=I.writeInt16LE;e.writeInt16BE=I.writeInt16BE;e.writeInt32LE=I.writeInt32LE;e.writeInt32BE=I.writeInt32BE;e.writeFloatLE=I.writeFloatLE;e.writeFloatBE=I.writeFloatBE;e.writeDoubleLE=I.writeDoubleLE;e.writeDoubleBE=I.writeDoubleBE;e.fill=I.fill;e.inspect=I.inspect;e.toArrayBuffer=I.toArrayBuffer;return e};var L=/[^+\/0-9A-z\-]/g;function B(e){e=M(e).replace(L,"");if(e.length<2)return"";while(e.length%4!==0){e=e+"="}return e}function M(e){if(e.trim)return e.trim();return e.replace(/^\s+|\s+$/g,"")}function P(e){return o(e)||f.isBuffer(e)||e&&typeof e==="object"&&typeof e.length==="number"}function x(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=[];var a=0;for(;a<n;a++){r=e.charCodeAt(a);if(r>55295&&r<57344){if(i){if(r<56320){if((t-=3)>-1)o.push(239,191,189);i=r;continue}else{r=i-55296<<10|r-56320|65536;i=null}}else{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}else{i=r;continue}}}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<2097152){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 U(e){var t=[];for(var r=0;r<e.length;r++){t.push(e.charCodeAt(r)&255)}return t}function N(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 O(e){return n.toByteArray(B(e))}function D(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 Y(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}},{"base64-js":3,ieee754:4,"is-array":5}],3:[function(e,t,r){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(e){"use strict";var t=typeof Uint8Array!=="undefined"?Uint8Array:Array;var r="+".charCodeAt(0);var i="/".charCodeAt(0);var o="0".charCodeAt(0);var a="a".charCodeAt(0);var s="A".charCodeAt(0);var f="-".charCodeAt(0);var c="_".charCodeAt(0);function u(e){var t=e.charCodeAt(0);if(t===r||t===f)return 62;if(t===i||t===c)return 63;if(t<o)return-1;if(t<o+10)return t-o+26+26;if(t<s+26)return t-s;if(t<a+26)return t-a+26}function l(e){var r,n,i,o,a,s;if(e.length%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var f=e.length;a="="===e.charAt(f-2)?2:"="===e.charAt(f-1)?1:0;s=new t(e.length*3/4-a);i=a>0?e.length-4:e.length;var c=0;function l(e){s[c++]=e}for(r=0,n=0;r<i;r+=4,n+=3){o=u(e.charAt(r))<<18|u(e.charAt(r+1))<<12|u(e.charAt(r+2))<<6|u(e.charAt(r+3));l((o&16711680)>>16);l((o&65280)>>8);l(o&255)}if(a===2){o=u(e.charAt(r))<<2|u(e.charAt(r+1))>>4;l(o&255)}else if(a===1){o=u(e.charAt(r))<<10|u(e.charAt(r+1))<<4|u(e.charAt(r+2))>>2;l(o>>8&255);l(o&255)}return s}function h(e){var t,r=e.length%3,i="",o,a;function s(e){return n.charAt(e)}function f(e){return s(e>>18&63)+s(e>>12&63)+s(e>>6&63)+s(e&63)}for(t=0,a=e.length-r;t<a;t+=3){o=(e[t]<<16)+(e[t+1]<<8)+e[t+2];i+=f(o)}switch(r){case 1:o=e[e.length-1];i+=s(o>>2);i+=s(o<<4&63);i+="==";break;case 2:o=(e[e.length-2]<<8)+e[e.length-1];i+=s(o>>10);i+=s(o>>4&63);i+=s(o<<2&63);i+="=";break}return i}e.toByteArray=l;e.fromByteArray=h})(typeof r==="undefined"?this.base64js={}:r)},{}],4:[function(e,t,r){r.read=function(e,t,r,n,i){var o,a,s=i*8-n-1,f=(1<<s)-1,c=f>>1,u=-7,l=r?i-1:0,h=r?-1:1,d=e[t+l];l+=h;o=d&(1<<-u)-1;d>>=-u;u+=s;for(;u>0;o=o*256+e[t+l],l+=h,u-=8);a=o&(1<<-u)-1;o>>=-u;u+=n;for(;u>0;a=a*256+e[t+l],l+=h,u-=8);if(o===0){o=1-c}else if(o===f){return a?NaN:(d?-1:1)*Infinity}else{a=a+Math.pow(2,n);o=o-c}return(d?-1:1)*a*Math.pow(2,o-n)};r.write=function(e,t,r,n,i,o){var a,s,f,c=o*8-i-1,u=(1<<c)-1,l=u>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,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=u}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>=u){s=0;a=u}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;c+=i;for(;c>0;e[r+d]=a&255,d+=p,a/=256,c-=8);e[r+d-p]|=g*128}},{}],5:[function(e,t,r){var n=Array.isArray;var i=Object.prototype.toString;t.exports=n||function(e){return!!e&&"[object Array]"==i.call(e)}},{}],6:[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,c;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}throw TypeError('Uncaught, unspecified "error" event.')}}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:n=arguments.length;o=new Array(n-1);for(f=1;f<n;f++)o[f-1]=arguments[f];r.apply(this,o)}}else if(a(r)){n=arguments.length;o=new Array(n-1);for(f=1;f<n;f++)o[f-1]=arguments[f];c=r.slice();n=c.length;for(f=0;f<n;f++)c[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){var r;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{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.listenerCount=function(e,t){var r;if(!e._events||!e._events[t])r=0;else if(i(e._events[t]))r=1;else r=e._events[t].length;return r};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}},{}],7:[function(e,t,r){if(typeof Object.create==="function"){t.exports=function n(e,t){e.super_=t;e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}})}}else{t.exports=function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype;e.prototype=new r;e.prototype.constructor=e}}},{}],8:[function(e,t,r){t.exports=Array.isArray||function(e){return Object.prototype.toString.call(e)=="[object Array]"}},{}],9:[function(e,t,r){var n=t.exports={};var i=[];var o=false;function a(){if(o){return}o=true;var e;var t=i.length;while(t){e=i;i=[];var r=-1;while(++r<t){e[r]()}t=i.length}o=false}n.nextTick=function(e){i.push(e);if(!o){setTimeout(a,0)}};n.title="browser";n.browser=true;n.env={};n.argv=[];n.version="";n.versions={};function s(){}n.on=s;n.addListener=s;n.once=s;n.off=s;n.removeListener=s;n.removeAllListeners=s;n.emit=s;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}},{}],10:[function(e,t,r){t.exports=e("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":11}],11:[function(e,t,r){(function(r){t.exports=s;var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};var i=e("core-util-is");i.inherits=e("inherits");var o=e("./_stream_readable");var a=e("./_stream_writable");i.inherits(s,o);c(n(a.prototype),function(e){if(!s.prototype[e])s.prototype[e]=a.prototype[e]});function s(e){if(!(this instanceof s))return new s(e);o.call(this,e);a.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",f)}function f(){if(this.allowHalfOpen||this._writableState.ended)return;r.nextTick(this.end.bind(this))}function c(e,t){for(var r=0,n=e.length;r<n;r++){t(e[r],r)}}}).call(this,e("_process"))},{"./_stream_readable":13,"./_stream_writable":15,_process:9,"core-util-is":16,inherits:7}],12:[function(e,t,r){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":14,"core-util-is":16,inherits:7}],13:[function(e,t,r){(function(r){t.exports=l;var n=e("isarray");var i=e("buffer").Buffer;l.ReadableState=u;var o=e("events").EventEmitter;if(!o.listenerCount)o.listenerCount=function(e,t){return e.listeners(t).length};var a=e("stream");var s=e("core-util-is");s.inherits=e("inherits");var f;var c=e("util");if(c&&c.debuglog){c=c.debuglog("stream")}else{c=function(){}}s.inherits(l,a);function u(t,r){var n=e("./_stream_duplex");t=t||{};var i=t.highWaterMark;var o=t.objectMode?16:16*1024;this.highWaterMark=i||i===0?i:o;this.highWaterMark=~~this.highWaterMark;this.buffer=[];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.objectMode=!!t.objectMode;if(r instanceof n)this.objectMode=this.objectMode||!!t.readableObjectMode;this.defaultEncoding=t.defaultEncoding||"utf8";this.ranOut=false;this.awaitDrain=0;this.readingMore=false;this.decoder=null;this.encoding=null;if(t.encoding){if(!f)f=e("string_decoder/").StringDecoder;this.decoder=new f(t.encoding);this.encoding=t.encoding}}function l(t){var r=e("./_stream_duplex");if(!(this instanceof l))return new l(t);this._readableState=new u(t,this);this.readable=true;a.call(this)}l.prototype.push=function(e,t){var r=this._readableState;if(s.isString(e)&&!r.objectMode){t=t||r.defaultEncoding;if(t!==r.encoding){e=new i(e,t);t=""}}return h(this,r,e,t,false)};l.prototype.unshift=function(e){var t=this._readableState;return h(this,t,e,"",true)};function h(e,t,r,n,i){var o=b(t,r);if(o){e.emit("error",o)}else if(s.isNullOrUndefined(r)){t.reading=false;if(!t.ended)y(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 a=new Error("stream.unshift() after end event");e.emit("error",a)}else{if(t.decoder&&!i&&!n)r=t.decoder.write(r);if(!i)t.reading=false;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)m(e)}_(e,t)}}else if(!i){t.reading=false}return d(t)}function d(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}l.prototype.setEncoding=function(t){if(!f)f=e("string_decoder/").StringDecoder;this._readableState.decoder=new f(t);this._readableState.encoding=t;return this};var p=8388608;function g(e){if(e>=p){e=p}else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}function v(e,t){if(t.length===0&&t.ended)return 0;if(t.objectMode)return e===0?0:1;if(isNaN(e)||s.isNull(e)){if(t.flowing&&t.buffer.length)return t.buffer[0].length;else return t.length}if(e<=0)return 0;if(e>t.highWaterMark)t.highWaterMark=g(e);if(e>t.length){if(!t.ended){t.needReadable=true;return 0}else return t.length}return e}l.prototype.read=function(e){c("read",e);var t=this._readableState;var r=e;if(!s.isNumber(e)||e>0)t.emittedReadable=false;if(e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended)){c("read: emitReadable",t.length,t.ended);if(t.length===0&&t.ended)T(this);else m(this);return null}e=v(e,t);if(e===0&&t.ended){if(t.length===0)T(this);return null}var n=t.needReadable;c("need readable",n);if(t.length===0||t.length-e<t.highWaterMark){n=true;c("length less than watermark",n)}if(t.ended||t.reading){n=false;c("reading or ended",n)}if(n){c("do read");t.reading=true;t.sync=true;if(t.length===0)t.needReadable=true;this._read(t.highWaterMark);t.sync=false}if(n&&!t.reading)e=v(r,t);var i;if(e>0)i=R(e,t);else i=null;if(s.isNull(i)){t.needReadable=true;e=0}t.length-=e;if(t.length===0&&!t.ended)t.needReadable=true;if(r!==e&&t.ended&&t.length===0)T(this);if(!s.isNull(i))this.emit("data",i);return i};function b(e,t){var r=null;if(!s.isBuffer(t)&&!s.isString(t)&&!s.isNullOrUndefined(t)&&!e.objectMode){r=new TypeError("Invalid non-string/buffer chunk")}return r}function y(e,t){if(t.decoder&&!t.ended){var r=t.decoder.end();if(r&&r.length){t.buffer.push(r);t.length+=t.objectMode?1:r.length}}t.ended=true;m(e)}function m(e){var t=e._readableState;t.needReadable=false;if(!t.emittedReadable){c("emitReadable",t.flowing);t.emittedReadable=true;if(t.sync)r.nextTick(function(){w(e)});else w(e)}}function w(e){c("emit readable");e.emit("readable");S(e)}function _(e,t){if(!t.readingMore){t.readingMore=true;r.nextTick(function(){E(e,t)})}}function E(e,t){var r=t.length;while(!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark){c("maybeReadMore read 0");e.read(0);if(r===t.length)break;else r=t.length}t.readingMore=false}l.prototype._read=function(e){this.emit("error",new Error("not implemented"))};l.prototype.pipe=function(e,t){var i=this;var a=this._readableState;switch(a.pipesCount){case 0:a.pipes=e;break;case 1:a.pipes=[a.pipes,e];break;default:a.pipes.push(e);break}a.pipesCount+=1;c("pipe count=%d opts=%j",a.pipesCount,t);var s=(!t||t.end!==false)&&e!==r.stdout&&e!==r.stderr;var f=s?l:d;if(a.endEmitted)r.nextTick(f);else i.once("end",f);e.on("unpipe",u);function u(e){c("onunpipe");if(e===i){d()}}function l(){c("onend");e.end()}var h=A(i);e.on("drain",h);function d(){c("cleanup");e.removeListener("close",v);e.removeListener("finish",b);e.removeListener("drain",h);e.removeListener("error",g);e.removeListener("unpipe",u);i.removeListener("end",l);i.removeListener("end",d);i.removeListener("data",p);if(a.awaitDrain&&(!e._writableState||e._writableState.needDrain))h()}i.on("data",p);function p(t){c("ondata");var r=e.write(t);if(false===r){c("false write response, pause",i._readableState.awaitDrain);i._readableState.awaitDrain++;i.pause()}}function g(t){
c("onerror",t);y();e.removeListener("error",g);if(o.listenerCount(e,"error")===0)e.emit("error",t)}if(!e._events||!e._events.error)e.on("error",g);else if(n(e._events.error))e._events.error.unshift(g);else e._events.error=[g,e._events.error];function v(){e.removeListener("finish",b);y()}e.once("close",v);function b(){c("onfinish");e.removeListener("close",v);y()}e.once("finish",b);function y(){c("unpipe");i.unpipe(e)}e.emit("pipe",i);if(!a.flowing){c("pipe resume");i.resume()}return e};function A(e){return function(){var t=e._readableState;c("pipeOnDrain",t.awaitDrain);if(t.awaitDrain)t.awaitDrain--;if(t.awaitDrain===0&&o.listenerCount(e,"data")){t.flowing=true;S(e)}}}l.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 i=L(t.pipes,e);if(i===-1)return this;t.pipes.splice(i,1);t.pipesCount-=1;if(t.pipesCount===1)t.pipes=t.pipes[0];e.emit("unpipe",this);return this};l.prototype.on=function(e,t){var n=a.prototype.on.call(this,e,t);if(e==="data"&&false!==this._readableState.flowing){this.resume()}if(e==="readable"&&this.readable){var i=this._readableState;if(!i.readableListening){i.readableListening=true;i.emittedReadable=false;i.needReadable=true;if(!i.reading){var o=this;r.nextTick(function(){c("readable nexttick read 0");o.read(0)})}else if(i.length){m(this,i)}}}return n};l.prototype.addListener=l.prototype.on;l.prototype.resume=function(){var e=this._readableState;if(!e.flowing){c("resume");e.flowing=true;if(!e.reading){c("resume read 0");this.read(0)}C(this,e)}return this};function C(e,t){if(!t.resumeScheduled){t.resumeScheduled=true;r.nextTick(function(){k(e,t)})}}function k(e,t){t.resumeScheduled=false;e.emit("resume");S(e);if(t.flowing&&!t.reading)e.read(0)}l.prototype.pause=function(){c("call pause flowing=%j",this._readableState.flowing);if(false!==this._readableState.flowing){c("pause");this._readableState.flowing=false;this.emit("pause")}return this};function S(e){var t=e._readableState;c("flow",t.flowing);if(t.flowing){do{var r=e.read()}while(null!==r&&t.flowing)}}l.prototype.wrap=function(e){var t=this._readableState;var r=false;var n=this;e.on("end",function(){c("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){c("wrapped data");if(t.decoder)i=t.decoder.write(i);if(!i||!t.objectMode&&!i.length)return;var o=n.push(i);if(!o){r=true;e.pause()}});for(var i in e){if(s.isFunction(e[i])&&s.isUndefined(this[i])){this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i)}}var o=["error","close","destroy","pause","resume"];I(o,function(t){e.on(t,n.emit.bind(n,t))});n._read=function(t){c("wrapped _read",t);if(r){r=false;e.resume()}};return n};l._fromList=R;function R(e,t){var r=t.buffer;var n=t.length;var o=!!t.decoder;var a=!!t.objectMode;var s;if(r.length===0)return null;if(n===0)s=null;else if(a)s=r.shift();else if(!e||e>=n){if(o)s=r.join("");else s=i.concat(r,n);r.length=0}else{if(e<r[0].length){var f=r[0];s=f.slice(0,e);r[0]=f.slice(e)}else if(e===r[0].length){s=r.shift()}else{if(o)s="";else s=new i(e);var c=0;for(var u=0,l=r.length;u<l&&c<e;u++){var f=r[0];var h=Math.min(e-c,f.length);if(o)s+=f.slice(0,h);else f.copy(s,c,0,h);if(h<f.length)r[0]=f.slice(h);else r.shift();c+=h}}}return s}function T(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");if(!t.endEmitted){t.ended=true;r.nextTick(function(){if(!t.endEmitted&&t.length===0){t.endEmitted=true;e.readable=false;e.emit("end")}})}}function I(e,t){for(var r=0,n=e.length;r<n;r++){t(e[r],r)}}function L(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":11,_process:9,buffer:2,"core-util-is":16,events:6,inherits:7,isarray:8,stream:21,"string_decoder/":22,util:1}],14:[function(e,t,r){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,t){this.afterTransform=function(e,r){return a(t,e,r)};this.needTransform=false;this.transforming=false;this.writecb=null;this.writechunk=null}function a(e,t,r){var n=e._transformState;n.transforming=false;var o=n.writecb;if(!o)return e.emit("error",new Error("no writecb in Transform class"));n.writechunk=null;n.writecb=null;if(!i.isNullOrUndefined(r))e.push(r);if(o)o(t);var a=e._readableState;a.reading=false;if(a.needReadable||a.length<a.highWaterMark){e._read(a.highWaterMark)}}function s(e){if(!(this instanceof s))return new s(e);n.call(this,e);this._transformState=new o(e,this);var t=this;this._readableState.needReadable=true;this._readableState.sync=false;this.once("prefinish",function(){if(i.isFunction(this._flush))this._flush(function(e){f(t,e)});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("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(!i.isNull(t.writechunk)&&t.writecb&&!t.transforming){t.transforming=true;this._transform(t.writechunk,t.writeencoding,t.afterTransform)}else{t.needTransform=true}};function f(e,t){if(t)return e.emit("error",t);var r=e._writableState;var n=e._transformState;if(r.length)throw new Error("calling transform done when ws.length != 0");if(n.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}},{"./_stream_duplex":11,"core-util-is":16,inherits:7}],15:[function(e,t,r){(function(r){t.exports=f;var n=e("buffer").Buffer;f.WritableState=s;var i=e("core-util-is");i.inherits=e("inherits");var o=e("stream");i.inherits(f,o);function a(e,t,r){this.chunk=e;this.encoding=t;this.callback=r}function s(t,r){var n=e("./_stream_duplex");t=t||{};var i=t.highWaterMark;var o=t.objectMode?16:16*1024;this.highWaterMark=i||i===0?i:o;this.objectMode=!!t.objectMode;if(r instanceof n)this.objectMode=this.objectMode||!!t.writableObjectMode;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){v(r,e)};this.writecb=null;this.writelen=0;this.buffer=[];this.pendingcb=0;this.prefinished=false;this.errorEmitted=false}function f(t){var r=e("./_stream_duplex");if(!(this instanceof f)&&!(this instanceof r))return new f(t);this._writableState=new s(t,this);this.writable=true;o.call(this)}f.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))};function c(e,t,n){var i=new Error("write after end");e.emit("error",i);r.nextTick(function(){n(i)})}function u(e,t,n,o){var a=true;if(!i.isBuffer(n)&&!i.isString(n)&&!i.isNullOrUndefined(n)&&!t.objectMode){var s=new TypeError("Invalid non-string/buffer chunk");e.emit("error",s);r.nextTick(function(){o(s)});a=false}return a}f.prototype.write=function(e,t,r){var n=this._writableState;var o=false;if(i.isFunction(t)){r=t;t=null}if(i.isBuffer(e))t="buffer";else if(!t)t=n.defaultEncoding;if(!i.isFunction(r))r=function(){};if(n.ended)c(this,n,r);else if(u(this,n,e,r)){n.pendingcb++;o=h(this,n,e,t,r)}return o};f.prototype.cork=function(){var e=this._writableState;e.corked++};f.prototype.uncork=function(){var e=this._writableState;if(e.corked){e.corked--;if(!e.writing&&!e.corked&&!e.finished&&!e.bufferProcessing&&e.buffer.length)m(this,e)}};function l(e,t,r){if(!e.objectMode&&e.decodeStrings!==false&&i.isString(t)){t=new n(t,r)}return t}function h(e,t,r,n,o){r=l(t,r,n);if(i.isBuffer(r))n="buffer";var s=t.objectMode?1:r.length;t.length+=s;var f=t.length<t.highWaterMark;if(!f)t.needDrain=true;if(t.writing||t.corked)t.buffer.push(new a(r,n,o));else d(e,t,false,s,r,n,o);return f}function d(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 p(e,t,n,i,o){if(n)r.nextTick(function(){t.pendingcb--;o(i)});else{t.pendingcb--;o(i)}e._writableState.errorEmitted=true;e.emit("error",i)}function g(e){e.writing=false;e.writecb=null;e.length-=e.writelen;e.writelen=0}function v(e,t){var n=e._writableState;var i=n.sync;var o=n.writecb;g(n);if(t)p(e,n,i,t,o);else{var a=w(e,n);if(!a&&!n.corked&&!n.bufferProcessing&&n.buffer.length){m(e,n)}if(i){r.nextTick(function(){b(e,n,a,o)})}else{b(e,n,a,o)}}}function b(e,t,r,n){if(!r)y(e,t);t.pendingcb--;n();E(e,t)}function y(e,t){if(t.length===0&&t.needDrain){t.needDrain=false;e.emit("drain")}}function m(e,t){t.bufferProcessing=true;if(e._writev&&t.buffer.length>1){var r=[];for(var n=0;n<t.buffer.length;n++)r.push(t.buffer[n].callback);t.pendingcb++;d(e,t,true,t.length,t.buffer,"",function(e){for(var n=0;n<r.length;n++){t.pendingcb--;r[n](e)}});t.buffer=[]}else{for(var n=0;n<t.buffer.length;n++){var i=t.buffer[n];var o=i.chunk;var a=i.encoding;var s=i.callback;var f=t.objectMode?1:o.length;d(e,t,false,f,o,a,s);if(t.writing){n++;break}}if(n<t.buffer.length)t.buffer=t.buffer.slice(n);else t.buffer.length=0}t.bufferProcessing=false}f.prototype._write=function(e,t,r){r(new Error("not implemented"))};f.prototype._writev=null;f.prototype.end=function(e,t,r){var n=this._writableState;if(i.isFunction(e)){r=e;e=null;t=null}else if(i.isFunction(t)){r=t;t=null}if(!i.isNullOrUndefined(e))this.write(e,t);if(n.corked){n.corked=1;this.uncork()}if(!n.ending&&!n.finished)A(this,n,r)};function w(e,t){return t.ending&&t.length===0&&!t.finished&&!t.writing}function _(e,t){if(!t.prefinished){t.prefinished=true;e.emit("prefinish")}}function E(e,t){var r=w(e,t);if(r){if(t.pendingcb===0){_(e,t);t.finished=true;e.emit("finish")}else _(e,t)}return r}function A(e,t,n){t.ending=true;E(e,t);if(n){if(t.finished)r.nextTick(n);else e.once("finish",n)}t.ended=true}}).call(this,e("_process"))},{"./_stream_duplex":11,_process:9,buffer:2,"core-util-is":16,inherits:7,stream:21}],16:[function(e,t,r){(function(e){function t(e){return Array.isArray(e)}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 c(e){return e===void 0}r.isUndefined=c;function u(e){return l(e)&&b(e)==="[object RegExp]"}r.isRegExp=u;function l(e){return typeof e==="object"&&e!==null}r.isObject=l;function h(e){return l(e)&&b(e)==="[object Date]"}r.isDate=h;function d(e){return l(e)&&(b(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;function v(t){return e.isBuffer(t)}r.isBuffer=v;function b(e){return Object.prototype.toString.call(e)}}).call(this,e("buffer").Buffer)},{buffer:2}],17:[function(e,t,r){t.exports=e("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":12}],18:[function(e,t,r){r=t.exports=e("./lib/_stream_readable.js");r.Stream=e("stream");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")},{"./lib/_stream_duplex.js":11,"./lib/_stream_passthrough.js":12,"./lib/_stream_readable.js":13,"./lib/_stream_transform.js":14,"./lib/_stream_writable.js":15,stream:21}],19:[function(e,t,r){t.exports=e("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":14}],20:[function(e,t,r){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":15}],21:[function(e,t,r){t.exports=o;var n=e("events").EventEmitter;var i=e("inherits");i(o,n);o.Readable=e("readable-stream/readable.js");o.Writable=e("readable-stream/writable.js");o.Duplex=e("readable-stream/duplex.js");o.Transform=e("readable-stream/transform.js");o.PassThrough=e("readable-stream/passthrough.js");o.Stream=o;function o(){n.call(this)}o.prototype.pipe=function(e,t){var r=this;function i(t){if(e.writable){if(false===e.write(t)&&r.pause){r.pause()}}}r.on("data",i);function o(){if(r.readable&&r.resume){r.resume()}}e.on("drain",o);if(!e._isStdio&&(!t||t.end!==false)){r.on("end",s);r.on("close",f)}var a=false;function s(){if(a)return;a=true;e.end()}function f(){if(a)return;a=true;if(typeof e.destroy==="function")e.destroy()}function c(e){u();if(n.listenerCount(this,"error")===0){throw e}}r.on("error",c);e.on("error",c);function u(){r.removeListener("data",i);e.removeListener("drain",o);r.removeListener("end",s);r.removeListener("close",f);r.removeListener("error",c);e.removeListener("error",c);r.removeListener("end",u);r.removeListener("close",u);e.removeListener("close",u)}r.on("end",u);r.on("close",u);e.on("close",u);e.emit("pipe",r);return e}},{events:6,inherits:7,"readable-stream/duplex.js":10,"readable-stream/passthrough.js":17,"readable-stream/readable.js":18,"readable-stream/transform.js":19,"readable-stream/writable.js":20}],22:[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=c;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 c(e){this.charReceived=e.length%3;this.charLength=this.charReceived?3:0}},{buffer:2}],23:[function(e,t,r){var n=[].slice;t.exports=function(e,t){if("string"==typeof t)t=e[t];if("function"!=typeof t)throw new Error("bind() requires a function");var r=n.call(arguments,2);return function(){return t.apply(e,r.concat(n.call(arguments)))}}},{}],24:[function(e,t,r){t.exports=n;function n(e){if(e)return i(e)}function i(e){for(var t in n.prototype){e[t]=n.prototype[t]}return e}n.prototype.on=n.prototype.addEventListener=function(e,t){this._callbacks=this._callbacks||{};(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t);return this};n.prototype.once=function(e,t){function r(){this.off(e,r);t.apply(this,arguments)}r.fn=t;this.on(e,r);return this};n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length){delete this._callbacks["$"+e];return this}var n;for(var i=0;i<r.length;i++){n=r[i];if(n===t||n.fn===t){r.splice(i,1);break}}return this};n.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),r=this._callbacks["$"+e];if(r){r=r.slice(0);for(var n=0,i=r.length;n<i;++n){r[n].apply(this,t)}}return this};n.prototype.listeners=function(e){this._callbacks=this._callbacks||{};return this._callbacks["$"+e]||[]};n.prototype.hasListeners=function(e){return!!this.listeners(e).length}},{}],25:[function(e,t,r){r=t.exports=e("./debug");r.log=o;r.formatArgs=i;r.save=a;r.load=s;r.useColors=n;r.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:f();r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"];function n(){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}r.formatters.j=function(e){return JSON.stringify(e)};function i(){var e=arguments;var t=this.useColors;e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+r.humanize(this.diff);if(!t)return e;var n="color: "+this.color;e=[e[0],n,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0;var o=0;e[0].replace(/%[a-z%]/g,function(e){if("%%"===e)return;i++;if("%c"===e){o=i}});e.splice(o,0,n);return e}function o(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{if(null==e){r.storage.removeItem("debug")}else{r.storage.debug=e}}catch(t){}}function s(){var e;try{e=r.storage.debug}catch(t){}return e}r.enable(s());function f(){try{return window.localStorage}catch(e){}}},{"./debug":26}],26:[function(e,t,r){r=t.exports=a;r.coerce=u;r.disable=f;r.enable=s;r.enabled=c;r.humanize=e("ms");r.names=[];r.skips=[];r.formatters={};var n=0;var i;function o(){return r.colors[n++%r.colors.length]}function a(e){function t(){}t.enabled=false;function n(){var e=n;var t=+new Date;var a=t-(i||t);e.diff=a;e.prev=i;e.curr=t;i=t;if(null==e.useColors)e.useColors=r.useColors();if(null==e.color&&e.useColors)e.color=o();var s=Array.prototype.slice.call(arguments);s[0]=r.coerce(s[0]);if("string"!==typeof s[0]){s=["%o"].concat(s)}var f=0;s[0]=s[0].replace(/%([a-z%])/g,function(t,n){if(t==="%%")return t;f++;var i=r.formatters[n];if("function"===typeof i){var o=s[f];t=i.call(e,o);s.splice(f,1);f--}return t});if("function"===typeof r.formatArgs){s=r.formatArgs.apply(e,s)}var c=n.log||r.log||console.log.bind(console);c.apply(e,s)}n.enabled=true;var a=r.enabled(e)?n:t;a.namespace=e;return a}function s(e){r.save(e);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 f(){r.enable("")}function c(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:27}],27:[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||{};if("string"==typeof e)return f(e);return t.long?u(e):c(e)};function f(e){e=""+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}}function c(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 u(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"}},{}],28:[function(e,t,r){t.exports=function(e){var t=[].slice.call(arguments,1),r;for(var n=0,i=t.length;n<i;n++){r=t[n];for(var o in r){e[o]=r[o]}}return e}},{}],29:[function(e,t,r){(function(r){var n=e("isarray");t.exports=i;function i(e){function t(e){if(!e)return false;if(r.Buffer&&r.Buffer.isBuffer(e)||r.ArrayBuffer&&e instanceof ArrayBuffer||r.Blob&&e instanceof Blob||r.File&&e instanceof File){return true}if(n(e)){for(var i=0;i<e.length;i++){if(t(e[i])){return true}}}else if(e&&"object"==typeof e){if(e.toJSON){e=e.toJSON()}for(var o in e){if(Object.prototype.hasOwnProperty.call(e,o)&&t(e[o])){return true}}}return false}return t(e)}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{isarray:30}],30:[function(e,t,r){arguments[4][8][0].apply(r,arguments)},{dup:8}],31:[function(e,t,r){var n=t.exports=function(e,t){if(!t)t=16;if(e===undefined)e=128;if(e<=0)return"0";var r=Math.log(Math.pow(2,e))/Math.log(t);for(var i=2;r===Infinity;i*=2){r=Math.log(Math.pow(2,e/i))/Math.log(t)*i}var o=r-Math.floor(r);var a="";for(var i=0;i<Math.floor(r);i++){var s=Math.floor(Math.random()*t).toString(t);a=s+a}if(o){var f=Math.pow(t,o);var s=Math.floor(Math.random()*f).toString(t);a=s+a}var c=parseInt(a,t);if(c!==Infinity&&c>=Math.pow(2,e)){return n(e,t)}else return a};n.rack=function(e,t,r){var i=function(i){var a=0;do{if(a++>10){if(r)e+=r;else throw new Error("too many ID collisions, use more bits")}var s=n(e,t)}while(Object.hasOwnProperty.call(o,s));o[s]=i;return s};var o=i.hats={};i.get=function(e){return i.hats[e]};i.set=function(e,t){i.hats[e]=t;return i};i.bits=e||128;i.base=t||16;return i}},{}],32:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{dup:7}],33:[function(e,t,r){(function(r){t.exports=l;var n=e("debug")("simple-peer");var i=e("get-browser-rtc");var o=e("hat");var a=e("inherits");var s=e("is-typedarray");var f=e("once");var c=e("stream");var u=e("typedarray-to-buffer");a(l,c.Duplex);function l(e){var t=this;if(!(t instanceof l))return new l(e);t._debug("new peer %o",e);if(!e)e={};e.allowHalfOpen=false;if(e.highWaterMark==null)e.highWaterMark=1024*1024;c.Duplex.call(t,e);t.initiator=e.initiator||false;t.channelConfig=e.channelConfig||l.channelConfig;t.channelName=e.channelName||o(160);if(!e.initiator)t.channelName=null;t.config=e.config||l.config;t.constraints=e.constraints||l.constraints;t.reconnectTimer=e.reconnectTimer||0;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||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._maxBufferedAmount=e.highWaterMark;t._pcReady=false;t._channelReady=false;t._iceComplete=false;t._channel=null;t._pendingCandidates=[];t._chunk=null;t._cb=null;t._interval=null;t._reconnectTimeout=null;t._pc=new t._wrtc.RTCPeerConnection(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);if(t.stream)t._pc.addStream(t.stream);t._pc.onaddstream=t._onAddStream.bind(t);if(t.initiator){t._setupData({channel:t._pc.createDataChannel(t.channelName,t.channelConfig)});t._pc.onnegotiationneeded=f(t._createOffer.bind(t));if(typeof window==="undefined"||!window.webkitRTCPeerConnection){t._pc.onnegotiationneeded()}}else{t._pc.ondatachannel=t._setupData.bind(t)}t.on("finish",function(){if(t.connected){setTimeout(function(){t._destroy()},100)}else{t.once("connect",function(){setTimeout(function(){t._destroy()},100)})}})}l.WEBRTC_SUPPORT=!!i();l.config={iceServers:[{url:"stun:23.21.150.121",urls:"stun:23.21.150.121"}]};l.constraints={};l.channelConfig={};Object.defineProperty(l.prototype,"bufferSize",{get:function(){var e=this;return e._channel&&e._channel.bufferedAmount||0}});l.prototype.address=function(){var e=this;return{port:e.localPort,family:"IPv4",address:e.localAddress}};l.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(r){e={}}}t._debug("signal()");function n(e){try{t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e),h,t._onError.bind(t))}catch(r){t._destroy(new Error("error adding candidate: "+r.message))}}if(e.sdp){t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e),function(){if(t.destroyed)return;if(t._pc.remoteDescription.type==="offer")t._createAnswer();t._pendingCandidates.forEach(n);t._pendingCandidates=[]},t._onError.bind(t))}if(e.candidate){if(t._pc.remoteDescription)n(e.candidate);else t._pendingCandidates.push(e.candidate)}if(!e.sdp&&!e.candidate){t._destroy(new Error("signal() called with invalid signal data"))}};l.prototype.send=function(e){var t=this;if(!s.strict(e)&&!(e instanceof ArrayBuffer)&&!r.isBuffer(e)&&typeof e!=="string"&&(typeof Blob==="undefined"||!(e instanceof Blob))){e=JSON.stringify(e)}if(r.isBuffer(e)&&!s.strict(e)){e=new Uint8Array(e)}var n=e.length||e.byteLength||e.size;t._channel.send(e);t._debug("write: %d bytes",n)};l.prototype.destroy=function(e){var t=this;t._destroy(null,e)};l.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._chunk=null;r._cb=null;clearInterval(r._interval);clearTimeout(r._reconnectTimeout);if(r._pc){try{r._pc.close()}catch(e){}r._pc.oniceconnectionstatechange=null;r._pc.onsignalingstatechange=null;r._pc.onicecandidate=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")};l.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)};l.prototype._read=function(){};l.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(i){return n._onError(i)}if(n._channel.bufferedAmount>n._maxBufferedAmount){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}};l.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,h,e._onError.bind(e));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)},e._onError.bind(e),e.offerConstraints)};l.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,h,e._onError.bind(e));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)},e._onError.bind(e),e.answerConstraints)};l.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==="closed"){e._destroy()}};l.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;if(typeof window!=="undefined"&&!!window.mozRTCPeerConnection){e._pc.getStats(null,function(e){var r=[];e.forEach(function(e){r.push(e)});t(r)},e._onError.bind(e))}else{e._pc.getStats(function(e){var r=[];e.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)});t(r)})}function t(t){t.forEach(function(t){if(t.type==="remotecandidate"){e.remoteAddress=t.ipAddress;e.remoteFamily="IPv4";e.remotePort=Number(t.portNumber);e._debug("connect remote: %s:%s (%s)",e.remoteAddress,e.remotePort,e.remoteFamily)}else if(t.type==="localcandidate"&&t.candidateType==="host"){e.localAddress=t.ipAddress;e.localPort=Number(t.portNumber);e._debug("connect local: %s:%s",e.localAddress,e.localPort)}});e._connecting=false;e.connected=true;if(e._chunk){try{e.send(e._chunk)}catch(r){return e._onError(r)}e._chunk=null;e._debug('sent chunk from "write before connect"');var n=e._cb;e._cb=null;n(null)}e._interval=setInterval(function(){if(!e._cb||!e._channel||e._channel.bufferedAmount>e._maxBufferedAmount)return;e._debug("ending backpressure: bufferedAmount %d",e._channel.bufferedAmount);var t=e._cb;e._cb=null;t(null)},150);if(e._interval.unref)e._interval.unref();e._debug("connect");e.emit("connect")}};l.prototype._onSignalingStateChange=function(){var e=this;if(e.destroyed)return;e._debug("signalingStateChange %s",e._pc.signalingState);e.emit("signalingStateChange",e._pc.signalingState)};l.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")}};l.prototype._onChannelMessage=function(e){var t=this;if(t.destroyed)return;var r=e.data;t._debug("read: %d bytes",r.byteLength||r.length);if(r instanceof ArrayBuffer){r=u(new Uint8Array(r));t.push(r)}else{try{r=JSON.parse(r)}catch(n){}t.emit("data",r)}};l.prototype._onChannelOpen=function(){var e=this;if(e.connected||e.destroyed)return;e._debug("on channel open");e._channelReady=true;e._maybeReady();
};l.prototype._onChannelClose=function(){var e=this;if(e.destroyed)return;e._debug("on channel close");e._destroy()};l.prototype._onAddStream=function(e){var t=this;if(t.destroyed)return;t._debug("on add stream");t.emit("stream",e.stream)};l.prototype._onError=function(e){var t=this;if(t.destroyed)return;t._debug("error %s",e.message||e);t._destroy(e)};l.prototype._debug=function(){var e=this;var t=[].slice.call(arguments);var r=e.channelName&&e.channelName.substring(0,7);t[0]="["+r+"] "+t[0];n.apply(null,t)};function h(){}}).call(this,e("buffer").Buffer)},{buffer:2,debug:25,"get-browser-rtc":34,hat:31,inherits:32,"is-typedarray":35,once:37,stream:21,"typedarray-to-buffer":38}],34:[function(e,t,r){t.exports=function n(){if(typeof window==="undefined")return null;var e={RTCPeerConnection:window.mozRTCPeerConnection||window.RTCPeerConnection||window.webkitRTCPeerConnection,RTCSessionDescription:window.mozRTCSessionDescription||window.RTCSessionDescription||window.webkitRTCSessionDescription,RTCIceCandidate:window.mozRTCIceCandidate||window.RTCIceCandidate||window.webkitRTCIceCandidate};if(!e.RTCPeerConnection)return null;return e}},{}],35:[function(e,t,r){t.exports=o;o.strict=a;o.loose=s;var n=Object.prototype.toString;var i={"[object Int8Array]":true,"[object Int16Array]":true,"[object Int32Array]":true,"[object Uint8Array]":true,"[object Uint8ClampedArray]":true,"[object Uint16Array]":true,"[object Uint32Array]":true,"[object Float32Array]":true,"[object Float64Array]":true};function o(e){return a(e)||s(e)}function a(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function s(e){return i[n.call(e)]}},{}],36:[function(e,t,r){t.exports=n;function n(e,t){if(e&&t)return n(e)(t);if(typeof e!=="function")throw new TypeError("need wrapper function");Object.keys(e).forEach(function(t){r[t]=e[t]});return r;function r(){var t=new Array(arguments.length);for(var r=0;r<t.length;r++){t[r]=arguments[r]}var n=e.apply(this,t);var i=t[t.length-1];if(typeof n==="function"&&n!==i){Object.keys(i).forEach(function(e){n[e]=i[e]})}return n}}},{}],37:[function(e,t,r){var n=e("wrappy");t.exports=n(i);i.proto=i(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:true})});function i(e){var t=function(){if(t.called)return t.value;t.called=true;return t.value=e.apply(this,arguments)};t.called=false;return t}},{wrappy:36}],38:[function(e,t,r){(function(r){var n=e("is-typedarray").strict;t.exports=function(e){var t=r.TYPED_ARRAY_SUPPORT?r._augment:function(e){return new r(e)};if(e instanceof Uint8Array){return t(e)}else if(e instanceof ArrayBuffer){return t(new Uint8Array(e))}else if(n(e)){return t(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}else{return new r(e)}}}).call(this,e("buffer").Buffer)},{buffer:2,"is-typedarray":35}],39:[function(e,t,r){(function(t){var n=e("isarray");var i=e("./is-buffer");r.deconstructPacket=function(e){var t=[];var r=e.data;function o(e){if(!e)return e;if(i(e)){var r={_placeholder:true,num:t.length};t.push(e);return r}else if(n(e)){var a=new Array(e.length);for(var s=0;s<e.length;s++){a[s]=o(e[s])}return a}else if("object"==typeof e&&!(e instanceof Date)){var a={};for(var f in e){a[f]=o(e[f])}return a}return e}var a=e;a.data=o(r);a.attachments=t.length;return{packet:a,buffers:t}};r.reconstructPacket=function(e,t){var r=0;function i(e){if(e&&e._placeholder){var r=t[e.num];return r}else if(n(e)){for(var o=0;o<e.length;o++){e[o]=i(e[o])}return e}else if(e&&"object"==typeof e){for(var a in e){e[a]=i(e[a])}return e}return e}e.data=i(e.data);e.attachments=undefined;return e};r.removeBlobs=function(e,r){function o(e,f,c){if(!e)return e;if(t.Blob&&e instanceof Blob||t.File&&e instanceof File){a++;var u=new FileReader;u.onload=function(){if(c){c[f]=this.result}else{s=this.result}if(!--a){r(s)}};u.readAsArrayBuffer(e)}else if(n(e)){for(var l=0;l<e.length;l++){o(e[l],l,e)}}else if(e&&"object"==typeof e&&!i(e)){for(var h in e){o(e[h],h,e)}}}var a=0;var s=e;o(s);if(!a){r(s)}}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./is-buffer":41,isarray:44}],40:[function(e,t,r){var n=e("debug")("socket.io-parser");var i=e("json3");var o=e("isarray");var a=e("component-emitter");var s=e("./binary");var f=e("./is-buffer");r.protocol=4;r.types=["CONNECT","DISCONNECT","EVENT","BINARY_EVENT","ACK","BINARY_ACK","ERROR"];r.CONNECT=0;r.DISCONNECT=1;r.EVENT=2;r.ACK=3;r.ERROR=4;r.BINARY_EVENT=5;r.BINARY_ACK=6;r.Encoder=c;r.Decoder=h;function c(){}c.prototype.encode=function(e,t){n("encoding packet %j",e);if(r.BINARY_EVENT==e.type||r.BINARY_ACK==e.type){l(e,t)}else{var i=u(e);t([i])}};function u(e){var t="";var o=false;t+=e.type;if(r.BINARY_EVENT==e.type||r.BINARY_ACK==e.type){t+=e.attachments;t+="-"}if(e.nsp&&"/"!=e.nsp){o=true;t+=e.nsp}if(null!=e.id){if(o){t+=",";o=false}t+=e.id}if(null!=e.data){if(o)t+=",";t+=i.stringify(e.data)}n("encoded %j as %s",e,t);return t}function l(e,t){function r(e){var r=s.deconstructPacket(e);var n=u(r.packet);var i=r.buffers;i.unshift(n);t(i)}s.removeBlobs(e,r)}function h(){this.reconstructor=null}a(h.prototype);h.prototype.add=function(e){var t;if("string"==typeof e){t=d(e);if(r.BINARY_EVENT==t.type||r.BINARY_ACK==t.type){this.reconstructor=new p(t);if(this.reconstructor.reconPack.attachments==0){this.emit("decoded",t)}}else{this.emit("decoded",t)}}else if(f(e)||e.base64){if(!this.reconstructor){throw new Error("got binary data when not reconstructing a packet")}else{t=this.reconstructor.takeBinaryData(e);if(t){this.reconstructor=null;this.emit("decoded",t)}}}else{throw new Error("Unknown type: "+e)}};function d(e){var t={};var o=0;t.type=Number(e.charAt(0));if(null==r.types[t.type])return g();if(r.BINARY_EVENT==t.type||r.BINARY_ACK==t.type){t.attachments="";while(e.charAt(++o)!="-"){t.attachments+=e.charAt(o)}t.attachments=Number(t.attachments)}if("/"==e.charAt(o+1)){t.nsp="";while(++o){var a=e.charAt(o);if(","==a)break;t.nsp+=a;if(o+1==e.length)break}}else{t.nsp="/"}var s=e.charAt(o+1);if(""!=s&&Number(s)==s){t.id="";while(++o){var a=e.charAt(o);if(null==a||Number(a)!=a){--o;break}t.id+=e.charAt(o);if(o+1==e.length)break}t.id=Number(t.id)}if(e.charAt(++o)){try{t.data=i.parse(e.substr(o))}catch(f){return g()}}n("decoded %s as %j",e,t);return t}h.prototype.destroy=function(){if(this.reconstructor){this.reconstructor.finishedReconstruction()}};function p(e){this.reconPack=e;this.buffers=[]}p.prototype.takeBinaryData=function(e){this.buffers.push(e);if(this.buffers.length==this.reconPack.attachments){this.reconPack.data["data"]=this.buffers.reduce(function(e,t,r,n){return this._appendBuffer(e,t)});s.reconstructPacket(this.reconPack,[this.reconPack.data["data"]]);var t=this.reconPack;this.finishedReconstruction();return t}return null};p.prototype.finishedReconstruction=function(){this.reconPack=null;this.buffers=[]};function g(e){return{type:r.ERROR,data:"parser error"}}p.prototype._appendBuffer=function(e,t){var r=new Uint8Array(e.byteLength+t.byteLength);r.set(new Uint8Array(e),0);r.set(new Uint8Array(t),e.byteLength);return r.buffer}},{"./binary":39,"./is-buffer":41,"component-emitter":42,debug:43,isarray:44,json3:45}],41:[function(e,t,r){(function(e){t.exports=r;function r(t){return e.Buffer&&e.Buffer.isBuffer(t)||e.ArrayBuffer&&t instanceof ArrayBuffer}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],42:[function(e,t,r){t.exports=n;function n(e){if(e)return i(e)}function i(e){for(var t in n.prototype){e[t]=n.prototype[t]}return e}n.prototype.on=n.prototype.addEventListener=function(e,t){this._callbacks=this._callbacks||{};(this._callbacks[e]=this._callbacks[e]||[]).push(t);return this};n.prototype.once=function(e,t){var r=this;this._callbacks=this._callbacks||{};function n(){r.off(e,n);t.apply(this,arguments)}n.fn=t;this.on(e,n);return this};n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var r=this._callbacks[e];if(!r)return this;if(1==arguments.length){delete this._callbacks[e];return this}var n;for(var i=0;i<r.length;i++){n=r[i];if(n===t||n.fn===t){r.splice(i,1);break}}return this};n.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),r=this._callbacks[e];if(r){r=r.slice(0);for(var n=0,i=r.length;n<i;++n){r[n].apply(this,t)}}return this};n.prototype.listeners=function(e){this._callbacks=this._callbacks||{};return this._callbacks[e]||[]};n.prototype.hasListeners=function(e){return!!this.listeners(e).length}},{}],43:[function(e,t,r){t.exports=n;function n(e){if(!n.enabled(e))return function(){};return function(t){t=i(t);var r=new Date;var o=r-(n[e]||r);n[e]=r;t=e+" "+t+" +"+n.humanize(o);window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}}n.names=[];n.skips=[];n.enable=function(e){try{localStorage.debug=e}catch(t){}var r=(e||"").split(/[\s,]+/),i=r.length;for(var o=0;o<i;o++){e=r[o].replace("*",".*?");if(e[0]==="-"){n.skips.push(new RegExp("^"+e.substr(1)+"$"))}else{n.names.push(new RegExp("^"+e+"$"))}}};n.disable=function(){n.enable("")};n.humanize=function(e){var t=1e3,r=60*1e3,n=60*r;if(e>=n)return(e/n).toFixed(1)+"h";if(e>=r)return(e/r).toFixed(1)+"m";if(e>=t)return(e/t|0)+"s";return e+"ms"};n.enabled=function(e){for(var t=0,r=n.skips.length;t<r;t++){if(n.skips[t].test(e)){return false}}for(var t=0,r=n.names.length;t<r;t++){if(n.names[t].test(e)){return true}}return false};function i(e){if(e instanceof Error)return e.stack||e.message;return e}try{if(window.localStorage)n.enable(localStorage.debug)}catch(o){}},{}],44:[function(e,t,r){arguments[4][8][0].apply(r,arguments)},{dup:8}],45:[function(t,r,n){(function(t){var r={}.toString,i,o,a;var s=typeof e==="function"&&e.amd;var f=typeof JSON=="object"&&JSON;var c=typeof n=="object"&&n&&!n.nodeType&&n;if(c&&f){c.stringify=f.stringify;c.parse=f.parse}else{c=t.JSON=f||{}}var u=new Date(-0xc782b5b800cec);try{u=u.getUTCFullYear()==-109252&&u.getUTCMonth()===0&&u.getUTCDate()===1&&u.getUTCHours()==10&&u.getUTCMinutes()==37&&u.getUTCSeconds()==6&&u.getUTCMilliseconds()==708}catch(l){}function h(e){if(h[e]!==a){return h[e]}var t;if(e=="bug-string-char-index"){t="a"[0]!="a"}else if(e=="json"){t=h("json-stringify")&&h("json-parse")}else{var n,i='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if(e=="json-stringify"){var o=c.stringify,s=typeof o=="function"&&u;if(s){(n=function(){return 1}).toJSON=n;try{s=o(0)==="0"&&o(new Number)==="0"&&o(new String)=='""'&&o(r)===a&&o(a)===a&&o()===a&&o(n)==="1"&&o([n])=="[1]"&&o([a])=="[null]"&&o(null)=="null"&&o([a,r,null])=="[null,null,null]"&&o({a:[n,true,false,null,"\x00\b\n\f\r "]})==i&&o(null,n)==="1"&&o([1,2],null,1)=="[\n 1,\n 2\n]"&&o(new Date(-864e13))=='"-271821-04-20T00:00:00.000Z"'&&o(new Date(864e13))=='"+275760-09-13T00:00:00.000Z"'&&o(new Date(-621987552e5))=='"-000001-01-01T00:00:00.000Z"'&&o(new Date(-1))=='"1969-12-31T23:59:59.999Z"'}catch(f){s=false}}t=s}if(e=="json-parse"){var l=c.parse;if(typeof l=="function"){try{if(l("0")===0&&!l(false)){n=l(i);var d=n["a"].length==5&&n["a"][0]===1;if(d){try{d=!l('" "')}catch(f){}if(d){try{d=l("01")!==1}catch(f){}}if(d){try{d=l("1.")!==1}catch(f){}}}}}catch(f){d=false}}t=d}}return h[e]=!!t}if(!h("json")){var d="[object Function]";var p="[object Date]";var g="[object Number]";var v="[object String]";var b="[object Array]";var y="[object Boolean]";var m=h("bug-string-char-index");if(!u){var w=Math.floor;var _=[0,31,59,90,120,151,181,212,243,273,304,334];var E=function(e,t){return _[t]+365*(e-1970)+w((e-1969+(t=+(t>1)))/4)-w((e-1901+t)/100)+w((e-1601+t)/400)}}if(!(i={}.hasOwnProperty)){i=function(e){var t={},n;if((t.__proto__=null,t.__proto__={toString:1},t).toString!=r){i=function(e){var t=this.__proto__,r=e in(this.__proto__=null,this);this.__proto__=t;return r}}else{n=t.constructor;i=function(e){var t=(this.constructor||n).prototype;return e in this&&!(e in t&&this[e]===t[e])}}t=null;return i.call(this,e)}}var A={"boolean":1,number:1,string:1,undefined:1};var C=function(e,t){var r=typeof e[t];return r=="object"?!!e[t]:!A[r]};o=function(e,t){var n=0,a,s,f;(a=function(){this.valueOf=0}).prototype.valueOf=0;s=new a;for(f in s){if(i.call(s,f)){n++}}a=s=null;if(!n){s=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"];o=function(e,t){var n=r.call(e)==d,o,a;var f=!n&&typeof e.constructor!="function"&&C(e,"hasOwnProperty")?e.hasOwnProperty:i;for(o in e){if(!(n&&o=="prototype")&&f.call(e,o)){t(o)}}for(a=s.length;o=s[--a];f.call(e,o)&&t(o));}}else if(n==2){o=function(e,t){var n={},o=r.call(e)==d,a;for(a in e){if(!(o&&a=="prototype")&&!i.call(n,a)&&(n[a]=1)&&i.call(e,a)){t(a)}}}}else{o=function(e,t){var n=r.call(e)==d,o,a;for(o in e){if(!(n&&o=="prototype")&&i.call(e,o)&&!(a=o==="constructor")){t(o)}}if(a||i.call(e,o="constructor")){t(o)}}}return o(e,t)};if(!h("json-stringify")){var k={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"};var S="000000";var R=function(e,t){return(S+(t||0)).slice(-e)};var T="\\u00";var I=function(e){var t='"',r=0,n=e.length,i=n>10&&m,o;if(i){o=e.split("")}for(;r<n;r++){var a=e.charCodeAt(r);switch(a){case 8:case 9:case 10:case 12:case 13:case 34:case 92:t+=k[a];break;default:if(a<32){t+=T+R(2,a.toString(16));break}t+=i?o[r]:m?e.charAt(r):e[r]}}return t+'"'};var L=function(e,t,n,s,f,c,u){var l,h,d,m,_,A,C,k,S,T,B,M,P,x,j,U;try{l=t[e]}catch(N){}if(typeof l=="object"&&l){h=r.call(l);if(h==p&&!i.call(l,"toJSON")){if(l>-1/0&&l<1/0){if(E){_=w(l/864e5);for(d=w(_/365.2425)+1970-1;E(d+1,0)<=_;d++);for(m=w((_-E(d,0))/30.42);E(d,m+1)<=_;m++);_=1+_-E(d,m);A=(l%864e5+864e5)%864e5;C=w(A/36e5)%24;k=w(A/6e4)%60;S=w(A/1e3)%60;T=A%1e3}else{d=l.getUTCFullYear();m=l.getUTCMonth();_=l.getUTCDate();C=l.getUTCHours();k=l.getUTCMinutes();S=l.getUTCSeconds();T=l.getUTCMilliseconds()}l=(d<=0||d>=1e4?(d<0?"-":"+")+R(6,d<0?-d:d):R(4,d))+"-"+R(2,m+1)+"-"+R(2,_)+"T"+R(2,C)+":"+R(2,k)+":"+R(2,S)+"."+R(3,T)+"Z"}else{l=null}}else if(typeof l.toJSON=="function"&&(h!=g&&h!=v&&h!=b||i.call(l,"toJSON"))){l=l.toJSON(e)}}if(n){l=n.call(t,e,l)}if(l===null){return"null"}h=r.call(l);if(h==y){return""+l}else if(h==g){return l>-1/0&&l<1/0?""+l:"null"}else if(h==v){return I(""+l)}if(typeof l=="object"){for(x=u.length;x--;){if(u[x]===l){throw TypeError()}}u.push(l);B=[];j=c;c+=f;if(h==b){for(P=0,x=l.length;P<x;P++){M=L(P,l,n,s,f,c,u);B.push(M===a?"null":M)}U=B.length?f?"[\n"+c+B.join(",\n"+c)+"\n"+j+"]":"["+B.join(",")+"]":"[]"}else{o(s||l,function(e){var t=L(e,l,n,s,f,c,u);if(t!==a){B.push(I(e)+":"+(f?" ":"")+t)}});U=B.length?f?"{\n"+c+B.join(",\n"+c)+"\n"+j+"}":"{"+B.join(",")+"}":"{}"}u.pop();return U}};c.stringify=function(e,t,n){var i,o,a,s;if(typeof t=="function"||typeof t=="object"&&t){if((s=r.call(t))==d){o=t}else if(s==b){a={};for(var f=0,c=t.length,u;f<c;u=t[f++],(s=r.call(u),s==v||s==g)&&(a[u]=1));}}if(n){if((s=r.call(n))==g){if((n-=n%1)>0){for(i="",n>10&&(n=10);i.length<n;i+=" ");}}else if(s==v){i=n.length<=10?n:n.slice(0,10)}}return L("",(u={},u[""]=e,u),o,a,i,"",[])}}if(!h("json-parse")){var B=String.fromCharCode;var M={92:"\\",34:'"',47:"/",98:"\b",116:" ",110:"\n",102:"\f",114:"\r"};var P,x;var j=function(){P=x=null;throw SyntaxError()};var U=function(){var e=x,t=e.length,r,n,i,o,a;while(P<t){a=e.charCodeAt(P);switch(a){case 9:case 10:case 13:case 32:P++;break;case 123:case 125:case 91:case 93:case 58:case 44:r=m?e.charAt(P):e[P];P++;return r;case 34:for(r="@",P++;P<t;){a=e.charCodeAt(P);if(a<32){j()}else if(a==92){a=e.charCodeAt(++P);switch(a){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:r+=M[a];P++;break;case 117:n=++P;for(i=P+4;P<i;P++){a=e.charCodeAt(P);if(!(a>=48&&a<=57||a>=97&&a<=102||a>=65&&a<=70)){j()}}r+=B("0x"+e.slice(n,P));break;default:j()}}else{if(a==34){break}a=e.charCodeAt(P);n=P;while(a>=32&&a!=92&&a!=34){a=e.charCodeAt(++P)}r+=e.slice(n,P)}}if(e.charCodeAt(P)==34){P++;return r}j();default:n=P;if(a==45){o=true;a=e.charCodeAt(++P)}if(a>=48&&a<=57){if(a==48&&(a=e.charCodeAt(P+1),a>=48&&a<=57)){j()}o=false;for(;P<t&&(a=e.charCodeAt(P),a>=48&&a<=57);P++);if(e.charCodeAt(P)==46){i=++P;for(;i<t&&(a=e.charCodeAt(i),a>=48&&a<=57);i++);if(i==P){j()}P=i}a=e.charCodeAt(P);if(a==101||a==69){a=e.charCodeAt(++P);if(a==43||a==45){P++}for(i=P;i<t&&(a=e.charCodeAt(i),a>=48&&a<=57);i++);if(i==P){j()}P=i}return+e.slice(n,P)}if(o){j()}if(e.slice(P,P+4)=="true"){P+=4;return true}else if(e.slice(P,P+5)=="false"){P+=5;return false}else if(e.slice(P,P+4)=="null"){P+=4;return null}j()}}return"$"};var N=function(e){var t,r;if(e=="$"){j()}if(typeof e=="string"){if((m?e.charAt(0):e[0])=="@"){return e.slice(1)}if(e=="["){t=[];for(;;r||(r=true)){e=U();if(e=="]"){break}if(r){if(e==","){e=U();if(e=="]"){j()}}else{j()}}if(e==","){j()}t.push(N(e))}return t}else if(e=="{"){t={};for(;;r||(r=true)){e=U();if(e=="}"){break}if(r){if(e==","){e=U();if(e=="}"){j()}}else{j()}}if(e==","||typeof e!="string"||(m?e.charAt(0):e[0])!="@"||U()!=":"){j()}t[e.slice(1)]=N(U())}return t}j()}return e};var O=function(e,t,r){var n=D(e,t,r);if(n===a){delete e[t]}else{e[t]=n}};var D=function(e,t,n){var i=e[t],a;if(typeof i=="object"&&i){if(r.call(i)==b){for(a=i.length;a--;){O(i,a,n)}}else{o(i,function(e){O(i,e,n)})}}return n.call(e,t,i)};c.parse=function(e,t){var n,i;P=0;x=""+e;n=N(U());if(U()!="$"){j()}P=x=null;return t&&r.call(t)==d?D((i={},i[""]=n,i),"",t):n}}}if(s){e(function(){return c})}})(this)},{}],46:[function(e,t,r){t.exports=n;function n(e,t){var r=[];t=t||0;for(var n=t||0;n<e.length;n++){r[n-t]=e[n]}return r}},{}],47:[function(e,t,r){var n;var i;if(window.mozRTCPeerConnection||navigator.mozGetUserMedia){n="moz";i=parseInt(navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1],10)}else if(window.webkitRTCPeerConnection||navigator.webkitGetUserMedia){n="webkit";i=navigator.userAgent.match(/Chrom(e|ium)/)&&parseInt(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2],10)}var o=window.mozRTCPeerConnection||window.webkitRTCPeerConnection;var a=window.mozRTCIceCandidate||window.RTCIceCandidate;var s=window.mozRTCSessionDescription||window.RTCSessionDescription;var f=window.webkitMediaStream||window.MediaStream;var c=window.location.protocol==="https:"&&(n==="webkit"&&i>=26||n==="moz"&&i>=33);var u=window.AudioContext||window.webkitAudioContext;var l=document.createElement("video");var h=l&&l.canPlayType&&l.canPlayType('video/webm; codecs="vp8", vorbis')==="probably";var d=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.msGetUserMedia||navigator.mozGetUserMedia;t.exports={prefix:n,browserVersion:i,support:!!o&&h&&!!d,supportRTCPeerConnection:!!o,supportVp8:h,supportGetUserMedia:!!d,supportDataChannel:!!(o&&o.prototype&&o.prototype.createDataChannel),supportWebAudio:!!(u&&u.prototype.createMediaStreamSource),supportMediaStream:!!(f&&f.prototype.removeTrack),supportScreenSharing:!!c,AudioContext:u,PeerConnection:o,SessionDescription:s,IceCandidate:a,MediaStream:f,getUserMedia:d}},{}],"/":[function(e,t,r){window.myDebug=e("debug");var n=e("simple-peer");var i=e("component-emitter");var o=e("socket.io-parser");var a=e("to-array");var s=e("has-binary");var f=e("component-bind");var c=e("debug")("socket");var u=e("hat");var l=e("extend.js");var h=e("webrtcsupport");var d=i.prototype.emit;function p(e,t,r){var i=this;i.useSockets=true;i.usePeerConnection=false;i.decoder=new o.Decoder(this);i.decoder.on("decoded",f(this,this.ondecoded));i.socket=e;i.cb=r;i._peers={};i.readyPeers=0;i.ready=false;i._peerEvents={upgrade:1,error:1,peer_signal:1,peer_ready:1,stream:1};var a={autoUpgrade:true,numClients:5};i.opts=l(a,t||{});i.peerOpts=i.opts.peerOpts||{};i.numConnectedClients;e.on("numClients",function(t){i.peerId=e.io.engine.id;i.numConnectedClients=t;if(h.supportDataChannel){r(function(t){var r={offers:t,fromPeerId:i.peerId};e.emit("offers",r)})}function r(e){var t=[];for(var r=0;r<i.opts.numClients;++r){o()}function o(){var e=u(160);var r=l(i.peerOpts,{initiator:true});var o=i._peers[e]=new n(r);o.setMaxListeners(50);i.setupPeerEvents(o);o.on("signal",function(r){t.push({offer:r,offerId:e});a()});o.on("error",function(e){d.call(this,"peer-error",e);c("Error in peer %s",e)})}function a(){if(t.length===i.opts.numClients){c("generated %s offers",i.opts.numClients);e(t)}}}});e.on("offer",function(t){var r=l(i.peerOpts,{initiator:false});var o=i._peers[t.fromPeerId]=new n(r);i.numConnectedClients++;o.setMaxListeners(50);i.setupPeerEvents(o);o.on("signal",function(r){var n={signal:r,offerId:t.offerId,fromPeerId:i.peerId,toPeerId:t.fromPeerId};e.emit("peer-signal",n)});o.on("error",function(e){d.call(this,"peer-error",e);c("Error in peer %s",e)});o.signal(t.offer)});e.on("peer-signal",function(t){var r=i._peers[t.offerId]||i._peers[t.fromPeerId];r.on("signal",function n(r){var n={signal:r,offerId:t.offerId,fromPeerId:i.peerId,toPeerId:t.fromPeerId};e.emit("peer-signal",n)});r.signal(t.signal)});i.on("peer_ready",function(e){i.readyPeers++;if(i.readyPeers>=i.numConnectedClients&&!i.ready){i.ready=true;if(i.opts.autoUpgrade)i.usePeerConnection=true;if(typeof i.cb==="function")i.cb();i.emit("upgrade")}})}i(p.prototype);p.prototype.setupPeerEvents=function(e){var t=this;e.on("connect",function(e){t.emit("peer_ready",e)});e.on("data",function(e){if(this.destroyed)return;t.decoder.add(e)});e.on("stream",function(e){t.emit("stream",e)})};p.prototype.on=function(e,t){var r=this;this.socket.addEventListener(e,function(t){d.call(r,e,t)});this.addEventListener(e,t)};p.prototype.emit=function(e,t){var r=this;var n=t||{};var i=new o.Encoder;if(this._peerEvents.hasOwnProperty(e)||n.fromSocket){d.apply(this,arguments)}else if(this.usePeerConnection||!this.useSockets){var f=a(arguments);var c=o.EVENT;if(s(f)){c=o.BINARY_EVENT}var u={type:c,data:f};i.encode(u,function(e){if(e[1]instanceof ArrayBuffer){r._sendArray(e)}else if(e){for(var t=0;t<e.length;t++){r._send(e[t])}}else{throw new Error("Encoding error")}})}else{this.socket.emit(e,t)}};p.prototype._sendArray=function(e){var t=e[0];var r=5e3;var n=e[1].byteLength;var i=Math.ceil(n/r);var o=t.substr(0,1)+i+t.substr(t.indexOf("-"));this._send(o);this.binarySlice(e[1],r,this._send)};p.prototype._send=function(e){var t=this;for(var r in t._peers){var n=t._peers[r];if(n._channelReady){n.send(e)}}};p.prototype.binarySlice=function(e,t,r){for(var n=0;n<e.byteLength;n+=t){var i=e.slice(n,n+t);r.call(this,i)}};p.prototype.ondecoded=function(e){var t=e.data||[];d.apply(this,t)};p.prototype.disconnect=function(){for(var e in this._peers){var t=this._peers[e];t.destroy();this.socket.disconnect()}};p.prototype.upgrade=function(){this.usePeerConnection=true};t.exports=p},{"component-bind":23,"component-emitter":24,debug:25,"extend.js":28,"has-binary":29,hat:31,"simple-peer":33,"socket.io-parser":40,"to-array":46,webrtcsupport:47}]},{},[])("/")});