Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2015-05-24 19:11:00 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-05-24 19:11:00 +0300
commit32130fdccf49138a750d7176025dcc0000fd3983 (patch)
tree402178e51bcd24d827ec5324fa7a476efdfb7bee
parentbb30d72f75b3c52b2ab86a512757c7d62bb0ea05 (diff)
build
-rw-r--r--webtorrent.min.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/webtorrent.min.js b/webtorrent.min.js
index b8fe244..957ea79 100644
--- a/webtorrent.min.js
+++ b/webtorrent.min.js
@@ -4,4 +4,4 @@ i.call(this);if(!t)t={};if(typeof e==="object"){t=e;e=t.size}this.size=e||512;if
}return t+r};f.prototype.writeUInt8=function Be(e,t,r){e=+e;t=t|0;if(!r)P(this,e,t,1,255,0);if(!f.TYPED_ARRAY_SUPPORT)e=Math.floor(e);this[t]=e;return t+1};function j(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 Re(e,t,r){e=+e;t=t|0;if(!r)P(this,e,t,2,65535,0);if(f.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8}else{j(this,e,t,true)}return t+2};f.prototype.writeUInt16BE=function Me(e,t,r){e=+e;t=t|0;if(!r)P(this,e,t,2,65535,0);if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>8;this[t+1]=e}else{j(this,e,t,false)}return t+2};function U(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 Pe(e,t,r){e=+e;t=t|0;if(!r)P(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{U(this,e,t,true)}return t+4};f.prototype.writeUInt32BE=function je(e,t,r){e=+e;t=t|0;if(!r)P(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{U(this,e,t,false)}return t+4};f.prototype.writeIntLE=function Ue(e,t,r,n){e=+e;t=t|0;if(!n){var i=Math.pow(2,8*r-1);P(this,e,t,r,i-1,-i)}var o=0;var a=1;var s=e<0?1:0;this[t]=e&255;while(++o<r&&(a*=256)){this[t+o]=(e/a>>0)-s&255}return t+r};f.prototype.writeIntBE=function Oe(e,t,r,n){e=+e;t=t|0;if(!n){var i=Math.pow(2,8*r-1);P(this,e,t,r,i-1,-i)}var o=r-1;var a=1;var s=e<0?1:0;this[t+o]=e&255;while(--o>=0&&(a*=256)){this[t+o]=(e/a>>0)-s&255}return t+r};f.prototype.writeInt8=function He(e,t,r){e=+e;t=t|0;if(!r)P(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 De(e,t,r){e=+e;t=t|0;if(!r)P(this,e,t,2,32767,-32768);if(f.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8}else{j(this,e,t,true)}return t+2};f.prototype.writeInt16BE=function Ne(e,t,r){e=+e;t=t|0;if(!r)P(this,e,t,2,32767,-32768);if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>8;this[t+1]=e}else{j(this,e,t,false)}return t+2};f.prototype.writeInt32LE=function qe(e,t,r){e=+e;t=t|0;if(!r)P(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{U(this,e,t,true)}return t+4};f.prototype.writeInt32BE=function ze(e,t,r){e=+e;t=t|0;if(!r)P(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{U(this,e,t,false)}return t+4};function O(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 H(e,t,r,n,o){if(!o){O(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38)}i.write(e,t,r,n,23,4);return r+4}f.prototype.writeFloatLE=function We(e,t,r){return H(this,e,t,true,r)};f.prototype.writeFloatBE=function Fe(e,t,r){return H(this,e,t,false,r)};function D(e,t,r,n,o){if(!o){O(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308)}i.write(e,t,r,n,52,8);return r+8}f.prototype.writeDoubleLE=function Ye(e,t,r){return D(this,e,t,true,r)};f.prototype.writeDoubleBE=function Ve(e,t,r){return D(this,e,t,false,r)};f.prototype.copy=function Je(e,t,r,n){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||this.length===0)return 0;if(t<0){throw new RangeError("targetStart out of bounds")}if(r<0||r>=this.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 i=n-r;if(i<1e3||!f.TYPED_ARRAY_SUPPORT){for(var o=0;o<i;o++){e[o+t]=this[o+r]}}else{e._set(this.subarray(r,r+i),t)}return i};f.prototype.fill=function $e(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=Y(e.toString());var o=i.length;for(n=t;n<r;n++){this[n]=i[n%o]}}return this};f.prototype.toArrayBuffer=function Ke(){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 N=f.prototype;f._augment=function Ge(e){e.constructor=f;e._isBuffer=true;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;return e};var q=/[^+\/0-9A-z\-]/g;function z(e){e=W(e).replace(q,"");if(e.length<2)return"";while(e.length%4!==0){e=e+"="}return e}function W(e){if(e.trim)return e.trim();return e.replace(/^\s+|\s+$/g,"")}function F(e){if(e<16)return"0"+e.toString(16);return e.toString(16)}function Y(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 V(e){var t=[];for(var r=0;r<e.length;r++){t.push(e.charCodeAt(r)&255)}return t}function J(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 $(e){return n.toByteArray(z(e))}function K(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 G(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}},{"base64-js":46,ieee754:47,"is-array":48}],46:[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 u="_".charCodeAt(0);function c(e){var t=e.charCodeAt(0);if(t===r||t===f)return 62;if(t===i||t===u)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 u=0;function l(e){s[u++]=e}for(r=0,n=0;r<i;r+=4,n+=3){o=c(e.charAt(r))<<18|c(e.charAt(r+1))<<12|c(e.charAt(r+2))<<6|c(e.charAt(r+3));l((o&16711680)>>16);l((o&65280)>>8);l(o&255)}if(a===2){o=c(e.charAt(r))<<2|c(e.charAt(r+1))>>4;l(o&255)}else if(a===1){o=c(e.charAt(r))<<10|c(e.charAt(r+1))<<4|c(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)},{}],47:[function(e,t,r){r.read=function(e,t,r,n,i){var o,a,s=i*8-n-1,f=(1<<s)-1,u=f>>1,c=-7,l=r?i-1:0,h=r?-1:1,d=e[t+l];l+=h;o=d&(1<<-c)-1;d>>=-c;c+=s;for(;c>0;o=o*256+e[t+l],l+=h,c-=8){}a=o&(1<<-c)-1;o>>=-c;c+=n;for(;c>0;a=a*256+e[t+l],l+=h,c-=8){}if(o===0){o=1-u}else if(o===f){return a?NaN:(d?-1:1)*Infinity}else{a=a+Math.pow(2,n);o=o-u}return(d?-1:1)*a*Math.pow(2,o-n)};r.write=function(e,t,r,n,i,o){var a,s,f,u=o*8-i-1,c=(1<<u)-1,l=c>>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=c}else{a=Math.floor(Math.log(t)/Math.LN2);if(t*(f=Math.pow(2,-a))<1){a--;f*=2}if(a+l>=1){t+=h/f}else{t+=h*Math.pow(2,1-l)}if(t*f>=2){a++;f/=2}if(a+l>=c){s=0;a=c}else if(a+l>=1){s=(t*f-1)*Math.pow(2,i);a=a+l}else{s=t*Math.pow(2,l-1)*Math.pow(2,i);a=0}}for(;i>=8;e[r+d]=s&255,d+=p,s/=256,i-=8){}a=a<<i|s;u+=i;for(;u>0;e[r+d]=a&255,d+=p,a/=256,u-=8){}e[r+d-p]|=g*128}},{}],48:[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)}},{}],49:[function(e,t,r){function n(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}t.exports=n;n.EventEmitter=n;n.prototype._events=undefined;n.prototype._maxListeners=undefined;n.defaultMaxListeners=10;n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");this._maxListeners=e;return this};n.prototype.emit=function(e){var t,r,n,o,f,u;if(!this._events)this._events={};if(e==="error"){if(!this._events.error||a(this._events.error)&&!this._events.error.length){t=arguments[1];if(t instanceof Error){throw t}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];u=r.slice();n=u.length;for(f=0;f<n;f++)u[f].apply(this,o)}return true};n.prototype.addListener=function(e,t){var r;if(!i(t))throw TypeError("listener must be a function");if(!this._events)this._events={};if(this._events.newListener)this.emit("newListener",e,i(t.listener)?t.listener:t);if(!this._events[e])this._events[e]=t;else if(a(this._events[e]))this._events[e].push(t);else this._events[e]=[this._events[e],t];if(a(this._events[e])&&!this._events[e].warned){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}},{}],50:[function(e,t,r){arguments[4][40][0].apply(r,arguments)},{dup:40}],51:[function(e,t,r){(function(e){function t(e,t){var r=0;for(var n=e.length-1;n>=0;n--){var i=e[n];if(i==="."){e.splice(n,1)}else if(i===".."){e.splice(n,1);r++}else if(r){e.splice(n,1);r--}}if(t){for(;r--;r){e.unshift("..")}}return e}var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var i=function(e){return n.exec(e).slice(1)};r.resolve=function(){var r="",n=false;for(var i=arguments.length-1;i>=-1&&!n;i--){var a=i>=0?arguments[i]:e.cwd();if(typeof a!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!a){continue}r=a+"/"+r;n=a.charAt(0)==="/"}r=t(o(r.split("/"),function(e){return!!e}),!n).join("/");return(n?"/":"")+r||"."};r.normalize=function(e){var n=r.isAbsolute(e),i=a(e,-1)==="/";e=t(o(e.split("/"),function(e){return!!e}),!n).join("/");if(!e&&!n){e="."}if(e&&i){e+="/"}return(n?"/":"")+e};r.isAbsolute=function(e){return e.charAt(0)==="/"};r.join=function(){var e=Array.prototype.slice.call(arguments,0);return r.normalize(o(e,function(e,t){if(typeof e!=="string"){throw new TypeError("Arguments to path.join must be strings")}return e}).join("/"))};r.relative=function(e,t){e=r.resolve(e).substr(1);t=r.resolve(t).substr(1);function n(e){var t=0;for(;t<e.length;t++){if(e[t]!=="")break}var r=e.length-1;for(;r>=0;r--){if(e[r]!=="")break}if(t>r)return[];return e.slice(t,r-t+1)}var i=n(e.split("/"));var o=n(t.split("/"));var a=Math.min(i.length,o.length);var s=a;for(var f=0;f<a;f++){if(i[f]!==o[f]){s=f;break}}var u=[];for(var f=s;f<i.length;f++){u.push("..")}u=u.concat(o.slice(s));return u.join("/")};r.sep="/";r.delimiter=":";r.dirname=function(e){var t=i(e),r=t[0],n=t[1];if(!r&&!n){return"."}if(n){n=n.substr(0,n.length-1)}return r+n};r.basename=function(e,t){var r=i(e)[2];if(t&&r.substr(-1*t.length)===t){r=r.substr(0,r.length-t.length)}return r};r.extname=function(e){return i(e)[3]};function o(e,t){if(e.filter)return e.filter(t);var r=[];for(var n=0;n<e.length;n++){if(t(e[n],n,e))r.push(e[n])}return r}var a="ab".substr(-1)==="b"?function(e,t,r){return e.substr(t,r)}:function(e,t,r){if(t<0)t=e.length+t;return e.substr(t,r)}}).call(this,e("_process"))},{_process:52}],52:[function(e,t,r){var n=t.exports={};var i=[];var o=false;var a;var s=-1;function f(){o=false;if(a.length){i=a.concat(i)}else{s=-1}if(i.length){u()}}function u(){if(o){return}var e=setTimeout(f);o=true;var t=i.length;while(t){a=i;i=[];while(++s<t){a[s].run()}s=-1;t=i.length}a=null;o=false;clearTimeout(e)}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1){for(var r=1;r<arguments.length;r++){t[r-1]=arguments[r]}}i.push(new c(e,t));if(!o){setTimeout(u,0)}};function c(e,t){this.fun=e;this.array=t}c.prototype.run=function(){this.fun.apply(null,this.array)};n.title="browser";n.browser=true;n.env={};n.argv=[];n.version="";n.versions={};function l(){}n.on=l;n.addListener=l;n.once=l;n.off=l;n.removeListener=l;n.removeAllListeners=l;n.emit=l;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}},{}],53:[function(t,r,n){(function(t){(function(i){var o=typeof n=="object"&&n&&!n.nodeType&&n;var a=typeof r=="object"&&r&&!r.nodeType&&r;var s=typeof t=="object"&&t;if(s.global===s||s.window===s||s.self===s){i=s}var f,u=2147483647,c=36,l=1,h=26,d=38,p=700,g=72,m=128,v="-",y=/^xn--/,_=/[^\x20-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=c-l,E=Math.floor,x=String.fromCharCode,S;function A(e){throw RangeError(b[e])}function I(e,t){var r=e.length;var n=[];while(r--){n[r]=t(e[r])}return n}function T(e,t){var r=e.split("@");var n="";if(r.length>1){n=r[0]+"@";e=r[1]}e=e.replace(w,".");var i=e.split(".");var o=I(i,t).join(".");return n+o}function C(e){var t=[],r=0,n=e.length,i,o;while(r<n){i=e.charCodeAt(r++);if(i>=55296&&i<=56319&&r<n){o=e.charCodeAt(r++);if((o&64512)==56320){t.push(((i&1023)<<10)+(o&1023)+65536)}else{t.push(i);r--}}else{t.push(i)}}return t}function L(e){return I(e,function(e){var t="";if(e>65535){e-=65536;t+=x(e>>>10&1023|55296);e=56320|e&1023}t+=x(e);return t}).join("")}function B(e){if(e-48<10){return e-22}if(e-65<26){return e-65}if(e-97<26){return e-97}return c}function R(e,t){return e+22+75*(e<26)-((t!=0)<<5)}function M(e,t,r){var n=0;e=r?E(e/p):e>>1;e+=E(e/t);for(;e>k*h>>1;n+=c){e=E(e/k)}return E(n+(k+1)*e/(e+d))}function P(e){var t=[],r=e.length,n,i=0,o=m,a=g,s,f,d,p,y,_,w,b,k;s=e.lastIndexOf(v);if(s<0){s=0}for(f=0;f<s;++f){if(e.charCodeAt(f)>=128){A("not-basic")}t.push(e.charCodeAt(f))}for(d=s>0?s+1:0;d<r;){for(p=i,y=1,_=c;;_+=c){if(d>=r){A("invalid-input")}w=B(e.charCodeAt(d++));if(w>=c||w>E((u-i)/y)){A("overflow")}i+=w*y;b=_<=a?l:_>=a+h?h:_-a;if(w<b){break}k=c-b;if(y>E(u/k)){A("overflow")}y*=k}n=t.length+1;a=M(i-p,n,p==0);if(E(i/n)>u-o){A("overflow")}o+=E(i/n);i%=n;t.splice(i++,0,o)}return L(t)}function j(e){var t,r,n,i,o,a,s,f,d,p,y,_=[],w,b,k,S;e=C(e);w=e.length;t=m;r=0;o=g;for(a=0;a<w;++a){y=e[a];if(y<128){_.push(x(y))}}n=i=_.length;if(i){_.push(v)}while(n<w){for(s=u,a=0;a<w;++a){y=e[a];if(y>=t&&y<s){s=y}}b=n+1;if(s-t>E((u-r)/b)){A("overflow")}r+=(s-t)*b;t=s;for(a=0;a<w;++a){y=e[a];if(y<t&&++r>u){A("overflow")}if(y==t){for(f=r,d=c;;d+=c){p=d<=o?l:d>=o+h?h:d-o;if(f<p){break}S=f-p;k=c-p;_.push(x(R(p+S%k,0)));f=E(S/k)}_.push(x(R(f,0)));o=M(r,b,n==i);r=0;++n}}++r;++t}return _.join("")}function U(e){return T(e,function(e){return y.test(e)?P(e.slice(4).toLowerCase()):e})}function O(e){return T(e,function(e){return _.test(e)?"xn--"+j(e):e})}f={version:"1.3.2",ucs2:{decode:C,encode:L},decode:P,encode:j,toASCII:O,toUnicode:U};if(typeof e=="function"&&typeof e.amd=="object"&&e.amd){e("punycode",function(){return f})}else if(o&&a){if(r.exports==o){a.exports=f}else{for(S in f){f.hasOwnProperty(S)&&(o[S]=f[S])}}}else{i.punycode=f}})(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],54:[function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,r,o){t=t||"&";r=r||"=";var a={};if(typeof e!=="string"||e.length===0){return a}var s=/\+/g;e=e.split(t);var f=1e3;if(o&&typeof o.maxKeys==="number"){f=o.maxKeys}var u=e.length;if(f>0&&u>f){u=f}for(var c=0;c<u;++c){var l=e[c].replace(s,"%20"),h=l.indexOf(r),d,p,g,m;if(h>=0){d=l.substr(0,h);p=l.substr(h+1)}else{d=l;p=""}g=decodeURIComponent(d);m=decodeURIComponent(p);if(!n(a,g)){a[g]=m}else if(i(a[g])){a[g].push(m)}else{a[g]=[a[g],m]}}return a};var i=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}},{}],55:[function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,r,s){t=t||"&";r=r||"=";if(e===null){e=undefined}if(typeof e==="object"){return o(a(e),function(a){var s=encodeURIComponent(n(a))+r;if(i(e[a])){return o(e[a],function(e){return s+encodeURIComponent(n(e))}).join(t)}else{return s+encodeURIComponent(n(e[a]))}}).join(t)}if(!s)return"";return encodeURIComponent(n(s))+r+encodeURIComponent(n(e))};var i=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};function o(e,t){if(e.map)return e.map(t);var r=[];for(var n=0;n<e.length;n++){r.push(t(e[n],n))}return r}var a=Object.keys||function(e){var t=[];for(var r in e){if(Object.prototype.hasOwnProperty.call(e,r))t.push(r)}return t}},{}],56:[function(e,t,r){"use strict";r.decode=r.parse=e("./decode");r.encode=r.stringify=e("./encode")},{"./decode":54,"./encode":55}],57:[function(e,t,r){t.exports=e("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":58}],58:[function(e,t,r){arguments[4][34][0].apply(r,arguments)},{"./_stream_readable":60,"./_stream_writable":62,_process:52,"core-util-is":63,dup:34,inherits:116}],59:[function(e,t,r){arguments[4][35][0].apply(r,arguments)},{"./_stream_transform":61,"core-util-is":63,dup:35,inherits:116}],60:[function(e,t,r){(function(r){t.exports=l;var n=e("isarray");var i=e("buffer").Buffer;l.ReadableState=c;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 u=e("util");if(u&&u.debuglog){u=u.debuglog("stream")}else{u=function(){}}s.inherits(l,a);function c(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 c(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=v(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)_(e)}b(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 m(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){u("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)){u("read: emitReadable",t.length,t.ended);if(t.length===0&&t.ended)T(this);else _(this);return null}e=m(e,t);if(e===0&&t.ended){if(t.length===0)T(this);return null}var n=t.needReadable;u("need readable",n);if(t.length===0||t.length-e<t.highWaterMark){n=true;u("length less than watermark",n)}if(t.ended||t.reading){n=false;u("reading or ended",n)}if(n){u("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=m(r,t);var i;if(e>0)i=I(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 v(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;_(e)}function _(e){var t=e._readableState;t.needReadable=false;if(!t.emittedReadable){u("emitReadable",t.flowing);t.emittedReadable=true;if(t.sync)r.nextTick(function(){w(e)});else w(e)}}function w(e){u("emit readable");e.emit("readable");A(e)}function b(e,t){if(!t.readingMore){t.readingMore=true;r.nextTick(function(){k(e,t)})}}function k(e,t){var r=t.length;while(!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark){u("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;u("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",c);function c(e){u("onunpipe");if(e===i){d()}}function l(){u("onend");e.end()}var h=E(i);e.on("drain",h);function d(){u("cleanup");e.removeListener("close",m);e.removeListener("finish",v);e.removeListener("drain",h);e.removeListener("error",g);e.removeListener("unpipe",c);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){u("ondata");var r=e.write(t);if(false===r){u("false write response, pause",i._readableState.awaitDrain);i._readableState.awaitDrain++;i.pause()}}function g(t){u("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 m(){e.removeListener("finish",v);y()}e.once("close",m);function v(){u("onfinish");e.removeListener("close",m);y()}e.once("finish",v);function y(){u("unpipe");i.unpipe(e)}e.emit("pipe",i);if(!a.flowing){u("pipe resume");i.resume()}return e};function E(e){return function(){var t=e._readableState;u("pipeOnDrain",t.awaitDrain);if(t.awaitDrain)t.awaitDrain--;if(t.awaitDrain===0&&o.listenerCount(e,"data")){t.flowing=true;A(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(){u("readable nexttick read 0");o.read(0)})}else if(i.length){_(this,i)}}}return n};l.prototype.addListener=l.prototype.on;l.prototype.resume=function(){var e=this._readableState;if(!e.flowing){u("resume");e.flowing=true;if(!e.reading){u("resume read 0");this.read(0)}x(this,e)}return this};function x(e,t){if(!t.resumeScheduled){t.resumeScheduled=true;r.nextTick(function(){S(e,t)})}}function S(e,t){t.resumeScheduled=false;e.emit("resume");A(e);if(t.flowing&&!t.reading)e.read(0)}l.prototype.pause=function(){u("call pause flowing=%j",this._readableState.flowing);if(false!==this._readableState.flowing){u("pause");this._readableState.flowing=false;this.emit("pause")}return this};function A(e){var t=e._readableState;u("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(){u("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){u("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"];C(o,function(t){e.on(t,n.emit.bind(n,t))});n._read=function(t){u("wrapped _read",t);if(r){r=false;e.resume()}};return n};l._fromList=I;function I(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 u=0;for(var c=0,l=r.length;c<l&&u<e;c++){var f=r[0];var h=Math.min(e-u,f.length);if(o)s+=f.slice(0,h);else f.copy(s,u,0,h);if(h<f.length)r[0]=f.slice(h);else r.shift();u+=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 C(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":58,_process:52,buffer:45,"core-util-is":63,events:49,inherits:116,isarray:50,stream:68,"string_decoder/":69,util:44}],61:[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":58,"core-util-is":63,inherits:116}],62:[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){m(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 u(e,t,n){var i=new Error("write after end");e.emit("error",i);r.nextTick(function(){n(i)})}function c(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)u(this,n,r);else if(c(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)_(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 m(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){_(e,n)}if(i){r.nextTick(function(){v(e,n,a,o)})}else{v(e,n,a,o)}}}function v(e,t,r,n){if(!r)y(e,t);t.pendingcb--;n();k(e,t)}function y(e,t){if(t.length===0&&t.needDrain){t.needDrain=false;e.emit("drain")}}function _(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)E(this,n,r)};function w(e,t){return t.ending&&t.length===0&&!t.finished&&!t.writing}function b(e,t){if(!t.prefinished){t.prefinished=true;e.emit("prefinish")}}function k(e,t){var r=w(e,t);if(r){if(t.pendingcb===0){b(e,t);t.finished=true;e.emit("finish")}else b(e,t)}return r}function E(e,t,n){t.ending=true;k(e,t);if(n){if(t.finished)r.nextTick(n);else e.once("finish",n)}t.ended=true}}).call(this,e("_process"))},{"./_stream_duplex":58,_process:52,buffer:45,"core-util-is":63,inherits:116,stream:68}],63:[function(e,t,r){arguments[4][39][0].apply(r,arguments)},{buffer:45,dup:39}],64:[function(e,t,r){t.exports=e("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":59}],65:[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":58,"./lib/_stream_passthrough.js":59,"./lib/_stream_readable.js":60,"./lib/_stream_transform.js":61,"./lib/_stream_writable.js":62,stream:68}],66:[function(e,t,r){t.exports=e("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":61}],67:[function(e,t,r){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":62}],68:[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 u(e){c();if(n.listenerCount(this,"error")===0){throw e}}r.on("error",u);e.on("error",u);function c(){r.removeListener("data",i);e.removeListener("drain",o);r.removeListener("end",s);r.removeListener("close",f);r.removeListener("error",u);e.removeListener("error",u);r.removeListener("end",c);r.removeListener("close",c);e.removeListener("close",c)}r.on("end",c);r.on("close",c);e.on("close",c);e.emit("pipe",r);return e}},{events:49,inherits:116,"readable-stream/duplex.js":57,"readable-stream/passthrough.js":64,"readable-stream/readable.js":65,"readable-stream/transform.js":66,"readable-stream/writable.js":67}],69:[function(e,t,r){arguments[4][41][0].apply(r,arguments)},{buffer:45,dup:41}],70:[function(e,t,r){var n=e("punycode");r.parse=_;r.resolve=b;r.resolveObject=k;r.format=w;r.Url=i;function i(){this.protocol=null;this.slashes=null;this.auth=null;this.host=null;this.port=null;this.hostname=null;this.hash=null;this.search=null;this.query=null;this.pathname=null;this.path=null;this.href=null}var o=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,s=["<",">",'"',"`"," ","\r","\n"," "],f=["{","}","|","\\","^","`"].concat(s),u=["'"].concat(f),c=["%","/","?",";","#"].concat(u),l=["/","?","#"],h=255,d=/^[a-z0-9A-Z_-]{0,63}$/,p=/^([a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:true,"javascript:":true},m={javascript:true,"javascript:":true},v={http:true,https:true,ftp:true,gopher:true,file:true,"http:":true,"https:":true,"ftp:":true,"gopher:":true,"file:":true},y=e("querystring");function _(e,t,r){if(e&&x(e)&&e instanceof i)return e;var n=new i;n.parse(e,t,r);return n}i.prototype.parse=function(e,t,r){if(!E(e)){throw new TypeError("Parameter 'url' must be a string, not "+typeof e)}var i=e;i=i.trim();var a=o.exec(i);if(a){a=a[0];var s=a.toLowerCase();this.protocol=s;i=i.substr(a.length)}if(r||a||i.match(/^\/\/[^@\/]+@[^@\/]+/)){var f=i.substr(0,2)==="//";if(f&&!(a&&m[a])){i=i.substr(2);this.slashes=true}}if(!m[a]&&(f||a&&!v[a])){var _=-1;for(var w=0;w<l.length;w++){var b=i.indexOf(l[w]);if(b!==-1&&(_===-1||b<_))_=b}var k,x;if(_===-1){x=i.lastIndexOf("@")}else{x=i.lastIndexOf("@",_)}if(x!==-1){k=i.slice(0,x);i=i.slice(x+1);this.auth=decodeURIComponent(k)}_=-1;for(var w=0;w<c.length;w++){var b=i.indexOf(c[w]);if(b!==-1&&(_===-1||b<_))_=b}if(_===-1)_=i.length;this.host=i.slice(0,_);i=i.slice(_);this.parseHost();this.hostname=this.hostname||"";var S=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!S){var A=this.hostname.split(/\./);for(var w=0,I=A.length;w<I;w++){var T=A[w];if(!T)continue;if(!T.match(d)){var C="";for(var L=0,B=T.length;L<B;L++){if(T.charCodeAt(L)>127){C+="x"}else{C+=T[L]}}if(!C.match(d)){var R=A.slice(0,w);var M=A.slice(w+1);var P=T.match(p);if(P){R.push(P[1]);M.unshift(P[2])}if(M.length){i="/"+M.join(".")+i}this.hostname=R.join(".");break}}}}if(this.hostname.length>h){this.hostname=""}else{this.hostname=this.hostname.toLowerCase()}if(!S){var j=this.hostname.split(".");var U=[];for(var w=0;w<j.length;++w){var O=j[w];U.push(O.match(/[^A-Za-z0-9_-]/)?"xn--"+n.encode(O):O)}this.hostname=U.join(".")}var H=this.port?":"+this.port:"";var D=this.hostname||"";this.host=D+H;this.href+=this.host;if(S){this.hostname=this.hostname.substr(1,this.hostname.length-2);if(i[0]!=="/"){i="/"+i}}}if(!g[s]){for(var w=0,I=u.length;w<I;w++){var N=u[w];var q=encodeURIComponent(N);if(q===N){q=escape(N)}i=i.split(N).join(q)}}var z=i.indexOf("#");if(z!==-1){this.hash=i.substr(z);i=i.slice(0,z)}var W=i.indexOf("?");if(W!==-1){this.search=i.substr(W);this.query=i.substr(W+1);if(t){this.query=y.parse(this.query)}i=i.slice(0,W)}else if(t){this.search="";this.query={}}if(i)this.pathname=i;if(v[s]&&this.hostname&&!this.pathname){this.pathname="/"}if(this.pathname||this.search){var H=this.pathname||"";var O=this.search||"";this.path=H+O}this.href=this.format();return this};function w(e){if(E(e))e=_(e);if(!(e instanceof i))return i.prototype.format.call(e);return e.format()}i.prototype.format=function(){var e=this.auth||"";if(e){e=encodeURIComponent(e);e=e.replace(/%3A/i,":");e+="@"}var t=this.protocol||"",r=this.pathname||"",n=this.hash||"",i=false,o="";if(this.host){i=e+this.host}else if(this.hostname){i=e+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]");if(this.port){i+=":"+this.port}}if(this.query&&x(this.query)&&Object.keys(this.query).length){o=y.stringify(this.query)}var a=this.search||o&&"?"+o||"";if(t&&t.substr(-1)!==":")t+=":";if(this.slashes||(!t||v[t])&&i!==false){i="//"+(i||"");if(r&&r.charAt(0)!=="/")r="/"+r}else if(!i){i=""}if(n&&n.charAt(0)!=="#")n="#"+n;if(a&&a.charAt(0)!=="?")a="?"+a;r=r.replace(/[?#]/g,function(e){return encodeURIComponent(e)});a=a.replace("#","%23");return t+i+r+a+n};function b(e,t){return _(e,false,true).resolve(t)}i.prototype.resolve=function(e){return this.resolveObject(_(e,false,true)).format()};function k(e,t){if(!e)return t;return _(e,false,true).resolveObject(t)}i.prototype.resolveObject=function(e){if(E(e)){var t=new i;t.parse(e,false,true);e=t}var r=new i;Object.keys(this).forEach(function(e){r[e]=this[e]},this);r.hash=e.hash;if(e.href===""){r.href=r.format();return r}if(e.slashes&&!e.protocol){Object.keys(e).forEach(function(t){if(t!=="protocol")r[t]=e[t]});if(v[r.protocol]&&r.hostname&&!r.pathname){r.path=r.pathname="/"}r.href=r.format();return r}if(e.protocol&&e.protocol!==r.protocol){if(!v[e.protocol]){Object.keys(e).forEach(function(t){r[t]=e[t]});r.href=r.format();return r}r.protocol=e.protocol;if(!e.host&&!m[e.protocol]){var n=(e.pathname||"").split("/");while(n.length&&!(e.host=n.shift()));if(!e.host)e.host="";if(!e.hostname)e.hostname="";if(n[0]!=="")n.unshift("");if(n.length<2)n.unshift("");r.pathname=n.join("/")}else{r.pathname=e.pathname}r.search=e.search;r.query=e.query;r.host=e.host||"";r.auth=e.auth;r.hostname=e.hostname||e.host;r.port=e.port;if(r.pathname||r.search){var o=r.pathname||"";var a=r.search||"";r.path=o+a}r.slashes=r.slashes||e.slashes;r.href=r.format();return r}var s=r.pathname&&r.pathname.charAt(0)==="/",f=e.host||e.pathname&&e.pathname.charAt(0)==="/",u=f||s||r.host&&e.pathname,c=u,l=r.pathname&&r.pathname.split("/")||[],n=e.pathname&&e.pathname.split("/")||[],h=r.protocol&&!v[r.protocol];if(h){r.hostname="";r.port=null;if(r.host){if(l[0]==="")l[0]=r.host;else l.unshift(r.host)}r.host="";if(e.protocol){e.hostname=null;e.port=null;if(e.host){if(n[0]==="")n[0]=e.host;else n.unshift(e.host)}e.host=null}u=u&&(n[0]===""||l[0]==="")}if(f){r.host=e.host||e.host===""?e.host:r.host;r.hostname=e.hostname||e.hostname===""?e.hostname:r.hostname;r.search=e.search;r.query=e.query;l=n}else if(n.length){if(!l)l=[];l.pop();l=l.concat(n);r.search=e.search;r.query=e.query}else if(!A(e.search)){if(h){r.hostname=r.host=l.shift();var d=r.host&&r.host.indexOf("@")>0?r.host.split("@"):false;if(d){r.auth=d.shift();r.host=r.hostname=d.shift()}}r.search=e.search;r.query=e.query;if(!S(r.pathname)||!S(r.search)){r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")}r.href=r.format();return r}if(!l.length){r.pathname=null;if(r.search){r.path="/"+r.search}else{r.path=null}r.href=r.format();return r}var p=l.slice(-1)[0];var g=(r.host||e.host)&&(p==="."||p==="..")||p==="";var y=0;for(var _=l.length;_>=0;_--){p=l[_];if(p=="."){l.splice(_,1)}else if(p===".."){l.splice(_,1);y++}else if(y){l.splice(_,1);y--}}if(!u&&!c){for(;y--;y){l.unshift("..")}}if(u&&l[0]!==""&&(!l[0]||l[0].charAt(0)!=="/")){l.unshift("")}if(g&&l.join("/").substr(-1)!=="/"){l.push("")}var w=l[0]===""||l[0]&&l[0].charAt(0)==="/";if(h){r.hostname=r.host=w?"":l.length?l.shift():"";var d=r.host&&r.host.indexOf("@")>0?r.host.split("@"):false;if(d){r.auth=d.shift();r.host=r.hostname=d.shift()}}u=u||r.host&&l.length;if(u&&!w){l.unshift("")}if(!l.length){r.pathname=null;r.path=null}else{r.pathname=l.join("/")}if(!S(r.pathname)||!S(r.search)){r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")}r.auth=e.auth||r.auth;r.slashes=r.slashes||e.slashes;r.href=r.format();return r};i.prototype.parseHost=function(){var e=this.host;var t=a.exec(e);if(t){t=t[0];if(t!==":"){this.port=t.substr(1)}e=e.substr(0,e.length-t.length)}if(e)this.hostname=e};function E(e){return typeof e==="string"}function x(e){return typeof e==="object"&&e!==null}function S(e){return e===null}function A(e){return e==null}},{punycode:53,querystring:56}],71:[function(e,t,r){(function(r){t.exports=m;t.exports.announceList=[["udp://tracker.publicbt.com:80"],["udp://tracker.openbittorrent.com:80"],["udp://open.demonii.com:1337"],["udp://tracker.webtorrent.io:80"],["wss://tracker.webtorrent.io"]];t.exports.parseInput=v;var n=e("bencode");var i=e("block-stream2");var o=e("piece-length");var a=e("path");var s=e("dezalgo");var f=e("filestream/read");var u=e("flatten");var c=e("fs");var l=e("multistream");var h=e("once");var d=e("run-parallel");var p=e("simple-sha1");var g=e("stream");function m(e,t,r){if(typeof t==="function"){r=t;t={}}if(!t)t={};v(e,t,function(e,n){if(e)return r(e);E(n,t,r)})}function v(e,t,n){if(typeof t==="function"){n=t;t={}}if(!t)t={};n=s(n);if(Array.isArray(e)&&e.length===0)throw new Error("invalid input type");if(A(e))e=Array.prototype.slice.call(e);if(!Array.isArray(e))e=[e];if(!t.name)t.name=e[0]&&e[0].name;if(!t.name)t.name=typeof e[0]==="string"&&a.basename(e[0]);if(t.name===undefined){throw new Error("missing option 'name' and unable to infer it from input[0].name")}if(e.length===1&&!e[0].name)e[0].name=t.name;var i=e.reduce(function(e,t){return e+Number(typeof t==="string")},0);d(e.map(function(e){return function(n){var o={};if(S(e)){o.getStream=T(e);o.length=e.size}else if(r.isBuffer(e)){o.getStream=C(e);o.length=e.length}else if(I(e)){if(!t.pieceLength){throw new Error("must specify `pieceLength` option if input is Stream")}o.getStream=B(e,o);o.length=0}else if(typeof e==="string"){if(typeof c.readdir!=="function"){throw new Error("filesystem paths do not work in the browser")}var s=i>1;y(e,s,n);return}else{throw new Error("invalid input type")}if(!e.name)throw new Error("missing requied `name` property on input");o.path=e.name.split(a.sep);n(null,o)}}),function(e,t){if(e)return n(e);t=u(t);n(null,t)})}function y(e,t,r){w(_,e,function(n,i){if(n)return r(n);if(Array.isArray(i))i=u(i);else i=[i];var o=a.normalize(e);if(t||i.length===1){o=o.slice(0,o.lastIndexOf(a.sep)+1)}else{if(o[o.length-1]!==a.sep)o+=a.sep}i.forEach(function(e){e.getStream=L(e.path);e.path=e.path.replace(o,"").split(a.sep)});r(null,i)})}function _(e,t){t=h(t);c.stat(e,function(r,n){if(r)return t(r);var i={length:n.size,path:e};t(null,i)})}function w(e,t,r){c.readdir(t,function(n,i){if(n&&n.code==="ENOTDIR"){e(t,r)}else if(n){r(n)}else{d(i.filter(b).map(function(r){return function(n){w(e,a.join(t,r),n)}}),r)}})}function b(e){return e[0]!=="."}function k(e,t,n){n=h(n);var o=[];var a=0;var s=e.map(function(e){return e.getStream});var f=0;var u=0;var c=false;var d=new l(s);var g=new i(t,{zeroPadding:false});d.on("error",y);d.pipe(g).on("data",m).on("end",v).on("error",y);function m(e){a+=e.length;var t=u;p(e,function(e){o[t]=e;f-=1;w()});f+=1;u+=1}function v(){c=true;w()}function y(e){_();n(e)}function _(){d.removeListener("error",y);g.removeListener("data",m);g.removeListener("end",v);g.removeListener("error",y)}function w(){if(c&&f===0){_();n(null,new r(o.join(""),"hex"),a)}}}function E(e,r,i){var a=r.announceList!==undefined?r.announceList:r.announce!==undefined?r.announce.map(function(e){return[e]}):t.exports.announceList;var s={info:{name:r.name},announce:a[0][0],"announce-list":a,"creation date":Number(r.creationDate)||Date.now(),encoding:"UTF-8"};if(r.comment!==undefined)s.info.comment=r.comment;if(r.createdBy!==undefined)s.info["created by"]=r.createdBy;if(r.private!==undefined)s.info.private=Number(r.private);if(r.sslCert!==undefined)s.info["ssl-cert"]=r.sslCert;if(r.urlList!==undefined)s["url-list"]=r.urlList;var f=e.length===1;var u=r.pieceLength||o(e.reduce(x,0));s.info["piece length"]=u;k(e,u,function(t,r,o){if(t)return i(t);s.info.pieces=r;e.forEach(function(e){delete e.getStream});if(!f){s.info.files=e}else{s.info.length=o}i(null,n.encode(s))})}function x(e,t){return e+t.length}function S(e){return typeof Blob!=="undefined"&&e instanceof Blob}function A(e){return typeof FileList==="function"&&e instanceof FileList}function I(e){return typeof e==="object"&&typeof e.pipe==="function"}function T(e){return function(){return new f(e)}}function C(e){return function(){var t=new g.PassThrough;t.end(e);return t}}function L(e){return function(){return c.createReadStream(e)}}function B(e,t){return function(){var r=new g.Transform;r._transform=function(e,r,n){t.length+=e.length;this.push(e);n()};e.pipe(r);return r}}}).call(this,e("buffer").Buffer)},{bencode:72,"block-stream2":76,buffer:45,dezalgo:88,"filestream/read":94,flatten:95,fs:43,multistream:96,once:99,path:51,"piece-length":100,"run-parallel":102,"simple-sha1":106,stream:68}],72:[function(e,t,r){arguments[4][13][0].apply(r,arguments)},{"./lib/decode":73,"./lib/encode":75,dup:13}],73:[function(e,t,r){arguments[4][14][0].apply(r,arguments)},{"./dict":74,buffer:45,dup:14}],74:[function(e,t,r){arguments[4][15][0].apply(r,arguments)},{dup:15}],75:[function(e,t,r){arguments[4][16][0].apply(r,arguments)},{buffer:45,dup:16}],76:[function(e,t,r){arguments[4][32][0].apply(r,arguments)},{buffer:45,defined:77,dup:32,inherits:78,"readable-stream":87}],77:[function(e,t,r){arguments[4][33][0].apply(r,arguments)},{dup:33}],78:[function(e,t,r){arguments[4][21][0].apply(r,arguments)},{dup:21}],79:[function(e,t,r){arguments[4][34][0].apply(r,arguments)},{"./_stream_readable":81,"./_stream_writable":83,_process:52,"core-util-is":84,dup:34,inherits:78}],80:[function(e,t,r){arguments[4][35][0].apply(r,arguments)},{"./_stream_transform":82,"core-util-is":84,dup:35,inherits:78}],81:[function(e,t,r){arguments[4][36][0].apply(r,arguments)},{_process:52,buffer:45,"core-util-is":84,dup:36,events:49,inherits:78,isarray:85,stream:68,"string_decoder/":86}],82:[function(e,t,r){arguments[4][37][0].apply(r,arguments)},{"./_stream_duplex":79,"core-util-is":84,dup:37,inherits:78}],83:[function(e,t,r){arguments[4][38][0].apply(r,arguments)},{"./_stream_duplex":79,_process:52,buffer:45,"core-util-is":84,dup:38,inherits:78,stream:68}],84:[function(e,t,r){arguments[4][39][0].apply(r,arguments)},{buffer:45,dup:39}],85:[function(e,t,r){arguments[4][40][0].apply(r,arguments)},{dup:40}],86:[function(e,t,r){arguments[4][41][0].apply(r,arguments)},{buffer:45,dup:41}],87:[function(e,t,r){arguments[4][42][0].apply(r,arguments)},{"./lib/_stream_duplex.js":79,"./lib/_stream_passthrough.js":80,"./lib/_stream_readable.js":81,"./lib/_stream_transform.js":82,"./lib/_stream_writable.js":83,dup:42,stream:68}],88:[function(e,t,r){arguments[4][27][0].apply(r,arguments)},{asap:89,dup:27,wrappy:90}],89:[function(e,t,r){arguments[4][28][0].apply(r,arguments)},{_process:52,dup:28}],90:[function(e,t,r){arguments[4][29][0].apply(r,arguments)},{dup:29}],91:[function(e,t,r){arguments[4][21][0].apply(r,arguments)},{dup:21}],92:[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:45,"is-typedarray":93}],93:[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 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 Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function s(e){return i[n.call(e)]}},{}],94:[function(e,t,r){var n=e("stream").Readable;var i=e("inherits");var o=/^.*\.(\w+)$/;var a=e("typedarray-to-buffer");function s(e,t){var r=this;if(!(this instanceof s)){return new s(e,t)}t=t||{};n.call(this,t);this._offset=0;this._ready=false;this._file=e;this._size=e.size;this._chunkSize=t.chunkSize||Math.max(this._size/1e3,200*1024);this.reader=new FileReader;this._generateHeaderBlocks(e,t,function(e,t){if(e){return r.emit("error",e)}if(Array.isArray(t)){t.forEach(function(e){r.push(e)})}r._ready=true;r.emit("_ready")})}i(s,n);t.exports=s;s.prototype._generateHeaderBlocks=function(e,t,r){r(null,[])};s.prototype._read=function(){if(!this._ready){this.once("_ready",this._read.bind(this));return}var e=this;var t=this.reader;var r=this._offset;var n=this._offset+this._chunkSize;if(n>this._size)n=this._size;if(r===this._size){this.destroy();this.push(null);return}t.onload=function(){e._offset=n;e.push(a(t.result))};t.onerror=function(){e.emit("error",t.error)};t.readAsArrayBuffer(this._file.slice(r,n))};s.prototype.destroy=function(){this._file=null;if(this.reader){this.reader.onload=null;this.reader.onerror=null;try{this.reader.abort()}catch(e){}}this.reader=null}},{inherits:91,stream:68,"typedarray-to-buffer":92}],95:[function(e,t,r){t.exports=function n(e,t){t=typeof t=="number"?t:Infinity;return r(e,1);function r(e,n){return e.reduce(function(e,i){if(Array.isArray(i)&&n<t){return e.concat(r(i,n+1))}else{return e.concat(i)}},[])}}},{}],96:[function(e,t,r){t.exports=o;var n=e("inherits");var i=e("stream");n(o,i.Readable);function o(e,t){if(!(this instanceof o))return new o(e,t);i.Readable.call(this,t);this.destroyed=false;this._drained=false;this._forwarding=false;this._current=null;this._queue=e.map(a);this._next()}o.obj=function(e){return new o(e,{objectMode:true,highWaterMark:16})};o.prototype._read=function(){this._drained=true;this._forward()};o.prototype._forward=function(){if(this._forwarding||!this._drained)return;this._forwarding=true;var e;while((e=this._current.read())!==null){this._drained=this.push(e)}this._forwarding=false};o.prototype.destroy=function(e){if(this.destroyed)return;this.destroyed=true;if(this._current&&this._current.destroy)this._current.destroy();this._queue.forEach(function(e){if(e.destroy)e.destroy()});if(e)this.emit("error",e);this.emit("close")};o.prototype._next=function(){var e=this;var t=e._queue.shift();if(typeof t==="function")t=a(t());if(!t){e.destroy();e.push(null);return}e._current=t;t.on("readable",r);t.on("end",i);t.on("error",o);t.on("close",n);function r(){e._forward()}function n(){if(!t._readableState.ended){e.destroy()}}function i(){e._current=null;t.removeListener("readable",r);t.removeListener("end",i);t.removeListener("error",o);t.removeListener("close",n);e._next()}function o(t){e.destroy(t)}};function a(e){if(!e||typeof e==="function"||e._readableState)return e;var t=(new i.Readable).wrap(e);if(e.destroy){t.destroy=e.destroy.bind(e)}return t}},{inherits:97,stream:68}],97:[function(e,t,r){arguments[4][21][0].apply(r,arguments)},{dup:21}],98:[function(e,t,r){arguments[4][29][0].apply(r,arguments)},{dup:29}],99:[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:98}],100:[function(e,t,r){var n=e("closest-to");var i=[];for(var o=14;o<=22;o++){i.push(Math.pow(2,o))}t.exports=function(e){return n(e/Math.pow(2,10),i)}},{"closest-to":101}],101:[function(e,t,r){t.exports=function(e,t){var r=Infinity;var n=0;var i=null;t.sort(function(e,t){return e-t});for(var o=0,a=t.length;o<a;o++){n=Math.abs(e-t[o]);if(n>=r){break}r=n;i=t[o]}return i}},{}],102:[function(e,t,r){var n=e("dezalgo");t.exports=function(e,t){if(t)t=n(t);var r,i,o;if(Array.isArray(e)){r=[];i=e.length}else{o=Object.keys(e);r={};i=o.length}function a(e,n,o){r[e]=o;if(--i===0||n){if(t)t(n,r);t=null}}if(!i){if(t)t(null,r);t=null}else if(o){o.forEach(function(t){e[t](a.bind(undefined,t))})}else{e.forEach(function(e,t){e(a.bind(undefined,t))})}}},{dezalgo:103}],103:[function(e,t,r){arguments[4][27][0].apply(r,arguments)},{asap:104,dup:27,wrappy:105}],104:[function(e,t,r){arguments[4][28][0].apply(r,arguments)},{_process:52,dup:28}],105:[function(e,t,r){arguments[4][29][0].apply(r,arguments)},{dup:29}],106:[function(e,t,r){var n=e("rusha");var i=new n;var o=window.crypto||window.msCrypto||{};var a=o.subtle||o.webkitSubtle;var s=i.digest.bind(i);try{a.digest({name:"sha-1"},new Uint8Array).catch(function(){a=false})}catch(f){a=false}function u(e,t){if(!a){setTimeout(t,0,s(e));return}if(typeof e==="string"){e=c(e)}a.digest({name:"sha-1"},e).then(function r(e){t(l(new Uint8Array(e)))},function n(r){t(s(e))})}function c(e){var t=e.length;var r=new Uint8Array(t);for(var n=0;n<t;n++){r[n]=e.charCodeAt(n)}return r}function l(e){var t=e.length;var r=[];for(var n=0;n<t;n++){var i=e[n];r.push((i>>>4).toString(16));r.push((i&15).toString(16))}return r.join("")}t.exports=u;t.exports.sync=s},{rusha:107}],107:[function(e,t,r){(function(e){(function(){if(typeof t!=="undefined"){t.exports=o}else if(typeof window!=="undefined"){window.Rusha=o}if(typeof FileReaderSync!=="undefined"){var r=new FileReaderSync,n=new o(4*1024*1024);self.onmessage=function s(e){var t,r=e.data.data;try{t=n.digest(r);self.postMessage({id:e.data.id,hash:t})}catch(i){self.postMessage({id:e.data.id,error:i.name})}}}var i={getDataType:function(t){if(typeof t==="string"){return"string"}if(t instanceof Array){return"array"}if(typeof e!=="undefined"&&e.Buffer&&e.Buffer.isBuffer(t)){return"buffer"}if(t instanceof ArrayBuffer){return"arraybuffer"}if(t.buffer instanceof ArrayBuffer){return"view"}if(t instanceof Blob){return"blob"}throw new Error("Unsupported data type.")}};function o(e){"use strict";var t={fill:0};var n=function(e){for(e+=9;e%64>0;e+=1);return e};var o=function(e,t){for(var r=t>>2;r<e.length;r++)e[r]=0};var s=function(e,t,r){e[t>>2]|=128<<24-(t%4<<3);e[((t>>2)+2&~15)+14]=r>>29;e[((t>>2)+2&~15)+15]=r<<3};var f=function(e,t,r,n,i){var o=this,a,s=i%4,f=n%4,u=n-f;if(u>0){switch(s){case 0:e[i+3|0]=o.charCodeAt(r);case 1:e[i+2|0]=o.charCodeAt(r+1);case 2:e[i+1|0]=o.charCodeAt(r+2);case 3:e[i|0]=o.charCodeAt(r+3)}}for(a=s;a<u;a=a+4|0){t[i+a>>2]=o.charCodeAt(r+a)<<24|o.charCodeAt(r+a+1)<<16|o.charCodeAt(r+a+2)<<8|o.charCodeAt(r+a+3)}switch(f){case 3:e[i+u+1|0]=o.charCodeAt(r+u+2);case 2:e[i+u+2|0]=o.charCodeAt(r+u+1);case 1:e[i+u+3|0]=o.charCodeAt(r+u)}};var u=function(e,t,r,n,i){var o=this,a,s=i%4,f=n%4,u=n-f;if(u>0){switch(s){case 0:e[i+3|0]=o[r];case 1:e[i+2|0]=o[r+1];case 2:e[i+1|0]=o[r+2];case 3:e[i|0]=o[r+3]}}for(a=4-s;a<u;a=a+=4|0){t[i+a>>2]=o[r+a]<<24|o[r+a+1]<<16|o[r+a+2]<<8|o[r+a+3]}switch(f){case 3:e[i+u+1|0]=o[r+u+2];case 2:e[i+u+2|0]=o[r+u+1];case 1:e[i+u+3|0]=o[r+u]}};var c=function(e,t,n,i,o){var a=this,s,f=o%4,u=i%4,c=i-u;var l=new Uint8Array(r.readAsArrayBuffer(a.slice(n,n+i)));if(c>0){switch(f){case 0:e[o+3|0]=l[0];case 1:e[o+2|0]=l[1];case 2:e[o+1|0]=l[2];case 3:e[o|0]=l[3]}}for(s=4-f;s<c;s=s+=4|0){t[o+s>>2]=l[s]<<24|l[s+1]<<16|l[s+2]<<8|l[s+3]}switch(u){case 3:e[o+c+1|0]=l[c+2];case 2:e[o+c+2|0]=l[c+1];case 1:e[o+c+3|0]=l[c]}};var l=function(e){switch(i.getDataType(e)){case"string":return f.bind(e);case"array":return u.bind(e);case"buffer":return u.bind(e);case"arraybuffer":return u.bind(new Uint8Array(e));case"view":return u.bind(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));case"blob":return c.bind(e)}};var h=function(e,t){switch(i.getDataType(e)){case"string":return e.slice(t);case"array":return e.slice(t);case"buffer":return e.slice(t);case"arraybuffer":return e.slice(t);case"view":return e.buffer.slice(t)}};var d=function(e){var t,r,n="0123456789abcdef",i=[],o=new Uint8Array(e);for(t=0;t<o.length;t++){r=o[t];i[t]=n.charAt(r>>4&15)+n.charAt(r>>0&15)}return i.join("")};var p=function(e){var t;if(e<=65536)return 65536;if(e<16777216){for(t=1;t<e;t=t<<1);}else{for(t=16777216;t<e;t+=16777216);}return t};var g=function(e){if(e%64>0){throw new Error("Chunk size must be a multiple of 128 bit")}t.maxChunkLen=e;t.padMaxChunkLen=n(e);t.heap=new ArrayBuffer(p(t.padMaxChunkLen+320+20));
t.h32=new Int32Array(t.heap);t.h8=new Int8Array(t.heap);t.core=a({Int32Array:Int32Array,DataView:DataView},{},t.heap);t.buffer=null};g(e||64*1024);var m=function(e,t){var r=new Int32Array(e,t+320,5);r[0]=1732584193;r[1]=-271733879;r[2]=-1732584194;r[3]=271733878;r[4]=-1009589776};var v=function(e,r){var i=n(e);var a=new Int32Array(t.heap,0,i>>2);o(a,e);s(a,e,r);return i};var y=function(e,r,n){l(e)(t.h8,t.h32,r,n,0)};var _=function(e,r,n,i,o){var a=n;if(o){a=v(n,i)}y(e,r,n);t.core.hash(a,t.padMaxChunkLen)};var w=function(e,t){var r=new Int32Array(e,t+320,5);var n=new Int32Array(5);var i=new DataView(n.buffer);i.setInt32(0,r[0],false);i.setInt32(4,r[1],false);i.setInt32(8,r[2],false);i.setInt32(12,r[3],false);i.setInt32(16,r[4],false);return n};var b=this.rawDigest=function(e){var r=e.byteLength||e.length||e.size||0;m(t.heap,t.padMaxChunkLen);var n=0,i=t.maxChunkLen,o;for(n=0;r>n+i;n+=i){_(e,n,i,r,false)}_(e,n,r-n,r,true);return w(t.heap,t.padMaxChunkLen)};this.digest=this.digestFromString=this.digestFromBuffer=this.digestFromArrayBuffer=function(e){return d(b(e).buffer)}}function a(e,t,r){"use asm";var n=new e.Int32Array(r);function i(e,t){e=e|0;t=t|0;var r=0,i=0,o=0,a=0,s=0,f=0,u=0,c=0,l=0,h=0,d=0,p=0,g=0,m=0;o=n[t+320>>2]|0;s=n[t+324>>2]|0;u=n[t+328>>2]|0;l=n[t+332>>2]|0;d=n[t+336>>2]|0;for(r=0;(r|0)<(e|0);r=r+64|0){a=o;f=s;c=u;h=l;p=d;for(i=0;(i|0)<64;i=i+4|0){m=n[r+i>>2]|0;g=((o<<5|o>>>27)+(s&u|~s&l)|0)+((m+d|0)+1518500249|0)|0;d=l;l=u;u=s<<30|s>>>2;s=o;o=g;n[e+i>>2]=m}for(i=e+64|0;(i|0)<(e+80|0);i=i+4|0){m=(n[i-12>>2]^n[i-32>>2]^n[i-56>>2]^n[i-64>>2])<<1|(n[i-12>>2]^n[i-32>>2]^n[i-56>>2]^n[i-64>>2])>>>31;g=((o<<5|o>>>27)+(s&u|~s&l)|0)+((m+d|0)+1518500249|0)|0;d=l;l=u;u=s<<30|s>>>2;s=o;o=g;n[i>>2]=m}for(i=e+80|0;(i|0)<(e+160|0);i=i+4|0){m=(n[i-12>>2]^n[i-32>>2]^n[i-56>>2]^n[i-64>>2])<<1|(n[i-12>>2]^n[i-32>>2]^n[i-56>>2]^n[i-64>>2])>>>31;g=((o<<5|o>>>27)+(s^u^l)|0)+((m+d|0)+1859775393|0)|0;d=l;l=u;u=s<<30|s>>>2;s=o;o=g;n[i>>2]=m}for(i=e+160|0;(i|0)<(e+240|0);i=i+4|0){m=(n[i-12>>2]^n[i-32>>2]^n[i-56>>2]^n[i-64>>2])<<1|(n[i-12>>2]^n[i-32>>2]^n[i-56>>2]^n[i-64>>2])>>>31;g=((o<<5|o>>>27)+(s&u|s&l|u&l)|0)+((m+d|0)-1894007588|0)|0;d=l;l=u;u=s<<30|s>>>2;s=o;o=g;n[i>>2]=m}for(i=e+240|0;(i|0)<(e+320|0);i=i+4|0){m=(n[i-12>>2]^n[i-32>>2]^n[i-56>>2]^n[i-64>>2])<<1|(n[i-12>>2]^n[i-32>>2]^n[i-56>>2]^n[i-64>>2])>>>31;g=((o<<5|o>>>27)+(s^u^l)|0)+((m+d|0)-899497514|0)|0;d=l;l=u;u=s<<30|s>>>2;s=o;o=g;n[i>>2]=m}o=o+a|0;s=s+f|0;u=u+c|0;l=l+h|0;d=d+p|0}n[t+320>>2]=o;n[t+324>>2]=s;n[t+328>>2]=u;n[t+332>>2]=l;n[t+336>>2]=d}return{hash:i}}})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],108:[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":109}],109:[function(e,t,r){arguments[4][19][0].apply(r,arguments)},{dup:19,ms:110}],110:[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?c(e):u(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 u(e){if(e>=a)return Math.round(e/a)+"d";if(e>=o)return Math.round(e/o)+"h";if(e>=i)return Math.round(e/i)+"m";if(e>=n)return Math.round(e/n)+"s";return e+"ms"}function c(e){return l(e,a,"day")||l(e,o,"hour")||l(e,i,"minute")||l(e,n,"second")||e+" ms"}function l(e,t,r){if(e<t)return;if(e<t*1.5)return Math.floor(e/t)+" "+r;return Math.ceil(e/t)+" "+r+"s"}},{}],111:[function(e,t,r){arguments[4][27][0].apply(r,arguments)},{asap:112,dup:27,wrappy:113}],112:[function(e,t,r){arguments[4][28][0].apply(r,arguments)},{_process:52,dup:28}],113:[function(e,t,r){arguments[4][29][0].apply(r,arguments)},{dup:29}],114:[function(e,t,r){var n=e("once");var i=function(){};var o=function(e){return e.setHeader&&typeof e.abort==="function"};var a=function(e){return e.stdio&&Array.isArray(e.stdio)&&e.stdio.length===3};var s=function(e,t,r){if(typeof t==="function")return s(e,null,t);if(!t)t={};r=n(r||i);var f=e._writableState;var u=e._readableState;var c=t.readable||t.readable!==false&&e.readable;var l=t.writable||t.writable!==false&&e.writable;var h=function(){if(!e.writable)d()};var d=function(){l=false;if(!c)r()};var p=function(){c=false;if(!l)r()};var g=function(e){r(e?new Error("exited with error code: "+e):null)};var m=function(){if(c&&!(u&&u.ended))return r(new Error("premature close"));if(l&&!(f&&f.ended))return r(new Error("premature close"))};var v=function(){e.req.on("finish",d)};if(o(e)){e.on("complete",d);e.on("abort",m);if(e.req)v();else e.on("request",v)}else if(l&&!f){e.on("end",h);e.on("close",h)}if(a(e))e.on("exit",g);e.on("end",p);e.on("finish",d);if(t.error!==false)e.on("error",r);e.on("close",m);return function(){e.removeListener("complete",d);e.removeListener("abort",m);e.removeListener("request",v);if(e.req)e.req.removeListener("finish",d);e.removeListener("end",h);e.removeListener("close",h);e.removeListener("finish",d);e.removeListener("exit",g);e.removeListener("end",p);e.removeListener("error",r);e.removeListener("close",m)}};t.exports=s},{once:120}],115:[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 u=parseInt(a,t);if(u!==Infinity&&u>=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}},{}],116:[function(e,t,r){arguments[4][21][0].apply(r,arguments)},{dup:21}],117:[function(e,t,r){arguments[4][96][0].apply(r,arguments)},{dup:96,inherits:118,stream:68}],118:[function(e,t,r){arguments[4][21][0].apply(r,arguments)},{dup:21}],119:[function(e,t,r){arguments[4][29][0].apply(r,arguments)},{dup:29}],120:[function(e,t,r){arguments[4][99][0].apply(r,arguments)},{dup:99,wrappy:119}],121:[function(e,t,r){(function(r){var n=e("magnet-uri");var i=e("parse-torrent-file");t.exports=function o(e){var t=e&&e.length;if(typeof e==="string"&&/magnet:/.test(e)){return n(e)}else if(typeof e==="string"&&(t===40||t===32)){return n("magnet:?xt=urn:btih:"+e)}else if(r.isBuffer(e)&&t===20){return n("magnet:?xt=urn:btih:"+e.toString("hex"))}else if(r.isBuffer(e)){return i(e)}else if(e&&e.infoHash){return e}else{throw new Error("Invalid torrent identifier")}};t.exports.toMagnetURI=n.encode;t.exports.toTorrentFile=i.encode}).call(this,e("buffer").Buffer)},{buffer:45,"magnet-uri":122,"parse-torrent-file":127}],122:[function(e,t,r){(function(r){t.exports=a;t.exports.decode=a;t.exports.encode=s;var n=e("thirty-two");var i=e("xtend");var o=e("uniq");function a(e){var t={};var i=e.split("magnet:?")[1];var a=i&&i.length>=0?i.split("&"):[];a.forEach(function(e){var r=e.split("=");if(r.length!==2)return;var n=r[0];var i=r[1];if(n==="dn")i=decodeURIComponent(i).replace(/\+/g," ");if(n==="tr"||n==="xs"||n==="as"||n==="ws"){i=decodeURIComponent(i)}if(n==="kt")i=decodeURIComponent(i).split("+");if(t[n]){if(Array.isArray(t[n])){t[n].push(i)}else{var o=t[n];t[n]=[o,i]}}else{t[n]=i}});var s;if(t.xt){var f=Array.isArray(t.xt)?t.xt:[t.xt];f.forEach(function(e){if(s=e.match(/^urn:btih:(.{40})/)){t.infoHash=new r(s[1],"hex").toString("hex")}else if(s=e.match(/^urn:btih:(.{32})/)){var i=n.decode(s[1]);t.infoHash=new r(i,"binary").toString("hex")}})}if(t.dn)t.name=t.dn;if(t.kt)t.keywords=t.kt;if(typeof t.tr==="string")t.announce=[t.tr];else if(Array.isArray(t.tr))t.announce=t.tr;else t.announce=[];o(t.announce);t.urlList=[];if(typeof t.as==="string"||Array.isArray(t.as)){t.urlList=t.urlList.concat(t.as)}if(typeof t.ws==="string"||Array.isArray(t.ws)){t.urlList=t.urlList.concat(t.ws)}return t}function s(e){e=i(e);if(e.infoHash)e.xt="urn:btih:"+e.infoHash;if(e.name)e.dn=e.name;if(e.keywords)e.kt=e.keywords;if(e.announce)e.tr=e.announce;if(e.urlList){e.ws=e.urlList;delete e.as}var t="magnet:?";Object.keys(e).filter(function(e){return e.length===2}).forEach(function(r,n){var i=Array.isArray(e[r])?e[r]:[e[r]];i.forEach(function(e,i){if((n>0||i>0)&&(r!=="kt"||i===0))t+="&";if(r==="dn")e=encodeURIComponent(e).replace(/%20/g,"+");if(r==="tr"||r==="xs"||r==="as"||r==="ws"){e=encodeURIComponent(e)}if(r==="kt")e=encodeURIComponent(e);if(r==="kt"&&i>0)t+="+"+e;else t+=r+"="+e})});return t}}).call(this,e("buffer").Buffer)},{buffer:45,"thirty-two":123,uniq:125,xtend:126}],123:[function(e,t,r){var n=e("./thirty-two");r.encode=n.encode;r.decode=n.decode},{"./thirty-two":124}],124:[function(e,t,r){(function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";var n=[255,255,26,27,28,29,30,31,255,255,255,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255,255,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,255,255,255,255,255];function i(e){var t=Math.floor(e.length/5);return e.length%5==0?t:t+1}r.encode=function(r){var n=0;var o=0;var a=0;var s=0;var f=new e(i(r)*8);if(!e.isBuffer(r)){r=new e(r)}while(n<r.length){var u=r[n];if(a>3){s=u&255>>a;a=(a+5)%8;s=s<<a|(n+1<r.length?r[n+1]:0)>>8-a;n++}else{s=u>>8-(a+5)&31;a=(a+5)%8;if(a==0)n++}f[o]=t.charCodeAt(s);o++}for(n=o;n<f.length;n++)f[n]=61;return f};r.decode=function(t){var r=0;var i=0;var o;var a=0;if(!e.isBuffer(t)){t=new e(t)}var s=new e(Math.ceil(t.length*5/8));for(var f=0;f<t.length;f++){if(t[f]==61){break}var u=t[f]-48;if(u<n.length){i=n[u];if(r<=3){r=(r+5)%8;if(r==0){o|=i;s[a]=o;a++;o=0}else{o|=255&i<<8-r}}else{r=(r+5)%8;o|=255&i>>>r;s[a]=o;a++;o=255&i<<8-r}}else{throw new Error("Invalid input - it is not base32 encoded string")}}return s.slice(0,a)}}).call(this,e("buffer").Buffer)},{buffer:45}],125:[function(e,t,r){"use strict";function n(e,t){var r=1,n=e.length,i=e[0],o=e[0];for(var a=1;a<n;++a){o=i;i=e[a];if(t(i,o)){if(a===r){r++;continue}e[r++]=i}}e.length=r;return e}function i(e){var t=1,r=e.length,n=e[0],i=e[0];for(var o=1;o<r;++o,i=n){i=n;n=e[o];if(n!==i){if(o===t){t++;continue}e[t++]=n}}e.length=t;return e}function o(e,t,r){if(e.length===0){return e}if(t){if(!r){e.sort(t)}return n(e,t)}if(!r){e.sort()}return i(e)}t.exports=o},{}],126:[function(e,t,r){arguments[4][23][0].apply(r,arguments)},{dup:23}],127:[function(e,t,r){(function(r){t.exports=s;t.exports.decode=s;t.exports.encode=f;var n=e("bencode");var i=e("path");var o=e("simple-sha1");var a=e("uniq");function s(e){if(r.isBuffer(e)){e=n.decode(e)}l(e.info,"info");l(e.info.name,"info.name");l(e.info["piece length"],"info['piece length']");l(e.info.pieces,"info.pieces");if(e.info.files){e.info.files.forEach(function(e){l(typeof e.length==="number","info.files[0].length");l(e.path,"info.files[0].path")})}else{l(typeof e.info.length==="number","info.length")}var t={};t.info=e.info;t.infoBuffer=n.encode(e.info);t.infoHash=o.sync(t.infoBuffer);t.name=e.info.name.toString();t.private=!!e.info.private;if(e["creation date"])t.created=new Date(e["creation date"]*1e3);if(r.isBuffer(e.comment))t.comment=e.comment.toString();t.announce=[];if(e["announce-list"]){e["announce-list"].forEach(function(e){e.forEach(function(e){t.announce.push(e.toString())})})}else if(e.announce){t.announce.push(e.announce)}a(t.announce);if(r.isBuffer(e["url-list"])){e["url-list"]=e["url-list"].length>0?[e["url-list"]]:[]}t.urlList=(e["url-list"]||[]).map(function(e){return e.toString()});var s=e.info.files||[e.info];t.files=s.map(function(e,r){var n=[].concat(e.name||t.name,e.path||[]).map(function(e){return e.toString()});return{path:i.join.apply(null,[i.sep].concat(n)).slice(1),name:n[n.length-1],length:e.length,offset:s.slice(0,r).reduce(u,0)}});t.length=s.reduce(u,0);var f=t.files[t.files.length-1];t.pieceLength=e.info["piece length"];t.lastPieceLength=(f.offset+f.length)%t.pieceLength||t.pieceLength;t.pieces=c(e.info.pieces);return t}function f(e){var t={info:e.info};t["announce-list"]=e.announce.map(function(e){if(!t.announce)t.announce=e;e=new r(e,"utf8");return[e]});if(e.created){t["creation date"]=e.created.getTime()/1e3|0}return n.encode(t)}function u(e,t){return e+t.length}function c(e){var t=[];for(var r=0;r<e.length;r+=20){t.push(e.slice(r,r+20).toString("hex"))}return t}function l(e,t){if(!e)throw new Error("Torrent is missing required field: "+t)}}).call(this,e("buffer").Buffer)},{bencode:128,buffer:45,path:51,"simple-sha1":132,uniq:134}],128:[function(e,t,r){arguments[4][13][0].apply(r,arguments)},{"./lib/decode":129,"./lib/encode":131,dup:13}],129:[function(e,t,r){arguments[4][14][0].apply(r,arguments)},{"./dict":130,buffer:45,dup:14}],130:[function(e,t,r){arguments[4][15][0].apply(r,arguments)},{dup:15}],131:[function(e,t,r){arguments[4][16][0].apply(r,arguments)},{buffer:45,dup:16}],132:[function(e,t,r){arguments[4][106][0].apply(r,arguments)},{dup:106,rusha:133}],133:[function(e,t,r){arguments[4][107][0].apply(r,arguments)},{dup:107}],134:[function(e,t,r){arguments[4][125][0].apply(r,arguments)},{dup:125}],135:[function(e,t,r){t.exports=i;t.exports.filter=o;var n=e("events").EventEmitter;function i(e,t,r){if(!Array.isArray(r))r=[r];var n=[];r.forEach(function(r){var i=function(){var e=[].slice.call(arguments);e.unshift(r);t.emit.apply(t,e)};n.push(i);e.on(r,i)});return function i(){r.forEach(function(t,r){e.removeListener(t,n[r])})}}function o(e,t){var r=new n;i(e,r,t);return r}},{events:49}],136:[function(e,t,r){arguments[4][102][0].apply(r,arguments)},{dezalgo:137,dup:102}],137:[function(e,t,r){arguments[4][27][0].apply(r,arguments)},{asap:138,dup:27,wrappy:139}],138:[function(e,t,r){arguments[4][28][0].apply(r,arguments)},{_process:52,dup:28}],139:[function(e,t,r){arguments[4][29][0].apply(r,arguments)},{dup:29}],140:[function(e,t,r){arguments[4][106][0].apply(r,arguments)},{dup:106,rusha:141}],141:[function(e,t,r){arguments[4][107][0].apply(r,arguments)},{dup:107}],142:[function(e,t,r){arguments[4][22][0].apply(r,arguments)},{dup:22}],143:[function(e,t,r){(function(r){t.exports=c;var n=e("debug")("torrent-discovery");var i=e("bittorrent-dht/client");var o=e("events").EventEmitter;var a=e("xtend/mutable");var s=e("inherits");var f=e("re-emitter");var u=e("bittorrent-tracker/client");s(c,o);function c(e){var t=this;if(!(t instanceof c))return new c(e);o.call(t);a(t,{announce:[],dht:typeof i==="function",rtcConfig:null,peerId:null,port:0,tracker:true,wrtc:null},e);t._externalDHT=typeof t.dht==="object";t._performedDHTLookup=false;if(!t.peerId)throw new Error("peerId required");if(!r.browser&&!t.port)throw new Error("port required");if(t.dht)t._createDHT(t.dhtPort)}c.prototype.setTorrent=function(e){var t=this;if(t.torrent)return;if(e&&e.infoHash){t.torrent=e;t.infoHash=e.infoHash}else{if(t.infoHash)return;t.infoHash=e}n("setTorrent %s",t.infoHash);if(t.tracker&&t.tracker!==true){t.tracker.torrentLength=e.length}else{t._createTracker()}if(t.dht){if(t.dht.ready)t._dhtLookupAndAnnounce();else t.dht.on("ready",t._dhtLookupAndAnnounce.bind(t))}};c.prototype.stop=function(e){var t=this;if(t.tracker){if(t.tracker.stop)t.tracker.stop();if(t.tracker.destroy)t.tracker.destroy()}if(!t._externalDHT&&t.dht&&t.dht.destroy)t.dht.destroy(e);else r.nextTick(function(){e(null)})};c.prototype._createDHT=function(e){var t=this;if(!t._externalDHT)t.dht=new i;f(t.dht,t,["error","warning"]);t.dht.on("peer",function(e,r){if(r===t.infoHash)t.emit("peer",e)});if(!t._externalDHT)t.dht.listen(e)};c.prototype._createTracker=function(){var e=this;if(!e.tracker)return;var t=e.torrent||{infoHash:e.infoHash,announce:e.announce};var r={rtcConfig:e.rtcConfig,wrtc:e.wrtc};e.tracker=new u(e.peerId,e.port,t,r);f(e.tracker,e,["peer","warning","error"]);e.tracker.start()};c.prototype._dhtLookupAndAnnounce=function(){var e=this;if(e._performedDHTLookup)return;e._performedDHTLookup=true;n("dht lookup");e.dht.lookup(e.infoHash,function(t){if(t||!e.port)return;n("dht announce");e.dht.announce(e.infoHash,e.port,function(){n("dht announce complete");e.emit("dhtAnnounce")})})}}).call(this,e("_process"))},{_process:52,"bittorrent-dht/client":44,"bittorrent-tracker/client":144,debug:174,events:49,inherits:177,"re-emitter":178,"xtend/mutable":179}],144:[function(e,t,r){(function(r){t.exports=h;var n=e("debug")("bittorrent-tracker");var i=e("events").EventEmitter;var o=e("inherits");var a=e("once");var s=e("url");var f=e("./lib/common");var u=e("./lib/http-tracker");var c=e("./lib/udp-tracker");var l=e("./lib/websocket-tracker");o(h,i);function h(e,t,o,a){var d=this;if(!(d instanceof h))return new h(e,t,o,a);i.call(d);if(!a)a={};d._peerId=r.isBuffer(e)?e:new r(e,"hex");d._peerIdHex=d._peerId.toString("hex");d._peerIdBinary=d._peerId.toString("binary");d._infoHash=r.isBuffer(o.infoHash)?o.infoHash:new r(o.infoHash,"hex");d._infoHashHex=d._infoHash.toString("hex");d._infoHashBinary=d._infoHash.toString("binary");d._port=t;d.torrentLength=o.length;d._rtcConfig=a.rtcConfig;d._wrtc=a.wrtc;d._numWant=a.numWant||f.DEFAULT_ANNOUNCE_PEERS;d._intervalMs=a.interval||f.DEFAULT_ANNOUNCE_INTERVAL;n("new client %s",d._infoHashHex);var p={interval:d._intervalMs};var g=!!d._wrtc||typeof window!=="undefined";var m=typeof o.announce==="string"?[o.announce]:o.announce==null?[]:o.announce;d._trackers=m.map(function(e){e=e.toString();var t=s.parse(e).protocol;if((t==="http:"||t==="https:")&&typeof u==="function"){return new u(d,e,p)}else if(t==="udp:"&&typeof c==="function"){return new c(d,e,p)}else if((t==="ws:"||t==="wss:")&&g){return new l(d,e,p)}return null}).filter(Boolean)}h.scrape=function(e,t,n){n=a(n);var i=new r("01234567890123456789");var o=6881;var s={infoHash:Array.isArray(t)?t[0]:t,announce:[e]};var f=new h(i,o,s);f.once("error",n);var u=Array.isArray(t)?t.length:1;var c={};f.on("scrape",function(e){u-=1;c[e.infoHash]=e;if(u===0){f.destroy();var t=Object.keys(c);if(t.length===1){n(null,c[t[0]])}else{n(null,c)}}});t=Array.isArray(t)?t.map(function(e){return new r(e,"hex")}):new r(t,"hex");f.scrape({infoHash:t})};h.prototype.start=function(e){var t=this;n("send `start`");e=t._defaultAnnounceOpts(e);e.event="started";t._announce(e);t._trackers.forEach(function(e){e.setInterval(t._intervalMs)})};h.prototype.stop=function(e){var t=this;n("send `stop`");e=t._defaultAnnounceOpts(e);e.event="stopped";t._announce(e)};h.prototype.complete=function(e){var t=this;n("send `complete`");if(!e)e={};if(e.downloaded==null&&t.torrentLength!=null){e.downloaded=t.torrentLength}e=t._defaultAnnounceOpts(e);e.event="completed";t._announce(e)};h.prototype.update=function(e){var t=this;n("send `update`");e=t._defaultAnnounceOpts(e);if(e.event)delete e.event;t._announce(e)};h.prototype._announce=function(e){var t=this;t._trackers.forEach(function(t){t.announce(e)})};h.prototype.scrape=function(e){var t=this;n("send `scrape`");if(!e)e={};t._trackers.forEach(function(t){t.scrape(e)})};h.prototype.setInterval=function(e){var t=this;n("setInterval");t._intervalMs=e;t._trackers.forEach(function(t){t.setInterval(e)})};h.prototype.destroy=function(){var e=this;n("destroy");e._trackers.forEach(function(e){e.destroy();e.setInterval(0)});e._trackers=[]};h.prototype._defaultAnnounceOpts=function(e){var t=this;if(!e)e={};if(e.numWant==null)e.numWant=t._numWant;if(e.uploaded==null)e.uploaded=0;if(e.downloaded==null)e.downloaded=0;if(e.left==null&&t.torrentLength!=null){e.left=t.torrentLength-e.downloaded}return e}}).call(this,e("buffer").Buffer)},{"./lib/common":146,"./lib/http-tracker":44,"./lib/udp-tracker":44,"./lib/websocket-tracker":147,buffer:45,debug:148,events:49,inherits:152,once:154,url:70}],145:[function(e,t,r){(function(t){var n=e("querystring");r.IPV4_RE=/^[\d\.]+$/;r.IPV6_RE=/^[\da-fA-F:]+$/;r.CONNECTION_ID=t.concat([i(1047),i(655366528)]);r.ACTIONS={CONNECT:0,ANNOUNCE:1,SCRAPE:2,ERROR:3};r.EVENTS={update:0,completed:1,started:2,stopped:3};r.EVENT_IDS={0:"update",1:"completed",2:"started",3:"stopped"};r.EVENT_NAMES={update:"update",completed:"complete",started:"start",stopped:"stop"};function i(e){var r=new t(4);r.writeUInt32BE(e,0);return r}r.toUInt32=i;r.querystringParse=function(e){var t=n.unescape;n.unescape=unescape;var r=n.parse(e);n.unescape=t;return r};r.querystringStringify=function(e){var t=n.escape;n.escape=escape;var r=n.stringify(e);r=r.replace(/[\@\*\/\+]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()});n.escape=t;return r}}).call(this,e("buffer").Buffer)},{buffer:45,querystring:56}],146:[function(e,t,r){(function(t){var n=e("xtend/mutable");r.DEFAULT_ANNOUNCE_INTERVAL=30*60*1e3;r.DEFAULT_ANNOUNCE_PEERS=50;r.MAX_ANNOUNCE_PEERS=82;r.binaryToHex=function(e){return new t(e,"binary").toString("hex")};r.hexToBinary=function(e){return new t(e,"hex").toString("binary")};var i=e("./common-node");n(r,i)}).call(this,e("buffer").Buffer)},{"./common-node":145,buffer:45,"xtend/mutable":173}],147:[function(e,t,r){t.exports=h;var n=e("debug")("bittorrent-tracker:websocket-tracker");var i=e("events").EventEmitter;var o=e("hat");var a=e("inherits");var s=e("simple-peer");var f=e("simple-websocket");var u=e("./common");var c=30*1e3;var l=5*1e3;a(h,i);function h(e,t,r){var a=this;i.call(a);n("new websocket tracker %s",t);a.client=e;a.destroyed=false;a._opts=r;a._announceUrl=t;if(a._announceUrl[a._announceUrl.length-1]!=="/")a._announceUrl+="/";a._announceUrl+="?"+o(40);a._peers={};a._socket=null;a._intervalMs=a.client._intervalMs;a._interval=null;a._openSocket()}h.prototype.announce=function(e){var t=this;if(!t._socket.connected){return t._socket.once("connect",t.announce.bind(t,e))}e.info_hash=t.client._infoHashBinary;e.peer_id=t.client._peerIdBinary;if(e.numWant>10)e.numWant=10;t._generateOffers(e.numWant,function(r){e.offers=r;if(t._trackerId){e.trackerid=t._trackerId}t._send(e)})};h.prototype.scrape=function(e){var t=this;t._onSocketError(new Error("scrape not supported "+t._announceUrl))};h.prototype.setInterval=function(e){var t=this;clearInterval(t._interval);t._intervalMs=e;if(e){var r=t.announce.bind(t,t.client._defaultAnnounceOpts());t._interval=setInterval(r,t._intervalMs)}};h.prototype.destroy=function(){var e=this;if(e.destroyed)return;e.destroyed=true;e._socket.removeListener("data",e._onSocketDataBound);e._socket.removeListener("close",e._onSocketCloseBound);e._socket.removeListener("error",e._onSocketErrorBound);e._onSocketErrorBound=null;e._onSocketDataBound=null;e._onSocketCloseBound=null;e._socket.on("error",d);try{e._socket.close()}catch(t){}e._socket=null};h.prototype._openSocket=function(){var e=this;e._onSocketErrorBound=e._onSocketError.bind(e);e._onSocketDataBound=e._onSocketData.bind(e);e._onSocketCloseBound=e._onSocketClose.bind(e);e._socket=new f(e._announceUrl);e._socket.on("data",e._onSocketDataBound);e._socket.on("close",e._onSocketCloseBound);e._socket.on("error",e._onSocketErrorBound)};h.prototype._onSocketData=function(e){var t=this;if(t.destroyed)return;if(!(typeof e==="object"&&e!==null)){return t.client.emit("warning",new Error("Invalid tracker response"))}if(e.info_hash!==t.client._infoHashBinary){return t.client.emit("warning",new Error("Invalid tracker response"))}n("received %s from %s",JSON.stringify(e),t._announceUrl);var r=e["failure reason"];if(r)return t.client.emit("warning",new Error(r));var i=e["warning message"];if(i)t.client.emit("warning",new Error(i));var o=e.interval||e["min interval"];if(o&&!t._opts.interval&&t._intervalMs!==0){t.setInterval(o*1e3)}var a=e["tracker id"];if(a){t._trackerId=a}if(e.complete){t.client.emit("update",{announce:t._announceUrl,complete:e.complete,incomplete:e.incomplete})}if(t.client._peerIdHex===u.binaryToHex(e.peer_id)){return}var f;if(e.offer){f=new s({trickle:false,config:t.client._rtcConfig,wrtc:t.client._wrtc});f.id=u.binaryToHex(e.peer_id);f.once("signal",function(r){var n={info_hash:t.client._infoHashBinary,peer_id:t.client._peerIdBinary,to_peer_id:e.peer_id,answer:r,offer_id:e.offer_id};if(t._trackerId)n.trackerid=t._trackerId;t._send(n)});f.signal(e.offer);t.client.emit("peer",f)}if(e.answer){f=t._peers[u.binaryToHex(e.offer_id)];if(f){f.id=u.binaryToHex(e.peer_id);f.signal(e.answer);t.client.emit("peer",f)}else{n("got unexpected answer: "+JSON.stringify(e.answer))}}};h.prototype._onSocketClose=function(){var e=this;e.destroy();var t=Math.floor(Math.random()*c)+l;setTimeout(function(){e._openSocket()},t);n("reconnecting socket in %s ms",t)};h.prototype._onSocketError=function(e){var t=this;if(t.destroyed)return;t.client.emit("error",e)};h.prototype._send=function(e){var t=this;if(t.destroyed)return;var r=JSON.stringify(e);n("send %s",r);t._socket.send(r)};h.prototype._generateOffers=function(e,t){var r=this;var i=[];n("generating %s offers",e);for(var a=0;a<e;++a){f()}function f(){var e=o(160);var t=r._peers[e]=new s({initiator:true,trickle:false,config:r.client._rtcConfig,wrtc:r.client._wrtc});t.once("signal",function(t){i.push({offer:t,offer_id:u.hexToBinary(e)});c()})}function c(){if(i.length===e){n("generated %s offers",e);t(i)}}};function d(){}},{"./common":146,debug:148,events:49,hat:151,inherits:152,"simple-peer":155,"simple-websocket":165}],148:[function(e,t,r){arguments[4][18][0].apply(r,arguments)},{"./debug":149,dup:18}],149:[function(e,t,r){arguments[4][19][0].apply(r,arguments)},{dup:19,ms:150}],150:[function(e,t,r){arguments[4][20][0].apply(r,arguments)},{dup:20}],151:[function(e,t,r){arguments[4][115][0].apply(r,arguments)},{dup:115}],152:[function(e,t,r){arguments[4][21][0].apply(r,arguments)},{dup:21}],153:[function(e,t,r){arguments[4][29][0].apply(r,arguments)},{dup:29}],154:[function(e,t,r){arguments[4][99][0].apply(r,arguments)},{dup:99,wrappy:153}],155:[function(e,t,r){(function(r){t.exports=c;var n=e("debug")("simple-peer");var i=e("hat");var o=e("inherits");var a=e("is-typedarray");var s=e("once");var f=e("stream");var u=e("typedarray-to-buffer");o(c,f.Duplex);function c(e){var t=this;if(!(t instanceof c))return new c(e);t._debug("new peer %o",e);if(!e)e={};e.allowHalfOpen=false;if(e.highWaterMark==null)e.highWaterMark=1024*1024;f.Duplex.call(t,e);t.initiator=e.initiator||false;t.channelConfig=e.channelConfig||c.channelConfig;t.channelName=e.channelName||i(160);if(!e.initiator)t.channelName=null;t.config=e.config||c.config;t.constraints=e.constraints||c.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||l();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._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=s(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)})}})}c.WEBRTC_SUPPORT=!!l();c.config={iceServers:[{url:"stun:23.21.150.121",urls:"stun:23.21.150.121"}]};c.constraints={};c.channelConfig={};Object.defineProperty(c.prototype,"bufferSize",{get:function(){var e=this;return e._channel&&e._channel.bufferedAmount||0}});c.prototype.address=function(){var e=this;return{port:e.localPort,family:"IPv4",address:e.localAddress}};c.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()");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._onError.bind(t))}if(e.candidate){try{t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e.candidate),d,t._onError.bind(t))}catch(r){t._destroy(new Error("error adding candidate: "+r.message))}}if(!e.sdp&&!e.candidate){t._destroy(new Error("signal() called with invalid signal data"))}};c.prototype.send=function(e){var t=this;if(!a.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)&&!a.strict(e)){e=new Uint8Array(e)}var n=e.length||e.byteLength||e.size;t._channel.send(e);t._debug("write: %d bytes",n)};c.prototype.destroy=function(e){var t=this;t._destroy(null,e)};c.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")};c.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)};c.prototype._read=function(){};c.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){n.send(e);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}};c.prototype._createOffer=function(){var e=this;if(e.destroyed)return;e._pc.createOffer(function(t){if(e.destroyed)return;h(t);t.sdp=e.sdpTransform(t.sdp);e._pc.setLocalDescription(t,d,e._onError.bind(e));var r=function(){e._debug("signal");e.emit("signal",e._pc.localDescription||t)};if(e.trickle||e._iceComplete)r();else e.once("_iceComplete",r)},e._onError.bind(e),e.offerConstraints)};c.prototype._createAnswer=function(){var e=this;if(e.destroyed)return;e._pc.createAnswer(function(t){if(e.destroyed)return;h(t);t.sdp=e.sdpTransform(t.sdp);e._pc.setLocalDescription(t,d,e._onError.bind(e));var r=function(){e._debug("signal");e.emit("signal",e._pc.localDescription||t)};if(e.trickle||e._iceComplete)r();else e.once("_iceComplete",r)},e._onError.bind(e),e.answerConstraints)};c.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()}};c.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){e.send(e._chunk);e._chunk=null;e._debug('sent chunk from "write before connect"');var r=e._cb;e._cb=null;r(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")}};c.prototype._onSignalingStateChange=function(){var e=this;if(e.destroyed)return;e._debug("signalingStateChange %s",e._pc.signalingState);e.emit("signalingStateChange",e._pc.signalingState)};c.prototype._onIceCandidate=function(e){var t=this;if(t.destroyed)return;if(e.candidate&&t.trickle){t.emit("signal",{candidate:e.candidate})}else if(!e.candidate){t._iceComplete=true;t.emit("_iceComplete")}};c.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)}};c.prototype._onChannelOpen=function(){var e=this;if(e.connected||e.destroyed)return;e._debug("on channel open");e._channelReady=true;e._maybeReady()};c.prototype._onChannelClose=function(){var e=this;if(e.destroyed)return;e._debug("on channel close");e._destroy()};c.prototype._onAddStream=function(e){var t=this;if(t.destroyed)return;t._debug("on add stream");t.emit("stream",e.stream)};c.prototype._onError=function(e){var t=this;if(t.destroyed)return;t._debug("error %s",e.message||e);t._destroy(e)};c.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 l(){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}function h(e){var t=e.sdp.split("b=AS:30");if(t.length>1)e.sdp=t[0]+"b=AS:1638400"+t[1]}function d(){}}).call(this,e("buffer").Buffer)},{buffer:45,debug:156,hat:159,inherits:160,"is-typedarray":161,once:163,stream:68,"typedarray-to-buffer":164}],156:[function(e,t,r){arguments[4][108][0].apply(r,arguments)},{"./debug":157,dup:108}],157:[function(e,t,r){arguments[4][19][0].apply(r,arguments)},{dup:19,ms:158}],158:[function(e,t,r){arguments[4][110][0].apply(r,arguments)},{dup:110}],159:[function(e,t,r){arguments[4][115][0].apply(r,arguments)},{dup:115}],160:[function(e,t,r){arguments[4][21][0].apply(r,arguments)},{dup:21}],161:[function(e,t,r){arguments[4][93][0].apply(r,arguments)},{dup:93}],162:[function(e,t,r){arguments[4][29][0].apply(r,arguments)},{dup:29}],163:[function(e,t,r){arguments[4][99][0].apply(r,arguments)},{dup:99,wrappy:162}],164:[function(e,t,r){arguments[4][92][0].apply(r,arguments)},{buffer:45,dup:92,"is-typedarray":161}],165:[function(e,t,r){(function(r){t.exports=c;var n=e("debug")("simple-websocket");var i=e("inherits");var o=e("is-typedarray");var a=e("stream");var s=e("typedarray-to-buffer");var f=e("ws");var u=typeof window!=="undefined"?window.WebSocket:f;i(c,a.Duplex);function c(e,t){var r=this;if(!(r instanceof c))return new c(e,t);if(!t)t={};n("new websocket: %s %o",e,t);t.allowHalfOpen=false;if(t.highWaterMark==null)t.highWaterMark=1024*1024;a.Duplex.call(r,t);r.url=e;r.connected=false;r.destroyed=false;r._maxBufferedAmount=t.highWaterMark;r._chunk=null;r._cb=null;r._interval=null;r._ws=new u(r.url);r._ws.binaryType="arraybuffer";r._ws.onopen=r._onOpen.bind(r);r._ws.onmessage=r._onMessage.bind(r);r._ws.onclose=r._onClose.bind(r);r._ws.onerror=r._onError.bind(r);r.on("finish",function(){if(r.connected){setTimeout(function(){r._destroy()},100)}else{r.once("connect",function(){setTimeout(function(){r._destroy()},100)})}})}c.prototype.send=function(e){var t=this;if(!o.strict(e)&&!(e instanceof ArrayBuffer)&&!r.isBuffer(e)&&typeof e!=="string"&&(typeof Blob==="undefined"||!(e instanceof Blob))){e=JSON.stringify(e)}var i=e.length||e.byteLength||e.size;t._ws.send(e);n("write: %d bytes",i)};c.prototype.destroy=function(e){var t=this;t._destroy(null,e)};c.prototype._destroy=function(e,t){var r=this;if(r.destroyed)return;if(t)r.once("close",t);n("destroy (error: %s)",e&&e.message);this.readable=this.writable=false;if(!r._readableState.ended)r.push(null);if(!r._writableState.finished)r.end();r.connected=false;r.destroyed=true;clearInterval(r._interval);r._interval=null;r._chunk=null;r._cb=null;if(r._ws){try{r._ws.close()}catch(e){}r._ws.onopen=null;r._ws.onmessage=null;r._ws.onclose=null;r._ws.onerror=null}r._ws=null;if(e)r.emit("error",e);r.emit("close")};c.prototype._read=function(){};c.prototype._write=function(e,t,r){var i=this;if(i.destroyed)return r(new Error("cannot write after socket is destroyed"));if(i.connected){i.send(e);if(typeof f!=="function"&&i._ws.bufferedAmount>i._maxBufferedAmount){n("start backpressure: bufferedAmount %d",i._ws.bufferedAmount);i._cb=r}else{r(null)}}else{n("write before connect");i._chunk=e;i._cb=r}};c.prototype._onMessage=function(e){var t=this;if(t.destroyed)return;var i=e.data;n("read: %d bytes",i.byteLength||i.length);if(i instanceof ArrayBuffer){i=s(new Uint8Array(i));t.push(i)}else if(r.isBuffer(i)){t.push(i)}else{try{i=JSON.parse(i)}catch(o){}t.emit("data",i)}};c.prototype._onOpen=function(){var e=this;if(e.connected||e.destroyed)return;e.connected=true;if(e._chunk){e.send(e._chunk);e._chunk=null;n('sent chunk from "write before connect"');var t=e._cb;e._cb=null;t(null)}if(typeof f!=="function"){e._interval=setInterval(function(){if(!e._cb||!e._ws||e._ws.bufferedAmount>e._maxBufferedAmount){return}n("ending backpressure: bufferedAmount %d",e._ws.bufferedAmount);var t=e._cb;e._cb=null;t(null)},150);if(e._interval.unref)e._interval.unref()}n("connect");e.emit("connect")};c.prototype._onClose=function(){var e=this;if(e.destroyed)return;n("on close");e._destroy()};c.prototype._onError=function(){var e=this;if(e.destroyed)return;var t=new Error("connection error to "+e.url);n("error: %s",t.message||t);e._destroy(t)}}).call(this,e("buffer").Buffer)},{buffer:45,debug:166,inherits:169,"is-typedarray":170,stream:68,"typedarray-to-buffer":171,ws:44}],166:[function(e,t,r){arguments[4][18][0].apply(r,arguments)},{"./debug":167,dup:18}],167:[function(e,t,r){arguments[4][19][0].apply(r,arguments)},{dup:19,ms:168}],168:[function(e,t,r){arguments[4][20][0].apply(r,arguments)},{dup:20}],169:[function(e,t,r){arguments[4][21][0].apply(r,arguments)},{dup:21}],170:[function(e,t,r){arguments[4][93][0].apply(r,arguments)},{dup:93}],171:[function(e,t,r){arguments[4][92][0].apply(r,arguments)},{buffer:45,dup:92,"is-typedarray":172}],172:[function(e,t,r){arguments[4][93][0].apply(r,arguments)},{dup:93}],173:[function(e,t,r){t.exports=n;function n(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r){if(r.hasOwnProperty(n)){e[n]=r[n]}}}return e}},{}],174:[function(e,t,r){arguments[4][18][0].apply(r,arguments)},{"./debug":175,dup:18}],175:[function(e,t,r){arguments[4][19][0].apply(r,arguments)},{dup:19,ms:176}],176:[function(e,t,r){arguments[4][20][0].apply(r,arguments)},{dup:20}],177:[function(e,t,r){arguments[4][21][0].apply(r,arguments)},{dup:21}],178:[function(e,t,r){arguments[4][135][0].apply(r,arguments)},{dup:135,events:49}],179:[function(e,t,r){arguments[4][173][0].apply(r,arguments)},{dup:173}],180:[function(e,t,r){arguments[4][125][0].apply(r,arguments)},{dup:125}],181:[function(e,t,r){(function(r){var n=e("bencode");var i=e("bitfield");var o=e("events").EventEmitter;var a=e("inherits");var s=e("simple-sha1");var f=1e7;var u=1e3;var c=16*1024;t.exports=function(e){a(t,o);function t(t){o.call(this);this._wire=t;this._metadataComplete=false;this._metadataSize=null;this._remainingRejects=null;this._fetching=false;this._bitfield=new i(0,{grow:u});if(r.isBuffer(e)){this.setMetadata(e)}}t.prototype.name="ut_metadata";t.prototype.onHandshake=function(e,t,r){this._infoHash=e;this._infoHashHex=e.toString("hex")};t.prototype.onExtendedHandshake=function(e){if(!e.m||!e.m.ut_metadata){return this.emit("warning",new Error("Peer does not support ut_metadata"))}if(!e.metadata_size){return this.emit("warning",new Error("Peer does not have metadata"))}if(e.metadata_size>f){return this.emit("warning",new Error("Peer gave maliciously large metadata size"))}this._metadataSize=e.metadata_size;this._numPieces=Math.ceil(this._metadataSize/c);this._remainingRejects=this._numPieces*2;if(this._fetching){this._requestPieces()}};t.prototype.onMessage=function(e){var t,r;try{var i=e.toString();var o=i.indexOf("ee")+2;t=n.decode(i.substring(0,o));r=e.slice(o)}catch(a){return}switch(t.msg_type){case 0:this._onRequest(t.piece);break;case 1:this._onData(t.piece,r,t.total_size);break;case 2:this._onReject(t.piece);break}};t.prototype.fetch=function(){if(this._metadataComplete){return}this._fetching=true;if(this._metadataSize){this._requestPieces()}};t.prototype.cancel=function(){this._fetching=false};t.prototype.setMetadata=function(e){if(this._metadataComplete)return true;try{var t=n.decode(e).info;if(t){e=n.encode(t)}}catch(r){}if(this._infoHashHex&&this._infoHashHex!==s.sync(e)){return false}this.cancel();this.metadata=e;this._metadataComplete=true;this._metadataSize=this.metadata.length;this._wire.extendedHandshake.metadata_size=this._metadataSize;this.emit("metadata",n.encode({info:n.decode(this.metadata)}));return true};t.prototype._send=function(e,t){var i=n.encode(e);if(r.isBuffer(t)){i=r.concat([i,t])}this._wire.extended("ut_metadata",i)};t.prototype._request=function(e){this._send({msg_type:0,piece:e})};t.prototype._data=function(e,t,r){var n={msg_type:1,piece:e};if(typeof r==="number"){n.total_size=r}this._send(n,t)};t.prototype._reject=function(e){this._send({msg_type:2,piece:e})};t.prototype._onRequest=function(e){if(!this._metadataComplete){this._reject(e);return}var t=e*c;var r=t+c;if(r>this._metadataSize){r=this._metadataSize}var n=this.metadata.slice(t,r);this._data(e,n,this._metadataSize)};t.prototype._onData=function(e,t,r){if(t.length>c){return}t.copy(this.metadata,e*c);this._bitfield.set(e);this._checkDone()};t.prototype._onReject=function(e){if(this._remainingRejects>0&&this._fetching){this._request(e);this._remainingRejects-=1}else{this.emit("warning",new Error('Peer sent "reject" too much'))}};t.prototype._requestPieces=function(){this.metadata=new r(this._metadataSize);for(var e=0;e<this._numPieces;e++){this._request(e)}};t.prototype._checkDone=function(){var e=true;for(var t=0;t<this._numPieces;t++){if(!this._bitfield.get(t)){e=false;break}}if(!e)return;var r=this.setMetadata(this.metadata);if(!r){this._failedMetadata()}};t.prototype._failedMetadata=function(){this._bitfield=new i(0,{grow:u});this._remainingRejects-=this._numPieces;if(this._remainingRejects>0){this._requestPieces()}else{this.emit("warning",new Error("Peer sent invalid metadata"))}};return t}}).call(this,e("buffer").Buffer)},{bencode:182,bitfield:186,buffer:45,events:49,inherits:187,"simple-sha1":188}],182:[function(e,t,r){arguments[4][13][0].apply(r,arguments)},{"./lib/decode":183,"./lib/encode":185,dup:13}],183:[function(e,t,r){arguments[4][14][0].apply(r,arguments)},{"./dict":184,buffer:45,dup:14}],184:[function(e,t,r){arguments[4][15][0].apply(r,arguments)},{dup:15}],185:[function(e,t,r){arguments[4][16][0].apply(r,arguments)},{buffer:45,dup:16}],186:[function(e,t,r){arguments[4][8][0].apply(r,arguments)},{buffer:45,dup:8}],187:[function(e,t,r){arguments[4][21][0].apply(r,arguments)},{dup:21}],188:[function(e,t,r){arguments[4][106][0].apply(r,arguments)},{dup:106,rusha:189}],189:[function(e,t,r){arguments[4][107][0].apply(r,arguments)},{dup:107}],190:[function(e,t,r){arguments[4][23][0].apply(r,arguments)},{dup:23}],191:[function(e,t,r){t.exports=function n(e,t,r){if(t===undefined){return function(t,r){return n(e,t,r)}}if(r===undefined)r="0";e-=t.toString().length;if(e>0)return new Array(e+(/\./.test(t)?2:1)).join(r)+t;return t+""}},{}],192:[function(e,t,r){t.exports={name:"webtorrent",description:"Streaming torrent client",version:"0.45.0",author:{name:"Feross Aboukhadijeh",email:"feross@feross.org",url:"http://feross.org/"},bin:{webtorrent:"./bin/cmd.js"},browser:{"./lib/fs-storage":false,"./server":false,"bittorrent-dht/client":false,"load-ip-set":false,"simple-get":false,ut_pex:false},bugs:{url:"https://github.com/feross/webtorrent/issues"},dependencies:{"addr-to-ip-port":"^1.0.1",bitfield:"^1.0.2","bittorrent-dht":"^3.0.0","bittorrent-swarm":"^5.0.0","block-stream2":"^1.0.0",clivas:"^0.2.0","create-torrent":"^3.4.0",debug:"^2.1.0",dezalgo:"^1.0.1","end-of-stream":"^1.0.0",hat:"0.0.3",inherits:"^2.0.1",inquirer:"^0.8.0","load-ip-set":"^1.0.3",mime:"^1.2.11",minimist:"^1.1.0",mkdirp:"^0.5.0",moment:"^2.8.3",multistream:"^1.4.2","network-address":"^1.0.0",once:"^1.3.1","parse-torrent":"^5.0.0","pretty-bytes":"^1.0.1",pump:"^1.0.0","random-access-file":"^0.3.1","range-parser":"^1.0.2","re-emitter":"^1.0.0",rimraf:"^2.2.5","run-parallel":"^1.0.0","simple-get":"^1.0.0","simple-sha1":"^2.0.0",speedometer:"^0.1.2",thunky:"^0.1.0","torrent-discovery":"^3.0.0",uniq:"^1.0.1",ut_metadata:"^2.1.0",ut_pex:"^1.0.1","windows-no-runnable":"0.0.6",xtend:"^4.0.0","zero-fill":"^2.2.0"},devDependencies:{"bittorrent-tracker":"^4.0.0",brfs:"^1.2.0",browserify:"^10.0.0","run-auto":"^1.0.0",standard:"^3.1.1",tape:"^4.0.0","uglify-js":"^2.4.15",zelda:"^2.0.0",zuul:"^3.0.0"},homepage:"http://webtorrent.io",keywords:["torrent","bittorrent","bittorrent client","streaming","download","webrtc","webrtc data","webtorrent","mad science"],license:"MIT",main:"index.js",optionalDependencies:{"airplay-js":"^0.2.3","chromecast-js":"^0.1.4",nodebmc:"0.0.5"},repository:{type:"git",url:"git://github.com/feross/webtorrent.git"},scripts:{build:"browserify -s WebTorrent -e ./ | uglifyjs -m > webtorrent.min.js","build-debug":"browserify -s WebTorrent -e ./ > webtorrent.debug.js",size:"npm run build && cat webtorrent.min.js | gzip | wc -c",test:"standard && node ./bin/test.js","test-browser":"zuul -- test/basic.js","test-browser-local":"zuul --local -- test/basic.js","test-node":"tape test/*.js"}}},{}]},{},[1])(1)});
+t._channel.onopen=t._onChannelOpen.bind(t);t._channel.onclose=t._onChannelClose.bind(t)};c.prototype._read=function(){};c.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){n.send(e);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}};c.prototype._createOffer=function(){var e=this;if(e.destroyed)return;e._pc.createOffer(function(t){if(e.destroyed)return;h(t);t.sdp=e.sdpTransform(t.sdp);e._pc.setLocalDescription(t,d,e._onError.bind(e));var r=function(){e._debug("signal");e.emit("signal",e._pc.localDescription||t)};if(e.trickle||e._iceComplete)r();else e.once("_iceComplete",r)},e._onError.bind(e),e.offerConstraints)};c.prototype._createAnswer=function(){var e=this;if(e.destroyed)return;e._pc.createAnswer(function(t){if(e.destroyed)return;h(t);t.sdp=e.sdpTransform(t.sdp);e._pc.setLocalDescription(t,d,e._onError.bind(e));var r=function(){e._debug("signal");e.emit("signal",e._pc.localDescription||t)};if(e.trickle||e._iceComplete)r();else e.once("_iceComplete",r)},e._onError.bind(e),e.answerConstraints)};c.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()}};c.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){e.send(e._chunk);e._chunk=null;e._debug('sent chunk from "write before connect"');var r=e._cb;e._cb=null;r(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")}};c.prototype._onSignalingStateChange=function(){var e=this;if(e.destroyed)return;e._debug("signalingStateChange %s",e._pc.signalingState);e.emit("signalingStateChange",e._pc.signalingState)};c.prototype._onIceCandidate=function(e){var t=this;if(t.destroyed)return;if(e.candidate&&t.trickle){t.emit("signal",{candidate:e.candidate})}else if(!e.candidate){t._iceComplete=true;t.emit("_iceComplete")}};c.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)}};c.prototype._onChannelOpen=function(){var e=this;if(e.connected||e.destroyed)return;e._debug("on channel open");e._channelReady=true;e._maybeReady()};c.prototype._onChannelClose=function(){var e=this;if(e.destroyed)return;e._debug("on channel close");e._destroy()};c.prototype._onAddStream=function(e){var t=this;if(t.destroyed)return;t._debug("on add stream");t.emit("stream",e.stream)};c.prototype._onError=function(e){var t=this;if(t.destroyed)return;t._debug("error %s",e.message||e);t._destroy(e)};c.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 l(){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}function h(e){var t=e.sdp.split("b=AS:30");if(t.length>1)e.sdp=t[0]+"b=AS:1638400"+t[1]}function d(){}}).call(this,e("buffer").Buffer)},{buffer:45,debug:156,hat:159,inherits:160,"is-typedarray":161,once:163,stream:68,"typedarray-to-buffer":164}],156:[function(e,t,r){arguments[4][108][0].apply(r,arguments)},{"./debug":157,dup:108}],157:[function(e,t,r){arguments[4][19][0].apply(r,arguments)},{dup:19,ms:158}],158:[function(e,t,r){arguments[4][110][0].apply(r,arguments)},{dup:110}],159:[function(e,t,r){arguments[4][115][0].apply(r,arguments)},{dup:115}],160:[function(e,t,r){arguments[4][21][0].apply(r,arguments)},{dup:21}],161:[function(e,t,r){arguments[4][93][0].apply(r,arguments)},{dup:93}],162:[function(e,t,r){arguments[4][29][0].apply(r,arguments)},{dup:29}],163:[function(e,t,r){arguments[4][99][0].apply(r,arguments)},{dup:99,wrappy:162}],164:[function(e,t,r){arguments[4][92][0].apply(r,arguments)},{buffer:45,dup:92,"is-typedarray":161}],165:[function(e,t,r){(function(r){t.exports=c;var n=e("debug")("simple-websocket");var i=e("inherits");var o=e("is-typedarray");var a=e("stream");var s=e("typedarray-to-buffer");var f=e("ws");var u=typeof window!=="undefined"?window.WebSocket:f;i(c,a.Duplex);function c(e,t){var r=this;if(!(r instanceof c))return new c(e,t);if(!t)t={};n("new websocket: %s %o",e,t);t.allowHalfOpen=false;if(t.highWaterMark==null)t.highWaterMark=1024*1024;a.Duplex.call(r,t);r.url=e;r.connected=false;r.destroyed=false;r._maxBufferedAmount=t.highWaterMark;r._chunk=null;r._cb=null;r._interval=null;r._ws=new u(r.url);r._ws.binaryType="arraybuffer";r._ws.onopen=r._onOpen.bind(r);r._ws.onmessage=r._onMessage.bind(r);r._ws.onclose=r._onClose.bind(r);r._ws.onerror=r._onError.bind(r);r.on("finish",function(){if(r.connected){setTimeout(function(){r._destroy()},100)}else{r.once("connect",function(){setTimeout(function(){r._destroy()},100)})}})}c.prototype.send=function(e){var t=this;if(!o.strict(e)&&!(e instanceof ArrayBuffer)&&!r.isBuffer(e)&&typeof e!=="string"&&(typeof Blob==="undefined"||!(e instanceof Blob))){e=JSON.stringify(e)}var i=e.length||e.byteLength||e.size;t._ws.send(e);n("write: %d bytes",i)};c.prototype.destroy=function(e){var t=this;t._destroy(null,e)};c.prototype._destroy=function(e,t){var r=this;if(r.destroyed)return;if(t)r.once("close",t);n("destroy (error: %s)",e&&e.message);this.readable=this.writable=false;if(!r._readableState.ended)r.push(null);if(!r._writableState.finished)r.end();r.connected=false;r.destroyed=true;clearInterval(r._interval);r._interval=null;r._chunk=null;r._cb=null;if(r._ws){try{r._ws.close()}catch(e){}r._ws.onopen=null;r._ws.onmessage=null;r._ws.onclose=null;r._ws.onerror=null}r._ws=null;if(e)r.emit("error",e);r.emit("close")};c.prototype._read=function(){};c.prototype._write=function(e,t,r){var i=this;if(i.destroyed)return r(new Error("cannot write after socket is destroyed"));if(i.connected){i.send(e);if(typeof f!=="function"&&i._ws.bufferedAmount>i._maxBufferedAmount){n("start backpressure: bufferedAmount %d",i._ws.bufferedAmount);i._cb=r}else{r(null)}}else{n("write before connect");i._chunk=e;i._cb=r}};c.prototype._onMessage=function(e){var t=this;if(t.destroyed)return;var i=e.data;n("read: %d bytes",i.byteLength||i.length);if(i instanceof ArrayBuffer){i=s(new Uint8Array(i));t.push(i)}else if(r.isBuffer(i)){t.push(i)}else{try{i=JSON.parse(i)}catch(o){}t.emit("data",i)}};c.prototype._onOpen=function(){var e=this;if(e.connected||e.destroyed)return;e.connected=true;if(e._chunk){e.send(e._chunk);e._chunk=null;n('sent chunk from "write before connect"');var t=e._cb;e._cb=null;t(null)}if(typeof f!=="function"){e._interval=setInterval(function(){if(!e._cb||!e._ws||e._ws.bufferedAmount>e._maxBufferedAmount){return}n("ending backpressure: bufferedAmount %d",e._ws.bufferedAmount);var t=e._cb;e._cb=null;t(null)},150);if(e._interval.unref)e._interval.unref()}n("connect");e.emit("connect")};c.prototype._onClose=function(){var e=this;if(e.destroyed)return;n("on close");e._destroy()};c.prototype._onError=function(){var e=this;if(e.destroyed)return;var t=new Error("connection error to "+e.url);n("error: %s",t.message||t);e._destroy(t)}}).call(this,e("buffer").Buffer)},{buffer:45,debug:166,inherits:169,"is-typedarray":170,stream:68,"typedarray-to-buffer":171,ws:44}],166:[function(e,t,r){arguments[4][18][0].apply(r,arguments)},{"./debug":167,dup:18}],167:[function(e,t,r){arguments[4][19][0].apply(r,arguments)},{dup:19,ms:168}],168:[function(e,t,r){arguments[4][20][0].apply(r,arguments)},{dup:20}],169:[function(e,t,r){arguments[4][21][0].apply(r,arguments)},{dup:21}],170:[function(e,t,r){arguments[4][93][0].apply(r,arguments)},{dup:93}],171:[function(e,t,r){arguments[4][92][0].apply(r,arguments)},{buffer:45,dup:92,"is-typedarray":172}],172:[function(e,t,r){arguments[4][93][0].apply(r,arguments)},{dup:93}],173:[function(e,t,r){t.exports=n;function n(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r){if(r.hasOwnProperty(n)){e[n]=r[n]}}}return e}},{}],174:[function(e,t,r){arguments[4][18][0].apply(r,arguments)},{"./debug":175,dup:18}],175:[function(e,t,r){arguments[4][19][0].apply(r,arguments)},{dup:19,ms:176}],176:[function(e,t,r){arguments[4][20][0].apply(r,arguments)},{dup:20}],177:[function(e,t,r){arguments[4][21][0].apply(r,arguments)},{dup:21}],178:[function(e,t,r){arguments[4][135][0].apply(r,arguments)},{dup:135,events:49}],179:[function(e,t,r){arguments[4][173][0].apply(r,arguments)},{dup:173}],180:[function(e,t,r){arguments[4][125][0].apply(r,arguments)},{dup:125}],181:[function(e,t,r){(function(r){var n=e("bencode");var i=e("bitfield");var o=e("events").EventEmitter;var a=e("inherits");var s=e("simple-sha1");var f=1e7;var u=1e3;var c=16*1024;t.exports=function(e){a(t,o);function t(t){o.call(this);this._wire=t;this._metadataComplete=false;this._metadataSize=null;this._remainingRejects=null;this._fetching=false;this._bitfield=new i(0,{grow:u});if(r.isBuffer(e)){this.setMetadata(e)}}t.prototype.name="ut_metadata";t.prototype.onHandshake=function(e,t,r){this._infoHash=e;this._infoHashHex=e.toString("hex")};t.prototype.onExtendedHandshake=function(e){if(!e.m||!e.m.ut_metadata){return this.emit("warning",new Error("Peer does not support ut_metadata"))}if(!e.metadata_size){return this.emit("warning",new Error("Peer does not have metadata"))}if(e.metadata_size>f){return this.emit("warning",new Error("Peer gave maliciously large metadata size"))}this._metadataSize=e.metadata_size;this._numPieces=Math.ceil(this._metadataSize/c);this._remainingRejects=this._numPieces*2;if(this._fetching){this._requestPieces()}};t.prototype.onMessage=function(e){var t,r;try{var i=e.toString();var o=i.indexOf("ee")+2;t=n.decode(i.substring(0,o));r=e.slice(o)}catch(a){return}switch(t.msg_type){case 0:this._onRequest(t.piece);break;case 1:this._onData(t.piece,r,t.total_size);break;case 2:this._onReject(t.piece);break}};t.prototype.fetch=function(){if(this._metadataComplete){return}this._fetching=true;if(this._metadataSize){this._requestPieces()}};t.prototype.cancel=function(){this._fetching=false};t.prototype.setMetadata=function(e){if(this._metadataComplete)return true;try{var t=n.decode(e).info;if(t){e=n.encode(t)}}catch(r){}if(this._infoHashHex&&this._infoHashHex!==s.sync(e)){return false}this.cancel();this.metadata=e;this._metadataComplete=true;this._metadataSize=this.metadata.length;this._wire.extendedHandshake.metadata_size=this._metadataSize;this.emit("metadata",n.encode({info:n.decode(this.metadata)}));return true};t.prototype._send=function(e,t){var i=n.encode(e);if(r.isBuffer(t)){i=r.concat([i,t])}this._wire.extended("ut_metadata",i)};t.prototype._request=function(e){this._send({msg_type:0,piece:e})};t.prototype._data=function(e,t,r){var n={msg_type:1,piece:e};if(typeof r==="number"){n.total_size=r}this._send(n,t)};t.prototype._reject=function(e){this._send({msg_type:2,piece:e})};t.prototype._onRequest=function(e){if(!this._metadataComplete){this._reject(e);return}var t=e*c;var r=t+c;if(r>this._metadataSize){r=this._metadataSize}var n=this.metadata.slice(t,r);this._data(e,n,this._metadataSize)};t.prototype._onData=function(e,t,r){if(t.length>c){return}t.copy(this.metadata,e*c);this._bitfield.set(e);this._checkDone()};t.prototype._onReject=function(e){if(this._remainingRejects>0&&this._fetching){this._request(e);this._remainingRejects-=1}else{this.emit("warning",new Error('Peer sent "reject" too much'))}};t.prototype._requestPieces=function(){this.metadata=new r(this._metadataSize);for(var e=0;e<this._numPieces;e++){this._request(e)}};t.prototype._checkDone=function(){var e=true;for(var t=0;t<this._numPieces;t++){if(!this._bitfield.get(t)){e=false;break}}if(!e)return;var r=this.setMetadata(this.metadata);if(!r){this._failedMetadata()}};t.prototype._failedMetadata=function(){this._bitfield=new i(0,{grow:u});this._remainingRejects-=this._numPieces;if(this._remainingRejects>0){this._requestPieces()}else{this.emit("warning",new Error("Peer sent invalid metadata"))}};return t}}).call(this,e("buffer").Buffer)},{bencode:182,bitfield:186,buffer:45,events:49,inherits:187,"simple-sha1":188}],182:[function(e,t,r){arguments[4][13][0].apply(r,arguments)},{"./lib/decode":183,"./lib/encode":185,dup:13}],183:[function(e,t,r){arguments[4][14][0].apply(r,arguments)},{"./dict":184,buffer:45,dup:14}],184:[function(e,t,r){arguments[4][15][0].apply(r,arguments)},{dup:15}],185:[function(e,t,r){arguments[4][16][0].apply(r,arguments)},{buffer:45,dup:16}],186:[function(e,t,r){arguments[4][8][0].apply(r,arguments)},{buffer:45,dup:8}],187:[function(e,t,r){arguments[4][21][0].apply(r,arguments)},{dup:21}],188:[function(e,t,r){arguments[4][106][0].apply(r,arguments)},{dup:106,rusha:189}],189:[function(e,t,r){arguments[4][107][0].apply(r,arguments)},{dup:107}],190:[function(e,t,r){arguments[4][23][0].apply(r,arguments)},{dup:23}],191:[function(e,t,r){t.exports=function n(e,t,r){if(t===undefined){return function(t,r){return n(e,t,r)}}if(r===undefined)r="0";e-=t.toString().length;if(e>0)return new Array(e+(/\./.test(t)?2:1)).join(r)+t;return t+""}},{}],192:[function(e,t,r){t.exports={name:"webtorrent",description:"Streaming torrent client",version:"0.46.0",author:{name:"Feross Aboukhadijeh",email:"feross@feross.org",url:"http://feross.org/"},bin:{webtorrent:"./bin/cmd.js"},browser:{"./lib/fs-storage":false,"./server":false,"bittorrent-dht/client":false,"load-ip-set":false,"simple-get":false,ut_pex:false},bugs:{url:"https://github.com/feross/webtorrent/issues"},dependencies:{"addr-to-ip-port":"^1.0.1",bitfield:"^1.0.2","bittorrent-dht":"^3.0.0","bittorrent-swarm":"^5.0.0","block-stream2":"^1.0.0",clivas:"^0.2.0","create-torrent":"^3.4.0",debug:"^2.1.0",dezalgo:"^1.0.1","end-of-stream":"^1.0.0",hat:"0.0.3",inherits:"^2.0.1",inquirer:"^0.8.0","load-ip-set":"^1.0.3",mime:"^1.2.11",minimist:"^1.1.0",mkdirp:"^0.5.0",moment:"^2.8.3",multistream:"^1.4.2","network-address":"^1.0.0",once:"^1.3.1","parse-torrent":"^5.0.0","pretty-bytes":"^1.0.1",pump:"^1.0.0","random-access-file":"^0.3.1","range-parser":"^1.0.2","re-emitter":"^1.0.0",rimraf:"^2.2.5","run-parallel":"^1.0.0","simple-get":"^1.0.0","simple-sha1":"^2.0.0",speedometer:"^0.1.2",thunky:"^0.1.0","torrent-discovery":"^3.0.0",uniq:"^1.0.1",ut_metadata:"^2.1.0",ut_pex:"^1.0.1","windows-no-runnable":"0.0.6",xtend:"^4.0.0","zero-fill":"^2.2.0"},devDependencies:{"bittorrent-tracker":"^4.0.0",brfs:"^1.2.0",browserify:"^10.0.0","run-auto":"^1.0.0",standard:"^3.1.1",tape:"^4.0.0","uglify-js":"^2.4.15",zelda:"^2.0.0",zuul:"^3.0.0"},homepage:"http://webtorrent.io",keywords:["torrent","bittorrent","bittorrent client","streaming","download","webrtc","webrtc data","webtorrent","mad science"],license:"MIT",main:"index.js",optionalDependencies:{"airplay-js":"^0.2.3","chromecast-js":"^0.1.4",nodebmc:"0.0.5"},repository:{type:"git",url:"git://github.com/feross/webtorrent.git"},scripts:{build:"browserify -s WebTorrent -e ./ | uglifyjs -m > webtorrent.min.js","build-debug":"browserify -s WebTorrent -e ./ > webtorrent.debug.js",size:"npm run build && cat webtorrent.min.js | gzip | wc -c",test:"standard && node ./bin/test.js","test-browser":"zuul -- test/basic.js","test-browser-local":"zuul --local -- test/basic.js","test-node":"tape test/*.js"}}},{}]},{},[1])(1)});