1
2
3
4
5
6
7
8
9
|
(function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.WebTorrent=e()}})(function(){var e,t,n;return function r(e,t,n){function i(o,s){if(!t[o]){if(!e[o]){var f=typeof require=="function"&&require;if(!s&&f)return f(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=t[o]={exports:{}};e[o][0].call(u.exports,function(t){var n=e[o][1][t];return i(n?n:t)},u,u.exports,r,e,t,n)}return t[o].exports}var a=typeof require=="function"&&require;for(var o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,t,n){(function(n,r,i){t.exports=_;var a=e("create-torrent");var o=e("debug")("webtorrent");var s=e("bittorrent-dht/client");var f=e("events").EventEmitter;var c=e("xtend");var u=e("hat");var l=e("inherits");var p=e("load-ip-set");var d=e("run-parallel");var h=e("parse-torrent");var m=e("speedometer");var v=e("zero-fill");var g=e("./lib/fs-storage");var y=e("./lib/storage");var b=e("./lib/torrent");l(_,f);var w=e("./package.json").version.match(/([0-9]+)/g).slice(0,2).map(v(2)).join("");function _(e){var t=this;if(!(t instanceof _))return new _(e);if(!e)e={};f.call(t);if(!o.enabled)t.setMaxListeners(0);t.destroyed=false;t.torrentPort=e.torrentPort||0;t.tracker=e.tracker!==undefined?e.tracker:true;t._rtcConfig=e.rtcConfig;t._wrtc=e.wrtc||r.WRTC;t.torrents=[];t.downloadSpeed=m();t.uploadSpeed=m();t.storage=typeof e.storage==="function"?e.storage:e.storage!==false&&typeof g==="function"?g:y;t.peerId=e.peerId===undefined?new i("-WW"+w+"-"+u(48),"utf8"):typeof e.peerId==="string"?new i(e.peerId,"hex"):e.peerId;t.peerIdHex=t.peerId.toString("hex");t.nodeId=e.nodeId===undefined?new i(u(160),"hex"):typeof e.nodeId==="string"?new i(e.nodeId,"hex"):e.nodeId;t.nodeIdHex=t.nodeId.toString("hex");if(e.dht!==false&&typeof s==="function"){t.dht=new s(c({nodeId:t.nodeId},e.dht));t.dht.listen(e.dhtPort)}o("new webtorrent (peerId %s, nodeId %s)",t.peerIdHex,t.nodeIdHex);if(typeof p==="function"){p(e.blocklist,{headers:{"user-agent":"WebTorrent (http://webtorrent.io)"}},function(e,n){if(e)return t.error("failed to load blocklist: "+e.message);t.blocked=n;a()})}else n.nextTick(a);function a(){if(t.destroyed)return;t.ready=true;t.emit("ready")}}Object.defineProperty(_.prototype,"ratio",{get:function(){var e=this;var t=e.torrents.reduce(function(e,t){return e+t.uploaded},0);var n=e.torrents.reduce(function(e,t){return e+t.downloaded},0)||1;return t/n}});_.prototype.get=function(e){var t=this;if(e instanceof b)return e;var n=h(e);if(!n.infoHash)throw new Error("Invalid torrent identifier");for(var r=0,i=t.torrents.length;r<i;r++){var a=t.torrents[r];if(a.infoHash===n.infoHash)return a}return null};_.prototype.add=_.prototype.download=function(e,t,n){var r=this;if(r.destroyed)throw new Error("client is destroyed");o("add");if(typeof t==="function"){n=t;t={}}if(!t)t={};t.client=r;t.storage=t.storage||r.storage;var i=new b(e,t);r.torrents.push(i);function a(e){if(i.infoHash===e.infoHash){n(i);r.removeListener("torrent",a)}}if(n)r.on("torrent",a);i.on("error",function(e){r.emit("error",e,i);r.remove(i)});i.on("listening",function(e){r.emit("listening",e,i)});i.on("ready",function(){o("torrent");r.emit("torrent",i)});return i};_.prototype.seed=function(t,n,r){var i=this;if(i.destroyed)throw new Error("client is destroyed");o("seed");if(typeof n==="function"){r=n;n={}}if(!n)n={};n.noVerify=true;n.createdBy="WebTorrent/"+e("./package.json").version;var s;var f=i.add(undefined,n,function(e){var t=[function(t){e.storage.load(s,t)}];if(i.dht){t.push(function(t){e.on("dhtAnnounce",t)})}d(t,function(t){if(t)return i.emit("error",t);if(r)r(e);i.emit("seed",e)})});a.parseInput(t,n,function(e,r){if(e)return i.emit("error",e);s=r.map(function(e){return e.getStream});a(t,n,function(e,t){if(e)return i.emit("error",e);if(i.destroyed)return;f._onTorrentId(t)})});return f};_.prototype.remove=function(e,t){var n=this;var r=n.get(e);if(!r)throw new Error("No torrent with id "+e);o("remove");n.torrents.splice(n.torrents.indexOf(r),1);r.destroy(t)};_.prototype.address=function(){var e=this;return{address:"0.0.0.0",family:"IPv4",port:e.torrentPort}};_.prototype.destroy=function(e){var t=this;t.destroyed=true;o("destroy");var n=t.torrents.map(function(e){return function(n){t.remove(e,n)}});if(t.dht){n.push(function(e){t.dht.destroy(e)})}d(n,e)}}).call(this,e("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},e("buffer").Buffer)},{"./lib/fs-storage":46,"./lib/storage":7,"./lib/torrent":8,"./package.json":209,_process:58,"bittorrent-dht/client":46,buffer:47,"create-torrent":79,debug:117,events:51,hat:124,inherits:125,"load-ip-set":46,"parse-torrent":132,"run-parallel":152,speedometer:158,xtend:207,"zero-fill":208}],2:[function(e,t,n){t.exports=f;var r=e("debug")("webtorrent:file-stream");var i=e("inherits");var a=e("path");var o=e("stream");var s=e("./media-stream");i(f,o.Readable);function f(e,t){var n=this;if(!(n instanceof f))return new f(e,t);o.Readable.call(n,t);r("new filestream %s",JSON.stringify(t));if(!t)t={};if(!t.start)t.start=0;if(!t.end)t.end=e.length-1;n.destroyed=false;n.length=t.end-t.start+1;var i=t.start+e.offset;var s=t.pieceLength;n.startPiece=i/s|0;n.endPiece=(t.end+e.offset)/s|0;n._extname=a.extname(e.name).toLowerCase();n._storage=e.storage;n._piece=n.startPiece;n._missing=n.length;n._reading=false;n._notifying=false;n._criticalLength=Math.min(1024*1024/s|0,2);n._offset=i-n.startPiece*s}f.prototype._read=function(){var e=this;r("_read");if(e._reading)return;e._reading=true;e.notify()};f.prototype.notify=function(){var e=this;r("notify");if(!e._reading||e._missing===0)return;if(!e._storage.bitfield.get(e._piece)){return e._storage.emit("critical",e._piece,e._piece+e._criticalLength)}if(e._notifying)return;e._notifying=true;var t=e._piece;r("before read %s",t);e._storage.read(e._piece++,function(n,i){r("after read %s (length %s) (err %s)",t,i.length,n&&n.message);e._notifying=false;if(e.destroyed)return;if(n){e._storage.emit("error",n);return e.destroy(n)}if(e._offset){i=i.slice(e._offset);e._offset=0}if(e._missing<i.length){i=i.slice(0,e._missing)}e._missing-=i.length;r("pushing buffer of length %s",i.length);e._reading=false;e.push(i);if(e._missing===0)e.push(null)})};f.prototype.pipe=function(e){var t=this;var n=o.Readable.prototype.pipe;if(e&&(e.nodeName==="VIDEO"||e.nodeName==="AUDIO")){var r={".webm":'video/webm; codecs="vorbis,vp8"',".mp4":'video/mp4; codecs="avc1.42c01e,mp4a.40.2"',".mp3":"audio/mpeg"}[t._extname];return n.call(t,new s(e,{type:r}))}else{return n.call(t,e)}};f.prototype.destroy=function(){var e=this;if(e.destroyed)return;e.destroyed=true;e._storage.emit("deselect",e.startPiece,e.endPiece,true)}},{"./media-stream":3,debug:117,inherits:125,path:57,stream:74}],3:[function(e,t,n){t.exports=f;var r=e("debug")("webtorrent:media-stream");var i=e("inherits");var a=e("once");var o=e("stream");var s=typeof window!=="undefined"&&window.MediaSource;i(f,o.Writable);function f(e,t){var n=this;if(!(n instanceof f))return new f(e,t);o.Writable.call(n,t);if(!s)throw new Error("web browser lacks MediaSource support");n.media=e;t=t||{};t.type=t.type||'video/webm; codecs="vorbis,vp8"';r("new mediastream %s %s",e,JSON.stringify(t));n._mediaSource=new s;n._sourceBuffer=null;n._cb=null;n.media.src=window.URL.createObjectURL(n._mediaSource);var i=a(function(){n._sourceBuffer=n._mediaSource.addSourceBuffer(t.type);n._sourceBuffer.addEventListener("updateend",n._flow.bind(n));n._flow()});n._mediaSource.addEventListener("webkitsourceopen",i,false);n._mediaSource.addEventListener("sourceopen",i,false);n.on("finish",function(){r("finish");n._mediaSource.endOfStream()});window.vs=n}f.prototype._write=function(e,t,n){var i=this;if(!i._sourceBuffer){i._cb=function(r){if(r)return n(r);i._write(e,t,n)};return}if(i._sourceBuffer.updating){return n(new Error("Cannot append buffer while source buffer updating"))}i._sourceBuffer.appendBuffer(e);r("appendBuffer %s",e.length);i._cb=n};f.prototype._flow=function(){var e=this;r("flow");if(e._cb){e._cb(null)}}},{debug:117,inherits:125,once:131,stream:74}],4:[function(e,t,n){t.exports={".aac":"audio/aac",".css":"text/css",".html":"text/html",".js":"application/javascript",".m4a":"audio/mp4",".md":"text/x-markdown",".mp3":"audio/mpeg",".mp4":"video/mp4",".oga":"audio/ogg",".ogg":"audio/ogg",".pdf":"application/pdf",".txt":"text/plain",".wav":"audio/wav",".webm":"video/webm"}},{}],5:[function(e,t,n){t.exports=r;function r(e,t){var n=this;n.swarm=e;n.numPieces=t;function r(e){e.on("have",function(e){n.pieces[e]++});e.on("bitfield",n.recalculate.bind(n));e.on("close",function(){for(var t=0;t<n.numPieces;++t){n.pieces[t]-=e.peerPieces.get(t)}})}n.swarm.wires.forEach(r);n.swarm.on("wire",function(e){n.recalculate();r(e)});n.recalculate()}r.prototype.recalculate=function(){var e=this;e.pieces=[];for(var t=0;t<e.numPieces;++t){e.pieces[t]=0}e.swarm.wires.forEach(function(t){for(var n=0;n<e.numPieces;++n){e.pieces[n]+=t.peerPieces.get(n)}})};r.prototype.getRarestPiece=function(e){var t=this;var n=[];var r=Infinity;e=e||function(){return true};for(var i=0;i<t.numPieces;++i){if(!e(i))continue;var a=t.pieces[i];if(a===r){n.push(i)}else if(a<r){n=[i];r=a}}if(n.length>0){return n[Math.random()*n.length|0]}else{return-1}}},{}],6:[function(e,t,n){var r=e("debug")("webtorrent:server");var i=e("http");var a=e("mime");var o=e("pump");var s=e("range-parser");var f=e("url");t.exports=function c(e,t){var n=i.createServer(t);n.on("connection",function(e){e.setTimeout(36e6)});n.on("request",function(t,n){r("onRequest");if(t.method==="OPTIONS"&&t.headers["access-control-request-headers"]){n.setHeader("Access-Control-Allow-Methods","POST, GET, OPTIONS");n.setHeader("Access-Control-Allow-Headers",t.headers["access-control-request-headers"]);n.setHeader("Access-Control-Max-Age","1728000");return n.end()}if(t.headers.origin){n.setHeader("Access-Control-Allow-Origin",t.headers.origin)}var i=f.parse(t.url).pathname;if(i==="/favicon.ico")return n.end();if(e.ready)c();else e.once("ready",c);function c(){if(i==="/"){n.setHeader("Content-Type","text/html");var f=e.files.map(function(e,t){return'<li><a href="/'+t+'">'+e.name+"</a></li>"}).join("<br>");return n.end("<h1>WebTorrent</h1><ol>"+f+"</ol>")}var c=Number(i.slice(1));if(Number.isNaN(c)||c>=e.files.length){n.statusCode=404;return n.end()}var u=e.files[c];n.setHeader("Accept-Ranges","bytes");n.setHeader("Content-Type",a.lookup(u.name));n.statusCode=200;n.setHeader("transferMode.dlna.org","Streaming");n.setHeader("contentFeatures.dlna.org","DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000");var l;if(t.headers.range){n.statusCode=206;l=s(u.length,t.headers.range)[0];r("range %s",JSON.stringify(l));n.setHeader("Content-Range","bytes "+l.start+"-"+l.end+"/"+u.length);n.setHeader("Content-Length",l.end-l.start+1)}else{n.setHeader("Content-Length",u.length)}if(t.method==="HEAD")n.end();o(u.createReadStream(l),n)}});return n}},{debug:117,http:52,mime:126,pump:149,"range-parser":150,url:76}],7:[function(e,t,n){(function(n,r){t.exports=E;var i=e("bitfield");var a=e("block-stream2");var o=e("debug")("webtorrent:storage");var s=e("dezalgo");var f=e("end-of-stream");var c=e("events").EventEmitter;var u=e("./file-stream");var l=e("inherits");var p=e("./mime.json");var d=e("multistream");var h=e("once");var m=e("path");var v=e("simple-sha1");var g=16*1024;var y=0;var b=1;var w=2;function _(){}l(x,c);function x(e,t,n,r){var i=this;c.call(i);if(!o.enabled)i.setMaxListeners(0);i.index=e;i.hash=t;i.noVerify=!!r;if(typeof n==="number"){i.buffer=null;i.length=n}else{i.buffer=n;i.length=n.length}i._reset()}x.prototype.readBlock=function(e,t,n){var r=this;n=s(n);if(!r.buffer||!r._verifyOffset(e)){return n(new Error("invalid block offset "+e))}n(null,r.buffer.slice(e,e+t))};x.prototype.writeBlock=function(e,t,n){var r=this;n=s(n);if(!r._verifyOffset(e)||!r._verifyBlock(e,t)){return n(new Error("invalid block "+e+":"+t.length))}r._lazyAllocBuffer();var i=e/g;if(r.blocks[i]===w){return n(null)}t.copy(r.buffer,e);r.blocks[i]=w;r.blocksWritten+=1;if(r.blocksWritten===r.blocks.length){r.verify()}n(null)};x.prototype.reserveBlock=function(e){var t=this;var n=t.blocks.length;for(var r=0;r<n;r++){if(t.blocks[r]&&!e||t.blocks[r]===w){continue}t.blocks[r]=b;return{offset:r*g,length:r===n-1?t.length-r*g:g}}return null};x.prototype.cancelBlock=function(e){var t=this;if(!t._verifyOffset(e)){return false}var n=e/g;if(t.blocks[n]===b){t.blocks[n]=y}return true};x.prototype._reset=function(){var e=this;e.verified=false;e.blocks=new r(Math.ceil(e.length/g));e.blocks.fill(0);e.blocksWritten=0};x.prototype.verify=function(e){var t=this;e=e||t.buffer;if(t.verified||!e){return}if(t.noVerify){t.verified=true;n();return}v(e,function(e){t.verified=e===t.hash;n()});function n(){if(t.verified){t.emit("done")}else{t.emit("warning",new Error("piece "+t.index+" failed verification"));t._reset()}}};x.prototype._verifyOffset=function(e){var t=this;if(e%g===0){return true}else{t.emit("warning",new Error("invalid block offset "+e+", not multiple of "+g));return false}};x.prototype._verifyBlock=function(e,t){var n=this;if(t.length===g){return true}else if(t.length===n.length-e&&n.length-e<g){return true}else{n.emit("warning",new Error("invalid block size "+t.length));return false}};x.prototype._lazyAllocBuffer=function(){var e=this;if(!e.buffer){e.buffer=new r(e.length)}};l(k,c);function k(e,t,n,r){var i=this;c.call(i);if(!o.enabled)i.setMaxListeners(0);i.storage=e;i.name=t.name;i.path=t.path;i.length=t.length;i.offset=t.offset;i.pieces=n;i.pieceLength=r;i.done=false;i.pieces.forEach(function(e){e.on("done",function(){i._checkDone()})});i._checkDone()}k.prototype.select=function(){var e=this;if(e.pieces.length>0){var t=e.pieces[0].index;var n=e.pieces[e.pieces.length-1].index;e.storage.emit("select",t,n,false)}};k.prototype.deselect=function(){var e=this;if(e.pieces.length>0){var t=e.pieces[0].index;var n=e.pieces[e.pieces.length-1].index;e.storage.emit("deselect",t,n,false)}};k.prototype.createReadStream=function(e){var t=this;if(!e)e={};if(e.pieceLength==null)e.pieceLength=t.pieceLength;var n=new u(t,e);t.storage.emit("select",n.startPiece,n.endPiece,true,n.notify.bind(n));f(n,function(){t.storage.emit("deselect",n.startPiece,n.endPiece,true)});return n};k.prototype.getBlobURL=function(e){var t=this;if(typeof window==="undefined")throw new Error("browser-only method");t.getBuffer(function(n,r){if(n)return e(n);var i=p[m.extname(t.name).toLowerCase()];var a=i?new window.Blob([r],{type:i}):new window.Blob([r]);var o=window.URL.createObjectURL(a);e(null,o)})};k.prototype.getBuffer=function(e){var t=this;e=s(h(e));var n;if(t.storage.buffer){var i=function(){n=t.storage.buffer.slice(t.offset,t.offset+t.length);e(null,n)};if(t.done)i();else t.once("done",i)}else{n=new r(t.length);var a=0;t.createReadStream().on("data",function(e){e.copy(n,a);a+=e.length}).on("end",function(){e(null,n)}).on("error",e)}};k.prototype._checkDone=function(){var e=this;e.done=e.pieces.every(function(e){return e.verified});if(e.done){n.nextTick(function(){e.emit("done")})}};l(E,c);function E(e,t){var n=this;c.call(n);if(!o.enabled)n.setMaxListeners(0);if(!t)t={};n.bitfield=new i(e.pieces.length);n.done=false;n.closed=false;n.readonly=true;if(!t.nobuffer){n.buffer=new r(e.length)}var a=n.pieceLength=e.pieceLength;var s=e.lastPieceLength;var f=e.pieces.length;n.pieces=e.pieces.map(function(e,r){var i=r*a;var o=i+(r===f-1?s:a);var c=n.buffer?n.buffer.slice(i,o):o-i;var u=new x(r,e,c,!!t.noVerify);u.on("done",n._onPieceDone.bind(n,u));return u});n.files=e.files.map(function(e){var t=e.offset;var r=t+e.length-1;var i=t/a|0;var o=r/a|0;var s=n.pieces.slice(i,o+1);var f=new k(n,e,s,a);f.on("done",n._onFileDone.bind(n,f));return f})}E.BLOCK_LENGTH=g;E.prototype.load=function(e,t){var n=this;if(!Array.isArray(e))e=[e];t=h(t||function(){});var r=0;var i=new d(e);var o=new a(n.pieceLength,{zeroPadding:false});i.on("error",f);n.once("done",c);i.pipe(o).on("data",s).on("error",f);function s(e){var t=r;r+=1;var i=0;var o=new a(g,{zeroPadding:false});o.on("data",s);o.on("end",f);function s(e){var r=i*g;i+=1;n.writeBlock(t,r,e)}function f(){c()}function c(){o.removeListener("data",s);o.removeListener("end",f)}o.end(e)}function f(e){u();t(e)}function c(){u();t(null)}function u(){i.removeListener("error",f);o.removeListener("data",s);o.removeListener("error",f);n.removeListener("done",c)}};Object.defineProperty(E.prototype,"downloaded",{get:function(){var e=this;return e.pieces.reduce(function(e,t){return e+(t.verified?t.length:t.blocksWritten*g)},0)}});Object.defineProperty(E.prototype,"numMissing",{get:function(){var e=this;var t=e.pieces.length;for(var n=0,r=e.pieces.length;n<r;n++){t-=e.bitfield.get(n)}return t}});E.prototype.readBlock=function(e,t,n,r){var i=this;r=s(r);var a=i.pieces[e];if(!a)return r(new Error("invalid piece index "+e));a.readBlock(t,n,r)};E.prototype.writeBlock=function(e,t,n,r){var i=this;if(!r)r=_;r=s(r);if(i.readonly)return r(new Error("cannot write to readonly storage"));var a=i.pieces[e];if(!a)return r(new Error("invalid piece index "+e));a.writeBlock(t,n,r)};E.prototype.read=function(e,t,n,i){var a=this;if(typeof t==="function"){i=n;n=t;t=null}n=s(n);var o=a.pieces[e];if(!o){return n(new Error("invalid piece index "+e))}if(!o.verified&&!i){return n(new Error("Storage.read called on incomplete piece "+e))}var f=0;var c=o.length;if(t){f=t.offset||0;c=t.length||c}if(o.buffer){return n(null,o.buffer.slice(f,f+c))}var u=[];function l(){if(c<=0)return n(null,r.concat(u));var t=f;var i=Math.min(g,c);f+=i;c-=i;a.readBlock(e,t,i,function(e,t){if(e)return n(e);u.push(t);l()})}l()};E.prototype.reserveBlock=function(e,t){var n=this;var r=n.pieces[e];if(!r)return null;return r.reserveBlock(t)};E.prototype.cancelBlock=function(e,t){var n=this;var r=n.pieces[e];if(!r)return false;return r.cancelBlock(t)};E.prototype.remove=function(e){if(e)s(e)(null)};E.prototype.close=function(e){var t=this;t.closed=true;if(e)s(e)(null)};E.prototype._onPieceDone=function(e){var t=this;t.bitfield.set(e.index);o("piece done "+e.index+" ("+t.numMissing+" still missing)");t.emit("piece",e)};E.prototype._onFileDone=function(e){var t=this;o("file done "+e.name);t.emit("file",e);t._checkDone()};E.prototype._checkDone=function(){var e=this;if(!e.done&&e.files.every(function(e){return e.done})){e.done=true;e.emit("done")}}}).call(this,e("_process"),e("buffer").Buffer)},{"./file-stream":2,"./mime.json":4,_process:58,bitfield:10,"block-stream2":34,buffer:47,debug:117,dezalgo:120,"end-of-stream":123,events:51,inherits:125,multistream:128,once:131,path:57,"simple-sha1":156}],8:[function(e,t,n){(function(n,r){t.exports=I;var i=e("addr-to-ip-port");var a=e("create-torrent");var o=e("debug")("webtorrent:torrent");var s=e("torrent-discovery");var f=e("events").EventEmitter;var c=e("inherits");var u=e("run-parallel");var l=e("parse-torrent");var p=e("re-emitter");var d=e("bittorrent-swarm");var h=e("uniq");var m=e("ut_metadata");var v=e("ut_pex");var g=e("./rarity-map");var y=e("./server");var b=e("./storage");var w=128*1024;var _=3e4;var x=5e3;var k=3*b.BLOCK_LENGTH;var E=.5;var S=1;var A=1e4;var T=2;function C(){}c(I,f);function I(e,t){var n=this;f.call(n);if(!o.enabled)n.setMaxListeners(0);o("new torrent");n.opts=t;n.client=t.client;n.hotswapEnabled="hotswap"in t?t.hotswap:true;n.verify=t.verify;n.chokeTimeout=t.chokeTimeout||x;n.pieceTimeout=t.pieceTimeout||_;n.strategy=t.strategy||"sequential";n._rechokeNumSlots=t.uploads===false||t.uploads===0?0:+t.uploads||10;n._rechokeOptimisticWire=null;n._rechokeOptimisticTime=0;n._rechokeIntervalId=null;n.ready=false;n.destroyed=false;n.files=[];n.metadata=null;n.parsedTorrent=null;n.storage=null;n.numBlockedPeers=0;n._amInterested=false;n._selections=[];n._critical=[];n._storageImpl=t.storage||b;this._torrentFileURL=null;if(e)n._onTorrentId(e)}Object.defineProperty(I.prototype,"length",{get:function(){return this.parsedTorrent&&this.parsedTorrent.length||0}});Object.defineProperty(I.prototype,"timeRemaining",{get:function(){if(this.swarm.downloadSpeed()===0)return Infinity;else return(this.length-this.downloaded)/this.swarm.downloadSpeed()*1e3}});Object.defineProperty(I.prototype,"progress",{get:function(){return this.parsedTorrent&&this.downloaded/this.parsedTorrent.length||0}});Object.defineProperty(I.prototype,"downloaded",{get:function(){return this.storage&&this.storage.downloaded||0}});Object.defineProperty(I.prototype,"uploaded",{get:function(){return this.swarm.uploaded}});Object.defineProperty(I.prototype,"ratio",{get:function(){return this.uploaded&&this.downloaded/this.uploaded||0}});Object.defineProperty(I.prototype,"magnetURI",{get:function(){return l.toMagnetURI(this.parsedTorrent)}});Object.defineProperty(I.prototype,"torrentFile",{get:function(){return l.toTorrentFile(this.parsedTorrent)}});Object.defineProperty(I.prototype,"torrentFileURL",{get:function(){if(typeof window==="undefined")throw new Error("browser-only property");if(this._torrentFileURL)return this._torrentFileURL;this._torrentFileURL=window.URL.createObjectURL(new window.Blob([this.torrentFile],{type:"application/x-bittorrent"}));return this._torrentFileURL}});I.prototype._onTorrentId=function(e){var t=this;if(t.destroyed)return;var n=e&&e.parsedTorrent;if(n){t._onParsedTorrent(n)}else{l.remote(e,function(e,n){if(t.destroyed)return;if(e)return t._onError(e);t._onParsedTorrent(n)})}};I.prototype._onParsedTorrent=function(e){var t=this;if(t.destroyed)return;t.parsedTorrent=e;t.infoHash=e.infoHash;if(!t.infoHash){return t._onError(new Error("Malformed torrent data: Missing info hash."))}if(t.parsedTorrent.name)t.name=t.parsedTorrent.name;if(t.opts.announce){t.parsedTorrent.announce=t.parsedTorrent.announce.concat(t.opts.announce)}if(r.WEBTORRENT_ANNOUNCE){t.parsedTorrent.announce=t.parsedTorrent.announce.concat(r.WEBTORRENT_ANNOUNCE)}if(t.parsedTorrent.announce.length===0){t.parsedTorrent.announce=a.announceList.map(function(e){return e[0]})}h(t.parsedTorrent.announce);t.swarm=new d(t.infoHash,t.client.peerId,{handshake:{dht:!!t.client.dht}});t.swarm.on("error",t._onError.bind(t));p(t.swarm,t,["warning"]);t.swarm.on("wire",t._onWire.bind(t));t.swarm.on("download",t.client.downloadSpeed.bind(t.client));t.swarm.on("upload",t.client.uploadSpeed.bind(t.client));t.swarm.listen(t.client.torrentPort,t._onSwarmListening.bind(t));n.nextTick(function(){if(t.destroyed)return;t.emit("infoHash",t.infoHash)})};I.prototype._onSwarmListening=function(){var e=this;if(e.destroyed)return;if(e.swarm.server)e.client.torrentPort=e.swarm.address().port;e.discovery=new s({announce:e.parsedTorrent.announce,dht:e.client.dht,tracker:e.client.tracker,peerId:e.client.peerId,port:e.client.torrentPort,rtcConfig:e.client._rtcConfig,wrtc:e.client._wrtc});e.discovery.on("error",e._onError.bind(e));e.discovery.setTorrent(e.infoHash);e.discovery.on("peer",e.addPeer.bind(e));p(e.discovery,e,["dhtAnnounce","warning"]);if(e.parsedTorrent.info)e._onMetadata(e.parsedTorrent);e.emit("listening",e.client.torrentPort)};I.prototype._onMetadata=function(e){var t=this;if(t.metadata||t.destroyed)return;o("got metadata");if(e&&e.infoHash){t.metadata=l.toTorrentFile(e);t.parsedTorrent=e}else{t.metadata=e;var r=t.parsedTorrent.announce;try{t.parsedTorrent=l(t.metadata)}catch(i){return t._onError(i)}t.parsedTorrent.announce=r}t.name=t.parsedTorrent.name;t.discovery.setTorrent(t.parsedTorrent);t.rarityMap=new g(t.swarm,t.parsedTorrent.pieces.length);t.storage=new t._storageImpl(t.parsedTorrent,t.opts);t.storage.on("piece",t._onStoragePiece.bind(t));t.storage.on("file",function(e){t.emit("file",e)});t._reservations=t.storage.pieces.map(function(){return[]});t.storage.on("done",function(){if(t.discovery.tracker)t.discovery.tracker.complete();o("torrent "+t.infoHash+" done");t.emit("done")});t.storage.on("select",t.select.bind(t));t.storage.on("deselect",t.deselect.bind(t));t.storage.on("critical",t.critical.bind(t));t.storage.files.forEach(function(e){t.files.push(e)});t.swarm.wires.forEach(function(e){if(e.ut_metadata)e.ut_metadata.setMetadata(t.metadata);t._onWireWithMetadata(e)});if(t.verify){n.nextTick(function(){o("verifying existing torrent data");var e=0;var n=0;u(t.storage.pieces.map(function(r){return function(i){t.storage.read(r.index,function(a,s){e+=1;t.emit("verifying",{percentDone:100*e/t.storage.pieces.length,percentVerified:100*n/t.storage.pieces.length});if(!a&&s){r.verify(s);n+=r.verified;o("piece "+(r.verified?"verified":"invalid")+" "+r.index)}i()},true)}}),t._onStorage.bind(t))})}else{n.nextTick(t._onStorage.bind(t))}n.nextTick(function(){t.emit("metadata")})};I.prototype.destroy=function(e){var t=this;if(t.destroyed)return;t.destroyed=true;o("destroy");if(t._rechokeIntervalId){clearInterval(t._rechokeIntervalId);t._rechokeIntervalId=null}if(t._torrentFileURL)window.URL.revokeObjectURL(t._torrentFileURL);var n=[];if(t.swarm)n.push(function(e){t.swarm.destroy(e)});if(t.discovery)n.push(function(e){t.discovery.stop(e)});if(t.storage)n.push(function(e){t.storage.close(e)});u(n,e)};I.prototype.addPeer=function(e){var t=this;if(typeof e==="string"&&t.client.blocked&&t.client.blocked.contains(i(e)[0])){t.numBlockedPeers+=1;t.emit("blockedPeer",e);return false}else{t.emit("peer",e);t.swarm.addPeer(e);return true}};I.prototype.select=function(e,t,n,r){var i=this;if(e>t||e<0||t>=i.storage.pieces.length){throw new Error("invalid selection ",e,":",t)}n=Number(n)||0;o("select %s-%s (priority %s)",e,t,n);i._selections.push({from:e,to:t,offset:0,priority:n,notify:r||C});i._selections.sort(function(e,t){return t.priority-e.priority});i._updateSelections()};I.prototype.deselect=function(e,t,n){var r=this;n=Number(n)||0;o("deselect %s-%s (priority %s)",e,t,n);for(var i=0;i<r._selections.length;++i){var a=r._selections[i];if(a.from===e&&a.to===t&&a.priority===n){r._selections.splice(i--,1);break}}r._updateSelections()};I.prototype.critical=function(e,t){var n=this;o("critical %s-%s",e,t);for(var r=e;r<=t;++r){n._critical[r]=true}n._updateSelections()};I.prototype._onWire=function(e,t){var n=this;o("got wire (%s)",t||"Unknown");if(t){var r=i(t);e.remoteAddress=r[0];e.remotePort=r[1]}e.use(m(n.metadata));if(!n.metadata){e.ut_metadata.on("metadata",function(e){o("got metadata via ut_metadata");n._onMetadata(e)});e.ut_metadata.fetch()}if(typeof v==="function"){e.use(v());e.ut_pex.on("peer",function(e){o("ut_pex: got peer: %s (from %s)",e,t);n.addPeer(e)});e.ut_pex.on("dropped",function(e){o("ut_pex: dropped peer: %s (from %s)",e,t);var r=n.swarm._peers[e];if(!r||!r.conn)n.swarm.removePeer(e)})}e.setKeepAlive(true);if(e.peerExtensions.dht&&n.client.dht&&n.client.dht.listening){e.port(n.client.dht.address().port)}e.on("port",function(t){if(!e.remoteAddress){o("ignoring port from peer with no address");return}o("port: %s (from %s)",t,e.remoteAddress+":"+e.remotePort);if(n.client.dht)n.client.dht.addNode(e.remoteAddress+":"+t)});e.on("timeout",function(){o("wire timeout (%s)",t);e.destroy()});e.setTimeout(n.pieceTimeout,true);if(n.metadata){n._onWireWithMetadata(e)}};I.prototype._onWireWithMetadata=function(e){var t=this;var n=null;var r=t.chokeTimeout;function i(){if(t.destroyed||e.destroyed)return;if(t.swarm.numQueued>2*(t.swarm.numConns-t.swarm.numPeers)&&e.amInterested){e.destroy()}else{n=setTimeout(i,r);if(n.unref)n.unref()}}var a=0;function s(){if(e.peerPieces.length!==t.storage.pieces.length)return;for(;a<t.storage.pieces.length;++a){if(!e.peerPieces.get(a))return}e.isSeeder=true;e.choke()}e.on("bitfield",function(){s();t._update()});e.on("have",function(){s();t._update()});e.once("interested",function(){e.unchoke()});e.on("close",function(){clearTimeout(n)});e.on("choke",function(){clearTimeout(n);n=setTimeout(i,r);if(n.unref)n.unref()});e.on("unchoke",function(){clearTimeout(n);t._update()});e.on("request",function(n,r,i,a){if(i>w){o("got invalid block size request %s (from %s)",i,e.remoteAddress+":"+e.remotePort);return e.destroy()}t.storage.readBlock(n,r,i,a)});e.bitfield(t.storage.bitfield);e.interested();n=setTimeout(i,r);if(n.unref)n.unref();e.isSeeder=false;s()};I.prototype._onStorage=function(){var e=this;if(e.destroyed)return;o("on storage");e.storage.readonly=false;e.select(0,e.storage.pieces.length-1,false);e._rechokeIntervalId=setInterval(e._rechoke.bind(e),A);if(e._rechokeIntervalId.unref)e._rechokeIntervalId.unref();n.nextTick(function(){e.ready=true;e.emit("ready")})};I.prototype._onStoragePiece=function(e){var t=this;o("piece done %s",e.index);t._reservations[e.index]=null;t.swarm.wires.forEach(function(t){t.have(e.index)});t._gcSelections()};I.prototype._updateSelections=function(){var e=this;if(!e.swarm||e.destroyed)return;if(!e.metadata)return e.once("metadata",e._updateSelections.bind(e));n.nextTick(e._gcSelections.bind(e));e._updateInterest();e._update()};I.prototype._gcSelections=function(){var e=this;for(var t=0;t<e._selections.length;t++){var n=e._selections[t];var r=n.offset;while(e.storage.bitfield.get(n.from+n.offset)&&n.from+n.offset<n.to){n.offset++}if(r!==n.offset)n.notify();if(n.to!==n.from+n.offset)continue;if(!e.storage.bitfield.get(n.from+n.offset))continue;e._selections.splice(t--,1);n.notify();e._updateInterest()}if(!e._selections.length)e.emit("idle")};I.prototype._updateInterest=function(){var e=this;var t=e._amInterested;e._amInterested=!!e._selections.length;e.swarm.wires.forEach(function(t){if(e._amInterested)t.interested();else t.uninterested()});if(t===e._amInterested)return;if(e._amInterested)e.emit("interested");else e.emit("uninterested")};I.prototype._update=function(){var e=this;if(e.destroyed)return;R(e.swarm.wires,e._updateWire.bind(e))};I.prototype._updateWire=function(e){var t=this;if(e.peerChoking)return;if(!e.downloaded)return a();var n=j(e,E);if(e.requests.length>=n)return;var r=j(e,S);f(false)||f(true);function i(t,n,r,i){return function(a){return a>=t&&a<=n&&!(a in r)&&e.peerPieces.get(a)&&(!i||i(a))}}function a(){if(e.requests.length)return;for(var n=t._selections.length;n--;){var r=t._selections[n];var a;if(t.strategy==="rarest"){var o=r.from+r.offset;var s=r.to;var f=s-o+1;var c={};var u=0;var l=i(o,s,c);while(u<f){a=t.rarityMap.getRarestPiece(l);if(a<0)break;if(t._request(e,a,false))return;c[a]=true;u+=1}}else{for(a=r.to;a>=r.from+r.offset;--a){if(!e.peerPieces.get(a))continue;if(t._request(e,a,false))return}}}}function o(){var n=e.downloadSpeed()||1;if(n>k)return function(){return true};var r=Math.max(1,e.requests.length)*b.BLOCK_LENGTH/n;var i=10;var a=0;return function(e){if(!i||t.storage.bitfield.get(e))return true;var o=t.storage.pieces[e];var s=o.blocks.length-o.blocksWritten;for(;a<t.swarm.wires.length;a++){var f=t.swarm.wires[a];var c=f.downloadSpeed();if(c<k)continue;if(c<=n)continue;if(!f.peerPieces.get(e))continue;if((s-=c*r)>0)continue;i--;return false}return true}}function s(e){var n=e;for(var r=e;r<t._selections.length&&t._selections[r].priority;r++){n=r}var i=t._selections[e];t._selections[e]=t._selections[n];t._selections[n]=i}function f(n){if(e.requests.length>=r)return true;var a=o();for(var f=0;f<t._selections.length;f++){var c=t._selections[f];var u;if(t.strategy==="rarest"){var l=c.from+c.offset;var p=c.to;var d=p-l+1;var h={};var m=0;var v=i(l,p,h,a);while(m<d){u=t.rarityMap.getRarestPiece(v);if(u<0)break;while(t._request(e,u,t._critical[u]||n)){}if(e.requests.length<r){h[u]=true;m++;continue}if(c.priority)s(f);return true}}else{for(u=c.from+c.offset;u<=c.to;u++){if(!e.peerPieces.get(u)||!a(u))continue;while(t._request(e,u,t._critical[u]||n)){}if(e.requests.length<r)continue;if(c.priority)s(f);return true}}}return false}};I.prototype._rechoke=function(){var e=this;if(e._rechokeOptimisticTime>0)e._rechokeOptimisticTime-=1;else e._rechokeOptimisticWire=null;
var t=[];e.swarm.wires.forEach(function(n){if(!n.isSeeder&&n!==e._rechokeOptimisticWire){t.push({wire:n,downloadSpeed:n.downloadSpeed(),uploadSpeed:n.uploadSpeed(),salt:Math.random(),isChoked:true})}});t.sort(o);var n=0;var r=0;for(;r<t.length&&n<e._rechokeNumSlots;++r){t[r].isChoked=false;if(t[r].wire.peerInterested)n+=1}if(!e._rechokeOptimisticWire&&r<t.length&&e._rechokeNumSlots){var i=t.slice(r).filter(function(e){return e.wire.peerInterested});var a=i[L(i.length)];if(a){a.isChoked=false;e._rechokeOptimisticWire=a.wire;e._rechokeOptimisticTime=T}}t.forEach(function(e){if(e.wire.amChoking!==e.isChoked){if(e.isChoked)e.wire.choke();else e.wire.unchoke()}});function o(e,t){if(e.downloadSpeed!==t.downloadSpeed){return t.downloadSpeed-e.downloadSpeed}if(e.uploadSpeed!==t.uploadSpeed){return t.uploadSpeed-e.uploadSpeed}if(e.wire.amChoking!==t.wire.amChoking){return e.wire.amChoking?1:-1}return e.salt-t.salt}};I.prototype._hotswap=function(e,t){var n=this;if(!n.hotswapEnabled)return false;var r=e.downloadSpeed();if(r<b.BLOCK_LENGTH)return false;if(!n._reservations[t])return false;var i=n._reservations[t];if(!i){return false}var a=Infinity;var o;var s;for(s=0;s<i.length;s++){var f=i[s];if(!f||f===e)continue;var c=f.downloadSpeed();if(c>=k)continue;if(2*c>r||c>a)continue;o=f;a=c}if(!o)return false;for(s=0;s<i.length;s++){if(i[s]===o)i[s]=null}for(s=0;s<o.requests.length;s++){var u=o.requests[s];if(u.piece!==t)continue;n.storage.cancelBlock(t,u.offset)}n.emit("hotswap",o,e,t);return true};I.prototype._request=function(e,t,r){var i=this;var a=e.requests.length;if(i.storage.bitfield.get(t))return false;var s=j(e,S);if(a>=s)return false;var f=e.requests.length===0&&i.storage.numMissing<30;var c=i.storage.reserveBlock(t,f);if(!c&&!f&&r&&i._hotswap(e,t)){c=i.storage.reserveBlock(t,false)}if(!c)return false;var u=i._reservations[t];if(!u){u=i._reservations[t]=[]}var l=u.indexOf(null);if(l===-1)l=u.length;u[l]=e;function p(r,a){if(!i.ready){i.once("ready",function(){p(r,a)});return}if(u[l]===e)u[l]=null;if(r){o("error getting piece %s (offset: %s length: %s) from %s: %s",t,c.offset,c.length,e.remoteAddress+":"+e.remotePort,r.message);i.storage.cancelBlock(t,c.offset);n.nextTick(i._update.bind(i));return false}else{o("got piece %s (offset: %s length: %s) from %s",t,c.offset,c.length,e.remoteAddress+":"+e.remotePort);i.storage.writeBlock(t,c.offset,a,function(e){if(e){o("error writing block");i.storage.cancelBlock(t,c.offset)}n.nextTick(i._update.bind(i))})}}e.request(t,c.offset,c.length,p);return true};I.prototype.createServer=function(e){var t=this;if(typeof y==="function"){return new y(t,e)}};I.prototype._onError=function(e){var t=this;o("torrent error: %s",e.message||e);t.emit("error",e);t.destroy()};function j(e,t){return Math.ceil(2+t*e.downloadSpeed()/b.BLOCK_LENGTH)}function L(e){return Math.random()*e|0}function R(e,t){var n=e.map(function(e,t){return t});for(var r=n.length-1;r>0;--r){var i=L(r+1);var a=n[r];n[r]=n[i];n[i]=a}n.forEach(function(n){t(e[n],n,e)})}}).call(this,e("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./rarity-map":5,"./server":6,"./storage":7,_process:58,"addr-to-ip-port":9,"bittorrent-swarm":11,"create-torrent":79,debug:117,events:51,inherits:125,"parse-torrent":132,"re-emitter":151,"run-parallel":152,"torrent-discovery":159,uniq:197,ut_metadata:198,ut_pex:46}],9:[function(e,t,n){var r=/^\[?([^\]]+)\]?:(\d+)$/;var i={};var a=0;t.exports=function o(e){if(a===1e5)i={};if(!i[e]){var t=r.exec(e);if(!t)throw new Error("invalid addr: "+e);i[e]=[t[1],Number(t[2])];a+=1}return i[e]};t.exports.reset=function s(){i={}}},{}],10:[function(e,t,n){(function(e){var n=typeof e!=="undefined"?e:typeof Int8Array!=="undefined"?Int8Array:function(e){var t=new Array(e);for(var n=0;n<e;n++)t[n]=0};function r(e,t){if(!(this instanceof r)){return new r(e,t)}if(arguments.length===0){e=0}this.grow=t&&(isFinite(t.grow)&&i(t.grow)||t.grow)||0;if(typeof e==="number"||e===undefined){e=new n(i(e));if(e.fill)e.fill(0)}this.buffer=e}function i(e){var t=e>>3;if(e%8!==0)t++;return t}r.prototype.get=function(e){var t=e>>3;return t<this.buffer.length&&!!(this.buffer[t]&128>>e%8)};r.prototype.set=function(e,t){var n=e>>3;if(t||arguments.length===1){if(this.buffer.length<n+1)this._grow(Math.max(n+1,Math.min(2*this.buffer.length,this.grow)));this.buffer[n]|=128>>e%8}else if(n<this.buffer.length){this.buffer[n]&=~(128>>e%8)}};r.prototype._grow=function(e){if(this.buffer.length<e&&e<=this.grow){var t=new n(e);if(t.fill)t.fill(0);if(this.buffer.copy)this.buffer.copy(t,0);else{for(var r=0;r<this.buffer.length;r++){t[r]=this.buffer[r]}}this.buffer=t}};if(typeof t!=="undefined")t.exports=r}).call(this,e("buffer").Buffer)},{buffer:47}],11:[function(e,t,n){(function(n,r){t.exports=m;var i=e("addr-to-ip-port");var a=e("debug")("bittorrent-swarm");var o=e("dezalgo");var s=e("events").EventEmitter;var f=e("inherits");var c=e("net");var u=e("./lib/peer");var l=e("speedometer");var p=e("./lib/tcp-pool");var d=55;var h=[1e3,5e3,15e3];f(m,s);function m(e,t,n){var i=this;if(!(i instanceof m))return new m(e,t,n);s.call(i);i.infoHash=typeof e==="string"?new r(e,"hex"):e;i.infoHashHex=i.infoHash.toString("hex");i.peerId=typeof t==="string"?new r(t,"hex"):t;i.peerIdHex=i.peerId.toString("hex");if(!n)n={};a("new swarm (i %s p %s)",i.infoHashHex,i.peerIdHex);i.handshakeOpts=n.handshake;i.maxConns=n.maxConns!==undefined?n.maxConns:d;i.destroyed=false;i.listening=false;i.paused=false;i.server=null;i.wires=[];i._queue=[];i._peers={};i._peersLength=0;i._port=0;i.downloaded=0;i.uploaded=0;i.downloadSpeed=l();i.uploadSpeed=l()}Object.defineProperty(m.prototype,"ratio",{get:function(){var e=this;return e.uploaded/e.downloaded||0}});Object.defineProperty(m.prototype,"numQueued",{get:function(){var e=this;return e._queue.length+(e._peersLength-e.numConns)}});Object.defineProperty(m.prototype,"numConns",{get:function(){var e=this;var t=0;for(var n in e._peers){var r=e._peers[n];if(r&&r.conn)t+=1}return t}});Object.defineProperty(m.prototype,"numPeers",{get:function(){var e=this;return e.wires.length}});m.prototype.addPeer=function(e){var t=this;if(t.destroyed){if(e&&e.destroy)e.destroy(new Error("swarm already destroyed"));return}if(typeof e==="string"&&!t._validAddr(e)){a("ignoring invalid peer %s (from swarm.addPeer)",e);return}var n=e&&e.id||e;if(t._peers[n])return;a("addPeer %s",n);var r;if(typeof e==="string"){r=u.createOutgoingTCPPeer(e,t);t._queue.push(r);t._drain()}else{r=u.createWebRTCPeer(e,t)}t._peers[r.id]=r;t._peersLength+=1};m.prototype._addIncomingPeer=function(e){var t=this;if(t.destroyed)return e.destroy(new Error("swarm already destroyed"));if(t.paused)return e.destroy(new Error("swarm paused"));if(!t._validAddr(e.addr)){return e.destroy(new Error("invalid addr "+e.addr+" (from incoming)"))}a("_addIncomingPeer %s",e.id);t._peers[e.id]=e;t._peersLength+=1};m.prototype.removePeer=function(e){var t=this;var n=t._peers[e];if(!n)return;a("removePeer %s",e);t._peers[e]=null;t._peersLength-=1;n.destroy()};m.prototype.pause=function(){var e=this;if(e.destroyed)return;a("pause");e.paused=true};m.prototype.resume=function(){var e=this;if(e.destroyed)return;a("resume");e.paused=false;e._drain()};m.prototype.listen=function(e,t,r){var i=this;if(typeof t==="function"){r=t;t=undefined}if(r)r=o(r);if(i.listening)throw new Error("swarm already listening");if(n.browser){r()}else{i._port=e||p.getDefaultListenPort(i.infoHashHex);i._hostname=t;if(r)i.once("listening",r);a("listen %s",e);var s=p.addSwarm(i);i.server=s.server}};m.prototype._onListening=function(e){var t=this;t._port=e;t.listening=true;t.emit("listening")};m.prototype.address=function(){var e=this;return e.server.address()};m.prototype.destroy=function(e){var t=this;if(t.destroyed)return;t.destroyed=true;t.listening=false;t.paused=false;if(e)t.once("close",e);a("destroy");for(var n in t._peers){t.removePeer(n)}p.removeSwarm(t,function(){t.emit("close")})};m.prototype._drain=function(){var e=this;a("_drain numConns %s maxConns %s",e.numConns,e.maxConns);if(typeof c.connect!=="function"||e.destroyed||e.paused||e.numConns>=e.maxConns){return}a("drain (%s queued, %s/%s peers)",e.numQueued,e.numPeers,e.maxConns);var t=e._queue.shift();if(!t)return;a("tcp connect attempt to %s",t.addr);var n=i(t.addr);var r=n[0];var o=n[1];var s=t.conn=c.connect({host:r,port:o,localAddress:e._hostname});s.once("connect",function(){t.onConnect()});s.once("error",function(e){t.destroy(e)});t.setConnectTimeout();s.on("close",function(){if(e.destroyed)return;if(t.retries>=h.length){a("conn %s closed: will not re-add (max %s attempts)",t.addr,h.length);return}function n(){var n=u.createOutgoingTCPPeer(t.addr,e);n.retries=t.retries+1;e._queue.push(n);e._drain()}var r=h[t.retries];a("conn %s closed: will re-add to queue in %sms (attempt %s)",t.addr,r,t.retries+1);var i=setTimeout(n,r);if(i.unref)i.unref()})};m.prototype._onError=function(e){var t=this;t.emit("error",e);t.destroy()};m.prototype._validAddr=function(e){var t=this;var n=i(e);var r=n[0];var a=n[1];return a>0&&a<65535&&!(r==="127.0.0.1"&&a===t._port)}}).call(this,e("_process"),e("buffer").Buffer)},{"./lib/peer":12,"./lib/tcp-pool":13,_process:58,"addr-to-ip-port":46,buffer:47,debug:26,dezalgo:29,events:51,inherits:32,net:46,speedometer:33}],12:[function(e,t,n){var r=e("debug")("bittorrent-swarm:peer");var i=e("bittorrent-protocol");var a=25e3;var o=25e3;n.createWebRTCPeer=function(e,t){var n=new s(e.id);n.conn=e;n.swarm=t;if(n.conn.connected){n.onConnect()}else{n.conn.once("connect",function(){n.onConnect()});n.conn.once("error",function(e){n.destroy(e)});n.setConnectTimeout()}return n};n.createIncomingTCPPeer=function(e){var t=e.remoteAddress+":"+e.remotePort;var n=new s(t);n.conn=e;n.addr=t;n.onConnect();return n};n.createOutgoingTCPPeer=function(e,t){var n=new s(e);n.swarm=t;n.addr=e;return n};function s(e){var t=this;t.id=e;r("new Peer %s",e);t.addr=null;t.conn=null;t.swarm=null;t.wire=null;t.destroyed=false;t.timeout=null;t.retries=0;t.sentHandshake=false}s.prototype.onConnect=function(){var e=this;r("Peer %s connected",e.id);clearTimeout(e.connectTimeout);var t=e.conn;t.once("end",function(){e.destroy()});t.once("close",function(){e.destroy()});t.once("finish",function(){e.destroy()});t.once("error",function(t){e.destroy(t)});var n=e.wire=new i;n.once("end",function(){e.destroy()});n.once("finish",function(){e.destroy()});n.once("error",function(t){e.destroy(t)});n.once("handshake",function(t,n){e.onHandshake(t,n)});e.setHandshakeTimeout();t.pipe(n).pipe(t);if(e.swarm)e.handshake()};s.prototype.onHandshake=function(e,t){var n=this;if(!n.swarm)return;var i=e.toString("hex");var a=t.toString("hex");if(n.swarm.destroyed)return n.destroy(new Error("swarm already destroyed"));if(i!==n.swarm.infoHashHex){return n.destroy(new Error("unexpected handshake info hash for this swarm"))}if(a===n.swarm.peerIdHex){return n.destroy(new Error("refusing to handshake with self"))}r("Peer %s got handshake %s",n.id,i);clearTimeout(n.handshakeTimeout);n.retries=0;n.wire.on("download",function(e){n.swarm.downloaded+=e;n.swarm.downloadSpeed(e);n.swarm.emit("download",e)});n.wire.on("upload",function(e){n.swarm.uploaded+=e;n.swarm.uploadSpeed(e);n.swarm.emit("upload",e)});if(!n.sentHandshake)n.handshake();n.swarm.wires.push(n.wire);var o=n.addr;if(!o&&n.conn.remoteAddress){o=n.conn.remoteAddress+":"+n.conn.remotePort}n.swarm.emit("wire",n.wire,o)};s.prototype.handshake=function(){var e=this;e.wire.handshake(e.swarm.infoHash,e.swarm.peerId,e.swarm.handshakeOpts);e.sentHandshake=true};s.prototype.setConnectTimeout=function(){var e=this;clearTimeout(e.connectTimeout);e.connectTimeout=setTimeout(function(){e.destroy(new Error("connect timeout"))},a);if(e.connectTimeout.unref)e.connectTimeout.unref()};s.prototype.setHandshakeTimeout=function(){var e=this;clearTimeout(e.handshakeTimeout);e.handshakeTimeout=setTimeout(function(){e.destroy(new Error("handshake timeout"))},o);if(e.handshakeTimeout.unref)e.handshakeTimeout.unref()};s.prototype.destroy=function(e){var t=this;if(t.destroyed)return;t.destroyed=true;r("destroy Peer %s (error: %s)",t.id,e&&(e.message||e));t.swarm.wires.splice(t.swarm.wires.indexOf(t.wire),1);if(t.conn)t.conn.destroy();if(t.wire)t.wire.destroy();if(t.swarm){t.swarm.removePeer(t.id);t.swarm._drain()}clearTimeout(t.connectTimeout);clearTimeout(t.handshakeTimeout);t.conn=null;t.swarm=null;t.wire=null}},{"bittorrent-protocol":14,debug:26}],13:[function(e,t,n){(function(n){t.exports=f;var r=e("debug")("bittorrent-swarm:tcp-pool");var i=e("dezalgo");var a=e("net");var o=e("./peer");var s={};function f(e,t){var n=this;n.port=e;n.listening=false;n.swarms={};r("new TCPPool (port: %s, hostname: %s)",e,t);n.pendingConns=[];n.server=a.createServer();n.server.on("connection",function(e){n._onConnection(e)});n.server.on("error",function(e){n._onError(e)});n.server.on("listening",function(){n._onListening()});n.server.listen(n.port,t)}f.addSwarm=function(e){var t=s[e._port];if(!t)t=s[e._port]=new f(e._port,e._hostname);t.addSwarm(e);return t};f.removeSwarm=function(e,t){var r=s[e._port];if(!r)return t();r.removeSwarm(e);var i=0;for(var a in r.swarms){var o=r.swarms[a];if(o)i+=1}if(i===0)r.destroy(t);else n.nextTick(t)};f.getDefaultListenPort=function(e){for(var t in s){var n=s[t];if(n&&!n.swarms[e])return n.port}return 0};f.prototype.addSwarm=function(e){var t=this;if(t.swarms[e.infoHashHex]){n.nextTick(function(){e._onError(new Error("There is already a swarm with info hash "+e.infoHashHex+" "+"listening on port "+e._port))});return}t.swarms[e.infoHashHex]=e;if(t.listening){n.nextTick(function(){e._onListening(t.port)})}r("add swarm %s to tcp pool %s",e.infoHashHex,t.port)};f.prototype.removeSwarm=function(e){var t=this;r("remove swarm %s from tcp pool %s",e.infoHashHex,t.port);t.swarms[e.infoHashHex]=null};f.prototype.destroy=function(e){var t=this;if(e)e=i(e);r("destroy tcp pool %s",t.port);t.listening=false;t.pendingConns.forEach(function(e){e.destroy()});s[t.port]=null;try{t.server.close(e)}catch(n){if(e)e(null)}};f.prototype._onListening=function(){var e=this;var t=e.server.address().port;r("tcp pool listening on %s",t);if(t!==e.port){s[e.port]=null;e.port=t;s[e.port]=e}e.listening=true;for(var n in e.swarms){var i=e.swarms[n];if(i)i._onListening(e.port)}};f.prototype._onConnection=function(e){var t=this;t.pendingConns.push(e);e.once("close",n);function n(){t.pendingConns.splice(t.pendingConns.indexOf(e))}var r=o.createIncomingTCPPeer(e);r.wire.once("handshake",function(i,a){var o=i.toString("hex");n();e.removeListener("close",n);var s=t.swarms[o];if(s){r.swarm=s;s._addIncomingPeer(r);r.onHandshake(i,a)}else{var f=new Error("Unexpected info hash "+o+" from incoming peer "+r.id+": destroying peer");r.destroy(f)}})};f.prototype._onError=function(e){var t=this;t.destroy();for(var n in t.swarms){var r=t.swarms[n];if(r){t.removeSwarm(r);r._onError(e)}}}}).call(this,e("_process"))},{"./peer":12,_process:58,debug:26,dezalgo:29,net:46}],14:[function(e,t,n){(function(n){t.exports=w;var r=e("bitfield");var i=e("bencode");var a=e("debug")("bittorrent-protocol");var o=e("xtend");var s=e("inherits");var f=e("speedometer");var c=e("stream");var u=4e5;var l=new n("BitTorrent protocol");var p=new n([0,0,0,0]);var d=new n([0,0,0,1,0]);var h=new n([0,0,0,1,1]);var m=new n([0,0,0,1,2]);var v=new n([0,0,0,1,3]);var g=[0,0,0,0,0,0,0,0];var y=[0,0,0,3,9,0,0];function b(e,t,n,r){this.piece=e;this.offset=t;this.length=n;this.callback=r}s(w,c.Duplex);function w(){if(!(this instanceof w))return new w;c.Duplex.call(this);a("new wire");this.amChoking=true;this.amInterested=false;this.peerChoking=true;this.peerInterested=false;this.peerPieces=new r(0,{grow:u});this.peerExtensions={};this.requests=[];this.peerRequests=[];this.extendedMapping={};this.peerExtendedMapping={};this.extendedHandshake={};this.peerExtendedHandshake={};this._ext={};this._nextExt=1;this.uploaded=0;this.downloaded=0;this.uploadSpeed=f();this.downloadSpeed=f();this._keepAlive=null;this._timeout=null;this._timeoutMs=0;this.destroyed=false;this._finished=false;this._buffer=[];this._bufferSize=0;this._parser=null;this._parserSize=0;this.on("finish",this._onfinish);this._parseHandshake()}w.prototype.setKeepAlive=function(e){clearInterval(this._keepAlive);if(e===false)return;this._keepAlive=setInterval(this._push.bind(this,p),6e4)};w.prototype.setTimeout=function(e,t){this._clearTimeout();this._timeoutMs=e;this._timeoutUnref=!!t;this._updateTimeout()};w.prototype.destroy=function(){if(this.destroyed)return;this.destroyed=true;a("destroy");this.end()};w.prototype.end=function(){this._onUninterested();this._onChoke();c.Duplex.prototype.end.apply(this,arguments)};w.prototype.use=function(e){var t=e.prototype.name;if(!t){throw new Error("Extension API requires a named function, e.g. function name() {}")}var n=this._nextExt;var r=new e(this);function i(){}if(typeof r.onHandshake!=="function"){r.onHandshake=i}if(typeof r.onExtendedHandshake!=="function"){r.onExtendedHandshake=i}if(typeof r.onMessage!=="function"){r.onMessage=i}this.extendedMapping[n]=t;this._ext[t]=r;this[t]=r;this._nextExt+=1};w.prototype.handshake=function(e,t,r){if(typeof e==="string")e=new n(e,"hex");if(typeof t==="string")t=new n(t,"hex");if(e.length!==20||t.length!==20){throw new Error("infoHash and peerId MUST have length 20")}var i=new n(g);i[5]|=16;if(r&&r.dht)i[7]|=1;this._push(n.concat([l,i,e,t]));this._handshakeSent=true;if(this.peerExtensions.extended){this._sendExtendedHandshake()}};w.prototype._sendExtendedHandshake=function(){var e=o(this.extendedHandshake);e.m={};for(var t in this.extendedMapping){var n=this.extendedMapping[t];e.m[n]=Number(t)}this.extended(0,i.encode(e))};w.prototype.choke=function(){if(this.amChoking)return;this.amChoking=true;this.peerRequests.splice(0,this.peerRequests.length);this._push(d)};w.prototype.unchoke=function(){if(!this.amChoking)return;this.amChoking=false;this._push(h)};w.prototype.interested=function(){if(this.amInterested)return;this.amInterested=true;this._push(m)};w.prototype.uninterested=function(){if(!this.amInterested)return;this.amInterested=false;this._push(v)};w.prototype.have=function(e){this._message(4,[e],null)};w.prototype.bitfield=function(e){if(!n.isBuffer(e))e=e.buffer;this._message(5,[],e)};w.prototype.request=function(e,t,n,r){if(!r)r=function(){};if(this._finished)return r(new Error("wire is closed"));if(this.peerChoking)return r(new Error("peer is choking"));this.requests.push(new b(e,t,n,r));this._updateTimeout();this._message(6,[e,t,n],null)};w.prototype.piece=function(e,t,n){this.uploaded+=n.length;this.uploadSpeed(n.length);this.emit("upload",n.length);this._message(7,[e,t],n)};w.prototype.cancel=function(e,t,n){this._callback(_(this.requests,e,t,n),new Error("request was cancelled"),null);this._message(8,[e,t,n],null)};w.prototype.port=function(e){var t=new n(y);t.writeUInt16BE(e,5);this._push(t)};w.prototype.extended=function(e,t){if(typeof e==="string"&&this.peerExtendedMapping[e]){e=this.peerExtendedMapping[e]}if(typeof e==="number"){var r=new n([e]);var a=n.isBuffer(t)?t:i.encode(t);this._message(20,[],n.concat([r,a]))}else{throw new Error("Unrecognized extension: "+e)}};w.prototype._onKeepAlive=function(){this.emit("keep-alive")};w.prototype._onHandshake=function(e,t,n){this.peerId=t;this.peerExtensions=n;this.emit("handshake",e,t,n);var r;for(r in this._ext){this._ext[r].onHandshake(e,t,n)}if(n.extended&&this._handshakeSent){this._sendExtendedHandshake()}};w.prototype._onChoke=function(){this.peerChoking=true;this.emit("choke");while(this.requests.length){this._callback(this.requests.shift(),new Error("peer is choking"),null)}};w.prototype._onUnchoke=function(){this.peerChoking=false;this.emit("unchoke")};w.prototype._onInterested=function(){this.peerInterested=true;this.emit("interested")};w.prototype._onUninterested=function(){this.peerInterested=false;this.emit("uninterested")};w.prototype._onHave=function(e){if(this.peerPieces.get(e))return;this.peerPieces.set(e,true);this.emit("have",e)};w.prototype._onBitField=function(e){this.peerPieces=new r(e);this.emit("bitfield",this.peerPieces)};w.prototype._onRequest=function(e,t,n){if(this.amChoking)return;var r=function(r,a){if(i!==_(this.peerRequests,e,t,n))return;if(r)return;this.piece(e,t,a)}.bind(this);var i=new b(e,t,n,r);this.peerRequests.push(i);this.emit("request",e,t,n,r)};w.prototype._onPiece=function(e,t,n){this._callback(_(this.requests,e,t,n.length),null,n);this.downloaded+=n.length;this.downloadSpeed(n.length);this.emit("download",n.length);this.emit("piece",e,t,n)};w.prototype._onCancel=function(e,t,n){_(this.peerRequests,e,t,n);this.emit("cancel",e,t,n)};w.prototype._onPort=function(e){this.emit("port",e)};w.prototype._onExtended=function(e,t){var n,r;if(e===0&&(n=x(t))){this.peerExtendedHandshake=n;if(typeof n.m==="object"){for(r in n.m){this.peerExtendedMapping[r]=Number(n.m[r].toString())}}for(r in this._ext){if(this.peerExtendedMapping[r]){this._ext[r].onExtendedHandshake(this.peerExtendedHandshake)}}this.emit("extended","handshake",this.peerExtendedHandshake)}else{if(this.extendedMapping[e]){e=this.extendedMapping[e];if(this._ext[e]){this._ext[e].onMessage(t)}}this.emit("extended",e,t)}};w.prototype._onTimeout=function(){this._callback(this.requests.shift(),new Error("request has timed out"),null);this.emit("timeout")};w.prototype._push=function(e){if(this._finished)return;return this.push(e)};w.prototype._write=function(e,t,r){this._bufferSize+=e.length;this._buffer.push(e);while(this._bufferSize>=this._parserSize){var i=this._buffer.length===1?this._buffer[0]:n.concat(this._buffer);this._bufferSize-=this._parserSize;this._buffer=this._bufferSize?[i.slice(this._parserSize)]:[];this._parser(i.slice(0,this._parserSize))}r(null)};w.prototype._read=function(){};w.prototype._callback=function(e,t,n){if(!e)return;this._clearTimeout();if(!this.peerChoking&&!this._finished)this._updateTimeout();e.callback(t,n)};w.prototype._clearTimeout=function(){if(!this._timeout)return;clearTimeout(this._timeout);this._timeout=null};w.prototype._updateTimeout=function(){if(!this._timeoutMs||!this.requests.length||this._timeout)return;this._timeout=setTimeout(this._onTimeout.bind(this),this._timeoutMs);if(this._timeoutUnref&&this._timeout.unref)this._timeout.unref()};w.prototype._parse=function(e,t){this._parserSize=e;this._parser=t};w.prototype._message=function(e,t,r){var i=r?r.length:0;var a=new n(5+4*t.length);a.writeUInt32BE(a.length+i-4,0);a[4]=e;for(var o=0;o<t.length;o++){a.writeUInt32BE(t[o],5+4*o)}this._push(a);if(r)this._push(r)};w.prototype._onmessagelength=function(e){var t=e.readUInt32BE(0);if(t>0){this._parse(t,this._onmessage)}else{this._onKeepAlive();this._parse(4,this._onmessagelength)}};w.prototype._onmessage=function(e){this._parse(4,this._onmessagelength);switch(e[0]){case 0:return this._onChoke();case 1:return this._onUnchoke();case 2:return this._onInterested();case 3:return this._onUninterested();case 4:return this._onHave(e.readUInt32BE(1));case 5:return this._onBitField(e.slice(1));case 6:return this._onRequest(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 7:return this._onPiece(e.readUInt32BE(1),e.readUInt32BE(5),e.slice(9));case 8:return this._onCancel(e.readUInt32BE(1),e.readUInt32BE(5),e.readUInt32BE(9));case 9:return this._onPort(e.readUInt16BE(1));case 20:return this._onExtended(e.readUInt8(1),e.slice(2));default:return this.emit("unknownmessage",e)}};w.prototype._parseHandshake=function(){this._parse(1,function(e){var t=e.readUInt8(0);this._parse(t+48,function(e){var n=e.slice(0,t);if(n.toString()!=="BitTorrent protocol"){a("Error: wire not speaking BitTorrent protocol (%s)",n.toString());this.end();return}e=e.slice(t);this._onHandshake(e.slice(8,28),e.slice(28,48),{dht:!!(e[7]&1),extended:!!(e[5]&16)});this._parse(4,this._onmessagelength)}.bind(this))}.bind(this))};w.prototype._onfinish=function(){this._finished=true;this.push(null);while(this.read()){}clearInterval(this._keepAlive);this._parse(Number.MAX_VALUE,function(){});this.peerRequests=[];while(this.requests.length){this._callback(this.requests.shift(),new Error("wire was closed"),null)}};function _(e,t,n,r){for(var i=0;i<e.length;i++){var a=e[i];if(a.piece!==t||a.offset!==n||a.length!==r)continue;if(i===0)e.shift();else e.splice(i,1);return a}return null}function x(e){try{return i.decode(e)}catch(t){console.warn(t)}}}).call(this,e("buffer").Buffer)},{bencode:15,bitfield:19,buffer:47,debug:20,inherits:23,speedometer:24,stream:74,xtend:25}],15:[function(e,t,n){t.exports={encode:e("./lib/encode"),decode:e("./lib/decode")}},{"./lib/decode":16,"./lib/encode":18}],16:[function(e,t,n){(function(n){var r=e("./dict");function i(e,t){i.position=0;i.encoding=t||null;i.data=!n.isBuffer(e)?new n(e):e;return i.next()}i.position=0;i.data=null;i.encoding=null;i.next=function(){switch(i.data[i.position]){case 100:return i.dictionary();break;case 108:return i.list();break;case 105:return i.integer();break;default:return i.bytes();break}};i.find=function(e){var t=i.position;var n=i.data.length;var r=i.data;while(t<n){if(r[t]===e)return t;t++}throw new Error('Invalid data: Missing delimiter "'+String.fromCharCode(e)+'" [0x'+e.toString(16)+"]")};i.dictionary=function(){i.position++;var e=new r;while(i.data[i.position]!==101){e.binarySet(i.bytes(),i.next())}i.position++;return e};i.list=function(){i.position++;var e=[];while(i.data[i.position]!==101){e.push(i.next())}i.position++;return e};i.integer=function(){var e=i.find(101);var t=i.data.toString("ascii",i.position+1,e);i.position+=e+1-i.position;return parseInt(t,10)};i.bytes=function(){var e=i.find(58);var t=parseInt(i.data.toString("ascii",i.position,e),10);var n=++e+t;i.position=n;return i.encoding?i.data.toString(i.encoding,e,n):i.data.slice(e,n)};t.exports=i}).call(this,e("buffer").Buffer)},{"./dict":17,buffer:47}],17:[function(e,t,n){var r=t.exports=function i(){Object.defineProperty(this,"_keys",{enumerable:false,value:[]})};r.prototype.binaryKeys=function a(){return this._keys.slice()};r.prototype.binarySet=function o(e,t){this._keys.push(e);this[e]=t}},{}],18:[function(e,t,n){(function(e){function n(t){var r=[];n._encode(r,t);return e.concat(r)}n._floatConversionDetected=false;n._encode=function(t,r){if(e.isBuffer(r)){t.push(new e(r.length+":"));t.push(r);return}switch(typeof r){case"string":n.bytes(t,r);break;case"number":n.number(t,r);break;case"object":r.constructor===Array?n.list(t,r):n.dict(t,r);break}};var r=new e("e"),i=new e("d"),a=new e("l");n.bytes=function(t,n){t.push(new e(e.byteLength(n)+":"+n))};n.number=function(t,r){var i=2147483648;var a=r/i<<0;var o=r%i<<0;var s=a*i+o;t.push(new e("i"+s+"e"));if(s!==r&&!n._floatConversionDetected){n._floatConversionDetected=true;console.warn('WARNING: Possible data corruption detected with value "'+r+'":','Bencoding only defines support for integers, value was converted to "'+s+'"');console.trace()}};n.dict=function(e,t){e.push(i);var a=0;var o;var s=Object.keys(t).sort();var f=s.length;for(;a<f;a++){o=s[a];n.bytes(e,o);n._encode(e,t[o])}e.push(r)};n.list=function(e,t){var i=0,o=1;var s=t.length;e.push(a);for(;i<s;i++){n._encode(e,t[i])}e.push(r)};t.exports=n}).call(this,e("buffer").Buffer)},{buffer:47}],19:[function(e,t,n){arguments[4][10][0].apply(n,arguments)},{buffer:47,dup:10}],20:[function(e,t,n){n=t.exports=e("./debug");n.log=o;n.formatArgs=a;n.save=s;n.load=f;n.useColors=i;var r;if(typeof chrome!=="undefined"&&typeof chrome.storage!=="undefined")r=chrome.storage.local;else r=c();n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"];function i(){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}n.formatters.j=function(e){return JSON.stringify(e)};function a(){var e=arguments;var t=this.useColors;e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+n.humanize(this.diff);if(!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0;var a=0;e[0].replace(/%[a-z%]/g,function(e){if("%%"===e)return;i++;if("%c"===e){a=i}});e.splice(a,0,r);return e}function o(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function s(e){try{if(null==e){r.removeItem("debug")}else{r.debug=e}}catch(t){}}function f(){var e;try{e=r.debug}catch(t){}return e}n.enable(f());function c(){try{return window.localStorage}catch(e){}}},{"./debug":21}],21:[function(e,t,n){n=t.exports=o;n.coerce=u;n.disable=f;n.enable=s;n.enabled=c;n.humanize=e("ms");n.names=[];n.skips=[];n.formatters={};var r=0;var i;function a(){return n.colors[r++%n.colors.length]}function o(e){function t(){}t.enabled=false;function r(){var e=r;var t=+new Date;var o=t-(i||t);e.diff=o;e.prev=i;e.curr=t;i=t;if(null==e.useColors)e.useColors=n.useColors();if(null==e.color&&e.useColors)e.color=a();var s=Array.prototype.slice.call(arguments);s[0]=n.coerce(s[0]);if("string"!==typeof s[0]){s=["%o"].concat(s)}var f=0;s[0]=s[0].replace(/%([a-z%])/g,function(t,r){if(t==="%%")return t;f++;var i=n.formatters[r];if("function"===typeof i){var a=s[f];t=i.call(e,a);s.splice(f,1);f--}return t});if("function"===typeof n.formatArgs){s=n.formatArgs.apply(e,s)}var c=r.log||n.log||console.log.bind(console);c.apply(e,s)}r.enabled=true;var o=n.enabled(e)?r:t;o.namespace=e;return o}function s(e){n.save(e);var t=(e||"").split(/[\s,]+/);var r=t.length;for(var i=0;i<r;i++){if(!t[i])continue;e=t[i].replace(/\*/g,".*?");if(e[0]==="-"){n.skips.push(new RegExp("^"+e.substr(1)+"$"))}else{n.names.push(new RegExp("^"+e+"$"))}}}function f(){n.enable("")}function c(e){var t,r;for(t=0,r=n.skips.length;t<r;t++){if(n.skips[t].test(e)){return false}}for(t=0,r=n.names.length;t<r;t++){if(n.names[t].test(e)){return true}}return false}function u(e){if(e instanceof Error)return e.stack||e.message;return e}},{ms:22}],22:[function(e,t,n){var r=1e3;var i=r*60;var a=i*60;var o=a*24;var s=o*365.25;t.exports=function(e,t){t=t||{};if("string"==typeof e)return f(e);return t.long?u(e):c(e)};function f(e){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 n=parseFloat(t[1]);var f=(t[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return n*s;case"days":case"day":case"d":return n*o;case"hours":case"hour":case"hrs":case"hr":case"h":return n*a;case"minutes":case"minute":case"mins":case"min":case"m":return n*i;case"seconds":case"second":case"secs":case"sec":case"s":return n*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}function c(e){if(e>=o)return Math.round(e/o)+"d";if(e>=a)return Math.round(e/a)+"h";if(e>=i)return Math.round(e/i)+"m";if(e>=r)return Math.round(e/r)+"s";return e+"ms"}function u(e){return l(e,o,"day")||l(e,a,"hour")||l(e,i,"minute")||l(e,r,"second")||e+" ms"}function l(e,t,n){if(e<t)return;if(e<t*1.5)return Math.floor(e/t)+" "+n;return Math.ceil(e/t)+" "+n+"s"}},{}],23:[function(e,t,n){if(typeof Object.create==="function"){t.exports=function r(e,t){e.super_=t;e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}})}}else{t.exports=function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype;e.prototype=new n;e.prototype.constructor=e}}},{}],24:[function(e,t,n){var r=1;var i=65535;var a=4;var o=function(){r=r+1&i};var s=setInterval(o,1e3/a|0);if(s.unref)s.unref();t.exports=function(e){var t=a*(e||5);var n=[0];var o=1;var s=r-1&i;return function(e){var f=r-s&i;if(f>t)f=t;s=r;while(f--){if(o===t)o=0;n[o]=n[o===0?t-1:o-1];o++}if(e)n[o-1]+=e;var c=n[o-1];var u=n.length<t?0:n[o===t?0:o];return n.length<a?c:(c-u)*a/n.length}}},{}],25:[function(e,t,n){t.exports=r;function r(){var e={};for(var t=0;t<arguments.length;t++){
var n=arguments[t];for(var r in n){if(n.hasOwnProperty(r)){e[r]=n[r]}}}return e}},{}],26:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{"./debug":27,dup:20}],27:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,ms:28}],28:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{dup:22}],29:[function(e,t,n){var r=e("wrappy");t.exports=r(a);var i=e("asap");function a(e){var t=true;i(function(){t=false});return function n(){var n=arguments;var r=this;if(t)i(function(){e.apply(r,n)});else e.apply(r,n)}}},{asap:30,wrappy:31}],30:[function(e,t,n){(function(e){var n={task:void 0,next:null};var r=n;var i=false;var a=void 0;var o=false;function s(){while(n.next){n=n.next;var e=n.task;n.task=void 0;var t=n.domain;if(t){n.domain=void 0;t.enter()}try{e()}catch(r){if(o){if(t){t.exit()}setTimeout(s,0);if(t){t.enter()}throw r}else{setTimeout(function(){throw r},0)}}if(t){t.exit()}}i=false}if(typeof e!=="undefined"&&e.nextTick){o=true;a=function(){e.nextTick(s)}}else if(typeof setImmediate==="function"){if(typeof window!=="undefined"){a=setImmediate.bind(window,s)}else{a=function(){setImmediate(s)}}}else if(typeof MessageChannel!=="undefined"){var f=new MessageChannel;f.port1.onmessage=s;a=function(){f.port2.postMessage(0)}}else{a=function(){setTimeout(s,0)}}function c(t){r=r.next={task:t,domain:o&&e.domain,next:null};if(!i){i=true;a()}}t.exports=c}).call(this,e("_process"))},{_process:58}],31:[function(e,t,n){t.exports=r;function r(e,t){if(e&&t)return r(e)(t);if(typeof e!=="function")throw new TypeError("need wrapper function");Object.keys(e).forEach(function(t){n[t]=e[t]});return n;function n(){var t=new Array(arguments.length);for(var n=0;n<t.length;n++){t[n]=arguments[n]}var r=e.apply(this,t);var i=t[t.length-1];if(typeof r==="function"&&r!==i){Object.keys(i).forEach(function(e){r[e]=i[e]})}return r}}},{}],32:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{dup:23}],33:[function(e,t,n){arguments[4][24][0].apply(n,arguments)},{dup:24}],34:[function(e,t,n){(function(n){var r=e("inherits");var i=e("readable-stream").Transform;var a=e("defined");t.exports=o;r(o,i);function o(e,t){if(!(this instanceof o))return new o(e,t);i.call(this);if(!t)t={};if(typeof e==="object"){t=e;e=t.size}this.size=e||512;if(t.nopad)this._zeroPadding=false;else this._zeroPadding=a(t.zeroPadding,true);this._buffered=[];this._bufferedBytes=0}o.prototype._transform=function(e,t,r){this._bufferedBytes+=e.length;this._buffered.push(e);while(this._bufferedBytes>=this.size){var i=n.concat(this._buffered);this._bufferedBytes-=this.size;this.push(i.slice(0,this.size));this._buffered=[i.slice(this.size,i.length)]}r()};o.prototype._flush=function(){if(this._bufferedBytes&&this._zeroPadding){var e=new n(this.size-this._bufferedBytes);e.fill(0);this._buffered.push(e);this.push(n.concat(this._buffered));this._buffered=null}else if(this._bufferedBytes){this.push(n.concat(this._buffered));this._buffered=null}this.push(null)}}).call(this,e("buffer").Buffer)},{buffer:47,defined:35,inherits:125,"readable-stream":44}],35:[function(e,t,n){t.exports=function(){for(var e=0;e<arguments.length;e++){if(arguments[e]!==undefined)return arguments[e]}}},{}],36:[function(e,t,n){(function(n){t.exports=s;var r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};var i=e("core-util-is");i.inherits=e("inherits");var a=e("./_stream_readable");var o=e("./_stream_writable");i.inherits(s,a);c(r(o.prototype),function(e){if(!s.prototype[e])s.prototype[e]=o.prototype[e]});function s(e){if(!(this instanceof s))return new s(e);a.call(this,e);o.call(this,e);if(e&&e.readable===false)this.readable=false;if(e&&e.writable===false)this.writable=false;this.allowHalfOpen=true;if(e&&e.allowHalfOpen===false)this.allowHalfOpen=false;this.once("end",f)}function f(){if(this.allowHalfOpen||this._writableState.ended)return;n.nextTick(this.end.bind(this))}function c(e,t){for(var n=0,r=e.length;n<r;n++){t(e[n],n)}}}).call(this,e("_process"))},{"./_stream_readable":38,"./_stream_writable":40,_process:58,"core-util-is":41,inherits:125}],37:[function(e,t,n){t.exports=a;var r=e("./_stream_transform");var i=e("core-util-is");i.inherits=e("inherits");i.inherits(a,r);function a(e){if(!(this instanceof a))return new a(e);r.call(this,e)}a.prototype._transform=function(e,t,n){n(null,e)}},{"./_stream_transform":39,"core-util-is":41,inherits:125}],38:[function(e,t,n){(function(n){t.exports=u;var r=e("isarray");var i=e("buffer").Buffer;u.ReadableState=c;var a=e("events").EventEmitter;if(!a.listenerCount)a.listenerCount=function(e,t){return e.listeners(t).length};var o=e("stream");var s=e("core-util-is");s.inherits=e("inherits");var f;s.inherits(u,o);function c(t,n){t=t||{};var r=t.highWaterMark;this.highWaterMark=r||r===0?r:16*1024;this.highWaterMark=~~this.highWaterMark;this.buffer=[];this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=false;this.ended=false;this.endEmitted=false;this.reading=false;this.calledRead=false;this.sync=true;this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.objectMode=!!t.objectMode;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 u(e){if(!(this instanceof u))return new u(e);this._readableState=new c(e,this);this.readable=true;o.call(this)}u.prototype.push=function(e,t){var n=this._readableState;if(typeof e==="string"&&!n.objectMode){t=t||n.defaultEncoding;if(t!==n.encoding){e=new i(e,t);t=""}}return l(this,n,e,t,false)};u.prototype.unshift=function(e){var t=this._readableState;return l(this,t,e,"",true)};function l(e,t,n,r,i){var a=v(t,n);if(a){e.emit("error",a)}else if(n===null||n===undefined){t.reading=false;if(!t.ended)g(e,t)}else if(t.objectMode||n&&n.length>0){if(t.ended&&!i){var o=new Error("stream.push() after EOF");e.emit("error",o)}else if(t.endEmitted&&i){var o=new Error("stream.unshift() after end event");e.emit("error",o)}else{if(t.decoder&&!i&&!r)n=t.decoder.write(n);t.length+=t.objectMode?1:n.length;if(i){t.buffer.unshift(n)}else{t.reading=false;t.buffer.push(n)}if(t.needReadable)y(e);w(e,t)}}else if(!i){t.reading=false}return p(t)}function p(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}u.prototype.setEncoding=function(t){if(!f)f=e("string_decoder/").StringDecoder;this._readableState.decoder=new f(t);this._readableState.encoding=t};var d=8388608;function h(e){if(e>=d){e=d}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(e===null||isNaN(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=h(e);if(e>t.length){if(!t.ended){t.needReadable=true;return 0}else return t.length}return e}u.prototype.read=function(e){var t=this._readableState;t.calledRead=true;var n=e;var r;if(typeof e!=="number"||e>0)t.emittedReadable=false;if(e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended)){y(this);return null}e=m(e,t);if(e===0&&t.ended){r=null;if(t.length>0&&t.decoder){r=A(e,t);t.length-=r.length}if(t.length===0)T(this);return r}var i=t.needReadable;if(t.length-e<=t.highWaterMark)i=true;if(t.ended||t.reading)i=false;if(i){t.reading=true;t.sync=true;if(t.length===0)t.needReadable=true;this._read(t.highWaterMark);t.sync=false}if(i&&!t.reading)e=m(n,t);if(e>0)r=A(e,t);else r=null;if(r===null){t.needReadable=true;e=0}t.length-=e;if(t.length===0&&!t.ended)t.needReadable=true;if(t.ended&&!t.endEmitted&&t.length===0)T(this);return r};function v(e,t){var n=null;if(!i.isBuffer(t)&&"string"!==typeof t&&t!==null&&t!==undefined&&!e.objectMode){n=new TypeError("Invalid non-string/buffer chunk")}return n}function g(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();if(n&&n.length){t.buffer.push(n);t.length+=t.objectMode?1:n.length}}t.ended=true;if(t.length>0)y(e);else T(e)}function y(e){var t=e._readableState;t.needReadable=false;if(t.emittedReadable)return;t.emittedReadable=true;if(t.sync)n.nextTick(function(){b(e)});else b(e)}function b(e){e.emit("readable")}function w(e,t){if(!t.readingMore){t.readingMore=true;n.nextTick(function(){_(e,t)})}}function _(e,t){var n=t.length;while(!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark){e.read(0);if(n===t.length)break;else n=t.length}t.readingMore=false}u.prototype._read=function(e){this.emit("error",new Error("not implemented"))};u.prototype.pipe=function(e,t){var i=this;var o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e);break}o.pipesCount+=1;var s=(!t||t.end!==false)&&e!==n.stdout&&e!==n.stderr;var f=s?u:p;if(o.endEmitted)n.nextTick(f);else i.once("end",f);e.on("unpipe",c);function c(e){if(e!==i)return;p()}function u(){e.end()}var l=x(i);e.on("drain",l);function p(){e.removeListener("close",h);e.removeListener("finish",m);e.removeListener("drain",l);e.removeListener("error",d);e.removeListener("unpipe",c);i.removeListener("end",u);i.removeListener("end",p);if(!e._writableState||e._writableState.needDrain)l()}function d(t){v();e.removeListener("error",d);if(a.listenerCount(e,"error")===0)e.emit("error",t)}if(!e._events||!e._events.error)e.on("error",d);else if(r(e._events.error))e._events.error.unshift(d);else e._events.error=[d,e._events.error];function h(){e.removeListener("finish",m);v()}e.once("close",h);function m(){e.removeListener("close",h);v()}e.once("finish",m);function v(){i.unpipe(e)}e.emit("pipe",i);if(!o.flowing){this.on("readable",E);o.flowing=true;n.nextTick(function(){k(i)})}return e};function x(e){return function(){var t=this;var n=e._readableState;n.awaitDrain--;if(n.awaitDrain===0)k(e)}}function k(e){var t=e._readableState;var n;t.awaitDrain=0;function r(e,r,i){var a=e.write(n);if(false===a){t.awaitDrain++}}while(t.pipesCount&&null!==(n=e.read())){if(t.pipesCount===1)r(t.pipes,0,null);else C(t.pipes,r);e.emit("data",n);if(t.awaitDrain>0)return}if(t.pipesCount===0){t.flowing=false;if(a.listenerCount(e,"data")>0)S(e);return}t.ranOut=true}function E(){if(this._readableState.ranOut){this._readableState.ranOut=false;k(this)}}u.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;this.removeListener("readable",E);t.flowing=false;if(e)e.emit("unpipe",this);return this}if(!e){var n=t.pipes;var r=t.pipesCount;t.pipes=null;t.pipesCount=0;this.removeListener("readable",E);t.flowing=false;for(var i=0;i<r;i++)n[i].emit("unpipe",this);return this}var i=I(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};u.prototype.on=function(e,t){var n=o.prototype.on.call(this,e,t);if(e==="data"&&!this._readableState.flowing)S(this);if(e==="readable"&&this.readable){var r=this._readableState;if(!r.readableListening){r.readableListening=true;r.emittedReadable=false;r.needReadable=true;if(!r.reading){this.read(0)}else if(r.length){y(this,r)}}}return n};u.prototype.addListener=u.prototype.on;u.prototype.resume=function(){S(this);this.read(0);this.emit("resume")};u.prototype.pause=function(){S(this,true);this.emit("pause")};function S(e,t){var r=e._readableState;if(r.flowing){throw new Error("Cannot switch to old mode now.")}var i=t||false;var a=false;e.readable=true;e.pipe=o.prototype.pipe;e.on=e.addListener=o.prototype.on;e.on("readable",function(){a=true;var t;while(!i&&null!==(t=e.read()))e.emit("data",t);if(t===null){a=false;e._readableState.needReadable=true}});e.pause=function(){i=true;this.emit("pause")};e.resume=function(){i=false;if(a)n.nextTick(function(){e.emit("readable")});else this.read(0);this.emit("resume")};e.emit("readable")}u.prototype.wrap=function(e){var t=this._readableState;var n=false;var r=this;e.on("end",function(){if(t.decoder&&!t.ended){var e=t.decoder.end();if(e&&e.length)r.push(e)}r.push(null)});e.on("data",function(i){if(t.decoder)i=t.decoder.write(i);if(t.objectMode&&(i===null||i===undefined))return;else if(!t.objectMode&&(!i||!i.length))return;var a=r.push(i);if(!a){n=true;e.pause()}});for(var i in e){if(typeof e[i]==="function"&&typeof this[i]==="undefined"){this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i)}}var a=["error","close","destroy","pause","resume"];C(a,function(t){e.on(t,r.emit.bind(r,t))});r._read=function(t){if(n){n=false;e.resume()}};return r};u._fromList=A;function A(e,t){var n=t.buffer;var r=t.length;var a=!!t.decoder;var o=!!t.objectMode;var s;if(n.length===0)return null;if(r===0)s=null;else if(o)s=n.shift();else if(!e||e>=r){if(a)s=n.join("");else s=i.concat(n,r);n.length=0}else{if(e<n[0].length){var f=n[0];s=f.slice(0,e);n[0]=f.slice(e)}else if(e===n[0].length){s=n.shift()}else{if(a)s="";else s=new i(e);var c=0;for(var u=0,l=n.length;u<l&&c<e;u++){var f=n[0];var p=Math.min(e-c,f.length);if(a)s+=f.slice(0,p);else f.copy(s,c,0,p);if(p<f.length)n[0]=f.slice(p);else n.shift();c+=p}}}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.calledRead){t.ended=true;n.nextTick(function(){if(!t.endEmitted&&t.length===0){t.endEmitted=true;e.readable=false;e.emit("end")}})}}function C(e,t){for(var n=0,r=e.length;n<r;n++){t(e[n],n)}}function I(e,t){for(var n=0,r=e.length;n<r;n++){if(e[n]===t)return n}return-1}}).call(this,e("_process"))},{_process:58,buffer:47,"core-util-is":41,events:51,inherits:125,isarray:42,stream:74,"string_decoder/":43}],39:[function(e,t,n){t.exports=s;var r=e("./_stream_duplex");var i=e("core-util-is");i.inherits=e("inherits");i.inherits(s,r);function a(e,t){this.afterTransform=function(e,n){return o(t,e,n)};this.needTransform=false;this.transforming=false;this.writecb=null;this.writechunk=null}function o(e,t,n){var r=e._transformState;r.transforming=false;var i=r.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));r.writechunk=null;r.writecb=null;if(n!==null&&n!==undefined)e.push(n);if(i)i(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);r.call(this,e);var t=this._transformState=new a(e,this);var n=this;this._readableState.needReadable=true;this._readableState.sync=false;this.once("finish",function(){if("function"===typeof this._flush)this._flush(function(e){f(n,e)});else f(n)})}s.prototype.push=function(e,t){this._transformState.needTransform=false;return r.prototype.push.call(this,e,t)};s.prototype._transform=function(e,t,n){throw new Error("not implemented")};s.prototype._write=function(e,t,n){var r=this._transformState;r.writecb=n;r.writechunk=e;r.writeencoding=t;if(!r.transforming){var i=this._readableState;if(r.needTransform||i.needReadable||i.length<i.highWaterMark)this._read(i.highWaterMark)}};s.prototype._read=function(e){var t=this._transformState;if(t.writechunk!==null&&t.writecb&&!t.transforming){t.transforming=true;this._transform(t.writechunk,t.writeencoding,t.afterTransform)}else{t.needTransform=true}};function f(e,t){if(t)return e.emit("error",t);var n=e._writableState;var r=e._readableState;var i=e._transformState;if(n.length)throw new Error("calling transform done when ws.length != 0");if(i.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}},{"./_stream_duplex":36,"core-util-is":41,inherits:125}],40:[function(e,t,n){(function(n){t.exports=f;var r=e("buffer").Buffer;f.WritableState=s;var i=e("core-util-is");i.inherits=e("inherits");var a=e("stream");i.inherits(f,a);function o(e,t,n){this.chunk=e;this.encoding=t;this.callback=n}function s(e,t){e=e||{};var n=e.highWaterMark;this.highWaterMark=n||n===0?n:16*1024;this.objectMode=!!e.objectMode;this.highWaterMark=~~this.highWaterMark;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;var r=e.decodeStrings===false;this.decodeStrings=!r;this.defaultEncoding=e.defaultEncoding||"utf8";this.length=0;this.writing=false;this.sync=true;this.bufferProcessing=false;this.onwrite=function(e){v(t,e)};this.writecb=null;this.writelen=0;this.buffer=[];this.errorEmitted=false}function f(t){var n=e("./_stream_duplex");if(!(this instanceof f)&&!(this instanceof n))return new f(t);this._writableState=new s(t,this);this.writable=true;a.call(this)}f.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))};function c(e,t,r){var i=new Error("write after end");e.emit("error",i);n.nextTick(function(){r(i)})}function u(e,t,i,a){var o=true;if(!r.isBuffer(i)&&"string"!==typeof i&&i!==null&&i!==undefined&&!t.objectMode){var s=new TypeError("Invalid non-string/buffer chunk");e.emit("error",s);n.nextTick(function(){a(s)});o=false}return o}f.prototype.write=function(e,t,n){var i=this._writableState;var a=false;if(typeof t==="function"){n=t;t=null}if(r.isBuffer(e))t="buffer";else if(!t)t=i.defaultEncoding;if(typeof n!=="function")n=function(){};if(i.ended)c(this,i,n);else if(u(this,i,e,n))a=p(this,i,e,t,n);return a};function l(e,t,n){if(!e.objectMode&&e.decodeStrings!==false&&typeof t==="string"){t=new r(t,n)}return t}function p(e,t,n,i,a){n=l(t,n,i);if(r.isBuffer(n))i="buffer";var s=t.objectMode?1:n.length;t.length+=s;var f=t.length<t.highWaterMark;if(!f)t.needDrain=true;if(t.writing)t.buffer.push(new o(n,i,a));else d(e,t,s,n,i,a);return f}function d(e,t,n,r,i,a){t.writelen=n;t.writecb=a;t.writing=true;t.sync=true;e._write(r,i,t.onwrite);t.sync=false}function h(e,t,r,i,a){if(r)n.nextTick(function(){a(i)});else a(i);e._writableState.errorEmitted=true;e.emit("error",i)}function m(e){e.writing=false;e.writecb=null;e.length-=e.writelen;e.writelen=0}function v(e,t){var r=e._writableState;var i=r.sync;var a=r.writecb;m(r);if(t)h(e,r,i,t,a);else{var o=w(e,r);if(!o&&!r.bufferProcessing&&r.buffer.length)b(e,r);if(i){n.nextTick(function(){g(e,r,o,a)})}else{g(e,r,o,a)}}}function g(e,t,n,r){if(!n)y(e,t);r();if(n)_(e,t)}function y(e,t){if(t.length===0&&t.needDrain){t.needDrain=false;e.emit("drain")}}function b(e,t){t.bufferProcessing=true;for(var n=0;n<t.buffer.length;n++){var r=t.buffer[n];var i=r.chunk;var a=r.encoding;var o=r.callback;var s=t.objectMode?1:i.length;d(e,t,s,i,a,o);if(t.writing){n++;break}}t.bufferProcessing=false;if(n<t.buffer.length)t.buffer=t.buffer.slice(n);else t.buffer.length=0}f.prototype._write=function(e,t,n){n(new Error("not implemented"))};f.prototype.end=function(e,t,n){var r=this._writableState;if(typeof e==="function"){n=e;e=null;t=null}else if(typeof t==="function"){n=t;t=null}if(typeof e!=="undefined"&&e!==null)this.write(e,t);if(!r.ending&&!r.finished)x(this,r,n)};function w(e,t){return t.ending&&t.length===0&&!t.finished&&!t.writing}function _(e,t){var n=w(e,t);if(n){t.finished=true;e.emit("finish")}return n}function x(e,t,r){t.ending=true;_(e,t);if(r){if(t.finished)n.nextTick(r);else e.once("finish",r)}t.ended=true}}).call(this,e("_process"))},{"./_stream_duplex":36,_process:58,buffer:47,"core-util-is":41,inherits:125,stream:74}],41:[function(e,t,n){(function(e){function t(e){return Array.isArray(e)}n.isArray=t;function r(e){return typeof e==="boolean"}n.isBoolean=r;function i(e){return e===null}n.isNull=i;function a(e){return e==null}n.isNullOrUndefined=a;function o(e){return typeof e==="number"}n.isNumber=o;function s(e){return typeof e==="string"}n.isString=s;function f(e){return typeof e==="symbol"}n.isSymbol=f;function c(e){return e===void 0}n.isUndefined=c;function u(e){return l(e)&&g(e)==="[object RegExp]"}n.isRegExp=u;function l(e){return typeof e==="object"&&e!==null}n.isObject=l;function p(e){return l(e)&&g(e)==="[object Date]"}n.isDate=p;function d(e){return l(e)&&(g(e)==="[object Error]"||e instanceof Error)}n.isError=d;function h(e){return typeof e==="function"}n.isFunction=h;function m(e){return e===null||typeof e==="boolean"||typeof e==="number"||typeof e==="string"||typeof e==="symbol"||typeof e==="undefined"}n.isPrimitive=m;function v(t){return e.isBuffer(t)}n.isBuffer=v;function g(e){return Object.prototype.toString.call(e)}}).call(this,e("buffer").Buffer)},{buffer:47}],42:[function(e,t,n){t.exports=Array.isArray||function(e){return Object.prototype.toString.call(e)=="[object Array]"}},{}],43:[function(e,t,n){var r=e("buffer").Buffer;var i=r.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return true;default:return false}};function a(e){if(e&&!i(e)){throw new Error("Unknown encoding: "+e)}}var o=n.StringDecoder=function(e){this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,"");a(e);switch(this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2;this.detectIncompleteChar=f;break;case"base64":this.surrogateSize=3;this.detectIncompleteChar=c;break;default:this.write=s;return}this.charBuffer=new r(6);this.charReceived=0;this.charLength=0};o.prototype.write=function(e){var t="";while(this.charLength){var n=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;e.copy(this.charBuffer,this.charReceived,0,n);this.charReceived+=n;if(this.charReceived<this.charLength){return""}e=e.slice(n,e.length);t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var r=t.charCodeAt(t.length-1);if(r>=55296&&r<=56319){this.charLength+=this.surrogateSize;t="";continue}this.charReceived=this.charLength=0;if(e.length===0){return t}break}this.detectIncompleteChar(e);var i=e.length;if(this.charLength){e.copy(this.charBuffer,0,e.length-this.charReceived,i);i-=this.charReceived}t+=e.toString(this.encoding,0,i);var i=t.length-1;var r=t.charCodeAt(i);if(r>=55296&&r<=56319){var a=this.surrogateSize;this.charLength+=a;this.charReceived+=a;this.charBuffer.copy(this.charBuffer,a,0,a);e.copy(this.charBuffer,0,0,a);return t.substring(0,i)}return t};o.prototype.detectIncompleteChar=function(e){var t=e.length>=3?3:e.length;for(;t>0;t--){var n=e[e.length-t];if(t==1&&n>>5==6){this.charLength=2;break}if(t<=2&&n>>4==14){this.charLength=3;break}if(t<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=t};o.prototype.end=function(e){var t="";if(e&&e.length)t=this.write(e);if(this.charReceived){var n=this.charReceived;var r=this.charBuffer;var i=this.encoding;t+=r.slice(0,n).toString(i)}return t};function s(e){return e.toString(this.encoding)}function f(e){this.charReceived=e.length%2;this.charLength=this.charReceived?2:0}function c(e){this.charReceived=e.length%3;this.charLength=this.charReceived?3:0}},{buffer:47}],44:[function(e,t,n){var r=e("stream");n=t.exports=e("./lib/_stream_readable.js");n.Stream=r;n.Readable=n;n.Writable=e("./lib/_stream_writable.js");n.Duplex=e("./lib/_stream_duplex.js");n.Transform=e("./lib/_stream_transform.js");n.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":36,"./lib/_stream_passthrough.js":37,"./lib/_stream_readable.js":38,"./lib/_stream_transform.js":39,"./lib/_stream_writable.js":40,stream:74}],45:[function(e,t,n){},{}],46:[function(e,t,n){arguments[4][45][0].apply(n,arguments)},{dup:45}],47:[function(e,t,n){var r=e("base64-js");var i=e("ieee754");var a=e("is-array");n.Buffer=f;n.SlowBuffer=b;n.INSPECT_MAX_BYTES=50;f.poolSize=8192;var o=1073741823;var s={};f.TYPED_ARRAY_SUPPORT=function(){try{var e=new ArrayBuffer(0);var t=new Uint8Array(e);t.foo=function(){return 42};return t.foo()===42&&typeof t.subarray==="function"&&new Uint8Array(1).subarray(1,1).byteLength===0}catch(n){return false}}();function f(e){if(!(this instanceof f)){if(arguments.length>1)return new f(e,arguments[1]);return new f(e)}this.length=0;this.parent=undefined;if(typeof e==="number"){return c(this,e)}if(typeof e==="string"){return u(this,e,arguments.length>1?arguments[1]:"utf8")}return l(this,e)}function c(e,t){e=g(e,t<0?0:y(t)|0);if(!f.TYPED_ARRAY_SUPPORT){for(var n=0;n<t;n++){e[n]=0}}return e}function u(e,t,n){if(typeof n!=="string"||n==="")n="utf8";var r=w(t,n)|0;e=g(e,r);e.write(t,n);return e}function l(e,t){if(f.isBuffer(t))return p(e,t);if(a(t))return d(e,t);if(t==null){throw new TypeError("must start with number, buffer, array or string")}if(typeof ArrayBuffer!=="undefined"&&t.buffer instanceof ArrayBuffer){return h(e,t)}if(t.length)return m(e,t);return v(e,t)}function p(e,t){var n=y(t.length)|0;e=g(e,n);t.copy(e,0,0,n);return e}function d(e,t){var n=y(t.length)|0;e=g(e,n);for(var r=0;r<n;r+=1){e[r]=t[r]&255}return e}function h(e,t){var n=y(t.length)|0;e=g(e,n);for(var r=0;r<n;r+=1){e[r]=t[r]&255}return e}function m(e,t){var n=y(t.length)|0;e=g(e,n);for(var r=0;r<n;r+=1){e[r]=t[r]&255}return e}function v(e,t){var n;var r=0;if(t.type==="Buffer"&&a(t.data)){n=t.data;r=y(n.length)|0}e=g(e,r);for(var i=0;i<r;i+=1){e[i]=n[i]&255}return e}function g(e,t){if(f.TYPED_ARRAY_SUPPORT){e=f._augment(new Uint8Array(t))}else{e.length=t;e._isBuffer=true}var n=t!==0&&t<=f.poolSize>>>1;if(n)e.parent=s;return e}function y(e){if(e>=o){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+o.toString(16)+" bytes")}return e|0}function b(e,t){if(!(this instanceof b))return new b(e,t);var n=new f(e,t);delete n.parent;return n}f.isBuffer=function X(e){return!!(e!=null&&e._isBuffer)};f.compare=function Z(e,t){if(!f.isBuffer(e)||!f.isBuffer(t)){throw new TypeError("Arguments must be Buffers")}if(e===t)return 0;var n=e.length;var r=t.length;var i=0;var a=Math.min(n,r);while(i<a){if(e[i]!==t[i])break;++i}if(i!==a){n=e[i];r=t[i]}if(n<r)return-1;if(r<n)return 1;return 0};f.isEncoding=function Q(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};f.concat=function ee(e,t){if(!a(e))throw new TypeError("list argument must be an Array of Buffers.");if(e.length===0){return new f(0)}else if(e.length===1){return e[0]}var n;if(t===undefined){t=0;for(n=0;n<e.length;n++){t+=e[n].length}}var r=new f(t);var i=0;for(n=0;n<e.length;n++){var o=e[n];o.copy(r,i);i+=o.length}return r};function w(e,t){if(typeof e!=="string")e=String(e);if(e.length===0)return 0;switch(t||"utf8"){case"ascii":case"binary":case"raw":return e.length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e.length*2;case"hex":return e.length>>>1;case"utf8":case"utf-8":return Y(e).length;case"base64":return $(e).length;default:return e.length}}f.byteLength=w;f.prototype.length=undefined;f.prototype.parent=undefined;f.prototype.toString=function te(e,t,n){var r=false;t=t|0;n=n===undefined||n===Infinity?this.length:n|0;if(!e)e="utf8";if(t<0)t=0;if(n>this.length)n=this.length;if(n<=t)return"";while(true){switch(e){case"hex":return L(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return I(this,t,n);case"binary":return j(this,t,n);case"base64":return T(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase();r=true}}};f.prototype.equals=function ne(e){if(!f.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(this===e)return true;return f.compare(this,e)===0};f.prototype.inspect=function re(){var e="";var t=n.INSPECT_MAX_BYTES;if(this.length>0){e=this.toString("hex",0,t).match(/.{2}/g).join(" ");if(this.length>t)e+=" ... "}return"<Buffer "+e+">"};f.prototype.compare=function ie(e){if(!f.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(this===e)return 0;return f.compare(this,e)};f.prototype.indexOf=function ae(e,t){if(t>2147483647)t=2147483647;else if(t<-2147483648)t=-2147483648;t>>=0;if(this.length===0)return-1;if(t>=this.length)return-1;if(t<0)t=Math.max(this.length+t,0);if(typeof e==="string"){if(e.length===0)return-1;return String.prototype.indexOf.call(this,e,t)}if(f.isBuffer(e)){return n(this,e,t)}if(typeof e==="number"){if(f.TYPED_ARRAY_SUPPORT&&Uint8Array.prototype.indexOf==="function"){return Uint8Array.prototype.indexOf.call(this,e,t)}return n(this,[e],t)}function n(e,t,n){var r=-1;for(var i=0;n+i<e.length;i++){if(e[n+i]===t[r===-1?0:i-r]){if(r===-1)r=i;if(i-r+1===t.length)return n+r}else{r=-1}}return-1}throw new TypeError("val must be string, number or Buffer")};f.prototype.get=function oe(e){console.log(".get() is deprecated. Access using array indexes instead.");return this.readUInt8(e)};f.prototype.set=function se(e,t){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(e,t)};function _(e,t,n,r){n=Number(n)||0;var i=e.length-n;if(!r){r=i}else{r=Number(r);if(r>i){r=i}}var a=t.length;if(a%2!==0)throw new Error("Invalid hex string");if(r>a/2){r=a/2}for(var o=0;o<r;o++){var s=parseInt(t.substr(o*2,2),16);if(isNaN(s))throw new Error("Invalid hex string");e[n+o]=s}return o}function x(e,t,n,r){return V(Y(t,e.length-n),e,n,r)}function k(e,t,n,r){return V(J(t),e,n,r)}function E(e,t,n,r){return k(e,t,n,r)}function S(e,t,n,r){return V($(t),e,n,r)}function A(e,t,n,r){return V(G(t,e.length-n),e,n,r)}f.prototype.write=function fe(e,t,n,r){if(t===undefined){r="utf8";n=this.length;t=0}else if(n===undefined&&typeof t==="string"){r=t;n=this.length;t=0}else if(isFinite(t)){t=t|0;if(isFinite(n)){n=n|0;if(r===undefined)r="utf8"}else{r=n;n=undefined}}else{var i=r;r=t;t=n|0;n=i}var a=this.length-t;if(n===undefined||n>a)n=a;if(e.length>0&&(n<0||t<0)||t>this.length){throw new RangeError("attempt to write outside buffer bounds")}if(!r)r="utf8";var o=false;for(;;){switch(r){case"hex":return _(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":return k(this,e,t,n);case"binary":return E(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase();o=true}}};f.prototype.toJSON=function ce(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,n){if(t===0&&n===e.length){return r.fromByteArray(e)}else{return r.fromByteArray(e.slice(t,n))}}function C(e,t,n){var r="";var i="";n=Math.min(e.length,n);for(var a=t;a<n;a++){if(e[a]<=127){r+=K(i)+String.fromCharCode(e[a]);i=""}else{i+="%"+e[a].toString(16)}}return r+K(i)}function I(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;i++){r+=String.fromCharCode(e[i]&127)}return r}function j(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;i++){r+=String.fromCharCode(e[i])}return r}function L(e,t,n){var r=e.length;if(!t||t<0)t=0;if(!n||n<0||n>r)n=r;var i="";for(var a=t;a<n;a++){i+=F(e[a])}return i}function R(e,t,n){var r=e.slice(t,n);var i="";for(var a=0;a<r.length;a+=2){i+=String.fromCharCode(r[a]+r[a+1]*256)}return i}f.prototype.slice=function ue(e,t){var n=this.length;e=~~e;t=t===undefined?n:~~t;if(e<0){e+=n;if(e<0)e=0}else if(e>n){e=n}if(t<0){t+=n;if(t<0)t=0}else if(t>n){t=n}if(t<e)t=e;var r;if(f.TYPED_ARRAY_SUPPORT){r=f._augment(this.subarray(e,t))}else{var i=t-e;r=new f(i,undefined);for(var a=0;a<i;a++){r[a]=this[a+e]}}if(r.length)r.parent=this.parent||this;return r};function B(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}f.prototype.readUIntLE=function le(e,t,n){e=e|0;t=t|0;if(!n)B(e,t,this.length);var r=this[e];var i=1;var a=0;while(++a<t&&(i*=256)){r+=this[e+a]*i}return r};f.prototype.readUIntBE=function pe(e,t,n){e=e|0;t=t|0;if(!n){B(e,t,this.length)}var r=this[e+--t];var i=1;while(t>0&&(i*=256)){r+=this[e+--t]*i}return r};f.prototype.readUInt8=function de(e,t){if(!t)B(e,1,this.length);return this[e]};f.prototype.readUInt16LE=function he(e,t){if(!t)B(e,2,this.length);return this[e]|this[e+1]<<8};f.prototype.readUInt16BE=function me(e,t){if(!t)B(e,2,this.length);return this[e]<<8|this[e+1]};f.prototype.readUInt32LE=function ve(e,t){
if(!t)B(e,4,this.length);return(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};f.prototype.readUInt32BE=function ge(e,t){if(!t)B(e,4,this.length);return this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};f.prototype.readIntLE=function ye(e,t,n){e=e|0;t=t|0;if(!n)B(e,t,this.length);var r=this[e];var i=1;var a=0;while(++a<t&&(i*=256)){r+=this[e+a]*i}i*=128;if(r>=i)r-=Math.pow(2,8*t);return r};f.prototype.readIntBE=function be(e,t,n){e=e|0;t=t|0;if(!n)B(e,t,this.length);var r=t;var i=1;var a=this[e+--r];while(r>0&&(i*=256)){a+=this[e+--r]*i}i*=128;if(a>=i)a-=Math.pow(2,8*t);return a};f.prototype.readInt8=function we(e,t){if(!t)B(e,1,this.length);if(!(this[e]&128))return this[e];return(255-this[e]+1)*-1};f.prototype.readInt16LE=function _e(e,t){if(!t)B(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};f.prototype.readInt16BE=function xe(e,t){if(!t)B(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};f.prototype.readInt32LE=function ke(e,t){if(!t)B(e,4,this.length);return this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};f.prototype.readInt32BE=function Ee(e,t){if(!t)B(e,4,this.length);return this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};f.prototype.readFloatLE=function Se(e,t){if(!t)B(e,4,this.length);return i.read(this,e,true,23,4)};f.prototype.readFloatBE=function Ae(e,t){if(!t)B(e,4,this.length);return i.read(this,e,false,23,4)};f.prototype.readDoubleLE=function Te(e,t){if(!t)B(e,8,this.length);return i.read(this,e,true,52,8)};f.prototype.readDoubleBE=function Ce(e,t){if(!t)B(e,8,this.length);return i.read(this,e,false,52,8)};function M(e,t,n,r,i,a){if(!f.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(t>i||t<a)throw new RangeError("value is out of bounds");if(n+r>e.length)throw new RangeError("index out of range")}f.prototype.writeUIntLE=function Ie(e,t,n,r){e=+e;t=t|0;n=n|0;if(!r)M(this,e,t,n,Math.pow(2,8*n),0);var i=1;var a=0;this[t]=e&255;while(++a<n&&(i*=256)){this[t+a]=e/i&255}return t+n};f.prototype.writeUIntBE=function je(e,t,n,r){e=+e;t=t|0;n=n|0;if(!r)M(this,e,t,n,Math.pow(2,8*n),0);var i=n-1;var a=1;this[t+i]=e&255;while(--i>=0&&(a*=256)){this[t+i]=e/a&255}return t+n};f.prototype.writeUInt8=function Le(e,t,n){e=+e;t=t|0;if(!n)M(this,e,t,1,255,0);if(!f.TYPED_ARRAY_SUPPORT)e=Math.floor(e);this[t]=e;return t+1};function P(e,t,n,r){if(t<0)t=65535+t+1;for(var i=0,a=Math.min(e.length-n,2);i<a;i++){e[n+i]=(t&255<<8*(r?i:1-i))>>>(r?i:1-i)*8}}f.prototype.writeUInt16LE=function Re(e,t,n){e=+e;t=t|0;if(!n)M(this,e,t,2,65535,0);if(f.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8}else{P(this,e,t,true)}return t+2};f.prototype.writeUInt16BE=function Be(e,t,n){e=+e;t=t|0;if(!n)M(this,e,t,2,65535,0);if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>8;this[t+1]=e}else{P(this,e,t,false)}return t+2};function O(e,t,n,r){if(t<0)t=4294967295+t+1;for(var i=0,a=Math.min(e.length-n,4);i<a;i++){e[n+i]=t>>>(r?i:3-i)*8&255}}f.prototype.writeUInt32LE=function Me(e,t,n){e=+e;t=t|0;if(!n)M(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{O(this,e,t,true)}return t+4};f.prototype.writeUInt32BE=function Pe(e,t,n){e=+e;t=t|0;if(!n)M(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{O(this,e,t,false)}return t+4};f.prototype.writeIntLE=function Oe(e,t,n,r){e=+e;t=t|0;if(!r){var i=Math.pow(2,8*n-1);M(this,e,t,n,i-1,-i)}var a=0;var o=1;var s=e<0?1:0;this[t]=e&255;while(++a<n&&(o*=256)){this[t+a]=(e/o>>0)-s&255}return t+n};f.prototype.writeIntBE=function Ue(e,t,n,r){e=+e;t=t|0;if(!r){var i=Math.pow(2,8*n-1);M(this,e,t,n,i-1,-i)}var a=n-1;var o=1;var s=e<0?1:0;this[t+a]=e&255;while(--a>=0&&(o*=256)){this[t+a]=(e/o>>0)-s&255}return t+n};f.prototype.writeInt8=function ze(e,t,n){e=+e;t=t|0;if(!n)M(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 He(e,t,n){e=+e;t=t|0;if(!n)M(this,e,t,2,32767,-32768);if(f.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8}else{P(this,e,t,true)}return t+2};f.prototype.writeInt16BE=function Ne(e,t,n){e=+e;t=t|0;if(!n)M(this,e,t,2,32767,-32768);if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>8;this[t+1]=e}else{P(this,e,t,false)}return t+2};f.prototype.writeInt32LE=function qe(e,t,n){e=+e;t=t|0;if(!n)M(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{O(this,e,t,true)}return t+4};f.prototype.writeInt32BE=function De(e,t,n){e=+e;t=t|0;if(!n)M(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{O(this,e,t,false)}return t+4};function U(e,t,n,r,i,a){if(t>i||t<a)throw new RangeError("value is out of bounds");if(n+r>e.length)throw new RangeError("index out of range");if(n<0)throw new RangeError("index out of range")}function z(e,t,n,r,a){if(!a){U(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38)}i.write(e,t,n,r,23,4);return n+4}f.prototype.writeFloatLE=function We(e,t,n){return z(this,e,t,true,n)};f.prototype.writeFloatBE=function Fe(e,t,n){return z(this,e,t,false,n)};function H(e,t,n,r,a){if(!a){U(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308)}i.write(e,t,n,r,52,8);return n+8}f.prototype.writeDoubleLE=function Ye(e,t,n){return H(this,e,t,true,n)};f.prototype.writeDoubleBE=function Je(e,t,n){return H(this,e,t,false,n)};f.prototype.copy=function Ge(e,t,n,r){if(!n)n=0;if(!r&&r!==0)r=this.length;if(t>=e.length)t=e.length;if(!t)t=0;if(r>0&&r<n)r=n;if(r===n)return 0;if(e.length===0||this.length===0)return 0;if(t<0){throw new RangeError("targetStart out of bounds")}if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");if(r>this.length)r=this.length;if(e.length-t<r-n){r=e.length-t+n}var i=r-n;if(i<1e3||!f.TYPED_ARRAY_SUPPORT){for(var a=0;a<i;a++){e[a+t]=this[a+n]}}else{e._set(this.subarray(n,n+i),t)}return i};f.prototype.fill=function $e(e,t,n){if(!e)e=0;if(!t)t=0;if(!n)n=this.length;if(n<t)throw new RangeError("end < start");if(n===t)return;if(this.length===0)return;if(t<0||t>=this.length)throw new RangeError("start out of bounds");if(n<0||n>this.length)throw new RangeError("end out of bounds");var r;if(typeof e==="number"){for(r=t;r<n;r++){this[r]=e}}else{var i=Y(e.toString());var a=i.length;for(r=t;r<n;r++){this[r]=i[r%a]}}return this};f.prototype.toArrayBuffer=function Ve(){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,n=e.length;t<n;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 Ke(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 D(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 n;var r=e.length;var i=null;var a=[];var o=0;for(;o<r;o++){n=e.charCodeAt(o);if(n>55295&&n<57344){if(i){if(n<56320){if((t-=3)>-1)a.push(239,191,189);i=n;continue}else{n=i-55296<<10|n-56320|65536;i=null}}else{if(n>56319){if((t-=3)>-1)a.push(239,191,189);continue}else if(o+1===r){if((t-=3)>-1)a.push(239,191,189);continue}else{i=n;continue}}}else if(i){if((t-=3)>-1)a.push(239,191,189);i=null}if(n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<2097152){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else{throw new Error("Invalid code point")}}return a}function J(e){var t=[];for(var n=0;n<e.length;n++){t.push(e.charCodeAt(n)&255)}return t}function G(e,t){var n,r,i;var a=[];for(var o=0;o<e.length;o++){if((t-=2)<0)break;n=e.charCodeAt(o);r=n>>8;i=n%256;a.push(i);a.push(r)}return a}function $(e){return r.toByteArray(D(e))}function V(e,t,n,r){for(var i=0;i<r;i++){if(i+n>=t.length||i>=e.length)break;t[i+n]=e[i]}return i}function K(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}},{"base64-js":48,ieee754:49,"is-array":50}],48:[function(e,t,n){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(e){"use strict";var t=typeof Uint8Array!=="undefined"?Uint8Array:Array;var n="+".charCodeAt(0);var i="/".charCodeAt(0);var a="0".charCodeAt(0);var o="a".charCodeAt(0);var s="A".charCodeAt(0);var f="-".charCodeAt(0);var c="_".charCodeAt(0);function u(e){var t=e.charCodeAt(0);if(t===n||t===f)return 62;if(t===i||t===c)return 63;if(t<a)return-1;if(t<a+10)return t-a+26+26;if(t<s+26)return t-s;if(t<o+26)return t-o+26}function l(e){var n,r,i,a,o,s;if(e.length%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var f=e.length;o="="===e.charAt(f-2)?2:"="===e.charAt(f-1)?1:0;s=new t(e.length*3/4-o);i=o>0?e.length-4:e.length;var c=0;function l(e){s[c++]=e}for(n=0,r=0;n<i;n+=4,r+=3){a=u(e.charAt(n))<<18|u(e.charAt(n+1))<<12|u(e.charAt(n+2))<<6|u(e.charAt(n+3));l((a&16711680)>>16);l((a&65280)>>8);l(a&255)}if(o===2){a=u(e.charAt(n))<<2|u(e.charAt(n+1))>>4;l(a&255)}else if(o===1){a=u(e.charAt(n))<<10|u(e.charAt(n+1))<<4|u(e.charAt(n+2))>>2;l(a>>8&255);l(a&255)}return s}function p(e){var t,n=e.length%3,i="",a,o;function s(e){return r.charAt(e)}function f(e){return s(e>>18&63)+s(e>>12&63)+s(e>>6&63)+s(e&63)}for(t=0,o=e.length-n;t<o;t+=3){a=(e[t]<<16)+(e[t+1]<<8)+e[t+2];i+=f(a)}switch(n){case 1:a=e[e.length-1];i+=s(a>>2);i+=s(a<<4&63);i+="==";break;case 2:a=(e[e.length-2]<<8)+e[e.length-1];i+=s(a>>10);i+=s(a>>4&63);i+=s(a<<2&63);i+="=";break}return i}e.toByteArray=l;e.fromByteArray=p})(typeof n==="undefined"?this.base64js={}:n)},{}],49:[function(e,t,n){n.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,f=(1<<s)-1,c=f>>1,u=-7,l=n?i-1:0,p=n?-1:1,d=e[t+l];l+=p;a=d&(1<<-u)-1;d>>=-u;u+=s;for(;u>0;a=a*256+e[t+l],l+=p,u-=8){}o=a&(1<<-u)-1;a>>=-u;u+=r;for(;u>0;o=o*256+e[t+l],l+=p,u-=8){}if(a===0){a=1-c}else if(a===f){return o?NaN:(d?-1:1)*Infinity}else{o=o+Math.pow(2,r);a=a-c}return(d?-1:1)*o*Math.pow(2,a-r)};n.write=function(e,t,n,r,i,a){var o,s,f,c=a*8-i-1,u=(1<<c)-1,l=u>>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:a-1,h=r?1:-1,m=t<0||t===0&&1/t<0?1:0;t=Math.abs(t);if(isNaN(t)||t===Infinity){s=isNaN(t)?1:0;o=u}else{o=Math.floor(Math.log(t)/Math.LN2);if(t*(f=Math.pow(2,-o))<1){o--;f*=2}if(o+l>=1){t+=p/f}else{t+=p*Math.pow(2,1-l)}if(t*f>=2){o++;f/=2}if(o+l>=u){s=0;o=u}else if(o+l>=1){s=(t*f-1)*Math.pow(2,i);o=o+l}else{s=t*Math.pow(2,l-1)*Math.pow(2,i);o=0}}for(;i>=8;e[n+d]=s&255,d+=h,s/=256,i-=8){}o=o<<i|s;c+=i;for(;c>0;e[n+d]=o&255,d+=h,o/=256,c-=8){}e[n+d-h]|=m*128}},{}],50:[function(e,t,n){var r=Array.isArray;var i=Object.prototype.toString;t.exports=r||function(e){return!!e&&"[object Array]"==i.call(e)}},{}],51:[function(e,t,n){function r(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}t.exports=r;r.EventEmitter=r;r.prototype._events=undefined;r.prototype._maxListeners=undefined;r.defaultMaxListeners=10;r.prototype.setMaxListeners=function(e){if(!a(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");this._maxListeners=e;return this};r.prototype.emit=function(e){var t,n,r,a,f,c;if(!this._events)this._events={};if(e==="error"){if(!this._events.error||o(this._events.error)&&!this._events.error.length){t=arguments[1];if(t instanceof Error){throw t}throw TypeError('Uncaught, unspecified "error" event.')}}n=this._events[e];if(s(n))return false;if(i(n)){switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:r=arguments.length;a=new Array(r-1);for(f=1;f<r;f++)a[f-1]=arguments[f];n.apply(this,a)}}else if(o(n)){r=arguments.length;a=new Array(r-1);for(f=1;f<r;f++)a[f-1]=arguments[f];c=n.slice();r=c.length;for(f=0;f<r;f++)c[f].apply(this,a)}return true};r.prototype.addListener=function(e,t){var n;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(o(this._events[e]))this._events[e].push(t);else this._events[e]=[this._events[e],t];if(o(this._events[e])&&!this._events[e].warned){var n;if(!s(this._maxListeners)){n=this._maxListeners}else{n=r.defaultMaxListeners}if(n&&n>0&&this._events[e].length>n){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};r.prototype.on=r.prototype.addListener;r.prototype.once=function(e,t){if(!i(t))throw TypeError("listener must be a function");var n=false;function r(){this.removeListener(e,r);if(!n){n=true;t.apply(this,arguments)}}r.listener=t;this.on(e,r);return this};r.prototype.removeListener=function(e,t){var n,r,a,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;n=this._events[e];a=n.length;r=-1;if(n===t||i(n.listener)&&n.listener===t){delete this._events[e];if(this._events.removeListener)this.emit("removeListener",e,t)}else if(o(n)){for(s=a;s-->0;){if(n[s]===t||n[s].listener&&n[s].listener===t){r=s;break}}if(r<0)return this;if(n.length===1){n.length=0;delete this._events[e]}else{n.splice(r,1)}if(this._events.removeListener)this.emit("removeListener",e,t)}return this};r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener){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}n=this._events[e];if(i(n)){this.removeListener(e,n)}else{while(n.length)this.removeListener(e,n[n.length-1])}delete this._events[e];return this};r.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};r.listenerCount=function(e,t){var n;if(!e._events||!e._events[t])n=0;else if(i(e._events[t]))n=1;else n=e._events[t].length;return n};function i(e){return typeof e==="function"}function a(e){return typeof e==="number"}function o(e){return typeof e==="object"&&e!==null}function s(e){return e===void 0}},{}],52:[function(e,t,n){var r=t.exports;var i=e("events").EventEmitter;var a=e("./lib/request");var o=e("url");r.request=function(e,t){if(typeof e==="string"){e=o.parse(e)}if(!e)e={};if(!e.host&&!e.port){e.port=parseInt(window.location.port,10)}if(!e.host&&e.hostname){e.host=e.hostname}if(!e.protocol){if(e.scheme){e.protocol=e.scheme+":"}else{e.protocol=window.location.protocol}}if(!e.host){e.host=window.location.hostname||window.location.host}if(/:/.test(e.host)){if(!e.port){e.port=e.host.split(":")[1]}e.host=e.host.split(":")[0]}if(!e.port)e.port=e.protocol=="https:"?443:80;var n=new a(new s,e);if(t)n.on("response",t);return n};r.get=function(e,t){e.method="GET";var n=r.request(e,t);n.end();return n};r.Agent=function(){};r.Agent.defaultMaxSockets=4;var s=function(){if(typeof window==="undefined"){throw new Error("no window object present")}else if(window.XMLHttpRequest){return window.XMLHttpRequest}else if(window.ActiveXObject){var e=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Microsoft.XMLHTTP"];for(var t=0;t<e.length;t++){try{var n=new window.ActiveXObject(e[t]);return function(){if(n){var r=n;n=null;return r}else{return new window.ActiveXObject(e[t])}}}catch(r){}}throw new Error("ajax not supported in this browser")}else{throw new Error("ajax not supported in this browser")}}();r.STATUS_CODES={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},{"./lib/request":53,events:51,url:76}],53:[function(e,t,n){var r=e("stream");var i=e("./response");var a=e("Base64");var o=e("inherits");var s=t.exports=function(e,t){var n=this;n.writable=true;n.xhr=e;n.body=[];n.uri=(t.protocol||"http:")+"//"+t.host+(t.port?":"+t.port:"")+(t.path||"/");if(typeof t.withCredentials==="undefined"){t.withCredentials=true}try{e.withCredentials=t.withCredentials}catch(r){}if(t.responseType)try{e.responseType=t.responseType}catch(r){}e.open(t.method||"GET",n.uri,true);e.onerror=function(e){n.emit("error",new Error("Network error"))};n._headers={};if(t.headers){var o=f(t.headers);for(var s=0;s<o.length;s++){var c=o[s];if(!n.isSafeRequestHeader(c))continue;var u=t.headers[c];n.setHeader(c,u)}}if(t.auth){this.setHeader("Authorization","Basic "+a.btoa(t.auth))}var l=new i;l.on("close",function(){n.emit("close")});l.on("ready",function(){n.emit("response",l)});l.on("error",function(e){n.emit("error",e)});e.onreadystatechange=function(){if(e.__aborted)return;l.handle(e)}};o(s,r);s.prototype.setHeader=function(e,t){this._headers[e.toLowerCase()]=t};s.prototype.getHeader=function(e){return this._headers[e.toLowerCase()]};s.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]};s.prototype.write=function(e){this.body.push(e)};s.prototype.destroy=function(e){this.xhr.__aborted=true;this.xhr.abort();this.emit("close")};s.prototype.end=function(e){if(e!==undefined)this.body.push(e);var t=f(this._headers);for(var n=0;n<t.length;n++){var r=t[n];var i=this._headers[r];if(c(i)){for(var a=0;a<i.length;a++){this.xhr.setRequestHeader(r,i[a])}}else this.xhr.setRequestHeader(r,i)}if(this.body.length===0){this.xhr.send("")}else if(typeof this.body[0]==="string"){this.xhr.send(this.body.join(""))}else if(c(this.body[0])){var o=[];for(var n=0;n<this.body.length;n++){o.push.apply(o,this.body[n])}this.xhr.send(o)}else if(/Array/.test(Object.prototype.toString.call(this.body[0]))){var s=0;for(var n=0;n<this.body.length;n++){s+=this.body[n].length}var o=new this.body[0].constructor(s);var u=0;for(var n=0;n<this.body.length;n++){var p=this.body[n];for(var a=0;a<p.length;a++){o[u++]=p[a]}}this.xhr.send(o)}else if(l(this.body[0])){this.xhr.send(this.body[0])}else{var o="";for(var n=0;n<this.body.length;n++){o+=this.body[n].toString()}this.xhr.send(o)}};s.unsafeHeaders=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];s.prototype.isSafeRequestHeader=function(e){if(!e)return false;return u(s.unsafeHeaders,e.toLowerCase())===-1};var f=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};var c=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};var u=function(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;n<e.length;n++){if(e[n]===t)return n}return-1};var l=function(e){if(typeof Blob!=="undefined"&&e instanceof Blob)return true;if(typeof ArrayBuffer!=="undefined"&&e instanceof ArrayBuffer)return true;if(typeof FormData!=="undefined"&&e instanceof FormData)return true}},{"./response":54,Base64:55,inherits:125,stream:74}],54:[function(e,t,n){var r=e("stream");var i=e("util");var a=t.exports=function(e){this.offset=0;this.readable=true};i.inherits(a,r);var o={streaming:true,status2:true};function s(e){var t=e.getAllResponseHeaders().split(/\r?\n/);var n={};for(var r=0;r<t.length;r++){var i=t[r];if(i==="")continue;var a=i.match(/^([^:]+):\s*(.*)/);if(a){var o=a[1].toLowerCase(),s=a[2];if(n[o]!==undefined){if(f(n[o])){n[o].push(s)}else{n[o]=[n[o],s]}}else{n[o]=s}}else{n[i]=true}}return n}a.prototype.getResponse=function(e){var t=String(e.responseType).toLowerCase();if(t==="blob")return e.responseBlob||e.response;if(t==="arraybuffer")return e.response;return e.responseText};a.prototype.getHeader=function(e){return this.headers[e.toLowerCase()]};a.prototype.handle=function(e){if(e.readyState===2&&o.status2){try{this.statusCode=e.status;this.headers=s(e)}catch(t){o.status2=false}if(o.status2){this.emit("ready")}}else if(o.streaming&&e.readyState===3){try{if(!this.statusCode){this.statusCode=e.status;this.headers=s(e);this.emit("ready")}}catch(t){}try{this._emitData(e)}catch(t){o.streaming=false}}else if(e.readyState===4){if(!this.statusCode){this.statusCode=e.status;this.emit("ready")}this._emitData(e);if(e.error){this.emit("error",this.getResponse(e))}else this.emit("end");this.emit("close")}};a.prototype._emitData=function(e){var t=this.getResponse(e);if(t.toString().match(/ArrayBuffer/)){this.emit("data",new Uint8Array(t,this.offset));this.offset=t.byteLength;return}if(t.length>this.offset){this.emit("data",t.slice(this.offset));this.offset=t.length}};var f=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}},{stream:74,util:78}],55:[function(e,t,n){(function(){var e=typeof n!="undefined"?n:this;var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function r(e){this.message=e}r.prototype=new Error;r.prototype.name="InvalidCharacterError";e.btoa||(e.btoa=function(e){for(var n,i,a=0,o=t,s="";e.charAt(a|0)||(o="=",a%1);s+=o.charAt(63&n>>8-a%1*8)){i=e.charCodeAt(a+=3/4);if(i>255){throw new r("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.")}n=n<<8|i}return s});e.atob||(e.atob=function(e){e=e.replace(/=+$/,"");if(e.length%4==1){throw new r("'atob' failed: The string to be decoded is not correctly encoded.")}for(var n=0,i,a,o=0,s="";a=e.charAt(o++);~a&&(i=n%4?i*64+a:a,n++%4)?s+=String.fromCharCode(255&i>>(-2*n&6)):0){a=t.indexOf(a)}return s})})()},{}],56:[function(e,t,n){arguments[4][42][0].apply(n,arguments)},{dup:42}],57:[function(e,t,n){(function(e){function t(e,t){var n=0;for(var r=e.length-1;r>=0;r--){var i=e[r];if(i==="."){e.splice(r,1)}else if(i===".."){e.splice(r,1);n++}else if(n){e.splice(r,1);n--}}if(t){for(;n--;n){e.unshift("..")}}return e}var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var i=function(e){return r.exec(e).slice(1)};n.resolve=function(){var n="",r=false;for(var i=arguments.length-1;i>=-1&&!r;i--){var o=i>=0?arguments[i]:e.cwd();if(typeof o!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!o){continue}n=o+"/"+n;r=o.charAt(0)==="/"}n=t(a(n.split("/"),function(e){return!!e}),!r).join("/");return(r?"/":"")+n||"."};n.normalize=function(e){var r=n.isAbsolute(e),i=o(e,-1)==="/";e=t(a(e.split("/"),function(e){return!!e}),!r).join("/");if(!e&&!r){e="."}if(e&&i){e+="/"}return(r?"/":"")+e};n.isAbsolute=function(e){return e.charAt(0)==="/"};n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(a(e,function(e,t){if(typeof e!=="string"){throw new TypeError("Arguments to path.join must be strings")}return e}).join("/"))};n.relative=function(e,t){e=n.resolve(e).substr(1);t=n.resolve(t).substr(1);function r(e){var t=0;for(;t<e.length;t++){if(e[t]!=="")break}var n=e.length-1;for(;n>=0;n--){if(e[n]!=="")break}if(t>n)return[];return e.slice(t,n-t+1)}var i=r(e.split("/"));var a=r(t.split("/"));var o=Math.min(i.length,a.length);var s=o;for(var f=0;f<o;f++){if(i[f]!==a[f]){s=f;break}}var c=[];for(var f=s;f<i.length;f++){c.push("..")}c=c.concat(a.slice(s));return c.join("/")};n.sep="/";n.delimiter=":";n.dirname=function(e){var t=i(e),n=t[0],r=t[1];if(!n&&!r){return"."}if(r){r=r.substr(0,r.length-1)}return n+r};n.basename=function(e,t){var n=i(e)[2];if(t&&n.substr(-1*t.length)===t){n=n.substr(0,n.length-t.length)}return n};n.extname=function(e){return i(e)[3]};function a(e,t){if(e.filter)return e.filter(t);var n=[];for(var r=0;r<e.length;r++){if(t(e[r],r,e))n.push(e[r])}return n}var o="ab".substr(-1)==="b"?function(e,t,n){return e.substr(t,n)}:function(e,t,n){if(t<0)t=e.length+t;return e.substr(t,n)}}).call(this,e("_process"))},{_process:58}],58:[function(e,t,n){var r=t.exports={};var i=[];var a=false;var o;var s=-1;function f(){a=false;if(o.length){i=o.concat(i)}else{s=-1}if(i.length){c()}}function c(){if(a){return}var e=setTimeout(f);a=true;var t=i.length;while(t){o=i;i=[];while(++s<t){o[s].run()}s=-1;t=i.length}o=null;a=false;clearTimeout(e)}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1){for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}}i.push(new u(e,t));if(i.length===1&&!a){setTimeout(c,0)}};function u(e,t){this.fun=e;this.array=t}u.prototype.run=function(){this.fun.apply(null,this.array)};r.title="browser";r.browser=true;r.env={};r.argv=[];r.version="";r.versions={};function l(){}r.on=l;r.addListener=l;r.once=l;r.off=l;r.removeListener=l;r.removeAllListeners=l;r.emit=l;r.binding=function(e){throw new Error("process.binding is not supported")};r.cwd=function(){return"/"};r.chdir=function(e){throw new Error("process.chdir is not supported")};r.umask=function(){return 0}},{}],59:[function(t,n,r){(function(t){(function(i){var a=typeof r=="object"&&r&&!r.nodeType&&r;var o=typeof n=="object"&&n&&!n.nodeType&&n;var s=typeof t=="object"&&t;if(s.global===s||s.window===s||s.self===s){i=s}var f,c=2147483647,u=36,l=1,p=26,d=38,h=700,m=72,v=128,g="-",y=/^xn--/,b=/[^\x20-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},x=u-l,k=Math.floor,E=String.fromCharCode,S;function A(e){throw RangeError(_[e])}function T(e,t){var n=e.length;var r=[];while(n--){r[n]=t(e[n])}return r}function C(e,t){var n=e.split("@");var r="";if(n.length>1){r=n[0]+"@";e=n[1]}e=e.replace(w,".");var i=e.split(".");var a=T(i,t).join(".");return r+a}function I(e){var t=[],n=0,r=e.length,i,a;while(n<r){i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){a=e.charCodeAt(n++);if((a&64512)==56320){t.push(((i&1023)<<10)+(a&1023)+65536)}else{t.push(i);n--}}else{t.push(i)}}return t}function j(e){return T(e,function(e){var t="";if(e>65535){e-=65536;t+=E(e>>>10&1023|55296);e=56320|e&1023}t+=E(e);return t}).join("")}function L(e){if(e-48<10){return e-22}if(e-65<26){return e-65}if(e-97<26){return e-97}return u}function R(e,t){return e+22+75*(e<26)-((t!=0)<<5)}function B(e,t,n){var r=0;e=n?k(e/h):e>>1;e+=k(e/t);for(;e>x*p>>1;r+=u){e=k(e/x)}return k(r+(x+1)*e/(e+d))}function M(e){var t=[],n=e.length,r,i=0,a=v,o=m,s,f,d,h,y,b,w,_,x;s=e.lastIndexOf(g);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<n;){for(h=i,y=1,b=u;;b+=u){if(d>=n){A("invalid-input")}w=L(e.charCodeAt(d++));if(w>=u||w>k((c-i)/y)){A("overflow")}i+=w*y;_=b<=o?l:b>=o+p?p:b-o;if(w<_){break}x=u-_;if(y>k(c/x)){A("overflow")}y*=x}r=t.length+1;o=B(i-h,r,h==0);if(k(i/r)>c-a){A("overflow")}a+=k(i/r);i%=r;t.splice(i++,0,a)}return j(t)}function P(e){var t,n,r,i,a,o,s,f,d,h,y,b=[],w,_,x,S;e=I(e);w=e.length;t=v;n=0;a=m;for(o=0;o<w;++o){y=e[o];if(y<128){b.push(E(y))}}r=i=b.length;if(i){b.push(g)}while(r<w){for(s=c,o=0;o<w;++o){y=e[o];if(y>=t&&y<s){s=y}}_=r+1;if(s-t>k((c-n)/_)){A("overflow")}n+=(s-t)*_;t=s;for(o=0;o<w;++o){y=e[o];if(y<t&&++n>c){A("overflow")}if(y==t){for(f=n,d=u;;d+=u){h=d<=a?l:d>=a+p?p:d-a;if(f<h){break}S=f-h;x=u-h;b.push(E(R(h+S%x,0)));f=k(S/x)}b.push(E(R(f,0)));a=B(n,_,r==i);n=0;++r}}++n;++t}return b.join("")}function O(e){return C(e,function(e){return y.test(e)?M(e.slice(4).toLowerCase()):e})}function U(e){return C(e,function(e){return b.test(e)?"xn--"+P(e):e})}f={version:"1.3.2",ucs2:{decode:I,encode:j},decode:M,encode:P,toASCII:U,toUnicode:O};if(typeof e=="function"&&typeof e.amd=="object"&&e.amd){e("punycode",function(){return f})}else if(a&&o){if(n.exports==a){o.exports=f}else{for(S in f){f.hasOwnProperty(S)&&(a[S]=f[S])}}}else{i.punycode=f}})(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],60:[function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,n,a){t=t||"&";n=n||"=";var o={};if(typeof e!=="string"||e.length===0){return o}var s=/\+/g;e=e.split(t);var f=1e3;if(a&&typeof a.maxKeys==="number"){f=a.maxKeys}var c=e.length;if(f>0&&c>f){c=f}for(var u=0;u<c;++u){var l=e[u].replace(s,"%20"),p=l.indexOf(n),d,h,m,v;if(p>=0){d=l.substr(0,p);h=l.substr(p+1)}else{d=l;h=""}m=decodeURIComponent(d);v=decodeURIComponent(h);if(!r(o,m)){o[m]=v}else if(i(o[m])){o[m].push(v)}else{o[m]=[o[m],v]}}return o};var i=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}},{}],61:[function(e,t,n){"use strict";var r=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,n,s){t=t||"&";n=n||"=";if(e===null){e=undefined}if(typeof e==="object"){return a(o(e),function(o){var s=encodeURIComponent(r(o))+n;if(i(e[o])){return a(e[o],function(e){return s+encodeURIComponent(r(e))}).join(t)}else{return s+encodeURIComponent(r(e[o]))}}).join(t)}if(!s)return"";return encodeURIComponent(r(s))+n+encodeURIComponent(r(e))};var i=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};function a(e,t){if(e.map)return e.map(t);var n=[];for(var r=0;r<e.length;r++){n.push(t(e[r],r));
}return n}var o=Object.keys||function(e){var t=[];for(var n in e){if(Object.prototype.hasOwnProperty.call(e,n))t.push(n)}return t}},{}],62:[function(e,t,n){"use strict";n.decode=n.parse=e("./decode");n.encode=n.stringify=e("./encode")},{"./decode":60,"./encode":61}],63:[function(e,t,n){t.exports=e("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":64}],64:[function(e,t,n){arguments[4][36][0].apply(n,arguments)},{"./_stream_readable":66,"./_stream_writable":68,_process:58,"core-util-is":69,dup:36,inherits:125}],65:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{"./_stream_transform":67,"core-util-is":69,dup:37,inherits:125}],66:[function(e,t,n){(function(n){t.exports=l;var r=e("isarray");var i=e("buffer").Buffer;l.ReadableState=u;var a=e("events").EventEmitter;if(!a.listenerCount)a.listenerCount=function(e,t){return e.listeners(t).length};var o=e("stream");var s=e("core-util-is");s.inherits=e("inherits");var f;var c=e("util");if(c&&c.debuglog){c=c.debuglog("stream")}else{c=function(){}}s.inherits(l,o);function u(t,n){var r=e("./_stream_duplex");t=t||{};var i=t.highWaterMark;var a=t.objectMode?16:16*1024;this.highWaterMark=i||i===0?i:a;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(n instanceof r)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 n=e("./_stream_duplex");if(!(this instanceof l))return new l(t);this._readableState=new u(t,this);this.readable=true;o.call(this)}l.prototype.push=function(e,t){var n=this._readableState;if(s.isString(e)&&!n.objectMode){t=t||n.defaultEncoding;if(t!==n.encoding){e=new i(e,t);t=""}}return p(this,n,e,t,false)};l.prototype.unshift=function(e){var t=this._readableState;return p(this,t,e,"",true)};function p(e,t,n,r,i){var a=g(t,n);if(a){e.emit("error",a)}else if(s.isNullOrUndefined(n)){t.reading=false;if(!t.ended)y(e,t)}else if(t.objectMode||n&&n.length>0){if(t.ended&&!i){var o=new Error("stream.push() after EOF");e.emit("error",o)}else if(t.endEmitted&&i){var o=new Error("stream.unshift() after end event");e.emit("error",o)}else{if(t.decoder&&!i&&!r)n=t.decoder.write(n);if(!i)t.reading=false;if(t.flowing&&t.length===0&&!t.sync){e.emit("data",n);e.read(0)}else{t.length+=t.objectMode?1:n.length;if(i)t.buffer.unshift(n);else t.buffer.push(n);if(t.needReadable)b(e)}_(e,t)}}else if(!i){t.reading=false}return d(t)}function d(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}l.prototype.setEncoding=function(t){if(!f)f=e("string_decoder/").StringDecoder;this._readableState.decoder=new f(t);this._readableState.encoding=t;return this};var h=8388608;function m(e){if(e>=h){e=h}else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}function v(e,t){if(t.length===0&&t.ended)return 0;if(t.objectMode)return e===0?0:1;if(isNaN(e)||s.isNull(e)){if(t.flowing&&t.buffer.length)return t.buffer[0].length;else return t.length}if(e<=0)return 0;if(e>t.highWaterMark)t.highWaterMark=m(e);if(e>t.length){if(!t.ended){t.needReadable=true;return 0}else return t.length}return e}l.prototype.read=function(e){c("read",e);var t=this._readableState;var n=e;if(!s.isNumber(e)||e>0)t.emittedReadable=false;if(e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended)){c("read: emitReadable",t.length,t.ended);if(t.length===0&&t.ended)C(this);else b(this);return null}e=v(e,t);if(e===0&&t.ended){if(t.length===0)C(this);return null}var r=t.needReadable;c("need readable",r);if(t.length===0||t.length-e<t.highWaterMark){r=true;c("length less than watermark",r)}if(t.ended||t.reading){r=false;c("reading or ended",r)}if(r){c("do read");t.reading=true;t.sync=true;if(t.length===0)t.needReadable=true;this._read(t.highWaterMark);t.sync=false}if(r&&!t.reading)e=v(n,t);var i;if(e>0)i=T(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(n!==e&&t.ended&&t.length===0)C(this);if(!s.isNull(i))this.emit("data",i);return i};function g(e,t){var n=null;if(!s.isBuffer(t)&&!s.isString(t)&&!s.isNullOrUndefined(t)&&!e.objectMode){n=new TypeError("Invalid non-string/buffer chunk")}return n}function y(e,t){if(t.decoder&&!t.ended){var n=t.decoder.end();if(n&&n.length){t.buffer.push(n);t.length+=t.objectMode?1:n.length}}t.ended=true;b(e)}function b(e){var t=e._readableState;t.needReadable=false;if(!t.emittedReadable){c("emitReadable",t.flowing);t.emittedReadable=true;if(t.sync)n.nextTick(function(){w(e)});else w(e)}}function w(e){c("emit readable");e.emit("readable");A(e)}function _(e,t){if(!t.readingMore){t.readingMore=true;n.nextTick(function(){x(e,t)})}}function x(e,t){var n=t.length;while(!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark){c("maybeReadMore read 0");e.read(0);if(n===t.length)break;else n=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 o=this._readableState;switch(o.pipesCount){case 0:o.pipes=e;break;case 1:o.pipes=[o.pipes,e];break;default:o.pipes.push(e);break}o.pipesCount+=1;c("pipe count=%d opts=%j",o.pipesCount,t);var s=(!t||t.end!==false)&&e!==n.stdout&&e!==n.stderr;var f=s?l:d;if(o.endEmitted)n.nextTick(f);else i.once("end",f);e.on("unpipe",u);function u(e){c("onunpipe");if(e===i){d()}}function l(){c("onend");e.end()}var p=k(i);e.on("drain",p);function d(){c("cleanup");e.removeListener("close",v);e.removeListener("finish",g);e.removeListener("drain",p);e.removeListener("error",m);e.removeListener("unpipe",u);i.removeListener("end",l);i.removeListener("end",d);i.removeListener("data",h);if(o.awaitDrain&&(!e._writableState||e._writableState.needDrain))p()}i.on("data",h);function h(t){c("ondata");var n=e.write(t);if(false===n){c("false write response, pause",i._readableState.awaitDrain);i._readableState.awaitDrain++;i.pause()}}function m(t){c("onerror",t);y();e.removeListener("error",m);if(a.listenerCount(e,"error")===0)e.emit("error",t)}if(!e._events||!e._events.error)e.on("error",m);else if(r(e._events.error))e._events.error.unshift(m);else e._events.error=[m,e._events.error];function v(){e.removeListener("finish",g);y()}e.once("close",v);function g(){c("onfinish");e.removeListener("close",v);y()}e.once("finish",g);function y(){c("unpipe");i.unpipe(e)}e.emit("pipe",i);if(!o.flowing){c("pipe resume");i.resume()}return e};function k(e){return function(){var t=e._readableState;c("pipeOnDrain",t.awaitDrain);if(t.awaitDrain)t.awaitDrain--;if(t.awaitDrain===0&&a.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 n=t.pipes;var r=t.pipesCount;t.pipes=null;t.pipesCount=0;t.flowing=false;for(var i=0;i<r;i++)n[i].emit("unpipe",this);return this}var i=j(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 r=o.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 a=this;n.nextTick(function(){c("readable nexttick read 0");a.read(0)})}else if(i.length){b(this,i)}}}return r};l.prototype.addListener=l.prototype.on;l.prototype.resume=function(){var e=this._readableState;if(!e.flowing){c("resume");e.flowing=true;if(!e.reading){c("resume read 0");this.read(0)}E(this,e)}return this};function E(e,t){if(!t.resumeScheduled){t.resumeScheduled=true;n.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(){c("call pause flowing=%j",this._readableState.flowing);if(false!==this._readableState.flowing){c("pause");this._readableState.flowing=false;this.emit("pause")}return this};function A(e){var t=e._readableState;c("flow",t.flowing);if(t.flowing){do{var n=e.read()}while(null!==n&&t.flowing)}}l.prototype.wrap=function(e){var t=this._readableState;var n=false;var r=this;e.on("end",function(){c("wrapped end");if(t.decoder&&!t.ended){var e=t.decoder.end();if(e&&e.length)r.push(e)}r.push(null)});e.on("data",function(i){c("wrapped data");if(t.decoder)i=t.decoder.write(i);if(!i||!t.objectMode&&!i.length)return;var a=r.push(i);if(!a){n=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 a=["error","close","destroy","pause","resume"];I(a,function(t){e.on(t,r.emit.bind(r,t))});r._read=function(t){c("wrapped _read",t);if(n){n=false;e.resume()}};return r};l._fromList=T;function T(e,t){var n=t.buffer;var r=t.length;var a=!!t.decoder;var o=!!t.objectMode;var s;if(n.length===0)return null;if(r===0)s=null;else if(o)s=n.shift();else if(!e||e>=r){if(a)s=n.join("");else s=i.concat(n,r);n.length=0}else{if(e<n[0].length){var f=n[0];s=f.slice(0,e);n[0]=f.slice(e)}else if(e===n[0].length){s=n.shift()}else{if(a)s="";else s=new i(e);var c=0;for(var u=0,l=n.length;u<l&&c<e;u++){var f=n[0];var p=Math.min(e-c,f.length);if(a)s+=f.slice(0,p);else f.copy(s,c,0,p);if(p<f.length)n[0]=f.slice(p);else n.shift();c+=p}}}return s}function C(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");if(!t.endEmitted){t.ended=true;n.nextTick(function(){if(!t.endEmitted&&t.length===0){t.endEmitted=true;e.readable=false;e.emit("end")}})}}function I(e,t){for(var n=0,r=e.length;n<r;n++){t(e[n],n)}}function j(e,t){for(var n=0,r=e.length;n<r;n++){if(e[n]===t)return n}return-1}}).call(this,e("_process"))},{"./_stream_duplex":64,_process:58,buffer:47,"core-util-is":69,events:51,inherits:125,isarray:56,stream:74,"string_decoder/":75,util:46}],67:[function(e,t,n){t.exports=s;var r=e("./_stream_duplex");var i=e("core-util-is");i.inherits=e("inherits");i.inherits(s,r);function a(e,t){this.afterTransform=function(e,n){return o(t,e,n)};this.needTransform=false;this.transforming=false;this.writecb=null;this.writechunk=null}function o(e,t,n){var r=e._transformState;r.transforming=false;var a=r.writecb;if(!a)return e.emit("error",new Error("no writecb in Transform class"));r.writechunk=null;r.writecb=null;if(!i.isNullOrUndefined(n))e.push(n);if(a)a(t);var o=e._readableState;o.reading=false;if(o.needReadable||o.length<o.highWaterMark){e._read(o.highWaterMark)}}function s(e){if(!(this instanceof s))return new s(e);r.call(this,e);this._transformState=new a(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 r.prototype.push.call(this,e,t)};s.prototype._transform=function(e,t,n){throw new Error("not implemented")};s.prototype._write=function(e,t,n){var r=this._transformState;r.writecb=n;r.writechunk=e;r.writeencoding=t;if(!r.transforming){var i=this._readableState;if(r.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 n=e._writableState;var r=e._transformState;if(n.length)throw new Error("calling transform done when ws.length != 0");if(r.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}},{"./_stream_duplex":64,"core-util-is":69,inherits:125}],68:[function(e,t,n){(function(n){t.exports=f;var r=e("buffer").Buffer;f.WritableState=s;var i=e("core-util-is");i.inherits=e("inherits");var a=e("stream");i.inherits(f,a);function o(e,t,n){this.chunk=e;this.encoding=t;this.callback=n}function s(t,n){var r=e("./_stream_duplex");t=t||{};var i=t.highWaterMark;var a=t.objectMode?16:16*1024;this.highWaterMark=i||i===0?i:a;this.objectMode=!!t.objectMode;if(n instanceof r)this.objectMode=this.objectMode||!!t.writableObjectMode;this.highWaterMark=~~this.highWaterMark;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;var o=t.decodeStrings===false;this.decodeStrings=!o;this.defaultEncoding=t.defaultEncoding||"utf8";this.length=0;this.writing=false;this.corked=0;this.sync=true;this.bufferProcessing=false;this.onwrite=function(e){v(n,e)};this.writecb=null;this.writelen=0;this.buffer=[];this.pendingcb=0;this.prefinished=false;this.errorEmitted=false}function f(t){var n=e("./_stream_duplex");if(!(this instanceof f)&&!(this instanceof n))return new f(t);this._writableState=new s(t,this);this.writable=true;a.call(this)}f.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))};function c(e,t,r){var i=new Error("write after end");e.emit("error",i);n.nextTick(function(){r(i)})}function u(e,t,r,a){var o=true;if(!i.isBuffer(r)&&!i.isString(r)&&!i.isNullOrUndefined(r)&&!t.objectMode){var s=new TypeError("Invalid non-string/buffer chunk");e.emit("error",s);n.nextTick(function(){a(s)});o=false}return o}f.prototype.write=function(e,t,n){var r=this._writableState;var a=false;if(i.isFunction(t)){n=t;t=null}if(i.isBuffer(e))t="buffer";else if(!t)t=r.defaultEncoding;if(!i.isFunction(n))n=function(){};if(r.ended)c(this,r,n);else if(u(this,r,e,n)){r.pendingcb++;a=p(this,r,e,t,n)}return a};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)b(this,e)}};function l(e,t,n){if(!e.objectMode&&e.decodeStrings!==false&&i.isString(t)){t=new r(t,n)}return t}function p(e,t,n,r,a){n=l(t,n,r);if(i.isBuffer(n))r="buffer";var s=t.objectMode?1:n.length;t.length+=s;var f=t.length<t.highWaterMark;if(!f)t.needDrain=true;if(t.writing||t.corked)t.buffer.push(new o(n,r,a));else d(e,t,false,s,n,r,a);return f}function d(e,t,n,r,i,a,o){t.writelen=r;t.writecb=o;t.writing=true;t.sync=true;if(n)e._writev(i,t.onwrite);else e._write(i,a,t.onwrite);t.sync=false}function h(e,t,r,i,a){if(r)n.nextTick(function(){t.pendingcb--;a(i)});else{t.pendingcb--;a(i)}e._writableState.errorEmitted=true;e.emit("error",i)}function m(e){e.writing=false;e.writecb=null;e.length-=e.writelen;e.writelen=0}function v(e,t){var r=e._writableState;var i=r.sync;var a=r.writecb;m(r);if(t)h(e,r,i,t,a);else{var o=w(e,r);if(!o&&!r.corked&&!r.bufferProcessing&&r.buffer.length){b(e,r)}if(i){n.nextTick(function(){g(e,r,o,a)})}else{g(e,r,o,a)}}}function g(e,t,n,r){if(!n)y(e,t);t.pendingcb--;r();x(e,t)}function y(e,t){if(t.length===0&&t.needDrain){t.needDrain=false;e.emit("drain")}}function b(e,t){t.bufferProcessing=true;if(e._writev&&t.buffer.length>1){var n=[];for(var r=0;r<t.buffer.length;r++)n.push(t.buffer[r].callback);t.pendingcb++;d(e,t,true,t.length,t.buffer,"",function(e){for(var r=0;r<n.length;r++){t.pendingcb--;n[r](e)}});t.buffer=[]}else{for(var r=0;r<t.buffer.length;r++){var i=t.buffer[r];var a=i.chunk;var o=i.encoding;var s=i.callback;var f=t.objectMode?1:a.length;d(e,t,false,f,a,o,s);if(t.writing){r++;break}}if(r<t.buffer.length)t.buffer=t.buffer.slice(r);else t.buffer.length=0}t.bufferProcessing=false}f.prototype._write=function(e,t,n){n(new Error("not implemented"))};f.prototype._writev=null;f.prototype.end=function(e,t,n){var r=this._writableState;if(i.isFunction(e)){n=e;e=null;t=null}else if(i.isFunction(t)){n=t;t=null}if(!i.isNullOrUndefined(e))this.write(e,t);if(r.corked){r.corked=1;this.uncork()}if(!r.ending&&!r.finished)k(this,r,n)};function w(e,t){return t.ending&&t.length===0&&!t.finished&&!t.writing}function _(e,t){if(!t.prefinished){t.prefinished=true;e.emit("prefinish")}}function x(e,t){var n=w(e,t);if(n){if(t.pendingcb===0){_(e,t);t.finished=true;e.emit("finish")}else _(e,t)}return n}function k(e,t,r){t.ending=true;x(e,t);if(r){if(t.finished)n.nextTick(r);else e.once("finish",r)}t.ended=true}}).call(this,e("_process"))},{"./_stream_duplex":64,_process:58,buffer:47,"core-util-is":69,inherits:125,stream:74}],69:[function(e,t,n){arguments[4][41][0].apply(n,arguments)},{buffer:47,dup:41}],70:[function(e,t,n){t.exports=e("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":65}],71:[function(e,t,n){n=t.exports=e("./lib/_stream_readable.js");n.Stream=e("stream");n.Readable=n;n.Writable=e("./lib/_stream_writable.js");n.Duplex=e("./lib/_stream_duplex.js");n.Transform=e("./lib/_stream_transform.js");n.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":64,"./lib/_stream_passthrough.js":65,"./lib/_stream_readable.js":66,"./lib/_stream_transform.js":67,"./lib/_stream_writable.js":68,stream:74}],72:[function(e,t,n){t.exports=e("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":67}],73:[function(e,t,n){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":68}],74:[function(e,t,n){t.exports=a;var r=e("events").EventEmitter;var i=e("inherits");i(a,r);a.Readable=e("readable-stream/readable.js");a.Writable=e("readable-stream/writable.js");a.Duplex=e("readable-stream/duplex.js");a.Transform=e("readable-stream/transform.js");a.PassThrough=e("readable-stream/passthrough.js");a.Stream=a;function a(){r.call(this)}a.prototype.pipe=function(e,t){var n=this;function i(t){if(e.writable){if(false===e.write(t)&&n.pause){n.pause()}}}n.on("data",i);function a(){if(n.readable&&n.resume){n.resume()}}e.on("drain",a);if(!e._isStdio&&(!t||t.end!==false)){n.on("end",s);n.on("close",f)}var o=false;function s(){if(o)return;o=true;e.end()}function f(){if(o)return;o=true;if(typeof e.destroy==="function")e.destroy()}function c(e){u();if(r.listenerCount(this,"error")===0){throw e}}n.on("error",c);e.on("error",c);function u(){n.removeListener("data",i);e.removeListener("drain",a);n.removeListener("end",s);n.removeListener("close",f);n.removeListener("error",c);e.removeListener("error",c);n.removeListener("end",u);n.removeListener("close",u);e.removeListener("close",u)}n.on("end",u);n.on("close",u);e.on("close",u);e.emit("pipe",n);return e}},{events:51,inherits:125,"readable-stream/duplex.js":63,"readable-stream/passthrough.js":70,"readable-stream/readable.js":71,"readable-stream/transform.js":72,"readable-stream/writable.js":73}],75:[function(e,t,n){arguments[4][43][0].apply(n,arguments)},{buffer:47,dup:43}],76:[function(e,t,n){var r=e("punycode");n.parse=b;n.resolve=_;n.resolveObject=x;n.format=w;n.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 a=/^([a-z0-9.+-]+:)/i,o=/:[0-9]*$/,s=["<",">",'"',"`"," ","\r","\n"," "],f=["{","}","|","\\","^","`"].concat(s),c=["'"].concat(f),u=["%","/","?",";","#"].concat(c),l=["/","?","#"],p=255,d=/^[a-z0-9A-Z_-]{0,63}$/,h=/^([a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:true,"javascript:":true},v={javascript:true,"javascript:":true},g={http:true,https:true,ftp:true,gopher:true,file:true,"http:":true,"https:":true,"ftp:":true,"gopher:":true,"file:":true},y=e("querystring");function b(e,t,n){if(e&&E(e)&&e instanceof i)return e;var r=new i;r.parse(e,t,n);return r}i.prototype.parse=function(e,t,n){if(!k(e)){throw new TypeError("Parameter 'url' must be a string, not "+typeof e)}var i=e;i=i.trim();var o=a.exec(i);if(o){o=o[0];var s=o.toLowerCase();this.protocol=s;i=i.substr(o.length)}if(n||o||i.match(/^\/\/[^@\/]+@[^@\/]+/)){var f=i.substr(0,2)==="//";if(f&&!(o&&v[o])){i=i.substr(2);this.slashes=true}}if(!v[o]&&(f||o&&!g[o])){var b=-1;for(var w=0;w<l.length;w++){var _=i.indexOf(l[w]);if(_!==-1&&(b===-1||_<b))b=_}var x,E;if(b===-1){E=i.lastIndexOf("@")}else{E=i.lastIndexOf("@",b)}if(E!==-1){x=i.slice(0,E);i=i.slice(E+1);this.auth=decodeURIComponent(x)}b=-1;for(var w=0;w<u.length;w++){var _=i.indexOf(u[w]);if(_!==-1&&(b===-1||_<b))b=_}if(b===-1)b=i.length;this.host=i.slice(0,b);i=i.slice(b);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,T=A.length;w<T;w++){var C=A[w];if(!C)continue;if(!C.match(d)){var I="";for(var j=0,L=C.length;j<L;j++){if(C.charCodeAt(j)>127){I+="x"}else{I+=C[j]}}if(!I.match(d)){var R=A.slice(0,w);var B=A.slice(w+1);var M=C.match(h);if(M){R.push(M[1]);B.unshift(M[2])}if(B.length){i="/"+B.join(".")+i}this.hostname=R.join(".");break}}}}if(this.hostname.length>p){this.hostname=""}else{this.hostname=this.hostname.toLowerCase()}if(!S){var P=this.hostname.split(".");var O=[];for(var w=0;w<P.length;++w){var U=P[w];O.push(U.match(/[^A-Za-z0-9_-]/)?"xn--"+r.encode(U):U)}this.hostname=O.join(".")}var z=this.port?":"+this.port:"";var H=this.hostname||"";this.host=H+z;this.href+=this.host;if(S){this.hostname=this.hostname.substr(1,this.hostname.length-2);if(i[0]!=="/"){i="/"+i}}}if(!m[s]){for(var w=0,T=c.length;w<T;w++){var N=c[w];var q=encodeURIComponent(N);if(q===N){q=escape(N)}i=i.split(N).join(q)}}var D=i.indexOf("#");if(D!==-1){this.hash=i.substr(D);i=i.slice(0,D)}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(g[s]&&this.hostname&&!this.pathname){this.pathname="/"}if(this.pathname||this.search){var z=this.pathname||"";var U=this.search||"";this.path=z+U}this.href=this.format();return this};function w(e){if(k(e))e=b(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||"",n=this.pathname||"",r=this.hash||"",i=false,a="";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&&E(this.query)&&Object.keys(this.query).length){a=y.stringify(this.query)}var o=this.search||a&&"?"+a||"";if(t&&t.substr(-1)!==":")t+=":";if(this.slashes||(!t||g[t])&&i!==false){i="//"+(i||"");if(n&&n.charAt(0)!=="/")n="/"+n}else if(!i){i=""}if(r&&r.charAt(0)!=="#")r="#"+r;if(o&&o.charAt(0)!=="?")o="?"+o;n=n.replace(/[?#]/g,function(e){return encodeURIComponent(e)});o=o.replace("#","%23");return t+i+n+o+r};function _(e,t){return b(e,false,true).resolve(t)}i.prototype.resolve=function(e){return this.resolveObject(b(e,false,true)).format()};function x(e,t){if(!e)return t;return b(e,false,true).resolveObject(t)}i.prototype.resolveObject=function(e){if(k(e)){var t=new i;t.parse(e,false,true);e=t}var n=new i;Object.keys(this).forEach(function(e){n[e]=this[e]},this);n.hash=e.hash;if(e.href===""){n.href=n.format();return n}if(e.slashes&&!e.protocol){Object.keys(e).forEach(function(t){if(t!=="protocol")n[t]=e[t]});if(g[n.protocol]&&n.hostname&&!n.pathname){n.path=n.pathname="/"}n.href=n.format();return n}if(e.protocol&&e.protocol!==n.protocol){if(!g[e.protocol]){Object.keys(e).forEach(function(t){n[t]=e[t]});n.href=n.format();return n}n.protocol=e.protocol;if(!e.host&&!v[e.protocol]){var r=(e.pathname||"").split("/");while(r.length&&!(e.host=r.shift()));if(!e.host)e.host="";if(!e.hostname)e.hostname="";if(r[0]!=="")r.unshift("");if(r.length<2)r.unshift("");n.pathname=r.join("/")}else{n.pathname=e.pathname}n.search=e.search;n.query=e.query;n.host=e.host||"";n.auth=e.auth;n.hostname=e.hostname||e.host;n.port=e.port;if(n.pathname||n.search){var a=n.pathname||"";var o=n.search||"";n.path=a+o}n.slashes=n.slashes||e.slashes;n.href=n.format();return n}var s=n.pathname&&n.pathname.charAt(0)==="/",f=e.host||e.pathname&&e.pathname.charAt(0)==="/",c=f||s||n.host&&e.pathname,u=c,l=n.pathname&&n.pathname.split("/")||[],r=e.pathname&&e.pathname.split("/")||[],p=n.protocol&&!g[n.protocol];if(p){n.hostname="";n.port=null;if(n.host){if(l[0]==="")l[0]=n.host;else l.unshift(n.host)}n.host="";if(e.protocol){e.hostname=null;e.port=null;if(e.host){if(r[0]==="")r[0]=e.host;else r.unshift(e.host)}e.host=null}c=c&&(r[0]===""||l[0]==="")}if(f){n.host=e.host||e.host===""?e.host:n.host;n.hostname=e.hostname||e.hostname===""?e.hostname:n.hostname;n.search=e.search;n.query=e.query;l=r}else if(r.length){if(!l)l=[];l.pop();l=l.concat(r);n.search=e.search;n.query=e.query}else if(!A(e.search)){if(p){n.hostname=n.host=l.shift();var d=n.host&&n.host.indexOf("@")>0?n.host.split("@"):false;if(d){n.auth=d.shift();n.host=n.hostname=d.shift()}}n.search=e.search;n.query=e.query;if(!S(n.pathname)||!S(n.search)){n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")}n.href=n.format();return n}if(!l.length){n.pathname=null;if(n.search){n.path="/"+n.search}else{n.path=null}n.href=n.format();return n}var h=l.slice(-1)[0];var m=(n.host||e.host)&&(h==="."||h==="..")||h==="";var y=0;for(var b=l.length;b>=0;b--){h=l[b];if(h=="."){l.splice(b,1)}else if(h===".."){l.splice(b,1);y++}else if(y){l.splice(b,1);y--}}if(!c&&!u){for(;y--;y){l.unshift("..")}}if(c&&l[0]!==""&&(!l[0]||l[0].charAt(0)!=="/")){l.unshift("")}if(m&&l.join("/").substr(-1)!=="/"){l.push("")}var w=l[0]===""||l[0]&&l[0].charAt(0)==="/";if(p){n.hostname=n.host=w?"":l.length?l.shift():"";var d=n.host&&n.host.indexOf("@")>0?n.host.split("@"):false;if(d){n.auth=d.shift();n.host=n.hostname=d.shift()}}c=c||n.host&&l.length;if(c&&!w){l.unshift("")}if(!l.length){n.pathname=null;n.path=null}else{n.pathname=l.join("/")}if(!S(n.pathname)||!S(n.search)){n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")}n.auth=e.auth||n.auth;n.slashes=n.slashes||e.slashes;n.href=n.format();return n};i.prototype.parseHost=function(){var e=this.host;var t=o.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 k(e){return typeof e==="string"}function E(e){return typeof e==="object"&&e!==null}function S(e){return e===null}function A(e){return e==null}},{punycode:59,querystring:62}],77:[function(e,t,n){t.exports=function r(e){return e&&typeof e==="object"&&typeof e.copy==="function"&&typeof e.fill==="function"&&typeof e.readUInt8==="function"}},{}],78:[function(e,t,n){(function(t,r){var i=/%[sdj%]/g;n.format=function(e){if(!x(e)){var t=[];for(var n=0;n<arguments.length;n++){t.push(s(arguments[n]))}return t.join(" ")}var n=1;var r=arguments;var a=r.length;var o=String(e).replace(i,function(e){if(e==="%%")return"%";if(n>=a)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return e}});for(var f=r[n];n<a;f=r[++n]){if(b(f)||!A(f)){o+=" "+f}else{o+=" "+s(f)}}return o};n.deprecate=function(e,i){if(E(r.process)){return function(){return n.deprecate(e,i).apply(this,arguments)}}if(t.noDeprecation===true){return e}var a=false;function o(){if(!a){if(t.throwDeprecation){throw new Error(i)}else if(t.traceDeprecation){console.trace(i)}else{console.error(i)}a=true}return e.apply(this,arguments)}return o};var a={};var o;n.debuglog=function(e){if(E(o))o=t.env.NODE_DEBUG||"";e=e.toUpperCase();if(!a[e]){if(new RegExp("\\b"+e+"\\b","i").test(o)){var r=t.pid;a[e]=function(){var t=n.format.apply(n,arguments);console.error("%s %d: %s",e,r,t)}}else{a[e]=function(){}}}return a[e]};function s(e,t){var r={seen:[],stylize:c};if(arguments.length>=3)r.depth=arguments[2];if(arguments.length>=4)r.colors=arguments[3];if(y(t)){r.showHidden=t}else if(t){n._extend(r,t)}if(E(r.showHidden))r.showHidden=false;if(E(r.depth))r.depth=2;if(E(r.colors))r.colors=false;if(E(r.customInspect))r.customInspect=true;if(r.colors)r.stylize=f;return l(r,e,r.depth)}n.inspect=s;s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};s.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};function f(e,t){var n=s.styles[t];if(n){return"["+s.colors[n][0]+"m"+e+"["+s.colors[n][1]+"m"}else{return e}}function c(e,t){return e}function u(e){var t={};e.forEach(function(e,n){t[e]=true});return t}function l(e,t,r){if(e.customInspect&&t&&I(t.inspect)&&t.inspect!==n.inspect&&!(t.constructor&&t.constructor.prototype===t)){var i=t.inspect(r,e);if(!x(i)){i=l(e,i,r)}return i}var a=p(e,t);if(a){return a}var o=Object.keys(t);var s=u(o);if(e.showHidden){o=Object.getOwnPropertyNames(t)}if(C(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0)){return d(t)}if(o.length===0){if(I(t)){var f=t.name?": "+t.name:"";return e.stylize("[Function"+f+"]","special")}if(S(t)){return e.stylize(RegExp.prototype.toString.call(t),"regexp")}if(T(t)){return e.stylize(Date.prototype.toString.call(t),"date")}if(C(t)){return d(t)}}var c="",y=false,b=["{","}"];if(g(t)){y=true;b=["[","]"]}if(I(t)){var w=t.name?": "+t.name:"";c=" [Function"+w+"]"}if(S(t)){c=" "+RegExp.prototype.toString.call(t)}if(T(t)){c=" "+Date.prototype.toUTCString.call(t)}if(C(t)){c=" "+d(t)}if(o.length===0&&(!y||t.length==0)){return b[0]+c+b[1]}if(r<0){if(S(t)){return e.stylize(RegExp.prototype.toString.call(t),"regexp")}else{return e.stylize("[Object]","special")}}e.seen.push(t);var _;if(y){_=h(e,t,r,s,o)}else{_=o.map(function(n){return m(e,t,r,s,n,y)})}e.seen.pop();return v(_,c,b)}function p(e,t){if(E(t))return e.stylize("undefined","undefined");if(x(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(_(t))return e.stylize(""+t,"number");if(y(t))return e.stylize(""+t,"boolean");if(b(t))return e.stylize("null","null")}function d(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,r,i){var a=[];for(var o=0,s=t.length;o<s;++o){if(P(t,String(o))){a.push(m(e,t,n,r,String(o),true))}else{a.push("")}}i.forEach(function(i){if(!i.match(/^\d+$/)){a.push(m(e,t,n,r,i,true))}});return a}function m(e,t,n,r,i,a){var o,s,f;f=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]};if(f.get){if(f.set){s=e.stylize("[Getter/Setter]","special")}else{s=e.stylize("[Getter]","special")}}else{if(f.set){s=e.stylize("[Setter]","special")}}if(!P(r,i)){o="["+i+"]"}if(!s){if(e.seen.indexOf(f.value)<0){if(b(n)){s=l(e,f.value,null)}else{s=l(e,f.value,n-1)}if(s.indexOf("\n")>-1){if(a){s=s.split("\n").map(function(e){return" "+e}).join("\n").substr(2)}else{s="\n"+s.split("\n").map(function(e){return" "+e}).join("\n")}}}else{s=e.stylize("[Circular]","special")}}if(E(o)){if(a&&i.match(/^\d+$/)){return s}o=JSON.stringify(""+i);if(o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){o=o.substr(1,o.length-2);o=e.stylize(o,"name")}else{o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");o=e.stylize(o,"string")}}return o+": "+s}function v(e,t,n){var r=0;var i=e.reduce(function(e,t){r++;if(t.indexOf("\n")>=0)r++;return e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(i>60){return n[0]+(t===""?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]}return n[0]+t+" "+e.join(", ")+" "+n[1]}function g(e){return Array.isArray(e)}n.isArray=g;function y(e){return typeof e==="boolean"}n.isBoolean=y;function b(e){return e===null}n.isNull=b;function w(e){return e==null}n.isNullOrUndefined=w;function _(e){return typeof e==="number"}n.isNumber=_;function x(e){return typeof e==="string"}n.isString=x;function k(e){return typeof e==="symbol";
}n.isSymbol=k;function E(e){return e===void 0}n.isUndefined=E;function S(e){return A(e)&&L(e)==="[object RegExp]"}n.isRegExp=S;function A(e){return typeof e==="object"&&e!==null}n.isObject=A;function T(e){return A(e)&&L(e)==="[object Date]"}n.isDate=T;function C(e){return A(e)&&(L(e)==="[object Error]"||e instanceof Error)}n.isError=C;function I(e){return typeof e==="function"}n.isFunction=I;function j(e){return e===null||typeof e==="boolean"||typeof e==="number"||typeof e==="string"||typeof e==="symbol"||typeof e==="undefined"}n.isPrimitive=j;n.isBuffer=e("./support/isBuffer");function L(e){return Object.prototype.toString.call(e)}function R(e){return e<10?"0"+e.toString(10):e.toString(10)}var B=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function M(){var e=new Date;var t=[R(e.getHours()),R(e.getMinutes()),R(e.getSeconds())].join(":");return[e.getDate(),B[e.getMonth()],t].join(" ")}n.log=function(){console.log("%s - %s",M(),n.format.apply(n,arguments))};n.inherits=e("inherits");n._extend=function(e,t){if(!t||!A(t))return e;var n=Object.keys(t);var r=n.length;while(r--){e[n[r]]=t[n[r]]}return e};function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}).call(this,e("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":77,_process:58,inherits:125}],79:[function(e,t,n){(function(n,r){t.exports=y;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=b;var i=e("bencode");var a=e("block-stream2");var o=e("piece-length");var s=e("path");var f=e("dezalgo");var c=e("filestream/read");var u=e("flatten");var l=e("fs");var p=e("is-file");var d=e("multistream");var h=e("once");var m=e("run-parallel");var v=e("simple-sha1");var g=e("stream");function y(e,t,n){if(typeof t==="function"){n=t;t={}}if(!t)t={};b(e,t,function(e,r,i){if(e)return n(e);t.singleFileTorrent=i;S(r,t,n)})}function b(e,t,n){if(typeof t==="function"){n=t;t={}}if(!t)t={};n=f(n);if(Array.isArray(e)&&e.length===0)throw new Error("invalid input type");if(C(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"&&s.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);var a=e.length===1;if(e.length===1&&typeof e[0]==="string"){p(e[0],function(e,t){if(e)return n(e);a=t;o()})}else{o()}function o(){m(e.map(function(e){return function(n){var o={};if(T(e)){o.getStream=j(e);o.length=e.size}else if(r.isBuffer(e)){o.getStream=L(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 l.readdir!=="function"){throw new Error("filesystem paths do not work in the browser")}var f=i>1||a;w(e,f,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(s.sep);n(null,o)}}),function(e,t){if(e)return n(e);t=u(t);n(null,t,a)})}}function w(e,t,n){x(e,_,function(r,i){if(r)return n(r);if(Array.isArray(i))i=u(i);else i=[i];e=s.normalize(e);if(t){e=e.slice(0,e.lastIndexOf(s.sep)+1)}if(e[e.length-1]!==s.sep)e+=s.sep;i.forEach(function(t){t.getStream=R(t.path);t.path=t.path.replace(e,"").split(s.sep)});n(null,i)})}function _(e,t){t=h(t);l.stat(e,function(n,r){if(n)return t(n);var i={length:r.size,path:e};t(null,i)})}function x(e,t,n){l.readdir(e,function(r,i){if(r&&r.code==="ENOTDIR"){t(e,n)}else if(r){n(r)}else{m(i.filter(k).map(function(n){return function(r){x(s.join(e,n),t,r)}}),n)}})}function k(e){return e[0]!=="."}function E(e,t,n){n=h(n);var i=[];var o=0;var s=e.map(function(e){return e.getStream});var f=0;var c=0;var u=false;var l=new d(s);var p=new a(t,{zeroPadding:false});l.on("error",y);l.pipe(p).on("data",m).on("end",g).on("error",y);function m(e){o+=e.length;var t=c;v(e,function(e){i[t]=e;f-=1;w()});f+=1;c+=1}function g(){u=true;w()}function y(e){b();n(e)}function b(){l.removeListener("error",y);p.removeListener("data",m);p.removeListener("end",g);p.removeListener("error",y)}function w(){if(u&&f===0){b();n(null,new r(i.join(""),"hex"),o)}}}function S(e,r,a){var s=r.announceList;if(!s){if(typeof r.announce==="string")s=[[r.announce]];else if(Array.isArray(r.announce)){s=r.announce.map(function(e){return[e]})}}if(!s)s=[];if(n.WEBTORRENT_ANNOUNCE){if(typeof n.WEBTORRENT_ANNOUNCE==="string"){s.push([[n.WEBTORRENT_ANNOUNCE]])}else if(Array.isArray(n.WEBTORRENT_ANNOUNCE)){s=s.concat(n.WEBTORRENT_ANNOUNCE.map(function(e){return[e]}))}}if(s.length===0){s=s.concat(t.exports.announceList)}var f={info:{name:r.name},announce:s[0][0],"announce-list":s,"creation date":Number(r.creationDate)||Date.now(),encoding:"UTF-8"};if(r.comment!==undefined)f.comment=r.comment;if(r.createdBy!==undefined)f["created by"]=r.createdBy;if(r.private!==undefined)f.info.private=Number(r.private);if(r.sslCert!==undefined)f.info["ssl-cert"]=r.sslCert;if(r.urlList!==undefined)f["url-list"]=r.urlList;var c=r.pieceLength||o(e.reduce(A,0));f.info["piece length"]=c;E(e,c,function(t,n,o){if(t)return a(t);f.info.pieces=n;e.forEach(function(e){delete e.getStream});if(r.singleFileTorrent){f.info.length=o}else{f.info.files=e}a(null,i.encode(f))})}function A(e,t){return e+t.length}function T(e){return typeof Blob!=="undefined"&&e instanceof Blob}function C(e){return typeof FileList==="function"&&e instanceof FileList}function I(e){return typeof e==="object"&&typeof e.pipe==="function"}function j(e){return function(){return new c(e)}}function L(e){return function(){var t=new g.PassThrough;t.end(e);return t}}function R(e){return function(){return l.createReadStream(e)}}function B(e,t){return function(){var n=new g.Transform;n._transform=function(e,n,r){t.length+=e.length;this.push(e);r()};e.pipe(n);return n}}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},e("buffer").Buffer)},{bencode:80,"block-stream2":84,buffer:47,dezalgo:96,"filestream/read":102,flatten:103,fs:45,"is-file":104,multistream:105,once:108,path:57,"piece-length":109,"run-parallel":111,"simple-sha1":115,stream:74}],80:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{"./lib/decode":81,"./lib/encode":83,dup:15}],81:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{"./dict":82,buffer:47,dup:16}],82:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{dup:17}],83:[function(e,t,n){arguments[4][18][0].apply(n,arguments)},{buffer:47,dup:18}],84:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{buffer:47,defined:85,dup:34,inherits:86,"readable-stream":95}],85:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{dup:35}],86:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{dup:23}],87:[function(e,t,n){arguments[4][36][0].apply(n,arguments)},{"./_stream_readable":89,"./_stream_writable":91,_process:58,"core-util-is":92,dup:36,inherits:86}],88:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{"./_stream_transform":90,"core-util-is":92,dup:37,inherits:86}],89:[function(e,t,n){arguments[4][38][0].apply(n,arguments)},{_process:58,buffer:47,"core-util-is":92,dup:38,events:51,inherits:86,isarray:93,stream:74,"string_decoder/":94}],90:[function(e,t,n){arguments[4][39][0].apply(n,arguments)},{"./_stream_duplex":87,"core-util-is":92,dup:39,inherits:86}],91:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{"./_stream_duplex":87,_process:58,buffer:47,"core-util-is":92,dup:40,inherits:86,stream:74}],92:[function(e,t,n){arguments[4][41][0].apply(n,arguments)},{buffer:47,dup:41}],93:[function(e,t,n){arguments[4][42][0].apply(n,arguments)},{dup:42}],94:[function(e,t,n){arguments[4][43][0].apply(n,arguments)},{buffer:47,dup:43}],95:[function(e,t,n){arguments[4][44][0].apply(n,arguments)},{"./lib/_stream_duplex.js":87,"./lib/_stream_passthrough.js":88,"./lib/_stream_readable.js":89,"./lib/_stream_transform.js":90,"./lib/_stream_writable.js":91,dup:44,stream:74}],96:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{asap:97,dup:29,wrappy:98}],97:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{_process:58,dup:30}],98:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],99:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{dup:23}],100:[function(e,t,n){(function(n){var r=e("is-typedarray").strict;t.exports=function(e){var t=n.TYPED_ARRAY_SUPPORT?n._augment:function(e){return new n(e)};if(e instanceof Uint8Array){return t(e)}else if(e instanceof ArrayBuffer){return t(new Uint8Array(e))}else if(r(e)){return t(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}else{return new n(e)}}}).call(this,e("buffer").Buffer)},{buffer:47,"is-typedarray":101}],101:[function(e,t,n){t.exports=a;a.strict=o;a.loose=s;var r=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 a(e){return o(e)||s(e)}function o(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[r.call(e)]}},{}],102:[function(e,t,n){var r=e("stream").Readable;var i=e("inherits");var a=/^.*\.(\w+)$/;var o=e("typedarray-to-buffer");function s(e,t){var n=this;if(!(this instanceof s)){return new s(e,t)}t=t||{};r.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 n.emit("error",e)}if(Array.isArray(t)){t.forEach(function(e){n.push(e)})}n._ready=true;n.emit("_ready")})}i(s,r);t.exports=s;s.prototype._generateHeaderBlocks=function(e,t,n){n(null,[])};s.prototype._read=function(){if(!this._ready){this.once("_ready",this._read.bind(this));return}var e=this;var t=this.reader;var n=this._offset;var r=this._offset+this._chunkSize;if(r>this._size)r=this._size;if(n===this._size){this.destroy();this.push(null);return}t.onload=function(){e._offset=r;e.push(o(t.result))};t.onerror=function(){e.emit("error",t.error)};t.readAsArrayBuffer(this._file.slice(n,r))};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:99,stream:74,"typedarray-to-buffer":100}],103:[function(e,t,n){t.exports=function r(e,t){t=typeof t=="number"?t:Infinity;return n(e,1);function n(e,r){return e.reduce(function(e,i){if(Array.isArray(i)&&r<t){return e.concat(n(i,r+1))}else{return e.concat(i)}},[])}}},{}],104:[function(e,t,n){"use strict";var r=e("fs");t.exports=function a(e,t){if(!t)return i(e);r.stat(e,function(e,n){if(e)return t(e);return t(null,n.isFile())})};t.exports.sync=i;function i(e){return r.existsSync(e)&&r.statSync(e).isFile()}},{fs:45}],105:[function(e,t,n){t.exports=a;var r=e("inherits");var i=e("stream");r(a,i.Readable);function a(e,t){if(!(this instanceof a))return new a(e,t);i.Readable.call(this,t);this.destroyed=false;this._drained=false;this._forwarding=false;this._current=null;this._queue=e.map(o);this._next()}a.obj=function(e){return new a(e,{objectMode:true,highWaterMark:16})};a.prototype._read=function(){this._drained=true;this._forward()};a.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};a.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")};a.prototype._next=function(){var e=this;var t=e._queue.shift();if(typeof t==="function")t=o(t());if(!t){e.destroy();e.push(null);return}e._current=t;t.on("readable",n);t.on("end",i);t.on("error",a);t.on("close",r);function n(){e._forward()}function r(){if(!t._readableState.ended){e.destroy()}}function i(){e._current=null;t.removeListener("readable",n);t.removeListener("end",i);t.removeListener("error",a);t.removeListener("close",r);e._next()}function a(t){e.destroy(t)}};function o(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:106,stream:74}],106:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{dup:23}],107:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],108:[function(e,t,n){var r=e("wrappy");t.exports=r(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:107}],109:[function(e,t,n){var r=e("closest-to");var i=[];for(var a=14;a<=22;a++){i.push(Math.pow(2,a))}t.exports=function(e){return r(e/Math.pow(2,10),i)}},{"closest-to":110}],110:[function(e,t,n){t.exports=function(e,t){var n=Infinity;var r=0;var i=null;t.sort(function(e,t){return e-t});for(var a=0,o=t.length;a<o;a++){r=Math.abs(e-t[a]);if(r>=n){break}n=r;i=t[a]}return i}},{}],111:[function(e,t,n){var r=e("dezalgo");t.exports=function(e,t){if(t)t=r(t);var n,i,a;if(Array.isArray(e)){n=[];i=e.length}else{a=Object.keys(e);n={};i=a.length}function o(e,r,a){n[e]=a;if(--i===0||r){if(t)t(r,n);t=null}}if(!i){if(t)t(null,n);t=null}else if(a){a.forEach(function(t){e[t](o.bind(undefined,t))})}else{e.forEach(function(e,t){e(o.bind(undefined,t))})}}},{dezalgo:112}],112:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{asap:113,dup:29,wrappy:114}],113:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{_process:58,dup:30}],114:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],115:[function(e,t,n){var r=e("rusha");var i=new r;var a=window.crypto||window.msCrypto||{};var o=a.subtle||a.webkitSubtle;var s=i.digest.bind(i);try{o.digest({name:"sha-1"},new Uint8Array).catch(function(){o=false})}catch(f){o=false}function c(e,t){if(!o){setTimeout(t,0,s(e));return}if(typeof e==="string"){e=u(e)}o.digest({name:"sha-1"},e).then(function n(e){t(l(new Uint8Array(e)))},function r(n){t(s(e))})}function u(e){var t=e.length;var n=new Uint8Array(t);for(var r=0;r<t;r++){n[r]=e.charCodeAt(r)}return n}function l(e){var t=e.length;var n=[];for(var r=0;r<t;r++){var i=e[r];n.push((i>>>4).toString(16));n.push((i&15).toString(16))}return n.join("")}t.exports=c;t.exports.sync=s},{rusha:116}],116:[function(e,t,n){(function(e){(function(){if(typeof t!=="undefined"){t.exports=a}else if(typeof window!=="undefined"){window.Rusha=a}if(typeof FileReaderSync!=="undefined"){var n=new FileReaderSync,r=new a(4*1024*1024);self.onmessage=function s(e){var t,n=e.data.data;try{t=r.digest(n);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 a(e){"use strict";var t={fill:0};var r=function(e){for(e+=9;e%64>0;e+=1);return e};var a=function(e,t){for(var n=t>>2;n<e.length;n++)e[n]=0};var s=function(e,t,n){e[t>>2]|=128<<24-(t%4<<3);e[((t>>2)+2&~15)+14]=n>>29;e[((t>>2)+2&~15)+15]=n<<3};var f=function(e,t,n,r,i){var a=this,o,s=i%4,f=r%4,c=r-f;if(c>0){switch(s){case 0:e[i+3|0]=a.charCodeAt(n);case 1:e[i+2|0]=a.charCodeAt(n+1);case 2:e[i+1|0]=a.charCodeAt(n+2);case 3:e[i|0]=a.charCodeAt(n+3)}}for(o=s;o<c;o=o+4|0){t[i+o>>2]=a.charCodeAt(n+o)<<24|a.charCodeAt(n+o+1)<<16|a.charCodeAt(n+o+2)<<8|a.charCodeAt(n+o+3)}switch(f){case 3:e[i+c+1|0]=a.charCodeAt(n+c+2);case 2:e[i+c+2|0]=a.charCodeAt(n+c+1);case 1:e[i+c+3|0]=a.charCodeAt(n+c)}};var c=function(e,t,n,r,i){var a=this,o,s=i%4,f=r%4,c=r-f;if(c>0){switch(s){case 0:e[i+3|0]=a[n];case 1:e[i+2|0]=a[n+1];case 2:e[i+1|0]=a[n+2];case 3:e[i|0]=a[n+3]}}for(o=4-s;o<c;o=o+=4|0){t[i+o>>2]=a[n+o]<<24|a[n+o+1]<<16|a[n+o+2]<<8|a[n+o+3]}switch(f){case 3:e[i+c+1|0]=a[n+c+2];case 2:e[i+c+2|0]=a[n+c+1];case 1:e[i+c+3|0]=a[n+c]}};var u=function(e,t,r,i,a){var o=this,s,f=a%4,c=i%4,u=i-c;var l=new Uint8Array(n.readAsArrayBuffer(o.slice(r,r+i)));if(u>0){switch(f){case 0:e[a+3|0]=l[0];case 1:e[a+2|0]=l[1];case 2:e[a+1|0]=l[2];case 3:e[a|0]=l[3]}}for(s=4-f;s<u;s=s+=4|0){t[a+s>>2]=l[s]<<24|l[s+1]<<16|l[s+2]<<8|l[s+3]}switch(c){case 3:e[a+u+1|0]=l[u+2];case 2:e[a+u+2|0]=l[u+1];case 1:e[a+u+3|0]=l[u]}};var l=function(e){switch(i.getDataType(e)){case"string":return f.bind(e);case"array":return c.bind(e);case"buffer":return c.bind(e);case"arraybuffer":return c.bind(new Uint8Array(e));case"view":return c.bind(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));case"blob":return u.bind(e)}};var p=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,n,r="0123456789abcdef",i=[],a=new Uint8Array(e);for(t=0;t<a.length;t++){n=a[t];i[t]=r.charAt(n>>4&15)+r.charAt(n>>0&15)}return i.join("")};var h=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 m=function(e){if(e%64>0){throw new Error("Chunk size must be a multiple of 128 bit")}t.maxChunkLen=e;t.padMaxChunkLen=r(e);t.heap=new ArrayBuffer(h(t.padMaxChunkLen+320+20));t.h32=new Int32Array(t.heap);t.h8=new Int8Array(t.heap);t.core=o({Int32Array:Int32Array,DataView:DataView},{},t.heap);t.buffer=null};m(e||64*1024);var v=function(e,t){var n=new Int32Array(e,t+320,5);n[0]=1732584193;n[1]=-271733879;n[2]=-1732584194;n[3]=271733878;n[4]=-1009589776};var g=function(e,n){var i=r(e);var o=new Int32Array(t.heap,0,i>>2);a(o,e);s(o,e,n);return i};var y=function(e,n,r){l(e)(t.h8,t.h32,n,r,0)};var b=function(e,n,r,i,a){var o=r;if(a){o=g(r,i)}y(e,n,r);t.core.hash(o,t.padMaxChunkLen)};var w=function(e,t){var n=new Int32Array(e,t+320,5);var r=new Int32Array(5);var i=new DataView(r.buffer);i.setInt32(0,n[0],false);i.setInt32(4,n[1],false);i.setInt32(8,n[2],false);i.setInt32(12,n[3],false);i.setInt32(16,n[4],false);return r};var _=this.rawDigest=function(e){var n=e.byteLength||e.length||e.size||0;v(t.heap,t.padMaxChunkLen);var r=0,i=t.maxChunkLen,a;for(r=0;n>r+i;r+=i){b(e,r,i,n,false)}b(e,r,n-r,n,true);return w(t.heap,t.padMaxChunkLen)};this.digest=this.digestFromString=this.digestFromBuffer=this.digestFromArrayBuffer=function(e){return d(_(e).buffer)}}function o(e,t,n){"use asm";var r=new e.Int32Array(n);function i(e,t){e=e|0;t=t|0;var n=0,i=0,a=0,o=0,s=0,f=0,c=0,u=0,l=0,p=0,d=0,h=0,m=0,v=0;a=r[t+320>>2]|0;s=r[t+324>>2]|0;c=r[t+328>>2]|0;l=r[t+332>>2]|0;d=r[t+336>>2]|0;for(n=0;(n|0)<(e|0);n=n+64|0){o=a;f=s;u=c;p=l;h=d;for(i=0;(i|0)<64;i=i+4|0){v=r[n+i>>2]|0;m=((a<<5|a>>>27)+(s&c|~s&l)|0)+((v+d|0)+1518500249|0)|0;d=l;l=c;c=s<<30|s>>>2;s=a;a=m;r[e+i>>2]=v}for(i=e+64|0;(i|0)<(e+80|0);i=i+4|0){v=(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])<<1|(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])>>>31;m=((a<<5|a>>>27)+(s&c|~s&l)|0)+((v+d|0)+1518500249|0)|0;d=l;l=c;c=s<<30|s>>>2;s=a;a=m;r[i>>2]=v}for(i=e+80|0;(i|0)<(e+160|0);i=i+4|0){v=(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])<<1|(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])>>>31;m=((a<<5|a>>>27)+(s^c^l)|0)+((v+d|0)+1859775393|0)|0;d=l;l=c;c=s<<30|s>>>2;s=a;a=m;r[i>>2]=v}for(i=e+160|0;(i|0)<(e+240|0);i=i+4|0){v=(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])<<1|(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])>>>31;m=((a<<5|a>>>27)+(s&c|s&l|c&l)|0)+((v+d|0)-1894007588|0)|0;d=l;l=c;c=s<<30|s>>>2;s=a;a=m;r[i>>2]=v}for(i=e+240|0;(i|0)<(e+320|0);i=i+4|0){v=(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])<<1|(r[i-12>>2]^r[i-32>>2]^r[i-56>>2]^r[i-64>>2])>>>31;m=((a<<5|a>>>27)+(s^c^l)|0)+((v+d|0)-899497514|0)|0;d=l;l=c;c=s<<30|s>>>2;s=a;a=m;r[i>>2]=v}a=a+o|0;s=s+f|0;c=c+u|0;l=l+p|0;d=d+h|0}r[t+320>>2]=a;r[t+324>>2]=s;r[t+328>>2]=c;r[t+332>>2]=l;r[t+336>>2]=d}return{hash:i}}})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],117:[function(e,t,n){n=t.exports=e("./debug");n.log=a;n.formatArgs=i;n.save=o;n.load=s;n.useColors=r;n.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:f();n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"];function r(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}n.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 ":" ")+"+"+n.humanize(this.diff);if(!t)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0;var a=0;e[0].replace(/%[a-z%]/g,function(e){if("%%"===e)return;i++;if("%c"===e){a=i}});e.splice(a,0,r);return e}function a(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function o(e){try{if(null==e){n.storage.removeItem("debug")}else{n.storage.debug=e}}catch(t){}}function s(){var e;try{e=n.storage.debug}catch(t){}return e}n.enable(s());function f(){try{return window.localStorage}catch(e){}}},{"./debug":118}],118:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,ms:119}],119:[function(e,t,n){var r=1e3;var i=r*60;var a=i*60;var o=a*24;var s=o*365.25;t.exports=function(e,t){t=t||{};if("string"==typeof e)return f(e);return t.long?u(e):c(e)};function f(e){e=""+e;if(e.length>1e4)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);var f=(t[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return n*s;case"days":case"day":case"d":return n*o;case"hours":case"hour":case"hrs":case"hr":case"h":return n*a;case"minutes":case"minute":case"mins":case"min":case"m":return n*i;case"seconds":case"second":case"secs":case"sec":case"s":return n*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}function c(e){if(e>=o)return Math.round(e/o)+"d";if(e>=a)return Math.round(e/a)+"h";if(e>=i)return Math.round(e/i)+"m";if(e>=r)return Math.round(e/r)+"s";return e+"ms"}function u(e){return l(e,o,"day")||l(e,a,"hour")||l(e,i,"minute")||l(e,r,"second")||e+" ms"}function l(e,t,n){if(e<t)return;if(e<t*1.5)return Math.floor(e/t)+" "+n;return Math.ceil(e/t)+" "+n+"s"}},{}],120:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{asap:121,dup:29,wrappy:122}],121:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{_process:58,dup:30}],122:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],123:[function(e,t,n){var r=e("once");var i=function(){};var a=function(e){return e.setHeader&&typeof e.abort==="function"};var o=function(e){return e.stdio&&Array.isArray(e.stdio)&&e.stdio.length===3};var s=function(e,t,n){if(typeof t==="function")return s(e,null,t);if(!t)t={};n=r(n||i);var f=e._writableState;var c=e._readableState;var u=t.readable||t.readable!==false&&e.readable;var l=t.writable||t.writable!==false&&e.writable;var p=function(){if(!e.writable)d()};var d=function(){l=false;if(!u)n()};var h=function(){u=false;if(!l)n()};var m=function(e){n(e?new Error("exited with error code: "+e):null)};var v=function(){if(u&&!(c&&c.ended))return n(new Error("premature close"));if(l&&!(f&&f.ended))return n(new Error("premature close"))};var g=function(){e.req.on("finish",d)};if(a(e)){e.on("complete",d);e.on("abort",v);if(e.req)g();else e.on("request",g)}else if(l&&!f){e.on("end",p);e.on("close",p)}if(o(e))e.on("exit",m);e.on("end",h);e.on("finish",d);if(t.error!==false)e.on("error",n);e.on("close",v);return function(){e.removeListener("complete",d);e.removeListener("abort",v);e.removeListener("request",g);if(e.req)e.req.removeListener("finish",d);e.removeListener("end",p);e.removeListener("close",p);e.removeListener("finish",d);e.removeListener("exit",m);e.removeListener("end",h);e.removeListener("error",n);e.removeListener("close",v)}};t.exports=s},{once:131}],124:[function(e,t,n){var r=t.exports=function(e,t){if(!t)t=16;if(e===undefined)e=128;if(e<=0)return"0";var n=Math.log(Math.pow(2,e))/Math.log(t);for(var i=2;n===Infinity;i*=2){n=Math.log(Math.pow(2,e/i))/Math.log(t)*i}var a=n-Math.floor(n);var o="";for(var i=0;i<Math.floor(n);i++){var s=Math.floor(Math.random()*t).toString(t);o=s+o}if(a){var f=Math.pow(t,a);var s=Math.floor(Math.random()*f).toString(t);o=s+o}var c=parseInt(o,t);if(c!==Infinity&&c>=Math.pow(2,e)){return r(e,t)}else return o};r.rack=function(e,t,n){var i=function(i){var o=0;do{if(o++>10){if(n)e+=n;else throw new Error("too many ID collisions, use more bits")}var s=r(e,t)}while(Object.hasOwnProperty.call(a,s));a[s]=i;return s};var a=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}},{}],125:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{dup:23}],126:[function(e,t,n){(function(n){var r=e("path");var i=e("fs");function a(){this.types=Object.create(null);this.extensions=Object.create(null)}a.prototype.define=function(e){for(var t in e){var r=e[t];for(var i=0;i<r.length;i++){if(n.env.DEBUG_MIME&&this.types[r]){console.warn(this._loading.replace(/.*\//,""),'changes "'+r[i]+'" extension type from '+this.types[r]+" to "+t)}this.types[r[i]]=t}if(!this.extensions[t]){this.extensions[t]=r[0]}}};a.prototype.load=function(e){this._loading=e;var t={},n=i.readFileSync(e,"ascii"),r=n.split(/[\r\n]+/);r.forEach(function(e){var n=e.replace(/\s*#.*|^\s*|\s*$/g,"").split(/\s+/);t[n.shift()]=n});this.define(t);this._loading=null};a.prototype.lookup=function(e,t){var n=e.replace(/.*[\.\/\\]/,"").toLowerCase();return this.types[n]||t||this.default_type};a.prototype.extension=function(e){var t=e.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase();return this.extensions[t]};var o=new a;o.define(e("./types.json"));o.default_type=o.lookup("bin");o.Mime=a;o.charsets={lookup:function(e,t){return/^text\//.test(e)?"UTF-8":t}};t.exports=o}).call(this,e("_process"))},{"./types.json":127,_process:58,fs:45,path:57}],127:[function(e,t,n){t.exports={"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomsvc+xml":["atomsvc"],"application/ccxml+xml":["ccxml"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mdp"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma"],"application/emma+xml":["emma"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/font-tdpfr":["pfr"],"application/font-woff":["woff"],"application/font-woff2":["woff2"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/java-archive":["jar"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/prs.cww":["cww"],"application/pskc+xml":["pskcxml"],"application/rdf+xml":["rdf"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["xfdf"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],
"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/voicexml+xml":["vxml"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["dmg"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-otf":["otf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-ttf":["ttf","ttc"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["iso"],"application/x-java-jnlp-file":["jnlp"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdownload":["exe","dll","com","bat","msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["wmf","wmz","emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-nzb":["nzb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["rar"],"application/x-research-info-systems":["ris"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["obj"],"application/x-ustar":["ustar"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt"],"application/x-xfig":["fig"],"application/x-xliff+xml":["xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"application/xaml+xml":["xaml"],"application/xcap-diff+xml":["xdf"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xml":["xml","xsl","xsd"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/adpcm":["adp"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mp4":["mp4a","m4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/webm":["weba"],"audio/x-aac":["aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-wav":["wav"],"audio/xm":["xm"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"font/opentype":["otf"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/g3fax":["g3"],"image/gif":["gif"],"image/ief":["ief"],"image/jpeg":["jpeg","jpg","jpe"],"image/ktx":["ktx"],"image/png":["png"],"image/prs.btif":["btif"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/tiff":["tiff","tif"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/webp":["webp"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["ico"],"image/x-mrsid-image":["sid"],"image/x-pcx":["pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/rfc822":["eml","mime"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.vtu":["vtu"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["x3db","x3dbz"],"model/x3d+vrml":["x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee"],"text/css":["css"],"text/csv":["csv"],"text/hjson":["hjson"],"text/html":["html","htm"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/prs.lines.tag":["dsc"],"text/richtext":["rtx"],"text/sgml":["sgml","sgm"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/vtt":["vtt"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["markdown","md","mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-pascal":["p","pas"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/jpeg":["jpgv"],"video/jpm":["jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/webm":["webm"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]}},{}],128:[function(e,t,n){arguments[4][105][0].apply(n,arguments)},{dup:105,inherits:129,stream:74}],129:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{dup:23}],130:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],131:[function(e,t,n){arguments[4][108][0].apply(n,arguments)},{dup:108,wrappy:130}],132:[function(e,t,n){(function(n){t.exports=f;t.exports.remote=c;var r=e("dezalgo");var i=e("fs");var a=e("simple-get");var o=e("magnet-uri");var s=e("parse-torrent-file");t.exports.toMagnetURI=o.encode;t.exports.toTorrentFile=s.encode;function f(e){var t=e&&e.length;if(typeof e==="string"&&/magnet:/.test(e)){return o(e)}else if(typeof e==="string"&&(t===40||t===32)){return o("magnet:?xt=urn:btih:"+e)}else if(n.isBuffer(e)&&t===20){return o("magnet:?xt=urn:btih:"+e.toString("hex"))}else if(n.isBuffer(e)){return s(e)}else if(e&&e.infoHash){if(!e.announce)e.announce=[];if(typeof e.announce==="string"){e.announce=[e.announce]}return e}else{throw new Error("Invalid torrent identifier")}}function c(e,t){var n;if(typeof t!=="function")throw new Error("second argument must be a Function");t=r(t);try{n=f(e)}catch(o){}if(n&&n.infoHash){t(null,n)}else if(typeof a==="function"&&/^https?:/.test(e)){a.concat({url:e,headers:{"user-agent":"WebTorrent (http://webtorrent.io)"}},function(e,n){if(e){e=new Error("Error downloading torrent: "+e.message);return t(e)}s(n)})}else if(typeof i.readFile==="function"&&typeof e==="string"){i.readFile(e,function(e,n){if(e)return t(new Error("Invalid torrent identifier"));s(n)})}else{t(new Error("Invalid torrent identifier"))}function s(e){try{n=f(e)}catch(r){return t(r)}if(n&&n.infoHash)t(null,n);else t(new Error("Invalid torrent identifier"))}}}).call(this,e("buffer").Buffer)},{buffer:47,dezalgo:133,fs:45,"magnet-uri":136,"parse-torrent-file":141,"simple-get":46}],133:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{asap:134,dup:29,wrappy:135}],134:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{_process:58,dup:30}],135:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],136:[function(e,t,n){(function(n){t.exports=o;t.exports.decode=o;t.exports.encode=s;var r=e("thirty-two");var i=e("xtend");var a=e("uniq");function o(e){var t={};var i=e.split("magnet:?")[1];var o=i&&i.length>=0?i.split("&"):[];o.forEach(function(e){var n=e.split("=");if(n.length!==2)return;var r=n[0];var i=n[1];if(r==="dn")i=decodeURIComponent(i).replace(/\+/g," ");if(r==="tr"||r==="xs"||r==="as"||r==="ws"){i=decodeURIComponent(i)}if(r==="kt")i=decodeURIComponent(i).split("+");if(t[r]){if(Array.isArray(t[r])){t[r].push(i)}else{var a=t[r];t[r]=[a,i]}}else{t[r]=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 n(s[1],"hex").toString("hex")}else if(s=e.match(/^urn:btih:(.{32})/)){var i=r.decode(s[1]);t.infoHash=new n(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=[];a(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(n,r){var i=Array.isArray(e[n])?e[n]:[e[n]];i.forEach(function(e,i){if((r>0||i>0)&&(n!=="kt"||i===0))t+="&";if(n==="dn")e=encodeURIComponent(e).replace(/%20/g,"+");if(n==="tr"||n==="xs"||n==="as"||n==="ws"){e=encodeURIComponent(e)}if(n==="kt")e=encodeURIComponent(e);if(n==="kt"&&i>0)t+="+"+e;else t+=n+"="+e})});return t}}).call(this,e("buffer").Buffer)},{buffer:47,"thirty-two":137,uniq:139,xtend:140}],137:[function(e,t,n){var r=e("./thirty-two");n.encode=r.encode;n.decode=r.decode},{"./thirty-two":138}],138:[function(e,t,n){(function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";var r=[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}n.encode=function(n){var r=0;var a=0;var o=0;var s=0;var f=new e(i(n)*8);if(!e.isBuffer(n)){n=new e(n)}while(r<n.length){var c=n[r];if(o>3){s=c&255>>o;o=(o+5)%8;s=s<<o|(r+1<n.length?n[r+1]:0)>>8-o;r++}else{s=c>>8-(o+5)&31;o=(o+5)%8;if(o==0)r++}f[a]=t.charCodeAt(s);a++}for(r=a;r<f.length;r++)f[r]=61;return f};n.decode=function(t){var n=0;var i=0;var a;var o=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 c=t[f]-48;if(c<r.length){i=r[c];if(n<=3){n=(n+5)%8;if(n==0){a|=i;s[o]=a;o++;a=0}else{a|=255&i<<8-n}}else{n=(n+5)%8;a|=255&i>>>n;s[o]=a;o++;a=255&i<<8-n}}else{throw new Error("Invalid input - it is not base32 encoded string")}}return s.slice(0,o)}}).call(this,e("buffer").Buffer)},{buffer:47}],139:[function(e,t,n){"use strict";function r(e,t){var n=1,r=e.length,i=e[0],a=e[0];for(var o=1;o<r;++o){a=i;i=e[o];if(t(i,a)){if(o===n){n++;continue}e[n++]=i}}e.length=n;return e}function i(e){var t=1,n=e.length,r=e[0],i=e[0];for(var a=1;a<n;++a,i=r){i=r;r=e[a];if(r!==i){if(a===t){t++;continue}e[t++]=r}}e.length=t;return e}function a(e,t,n){if(e.length===0){return e}if(t){if(!n){e.sort(t)}return r(e,t)}if(!n){e.sort()}return i(e)}t.exports=a},{}],140:[function(e,t,n){arguments[4][25][0].apply(n,arguments)},{dup:25}],141:[function(e,t,n){(function(n){t.exports=s;t.exports.decode=s;t.exports.encode=f;var r=e("bencode");var i=e("path");var a=e("simple-sha1");var o=e("uniq");function s(e){if(n.isBuffer(e)){e=r.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=r.encode(e.info);t.infoHash=a.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(n.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)}o(t.announce);if(n.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,n){var r=[].concat(e.name||t.name,e.path||[]).map(function(e){return e.toString()});return{path:i.join.apply(null,[i.sep].concat(r)).slice(1),name:r[r.length-1],length:e.length,offset:s.slice(0,n).reduce(c,0)}});t.length=s.reduce(c,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=u(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 n(e,"utf8");return[e]});if(e.created){t["creation date"]=e.created.getTime()/1e3|0}return r.encode(t)}function c(e,t){return e+t.length}function u(e){var t=[];for(var n=0;n<e.length;n+=20){t.push(e.slice(n,n+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:142,buffer:47,path:57,"simple-sha1":146,uniq:148}],142:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{"./lib/decode":143,"./lib/encode":145,dup:15}],143:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{"./dict":144,buffer:47,dup:16}],144:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{dup:17}],145:[function(e,t,n){arguments[4][18][0].apply(n,arguments)},{buffer:47,dup:18}],146:[function(e,t,n){arguments[4][115][0].apply(n,arguments)},{dup:115,rusha:147}],147:[function(e,t,n){arguments[4][116][0].apply(n,arguments)},{dup:116}],148:[function(e,t,n){arguments[4][139][0].apply(n,arguments)},{dup:139}],149:[function(e,t,n){var r=e("once");var i=e("end-of-stream");var a=e("fs");var o=function(){};var s=function(e){return typeof e==="function"};var f=function(e){return(e instanceof(a.ReadStream||o)||e instanceof(a.WriteStream||o))&&s(e.close)};var c=function(e){return e.setHeader&&s(e.abort)};var u=function(e,t,n,a){a=r(a);var o=false;e.on("close",function(){o=true});i(e,{readable:t,writable:n},function(e){if(e)return a(e);o=true;a()});var u=false;return function(t){if(o)return;if(u)return;u=true;if(f(e))return e.close();if(c(e))return e.abort();if(s(e.destroy))return e.destroy();a(t||new Error("stream was destroyed"))}};var l=function(e){e()};var p=function(e,t){return e.pipe(t)};var d=function(){var e=Array.prototype.slice.call(arguments);var t=s(e[e.length-1]||o)&&e.pop()||o;if(Array.isArray(e[0]))e=e[0];if(e.length<2)throw new Error("pump requires two streams per minimum");var n;var r=e.map(function(i,a){var o=a<e.length-1;var s=a>0;return u(i,o,s,function(e){if(!n)n=e;if(e)r.forEach(l);if(o)return;r.forEach(l);t(n)})});return e.reduce(p)};t.exports=d},{"end-of-stream":123,fs:45,once:131}],150:[function(e,t,n){t.exports=function(e,t){var n=true;var r=t.indexOf("=");if(-1==r)return-2;var i=t.slice(r+1).split(",").map(function(t){var t=t.split("-"),r=parseInt(t[0],10),i=parseInt(t[1],10);if(isNaN(r)){r=e-i;i=e-1}else if(isNaN(i)){i=e-1}if(i>e-1)i=e-1;if(isNaN(r)||isNaN(i)||r>i||r<0)n=false;return{start:r,end:i}});i.type=t.slice(0,r);return n?i:-1}},{}],151:[function(e,t,n){t.exports=i;t.exports.filter=a;var r=e("events").EventEmitter;function i(e,t,n){if(!Array.isArray(n))n=[n];var r=[];n.forEach(function(n){var i=function(){var e=[].slice.call(arguments);e.unshift(n);t.emit.apply(t,e)};r.push(i);e.on(n,i)});return function i(){n.forEach(function(t,n){e.removeListener(t,r[n])})}}function a(e,t){var n=new r;i(e,n,t);return n}},{events:51}],152:[function(e,t,n){arguments[4][111][0].apply(n,arguments)},{dezalgo:153,dup:111}],153:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{asap:154,dup:29,wrappy:155}],154:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{_process:58,dup:30}],155:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],156:[function(e,t,n){arguments[4][115][0].apply(n,arguments)},{dup:115,rusha:157}],157:[function(e,t,n){arguments[4][116][0].apply(n,arguments)},{dup:116}],158:[function(e,t,n){arguments[4][24][0].apply(n,arguments)},{dup:24}],159:[function(e,t,n){(function(n){t.exports=u;var r=e("debug")("torrent-discovery");var i=e("bittorrent-dht/client");var a=e("events").EventEmitter;var o=e("xtend/mutable");var s=e("inherits");var f=e("re-emitter");var c=e("bittorrent-tracker/client");s(u,a);function u(e){var t=this;if(!(t instanceof u))return new u(e);a.call(t);o(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(!n.browser&&!t.port)throw new Error("port required");if(t.dht)t._createDHT(t.dhtPort)}u.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}r("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))}};u.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 n.nextTick(function(){e(null)})};u.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,n){if(n===t.infoHash)t.emit("peer",e)});if(!t._externalDHT)t.dht.listen(e)};u.prototype._createTracker=function(){var e=this;if(!e.tracker)return;var t=e.torrent||{infoHash:e.infoHash,announce:e.announce};var n={rtcConfig:e.rtcConfig,wrtc:e.wrtc};e.tracker=new c(e.peerId,e.port,t,n);f(e.tracker,e,["peer","warning","error"]);e.tracker.start()};u.prototype._dhtLookupAndAnnounce=function(){var e=this;if(e._performedDHTLookup)return;e._performedDHTLookup=true;r("dht lookup");e.dht.lookup(e.infoHash,function(t){if(t||!e.port)return;r("dht announce");e.dht.announce(e.infoHash,e.port,function(){r("dht announce complete");e.emit("dhtAnnounce")})})}}).call(this,e("_process"))},{_process:58,"bittorrent-dht/client":46,"bittorrent-tracker/client":160,debug:191,events:51,inherits:194,"re-emitter":195,"xtend/mutable":196}],160:[function(e,t,n){(function(n,r){t.exports=d;var i=e("debug")("bittorrent-tracker");var a=e("events").EventEmitter;var o=e("inherits");var s=e("once");var f=e("url");var c=e("./lib/common");var u=e("./lib/http-tracker");var l=e("./lib/udp-tracker");var p=e("./lib/websocket-tracker");o(d,a);function d(e,t,o,s){var h=this;if(!(h instanceof d))return new d(e,t,o,s);a.call(h);if(!s)s={};h._peerId=r.isBuffer(e)?e:new r(e,"hex");h._peerIdHex=h._peerId.toString("hex");h._peerIdBinary=h._peerId.toString("binary");h._infoHash=r.isBuffer(o.infoHash)?o.infoHash:new r(o.infoHash,"hex");h._infoHashHex=h._infoHash.toString("hex");h._infoHashBinary=h._infoHash.toString("binary");h._port=t;h.torrentLength=o.length;h._rtcConfig=s.rtcConfig;h._wrtc=s.wrtc;h._numWant=s.numWant||c.DEFAULT_ANNOUNCE_PEERS;h._intervalMs=s.interval||c.DEFAULT_ANNOUNCE_INTERVAL;i("new client %s",h._infoHashHex);var m={interval:h._intervalMs};var v=!!h._wrtc||typeof window!=="undefined";var g=typeof o.announce==="string"?[o.announce]:o.announce==null?[]:o.announce;h._trackers=g.map(function(e){e=e.toString();var t=f.parse(e).protocol;if((t==="http:"||t==="https:")&&typeof u==="function"){return new u(h,e,m)}else if(t==="udp:"&&typeof l==="function"){return new l(h,e,m)}else if((t==="ws:"||t==="wss:")&&v){return new p(h,e,m)}else{n.nextTick(function(){var t=new Error("unsupported tracker protocol for "+e);h.emit("warning",t)})}return null}).filter(Boolean)}d.scrape=function(e,t,n){n=s(n);var i=new r("01234567890123456789");var a=6881;var o={infoHash:Array.isArray(t)?t[0]:t,announce:[e]};var f=new d(i,a,o);f.once("error",n);var c=Array.isArray(t)?t.length:1;var u={};f.on("scrape",function(e){c-=1;u[e.infoHash]=e;if(c===0){f.destroy();var t=Object.keys(u);if(t.length===1){n(null,u[t[0]])}else{n(null,u)}}});t=Array.isArray(t)?t.map(function(e){return new r(e,"hex")}):new r(t,"hex");f.scrape({infoHash:t})};d.prototype.start=function(e){var t=this;i("send `start`");e=t._defaultAnnounceOpts(e);e.event="started";t._announce(e);t._trackers.forEach(function(e){e.setInterval(t._intervalMs)})};d.prototype.stop=function(e){var t=this;i("send `stop`");e=t._defaultAnnounceOpts(e);e.event="stopped";t._announce(e)};d.prototype.complete=function(e){var t=this;i("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)};d.prototype.update=function(e){var t=this;i("send `update`");e=t._defaultAnnounceOpts(e);if(e.event)delete e.event;t._announce(e)};d.prototype._announce=function(e){var t=this;t._trackers.forEach(function(t){t.announce(e)})};d.prototype.scrape=function(e){var t=this;i("send `scrape`");if(!e)e={};t._trackers.forEach(function(t){t.scrape(e)})};d.prototype.setInterval=function(e){var t=this;i("setInterval");t._intervalMs=e;t._trackers.forEach(function(t){t.setInterval(e)})};d.prototype.destroy=function(){var e=this;i("destroy");e._trackers.forEach(function(e){e.destroy();e.setInterval(0)});e._trackers=[]};d.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("_process"),e("buffer").Buffer)},{"./lib/common":162,"./lib/http-tracker":46,"./lib/udp-tracker":46,"./lib/websocket-tracker":163,_process:58,buffer:47,debug:164,events:51,inherits:168,once:170,url:76}],161:[function(e,t,n){(function(t){var r=e("querystring");n.IPV4_RE=/^[\d\.]+$/;n.IPV6_RE=/^[\da-fA-F:]+$/;n.CONNECTION_ID=t.concat([i(1047),i(655366528)]);n.ACTIONS={CONNECT:0,ANNOUNCE:1,SCRAPE:2,ERROR:3};n.EVENTS={update:0,completed:1,started:2,stopped:3};n.EVENT_IDS={0:"update",1:"completed",2:"started",3:"stopped"};n.EVENT_NAMES={update:"update",completed:"complete",started:"start",stopped:"stop"};function i(e){var n=new t(4);n.writeUInt32BE(e,0);return n}n.toUInt32=i;n.querystringParse=function(e){var t=r.unescape;r.unescape=unescape;var n=r.parse(e);r.unescape=t;return n};n.querystringStringify=function(e){var t=r.escape;r.escape=escape;var n=r.stringify(e);n=n.replace(/[\@\*\/\+]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()});r.escape=t;return n}}).call(this,e("buffer").Buffer)},{buffer:47,querystring:62}],162:[function(e,t,n){(function(t){var r=e("xtend/mutable");n.DEFAULT_ANNOUNCE_INTERVAL=30*60*1e3;n.DEFAULT_ANNOUNCE_PEERS=50;n.MAX_ANNOUNCE_PEERS=82;n.binaryToHex=function(e){return new t(e,"binary").toString("hex")};n.hexToBinary=function(e){return new t(e,"hex").toString("binary")};var i=e("./common-node");r(n,i)}).call(this,e("buffer").Buffer)},{"./common-node":161,buffer:47,"xtend/mutable":190}],163:[function(e,t,n){t.exports=d;var r=e("debug")("bittorrent-tracker:websocket-tracker");var i=e("events").EventEmitter;var a=e("hat");var o=e("inherits");var s=e("simple-peer");var f=e("simple-websocket");var c=e("./common");var u={};var l=30*1e3;var p=5*1e3;o(d,i);function d(e,t,n){var a=this;i.call(a);r("new websocket tracker %s",t);a.client=e;a.destroyed=false;a._opts=n;if(t[t.length-1]==="/"){t=t.substring(0,t.length-1)}a._announceUrl=t;a._peers={};a._socket=null;a._intervalMs=a.client._intervalMs;a._interval=null;a._openSocket()}d.prototype.announce=function(e){var t=this;if(t.destroyed)return;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(n){e.offers=n;if(t._trackerId){e.trackerid=t._trackerId}t._send(e)})};d.prototype.scrape=function(e){var t=this;if(t.destroyed)return;t._onSocketError(new Error("scrape not supported "+t._announceUrl))};d.prototype.setInterval=function(e){var t=this;clearInterval(t._interval);t._intervalMs=e;if(e){var n=t.announce.bind(t,t.client._defaultAnnounceOpts());t._interval=setInterval(n,t._intervalMs)}};d.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",h);try{e._socket.close()}catch(t){}e._socket=null};d.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=u[e._announceUrl];if(!e._socket){e._socket=u[e._announceUrl]=new f(e._announceUrl)}e._socket.on("data",e._onSocketDataBound);e._socket.on("close",e._onSocketCloseBound);e._socket.on("error",e._onSocketErrorBound)};d.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){r("ignoring websocket data from %s for %s (looking for %s: reused socket)",t._announceUrl,c.binaryToHex(e.info_hash),t.client._infoHashHex);return}if(e.peer_id&&e.peer_id===t.client._peerIdBinary){return}r("received %s from %s for %s",JSON.stringify(e),t._announceUrl,t.client._infoHashHex);var n=e["failure reason"];if(n)return t.client.emit("warning",new Error(n));var i=e["warning message"];if(i)t.client.emit("warning",new Error(i));var a=e.interval||e["min interval"];if(a&&!t._opts.interval&&t._intervalMs!==0){t.setInterval(a*1e3)}var o=e["tracker id"];if(o){t._trackerId=o}if(e.complete){t.client.emit("update",{announce:t._announceUrl,complete:e.complete,incomplete:e.incomplete})}var f;if(e.offer&&e.peer_id){f=new s({trickle:false,config:t.client._rtcConfig,wrtc:t.client._wrtc});f.id=c.binaryToHex(e.peer_id);f.once("signal",function(n){var r={info_hash:t.client._infoHashBinary,peer_id:t.client._peerIdBinary,to_peer_id:e.peer_id,answer:n,offer_id:e.offer_id};if(t._trackerId)r.trackerid=t._trackerId;t._send(r)});f.signal(e.offer);t.client.emit("peer",f)}if(e.answer&&e.peer_id){f=t._peers[c.binaryToHex(e.offer_id)];if(f){f.id=c.binaryToHex(e.peer_id);f.signal(e.answer);t.client.emit("peer",f)}else{r("got unexpected answer: "+JSON.stringify(e.answer))}}};d.prototype._onSocketClose=function(){var e=this;if(e.destroyed)return;e.destroy();e._startReconnectTimer()};d.prototype._onSocketError=function(e){var t=this;if(t.destroyed)return;t.destroy();t.client.emit("warning",e);t._startReconnectTimer()};d.prototype._startReconnectTimer=function(){var e=this;var t=Math.floor(Math.random()*l)+p;setTimeout(function(){e.destroyed=false;e._openSocket()},t);r("reconnecting socket in %s ms",t)};d.prototype._send=function(e){var t=this;if(t.destroyed)return;var n=JSON.stringify(e);r("send %s",n);t._socket.send(n)};d.prototype._generateOffers=function(e,t){var n=this;var i=[];r("generating %s offers",e);for(var o=0;o<e;++o){f()}function f(){var e=a(160);var t=n._peers[e]=new s({initiator:true,trickle:false,config:n.client._rtcConfig,wrtc:n.client._wrtc});t.once("signal",function(t){i.push({offer:t,offer_id:c.hexToBinary(e)});u()})}function u(){if(i.length===e){r("generated %s offers",e);t(i)}}};function h(){}},{"./common":162,debug:164,events:51,hat:167,inherits:168,"simple-peer":171,"simple-websocket":182}],164:[function(e,t,n){arguments[4][117][0].apply(n,arguments)},{"./debug":165,dup:117}],165:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,ms:166}],166:[function(e,t,n){arguments[4][119][0].apply(n,arguments)},{dup:119}],167:[function(e,t,n){arguments[4][124][0].apply(n,arguments)},{dup:124}],168:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{dup:23}],169:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],170:[function(e,t,n){arguments[4][108][0].apply(n,arguments)},{dup:108,wrappy:169}],171:[function(e,t,n){(function(n){t.exports=u;var r=e("debug")("simple-peer");var i=e("hat");var a=e("inherits");var o=e("is-typedarray");var s=e("once");var f=e("stream");var c=e("typedarray-to-buffer");a(u,f.Duplex);function u(e){var t=this;if(!(t instanceof u))return new u(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||u.channelConfig;t.channelName=e.channelName||i(160);if(!e.initiator)t.channelName=null;t.config=e.config||u.config;t.constraints=e.constraints||u.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)})}})}u.WEBRTC_SUPPORT=!!l();u.config={iceServers:[{url:"stun:23.21.150.121",urls:"stun:23.21.150.121"}]};u.constraints={};u.channelConfig={};Object.defineProperty(u.prototype,"bufferSize",{get:function(){var e=this;return e._channel&&e._channel.bufferedAmount||0}});u.prototype.address=function(){var e=this;return{port:e.localPort,family:"IPv4",address:e.localAddress}};u.prototype.signal=function(e){var t=this;if(t.destroyed)throw new Error("cannot signal after peer is destroyed");if(typeof e==="string"){try{e=JSON.parse(e)}catch(n){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),p,t._onError.bind(t))}catch(n){t._destroy(new Error("error adding candidate: "+n.message))}}if(!e.sdp&&!e.candidate){t._destroy(new Error("signal() called with invalid signal data"))}};u.prototype.send=function(e){var t=this;if(!o.strict(e)&&!(e instanceof ArrayBuffer)&&!n.isBuffer(e)&&typeof e!=="string"&&(typeof Blob==="undefined"||!(e instanceof Blob))){e=JSON.stringify(e)}if(n.isBuffer(e)&&!o.strict(e)){e=new Uint8Array(e)}var r=e.length||e.byteLength||e.size;t._channel.send(e);t._debug("write: %d bytes",r)};u.prototype.destroy=function(e){var t=this;t._destroy(null,e)};u.prototype._destroy=function(e,t){var n=this;if(n.destroyed)return;if(t)n.once("close",t);n._debug("destroy (error: %s)",e&&e.message);n.readable=n.writable=false;if(!n._readableState.ended)n.push(null);if(!n._writableState.finished)n.end();n.destroyed=true;n.connected=false;n._pcReady=false;n._channelReady=false;n._chunk=null;n._cb=null;clearInterval(n._interval);clearTimeout(n._reconnectTimeout);if(n._pc){try{n._pc.close()}catch(e){}n._pc.oniceconnectionstatechange=null;n._pc.onsignalingstatechange=null;n._pc.onicecandidate=null}if(n._channel){try{n._channel.close()}catch(e){}n._channel.onmessage=null;n._channel.onopen=null;n._channel.onclose=null}n._pc=null;n._channel=null;if(e)n.emit("error",e);n.emit("close")};u.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)};u.prototype._read=function(){};u.prototype._write=function(e,t,n){var r=this;if(r.destroyed)return n(new Error("cannot write after peer is destroyed"));if(r.connected){r.send(e);if(r._channel.bufferedAmount>r._maxBufferedAmount){r._debug("start backpressure: bufferedAmount %d",r._channel.bufferedAmount);r._cb=n}else{n(null)}}else{r._debug("write before connect");r._chunk=e;r._cb=n}};u.prototype._createOffer=function(){var e=this;if(e.destroyed)return;e._pc.createOffer(function(t){if(e.destroyed)return;t.sdp=e.sdpTransform(t.sdp);e._pc.setLocalDescription(t,p,e._onError.bind(e));var n=function(){var n=e._pc.localDescription||t;e._debug("signal");e.emit("signal",{type:n.type,sdp:n.sdp})};if(e.trickle||e._iceComplete)n();else e.once("_iceComplete",n)},e._onError.bind(e),e.offerConstraints)};u.prototype._createAnswer=function(){var e=this;if(e.destroyed)return;e._pc.createAnswer(function(t){if(e.destroyed)return;t.sdp=e.sdpTransform(t.sdp);e._pc.setLocalDescription(t,p,e._onError.bind(e));var n=function(){var n=e._pc.localDescription||t;e._debug("signal");e.emit("signal",{type:n.type,sdp:n.sdp})};if(e.trickle||e._iceComplete)n();else e.once("_iceComplete",n)},e._onError.bind(e),e.answerConstraints)};u.prototype._onIceConnectionStateChange=function(){var e=this;if(e.destroyed)return;var t=e._pc.iceGatheringState;var n=e._pc.iceConnectionState;e._debug("iceConnectionStateChange %s %s",t,n);e.emit("iceConnectionStateChange",t,n);if(n==="connected"||n==="completed"){clearTimeout(e._reconnectTimeout);e._pcReady=true;e._maybeReady()}if(n==="disconnected"){if(e.reconnectTimer){clearTimeout(e._reconnectTimeout);e._reconnectTimeout=setTimeout(function(){e._destroy()},e.reconnectTimer)}else{e._destroy()}}if(n==="closed"){e._destroy()}};u.prototype._maybeReady=function(){var e=this;e._debug("maybeReady pc %s channel %s",e._pcReady,e._channelReady);if(e.connected||e._connecting||!e._pcReady||!e._channelReady)return;e._connecting=true;if(typeof window!=="undefined"&&!!window.mozRTCPeerConnection){e._pc.getStats(null,function(e){var n=[];e.forEach(function(e){n.push(e)});t(n)},e._onError.bind(e))}else{e._pc.getStats(function(e){var n=[];e.result().forEach(function(e){var t={};e.names().forEach(function(n){t[n]=e.stat(n)});t.id=e.id;t.type=e.type;t.timestamp=e.timestamp;n.push(t)});t(n)})}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 n=e._cb;e._cb=null;n(null)}e._interval=setInterval(function(){if(!e._cb||!e._channel||e._channel.bufferedAmount>e._maxBufferedAmount)return;e._debug("ending backpressure: bufferedAmount %d",e._channel.bufferedAmount);var t=e._cb;e._cb=null;t(null)},150);if(e._interval.unref)e._interval.unref();e._debug("connect");e.emit("connect")}};u.prototype._onSignalingStateChange=function(){var e=this;if(e.destroyed)return;e._debug("signalingStateChange %s",e._pc.signalingState);e.emit("signalingStateChange",e._pc.signalingState)};u.prototype._onIceCandidate=function(e){var t=this;if(t.destroyed)return;if(e.candidate&&t.trickle){t.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}})}else if(!e.candidate){t._iceComplete=true;t.emit("_iceComplete")}};u.prototype._onChannelMessage=function(e){var t=this;if(t.destroyed)return;var n=e.data;t._debug("read: %d bytes",n.byteLength||n.length);if(n instanceof ArrayBuffer){n=c(new Uint8Array(n));t.push(n)}else{try{n=JSON.parse(n)}catch(r){}t.emit("data",n)}};u.prototype._onChannelOpen=function(){var e=this;if(e.connected||e.destroyed)return;e._debug("on channel open");e._channelReady=true;e._maybeReady()};u.prototype._onChannelClose=function(){var e=this;if(e.destroyed)return;e._debug("on channel close");e._destroy()};u.prototype._onAddStream=function(e){var t=this;if(t.destroyed)return;t._debug("on add stream");t.emit("stream",e.stream)};u.prototype._onError=function(e){var t=this;if(t.destroyed)return;t._debug("error %s",e.message||e);t._destroy(e)};u.prototype._debug=function(){var e=this;var t=[].slice.call(arguments);var n=e.channelName&&e.channelName.substring(0,7);t[0]="["+n+"] "+t[0];r.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 p(){}}).call(this,e("buffer").Buffer)},{buffer:47,debug:172,hat:175,inherits:176,"is-typedarray":177,once:179,stream:74,"typedarray-to-buffer":180}],172:[function(e,t,n){arguments[4][117][0].apply(n,arguments)},{"./debug":173,dup:117}],173:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,ms:174}],174:[function(e,t,n){arguments[4][119][0].apply(n,arguments)},{dup:119}],175:[function(e,t,n){arguments[4][124][0].apply(n,arguments)},{dup:124}],176:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{dup:23}],177:[function(e,t,n){t.exports=a;a.strict=o;a.loose=s;var r=Object.prototype.toString;var i={"[object Int8Array]":true,"[object Int16Array]":true,"[object Int32Array]":true,"[object Uint8Array]":true,"[object Uint8ClampedArray]":true,"[object Uint16Array]":true,"[object Uint32Array]":true,"[object Float32Array]":true,"[object Float64Array]":true};function a(e){return o(e)||s(e)}function o(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function s(e){return i[r.call(e)]}},{}],178:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],179:[function(e,t,n){arguments[4][108][0].apply(n,arguments)},{dup:108,wrappy:178}],180:[function(e,t,n){arguments[4][100][0].apply(n,arguments)},{buffer:47,dup:100,"is-typedarray":181}],181:[function(e,t,n){arguments[4][177][0].apply(n,arguments)},{dup:177}],182:[function(e,t,n){(function(n){t.exports=u;var r=e("debug")("simple-websocket");var i=e("inherits");var a=e("is-typedarray");var o=e("stream");var s=e("typedarray-to-buffer");var f=e("ws");var c=typeof window!=="undefined"?window.WebSocket:f;i(u,o.Duplex);function u(e,t){var n=this;if(!(n instanceof u))return new u(e,t);if(!t)t={};r("new websocket: %s %o",e,t);t.allowHalfOpen=false;if(t.highWaterMark==null)t.highWaterMark=1024*1024;o.Duplex.call(n,t);n.url=e;n.connected=false;n.destroyed=false;n._maxBufferedAmount=t.highWaterMark;n._chunk=null;n._cb=null;n._interval=null;n._ws=new c(n.url);n._ws.binaryType="arraybuffer";n._ws.onopen=n._onOpen.bind(n);n._ws.onmessage=n._onMessage.bind(n);n._ws.onclose=n._onClose.bind(n);n._ws.onerror=n._onError.bind(n);n.on("finish",function(){if(n.connected){setTimeout(function(){n._destroy()},100)}else{n.once("connect",function(){setTimeout(function(){n._destroy()},100)})}})}u.prototype.send=function(e){var t=this;if(!a.strict(e)&&!(e instanceof ArrayBuffer)&&!n.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);r("write: %d bytes",i)};u.prototype.destroy=function(e){var t=this;t._destroy(null,e)};u.prototype._destroy=function(e,t){var n=this;if(n.destroyed)return;if(t)n.once("close",t);r("destroy (error: %s)",e&&e.message);this.readable=this.writable=false;if(!n._readableState.ended)n.push(null);if(!n._writableState.finished)n.end();n.connected=false;n.destroyed=true;clearInterval(n._interval);n._interval=null;n._chunk=null;n._cb=null;if(n._ws){try{n._ws.close()}catch(e){}n._ws.onopen=null;n._ws.onmessage=null;n._ws.onclose=null;n._ws.onerror=null}n._ws=null;if(e)n.emit("error",e);n.emit("close")};u.prototype._read=function(){};u.prototype._write=function(e,t,n){var i=this;if(i.destroyed)return n(new Error("cannot write after socket is destroyed"));if(i.connected){i.send(e);if(typeof f!=="function"&&i._ws.bufferedAmount>i._maxBufferedAmount){r("start backpressure: bufferedAmount %d",i._ws.bufferedAmount);i._cb=n}else{n(null)}}else{r("write before connect");i._chunk=e;i._cb=n}};u.prototype._onMessage=function(e){var t=this;if(t.destroyed)return;var i=e.data;r("read: %d bytes",i.byteLength||i.length);if(i instanceof ArrayBuffer){i=s(new Uint8Array(i));t.push(i)}else if(n.isBuffer(i)){t.push(i)}else{try{i=JSON.parse(i)}catch(a){}t.emit("data",i)}};u.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;r('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}r("ending backpressure: bufferedAmount %d",e._ws.bufferedAmount);var t=e._cb;e._cb=null;t(null)},150);if(e._interval.unref)e._interval.unref()}r("connect");e.emit("connect")};u.prototype._onClose=function(){var e=this;if(e.destroyed)return;r("on close");e._destroy()};u.prototype._onError=function(){var e=this;if(e.destroyed)return;var t=new Error("connection error to "+e.url);r("error: %s",t.message||t);e._destroy(t)}}).call(this,e("buffer").Buffer)},{buffer:47,debug:183,inherits:186,"is-typedarray":187,stream:74,"typedarray-to-buffer":188,ws:46}],183:[function(e,t,n){arguments[4][117][0].apply(n,arguments)},{"./debug":184,dup:117}],184:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,ms:185}],185:[function(e,t,n){arguments[4][119][0].apply(n,arguments)},{dup:119}],186:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{dup:23}],187:[function(e,t,n){arguments[4][177][0].apply(n,arguments)},{dup:177}],188:[function(e,t,n){arguments[4][100][0].apply(n,arguments)},{buffer:47,dup:100,"is-typedarray":189}],189:[function(e,t,n){arguments[4][177][0].apply(n,arguments)},{dup:177}],190:[function(e,t,n){t.exports=r;function r(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n){if(n.hasOwnProperty(r)){e[r]=n[r]}}}return e}},{}],191:[function(e,t,n){arguments[4][20][0].apply(n,arguments)},{"./debug":192,dup:20}],192:[function(e,t,n){arguments[4][21][0].apply(n,arguments)},{dup:21,ms:193}],193:[function(e,t,n){arguments[4][22][0].apply(n,arguments)},{dup:22}],194:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{dup:23}],195:[function(e,t,n){arguments[4][151][0].apply(n,arguments)},{dup:151,events:51}],196:[function(e,t,n){arguments[4][190][0].apply(n,arguments)},{dup:190}],197:[function(e,t,n){arguments[4][139][0].apply(n,arguments)},{dup:139}],198:[function(e,t,n){(function(n){var r=e("bencode");var i=e("bitfield");var a=e("events").EventEmitter;var o=e("inherits");var s=e("simple-sha1");var f=1e7;var c=1e3;var u=16*1024;t.exports=function(e){o(t,a);function t(t){a.call(this);this._wire=t;this._metadataComplete=false;this._metadataSize=null;this._remainingRejects=null;this._fetching=false;this._bitfield=new i(0,{grow:c});if(n.isBuffer(e)){this.setMetadata(e)}}t.prototype.name="ut_metadata";t.prototype.onHandshake=function(e,t,n){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/u);this._remainingRejects=this._numPieces*2;if(this._fetching){this._requestPieces()}};t.prototype.onMessage=function(e){var t,n;try{var i=e.toString();var a=i.indexOf("ee")+2;t=r.decode(i.substring(0,a));n=e.slice(a)}catch(o){return}switch(t.msg_type){case 0:this._onRequest(t.piece);break;case 1:this._onData(t.piece,n,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=r.decode(e).info;if(t){e=r.encode(t)}}catch(n){}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",r.encode({info:r.decode(this.metadata)}));return true};t.prototype._send=function(e,t){var i=r.encode(e);if(n.isBuffer(t)){i=n.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,n){var r={msg_type:1,piece:e};if(typeof n==="number"){r.total_size=n}this._send(r,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*u;var n=t+u;if(n>this._metadataSize){n=this._metadataSize}var r=this.metadata.slice(t,n);this._data(e,r,this._metadataSize)};t.prototype._onData=function(e,t,n){if(t.length>u){return}t.copy(this.metadata,e*u);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 n(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 n=this.setMetadata(this.metadata);if(!n){this._failedMetadata()}};t.prototype._failedMetadata=function(){this._bitfield=new i(0,{grow:c});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:199,bitfield:203,buffer:47,events:51,inherits:204,"simple-sha1":205}],199:[function(e,t,n){arguments[4][15][0].apply(n,arguments)},{"./lib/decode":200,"./lib/encode":202,dup:15}],200:[function(e,t,n){arguments[4][16][0].apply(n,arguments)},{"./dict":201,buffer:47,dup:16}],201:[function(e,t,n){arguments[4][17][0].apply(n,arguments)},{dup:17}],202:[function(e,t,n){arguments[4][18][0].apply(n,arguments)},{buffer:47,dup:18}],203:[function(e,t,n){arguments[4][10][0].apply(n,arguments)},{buffer:47,dup:10}],204:[function(e,t,n){arguments[4][23][0].apply(n,arguments)},{dup:23}],205:[function(e,t,n){arguments[4][115][0].apply(n,arguments)},{dup:115,rusha:206}],206:[function(e,t,n){arguments[4][116][0].apply(n,arguments)},{dup:116}],207:[function(e,t,n){arguments[4][25][0].apply(n,arguments)},{dup:25}],208:[function(e,t,n){t.exports=function r(e,t,n){if(t===undefined){return function(t,n){return r(e,t,n)}}if(n===undefined)n="0";e-=t.toString().length;if(e>0)return new Array(e+(/\./.test(t)?2:1)).join(n)+t;return t+""}},{}],209:[function(e,t,n){t.exports={name:"webtorrent",description:"Streaming torrent client",version:"0.48.6",author:{name:"Feross Aboukhadijeh",email:"feross@feross.org",url:"http://feross.org/"},bin:{webtorrent:"./bin/cmd.js"},browser:{"./lib/fs-storage":false,"./lib/server":false,"bittorrent-dht/client":false,"load-ip-set":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.1.0","pretty-bytes":"^2.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-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","simple-get":"^1.0.0",standard:"^4.0.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)});
|