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

github.com/webtorrent/webtorrent.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFeross Aboukhadijeh <feross@feross.org>2015-07-15 23:58:02 +0300
committerFeross Aboukhadijeh <feross@feross.org>2015-07-15 23:58:02 +0300
commitfc14dfd23752d42cd979298e3de712ad5e808467 (patch)
tree21cd3fd626e07b7d726ef9e81b67302e95611707 /webtorrent.min.js
parenta09966de7cb2aa0b82ce7f535459e99a007127b9 (diff)
build
Diffstat (limited to 'webtorrent.min.js')
-rw-r--r--webtorrent.min.js25
1 files changed, 12 insertions, 13 deletions
diff --git a/webtorrent.min.js b/webtorrent.min.js
index bc72fb8..10acb20 100644
--- a/webtorrent.min.js
+++ b/webtorrent.min.js
@@ -1,13 +1,12 @@
-(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,r;return function n(e,t,r){function i(s,o){if(!t[s]){if(!e[s]){var f=typeof require=="function"&&require;if(!o&&f)return f(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=t[s]={exports:{}};e[s][0].call(u.exports,function(t){var r=e[s][1][t];return i(r?r:t)},u,u.exports,n,e,t,r)}return t[s].exports}var a=typeof require=="function"&&require;for(var s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,r){var i=e("debug")("webtorrent:append-to");var n=e("dezalgo");var a=e("./media-stream");var s=e("path");var o=e("videostream");var f=[".mp4",".m4v",".m4a"];var l=[".mp4",".m4v",".webm"];var u=[".m4a",".mp3"];var c=l.concat(u);var p=[".wav",".aac",".ogg",".oga"];var d=[".jpg",".png",".gif",".bmp"];var h=[".css",".html",".js",".md",".pdf",".txt"];var m=typeof window!=="undefined"&&window.MediaSource;t.exports=function v(e,t,r){r=n(r);var u;var v=s.extname(e.name).toLowerCase();if(t&&(t.nodeName==="VIDEO"||t.nodeName==="AUDIO")){throw new Error("Invalid video/audio node argument. Argument must be root element that "+"video/audio tag will be appended to.")}if(c.indexOf(v)>=0)g();else if(p.indexOf(v)>=0)y();else if(d.indexOf(v)>=0)b();else if(h.indexOf(v)>=0)w();else r(new Error('Unsupported file type "'+v+'": Cannot append to DOM'));function g(){if(!m){return r(new Error("Video/audio streaming is not supported in your browser. You can still share "+"or download "+e.name+" (once it's fully downloaded). Use Chrome for "+"MediaSource support."))}var n=l.indexOf(v)>=0?"video":"audio";if(f.indexOf(v)>=0)s();else c();function s(){i("Use `videostream` package for "+e.name);g();u.addEventListener("error",d);u.addEventListener("playing",_);o(e,u);y()}function c(){i("Use MediaSource API for "+e.name);g();u.addEventListener("error",h);u.addEventListener("playing",_);e.createReadStream().pipe(new a(u,{extname:v}));y()}function p(){i("Use Blob URL for "+e.name);g();u.addEventListener("error",x);u.addEventListener("playing",_);y();e.getBlobURL(function(e,t){if(e)return x(e);u.src=t})}function d(e){i("videostream error: fallback to MediaSource API: %o",e.message||e);u.removeEventListener("error",d);u.removeEventListener("playing",_);c()}function h(e){i("MediaSource API error: fallback to Blob URL: %o",e.message||e);u.removeEventListener("error",h);u.removeEventListener("playing",_);p()}function g(){if(u)u.remove();u=window.elem=document.createElement(n);u.controls=true;u.autoplay=true}function y(){t.appendChild(u);u.play()}}function _(){u.removeEventListener("playing",_);r(null,u)}function y(){u=document.createElement("audio");u.controls=true;u.autoplay=true;t.appendChild(u);e.getBlobURL(function(e,t){if(e)return x(e);u.addEventListener("error",x);u.addEventListener("playing",_);u.src=t;u.play()})}function b(){e.getBlobURL(function(i,n){if(i)return x(i);u=document.createElement("img");u.src=n;u.alt=e.name;t.appendChild(u);r(null)})}function w(){e.getBlobURL(function(e,i){if(e)return x(e);u=document.createElement("iframe");u.src=i;if(v!==".pdf")u.sandbox="allow-forms allow-scripts";t.appendChild(u);r(null)})}function x(t){if(u)u.remove();t.message='Error appending file "'+e.name+'" to DOM: '+t.message;i(t.message);if(r)r(t)}}},{"./media-stream":3,debug:138,dezalgo:141,path:77,videostream:237}],2:[function(e,t,r){t.exports=s;var i=e("debug")("webtorrent:file-stream");var n=e("inherits");var a=e("stream");n(s,a.Readable);function s(e,t){var r=this;if(!(r instanceof s))return new s(e,t);a.Readable.call(r,t);i("new filestream %s",JSON.stringify(t));if(!t)t={};if(!t.start)t.start=0;if(!t.end)t.end=e.length-1;r.destroyed=false;r.length=t.end-t.start+1;var n=t.start+e.offset;var o=t.pieceLength;r.startPiece=n/o|0;r.endPiece=(t.end+e.offset)/o|0;r._storage=e.storage;r._piece=r.startPiece;r._missing=r.length;r._reading=false;r._notifying=false;r._criticalLength=Math.min(1024*1024/o|0,2);r._offset=n-r.startPiece*o}s.prototype._read=function(){var e=this;i("_read");if(e._reading)return;e._reading=true;e.notify()};s.prototype.notify=function(){var e=this;i("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;e._storage.read(e._piece++,function(r,n){e._notifying=false;if(e.destroyed)return;if(r){e._storage.emit("error",r);return e.destroy(r)}i("read %s (length %s) (err %s)",t,n.length,r&&r.message);if(e._offset){n=n.slice(e._offset);e._offset=0}if(e._missing<n.length){n=n.slice(0,e._missing)}e._missing-=n.length;i("pushing buffer of length %s",n.length);e._reading=false;e.push(n);if(e._missing===0)e.push(null)})};s.prototype.destroy=function(){var e=this;if(e.destroyed)return;e.destroyed=true;e._storage.emit("deselect",e.startPiece,e.endPiece,true)}},{debug:138,inherits:147,stream:94}],3:[function(e,t,r){t.exports=o;var i=e("debug")("webtorrent:media-source-stream");var n=e("inherits");var a=e("stream");var s=typeof window!=="undefined"&&window.MediaSource;n(o,a.Writable);function o(e,t){var r=this;if(!(r instanceof o))return new o(e,t);a.Writable.call(r,t);if(!s)throw new Error("web browser lacks MediaSource support");if(!t)t={};i("new MediaSourceStream %s %s",e,JSON.stringify(t));r._elem=e;r._mediaSource=new s;r._sourceBuffer=null;r._cb=null;r._type=t.type||f(t.extname);if(!r._type)throw new Error("missing `opts.type` or `opts.extname` options");r._elem.src=window.URL.createObjectURL(r._mediaSource);r._mediaSource.addEventListener("sourceopen",function(){if(s.isTypeSupported(r._type)){r._sourceBuffer=r._mediaSource.addSourceBuffer(r._type);r._sourceBuffer.addEventListener("updateend",r._flow.bind(r));r._flow()}else{r._mediaSource.endOfStream("decode")}});r.on("finish",function(){i("finish");r._mediaSource.endOfStream()});window.vs=r}o.prototype._write=function(e,t,r){var n=this;if(!n._sourceBuffer){n._cb=function(i){if(i)return r(i);n._write(e,t,r)};return}if(n._sourceBuffer.updating){return r(new Error("Cannot append buffer while source buffer updating"))}n._sourceBuffer.appendBuffer(e);i("appendBuffer %s",e.length);n._cb=r};o.prototype._flow=function(){var e=this;i("flow");if(e._cb){e._cb(null)}};function f(e){if(!e)return null;if(e[0]!==".")e="."+e;return{".m4a":'audio/mp4; codecs="mp4a.40.5"',".m4v":'video/mp4; codecs="avc1.640029, mp4a.40.5"',".mp3":"audio/mpeg",".mp4":'video/mp4; codecs="avc1.640029, mp4a.40.5"',".webm":'video/webm; codecs="vorbis, vp8"'}[e]}},{debug:138,inherits:147,stream:94}],4:[function(e,t,r){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,r){t.exports=i;function i(e,t){var r=this;r.swarm=e;r.numPieces=t;function i(e){e.on("have",function(e){r.pieces[e]++});e.on("bitfield",r.recalculate.bind(r));e.on("close",function(){for(var t=0;t<r.numPieces;++t){r.pieces[t]-=e.peerPieces.get(t)}})}r.swarm.wires.forEach(i);r.swarm.on("wire",function(e){r.recalculate();i(e)});r.recalculate()}i.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 r=0;r<e.numPieces;++r){e.pieces[r]+=t.peerPieces.get(r)}})};i.prototype.getRarestPiece=function(e){var t=this;var r=[];var i=Infinity;e=e||function(){return true};for(var n=0;n<t.numPieces;++n){if(!e(n))continue;var a=t.pieces[n];if(a===i){r.push(n)}else if(a<i){r=[n];i=a}}if(r.length>0){return r[Math.random()*r.length|0]}else{return-1}}},{}],6:[function(e,t,r){var i=e("debug")("webtorrent:server");var n=e("http");var a=e("mime");var s=e("pump");var o=e("range-parser");var f=e("url");t.exports=function l(e,t){var r=n.createServer(t);r.on("connection",function(e){e.setTimeout(36e6)});r.on("request",function(t,r){i("onRequest");if(t.method==="OPTIONS"&&t.headers["access-control-request-headers"]){r.setHeader("Access-Control-Allow-Methods","POST, GET, OPTIONS");r.setHeader("Access-Control-Allow-Headers",t.headers["access-control-request-headers"]);r.setHeader("Access-Control-Max-Age","1728000");return r.end()}if(t.headers.origin){r.setHeader("Access-Control-Allow-Origin",t.headers.origin)}var n=f.parse(t.url).pathname;if(n==="/favicon.ico")return r.end();if(e.ready)l();else e.once("ready",l);function l(){if(n==="/"){r.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 r.end("<h1>WebTorrent</h1><ol>"+f+"</ol>")}var l=Number(n.slice(1));if(Number.isNaN(l)||l>=e.files.length){r.statusCode=404;return r.end("404 Not Found")}var u=e.files[l];r.setHeader("Accept-Ranges","bytes");r.setHeader("Content-Type",a.lookup(u.name));r.statusCode=200;r.setHeader("transferMode.dlna.org","Streaming");r.setHeader("contentFeatures.dlna.org","DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000");var c;if(t.headers.range){r.statusCode=206;c=o(u.length,t.headers.range)[0];i("range %s",JSON.stringify(c));r.setHeader("Content-Range","bytes "+c.start+"-"+c.end+"/"+u.length);r.setHeader("Content-Length",c.end-c.start+1)}else{r.setHeader("Content-Length",u.length)}if(t.method==="HEAD")r.end();s(u.createReadStream(c),r)}});return r}},{debug:138,http:71,mime:148,pump:172,"range-parser":173,url:96}],7:[function(e,t,r){(function(i,n){t.exports=r=A;var a=e("./append-to");var s=e("bitfield");var o=e("block-stream2");var f=e("debug")("webtorrent:storage");var l=e("dezalgo");var u=e("end-of-stream");var c=e("events").EventEmitter;var p=e("./file-stream");var d=e("inherits");var h=e("./mime.json");var m=e("multistream");var v=e("once");var g=e("path");var _=e("simple-sha1");var y=16*1024;var b=r.BLOCK_BLANK=0;var w=r.BLOCK_RESERVED=1;var x=r.BLOCK_WRITTEN=2;function k(){}d(S,c);function S(e,t,r,i){var n=this;c.call(n);if(!f.enabled)n.setMaxListeners(0);n.index=e;n.hash=t;n.noVerify=!!i;if(typeof r==="number"){n.buffer=null;n.length=r}else{n.buffer=r;n.length=r.length}n._reset()}S.prototype.readBlock=function(e,t,r){var i=this;r=l(r);if(!i.buffer||!i._verifyOffset(e)){return r(new Error("invalid block offset "+e))}r(null,i.buffer.slice(e,e+t))};S.prototype.writeBlock=function(e,t,r){var i=this;r=l(r);if(!i._verifyOffset(e)||!i._verifyBlock(e,t)){return r(new Error("invalid block "+e+":"+t.length))}i._lazyAllocBuffer();var n=e/y;if(i.blocks[n]===x){return r(null)}t.copy(i.buffer,e);i.blocks[n]=x;i.blocksWritten+=1;if(i.blocksWritten===i.blocks.length){i.verify()}r(null)};S.prototype.reserveBlock=function(e){var t=this;var r=t.blocks.length;for(var i=0;i<r;i++){if(t.blocks[i]&&!e||t.blocks[i]===x){continue}t.blocks[i]=w;return{offset:i*y,length:i===r-1?t.length-i*y:y}}return null};S.prototype.cancelBlock=function(e){var t=this;if(!t._verifyOffset(e)){return false}var r=e/y;if(t.blocks[r]===w){t.blocks[r]=b}return true};S.prototype._reset=function(){var e=this;e.verified=false;e.blocks=new n(Math.ceil(e.length/y));if(!i.browser)e.blocks.fill(0);e.blocksWritten=0};S.prototype.verify=function(e){var t=this;if(!e)e=t.buffer;if(t.verified||!e){return}if(t.noVerify){t.verified=true;r();return}_(e,function(e){t.verified=e===t.hash;r()});function r(){if(t.verified){t.emit("done")}else{t.emit("warning",new Error("piece "+t.index+" failed verification"));t._reset()}}};S.prototype._verifyOffset=function(e){var t=this;if(e%y===0){return true}else{t.emit("warning",new Error("invalid block offset "+e+", not multiple of "+y));return false}};S.prototype._verifyBlock=function(e,t){var r=this;if(t.length===y){return true}else if(t.length===r.length-e&&r.length-e<y){return true}else{r.emit("warning",new Error("invalid block size "+t.length));return false}};S.prototype._lazyAllocBuffer=function(){var e=this;if(!e.buffer)e.buffer=new n(e.length)};d(E,c);function E(e,t,r,i){var n=this;c.call(n);if(!f.enabled)n.setMaxListeners(0);n.storage=e;n.name=t.name;n.path=t.path;n.length=t.length;n.offset=t.offset;n.pieces=r;n.pieceLength=i;n.done=false;n._blobUrl=null;n._blobUrlPending=false;n.pieces.forEach(function(e){e.on("done",function(){n._checkDone()})});n._checkDone()}E.prototype.select=function(){var e=this;if(e.pieces.length>0){var t=e.pieces[0].index;var r=e.pieces[e.pieces.length-1].index;e.storage.emit("select",t,r,false)}};E.prototype.deselect=function(){var e=this;if(e.pieces.length>0){var t=e.pieces[0].index;var r=e.pieces[e.pieces.length-1].index;e.storage.emit("deselect",t,r,false)}};E.prototype.createReadStream=function(e){var t=this;if(!e)e={};if(e.pieceLength==null)e.pieceLength=t.pieceLength;var r=new p(t,e);t.storage.emit("select",r.startPiece,r.endPiece,true,r.notify.bind(r));u(r,function(){t.storage.emit("deselect",r.startPiece,r.endPiece,true)});return r};E.prototype.getBuffer=function(e){var t=this;e=l(v(e));var r;if(t.storage.buffer){var i=function(){r=t.storage.buffer.slice(t.offset,t.offset+t.length);e(null,r)};if(t.done)i();else t.once("done",i)}else{r=new n(t.length);var a=0;t.createReadStream().on("data",function(e){e.copy(r,a);a+=e.length}).on("end",function(){e(null,r)}).on("error",e)}};E.prototype.appendTo=function(e,t){var r=this;if(typeof window==="undefined")throw new Error("browser-only method");if(typeof e==="string")e=document.querySelector(e);a(r,e,t)};E.prototype.getBlobURL=function(e){var t=this;if(typeof window==="undefined")throw new Error("browser-only method");e=l(e);if(t._blobUrl)return e(null,t._blobUrl);if(t._blobUrlPending)return t.once("_blobUrl",e);t._blobUrlPending=true;t.getBuffer(function(r,i){t._blobUrlPending=false;if(r){e(r);t.emit("_blobUrl",r);return}var n=h[g.extname(t.name).toLowerCase()];var a=n?new window.Blob([i],{type:n}):new window.Blob([i]);t._blobUrl=window.URL.createObjectURL(a);e(null,t._blobUrl);t.emit("_blobUrl",null,t._blobUrl)})};E.prototype._checkDone=function(){var e=this;e.done=e.pieces.every(function(e){return e.verified});if(e.done){i.nextTick(function(){e.emit("done")})}};d(A,c);function A(e,t){var r=this;c.call(r);if(!f.enabled)r.setMaxListeners(0);if(!t)t={};r.bitfield=new s(e.pieces.length);r.done=false;r.closed=false;r.readonly=true;if(!t.nobuffer){r.buffer=new n(e.length)}var i=r.pieceLength=e.pieceLength;var a=e.lastPieceLength;var o=e.pieces.length;r.pieces=e.pieces.map(function(e,n){var s=n*i;var f=s+(n===o-1?a:i);var l=r.buffer?r.buffer.slice(s,f):f-s;var u=new S(n,e,l,!!t.noVerify);u.on("done",r._onPieceDone.bind(r,u));return u});r.files=e.files.map(function(e){var t=e.offset;var n=t+e.length-1;var a=t/i|0;var s=n/i|0;var o=r.pieces.slice(a,s+1);var f=new E(r,e,o,i);f.on("done",r._onFileDone.bind(r,f));return f})}A.BLOCK_LENGTH=y;A.prototype.load=function(e,t){var r=this;if(!Array.isArray(e))e=[e];t=v(t||function(){});var i=0;var n=new m(e);var a=new o(r.pieceLength,{zeroPadding:false});n.on("error",f);r.once("done",l);n.pipe(a).on("data",s).on("error",f);function s(e){var t=i;i+=1;var n=0;var a=new o(y,{zeroPadding:false});a.on("data",s);a.on("end",f);function s(e){var i=n*y;n+=1;r.writeBlock(t,i,e)}function f(){l()}function l(){a.removeListener("data",s);a.removeListener("end",f)}a.end(e)}function f(e){u();t(e)}function l(){u();t(null)}function u(){n.removeListener("error",f);a.removeListener("data",s);a.removeListener("error",f);r.removeListener("done",l)}};Object.defineProperty(A.prototype,"downloaded",{get:function(){var e=this;return e.pieces.reduce(function(e,t){return e+(t.verified?t.length:t.blocksWritten*y)},0)}});Object.defineProperty(A.prototype,"numMissing",{get:function(){var e=this;var t=e.pieces.length;for(var r=0,i=e.pieces.length;r<i;r++){t-=e.bitfield.get(r)}return t}});A.prototype.readBlock=function(e,t,r,i){var n=this;i=l(i);var a=n.pieces[e];if(!a)return i(new Error("invalid piece index "+e));a.readBlock(t,r,i)};A.prototype.writeBlock=function(e,t,r,i){var n=this;if(!i)i=k;i=l(i);if(n.readonly)return i(new Error("cannot write to readonly storage"));var a=n.pieces[e];if(!a)return i(new Error("invalid piece index "+e));a.writeBlock(t,r,i)};A.prototype.read=function(e,t,r,i){var a=this;if(typeof t==="function"){i=r;r=t;t=null}r=l(r);var s=a.pieces[e];if(!s){return r(new Error("invalid piece index "+e))}if(!s.verified&&!i){return r(new Error("Storage.read called on incomplete piece "+e))}var o=0;var f=s.length;if(t){o=t.offset||0;f=t.length||f}if(s.buffer){return r(null,s.buffer.slice(o,o+f))}var u=[];function c(){if(f<=0)return r(null,n.concat(u));var t=o;var i=Math.min(y,f);o+=i;f-=i;a.readBlock(e,t,i,function(e,t){if(e)return r(e);u.push(t);c()})}c()};A.prototype.reserveBlock=function(e,t){var r=this;var i=r.pieces[e];if(!i)return null;return i.reserveBlock(t)};A.prototype.cancelBlock=function(e,t){var r=this;var i=r.pieces[e];if(!i)return false;return i.cancelBlock(t)};A.prototype.remove=function(e){if(e)l(e)(null)};A.prototype.close=function(e){var t=this;t.closed=true;if(e)l(e)(null)};A.prototype._onPieceDone=function(e){var t=this;t.bitfield.set(e.index);f("piece done "+e.index+" ("+t.numMissing+" still missing)");t.emit("piece",e)};A.prototype._onFileDone=function(e){var t=this;f("file done "+e.name);t.emit("file",e);t._checkDone()};A.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)},{"./append-to":1,"./file-stream":2,"./mime.json":4,_process:78,bitfield:10,"block-stream2":39,buffer:66,debug:138,dezalgo:141,"end-of-stream":145,events:70,inherits:147,multistream:150,once:153,path:77,"simple-sha1":179}],8:[function(e,t,r){(function(r,i){t.exports=U;var n=e("addr-to-ip-port");var a=e("create-torrent");var s=e("debug")("webtorrent:torrent");var o=e("torrent-discovery");var f=e("events").EventEmitter;var l=e("inherits");var u=e("run-parallel");var c=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 _=e("./server");var y=e("./storage");var b=128*1024;var w=3e4;var x=5e3;var k=3*y.BLOCK_LENGTH;var S=.5;var E=1;var A=1e4;var T=2;function I(){}l(U,f);function U(e,t){var r=this;f.call(r);if(!s.enabled)r.setMaxListeners(0);s("new torrent");r.opts=t;r.client=t.client;r.hotswapEnabled="hotswap"in t?t.hotswap:true;r.verify=t.verify;r.chokeTimeout=t.chokeTimeout||x;r.pieceTimeout=t.pieceTimeout||w;r.strategy=t.strategy||"sequential";r._rechokeNumSlots=t.uploads===false||t.uploads===0?0:+t.uploads||10;r._rechokeOptimisticWire=null;r._rechokeOptimisticTime=0;r._rechokeIntervalId=null;r.ready=false;r.destroyed=false;r.files=[];r.metadata=null;r.parsedTorrent=null;r.storage=null;r.numBlockedPeers=0;r._amInterested=false;r._selections=[];r._critical=[];r._storageImpl=t.storage||y;this._torrentFileURL=null;if(e)r._onTorrentId(e)}Object.defineProperty(U.prototype,"length",{get:function(){return this.parsedTorrent&&this.parsedTorrent.length||0}});Object.defineProperty(U.prototype,"timeRemaining",{get:function(){if(this.swarm.downloadSpeed()===0)return Infinity;else return(this.length-this.downloaded)/this.swarm.downloadSpeed()*1e3}});Object.defineProperty(U.prototype,"progress",{get:function(){return this.parsedTorrent&&this.downloaded/this.parsedTorrent.length||0}});Object.defineProperty(U.prototype,"downloaded",{get:function(){return this.storage&&this.storage.downloaded||0}});Object.defineProperty(U.prototype,"uploaded",{get:function(){return this.swarm.uploaded}});Object.defineProperty(U.prototype,"ratio",{get:function(){return this.uploaded&&this.downloaded/this.uploaded||0}});Object.defineProperty(U.prototype,"magnetURI",{get:function(){return c.toMagnetURI(this.parsedTorrent)}});Object.defineProperty(U.prototype,"torrentFile",{get:function(){return c.toTorrentFile(this.parsedTorrent)}});Object.defineProperty(U.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}});U.prototype._onTorrentId=function(e){var t=this;if(t.destroyed)return;var r=e&&e.parsedTorrent;if(r){t._onParsedTorrent(r)}else{c.remote(e,function(e,r){if(t.destroyed)return;if(e)return t._onError(e);t._onParsedTorrent(r)})}};U.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(i.WEBTORRENT_ANNOUNCE){t.parsedTorrent.announce=t.parsedTorrent.announce.concat(i.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));if(t.parsedTorrent.urlList){t.parsedTorrent.urlList.forEach(t.addWebSeed.bind(t))}r.nextTick(function(){if(t.destroyed)return;t.emit("infoHash",t.infoHash)})};U.prototype._onSwarmListening=function(){var e=this;if(e.destroyed)return;if(e.swarm.server)e.client.torrentPort=e.swarm.address().port;e.discovery=new o({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)};U.prototype._onMetadata=function(e){var t=this;if(t.metadata||t.destroyed)return;s("got metadata");if(e&&e.infoHash){t.metadata=c.toTorrentFile(e);t.parsedTorrent=e}else{t.metadata=e;var i=t.parsedTorrent.announce;try{t.parsedTorrent=c(t.metadata)}catch(n){return t._onError(n)}t.parsedTorrent.announce=i}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();s("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){r.nextTick(function(){s("verifying existing torrent data");var e=0;var r=0;u(t.storage.pieces.map(function(i){return function(n){t.storage.read(i.index,function(a,o){e+=1;t.emit("verifying",{percentDone:100*e/t.storage.pieces.length,percentVerified:100*r/t.storage.pieces.length});if(!a&&o){i.verify(o);r+=i.verified;s("piece "+(i.verified?"verified":"invalid")+" "+i.index)}n()},true)}}),t._onStorage.bind(t))})}else{r.nextTick(t._onStorage.bind(t))}r.nextTick(function(){t.emit("metadata")})};U.prototype.destroy=function(e){var t=this;if(t.destroyed)return;t.destroyed=true;s("destroy");if(t._rechokeIntervalId){clearInterval(t._rechokeIntervalId);t._rechokeIntervalId=null}if(t._torrentFileURL)window.URL.revokeObjectURL(t._torrentFileURL);var r=[];if(t.swarm)r.push(function(e){t.swarm.destroy(e)});if(t.discovery)r.push(function(e){t.discovery.stop(e)});if(t.storage)r.push(function(e){t.storage.close(e)});u(r,e)};U.prototype.addPeer=function(e){var t=this;function r(){t.emit("peer",e);t.swarm.addPeer(e)}if(typeof e==="string"&&t.client.blocked&&t.client.blocked.contains(n(e)[0])){t.numBlockedPeers+=1;t.emit("blockedPeer",e);return false}else{if(t.swarm)r();else t.on("listening",r);return true}};U.prototype.addWebSeed=function(e){var t=this;t.swarm.addWebSeed(e,t.parsedTorrent)};U.prototype.select=function(e,t,r,i){var n=this;if(e>t||e<0||t>=n.storage.pieces.length){throw new Error("invalid selection ",e,":",t)}r=Number(r)||0;s("select %s-%s (priority %s)",e,t,r);n._selections.push({from:e,to:t,offset:0,priority:r,notify:i||I});n._selections.sort(function(e,t){return t.priority-e.priority});n._updateSelections()};U.prototype.deselect=function(e,t,r){var i=this;r=Number(r)||0;s("deselect %s-%s (priority %s)",e,t,r);for(var n=0;n<i._selections.length;++n){var a=i._selections[n];if(a.from===e&&a.to===t&&a.priority===r){i._selections.splice(n--,1);break}}i._updateSelections()};U.prototype.critical=function(e,t){var r=this;s("critical %s-%s",e,t);for(var i=e;i<=t;++i){r._critical[i]=true}r._updateSelections()};U.prototype._onWire=function(e,t){var r=this;s("got wire (%s)",t||"Unknown");if(t){var i=n(t);e.remoteAddress=i[0];e.remotePort=i[1]}if(e.peerExtensions.dht&&r.client.dht&&r.client.dht.listening){e.on("port",function(t){if(!e.remoteAddress){s("ignoring port from peer with no address");return}s("port: %s (from %s)",t,e.remoteAddress+":"+e.remotePort);r.client.dht.addNode(e.remoteAddress+":"+t)});e.port(r.client.dht.address().port)}e.on("timeout",function(){s("wire timeout (%s)",t);e.destroy()});e.setTimeout(r.pieceTimeout,true);e.setKeepAlive(true);e.use(m(r.metadata));if(!r.metadata){e.ut_metadata.on("metadata",function(e){s("got metadata via ut_metadata");r._onMetadata(e)});e.ut_metadata.fetch()}if(typeof v==="function"){e.use(v());e.ut_pex.on("peer",function(e){s("ut_pex: got peer: %s (from %s)",e,t);r.addPeer(e)});e.ut_pex.on("dropped",function(e){s("ut_pex: dropped peer: %s (from %s)",e,t);var i=r.swarm._peers[e];if(!i||!i.conn)r.swarm.removePeer(e)})}r.emit("wire",e);if(r.metadata){r._onWireWithMetadata(e)}};U.prototype._onWireWithMetadata=function(e){var t=this;var r=null;var i=t.chokeTimeout;function n(){if(t.destroyed||e.destroyed)return;if(t.swarm.numQueued>2*(t.swarm.numConns-t.swarm.numPeers)&&e.amInterested){e.destroy()}else{r=setTimeout(n,i);if(r.unref)r.unref()}}var a=0;function o(){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(){o();t._update()});e.on("have",function(){o();t._update()});e.once("interested",function(){e.unchoke()});e.on("close",function(){clearTimeout(r)});e.on("choke",function(){clearTimeout(r);r=setTimeout(n,i);if(r.unref)r.unref()});e.on("unchoke",function(){clearTimeout(r);t._update()});e.on("request",function(r,i,n,a){if(n>b){s("got invalid block size request %s (from %s)",n,e.remoteAddress+":"+e.remotePort);return e.destroy()}t.storage.readBlock(r,i,n,a)});e.bitfield(t.storage.bitfield);e.interested();r=setTimeout(n,i);if(r.unref)r.unref();e.isSeeder=false;o()};U.prototype._onStorage=function(){var e=this;if(e.destroyed)return;s("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();r.nextTick(function(){e.ready=true;e.emit("ready")})};U.prototype._onStoragePiece=function(e){var t=this;s("piece done %s",e.index);t._reservations[e.index]=null;t.swarm.wires.forEach(function(t){t.have(e.index)});t._gcSelections()};U.prototype._updateSelections=function(){var e=this;if(!e.swarm||e.destroyed)return;if(!e.metadata)return e.once("metadata",e._updateSelections.bind(e));r.nextTick(e._gcSelections.bind(e));e._updateInterest();e._update()};U.prototype._gcSelections=function(){var e=this;for(var t=0;t<e._selections.length;t++){var r=e._selections[t];var i=r.offset;while(e.storage.bitfield.get(r.from+r.offset)&&r.from+r.offset<r.to){r.offset++}if(i!==r.offset)r.notify();if(r.to!==r.from+r.offset)continue;if(!e.storage.bitfield.get(r.from+r.offset))continue;e._selections.splice(t--,1);r.notify();e._updateInterest()}if(!e._selections.length)e.emit("idle")};U.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")};U.prototype._update=function(){var e=this;if(e.destroyed)return;z(e.swarm.wires,e._updateWire.bind(e))};U.prototype._updateWire=function(e){var t=this;if(e.peerChoking)return;if(!e.downloaded)return a();var r=L(e,S);if(e.requests.length>=r)return;var i=L(e,E);f(false)||f(true);function n(t,r,i,n){return function(a){return a>=t&&a<=r&&!(a in i)&&e.peerPieces.get(a)&&(!n||n(a))}}function a(){if(e.requests.length)return;for(var r=t._selections.length;r--;){var i=t._selections[r];var a;if(t.strategy==="rarest"){var s=i.from+i.offset;var o=i.to;var f=o-s+1;var l={};var u=0;var c=n(s,o,l);while(u<f){a=t.rarityMap.getRarestPiece(c);if(a<0)break;if(t._request(e,a,false))return;l[a]=true;u+=1}}else{for(a=i.to;a>=i.from+i.offset;--a){if(!e.peerPieces.get(a))continue;if(t._request(e,a,false))return}}}}function s(){var r=e.downloadSpeed()||1;if(r>k)return function(){return true};var i=Math.max(1,e.requests.length)*y.BLOCK_LENGTH/r;var n=10;var a=0;return function(e){if(!n||t.storage.bitfield.get(e))return true;var s=t.storage.pieces[e];var o=s.blocks.length-s.blocksWritten;for(;a<t.swarm.wires.length;a++){var f=t.swarm.wires[a];var l=f.downloadSpeed();if(l<k)continue;if(l<=r)continue;if(!f.peerPieces.get(e))continue;if((o-=l*i)>0)continue;n--;return false}return true}}function o(e){var r=e;for(var i=e;i<t._selections.length&&t._selections[i].priority;i++){r=i}var n=t._selections[e];t._selections[e]=t._selections[r];t._selections[r]=n}function f(r){if(e.requests.length>=i)return true;var a=s();for(var f=0;f<t._selections.length;f++){var l=t._selections[f];var u;if(t.strategy==="rarest"){var c=l.from+l.offset;var p=l.to;var d=p-c+1;var h={};var m=0;var v=n(c,p,h,a);while(m<d){u=t.rarityMap.getRarestPiece(v);if(u<0)break;while(t._request(e,u,t._critical[u]||r)){}if(e.requests.length<i){h[u]=true;m++;continue}if(l.priority)o(f);return true}}else{for(u=l.from+l.offset;u<=l.to;u++){if(!e.peerPieces.get(u)||!a(u))continue;while(t._request(e,u,t._critical[u]||r)){}if(e.requests.length<i)continue;if(l.priority)o(f);return true}}}return false}};U.prototype._rechoke=function(){var e=this;if(e._rechokeOptimisticTime>0)e._rechokeOptimisticTime-=1;else e._rechokeOptimisticWire=null;var t=[];e.swarm.wires.forEach(function(r){if(!r.isSeeder&&r!==e._rechokeOptimisticWire){t.push({wire:r,downloadSpeed:r.downloadSpeed(),uploadSpeed:r.uploadSpeed(),salt:Math.random(),isChoked:true})}});t.sort(s);var r=0;var i=0;for(;i<t.length&&r<e._rechokeNumSlots;++i){t[i].isChoked=false;if(t[i].wire.peerInterested)r+=1}if(!e._rechokeOptimisticWire&&i<t.length&&e._rechokeNumSlots){var n=t.slice(i).filter(function(e){return e.wire.peerInterested});var a=n[B(n.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 s(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}};U.prototype._hotswap=function(e,t){var r=this;if(!r.hotswapEnabled)return false;var i=e.downloadSpeed();if(i<y.BLOCK_LENGTH)return false;if(!r._reservations[t])return false;var n=r._reservations[t];if(!n){return false}var a=Infinity;var s;var o;for(o=0;o<n.length;o++){var f=n[o];if(!f||f===e)continue;var l=f.downloadSpeed();if(l>=k)continue;if(2*l>i||l>a)continue;s=f;a=l}if(!s)return false;for(o=0;o<n.length;o++){if(n[o]===s)n[o]=null}for(o=0;o<s.requests.length;o++){var u=s.requests[o];if(u.piece!==t)continue;r.storage.cancelBlock(t,u.offset)}r.emit("hotswap",s,e,t);return true};U.prototype._request=function(e,t,i){var n=this;var a=e.requests.length;if(n.storage.bitfield.get(t))return false;var o=L(e,E);if(a>=o)return false;var f=e.requests.length===0&&n.storage.numMissing<30;var l=n.storage.reserveBlock(t,f);if(!l&&!f&&i&&n._hotswap(e,t)){l=n.storage.reserveBlock(t,false)}if(!l)return false;var u=n._reservations[t];if(!u){u=n._reservations[t]=[]}var c=u.indexOf(null);if(c===-1)c=u.length;u[c]=e;function p(i,a){if(!n.ready){n.once("ready",function(){p(i,a)});return}if(u[c]===e)u[c]=null;if(i){s("error getting piece %s (offset: %s length: %s) from %s: %s",t,l.offset,l.length,e.remoteAddress+":"+e.remotePort,i.message);n.storage.cancelBlock(t,l.offset);r.nextTick(n._update.bind(n));return false}else{s("got piece %s (offset: %s length: %s) from %s",t,l.offset,l.length,e.remoteAddress+":"+e.remotePort);n.storage.writeBlock(t,l.offset,a,function(e){if(e){s("error writing block");n.storage.cancelBlock(t,l.offset)}r.nextTick(n._update.bind(n))})}}e.request(t,l.offset,l.length,p);return true};U.prototype.createServer=function(e){var t=this;if(typeof _==="function"){return new _(t,e)}};U.prototype._onError=function(e){var t=this;s("torrent error: %s",e.message||e);t.emit("error",e);t.destroy()};function L(e,t){return Math.ceil(2+t*e.downloadSpeed()/y.BLOCK_LENGTH)}function B(e){return Math.random()*e|0}function z(e,t){var r=e.map(function(e,t){return t});for(var i=r.length-1;i>0;--i){var n=B(i+1);var a=r[i];r[i]=r[n];r[n]=a}r.forEach(function(r){t(e[r],r,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:78,"addr-to-ip-port":9,"bittorrent-swarm":11,"create-torrent":99,debug:138,events:70,inherits:147,"parse-torrent":154,"re-emitter":174,"run-parallel":175,"torrent-discovery":182,uniq:221,ut_metadata:222,ut_pex:52}],9:[function(e,t,r){var i=/^\[?([^\]]+)\]?:(\d+)$/;var n={};var a=0;t.exports=function s(e){if(a===1e5)n={};if(!n[e]){var t=i.exec(e);if(!t)throw new Error("invalid addr: "+e);n[e]=[t[1],Number(t[2])];a+=1}return n[e]};t.exports.reset=function o(){n={}}},{}],10:[function(e,t,r){(function(e){var r=typeof e!=="undefined"?e:typeof Int8Array!=="undefined"?Int8Array:function(e){var t=new Array(e);for(var r=0;r<e;r++)t[r]=0};function i(e,t){if(!(this instanceof i)){return new i(e,t)}if(arguments.length===0){e=0}this.grow=t&&(isFinite(t.grow)&&n(t.grow)||t.grow)||0;if(typeof e==="number"||e===undefined){e=new r(n(e));if(e.fill)e.fill(0)}this.buffer=e}function n(e){var t=e>>3;if(e%8!==0)t++;return t}i.prototype.get=function(e){var t=e>>3;return t<this.buffer.length&&!!(this.buffer[t]&128>>e%8)};i.prototype.set=function(e,t){var r=e>>3;if(t||arguments.length===1){if(this.buffer.length<r+1)this._grow(Math.max(r+1,Math.min(2*this.buffer.length,this.grow)));this.buffer[r]|=128>>e%8}else if(r<this.buffer.length){this.buffer[r]&=~(128>>e%8)}};i.prototype._grow=function(e){if(this.buffer.length<e&&e<=this.grow){var t=new r(e);if(t.fill)t.fill(0);if(this.buffer.copy)this.buffer.copy(t,0);else{for(var i=0;i<this.buffer.length;i++){t[i]=this.buffer[i]}}this.buffer=t}};if(typeof t!=="undefined")t.exports=i}).call(this,e("buffer").Buffer)},{buffer:66}],11:[function(e,t,r){(function(r,i){t.exports=m;var n=e("addr-to-ip-port");var a=e("debug")("bittorrent-swarm");var s=e("dezalgo");var o=e("events").EventEmitter;var f=e("inherits");var l=e("net");var u=e("./lib/peer");var c=e("speedometer");var p=e("./lib/tcp-pool");var d=55;var h=[1e3,5e3,15e3];f(m,o);function m(e,t,r){var n=this;if(!(n instanceof m))return new m(e,t,r);o.call(n);n.infoHash=typeof e==="string"?new i(e,"hex"):e;n.infoHashHex=n.infoHash.toString("hex");n.peerId=typeof t==="string"?new i(t,"hex"):t;n.peerIdHex=n.peerId.toString("hex");if(!r)r={};a("new swarm (i %s p %s)",n.infoHashHex,n.peerIdHex);n.handshakeOpts=r.handshake;n.maxConns=r.maxConns!==undefined?r.maxConns:d;n.destroyed=false;n.listening=false;n.paused=false;n.server=null;n.wires=[];n._queue=[];n._peers={};n._peersLength=0;n._port=0;n.downloaded=0;n.uploaded=0;n.downloadSpeed=c();n.uploadSpeed=c()}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 r in e._peers){var i=e._peers[r];if(i&&i.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 r=e&&e.id||e;if(t._peers[r])return;a("addPeer %s",r);var i;if(typeof e==="string"){i=u.createOutgoingTCPPeer(e,t);t._queue.push(i);t._drain()}else{i=u.createWebRTCPeer(e,t)}t._peers[i.id]=i;t._peersLength+=1};m.prototype.addWebSeed=function(e,t){var r=this;if(r.destroyed)return;if(!/^https?:\/\/.+/.test(e)){a("ignoring invalid web seed %s (from swarm.addWebSeed)",e);return}if(r._peers[e])return;a("addWebSeed %s",e);r._peers[e]=u.createWebPeer(e,t,r);r._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 r=t._peers[e];if(!r)return;a("removePeer %s",e);t._peers[e]=null;t._peersLength-=1;r.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,i){var n=this;if(typeof t==="function"){i=t;t=undefined}if(i)i=s(i);if(n.listening)throw new Error("swarm already listening");if(r.browser){i()}else{n._port=e||p.getDefaultListenPort(n.infoHashHex);n._hostname=t;if(i)n.once("listening",i);a("listen %s",e);var o=p.addSwarm(n);n.server=o.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 r in t._peers){t.removePeer(r)}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 l.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 r=n(t.addr);var i=r[0];var s=r[1];var o=t.conn=l.connect({host:i,port:s,localAddress:e._hostname});o.once("connect",function(){t.onConnect()});o.once("error",function(e){t.destroy(e)});t.setConnectTimeout();o.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 r(){var r=u.createOutgoingTCPPeer(t.addr,e);r.retries=t.retries+1;e._queue.push(r);e._drain()}var i=h[t.retries];a("conn %s closed: will re-add to queue in %sms (attempt %s)",t.addr,i,t.retries+1);var n=setTimeout(r,i);if(n.unref)n.unref()})};m.prototype._onError=function(e){var t=this;t.emit("error",e);t.destroy()};m.prototype._validAddr=function(e){var t=this;var r=n(e);var i=r[0];var a=r[1];return a>0&&a<65535&&!(i==="127.0.0.1"&&a===t._port)}}).call(this,e("_process"),e("buffer").Buffer)},{"./lib/peer":12,"./lib/tcp-pool":13,_process:78,"addr-to-ip-port":52,buffer:66,debug:28,dezalgo:31,events:70,inherits:34,net:52,speedometer:38}],12:[function(e,t,r){var i=e("debug")("bittorrent-swarm:peer");var n=e("./webconn");var a=e("bittorrent-protocol");var s=25e3;var o=25e3;r.createWebRTCPeer=function(e,t){var r=new f(e.id);r.conn=e;r.swarm=t;if(r.conn.connected){r.onConnect()}else{r.conn.once("connect",function(){r.onConnect()});r.conn.once("error",function(e){r.destroy(e)});r.setConnectTimeout()}return r};r.createIncomingTCPPeer=function(e){var t=e.remoteAddress+":"+e.remotePort;var r=new f(t);r.conn=e;r.addr=t;r.onConnect();return r};r.createOutgoingTCPPeer=function(e,t){var r=new f(e);r.addr=e;r.swarm=t;return r};r.createWebPeer=function(e,t,r){var i=new f(e);i.swarm=r;i.conn=new n(e,t);i.onConnect();return i};function f(e){var t=this;t.id=e;i("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}f.prototype.onConnect=function(){var e=this;if(e.destroyed)return;i("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 r=e.wire=new a;r.once("end",function(){e.destroy()});r.once("finish",function(){e.destroy()});r.once("error",function(t){e.destroy(t)});r.once("handshake",function(t,r){e.onHandshake(t,r)});e.setHandshakeTimeout();t.pipe(r).pipe(t);if(e.swarm)e.handshake()};f.prototype.onHandshake=function(e,t){var r=this;if(!r.swarm)return;var n=e.toString("hex");var a=t.toString("hex");if(r.swarm.destroyed)return r.destroy(new Error("swarm already destroyed"));if(n!==r.swarm.infoHashHex){return r.destroy(new Error("unexpected handshake info hash for this swarm"))}if(a===r.swarm.peerIdHex){return r.destroy(new Error("refusing to handshake with self"))}i("Peer %s got handshake %s",r.id,n);clearTimeout(r.handshakeTimeout);r.retries=0;r.wire.on("download",function(e){if(r.destroyed)return;r.swarm.downloaded+=e;r.swarm.downloadSpeed(e);r.swarm.emit("download",e)});r.wire.on("upload",function(e){if(r.destroyed)return;r.swarm.uploaded+=e;r.swarm.uploadSpeed(e);r.swarm.emit("upload",e)});if(!r.sentHandshake)r.handshake();r.swarm.wires.push(r.wire);var s=r.addr;if(!s&&r.conn.remoteAddress){s=r.conn.remoteAddress+":"+r.conn.remotePort}r.swarm.emit("wire",r.wire,s)};f.prototype.handshake=function(){var e=this;e.wire.handshake(e.swarm.infoHash,e.swarm.peerId,e.swarm.handshakeOpts);e.sentHandshake=true};f.prototype.setConnectTimeout=function(){var e=this;clearTimeout(e.connectTimeout);e.connectTimeout=setTimeout(function(){e.destroy(new Error("connect timeout"))},s);if(e.connectTimeout.unref)e.connectTimeout.unref()};f.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()};f.prototype.destroy=function(e){var t=this;if(t.destroyed)return;t.destroyed=true;i("destroy Peer %s (error: %s)",t.id,e&&(e.message||e));if(t.swarm)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}},{"./webconn":14,"bittorrent-protocol":16,debug:28}],13:[function(e,t,r){(function(r){t.exports=f;var i=e("debug")("bittorrent-swarm:tcp-pool");var n=e("dezalgo");var a=e("net");var s=e("./peer");var o={};function f(e,t){var r=this;r.port=e;r.listening=false;r.swarms={};i("new TCPPool (port: %s, hostname: %s)",e,t);r.pendingConns=[];r.server=a.createServer();r.server.on("connection",function(e){r._onConnection(e)});r.server.on("error",function(e){r._onError(e)});r.server.on("listening",function(){r._onListening()});r.server.listen(r.port,t)}f.addSwarm=function(e){var t=o[e._port];if(!t)t=o[e._port]=new f(e._port,e._hostname);t.addSwarm(e);return t};f.removeSwarm=function(e,t){var i=o[e._port];if(!i)return t();i.removeSwarm(e);var n=0;for(var a in i.swarms){var s=i.swarms[a];if(s)n+=1}if(n===0)i.destroy(t);else r.nextTick(t)};f.getDefaultListenPort=function(e){for(var t in o){var r=o[t];if(r&&!r.swarms[e])return r.port}return 0};f.prototype.addSwarm=function(e){var t=this;if(t.swarms[e.infoHashHex]){r.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){r.nextTick(function(){e._onListening(t.port)})}i("add swarm %s to tcp pool %s",e.infoHashHex,t.port)};f.prototype.removeSwarm=function(e){var t=this;i("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=n(e);i("destroy tcp pool %s",t.port);t.listening=false;t.pendingConns.forEach(function(e){e.destroy()});o[t.port]=null;try{t.server.close(e)}catch(r){if(e)e(null)}};f.prototype._onListening=function(){var e=this;var t=e.server.address()||{port:0};var r=t.port;i("tcp pool listening on %s",r);if(r!==e.port){o[e.port]=null;e.port=r;o[e.port]=e}e.listening=true;for(var n in e.swarms){var a=e.swarms[n];if(a)a._onListening(e.port)}};f.prototype._onConnection=function(e){var t=this;t.pendingConns.push(e);e.once("close",r);function r(){t.pendingConns.splice(t.pendingConns.indexOf(e))}var i=s.createIncomingTCPPeer(e);i.wire.once("handshake",function(n,a){var s=n.toString("hex");r();e.removeListener("close",r);var o=t.swarms[s];if(o){i.swarm=o;o._addIncomingPeer(i);i.onHandshake(n,a)}else{var f=new Error("Unexpected info hash "+s+" from incoming peer "+i.id+": destroying peer");i.destroy(f)}})};f.prototype._onError=function(e){var t=this;t.destroy();for(var r in t.swarms){var i=t.swarms[r];if(i){t.removeSwarm(i);i._onError(e)}}}}).call(this,e("_process"))},{"./peer":12,_process:78,debug:28,dezalgo:31,net:52}],14:[function(e,t,r){(function(r){t.exports=f;var i=e("bitfield");var n=e("debug")("bittorrent-swarm:webconn");var a=e("simple-get");var s=e("inherits");var o=e("bittorrent-protocol");s(f,o);function f(e,t){var a=this;o.call(this);a.url=e;a.parsedTorrent=t;a.setKeepAlive(true);a.on("handshake",function(t,n){a.handshake(t,new r(20).fill(e));var s=a.parsedTorrent.pieces.length;var o=new i(s);for(var f=0;f<=s;f++){o.set(f,true)}a.bitfield(o)});a.on("choke",function(){n("choke")});a.on("unchoke",function(){n("unchoke")});a.once("interested",function(){n("interested");a.unchoke()});a.on("uninterested",function(){n("uninterested")});a.on("bitfield",function(){n("bitfield")});a.on("request",function(e,t,r,i){n("request pieceIndex=%d offset=%d length=%d",e,t,r);a.httpRequest(e,t,r,i)})}f.prototype.httpRequest=function(e,t,r,i){var s=this;var o=e*s.parsedTorrent.pieceLength;var f=o+t;var l=f+r-1;n("Requesting pieceIndex=%d offset=%d length=%d start=%d end=%d",e,t,r,f,l);var u={url:s.url,method:"GET",headers:{"user-agent":"WebTorrent (http://webtorrent.io)",range:"bytes="+f+"-"+l}};a.concat(u,function(e,t,r){if(e)return i(e);if(r.statusCode<200||r.statusCode>=300){return i(new Error("Unexpected HTTP status code "+r.statusCode))}n("Got data of length %d",t.length);i(null,t)})}}).call(this,e("buffer").Buffer)},{bitfield:15,"bittorrent-protocol":16,buffer:66,debug:28,inherits:34,"simple-get":35}],15:[function(e,t,r){arguments[4][10][0].apply(r,arguments)},{buffer:66,dup:10}],16:[function(e,t,r){(function(r){t.exports=b;var i=e("bitfield");var n=e("bencode");var a=e("debug")("bittorrent-protocol");var s=e("xtend");var o=e("inherits");var f=e("speedometer");var l=e("stream");var u=4e5;var c=new r("BitTorrent protocol");var p=new r([0,0,0,0]);var d=new r([0,0,0,1,0]);var h=new r([0,0,0,1,1]);var m=new r([0,0,0,1,2]);var v=new r([0,0,0,1,3]);var g=[0,0,0,0,0,0,0,0];var _=[0,0,0,3,9,0,0];function y(e,t,r,i){this.piece=e;this.offset=t;this.length=r;this.callback=i}o(b,l.Duplex);function b(){if(!(this instanceof b))return new b;l.Duplex.call(this);a("new wire");this.amChoking=true;this.amInterested=false;this.peerChoking=true;this.peerInterested=false;this.peerPieces=new i(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()}b.prototype.setKeepAlive=function(e){clearInterval(this._keepAlive);if(e===false)return;this._keepAlive=setInterval(this._push.bind(this,p),6e4)};b.prototype.setTimeout=function(e,t){this._clearTimeout();this._timeoutMs=e;this._timeoutUnref=!!t;this._updateTimeout()};b.prototype.destroy=function(){if(this.destroyed)return;this.destroyed=true;a("destroy");this.end()};b.prototype.end=function(){this._onUninterested();this._onChoke();l.Duplex.prototype.end.apply(this,arguments)};b.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 r=this._nextExt;var i=new e(this);function n(){}if(typeof i.onHandshake!=="function"){i.onHandshake=n}if(typeof i.onExtendedHandshake!=="function"){i.onExtendedHandshake=n}if(typeof i.onMessage!=="function"){i.onMessage=n}this.extendedMapping[r]=t;this._ext[t]=i;this[t]=i;this._nextExt+=1};b.prototype.handshake=function(e,t,i){if(typeof e==="string")e=new r(e,"hex");if(typeof t==="string")t=new r(t,"hex");if(e.length!==20||t.length!==20){throw new Error("infoHash and peerId MUST have length 20")}var n=new r(g);n[5]|=16;if(i&&i.dht)n[7]|=1;this._push(r.concat([c,n,e,t]));this._handshakeSent=true;if(this.peerExtensions.extended){this._sendExtendedHandshake()}};b.prototype._sendExtendedHandshake=function(){var e=s(this.extendedHandshake);e.m={};for(var t in this.extendedMapping){var r=this.extendedMapping[t];e.m[r]=Number(t)}this.extended(0,n.encode(e))};b.prototype.choke=function(){if(this.amChoking)return;this.amChoking=true;this.peerRequests.splice(0,this.peerRequests.length);this._push(d)};b.prototype.unchoke=function(){if(!this.amChoking)return;this.amChoking=false;this._push(h)};b.prototype.interested=function(){if(this.amInterested)return;this.amInterested=true;this._push(m)};b.prototype.uninterested=function(){if(!this.amInterested)return;this.amInterested=false;this._push(v)};b.prototype.have=function(e){this._message(4,[e],null)};b.prototype.bitfield=function(e){if(!r.isBuffer(e))e=e.buffer;this._message(5,[],e)};b.prototype.request=function(e,t,r,i){if(!i)i=function(){};if(this._finished)return i(new Error("wire is closed"));if(this.peerChoking)return i(new Error("peer is choking"));this.requests.push(new y(e,t,r,i));this._updateTimeout();this._message(6,[e,t,r],null)};b.prototype.piece=function(e,t,r){this.uploaded+=r.length;this.uploadSpeed(r.length);this.emit("upload",r.length);this._message(7,[e,t],r)};b.prototype.cancel=function(e,t,r){this._callback(w(this.requests,e,t,r),new Error("request was cancelled"),null);this._message(8,[e,t,r],null)};b.prototype.port=function(e){var t=new r(_);t.writeUInt16BE(e,5);this._push(t)};b.prototype.extended=function(e,t){if(typeof e==="string"&&this.peerExtendedMapping[e]){e=this.peerExtendedMapping[e]}if(typeof e==="number"){var i=new r([e]);var a=r.isBuffer(t)?t:n.encode(t);this._message(20,[],r.concat([i,a]))}else{throw new Error("Unrecognized extension: "+e)}};b.prototype._onKeepAlive=function(){this.emit("keep-alive")};b.prototype._onHandshake=function(e,t,r){this.peerId=t;this.peerExtensions=r;this.emit("handshake",e,t,r);var i;for(i in this._ext){this._ext[i].onHandshake(e,t,r)}if(r.extended&&this._handshakeSent){this._sendExtendedHandshake()}};b.prototype._onChoke=function(){this.peerChoking=true;this.emit("choke");while(this.requests.length){this._callback(this.requests.shift(),new Error("peer is choking"),null)}};b.prototype._onUnchoke=function(){this.peerChoking=false;this.emit("unchoke")};b.prototype._onInterested=function(){this.peerInterested=true;this.emit("interested")};b.prototype._onUninterested=function(){this.peerInterested=false;this.emit("uninterested")};b.prototype._onHave=function(e){if(this.peerPieces.get(e))return;this.peerPieces.set(e,true);this.emit("have",e)};b.prototype._onBitField=function(e){this.peerPieces=new i(e);this.emit("bitfield",this.peerPieces)};b.prototype._onRequest=function(e,t,r){if(this.amChoking)return;var i=function(i,a){if(n!==w(this.peerRequests,e,t,r))return;if(i)return;this.piece(e,t,a)}.bind(this);var n=new y(e,t,r,i);this.peerRequests.push(n);this.emit("request",e,t,r,i)};b.prototype._onPiece=function(e,t,r){this._callback(w(this.requests,e,t,r.length),null,r);this.downloaded+=r.length;this.downloadSpeed(r.length);this.emit("download",r.length);this.emit("piece",e,t,r)};b.prototype._onCancel=function(e,t,r){w(this.peerRequests,e,t,r);this.emit("cancel",e,t,r)};b.prototype._onPort=function(e){this.emit("port",e)};b.prototype._onExtended=function(e,t){var r,i;if(e===0&&(r=x(t))){this.peerExtendedHandshake=r;if(typeof r.m==="object"){for(i in r.m){this.peerExtendedMapping[i]=Number(r.m[i].toString())}}for(i in this._ext){if(this.peerExtendedMapping[i]){this._ext[i].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)}};b.prototype._onTimeout=function(){this._callback(this.requests.shift(),new Error("request has timed out"),null);this.emit("timeout")};b.prototype._push=function(e){if(this._finished)return;return this.push(e)};b.prototype._write=function(e,t,i){this._bufferSize+=e.length;this._buffer.push(e);while(this._bufferSize>=this._parserSize){var n=this._buffer.length===1?this._buffer[0]:r.concat(this._buffer);this._bufferSize-=this._parserSize;this._buffer=this._bufferSize?[n.slice(this._parserSize)]:[];this._parser(n.slice(0,this._parserSize))}i(null)};b.prototype._read=function(){};b.prototype._callback=function(e,t,r){if(!e)return;this._clearTimeout();if(!this.peerChoking&&!this._finished)this._updateTimeout();e.callback(t,r)};b.prototype._clearTimeout=function(){if(!this._timeout)return;clearTimeout(this._timeout);this._timeout=null};b.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()};b.prototype._parse=function(e,t){this._parserSize=e;this._parser=t};b.prototype._message=function(e,t,i){var n=i?i.length:0;var a=new r(5+4*t.length);a.writeUInt32BE(a.length+n-4,0);a[4]=e;for(var s=0;s<t.length;s++){a.writeUInt32BE(t[s],5+4*s)}this._push(a);if(i)this._push(i)};b.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)}};b.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)}};b.prototype._parseHandshake=function(){this._parse(1,function(e){var t=e.readUInt8(0);this._parse(t+48,function(e){var r=e.slice(0,t);if(r.toString()!=="BitTorrent protocol"){a("Error: wire not speaking BitTorrent protocol (%s)",r.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))};b.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 w(e,t,r,i){for(var n=0;n<e.length;n++){var a=e[n];if(a.piece!==t||a.offset!==r||a.length!==i)continue;if(n===0)e.shift();else e.splice(n,1);return a}return null}function x(e){try{return n.decode(e)}catch(t){console.warn(t)}}}).call(this,e("buffer").Buffer)},{bencode:17,bitfield:21,buffer:66,debug:22,inherits:25,speedometer:26,stream:94,xtend:27}],17:[function(e,t,r){t.exports={encode:e("./lib/encode"),decode:e("./lib/decode")}},{"./lib/decode":18,"./lib/encode":20}],18:[function(e,t,r){(function(r){var i=e("./dict");function n(e,t){n.position=0;n.encoding=t||null;n.data=!r.isBuffer(e)?new r(e):e;return n.next()}n.position=0;n.data=null;n.encoding=null;n.next=function(){switch(n.data[n.position]){case 100:return n.dictionary();break;case 108:return n.list();break;case 105:return n.integer();break;default:return n.bytes();break}};n.find=function(e){var t=n.position;var r=n.data.length;var i=n.data;while(t<r){if(i[t]===e)return t;t++}throw new Error('Invalid data: Missing delimiter "'+String.fromCharCode(e)+'" [0x'+e.toString(16)+"]")};n.dictionary=function(){n.position++;var e=new i;while(n.data[n.position]!==101){e.binarySet(n.bytes(),n.next())}n.position++;return e};n.list=function(){n.position++;var e=[];while(n.data[n.position]!==101){e.push(n.next())}n.position++;return e};n.integer=function(){var e=n.find(101);var t=n.data.toString("ascii",n.position+1,e);n.position+=e+1-n.position;return parseInt(t,10)};n.bytes=function(){var e=n.find(58);var t=parseInt(n.data.toString("ascii",n.position,e),10);var r=++e+t;n.position=r;return n.encoding?n.data.toString(n.encoding,e,r):n.data.slice(e,r)};t.exports=n}).call(this,e("buffer").Buffer)},{"./dict":19,buffer:66}],19:[function(e,t,r){var i=t.exports=function n(){Object.defineProperty(this,"_keys",{enumerable:false,value:[]})};i.prototype.binaryKeys=function a(){return this._keys.slice()};i.prototype.binarySet=function s(e,t){this._keys.push(e);this[e]=t}},{}],20:[function(e,t,r){(function(e){function r(t){var i=[];r._encode(i,t);return e.concat(i)}r._floatConversionDetected=false;r._encode=function(t,i){if(e.isBuffer(i)){t.push(new e(i.length+":"));t.push(i);return}switch(typeof i){case"string":r.bytes(t,i);break;case"number":r.number(t,i);break;case"object":i.constructor===Array?r.list(t,i):r.dict(t,i);break}};var i=new e("e"),n=new e("d"),a=new e("l");r.bytes=function(t,r){t.push(new e(e.byteLength(r)+":"+r))};r.number=function(t,i){var n=2147483648;var a=i/n<<0;var s=i%n<<0;var o=a*n+s;t.push(new e("i"+o+"e"));if(o!==i&&!r._floatConversionDetected){r._floatConversionDetected=true;console.warn('WARNING: Possible data corruption detected with value "'+i+'":','Bencoding only defines support for integers, value was converted to "'+o+'"');console.trace()}};r.dict=function(e,t){e.push(n);var a=0;var s;var o=Object.keys(t).sort();var f=o.length;for(;a<f;a++){s=o[a];r.bytes(e,s);r._encode(e,t[s])}e.push(i)};r.list=function(e,t){var n=0,s=1;var o=t.length;e.push(a);for(;n<o;n++){r._encode(e,t[n])}e.push(i)};t.exports=r}).call(this,e("buffer").Buffer)},{buffer:66}],21:[function(e,t,r){arguments[4][10][0].apply(r,arguments)},{buffer:66,dup:10}],22:[function(e,t,r){r=t.exports=e("./debug");r.log=s;r.formatArgs=a;r.save=o;r.load=f;r.useColors=n;var i;if(typeof chrome!=="undefined"&&typeof chrome.storage!=="undefined")i=chrome.storage.local;else i=l();r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"];function n(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}r.formatters.j=function(e){return JSON.stringify(e)};function a(){var e=arguments;var t=this.useColors;e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+r.humanize(this.diff);if(!t)return e;var i="color: "+this.color;e=[e[0],i,"color: inherit"].concat(Array.prototype.slice.call(e,1));var n=0;var a=0;e[0].replace(/%[a-z%]/g,function(e){if("%%"===e)return;n++;if("%c"===e){a=n}});e.splice(a,0,i);return e}function s(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function o(e){try{if(null==e){i.removeItem("debug")}else{i.debug=e}}catch(t){}}function f(){var e;try{e=i.debug}catch(t){}return e}r.enable(f());function l(){try{return window.localStorage}catch(e){}}},{"./debug":23}],23:[function(e,t,r){r=t.exports=s;r.coerce=u;r.disable=f;r.enable=o;r.enabled=l;r.humanize=e("ms");r.names=[];r.skips=[];r.formatters={};var i=0;var n;function a(){return r.colors[i++%r.colors.length]}function s(e){function t(){}t.enabled=false;function i(){var e=i;var t=+new Date;var s=t-(n||t);e.diff=s;e.prev=n;e.curr=t;n=t;if(null==e.useColors)e.useColors=r.useColors();if(null==e.color&&e.useColors)e.color=a();var o=Array.prototype.slice.call(arguments);o[0]=r.coerce(o[0]);if("string"!==typeof o[0]){o=["%o"].concat(o)}var f=0;o[0]=o[0].replace(/%([a-z%])/g,function(t,i){if(t==="%%")return t;f++;var n=r.formatters[i];if("function"===typeof n){var a=o[f];t=n.call(e,a);o.splice(f,1);f--}return t});if("function"===typeof r.formatArgs){o=r.formatArgs.apply(e,o)}var l=i.log||r.log||console.log.bind(console);l.apply(e,o)}i.enabled=true;var s=r.enabled(e)?i:t;s.namespace=e;return s}function o(e){r.save(e);var t=(e||"").split(/[\s,]+/);var i=t.length;for(var n=0;n<i;n++){if(!t[n])continue;e=t[n].replace(/\*/g,".*?");if(e[0]==="-"){r.skips.push(new RegExp("^"+e.substr(1)+"$"))}else{r.names.push(new RegExp("^"+e+"$"))}}}function f(){r.enable("")}function l(e){var t,i;for(t=0,i=r.skips.length;t<i;t++){if(r.skips[t].test(e)){return false}}for(t=0,i=r.names.length;t<i;t++){if(r.names[t].test(e)){return true}}return false}function u(e){if(e instanceof Error)return e.stack||e.message;return e}},{ms:24}],24:[function(e,t,r){var i=1e3;var n=i*60;var a=n*60;var s=a*24;var o=s*365.25;t.exports=function(e,t){t=t||{};if("string"==typeof e)return f(e);return t.long?u(e):l(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 r=parseFloat(t[1]);var f=(t[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return r*o;case"days":case"day":case"d":return r*s;case"hours":case"hour":case"hrs":case"hr":case"h":return r*a;case"minutes":case"minute":case"mins":case"min":case"m":return r*n;case"seconds":case"second":case"secs":case"sec":case"s":return r*i;case"milliseconds":case"millisecond":case"msecs":case"msec":
-case"ms":return r}}function l(e){if(e>=s)return Math.round(e/s)+"d";if(e>=a)return Math.round(e/a)+"h";if(e>=n)return Math.round(e/n)+"m";if(e>=i)return Math.round(e/i)+"s";return e+"ms"}function u(e){return c(e,s,"day")||c(e,a,"hour")||c(e,n,"minute")||c(e,i,"second")||e+" ms"}function c(e,t,r){if(e<t)return;if(e<t*1.5)return Math.floor(e/t)+" "+r;return Math.ceil(e/t)+" "+r+"s"}},{}],25:[function(e,t,r){if(typeof Object.create==="function"){t.exports=function i(e,t){e.super_=t;e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}})}}else{t.exports=function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype;e.prototype=new r;e.prototype.constructor=e}}},{}],26:[function(e,t,r){var i=1;var n=65535;var a=4;var s=function(){i=i+1&n};var o=setInterval(s,1e3/a|0);if(o.unref)o.unref();t.exports=function(e){var t=a*(e||5);var r=[0];var s=1;var o=i-1&n;return function(e){var f=i-o&n;if(f>t)f=t;o=i;while(f--){if(s===t)s=0;r[s]=r[s===0?t-1:s-1];s++}if(e)r[s-1]+=e;var l=r[s-1];var u=r.length<t?0:r[s===t?0:s];return r.length<a?l:(l-u)*a/r.length}}},{}],27:[function(e,t,r){t.exports=i;function i(){var e={};for(var t=0;t<arguments.length;t++){var r=arguments[t];for(var i in r){if(r.hasOwnProperty(i)){e[i]=r[i]}}}return e}},{}],28:[function(e,t,r){arguments[4][22][0].apply(r,arguments)},{"./debug":29,dup:22}],29:[function(e,t,r){arguments[4][23][0].apply(r,arguments)},{dup:23,ms:30}],30:[function(e,t,r){arguments[4][24][0].apply(r,arguments)},{dup:24}],31:[function(e,t,r){var i=e("wrappy");t.exports=i(a);var n=e("asap");function a(e){var t=true;n(function(){t=false});return function r(){var r=arguments;var i=this;if(t)n(function(){e.apply(i,r)});else e.apply(i,r)}}},{asap:32,wrappy:33}],32:[function(e,t,r){(function(e){var r={task:void 0,next:null};var i=r;var n=false;var a=void 0;var s=false;function o(){while(r.next){r=r.next;var e=r.task;r.task=void 0;var t=r.domain;if(t){r.domain=void 0;t.enter()}try{e()}catch(i){if(s){if(t){t.exit()}setTimeout(o,0);if(t){t.enter()}throw i}else{setTimeout(function(){throw i},0)}}if(t){t.exit()}}n=false}if(typeof e!=="undefined"&&e.nextTick){s=true;a=function(){e.nextTick(o)}}else if(typeof setImmediate==="function"){if(typeof window!=="undefined"){a=setImmediate.bind(window,o)}else{a=function(){setImmediate(o)}}}else if(typeof MessageChannel!=="undefined"){var f=new MessageChannel;f.port1.onmessage=o;a=function(){f.port2.postMessage(0)}}else{a=function(){setTimeout(o,0)}}function l(t){i=i.next={task:t,domain:s&&e.domain,next:null};if(!n){n=true;a()}}t.exports=l}).call(this,e("_process"))},{_process:78}],33:[function(e,t,r){t.exports=i;function i(e,t){if(e&&t)return i(e)(t);if(typeof e!=="function")throw new TypeError("need wrapper function");Object.keys(e).forEach(function(t){r[t]=e[t]});return r;function r(){var t=new Array(arguments.length);for(var r=0;r<t.length;r++){t[r]=arguments[r]}var i=e.apply(this,t);var n=t[t.length-1];if(typeof i==="function"&&i!==n){Object.keys(n).forEach(function(e){i[e]=n[e]})}return i}}},{}],34:[function(e,t,r){arguments[4][25][0].apply(r,arguments)},{dup:25}],35:[function(e,t,r){(function(r){t.exports=f;var i=e("http");var n=e("https");var a=e("once");var s=e("url");var o=e("zlib");function f(e,t){if(typeof e==="string")e={url:e};t=a(t);if(e.maxRedirects===0){t(new Error("too many redirects"));return}if(!e.maxRedirects)e.maxRedirects=10;if(e.url)l(e);if(!e.headers)e.headers={};var r=e.body;e.body=undefined;if(r&&!e.method)e.method="POST";var s=Object.keys(e.headers).some(function(e){return e.toLowerCase()==="accept-encoding"});if(!s)e.headers["accept-encoding"]="gzip, deflate";var u=e.protocol==="https:"?n:i;var c=u.request(e,function(r){if(r.statusCode>=300&&r.statusCode<400&&"location"in r.headers){e.url=r.headers.location;l(e);r.resume();e.maxRedirects-=1;return f(e,t)}if(["gzip","deflate"].indexOf(r.headers["content-encoding"])!==-1){var i=o.createUnzip();r.pipe(i);r.on("close",function(){i.emit("close")});i.httpVersion=r.httpVersion;i.headers=r.headers;i.trailers=r.trailers;i.setTimeout=r.setTimeout.bind(r);i.method=r.method;i.url=r.url;i.statusCode=r.statusCode;i.socket=r.socket;t(null,i)}else{t(null,r)}});c.on("error",t);c.end(r);return c}t.exports.concat=function(e,t){return f(e,function(e,i){if(e)return t(e);var n=[];i.on("data",function(e){n.push(e)});i.on("end",function(){t(null,r.concat(n),i)})})};["get","post","put","patch","head","delete"].forEach(function(e){t.exports[e]=function(t,r){if(typeof t==="string")t={url:t};t.method=e.toUpperCase();return f(t,r)}});function l(e){var t=s.parse(e.url);if(t.hostname)e.hostname=t.hostname;if(t.port)e.port=t.port;if(t.protocol)e.protocol=t.protocol;e.path=t.path;delete e.url}}).call(this,e("buffer").Buffer)},{buffer:66,http:71,https:75,once:37,url:96,zlib:65}],36:[function(e,t,r){arguments[4][33][0].apply(r,arguments)},{dup:33}],37:[function(e,t,r){var i=e("wrappy");t.exports=i(n);n.proto=n(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return n(this)},configurable:true})});function n(e){var t=function(){if(t.called)return t.value;t.called=true;return t.value=e.apply(this,arguments)};t.called=false;return t}},{wrappy:36}],38:[function(e,t,r){arguments[4][26][0].apply(r,arguments)},{dup:26}],39:[function(e,t,r){(function(r){var i=e("inherits");var n=e("readable-stream").Transform;var a=e("defined");t.exports=s;i(s,n);function s(e,t){if(!(this instanceof s))return new s(e,t);n.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}s.prototype._transform=function(e,t,i){this._bufferedBytes+=e.length;this._buffered.push(e);while(this._bufferedBytes>=this.size){var n=r.concat(this._buffered);this._bufferedBytes-=this.size;this.push(n.slice(0,this.size));this._buffered=[n.slice(this.size,n.length)]}i()};s.prototype._flush=function(){if(this._bufferedBytes&&this._zeroPadding){var e=new r(this.size-this._bufferedBytes);e.fill(0);this._buffered.push(e);this.push(r.concat(this._buffered));this._buffered=null}else if(this._bufferedBytes){this.push(r.concat(this._buffered));this._buffered=null}this.push(null)}}).call(this,e("buffer").Buffer)},{buffer:66,defined:40,inherits:147,"readable-stream":49}],40:[function(e,t,r){t.exports=function(){for(var e=0;e<arguments.length;e++){if(arguments[e]!==undefined)return arguments[e]}}},{}],41:[function(e,t,r){(function(r){t.exports=o;var i=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};var n=e("core-util-is");n.inherits=e("inherits");var a=e("./_stream_readable");var s=e("./_stream_writable");n.inherits(o,a);l(i(s.prototype),function(e){if(!o.prototype[e])o.prototype[e]=s.prototype[e]});function o(e){if(!(this instanceof o))return new o(e);a.call(this,e);s.call(this,e);if(e&&e.readable===false)this.readable=false;if(e&&e.writable===false)this.writable=false;this.allowHalfOpen=true;if(e&&e.allowHalfOpen===false)this.allowHalfOpen=false;this.once("end",f)}function f(){if(this.allowHalfOpen||this._writableState.ended)return;r.nextTick(this.end.bind(this))}function l(e,t){for(var r=0,i=e.length;r<i;r++){t(e[r],r)}}}).call(this,e("_process"))},{"./_stream_readable":43,"./_stream_writable":45,_process:78,"core-util-is":46,inherits:147}],42:[function(e,t,r){t.exports=a;var i=e("./_stream_transform");var n=e("core-util-is");n.inherits=e("inherits");n.inherits(a,i);function a(e){if(!(this instanceof a))return new a(e);i.call(this,e)}a.prototype._transform=function(e,t,r){r(null,e)}},{"./_stream_transform":44,"core-util-is":46,inherits:147}],43:[function(e,t,r){(function(r){t.exports=c;var i=e("isarray");var n=e("buffer").Buffer;c.ReadableState=u;var a=e("events").EventEmitter;if(!a.listenerCount)a.listenerCount=function(e,t){return e.listeners(t).length};var s=e("stream");var o=e("core-util-is");o.inherits=e("inherits");var f;var l=e("util");if(l&&l.debuglog){l=l.debuglog("stream")}else{l=function(){}}o.inherits(c,s);function u(t,r){var i=e("./_stream_duplex");t=t||{};var n=t.highWaterMark;var a=t.objectMode?16:16*1024;this.highWaterMark=n||n===0?n: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(r instanceof i)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 c(t){var r=e("./_stream_duplex");if(!(this instanceof c))return new c(t);this._readableState=new u(t,this);this.readable=true;s.call(this)}c.prototype.push=function(e,t){var r=this._readableState;if(o.isString(e)&&!r.objectMode){t=t||r.defaultEncoding;if(t!==r.encoding){e=new n(e,t);t=""}}return p(this,r,e,t,false)};c.prototype.unshift=function(e){var t=this._readableState;return p(this,t,e,"",true)};function p(e,t,r,i,n){var a=g(t,r);if(a){e.emit("error",a)}else if(o.isNullOrUndefined(r)){t.reading=false;if(!t.ended)_(e,t)}else if(t.objectMode||r&&r.length>0){if(t.ended&&!n){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&n){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{if(t.decoder&&!n&&!i)r=t.decoder.write(r);if(!n)t.reading=false;if(t.flowing&&t.length===0&&!t.sync){e.emit("data",r);e.read(0)}else{t.length+=t.objectMode?1:r.length;if(n)t.buffer.unshift(r);else t.buffer.push(r);if(t.needReadable)y(e)}w(e,t)}}else if(!n){t.reading=false}return d(t)}function d(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||e.length===0)}c.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)||o.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}c.prototype.read=function(e){l("read",e);var t=this._readableState;var r=e;if(!o.isNumber(e)||e>0)t.emittedReadable=false;if(e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended)){l("read: emitReadable",t.length,t.ended);if(t.length===0&&t.ended)I(this);else y(this);return null}e=v(e,t);if(e===0&&t.ended){if(t.length===0)I(this);return null}var i=t.needReadable;l("need readable",i);if(t.length===0||t.length-e<t.highWaterMark){i=true;l("length less than watermark",i)}if(t.ended||t.reading){i=false;l("reading or ended",i)}if(i){l("do read");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=v(r,t);var n;if(e>0)n=T(e,t);else n=null;if(o.isNull(n)){t.needReadable=true;e=0}t.length-=e;if(t.length===0&&!t.ended)t.needReadable=true;if(r!==e&&t.ended&&t.length===0)I(this);if(!o.isNull(n))this.emit("data",n);return n};function g(e,t){var r=null;if(!o.isBuffer(t)&&!o.isString(t)&&!o.isNullOrUndefined(t)&&!e.objectMode){r=new TypeError("Invalid non-string/buffer chunk")}return r}function _(e,t){if(t.decoder&&!t.ended){var r=t.decoder.end();if(r&&r.length){t.buffer.push(r);t.length+=t.objectMode?1:r.length}}t.ended=true;y(e)}function y(e){var t=e._readableState;t.needReadable=false;if(!t.emittedReadable){l("emitReadable",t.flowing);t.emittedReadable=true;if(t.sync)r.nextTick(function(){b(e)});else b(e)}}function b(e){l("emit readable");e.emit("readable");A(e)}function w(e,t){if(!t.readingMore){t.readingMore=true;r.nextTick(function(){x(e,t)})}}function x(e,t){var r=t.length;while(!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark){l("maybeReadMore read 0");e.read(0);if(r===t.length)break;else r=t.length}t.readingMore=false}c.prototype._read=function(e){this.emit("error",new Error("not implemented"))};c.prototype.pipe=function(e,t){var n=this;var s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e);break}s.pipesCount+=1;l("pipe count=%d opts=%j",s.pipesCount,t);var o=(!t||t.end!==false)&&e!==r.stdout&&e!==r.stderr;var f=o?c:d;if(s.endEmitted)r.nextTick(f);else n.once("end",f);e.on("unpipe",u);function u(e){l("onunpipe");if(e===n){d()}}function c(){l("onend");e.end()}var p=k(n);e.on("drain",p);function d(){l("cleanup");e.removeListener("close",v);e.removeListener("finish",g);e.removeListener("drain",p);e.removeListener("error",m);e.removeListener("unpipe",u);n.removeListener("end",c);n.removeListener("end",d);n.removeListener("data",h);if(s.awaitDrain&&(!e._writableState||e._writableState.needDrain))p()}n.on("data",h);function h(t){l("ondata");var r=e.write(t);if(false===r){l("false write response, pause",n._readableState.awaitDrain);n._readableState.awaitDrain++;n.pause()}}function m(t){l("onerror",t);_();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(i(e._events.error))e._events.error.unshift(m);else e._events.error=[m,e._events.error];function v(){e.removeListener("finish",g);_()}e.once("close",v);function g(){l("onfinish");e.removeListener("close",v);_()}e.once("finish",g);function _(){l("unpipe");n.unpipe(e)}e.emit("pipe",n);if(!s.flowing){l("pipe resume");n.resume()}return e};function k(e){return function(){var t=e._readableState;l("pipeOnDrain",t.awaitDrain);if(t.awaitDrain)t.awaitDrain--;if(t.awaitDrain===0&&a.listenerCount(e,"data")){t.flowing=true;A(e)}}}c.prototype.unpipe=function(e){var t=this._readableState;if(t.pipesCount===0)return this;if(t.pipesCount===1){if(e&&e!==t.pipes)return this;if(!e)e=t.pipes;t.pipes=null;t.pipesCount=0;t.flowing=false;if(e)e.emit("unpipe",this);return this}if(!e){var r=t.pipes;var i=t.pipesCount;t.pipes=null;t.pipesCount=0;t.flowing=false;for(var n=0;n<i;n++)r[n].emit("unpipe",this);return this}var n=L(t.pipes,e);if(n===-1)return this;t.pipes.splice(n,1);t.pipesCount-=1;if(t.pipesCount===1)t.pipes=t.pipes[0];e.emit("unpipe",this);return this};c.prototype.on=function(e,t){var i=s.prototype.on.call(this,e,t);if(e==="data"&&false!==this._readableState.flowing){this.resume()}if(e==="readable"&&this.readable){var n=this._readableState;if(!n.readableListening){n.readableListening=true;n.emittedReadable=false;n.needReadable=true;if(!n.reading){var a=this;r.nextTick(function(){l("readable nexttick read 0");a.read(0)})}else if(n.length){y(this,n)}}}return i};c.prototype.addListener=c.prototype.on;c.prototype.resume=function(){var e=this._readableState;if(!e.flowing){l("resume");e.flowing=true;if(!e.reading){l("resume read 0");this.read(0)}S(this,e)}return this};function S(e,t){if(!t.resumeScheduled){t.resumeScheduled=true;r.nextTick(function(){E(e,t)})}}function E(e,t){t.resumeScheduled=false;e.emit("resume");A(e);if(t.flowing&&!t.reading)e.read(0)}c.prototype.pause=function(){l("call pause flowing=%j",this._readableState.flowing);if(false!==this._readableState.flowing){l("pause");this._readableState.flowing=false;this.emit("pause")}return this};function A(e){var t=e._readableState;l("flow",t.flowing);if(t.flowing){do{var r=e.read()}while(null!==r&&t.flowing)}}c.prototype.wrap=function(e){var t=this._readableState;var r=false;var i=this;e.on("end",function(){l("wrapped end");if(t.decoder&&!t.ended){var e=t.decoder.end();if(e&&e.length)i.push(e)}i.push(null)});e.on("data",function(n){l("wrapped data");if(t.decoder)n=t.decoder.write(n);if(!n||!t.objectMode&&!n.length)return;var a=i.push(n);if(!a){r=true;e.pause()}});for(var n in e){if(o.isFunction(e[n])&&o.isUndefined(this[n])){this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n)}}var a=["error","close","destroy","pause","resume"];U(a,function(t){e.on(t,i.emit.bind(i,t))});i._read=function(t){l("wrapped _read",t);if(r){r=false;e.resume()}};return i};c._fromList=T;function T(e,t){var r=t.buffer;var i=t.length;var a=!!t.decoder;var s=!!t.objectMode;var o;if(r.length===0)return null;if(i===0)o=null;else if(s)o=r.shift();else if(!e||e>=i){if(a)o=r.join("");else o=n.concat(r,i);r.length=0}else{if(e<r[0].length){var f=r[0];o=f.slice(0,e);r[0]=f.slice(e)}else if(e===r[0].length){o=r.shift()}else{if(a)o="";else o=new n(e);var l=0;for(var u=0,c=r.length;u<c&&l<e;u++){var f=r[0];var p=Math.min(e-l,f.length);if(a)o+=f.slice(0,p);else f.copy(o,l,0,p);if(p<f.length)r[0]=f.slice(p);else r.shift();l+=p}}}return o}function I(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");if(!t.endEmitted){t.ended=true;r.nextTick(function(){if(!t.endEmitted&&t.length===0){t.endEmitted=true;e.readable=false;e.emit("end")}})}}function U(e,t){for(var r=0,i=e.length;r<i;r++){t(e[r],r)}}function L(e,t){for(var r=0,i=e.length;r<i;r++){if(e[r]===t)return r}return-1}}).call(this,e("_process"))},{"./_stream_duplex":41,_process:78,buffer:66,"core-util-is":46,events:70,inherits:147,isarray:47,stream:94,"string_decoder/":48,util:52}],44:[function(e,t,r){t.exports=o;var i=e("./_stream_duplex");var n=e("core-util-is");n.inherits=e("inherits");n.inherits(o,i);function a(e,t){this.afterTransform=function(e,r){return s(t,e,r)};this.needTransform=false;this.transforming=false;this.writecb=null;this.writechunk=null}function s(e,t,r){var i=e._transformState;i.transforming=false;var a=i.writecb;if(!a)return e.emit("error",new Error("no writecb in Transform class"));i.writechunk=null;i.writecb=null;if(!n.isNullOrUndefined(r))e.push(r);if(a)a(t);var s=e._readableState;s.reading=false;if(s.needReadable||s.length<s.highWaterMark){e._read(s.highWaterMark)}}function o(e){if(!(this instanceof o))return new o(e);i.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(n.isFunction(this._flush))this._flush(function(e){f(t,e)});else f(t)})}o.prototype.push=function(e,t){this._transformState.needTransform=false;return i.prototype.push.call(this,e,t)};o.prototype._transform=function(e,t,r){throw new Error("not implemented")};o.prototype._write=function(e,t,r){var i=this._transformState;i.writecb=r;i.writechunk=e;i.writeencoding=t;if(!i.transforming){var n=this._readableState;if(i.needTransform||n.needReadable||n.length<n.highWaterMark)this._read(n.highWaterMark)}};o.prototype._read=function(e){var t=this._transformState;if(!n.isNull(t.writechunk)&&t.writecb&&!t.transforming){t.transforming=true;this._transform(t.writechunk,t.writeencoding,t.afterTransform)}else{t.needTransform=true}};function f(e,t){if(t)return e.emit("error",t);var r=e._writableState;var i=e._transformState;if(r.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":41,"core-util-is":46,inherits:147}],45:[function(e,t,r){(function(r){t.exports=f;var i=e("buffer").Buffer;f.WritableState=o;var n=e("core-util-is");n.inherits=e("inherits");var a=e("stream");n.inherits(f,a);function s(e,t,r){this.chunk=e;this.encoding=t;this.callback=r}function o(t,r){var i=e("./_stream_duplex");t=t||{};var n=t.highWaterMark;var a=t.objectMode?16:16*1024;this.highWaterMark=n||n===0?n:a;this.objectMode=!!t.objectMode;if(r instanceof i)this.objectMode=this.objectMode||!!t.writableObjectMode;this.highWaterMark=~~this.highWaterMark;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;var s=t.decodeStrings===false;this.decodeStrings=!s;this.defaultEncoding=t.defaultEncoding||"utf8";this.length=0;this.writing=false;this.corked=0;this.sync=true;this.bufferProcessing=false;this.onwrite=function(e){v(r,e)};this.writecb=null;this.writelen=0;this.buffer=[];this.pendingcb=0;this.prefinished=false;this.errorEmitted=false}function f(t){var r=e("./_stream_duplex");if(!(this instanceof f)&&!(this instanceof r))return new f(t);this._writableState=new o(t,this);this.writable=true;a.call(this)}f.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))};function l(e,t,i){var n=new Error("write after end");e.emit("error",n);r.nextTick(function(){i(n)})}function u(e,t,i,a){var s=true;if(!n.isBuffer(i)&&!n.isString(i)&&!n.isNullOrUndefined(i)&&!t.objectMode){var o=new TypeError("Invalid non-string/buffer chunk");e.emit("error",o);r.nextTick(function(){a(o)});s=false}return s}f.prototype.write=function(e,t,r){var i=this._writableState;var a=false;if(n.isFunction(t)){r=t;t=null}if(n.isBuffer(e))t="buffer";else if(!t)t=i.defaultEncoding;if(!n.isFunction(r))r=function(){};if(i.ended)l(this,i,r);else if(u(this,i,e,r)){i.pendingcb++;a=p(this,i,e,t,r)}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)y(this,e)}};function c(e,t,r){if(!e.objectMode&&e.decodeStrings!==false&&n.isString(t)){t=new i(t,r)}return t}function p(e,t,r,i,a){r=c(t,r,i);if(n.isBuffer(r))i="buffer";var o=t.objectMode?1:r.length;t.length+=o;var f=t.length<t.highWaterMark;if(!f)t.needDrain=true;if(t.writing||t.corked)t.buffer.push(new s(r,i,a));else d(e,t,false,o,r,i,a);return f}function d(e,t,r,i,n,a,s){t.writelen=i;t.writecb=s;t.writing=true;t.sync=true;if(r)e._writev(n,t.onwrite);else e._write(n,a,t.onwrite);t.sync=false}function h(e,t,i,n,a){if(i)r.nextTick(function(){t.pendingcb--;a(n)});else{t.pendingcb--;a(n)}e._writableState.errorEmitted=true;e.emit("error",n)}function m(e){e.writing=false;e.writecb=null;e.length-=e.writelen;e.writelen=0}function v(e,t){var i=e._writableState;var n=i.sync;var a=i.writecb;m(i);if(t)h(e,i,n,t,a);else{var s=b(e,i);if(!s&&!i.corked&&!i.bufferProcessing&&i.buffer.length){y(e,i)}if(n){r.nextTick(function(){g(e,i,s,a)})}else{g(e,i,s,a)}}}function g(e,t,r,i){if(!r)_(e,t);t.pendingcb--;i();x(e,t)}function _(e,t){if(t.length===0&&t.needDrain){t.needDrain=false;e.emit("drain")}}function y(e,t){t.bufferProcessing=true;if(e._writev&&t.buffer.length>1){var r=[];for(var i=0;i<t.buffer.length;i++)r.push(t.buffer[i].callback);t.pendingcb++;d(e,t,true,t.length,t.buffer,"",function(e){for(var i=0;i<r.length;i++){t.pendingcb--;r[i](e)}});t.buffer=[]}else{for(var i=0;i<t.buffer.length;i++){var n=t.buffer[i];var a=n.chunk;var s=n.encoding;var o=n.callback;var f=t.objectMode?1:a.length;d(e,t,false,f,a,s,o);if(t.writing){i++;break}}if(i<t.buffer.length)t.buffer=t.buffer.slice(i);else t.buffer.length=0}t.bufferProcessing=false}f.prototype._write=function(e,t,r){r(new Error("not implemented"))};f.prototype._writev=null;f.prototype.end=function(e,t,r){var i=this._writableState;if(n.isFunction(e)){r=e;e=null;t=null}else if(n.isFunction(t)){r=t;t=null}if(!n.isNullOrUndefined(e))this.write(e,t);if(i.corked){i.corked=1;this.uncork()}if(!i.ending&&!i.finished)k(this,i,r)};function b(e,t){return t.ending&&t.length===0&&!t.finished&&!t.writing}function w(e,t){if(!t.prefinished){t.prefinished=true;e.emit("prefinish")}}function x(e,t){var r=b(e,t);if(r){if(t.pendingcb===0){w(e,t);t.finished=true;e.emit("finish")}else w(e,t)}return r}function k(e,t,i){t.ending=true;x(e,t);if(i){if(t.finished)r.nextTick(i);else e.once("finish",i)}t.ended=true}}).call(this,e("_process"))},{"./_stream_duplex":41,_process:78,buffer:66,"core-util-is":46,inherits:147,stream:94}],46:[function(e,t,r){(function(e){function t(e){return Array.isArray(e)}r.isArray=t;function i(e){return typeof e==="boolean"}r.isBoolean=i;function n(e){return e===null}r.isNull=n;function a(e){return e==null}r.isNullOrUndefined=a;function s(e){return typeof e==="number"}r.isNumber=s;function o(e){return typeof e==="string"}r.isString=o;function f(e){return typeof e==="symbol"}r.isSymbol=f;function l(e){return e===void 0}r.isUndefined=l;function u(e){return c(e)&&g(e)==="[object RegExp]"}r.isRegExp=u;function c(e){return typeof e==="object"&&e!==null}r.isObject=c;function p(e){return c(e)&&g(e)==="[object Date]"}r.isDate=p;function d(e){return c(e)&&(g(e)==="[object Error]"||e instanceof Error)}r.isError=d;function h(e){return typeof e==="function"}r.isFunction=h;function m(e){return e===null||typeof e==="boolean"||typeof e==="number"||typeof e==="string"||typeof e==="symbol"||typeof e==="undefined"}r.isPrimitive=m;function v(t){return e.isBuffer(t)}r.isBuffer=v;function g(e){return Object.prototype.toString.call(e)}}).call(this,e("buffer").Buffer)},{buffer:66}],47:[function(e,t,r){t.exports=Array.isArray||function(e){return Object.prototype.toString.call(e)=="[object Array]"}},{}],48:[function(e,t,r){var i=e("buffer").Buffer;var n=i.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&&!n(e)){throw new Error("Unknown encoding: "+e)}}var s=r.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=l;break;default:this.write=o;return}this.charBuffer=new i(6);this.charReceived=0;this.charLength=0};s.prototype.write=function(e){var t="";while(this.charLength){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;e.copy(this.charBuffer,this.charReceived,0,r);this.charReceived+=r;if(this.charReceived<this.charLength){return""}e=e.slice(r,e.length);t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var i=t.charCodeAt(t.length-1);if(i>=55296&&i<=56319){this.charLength+=this.surrogateSize;t="";continue}this.charReceived=this.charLength=0;if(e.length===0){return t}break}this.detectIncompleteChar(e);var n=e.length;if(this.charLength){e.copy(this.charBuffer,0,e.length-this.charReceived,n);n-=this.charReceived}t+=e.toString(this.encoding,0,n);var n=t.length-1;var i=t.charCodeAt(n);if(i>=55296&&i<=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,n)}return t};s.prototype.detectIncompleteChar=function(e){var t=e.length>=3?3:e.length;for(;t>0;t--){var r=e[e.length-t];if(t==1&&r>>5==6){this.charLength=2;break}if(t<=2&&r>>4==14){this.charLength=3;break}if(t<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=t};s.prototype.end=function(e){var t="";if(e&&e.length)t=this.write(e);if(this.charReceived){var r=this.charReceived;var i=this.charBuffer;var n=this.encoding;t+=i.slice(0,r).toString(n)}return t};function o(e){return e.toString(this.encoding)}function f(e){this.charReceived=e.length%2;this.charLength=this.charReceived?2:0}function l(e){this.charReceived=e.length%3;this.charLength=this.charReceived?3:0}},{buffer:66}],49:[function(e,t,r){r=t.exports=e("./lib/_stream_readable.js");r.Stream=e("stream");r.Readable=r;r.Writable=e("./lib/_stream_writable.js");r.Duplex=e("./lib/_stream_duplex.js");r.Transform=e("./lib/_stream_transform.js");r.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":41,"./lib/_stream_passthrough.js":42,"./lib/_stream_readable.js":43,"./lib/_stream_transform.js":44,"./lib/_stream_writable.js":45,stream:94}],50:[function(e,t,r){},{}],51:[function(e,t,r){var i=e("util/");var n=Array.prototype.slice;var a=Object.prototype.hasOwnProperty;var s=t.exports=c;s.AssertionError=function _(e){this.name="AssertionError";this.actual=e.actual;this.expected=e.expected;this.operator=e.operator;if(e.message){this.message=e.message;this.generatedMessage=false}else{this.message=l(this);this.generatedMessage=true}var t=e.stackStartFunction||u;if(Error.captureStackTrace){Error.captureStackTrace(this,t)}else{var r=new Error;if(r.stack){var i=r.stack;var n=t.name;var a=i.indexOf("\n"+n);if(a>=0){var s=i.indexOf("\n",a+1);i=i.substring(s+1)}this.stack=i}}};i.inherits(s.AssertionError,Error);function o(e,t){if(i.isUndefined(t)){return""+t}if(i.isNumber(t)&&!isFinite(t)){return t.toString()}if(i.isFunction(t)||i.isRegExp(t)){return t.toString()}return t}function f(e,t){if(i.isString(e)){return e.length<t?e:e.slice(0,t)}else{return e}}function l(e){return f(JSON.stringify(e.actual,o),128)+" "+e.operator+" "+f(JSON.stringify(e.expected,o),128)}function u(e,t,r,i,n){throw new s.AssertionError({message:r,actual:e,expected:t,operator:i,stackStartFunction:n})}s.fail=u;function c(e,t){if(!e)u(e,true,t,"==",s.ok)}s.ok=c;s.equal=function y(e,t,r){if(e!=t)u(e,t,r,"==",s.equal)};s.notEqual=function b(e,t,r){if(e==t){u(e,t,r,"!=",s.notEqual)}};s.deepEqual=function w(e,t,r){if(!p(e,t)){u(e,t,r,"deepEqual",s.deepEqual)}};function p(e,t){if(e===t){return true}else if(i.isBuffer(e)&&i.isBuffer(t)){if(e.length!=t.length)return false;for(var r=0;r<e.length;r++){if(e[r]!==t[r])return false}return true}else if(i.isDate(e)&&i.isDate(t)){return e.getTime()===t.getTime()}else if(i.isRegExp(e)&&i.isRegExp(t)){return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase}else if(!i.isObject(e)&&!i.isObject(t)){return e==t}else{return h(e,t)}}function d(e){return Object.prototype.toString.call(e)=="[object Arguments]"}function h(e,t){if(i.isNullOrUndefined(e)||i.isNullOrUndefined(t))return false;if(e.prototype!==t.prototype)return false;if(i.isPrimitive(e)||i.isPrimitive(t)){return e===t}var r=d(e),a=d(t);if(r&&!a||!r&&a)return false;if(r){e=n.call(e);t=n.call(t);return p(e,t)}var s=g(e),o=g(t),f,l;if(s.length!=o.length)return false;s.sort();o.sort();for(l=s.length-1;l>=0;l--){if(s[l]!=o[l])return false}for(l=s.length-1;l>=0;l--){f=s[l];if(!p(e[f],t[f]))return false}return true}s.notDeepEqual=function x(e,t,r){if(p(e,t)){u(e,t,r,"notDeepEqual",s.notDeepEqual)}};s.strictEqual=function k(e,t,r){if(e!==t){u(e,t,r,"===",s.strictEqual)}};s.notStrictEqual=function S(e,t,r){if(e===t){u(e,t,r,"!==",s.notStrictEqual)}};function m(e,t){if(!e||!t){return false}if(Object.prototype.toString.call(t)=="[object RegExp]"){return t.test(e)}else if(e instanceof t){return true}else if(t.call({},e)===true){return true}return false}function v(e,t,r,n){var a;if(i.isString(r)){n=r;r=null}try{t()}catch(s){a=s}n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:".");if(e&&!a){u(a,r,"Missing expected exception"+n)}if(!e&&m(a,r)){u(a,r,"Got unwanted exception"+n)}if(e&&a&&r&&!m(a,r)||!e&&a){throw a}}s.throws=function(e,t,r){v.apply(this,[true].concat(n.call(arguments)))};s.doesNotThrow=function(e,t){v.apply(this,[false].concat(n.call(arguments)))};s.ifError=function(e){if(e){throw e}};var g=Object.keys||function(e){var t=[];for(var r in e){if(a.call(e,r))t.push(r)}return t}},{"util/":98}],52:[function(e,t,r){arguments[4][50][0].apply(r,arguments)},{dup:50}],53:[function(e,t,r){"use strict";var i=typeof Uint8Array!=="undefined"&&typeof Uint16Array!=="undefined"&&typeof Int32Array!=="undefined";r.assign=function(e){var t=Array.prototype.slice.call(arguments,1);while(t.length){var r=t.shift();if(!r){continue}if(typeof r!=="object"){throw new TypeError(r+"must be non-object")}for(var i in r){if(r.hasOwnProperty(i)){e[i]=r[i]}}}return e};r.shrinkBuf=function(e,t){if(e.length===t){return e}if(e.subarray){return e.subarray(0,t)}e.length=t;return e};var n={arraySet:function(e,t,r,i,n){if(t.subarray&&e.subarray){e.set(t.subarray(r,r+i),n);return}for(var a=0;a<i;a++){e[n+a]=t[r+a]}},flattenChunks:function(e){var t,r,i,n,a,s;i=0;for(t=0,r=e.length;t<r;t++){
-i+=e[t].length}s=new Uint8Array(i);n=0;for(t=0,r=e.length;t<r;t++){a=e[t];s.set(a,n);n+=a.length}return s}};var a={arraySet:function(e,t,r,i,n){for(var a=0;a<i;a++){e[n+a]=t[r+a]}},flattenChunks:function(e){return[].concat.apply([],e)}};r.setTyped=function(e){if(e){r.Buf8=Uint8Array;r.Buf16=Uint16Array;r.Buf32=Int32Array;r.assign(r,n)}else{r.Buf8=Array;r.Buf16=Array;r.Buf32=Array;r.assign(r,a)}};r.setTyped(i)},{}],54:[function(e,t,r){"use strict";function i(e,t,r,i){var n=e&65535|0,a=e>>>16&65535|0,s=0;while(r!==0){s=r>2e3?2e3:r;r-=s;do{n=n+t[i++]|0;a=a+n|0}while(--s);n%=65521;a%=65521}return n|a<<16|0}t.exports=i},{}],55:[function(e,t,r){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],56:[function(e,t,r){"use strict";function i(){var e,t=[];for(var r=0;r<256;r++){e=r;for(var i=0;i<8;i++){e=e&1?3988292384^e>>>1:e>>>1}t[r]=e}return t}var n=i();function a(e,t,r,i){var a=n,s=i+r;e=e^-1;for(var o=i;o<s;o++){e=e>>>8^a[(e^t[o])&255]}return e^-1}t.exports=a},{}],57:[function(e,t,r){"use strict";var i=e("../utils/common");var n=e("./trees");var a=e("./adler32");var s=e("./crc32");var o=e("./messages");var f=0;var l=1;var u=3;var c=4;var p=5;var d=0;var h=1;var m=-2;var v=-3;var g=-5;var _=-1;var y=1;var b=2;var w=3;var x=4;var k=0;var S=2;var E=8;var A=9;var T=15;var I=8;var U=29;var L=256;var B=L+1+U;var z=30;var C=19;var R=2*B+1;var F=15;var O=3;var M=258;var N=M+O+1;var D=32;var P=42;var j=69;var H=73;var q=91;var G=103;var W=113;var Z=666;var V=1;var Y=2;var K=3;var $=4;var X=3;function J(e,t){e.msg=o[t];return t}function Q(e){return(e<<1)-(e>4?9:0)}function ee(e){var t=e.length;while(--t>=0){e[t]=0}}function te(e){var t=e.state;var r=t.pending;if(r>e.avail_out){r=e.avail_out}if(r===0){return}i.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out);e.next_out+=r;t.pending_out+=r;e.total_out+=r;e.avail_out-=r;t.pending-=r;if(t.pending===0){t.pending_out=0}}function re(e,t){n._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t);e.block_start=e.strstart;te(e.strm)}function ie(e,t){e.pending_buf[e.pending++]=t}function ne(e,t){e.pending_buf[e.pending++]=t>>>8&255;e.pending_buf[e.pending++]=t&255}function ae(e,t,r,n){var o=e.avail_in;if(o>n){o=n}if(o===0){return 0}e.avail_in-=o;i.arraySet(t,e.input,e.next_in,o,r);if(e.state.wrap===1){e.adler=a(e.adler,t,o,r)}else if(e.state.wrap===2){e.adler=s(e.adler,t,o,r)}e.next_in+=o;e.total_in+=o;return o}function se(e,t){var r=e.max_chain_length;var i=e.strstart;var n;var a;var s=e.prev_length;var o=e.nice_match;var f=e.strstart>e.w_size-N?e.strstart-(e.w_size-N):0;var l=e.window;var u=e.w_mask;var c=e.prev;var p=e.strstart+M;var d=l[i+s-1];var h=l[i+s];if(e.prev_length>=e.good_match){r>>=2}if(o>e.lookahead){o=e.lookahead}do{n=t;if(l[n+s]!==h||l[n+s-1]!==d||l[n]!==l[i]||l[++n]!==l[i+1]){continue}i+=2;n++;do{}while(l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&i<p);a=M-(p-i);i=p-M;if(a>s){e.match_start=t;s=a;if(a>=o){break}d=l[i+s-1];h=l[i+s]}}while((t=c[t&u])>f&&--r!==0);if(s<=e.lookahead){return s}return e.lookahead}function oe(e){var t=e.w_size;var r,n,a,s,o;do{s=e.window_size-e.lookahead-e.strstart;if(e.strstart>=t+(t-N)){i.arraySet(e.window,e.window,t,t,0);e.match_start-=t;e.strstart-=t;e.block_start-=t;n=e.hash_size;r=n;do{a=e.head[--r];e.head[r]=a>=t?a-t:0}while(--n);n=t;r=n;do{a=e.prev[--r];e.prev[r]=a>=t?a-t:0}while(--n);s+=t}if(e.strm.avail_in===0){break}n=ae(e.strm,e.window,e.strstart+e.lookahead,s);e.lookahead+=n;if(e.lookahead+e.insert>=O){o=e.strstart-e.insert;e.ins_h=e.window[o];e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;while(e.insert){e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+O-1])&e.hash_mask;e.prev[o&e.w_mask]=e.head[e.ins_h];e.head[e.ins_h]=o;o++;e.insert--;if(e.lookahead+e.insert<O){break}}}}while(e.lookahead<N&&e.strm.avail_in!==0)}function fe(e,t){var r=65535;if(r>e.pending_buf_size-5){r=e.pending_buf_size-5}for(;;){if(e.lookahead<=1){oe(e);if(e.lookahead===0&&t===f){return V}if(e.lookahead===0){break}}e.strstart+=e.lookahead;e.lookahead=0;var i=e.block_start+r;if(e.strstart===0||e.strstart>=i){e.lookahead=e.strstart-i;e.strstart=i;re(e,false);if(e.strm.avail_out===0){return V}}if(e.strstart-e.block_start>=e.w_size-N){re(e,false);if(e.strm.avail_out===0){return V}}}e.insert=0;if(t===c){re(e,true);if(e.strm.avail_out===0){return K}return $}if(e.strstart>e.block_start){re(e,false);if(e.strm.avail_out===0){return V}}return V}function le(e,t){var r;var i;for(;;){if(e.lookahead<N){oe(e);if(e.lookahead<N&&t===f){return V}if(e.lookahead===0){break}}r=0;if(e.lookahead>=O){e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+O-1])&e.hash_mask;r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h];e.head[e.ins_h]=e.strstart}if(r!==0&&e.strstart-r<=e.w_size-N){e.match_length=se(e,r)}if(e.match_length>=O){i=n._tr_tally(e,e.strstart-e.match_start,e.match_length-O);e.lookahead-=e.match_length;if(e.match_length<=e.max_lazy_match&&e.lookahead>=O){e.match_length--;do{e.strstart++;e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+O-1])&e.hash_mask;r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h];e.head[e.ins_h]=e.strstart}while(--e.match_length!==0);e.strstart++}else{e.strstart+=e.match_length;e.match_length=0;e.ins_h=e.window[e.strstart];e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask}}else{i=n._tr_tally(e,0,e.window[e.strstart]);e.lookahead--;e.strstart++}if(i){re(e,false);if(e.strm.avail_out===0){return V}}}e.insert=e.strstart<O-1?e.strstart:O-1;if(t===c){re(e,true);if(e.strm.avail_out===0){return K}return $}if(e.last_lit){re(e,false);if(e.strm.avail_out===0){return V}}return Y}function ue(e,t){var r;var i;var a;for(;;){if(e.lookahead<N){oe(e);if(e.lookahead<N&&t===f){return V}if(e.lookahead===0){break}}r=0;if(e.lookahead>=O){e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+O-1])&e.hash_mask;r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h];e.head[e.ins_h]=e.strstart}e.prev_length=e.match_length;e.prev_match=e.match_start;e.match_length=O-1;if(r!==0&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-N){e.match_length=se(e,r);if(e.match_length<=5&&(e.strategy===y||e.match_length===O&&e.strstart-e.match_start>4096)){e.match_length=O-1}}if(e.prev_length>=O&&e.match_length<=e.prev_length){a=e.strstart+e.lookahead-O;i=n._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-O);e.lookahead-=e.prev_length-1;e.prev_length-=2;do{if(++e.strstart<=a){e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+O-1])&e.hash_mask;r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h];e.head[e.ins_h]=e.strstart}}while(--e.prev_length!==0);e.match_available=0;e.match_length=O-1;e.strstart++;if(i){re(e,false);if(e.strm.avail_out===0){return V}}}else if(e.match_available){i=n._tr_tally(e,0,e.window[e.strstart-1]);if(i){re(e,false)}e.strstart++;e.lookahead--;if(e.strm.avail_out===0){return V}}else{e.match_available=1;e.strstart++;e.lookahead--}}if(e.match_available){i=n._tr_tally(e,0,e.window[e.strstart-1]);e.match_available=0}e.insert=e.strstart<O-1?e.strstart:O-1;if(t===c){re(e,true);if(e.strm.avail_out===0){return K}return $}if(e.last_lit){re(e,false);if(e.strm.avail_out===0){return V}}return Y}function ce(e,t){var r;var i;var a,s;var o=e.window;for(;;){if(e.lookahead<=M){oe(e);if(e.lookahead<=M&&t===f){return V}if(e.lookahead===0){break}}e.match_length=0;if(e.lookahead>=O&&e.strstart>0){a=e.strstart-1;i=o[a];if(i===o[++a]&&i===o[++a]&&i===o[++a]){s=e.strstart+M;do{}while(i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&i===o[++a]&&a<s);e.match_length=M-(s-a);if(e.match_length>e.lookahead){e.match_length=e.lookahead}}}if(e.match_length>=O){r=n._tr_tally(e,1,e.match_length-O);e.lookahead-=e.match_length;e.strstart+=e.match_length;e.match_length=0}else{r=n._tr_tally(e,0,e.window[e.strstart]);e.lookahead--;e.strstart++}if(r){re(e,false);if(e.strm.avail_out===0){return V}}}e.insert=0;if(t===c){re(e,true);if(e.strm.avail_out===0){return K}return $}if(e.last_lit){re(e,false);if(e.strm.avail_out===0){return V}}return Y}function pe(e,t){var r;for(;;){if(e.lookahead===0){oe(e);if(e.lookahead===0){if(t===f){return V}break}}e.match_length=0;r=n._tr_tally(e,0,e.window[e.strstart]);e.lookahead--;e.strstart++;if(r){re(e,false);if(e.strm.avail_out===0){return V}}}e.insert=0;if(t===c){re(e,true);if(e.strm.avail_out===0){return K}return $}if(e.last_lit){re(e,false);if(e.strm.avail_out===0){return V}}return Y}var de=function(e,t,r,i,n){this.good_length=e;this.max_lazy=t;this.nice_length=r;this.max_chain=i;this.func=n};var he;he=[new de(0,0,0,0,fe),new de(4,4,8,4,le),new de(4,5,16,8,le),new de(4,6,32,32,le),new de(4,4,16,16,ue),new de(8,16,32,32,ue),new de(8,16,128,128,ue),new de(8,32,128,256,ue),new de(32,128,258,1024,ue),new de(32,258,258,4096,ue)];function me(e){e.window_size=2*e.w_size;ee(e.head);e.max_lazy_match=he[e.level].max_lazy;e.good_match=he[e.level].good_length;e.nice_match=he[e.level].nice_length;e.max_chain_length=he[e.level].max_chain;e.strstart=0;e.block_start=0;e.lookahead=0;e.insert=0;e.match_length=e.prev_length=O-1;e.match_available=0;e.ins_h=0}function ve(){this.strm=null;this.status=0;this.pending_buf=null;this.pending_buf_size=0;this.pending_out=0;this.pending=0;this.wrap=0;this.gzhead=null;this.gzindex=0;this.method=E;this.last_flush=-1;this.w_size=0;this.w_bits=0;this.w_mask=0;this.window=null;this.window_size=0;this.prev=null;this.head=null;this.ins_h=0;this.hash_size=0;this.hash_bits=0;this.hash_mask=0;this.hash_shift=0;this.block_start=0;this.match_length=0;this.prev_match=0;this.match_available=0;this.strstart=0;this.match_start=0;this.lookahead=0;this.prev_length=0;this.max_chain_length=0;this.max_lazy_match=0;this.level=0;this.strategy=0;this.good_match=0;this.nice_match=0;this.dyn_ltree=new i.Buf16(R*2);this.dyn_dtree=new i.Buf16((2*z+1)*2);this.bl_tree=new i.Buf16((2*C+1)*2);ee(this.dyn_ltree);ee(this.dyn_dtree);ee(this.bl_tree);this.l_desc=null;this.d_desc=null;this.bl_desc=null;this.bl_count=new i.Buf16(F+1);this.heap=new i.Buf16(2*B+1);ee(this.heap);this.heap_len=0;this.heap_max=0;this.depth=new i.Buf16(2*B+1);ee(this.depth);this.l_buf=0;this.lit_bufsize=0;this.last_lit=0;this.d_buf=0;this.opt_len=0;this.static_len=0;this.matches=0;this.insert=0;this.bi_buf=0;this.bi_valid=0}function ge(e){var t;if(!e||!e.state){return J(e,m)}e.total_in=e.total_out=0;e.data_type=S;t=e.state;t.pending=0;t.pending_out=0;if(t.wrap<0){t.wrap=-t.wrap}t.status=t.wrap?P:W;e.adler=t.wrap===2?0:1;t.last_flush=f;n._tr_init(t);return d}function _e(e){var t=ge(e);if(t===d){me(e.state)}return t}function ye(e,t){if(!e||!e.state){return m}if(e.state.wrap!==2){return m}e.state.gzhead=t;return d}function be(e,t,r,n,a,s){if(!e){return m}var o=1;if(t===_){t=6}if(n<0){o=0;n=-n}else if(n>15){o=2;n-=16}if(a<1||a>A||r!==E||n<8||n>15||t<0||t>9||s<0||s>x){return J(e,m)}if(n===8){n=9}var f=new ve;e.state=f;f.strm=e;f.wrap=o;f.gzhead=null;f.w_bits=n;f.w_size=1<<f.w_bits;f.w_mask=f.w_size-1;f.hash_bits=a+7;f.hash_size=1<<f.hash_bits;f.hash_mask=f.hash_size-1;f.hash_shift=~~((f.hash_bits+O-1)/O);f.window=new i.Buf8(f.w_size*2);f.head=new i.Buf16(f.hash_size);f.prev=new i.Buf16(f.w_size);f.lit_bufsize=1<<a+6;f.pending_buf_size=f.lit_bufsize*4;f.pending_buf=new i.Buf8(f.pending_buf_size);f.d_buf=f.lit_bufsize>>1;f.l_buf=(1+2)*f.lit_bufsize;f.level=t;f.strategy=s;f.method=r;return _e(e)}function we(e,t){return be(e,t,E,T,I,k)}function xe(e,t){var r,i;var a,o;if(!e||!e.state||t>p||t<0){return e?J(e,m):m}i=e.state;if(!e.output||!e.input&&e.avail_in!==0||i.status===Z&&t!==c){return J(e,e.avail_out===0?g:m)}i.strm=e;r=i.last_flush;i.last_flush=t;if(i.status===P){if(i.wrap===2){e.adler=0;ie(i,31);ie(i,139);ie(i,8);if(!i.gzhead){ie(i,0);ie(i,0);ie(i,0);ie(i,0);ie(i,0);ie(i,i.level===9?2:i.strategy>=b||i.level<2?4:0);ie(i,X);i.status=W}else{ie(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(!i.gzhead.extra?0:4)+(!i.gzhead.name?0:8)+(!i.gzhead.comment?0:16));ie(i,i.gzhead.time&255);ie(i,i.gzhead.time>>8&255);ie(i,i.gzhead.time>>16&255);ie(i,i.gzhead.time>>24&255);ie(i,i.level===9?2:i.strategy>=b||i.level<2?4:0);ie(i,i.gzhead.os&255);if(i.gzhead.extra&&i.gzhead.extra.length){ie(i,i.gzhead.extra.length&255);ie(i,i.gzhead.extra.length>>8&255)}if(i.gzhead.hcrc){e.adler=s(e.adler,i.pending_buf,i.pending,0)}i.gzindex=0;i.status=j}}else{var v=E+(i.w_bits-8<<4)<<8;var _=-1;if(i.strategy>=b||i.level<2){_=0}else if(i.level<6){_=1}else if(i.level===6){_=2}else{_=3}v|=_<<6;if(i.strstart!==0){v|=D}v+=31-v%31;i.status=W;ne(i,v);if(i.strstart!==0){ne(i,e.adler>>>16);ne(i,e.adler&65535)}e.adler=1}}if(i.status===j){if(i.gzhead.extra){a=i.pending;while(i.gzindex<(i.gzhead.extra.length&65535)){if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>a){e.adler=s(e.adler,i.pending_buf,i.pending-a,a)}te(e);a=i.pending;if(i.pending===i.pending_buf_size){break}}ie(i,i.gzhead.extra[i.gzindex]&255);i.gzindex++}if(i.gzhead.hcrc&&i.pending>a){e.adler=s(e.adler,i.pending_buf,i.pending-a,a)}if(i.gzindex===i.gzhead.extra.length){i.gzindex=0;i.status=H}}else{i.status=H}}if(i.status===H){if(i.gzhead.name){a=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>a){e.adler=s(e.adler,i.pending_buf,i.pending-a,a)}te(e);a=i.pending;if(i.pending===i.pending_buf_size){o=1;break}}if(i.gzindex<i.gzhead.name.length){o=i.gzhead.name.charCodeAt(i.gzindex++)&255}else{o=0}ie(i,o)}while(o!==0);if(i.gzhead.hcrc&&i.pending>a){e.adler=s(e.adler,i.pending_buf,i.pending-a,a)}if(o===0){i.gzindex=0;i.status=q}}else{i.status=q}}if(i.status===q){if(i.gzhead.comment){a=i.pending;do{if(i.pending===i.pending_buf_size){if(i.gzhead.hcrc&&i.pending>a){e.adler=s(e.adler,i.pending_buf,i.pending-a,a)}te(e);a=i.pending;if(i.pending===i.pending_buf_size){o=1;break}}if(i.gzindex<i.gzhead.comment.length){o=i.gzhead.comment.charCodeAt(i.gzindex++)&255}else{o=0}ie(i,o)}while(o!==0);if(i.gzhead.hcrc&&i.pending>a){e.adler=s(e.adler,i.pending_buf,i.pending-a,a)}if(o===0){i.status=G}}else{i.status=G}}if(i.status===G){if(i.gzhead.hcrc){if(i.pending+2>i.pending_buf_size){te(e)}if(i.pending+2<=i.pending_buf_size){ie(i,e.adler&255);ie(i,e.adler>>8&255);e.adler=0;i.status=W}}else{i.status=W}}if(i.pending!==0){te(e);if(e.avail_out===0){i.last_flush=-1;return d}}else if(e.avail_in===0&&Q(t)<=Q(r)&&t!==c){return J(e,g)}if(i.status===Z&&e.avail_in!==0){return J(e,g)}if(e.avail_in!==0||i.lookahead!==0||t!==f&&i.status!==Z){var y=i.strategy===b?pe(i,t):i.strategy===w?ce(i,t):he[i.level].func(i,t);if(y===K||y===$){i.status=Z}if(y===V||y===K){if(e.avail_out===0){i.last_flush=-1}return d}if(y===Y){if(t===l){n._tr_align(i)}else if(t!==p){n._tr_stored_block(i,0,0,false);if(t===u){ee(i.head);if(i.lookahead===0){i.strstart=0;i.block_start=0;i.insert=0}}}te(e);if(e.avail_out===0){i.last_flush=-1;return d}}}if(t!==c){return d}if(i.wrap<=0){return h}if(i.wrap===2){ie(i,e.adler&255);ie(i,e.adler>>8&255);ie(i,e.adler>>16&255);ie(i,e.adler>>24&255);ie(i,e.total_in&255);ie(i,e.total_in>>8&255);ie(i,e.total_in>>16&255);ie(i,e.total_in>>24&255)}else{ne(i,e.adler>>>16);ne(i,e.adler&65535)}te(e);if(i.wrap>0){i.wrap=-i.wrap}return i.pending!==0?d:h}function ke(e){var t;if(!e||!e.state){return m}t=e.state.status;if(t!==P&&t!==j&&t!==H&&t!==q&&t!==G&&t!==W&&t!==Z){return J(e,m)}e.state=null;return t===W?J(e,v):d}r.deflateInit=we;r.deflateInit2=be;r.deflateReset=_e;r.deflateResetKeep=ge;r.deflateSetHeader=ye;r.deflate=xe;r.deflateEnd=ke;r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":53,"./adler32":54,"./crc32":56,"./messages":61,"./trees":62}],58:[function(e,t,r){"use strict";var i=30;var n=12;t.exports=function a(e,t){var r;var a;var s;var o;var f;var l;var u;var c;var p;var d;var h;var m;var v;var g;var _;var y;var b;var w;var x;var k;var S;var E;var A;var T,I;r=e.state;a=e.next_in;T=e.input;s=a+(e.avail_in-5);o=e.next_out;I=e.output;f=o-(t-e.avail_out);l=o+(e.avail_out-257);u=r.dmax;c=r.wsize;p=r.whave;d=r.wnext;h=r.window;m=r.hold;v=r.bits;g=r.lencode;_=r.distcode;y=(1<<r.lenbits)-1;b=(1<<r.distbits)-1;e:do{if(v<15){m+=T[a++]<<v;v+=8;m+=T[a++]<<v;v+=8}w=g[m&y];t:for(;;){x=w>>>24;m>>>=x;v-=x;x=w>>>16&255;if(x===0){I[o++]=w&65535}else if(x&16){k=w&65535;x&=15;if(x){if(v<x){m+=T[a++]<<v;v+=8}k+=m&(1<<x)-1;m>>>=x;v-=x}if(v<15){m+=T[a++]<<v;v+=8;m+=T[a++]<<v;v+=8}w=_[m&b];r:for(;;){x=w>>>24;m>>>=x;v-=x;x=w>>>16&255;if(x&16){S=w&65535;x&=15;if(v<x){m+=T[a++]<<v;v+=8;if(v<x){m+=T[a++]<<v;v+=8}}S+=m&(1<<x)-1;if(S>u){e.msg="invalid distance too far back";r.mode=i;break e}m>>>=x;v-=x;x=o-f;if(S>x){x=S-x;if(x>p){if(r.sane){e.msg="invalid distance too far back";r.mode=i;break e}}E=0;A=h;if(d===0){E+=c-x;if(x<k){k-=x;do{I[o++]=h[E++]}while(--x);E=o-S;A=I}}else if(d<x){E+=c+d-x;x-=d;if(x<k){k-=x;do{I[o++]=h[E++]}while(--x);E=0;if(d<k){x=d;k-=x;do{I[o++]=h[E++]}while(--x);E=o-S;A=I}}}else{E+=d-x;if(x<k){k-=x;do{I[o++]=h[E++]}while(--x);E=o-S;A=I}}while(k>2){I[o++]=A[E++];I[o++]=A[E++];I[o++]=A[E++];k-=3}if(k){I[o++]=A[E++];if(k>1){I[o++]=A[E++]}}}else{E=o-S;do{I[o++]=I[E++];I[o++]=I[E++];I[o++]=I[E++];k-=3}while(k>2);if(k){I[o++]=I[E++];if(k>1){I[o++]=I[E++]}}}}else if((x&64)===0){w=_[(w&65535)+(m&(1<<x)-1)];continue r}else{e.msg="invalid distance code";r.mode=i;break e}break}}else if((x&64)===0){w=g[(w&65535)+(m&(1<<x)-1)];continue t}else if(x&32){r.mode=n;break e}else{e.msg="invalid literal/length code";r.mode=i;break e}break}}while(a<s&&o<l);k=v>>3;a-=k;v-=k<<3;m&=(1<<v)-1;e.next_in=a;e.next_out=o;e.avail_in=a<s?5+(s-a):5-(a-s);e.avail_out=o<l?257+(l-o):257-(o-l);r.hold=m;r.bits=v;return}},{}],59:[function(e,t,r){"use strict";var i=e("../utils/common");var n=e("./adler32");var a=e("./crc32");var s=e("./inffast");var o=e("./inftrees");var f=0;var l=1;var u=2;var c=4;var p=5;var d=6;var h=0;var m=1;var v=2;var g=-2;var _=-3;var y=-4;var b=-5;var w=8;var x=1;var k=2;var S=3;var E=4;var A=5;var T=6;var I=7;var U=8;var L=9;var B=10;var z=11;var C=12;var R=13;var F=14;var O=15;var M=16;var N=17;var D=18;var P=19;var j=20;var H=21;var q=22;var G=23;var W=24;var Z=25;var V=26;var Y=27;var K=28;var $=29;var X=30;var J=31;var Q=32;var ee=852;var te=592;var re=15;var ie=re;function ne(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function ae(){this.mode=0;this.last=false;this.wrap=0;this.havedict=false;this.flags=0;this.dmax=0;this.check=0;this.total=0;this.head=null;this.wbits=0;this.wsize=0;this.whave=0;this.wnext=0;this.window=null;this.hold=0;this.bits=0;this.length=0;this.offset=0;this.extra=0;this.lencode=null;this.distcode=null;this.lenbits=0;this.distbits=0;this.ncode=0;this.nlen=0;this.ndist=0;this.have=0;this.next=null;this.lens=new i.Buf16(320);this.work=new i.Buf16(288);this.lendyn=null;this.distdyn=null;this.sane=0;this.back=0;this.was=0}function se(e){var t;if(!e||!e.state){return g}t=e.state;e.total_in=e.total_out=t.total=0;e.msg="";if(t.wrap){e.adler=t.wrap&1}t.mode=x;t.last=0;t.havedict=0;t.dmax=32768;t.head=null;t.hold=0;t.bits=0;t.lencode=t.lendyn=new i.Buf32(ee);t.distcode=t.distdyn=new i.Buf32(te);t.sane=1;t.back=-1;return h}function oe(e){var t;if(!e||!e.state){return g}t=e.state;t.wsize=0;t.whave=0;t.wnext=0;return se(e)}function fe(e,t){var r;var i;if(!e||!e.state){return g}i=e.state;if(t<0){r=0;t=-t}else{r=(t>>4)+1;if(t<48){t&=15}}if(t&&(t<8||t>15)){return g}if(i.window!==null&&i.wbits!==t){i.window=null}i.wrap=r;i.wbits=t;return oe(e)}function le(e,t){var r;var i;if(!e){return g}i=new ae;e.state=i;i.window=null;r=fe(e,t);if(r!==h){e.state=null}return r}function ue(e){return le(e,ie)}var ce=true;var pe,de;function he(e){if(ce){var t;pe=new i.Buf32(512);de=new i.Buf32(32);t=0;while(t<144){e.lens[t++]=8}while(t<256){e.lens[t++]=9}while(t<280){e.lens[t++]=7}while(t<288){e.lens[t++]=8}o(l,e.lens,0,288,pe,0,e.work,{bits:9});t=0;while(t<32){e.lens[t++]=5}o(u,e.lens,0,32,de,0,e.work,{bits:5});ce=false}e.lencode=pe;e.lenbits=9;e.distcode=de;e.distbits=5}function me(e,t,r,n){var a;var s=e.state;if(s.window===null){s.wsize=1<<s.wbits;s.wnext=0;s.whave=0;s.window=new i.Buf8(s.wsize)}if(n>=s.wsize){i.arraySet(s.window,t,r-s.wsize,s.wsize,0);s.wnext=0;s.whave=s.wsize}else{a=s.wsize-s.wnext;if(a>n){a=n}i.arraySet(s.window,t,r-n,a,s.wnext);n-=a;if(n){i.arraySet(s.window,t,r-n,n,0);s.wnext=n;s.whave=s.wsize}else{s.wnext+=a;if(s.wnext===s.wsize){s.wnext=0}if(s.whave<s.wsize){s.whave+=a}}}return 0}function ve(e,t){var r;var ee,te;var re;var ie;var ae,se;var oe;var fe;var le,ue;var ce;var pe;var de;var ve=0;var ge,_e,ye;var be,we,xe;var ke;var Se;var Ee=new i.Buf8(4);var Ae;var Te;var Ie=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0){return g}r=e.state;if(r.mode===C){r.mode=R}ie=e.next_out;te=e.output;se=e.avail_out;re=e.next_in;ee=e.input;ae=e.avail_in;oe=r.hold;fe=r.bits;le=ae;ue=se;Se=h;e:for(;;){switch(r.mode){case x:if(r.wrap===0){r.mode=R;break}while(fe<16){if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}if(r.wrap&2&&oe===35615){r.check=0;Ee[0]=oe&255;Ee[1]=oe>>>8&255;r.check=a(r.check,Ee,2,0);oe=0;fe=0;r.mode=k;break}r.flags=0;if(r.head){r.head.done=false}if(!(r.wrap&1)||(((oe&255)<<8)+(oe>>8))%31){e.msg="incorrect header check";r.mode=X;break}if((oe&15)!==w){e.msg="unknown compression method";r.mode=X;break}oe>>>=4;fe-=4;ke=(oe&15)+8;if(r.wbits===0){r.wbits=ke}else if(ke>r.wbits){e.msg="invalid window size";r.mode=X;break}r.dmax=1<<ke;e.adler=r.check=1;r.mode=oe&512?B:C;oe=0;fe=0;break;case k:while(fe<16){if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}r.flags=oe;if((r.flags&255)!==w){e.msg="unknown compression method";r.mode=X;break}if(r.flags&57344){e.msg="unknown header flags set";r.mode=X;break}if(r.head){r.head.text=oe>>8&1}if(r.flags&512){Ee[0]=oe&255;Ee[1]=oe>>>8&255;r.check=a(r.check,Ee,2,0)}oe=0;fe=0;r.mode=S;case S:while(fe<32){if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}if(r.head){r.head.time=oe}if(r.flags&512){Ee[0]=oe&255;Ee[1]=oe>>>8&255;Ee[2]=oe>>>16&255;Ee[3]=oe>>>24&255;r.check=a(r.check,Ee,4,0)}oe=0;fe=0;r.mode=E;case E:while(fe<16){if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}if(r.head){r.head.xflags=oe&255;r.head.os=oe>>8}if(r.flags&512){Ee[0]=oe&255;Ee[1]=oe>>>8&255;r.check=a(r.check,Ee,2,0)}oe=0;fe=0;r.mode=A;case A:if(r.flags&1024){while(fe<16){if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}r.length=oe;if(r.head){r.head.extra_len=oe}if(r.flags&512){Ee[0]=oe&255;Ee[1]=oe>>>8&255;r.check=a(r.check,Ee,2,0)}oe=0;fe=0}else if(r.head){r.head.extra=null}r.mode=T;case T:if(r.flags&1024){ce=r.length;if(ce>ae){ce=ae}if(ce){if(r.head){ke=r.head.extra_len-r.length;if(!r.head.extra){r.head.extra=new Array(r.head.extra_len)}i.arraySet(r.head.extra,ee,re,ce,ke)}if(r.flags&512){r.check=a(r.check,ee,ce,re)}ae-=ce;re+=ce;r.length-=ce}if(r.length){break e}}r.length=0;r.mode=I;case I:if(r.flags&2048){if(ae===0){break e}ce=0;do{ke=ee[re+ce++];if(r.head&&ke&&r.length<65536){r.head.name+=String.fromCharCode(ke)}}while(ke&&ce<ae);if(r.flags&512){r.check=a(r.check,ee,ce,re)}ae-=ce;re+=ce;if(ke){break e}}else if(r.head){r.head.name=null}r.length=0;r.mode=U;case U:if(r.flags&4096){if(ae===0){break e}ce=0;do{ke=ee[re+ce++];if(r.head&&ke&&r.length<65536){r.head.comment+=String.fromCharCode(ke)}}while(ke&&ce<ae);if(r.flags&512){r.check=a(r.check,ee,ce,re)}ae-=ce;re+=ce;if(ke){break e}}else if(r.head){r.head.comment=null}r.mode=L;case L:if(r.flags&512){while(fe<16){if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}if(oe!==(r.check&65535)){e.msg="header crc mismatch";r.mode=X;break}oe=0;fe=0}if(r.head){r.head.hcrc=r.flags>>9&1;r.head.done=true}e.adler=r.check=0;r.mode=C;break;case B:while(fe<32){if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}e.adler=r.check=ne(oe);oe=0;fe=0;r.mode=z;case z:if(r.havedict===0){e.next_out=ie;e.avail_out=se;e.next_in=re;e.avail_in=ae;r.hold=oe;r.bits=fe;return v}e.adler=r.check=1;r.mode=C;case C:if(t===p||t===d){break e}case R:if(r.last){oe>>>=fe&7;fe-=fe&7;r.mode=Y;break}while(fe<3){if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}r.last=oe&1;oe>>>=1;fe-=1;switch(oe&3){case 0:r.mode=F;break;case 1:he(r);r.mode=j;if(t===d){oe>>>=2;fe-=2;break e}break;case 2:r.mode=N;break;case 3:e.msg="invalid block type";r.mode=X}oe>>>=2;fe-=2;break;case F:oe>>>=fe&7;fe-=fe&7;while(fe<32){if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}if((oe&65535)!==(oe>>>16^65535)){e.msg="invalid stored block lengths";r.mode=X;break}r.length=oe&65535;oe=0;fe=0;r.mode=O;if(t===d){break e}case O:r.mode=M;case M:ce=r.length;if(ce){if(ce>ae){ce=ae}if(ce>se){ce=se}if(ce===0){break e}i.arraySet(te,ee,re,ce,ie);ae-=ce;re+=ce;se-=ce;ie+=ce;r.length-=ce;break}r.mode=C;break;case N:while(fe<14){if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}r.nlen=(oe&31)+257;oe>>>=5;fe-=5;r.ndist=(oe&31)+1;oe>>>=5;fe-=5;r.ncode=(oe&15)+4;oe>>>=4;fe-=4;if(r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols";r.mode=X;break}r.have=0;r.mode=D;case D:while(r.have<r.ncode){while(fe<3){if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}r.lens[Ie[r.have++]]=oe&7;oe>>>=3;fe-=3}while(r.have<19){r.lens[Ie[r.have++]]=0}r.lencode=r.lendyn;r.lenbits=7;Ae={bits:r.lenbits};Se=o(f,r.lens,0,19,r.lencode,0,r.work,Ae);r.lenbits=Ae.bits;if(Se){e.msg="invalid code lengths set";r.mode=X;break}r.have=0;r.mode=P;case P:while(r.have<r.nlen+r.ndist){for(;;){ve=r.lencode[oe&(1<<r.lenbits)-1];ge=ve>>>24;_e=ve>>>16&255;ye=ve&65535;if(ge<=fe){break}if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}if(ye<16){oe>>>=ge;fe-=ge;r.lens[r.have++]=ye}else{if(ye===16){Te=ge+2;while(fe<Te){if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}oe>>>=ge;fe-=ge;if(r.have===0){e.msg="invalid bit length repeat";r.mode=X;break}ke=r.lens[r.have-1];ce=3+(oe&3);oe>>>=2;fe-=2}else if(ye===17){Te=ge+3;while(fe<Te){if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}oe>>>=ge;fe-=ge;ke=0;ce=3+(oe&7);oe>>>=3;fe-=3}else{Te=ge+7;while(fe<Te){if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}oe>>>=ge;fe-=ge;ke=0;ce=11+(oe&127);oe>>>=7;fe-=7}if(r.have+ce>r.nlen+r.ndist){e.msg="invalid bit length repeat";r.mode=X;break}while(ce--){r.lens[r.have++]=ke}}}if(r.mode===X){break}if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block";r.mode=X;break}r.lenbits=9;Ae={bits:r.lenbits};Se=o(l,r.lens,0,r.nlen,r.lencode,0,r.work,Ae);r.lenbits=Ae.bits;if(Se){e.msg="invalid literal/lengths set";r.mode=X;break}r.distbits=6;r.distcode=r.distdyn;Ae={bits:r.distbits};Se=o(u,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,Ae);r.distbits=Ae.bits;if(Se){e.msg="invalid distances set";r.mode=X;break}r.mode=j;if(t===d){break e}case j:r.mode=H;case H:if(ae>=6&&se>=258){e.next_out=ie;e.avail_out=se;e.next_in=re;e.avail_in=ae;r.hold=oe;r.bits=fe;s(e,ue);ie=e.next_out;te=e.output;se=e.avail_out;re=e.next_in;ee=e.input;ae=e.avail_in;oe=r.hold;fe=r.bits;if(r.mode===C){r.back=-1}break}r.back=0;for(;;){ve=r.lencode[oe&(1<<r.lenbits)-1];ge=ve>>>24;_e=ve>>>16&255;ye=ve&65535;if(ge<=fe){break}if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}if(_e&&(_e&240)===0){be=ge;we=_e;xe=ye;for(;;){ve=r.lencode[xe+((oe&(1<<be+we)-1)>>be)];ge=ve>>>24;_e=ve>>>16&255;ye=ve&65535;if(be+ge<=fe){break}if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}oe>>>=be;fe-=be;r.back+=be}oe>>>=ge;fe-=ge;r.back+=ge;r.length=ye;if(_e===0){r.mode=V;break}if(_e&32){r.back=-1;r.mode=C;break}if(_e&64){e.msg="invalid literal/length code";r.mode=X;break}r.extra=_e&15;r.mode=q;case q:if(r.extra){Te=r.extra;while(fe<Te){if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}r.length+=oe&(1<<r.extra)-1;oe>>>=r.extra;fe-=r.extra;r.back+=r.extra}r.was=r.length;r.mode=G;case G:for(;;){ve=r.distcode[oe&(1<<r.distbits)-1];ge=ve>>>24;_e=ve>>>16&255;ye=ve&65535;if(ge<=fe){break}if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}if((_e&240)===0){be=ge;we=_e;xe=ye;for(;;){ve=r.distcode[xe+((oe&(1<<be+we)-1)>>be)];ge=ve>>>24;_e=ve>>>16&255;ye=ve&65535;if(be+ge<=fe){break}if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}oe>>>=be;fe-=be;r.back+=be}oe>>>=ge;fe-=ge;r.back+=ge;if(_e&64){e.msg="invalid distance code";r.mode=X;break}r.offset=ye;r.extra=_e&15;r.mode=W;case W:if(r.extra){Te=r.extra;while(fe<Te){if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}r.offset+=oe&(1<<r.extra)-1;oe>>>=r.extra;fe-=r.extra;r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back";r.mode=X;break}r.mode=Z;case Z:if(se===0){break e}ce=ue-se;if(r.offset>ce){ce=r.offset-ce;if(ce>r.whave){if(r.sane){e.msg="invalid distance too far back";r.mode=X;break}}if(ce>r.wnext){ce-=r.wnext;pe=r.wsize-ce}else{pe=r.wnext-ce}if(ce>r.length){ce=r.length}de=r.window}else{de=te;pe=ie-r.offset;ce=r.length}if(ce>se){ce=se}se-=ce;r.length-=ce;do{te[ie++]=de[pe++]}while(--ce);if(r.length===0){r.mode=H}break;case V:if(se===0){break e}te[ie++]=r.length;se--;r.mode=H;break;case Y:if(r.wrap){while(fe<32){if(ae===0){break e}ae--;oe|=ee[re++]<<fe;fe+=8}ue-=se;e.total_out+=ue;r.total+=ue;if(ue){e.adler=r.check=r.flags?a(r.check,te,ue,ie-ue):n(r.check,te,ue,ie-ue)}ue=se;if((r.flags?oe:ne(oe))!==r.check){e.msg="incorrect data check";r.mode=X;break}oe=0;fe=0}r.mode=K;case K:if(r.wrap&&r.flags){while(fe<32){if(ae===0){break e}ae--;oe+=ee[re++]<<fe;fe+=8}if(oe!==(r.total&4294967295)){e.msg="incorrect length check";r.mode=X;break}oe=0;fe=0}r.mode=$;case $:Se=m;break e;case X:Se=_;break e;case J:return y;case Q:default:return g}}e.next_out=ie;e.avail_out=se;e.next_in=re;e.avail_in=ae;r.hold=oe;r.bits=fe;if(r.wsize||ue!==e.avail_out&&r.mode<X&&(r.mode<Y||t!==c)){if(me(e,e.output,e.next_out,ue-e.avail_out)){r.mode=J;return y}}le-=e.avail_in;ue-=e.avail_out;e.total_in+=le;e.total_out+=ue;r.total+=ue;if(r.wrap&&ue){e.adler=r.check=r.flags?a(r.check,te,ue,e.next_out-ue):n(r.check,te,ue,e.next_out-ue)}e.data_type=r.bits+(r.last?64:0)+(r.mode===C?128:0)+(r.mode===j||r.mode===O?256:0);if((le===0&&ue===0||t===c)&&Se===h){Se=b}return Se}function ge(e){if(!e||!e.state){return g}var t=e.state;if(t.window){t.window=null}e.state=null;return h}function _e(e,t){var r;if(!e||!e.state){return g}r=e.state;if((r.wrap&2)===0){return g}r.head=t;t.done=false;return h}r.inflateReset=oe;r.inflateReset2=fe;r.inflateResetKeep=se;r.inflateInit=ue;r.inflateInit2=le;r.inflate=ve;r.inflateEnd=ge;r.inflateGetHeader=_e;r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":53,"./adler32":54,"./crc32":56,"./inffast":58,"./inftrees":60}],60:[function(e,t,r){"use strict";var i=e("../utils/common");var n=15;var a=852;var s=592;var o=0;var f=1;var l=2;var u=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0];var c=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78];var p=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0];var d=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function h(e,t,r,m,v,g,_,y){var b=y.bits;var w=0;var x=0;var k=0,S=0;var E=0;var A=0;var T=0;var I=0;var U=0;var L=0;var B;var z;var C;var R;var F;var O=null;var M=0;var N;var D=new i.Buf16(n+1);var P=new i.Buf16(n+1);var j=null;var H=0;var q,G,W;for(w=0;w<=n;w++){D[w]=0}for(x=0;x<m;x++){D[t[r+x]]++}E=b;for(S=n;S>=1;S--){if(D[S]!==0){break}}if(E>S){E=S}if(S===0){v[g++]=1<<24|64<<16|0;v[g++]=1<<24|64<<16|0;y.bits=1;return 0}for(k=1;k<S;k++){if(D[k]!==0){break}}if(E<k){E=k}I=1;for(w=1;w<=n;w++){I<<=1;I-=D[w];if(I<0){return-1}}if(I>0&&(e===o||S!==1)){return-1}P[1]=0;for(w=1;w<n;w++){P[w+1]=P[w]+D[w]}for(x=0;x<m;x++){if(t[r+x]!==0){_[P[t[r+x]]++]=x}}if(e===o){O=j=_;N=19}else if(e===f){O=u;M-=257;j=c;H-=257;N=256}else{O=p;j=d;N=-1}L=0;x=0;w=k;F=g;A=E;T=0;C=-1;U=1<<E;R=U-1;if(e===f&&U>a||e===l&&U>s){return 1}var Z=0;for(;;){Z++;q=w-T;if(_[x]<N){G=0;W=_[x]}else if(_[x]>N){G=j[H+_[x]];W=O[M+_[x]]}else{G=32+64;W=0}B=1<<w-T;z=1<<A;k=z;do{z-=B;v[F+(L>>T)+z]=q<<24|G<<16|W|0}while(z!==0);B=1<<w-1;
-while(L&B){B>>=1}if(B!==0){L&=B-1;L+=B}else{L=0}x++;if(--D[w]===0){if(w===S){break}w=t[r+_[x]]}if(w>E&&(L&R)!==C){if(T===0){T=E}F+=k;A=w-T;I=1<<A;while(A+T<S){I-=D[A+T];if(I<=0){break}A++;I<<=1}U+=1<<A;if(e===f&&U>a||e===l&&U>s){return 1}C=L&R;v[C]=E<<24|A<<16|F-g|0}}if(L!==0){v[F+L]=w-T<<24|64<<16|0}y.bits=E;return 0}},{"../utils/common":53}],61:[function(e,t,r){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],62:[function(e,t,r){"use strict";var i=e("../utils/common");var n=4;var a=0;var s=1;var o=2;function f(e){var t=e.length;while(--t>=0){e[t]=0}}var l=0;var u=1;var c=2;var p=3;var d=258;var h=29;var m=256;var v=m+1+h;var g=30;var _=19;var y=2*v+1;var b=15;var w=16;var x=7;var k=256;var S=16;var E=17;var A=18;var T=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];var I=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];var U=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];var L=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];var B=512;var z=new Array((v+2)*2);f(z);var C=new Array(g*2);f(C);var R=new Array(B);f(R);var F=new Array(d-p+1);f(F);var O=new Array(h);f(O);var M=new Array(g);f(M);var N=function(e,t,r,i,n){this.static_tree=e;this.extra_bits=t;this.extra_base=r;this.elems=i;this.max_length=n;this.has_stree=e&&e.length};var D;var P;var j;var H=function(e,t){this.dyn_tree=e;this.max_code=0;this.stat_desc=t};function q(e){return e<256?R[e]:R[256+(e>>>7)]}function G(e,t){e.pending_buf[e.pending++]=t&255;e.pending_buf[e.pending++]=t>>>8&255}function W(e,t,r){if(e.bi_valid>w-r){e.bi_buf|=t<<e.bi_valid&65535;G(e,e.bi_buf);e.bi_buf=t>>w-e.bi_valid;e.bi_valid+=r-w}else{e.bi_buf|=t<<e.bi_valid&65535;e.bi_valid+=r}}function Z(e,t,r){W(e,r[t*2],r[t*2+1])}function V(e,t){var r=0;do{r|=e&1;e>>>=1;r<<=1}while(--t>0);return r>>>1}function Y(e){if(e.bi_valid===16){G(e,e.bi_buf);e.bi_buf=0;e.bi_valid=0}else if(e.bi_valid>=8){e.pending_buf[e.pending++]=e.bi_buf&255;e.bi_buf>>=8;e.bi_valid-=8}}function K(e,t){var r=t.dyn_tree;var i=t.max_code;var n=t.stat_desc.static_tree;var a=t.stat_desc.has_stree;var s=t.stat_desc.extra_bits;var o=t.stat_desc.extra_base;var f=t.stat_desc.max_length;var l;var u,c;var p;var d;var h;var m=0;for(p=0;p<=b;p++){e.bl_count[p]=0}r[e.heap[e.heap_max]*2+1]=0;for(l=e.heap_max+1;l<y;l++){u=e.heap[l];p=r[r[u*2+1]*2+1]+1;if(p>f){p=f;m++}r[u*2+1]=p;if(u>i){continue}e.bl_count[p]++;d=0;if(u>=o){d=s[u-o]}h=r[u*2];e.opt_len+=h*(p+d);if(a){e.static_len+=h*(n[u*2+1]+d)}}if(m===0){return}do{p=f-1;while(e.bl_count[p]===0){p--}e.bl_count[p]--;e.bl_count[p+1]+=2;e.bl_count[f]--;m-=2}while(m>0);for(p=f;p!==0;p--){u=e.bl_count[p];while(u!==0){c=e.heap[--l];if(c>i){continue}if(r[c*2+1]!==p){e.opt_len+=(p-r[c*2+1])*r[c*2];r[c*2+1]=p}u--}}}function $(e,t,r){var i=new Array(b+1);var n=0;var a;var s;for(a=1;a<=b;a++){i[a]=n=n+r[a-1]<<1}for(s=0;s<=t;s++){var o=e[s*2+1];if(o===0){continue}e[s*2]=V(i[o]++,o)}}function X(){var e;var t;var r;var i;var n;var a=new Array(b+1);r=0;for(i=0;i<h-1;i++){O[i]=r;for(e=0;e<1<<T[i];e++){F[r++]=i}}F[r-1]=i;n=0;for(i=0;i<16;i++){M[i]=n;for(e=0;e<1<<I[i];e++){R[n++]=i}}n>>=7;for(;i<g;i++){M[i]=n<<7;for(e=0;e<1<<I[i]-7;e++){R[256+n++]=i}}for(t=0;t<=b;t++){a[t]=0}e=0;while(e<=143){z[e*2+1]=8;e++;a[8]++}while(e<=255){z[e*2+1]=9;e++;a[9]++}while(e<=279){z[e*2+1]=7;e++;a[7]++}while(e<=287){z[e*2+1]=8;e++;a[8]++}$(z,v+1,a);for(e=0;e<g;e++){C[e*2+1]=5;C[e*2]=V(e,5)}D=new N(z,T,m+1,v,b);P=new N(C,I,0,g,b);j=new N(new Array(0),U,0,_,x)}function J(e){var t;for(t=0;t<v;t++){e.dyn_ltree[t*2]=0}for(t=0;t<g;t++){e.dyn_dtree[t*2]=0}for(t=0;t<_;t++){e.bl_tree[t*2]=0}e.dyn_ltree[k*2]=1;e.opt_len=e.static_len=0;e.last_lit=e.matches=0}function Q(e){if(e.bi_valid>8){G(e,e.bi_buf)}else if(e.bi_valid>0){e.pending_buf[e.pending++]=e.bi_buf}e.bi_buf=0;e.bi_valid=0}function ee(e,t,r,n){Q(e);if(n){G(e,r);G(e,~r)}i.arraySet(e.pending_buf,e.window,t,r,e.pending);e.pending+=r}function te(e,t,r,i){var n=t*2;var a=r*2;return e[n]<e[a]||e[n]===e[a]&&i[t]<=i[r]}function re(e,t,r){var i=e.heap[r];var n=r<<1;while(n<=e.heap_len){if(n<e.heap_len&&te(t,e.heap[n+1],e.heap[n],e.depth)){n++}if(te(t,i,e.heap[n],e.depth)){break}e.heap[r]=e.heap[n];r=n;n<<=1}e.heap[r]=i}function ie(e,t,r){var i;var n;var a=0;var s;var o;if(e.last_lit!==0){do{i=e.pending_buf[e.d_buf+a*2]<<8|e.pending_buf[e.d_buf+a*2+1];n=e.pending_buf[e.l_buf+a];a++;if(i===0){Z(e,n,t)}else{s=F[n];Z(e,s+m+1,t);o=T[s];if(o!==0){n-=O[s];W(e,n,o)}i--;s=q(i);Z(e,s,r);o=I[s];if(o!==0){i-=M[s];W(e,i,o)}}}while(a<e.last_lit)}Z(e,k,t)}function ne(e,t){var r=t.dyn_tree;var i=t.stat_desc.static_tree;var n=t.stat_desc.has_stree;var a=t.stat_desc.elems;var s,o;var f=-1;var l;e.heap_len=0;e.heap_max=y;for(s=0;s<a;s++){if(r[s*2]!==0){e.heap[++e.heap_len]=f=s;e.depth[s]=0}else{r[s*2+1]=0}}while(e.heap_len<2){l=e.heap[++e.heap_len]=f<2?++f:0;r[l*2]=1;e.depth[l]=0;e.opt_len--;if(n){e.static_len-=i[l*2+1]}}t.max_code=f;for(s=e.heap_len>>1;s>=1;s--){re(e,r,s)}l=a;do{s=e.heap[1];e.heap[1]=e.heap[e.heap_len--];re(e,r,1);o=e.heap[1];e.heap[--e.heap_max]=s;e.heap[--e.heap_max]=o;r[l*2]=r[s*2]+r[o*2];e.depth[l]=(e.depth[s]>=e.depth[o]?e.depth[s]:e.depth[o])+1;r[s*2+1]=r[o*2+1]=l;e.heap[1]=l++;re(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1];K(e,t);$(r,f,e.bl_count)}function ae(e,t,r){var i;var n=-1;var a;var s=t[0*2+1];var o=0;var f=7;var l=4;if(s===0){f=138;l=3}t[(r+1)*2+1]=65535;for(i=0;i<=r;i++){a=s;s=t[(i+1)*2+1];if(++o<f&&a===s){continue}else if(o<l){e.bl_tree[a*2]+=o}else if(a!==0){if(a!==n){e.bl_tree[a*2]++}e.bl_tree[S*2]++}else if(o<=10){e.bl_tree[E*2]++}else{e.bl_tree[A*2]++}o=0;n=a;if(s===0){f=138;l=3}else if(a===s){f=6;l=3}else{f=7;l=4}}}function se(e,t,r){var i;var n=-1;var a;var s=t[0*2+1];var o=0;var f=7;var l=4;if(s===0){f=138;l=3}for(i=0;i<=r;i++){a=s;s=t[(i+1)*2+1];if(++o<f&&a===s){continue}else if(o<l){do{Z(e,a,e.bl_tree)}while(--o!==0)}else if(a!==0){if(a!==n){Z(e,a,e.bl_tree);o--}Z(e,S,e.bl_tree);W(e,o-3,2)}else if(o<=10){Z(e,E,e.bl_tree);W(e,o-3,3)}else{Z(e,A,e.bl_tree);W(e,o-11,7)}o=0;n=a;if(s===0){f=138;l=3}else if(a===s){f=6;l=3}else{f=7;l=4}}}function oe(e){var t;ae(e,e.dyn_ltree,e.l_desc.max_code);ae(e,e.dyn_dtree,e.d_desc.max_code);ne(e,e.bl_desc);for(t=_-1;t>=3;t--){if(e.bl_tree[L[t]*2+1]!==0){break}}e.opt_len+=3*(t+1)+5+5+4;return t}function fe(e,t,r,i){var n;W(e,t-257,5);W(e,r-1,5);W(e,i-4,4);for(n=0;n<i;n++){W(e,e.bl_tree[L[n]*2+1],3)}se(e,e.dyn_ltree,t-1);se(e,e.dyn_dtree,r-1)}function le(e){var t=4093624447;var r;for(r=0;r<=31;r++,t>>>=1){if(t&1&&e.dyn_ltree[r*2]!==0){return a}}if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0){return s}for(r=32;r<m;r++){if(e.dyn_ltree[r*2]!==0){return s}}return a}var ue=false;function ce(e){if(!ue){X();ue=true}e.l_desc=new H(e.dyn_ltree,D);e.d_desc=new H(e.dyn_dtree,P);e.bl_desc=new H(e.bl_tree,j);e.bi_buf=0;e.bi_valid=0;J(e)}function pe(e,t,r,i){W(e,(l<<1)+(i?1:0),3);ee(e,t,r,true)}function de(e){W(e,u<<1,3);Z(e,k,z);Y(e)}function he(e,t,r,i){var a,s;var f=0;if(e.level>0){if(e.strm.data_type===o){e.strm.data_type=le(e)}ne(e,e.l_desc);ne(e,e.d_desc);f=oe(e);a=e.opt_len+3+7>>>3;s=e.static_len+3+7>>>3;if(s<=a){a=s}}else{a=s=r+5}if(r+4<=a&&t!==-1){pe(e,t,r,i)}else if(e.strategy===n||s===a){W(e,(u<<1)+(i?1:0),3);ie(e,z,C)}else{W(e,(c<<1)+(i?1:0),3);fe(e,e.l_desc.max_code+1,e.d_desc.max_code+1,f+1);ie(e,e.dyn_ltree,e.dyn_dtree)}J(e);if(i){Q(e)}}function me(e,t,r){e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255;e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255;e.pending_buf[e.l_buf+e.last_lit]=r&255;e.last_lit++;if(t===0){e.dyn_ltree[r*2]++}else{e.matches++;t--;e.dyn_ltree[(F[r]+m+1)*2]++;e.dyn_dtree[q(t)*2]++}return e.last_lit===e.lit_bufsize-1}r._tr_init=ce;r._tr_stored_block=pe;r._tr_flush_block=he;r._tr_tally=me;r._tr_align=de},{"../utils/common":53}],63:[function(e,t,r){"use strict";function i(){this.input=null;this.next_in=0;this.avail_in=0;this.total_in=0;this.output=null;this.next_out=0;this.avail_out=0;this.total_out=0;this.msg="";this.state=null;this.data_type=2;this.adler=0}t.exports=i},{}],64:[function(e,t,r){(function(t,i){var n=e("pako/lib/zlib/messages");var a=e("pako/lib/zlib/zstream");var s=e("pako/lib/zlib/deflate.js");var o=e("pako/lib/zlib/inflate.js");var f=e("pako/lib/zlib/constants");for(var l in f){r[l]=f[l]}r.NONE=0;r.DEFLATE=1;r.INFLATE=2;r.GZIP=3;r.GUNZIP=4;r.DEFLATERAW=5;r.INFLATERAW=6;r.UNZIP=7;function u(e){if(e<r.DEFLATE||e>r.UNZIP)throw new TypeError("Bad argument");this.mode=e;this.init_done=false;this.write_in_progress=false;this.pending_close=false;this.windowBits=0;this.level=0;this.memLevel=0;this.strategy=0;this.dictionary=null}u.prototype.init=function(e,t,i,n,f){this.windowBits=e;this.level=t;this.memLevel=i;this.strategy=n;if(this.mode===r.GZIP||this.mode===r.GUNZIP)this.windowBits+=16;if(this.mode===r.UNZIP)this.windowBits+=32;if(this.mode===r.DEFLATERAW||this.mode===r.INFLATERAW)this.windowBits=-this.windowBits;this.strm=new a;switch(this.mode){case r.DEFLATE:case r.GZIP:case r.DEFLATERAW:var l=s.deflateInit2(this.strm,this.level,r.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case r.INFLATE:case r.GUNZIP:case r.INFLATERAW:case r.UNZIP:var l=o.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}if(l!==r.Z_OK){this._error(l);return}this.write_in_progress=false;this.init_done=true};u.prototype.params=function(){throw new Error("deflateParams Not supported")};u.prototype._writeCheck=function(){if(!this.init_done)throw new Error("write before init");if(this.mode===r.NONE)throw new Error("already finalized");if(this.write_in_progress)throw new Error("write already in progress");if(this.pending_close)throw new Error("close is pending")};u.prototype.write=function(e,r,i,n,a,s,o){this._writeCheck();this.write_in_progress=true;var f=this;t.nextTick(function(){f.write_in_progress=false;var t=f._write(e,r,i,n,a,s,o);f.callback(t[0],t[1]);if(f.pending_close)f.close()});return this};function c(e,t){for(var r=0;r<e.length;r++){this[t+r]=e[r]}}u.prototype.writeSync=function(e,t,r,i,n,a,s){this._writeCheck();return this._write(e,t,r,i,n,a,s)};u.prototype._write=function(e,t,n,a,f,l,u){this.write_in_progress=true;if(e!==r.Z_NO_FLUSH&&e!==r.Z_PARTIAL_FLUSH&&e!==r.Z_SYNC_FLUSH&&e!==r.Z_FULL_FLUSH&&e!==r.Z_FINISH&&e!==r.Z_BLOCK){throw new Error("Invalid flush value")}if(t==null){t=new i(0);a=0;n=0}if(f._set)f.set=f._set;else f.set=c;var p=this.strm;p.avail_in=a;p.input=t;p.next_in=n;p.avail_out=u;p.output=f;p.next_out=l;switch(this.mode){case r.DEFLATE:case r.GZIP:case r.DEFLATERAW:var d=s.deflate(p,e);break;case r.UNZIP:case r.INFLATE:case r.GUNZIP:case r.INFLATERAW:var d=o.inflate(p,e);break;default:throw new Error("Unknown mode "+this.mode)}if(d!==r.Z_STREAM_END&&d!==r.Z_OK){this._error(d)}this.write_in_progress=false;return[p.avail_in,p.avail_out]};u.prototype.close=function(){if(this.write_in_progress){this.pending_close=true;return}this.pending_close=false;if(this.mode===r.DEFLATE||this.mode===r.GZIP||this.mode===r.DEFLATERAW){s.deflateEnd(this.strm)}else{o.inflateEnd(this.strm)}this.mode=r.NONE};u.prototype.reset=function(){switch(this.mode){case r.DEFLATE:case r.DEFLATERAW:var e=s.deflateReset(this.strm);break;case r.INFLATE:case r.INFLATERAW:var e=o.inflateReset(this.strm);break}if(e!==r.Z_OK){this._error(e)}};u.prototype._error=function(e){this.onerror(n[e]+": "+this.strm.msg,e);this.write_in_progress=false;if(this.pending_close)this.close()};r.Zlib=u}).call(this,e("_process"),e("buffer").Buffer)},{_process:78,buffer:66,"pako/lib/zlib/constants":55,"pako/lib/zlib/deflate.js":57,"pako/lib/zlib/inflate.js":59,"pako/lib/zlib/messages":61,"pako/lib/zlib/zstream":63}],65:[function(e,t,r){(function(t,i){var n=e("_stream_transform");var a=e("./binding");var s=e("util");var o=e("assert").ok;a.Z_MIN_WINDOWBITS=8;a.Z_MAX_WINDOWBITS=15;a.Z_DEFAULT_WINDOWBITS=15;a.Z_MIN_CHUNK=64;a.Z_MAX_CHUNK=Infinity;a.Z_DEFAULT_CHUNK=16*1024;a.Z_MIN_MEMLEVEL=1;a.Z_MAX_MEMLEVEL=9;a.Z_DEFAULT_MEMLEVEL=8;a.Z_MIN_LEVEL=-1;a.Z_MAX_LEVEL=9;a.Z_DEFAULT_LEVEL=a.Z_DEFAULT_COMPRESSION;Object.keys(a).forEach(function(e){if(e.match(/^Z/))r[e]=a[e]});r.codes={Z_OK:a.Z_OK,Z_STREAM_END:a.Z_STREAM_END,Z_NEED_DICT:a.Z_NEED_DICT,Z_ERRNO:a.Z_ERRNO,Z_STREAM_ERROR:a.Z_STREAM_ERROR,Z_DATA_ERROR:a.Z_DATA_ERROR,Z_MEM_ERROR:a.Z_MEM_ERROR,Z_BUF_ERROR:a.Z_BUF_ERROR,Z_VERSION_ERROR:a.Z_VERSION_ERROR};Object.keys(r.codes).forEach(function(e){r.codes[r.codes[e]]=e});r.Deflate=u;r.Inflate=c;r.Gzip=p;r.Gunzip=d;r.DeflateRaw=h;r.InflateRaw=m;r.Unzip=v;r.createDeflate=function(e){return new u(e)};r.createInflate=function(e){return new c(e)};r.createDeflateRaw=function(e){return new h(e)};r.createInflateRaw=function(e){return new m(e)};r.createGzip=function(e){return new p(e)};r.createGunzip=function(e){return new d(e)};r.createUnzip=function(e){return new v(e)};r.deflate=function(e,t,r){if(typeof t==="function"){r=t;t={}}return f(new u(t),e,r)};r.deflateSync=function(e,t){return l(new u(t),e)};r.gzip=function(e,t,r){if(typeof t==="function"){r=t;t={}}return f(new p(t),e,r)};r.gzipSync=function(e,t){return l(new p(t),e)};r.deflateRaw=function(e,t,r){if(typeof t==="function"){r=t;t={}}return f(new h(t),e,r)};r.deflateRawSync=function(e,t){return l(new h(t),e)};r.unzip=function(e,t,r){if(typeof t==="function"){r=t;t={}}return f(new v(t),e,r)};r.unzipSync=function(e,t){return l(new v(t),e)};r.inflate=function(e,t,r){if(typeof t==="function"){r=t;t={}}return f(new c(t),e,r)};r.inflateSync=function(e,t){return l(new c(t),e)};r.gunzip=function(e,t,r){if(typeof t==="function"){r=t;t={}}return f(new d(t),e,r)};r.gunzipSync=function(e,t){return l(new d(t),e)};r.inflateRaw=function(e,t,r){if(typeof t==="function"){r=t;t={}}return f(new m(t),e,r)};r.inflateRawSync=function(e,t){return l(new m(t),e)};function f(e,t,r){var n=[];var a=0;e.on("error",o);e.on("end",f);e.end(t);s();function s(){var t;while(null!==(t=e.read())){n.push(t);a+=t.length}e.once("readable",s)}function o(t){e.removeListener("end",f);e.removeListener("readable",s);r(t)}function f(){var t=i.concat(n,a);n=[];r(null,t);e.close()}}function l(e,t){if(typeof t==="string")t=new i(t);if(!i.isBuffer(t))throw new TypeError("Not a string or buffer");var r=a.Z_FINISH;return e._processChunk(t,r)}function u(e){if(!(this instanceof u))return new u(e);g.call(this,e,a.DEFLATE)}function c(e){if(!(this instanceof c))return new c(e);g.call(this,e,a.INFLATE)}function p(e){if(!(this instanceof p))return new p(e);g.call(this,e,a.GZIP)}function d(e){if(!(this instanceof d))return new d(e);g.call(this,e,a.GUNZIP)}function h(e){if(!(this instanceof h))return new h(e);g.call(this,e,a.DEFLATERAW)}function m(e){if(!(this instanceof m))return new m(e);g.call(this,e,a.INFLATERAW)}function v(e){if(!(this instanceof v))return new v(e);g.call(this,e,a.UNZIP)}function g(e,t){this._opts=e=e||{};this._chunkSize=e.chunkSize||r.Z_DEFAULT_CHUNK;n.call(this,e);if(e.flush){if(e.flush!==a.Z_NO_FLUSH&&e.flush!==a.Z_PARTIAL_FLUSH&&e.flush!==a.Z_SYNC_FLUSH&&e.flush!==a.Z_FULL_FLUSH&&e.flush!==a.Z_FINISH&&e.flush!==a.Z_BLOCK){throw new Error("Invalid flush flag: "+e.flush)}}this._flushFlag=e.flush||a.Z_NO_FLUSH;if(e.chunkSize){if(e.chunkSize<r.Z_MIN_CHUNK||e.chunkSize>r.Z_MAX_CHUNK){throw new Error("Invalid chunk size: "+e.chunkSize)}}if(e.windowBits){if(e.windowBits<r.Z_MIN_WINDOWBITS||e.windowBits>r.Z_MAX_WINDOWBITS){throw new Error("Invalid windowBits: "+e.windowBits)}}if(e.level){if(e.level<r.Z_MIN_LEVEL||e.level>r.Z_MAX_LEVEL){throw new Error("Invalid compression level: "+e.level)}}if(e.memLevel){if(e.memLevel<r.Z_MIN_MEMLEVEL||e.memLevel>r.Z_MAX_MEMLEVEL){throw new Error("Invalid memLevel: "+e.memLevel)}}if(e.strategy){if(e.strategy!=r.Z_FILTERED&&e.strategy!=r.Z_HUFFMAN_ONLY&&e.strategy!=r.Z_RLE&&e.strategy!=r.Z_FIXED&&e.strategy!=r.Z_DEFAULT_STRATEGY){throw new Error("Invalid strategy: "+e.strategy)}}if(e.dictionary){if(!i.isBuffer(e.dictionary)){throw new Error("Invalid dictionary: it should be a Buffer instance")}}this._binding=new a.Zlib(t);var s=this;this._hadError=false;this._binding.onerror=function(e,t){s._binding=null;s._hadError=true;var i=new Error(e);i.errno=t;i.code=r.codes[t];s.emit("error",i)};var o=r.Z_DEFAULT_COMPRESSION;if(typeof e.level==="number")o=e.level;var f=r.Z_DEFAULT_STRATEGY;if(typeof e.strategy==="number")f=e.strategy;this._binding.init(e.windowBits||r.Z_DEFAULT_WINDOWBITS,o,e.memLevel||r.Z_DEFAULT_MEMLEVEL,f,e.dictionary);this._buffer=new i(this._chunkSize);this._offset=0;this._closed=false;this._level=o;this._strategy=f;this.once("end",this.close)}s.inherits(g,n);g.prototype.params=function(e,i,n){if(e<r.Z_MIN_LEVEL||e>r.Z_MAX_LEVEL){throw new RangeError("Invalid compression level: "+e)}if(i!=r.Z_FILTERED&&i!=r.Z_HUFFMAN_ONLY&&i!=r.Z_RLE&&i!=r.Z_FIXED&&i!=r.Z_DEFAULT_STRATEGY){throw new TypeError("Invalid strategy: "+i)}if(this._level!==e||this._strategy!==i){var s=this;this.flush(a.Z_SYNC_FLUSH,function(){s._binding.params(e,i);if(!s._hadError){s._level=e;s._strategy=i;if(n)n()}})}else{t.nextTick(n)}};g.prototype.reset=function(){return this._binding.reset()};g.prototype._flush=function(e){this._transform(new i(0),"",e)};g.prototype.flush=function(e,r){var n=this._writableState;if(typeof e==="function"||e===void 0&&!r){r=e;e=a.Z_FULL_FLUSH}if(n.ended){if(r)t.nextTick(r)}else if(n.ending){if(r)this.once("end",r)}else if(n.needDrain){var s=this;this.once("drain",function(){s.flush(r)})}else{this._flushFlag=e;this.write(new i(0),"",r)}};g.prototype.close=function(e){if(e)t.nextTick(e);if(this._closed)return;this._closed=true;this._binding.close();var r=this;t.nextTick(function(){r.emit("close")})};g.prototype._transform=function(e,t,r){var n;var s=this._writableState;var o=s.ending||s.ended;var f=o&&(!e||s.length===e.length);if(!e===null&&!i.isBuffer(e))return r(new Error("invalid input"));if(f)n=a.Z_FINISH;else{n=this._flushFlag;if(e.length>=s.length){this._flushFlag=this._opts.flush||a.Z_NO_FLUSH}}var l=this;this._processChunk(e,n,r)};g.prototype._processChunk=function(e,t,r){var n=e&&e.length;var a=this._chunkSize-this._offset;var s=0;var f=this;var l=typeof r==="function";if(!l){var u=[];var c=0;var p;this.on("error",function(e){p=e});do{var d=this._binding.writeSync(t,e,s,n,this._buffer,this._offset,a)}while(!this._hadError&&v(d[0],d[1]));if(this._hadError){throw p}var h=i.concat(u,c);this.close();return h}var m=this._binding.write(t,e,s,n,this._buffer,this._offset,a);m.buffer=e;m.callback=v;function v(p,d){if(f._hadError)return;var h=a-d;o(h>=0,"have should not go down");if(h>0){var m=f._buffer.slice(f._offset,f._offset+h);f._offset+=h;if(l){f.push(m)}else{u.push(m);c+=m.length}}if(d===0||f._offset>=f._chunkSize){a=f._chunkSize;f._offset=0;f._buffer=new i(f._chunkSize)}if(d===0){s+=n-p;n=p;if(!l)return true;var g=f._binding.write(t,e,s,n,f._buffer,f._offset,f._chunkSize);g.callback=v;g.buffer=e;return}if(!l)return false;r()}};s.inherits(u,g);s.inherits(c,g);s.inherits(p,g);s.inherits(d,g);s.inherits(h,g);s.inherits(m,g);s.inherits(v,g)}).call(this,e("_process"),e("buffer").Buffer)},{"./binding":64,_process:78,_stream_transform:92,assert:51,buffer:66,util:98}],66:[function(e,t,r){var i=e("base64-js");var n=e("ieee754");var a=e("is-array");r.Buffer=f;r.SlowBuffer=y;r.INSPECT_MAX_BYTES=50;f.poolSize=8192;var s=1073741823;var o={};f.TYPED_ARRAY_SUPPORT=function(){try{var e=new ArrayBuffer(0);var t=new Uint8Array(e);t.foo=function(){return 42};return t.foo()===42&&typeof t.subarray==="function"&&new Uint8Array(1).subarray(1,1).byteLength===0}catch(r){return false}}();function f(e){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 l(this,e)}if(typeof e==="string"){return u(this,e,arguments.length>1?arguments[1]:"utf8")}return c(this,e)}function l(e,t){e=g(e,t<0?0:_(t)|0);if(!f.TYPED_ARRAY_SUPPORT){for(var r=0;r<t;r++){e[r]=0}}return e}function u(e,t,r){if(typeof r!=="string"||r==="")r="utf8";var i=b(t,r)|0;e=g(e,i);e.write(t,r);return e}function c(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 r=_(t.length)|0;e=g(e,r);t.copy(e,0,0,r);return e}function d(e,t){var r=_(t.length)|0;e=g(e,r);for(var i=0;i<r;i+=1){e[i]=t[i]&255}return e}function h(e,t){var r=_(t.length)|0;e=g(e,r);for(var i=0;i<r;i+=1){e[i]=t[i]&255}return e}function m(e,t){var r=_(t.length)|0;e=g(e,r);for(var i=0;i<r;i+=1){e[i]=t[i]&255}return e}function v(e,t){var r;var i=0;if(t.type==="Buffer"&&a(t.data)){r=t.data;i=_(r.length)|0}e=g(e,i);for(var n=0;n<i;n+=1){e[n]=r[n]&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 r=t!==0&&t<=f.poolSize>>>1;if(r)e.parent=o;return e}function _(e){if(e>=s){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+s.toString(16)+" bytes")}return e|0}function y(e,t){if(!(this instanceof y))return new y(e,t);var r=new f(e,t);delete r.parent;return r}f.isBuffer=function X(e){return!!(e!=null&&e._isBuffer)};f.compare=function J(e,t){if(!f.isBuffer(e)||!f.isBuffer(t)){throw new TypeError("Arguments must be Buffers")}if(e===t)return 0;var r=e.length;var i=t.length;var n=0;var a=Math.min(r,i);while(n<a){if(e[n]!==t[n])break;++n}if(n!==a){r=e[n];i=t[n]}if(r<i)return-1;if(i<r)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 r;if(t===undefined){t=0;for(r=0;r<e.length;r++){t+=e[r].length}}var i=new f(t);var n=0;for(r=0;r<e.length;r++){var s=e[r];s.copy(i,n);n+=s.length}return i};function b(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 W(e).length;case"base64":return Y(e).length;default:return e.length}}f.byteLength=b;f.prototype.length=undefined;f.prototype.parent=undefined;f.prototype.toString=function te(e,t,r){var i=false;t=t|0;r=r===undefined||r===Infinity?this.length:r|0;if(!e)e="utf8";if(t<0)t=0;if(r>this.length)r=this.length;if(r<=t)return"";while(true){switch(e){case"hex":return B(this,t,r);case"utf8":case"utf-8":return I(this,t,r);case"ascii":return U(this,t,r);case"binary":return L(this,t,r);case"base64":return T(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase();i=true}}};f.prototype.equals=function re(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 ie(){var e="";var t=r.INSPECT_MAX_BYTES;if(this.length>0){e=this.toString("hex",0,t).match(/.{2}/g).join(" ");if(this.length>t)e+=" ... "}return"<Buffer "+e+">"};f.prototype.compare=function ne(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 r(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 r(this,[e],t)}function r(e,t,r){var i=-1;for(var n=0;r+n<e.length;n++){if(e[r+n]===t[i===-1?0:n-i]){if(i===-1)i=n;if(n-i+1===t.length)return r+i}else{i=-1}}return-1}throw new TypeError("val must be string, number or Buffer")};f.prototype.get=function se(e){console.log(".get() is deprecated. Access using array indexes instead.");return this.readUInt8(e)};f.prototype.set=function oe(e,t){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(e,t)};function w(e,t,r,i){r=Number(r)||0;var n=e.length-r;if(!i){i=n}else{i=Number(i);if(i>n){i=n}}var a=t.length;if(a%2!==0)throw new Error("Invalid hex string");if(i>a/2){i=a/2}for(var s=0;s<i;s++){var o=parseInt(t.substr(s*2,2),16);if(isNaN(o))throw new Error("Invalid hex string");e[r+s]=o}return s}function x(e,t,r,i){return K(W(t,e.length-r),e,r,i)}function k(e,t,r,i){return K(Z(t),e,r,i)}function S(e,t,r,i){return k(e,t,r,i)}function E(e,t,r,i){return K(Y(t),e,r,i)}function A(e,t,r,i){return K(V(t,e.length-r),e,r,i)}f.prototype.write=function fe(e,t,r,i){if(t===undefined){i="utf8";r=this.length;t=0}else if(r===undefined&&typeof t==="string"){i=t;r=this.length;t=0}else if(isFinite(t)){t=t|0;if(isFinite(r)){r=r|0;if(i===undefined)i="utf8"}else{i=r;r=undefined}}else{var n=i;i=t;t=r|0;r=n}var a=this.length-t;if(r===undefined||r>a)r=a;if(e.length>0&&(r<0||t<0)||t>this.length){throw new RangeError("attempt to write outside buffer bounds")}if(!i)i="utf8";var s=false;for(;;){switch(i){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return x(this,e,t,r);case"ascii":return k(this,e,t,r);case"binary":return S(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase();s=true}}};f.prototype.toJSON=function le(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,r){if(t===0&&r===e.length){return i.fromByteArray(e)}else{return i.fromByteArray(e.slice(t,r))}}function I(e,t,r){var i="";var n="";r=Math.min(e.length,r);for(var a=t;a<r;a++){if(e[a]<=127){i+=$(n)+String.fromCharCode(e[a]);n=""}else{n+="%"+e[a].toString(16)}}return i+$(n)}function U(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;n++){i+=String.fromCharCode(e[n]&127)}return i}function L(e,t,r){var i="";r=Math.min(e.length,r);for(var n=t;n<r;n++){i+=String.fromCharCode(e[n])}return i}function B(e,t,r){var i=e.length;if(!t||t<0)t=0;if(!r||r<0||r>i)r=i;var n="";for(var a=t;a<r;a++){n+=G(e[a])}return n}function z(e,t,r){var i=e.slice(t,r);var n="";for(var a=0;a<i.length;a+=2){n+=String.fromCharCode(i[a]+i[a+1]*256)}return n}f.prototype.slice=function ue(e,t){var r=this.length;e=~~e;t=t===undefined?r:~~t;if(e<0){e+=r;if(e<0)e=0}else if(e>r){e=r}if(t<0){t+=r;if(t<0)t=0}else if(t>r){t=r}if(t<e)t=e;var i;if(f.TYPED_ARRAY_SUPPORT){i=f._augment(this.subarray(e,t))}else{var n=t-e;i=new f(n,undefined);for(var a=0;a<n;a++){i[a]=this[a+e]}}if(i.length)i.parent=this.parent||this;return i};function C(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}f.prototype.readUIntLE=function ce(e,t,r){e=e|0;t=t|0;if(!r)C(e,t,this.length);var i=this[e];var n=1;var a=0;while(++a<t&&(n*=256)){i+=this[e+a]*n}return i};f.prototype.readUIntBE=function pe(e,t,r){e=e|0;t=t|0;if(!r){C(e,t,this.length)}var i=this[e+--t];var n=1;while(t>0&&(n*=256)){i+=this[e+--t]*n}return i};f.prototype.readUInt8=function de(e,t){if(!t)C(e,1,this.length);return this[e]};f.prototype.readUInt16LE=function he(e,t){if(!t)C(e,2,this.length);return this[e]|this[e+1]<<8};f.prototype.readUInt16BE=function me(e,t){if(!t)C(e,2,this.length);return this[e]<<8|this[e+1]};f.prototype.readUInt32LE=function ve(e,t){if(!t)C(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)C(e,4,this.length);return this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};f.prototype.readIntLE=function _e(e,t,r){e=e|0;t=t|0;if(!r)C(e,t,this.length);var i=this[e];var n=1;var a=0;while(++a<t&&(n*=256)){i+=this[e+a]*n}n*=128;if(i>=n)i-=Math.pow(2,8*t);return i};f.prototype.readIntBE=function ye(e,t,r){e=e|0;t=t|0;if(!r)C(e,t,this.length);var i=t;var n=1;var a=this[e+--i];while(i>0&&(n*=256)){a+=this[e+--i]*n}n*=128;if(a>=n)a-=Math.pow(2,8*t);return a};f.prototype.readInt8=function be(e,t){if(!t)C(e,1,this.length);if(!(this[e]&128))return this[e];return(255-this[e]+1)*-1};f.prototype.readInt16LE=function we(e,t){if(!t)C(e,2,this.length);var r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r};f.prototype.readInt16BE=function xe(e,t){if(!t)C(e,2,this.length);var r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r};f.prototype.readInt32LE=function ke(e,t){if(!t)C(e,4,this.length);return this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};f.prototype.readInt32BE=function Se(e,t){if(!t)C(e,4,this.length);return this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};f.prototype.readFloatLE=function Ee(e,t){if(!t)C(e,4,this.length);return n.read(this,e,true,23,4)};f.prototype.readFloatBE=function Ae(e,t){if(!t)C(e,4,this.length);return n.read(this,e,false,23,4)};f.prototype.readDoubleLE=function Te(e,t){if(!t)C(e,8,this.length);return n.read(this,e,true,52,8)};f.prototype.readDoubleBE=function Ie(e,t){if(!t)C(e,8,this.length);return n.read(this,e,false,52,8)};function R(e,t,r,i,n,a){if(!f.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(t>n||t<a)throw new RangeError("value is out of bounds");if(r+i>e.length)throw new RangeError("index out of range")}f.prototype.writeUIntLE=function Ue(e,t,r,i){e=+e;t=t|0;r=r|0;if(!i)R(this,e,t,r,Math.pow(2,8*r),0);var n=1;var a=0;this[t]=e&255;while(++a<r&&(n*=256)){this[t+a]=e/n&255}return t+r};f.prototype.writeUIntBE=function Le(e,t,r,i){e=+e;t=t|0;r=r|0;if(!i)R(this,e,t,r,Math.pow(2,8*r),0);var n=r-1;var a=1;this[t+n]=e&255;while(--n>=0&&(a*=256)){this[t+n]=e/a&255}return t+r};f.prototype.writeUInt8=function Be(e,t,r){e=+e;t=t|0;if(!r)R(this,e,t,1,255,0);if(!f.TYPED_ARRAY_SUPPORT)e=Math.floor(e);this[t]=e;return t+1};function F(e,t,r,i){if(t<0)t=65535+t+1;for(var n=0,a=Math.min(e.length-r,2);n<a;n++){e[r+n]=(t&255<<8*(i?n:1-n))>>>(i?n:1-n)*8}}f.prototype.writeUInt16LE=function ze(e,t,r){e=+e;t=t|0;if(!r)R(this,e,t,2,65535,0);if(f.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8}else{F(this,e,t,true)}return t+2};f.prototype.writeUInt16BE=function Ce(e,t,r){e=+e;t=t|0;if(!r)R(this,e,t,2,65535,0);if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>8;this[t+1]=e}else{F(this,e,t,false)}return t+2};function O(e,t,r,i){if(t<0)t=4294967295+t+1;for(var n=0,a=Math.min(e.length-r,4);n<a;n++){e[r+n]=t>>>(i?n:3-n)*8&255}}f.prototype.writeUInt32LE=function Re(e,t,r){e=+e;t=t|0;if(!r)R(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 Fe(e,t,r){e=+e;t=t|0;if(!r)R(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,r,i){e=+e;t=t|0;if(!i){var n=Math.pow(2,8*r-1);R(this,e,t,r,n-1,-n)}var a=0;var s=1;var o=e<0?1:0;this[t]=e&255;while(++a<r&&(s*=256)){this[t+a]=(e/s>>0)-o&255}return t+r};f.prototype.writeIntBE=function Me(e,t,r,i){e=+e;t=t|0;if(!i){var n=Math.pow(2,8*r-1);R(this,e,t,r,n-1,-n)}var a=r-1;var s=1;var o=e<0?1:0;this[t+a]=e&255;while(--a>=0&&(s*=256)){this[t+a]=(e/s>>0)-o&255}return t+r};f.prototype.writeInt8=function Ne(e,t,r){e=+e;t=t|0;if(!r)R(this,e,t,1,127,-128);if(!f.TYPED_ARRAY_SUPPORT)e=Math.floor(e);if(e<0)e=255+e+1;this[t]=e;return t+1};f.prototype.writeInt16LE=function De(e,t,r){e=+e;t=t|0;if(!r)R(this,e,t,2,32767,-32768);if(f.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8}else{F(this,e,t,true)}return t+2;
-};f.prototype.writeInt16BE=function Pe(e,t,r){e=+e;t=t|0;if(!r)R(this,e,t,2,32767,-32768);if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>8;this[t+1]=e}else{F(this,e,t,false)}return t+2};f.prototype.writeInt32LE=function je(e,t,r){e=+e;t=t|0;if(!r)R(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 He(e,t,r){e=+e;t=t|0;if(!r)R(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 M(e,t,r,i,n,a){if(t>n||t<a)throw new RangeError("value is out of bounds");if(r+i>e.length)throw new RangeError("index out of range");if(r<0)throw new RangeError("index out of range")}function N(e,t,r,i,a){if(!a){M(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38)}n.write(e,t,r,i,23,4);return r+4}f.prototype.writeFloatLE=function qe(e,t,r){return N(this,e,t,true,r)};f.prototype.writeFloatBE=function Ge(e,t,r){return N(this,e,t,false,r)};function D(e,t,r,i,a){if(!a){M(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308)}n.write(e,t,r,i,52,8);return r+8}f.prototype.writeDoubleLE=function We(e,t,r){return D(this,e,t,true,r)};f.prototype.writeDoubleBE=function Ze(e,t,r){return D(this,e,t,false,r)};f.prototype.copy=function Ve(e,t,r,i){if(!r)r=0;if(!i&&i!==0)i=this.length;if(t>=e.length)t=e.length;if(!t)t=0;if(i>0&&i<r)i=r;if(i===r)return 0;if(e.length===0||this.length===0)return 0;if(t<0){throw new RangeError("targetStart out of bounds")}if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");if(i>this.length)i=this.length;if(e.length-t<i-r){i=e.length-t+r}var n=i-r;if(n<1e3||!f.TYPED_ARRAY_SUPPORT){for(var a=0;a<n;a++){e[a+t]=this[a+r]}}else{e._set(this.subarray(r,r+n),t)}return n};f.prototype.fill=function Ye(e,t,r){if(!e)e=0;if(!t)t=0;if(!r)r=this.length;if(r<t)throw new RangeError("end < start");if(r===t)return;if(this.length===0)return;if(t<0||t>=this.length)throw new RangeError("start out of bounds");if(r<0||r>this.length)throw new RangeError("end out of bounds");var i;if(typeof e==="number"){for(i=t;i<r;i++){this[i]=e}}else{var n=W(e.toString());var a=n.length;for(i=t;i<r;i++){this[i]=n[i%a]}}return this};f.prototype.toArrayBuffer=function Ke(){if(typeof Uint8Array!=="undefined"){if(f.TYPED_ARRAY_SUPPORT){return new f(this).buffer}else{var e=new Uint8Array(this.length);for(var t=0,r=e.length;t<r;t+=1){e[t]=this[t]}return e.buffer}}else{throw new TypeError("Buffer.toArrayBuffer not supported in this browser")}};var P=f.prototype;f._augment=function $e(e){e.constructor=f;e._isBuffer=true;e._set=e.set;e.get=P.get;e.set=P.set;e.write=P.write;e.toString=P.toString;e.toLocaleString=P.toString;e.toJSON=P.toJSON;e.equals=P.equals;e.compare=P.compare;e.indexOf=P.indexOf;e.copy=P.copy;e.slice=P.slice;e.readUIntLE=P.readUIntLE;e.readUIntBE=P.readUIntBE;e.readUInt8=P.readUInt8;e.readUInt16LE=P.readUInt16LE;e.readUInt16BE=P.readUInt16BE;e.readUInt32LE=P.readUInt32LE;e.readUInt32BE=P.readUInt32BE;e.readIntLE=P.readIntLE;e.readIntBE=P.readIntBE;e.readInt8=P.readInt8;e.readInt16LE=P.readInt16LE;e.readInt16BE=P.readInt16BE;e.readInt32LE=P.readInt32LE;e.readInt32BE=P.readInt32BE;e.readFloatLE=P.readFloatLE;e.readFloatBE=P.readFloatBE;e.readDoubleLE=P.readDoubleLE;e.readDoubleBE=P.readDoubleBE;e.writeUInt8=P.writeUInt8;e.writeUIntLE=P.writeUIntLE;e.writeUIntBE=P.writeUIntBE;e.writeUInt16LE=P.writeUInt16LE;e.writeUInt16BE=P.writeUInt16BE;e.writeUInt32LE=P.writeUInt32LE;e.writeUInt32BE=P.writeUInt32BE;e.writeIntLE=P.writeIntLE;e.writeIntBE=P.writeIntBE;e.writeInt8=P.writeInt8;e.writeInt16LE=P.writeInt16LE;e.writeInt16BE=P.writeInt16BE;e.writeInt32LE=P.writeInt32LE;e.writeInt32BE=P.writeInt32BE;e.writeFloatLE=P.writeFloatLE;e.writeFloatBE=P.writeFloatBE;e.writeDoubleLE=P.writeDoubleLE;e.writeDoubleBE=P.writeDoubleBE;e.fill=P.fill;e.inspect=P.inspect;e.toArrayBuffer=P.toArrayBuffer;return e};var j=/[^+\/0-9A-z\-]/g;function H(e){e=q(e).replace(j,"");if(e.length<2)return"";while(e.length%4!==0){e=e+"="}return e}function q(e){if(e.trim)return e.trim();return e.replace(/^\s+|\s+$/g,"")}function G(e){if(e<16)return"0"+e.toString(16);return e.toString(16)}function W(e,t){t=t||Infinity;var r;var i=e.length;var n=null;var a=[];var s=0;for(;s<i;s++){r=e.charCodeAt(s);if(r>55295&&r<57344){if(n){if(r<56320){if((t-=3)>-1)a.push(239,191,189);n=r;continue}else{r=n-55296<<10|r-56320|65536;n=null}}else{if(r>56319){if((t-=3)>-1)a.push(239,191,189);continue}else if(s+1===i){if((t-=3)>-1)a.push(239,191,189);continue}else{n=r;continue}}}else if(n){if((t-=3)>-1)a.push(239,191,189);n=null}if(r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<2097152){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else{throw new Error("Invalid code point")}}return a}function Z(e){var t=[];for(var r=0;r<e.length;r++){t.push(e.charCodeAt(r)&255)}return t}function V(e,t){var r,i,n;var a=[];for(var s=0;s<e.length;s++){if((t-=2)<0)break;r=e.charCodeAt(s);i=r>>8;n=r%256;a.push(n);a.push(i)}return a}function Y(e){return i.toByteArray(H(e))}function K(e,t,r,i){for(var n=0;n<i;n++){if(n+r>=t.length||n>=e.length)break;t[n+r]=e[n]}return n}function $(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}},{"base64-js":67,ieee754:68,"is-array":69}],67:[function(e,t,r){var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(e){"use strict";var t=typeof Uint8Array!=="undefined"?Uint8Array:Array;var r="+".charCodeAt(0);var n="/".charCodeAt(0);var a="0".charCodeAt(0);var s="a".charCodeAt(0);var o="A".charCodeAt(0);var f="-".charCodeAt(0);var l="_".charCodeAt(0);function u(e){var t=e.charCodeAt(0);if(t===r||t===f)return 62;if(t===n||t===l)return 63;if(t<a)return-1;if(t<a+10)return t-a+26+26;if(t<o+26)return t-o;if(t<s+26)return t-s+26}function c(e){var r,i,n,a,s,o;if(e.length%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var f=e.length;s="="===e.charAt(f-2)?2:"="===e.charAt(f-1)?1:0;o=new t(e.length*3/4-s);n=s>0?e.length-4:e.length;var l=0;function c(e){o[l++]=e}for(r=0,i=0;r<n;r+=4,i+=3){a=u(e.charAt(r))<<18|u(e.charAt(r+1))<<12|u(e.charAt(r+2))<<6|u(e.charAt(r+3));c((a&16711680)>>16);c((a&65280)>>8);c(a&255)}if(s===2){a=u(e.charAt(r))<<2|u(e.charAt(r+1))>>4;c(a&255)}else if(s===1){a=u(e.charAt(r))<<10|u(e.charAt(r+1))<<4|u(e.charAt(r+2))>>2;c(a>>8&255);c(a&255)}return o}function p(e){var t,r=e.length%3,n="",a,s;function o(e){return i.charAt(e)}function f(e){return o(e>>18&63)+o(e>>12&63)+o(e>>6&63)+o(e&63)}for(t=0,s=e.length-r;t<s;t+=3){a=(e[t]<<16)+(e[t+1]<<8)+e[t+2];n+=f(a)}switch(r){case 1:a=e[e.length-1];n+=o(a>>2);n+=o(a<<4&63);n+="==";break;case 2:a=(e[e.length-2]<<8)+e[e.length-1];n+=o(a>>10);n+=o(a>>4&63);n+=o(a<<2&63);n+="=";break}return n}e.toByteArray=c;e.fromByteArray=p})(typeof r==="undefined"?this.base64js={}:r)},{}],68:[function(e,t,r){r.read=function(e,t,r,i,n){var a,s;var o=n*8-i-1;var f=(1<<o)-1;var l=f>>1;var u=-7;var c=r?n-1:0;var p=r?-1:1;var d=e[t+c];c+=p;a=d&(1<<-u)-1;d>>=-u;u+=o;for(;u>0;a=a*256+e[t+c],c+=p,u-=8){}s=a&(1<<-u)-1;a>>=-u;u+=i;for(;u>0;s=s*256+e[t+c],c+=p,u-=8){}if(a===0){a=1-l}else if(a===f){return s?NaN:(d?-1:1)*Infinity}else{s=s+Math.pow(2,i);a=a-l}return(d?-1:1)*s*Math.pow(2,a-i)};r.write=function(e,t,r,i,n,a){var s,o,f;var l=a*8-n-1;var u=(1<<l)-1;var c=u>>1;var p=n===23?Math.pow(2,-24)-Math.pow(2,-77):0;var d=i?0:a-1;var h=i?1:-1;var m=t<0||t===0&&1/t<0?1:0;t=Math.abs(t);if(isNaN(t)||t===Infinity){o=isNaN(t)?1:0;s=u}else{s=Math.floor(Math.log(t)/Math.LN2);if(t*(f=Math.pow(2,-s))<1){s--;f*=2}if(s+c>=1){t+=p/f}else{t+=p*Math.pow(2,1-c)}if(t*f>=2){s++;f/=2}if(s+c>=u){o=0;s=u}else if(s+c>=1){o=(t*f-1)*Math.pow(2,n);s=s+c}else{o=t*Math.pow(2,c-1)*Math.pow(2,n);s=0}}for(;n>=8;e[r+d]=o&255,d+=h,o/=256,n-=8){}s=s<<n|o;l+=n;for(;l>0;e[r+d]=s&255,d+=h,s/=256,l-=8){}e[r+d-h]|=m*128}},{}],69:[function(e,t,r){var i=Array.isArray;var n=Object.prototype.toString;t.exports=i||function(e){return!!e&&"[object Array]"==n.call(e)}},{}],70:[function(e,t,r){function i(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}t.exports=i;i.EventEmitter=i;i.prototype._events=undefined;i.prototype._maxListeners=undefined;i.defaultMaxListeners=10;i.prototype.setMaxListeners=function(e){if(!a(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");this._maxListeners=e;return this};i.prototype.emit=function(e){var t,r,i,a,f,l;if(!this._events)this._events={};if(e==="error"){if(!this._events.error||s(this._events.error)&&!this._events.error.length){t=arguments[1];if(t instanceof Error){throw t}throw TypeError('Uncaught, unspecified "error" event.')}}r=this._events[e];if(o(r))return false;if(n(r)){switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:i=arguments.length;a=new Array(i-1);for(f=1;f<i;f++)a[f-1]=arguments[f];r.apply(this,a)}}else if(s(r)){i=arguments.length;a=new Array(i-1);for(f=1;f<i;f++)a[f-1]=arguments[f];l=r.slice();i=l.length;for(f=0;f<i;f++)l[f].apply(this,a)}return true};i.prototype.addListener=function(e,t){var r;if(!n(t))throw TypeError("listener must be a function");if(!this._events)this._events={};if(this._events.newListener)this.emit("newListener",e,n(t.listener)?t.listener:t);if(!this._events[e])this._events[e]=t;else if(s(this._events[e]))this._events[e].push(t);else this._events[e]=[this._events[e],t];if(s(this._events[e])&&!this._events[e].warned){var r;if(!o(this._maxListeners)){r=this._maxListeners}else{r=i.defaultMaxListeners}if(r&&r>0&&this._events[e].length>r){this._events[e].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[e].length);if(typeof console.trace==="function"){console.trace()}}}return this};i.prototype.on=i.prototype.addListener;i.prototype.once=function(e,t){if(!n(t))throw TypeError("listener must be a function");var r=false;function i(){this.removeListener(e,i);if(!r){r=true;t.apply(this,arguments)}}i.listener=t;this.on(e,i);return this};i.prototype.removeListener=function(e,t){var r,i,a,o;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;r=this._events[e];a=r.length;i=-1;if(r===t||n(r.listener)&&r.listener===t){delete this._events[e];if(this._events.removeListener)this.emit("removeListener",e,t)}else if(s(r)){for(o=a;o-->0;){if(r[o]===t||r[o].listener&&r[o].listener===t){i=o;break}}if(i<0)return this;if(r.length===1){r.length=0;delete this._events[e]}else{r.splice(i,1)}if(this._events.removeListener)this.emit("removeListener",e,t)}return this};i.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[e])delete this._events[e];return this}if(arguments.length===0){for(t in this._events){if(t==="removeListener")continue;this.removeAllListeners(t)}this.removeAllListeners("removeListener");this._events={};return this}r=this._events[e];if(n(r)){this.removeListener(e,r)}else{while(r.length)this.removeListener(e,r[r.length-1])}delete this._events[e];return this};i.prototype.listeners=function(e){var t;if(!this._events||!this._events[e])t=[];else if(n(this._events[e]))t=[this._events[e]];else t=this._events[e].slice();return t};i.listenerCount=function(e,t){var r;if(!e._events||!e._events[t])r=0;else if(n(e._events[t]))r=1;else r=e._events[t].length;return r};function n(e){return typeof e==="function"}function a(e){return typeof e==="number"}function s(e){return typeof e==="object"&&e!==null}function o(e){return e===void 0}},{}],71:[function(e,t,r){var i=t.exports;var n=e("events").EventEmitter;var a=e("./lib/request");var s=e("url");i.request=function(e,t){if(typeof e==="string"){e=s.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 r=new a(new o,e);if(t)r.on("response",t);return r};i.get=function(e,t){e.method="GET";var r=i.request(e,t);r.end();return r};i.Agent=function(){};i.Agent.defaultMaxSockets=4;var o=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 r=new window.ActiveXObject(e[t]);return function(){if(r){var i=r;r=null;return i}else{return new window.ActiveXObject(e[t])}}}catch(i){}}throw new Error("ajax not supported in this browser")}else{throw new Error("ajax not supported in this browser")}}();i.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":72,events:70,url:96}],72:[function(e,t,r){var i=e("stream");var n=e("./response");var a=e("Base64");var s=e("inherits");var o=t.exports=function(e,t){var r=this;r.writable=true;r.xhr=e;r.body=[];r.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(i){}if(t.responseType)try{e.responseType=t.responseType}catch(i){}e.open(t.method||"GET",r.uri,true);e.onerror=function(e){r.emit("error",new Error("Network error"))};r._headers={};if(t.headers){var s=f(t.headers);for(var o=0;o<s.length;o++){var l=s[o];if(!r.isSafeRequestHeader(l))continue;var u=t.headers[l];r.setHeader(l,u)}}if(t.auth){this.setHeader("Authorization","Basic "+a.btoa(t.auth))}var c=new n;c.on("close",function(){r.emit("close")});c.on("ready",function(){r.emit("response",c)});c.on("error",function(e){r.emit("error",e)});e.onreadystatechange=function(){if(e.__aborted)return;c.handle(e)}};s(o,i);o.prototype.setHeader=function(e,t){this._headers[e.toLowerCase()]=t};o.prototype.getHeader=function(e){return this._headers[e.toLowerCase()]};o.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]};o.prototype.write=function(e){this.body.push(e)};o.prototype.destroy=function(e){this.xhr.__aborted=true;this.xhr.abort();this.emit("close")};o.prototype.end=function(e){if(e!==undefined)this.body.push(e);var t=f(this._headers);for(var r=0;r<t.length;r++){var i=t[r];var n=this._headers[i];if(l(n)){for(var a=0;a<n.length;a++){this.xhr.setRequestHeader(i,n[a])}}else this.xhr.setRequestHeader(i,n)}if(this.body.length===0){this.xhr.send("")}else if(typeof this.body[0]==="string"){this.xhr.send(this.body.join(""))}else if(l(this.body[0])){var s=[];for(var r=0;r<this.body.length;r++){s.push.apply(s,this.body[r])}this.xhr.send(s)}else if(/Array/.test(Object.prototype.toString.call(this.body[0]))){var o=0;for(var r=0;r<this.body.length;r++){o+=this.body[r].length}var s=new this.body[0].constructor(o);var u=0;for(var r=0;r<this.body.length;r++){var p=this.body[r];for(var a=0;a<p.length;a++){s[u++]=p[a]}}this.xhr.send(s)}else if(c(this.body[0])){this.xhr.send(this.body[0])}else{var s="";for(var r=0;r<this.body.length;r++){s+=this.body[r].toString()}this.xhr.send(s)}};o.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"];o.prototype.isSafeRequestHeader=function(e){if(!e)return false;return u(o.unsafeHeaders,e.toLowerCase())===-1};var f=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};var l=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 r=0;r<e.length;r++){if(e[r]===t)return r}return-1};var c=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":73,Base64:74,inherits:147,stream:94}],73:[function(e,t,r){var i=e("stream");var n=e("util");var a=t.exports=function(e){this.offset=0;this.readable=true};n.inherits(a,i);var s={streaming:true,status2:true};function o(e){var t=e.getAllResponseHeaders().split(/\r?\n/);var r={};for(var i=0;i<t.length;i++){var n=t[i];if(n==="")continue;var a=n.match(/^([^:]+):\s*(.*)/);if(a){var s=a[1].toLowerCase(),o=a[2];if(r[s]!==undefined){if(f(r[s])){r[s].push(o)}else{r[s]=[r[s],o]}}else{r[s]=o}}else{r[n]=true}}return r}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&&s.status2){try{this.statusCode=e.status;this.headers=o(e)}catch(t){s.status2=false}if(s.status2){this.emit("ready")}}else if(s.streaming&&e.readyState===3){try{if(!this.statusCode){this.statusCode=e.status;this.headers=o(e);this.emit("ready")}}catch(t){}try{this._emitData(e)}catch(t){s.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:94,util:98}],74:[function(e,t,r){(function(){var e=typeof r!="undefined"?r:this;var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function i(e){this.message=e}i.prototype=new Error;i.prototype.name="InvalidCharacterError";e.btoa||(e.btoa=function(e){for(var r,n,a=0,s=t,o="";e.charAt(a|0)||(s="=",a%1);o+=s.charAt(63&r>>8-a%1*8)){n=e.charCodeAt(a+=3/4);if(n>255){throw new i("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.")}r=r<<8|n}return o});e.atob||(e.atob=function(e){e=e.replace(/=+$/,"");if(e.length%4==1){throw new i("'atob' failed: The string to be decoded is not correctly encoded.")}for(var r=0,n,a,s=0,o="";a=e.charAt(s++);~a&&(n=r%4?n*64+a:a,r++%4)?o+=String.fromCharCode(255&n>>(-2*r&6)):0){a=t.indexOf(a)}return o})})()},{}],75:[function(e,t,r){var i=e("http");var n=t.exports;for(var a in i){if(i.hasOwnProperty(a))n[a]=i[a]}n.request=function(e,t){if(!e)e={};e.scheme="https";return i.request.call(this,e,t)}},{http:71}],76:[function(e,t,r){arguments[4][47][0].apply(r,arguments)},{dup:47}],77:[function(e,t,r){(function(e){function t(e,t){var r=0;for(var i=e.length-1;i>=0;i--){var n=e[i];if(n==="."){e.splice(i,1)}else if(n===".."){e.splice(i,1);r++}else if(r){e.splice(i,1);r--}}if(t){for(;r--;r){e.unshift("..")}}return e}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var n=function(e){return i.exec(e).slice(1)};r.resolve=function(){var r="",i=false;for(var n=arguments.length-1;n>=-1&&!i;n--){var s=n>=0?arguments[n]:e.cwd();if(typeof s!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!s){continue}r=s+"/"+r;i=s.charAt(0)==="/"}r=t(a(r.split("/"),function(e){return!!e}),!i).join("/");return(i?"/":"")+r||"."};r.normalize=function(e){var i=r.isAbsolute(e),n=s(e,-1)==="/";e=t(a(e.split("/"),function(e){return!!e}),!i).join("/");if(!e&&!i){e="."}if(e&&n){e+="/"}return(i?"/":"")+e};r.isAbsolute=function(e){return e.charAt(0)==="/"};r.join=function(){var e=Array.prototype.slice.call(arguments,0);return r.normalize(a(e,function(e,t){if(typeof e!=="string"){throw new TypeError("Arguments to path.join must be strings")}return e}).join("/"))};r.relative=function(e,t){e=r.resolve(e).substr(1);t=r.resolve(t).substr(1);function i(e){var t=0;for(;t<e.length;t++){if(e[t]!=="")break}var r=e.length-1;for(;r>=0;r--){if(e[r]!=="")break}if(t>r)return[];return e.slice(t,r-t+1)}var n=i(e.split("/"));var a=i(t.split("/"));var s=Math.min(n.length,a.length);var o=s;for(var f=0;f<s;f++){if(n[f]!==a[f]){o=f;break}}var l=[];for(var f=o;f<n.length;f++){l.push("..")}l=l.concat(a.slice(o));return l.join("/")};r.sep="/";r.delimiter=":";r.dirname=function(e){var t=n(e),r=t[0],i=t[1];if(!r&&!i){return"."}if(i){i=i.substr(0,i.length-1)}return r+i};r.basename=function(e,t){var r=n(e)[2];if(t&&r.substr(-1*t.length)===t){r=r.substr(0,r.length-t.length)}return r};r.extname=function(e){return n(e)[3]};function a(e,t){if(e.filter)return e.filter(t);var r=[];for(var i=0;i<e.length;i++){if(t(e[i],i,e))r.push(e[i])}return r}var s="ab".substr(-1)==="b"?function(e,t,r){return e.substr(t,r)}:function(e,t,r){if(t<0)t=e.length+t;return e.substr(t,r)}}).call(this,e("_process"))},{_process:78}],78:[function(e,t,r){var i=t.exports={};var n=[];var a=false;var s;var o=-1;function f(){a=false;if(s.length){n=s.concat(n)}else{o=-1}if(n.length){l()}}function l(){if(a){return}var e=setTimeout(f);a=true;var t=n.length;while(t){s=n;n=[];while(++o<t){s[o].run()}o=-1;t=n.length}s=null;a=false;clearTimeout(e)}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1){for(var r=1;r<arguments.length;r++){t[r-1]=arguments[r]}}n.push(new u(e,t));if(n.length===1&&!a){setTimeout(l,0)}};function u(e,t){this.fun=e;this.array=t}u.prototype.run=function(){this.fun.apply(null,this.array)};i.title="browser";i.browser=true;i.env={};i.argv=[];i.version="";i.versions={};function c(){}i.on=c;i.addListener=c;i.once=c;i.off=c;i.removeListener=c;i.removeAllListeners=c;i.emit=c;i.binding=function(e){throw new Error("process.binding is not supported")};i.cwd=function(){return"/"};i.chdir=function(e){throw new Error("process.chdir is not supported")};i.umask=function(){return 0}},{}],79:[function(t,r,i){(function(t){(function(n){var a=typeof i=="object"&&i&&!i.nodeType&&i;var s=typeof r=="object"&&r&&!r.nodeType&&r;var o=typeof t=="object"&&t;if(o.global===o||o.window===o||o.self===o){n=o}var f,l=2147483647,u=36,c=1,p=26,d=38,h=700,m=72,v=128,g="-",_=/^xn--/,y=/[^\x20-\x7E]/,b=/[\x2E\u3002\uFF0E\uFF61]/g,w={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},x=u-c,k=Math.floor,S=String.fromCharCode,E;function A(e){throw RangeError(w[e])}function T(e,t){var r=e.length;var i=[];while(r--){i[r]=t(e[r])}return i}function I(e,t){var r=e.split("@");var i="";if(r.length>1){i=r[0]+"@";e=r[1]}e=e.replace(b,".");var n=e.split(".");var a=T(n,t).join(".");return i+a}function U(e){var t=[],r=0,i=e.length,n,a;while(r<i){n=e.charCodeAt(r++);if(n>=55296&&n<=56319&&r<i){a=e.charCodeAt(r++);if((a&64512)==56320){t.push(((n&1023)<<10)+(a&1023)+65536)}else{t.push(n);r--}}else{t.push(n)}}return t}function L(e){return T(e,function(e){var t="";if(e>65535){e-=65536;t+=S(e>>>10&1023|55296);e=56320|e&1023}t+=S(e);return t}).join("")}function B(e){if(e-48<10){return e-22}if(e-65<26){return e-65}if(e-97<26){return e-97}return u}function z(e,t){return e+22+75*(e<26)-((t!=0)<<5)}function C(e,t,r){var i=0;e=r?k(e/h):e>>1;e+=k(e/t);for(;e>x*p>>1;i+=u){e=k(e/x)}return k(i+(x+1)*e/(e+d))}function R(e){var t=[],r=e.length,i,n=0,a=v,s=m,o,f,d,h,_,y,b,w,x;o=e.lastIndexOf(g);if(o<0){o=0}for(f=0;f<o;++f){if(e.charCodeAt(f)>=128){A("not-basic")}t.push(e.charCodeAt(f))}for(d=o>0?o+1:0;d<r;){for(h=n,_=1,y=u;;y+=u){if(d>=r){A("invalid-input")}b=B(e.charCodeAt(d++));if(b>=u||b>k((l-n)/_)){A("overflow")}n+=b*_;w=y<=s?c:y>=s+p?p:y-s;if(b<w){break}x=u-w;if(_>k(l/x)){A("overflow")}_*=x}i=t.length+1;s=C(n-h,i,h==0);if(k(n/i)>l-a){A("overflow")}a+=k(n/i);n%=i;t.splice(n++,0,a)}return L(t)}function F(e){var t,r,i,n,a,s,o,f,d,h,_,y=[],b,w,x,E;e=U(e);b=e.length;t=v;r=0;a=m;for(s=0;s<b;++s){_=e[s];if(_<128){y.push(S(_))}}i=n=y.length;if(n){y.push(g)}while(i<b){for(o=l,s=0;s<b;++s){_=e[s];if(_>=t&&_<o){o=_}}w=i+1;if(o-t>k((l-r)/w)){A("overflow")}r+=(o-t)*w;t=o;for(s=0;s<b;++s){_=e[s];if(_<t&&++r>l){A("overflow")}if(_==t){for(f=r,d=u;;d+=u){h=d<=a?c:d>=a+p?p:d-a;if(f<h){break}E=f-h;x=u-h;y.push(S(z(h+E%x,0)));f=k(E/x)}y.push(S(z(f,0)));a=C(r,w,i==n);r=0;++i}}++r;++t}return y.join("")}function O(e){return I(e,function(e){return _.test(e)?R(e.slice(4).toLowerCase()):e})}function M(e){return I(e,function(e){return y.test(e)?"xn--"+F(e):e})}f={version:"1.3.2",ucs2:{decode:U,encode:L},decode:R,encode:F,toASCII:M,toUnicode:O};if(typeof e=="function"&&typeof e.amd=="object"&&e.amd){e("punycode",function(){return f})}else if(a&&s){if(r.exports==a){s.exports=f}else{for(E in f){f.hasOwnProperty(E)&&(a[E]=f[E])}}}else{n.punycode=f}})(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],80:[function(e,t,r){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,r,a){t=t||"&";r=r||"=";var s={};if(typeof e!=="string"||e.length===0){return s}var o=/\+/g;e=e.split(t);var f=1e3;if(a&&typeof a.maxKeys==="number"){f=a.maxKeys}var l=e.length;if(f>0&&l>f){l=f}for(var u=0;u<l;++u){var c=e[u].replace(o,"%20"),p=c.indexOf(r),d,h,m,v;if(p>=0){d=c.substr(0,p);h=c.substr(p+1)}else{d=c;h=""}m=decodeURIComponent(d);v=decodeURIComponent(h);if(!i(s,m)){s[m]=v}else if(n(s[m])){s[m].push(v)}else{s[m]=[s[m],v]}}return s};var n=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}},{}],81:[function(e,t,r){"use strict";var i=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,r,o){t=t||"&";r=r||"=";if(e===null){e=undefined}if(typeof e==="object"){return a(s(e),function(s){var o=encodeURIComponent(i(s))+r;if(n(e[s])){return a(e[s],function(e){return o+encodeURIComponent(i(e))}).join(t)}else{return o+encodeURIComponent(i(e[s]))}}).join(t)}if(!o)return"";return encodeURIComponent(i(o))+r+encodeURIComponent(i(e))};var n=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};function a(e,t){if(e.map)return e.map(t);var r=[];for(var i=0;i<e.length;i++){r.push(t(e[i],i))}return r}var s=Object.keys||function(e){var t=[];for(var r in e){if(Object.prototype.hasOwnProperty.call(e,r))t.push(r)}return t}},{}],82:[function(e,t,r){"use strict";r.decode=r.parse=e("./decode");r.encode=r.stringify=e("./encode")},{"./decode":80,"./encode":81}],83:[function(e,t,r){t.exports=e("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":84}],84:[function(e,t,r){arguments[4][41][0].apply(r,arguments)},{"./_stream_readable":86,"./_stream_writable":88,_process:78,"core-util-is":89,dup:41,inherits:147}],85:[function(e,t,r){arguments[4][42][0].apply(r,arguments)},{"./_stream_transform":87,"core-util-is":89,dup:42,inherits:147}],86:[function(e,t,r){arguments[4][43][0].apply(r,arguments)},{"./_stream_duplex":84,_process:78,buffer:66,"core-util-is":89,dup:43,events:70,inherits:147,isarray:76,stream:94,"string_decoder/":95,util:52}],87:[function(e,t,r){arguments[4][44][0].apply(r,arguments)},{"./_stream_duplex":84,"core-util-is":89,dup:44,inherits:147}],88:[function(e,t,r){arguments[4][45][0].apply(r,arguments)},{"./_stream_duplex":84,_process:78,buffer:66,"core-util-is":89,dup:45,inherits:147,stream:94}],89:[function(e,t,r){arguments[4][46][0].apply(r,arguments)},{buffer:66,dup:46}],90:[function(e,t,r){t.exports=e("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":85}],91:[function(e,t,r){arguments[4][49][0].apply(r,arguments)},{"./lib/_stream_duplex.js":84,"./lib/_stream_passthrough.js":85,"./lib/_stream_readable.js":86,"./lib/_stream_transform.js":87,"./lib/_stream_writable.js":88,dup:49,stream:94}],92:[function(e,t,r){t.exports=e("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":87}],93:[function(e,t,r){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":88}],94:[function(e,t,r){t.exports=a;var i=e("events").EventEmitter;var n=e("inherits");n(a,i);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(){i.call(this)}a.prototype.pipe=function(e,t){var r=this;function n(t){if(e.writable){if(false===e.write(t)&&r.pause){r.pause()}}}r.on("data",n);function a(){if(r.readable&&r.resume){r.resume()}}e.on("drain",a);if(!e._isStdio&&(!t||t.end!==false)){r.on("end",o);r.on("close",f)}var s=false;function o(){if(s)return;s=true;e.end()}function f(){if(s)return;s=true;if(typeof e.destroy==="function")e.destroy()}function l(e){u();if(i.listenerCount(this,"error")===0){throw e}}r.on("error",l);e.on("error",l);function u(){r.removeListener("data",n);e.removeListener("drain",a);r.removeListener("end",o);r.removeListener("close",f);r.removeListener("error",l);e.removeListener("error",l);r.removeListener("end",u);r.removeListener("close",u);e.removeListener("close",u)}r.on("end",u);r.on("close",u);e.on("close",u);e.emit("pipe",r);return e}},{events:70,inherits:147,"readable-stream/duplex.js":83,"readable-stream/passthrough.js":90,"readable-stream/readable.js":91,"readable-stream/transform.js":92,"readable-stream/writable.js":93}],95:[function(e,t,r){arguments[4][48][0].apply(r,arguments)},{buffer:66,dup:48}],96:[function(e,t,r){var i=e("punycode");r.parse=y;r.resolve=w;r.resolveObject=x;r.format=b;r.Url=n;function n(){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,s=/:[0-9]*$/,o=["<",">",'"',"`"," ","\r","\n"," "],f=["{","}","|","\\","^","`"].concat(o),l=["'"].concat(f),u=["%","/","?",";","#"].concat(l),c=["/","?","#"],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},_=e("querystring");function y(e,t,r){if(e&&S(e)&&e instanceof n)return e;var i=new n;i.parse(e,t,r);return i}n.prototype.parse=function(e,t,r){if(!k(e)){throw new TypeError("Parameter 'url' must be a string, not "+typeof e)}var n=e;n=n.trim();var s=a.exec(n);if(s){s=s[0];var o=s.toLowerCase();this.protocol=o;n=n.substr(s.length)}if(r||s||n.match(/^\/\/[^@\/]+@[^@\/]+/)){var f=n.substr(0,2)==="//";if(f&&!(s&&v[s])){n=n.substr(2);this.slashes=true}}if(!v[s]&&(f||s&&!g[s])){var y=-1;for(var b=0;b<c.length;b++){var w=n.indexOf(c[b]);if(w!==-1&&(y===-1||w<y))y=w}var x,S;if(y===-1){S=n.lastIndexOf("@")}else{S=n.lastIndexOf("@",y)}if(S!==-1){x=n.slice(0,S);n=n.slice(S+1);this.auth=decodeURIComponent(x)}y=-1;for(var b=0;b<u.length;b++){var w=n.indexOf(u[b]);if(w!==-1&&(y===-1||w<y))y=w}if(y===-1)y=n.length;this.host=n.slice(0,y);n=n.slice(y);this.parseHost();this.hostname=this.hostname||"";var E=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!E){var A=this.hostname.split(/\./);for(var b=0,T=A.length;b<T;b++){var I=A[b];if(!I)continue;if(!I.match(d)){var U="";for(var L=0,B=I.length;L<B;L++){if(I.charCodeAt(L)>127){U+="x"}else{U+=I[L]}}if(!U.match(d)){var z=A.slice(0,b);var C=A.slice(b+1);var R=I.match(h);if(R){z.push(R[1]);C.unshift(R[2])}if(C.length){n="/"+C.join(".")+n}this.hostname=z.join(".");break}}}}if(this.hostname.length>p){this.hostname=""}else{this.hostname=this.hostname.toLowerCase()}if(!E){var F=this.hostname.split(".");var O=[];for(var b=0;b<F.length;++b){var M=F[b];O.push(M.match(/[^A-Za-z0-9_-]/)?"xn--"+i.encode(M):M)}this.hostname=O.join(".")}var N=this.port?":"+this.port:"";var D=this.hostname||"";this.host=D+N;this.href+=this.host;if(E){this.hostname=this.hostname.substr(1,this.hostname.length-2);if(n[0]!=="/"){n="/"+n}}}if(!m[o]){for(var b=0,T=l.length;b<T;b++){var P=l[b];var j=encodeURIComponent(P);if(j===P){j=escape(P)}n=n.split(P).join(j)}}var H=n.indexOf("#");if(H!==-1){this.hash=n.substr(H);n=n.slice(0,H)}var q=n.indexOf("?");if(q!==-1){this.search=n.substr(q);this.query=n.substr(q+1);if(t){this.query=_.parse(this.query)}n=n.slice(0,q)}else if(t){this.search="";this.query={}}if(n)this.pathname=n;if(g[o]&&this.hostname&&!this.pathname){this.pathname="/"}if(this.pathname||this.search){var N=this.pathname||"";var M=this.search||"";this.path=N+M}this.href=this.format();return this};function b(e){if(k(e))e=y(e);if(!(e instanceof n))return n.prototype.format.call(e);return e.format()}n.prototype.format=function(){var e=this.auth||"";if(e){e=encodeURIComponent(e);e=e.replace(/%3A/i,":");e+="@"}var t=this.protocol||"",r=this.pathname||"",i=this.hash||"",n=false,a="";if(this.host){n=e+this.host}else if(this.hostname){n=e+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]");if(this.port){n+=":"+this.port}}if(this.query&&S(this.query)&&Object.keys(this.query).length){a=_.stringify(this.query)}var s=this.search||a&&"?"+a||"";if(t&&t.substr(-1)!==":")t+=":";if(this.slashes||(!t||g[t])&&n!==false){n="//"+(n||"");if(r&&r.charAt(0)!=="/")r="/"+r}else if(!n){n=""}if(i&&i.charAt(0)!=="#")i="#"+i;if(s&&s.charAt(0)!=="?")s="?"+s;r=r.replace(/[?#]/g,function(e){return encodeURIComponent(e)});s=s.replace("#","%23");return t+n+r+s+i};function w(e,t){return y(e,false,true).resolve(t)}n.prototype.resolve=function(e){return this.resolveObject(y(e,false,true)).format()};function x(e,t){if(!e)return t;return y(e,false,true).resolveObject(t)}n.prototype.resolveObject=function(e){if(k(e)){var t=new n;t.parse(e,false,true);e=t}var r=new n;Object.keys(this).forEach(function(e){r[e]=this[e]},this);r.hash=e.hash;if(e.href===""){r.href=r.format();return r}if(e.slashes&&!e.protocol){Object.keys(e).forEach(function(t){if(t!=="protocol")r[t]=e[t]});if(g[r.protocol]&&r.hostname&&!r.pathname){r.path=r.pathname="/"}r.href=r.format();return r}if(e.protocol&&e.protocol!==r.protocol){if(!g[e.protocol]){Object.keys(e).forEach(function(t){r[t]=e[t]});r.href=r.format();return r}r.protocol=e.protocol;if(!e.host&&!v[e.protocol]){var i=(e.pathname||"").split("/");while(i.length&&!(e.host=i.shift()));if(!e.host)e.host="";if(!e.hostname)e.hostname="";if(i[0]!=="")i.unshift("");if(i.length<2)i.unshift("");r.pathname=i.join("/")}else{r.pathname=e.pathname}r.search=e.search;r.query=e.query;r.host=e.host||"";r.auth=e.auth;r.hostname=e.hostname||e.host;r.port=e.port;if(r.pathname||r.search){var a=r.pathname||"";var s=r.search||"";r.path=a+s}r.slashes=r.slashes||e.slashes;r.href=r.format();return r}var o=r.pathname&&r.pathname.charAt(0)==="/",f=e.host||e.pathname&&e.pathname.charAt(0)==="/",l=f||o||r.host&&e.pathname,u=l,c=r.pathname&&r.pathname.split("/")||[],i=e.pathname&&e.pathname.split("/")||[],p=r.protocol&&!g[r.protocol];if(p){r.hostname="";r.port=null;if(r.host){if(c[0]==="")c[0]=r.host;else c.unshift(r.host)}r.host="";if(e.protocol){e.hostname=null;e.port=null;if(e.host){if(i[0]==="")i[0]=e.host;else i.unshift(e.host)}e.host=null}l=l&&(i[0]===""||c[0]==="")}if(f){r.host=e.host||e.host===""?e.host:r.host;r.hostname=e.hostname||e.hostname===""?e.hostname:r.hostname;r.search=e.search;r.query=e.query;c=i}else if(i.length){if(!c)c=[];c.pop();c=c.concat(i);r.search=e.search;r.query=e.query}else if(!A(e.search)){if(p){r.hostname=r.host=c.shift();var d=r.host&&r.host.indexOf("@")>0?r.host.split("@"):false;if(d){r.auth=d.shift();r.host=r.hostname=d.shift()}}r.search=e.search;r.query=e.query;if(!E(r.pathname)||!E(r.search)){r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")}r.href=r.format();return r}if(!c.length){r.pathname=null;if(r.search){r.path="/"+r.search}else{r.path=null}r.href=r.format();return r}var h=c.slice(-1)[0];var m=(r.host||e.host)&&(h==="."||h==="..")||h==="";var _=0;for(var y=c.length;y>=0;y--){h=c[y];if(h=="."){c.splice(y,1)}else if(h===".."){c.splice(y,1);_++}else if(_){c.splice(y,1);_--}}if(!l&&!u){for(;_--;_){c.unshift("..")}}if(l&&c[0]!==""&&(!c[0]||c[0].charAt(0)!=="/")){c.unshift("")}if(m&&c.join("/").substr(-1)!=="/"){c.push("")}var b=c[0]===""||c[0]&&c[0].charAt(0)==="/";if(p){r.hostname=r.host=b?"":c.length?c.shift():"";var d=r.host&&r.host.indexOf("@")>0?r.host.split("@"):false;if(d){r.auth=d.shift();r.host=r.hostname=d.shift()}}l=l||r.host&&c.length;if(l&&!b){c.unshift("")}if(!c.length){r.pathname=null;r.path=null}else{r.pathname=c.join("/")}if(!E(r.pathname)||!E(r.search)){r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")}r.auth=e.auth||r.auth;r.slashes=r.slashes||e.slashes;r.href=r.format();return r};n.prototype.parseHost=function(){var e=this.host;var t=s.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 S(e){return typeof e==="object"&&e!==null}function E(e){return e===null}function A(e){return e==null}},{punycode:79,querystring:82}],97:[function(e,t,r){t.exports=function i(e){return e&&typeof e==="object"&&typeof e.copy==="function"&&typeof e.fill==="function"&&typeof e.readUInt8==="function"}},{}],98:[function(e,t,r){(function(t,i){var n=/%[sdj%]/g;r.format=function(e){if(!x(e)){var t=[];for(var r=0;r<arguments.length;r++){t.push(o(arguments[r]))}return t.join(" ")}var r=1;var i=arguments;var a=i.length;var s=String(e).replace(n,function(e){if(e==="%%")return"%";if(r>=a)return e;switch(e){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return e}});for(var f=i[r];r<a;f=i[++r]){if(y(f)||!A(f)){s+=" "+f}else{s+=" "+o(f)}}return s};r.deprecate=function(e,n){if(S(i.process)){return function(){return r.deprecate(e,n).apply(this,arguments)}}if(t.noDeprecation===true){return e}var a=false;function s(){if(!a){if(t.throwDeprecation){throw new Error(n)}else if(t.traceDeprecation){console.trace(n)}else{console.error(n)}a=true}return e.apply(this,arguments)}return s};var a={};var s;r.debuglog=function(e){if(S(s))s=t.env.NODE_DEBUG||"";e=e.toUpperCase();if(!a[e]){if(new RegExp("\\b"+e+"\\b","i").test(s)){var i=t.pid;a[e]=function(){var t=r.format.apply(r,arguments);console.error("%s %d: %s",e,i,t)}}else{a[e]=function(){}}}return a[e]};function o(e,t){var i={seen:[],stylize:l};if(arguments.length>=3)i.depth=arguments[2];if(arguments.length>=4)i.colors=arguments[3];if(_(t)){i.showHidden=t}else if(t){r._extend(i,t)}if(S(i.showHidden))i.showHidden=false;if(S(i.depth))i.depth=2;if(S(i.colors))i.colors=false;if(S(i.customInspect))i.customInspect=true;if(i.colors)i.stylize=f;return c(i,e,i.depth)}r.inspect=o;o.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]};o.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};function f(e,t){var r=o.styles[t];if(r){return"["+o.colors[r][0]+"m"+e+"["+o.colors[r][1]+"m"}else{return e}}function l(e,t){return e}function u(e){var t={};e.forEach(function(e,r){t[e]=true});return t}function c(e,t,i){if(e.customInspect&&t&&U(t.inspect)&&t.inspect!==r.inspect&&!(t.constructor&&t.constructor.prototype===t)){var n=t.inspect(i,e);if(!x(n)){n=c(e,n,i)}return n}var a=p(e,t);if(a){return a}var s=Object.keys(t);var o=u(s);if(e.showHidden){s=Object.getOwnPropertyNames(t)}if(I(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0)){return d(t)}if(s.length===0){if(U(t)){var f=t.name?": "+t.name:"";return e.stylize("[Function"+f+"]","special")}if(E(t)){return e.stylize(RegExp.prototype.toString.call(t),"regexp")}if(T(t)){return e.stylize(Date.prototype.toString.call(t),"date")}if(I(t)){return d(t)}}var l="",_=false,y=["{","}"];if(g(t)){_=true;y=["[","]"]}if(U(t)){var b=t.name?": "+t.name:"";l=" [Function"+b+"]"}if(E(t)){l=" "+RegExp.prototype.toString.call(t)}if(T(t)){l=" "+Date.prototype.toUTCString.call(t)}if(I(t)){l=" "+d(t)}if(s.length===0&&(!_||t.length==0)){return y[0]+l+y[1]}if(i<0){if(E(t)){return e.stylize(RegExp.prototype.toString.call(t),"regexp")}else{return e.stylize("[Object]","special")}}e.seen.push(t);var w;if(_){w=h(e,t,i,o,s)}else{w=s.map(function(r){return m(e,t,i,o,r,_)})}e.seen.pop();return v(w,l,y)}function p(e,t){if(S(t))return e.stylize("undefined","undefined");if(x(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(w(t))return e.stylize(""+t,"number");if(_(t))return e.stylize(""+t,"boolean");if(y(t))return e.stylize("null","null")}function d(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,r,i,n){var a=[];for(var s=0,o=t.length;s<o;++s){if(F(t,String(s))){a.push(m(e,t,r,i,String(s),true))}else{a.push("")}}n.forEach(function(n){if(!n.match(/^\d+$/)){a.push(m(e,t,r,i,n,true))}});return a}function m(e,t,r,i,n,a){var s,o,f;f=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]};if(f.get){if(f.set){o=e.stylize("[Getter/Setter]","special")}else{o=e.stylize("[Getter]","special")}}else{if(f.set){o=e.stylize("[Setter]","special")}}if(!F(i,n)){s="["+n+"]"}if(!o){if(e.seen.indexOf(f.value)<0){if(y(r)){o=c(e,f.value,null)}else{o=c(e,f.value,r-1)}if(o.indexOf("\n")>-1){if(a){o=o.split("\n").map(function(e){return" "+e}).join("\n").substr(2)}else{o="\n"+o.split("\n").map(function(e){return" "+e}).join("\n")}}}else{o=e.stylize("[Circular]","special")}}if(S(s)){if(a&&n.match(/^\d+$/)){return o}s=JSON.stringify(""+n);if(s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){s=s.substr(1,s.length-2);s=e.stylize(s,"name")}else{s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");s=e.stylize(s,"string")}}return s+": "+o}function v(e,t,r){var i=0;var n=e.reduce(function(e,t){i++;if(t.indexOf("\n")>=0)i++;return e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(n>60){return r[0]+(t===""?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]}return r[0]+t+" "+e.join(", ")+" "+r[1]}function g(e){return Array.isArray(e)}r.isArray=g;function _(e){return typeof e==="boolean"}r.isBoolean=_;function y(e){return e===null}r.isNull=y;function b(e){return e==null}r.isNullOrUndefined=b;function w(e){return typeof e==="number"}r.isNumber=w;function x(e){return typeof e==="string"}r.isString=x;function k(e){return typeof e==="symbol"}r.isSymbol=k;function S(e){return e===void 0}r.isUndefined=S;function E(e){return A(e)&&B(e)==="[object RegExp]"}r.isRegExp=E;function A(e){return typeof e==="object"&&e!==null}r.isObject=A;function T(e){return A(e)&&B(e)==="[object Date]"}r.isDate=T;function I(e){return A(e)&&(B(e)==="[object Error]"||e instanceof Error)}r.isError=I;function U(e){return typeof e==="function"}r.isFunction=U;function L(e){return e===null||typeof e==="boolean"||typeof e==="number"||typeof e==="string"||typeof e==="symbol"||typeof e==="undefined"}r.isPrimitive=L;r.isBuffer=e("./support/isBuffer");function B(e){return Object.prototype.toString.call(e)}function z(e){return e<10?"0"+e.toString(10):e.toString(10)}var C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function R(){var e=new Date;var t=[z(e.getHours()),z(e.getMinutes()),z(e.getSeconds())].join(":");return[e.getDate(),C[e.getMonth()],t].join(" ")}r.log=function(){console.log("%s - %s",R(),r.format.apply(r,arguments))};r.inherits=e("inherits");r._extend=function(e,t){if(!t||!A(t))return e;var r=Object.keys(t);var i=r.length;while(i--){e[r[i]]=t[r[i]]}return e};function F(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":97,_process:78,inherits:147}],99:[function(e,t,r){(function(r,i){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 n=e("bencode");var a=e("block-stream2");var s=e("piece-length");var o=e("path");var f=e("dezalgo");var l=e("filestream/read");var u=e("flatten");var c=e("fs");var p=e("is-file");var d=e("junk");var h=e("multistream");var m=e("once");var v=e("run-parallel");var g=e("simple-sha1");var _=e("stream");function y(e,t,r){if(typeof t==="function"){r=t;t={}}if(!t)t={};b(e,t,function(e,i,n){if(e)return r(e);t.singleFileTorrent=n;A(i,t,r)})}function b(e,t,r){if(typeof t==="function"){r=t;t={}}if(!t)t={};r=f(r);if(Array.isArray(e)&&e.length===0)throw new Error("invalid input type");if(U(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"&&o.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 n=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 r(e);a=t;s()})}else{s()}function s(){v(e.map(function(e){return function(r){var s={};if(I(e)){s.getStream=B(e);s.length=e.size}else if(i.isBuffer(e)){s.getStream=z(e);s.length=e.length}else if(L(e)){if(!t.pieceLength){throw new Error("must specify `pieceLength` option if input is Stream")}s.getStream=R(e,s);s.length=0}else if(typeof e==="string"){if(typeof c.readdir!=="function"){throw new Error("filesystem paths do not work in the browser")}var f=n>1||a;w(e,f,r);return}else{throw new Error("invalid input type")}if(!e.name)throw new Error("missing requied `name` property on input");s.path=e.name.split(o.sep);r(null,s)}}),function(e,t){if(e)return r(e);t=u(t);r(null,t,a)})}}function w(e,t,r){k(e,x,function(i,n){if(i)return r(i);if(Array.isArray(n))n=u(n);else n=[n];e=o.normalize(e);if(t){e=e.slice(0,e.lastIndexOf(o.sep)+1)}if(e[e.length-1]!==o.sep)e+=o.sep;n.forEach(function(t){t.getStream=C(t.path);t.path=t.path.replace(e,"").split(o.sep)});r(null,n)})}function x(e,t){t=m(t);c.stat(e,function(r,i){if(r)return t(r);var n={length:i.size,path:e};t(null,n)})}function k(e,t,r){c.readdir(e,function(i,n){if(i&&i.code==="ENOTDIR"){t(e,r)}else if(i){r(i)}else{v(n.filter(S).filter(d.not).map(function(r){return function(i){k(o.join(e,r),t,i)}}),r)}})}function S(e){return e[0]!=="."}function E(e,t,r){r=m(r);var n=[];var s=0;var o=e.map(function(e){return e.getStream});var f=0;var l=0;var u=false;var c=new h(o);var p=new a(t,{zeroPadding:false});c.on("error",_);c.pipe(p).on("data",d).on("end",v).on("error",_);function d(e){s+=e.length;var t=l;g(e,function(e){n[t]=e;f-=1;b()});f+=1;l+=1}function v(){u=true;b()}function _(e){y();r(e)}function y(){c.removeListener("error",_);p.removeListener("data",d);p.removeListener("end",v);p.removeListener("error",_)}function b(){if(u&&f===0){y();r(null,new i(n.join(""),"hex"),s)}}}function A(e,i,a){var o=i.announceList;if(!o){if(typeof i.announce==="string")o=[[i.announce]];else if(Array.isArray(i.announce)){o=i.announce.map(function(e){return[e]})}}if(!o)o=[];if(r.WEBTORRENT_ANNOUNCE){if(typeof r.WEBTORRENT_ANNOUNCE==="string"){o.push([[r.WEBTORRENT_ANNOUNCE]])}else if(Array.isArray(r.WEBTORRENT_ANNOUNCE)){o=o.concat(r.WEBTORRENT_ANNOUNCE.map(function(e){return[e]}))}}if(o.length===0){o=o.concat(t.exports.announceList)}var f={info:{name:i.name},announce:o[0][0],"announce-list":o,"creation date":Number(i.creationDate)||Date.now(),encoding:"UTF-8"};if(i.comment!==undefined)f.comment=i.comment;if(i.createdBy!==undefined)f["created by"]=i.createdBy;if(i.private!==undefined)f.info.private=Number(i.private);if(i.sslCert!==undefined)f.info["ssl-cert"]=i.sslCert;if(i.urlList!==undefined)f["url-list"]=i.urlList;var l=i.pieceLength||s(e.reduce(T,0));f.info["piece length"]=l;E(e,l,function(t,r,s){if(t)return a(t);f.info.pieces=r;e.forEach(function(e){delete e.getStream});if(i.singleFileTorrent){f.info.length=s}else{f.info.files=e}a(null,n.encode(f))})}function T(e,t){return e+t.length}function I(e){return typeof Blob!=="undefined"&&e instanceof Blob}function U(e){return typeof FileList==="function"&&e instanceof FileList}function L(e){return typeof e==="object"&&typeof e.pipe==="function"}function B(e){return function(){return new l(e)}}function z(e){return function(){var t=new _.PassThrough;t.end(e);return t}}function C(e){return function(){return c.createReadStream(e)}}function R(e,t){return function(){var r=new _.Transform;r._transform=function(e,r,i){t.length+=e.length;this.push(e);i()};e.pipe(r);return r}}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},e("buffer").Buffer)},{bencode:100,"block-stream2":104,buffer:66,dezalgo:116,"filestream/read":122,flatten:123,fs:50,"is-file":124,junk:125,multistream:126,once:129,path:77,"piece-length":130,"run-parallel":132,"simple-sha1":136,stream:94}],100:[function(e,t,r){arguments[4][17][0].apply(r,arguments)},{"./lib/decode":101,"./lib/encode":103,dup:17}],101:[function(e,t,r){arguments[4][18][0].apply(r,arguments)},{"./dict":102,buffer:66,dup:18}],102:[function(e,t,r){arguments[4][19][0].apply(r,arguments)},{dup:19}],103:[function(e,t,r){arguments[4][20][0].apply(r,arguments)},{buffer:66,dup:20}],104:[function(e,t,r){arguments[4][39][0].apply(r,arguments)},{buffer:66,defined:105,dup:39,inherits:106,"readable-stream":115}],105:[function(e,t,r){arguments[4][40][0].apply(r,arguments)},{dup:40}],106:[function(e,t,r){arguments[4][25][0].apply(r,arguments)},{dup:25}],107:[function(e,t,r){arguments[4][41][0].apply(r,arguments)},{"./_stream_readable":109,"./_stream_writable":111,_process:78,"core-util-is":112,dup:41,inherits:106}],108:[function(e,t,r){arguments[4][42][0].apply(r,arguments)},{"./_stream_transform":110,"core-util-is":112,dup:42,inherits:106}],109:[function(e,t,r){(function(r){t.exports=u;var i=e("isarray");var n=e("buffer").Buffer;u.ReadableState=l;var a=e("events").EventEmitter;if(!a.listenerCount)a.listenerCount=function(e,t){return e.listeners(t).length};var s=e("stream");var o=e("core-util-is");o.inherits=e("inherits");var f;o.inherits(u,s);function l(t,r){t=t||{};var i=t.highWaterMark;this.highWaterMark=i||i===0?i: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 l(e,this);this.readable=true;s.call(this)}u.prototype.push=function(e,t){var r=this._readableState;if(typeof e==="string"&&!r.objectMode){t=t||r.defaultEncoding;if(t!==r.encoding){e=new n(e,t);t=""}}return c(this,r,e,t,false)};u.prototype.unshift=function(e){var t=this._readableState;return c(this,t,e,"",true)};function c(e,t,r,i,n){var a=v(t,r);if(a){e.emit("error",a)}else if(r===null||r===undefined){t.reading=false;if(!t.ended)g(e,t)}else if(t.objectMode||r&&r.length>0){if(t.ended&&!n){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&n){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{if(t.decoder&&!n&&!i)r=t.decoder.write(r);t.length+=t.objectMode?1:r.length;if(n){t.buffer.unshift(r)}else{t.reading=false;t.buffer.push(r)}if(t.needReadable)_(e);b(e,t)}}else if(!n){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 r=e;var i;if(typeof e!=="number"||e>0)t.emittedReadable=false;if(e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended)){_(this);return null}e=m(e,t);if(e===0&&t.ended){i=null;if(t.length>0&&t.decoder){i=A(e,t);t.length-=i.length}if(t.length===0)T(this);return i}var n=t.needReadable;if(t.length-e<=t.highWaterMark)n=true;if(t.ended||t.reading)n=false;if(n){t.reading=true;t.sync=true;if(t.length===0)t.needReadable=true;this._read(t.highWaterMark);t.sync=false}if(n&&!t.reading)e=m(r,t);if(e>0)i=A(e,t);else i=null;if(i===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 i};function v(e,t){var r=null;if(!n.isBuffer(t)&&"string"!==typeof t&&t!==null&&t!==undefined&&!e.objectMode){r=new TypeError("Invalid non-string/buffer chunk")}return r}function g(e,t){if(t.decoder&&!t.ended){var r=t.decoder.end();if(r&&r.length){t.buffer.push(r);t.length+=t.objectMode?1:r.length}}t.ended=true;if(t.length>0)_(e);else T(e)}function _(e){var t=e._readableState;t.needReadable=false;if(t.emittedReadable)return;t.emittedReadable=true;if(t.sync)r.nextTick(function(){y(e)});else y(e)}function y(e){e.emit("readable")}function b(e,t){if(!t.readingMore){t.readingMore=true;r.nextTick(function(){w(e,t)})}}function w(e,t){var r=t.length;while(!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark){e.read(0);if(r===t.length)break;else r=t.length}t.readingMore=false}u.prototype._read=function(e){this.emit("error",new Error("not implemented"))};u.prototype.pipe=function(e,t){var n=this;var s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e);break}s.pipesCount+=1;var o=(!t||t.end!==false)&&e!==r.stdout&&e!==r.stderr;var f=o?u:p;if(s.endEmitted)r.nextTick(f);else n.once("end",f);e.on("unpipe",l);function l(e){if(e!==n)return;p()}function u(){e.end()}var c=x(n);e.on("drain",c);function p(){e.removeListener("close",h);e.removeListener("finish",m);e.removeListener("drain",c);e.removeListener("error",d);e.removeListener("unpipe",l);n.removeListener("end",u);n.removeListener("end",p);if(!e._writableState||e._writableState.needDrain)c()}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(i(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(){n.unpipe(e)}e.emit("pipe",n);if(!s.flowing){this.on("readable",S);s.flowing=true;r.nextTick(function(){k(n)})}return e};function x(e){return function(){var t=this;var r=e._readableState;r.awaitDrain--;if(r.awaitDrain===0)k(e)}}function k(e){var t=e._readableState;var r;t.awaitDrain=0;function i(e,i,n){var a=e.write(r);if(false===a){t.awaitDrain++}}while(t.pipesCount&&null!==(r=e.read())){if(t.pipesCount===1)i(t.pipes,0,null);else I(t.pipes,i);e.emit("data",r);if(t.awaitDrain>0)return}if(t.pipesCount===0){t.flowing=false;if(a.listenerCount(e,"data")>0)E(e);return}t.ranOut=true}function S(){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",S);t.flowing=false;if(e)e.emit("unpipe",this);return this}if(!e){var r=t.pipes;var i=t.pipesCount;t.pipes=null;t.pipesCount=0;this.removeListener("readable",S);t.flowing=false;for(var n=0;n<i;n++)r[n].emit("unpipe",this);return this}var n=U(t.pipes,e);if(n===-1)return this;t.pipes.splice(n,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 r=s.prototype.on.call(this,e,t);if(e==="data"&&!this._readableState.flowing)E(this);if(e==="readable"&&this.readable){var i=this._readableState;if(!i.readableListening){i.readableListening=true;i.emittedReadable=false;i.needReadable=true;if(!i.reading){this.read(0)}else if(i.length){_(this,i)}}}return r};u.prototype.addListener=u.prototype.on;u.prototype.resume=function(){E(this);this.read(0);this.emit("resume")};u.prototype.pause=function(){E(this,true);this.emit("pause")};function E(e,t){var i=e._readableState;if(i.flowing){throw new Error("Cannot switch to old mode now.")}var n=t||false;var a=false;e.readable=true;e.pipe=s.prototype.pipe;e.on=e.addListener=s.prototype.on;e.on("readable",function(){a=true;var t;while(!n&&null!==(t=e.read()))e.emit("data",t);if(t===null){a=false;e._readableState.needReadable=true}});e.pause=function(){n=true;this.emit("pause")};e.resume=function(){n=false;if(a)r.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 r=false;var i=this;e.on("end",function(){if(t.decoder&&!t.ended){var e=t.decoder.end();if(e&&e.length)i.push(e)}i.push(null)});e.on("data",function(n){if(t.decoder)n=t.decoder.write(n);if(t.objectMode&&(n===null||n===undefined))return;else if(!t.objectMode&&(!n||!n.length))return;var a=i.push(n);if(!a){r=true;e.pause()}});for(var n in e){if(typeof e[n]==="function"&&typeof this[n]==="undefined"){this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n)}}var a=["error","close","destroy","pause","resume"];I(a,function(t){e.on(t,i.emit.bind(i,t))});i._read=function(t){if(r){r=false;e.resume()}};return i};u._fromList=A;function A(e,t){var r=t.buffer;var i=t.length;var a=!!t.decoder;var s=!!t.objectMode;var o;if(r.length===0)return null;if(i===0)o=null;else if(s)o=r.shift();else if(!e||e>=i){if(a)o=r.join("");else o=n.concat(r,i);r.length=0}else{if(e<r[0].length){var f=r[0];o=f.slice(0,e);r[0]=f.slice(e)}else if(e===r[0].length){o=r.shift()}else{if(a)o="";else o=new n(e);var l=0;for(var u=0,c=r.length;u<c&&l<e;u++){var f=r[0];var p=Math.min(e-l,f.length);if(a)o+=f.slice(0,p);else f.copy(o,l,0,p);if(p<f.length)r[0]=f.slice(p);else r.shift();l+=p}}}return o}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;r.nextTick(function(){if(!t.endEmitted&&t.length===0){t.endEmitted=true;e.readable=false;e.emit("end")}})}}function I(e,t){for(var r=0,i=e.length;r<i;r++){t(e[r],r)}}function U(e,t){for(var r=0,i=e.length;r<i;r++){if(e[r]===t)return r}return-1}}).call(this,e("_process"))},{_process:78,buffer:66,"core-util-is":112,events:70,inherits:106,isarray:113,stream:94,"string_decoder/":114}],110:[function(e,t,r){t.exports=o;var i=e("./_stream_duplex");var n=e("core-util-is");n.inherits=e("inherits");n.inherits(o,i);function a(e,t){this.afterTransform=function(e,r){return s(t,e,r)};this.needTransform=false;this.transforming=false;this.writecb=null;this.writechunk=null}function s(e,t,r){var i=e._transformState;i.transforming=false;var n=i.writecb;if(!n)return e.emit("error",new Error("no writecb in Transform class"));i.writechunk=null;i.writecb=null;if(r!==null&&r!==undefined)e.push(r);if(n)n(t);var a=e._readableState;a.reading=false;if(a.needReadable||a.length<a.highWaterMark){e._read(a.highWaterMark)}}function o(e){if(!(this instanceof o))return new o(e);i.call(this,e);var t=this._transformState=new a(e,this);var r=this;this._readableState.needReadable=true;this._readableState.sync=false;this.once("finish",function(){if("function"===typeof this._flush)this._flush(function(e){f(r,e)});else f(r)})}o.prototype.push=function(e,t){this._transformState.needTransform=false;return i.prototype.push.call(this,e,t)};o.prototype._transform=function(e,t,r){throw new Error("not implemented")};o.prototype._write=function(e,t,r){var i=this._transformState;i.writecb=r;i.writechunk=e;i.writeencoding=t;if(!i.transforming){var n=this._readableState;if(i.needTransform||n.needReadable||n.length<n.highWaterMark)this._read(n.highWaterMark)}};o.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 r=e._writableState;var i=e._readableState;var n=e._transformState;if(r.length)throw new Error("calling transform done when ws.length != 0");if(n.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}},{"./_stream_duplex":107,"core-util-is":112,inherits:106}],111:[function(e,t,r){(function(r){t.exports=f;var i=e("buffer").Buffer;f.WritableState=o;var n=e("core-util-is");n.inherits=e("inherits");var a=e("stream");n.inherits(f,a);function s(e,t,r){this.chunk=e;this.encoding=t;this.callback=r}function o(e,t){e=e||{};var r=e.highWaterMark;this.highWaterMark=r||r===0?r:16*1024;this.objectMode=!!e.objectMode;this.highWaterMark=~~this.highWaterMark;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;var i=e.decodeStrings===false;this.decodeStrings=!i;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 r=e("./_stream_duplex");if(!(this instanceof f)&&!(this instanceof r))return new f(t);this._writableState=new o(t,this);this.writable=true;a.call(this)}f.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."));
-};function l(e,t,i){var n=new Error("write after end");e.emit("error",n);r.nextTick(function(){i(n)})}function u(e,t,n,a){var s=true;if(!i.isBuffer(n)&&"string"!==typeof n&&n!==null&&n!==undefined&&!t.objectMode){var o=new TypeError("Invalid non-string/buffer chunk");e.emit("error",o);r.nextTick(function(){a(o)});s=false}return s}f.prototype.write=function(e,t,r){var n=this._writableState;var a=false;if(typeof t==="function"){r=t;t=null}if(i.isBuffer(e))t="buffer";else if(!t)t=n.defaultEncoding;if(typeof r!=="function")r=function(){};if(n.ended)l(this,n,r);else if(u(this,n,e,r))a=p(this,n,e,t,r);return a};function c(e,t,r){if(!e.objectMode&&e.decodeStrings!==false&&typeof t==="string"){t=new i(t,r)}return t}function p(e,t,r,n,a){r=c(t,r,n);if(i.isBuffer(r))n="buffer";var o=t.objectMode?1:r.length;t.length+=o;var f=t.length<t.highWaterMark;if(!f)t.needDrain=true;if(t.writing)t.buffer.push(new s(r,n,a));else d(e,t,o,r,n,a);return f}function d(e,t,r,i,n,a){t.writelen=r;t.writecb=a;t.writing=true;t.sync=true;e._write(i,n,t.onwrite);t.sync=false}function h(e,t,i,n,a){if(i)r.nextTick(function(){a(n)});else a(n);e._writableState.errorEmitted=true;e.emit("error",n)}function m(e){e.writing=false;e.writecb=null;e.length-=e.writelen;e.writelen=0}function v(e,t){var i=e._writableState;var n=i.sync;var a=i.writecb;m(i);if(t)h(e,i,n,t,a);else{var s=b(e,i);if(!s&&!i.bufferProcessing&&i.buffer.length)y(e,i);if(n){r.nextTick(function(){g(e,i,s,a)})}else{g(e,i,s,a)}}}function g(e,t,r,i){if(!r)_(e,t);i();if(r)w(e,t)}function _(e,t){if(t.length===0&&t.needDrain){t.needDrain=false;e.emit("drain")}}function y(e,t){t.bufferProcessing=true;for(var r=0;r<t.buffer.length;r++){var i=t.buffer[r];var n=i.chunk;var a=i.encoding;var s=i.callback;var o=t.objectMode?1:n.length;d(e,t,o,n,a,s);if(t.writing){r++;break}}t.bufferProcessing=false;if(r<t.buffer.length)t.buffer=t.buffer.slice(r);else t.buffer.length=0}f.prototype._write=function(e,t,r){r(new Error("not implemented"))};f.prototype.end=function(e,t,r){var i=this._writableState;if(typeof e==="function"){r=e;e=null;t=null}else if(typeof t==="function"){r=t;t=null}if(typeof e!=="undefined"&&e!==null)this.write(e,t);if(!i.ending&&!i.finished)x(this,i,r)};function b(e,t){return t.ending&&t.length===0&&!t.finished&&!t.writing}function w(e,t){var r=b(e,t);if(r){t.finished=true;e.emit("finish")}return r}function x(e,t,i){t.ending=true;w(e,t);if(i){if(t.finished)r.nextTick(i);else e.once("finish",i)}t.ended=true}}).call(this,e("_process"))},{"./_stream_duplex":107,_process:78,buffer:66,"core-util-is":112,inherits:106,stream:94}],112:[function(e,t,r){arguments[4][46][0].apply(r,arguments)},{buffer:66,dup:46}],113:[function(e,t,r){arguments[4][47][0].apply(r,arguments)},{dup:47}],114:[function(e,t,r){arguments[4][48][0].apply(r,arguments)},{buffer:66,dup:48}],115:[function(e,t,r){var i=e("stream");r=t.exports=e("./lib/_stream_readable.js");r.Stream=i;r.Readable=r;r.Writable=e("./lib/_stream_writable.js");r.Duplex=e("./lib/_stream_duplex.js");r.Transform=e("./lib/_stream_transform.js");r.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":107,"./lib/_stream_passthrough.js":108,"./lib/_stream_readable.js":109,"./lib/_stream_transform.js":110,"./lib/_stream_writable.js":111,stream:94}],116:[function(e,t,r){arguments[4][31][0].apply(r,arguments)},{asap:117,dup:31,wrappy:118}],117:[function(e,t,r){arguments[4][32][0].apply(r,arguments)},{_process:78,dup:32}],118:[function(e,t,r){arguments[4][33][0].apply(r,arguments)},{dup:33}],119:[function(e,t,r){arguments[4][25][0].apply(r,arguments)},{dup:25}],120:[function(e,t,r){(function(r){var i=e("is-typedarray").strict;t.exports=function(e){var t=r.TYPED_ARRAY_SUPPORT?r._augment:function(e){return new r(e)};if(e instanceof Uint8Array){return t(e)}else if(e instanceof ArrayBuffer){return t(new Uint8Array(e))}else if(i(e)){return t(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}else{return new r(e)}}}).call(this,e("buffer").Buffer)},{buffer:66,"is-typedarray":121}],121:[function(e,t,r){t.exports=a;a.strict=s;a.loose=o;var i=Object.prototype.toString;var n={"[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 s(e)||o(e)}function s(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function o(e){return n[i.call(e)]}},{}],122:[function(e,t,r){var i=e("stream").Readable;var n=e("inherits");var a=/^.*\.(\w+)$/;var s=e("typedarray-to-buffer");function o(e,t){var r=this;if(!(this instanceof o)){return new o(e,t)}t=t||{};i.call(this,t);this._offset=0;this._ready=false;this._file=e;this._size=e.size;this._chunkSize=t.chunkSize||Math.max(this._size/1e3,200*1024);this.reader=new FileReader;this._generateHeaderBlocks(e,t,function(e,t){if(e){return r.emit("error",e)}if(Array.isArray(t)){t.forEach(function(e){r.push(e)})}r._ready=true;r.emit("_ready")})}n(o,i);t.exports=o;o.prototype._generateHeaderBlocks=function(e,t,r){r(null,[])};o.prototype._read=function(){if(!this._ready){this.once("_ready",this._read.bind(this));return}var e=this;var t=this.reader;var r=this._offset;var i=this._offset+this._chunkSize;if(i>this._size)i=this._size;if(r===this._size){this.destroy();this.push(null);return}t.onload=function(){e._offset=i;e.push(s(t.result))};t.onerror=function(){e.emit("error",t.error)};t.readAsArrayBuffer(this._file.slice(r,i))};o.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:119,stream:94,"typedarray-to-buffer":120}],123:[function(e,t,r){t.exports=function i(e,t){t=typeof t=="number"?t:Infinity;return r(e,1);function r(e,i){return e.reduce(function(e,n){if(Array.isArray(n)&&i<t){return e.concat(r(n,i+1))}else{return e.concat(n)}},[])}}},{}],124:[function(e,t,r){"use strict";var i=e("fs");t.exports=function a(e,t){if(!t)return n(e);i.stat(e,function(e,r){if(e)return t(e);return t(null,r.isFile())})};t.exports.sync=n;function n(e){return i.existsSync(e)&&i.statSync(e).isFile()}},{fs:50}],125:[function(e,t,r){"use strict";r.re=/^npm-debug\.log$|^\..*\.swp$|^\.DS_Store$|^\.AppleDouble$|^\.LSOverride$|^Icon[\r\?]?|^\._.*|^.Spotlight-V100$|\.Trashes|^__MACOSX$|~$|^Thumbs\.db$|^ehthumbs\.db$|^Desktop\.ini$/;r.is=function(e){return r.re.test(e)};r.not=r.isnt=function(e){return!r.is(e)}},{}],126:[function(e,t,r){t.exports=a;var i=e("inherits");var n=e("stream");i(a,n.Readable);function a(e,t){if(!(this instanceof a))return new a(e,t);n.Readable.call(this,t);this.destroyed=false;this._drained=false;this._forwarding=false;this._current=null;this._queue=e.map(s);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=s(t());if(!t){e.destroy();e.push(null);return}e._current=t;t.on("readable",r);t.on("end",n);t.on("error",a);t.on("close",i);function r(){e._forward()}function i(){if(!t._readableState.ended){e.destroy()}}function n(){e._current=null;t.removeListener("readable",r);t.removeListener("end",n);t.removeListener("error",a);t.removeListener("close",i);e._next()}function a(t){e.destroy(t)}};function s(e){if(!e||typeof e==="function"||e._readableState)return e;var t=(new n.Readable).wrap(e);if(e.destroy){t.destroy=e.destroy.bind(e)}return t}},{inherits:127,stream:94}],127:[function(e,t,r){arguments[4][25][0].apply(r,arguments)},{dup:25}],128:[function(e,t,r){arguments[4][33][0].apply(r,arguments)},{dup:33}],129:[function(e,t,r){arguments[4][37][0].apply(r,arguments)},{dup:37,wrappy:128}],130:[function(e,t,r){var i=e("closest-to");var n=[];for(var a=14;a<=22;a++){n.push(Math.pow(2,a))}t.exports=function(e){return i(e/Math.pow(2,10),n)}},{"closest-to":131}],131:[function(e,t,r){t.exports=function(e,t){var r=Infinity;var i=0;var n=null;t.sort(function(e,t){return e-t});for(var a=0,s=t.length;a<s;a++){i=Math.abs(e-t[a]);if(i>=r){break}r=i;n=t[a]}return n}},{}],132:[function(e,t,r){var i=e("dezalgo");t.exports=function(e,t){if(t)t=i(t);var r,n,a;if(Array.isArray(e)){r=[];n=e.length}else{a=Object.keys(e);r={};n=a.length}function s(e,i,a){r[e]=a;if(--n===0||i){if(t)t(i,r);t=null}}if(!n){if(t)t(null,r);t=null}else if(a){a.forEach(function(t){e[t](s.bind(undefined,t))})}else{e.forEach(function(e,t){e(s.bind(undefined,t))})}}},{dezalgo:133}],133:[function(e,t,r){arguments[4][31][0].apply(r,arguments)},{asap:134,dup:31,wrappy:135}],134:[function(e,t,r){arguments[4][32][0].apply(r,arguments)},{_process:78,dup:32}],135:[function(e,t,r){arguments[4][33][0].apply(r,arguments)},{dup:33}],136:[function(e,t,r){var i=e("rusha");var n=new i;var a=window.crypto||window.msCrypto||{};var s=a.subtle||a.webkitSubtle;var o=n.digest.bind(n);try{s.digest({name:"sha-1"},new Uint8Array).catch(function(){s=false})}catch(f){s=false}function l(e,t){if(!s){setTimeout(t,0,o(e));return}if(typeof e==="string"){e=u(e)}s.digest({name:"sha-1"},e).then(function r(e){t(c(new Uint8Array(e)))},function i(r){t(o(e))})}function u(e){var t=e.length;var r=new Uint8Array(t);for(var i=0;i<t;i++){r[i]=e.charCodeAt(i)}return r}function c(e){var t=e.length;var r=[];for(var i=0;i<t;i++){var n=e[i];r.push((n>>>4).toString(16));r.push((n&15).toString(16))}return r.join("")}t.exports=l;t.exports.sync=o},{rusha:137}],137:[function(e,t,r){(function(e){(function(){if(typeof t!=="undefined"){t.exports=a}else if(typeof window!=="undefined"){window.Rusha=a}if(typeof FileReaderSync!=="undefined"){var r=new FileReaderSync,i=new a(4*1024*1024);self.onmessage=function o(e){var t,r=e.data.data;try{t=i.digest(r);self.postMessage({id:e.data.id,hash:t})}catch(n){self.postMessage({id:e.data.id,error:n.name})}}}var n={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 i=function(e){for(e+=9;e%64>0;e+=1);return e};var a=function(e,t){for(var r=t>>2;r<e.length;r++)e[r]=0};var o=function(e,t,r){e[t>>2]|=128<<24-(t%4<<3);e[((t>>2)+2&~15)+14]=r>>29;e[((t>>2)+2&~15)+15]=r<<3};var f=function(e,t,r,i,n){var a=this,s,o=n%4,f=i%4,l=i-f;if(l>0){switch(o){case 0:e[n+3|0]=a.charCodeAt(r);case 1:e[n+2|0]=a.charCodeAt(r+1);case 2:e[n+1|0]=a.charCodeAt(r+2);case 3:e[n|0]=a.charCodeAt(r+3)}}for(s=o;s<l;s=s+4|0){t[n+s>>2]=a.charCodeAt(r+s)<<24|a.charCodeAt(r+s+1)<<16|a.charCodeAt(r+s+2)<<8|a.charCodeAt(r+s+3)}switch(f){case 3:e[n+l+1|0]=a.charCodeAt(r+l+2);case 2:e[n+l+2|0]=a.charCodeAt(r+l+1);case 1:e[n+l+3|0]=a.charCodeAt(r+l)}};var l=function(e,t,r,i,n){var a=this,s,o=n%4,f=i%4,l=i-f;if(l>0){switch(o){case 0:e[n+3|0]=a[r];case 1:e[n+2|0]=a[r+1];case 2:e[n+1|0]=a[r+2];case 3:e[n|0]=a[r+3]}}for(s=4-o;s<l;s=s+=4|0){t[n+s>>2]=a[r+s]<<24|a[r+s+1]<<16|a[r+s+2]<<8|a[r+s+3]}switch(f){case 3:e[n+l+1|0]=a[r+l+2];case 2:e[n+l+2|0]=a[r+l+1];case 1:e[n+l+3|0]=a[r+l]}};var u=function(e,t,i,n,a){var s=this,o,f=a%4,l=n%4,u=n-l;var c=new Uint8Array(r.readAsArrayBuffer(s.slice(i,i+n)));if(u>0){switch(f){case 0:e[a+3|0]=c[0];case 1:e[a+2|0]=c[1];case 2:e[a+1|0]=c[2];case 3:e[a|0]=c[3]}}for(o=4-f;o<u;o=o+=4|0){t[a+o>>2]=c[o]<<24|c[o+1]<<16|c[o+2]<<8|c[o+3]}switch(l){case 3:e[a+u+1|0]=c[u+2];case 2:e[a+u+2|0]=c[u+1];case 1:e[a+u+3|0]=c[u]}};var c=function(e){switch(n.getDataType(e)){case"string":return f.bind(e);case"array":return l.bind(e);case"buffer":return l.bind(e);case"arraybuffer":return l.bind(new Uint8Array(e));case"view":return l.bind(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));case"blob":return u.bind(e)}};var p=function(e,t){switch(n.getDataType(e)){case"string":return e.slice(t);case"array":return e.slice(t);case"buffer":return e.slice(t);case"arraybuffer":return e.slice(t);case"view":return e.buffer.slice(t)}};var d=function(e){var t,r,i="0123456789abcdef",n=[],a=new Uint8Array(e);for(t=0;t<a.length;t++){r=a[t];n[t]=i.charAt(r>>4&15)+i.charAt(r>>0&15)}return n.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=i(e);t.heap=new ArrayBuffer(h(t.padMaxChunkLen+320+20));t.h32=new Int32Array(t.heap);t.h8=new Int8Array(t.heap);t.core=s({Int32Array:Int32Array,DataView:DataView},{},t.heap);t.buffer=null};m(e||64*1024);var v=function(e,t){var r=new Int32Array(e,t+320,5);r[0]=1732584193;r[1]=-271733879;r[2]=-1732584194;r[3]=271733878;r[4]=-1009589776};var g=function(e,r){var n=i(e);var s=new Int32Array(t.heap,0,n>>2);a(s,e);o(s,e,r);return n};var _=function(e,r,i){c(e)(t.h8,t.h32,r,i,0)};var y=function(e,r,i,n,a){var s=i;if(a){s=g(i,n)}_(e,r,i);t.core.hash(s,t.padMaxChunkLen)};var b=function(e,t){var r=new Int32Array(e,t+320,5);var i=new Int32Array(5);var n=new DataView(i.buffer);n.setInt32(0,r[0],false);n.setInt32(4,r[1],false);n.setInt32(8,r[2],false);n.setInt32(12,r[3],false);n.setInt32(16,r[4],false);return i};var w=this.rawDigest=function(e){var r=e.byteLength||e.length||e.size||0;v(t.heap,t.padMaxChunkLen);var i=0,n=t.maxChunkLen,a;for(i=0;r>i+n;i+=n){y(e,i,n,r,false)}y(e,i,r-i,r,true);return b(t.heap,t.padMaxChunkLen)};this.digest=this.digestFromString=this.digestFromBuffer=this.digestFromArrayBuffer=function(e){return d(w(e).buffer)}}function s(e,t,r){"use asm";var i=new e.Int32Array(r);function n(e,t){e=e|0;t=t|0;var r=0,n=0,a=0,s=0,o=0,f=0,l=0,u=0,c=0,p=0,d=0,h=0,m=0,v=0;a=i[t+320>>2]|0;o=i[t+324>>2]|0;l=i[t+328>>2]|0;c=i[t+332>>2]|0;d=i[t+336>>2]|0;for(r=0;(r|0)<(e|0);r=r+64|0){s=a;f=o;u=l;p=c;h=d;for(n=0;(n|0)<64;n=n+4|0){v=i[r+n>>2]|0;m=((a<<5|a>>>27)+(o&l|~o&c)|0)+((v+d|0)+1518500249|0)|0;d=c;c=l;l=o<<30|o>>>2;o=a;a=m;i[e+n>>2]=v}for(n=e+64|0;(n|0)<(e+80|0);n=n+4|0){v=(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])<<1|(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])>>>31;m=((a<<5|a>>>27)+(o&l|~o&c)|0)+((v+d|0)+1518500249|0)|0;d=c;c=l;l=o<<30|o>>>2;o=a;a=m;i[n>>2]=v}for(n=e+80|0;(n|0)<(e+160|0);n=n+4|0){v=(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])<<1|(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])>>>31;m=((a<<5|a>>>27)+(o^l^c)|0)+((v+d|0)+1859775393|0)|0;d=c;c=l;l=o<<30|o>>>2;o=a;a=m;i[n>>2]=v}for(n=e+160|0;(n|0)<(e+240|0);n=n+4|0){v=(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])<<1|(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])>>>31;m=((a<<5|a>>>27)+(o&l|o&c|l&c)|0)+((v+d|0)-1894007588|0)|0;d=c;c=l;l=o<<30|o>>>2;o=a;a=m;i[n>>2]=v}for(n=e+240|0;(n|0)<(e+320|0);n=n+4|0){v=(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])<<1|(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])>>>31;m=((a<<5|a>>>27)+(o^l^c)|0)+((v+d|0)-899497514|0)|0;d=c;c=l;l=o<<30|o>>>2;o=a;a=m;i[n>>2]=v}a=a+s|0;o=o+f|0;l=l+u|0;c=c+p|0;d=d+h|0}i[t+320>>2]=a;i[t+324>>2]=o;i[t+328>>2]=l;i[t+332>>2]=c;i[t+336>>2]=d}return{hash:n}}})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],138:[function(e,t,r){r=t.exports=e("./debug");r.log=a;r.formatArgs=n;r.save=s;r.load=o;r.useColors=i;r.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:f();r.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}r.formatters.j=function(e){return JSON.stringify(e)};function n(){var e=arguments;var t=this.useColors;e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+r.humanize(this.diff);if(!t)return e;var i="color: "+this.color;e=[e[0],i,"color: inherit"].concat(Array.prototype.slice.call(e,1));var n=0;var a=0;e[0].replace(/%[a-z%]/g,function(e){if("%%"===e)return;n++;if("%c"===e){a=n}});e.splice(a,0,i);return e}function a(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function s(e){try{if(null==e){r.storage.removeItem("debug")}else{r.storage.debug=e}}catch(t){}}function o(){var e;try{e=r.storage.debug}catch(t){}return e}r.enable(o());function f(){try{return window.localStorage}catch(e){}}},{"./debug":139}],139:[function(e,t,r){arguments[4][23][0].apply(r,arguments)},{dup:23,ms:140}],140:[function(e,t,r){var i=1e3;var n=i*60;var a=n*60;var s=a*24;var o=s*365.25;t.exports=function(e,t){t=t||{};if("string"==typeof e)return f(e);return t.long?u(e):l(e)};function f(e){e=""+e;if(e.length>1e4)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);var f=(t[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return r*o;case"days":case"day":case"d":return r*s;case"hours":case"hour":case"hrs":case"hr":case"h":return r*a;case"minutes":case"minute":case"mins":case"min":case"m":return r*n;case"seconds":case"second":case"secs":case"sec":case"s":return r*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r}}function l(e){if(e>=s)return Math.round(e/s)+"d";if(e>=a)return Math.round(e/a)+"h";if(e>=n)return Math.round(e/n)+"m";if(e>=i)return Math.round(e/i)+"s";return e+"ms"}function u(e){return c(e,s,"day")||c(e,a,"hour")||c(e,n,"minute")||c(e,i,"second")||e+" ms"}function c(e,t,r){if(e<t)return;if(e<t*1.5)return Math.floor(e/t)+" "+r;return Math.ceil(e/t)+" "+r+"s"}},{}],141:[function(e,t,r){arguments[4][31][0].apply(r,arguments)},{asap:142,dup:31,wrappy:144}],142:[function(e,t,r){"use strict";var i=e("./raw");var n=[];var a=[];var s=i.makeRequestCallFromTimer(o);function o(){if(a.length){throw a.shift()}}t.exports=f;function f(e){var t;if(n.length){t=n.pop()}else{t=new l}t.task=e;i(t)}function l(){this.task=null}l.prototype.call=function(){try{this.task.call()}catch(e){if(f.onerror){f.onerror(e)}else{a.push(e);s()}}finally{this.task=null;n[n.length]=this}}},{"./raw":143}],143:[function(e,t,r){(function(e){"use strict";t.exports=r;function r(e){if(!i.length){a();n=true}i[i.length]=e}var i=[];var n=false;var a;var s=0;var o=1024;function f(){while(s<i.length){var e=s;s=s+1;i[e].call();if(s>o){for(var t=0,r=i.length-s;t<r;t++){i[t]=i[t+s]}i.length-=s;s=0}}i.length=0;s=0;n=false}var l=e.MutationObserver||e.WebKitMutationObserver;if(typeof l==="function"){a=u(f)}else{a=c(f)}r.requestFlush=a;function u(e){var t=1;var r=new l(e);var i=document.createTextNode("");r.observe(i,{characterData:true});return function n(){t=-t;i.data=t}}function c(e){return function t(){var t=setTimeout(i,0);var r=setInterval(i,50);function i(){clearTimeout(t);clearInterval(r);e()}}}r.makeRequestCallFromTimer=c}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],144:[function(e,t,r){arguments[4][33][0].apply(r,arguments)},{dup:33}],145:[function(e,t,r){var i=e("once");var n=function(){};var a=function(e){return e.setHeader&&typeof e.abort==="function"};var s=function(e){return e.stdio&&Array.isArray(e.stdio)&&e.stdio.length===3};var o=function(e,t,r){if(typeof t==="function")return o(e,null,t);if(!t)t={};r=i(r||n);var f=e._writableState;var l=e._readableState;var u=t.readable||t.readable!==false&&e.readable;var c=t.writable||t.writable!==false&&e.writable;var p=function(){if(!e.writable)d()};var d=function(){c=false;if(!u)r()};var h=function(){u=false;if(!c)r()};var m=function(e){r(e?new Error("exited with error code: "+e):null)};var v=function(){if(u&&!(l&&l.ended))return r(new Error("premature close"));if(c&&!(f&&f.ended))return r(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(c&&!f){e.on("end",p);e.on("close",p)}if(s(e))e.on("exit",m);e.on("end",h);e.on("finish",d);if(t.error!==false)e.on("error",r);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",r);e.removeListener("close",v)}};t.exports=o},{once:153}],146:[function(e,t,r){var i=t.exports=function(e,t){if(!t)t=16;if(e===undefined)e=128;if(e<=0)return"0";var r=Math.log(Math.pow(2,e))/Math.log(t);for(var n=2;r===Infinity;n*=2){r=Math.log(Math.pow(2,e/n))/Math.log(t)*n}var a=r-Math.floor(r);var s="";for(var n=0;n<Math.floor(r);n++){var o=Math.floor(Math.random()*t).toString(t);s=o+s}if(a){var f=Math.pow(t,a);var o=Math.floor(Math.random()*f).toString(t);s=o+s}var l=parseInt(s,t);if(l!==Infinity&&l>=Math.pow(2,e)){return i(e,t)}else return s};i.rack=function(e,t,r){var n=function(n){var s=0;do{if(s++>10){if(r)e+=r;else throw new Error("too many ID collisions, use more bits")}var o=i(e,t)}while(Object.hasOwnProperty.call(a,o));a[o]=n;return o};var a=n.hats={};n.get=function(e){return n.hats[e]};n.set=function(e,t){n.hats[e]=t;return n};n.bits=e||128;n.base=t||16;return n}},{}],147:[function(e,t,r){arguments[4][25][0].apply(r,arguments)},{dup:25}],148:[function(e,t,r){(function(r){var i=e("path");var n=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 i=e[t];for(var n=0;n<i.length;n++){if(r.env.DEBUG_MIME&&this.types[i]){console.warn(this._loading.replace(/.*\//,""),'changes "'+i[n]+'" extension type from '+this.types[i]+" to "+t)}this.types[i[n]]=t}if(!this.extensions[t]){this.extensions[t]=i[0]}}};a.prototype.load=function(e){this._loading=e;var t={},r=n.readFileSync(e,"ascii"),i=r.split(/[\r\n]+/);i.forEach(function(e){var r=e.replace(/\s*#.*|^\s*|\s*$/g,"").split(/\s+/);t[r.shift()]=r});this.define(t);this._loading=null};a.prototype.lookup=function(e,t){var r=e.replace(/.*[\.\/\\]/,"").toLowerCase();return this.types[r]||t||this.default_type};a.prototype.extension=function(e){var t=e.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase();return this.extensions[t]};var s=new a;s.define(e("./types.json"));s.default_type=s.lookup("bin");s.Mime=a;s.charsets={lookup:function(e,t){return/^text\//.test(e)?"UTF-8":t}};t.exports=s}).call(this,e("_process"))},{"./types.json":149,_process:78,fs:50,path:77}],149:[function(e,t,r){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"]}},{}],150:[function(e,t,r){arguments[4][126][0].apply(r,arguments)},{dup:126,inherits:151,stream:94}],151:[function(e,t,r){arguments[4][25][0].apply(r,arguments)},{dup:25}],152:[function(e,t,r){arguments[4][33][0].apply(r,arguments)},{dup:33}],153:[function(e,t,r){arguments[4][37][0].apply(r,arguments)},{dup:37,wrappy:152}],154:[function(e,t,r){(function(r){t.exports=f;t.exports.remote=l;var i=e("dezalgo");var n=e("fs");var a=e("simple-get");var s=e("magnet-uri");var o=e("parse-torrent-file");t.exports.toMagnetURI=s.encode;t.exports.toTorrentFile=o.encode;function f(e){var t=e&&e.length;if(typeof e==="string"&&/magnet:/.test(e)){return s(e)}else if(typeof e==="string"&&(t===40||t===32)){return s("magnet:?xt=urn:btih:"+e)}else if(r.isBuffer(e)&&t===20){return s("magnet:?xt=urn:btih:"+e.toString("hex"))}else if(r.isBuffer(e)){return o(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 l(e,t){var r;if(typeof t!=="function")throw new Error("second argument must be a Function");t=i(t);try{r=f(e)}catch(s){}if(r&&r.infoHash){t(null,r)}else if(typeof a==="function"&&/^https?:/.test(e)){a.concat({url:e,headers:{"user-agent":"WebTorrent (http://webtorrent.io)"}},function(e,r){if(e){e=new Error("Error downloading torrent: "+e.message);return t(e)}o(r)})}else if(typeof n.readFile==="function"&&typeof e==="string"){n.readFile(e,function(e,r){if(e)return t(new Error("Invalid torrent identifier"));o(r)})}else{t(new Error("Invalid torrent identifier"))}function o(e){try{r=f(e)}catch(i){return t(i)}if(r&&r.infoHash)t(null,r);else t(new Error("Invalid torrent identifier"))}}}).call(this,e("buffer").Buffer)},{buffer:66,dezalgo:155,fs:50,"magnet-uri":159,"parse-torrent-file":164,"simple-get":52}],155:[function(e,t,r){arguments[4][31][0].apply(r,arguments)},{asap:156,dup:31,wrappy:158}],156:[function(e,t,r){arguments[4][142][0].apply(r,arguments)},{"./raw":157,dup:142}],157:[function(e,t,r){arguments[4][143][0].apply(r,arguments)},{dup:143}],158:[function(e,t,r){arguments[4][33][0].apply(r,arguments)},{dup:33}],159:[function(e,t,r){(function(r){t.exports=s;t.exports.decode=s;t.exports.encode=o;var i=e("thirty-two");var n=e("xtend");var a=e("uniq");function s(e){var t={};var n=e.split("magnet:?")[1];var s=n&&n.length>=0?n.split("&"):[];s.forEach(function(e){var r=e.split("=");if(r.length!==2)return;var i=r[0];var n=r[1];if(i==="dn")n=decodeURIComponent(n).replace(/\+/g," ");if(i==="tr"||i==="xs"||i==="as"||i==="ws"){n=decodeURIComponent(n)}if(i==="kt")n=decodeURIComponent(n).split("+");if(t[i]){if(Array.isArray(t[i])){t[i].push(n)}else{var a=t[i];t[i]=[a,n]}}else{t[i]=n}});var o;if(t.xt){var f=Array.isArray(t.xt)?t.xt:[t.xt];f.forEach(function(e){if(o=e.match(/^urn:btih:(.{40})/)){t.infoHash=new r(o[1],"hex").toString("hex")}else if(o=e.match(/^urn:btih:(.{32})/)){var n=i.decode(o[1]);t.infoHash=new r(n,"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 o(e){e=n(e);if(e.infoHash)e.xt="urn:btih:"+e.infoHash;if(e.name)e.dn=e.name;if(e.keywords)e.kt=e.keywords;if(e.announce)e.tr=e.announce;if(e.urlList){e.ws=e.urlList;delete e.as}var t="magnet:?";Object.keys(e).filter(function(e){return e.length===2}).forEach(function(r,i){var n=Array.isArray(e[r])?e[r]:[e[r]];n.forEach(function(e,n){if((i>0||n>0)&&(r!=="kt"||n===0))t+="&";if(r==="dn")e=encodeURIComponent(e).replace(/%20/g,"+");if(r==="tr"||r==="xs"||r==="as"||r==="ws"){e=encodeURIComponent(e)}if(r==="kt")e=encodeURIComponent(e);if(r==="kt"&&n>0)t+="+"+e;else t+=r+"="+e})});return t}}).call(this,e("buffer").Buffer)},{buffer:66,"thirty-two":160,uniq:162,xtend:163}],160:[function(e,t,r){var i=e("./thirty-two");r.encode=i.encode;r.decode=i.decode},{"./thirty-two":161}],161:[function(e,t,r){(function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";var i=[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 n(e){var t=Math.floor(e.length/5);return e.length%5==0?t:t+1}r.encode=function(r){var i=0;var a=0;var s=0;var o=0;var f=new e(n(r)*8);if(!e.isBuffer(r)){r=new e(r)}while(i<r.length){var l=r[i];if(s>3){o=l&255>>s;s=(s+5)%8;o=o<<s|(i+1<r.length?r[i+1]:0)>>8-s;i++}else{o=l>>8-(s+5)&31;s=(s+5)%8;if(s==0)i++}f[a]=t.charCodeAt(o);a++}for(i=a;i<f.length;i++)f[i]=61;return f};r.decode=function(t){var r=0;var n=0;var a;var s=0;if(!e.isBuffer(t)){t=new e(t)}var o=new e(Math.ceil(t.length*5/8));for(var f=0;f<t.length;f++){if(t[f]==61){break}var l=t[f]-48;if(l<i.length){n=i[l];if(r<=3){r=(r+5)%8;if(r==0){a|=n;o[s]=a;s++;a=0}else{a|=255&n<<8-r}}else{r=(r+5)%8;a|=255&n>>>r;o[s]=a;s++;a=255&n<<8-r}}else{throw new Error("Invalid input - it is not base32 encoded string")}}return o.slice(0,s)}}).call(this,e("buffer").Buffer)},{buffer:66}],162:[function(e,t,r){"use strict";function i(e,t){var r=1,i=e.length,n=e[0],a=e[0];for(var s=1;s<i;++s){a=n;n=e[s];if(t(n,a)){if(s===r){r++;continue}e[r++]=n}}e.length=r;return e}function n(e){var t=1,r=e.length,i=e[0],n=e[0];for(var a=1;a<r;++a,n=i){n=i;i=e[a];if(i!==n){if(a===t){t++;continue}e[t++]=i}}e.length=t;return e}function a(e,t,r){if(e.length===0){return e}if(t){if(!r){e.sort(t)}return i(e,t)}if(!r){e.sort()}return n(e)}t.exports=a},{}],163:[function(e,t,r){arguments[4][27][0].apply(r,arguments)},{dup:27}],164:[function(e,t,r){(function(r){t.exports=o;t.exports.decode=o;t.exports.encode=f;var i=e("bencode");var n=e("path");var a=e("simple-sha1");var s=e("uniq");function o(e){if(r.isBuffer(e)){e=i.decode(e)}c(e.info,"info");c(e.info["name.utf-8"]||e.info.name,"info.name");c(e.info["piece length"],"info['piece length']");c(e.info.pieces,"info.pieces");if(e.info.files){e.info.files.forEach(function(e){c(typeof e.length==="number","info.files[0].length");c(e["path.utf-8"]||e.path,"info.files[0].path")})}else{c(typeof e.info.length==="number","info.length")}var t={};t.info=e.info;t.infoBuffer=i.encode(e.info);t.infoHash=a.sync(t.infoBuffer);t.name=(e.info["name.utf-8"]||e.info.name).toString();t.private=!!e.info.private;if(e["creation date"])t.created=new Date(e["creation date"]*1e3);if(r.isBuffer(e.comment))t.comment=e.comment.toString();t.announce=[];if(e["announce-list"]){e["announce-list"].forEach(function(e){e.forEach(function(e){t.announce.push(e.toString())})})}else if(e.announce){t.announce.push(e.announce)}s(t.announce);if(r.isBuffer(e["url-list"])){e["url-list"]=e["url-list"].length>0?[e["url-list"]]:[]}t.urlList=(e["url-list"]||[]).map(function(e){return e.toString()});var o=e.info.files||[e.info];t.files=o.map(function(e,r){var i=[].concat(t.name,e["path.utf-8"]||e.path||[]).map(function(e){return e.toString()});return{path:n.join.apply(null,[n.sep].concat(i)).slice(1),name:i[i.length-1],length:e.length,offset:o.slice(0,r).reduce(l,0)}});t.length=o.reduce(l,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 r(e,"utf8");return[e]});if(e.created){t["creation date"]=e.created.getTime()/1e3|0}if(e.urlList){t["url-list"]=e.urlList}return i.encode(t)}function l(e,t){return e+t.length}function u(e){var t=[];for(var r=0;r<e.length;r+=20){t.push(e.slice(r,r+20).toString("hex"))}return t}function c(e,t){if(!e)throw new Error("Torrent is missing required field: "+t)}}).call(this,e("buffer").Buffer)},{bencode:165,buffer:66,path:77,"simple-sha1":169,uniq:171}],165:[function(e,t,r){arguments[4][17][0].apply(r,arguments)},{"./lib/decode":166,"./lib/encode":168,dup:17}],166:[function(e,t,r){arguments[4][18][0].apply(r,arguments)},{"./dict":167,buffer:66,dup:18}],167:[function(e,t,r){arguments[4][19][0].apply(r,arguments)},{dup:19}],168:[function(e,t,r){arguments[4][20][0].apply(r,arguments)},{buffer:66,dup:20}],169:[function(e,t,r){arguments[4][136][0].apply(r,arguments)},{dup:136,rusha:170}],170:[function(e,t,r){arguments[4][137][0].apply(r,arguments)},{dup:137}],171:[function(e,t,r){arguments[4][162][0].apply(r,arguments)},{dup:162}],172:[function(e,t,r){var i=e("once");var n=e("end-of-stream");var a=e("fs");var s=function(){};var o=function(e){return typeof e==="function"};var f=function(e){return(e instanceof(a.ReadStream||s)||e instanceof(a.WriteStream||s))&&o(e.close)};var l=function(e){return e.setHeader&&o(e.abort)};var u=function(e,t,r,a){a=i(a);var s=false;e.on("close",function(){s=true});n(e,{readable:t,writable:r},function(e){if(e)return a(e);s=true;a()});var u=false;return function(t){if(s)return;if(u)return;u=true;if(f(e))return e.close();if(l(e))return e.abort();if(o(e.destroy))return e.destroy();a(t||new Error("stream was destroyed"))}};var c=function(e){e()};var p=function(e,t){return e.pipe(t)};var d=function(){var e=Array.prototype.slice.call(arguments);var t=o(e[e.length-1]||s)&&e.pop()||s;if(Array.isArray(e[0]))e=e[0];if(e.length<2)throw new Error("pump requires two streams per minimum");var r;var i=e.map(function(n,a){var s=a<e.length-1;var o=a>0;return u(n,s,o,function(e){if(!r)r=e;if(e)i.forEach(c);if(s)return;i.forEach(c);t(r)})});return e.reduce(p)};t.exports=d},{"end-of-stream":145,fs:50,once:153}],173:[function(e,t,r){t.exports=function(e,t){var r=true;var i=t.indexOf("=");if(-1==i)return-2;var n=t.slice(i+1).split(",").map(function(t){var t=t.split("-"),i=parseInt(t[0],10),n=parseInt(t[1],10);if(isNaN(i)){i=e-n;n=e-1}else if(isNaN(n)){n=e-1}if(n>e-1)n=e-1;if(isNaN(i)||isNaN(n)||i>n||i<0)r=false;return{start:i,end:n}});n.type=t.slice(0,i);return r?n:-1}},{}],174:[function(e,t,r){t.exports=n;t.exports.filter=a;var i=e("events").EventEmitter;function n(e,t,r){if(!Array.isArray(r))r=[r];var i=[];r.forEach(function(r){var n=function(){var e=[].slice.call(arguments);e.unshift(r);t.emit.apply(t,e)};i.push(n);e.on(r,n)});return function n(){r.forEach(function(t,r){e.removeListener(t,i[r])})}}function a(e,t){var r=new i;n(e,r,t);return r}},{events:70}],175:[function(e,t,r){arguments[4][132][0].apply(r,arguments)},{dezalgo:176,dup:132}],176:[function(e,t,r){arguments[4][31][0].apply(r,arguments)},{asap:177,dup:31,wrappy:178}],177:[function(e,t,r){arguments[4][32][0].apply(r,arguments)},{_process:78,dup:32}],178:[function(e,t,r){arguments[4][33][0].apply(r,arguments)},{dup:33}],179:[function(e,t,r){arguments[4][136][0].apply(r,arguments)},{dup:136,rusha:180}],180:[function(e,t,r){(function(e){(function(){var r={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 i(e){"use strict";var t={fill:0};var a=function(e){for(e+=9;e%64>0;e+=1);return e};var s=function(e,t){for(var r=t>>2;r<e.length;r++)e[r]=0};var o=function(e,t,r){e[t>>2]|=128<<24-(t%4<<3);e[((t>>2)+2&~15)+14]=r>>29;e[((t>>2)+2&~15)+15]=r<<3};var f=function(e,t,r,i,n){var a=this,s,o=n%4,f=i%4,l=i-f;if(l>0){switch(o){case 0:e[n+3|0]=a.charCodeAt(r);case 1:e[n+2|0]=a.charCodeAt(r+1);case 2:e[n+1|0]=a.charCodeAt(r+2);case 3:e[n|0]=a.charCodeAt(r+3)}}for(s=o;s<l;s=s+4|0){t[n+s>>2]=a.charCodeAt(r+s)<<24|a.charCodeAt(r+s+1)<<16|a.charCodeAt(r+s+2)<<8|a.charCodeAt(r+s+3)}switch(f){case 3:e[n+l+1|0]=a.charCodeAt(r+l+2);case 2:e[n+l+2|0]=a.charCodeAt(r+l+1);case 1:e[n+l+3|0]=a.charCodeAt(r+l)}};var l=function(e,t,r,i,n){var a=this,s,o=n%4,f=i%4,l=i-f;if(l>0){switch(o){case 0:e[n+3|0]=a[r];case 1:e[n+2|0]=a[r+1];case 2:e[n+1|0]=a[r+2];case 3:e[n|0]=a[r+3]}}for(s=4-o;s<l;s=s+=4|0){t[n+s>>2]=a[r+s]<<24|a[r+s+1]<<16|a[r+s+2]<<8|a[r+s+3]}switch(f){case 3:e[n+l+1|0]=a[r+l+2];case 2:e[n+l+2|0]=a[r+l+1];case 1:e[n+l+3|0]=a[r+l]}};var u=function(e,t,r,i,a){var s=this,o,f=a%4,l=i%4,u=i-l;var c=new Uint8Array(n.readAsArrayBuffer(s.slice(r,r+i)));if(u>0){switch(f){case 0:e[a+3|0]=c[0];case 1:e[a+2|0]=c[1];case 2:e[a+1|0]=c[2];case 3:e[a|0]=c[3]}}for(o=4-f;o<u;o=o+=4|0){t[a+o>>2]=c[o]<<24|c[o+1]<<16|c[o+2]<<8|c[o+3]}switch(l){case 3:e[a+u+1|0]=c[u+2];case 2:e[a+u+2|0]=c[u+1];case 1:e[a+u+3|0]=c[u]}};var c=function(e){switch(r.getDataType(e)){case"string":return f.bind(e);case"array":return l.bind(e);case"buffer":return l.bind(e);case"arraybuffer":return l.bind(new Uint8Array(e));case"view":return l.bind(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));case"blob":return u.bind(e)}};var p=function(e,t){switch(r.getDataType(e)){case"string":return e.slice(t);case"array":return e.slice(t);case"buffer":return e.slice(t);case"arraybuffer":return e.slice(t);case"view":return e.buffer.slice(t)}};var d=function(e){var t,r,i="0123456789abcdef",n=[],a=new Uint8Array(e);for(t=0;t<a.length;t++){r=a[t];n[t]=i.charAt(r>>4&15)+i.charAt(r>>0&15)}return n.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=a(e);t.heap=new ArrayBuffer(h(t.padMaxChunkLen+320+20));t.h32=new Int32Array(t.heap);t.h8=new Int8Array(t.heap);t.core=new i._core({Int32Array:Int32Array,DataView:DataView},{},t.heap);t.buffer=null};m(e||64*1024);var v=function(e,t){var r=new Int32Array(e,t+320,5);r[0]=1732584193;r[1]=-271733879;r[2]=-1732584194;r[3]=271733878;r[4]=-1009589776};var g=function(e,r){var i=a(e);var n=new Int32Array(t.heap,0,i>>2);s(n,e);o(n,e,r);return i};var _=function(e,r,i){c(e)(t.h8,t.h32,r,i,0)};var y=function(e,r,i,n,a){var s=i;if(a){s=g(i,n)}_(e,r,i);t.core.hash(s,t.padMaxChunkLen)};var b=function(e,t){var r=new Int32Array(e,t+320,5);var i=new Int32Array(5);var n=new DataView(i.buffer);n.setInt32(0,r[0],false);n.setInt32(4,r[1],false);n.setInt32(8,r[2],false);n.setInt32(12,r[3],false);n.setInt32(16,r[4],false);return i};var w=this.rawDigest=function(e){var r=e.byteLength||e.length||e.size||0;v(t.heap,t.padMaxChunkLen);var i=0,n=t.maxChunkLen,a;for(i=0;r>i+n;i+=n){y(e,i,n,r,false)}y(e,i,r-i,r,true);return b(t.heap,t.padMaxChunkLen)};this.digest=this.digestFromString=this.digestFromBuffer=this.digestFromArrayBuffer=function(e){return d(w(e).buffer)}}i._core=function s(e,t,r){"use asm";var i=new e.Int32Array(r);function n(e,t){e=e|0;t=t|0;var r=0,n=0,a=0,s=0,o=0,f=0,l=0,u=0,c=0,p=0,d=0,h=0,m=0,v=0;a=i[t+320>>2]|0;o=i[t+324>>2]|0;l=i[t+328>>2]|0;c=i[t+332>>2]|0;d=i[t+336>>2]|0;for(r=0;(r|0)<(e|0);r=r+64|0){s=a;f=o;u=l;p=c;h=d;for(n=0;(n|0)<64;n=n+4|0){v=i[r+n>>2]|0;m=((a<<5|a>>>27)+(o&l|~o&c)|0)+((v+d|0)+1518500249|0)|0;d=c;c=l;l=o<<30|o>>>2;o=a;a=m;i[e+n>>2]=v}for(n=e+64|0;(n|0)<(e+80|0);n=n+4|0){v=(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])<<1|(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])>>>31;m=((a<<5|a>>>27)+(o&l|~o&c)|0)+((v+d|0)+1518500249|0)|0;d=c;c=l;l=o<<30|o>>>2;o=a;a=m;i[n>>2]=v}for(n=e+80|0;(n|0)<(e+160|0);n=n+4|0){v=(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])<<1|(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])>>>31;m=((a<<5|a>>>27)+(o^l^c)|0)+((v+d|0)+1859775393|0)|0;d=c;c=l;l=o<<30|o>>>2;o=a;a=m;i[n>>2]=v}for(n=e+160|0;(n|0)<(e+240|0);n=n+4|0){v=(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])<<1|(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])>>>31;m=((a<<5|a>>>27)+(o&l|o&c|l&c)|0)+((v+d|0)-1894007588|0)|0;d=c;c=l;l=o<<30|o>>>2;o=a;a=m;i[n>>2]=v}for(n=e+240|0;(n|0)<(e+320|0);n=n+4|0){v=(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])<<1|(i[n-12>>2]^i[n-32>>2]^i[n-56>>2]^i[n-64>>2])>>>31;m=((a<<5|a>>>27)+(o^l^c)|0)+((v+d|0)-899497514|0)|0;d=c;c=l;l=o<<30|o>>>2;o=a;a=m;i[n>>2]=v}a=a+s|0;o=o+f|0;l=l+u|0;c=c+p|0;d=d+h|0}i[t+320>>2]=a;i[t+324>>2]=o;i[t+328>>2]=l;i[t+332>>2]=c;i[t+336>>2]=d}return{hash:n}};if(typeof t!=="undefined"){t.exports=i}else if(typeof window!=="undefined"){window.Rusha=i}if(typeof FileReaderSync!=="undefined"){var n=new FileReaderSync,a=new i(4*1024*1024);self.onmessage=function o(e){var t,r=e.data.data;try{t=a.digest(r);self.postMessage({id:e.data.id,hash:t})}catch(i){self.postMessage({id:e.data.id,error:i.name})}}}})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],181:[function(e,t,r){arguments[4][26][0].apply(r,arguments)},{dup:26}],182:[function(e,t,r){(function(r){t.exports=u;var i=e("debug")("torrent-discovery");var n=e("bittorrent-dht/client");var a=e("events").EventEmitter;var s=e("xtend/mutable");var o=e("inherits");var f=e("re-emitter");var l=e("bittorrent-tracker/client");o(u,a);function u(e){var t=this;if(!(t instanceof u))return new u(e);a.call(t);s(t,{announce:[],dht:typeof n==="function",rtcConfig:null,peerId:null,port:0,tracker:true,wrtc:null},e);t._externalDHT=typeof t.dht==="object";t._performedDHTLookup=false;if(!t.peerId)throw new Error("peerId required");if(!r.browser&&!t.port)throw new Error("port required");if(t.dht)t._createDHT(t.dhtPort)}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}i("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 r.nextTick(function(){e(null)})};u.prototype._createDHT=function(e){var t=this;if(!t._externalDHT)t.dht=new n;f(t.dht,t,["error","warning"]);t.dht.on("peer",function(e,r){if(r===t.infoHash)t.emit("peer",e)});if(!t._externalDHT)t.dht.listen(e)};u.prototype._createTracker=function(){var e=this;if(!e.tracker)return;var t=e.torrent||{infoHash:e.infoHash,announce:e.announce};var r={rtcConfig:e.rtcConfig,wrtc:e.wrtc};e.tracker=new l(e.peerId,e.port,t,r);f(e.tracker,e,["peer","warning","error"]);e.tracker.start()};u.prototype._dhtLookupAndAnnounce=function(){var e=this;if(e._performedDHTLookup)return;e._performedDHTLookup=true;i("dht lookup");e.dht.lookup(e.infoHash,function(t){if(t||!e.port)return;i("dht announce");e.dht.announce(e.infoHash,e.port,function(){i("dht announce complete");e.emit("dhtAnnounce")})})}}).call(this,e("_process"))},{_process:78,"bittorrent-dht/client":52,"bittorrent-tracker/client":183,debug:215,events:70,inherits:218,"re-emitter":219,"xtend/mutable":220}],183:[function(e,t,r){(function(r,i){t.exports=d;var n=e("debug")("bittorrent-tracker");var a=e("events").EventEmitter;var s=e("inherits");var o=e("once");var f=e("url");var l=e("./lib/common");var u=e("./lib/http-tracker");var c=e("./lib/udp-tracker");var p=e("./lib/websocket-tracker");s(d,a);function d(e,t,s,o){var h=this;if(!(h instanceof d))return new d(e,t,s,o);a.call(h);if(!o)o={};h._peerId=i.isBuffer(e)?e:new i(e,"hex");h._peerIdHex=h._peerId.toString("hex");h._peerIdBinary=h._peerId.toString("binary");h._infoHash=i.isBuffer(s.infoHash)?s.infoHash:new i(s.infoHash,"hex");h._infoHashHex=h._infoHash.toString("hex");h._infoHashBinary=h._infoHash.toString("binary");h._port=t;h.torrentLength=s.length;h._rtcConfig=o.rtcConfig;h._wrtc=o.wrtc;h._numWant=o.numWant||l.DEFAULT_ANNOUNCE_PEERS;h._intervalMs=o.interval||l.DEFAULT_ANNOUNCE_INTERVAL;n("new client %s",h._infoHashHex);var m={interval:h._intervalMs};var v=!!h._wrtc||typeof window!=="undefined";var g=typeof s.announce==="string"?[s.announce]:s.announce==null?[]:s.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 c==="function"){return new c(h,e,m)}else if((t==="ws:"||t==="wss:")&&v){return new p(h,e,m)}else{r.nextTick(function(){var t=new Error("unsupported tracker protocol for "+e);h.emit("warning",t)})}return null}).filter(Boolean)}d.scrape=function(e,t,r){r=o(r);var n=new i("01234567890123456789");var a=6881;var s={infoHash:Array.isArray(t)?t[0]:t,announce:[e]};var f=new d(n,a,s);f.once("error",r);var l=Array.isArray(t)?t.length:1;var u={};f.on("scrape",function(e){l-=1;u[e.infoHash]=e;if(l===0){f.destroy();var t=Object.keys(u);if(t.length===1){r(null,u[t[0]])}else{r(null,u)}}});t=Array.isArray(t)?t.map(function(e){return new i(e,"hex")}):new i(t,"hex");f.scrape({infoHash:t})};d.prototype.start=function(e){var t=this;n("send `start`");e=t._defaultAnnounceOpts(e);e.event="started";t._announce(e);t._trackers.forEach(function(e){e.setInterval(t._intervalMs)})};d.prototype.stop=function(e){var t=this;n("send `stop`");e=t._defaultAnnounceOpts(e);e.event="stopped";t._announce(e)};d.prototype.complete=function(e){var t=this;n("send `complete`");if(!e)e={};if(e.downloaded==null&&t.torrentLength!=null){e.downloaded=t.torrentLength}e=t._defaultAnnounceOpts(e);e.event="completed";t._announce(e)};d.prototype.update=function(e){var t=this;n("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;n("send `scrape`");if(!e)e={};t._trackers.forEach(function(t){t.scrape(e)})};d.prototype.setInterval=function(e){var t=this;n("setInterval");t._intervalMs=e;t._trackers.forEach(function(t){t.setInterval(e)})};d.prototype.destroy=function(){var e=this;n("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":185,"./lib/http-tracker":52,"./lib/udp-tracker":52,"./lib/websocket-tracker":186,_process:78,buffer:66,debug:187,events:70,inherits:191,once:193,url:96}],184:[function(e,t,r){(function(t){var i=e("querystring");r.IPV4_RE=/^[\d\.]+$/;r.IPV6_RE=/^[\da-fA-F:]+$/;r.CONNECTION_ID=t.concat([n(1047),n(655366528)]);r.ACTIONS={CONNECT:0,ANNOUNCE:1,SCRAPE:2,ERROR:3};r.EVENTS={update:0,completed:1,started:2,stopped:3};r.EVENT_IDS={0:"update",1:"completed",2:"started",3:"stopped"};r.EVENT_NAMES={update:"update",completed:"complete",started:"start",stopped:"stop"};function n(e){var r=new t(4);r.writeUInt32BE(e,0);return r}r.toUInt32=n;r.querystringParse=function(e){var t=i.unescape;i.unescape=unescape;var r=i.parse(e);i.unescape=t;return r};r.querystringStringify=function(e){var t=i.escape;i.escape=escape;var r=i.stringify(e);r=r.replace(/[\@\*\/\+]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()});i.escape=t;return r}}).call(this,e("buffer").Buffer)},{buffer:66,querystring:82}],185:[function(e,t,r){(function(t){var i=e("xtend/mutable");r.DEFAULT_ANNOUNCE_INTERVAL=30*60*1e3;r.DEFAULT_ANNOUNCE_PEERS=50;r.MAX_ANNOUNCE_PEERS=82;r.binaryToHex=function(e){return new t(e,"binary").toString("hex")};r.hexToBinary=function(e){return new t(e,"hex").toString("binary")};var n=e("./common-node");i(r,n)}).call(this,e("buffer").Buffer)},{"./common-node":184,buffer:66,"xtend/mutable":214}],186:[function(e,t,r){t.exports=d;var i=e("debug")("bittorrent-tracker:websocket-tracker");var n=e("events").EventEmitter;var a=e("hat");var s=e("inherits");var o=e("simple-peer");var f=e("simple-websocket");var l=e("./common");var u={};var c=30*1e3;var p=5*1e3;s(d,n);function d(e,t,r){var a=this;n.call(a);i("new websocket tracker %s",t);a.client=e;a.destroyed=false;a._opts=r;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(r){e.offers=r;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 r=t.announce.bind(t,t.client._defaultAnnounceOpts());t._interval=setInterval(r,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){i("ignoring websocket data from %s for %s (looking for %s: reused socket)",t._announceUrl,l.binaryToHex(e.info_hash),t.client._infoHashHex);return}if(e.peer_id&&e.peer_id===t.client._peerIdBinary){return}i("received %s from %s for %s",JSON.stringify(e),t._announceUrl,t.client._infoHashHex);var r=e["failure reason"];if(r)return t.client.emit("warning",new Error(r));var n=e["warning message"];if(n)t.client.emit("warning",new Error(n));var a=e.interval||e["min interval"];if(a&&!t._opts.interval&&t._intervalMs!==0){t.setInterval(a*1e3)}var s=e["tracker id"];if(s){t._trackerId=s}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 o({trickle:false,config:t.client._rtcConfig,wrtc:t.client._wrtc});f.id=l.binaryToHex(e.peer_id);f.once("signal",function(r){var i={info_hash:t.client._infoHashBinary,peer_id:t.client._peerIdBinary,to_peer_id:e.peer_id,answer:r,offer_id:e.offer_id};if(t._trackerId)i.trackerid=t._trackerId;t._send(i)});f.signal(e.offer);t.client.emit("peer",f)}if(e.answer&&e.peer_id){f=t._peers[l.binaryToHex(e.offer_id)];if(f){f.id=l.binaryToHex(e.peer_id);f.signal(e.answer);t.client.emit("peer",f)}else{i("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()*c)+p;setTimeout(function(){e.destroyed=false;e._openSocket()},t);i("reconnecting socket in %s ms",t)};d.prototype._send=function(e){var t=this;if(t.destroyed)return;var r=JSON.stringify(e);i("send %s",r);t._socket.send(r)};d.prototype._generateOffers=function(e,t){var r=this;var n=[];i("generating %s offers",e);for(var s=0;s<e;++s){f()}function f(){var e=a(160);var t=r._peers[e]=new o({initiator:true,trickle:false,config:r.client._rtcConfig,wrtc:r.client._wrtc});t.once("signal",function(t){n.push({offer:t,offer_id:l.hexToBinary(e)});u()})}function u(){if(n.length===e){i("generated %s offers",e);t(n)}}};function h(){}},{"./common":185,debug:187,events:70,hat:190,inherits:191,"simple-peer":194,"simple-websocket":206}],187:[function(e,t,r){arguments[4][138][0].apply(r,arguments)},{"./debug":188,dup:138}],188:[function(e,t,r){arguments[4][23][0].apply(r,arguments)},{dup:23,ms:189}],189:[function(e,t,r){arguments[4][140][0].apply(r,arguments)},{dup:140}],190:[function(e,t,r){arguments[4][146][0].apply(r,arguments)},{dup:146}],191:[function(e,t,r){arguments[4][25][0].apply(r,arguments)},{dup:25}],192:[function(e,t,r){arguments[4][33][0].apply(r,arguments)},{dup:33}],193:[function(e,t,r){arguments[4][37][0].apply(r,arguments)},{dup:37,wrappy:192}],194:[function(e,t,r){(function(r){t.exports=c;var i=e("debug")("simple-peer");var n=e("get-browser-rtc");var a=e("hat");var s=e("inherits");var o=e("is-typedarray");var f=e("once");var l=e("stream");var u=e("typedarray-to-buffer");s(c,l.Duplex);function c(e){var t=this;if(!(t instanceof c))return new c(e);t._debug("new peer %o",e);if(!e)e={};e.allowHalfOpen=false;if(e.highWaterMark==null)e.highWaterMark=1024*1024;l.Duplex.call(t,e);t.initiator=e.initiator||false;t.channelConfig=e.channelConfig||c.channelConfig;t.channelName=e.channelName||a(160);if(!e.initiator)t.channelName=null;t.config=e.config||c.config;t.constraints=e.constraints||c.constraints;t.reconnectTimer=e.reconnectTimer||0;t.sdpTransform=e.sdpTransform||function(e){return e};t.stream=e.stream||false;t.trickle=e.trickle!==undefined?e.trickle:true;t.destroyed=false;t.connected=false;t.remoteAddress=undefined;t.remoteFamily=undefined;t.remotePort=undefined;t.localAddress=undefined;t.localPort=undefined;t._wrtc=e.wrtc||n();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=f(t._createOffer.bind(t));if(typeof window==="undefined"||!window.webkitRTCPeerConnection){t._pc.onnegotiationneeded()}}else{t._pc.ondatachannel=t._setupData.bind(t)}t.on("finish",function(){if(t.connected){setTimeout(function(){t._destroy()},100)}else{t.once("connect",function(){setTimeout(function(){t._destroy()},100)})}})}c.WEBRTC_SUPPORT=!!n();c.config={iceServers:[{url:"stun:23.21.150.121",urls:"stun:23.21.150.121"}]};c.constraints={};c.channelConfig={};Object.defineProperty(c.prototype,"bufferSize",{get:function(){var e=this;return e._channel&&e._channel.bufferedAmount||0}});c.prototype.address=function(){var e=this;return{port:e.localPort,family:"IPv4",address:e.localAddress}};c.prototype.signal=function(e){var t=this;if(t.destroyed)throw new Error("cannot signal after peer is destroyed");if(typeof e==="string"){try{e=JSON.parse(e)}catch(r){e={}}}t._debug("signal()");if(e.sdp){t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e),function(){if(t.destroyed)return;if(t._pc.remoteDescription.type==="offer")t._createAnswer()},t._onError.bind(t))}if(e.candidate){try{t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e.candidate),p,t._onError.bind(t))}catch(r){t._destroy(new Error("error adding candidate: "+r.message))}}if(!e.sdp&&!e.candidate){t._destroy(new Error("signal() called with invalid signal data"))}};c.prototype.send=function(e){var t=this;if(!o.strict(e)&&!(e instanceof ArrayBuffer)&&!r.isBuffer(e)&&typeof e!=="string"&&(typeof Blob==="undefined"||!(e instanceof Blob))){e=JSON.stringify(e)}if(r.isBuffer(e)&&!o.strict(e)){e=new Uint8Array(e)}var i=e.length||e.byteLength||e.size;t._channel.send(e);t._debug("write: %d bytes",i)};c.prototype.destroy=function(e){var t=this;t._destroy(null,e)};c.prototype._destroy=function(e,t){var r=this;if(r.destroyed)return;if(t)r.once("close",t);r._debug("destroy (error: %s)",e&&e.message);r.readable=r.writable=false;if(!r._readableState.ended)r.push(null);if(!r._writableState.finished)r.end();r.destroyed=true;r.connected=false;r._pcReady=false;r._channelReady=false;r._chunk=null;r._cb=null;clearInterval(r._interval);clearTimeout(r._reconnectTimeout);if(r._pc){try{r._pc.close()}catch(e){}r._pc.oniceconnectionstatechange=null;r._pc.onsignalingstatechange=null;r._pc.onicecandidate=null}if(r._channel){try{r._channel.close()}catch(e){}r._channel.onmessage=null;r._channel.onopen=null;r._channel.onclose=null}r._pc=null;r._channel=null;if(e)r.emit("error",e);r.emit("close")};c.prototype._setupData=function(e){var t=this;t._channel=e.channel;t.channelName=t._channel.label;t._channel.binaryType="arraybuffer";t._channel.onmessage=t._onChannelMessage.bind(t);t._channel.onopen=t._onChannelOpen.bind(t);t._channel.onclose=t._onChannelClose.bind(t)};c.prototype._read=function(){};c.prototype._write=function(e,t,r){var i=this;if(i.destroyed)return r(new Error("cannot write after peer is destroyed"));if(i.connected){try{i.send(e)}catch(n){return i._onError(n)}if(i._channel.bufferedAmount>i._maxBufferedAmount){i._debug("start backpressure: bufferedAmount %d",i._channel.bufferedAmount);i._cb=r}else{r(null)}}else{i._debug("write before connect");i._chunk=e;i._cb=r}};c.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 r=function(){var r=e._pc.localDescription||t;e._debug("signal");e.emit("signal",{type:r.type,sdp:r.sdp})};if(e.trickle||e._iceComplete)r();else e.once("_iceComplete",r)},e._onError.bind(e),e.offerConstraints)};c.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 r=function(){var r=e._pc.localDescription||t;e._debug("signal");e.emit("signal",{type:r.type,sdp:r.sdp})};if(e.trickle||e._iceComplete)r();else e.once("_iceComplete",r)},e._onError.bind(e),e.answerConstraints)};c.prototype._onIceConnectionStateChange=function(){var e=this;if(e.destroyed)return;var t=e._pc.iceGatheringState;var r=e._pc.iceConnectionState;e._debug("iceConnectionStateChange %s %s",t,r);e.emit("iceConnectionStateChange",t,r);if(r==="connected"||r==="completed"){clearTimeout(e._reconnectTimeout);e._pcReady=true;e._maybeReady()}if(r==="disconnected"){if(e.reconnectTimer){clearTimeout(e._reconnectTimeout);e._reconnectTimeout=setTimeout(function(){e._destroy()},e.reconnectTimer)}else{e._destroy()}}if(r==="closed"){e._destroy()}};c.prototype._maybeReady=function(){var e=this;e._debug("maybeReady pc %s channel %s",e._pcReady,e._channelReady);if(e.connected||e._connecting||!e._pcReady||!e._channelReady)return;e._connecting=true;if(typeof window!=="undefined"&&!!window.mozRTCPeerConnection){e._pc.getStats(null,function(e){var r=[];e.forEach(function(e){r.push(e)});t(r)},e._onError.bind(e))}else{e._pc.getStats(function(e){var r=[];e.result().forEach(function(e){var t={};e.names().forEach(function(r){t[r]=e.stat(r)});t.id=e.id;t.type=e.type;t.timestamp=e.timestamp;r.push(t)});t(r)})}function t(t){t.forEach(function(t){if(t.type==="remotecandidate"){e.remoteAddress=t.ipAddress;e.remoteFamily="IPv4";e.remotePort=Number(t.portNumber);e._debug("connect remote: %s:%s (%s)",e.remoteAddress,e.remotePort,e.remoteFamily)}else if(t.type==="localcandidate"&&t.candidateType==="host"){e.localAddress=t.ipAddress;e.localPort=Number(t.portNumber);e._debug("connect local: %s:%s",e.localAddress,e.localPort)}});e._connecting=false;e.connected=true;if(e._chunk){try{e.send(e._chunk)}catch(r){return e._onError(r)}e._chunk=null;e._debug('sent chunk from "write before connect"');var i=e._cb;e._cb=null;i(null)}e._interval=setInterval(function(){if(!e._cb||!e._channel||e._channel.bufferedAmount>e._maxBufferedAmount)return;e._debug("ending backpressure: bufferedAmount %d",e._channel.bufferedAmount);var t=e._cb;e._cb=null;t(null)},150);if(e._interval.unref)e._interval.unref();e._debug("connect");e.emit("connect")}};c.prototype._onSignalingStateChange=function(){var e=this;if(e.destroyed)return;e._debug("signalingStateChange %s",e._pc.signalingState);e.emit("signalingStateChange",e._pc.signalingState)};c.prototype._onIceCandidate=function(e){var t=this;if(t.destroyed)return;if(e.candidate&&t.trickle){t.emit("signal",{candidate:{candidate:e.candidate.candidate,sdpMLineIndex:e.candidate.sdpMLineIndex,sdpMid:e.candidate.sdpMid}})}else if(!e.candidate){t._iceComplete=true;t.emit("_iceComplete")}};c.prototype._onChannelMessage=function(e){var t=this;if(t.destroyed)return;var r=e.data;t._debug("read: %d bytes",r.byteLength||r.length);if(r instanceof ArrayBuffer){r=u(new Uint8Array(r));t.push(r)}else{try{r=JSON.parse(r)}catch(i){}t.emit("data",r)}};c.prototype._onChannelOpen=function(){var e=this;if(e.connected||e.destroyed)return;e._debug("on channel open");e._channelReady=true;e._maybeReady()};c.prototype._onChannelClose=function(){var e=this;if(e.destroyed)return;e._debug("on channel close");e._destroy()};c.prototype._onAddStream=function(e){var t=this;if(t.destroyed)return;t._debug("on add stream");t.emit("stream",e.stream)};c.prototype._onError=function(e){var t=this;if(t.destroyed)return;t._debug("error %s",e.message||e);t._destroy(e)};c.prototype._debug=function(){var e=this;var t=[].slice.call(arguments);var r=e.channelName&&e.channelName.substring(0,7);t[0]="["+r+"] "+t[0];i.apply(null,t)};function p(){}}).call(this,e("buffer").Buffer)},{buffer:66,debug:195,"get-browser-rtc":198,hat:199,inherits:200,"is-typedarray":201,once:203,stream:94,"typedarray-to-buffer":204}],195:[function(e,t,r){arguments[4][138][0].apply(r,arguments)},{"./debug":196,dup:138}],196:[function(e,t,r){arguments[4][23][0].apply(r,arguments)},{dup:23,ms:197}],197:[function(e,t,r){arguments[4][140][0].apply(r,arguments)},{dup:140}],198:[function(e,t,r){t.exports=function i(){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}},{}],199:[function(e,t,r){arguments[4][146][0].apply(r,arguments)},{dup:146}],200:[function(e,t,r){arguments[4][25][0].apply(r,arguments)},{dup:25}],201:[function(e,t,r){t.exports=a;a.strict=s;a.loose=o;var i=Object.prototype.toString;var n={"[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 s(e)||o(e)}function s(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 o(e){return n[i.call(e)]}},{}],202:[function(e,t,r){arguments[4][33][0].apply(r,arguments)},{dup:33}],203:[function(e,t,r){arguments[4][37][0].apply(r,arguments)},{dup:37,wrappy:202}],204:[function(e,t,r){arguments[4][120][0].apply(r,arguments)},{buffer:66,dup:120,"is-typedarray":205}],205:[function(e,t,r){arguments[4][201][0].apply(r,arguments)},{dup:201}],206:[function(e,t,r){(function(r){t.exports=u;var i=e("debug")("simple-websocket");var n=e("inherits");var a=e("is-typedarray");var s=e("stream");var o=e("typedarray-to-buffer");var f=e("ws");var l=typeof window!=="undefined"?window.WebSocket:f;n(u,s.Duplex);function u(e,t){var r=this;if(!(r instanceof u))return new u(e,t);if(!t)t={};i("new websocket: %s %o",e,t);t.allowHalfOpen=false;if(t.highWaterMark==null)t.highWaterMark=1024*1024;s.Duplex.call(r,t);r.url=e;r.connected=false;r.destroyed=false;r._maxBufferedAmount=t.highWaterMark;r._chunk=null;r._cb=null;r._interval=null;r._ws=new l(r.url);r._ws.binaryType="arraybuffer";r._ws.onopen=r._onOpen.bind(r);r._ws.onmessage=r._onMessage.bind(r);r._ws.onclose=r._onClose.bind(r);r._ws.onerror=function(){r._onError(new Error("connection error to "+r.url))};r.on("finish",function(){if(r.connected){setTimeout(function(){r._destroy()},100)}else{r.once("connect",function(){setTimeout(function(){r._destroy()},100)})}})}u.prototype.send=function(e){var t=this;if(!a.strict(e)&&!(e instanceof ArrayBuffer)&&!r.isBuffer(e)&&typeof e!=="string"&&(typeof Blob==="undefined"||!(e instanceof Blob))){e=JSON.stringify(e)}var n=e.length||e.byteLength||e.size;t._ws.send(e);i("write: %d bytes",n)};u.prototype.destroy=function(e){var t=this;t._destroy(null,e)};u.prototype._destroy=function(e,t){var r=this;if(r.destroyed)return;if(t)r.once("close",t);i("destroy (error: %s)",e&&e.message);this.readable=this.writable=false;if(!r._readableState.ended)r.push(null);if(!r._writableState.finished)r.end();r.connected=false;r.destroyed=true;clearInterval(r._interval);r._interval=null;r._chunk=null;r._cb=null;if(r._ws){try{r._ws.close()}catch(e){}r._ws.onopen=null;r._ws.onmessage=null;r._ws.onclose=null;r._ws.onerror=null}r._ws=null;if(e)r.emit("error",e);r.emit("close")};u.prototype._read=function(){};u.prototype._write=function(e,t,r){var n=this;if(n.destroyed)return r(new Error("cannot write after socket is destroyed"));if(n.connected){try{n.send(e)}catch(a){return n._onError(a)}if(typeof f!=="function"&&n._ws.bufferedAmount>n._maxBufferedAmount){i("start backpressure: bufferedAmount %d",n._ws.bufferedAmount);n._cb=r}else{r(null)}}else{i("write before connect");n._chunk=e;n._cb=r}};u.prototype._onMessage=function(e){var t=this;if(t.destroyed)return;var n=e.data;i("read: %d bytes",n.byteLength||n.length);if(n instanceof ArrayBuffer){n=o(new Uint8Array(n));t.push(n)}else if(r.isBuffer(n)){t.push(n)}else{try{n=JSON.parse(n)}catch(a){}t.emit("data",n)}};u.prototype._onOpen=function(){var e=this;if(e.connected||e.destroyed)return;e.connected=true;if(e._chunk){try{e.send(e._chunk)}catch(t){return e._onError(t)}e._chunk=null;i('sent chunk from "write before connect"');var r=e._cb;e._cb=null;r(null)}if(typeof f!=="function"){e._interval=setInterval(function(){if(!e._cb||!e._ws||e._ws.bufferedAmount>e._maxBufferedAmount){
-return}i("ending backpressure: bufferedAmount %d",e._ws.bufferedAmount);var t=e._cb;e._cb=null;t(null)},150);if(e._interval.unref)e._interval.unref()}i("connect");e.emit("connect")};u.prototype._onClose=function(){var e=this;if(e.destroyed)return;i("on close");e._destroy()};u.prototype._onError=function(e){var t=this;if(t.destroyed)return;i("error: %s",e.message||e);t._destroy(e)}}).call(this,e("buffer").Buffer)},{buffer:66,debug:207,inherits:210,"is-typedarray":211,stream:94,"typedarray-to-buffer":212,ws:52}],207:[function(e,t,r){arguments[4][138][0].apply(r,arguments)},{"./debug":208,dup:138}],208:[function(e,t,r){arguments[4][23][0].apply(r,arguments)},{dup:23,ms:209}],209:[function(e,t,r){arguments[4][140][0].apply(r,arguments)},{dup:140}],210:[function(e,t,r){arguments[4][25][0].apply(r,arguments)},{dup:25}],211:[function(e,t,r){arguments[4][201][0].apply(r,arguments)},{dup:201}],212:[function(e,t,r){arguments[4][120][0].apply(r,arguments)},{buffer:66,dup:120,"is-typedarray":213}],213:[function(e,t,r){arguments[4][201][0].apply(r,arguments)},{dup:201}],214:[function(e,t,r){t.exports=i;function i(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r){if(r.hasOwnProperty(i)){e[i]=r[i]}}}return e}},{}],215:[function(e,t,r){arguments[4][138][0].apply(r,arguments)},{"./debug":216,dup:138}],216:[function(e,t,r){arguments[4][23][0].apply(r,arguments)},{dup:23,ms:217}],217:[function(e,t,r){arguments[4][140][0].apply(r,arguments)},{dup:140}],218:[function(e,t,r){arguments[4][25][0].apply(r,arguments)},{dup:25}],219:[function(e,t,r){arguments[4][174][0].apply(r,arguments)},{dup:174,events:70}],220:[function(e,t,r){arguments[4][214][0].apply(r,arguments)},{dup:214}],221:[function(e,t,r){arguments[4][162][0].apply(r,arguments)},{dup:162}],222:[function(e,t,r){(function(r){var i=e("bencode");var n=e("bitfield");var a=e("events").EventEmitter;var s=e("inherits");var o=e("simple-sha1");var f=1e7;var l=1e3;var u=16*1024;t.exports=function(e){s(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 n(0,{grow:l});if(r.isBuffer(e)){this.setMetadata(e)}}t.prototype.name="ut_metadata";t.prototype.onHandshake=function(e,t,r){this._infoHash=e;this._infoHashHex=e.toString("hex")};t.prototype.onExtendedHandshake=function(e){if(!e.m||!e.m.ut_metadata){return this.emit("warning",new Error("Peer does not support ut_metadata"))}if(!e.metadata_size){return this.emit("warning",new Error("Peer does not have metadata"))}if(e.metadata_size>f){return this.emit("warning",new Error("Peer gave maliciously large metadata size"))}this._metadataSize=e.metadata_size;this._numPieces=Math.ceil(this._metadataSize/u);this._remainingRejects=this._numPieces*2;if(this._fetching){this._requestPieces()}};t.prototype.onMessage=function(e){var t,r;try{var n=e.toString();var a=n.indexOf("ee")+2;t=i.decode(n.substring(0,a));r=e.slice(a)}catch(s){return}switch(t.msg_type){case 0:this._onRequest(t.piece);break;case 1:this._onData(t.piece,r,t.total_size);break;case 2:this._onReject(t.piece);break}};t.prototype.fetch=function(){if(this._metadataComplete){return}this._fetching=true;if(this._metadataSize){this._requestPieces()}};t.prototype.cancel=function(){this._fetching=false};t.prototype.setMetadata=function(e){if(this._metadataComplete)return true;try{var t=i.decode(e).info;if(t){e=i.encode(t)}}catch(r){}if(this._infoHashHex&&this._infoHashHex!==o.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",i.encode({info:i.decode(this.metadata)}));return true};t.prototype._send=function(e,t){var n=i.encode(e);if(r.isBuffer(t)){n=r.concat([n,t])}this._wire.extended("ut_metadata",n)};t.prototype._request=function(e){this._send({msg_type:0,piece:e})};t.prototype._data=function(e,t,r){var i={msg_type:1,piece:e};if(typeof r==="number"){i.total_size=r}this._send(i,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 r=t+u;if(r>this._metadataSize){r=this._metadataSize}var i=this.metadata.slice(t,r);this._data(e,i,this._metadataSize)};t.prototype._onData=function(e,t,r){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 r(this._metadataSize);for(var e=0;e<this._numPieces;e++){this._request(e)}};t.prototype._checkDone=function(){var e=true;for(var t=0;t<this._numPieces;t++){if(!this._bitfield.get(t)){e=false;break}}if(!e)return;var r=this.setMetadata(this.metadata);if(!r){this._failedMetadata()}};t.prototype._failedMetadata=function(){this._bitfield=new n(0,{grow:l});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:223,bitfield:227,buffer:66,events:70,inherits:228,"simple-sha1":229}],223:[function(e,t,r){arguments[4][17][0].apply(r,arguments)},{"./lib/decode":224,"./lib/encode":226,dup:17}],224:[function(e,t,r){arguments[4][18][0].apply(r,arguments)},{"./dict":225,buffer:66,dup:18}],225:[function(e,t,r){arguments[4][19][0].apply(r,arguments)},{dup:19}],226:[function(e,t,r){arguments[4][20][0].apply(r,arguments)},{buffer:66,dup:20}],227:[function(e,t,r){arguments[4][10][0].apply(r,arguments)},{buffer:66,dup:10}],228:[function(e,t,r){arguments[4][25][0].apply(r,arguments)},{dup:25}],229:[function(e,t,r){arguments[4][136][0].apply(r,arguments)},{dup:136,rusha:230}],230:[function(e,t,r){arguments[4][137][0].apply(r,arguments)},{dup:137}],231:[function(e,t,r){var i=function(e,t,r){this._byteOffset=t||0;if(e instanceof ArrayBuffer){this.buffer=e}else if(typeof e=="object"){this.dataView=e;if(t){this._byteOffset+=t}}else{this.buffer=new ArrayBuffer(e||0)}this.position=0;this.endianness=r==null?i.LITTLE_ENDIAN:r};t.exports=i;i.prototype={};i.prototype.save=function(e){var t=new Blob([this.buffer]);var r=window.webkitURL||window.URL;if(r&&r.createObjectURL){var i=r.createObjectURL(t);var n=document.createElement("a");n.setAttribute("href",i);n.setAttribute("download",e);n.click();r.revokeObjectURL(i)}else{throw"DataStream.save: Can't create object URL."}};i.BIG_ENDIAN=false;i.LITTLE_ENDIAN=true;i.prototype._dynamicSize=true;Object.defineProperty(i.prototype,"dynamicSize",{get:function(){return this._dynamicSize},set:function(e){if(!e){this._trimAlloc()}this._dynamicSize=e}});i.prototype._byteLength=0;Object.defineProperty(i.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}});Object.defineProperty(i.prototype,"buffer",{get:function(){this._trimAlloc();return this._buffer},set:function(e){this._buffer=e;this._dataView=new DataView(this._buffer,this._byteOffset);this._byteLength=this._buffer.byteLength}});Object.defineProperty(i.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e;this._dataView=new DataView(this._buffer,this._byteOffset);this._byteLength=this._buffer.byteLength}});Object.defineProperty(i.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset;this._buffer=e.buffer;this._dataView=new DataView(this._buffer,this._byteOffset);this._byteLength=this._byteOffset+e.byteLength}});i.prototype._realloc=function(e){if(!this._dynamicSize){return}var t=this._byteOffset+this.position+e;var r=this._buffer.byteLength;if(t<=r){if(t>this._byteLength){this._byteLength=t}return}if(r<1){r=1}while(t>r){r*=2}var i=new ArrayBuffer(r);var n=new Uint8Array(this._buffer);var a=new Uint8Array(i,0,n.length);a.set(n);this.buffer=i;this._byteLength=t};i.prototype._trimAlloc=function(){if(this._byteLength==this._buffer.byteLength){return}var e=new ArrayBuffer(this._byteLength);var t=new Uint8Array(e);var r=new Uint8Array(this._buffer,0,t.length);t.set(r);this.buffer=e};i.prototype.shift=function(e){var t=new ArrayBuffer(this._byteLength-e);var r=new Uint8Array(t);var i=new Uint8Array(this._buffer,e,r.length);r.set(i);this.buffer=t;this.position-=e};i.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t};i.prototype.isEof=function(){return this.position>=this._byteLength};i.prototype.mapInt32Array=function(e,t){this._realloc(e*4);var r=new Int32Array(this._buffer,this.byteOffset+this.position,e);i.arrayToNative(r,t==null?this.endianness:t);this.position+=e*4;return r};i.prototype.mapInt16Array=function(e,t){this._realloc(e*2);var r=new Int16Array(this._buffer,this.byteOffset+this.position,e);i.arrayToNative(r,t==null?this.endianness:t);this.position+=e*2;return r};i.prototype.mapInt8Array=function(e){this._realloc(e*1);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);this.position+=e*1;return t};i.prototype.mapUint32Array=function(e,t){this._realloc(e*4);var r=new Uint32Array(this._buffer,this.byteOffset+this.position,e);i.arrayToNative(r,t==null?this.endianness:t);this.position+=e*4;return r};i.prototype.mapUint16Array=function(e,t){this._realloc(e*2);var r=new Uint16Array(this._buffer,this.byteOffset+this.position,e);i.arrayToNative(r,t==null?this.endianness:t);this.position+=e*2;return r};i.prototype.mapUint8Array=function(e){this._realloc(e*1);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);this.position+=e*1;return t};i.prototype.mapFloat64Array=function(e,t){this._realloc(e*8);var r=new Float64Array(this._buffer,this.byteOffset+this.position,e);i.arrayToNative(r,t==null?this.endianness:t);this.position+=e*8;return r};i.prototype.mapFloat32Array=function(e,t){this._realloc(e*4);var r=new Float32Array(this._buffer,this.byteOffset+this.position,e);i.arrayToNative(r,t==null?this.endianness:t);this.position+=e*4;return r};i.prototype.readInt32Array=function(e,t){e=e==null?this.byteLength-this.position/4:e;var r=new Int32Array(e);i.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT);i.arrayToNative(r,t==null?this.endianness:t);this.position+=r.byteLength;return r};i.prototype.readInt16Array=function(e,t){e=e==null?this.byteLength-this.position/2:e;var r=new Int16Array(e);i.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT);i.arrayToNative(r,t==null?this.endianness:t);this.position+=r.byteLength;return r};i.prototype.readInt8Array=function(e){e=e==null?this.byteLength-this.position:e;var t=new Int8Array(e);i.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT);this.position+=t.byteLength;return t};i.prototype.readUint32Array=function(e,t){e=e==null?this.byteLength-this.position/4:e;var r=new Uint32Array(e);i.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT);i.arrayToNative(r,t==null?this.endianness:t);this.position+=r.byteLength;return r};i.prototype.readUint16Array=function(e,t){e=e==null?this.byteLength-this.position/2:e;var r=new Uint16Array(e);i.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT);i.arrayToNative(r,t==null?this.endianness:t);this.position+=r.byteLength;return r};i.prototype.readUint8Array=function(e){e=e==null?this.byteLength-this.position:e;var t=new Uint8Array(e);i.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT);this.position+=t.byteLength;return t};i.prototype.readFloat64Array=function(e,t){e=e==null?this.byteLength-this.position/8:e;var r=new Float64Array(e);i.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT);i.arrayToNative(r,t==null?this.endianness:t);this.position+=r.byteLength;return r};i.prototype.readFloat32Array=function(e,t){e=e==null?this.byteLength-this.position/4:e;var r=new Float32Array(e);i.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT);i.arrayToNative(r,t==null?this.endianness:t);this.position+=r.byteLength;return r};i.prototype.writeInt32Array=function(e,t){this._realloc(e.length*4);if(e instanceof Int32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0){i.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength);this.mapInt32Array(e.length,t)}else{for(var r=0;r<e.length;r++){this.writeInt32(e[r],t)}}};i.prototype.writeInt16Array=function(e,t){this._realloc(e.length*2);if(e instanceof Int16Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0){i.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength);this.mapInt16Array(e.length,t)}else{for(var r=0;r<e.length;r++){this.writeInt16(e[r],t)}}};i.prototype.writeInt8Array=function(e){this._realloc(e.length*1);if(e instanceof Int8Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0){i.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength);this.mapInt8Array(e.length)}else{for(var t=0;t<e.length;t++){this.writeInt8(e[t])}}};i.prototype.writeUint32Array=function(e,t){this._realloc(e.length*4);if(e instanceof Uint32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0){i.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength);this.mapUint32Array(e.length,t)}else{for(var r=0;r<e.length;r++){this.writeUint32(e[r],t)}}};i.prototype.writeUint16Array=function(e,t){this._realloc(e.length*2);if(e instanceof Uint16Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0){i.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength);this.mapUint16Array(e.length,t)}else{for(var r=0;r<e.length;r++){this.writeUint16(e[r],t)}}};i.prototype.writeUint8Array=function(e){this._realloc(e.length*1);if(e instanceof Uint8Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0){i.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength);this.mapUint8Array(e.length)}else{for(var t=0;t<e.length;t++){this.writeUint8(e[t])}}};i.prototype.writeFloat64Array=function(e,t){this._realloc(e.length*8);if(e instanceof Float64Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0){i.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength);this.mapFloat64Array(e.length,t)}else{for(var r=0;r<e.length;r++){this.writeFloat64(e[r],t)}}};i.prototype.writeFloat32Array=function(e,t){this._realloc(e.length*4);if(e instanceof Float32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0){i.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength);this.mapFloat32Array(e.length,t)}else{for(var r=0;r<e.length;r++){this.writeFloat32(e[r],t)}}};i.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,e==null?this.endianness:e);this.position+=4;return t};i.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,e==null?this.endianness:e);this.position+=2;return t};i.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);this.position+=1;return e};i.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,e==null?this.endianness:e);this.position+=4;return t};i.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,e==null?this.endianness:e);this.position+=2;return t};i.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);this.position+=1;return e};i.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,e==null?this.endianness:e);this.position+=4;return t};i.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,e==null?this.endianness:e);this.position+=8;return t};i.prototype.writeInt32=function(e,t){this._realloc(4);this._dataView.setInt32(this.position,e,t==null?this.endianness:t);this.position+=4};i.prototype.writeInt16=function(e,t){this._realloc(2);this._dataView.setInt16(this.position,e,t==null?this.endianness:t);this.position+=2};i.prototype.writeInt8=function(e){this._realloc(1);this._dataView.setInt8(this.position,e);this.position+=1};i.prototype.writeUint32=function(e,t){this._realloc(4);this._dataView.setUint32(this.position,e,t==null?this.endianness:t);this.position+=4};i.prototype.writeUint16=function(e,t){this._realloc(2);this._dataView.setUint16(this.position,e,t==null?this.endianness:t);this.position+=2};i.prototype.writeUint8=function(e){this._realloc(1);this._dataView.setUint8(this.position,e);this.position+=1};i.prototype.writeFloat32=function(e,t){this._realloc(4);this._dataView.setFloat32(this.position,e,t==null?this.endianness:t);this.position+=4};i.prototype.writeFloat64=function(e,t){this._realloc(8);this._dataView.setFloat64(this.position,e,t==null?this.endianness:t);this.position+=8};i.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0;i.memcpy=function(e,t,r,i,n){var a=new Uint8Array(e,t,n);var s=new Uint8Array(r,i,n);a.set(s)};i.arrayToNative=function(e,t){if(t==this.endianness){return e}else{return this.flipArrayEndianness(e)}};i.nativeToEndian=function(e,t){if(this.endianness==t){return e}else{return this.flipArrayEndianness(e)}};i.flipArrayEndianness=function(e){var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);for(var r=0;r<e.byteLength;r+=e.BYTES_PER_ELEMENT){for(var i=r+e.BYTES_PER_ELEMENT-1,n=r;i>n;i--,n++){var a=t[n];t[n]=t[i];t[i]=a}}return e};i.prototype.failurePosition=0;i.prototype.readStruct=function(e){var t={},r,i,n;var a=this.position;for(var s=0;s<e.length;s+=2){r=e[s+1];i=this.readType(r,t);if(i==null){if(this.failurePosition===0){this.failurePosition=this.position}this.position=a;return null}t[e[s]]=i}return t};i.prototype.readUCS2String=function(e,t){return String.fromCharCode.apply(null,this.readUint16Array(e,t))};i.prototype.writeUCS2String=function(e,t,r){if(r==null){r=e.length}for(var i=0;i<e.length&&i<r;i++){this.writeUint16(e.charCodeAt(i),t)}for(;i<r;i++){this.writeUint16(0)}};i.prototype.readString=function(e,t){if(t==null||t=="ASCII"){return String.fromCharCode.apply(null,this.mapUint8Array(e==null?this.byteLength-this.position:e))}else{return new TextDecoder(t).decode(this.mapUint8Array(e))}};i.prototype.writeString=function(e,t,r){var i=0;if(t==null||t=="ASCII"){if(r!=null){var n=Math.min(e.length,r);for(i=0;i<n;i++){this.writeUint8(e.charCodeAt(i))}for(;i<r;i++){this.writeUint8(0)}}else{for(i=0;i<e.length;i++){this.writeUint8(e.charCodeAt(i))}}}else{this.writeUint8Array(new TextEncoder(t).encode(e.substring(0,r)))}};i.prototype.readCString=function(e){var t=this.byteLength-this.position;var r=new Uint8Array(this._buffer,this._byteOffset+this.position);var i=t;if(e!=null){i=Math.min(e,t)}for(var n=0;n<i&&r[n]!==0;n++);var a=String.fromCharCode.apply(null,this.mapUint8Array(n));if(e!=null){this.position+=i-n}else if(n!=t){this.position+=1}return a};i.prototype.writeCString=function(e,t){var r=0;if(t!=null){var i=Math.min(e.length,t);for(r=0;r<i;r++){this.writeUint8(e.charCodeAt(r))}for(;r<t;r++){this.writeUint8(0)}}else{for(r=0;r<e.length;r++){this.writeUint8(e.charCodeAt(r))}this.writeUint8(0)}};i.prototype.readType=function(e,t){if(typeof e=="function"){return e(this,t)}else if(typeof e=="object"&&!(e instanceof Array)){return e.get(this,t)}else if(e instanceof Array&&e.length!=3){return this.readStruct(e,t)}var r=null;var n=null;var a="ASCII";var s=this.position;var o;var f;var l;if(typeof e=="string"&&/:/.test(e)){o=e.split(":");e=o[0];n=parseInt(o[1])}if(typeof e=="string"&&/,/.test(e)){o=e.split(",");e=o[0];a=parseInt(o[1])}switch(e){case"uint8":r=this.readUint8();break;case"int8":r=this.readInt8();break;case"uint16":r=this.readUint16(this.endianness);break;case"int16":r=this.readInt16(this.endianness);break;case"uint32":r=this.readUint32(this.endianness);break;case"int32":r=this.readInt32(this.endianness);break;case"float32":r=this.readFloat32(this.endianness);break;case"float64":r=this.readFloat64(this.endianness);break;case"uint16be":r=this.readUint16(i.BIG_ENDIAN);break;case"int16be":r=this.readInt16(i.BIG_ENDIAN);break;case"uint32be":r=this.readUint32(i.BIG_ENDIAN);break;case"int32be":r=this.readInt32(i.BIG_ENDIAN);break;case"float32be":r=this.readFloat32(i.BIG_ENDIAN);break;case"float64be":r=this.readFloat64(i.BIG_ENDIAN);break;case"uint16le":r=this.readUint16(i.LITTLE_ENDIAN);break;case"int16le":r=this.readInt16(i.LITTLE_ENDIAN);break;case"uint32le":r=this.readUint32(i.LITTLE_ENDIAN);break;case"int32le":r=this.readInt32(i.LITTLE_ENDIAN);break;case"float32le":r=this.readFloat32(i.LITTLE_ENDIAN);break;case"float64le":r=this.readFloat64(i.LITTLE_ENDIAN);break;case"cstring":r=this.readCString(n);break;case"string":r=this.readString(n,a);break;case"u16string":r=this.readUCS2String(n,this.endianness);break;case"u16stringle":r=this.readUCS2String(n,i.LITTLE_ENDIAN);break;case"u16stringbe":r=this.readUCS2String(n,i.BIG_ENDIAN);break;default:if(e.length==3){var u=e[1];var c=e[2];var p=0;if(typeof c=="function"){p=c(t,this,e)}else if(typeof c=="string"&&t[c]!=null){p=parseInt(t[c])}else{p=parseInt(c)}if(typeof u=="string"){var d=u.replace(/(le|be)$/,"");var h=null;if(/le$/.test(u)){h=i.LITTLE_ENDIAN}else if(/be$/.test(u)){h=i.BIG_ENDIAN}if(c=="*"){p=null}switch(d){case"uint8":r=this.readUint8Array(p);break;case"uint16":r=this.readUint16Array(p,h);break;case"uint32":r=this.readUint32Array(p,h);break;case"int8":r=this.readInt8Array(p);break;case"int16":r=this.readInt16Array(p,h);break;case"int32":r=this.readInt32Array(p,h);break;case"float32":r=this.readFloat32Array(p,h);break;case"float64":r=this.readFloat64Array(p,h);break;case"cstring":case"utf16string":case"string":if(p==null){r=[];while(!this.isEof()){l=this.readType(u,t);if(l==null)break;r.push(l)}}else{r=new Array(p);for(f=0;f<p;f++){r[f]=this.readType(u,t)}}break}}else{if(c=="*"){r=[];var m=this.buffer;while(true){var v=this.position;try{var g=this.readType(u,t);if(g==null){this.position=v;break}r.push(g)}catch(_){this.position=v;break}}}else{r=new Array(p);for(f=0;f<p;f++){l=this.readType(u,t);if(l==null)return null;r[f]=l}}}break}}if(n!=null){this.position=s+n}return r};i.prototype.writeStruct=function(e,t){for(var r=0;r<e.length;r+=2){var i=e[r+1];this.writeType(i,t[e[r]],t)}};i.prototype.writeType=function(e,t,r){var n;if(typeof e=="function"){return e(this,t)}else if(typeof e=="object"&&!(e instanceof Array)){return e.set(this,t,r)}var a=null;var s="ASCII";var o=this.position;if(typeof e=="string"&&/:/.test(e)){n=e.split(":");e=n[0];a=parseInt(n[1])}if(typeof e=="string"&&/,/.test(e)){n=e.split(",");e=n[0];s=parseInt(n[1])}switch(e){case"uint8":this.writeUint8(t);break;case"int8":this.writeInt8(t);break;case"uint16":this.writeUint16(t,this.endianness);break;case"int16":this.writeInt16(t,this.endianness);break;case"uint32":this.writeUint32(t,this.endianness);break;case"int32":this.writeInt32(t,this.endianness);break;case"float32":this.writeFloat32(t,this.endianness);break;case"float64":this.writeFloat64(t,this.endianness);break;case"uint16be":this.writeUint16(t,i.BIG_ENDIAN);break;case"int16be":this.writeInt16(t,i.BIG_ENDIAN);break;case"uint32be":this.writeUint32(t,i.BIG_ENDIAN);break;case"int32be":this.writeInt32(t,i.BIG_ENDIAN);break;case"float32be":this.writeFloat32(t,i.BIG_ENDIAN);break;case"float64be":this.writeFloat64(t,i.BIG_ENDIAN);break;case"uint16le":this.writeUint16(t,i.LITTLE_ENDIAN);break;case"int16le":this.writeInt16(t,i.LITTLE_ENDIAN);break;case"uint32le":this.writeUint32(t,i.LITTLE_ENDIAN);break;case"int32le":this.writeInt32(t,i.LITTLE_ENDIAN);break;case"float32le":this.writeFloat32(t,i.LITTLE_ENDIAN);break;case"float64le":this.writeFloat64(t,i.LITTLE_ENDIAN);break;case"cstring":this.writeCString(t,a);break;case"string":this.writeString(t,s,a);break;case"u16string":this.writeUCS2String(t,this.endianness,a);break;case"u16stringle":this.writeUCS2String(t,i.LITTLE_ENDIAN,a);break;case"u16stringbe":this.writeUCS2String(t,i.BIG_ENDIAN,a);break;default:if(e.length==3){var f=e[1];for(var l=0;l<t.length;l++){this.writeType(f,t[l])}break}else{this.writeStruct(e,t);break}}if(a!=null){this.position=o;this._realloc(a);this.position=o+a}};var n=Math.pow(2,32);r.MAX_SIZE=n;i.prototype.readUint64=function(){return this.readUint32()*n+this.readUint32()};i.prototype.writeUint64=function(e){var t=Math.floor(e/n);this.writeUint32(t);this.writeUint32(e&4294967295)};i.prototype.readUint24=function(){return(this.readUint8()<<16)+(this.readUint8()<<8)+this.readUint8()};i.prototype.writeUint24=function(e){this.writeUint8((e&16711680)>>16);this.writeUint8((e&65280)>>8);this.writeUint8(e&255)};i.prototype.adjustUint32=function(e,t){var r=this.position;this.seek(e);this.writeUint32(t);this.seek(r)}},{}],232:[function(e,t,r){var n=e("./DataStream");var a=e("./descriptor");var s=e("./log");var o={ERR_NOT_ENOUGH_DATA:0,OK:1,boxCodes:["mdat","avcC","hvcC","ftyp","payl","vmhd","smhd","hmhd","dref","elst"],fullBoxCodes:["mvhd","tkhd","mdhd","hdlr","smhd","hmhd","nhmd","url ","urn ","ctts","cslg","stco","co64","stsc","stss","stsz","stz2","stts","stsh","mehd","trex","mfhd","tfhd","trun","tfdt","esds","subs","txtC"],containerBoxCodes:[["moov",["trak"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl"],["mvex",["trex"]],["moof",["traf"]],["traf",["trun"]],["vttc"],["tref"]],sampleEntryCodes:[{prefix:"Visual",types:["mp4v","avc1","avc2","avc3","avc4","avcp","drac","encv","mjp2","mvc1","mvc2","resv","s263","svc1","vc-1","hvc1","hev1"]},{prefix:"Audio",types:["mp4a","ac-3","alac","dra1","dtsc","dtse",,"dtsh","dtsl","ec-3","enca","g719","g726","m4ae","mlpa","raw ","samr","sawb","sawp","sevc","sqcp","ssmv","twos"]},{prefix:"Hint",types:["fdp ","m2ts","pm2t","prtp","rm2t","rrtp","rsrp","rtp ","sm2t","srtp"]},{prefix:"Metadata",types:["metx","mett","urim"]},{prefix:"Subtitle",types:["stpp","wvtt","sbtt","tx3g","stxt"]}],trackReferenceTypes:["scal"],initialize:function(){var e,t;var r;o.FullBox.prototype=new o.Box;o.ContainerBox.prototype=new o.Box;o.stsdBox.prototype=new o.FullBox;o.SampleEntry.prototype=new o.FullBox;o.TrackReferenceTypeBox.prototype=new o.Box;r=o.boxCodes.length;for(e=0;e<r;e++){o[o.boxCodes[e]+"Box"]=function(e){return function(t){o.Box.call(this,o.boxCodes[e],t)}}(e);o[o.boxCodes[e]+"Box"].prototype=new o.Box}r=o.fullBoxCodes.length;for(e=0;e<r;e++){o[o.fullBoxCodes[e]+"Box"]=function(e){return function(t){o.FullBox.call(this,o.fullBoxCodes[e],t)}}(e);o[o.fullBoxCodes[e]+"Box"].prototype=new o.FullBox}r=o.containerBoxCodes.length;for(e=0;e<r;e++){o[o.containerBoxCodes[e][0]+"Box"]=function(e,t){return function(r){o.ContainerBox.call(this,o.containerBoxCodes[e][0],r);if(t){this.subBoxNames=t;var i=t.length;for(var n=0;n<i;n++){this[t[n]+"s"]=[]}}}}(e,o.containerBoxCodes[e][1]);o[o.containerBoxCodes[e][0]+"Box"].prototype=new o.ContainerBox}r=o.sampleEntryCodes.length;for(t=0;t<r;t++){var i=o.sampleEntryCodes[t].prefix;var n=o.sampleEntryCodes[t].types;var a=n.length;o[i+"SampleEntry"]=function(e,t){o.SampleEntry.call(this,e,t)};o[i+"SampleEntry"].prototype=new o.SampleEntry;for(e=0;e<a;e++){o[n[e]+"Box"]=function(e,t){return function(r){o[o.sampleEntryCodes[e].prefix+"SampleEntry"].call(this,o.sampleEntryCodes[e].types[t],r)}}(t,e);o[n[e]+"Box"].prototype=new o[i+"SampleEntry"]}}r=o.trackReferenceTypes.length;for(e=0;e<r;e++){o[o.trackReferenceTypes[e]+"Box"]=function(e){return function(t){o.TrackReferenceTypeBox.call(this,o.trackReferenceTypes[e],t)}}(e);o[o.trackReferenceTypes[e]+"Box"].prototype=new o.Box}},Box:function(e,t){this.type=e;this.size=t},FullBox:function(e,t){o.Box.call(this,e,t);this.flags=0;this.version=0},ContainerBox:function(e,t){o.Box.call(this,e,t);this.boxes=[]},SampleEntry:function(e,t){o.Box.call(this,e,t);this.boxes=[]},TrackReferenceTypeBox:function(e,t){o.Box.call(this,e,t);this.track_ids=[]},stsdBox:function(e){o.FullBox.call(this,"stsd",e);this.entries=[]},parseOneBox:function(e,t){var r;var i=e.position;var n=0;if(e.byteLength-e.position<8){s.d("BoxParser","Not enough data in stream to parse the type and size of the box");return{code:o.ERR_NOT_ENOUGH_DATA}}var a=e.readUint32();var f=e.readString(4);s.d("BoxParser","Found box of type "+f+" and size "+a+" at position "+i+" in the current buffer ("+(e.buffer.fileStart+i)+" in the file)");n=8;if(a==1){if(e.byteLength-e.position<8){e.seek(i);s.w("BoxParser",'Not enough data in stream to parse the extended size of the "'+f+'" box');return{code:o.ERR_NOT_ENOUGH_DATA}}a=e.readUint64();n+=8}else if(a===0){throw"Unlimited box size not supported"}if(i+a>e.byteLength){e.seek(i);s.w("BoxParser",'Not enough data in stream to parse the entire "'+f+'" box');return{code:o.ERR_NOT_ENOUGH_DATA,type:f,size:a,hdr_size:n}}if(o[f+"Box"]){r=new o[f+"Box"](a-n)}else{if(t){r=new o.SampleEntry(f,a-n)}else{r=new o.Box(f,a-n)}}r.hdr_size=n;r.start=i;r.fileStart=i+e.buffer.fileStart;r.parse(e);e.seek(i+a);return{code:o.OK,box:r,size:a}}};t.exports=o;o.initialize();o.Box.prototype.parse=function(e){if(this.type!="mdat"){this.data=e.readUint8Array(this.size)}else{e.seek(this.start+this.size+this.hdr_size)}};o.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8();this.flags=e.readUint24();this.size-=4};o.ContainerBox.prototype.parse=function(e){var t;var r;var i;i=e.position;while(e.position<i+this.size){t=o.parseOneBox(e);r=t.box;this.boxes.push(r);if(this.subBoxNames&&this.subBoxNames.indexOf(r.type)!=-1){this[this.subBoxNames+"s"].push(r)}else{this[r.type]=r}}};o.SampleEntry.prototype.isVideo=function(){return false};o.SampleEntry.prototype.isAudio=function(){return false};o.SampleEntry.prototype.isSubtitle=function(){return false};o.SampleEntry.prototype.isMetadata=function(){return false};o.SampleEntry.prototype.isHint=function(){return false};o.SampleEntry.prototype.getCodec=function(){return this.type};o.SampleEntry.prototype.getWidth=function(){return""};o.SampleEntry.prototype.getHeight=function(){return""};o.SampleEntry.prototype.getChannelCount=function(){return""};o.SampleEntry.prototype.getSampleRate=function(){return""};o.SampleEntry.prototype.getSampleSize=function(){return""};o.SampleEntry.prototype.parseHeader=function(e){this.start=e.position;e.readUint8Array(6);this.data_reference_index=e.readUint16()};o.SampleEntry.prototype.parse=function(e){this.parseHeader(e);e.seek(this.start+this.size)};o.SampleEntry.prototype.parseFooter=function(e){var t;var r;while(e.position<this.start+this.size){t=o.parseOneBox(e,false);r=t.box;this.boxes.push(r);this[r.type]=r}};o.VisualSampleEntry.prototype.parse=function(e){this.parseHeader(e);e.readUint16();e.readUint16();e.readUint32Array(3);this.width=e.readUint16();this.height=e.readUint16();this.horizresolution=e.readUint32();this.vertresolution=e.readUint32();e.readUint32();this.frame_count=e.readUint16();this.compressorname=e.readString(32);this.depth=e.readUint16();e.readUint16();this.parseFooter(e)};o.VisualSampleEntry.prototype.isVideo=function(){return true};o.VisualSampleEntry.prototype.getWidth=function(){return this.width};o.VisualSampleEntry.prototype.getHeight=function(){return this.height};o.AudioSampleEntry.prototype.parse=function(e){this.parseHeader(e);e.readUint32Array(2);this.channel_count=e.readUint16();this.samplesize=e.readUint16();e.readUint16();e.readUint16();this.samplerate=e.readUint32()/(1<<16);this.parseFooter(e)};o.AudioSampleEntry.prototype.isAudio=function(){return true};o.AudioSampleEntry.prototype.getChannelCount=function(){return this.channel_count};o.AudioSampleEntry.prototype.getSampleRate=function(){return this.samplerate};o.AudioSampleEntry.prototype.getSampleSize=function(){return this.samplesize};o.SubtitleSampleEntry.prototype.parse=function(e){this.parseHeader(e);this.parseFooter(e)};o.SubtitleSampleEntry.prototype.isSubtitle=function(){return true};o.MetadataSampleEntry.prototype.parse=function(e){this.parseHeader(e);this.parseFooter(e)};o.MetadataSampleEntry.prototype.isMetadata=function(){
-return true};o.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint8Array(this.size)};o.metxBox.prototype.parse=function(e){this.parseHeader(e);this.content_encoding=e.readCString();this.namespace=e.readCString();this.schema_location=e.readCString();this.parseFooter(e)};o.mettBox.prototype.parse=function(e){this.parseHeader(e);this.content_encoding=e.readCString();this.mime_format=e.readCString();this.parseFooter(e)};o.sbttBox.prototype.parse=function(e){this.parseHeader(e);this.content_encoding=e.readCString();this.mime_format=e.readCString();this.parseFooter(e)};o.stxtBox.prototype.parse=function(e){this.parseHeader(e);this.content_encoding=e.readCString();this.mime_format=e.readCString();this.parseFooter(e)};o.stppBox.prototype.parse=function(e){this.parseHeader(e);this.namespace=e.readCString();this.schema_location=e.readCString();this.auxiliary_mime_types=e.readCString();this.parseFooter(e)};o.tx3gBox.prototype.parse=function(e){this.parseHeader(e);this.displayFlags=e.readUint32();this.horizontal_justification=e.readInt8();this.vertical_justification=e.readInt8();this.bg_color_rgba=e.readUint8Array(4);this.box_record=e.readInt16Array(4);this.style_record=e.readUint8Array(12);this.parseFooter(e)};o.ftypBox.prototype.parse=function(e){this.major_brand=e.readString(4);this.minor_version=e.readUint32();this.size-=8;this.compatible_brands=[];var t=0;while(this.size>=4){this.compatible_brands[t]=e.readString(4);this.size-=4;t++}};o.mvhdBox.prototype.parse=function(e){this.flags=0;this.parseFullHeader(e);if(this.version==1){this.creation_time=e.readUint64();this.modification_time=e.readUint64();this.timescale=e.readUint32();this.duration=e.readUint64()}else{this.creation_time=e.readUint32();this.modification_time=e.readUint32();this.timescale=e.readUint32();this.duration=e.readUint32()}this.rate=e.readUint32();this.volume=e.readUint16()>>8;e.readUint16();e.readUint32Array(2);this.matrix=e.readUint32Array(9);e.readUint32Array(6);this.next_track_id=e.readUint32()};o.TKHD_FLAG_ENABLED=1;o.TKHD_FLAG_IN_MOVIE=2;o.TKHD_FLAG_IN_PREVIEW=4;o.tkhdBox.prototype.parse=function(e){this.parseFullHeader(e);if(this.version==1){this.creation_time=e.readUint64();this.modification_time=e.readUint64();this.track_id=e.readUint32();e.readUint32();this.duration=e.readUint64()}else{this.creation_time=e.readUint32();this.modification_time=e.readUint32();this.track_id=e.readUint32();e.readUint32();this.duration=e.readUint32()}e.readUint32Array(2);this.layer=e.readInt16();this.alternate_group=e.readInt16();this.volume=e.readInt16()>>8;e.readUint16();this.matrix=e.readInt32Array(9);this.width=e.readUint32();this.height=e.readUint32()};o.mdhdBox.prototype.parse=function(e){this.parseFullHeader(e);if(this.version==1){this.creation_time=e.readUint64();this.modification_time=e.readUint64();this.timescale=e.readUint32();this.duration=e.readUint64()}else{this.creation_time=e.readUint32();this.modification_time=e.readUint32();this.timescale=e.readUint32();this.duration=e.readUint32()}this.language=e.readUint16();var t=[];t[0]=this.language>>10&31;t[1]=this.language>>5&31;t[2]=this.language&31;this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96);e.readUint16()};o.hdlrBox.prototype.parse=function(e){this.parseFullHeader(e);if(this.version===0){e.readUint32();this.handler=e.readString(4);e.readUint32Array(3);this.name=e.readCString()}else{this.data=e.readUint8Array(size)}};o.stsdBox.prototype.parse=function(e){var t;var r;this.parseFullHeader(e);r=e.readUint32();for(i=1;i<=r;i++){t=o.parseOneBox(e,true);this.entries.push(t.box)}};o.avcCBox.prototype.parse=function(e){var t;var r;var i;this.configurationVersion=e.readUint8();this.AVCProfileIndication=e.readUint8();this.profile_compatibility=e.readUint8();this.AVCLevelIndication=e.readUint8();this.lengthSizeMinusOne=e.readUint8()&3;r=e.readUint8()&31;this.size-=6;this.SPS=new Array(r);for(t=0;t<r;t++){i=e.readUint16();this.SPS[t]=e.readUint8Array(i);this.size-=2+i}r=e.readUint8();this.size--;this.PPS=new Array(r);for(t=0;t<r;t++){i=e.readUint16();this.PPS[t]=e.readUint8Array(i);this.size-=2+i}if(this.size>0){this.ext=e.readUint8Array(this.size)}};o.hvcCBox.prototype.parse=function(e){var t;var r;var i;var n;this.configurationVersion=e.readUint8();n=e.readUint8();this.general_profile_space=n>>6;this.general_tier_flag=(n&32)>>5;this.general_profile_idc=n&31;this.general_profile_compatibility=e.readUint32();this.general_constraint_indicator=e.readUint8Array(6);this.general_level_idc=e.readUint8();this.min_spatial_segmentation_idc=e.readUint16()&4095;this.parallelismType=e.readUint8()&3;this.chromaFormat=e.readUint8()&3;this.bitDepthLumaMinus8=e.readUint8()&7;this.bitDepthChromaMinus8=e.readUint8()&7;this.avgFrameRate=e.readUint16();n=e.readUint8();this.constantFrameRate=n>>6;this.numTemporalLayers=(n&13)>>3;this.temporalIdNested=(n&4)>>2;this.lengthSizeMinusOne=n&3;this.nalu_arrays=[];numOfArrays=e.readUint8();for(t=0;t<numOfArrays;t++){var a=[];this.nalu_arrays.push(a);n=e.readUint8();a.completeness=(n&128)>>7;a.nalu_type=n&63;numNalus=e.readUint16();for(j=0;j<numNalus;j++){var s={};a.push(s);i=e.readUint16();s.data=e.readUint8Array(i)}}};function f(e,t){var r=Number(e).toString(16);t=typeof t==="undefined"||t===null?t=2:t;while(r.length<t){r="0"+r}return r}o.avc1Box.prototype.getCodec=function(){var e=o.SampleEntry.prototype.getCodec.call(this);if(this.avcC){return e+"."+f(this.avcC.AVCProfileIndication)+""+f(this.avcC.profile_compatibility)+""+f(this.avcC.AVCLevelIndication)}else{return e}};o.hvc1Box.prototype.getCodec=function(){var e;var t=o.SampleEntry.prototype.getCodec.call(this);if(this.hvcC){t+=".";switch(this.hvcC.general_profile_space){case 0:t+="";break;case 1:t+="A";break;case 2:t+="B";break;case 3:t+="C";break}t+=this.hvcC.general_profile_idc;t+=".";var r=this.hvcC.general_profile_compatibility;var i=0;for(e=0;e<32;e++){i|=r&1;if(e==31)break;i<<=1;r>>=1}t+=f(i,0);t+=".";if(this.hvcC.general_tier_flag===0){t+="L"}else{t+="H"}t+=this.hvcC.general_level_idc;var n=false;var a="";for(e=5;e>=0;e--){if(this.hvcC.general_constraint_indicator[e]||n){a="."+f(this.hvcC.general_constraint_indicator[e],0)+a;n=true}}t+=a}return t};o.mp4aBox.prototype.getCodec=function(){var e=o.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI();var r=this.esds.esd.getAudioConfig();return e+"."+f(t)+(r?"."+r:"")}else{return e}};o.esdsBox.prototype.parse=function(e){this.parseFullHeader(e);this.data=e.readUint8Array(this.size);this.size=0;var t=new a;this.esd=t.parseOneDescriptor(new n(this.data.buffer,0,n.BIG_ENDIAN))};o.txtCBox.prototype.parse=function(e){this.parseFullHeader(e);this.config=e.readCString()};o.cttsBox.prototype.parse=function(e){var t;var r;this.parseFullHeader(e);t=e.readUint32();this.sample_counts=[];this.sample_offsets=[];if(this.version===0){for(r=0;r<t;r++){this.sample_counts.push(e.readUint32());this.sample_offsets.push(e.readInt32())}}else if(this.version==1){for(r=0;r<t;r++){this.sample_counts.push(e.readUint32());this.sample_offsets.push(e.readInt32())}}else{this.data=e.readUint8Array(this.size-4)}};o.cttsBox.prototype.unpack=function(e){var t,r,i;i=0;for(t=0;t<this.sample_counts.length;t++){for(r=0;r<this.sample_counts[t];r++){e[i].pts=e[i].dts+this.sample_offsets[t];i++}}};o.cslgBox.prototype.parse=function(e){var t;this.parseFullHeader(e);if(this.version===0){this.compositionToDTSShift=e.readInt32();this.leastDecodeToDisplayDelta=e.readInt32();this.greatestDecodeToDisplayDelta=e.readInt32();this.compositionStartTime=e.readInt32();this.compositionEndTime=e.readInt32()}else{this.data=e.readUint8Array(this.size-4)}};o.sttsBox.prototype.parse=function(e){var t;var r;this.parseFullHeader(e);t=e.readUint32();this.sample_counts=[];this.sample_deltas=[];if(this.version===0){for(r=0;r<t;r++){this.sample_counts.push(e.readUint32());this.sample_deltas.push(e.readUint32())}}else{this.data=e.readUint8Array(this.size-4)}};o.sttsBox.prototype.unpack=function(e){var t,r,i;i=0;for(t=0;t<this.sample_counts.length;t++){for(r=0;r<this.sample_counts[t];r++){if(i===0){e[i].dts=0}else{e[i].dts=e[i-1].dts+this.sample_deltas[t]}i++}}};o.stssBox.prototype.parse=function(e){var t;this.parseFullHeader(e);t=e.readUint32();if(this.version===0){this.sample_numbers=e.readUint32Array(t)}else{this.data=e.readUint8Array(this.size-4)}};o.stshBox.prototype.parse=function(e){var t;var r;this.parseFullHeader(e);t=e.readUint32();this.shadowed_sample_numbers=[];this.sync_sample_numbers=[];if(this.version===0){for(r=0;r<t;r++){this.shadowed_sample_numbers.push(e.readUint32());this.sync_sample_numbers.push(e.readUint32())}}else{this.data=e.readUint8Array(this.size-4)}};o.stcoBox.prototype.parse=function(e){var t;this.parseFullHeader(e);t=e.readUint32();if(this.version===0){this.chunk_offsets=e.readUint32Array(t)}else{this.data=e.readUint8Array(this.size-4)}};o.stcoBox.prototype.unpack=function(e){var t;for(t=0;t<this.chunk_offsets.length;t++){e[t].offset=this.chunk_offsets[t]}};o.co64Box.prototype.parse=function(e){var t;var r;this.parseFullHeader(e);t=e.readUint32();this.chunk_offsets=[];if(this.version===0){for(r=0;r<t;r++){this.chunk_offsets.push(e.readUint64())}}else{this.data=e.readUint8Array(this.size-4)}};o.stscBox.prototype.parse=function(e){var t;var r;this.parseFullHeader(e);t=e.readUint32();this.first_chunk=[];this.samples_per_chunk=[];this.sample_description_index=[];if(this.version===0){for(r=0;r<t;r++){this.first_chunk.push(e.readUint32());this.samples_per_chunk.push(e.readUint32());this.sample_description_index.push(e.readUint32())}}else{this.data=e.readUint8Array(this.size-4)}};o.stscBox.prototype.unpack=function(e){var t,r,i,n,a;n=0;a=0;for(t=0;t<this.first_chunk.length;t++){for(r=0;r<(t+1<this.first_chunk.length?this.first_chunk[t+1]:Infinity);r++){a++;for(i=0;i<this.samples_per_chunk[t];i++){if(e[n]){e[n].description_index=this.sample_description_index[t];e[n].chunk_index=a}else{return}n++}}}};o.stszBox.prototype.parse=function(e){var t;var r;var i;this.parseFullHeader(e);this.sample_sizes=[];if(this.version===0){r=e.readUint32();i=e.readUint32();if(r===0){this.sample_sizes=e.readUint32Array(i)}else{this.sample_sizes=[];for(t=0;t<i;t++){this.sample_sizes[t]=r}}}else{this.data=e.readUint8Array(this.size)}};o.stszBox.prototype.unpack=function(e){var t;for(t=0;t<this.sample_sizes.length;t++){e[t].size=this.sample_sizes[t]}};o.mehdBox.prototype.parse=function(e){this.parseFullHeader(e);if(this.version==1){this.fragment_duration=e.readUint64()}else{this.fragment_duration=e.readUint32()}};o.trexBox.prototype.parse=function(e){this.parseFullHeader(e);this.track_id=e.readUint32();this.default_sample_description_index=e.readUint32();this.default_sample_duration=e.readUint32();this.default_sample_size=e.readUint32();this.default_sample_flags=e.readUint32()};o.mfhdBox.prototype.parse=function(e){this.parseFullHeader(e);this.sequence_number=e.readUint32()};o.TFHD_FLAG_BASE_DATA_OFFSET=1;o.TFHD_FLAG_SAMPLE_DESC=2;o.TFHD_FLAG_SAMPLE_DUR=8;o.TFHD_FLAG_SAMPLE_SIZE=16;o.TFHD_FLAG_SAMPLE_FLAGS=32;o.TFHD_FLAG_DUR_EMPTY=65536;o.TFHD_FLAG_DEFAULT_BASE_IS_MOOF=131072;o.tfhdBox.prototype.parse=function(e){var t=0;this.parseFullHeader(e);this.track_id=e.readUint32();if(this.size>t&&this.flags&o.TFHD_FLAG_BASE_DATA_OFFSET){this.base_data_offset=e.readUint64();t+=8}else{this.base_data_offset=0}if(this.size>t&&this.flags&o.TFHD_FLAG_SAMPLE_DESC){this.default_sample_description_index=e.readUint32();t+=4}else{this.default_sample_description_index=0}if(this.size>t&&this.flags&o.TFHD_FLAG_SAMPLE_DUR){this.default_sample_duration=e.readUint32();t+=4}else{this.default_sample_duration=0}if(this.size>t&&this.flags&o.TFHD_FLAG_SAMPLE_SIZE){this.default_sample_size=e.readUint32();t+=4}else{this.default_sample_size=0}if(this.size>t&&this.flags&o.TFHD_FLAG_SAMPLE_FLAGS){this.default_sample_flags=e.readUint32();t+=4}else{this.default_sample_flags=0}};o.TRUN_FLAGS_DATA_OFFSET=1;o.TRUN_FLAGS_FIRST_FLAG=4;o.TRUN_FLAGS_DURATION=256;o.TRUN_FLAGS_SIZE=512;o.TRUN_FLAGS_FLAGS=1024;o.TRUN_FLAGS_CTS_OFFSET=2048;o.trunBox.prototype.parse=function(e){var t=0;this.parseFullHeader(e);this.sample_count=e.readUint32();t+=4;if(this.size>t&&this.flags&o.TRUN_FLAGS_DATA_OFFSET){this.data_offset=e.readInt32();t+=4}else{this.data_offset=0}if(this.size>t&&this.flags&o.TRUN_FLAGS_FIRST_FLAG){this.first_sample_flags=e.readUint32();t+=4}else{this.first_sample_flags=0}this.sample_duration=[];this.sample_size=[];this.sample_flags=[];this.sample_composition_time_offset=[];if(this.size>t){for(var r=0;r<this.sample_count;r++){if(this.flags&o.TRUN_FLAGS_DURATION){this.sample_duration[r]=e.readUint32()}if(this.flags&o.TRUN_FLAGS_SIZE){this.sample_size[r]=e.readUint32()}if(this.flags&o.TRUN_FLAGS_FLAGS){this.sample_flags[r]=e.readUint32()}if(this.flags&o.TRUN_FLAGS_CTS_OFFSET){if(this.version===0){this.sample_composition_time_offset[r]=e.readUint32()}else{this.sample_composition_time_offset[r]=e.readInt32()}}}}};o.tfdtBox.prototype.parse=function(e){this.parseFullHeader(e);if(this.version==1){this.baseMediaDecodeTime=e.readUint64()}else{this.baseMediaDecodeTime=e.readUint32()}};o.paylBox.prototype.parse=function(e){this.text=e.readString(this.size)};o.subsBox.prototype.parse=function(e){var t,r;var i;var n;this.parseFullHeader(e);i=e.readUint32();this.samples=[];for(t=0;t<i;t++){var a={};this.samples[t]=a;a.sample_delta=e.readUint32();a.subsamples=[];n=e.readUint16();if(n>0){for(r=0;r<n;r++){var s={};a.subsamples.push(s);if(this.version==1){s.size=e.readUint32()}else{s.size=e.readUint16()}s.priority=e.readUint8();s.discardable=e.readUint8();s.reserved=e.readUint32()}}}};o.Box.prototype.writeHeader=function(e,t){this.size+=8;if(this.size>n.MAX_SIZE){this.size+=8}s.d("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.position+(t||""));if(this.size>n.MAX_SIZE){e.writeUint32(1)}else{this.sizePosition=e.position;e.writeUint32(this.size)}e.writeString(this.type,null,4);if(this.size>n.MAX_SIZE){e.writeUint64(this.size)}};o.FullBox.prototype.writeHeader=function(e){this.size+=4;o.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags);e.writeUint8(this.version);e.writeUint24(this.flags)};o.Box.prototype.write=function(e){if(this.type==="mdat"){if(this.data){this.size=this.data.length;this.writeHeader(e);e.writeUint8Array(this.data)}}else{this.size=this.data.length;this.writeHeader(e);e.writeUint8Array(this.data)}};o.ContainerBox.prototype.write=function(e){this.size=0;this.writeHeader(e);for(var t=0;t<this.boxes.length;t++){if(this.boxes[t]){this.boxes[t].write(e);this.size+=this.boxes[t].size}}s.d("BoxWriter","Adjusting box "+this.type+" with new size "+this.size);e.adjustUint32(this.sizePosition,this.size)};o.TrackReferenceTypeBox.prototype.write=function(e){this.size=this.track_ids.length*4;this.writeHeader(e);e.writeUint32Array(this.track_ids)};o.ftypBox.prototype.write=function(e){this.size=8+4*this.compatible_brands.length;this.writeHeader(e);e.writeString(this.major_brand,null,4);e.writeUint32(this.minor_version);for(var t=0;t<this.compatible_brands.length;t++){e.writeString(this.compatible_brands[t],null,4)}};o.mvhdBox.prototype.write=function(e){this.version=0;this.flags=0;this.size=23*4+2*2;this.writeHeader(e);e.writeUint32(this.creation_time);e.writeUint32(this.modification_time);e.writeUint32(this.timescale);e.writeUint32(this.duration);e.writeUint32(this.rate);e.writeUint16(this.volume<<8);e.writeUint16(0);e.writeUint32(0);e.writeUint32(0);e.writeUint32Array(this.matrix);e.writeUint32(0);e.writeUint32(0);e.writeUint32(0);e.writeUint32(0);e.writeUint32(0);e.writeUint32(0);e.writeUint32(this.next_track_id)};o.tkhdBox.prototype.write=function(e){this.version=0;this.size=4*18+2*4;this.writeHeader(e);e.writeUint32(this.creation_time);e.writeUint32(this.modification_time);e.writeUint32(this.track_id);e.writeUint32(0);e.writeUint32(this.duration);e.writeUint32(0);e.writeUint32(0);e.writeInt16(this.layer);e.writeInt16(this.alternate_group);e.writeInt16(this.volume<<8);e.writeUint16(0);e.writeInt32Array(this.matrix);e.writeUint32(this.width);e.writeUint32(this.height)};o.mdhdBox.prototype.write=function(e){this.size=4*4+2*2;this.flags=0;this.version=0;this.writeHeader(e);e.writeUint32(this.creation_time);e.writeUint32(this.modification_time);e.writeUint32(this.timescale);e.writeUint32(this.duration);e.writeUint16(this.language);e.writeUint16(0)};o.hdlrBox.prototype.write=function(e){this.size=5*4+this.name.length+1;this.version=0;this.flags=0;this.writeHeader(e);e.writeUint32(0);e.writeString(this.handler,null,4);e.writeUint32(0);e.writeUint32(0);e.writeUint32(0);e.writeCString(this.name)};o.stsdBox.prototype.write=function(e){var t;this.version=0;this.flags=0;this.size=0;this.writeHeader(e);e.writeUint32(this.entries.length);this.size+=4;for(t=0;t<this.entries.length;t++){this.entries[t].write(e);this.size+=this.entries[t].size}s.d("BoxWriter","Adjusting box "+this.type+" with new size "+this.size);e.adjustUint32(this.sizePosition,this.size)};o.SampleEntry.prototype.writeHeader=function(e){this.size=8;o.Box.prototype.writeHeader.call(this,e);e.writeUint8(0);e.writeUint8(0);e.writeUint8(0);e.writeUint8(0);e.writeUint8(0);e.writeUint8(0);e.writeUint16(this.data_reference_index)};o.SampleEntry.prototype.writeFooter=function(e){for(var t=0;t<this.boxes.length;t++){this.boxes[t].write(e);this.size+=this.boxes[t].size}s.d("BoxWriter","Adjusting box "+this.type+" with new size "+this.size);e.adjustUint32(this.sizePosition,this.size)};o.SampleEntry.prototype.write=function(e){this.writeHeader(e);this.writeFooter(e)};o.VisualSampleEntry.prototype.write=function(e){this.writeHeader(e);this.size+=2*7+6*4+32;e.writeUint16(0);e.writeUint16(0);e.writeUint32(0);e.writeUint32(0);e.writeUint32(0);e.writeUint16(this.width-this.width%2);e.writeUint16(this.height-this.height%2);e.writeUint32(this.horizresolution);e.writeUint32(this.vertresolution);e.writeUint32(0);e.writeUint16(this.frame_count);e.writeString(this.compressorname,null,32);e.writeUint16(this.depth);e.writeInt16(-1);this.writeFooter(e)};o.AudioSampleEntry.prototype.write=function(e){this.writeHeader(e);this.size+=2*4+3*4;e.writeUint32(0);e.writeUint32(0);e.writeUint16(this.channel_count);e.writeUint16(this.samplesize);e.writeUint16(0);e.writeUint16(0);e.writeUint32(this.samplerate<<16);this.writeFooter(e)};o.avcCBox.prototype.write=function(e){var t;this.size=7;for(t=0;t<this.SPS.length;t++){this.size+=2+this.SPS[t].length}for(t=0;t<this.PPS.length;t++){this.size+=2+this.PPS[t].length}if(this.ext){this.size+=this.ext.length}this.writeHeader(e);e.writeUint8(this.configurationVersion);e.writeUint8(this.AVCProfileIndication);e.writeUint8(this.profile_compatibility);e.writeUint8(this.AVCLevelIndication);e.writeUint8(this.lengthSizeMinusOne+(63<<2));e.writeUint8(this.SPS.length+(7<<5));for(t=0;t<this.SPS.length;t++){e.writeUint16(this.SPS[t].length);e.writeUint8Array(this.SPS[t])}e.writeUint8(this.PPS.length);for(t=0;t<this.PPS.length;t++){e.writeUint16(this.PPS[t].length);e.writeUint8Array(this.PPS[t])}if(this.ext){e.writeUint8Array(this.ext)}};o.cttsBox.prototype.write=function(e){var t;this.version=1;this.flags=0;this.size=4+8*this.sample_counts.length;this.writeHeader(e);e.writeUint32(this.sample_counts.length);for(t=0;t<this.sample_counts.length;t++){e.writeUint32(this.sample_counts[t]);e.writeInt32(this.sample_offsets[t])}};o.cslgBox.prototype.write=function(e){var t;this.version=0;this.flags=0;this.size=4*5;this.writeHeader(e);e.writeInt32(this.compositionToDTSShift);e.writeInt32(this.leastDecodeToDisplayDelta);e.writeInt32(this.greatestDecodeToDisplayDelta);e.writeInt32(this.compositionStartTime);e.writeInt32(this.compositionEndTime)};o.sttsBox.prototype.write=function(e){var t;this.version=0;this.flags=0;this.size=4+8*this.sample_counts.length;this.writeHeader(e);e.writeUint32(this.sample_counts.length);for(t=0;t<this.sample_counts.length;t++){e.writeUint32(this.sample_counts[t]);e.writeUint32(this.sample_deltas[t])}};o.stssBox.prototype.write=function(e){this.version=0;this.flags=0;this.size=4+4*this.sample_numbers.length;this.writeHeader(e);e.writeUint32(this.sample_numbers.length);e.writeUint32Array(this.sample_numbers)};o.stshBox.prototype.write=function(e){var t;this.version=0;this.flags=0;this.size=4+8*this.shadowed_sample_numbers.length;this.writeHeader(e);e.writeUint32(this.shadowed_sample_numbers.length);for(t=0;t<this.shadowed_sample_numbers.length;t++){e.writeUint32(this.shadowed_sample_numbers[t]);e.writeUint32(this.sync_sample_numbers[t])}};o.stcoBox.prototype.write=function(e){this.version=0;this.flags=0;this.size=4+4*this.chunk_offsets.length;this.writeHeader(e);e.writeUint32(this.chunk_offsets.length);e.writeUint32Array(this.chunk_offsets)};o.co64Box.prototype.write=function(e){var t;this.version=0;this.flags=0;this.size=4+8*this.chunk_offsets.length;this.writeHeader(e);e.writeUint32(this.chunk_offsets.length);for(t=0;t<this.chunk_offsets.length;t++){e.writeUint64(this.chunk_offsets[t])}};o.stscBox.prototype.write=function(e){var t;this.version=0;this.flags=0;this.size=4+12*this.first_chunk.length;this.writeHeader(e);e.writeUint32(this.first_chunk.length);for(t=0;t<this.first_chunk.length;t++){e.writeUint32(this.first_chunk[t]);e.writeUint32(this.samples_per_chunk[t]);e.writeUint32(this.sample_description_index[t])}};o.stszBox.prototype.write=function(e){var t;this.version=0;this.flags=0;this.size=8+12*this.sample_sizes.length;this.writeHeader(e);e.writeUint32(0);e.writeUint32(this.sample_sizes.length);e.writeUint32Array(this.sample_sizes)};o.mehdBox.prototype.write=function(e){this.version=0;this.flags=0;this.size=4;this.writeHeader(e);e.writeUint32(this.fragment_duration)};o.trexBox.prototype.write=function(e){this.version=0;this.flags=0;this.size=4*5;this.writeHeader(e);e.writeUint32(this.track_id);e.writeUint32(this.default_sample_description_index);e.writeUint32(this.default_sample_duration);e.writeUint32(this.default_sample_size);e.writeUint32(this.default_sample_flags)};o.mfhdBox.prototype.write=function(e){this.version=0;this.flags=0;this.size=4;this.writeHeader(e);e.writeUint32(this.sequence_number)};o.tfhdBox.prototype.write=function(e){this.version=0;this.size=4;if(this.flags&o.TFHD_FLAG_BASE_OFFSET){this.size+=8}if(this.flags&o.TFHD_FLAG_SAMPLE_DESC){this.size+=4}if(this.flags&o.TFHD_FLAG_SAMPLE_DUR){this.size+=4}if(this.flags&o.TFHD_FLAG_SAMPLE_SIZE){this.size+=4}if(this.flags&o.TFHD_FLAG_SAMPLE_FLAGS){this.size+=4}this.writeHeader(e);e.writeUint32(this.track_id);if(this.flags&o.TFHD_FLAG_BASE_OFFSET){e.writeUint64(this.base_data_offset)}if(this.flags&o.TFHD_FLAG_SAMPLE_DESC){e.writeUint32(this.default_sample_description_index)}if(this.flags&o.TFHD_FLAG_SAMPLE_DUR){e.writeUint32(this.default_sample_duration)}if(this.flags&o.TFHD_FLAG_SAMPLE_SIZE){e.writeUint32(this.default_sample_size)}if(this.flags&o.TFHD_FLAG_SAMPLE_FLAGS){e.writeUint32(this.default_sample_flags)}};o.trunBox.prototype.write=function(e){this.version=0;this.size=4;if(this.flags&o.TRUN_FLAGS_DATA_OFFSET){this.size+=4}if(this.flags&o.TRUN_FLAGS_FIRST_FLAG){this.size+=4}if(this.flags&o.TRUN_FLAGS_DURATION){this.size+=4*this.sample_duration.length}if(this.flags&o.TRUN_FLAGS_SIZE){this.size+=4*this.sample_size.length}if(this.flags&o.TRUN_FLAGS_FLAGS){this.size+=4*this.sample_flags.length}if(this.flags&o.TRUN_FLAGS_CTS_OFFSET){this.size+=4*this.sample_composition_time_offset.length}this.writeHeader(e);e.writeUint32(this.sample_count);if(this.flags&o.TRUN_FLAGS_DATA_OFFSET){this.data_offset_position=e.position;e.writeInt32(this.data_offset)}if(this.flags&o.TRUN_FLAGS_FIRST_FLAG){e.writeUint32(this.first_sample_flags)}for(var t=0;t<this.sample_count;t++){if(this.flags&o.TRUN_FLAGS_DURATION){e.writeUint32(this.sample_duration[t])}if(this.flags&o.TRUN_FLAGS_SIZE){e.writeUint32(this.sample_size[t])}if(this.flags&o.TRUN_FLAGS_FLAGS){e.writeUint32(this.sample_flags[t])}if(this.flags&o.TRUN_FLAGS_CTS_OFFSET){if(this.version===0){e.writeUint32(this.sample_composition_time_offset[t])}else{e.writeInt32(this.sample_composition_time_offset[t])}}}};o.tfdtBox.prototype.write=function(e){this.version=0;this.flags=0;this.size=4;this.writeHeader(e);if(this.version==1){e.writeUint64(this.baseMediaDecodeTime)}else{e.writeUint32(this.baseMediaDecodeTime)}}},{"./DataStream":231,"./descriptor":233,"./log":235}],233:[function(e,t,r){var i=e("./log");var n=function(){var e=3;var t=4;var r=5;var n=6;var a=[];a[e]="ES_Descriptor";a[t]="DecoderConfigDescriptor";a[r]="DecoderSpecificInfo";a[n]="SLConfigDescriptor";var s=this;var o={};this.parseOneDescriptor=function(e){var t=0;var r=0;var n;var s;var f;n=e.readUint8();t++;f=e.readUint8();t++;while(f&128){r=(f&127)<<7;f=e.readUint8();t++}r+=f&127;i.d("MPEG4DescriptorParser","Found "+(a[n]|"Descriptor "+n)+", size "+r+" at position "+e.position);if(a[n]){s=new o[a[n]](r)}else{s=new o.Descriptor(r)}s.parse(e);return s};o.Descriptor=function(e,t){this.tag=e;this.size=t;this.descs=[]};o.Descriptor.prototype.parse=function(e){this.data=e.readUint8Array(this.size)};o.Descriptor.prototype.findDescriptor=function(e){for(var t=0;t<this.descs.length;t++){if(this.descs[t].tag==e){return this.descs[t]}}return null};o.Descriptor.prototype.parseRemainingDescriptors=function(e){var t=e.position;while(e.position<t+this.size){var r=s.parseOneDescriptor(e);this.descs.push(r)}};o.ES_Descriptor=function(t){o.Descriptor.call(this,e,t)};o.ES_Descriptor.prototype=new o.Descriptor;o.ES_Descriptor.prototype.parse=function(e){this.ES_ID=e.readUint16();this.flags=e.readUint8();this.size-=3;if(this.flags&128){this.dependsOn_ES_ID=e.readUint16();this.size-=2}else{this.dependsOn_ES_ID=0}if(this.flags&64){var t=e.readUint8();this.URL=e.readString(t);this.size-=t+1}else{this.URL=null}if(this.flags&32){this.OCR_ES_ID=e.readUint16();this.size-=2}else{this.OCR_ES_ID=0}this.parseRemainingDescriptors(e)};o.ES_Descriptor.prototype.getOTI=function(e){var r=this.findDescriptor(t);if(r){return r.oti}else{return 0}};o.ES_Descriptor.prototype.getAudioConfig=function(e){var i=this.findDescriptor(t);if(!i)return null;var n=i.findDescriptor(r);if(n&&n.data){return(n.data[0]&248)>>3}else{return null}};o.DecoderConfigDescriptor=function(e){o.Descriptor.call(this,t,e)};o.DecoderConfigDescriptor.prototype=new o.Descriptor;o.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8();this.streamType=e.readUint8();this.bufferSize=e.readUint24();this.maxBitrate=e.readUint32();this.avgBitrate=e.readUint32();this.size-=13;this.parseRemainingDescriptors(e)};o.DecoderSpecificInfo=function(e){o.Descriptor.call(this,r,e)};o.DecoderSpecificInfo.prototype=new o.Descriptor;o.SLConfigDescriptor=function(e){o.Descriptor.call(this,n,e)};o.SLConfigDescriptor.prototype=new o.Descriptor;return this};t.exports=n},{"./log":235}],234:[function(e,t,r){var i=e("./box");var n=e("./DataStream");var a=e("./log");var s=function(e){this.stream=e;this.boxes=[];this.mdats=[];this.moofs=[];this.isProgressive=false;this.lastMoofIndex=0;this.lastBoxStartPosition=0;this.parsingMdat=null;this.moovStartFound=false;this.samplesDataSize=0;this.nextParsePosition=0};t.exports=s;s.prototype.mergeNextBuffer=function(){var e;if(this.stream.bufferIndex+1<this.stream.nextBuffers.length){e=this.stream.nextBuffers[this.stream.bufferIndex+1];if(e.fileStart===this.stream.buffer.fileStart+this.stream.buffer.byteLength){var t=this.stream.buffer.byteLength;var r=this.stream.buffer.usedBytes;var i=this.stream.buffer.fileStart;this.stream.nextBuffers[this.stream.bufferIndex]=ArrayBuffer.concat(this.stream.buffer,e);this.stream.buffer=this.stream.nextBuffers[this.stream.bufferIndex];this.stream.nextBuffers.splice(this.stream.bufferIndex+1,1);this.stream.buffer.usedBytes=r;this.stream.buffer.fileStart=i;a.d("ISOFile","Concatenating buffer for box parsing (length: "+t+"->"+this.stream.buffer.byteLength+")");return true}else{return false}}else{return false}};s.prototype.parse=function(){var e;var t;var r;a.d("ISOFile","Starting parsing with buffer #"+this.stream.bufferIndex+" (fileStart: "+this.stream.buffer.fileStart+" - Length: "+this.stream.buffer.byteLength+") from position "+this.lastBoxStartPosition+" ("+(this.stream.buffer.fileStart+this.lastBoxStartPosition)+" in the file)");this.stream.seek(this.lastBoxStartPosition);while(true){if(this.parsingMdat!==null){r=this.parsingMdat;e=this.reposition(false,r.fileStart+r.hdr_size+r.size);if(e){a.d("ISOFile","Found 'mdat' end in buffer #"+this.stream.bufferIndex);this.parsingMdat=null;continue}else{this.nextParsePosition=this.findEndContiguousBuf(this.stream.bufferIndex);return}}else{this.lastBoxStartPosition=this.stream.position;t=i.parseOneBox(this.stream);if(t.code===i.ERR_NOT_ENOUGH_DATA){if(t.type==="mdat"){r=new i[t.type+"Box"](t.size-t.hdr_size);this.parsingMdat=r;this.mdats.push(r);r.fileStart=this.stream.buffer.fileStart+this.stream.position;r.hdr_size=t.hdr_size;this.stream.buffer.usedBytes+=t.hdr_size;e=this.reposition(false,r.fileStart+r.hdr_size+r.size);if(e){this.parsingMdat=null;continue}else{if(!this.moovStartFound){this.nextParsePosition=r.fileStart+r.size+r.hdr_size}else{this.nextParsePosition=this.findEndContiguousBuf(this.stream.bufferIndex)}return}}else{if(t.type==="moov"){this.moovStartFound=true;if(this.mdats.length===0){this.isProgressive=true}}else if(t.type==="free"){e=this.reposition(false,this.stream.buffer.fileStart+this.stream.position+t.size);if(e){continue}else{this.nextParsePosition=this.stream.buffer.fileStart+this.stream.position+t.size;return}}merged=this.mergeNextBuffer();if(merged){this.nextParsePosition=this.stream.buffer.fileStart+this.stream.buffer.byteLength;continue}else{if(!t.type){this.nextParsePosition=this.stream.buffer.fileStart+this.stream.buffer.byteLength}else{if(this.moovStartFound){this.nextParsePosition=this.stream.buffer.fileStart+this.stream.buffer.byteLength}else{this.nextParsePosition=this.stream.buffer.fileStart+this.stream.position+t.size}}return}}}else{r=t.box;this.boxes.push(r);switch(r.type){case"mdat":this.mdats.push(r);r.fileStart=this.stream.buffer.fileStart+r.start;break;case"moof":this.moofs.push(r);break;case"moov":this.moovStartFound=true;if(this.mdats.length===0){this.isProgressive=true}default:if(this[r.type]!==undefined){a.w("ISOFile","Duplicate Box of type: "+r.type+", overriding previous occurrence")}this[r.type]=r;break}if(r.type==="mdat"){this.stream.buffer.usedBytes+=r.hdr_size}else{this.stream.buffer.usedBytes+=t.size}}}}};s.prototype.reposition=function(e,t){var r;r=this.findPosition(e,t);if(r!==-1){this.stream.buffer=this.stream.nextBuffers[r];this.stream.bufferIndex=r;this.stream.position=t-this.stream.buffer.fileStart;a.d("ISOFile","Repositioning parser at buffer position: "+this.stream.position);return true}else{return false}};s.prototype.findPosition=function(e,t){var r;var i=null;var n=-1;if(e===true){r=0}else{r=this.stream.bufferIndex}while(r<this.stream.nextBuffers.length){i=this.stream.nextBuffers[r];if(i.fileStart<=t){n=r}else{break}r++}if(n!==-1){i=this.stream.nextBuffers[n];if(i.fileStart+i.byteLength>=t){a.d("ISOFile","Found position in existing buffer #"+n);return n}else{return-1}}else{return-1}};s.prototype.findEndContiguousBuf=function(e){var t;var r;var i;r=this.stream.nextBuffers[e];if(this.stream.nextBuffers.length>e+1){for(t=e+1;t<this.stream.nextBuffers.length;t++){i=this.stream.nextBuffers[t];if(i.fileStart===r.fileStart+r.byteLength){r=i}else{break}}}return r.fileStart+r.byteLength};s.prototype.write=function(e){for(var t=0;t<this.boxes.length;t++){this.boxes[t].write(e)}};s.prototype.writeInitializationSegment=function(e){var t;var r;var n;var s;var o;a.d("ISOFile","Generating initialization segment");this.ftyp.write(e);if(this.moov.mvex){this.initial_duration=this.moov.mvex.mehd.fragment_duration;r=-1;for(t=0;t<this.moov.boxes.length;t++){o=this.moov.boxes[t];if(o===this.moov.mvex){r=t}}if(r>-1){this.moov.boxes.splice(r,1)}this.moov.mvex=null}this.moov.mvex=new i.mvexBox;this.moov.boxes.push(this.moov.mvex);this.moov.mvex.mehd=new i.mehdBox;
-this.moov.mvex.boxes.push(this.moov.mvex.mehd);this.moov.mvex.mehd.fragment_duration=this.initial_duration;for(t=0;t<this.moov.traks.length;t++){if(this.moov.traks[t].ignore)continue;s=new i.trexBox;this.moov.mvex.boxes.push(s);s.track_id=this.moov.traks[t].tkhd.track_id;s.default_sample_description_index=1;s.default_sample_duration=this.moov.traks[t].samples.length>0?this.moov.traks[t].samples[0].duration:0;s.default_sample_size=0;s.default_sample_flags=1<<16}this.moov.write(e)};s.prototype.resetTables=function(){var e;var t,r,i,n,a,s,o,f;this.initial_duration=this.moov.mvhd.duration;this.moov.mvhd.duration=0;for(e=0;e<this.moov.traks.length;e++){t=this.moov.traks[e];t.tkhd.duration=0;t.mdia.mdhd.duration=0;r=t.mdia.minf.stbl.stco||t.mdia.minf.stbl.co64;r.chunk_offsets=[];i=t.mdia.minf.stbl.stsc;i.first_chunk=[];i.samples_per_chunk=[];i.sample_description_index=[];n=t.mdia.minf.stbl.stsz;n.sample_sizes=[];a=t.mdia.minf.stbl.stts;a.sample_counts=[];a.sample_deltas=[];s=t.mdia.minf.stbl.ctts;if(s){s.sample_counts=[];s.sample_offsets=[]}o=t.mdia.minf.stbl.stss;if(o){o.sample_numbers=new Uint32Array(0)}f=t.mdia.minf.stbl.sdtp;var l=t.mdia.minf.stbl.boxes.indexOf(f);if(l!=-1)t.mdia.minf.stbl.boxes[l]=null}};s.prototype.buildSampleLists=function(){var e,t,r;var i,n,a,s,o,f,l,u,c;var p,d,h,m,v;var g,_,y,b,w,x;this.originalMvex=this.moov.mvex;for(e=0;e<this.moov.traks.length;e++){i=this.moov.traks[e];i.samples=[];n=i.mdia.minf.stbl.stco||i.mdia.minf.stbl.co64;a=i.mdia.minf.stbl.stsc;s=i.mdia.minf.stbl.stsz;o=i.mdia.minf.stbl.stts;f=i.mdia.minf.stbl.ctts;l=i.mdia.minf.stbl.stss;u=i.mdia.minf.stbl.stsd;c=i.mdia.minf.stbl.subs;g=-1;_=-1;y=-1;b=-1;w=0;subs_entry_index=0;last_subs_sample_index=0;for(t=0;t<s.sample_sizes.length;t++){var k={};k.number=t;k.track_id=i.tkhd.track_id;k.timescale=i.mdia.mdhd.timescale;i.samples[t]=k;k.size=s.sample_sizes[t];if(t===0){d=1;p=0;k.chunk_index=d;k.chunk_run_index=p;v=a.samples_per_chunk[p];m=0;if(p+1<a.first_chunk.length){h=a.first_chunk[p+1]-1}else{h=Infinity}}else{if(t<v){k.chunk_index=d;k.chunk_run_index=p}else{d++;k.chunk_index=d;m=0;if(d<=h){}else{p++;if(p+1<a.first_chunk.length){h=a.first_chunk[p+1]-1}else{h=Infinity}}k.chunk_run_index=p;v+=a.samples_per_chunk[p]}}k.description=u.entries[a.sample_description_index[k.chunk_run_index]-1];k.offset=n.chunk_offsets[k.chunk_index-1]+m;m+=k.size;if(t>g){_++;if(g<0){g=0}g+=o.sample_counts[_]}if(t>0){i.samples[t-1].duration=o.sample_deltas[_];k.dts=i.samples[t-1].dts+i.samples[t-1].duration}else{k.dts=0}if(f){if(t>y){b++;y+=f.sample_counts[b]}k.cts=i.samples[t].dts+f.sample_offsets[b]}else{k.cts=k.dts}if(l){if(t==l.sample_numbers[w]-1){k.is_rap=true;w++}else{k.is_rap=false}}else{k.is_rap=true}if(c){if(c.samples[subs_entry_index].sample_delta+last_subs_sample_index==t){k.subsamples=c.samples[subs_entry_index].subsamples;last_subs_sample_index+=c.samples[subs_entry_index].sample_delta}}}if(t>0)i.samples[t-1].duration=i.mdia.mdhd.duration-i.samples[t-1].dts}};s.prototype.updateSampleLists=function(){var e,t,r;var n,a,s,o;var f;var l,u,c,p,d;var h;while(this.lastMoofIndex<this.moofs.length){l=this.moofs[this.lastMoofIndex];this.lastMoofIndex++;if(l.type=="moof"){u=l;for(e=0;e<u.trafs.length;e++){c=u.trafs[e];p=this.getTrackById(c.tfhd.track_id);d=this.getTrexById(c.tfhd.track_id);if(c.tfhd.flags&i.TFHD_FLAG_SAMPLE_DESC){n=c.tfhd.default_sample_description_index}else{n=d.default_sample_description_index}if(c.tfhd.flags&i.TFHD_FLAG_SAMPLE_DUR){a=c.tfhd.default_sample_duration}else{a=d.default_sample_duration}if(c.tfhd.flags&i.TFHD_FLAG_SAMPLE_SIZE){s=c.tfhd.default_sample_size}else{s=d.default_sample_size}if(c.tfhd.flags&i.TFHD_FLAG_SAMPLE_FLAGS){o=c.tfhd.default_sample_flags}else{o=d.default_sample_flags}for(t=0;t<c.truns.length;t++){var m=c.truns[t];for(r=0;r<m.sample_count;r++){h={};c.first_sample_index=p.samples.length;p.samples.push(h);h.track_id=p.tkhd.track_id;h.timescale=p.mdia.mdhd.timescale;h.description=p.mdia.minf.stbl.stsd.entries[n-1];h.size=s;if(m.flags&i.TRUN_FLAGS_SIZE){h.size=m.sample_size[r]}h.duration=a;if(m.flags&i.TRUN_FLAGS_DURATION){h.duration=m.sample_duration[r]}if(p.first_traf_merged||r>0){h.dts=p.samples[p.samples.length-2].dts+p.samples[p.samples.length-2].duration}else{if(c.tfdt){h.dts=c.tfdt.baseMediaDecodeTime}else{h.dts=0}p.first_traf_merged=true}h.cts=h.dts;if(m.flags&i.TRUN_FLAGS_CTS_OFFSET){h.cts=h.dts+m.sample_composition_time_offset[r]}sample_flags=o;if(m.flags&i.TRUN_FLAGS_FLAGS){sample_flags=m.sample_flags[r]}else if(r===0&&m.flags&i.TRUN_FLAGS_FIRST_FLAG){sample_flags=m.first_sample_flags}h.is_rap=sample_flags>>16&1?false:true;var v=c.tfhd.flags&i.TFHD_FLAG_BASE_DATA_OFFSET?true:false;var g=c.tfhd.flags&i.TFHD_FLAG_DEFAULT_BASE_IS_MOOF?true:false;var _=m.flags&i.TRUN_FLAGS_DATA_OFFSET?true:false;var y=0;if(!v){if(!g){if(t===0){y=u.fileStart}else{y=f}}else{y=u.fileStart}}else{y=c.tfhd.base_data_offset}if(t===0&&r===0){if(_){h.offset=y+m.data_offset}else{h.offset=y}}else{h.offset=f}f=h.offset+h.size}}if(c.subs){var b=c.first_sample_index;for(t=0;t<c.subs.samples.length;t++){b+=c.subs.samples[t].sample_delta;h=p.samples[b-1];h.subsamples=c.subs.samples[t].subsamples}}}}}};s.prototype.getCodecs=function(){var e;var t="";for(e=0;e<this.moov.traks.length;e++){var r=this.moov.traks[e];if(e>0){t+=","}t+=r.mdia.minf.stbl.stsd.entries[0].getCodec()}return t};s.prototype.getTrexById=function(e){var t;if(!this.originalMvex)return null;for(t=0;t<this.originalMvex.trexs.length;t++){var r=this.originalMvex.trexs[t];if(r.track_id==e)return r}return null};s.prototype.getTrackById=function(e){for(var t=0;t<this.moov.traks.length;t++){var r=this.moov.traks[t];if(r.tkhd.track_id==e)return r}return null};s.prototype.getSample=function(e,t){var r;var i;var s=e.samples[t];if(!this.moov){return null}if(!s.data){s.data=new Uint8Array(s.size);s.alreadyRead=0;this.samplesDataSize+=s.size;a.d("ISOFile","Allocating sample #"+t+" on track #"+e.tkhd.track_id+" of size "+s.size+" (total: "+this.samplesDataSize+")")}else if(s.alreadyRead==s.size){return s}for(i=0;i<this.stream.nextBuffers.length;i++){r=this.stream.nextBuffers[i];if(s.offset+s.alreadyRead>=r.fileStart&&s.offset+s.alreadyRead<r.fileStart+r.byteLength){var o=r.byteLength-(s.offset+s.alreadyRead-r.fileStart);if(s.size-s.alreadyRead<=o){a.d("ISOFile","Getting sample #"+t+" data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-r.fileStart)+" size: "+(s.size-s.alreadyRead)+")");n.memcpy(s.data.buffer,s.alreadyRead,r,s.offset+s.alreadyRead-r.fileStart,s.size-s.alreadyRead);s.alreadyRead=s.size;r.usedBytes+=s.size-s.alreadyRead;if(r.usedBytes===r.byteLength){this.stream.nextBuffers.splice(i,1);i--}return s}else{a.d("ISOFile","Getting sample data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-r.fileStart)+" size: "+o+")");n.memcpy(s.data.buffer,s.alreadyRead,r,s.offset+s.alreadyRead-r.fileStart,o);s.alreadyRead+=o;r.usedBytes+=o;if(r.usedBytes===r.byteLength){this.stream.nextBuffers.splice(i,1);i--}}}}return null};s.prototype.releaseSample=function(e,t){var r=e.samples[t];r.data=null;this.samplesDataSize-=r.size;return r.size}},{"./DataStream":231,"./box":232,"./log":235}],235:[function(e,t,r){var i=function(){var e=new Date;var t=4;var r=3;var n=2;var a=1;var s=t;var o={setLogLevel:function(e){if(e==this.d)s=a;else if(e==this.i)s=n;else if(e==this.w)s=r;else if(e==this.e)s=t;else s=t},d:function(t,r){if(a>=s){console.debug("["+i.getDurationString(new Date-e,1e3)+"]","["+t+"]",r)}},i:function(t,r){if(n>=s){console.info("["+i.getDurationString(new Date-e,1e3)+"]","["+t+"]",r)}},w:function(t,n){if(r>=s){console.warn("["+i.getDurationString(new Date-e,1e3)+"]","["+t+"]",n)}},e:function(r,n){if(t>=s){console.error("["+i.getDurationString(new Date-e,1e3)+"]","["+r+"]",n)}}};return o}();t.exports=i;i.getDurationString=function(e,t){function r(e,t){var r=""+e;var i=r.split(".");while(i[0].length<t){i[0]="0"+i[0]}return i.join(".")}var i=t||1;var n=e/i;var a=Math.floor(n/3600);n-=a*3600;var s=Math.floor(n/60);n-=s*60;var o=n*1e3;n=Math.floor(n);o-=n*1e3;o=Math.floor(o);return""+a+":"+r(s,2)+":"+r(n,2)+"."+r(o,3)};i.printRanges=function(e){var t=e.length;if(t>0){var r="";for(var n=0;n<t;n++){if(n>0)r+=",";r+="["+i.getDurationString(e.start(n))+","+i.getDurationString(e.end(n))+"]"}return r}else{return"(empty)"}}},{}],236:[function(e,t,r){var n=e("./box");var a=e("./DataStream");var s=e("./isofile");var o=e("./log");var f=function(){this.inputStream=null;this.nextBuffers=[];this.inputIsoFile=null;this.onMoovStart=null;this.moovStartSent=false;this.onReady=null;this.readySent=false;this.onSegment=null;this.onSamples=null;this.onError=null;this.sampleListBuilt=false;this.fragmentedTracks=[];this.extractedTracks=[];this.isFragmentationStarted=false;this.nextMoofNumber=0};t.exports=f;f.prototype.setSegmentOptions=function(e,t,r){var i=this.inputIsoFile.getTrackById(e);if(i){var n={};this.fragmentedTracks.push(n);n.id=e;n.user=t;n.trak=i;i.nextSample=0;n.segmentStream=null;n.nb_samples=1e3;n.rapAlignement=true;if(r){if(r.nbSamples)n.nb_samples=r.nbSamples;if(r.rapAlignement)n.rapAlignement=r.rapAlignement}}};f.prototype.unsetSegmentOptions=function(e){var t=-1;for(var r=0;r<this.fragmentedTracks.length;r++){var i=this.fragmentedTracks[r];if(i.id==e){t=r}}if(t>-1){this.fragmentedTracks.splice(t,1)}};f.prototype.setExtractionOptions=function(e,t,r){var i=this.inputIsoFile.getTrackById(e);if(i){var n={};this.extractedTracks.push(n);n.id=e;n.user=t;n.trak=i;i.nextSample=0;n.nb_samples=1e3;n.samples=[];if(r){if(r.nbSamples)n.nb_samples=r.nbSamples}}};f.prototype.unsetExtractionOptions=function(e){var t=-1;for(var r=0;r<this.extractedTracks.length;r++){var i=this.extractedTracks[r];if(i.id==e){t=r}}if(t>-1){this.extractedTracks.splice(t,1)}};f.prototype.createSingleSampleMoof=function(e){var t=new n.moofBox;var r=new n.mfhdBox;r.sequence_number=this.nextMoofNumber;this.nextMoofNumber++;t.boxes.push(r);var i=new n.trafBox;t.boxes.push(i);var a=new n.tfhdBox;i.boxes.push(a);a.track_id=e.track_id;a.flags=n.TFHD_FLAG_DEFAULT_BASE_IS_MOOF;var s=new n.tfdtBox;i.boxes.push(s);s.baseMediaDecodeTime=e.dts;var o=new n.trunBox;i.boxes.push(o);t.trun=o;o.flags=n.TRUN_FLAGS_DATA_OFFSET|n.TRUN_FLAGS_DURATION|n.TRUN_FLAGS_SIZE|n.TRUN_FLAGS_FLAGS|n.TRUN_FLAGS_CTS_OFFSET;o.data_offset=0;o.first_sample_flags=0;o.sample_count=1;o.sample_duration=[];o.sample_duration[0]=e.duration;o.sample_size=[];o.sample_size[0]=e.size;o.sample_flags=[];o.sample_flags[0]=0;o.sample_composition_time_offset=[];o.sample_composition_time_offset[0]=e.cts-e.dts;return t};f.prototype.createFragment=function(e,t,r,i){var s=this.inputIsoFile.getTrackById(t);var f=this.inputIsoFile.getSample(s,r);if(f==null){if(this.nextSeekPosition){this.nextSeekPosition=Math.min(s.samples[r].offset,this.nextSeekPosition)}else{this.nextSeekPosition=s.samples[r].offset}return null}var l=i||new a;l.endianness=a.BIG_ENDIAN;var u=this.createSingleSampleMoof(f);u.write(l);u.trun.data_offset=u.size+8;o.d("BoxWriter","Adjusting data_offset with new value "+u.trun.data_offset);l.adjustUint32(u.trun.data_offset_position,u.trun.data_offset);var c=new n.mdatBox;c.data=f.data;c.write(l);return l};ArrayBuffer.concat=function(e,t){o.d("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var r=new Uint8Array(e.byteLength+t.byteLength);r.set(new Uint8Array(e),0);r.set(new Uint8Array(t),e.byteLength);return r.buffer};f.prototype.reduceBuffer=function(e,t,r){var i;i=new Uint8Array(r);i.set(new Uint8Array(e,t,r));i.buffer.fileStart=e.fileStart+t;i.buffer.usedBytes=0;return i.buffer};f.prototype.insertBuffer=function(e){var t=true;for(var r=0;r<this.nextBuffers.length;r++){var i=this.nextBuffers[r];if(e.fileStart<=i.fileStart){if(e.fileStart===i.fileStart){if(e.byteLength>i.byteLength){this.nextBuffers.splice(r,1);r--;continue}else{o.w("MP4Box","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}}else{if(e.fileStart+e.byteLength<=i.fileStart){}else{e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)}o.d("MP4Box","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")");this.nextBuffers.splice(r,0,e);if(r===0&&this.inputStream!==null){this.inputStream.buffer=e}}t=false;break}else if(e.fileStart<i.fileStart+i.byteLength){var n=i.fileStart+i.byteLength-e.fileStart;var a=e.byteLength-n;if(a>0){e=this.reduceBuffer(e,n,a)}else{t=false;break}}}if(t){o.d("MP4Box","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")");this.nextBuffers.push(e);if(r===0&&this.inputStream!==null){this.inputStream.buffer=e}}};f.prototype.processSamples=function(){var e;var t;if(this.isFragmentationStarted&&this.onSegment!==null){for(e=0;e<this.fragmentedTracks.length;e++){var r=this.fragmentedTracks[e];t=r.trak;while(t.nextSample<t.samples.length){o.d("MP4Box","Creating media fragment on track #"+r.id+" for sample "+t.nextSample);var i=this.createFragment(this.inputIsoFile,r.id,t.nextSample,r.segmentStream);if(i){r.segmentStream=i;t.nextSample++}else{break}if(t.nextSample%r.nb_samples===0||t.nextSample>=t.samples.length){o.i("MP4Box","Sending fragmented data on track #"+r.id+" for samples ["+(t.nextSample-r.nb_samples)+","+(t.nextSample-1)+"]");if(this.onSegment){this.onSegment(r.id,r.user,r.segmentStream.buffer,t.nextSample)}r.segmentStream=null;if(r!==this.fragmentedTracks[e]){break}}}}}if(this.onSamples!==null){for(e=0;e<this.extractedTracks.length;e++){var n=this.extractedTracks[e];t=n.trak;while(t.nextSample<t.samples.length){o.d("MP4Box","Exporting on track #"+n.id+" sample #"+t.nextSample);var a=this.inputIsoFile.getSample(t,t.nextSample);if(a){t.nextSample++;n.samples.push(a)}else{return}if(t.nextSample%n.nb_samples===0||t.nextSample>=t.samples.length){o.d("MP4Box","Sending samples on track #"+n.id+" for sample "+t.nextSample);if(this.onSamples){this.onSamples(n.id,n.user,n.samples)}n.samples=[];if(n!==this.extractedTracks[e]){break}}}}}};f.prototype.appendBuffer=function(e){var t;var r;if(e===null||e===undefined){throw"Buffer must be defined and non empty"}if(e.fileStart===undefined){throw"Buffer must have a fileStart property"}if(e.byteLength===0){o.w("MP4Box","Ignoring empty buffer (fileStart: "+e.fileStart+")");return}e.usedBytes=0;this.insertBuffer(e);if(!this.inputStream){if(this.nextBuffers.length>0){r=this.nextBuffers[0];if(r.fileStart===0){this.inputStream=new a(r,0,a.BIG_ENDIAN);this.inputStream.nextBuffers=this.nextBuffers;this.inputStream.bufferIndex=0}else{o.w("MP4Box","The first buffer should have a fileStart of 0");return}}else{o.w("MP4Box","No buffer to start parsing from");return}}if(!this.inputIsoFile){this.inputIsoFile=new s(this.inputStream)}this.inputIsoFile.parse();if(this.inputIsoFile.moovStartFound&&!this.moovStartSent){this.moovStartSent=true;if(this.onMoovStart)this.onMoovStart()}if(this.inputIsoFile.moov){if(!this.sampleListBuilt){this.inputIsoFile.buildSampleLists();this.sampleListBuilt=true}this.inputIsoFile.updateSampleLists();if(this.onReady&&!this.readySent){var i=this.getInfo();this.readySent=true;this.onReady(i)}this.processSamples();if(this.nextSeekPosition){t=this.nextSeekPosition;this.nextSeekPosition=undefined}else{t=this.inputIsoFile.nextParsePosition}var n=this.inputIsoFile.findPosition(true,t);if(n!==-1){t=this.inputIsoFile.findEndContiguousBuf(n)}o.i("MP4Box","Next buffer to fetch should have a fileStart position of "+t);return t}else{if(this.inputIsoFile!==null){return this.inputIsoFile.nextParsePosition}else{return 0}}};f.prototype.getInfo=function(){var e={};var t;var r;var n;var a=new Date(4,0,1,0,0,0,0).getTime();e.duration=this.inputIsoFile.moov.mvhd.duration;e.timescale=this.inputIsoFile.moov.mvhd.timescale;e.isFragmented=this.inputIsoFile.moov.mvex!=null;if(e.isFragmented&&this.inputIsoFile.moov.mvex.mehd){e.fragment_duration=this.inputIsoFile.moov.mvex.mehd.fragment_duration}else{e.fragment_duration=0}e.isProgressive=this.inputIsoFile.isProgressive;e.hasIOD=this.inputIsoFile.moov.iods!=null;e.brands=[];e.brands.push(this.inputIsoFile.ftyp.major_brand);e.brands=e.brands.concat(this.inputIsoFile.ftyp.compatible_brands);e.created=new Date(a+this.inputIsoFile.moov.mvhd.creation_time*1e3);e.modified=new Date(a+this.inputIsoFile.moov.mvhd.modification_time*1e3);e.tracks=[];e.audioTracks=[];e.videoTracks=[];e.subtitleTracks=[];e.metadataTracks=[];e.hintTracks=[];e.otherTracks=[];for(i=0;i<this.inputIsoFile.moov.traks.length;i++){t=this.inputIsoFile.moov.traks[i];n=t.mdia.minf.stbl.stsd.entries[0];r={};e.tracks.push(r);r.id=t.tkhd.track_id;r.references=[];if(t.tref){for(j=0;j<t.tref.boxes.length;j++){ref={};r.references.push(ref);ref.type=t.tref.boxes[j].type;ref.track_ids=t.tref.boxes[j].track_ids}}r.created=new Date(a+t.tkhd.creation_time*1e3);r.modified=new Date(a+t.tkhd.modification_time*1e3);r.movie_duration=t.tkhd.duration;r.layer=t.tkhd.layer;r.alternate_group=t.tkhd.alternate_group;r.volume=t.tkhd.volume;r.matrix=t.tkhd.matrix;r.track_width=t.tkhd.width/(1<<16);r.track_height=t.tkhd.height/(1<<16);r.timescale=t.mdia.mdhd.timescale;r.duration=t.mdia.mdhd.duration;r.codec=n.getCodec();r.language=t.mdia.mdhd.languageString;r.nb_samples=t.samples.length;r.size=0;for(j=0;j<r.nb_samples;j++){r.size+=t.samples[j].size}r.bitrate=r.size*8*r.timescale/r.duration;if(n.isAudio()){e.audioTracks.push(r);r.audio={};r.audio.sample_rate=n.getSampleRate();r.audio.channel_count=n.getChannelCount();r.audio.sample_size=n.getSampleSize()}else if(n.isVideo()){e.videoTracks.push(r);r.video={};r.video.width=n.getWidth();r.video.height=n.getHeight()}else if(n.isSubtitle()){e.subtitleTracks.push(r)}else if(n.isHint()){e.hintTracks.push(r)}else if(n.isMetadata()){e.metadataTracks.push(r)}else{e.otherTracks.push(r)}}return e};f.prototype.getInitializationSegment=function(){var e=new a;e.endianness=a.BIG_ENDIAN;this.inputIsoFile.writeInitializationSegment(e);return e.buffer};f.prototype.writeFile=function(){var e=new a;e.endianness=a.BIG_ENDIAN;this.inputIsoFile.write(e);return e.buffer};f.prototype.initializeSegmentation=function(){var e;var t;var r;var i;var n;if(this.onSegment===null){o.w("MP4Box","No segmentation callback set!")}if(!this.isFragmentationStarted){this.isFragmentationStarted=true;this.nextMoofNumber=0;this.inputIsoFile.resetTables()}i=[];for(e=0;e<this.fragmentedTracks.length;e++){for(t=0;t<this.inputIsoFile.moov.boxes.length;t++){r=this.inputIsoFile.moov.boxes[t];if(r&&r.type==="trak"){this.inputIsoFile.moov.boxes[t].ignore=true;this.inputIsoFile.moov.boxes[t]=null}}n=this.inputIsoFile.getTrackById(this.fragmentedTracks[e].id);delete n.ignore;for(t=0;t<this.inputIsoFile.moov.boxes.length;t++){r=this.inputIsoFile.moov.boxes[t];if(r==null){this.inputIsoFile.moov.boxes[t]=n;break}}seg={};seg.id=n.tkhd.track_id;seg.user=this.fragmentedTracks[e].user;seg.buffer=this.getInitializationSegment();i.push(seg)}return i};f.prototype.releaseUsedSamples=function(e,t){var r=0;var i=this.inputIsoFile.getTrackById(e);if(!i.lastValidSample)i.lastValidSample=0;for(var n=i.lastValidSample;n<t;n++){r+=this.inputIsoFile.releaseSample(i,n)}o.d("MP4Box","Track #"+e+" released samples up to "+t+" (total size: "+r+", remaining: "+this.inputIsoFile.samplesDataSize+")");i.lastValidSample=t};f.prototype.flush=function(){o.i("MP4Box","Flushing remaining samples");this.inputIsoFile.updateSampleLists();this.processSamples()};f.prototype.seekTrack=function(e,t,r){var i;var n;var a=Infinity;var s=0;var f=Infinity;var l=0;var u=0;var c;for(i=0;i<r.samples.length;i++){n=r.samples[i];if(i===0){f=n.offset;u=0;c=n.timescale}else if(n.cts>e*n.timescale){f=r.samples[i-1].offset;u=i-1;break}if(t&&n.is_rap){a=n.offset;s=n.cts;l=i}}if(t){r.nextSample=l;o.i("MP4Box","Seeking to RAP sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+o.getDurationString(s,c)+" and offset: "+a);return{offset:a,time:s/c}}else{r.nextSample=u;o.i("MP4Box","Seeking to non-RAP sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+o.getDurationString(e)+" and offset: "+a);return{offset:f,time:e}}};f.prototype.seek=function(e,t){var r=this.inputIsoFile.moov;var i;var n;var a;var s={offset:Infinity,time:Infinity};if(!this.inputIsoFile.moov){throw"Cannot seek: moov not received!"}else{for(a=0;a<r.traks.length;a++){i=r.traks[a];n=this.seekTrack(e,t,i);if(n.offset<s.offset){s.offset=n.offset}if(n.time<s.time){s.time=n.time}}if(s.offset===Infinity){s={offset:this.inputIsoFile.nextParsePosition,time:0}}else{var f=this.inputIsoFile.findPosition(true,s.offset);if(f!==-1){s.offset=this.inputIsoFile.findEndContiguousBuf(f)}}o.i("MP4Box","Seeking at time "+o.getDurationString(s.time,1)+" needs a buffer with a fileStart position of "+s.offset);return s}}},{"./DataStream":231,"./box":232,"./isofile":234,"./log":235}],237:[function(e,t,r){var i=e("debug")();var n=e("mp4box");var a=1e7;var s=1e6;var o=5e3;t.exports=function(e,t,r){r=r||{};var l=r.debugTrack||-1;var u=[];t.addEventListener("waiting",function(){if(d){b(t.currentTime)}});var c=new MediaSource;c.addEventListener("sourceopen",function(){y(0)});t.src=window.URL.createObjectURL(c);var p=new n;p.onError=function(e){i("MP4Box error: %s",e.message);if(_){_()}if(c.readyState==="open"){c.endOfStream("decode")}};var d=false;var h=0;var m={};p.onReady=function(e){i("MP4 info: %o",e);e.tracks.forEach(function(e){var t;if(e.video){t="video/mp4"}else if(e.audio){t="audio/mp4"}else{return}t+='; codecs="'+e.codec+'"';if(MediaSource.isTypeSupported(t)){var r=c.addSourceBuffer(t);var i={buffer:r,arrayBuffers:[],meta:e,ended:false};r.addEventListener("updateend",x.bind(null,i));p.setSegmentOptions(e.id,null,{nbSamples:e.video?1:100});m[e.id]=i}});if(Object.keys(m).length===0){c.endOfStream("decode");return}var t=p.initializeSegmentation();t.forEach(function(e){w(m[e.id],e.buffer);if(e.id===l){f("init-track-"+l+".mp4",[e.buffer]);u.push(e.buffer)}});d=true};p.onSegment=function(e,t,r,i){var n=m[e];w(n,r,i===n.meta.nb_samples);if(e===l&&u){u.push(r);if(i>1e3){f("track-"+l+".mp4",u);u=null}}};var v;var g=null;var _=null;function y(t){if(t===e.length){p.flush();return}if(g&&t===v){return}if(g){g.destroy();_()}v=t;var r={start:v,end:e.length-1};g=e.createReadStream(r);function n(e){g.pause();if(h<=a){k()}var t=e.toArrayBuffer();t.fileStart=v;v+=t.byteLength;var r;try{r=p.appendBuffer(t)}catch(n){i("MP4Box threw exception: %s",n.message);if(c.readyState==="open"){c.endOfStream("decode")}g.destroy();_();return}y(r)}g.on("data",n);function s(){_();y(v)}g.on("end",s);function o(e){i("Stream error: %s",e.message);if(c.readyState==="open"){c.endOfStream("network")}}g.on("error",o);_=function(){g.removeListener("data",n);g.removeListener("end",s);g.removeListener("error",o);g=null;_=null}}function b(e){var t=p.seek(e,true);i("Seeking to time: %d",e);i("Seeked file offset: %d",t.offset);y(t.offset);k()}function w(e,t,r){h+=t.byteLength;e.arrayBuffers.push({buffer:t,ended:r||false});x(e)}function x(e){if(e.buffer.updating||e.arrayBuffers.length===0)return;var t=e.arrayBuffers.shift();var r=false;try{e.buffer.appendBuffer(t.buffer);e.ended=t.ended;r=true}catch(n){i("SourceBuffer error: %s",n.message);e.arrayBuffers.unshift(t);setTimeout(function(){x(e)},o)}if(r){h-=t.buffer.byteLength;if(h<=s){k()}S()}}function k(){setTimeout(function(){if(g){if(g.isPaused?g.isPaused():!g._readableState.flowing){g.resume()}}})}function S(){if(c.readyState!=="open"){return}var e=Object.keys(m).every(function(e){var t=m[e];return t.ended&&!t.buffer.updating});if(e&&c.readyState==="open"){c.endOfStream()}}};function f(e,t){var r=new Blob(t);var i=URL.createObjectURL(r);var n=document.createElement("a");n.setAttribute("href",i);n.setAttribute("download",e);n.click()}},{debug:138,mp4box:236}],238:[function(e,t,r){arguments[4][27][0].apply(r,arguments)},{dup:27}],239:[function(e,t,r){t.exports=function i(e,t,r){if(t===undefined){return function(t,r){return i(e,t,r)}}if(r===undefined)r="0";e-=t.toString().length;if(e>0)return new Array(e+(/\./.test(t)?2:1)).join(r)+t;return t+""}},{}],240:[function(e,t,r){t.exports={name:"webtorrent",description:"Streaming torrent client",version:"0.52.0",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",videostream:"^1.1.4","windows-no-runnable":"0.0.6",xtend:"^4.0.0","zero-fill":"^2.2.0"},devDependencies:{"bittorrent-tracker":"^5.0.0",brfs:"^1.2.0",browserify:"^10.0.0",finalhandler:"^0.3.6","run-auto":"^1.0.0","serve-static":"^1.9.3","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"}}},{}],241:[function(e,t,r){(function(r,i,n){t.exports=k;var a=e("create-torrent");var s=e("debug")("webtorrent");var o=e("bittorrent-dht/client");var f=e("events").EventEmitter;var l=e("xtend");var u=e("hat");var c=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("path");var _=e("./lib/fs-storage");var y=e("./lib/storage");var b=e("./lib/torrent");c(k,f);var w=e("./package.json").version;var x=w.match(/([0-9]+)/g).slice(0,2).map(v(2)).join("");function k(e){var t=this;if(!(t instanceof k))return new k(e);if(!e)e={};f.call(t);if(!s.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||i.WRTC;t.torrents=[];t.downloadSpeed=m();t.uploadSpeed=m();t.storage=typeof e.storage==="function"?e.storage:e.storage!==false&&typeof _==="function"?_:y;t.peerId=e.peerId===undefined?new n("-WW"+x+"-"+u(48),"utf8"):typeof e.peerId==="string"?new n(e.peerId,"hex"):e.peerId;t.peerIdHex=t.peerId.toString("hex");t.nodeId=e.nodeId===undefined?new n(u(160),"hex"):typeof e.nodeId==="string"?new n(e.nodeId,"hex"):e.nodeId;t.nodeIdHex=t.nodeId.toString("hex");if(e.dht!==false&&typeof o==="function"){t.dht=new o(l({nodeId:t.nodeId},e.dht));t.dht.listen(e.dhtPort)}s("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,r){if(e)return t.error("failed to load blocklist: "+e.message);t.blocked=r;a()})}else r.nextTick(a);function a(){if(t.destroyed)return;t.ready=true;t.emit("ready")}}Object.defineProperty(k.prototype,"ratio",{get:function(){var e=this;var t=e.torrents.reduce(function(e,t){return e+t.uploaded},0);var r=e.torrents.reduce(function(e,t){return e+t.downloaded},0)||1;return t/r}});k.prototype.get=function(e){var t=this;if(e instanceof b)return e;var r;try{r=h(e)}catch(i){return null}if(!r.infoHash)throw new Error("Invalid torrent identifier");for(var n=0,a=t.torrents.length;n<a;n++){var s=t.torrents[n];if(s.infoHash===r.infoHash)return s}return null};k.prototype.add=k.prototype.download=function(e,t,i){var n=this;if(n.destroyed)throw new Error("client is destroyed");s("add");if(typeof t==="function"){i=t;t={}}if(!t)t={};if(!t.storage)t.storage=n.storage;t.client=n;var a=n.get(e);function o(){s("on torrent");if(typeof i==="function")i(a)}if(a){if(a.ready)r.nextTick(o);else a.on("ready",o)}else{a=new b(e,t);n.torrents.push(a);a.on("error",function(e){n.emit("error",e,a);n.remove(a)});a.on("listening",function(e){n.emit("listening",e,a)});a.on("ready",function(){o();n.emit("torrent",a)})}return a};k.prototype.seed=function(e,t,r){var i=this;if(i.destroyed)throw new Error("client is destroyed");s("seed");if(typeof t==="function"){r=t;t={}}if(!t)t={};t.noVerify=true;t.createdBy="WebTorrent/"+w;if(typeof e==="string"&&!t.path)t.path=g.dirname(e);var n;var o=i.add(undefined,t,function(e){var t=[function(t){e.storage.load(n,t)}];if(i.dht){t.push(function(t){e.on("dhtAnnounce",t)})}d(t,function(t){if(t)return i.emit("error",t);f();i.emit("seed",e)})});a.parseInput(e,t,function(r,s){if(r)return i.emit("error",r);n=s.map(function(e){return e.getStream});a(e,t,function(e,t){if(e)return i.emit("error",e);if(i.destroyed)return;var r=i.get(t);if(r){o.destroy();f();return}else{o._onTorrentId(t)}})});function f(){s("on seed");if(typeof r==="function")r(o)}return o};k.prototype.remove=function(e,t){var r=this;var i=r.get(e);if(!i)throw new Error("No torrent with id "+e);s("remove");r.torrents.splice(r.torrents.indexOf(i),1);i.destroy(t)};k.prototype.address=function(){var e=this;return{address:"0.0.0.0",family:"IPv4",port:e.torrentPort}};k.prototype.destroy=function(e){var t=this;t.destroyed=true;s("destroy");var r=t.torrents.map(function(e){return function(r){t.remove(e,r)}});if(t.dht){r.push(function(e){t.dht.destroy(e)})}d(r,e)}}).call(this,e("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},e("buffer").Buffer)},{"./lib/fs-storage":52,"./lib/storage":7,"./lib/torrent":8,"./package.json":240,_process:78,"bittorrent-dht/client":52,buffer:66,"create-torrent":99,debug:138,events:70,hat:146,inherits:147,"load-ip-set":52,"parse-torrent":154,path:77,"run-parallel":175,speedometer:181,xtend:238,"zero-fill":239}]},{},[241])(241)});
+(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,r;return function n(e,t,i){function r(s,o){if(!t[s]){if(!e[s]){var f=typeof require=="function"&&require;if(!o&&f)return f(s,!0);if(a)return a(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=t[s]={exports:{}};e[s][0].call(c.exports,function(t){var i=e[s][1][t];return r(i?i:t)},c,c.exports,n,e,t,i)}return t[s].exports}var a=typeof require=="function"&&require;for(var s=0;s<i.length;s++)r(i[s]);return r}({1:[function(e,t,i){var r=e("debug")("webtorrent:append-to");var n=e("dezalgo");var a=e("./media-stream");var s=e("path");var o=e("videostream");var f=[".mp4",".m4v",".m4a"];var l=[".mp4",".m4v",".webm"];var c=[".m4a",".mp3"];var u=l.concat(c);var p=[".wav",".aac",".ogg",".oga"];var h=[".jpg",".png",".gif",".bmp"];var d=[".css",".html",".js",".md",".pdf",".txt"];var m=typeof window!=="undefined"&&window.MediaSource;t.exports=function v(e,t,i){i=n(i);var c;var v=s.extname(e.name).toLowerCase();if(t&&(t.nodeName==="VIDEO"||t.nodeName==="AUDIO")){throw new Error("Invalid video/audio node argument. Argument must be root element that "+"video/audio tag will be appended to.")}if(u.indexOf(v)>=0)g();else if(p.indexOf(v)>=0)y();else if(h.indexOf(v)>=0)b();else if(d.indexOf(v)>=0)w();else i(new Error('Unsupported file type "'+v+'": Cannot append to DOM'));function g(){if(!m){return i(new Error("Video/audio streaming is not supported in your browser. You can still share "+"or download "+e.name+" (once it's fully downloaded). Use Chrome for "+"MediaSource support."))}var n=l.indexOf(v)>=0?"video":"audio";if(f.indexOf(v)>=0)s();else u();function s(){r("Use `videostream` package for "+e.name);g();c.addEventListener("error",h);c.addEventListener("playing",_);o(e,c);y()}function u(){r("Use MediaSource API for "+e.name);g();c.addEventListener("error",d);c.addEventListener("playing",_);e.createReadStream().pipe(new a(c,{extname:v}));y()}function p(){r("Use Blob URL for "+e.name);g();c.addEventListener("error",x);c.addEventListener("playing",_);y();e.getBlobURL(function(e,t){if(e)return x(e);c.src=t})}function h(e){r("videostream error: fallback to MediaSource API: %o",e.message||e);c.removeEventListener("error",h);c.removeEventListener("playing",_);u()}function d(e){r("MediaSource API error: fallback to Blob URL: %o",e.message||e);c.removeEventListener("error",d);c.removeEventListener("playing",_);p()}function g(){if(c)c.remove();c=window.elem=document.createElement(n);c.controls=true;c.autoplay=true}function y(){t.appendChild(c);c.play()}}function _(){c.removeEventListener("playing",_);i(null,c)}function y(){c=document.createElement("audio");c.controls=true;c.autoplay=true;t.appendChild(c);e.getBlobURL(function(e,t){if(e)return x(e);c.addEventListener("error",x);c.addEventListener("playing",_);c.src=t;c.play()})}function b(){e.getBlobURL(function(r,n){if(r)return x(r);c=document.createElement("img");c.src=n;c.alt=e.name;t.appendChild(c);i(null)})}function w(){e.getBlobURL(function(e,r){if(e)return x(e);c=document.createElement("iframe");c.src=r;if(v!==".pdf")c.sandbox="allow-forms allow-scripts";t.appendChild(c);i(null)})}function x(t){if(c)c.remove();t.message='Error appending file "'+e.name+'" to DOM: '+t.message;r(t.message);if(i)i(t)}}},{"./media-stream":3,debug:40,dezalgo:43,path:86,videostream:122}],2:[function(e,t,i){t.exports=s;var r=e("debug")("webtorrent:file-stream");var n=e("inherits");var a=e("stream");n(s,a.Readable);function s(e,t){var i=this;if(!(i instanceof s))return new s(e,t);a.Readable.call(i,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;i.destroyed=false;i.length=t.end-t.start+1;var n=t.start+e.offset;var o=t.pieceLength;i.startPiece=n/o|0;i.endPiece=(t.end+e.offset)/o|0;i._storage=e.storage;i._piece=i.startPiece;i._missing=i.length;i._reading=false;i._notifying=false;i._criticalLength=Math.min(1024*1024/o|0,2);i._offset=n-i.startPiece*o}s.prototype._read=function(){var e=this;r("_read");if(e._reading)return;e._reading=true;e.notify()};s.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;e._storage.read(e._piece++,function(i,n){e._notifying=false;if(e.destroyed)return;if(i){e._storage.emit("error",i);return e.destroy(i)}r("read %s (length %s) (err %s)",t,n.length,i&&i.message);if(e._offset){n=n.slice(e._offset);e._offset=0}if(e._missing<n.length){n=n.slice(0,e._missing)}e._missing-=n.length;r("pushing buffer of length %s",n.length);e._reading=false;e.push(n);if(e._missing===0)e.push(null)})};s.prototype.destroy=function(){var e=this;if(e.destroyed)return;e.destroyed=true;e._storage.emit("deselect",e.startPiece,e.endPiece,true)}},{debug:40,inherits:55,stream:111}],3:[function(e,t,i){t.exports=o;var r=e("debug")("webtorrent:media-source-stream");var n=e("inherits");var a=e("stream");var s=typeof window!=="undefined"&&window.MediaSource;n(o,a.Writable);function o(e,t){var i=this;if(!(i instanceof o))return new o(e,t);a.Writable.call(i,t);if(!s)throw new Error("web browser lacks MediaSource support");if(!t)t={};r("new MediaSourceStream %s %s",e,JSON.stringify(t));i._elem=e;i._mediaSource=new s;i._sourceBuffer=null;i._cb=null;i._type=t.type||f(t.extname);if(!i._type)throw new Error("missing `opts.type` or `opts.extname` options");i._elem.src=window.URL.createObjectURL(i._mediaSource);i._mediaSource.addEventListener("sourceopen",function(){if(s.isTypeSupported(i._type)){i._sourceBuffer=i._mediaSource.addSourceBuffer(i._type);i._sourceBuffer.addEventListener("updateend",i._flow.bind(i));i._flow()}else{i._mediaSource.endOfStream("decode")}});i.on("finish",function(){r("finish");i._mediaSource.endOfStream()});window.vs=i}o.prototype._write=function(e,t,i){var n=this;if(!n._sourceBuffer){n._cb=function(r){if(r)return i(r);n._write(e,t,i)};return}if(n._sourceBuffer.updating){return i(new Error("Cannot append buffer while source buffer updating"))}n._sourceBuffer.appendBuffer(e);r("appendBuffer %s",e.length);n._cb=i};o.prototype._flow=function(){var e=this;r("flow");if(e._cb){e._cb(null)}};function f(e){if(!e)return null;if(e[0]!==".")e="."+e;return{".m4a":'audio/mp4; codecs="mp4a.40.5"',".m4v":'video/mp4; codecs="avc1.640029, mp4a.40.5"',".mp3":"audio/mpeg",".mp4":'video/mp4; codecs="avc1.640029, mp4a.40.5"',".webm":'video/webm; codecs="vorbis, vp8"'}[e]}},{debug:40,inherits:55,stream:111}],4:[function(e,t,i){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,i){t.exports=r;function r(e,t){var i=this;i.swarm=e;i.numPieces=t;function r(e){e.on("have",function(e){i.pieces[e]++});e.on("bitfield",i.recalculate.bind(i));e.on("close",function(){for(var t=0;t<i.numPieces;++t){i.pieces[t]-=e.peerPieces.get(t)}})}i.swarm.wires.forEach(r);i.swarm.on("wire",function(e){i.recalculate();r(e)});i.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 i=0;i<e.numPieces;++i){e.pieces[i]+=t.peerPieces.get(i)}})};r.prototype.getRarestPiece=function(e){var t=this;var i=[];var r=Infinity;e=e||function(){return true};for(var n=0;n<t.numPieces;++n){if(!e(n))continue;var a=t.pieces[n];if(a===r){i.push(n)}else if(a<r){i=[n];r=a}}if(i.length>0){return i[Math.random()*i.length|0]}else{return-1}}},{}],6:[function(e,t,i){var r=e("debug")("webtorrent:server");var n=e("http");var a=e("mime");var s=e("pump");var o=e("range-parser");var f=e("url");t.exports=function l(e,t){var i=n.createServer(t);i.on("connection",function(e){e.setTimeout(36e6)});i.on("request",function(t,i){r("onRequest");if(t.method==="OPTIONS"&&t.headers["access-control-request-headers"]){i.setHeader("Access-Control-Allow-Methods","POST, GET, OPTIONS");i.setHeader("Access-Control-Allow-Headers",t.headers["access-control-request-headers"]);i.setHeader("Access-Control-Max-Age","1728000");return i.end()}if(t.headers.origin){i.setHeader("Access-Control-Allow-Origin",t.headers.origin)}var n=f.parse(t.url).pathname;if(n==="/favicon.ico")return i.end();if(e.ready)l();else e.once("ready",l);function l(){if(n==="/"){i.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 i.end("<h1>WebTorrent</h1><ol>"+f+"</ol>")}var l=Number(n.slice(1));if(Number.isNaN(l)||l>=e.files.length){i.statusCode=404;return i.end("404 Not Found")}var c=e.files[l];i.setHeader("Accept-Ranges","bytes");i.setHeader("Content-Type",a.lookup(c.name));i.statusCode=200;i.setHeader("transferMode.dlna.org","Streaming");i.setHeader("contentFeatures.dlna.org","DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000");var u;if(t.headers.range){i.statusCode=206;u=o(c.length,t.headers.range)[0];r("range %s",JSON.stringify(u));i.setHeader("Content-Range","bytes "+u.start+"-"+u.end+"/"+c.length);i.setHeader("Content-Length",u.end-u.start+1)}else{i.setHeader("Content-Length",c.length)}if(t.method==="HEAD")i.end();s(c.createReadStream(u),i)}});return i}},{debug:40,http:50,mime:62,pump:88,"range-parser":92,url:118}],7:[function(e,t,i){(function(r,n){t.exports=i=A;var a=e("./append-to");var s=e("bitfield");var o=e("block-stream2");var f=e("debug")("webtorrent:storage");var l=e("dezalgo");var c=e("end-of-stream");var u=e("events").EventEmitter;var p=e("./file-stream");var h=e("inherits");var d=e("./mime.json");var m=e("multistream");var v=e("once");var g=e("path");var _=e("simple-sha1");var y=16*1024;var b=i.BLOCK_BLANK=0;var w=i.BLOCK_RESERVED=1;var x=i.BLOCK_WRITTEN=2;function k(){}h(S,u);function S(e,t,i,r){var n=this;u.call(n);if(!f.enabled)n.setMaxListeners(0);n.index=e;n.hash=t;n.noVerify=!!r;if(typeof i==="number"){n.buffer=null;n.length=i}else{n.buffer=i;n.length=i.length}n._reset()}S.prototype.readBlock=function(e,t,i){var r=this;i=l(i);if(!r.buffer||!r._verifyOffset(e)){return i(new Error("invalid block offset "+e))}i(null,r.buffer.slice(e,e+t))};S.prototype.writeBlock=function(e,t,i){var r=this;i=l(i);if(!r._verifyOffset(e)||!r._verifyBlock(e,t)){return i(new Error("invalid block "+e+":"+t.length))}r._lazyAllocBuffer();var n=e/y;if(r.blocks[n]===x){return i(null)}t.copy(r.buffer,e);r.blocks[n]=x;r.blocksWritten+=1;if(r.blocksWritten===r.blocks.length){r.verify()}i(null)};S.prototype.reserveBlock=function(e){var t=this;var i=t.blocks.length;for(var r=0;r<i;r++){if(t.blocks[r]&&!e||t.blocks[r]===x){continue}t.blocks[r]=w;return{offset:r*y,length:r===i-1?t.length-r*y:y}}return null};S.prototype.cancelBlock=function(e){var t=this;if(!t._verifyOffset(e)){return false}var i=e/y;if(t.blocks[i]===w){t.blocks[i]=b}return true};S.prototype._reset=function(){var e=this;e.verified=false;e.blocks=new n(Math.ceil(e.length/y));if(!r.browser)e.blocks.fill(0);e.blocksWritten=0};S.prototype.verify=function(e){var t=this;if(!e)e=t.buffer;if(t.verified||!e){return}if(t.noVerify){t.verified=true;i();return}_(e,function(e){t.verified=e===t.hash;i()});function i(){if(t.verified){t.emit("done")}else{t.emit("warning",new Error("piece "+t.index+" failed verification"));t._reset()}}};S.prototype._verifyOffset=function(e){var t=this;if(e%y===0){return true}else{t.emit("warning",new Error("invalid block offset "+e+", not multiple of "+y));return false}};S.prototype._verifyBlock=function(e,t){var i=this;if(t.length===y){return true}else if(t.length===i.length-e&&i.length-e<y){return true}else{i.emit("warning",new Error("invalid block size "+t.length));return false}};S.prototype._lazyAllocBuffer=function(){var e=this;if(!e.buffer)e.buffer=new n(e.length)};h(E,u);function E(e,t,i,r){var n=this;u.call(n);if(!f.enabled)n.setMaxListeners(0);n.storage=e;n.name=t.name;n.path=t.path;n.length=t.length;n.offset=t.offset;n.pieces=i;n.pieceLength=r;n.done=false;n._blobUrl=null;n._blobUrlPending=false;n.pieces.forEach(function(e){e.on("done",function(){n._checkDone()})});n._checkDone()}E.prototype.select=function(){var e=this;if(e.pieces.length>0){var t=e.pieces[0].index;var i=e.pieces[e.pieces.length-1].index;e.storage.emit("select",t,i,false)}};E.prototype.deselect=function(){var e=this;if(e.pieces.length>0){var t=e.pieces[0].index;var i=e.pieces[e.pieces.length-1].index;e.storage.emit("deselect",t,i,false)}};E.prototype.createReadStream=function(e){var t=this;if(!e)e={};if(e.pieceLength==null)e.pieceLength=t.pieceLength;var i=new p(t,e);t.storage.emit("select",i.startPiece,i.endPiece,true,i.notify.bind(i));c(i,function(){t.storage.emit("deselect",i.startPiece,i.endPiece,true)});return i};E.prototype.getBuffer=function(e){var t=this;e=l(v(e));var i;if(t.storage.buffer){var r=function(){i=t.storage.buffer.slice(t.offset,t.offset+t.length);e(null,i)};if(t.done)r();else t.once("done",r)}else{i=new n(t.length);var a=0;t.createReadStream().on("data",function(e){e.copy(i,a);a+=e.length}).on("end",function(){e(null,i)}).on("error",e)}};E.prototype.appendTo=function(e,t){var i=this;if(typeof window==="undefined")throw new Error("browser-only method");if(typeof e==="string")e=document.querySelector(e);a(i,e,t)};E.prototype.getBlobURL=function(e){var t=this;if(typeof window==="undefined")throw new Error("browser-only method");e=l(e);if(t._blobUrl)return e(null,t._blobUrl);if(t._blobUrlPending)return t.once("_blobUrl",e);t._blobUrlPending=true;t.getBuffer(function(i,r){t._blobUrlPending=false;if(i){e(i);t.emit("_blobUrl",i);return}var n=d[g.extname(t.name).toLowerCase()];var a=n?new window.Blob([r],{type:n}):new window.Blob([r]);t._blobUrl=window.URL.createObjectURL(a);e(null,t._blobUrl);t.emit("_blobUrl",null,t._blobUrl)})};E.prototype._checkDone=function(){var e=this;e.done=e.pieces.every(function(e){return e.verified});if(e.done){r.nextTick(function(){e.emit("done")})}};h(A,u);function A(e,t){var i=this;u.call(i);if(!f.enabled)i.setMaxListeners(0);if(!t)t={};i.bitfield=new s(e.pieces.length);i.done=false;i.closed=false;i.readonly=true;if(!t.nobuffer){i.buffer=new n(e.length)}var r=i.pieceLength=e.pieceLength;var a=e.lastPieceLength;var o=e.pieces.length;i.pieces=e.pieces.map(function(e,n){var s=n*r;var f=s+(n===o-1?a:r);var l=i.buffer?i.buffer.slice(s,f):f-s;var c=new S(n,e,l,!!t.noVerify);c.on("done",i._onPieceDone.bind(i,c));return c});i.files=e.files.map(function(e){var t=e.offset;var n=t+e.length-1;var a=t/r|0;var s=n/r|0;var o=i.pieces.slice(a,s+1);var f=new E(i,e,o,r);f.on("done",i._onFileDone.bind(i,f));return f})}A.BLOCK_LENGTH=y;A.prototype.load=function(e,t){var i=this;if(!Array.isArray(e))e=[e];t=v(t||function(){});var r=0;var n=new m(e);var a=new o(i.pieceLength,{zeroPadding:false});n.on("error",f);i.once("done",l);n.pipe(a).on("data",s).on("error",f);function s(e){var t=r;r+=1;var n=0;var a=new o(y,{zeroPadding:false});a.on("data",s);a.on("end",f);function s(e){var r=n*y;n+=1;i.writeBlock(t,r,e)}function f(){l()}function l(){a.removeListener("data",s);a.removeListener("end",f)}a.end(e)}function f(e){c();t(e)}function l(){c();t(null)}function c(){n.removeListener("error",f);a.removeListener("data",s);a.removeListener("error",f);i.removeListener("done",l)}};Object.defineProperty(A.prototype,"downloaded",{get:function(){var e=this;return e.pieces.reduce(function(e,t){return e+(t.verified?t.length:t.blocksWritten*y)},0)}});Object.defineProperty(A.prototype,"numMissing",{get:function(){var e=this;var t=e.pieces.length;for(var i=0,r=e.pieces.length;i<r;i++){t-=e.bitfield.get(i)}return t}});A.prototype.readBlock=function(e,t,i,r){var n=this;r=l(r);var a=n.pieces[e];if(!a)return r(new Error("invalid piece index "+e));a.readBlock(t,i,r)};A.prototype.writeBlock=function(e,t,i,r){var n=this;if(!r)r=k;r=l(r);if(n.readonly)return r(new Error("cannot write to readonly storage"));var a=n.pieces[e];if(!a)return r(new Error("invalid piece index "+e));a.writeBlock(t,i,r)};A.prototype.read=function(e,t,i,r){var a=this;if(typeof t==="function"){r=i;i=t;t=null}i=l(i);var s=a.pieces[e];if(!s){return i(new Error("invalid piece index "+e))}if(!s.verified&&!r){return i(new Error("Storage.read called on incomplete piece "+e))}var o=0;var f=s.length;if(t){o=t.offset||0;f=t.length||f}if(s.buffer){return i(null,s.buffer.slice(o,o+f))}var c=[];function u(){if(f<=0)return i(null,n.concat(c));var t=o;var r=Math.min(y,f);o+=r;f-=r;a.readBlock(e,t,r,function(e,t){if(e)return i(e);c.push(t);u()})}u()};A.prototype.reserveBlock=function(e,t){var i=this;var r=i.pieces[e];if(!r)return null;return r.reserveBlock(t)};A.prototype.cancelBlock=function(e,t){var i=this;var r=i.pieces[e];if(!r)return false;return r.cancelBlock(t)};A.prototype.remove=function(e){if(e)l(e)(null)};A.prototype.close=function(e){var t=this;t.closed=true;if(e)l(e)(null)};A.prototype._onPieceDone=function(e){var t=this;t.bitfield.set(e.index);f("piece done "+e.index+" ("+t.numMissing+" still missing)");t.emit("piece",e)};A.prototype._onFileDone=function(e){var t=this;f("file done "+e.name);t.emit("file",e);t._checkDone()};A.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)},{"./append-to":1,"./file-stream":2,"./mime.json":4,_process:34,bitfield:19,"block-stream2":29,buffer:36,debug:40,dezalgo:43,"end-of-stream":44,events:45,inherits:55,multistream:71,once:72,path:86,"simple-sha1":108}],8:[function(e,t,i){(function(i,r){t.exports=I;var n=e("addr-to-ip-port");var a=e("create-torrent");var s=e("debug")("webtorrent:torrent");var o=e("torrent-discovery");var f=e("events").EventEmitter;var l=e("inherits");var c=e("run-parallel");var u=e("parse-torrent");var p=e("re-emitter");var h=e("bittorrent-swarm");var d=e("uniq");var m=e("ut_metadata");var v=e("ut_pex");var g=e("./rarity-map");var _=e("./server");var y=e("./storage");var b=128*1024;var w=3e4;var x=5e3;var k=3*y.BLOCK_LENGTH;var S=.5;var E=1;var A=1e4;var U=2;function T(){}l(I,f);function I(e,t){var i=this;f.call(i);if(!s.enabled)i.setMaxListeners(0);s("new torrent");i.opts=t;i.client=t.client;i.hotswapEnabled="hotswap"in t?t.hotswap:true;i.verify=t.verify;i.chokeTimeout=t.chokeTimeout||x;i.pieceTimeout=t.pieceTimeout||w;i.strategy=t.strategy||"sequential";i._rechokeNumSlots=t.uploads===false||t.uploads===0?0:+t.uploads||10;i._rechokeOptimisticWire=null;i._rechokeOptimisticTime=0;i._rechokeIntervalId=null;i.ready=false;i.destroyed=false;i.files=[];i.metadata=null;i.parsedTorrent=null;i.storage=null;i.numBlockedPeers=0;i._amInterested=false;i._selections=[];i._critical=[];i._storageImpl=t.storage||y;this._torrentFileURL=null;if(e)i._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 u.toMagnetURI(this.parsedTorrent)}});Object.defineProperty(I.prototype,"torrentFile",{get:function(){return u.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 i=e&&e.parsedTorrent;if(i){t._onParsedTorrent(i)}else{u.remote(e,function(e,i){if(t.destroyed)return;if(e)return t._onError(e);t._onParsedTorrent(i)})}};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]})}d(t.parsedTorrent.announce);t.swarm=new h(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));if(t.parsedTorrent.urlList){t.parsedTorrent.urlList.forEach(t.addWebSeed.bind(t))}i.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 o({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;s("got metadata");if(e&&e.infoHash){t.metadata=u.toTorrentFile(e);t.parsedTorrent=e}else{t.metadata=e;var r=t.parsedTorrent.announce;try{t.parsedTorrent=u(t.metadata)}catch(n){return t._onError(n)}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();s("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){i.nextTick(function(){s("verifying existing torrent data");var e=0;var i=0;c(t.storage.pieces.map(function(r){return function(n){t.storage.read(r.index,function(a,o){e+=1;t.emit("verifying",{percentDone:100*e/t.storage.pieces.length,percentVerified:100*i/t.storage.pieces.length});if(!a&&o){r.verify(o);i+=r.verified;s("piece "+(r.verified?"verified":"invalid")+" "+r.index)}n()},true)}}),t._onStorage.bind(t))})}else{i.nextTick(t._onStorage.bind(t))}i.nextTick(function(){t.emit("metadata")})};I.prototype.destroy=function(e){var t=this;if(t.destroyed)return;t.destroyed=true;s("destroy");if(t._rechokeIntervalId){clearInterval(t._rechokeIntervalId);t._rechokeIntervalId=null}t.files.forEach(function(e){if(e._blobURL)window.URL.revokeObjectURL(e._blobURL)});if(t._torrentFileURL)window.URL.revokeObjectURL(t._torrentFileURL);var i=[];if(t.swarm)i.push(function(e){t.swarm.destroy(e)});if(t.discovery)i.push(function(e){t.discovery.stop(e)});if(t.storage)i.push(function(e){t.storage.close(e)});c(i,e)};I.prototype.addPeer=function(e){var t=this;function i(){t.emit("peer",e);t.swarm.addPeer(e)}if(typeof e==="string"&&t.client.blocked&&t.client.blocked.contains(n(e)[0])){t.numBlockedPeers+=1;t.emit("blockedPeer",e);return false}else{if(t.swarm)i();else t.on("listening",i);return true}};I.prototype.addWebSeed=function(e){var t=this;t.swarm.addWebSeed(e,t.parsedTorrent)};I.prototype.select=function(e,t,i,r){var n=this;if(e>t||e<0||t>=n.storage.pieces.length){throw new Error("invalid selection ",e,":",t)}i=Number(i)||0;s("select %s-%s (priority %s)",e,t,i);n._selections.push({from:e,to:t,offset:0,priority:i,notify:r||T});n._selections.sort(function(e,t){return t.priority-e.priority});n._updateSelections()};I.prototype.deselect=function(e,t,i){var r=this;i=Number(i)||0;s("deselect %s-%s (priority %s)",e,t,i);for(var n=0;n<r._selections.length;++n){var a=r._selections[n];if(a.from===e&&a.to===t&&a.priority===i){r._selections.splice(n--,1);break}}r._updateSelections()};I.prototype.critical=function(e,t){var i=this;s("critical %s-%s",e,t);for(var r=e;r<=t;++r){i._critical[r]=true}i._updateSelections()};I.prototype._onWire=function(e,t){var i=this;s("got wire (%s)",t||"Unknown");if(t){var r=n(t);e.remoteAddress=r[0];e.remotePort=r[1]}if(e.peerExtensions.dht&&i.client.dht&&i.client.dht.listening){e.on("port",function(t){if(!e.remoteAddress){s("ignoring port from peer with no address");return}s("port: %s (from %s)",t,e.remoteAddress+":"+e.remotePort);i.client.dht.addNode(e.remoteAddress+":"+t)});e.port(i.client.dht.address().port)}e.on("timeout",function(){s("wire timeout (%s)",t);e.destroy()});e.setTimeout(i.pieceTimeout,true);e.setKeepAlive(true);e.use(m(i.metadata));if(!i.metadata){e.ut_metadata.on("metadata",function(e){s("got metadata via ut_metadata");i._onMetadata(e)});e.ut_metadata.fetch()}if(typeof v==="function"){e.use(v());e.ut_pex.on("peer",function(e){s("ut_pex: got peer: %s (from %s)",e,t);i.addPeer(e)});e.ut_pex.on("dropped",function(e){s("ut_pex: dropped peer: %s (from %s)",e,t);var r=i.swarm._peers[e];if(!r||!r.conn)i.swarm.removePeer(e)})}i.emit("wire",e);if(i.metadata){i._onWireWithMetadata(e)}};I.prototype._onWireWithMetadata=function(e){var t=this;var i=null;var r=t.chokeTimeout;function n(){if(t.destroyed||e.destroyed)return;if(t.swarm.numQueued>2*(t.swarm.numConns-t.swarm.numPeers)&&e.amInterested){e.destroy()}else{i=setTimeout(n,r);if(i.unref)i.unref()}}var a=0;function o(){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(){o();t._update()});e.on("have",function(){o();t._update()});e.once("interested",function(){e.unchoke()});e.on("close",function(){clearTimeout(i)});e.on("choke",function(){clearTimeout(i);i=setTimeout(n,r);if(i.unref)i.unref()});e.on("unchoke",function(){clearTimeout(i);t._update()});e.on("request",function(i,r,n,a){if(n>b){s("got invalid block size request %s (from %s)",n,e.remoteAddress+":"+e.remotePort);return e.destroy()}t.storage.readBlock(i,r,n,a)});e.bitfield(t.storage.bitfield);e.interested();i=setTimeout(n,r);if(i.unref)i.unref();e.isSeeder=false;o()};I.prototype._onStorage=function(){var e=this;if(e.destroyed)return;s("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();i.nextTick(function(){e.ready=true;e.emit("ready")})};I.prototype._onStoragePiece=function(e){var t=this;s("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));i.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 i=e._selections[t];var r=i.offset;while(e.storage.bitfield.get(i.from+i.offset)&&i.from+i.offset<i.to){i.offset++}if(r!==i.offset)i.notify();if(i.to!==i.from+i.offset)continue;if(!e.storage.bitfield.get(i.from+i.offset))continue;e._selections.splice(t--,1);i.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;z(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 i=L(e,S);if(e.requests.length>=i)return;var r=L(e,E);f(false)||f(true);function n(t,i,r,n){return function(a){return a>=t&&a<=i&&!(a in r)&&e.peerPieces.get(a)&&(!n||n(a))}}function a(){if(e.requests.length)return;for(var i=t._selections.length;i--;){var r=t._selections[i];var a;if(t.strategy==="rarest"){var s=r.from+r.offset;var o=r.to;var f=o-s+1;var l={};var c=0;var u=n(s,o,l);while(c<f){a=t.rarityMap.getRarestPiece(u);if(a<0)break;if(t._request(e,a,false))return;l[a]=true;c+=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 s(){var i=e.downloadSpeed()||1;if(i>k)return function(){return true};var r=Math.max(1,e.requests.length)*y.BLOCK_LENGTH/i;var n=10;var a=0;return function(e){if(!n||t.storage.bitfield.get(e))return true;var s=t.storage.pieces[e];var o=s.blocks.length-s.blocksWritten;for(;a<t.swarm.wires.length;a++){var f=t.swarm.wires[a];var l=f.downloadSpeed();if(l<k)continue;if(l<=i)continue;if(!f.peerPieces.get(e))continue;if((o-=l*r)>0)continue;n--;return false}return true}}function o(e){var i=e;for(var r=e;r<t._selections.length&&t._selections[r].priority;r++){i=r}var n=t._selections[e];t._selections[e]=t._selections[i];t._selections[i]=n}function f(i){if(e.requests.length>=r)return true;var a=s();for(var f=0;f<t._selections.length;f++){var l=t._selections[f];var c;if(t.strategy==="rarest"){var u=l.from+l.offset;var p=l.to;var h=p-u+1;var d={};var m=0;var v=n(u,p,d,a);while(m<h){c=t.rarityMap.getRarestPiece(v);if(c<0)break;while(t._request(e,c,t._critical[c]||i)){}if(e.requests.length<r){d[c]=true;m++;continue}if(l.priority)o(f);return true}}else{for(c=l.from+l.offset;c<=l.to;c++){if(!e.peerPieces.get(c)||!a(c))continue;while(t._request(e,c,t._critical[c]||i)){}if(e.requests.length<r)continue;if(l.priority)o(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(i){if(!i.isSeeder&&i!==e._rechokeOptimisticWire){t.push({wire:i,downloadSpeed:i.downloadSpeed(),uploadSpeed:i.uploadSpeed(),salt:Math.random(),isChoked:true})}});t.sort(s);var i=0;var r=0;for(;r<t.length&&i<e._rechokeNumSlots;++r){t[r].isChoked=false;if(t[r].wire.peerInterested)i+=1}if(!e._rechokeOptimisticWire&&r<t.length&&e._rechokeNumSlots){var n=t.slice(r).filter(function(e){return e.wire.peerInterested});var a=n[B(n.length)];if(a){a.isChoked=false;e._rechokeOptimisticWire=a.wire;e._rechokeOptimisticTime=U}}t.forEach(function(e){if(e.wire.amChoking!==e.isChoked){if(e.isChoked)e.wire.choke();else e.wire.unchoke();
+}});function s(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 i=this;if(!i.hotswapEnabled)return false;var r=e.downloadSpeed();if(r<y.BLOCK_LENGTH)return false;if(!i._reservations[t])return false;var n=i._reservations[t];if(!n){return false}var a=Infinity;var s;var o;for(o=0;o<n.length;o++){var f=n[o];if(!f||f===e)continue;var l=f.downloadSpeed();if(l>=k)continue;if(2*l>r||l>a)continue;s=f;a=l}if(!s)return false;for(o=0;o<n.length;o++){if(n[o]===s)n[o]=null}for(o=0;o<s.requests.length;o++){var c=s.requests[o];if(c.piece!==t)continue;i.storage.cancelBlock(t,c.offset)}i.emit("hotswap",s,e,t);return true};I.prototype._request=function(e,t,r){var n=this;var a=e.requests.length;if(n.storage.bitfield.get(t))return false;var o=L(e,E);if(a>=o)return false;var f=e.requests.length===0&&n.storage.numMissing<30;var l=n.storage.reserveBlock(t,f);if(!l&&!f&&r&&n._hotswap(e,t)){l=n.storage.reserveBlock(t,false)}if(!l)return false;var c=n._reservations[t];if(!c){c=n._reservations[t]=[]}var u=c.indexOf(null);if(u===-1)u=c.length;c[u]=e;function p(r,a){if(!n.ready){n.once("ready",function(){p(r,a)});return}if(c[u]===e)c[u]=null;if(r){s("error getting piece %s (offset: %s length: %s) from %s: %s",t,l.offset,l.length,e.remoteAddress+":"+e.remotePort,r.message);n.storage.cancelBlock(t,l.offset);i.nextTick(n._update.bind(n));return false}else{s("got piece %s (offset: %s length: %s) from %s",t,l.offset,l.length,e.remoteAddress+":"+e.remotePort);n.storage.writeBlock(t,l.offset,a,function(e){if(e){s("error writing block");n.storage.cancelBlock(t,l.offset)}i.nextTick(n._update.bind(n))})}}e.request(t,l.offset,l.length,p);return true};I.prototype.createServer=function(e){var t=this;if(typeof _==="function"){return new _(t,e)}};I.prototype._onError=function(e){var t=this;s("torrent error: %s",e.message||e);t.emit("error",e);t.destroy()};function L(e,t){return Math.ceil(2+t*e.downloadSpeed()/y.BLOCK_LENGTH)}function B(e){return Math.random()*e|0}function z(e,t){var i=e.map(function(e,t){return t});for(var r=i.length-1;r>0;--r){var n=B(r+1);var a=i[r];i[r]=i[n];i[n]=a}i.forEach(function(i){t(e[i],i,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:34,"addr-to-ip-port":10,"bittorrent-swarm":21,"create-torrent":39,debug:40,events:45,inherits:55,"parse-torrent":85,"re-emitter":93,"run-parallel":104,"torrent-discovery":115,uniq:117,ut_metadata:119,ut_pex:30}],9:[function(e,t,i){(function(){var e=typeof i!="undefined"?i: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 i,n,a=0,s=t,o="";e.charAt(a|0)||(s="=",a%1);o+=s.charAt(63&i>>8-a%1*8)){n=e.charCodeAt(a+=3/4);if(n>255){throw new r("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.")}i=i<<8|n}return o});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 i=0,n,a,s=0,o="";a=e.charAt(s++);~a&&(n=i%4?n*64+a:a,i++%4)?o+=String.fromCharCode(255&n>>(-2*i&6)):0){a=t.indexOf(a)}return o})})()},{}],10:[function(e,t,i){var r=/^\[?([^\]]+)\]?:(\d+)$/;var n={};var a=0;t.exports=function s(e){if(a===1e5)n={};if(!n[e]){var t=r.exec(e);if(!t)throw new Error("invalid addr: "+e);n[e]=[t[1],Number(t[2])];a+=1}return n[e]};t.exports.reset=function o(){n={}}},{}],11:[function(e,t,i){"use strict";var r=e("./raw");var n=[];var a=[];var s=r.makeRequestCallFromTimer(o);function o(){if(a.length){throw a.shift()}}t.exports=f;function f(e){var t;if(n.length){t=n.pop()}else{t=new l}t.task=e;r(t)}function l(){this.task=null}l.prototype.call=function(){try{this.task.call()}catch(e){if(f.onerror){f.onerror(e)}else{a.push(e);s()}}finally{this.task=null;n[n.length]=this}}},{"./raw":12}],12:[function(e,t,i){(function(e){"use strict";t.exports=i;function i(e){if(!r.length){a();n=true}r[r.length]=e}var r=[];var n=false;var a;var s=0;var o=1024;function f(){while(s<r.length){var e=s;s=s+1;r[e].call();if(s>o){for(var t=0,i=r.length-s;t<i;t++){r[t]=r[t+s]}r.length-=s;s=0}}r.length=0;s=0;n=false}var l=e.MutationObserver||e.WebKitMutationObserver;if(typeof l==="function"){a=c(f)}else{a=u(f)}i.requestFlush=a;function c(e){var t=1;var i=new l(e);var r=document.createTextNode("");i.observe(r,{characterData:true});return function n(){t=-t;r.data=t}}function u(e){return function t(){var t=setTimeout(r,0);var i=setInterval(r,50);function r(){clearTimeout(t);clearInterval(i);e()}}}i.makeRequestCallFromTimer=u}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],13:[function(e,t,i){var r=e("util/");var n=Array.prototype.slice;var a=Object.prototype.hasOwnProperty;var s=t.exports=u;s.AssertionError=function _(e){this.name="AssertionError";this.actual=e.actual;this.expected=e.expected;this.operator=e.operator;if(e.message){this.message=e.message;this.generatedMessage=false}else{this.message=l(this);this.generatedMessage=true}var t=e.stackStartFunction||c;if(Error.captureStackTrace){Error.captureStackTrace(this,t)}else{var i=new Error;if(i.stack){var r=i.stack;var n=t.name;var a=r.indexOf("\n"+n);if(a>=0){var s=r.indexOf("\n",a+1);r=r.substring(s+1)}this.stack=r}}};r.inherits(s.AssertionError,Error);function o(e,t){if(r.isUndefined(t)){return""+t}if(r.isNumber(t)&&!isFinite(t)){return t.toString()}if(r.isFunction(t)||r.isRegExp(t)){return t.toString()}return t}function f(e,t){if(r.isString(e)){return e.length<t?e:e.slice(0,t)}else{return e}}function l(e){return f(JSON.stringify(e.actual,o),128)+" "+e.operator+" "+f(JSON.stringify(e.expected,o),128)}function c(e,t,i,r,n){throw new s.AssertionError({message:i,actual:e,expected:t,operator:r,stackStartFunction:n})}s.fail=c;function u(e,t){if(!e)c(e,true,t,"==",s.ok)}s.ok=u;s.equal=function y(e,t,i){if(e!=t)c(e,t,i,"==",s.equal)};s.notEqual=function b(e,t,i){if(e==t){c(e,t,i,"!=",s.notEqual)}};s.deepEqual=function w(e,t,i){if(!p(e,t)){c(e,t,i,"deepEqual",s.deepEqual)}};function p(e,t){if(e===t){return true}else if(r.isBuffer(e)&&r.isBuffer(t)){if(e.length!=t.length)return false;for(var i=0;i<e.length;i++){if(e[i]!==t[i])return false}return true}else if(r.isDate(e)&&r.isDate(t)){return e.getTime()===t.getTime()}else if(r.isRegExp(e)&&r.isRegExp(t)){return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase}else if(!r.isObject(e)&&!r.isObject(t)){return e==t}else{return d(e,t)}}function h(e){return Object.prototype.toString.call(e)=="[object Arguments]"}function d(e,t){if(r.isNullOrUndefined(e)||r.isNullOrUndefined(t))return false;if(e.prototype!==t.prototype)return false;if(r.isPrimitive(e)||r.isPrimitive(t)){return e===t}var i=h(e),a=h(t);if(i&&!a||!i&&a)return false;if(i){e=n.call(e);t=n.call(t);return p(e,t)}var s=g(e),o=g(t),f,l;if(s.length!=o.length)return false;s.sort();o.sort();for(l=s.length-1;l>=0;l--){if(s[l]!=o[l])return false}for(l=s.length-1;l>=0;l--){f=s[l];if(!p(e[f],t[f]))return false}return true}s.notDeepEqual=function x(e,t,i){if(p(e,t)){c(e,t,i,"notDeepEqual",s.notDeepEqual)}};s.strictEqual=function k(e,t,i){if(e!==t){c(e,t,i,"===",s.strictEqual)}};s.notStrictEqual=function S(e,t,i){if(e===t){c(e,t,i,"!==",s.notStrictEqual)}};function m(e,t){if(!e||!t){return false}if(Object.prototype.toString.call(t)=="[object RegExp]"){return t.test(e)}else if(e instanceof t){return true}else if(t.call({},e)===true){return true}return false}function v(e,t,i,n){var a;if(r.isString(i)){n=i;i=null}try{t()}catch(s){a=s}n=(i&&i.name?" ("+i.name+").":".")+(n?" "+n:".");if(e&&!a){c(a,i,"Missing expected exception"+n)}if(!e&&m(a,i)){c(a,i,"Got unwanted exception"+n)}if(e&&a&&i&&!m(a,i)||!e&&a){throw a}}s.throws=function(e,t,i){v.apply(this,[true].concat(n.call(arguments)))};s.doesNotThrow=function(e,t){v.apply(this,[false].concat(n.call(arguments)))};s.ifError=function(e){if(e){throw e}};var g=Object.keys||function(e){var t=[];for(var i in e){if(a.call(e,i))t.push(i)}return t}},{"util/":121}],14:[function(e,t,i){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(e){"use strict";var t=typeof Uint8Array!=="undefined"?Uint8Array:Array;var i="+".charCodeAt(0);var n="/".charCodeAt(0);var a="0".charCodeAt(0);var s="a".charCodeAt(0);var o="A".charCodeAt(0);var f="-".charCodeAt(0);var l="_".charCodeAt(0);function c(e){var t=e.charCodeAt(0);if(t===i||t===f)return 62;if(t===n||t===l)return 63;if(t<a)return-1;if(t<a+10)return t-a+26+26;if(t<o+26)return t-o;if(t<s+26)return t-s+26}function u(e){var i,r,n,a,s,o;if(e.length%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var f=e.length;s="="===e.charAt(f-2)?2:"="===e.charAt(f-1)?1:0;o=new t(e.length*3/4-s);n=s>0?e.length-4:e.length;var l=0;function u(e){o[l++]=e}for(i=0,r=0;i<n;i+=4,r+=3){a=c(e.charAt(i))<<18|c(e.charAt(i+1))<<12|c(e.charAt(i+2))<<6|c(e.charAt(i+3));u((a&16711680)>>16);u((a&65280)>>8);u(a&255)}if(s===2){a=c(e.charAt(i))<<2|c(e.charAt(i+1))>>4;u(a&255)}else if(s===1){a=c(e.charAt(i))<<10|c(e.charAt(i+1))<<4|c(e.charAt(i+2))>>2;u(a>>8&255);u(a&255)}return o}function p(e){var t,i=e.length%3,n="",a,s;function o(e){return r.charAt(e)}function f(e){return o(e>>18&63)+o(e>>12&63)+o(e>>6&63)+o(e&63)}for(t=0,s=e.length-i;t<s;t+=3){a=(e[t]<<16)+(e[t+1]<<8)+e[t+2];n+=f(a)}switch(i){case 1:a=e[e.length-1];n+=o(a>>2);n+=o(a<<4&63);n+="==";break;case 2:a=(e[e.length-2]<<8)+e[e.length-1];n+=o(a>>10);n+=o(a>>4&63);n+=o(a<<2&63);n+="=";break}return n}e.toByteArray=u;e.fromByteArray=p})(typeof i==="undefined"?this.base64js={}:i)},{}],15:[function(e,t,i){t.exports={encode:e("./lib/encode"),decode:e("./lib/decode")}},{"./lib/decode":16,"./lib/encode":18}],16:[function(e,t,i){(function(i){var r=e("./dict");function n(e,t){n.position=0;n.encoding=t||null;n.data=!i.isBuffer(e)?new i(e):e;return n.next()}n.position=0;n.data=null;n.encoding=null;n.next=function(){switch(n.data[n.position]){case 100:return n.dictionary();break;case 108:return n.list();break;case 105:return n.integer();break;default:return n.bytes();break}};n.find=function(e){var t=n.position;var i=n.data.length;var r=n.data;while(t<i){if(r[t]===e)return t;t++}throw new Error('Invalid data: Missing delimiter "'+String.fromCharCode(e)+'" [0x'+e.toString(16)+"]")};n.dictionary=function(){n.position++;var e=new r;while(n.data[n.position]!==101){e.binarySet(n.bytes(),n.next())}n.position++;return e};n.list=function(){n.position++;var e=[];while(n.data[n.position]!==101){e.push(n.next())}n.position++;return e};n.integer=function(){var e=n.find(101);var t=n.data.toString("ascii",n.position+1,e);n.position+=e+1-n.position;return parseInt(t,10)};n.bytes=function(){var e=n.find(58);var t=parseInt(n.data.toString("ascii",n.position,e),10);var i=++e+t;n.position=i;return n.encoding?n.data.toString(n.encoding,e,i):n.data.slice(e,i)};t.exports=n}).call(this,e("buffer").Buffer)},{"./dict":17,buffer:36}],17:[function(e,t,i){var r=t.exports=function n(){Object.defineProperty(this,"_keys",{enumerable:false,value:[]})};r.prototype.binaryKeys=function a(){return this._keys.slice()};r.prototype.binarySet=function s(e,t){this._keys.push(e);this[e]=t}},{}],18:[function(e,t,i){(function(e){function i(t){var r=[];i._encode(r,t);return e.concat(r)}i._floatConversionDetected=false;i._encode=function(t,r){if(e.isBuffer(r)){t.push(new e(r.length+":"));t.push(r);return}switch(typeof r){case"string":i.bytes(t,r);break;case"number":i.number(t,r);break;case"object":r.constructor===Array?i.list(t,r):i.dict(t,r);break}};var r=new e("e"),n=new e("d"),a=new e("l");i.bytes=function(t,i){t.push(new e(e.byteLength(i)+":"+i))};i.number=function(t,r){var n=2147483648;var a=r/n<<0;var s=r%n<<0;var o=a*n+s;t.push(new e("i"+o+"e"));if(o!==r&&!i._floatConversionDetected){i._floatConversionDetected=true;console.warn('WARNING: Possible data corruption detected with value "'+r+'":','Bencoding only defines support for integers, value was converted to "'+o+'"');console.trace()}};i.dict=function(e,t){e.push(n);var a=0;var s;var o=Object.keys(t).sort();var f=o.length;for(;a<f;a++){s=o[a];i.bytes(e,s);i._encode(e,t[s])}e.push(r)};i.list=function(e,t){var n=0,s=1;var o=t.length;e.push(a);for(;n<o;n++){i._encode(e,t[n])}e.push(r)};t.exports=i}).call(this,e("buffer").Buffer)},{buffer:36}],19:[function(e,t,i){(function(e){var i=typeof e!=="undefined"?e:typeof Int8Array!=="undefined"?Int8Array:function(e){var t=new Array(e);for(var i=0;i<e;i++)t[i]=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)&&n(t.grow)||t.grow)||0;if(typeof e==="number"||e===undefined){e=new i(n(e));if(e.fill&&!e._isBuffer)e.fill(0)}this.buffer=e}function n(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 i=e>>3;if(t||arguments.length===1){if(this.buffer.length<i+1)this._grow(Math.max(i+1,Math.min(2*this.buffer.length,this.grow)));this.buffer[i]|=128>>e%8}else if(i<this.buffer.length){this.buffer[i]&=~(128>>e%8)}};r.prototype._grow=function(e){if(this.buffer.length<e&&e<=this.grow){var t=new i(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:36}],20:[function(e,t,i){(function(i){t.exports=b;var r=e("bitfield");var n=e("bencode");var a=e("debug")("bittorrent-protocol");var s=e("xtend");var o=e("inherits");var f=e("speedometer");var l=e("stream");var c=4e5;var u=new i("BitTorrent protocol");var p=new i([0,0,0,0]);var h=new i([0,0,0,1,0]);var d=new i([0,0,0,1,1]);var m=new i([0,0,0,1,2]);var v=new i([0,0,0,1,3]);var g=[0,0,0,0,0,0,0,0];var _=[0,0,0,3,9,0,0];function y(e,t,i,r){this.piece=e;this.offset=t;this.length=i;this.callback=r}o(b,l.Duplex);function b(){if(!(this instanceof b))return new b;l.Duplex.call(this);a("new wire");this.amChoking=true;this.amInterested=false;this.peerChoking=true;this.peerInterested=false;this.peerPieces=new r(0,{grow:c});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()}b.prototype.setKeepAlive=function(e){clearInterval(this._keepAlive);if(e===false)return;this._keepAlive=setInterval(this._push.bind(this,p),6e4)};b.prototype.setTimeout=function(e,t){this._clearTimeout();this._timeoutMs=e;this._timeoutUnref=!!t;this._updateTimeout()};b.prototype.destroy=function(){if(this.destroyed)return;this.destroyed=true;a("destroy");this.end()};b.prototype.end=function(){this._onUninterested();this._onChoke();l.Duplex.prototype.end.apply(this,arguments)};b.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 i=this._nextExt;var r=new e(this);function n(){}if(typeof r.onHandshake!=="function"){r.onHandshake=n}if(typeof r.onExtendedHandshake!=="function"){r.onExtendedHandshake=n}if(typeof r.onMessage!=="function"){r.onMessage=n}this.extendedMapping[i]=t;this._ext[t]=r;this[t]=r;this._nextExt+=1};b.prototype.handshake=function(e,t,r){if(typeof e==="string")e=new i(e,"hex");if(typeof t==="string")t=new i(t,"hex");if(e.length!==20||t.length!==20){throw new Error("infoHash and peerId MUST have length 20")}var n=new i(g);n[5]|=16;if(r&&r.dht)n[7]|=1;this._push(i.concat([u,n,e,t]));this._handshakeSent=true;if(this.peerExtensions.extended){this._sendExtendedHandshake()}};b.prototype._sendExtendedHandshake=function(){var e=s(this.extendedHandshake);e.m={};for(var t in this.extendedMapping){var i=this.extendedMapping[t];e.m[i]=Number(t)}this.extended(0,n.encode(e))};b.prototype.choke=function(){if(this.amChoking)return;this.amChoking=true;this.peerRequests.splice(0,this.peerRequests.length);this._push(h)};b.prototype.unchoke=function(){if(!this.amChoking)return;this.amChoking=false;this._push(d)};b.prototype.interested=function(){if(this.amInterested)return;this.amInterested=true;this._push(m)};b.prototype.uninterested=function(){if(!this.amInterested)return;this.amInterested=false;this._push(v)};b.prototype.have=function(e){this._message(4,[e],null)};b.prototype.bitfield=function(e){if(!i.isBuffer(e))e=e.buffer;this._message(5,[],e)};b.prototype.request=function(e,t,i,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 y(e,t,i,r));this._updateTimeout();this._message(6,[e,t,i],null)};b.prototype.piece=function(e,t,i){this.uploaded+=i.length;this.uploadSpeed(i.length);this.emit("upload",i.length);this._message(7,[e,t],i)};b.prototype.cancel=function(e,t,i){this._callback(w(this.requests,e,t,i),new Error("request was cancelled"),null);this._message(8,[e,t,i],null)};b.prototype.port=function(e){var t=new i(_);t.writeUInt16BE(e,5);this._push(t)};b.prototype.extended=function(e,t){if(typeof e==="string"&&this.peerExtendedMapping[e]){e=this.peerExtendedMapping[e]}if(typeof e==="number"){var r=new i([e]);var a=i.isBuffer(t)?t:n.encode(t);this._message(20,[],i.concat([r,a]))}else{throw new Error("Unrecognized extension: "+e)}};b.prototype._onKeepAlive=function(){this.emit("keep-alive")};b.prototype._onHandshake=function(e,t,i){this.peerId=t;this.peerExtensions=i;this.emit("handshake",e,t,i);var r;for(r in this._ext){this._ext[r].onHandshake(e,t,i)}if(i.extended&&this._handshakeSent){this._sendExtendedHandshake()}};b.prototype._onChoke=function(){this.peerChoking=true;this.emit("choke");while(this.requests.length){this._callback(this.requests.shift(),new Error("peer is choking"),null)}};b.prototype._onUnchoke=function(){this.peerChoking=false;this.emit("unchoke")};b.prototype._onInterested=function(){this.peerInterested=true;this.emit("interested")};b.prototype._onUninterested=function(){this.peerInterested=false;this.emit("uninterested")};b.prototype._onHave=function(e){if(this.peerPieces.get(e))return;this.peerPieces.set(e,true);this.emit("have",e)};b.prototype._onBitField=function(e){this.peerPieces=new r(e);this.emit("bitfield",this.peerPieces)};b.prototype._onRequest=function(e,t,i){if(this.amChoking)return;var r=function(r,a){if(n!==w(this.peerRequests,e,t,i))return;if(r)return;this.piece(e,t,a)}.bind(this);var n=new y(e,t,i,r);this.peerRequests.push(n);this.emit("request",e,t,i,r)};b.prototype._onPiece=function(e,t,i){this._callback(w(this.requests,e,t,i.length),null,i);this.downloaded+=i.length;this.downloadSpeed(i.length);this.emit("download",i.length);this.emit("piece",e,t,i)};b.prototype._onCancel=function(e,t,i){w(this.peerRequests,e,t,i);this.emit("cancel",e,t,i)};b.prototype._onPort=function(e){this.emit("port",e)};b.prototype._onExtended=function(e,t){var i,r;if(e===0&&(i=x(t))){this.peerExtendedHandshake=i;if(typeof i.m==="object"){for(r in i.m){this.peerExtendedMapping[r]=Number(i.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)}};b.prototype._onTimeout=function(){this._callback(this.requests.shift(),new Error("request has timed out"),null);this.emit("timeout")};b.prototype._push=function(e){if(this._finished)return;return this.push(e)};b.prototype._write=function(e,t,r){this._bufferSize+=e.length;this._buffer.push(e);while(this._bufferSize>=this._parserSize){var n=this._buffer.length===1?this._buffer[0]:i.concat(this._buffer);this._bufferSize-=this._parserSize;this._buffer=this._bufferSize?[n.slice(this._parserSize)]:[];this._parser(n.slice(0,this._parserSize))}r(null)};b.prototype._read=function(){};b.prototype._callback=function(e,t,i){if(!e)return;this._clearTimeout();if(!this.peerChoking&&!this._finished)this._updateTimeout();e.callback(t,i)};b.prototype._clearTimeout=function(){if(!this._timeout)return;clearTimeout(this._timeout);this._timeout=null};b.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()};b.prototype._parse=function(e,t){this._parserSize=e;this._parser=t};b.prototype._message=function(e,t,r){var n=r?r.length:0;var a=new i(5+4*t.length);a.writeUInt32BE(a.length+n-4,0);a[4]=e;for(var s=0;s<t.length;s++){a.writeUInt32BE(t[s],5+4*s)}this._push(a);if(r)this._push(r)};b.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)}};b.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)}};b.prototype._parseHandshake=function(){this._parse(1,function(e){var t=e.readUInt8(0);this._parse(t+48,function(e){var i=e.slice(0,t);if(i.toString()!=="BitTorrent protocol"){a("Error: wire not speaking BitTorrent protocol (%s)",i.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))};b.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 w(e,t,i,r){for(var n=0;n<e.length;n++){var a=e[n];if(a.piece!==t||a.offset!==i||a.length!==r)continue;if(n===0)e.shift();else e.splice(n,1);return a}return null}function x(e){try{return n.decode(e)}catch(t){console.warn(t)}}}).call(this,e("buffer").Buffer)},{bencode:15,bitfield:19,buffer:36,debug:40,inherits:55,speedometer:110,stream:111,xtend:124}],21:[function(e,t,i){(function(i,r){t.exports=m;var n=e("addr-to-ip-port");var a=e("debug")("bittorrent-swarm");var s=e("dezalgo");var o=e("events").EventEmitter;var f=e("inherits");var l=e("net");var c=e("./lib/peer");var u=e("speedometer");var p=e("./lib/tcp-pool");var h=55;var d=[1e3,5e3,15e3];f(m,o);function m(e,t,i){var n=this;if(!(n instanceof m))return new m(e,t,i);o.call(n);n.infoHash=typeof e==="string"?new r(e,"hex"):e;n.infoHashHex=n.infoHash.toString("hex");n.peerId=typeof t==="string"?new r(t,"hex"):t;n.peerIdHex=n.peerId.toString("hex");if(!i)i={};a("new swarm (i %s p %s)",n.infoHashHex,n.peerIdHex);n.handshakeOpts=i.handshake;n.maxConns=i.maxConns!==undefined?i.maxConns:h;n.destroyed=false;n.listening=false;n.paused=false;n.server=null;n.wires=[];n._queue=[];n._peers={};n._peersLength=0;n._port=0;n.downloaded=0;n.uploaded=0;n.downloadSpeed=u();n.uploadSpeed=u()}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 i in e._peers){var r=e._peers[i];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 i=e&&e.id||e;if(t._peers[i])return;a("addPeer %s",i);var r;if(typeof e==="string"){r=c.createOutgoingTCPPeer(e,t);t._queue.push(r);t._drain()}else{r=c.createWebRTCPeer(e,t)}t._peers[r.id]=r;t._peersLength+=1};m.prototype.addWebSeed=function(e,t){var i=this;if(i.destroyed)return;if(!/^https?:\/\/.+/.test(e)){a("ignoring invalid web seed %s (from swarm.addWebSeed)",e);return}if(i._peers[e])return;a("addWebSeed %s",e);i._peers[e]=c.createWebPeer(e,t,i);i._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 i=t._peers[e];if(!i)return;a("removePeer %s",e);t._peers[e]=null;t._peersLength-=1;i.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 n=this;if(typeof t==="function"){r=t;t=undefined}if(r)r=s(r);if(n.listening)throw new Error("swarm already listening");if(i.browser){r()}else{n._port=e||p.getDefaultListenPort(n.infoHashHex);n._hostname=t;if(r)n.once("listening",r);a("listen %s",e);var o=p.addSwarm(n);n.server=o.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 i in t._peers){t.removePeer(i)}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 l.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 i=n(t.addr);var r=i[0];var s=i[1];var o=t.conn=l.connect({host:r,port:s,localAddress:e._hostname});o.once("connect",function(){t.onConnect()});o.once("error",function(e){t.destroy(e)});t.setConnectTimeout();o.on("close",function(){if(e.destroyed)return;if(t.retries>=d.length){a("conn %s closed: will not re-add (max %s attempts)",t.addr,d.length);return}function i(){var i=c.createOutgoingTCPPeer(t.addr,e);i.retries=t.retries+1;e._queue.push(i);e._drain()}var r=d[t.retries];a("conn %s closed: will re-add to queue in %sms (attempt %s)",t.addr,r,t.retries+1);var n=setTimeout(i,r);if(n.unref)n.unref()})};m.prototype._onError=function(e){var t=this;t.emit("error",e);t.destroy()};m.prototype._validAddr=function(e){var t=this;var i=n(e);var r=i[0];var a=i[1];return a>0&&a<65535&&!(r==="127.0.0.1"&&a===t._port)}}).call(this,e("_process"),e("buffer").Buffer)},{"./lib/peer":22,"./lib/tcp-pool":23,_process:34,"addr-to-ip-port":30,buffer:36,debug:40,dezalgo:43,events:45,inherits:55,net:30,speedometer:110}],22:[function(e,t,i){var r=e("debug")("bittorrent-swarm:peer");var n=e("./webconn");var a=e("bittorrent-protocol");var s=25e3;var o=25e3;i.createWebRTCPeer=function(e,t){var i=new f(e.id);i.conn=e;i.swarm=t;if(i.conn.connected){i.onConnect()}else{i.conn.once("connect",function(){i.onConnect()});i.conn.once("error",function(e){i.destroy(e)});i.setConnectTimeout()}return i};i.createIncomingTCPPeer=function(e){var t=e.remoteAddress+":"+e.remotePort;var i=new f(t);i.conn=e;i.addr=t;i.onConnect();return i};i.createOutgoingTCPPeer=function(e,t){var i=new f(e);i.addr=e;i.swarm=t;return i};i.createWebPeer=function(e,t,i){var r=new f(e);r.swarm=i;r.conn=new n(e,t);r.onConnect();return r};function f(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}f.prototype.onConnect=function(){var e=this;if(e.destroyed)return;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 i=e.wire=new a;i.once("end",function(){e.destroy()});i.once("finish",function(){e.destroy()});i.once("error",function(t){e.destroy(t)});i.once("handshake",function(t,i){e.onHandshake(t,i)});e.setHandshakeTimeout();t.pipe(i).pipe(t);if(e.swarm)e.handshake()};f.prototype.onHandshake=function(e,t){var i=this;if(!i.swarm)return;var n=e.toString("hex");var a=t.toString("hex");if(i.swarm.destroyed)return i.destroy(new Error("swarm already destroyed"));if(n!==i.swarm.infoHashHex){return i.destroy(new Error("unexpected handshake info hash for this swarm"))}if(a===i.swarm.peerIdHex){return i.destroy(new Error("refusing to handshake with self"))}r("Peer %s got handshake %s",i.id,n);clearTimeout(i.handshakeTimeout);i.retries=0;i.wire.on("download",function(e){if(i.destroyed)return;i.swarm.downloaded+=e;i.swarm.downloadSpeed(e);i.swarm.emit("download",e)});i.wire.on("upload",function(e){if(i.destroyed)return;i.swarm.uploaded+=e;i.swarm.uploadSpeed(e);i.swarm.emit("upload",e)});if(!i.sentHandshake)i.handshake();i.swarm.wires.push(i.wire);var s=i.addr;if(!s&&i.conn.remoteAddress){s=i.conn.remoteAddress+":"+i.conn.remotePort}i.swarm.emit("wire",i.wire,s)};f.prototype.handshake=function(){var e=this;e.wire.handshake(e.swarm.infoHash,e.swarm.peerId,e.swarm.handshakeOpts);e.sentHandshake=true};f.prototype.setConnectTimeout=function(){var e=this;clearTimeout(e.connectTimeout);e.connectTimeout=setTimeout(function(){e.destroy(new Error("connect timeout"))},s);if(e.connectTimeout.unref)e.connectTimeout.unref()};f.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()};f.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));if(t.swarm)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}},{"./webconn":24,"bittorrent-protocol":20,debug:40}],23:[function(e,t,i){(function(i){t.exports=f;var r=e("debug")("bittorrent-swarm:tcp-pool");var n=e("dezalgo");var a=e("net");var s=e("./peer");var o={};function f(e,t){var i=this;i.port=e;i.listening=false;i.swarms={};r("new TCPPool (port: %s, hostname: %s)",e,t);i.pendingConns=[];i.server=a.createServer();i.server.on("connection",function(e){i._onConnection(e)});i.server.on("error",function(e){i._onError(e)});i.server.on("listening",function(){
+i._onListening()});i.server.listen(i.port,t)}f.addSwarm=function(e){var t=o[e._port];if(!t)t=o[e._port]=new f(e._port,e._hostname);t.addSwarm(e);return t};f.removeSwarm=function(e,t){var r=o[e._port];if(!r)return t();r.removeSwarm(e);var n=0;for(var a in r.swarms){var s=r.swarms[a];if(s)n+=1}if(n===0)r.destroy(t);else i.nextTick(t)};f.getDefaultListenPort=function(e){for(var t in o){var i=o[t];if(i&&!i.swarms[e])return i.port}return 0};f.prototype.addSwarm=function(e){var t=this;if(t.swarms[e.infoHashHex]){i.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){i.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=n(e);r("destroy tcp pool %s",t.port);t.listening=false;t.pendingConns.forEach(function(e){e.destroy()});o[t.port]=null;try{t.server.close(e)}catch(i){if(e)e(null)}};f.prototype._onListening=function(){var e=this;var t=e.server.address()||{port:0};var i=t.port;r("tcp pool listening on %s",i);if(i!==e.port){o[e.port]=null;e.port=i;o[e.port]=e}e.listening=true;for(var n in e.swarms){var a=e.swarms[n];if(a)a._onListening(e.port)}};f.prototype._onConnection=function(e){var t=this;t.pendingConns.push(e);e.once("close",i);function i(){t.pendingConns.splice(t.pendingConns.indexOf(e))}var r=s.createIncomingTCPPeer(e);r.wire.once("handshake",function(n,a){var s=n.toString("hex");i();e.removeListener("close",i);var o=t.swarms[s];if(o){r.swarm=o;o._addIncomingPeer(r);r.onHandshake(n,a)}else{var f=new Error("Unexpected info hash "+s+" from incoming peer "+r.id+": destroying peer");r.destroy(f)}})};f.prototype._onError=function(e){var t=this;t.destroy();for(var i in t.swarms){var r=t.swarms[i];if(r){t.removeSwarm(r);r._onError(e)}}}}).call(this,e("_process"))},{"./peer":22,_process:34,debug:40,dezalgo:43,net:30}],24:[function(e,t,i){(function(i){t.exports=f;var r=e("bitfield");var n=e("debug")("bittorrent-swarm:webconn");var a=e("simple-get");var s=e("inherits");var o=e("bittorrent-protocol");s(f,o);function f(e,t){var a=this;o.call(this);a.url=e;a.parsedTorrent=t;a.setKeepAlive(true);a.on("handshake",function(t,n){a.handshake(t,new i(20).fill(e));var s=a.parsedTorrent.pieces.length;var o=new r(s);for(var f=0;f<=s;f++){o.set(f,true)}a.bitfield(o)});a.on("choke",function(){n("choke")});a.on("unchoke",function(){n("unchoke")});a.once("interested",function(){n("interested");a.unchoke()});a.on("uninterested",function(){n("uninterested")});a.on("bitfield",function(){n("bitfield")});a.on("request",function(e,t,i,r){n("request pieceIndex=%d offset=%d length=%d",e,t,i);a.httpRequest(e,t,i,r)})}f.prototype.httpRequest=function(e,t,i,r){var s=this;var o=e*s.parsedTorrent.pieceLength;var f=o+t;var l=f+i-1;n("Requesting pieceIndex=%d offset=%d length=%d start=%d end=%d",e,t,i,f,l);var c={url:s.url,method:"GET",headers:{"user-agent":"WebTorrent (http://webtorrent.io)",range:"bytes="+f+"-"+l}};a.concat(c,function(e,t,i){if(e)return r(e);if(i.statusCode<200||i.statusCode>=300){return r(new Error("Unexpected HTTP status code "+i.statusCode))}n("Got data of length %d",t.length);r(null,t)})}}).call(this,e("buffer").Buffer)},{bitfield:19,"bittorrent-protocol":20,buffer:36,debug:40,inherits:55,"simple-get":106}],25:[function(e,t,i){(function(i,r){t.exports=h;var n=e("debug")("bittorrent-tracker");var a=e("events").EventEmitter;var s=e("inherits");var o=e("once");var f=e("url");var l=e("./lib/common");var c=e("./lib/http-tracker");var u=e("./lib/udp-tracker");var p=e("./lib/websocket-tracker");s(h,a);function h(e,t,s,o){var d=this;if(!(d instanceof h))return new h(e,t,s,o);a.call(d);if(!o)o={};d._peerId=r.isBuffer(e)?e:new r(e,"hex");d._peerIdHex=d._peerId.toString("hex");d._peerIdBinary=d._peerId.toString("binary");d._infoHash=r.isBuffer(s.infoHash)?s.infoHash:new r(s.infoHash,"hex");d._infoHashHex=d._infoHash.toString("hex");d._infoHashBinary=d._infoHash.toString("binary");d._port=t;d.torrentLength=s.length;d._rtcConfig=o.rtcConfig;d._wrtc=o.wrtc;d._numWant=o.numWant||l.DEFAULT_ANNOUNCE_PEERS;d._intervalMs=o.interval||l.DEFAULT_ANNOUNCE_INTERVAL;n("new client %s",d._infoHashHex);var m={interval:d._intervalMs};var v=!!d._wrtc||typeof window!=="undefined";var g=typeof s.announce==="string"?[s.announce]:s.announce==null?[]:s.announce;d._trackers=g.map(function(e){e=e.toString();var t=f.parse(e).protocol;if((t==="http:"||t==="https:")&&typeof c==="function"){return new c(d,e,m)}else if(t==="udp:"&&typeof u==="function"){return new u(d,e,m)}else if((t==="ws:"||t==="wss:")&&v){return new p(d,e,m)}else{i.nextTick(function(){var t=new Error("unsupported tracker protocol for "+e);d.emit("warning",t)})}return null}).filter(Boolean)}h.scrape=function(e,t,i){i=o(i);var n=new r("01234567890123456789");var a=6881;var s={infoHash:Array.isArray(t)?t[0]:t,announce:[e]};var f=new h(n,a,s);f.once("error",i);var l=Array.isArray(t)?t.length:1;var c={};f.on("scrape",function(e){l-=1;c[e.infoHash]=e;if(l===0){f.destroy();var t=Object.keys(c);if(t.length===1){i(null,c[t[0]])}else{i(null,c)}}});t=Array.isArray(t)?t.map(function(e){return new r(e,"hex")}):new r(t,"hex");f.scrape({infoHash:t})};h.prototype.start=function(e){var t=this;n("send `start`");e=t._defaultAnnounceOpts(e);e.event="started";t._announce(e);t._trackers.forEach(function(e){e.setInterval(t._intervalMs)})};h.prototype.stop=function(e){var t=this;n("send `stop`");e=t._defaultAnnounceOpts(e);e.event="stopped";t._announce(e)};h.prototype.complete=function(e){var t=this;n("send `complete`");if(!e)e={};if(e.downloaded==null&&t.torrentLength!=null){e.downloaded=t.torrentLength}e=t._defaultAnnounceOpts(e);e.event="completed";t._announce(e)};h.prototype.update=function(e){var t=this;n("send `update`");e=t._defaultAnnounceOpts(e);if(e.event)delete e.event;t._announce(e)};h.prototype._announce=function(e){var t=this;t._trackers.forEach(function(t){t.announce(e)})};h.prototype.scrape=function(e){var t=this;n("send `scrape`");if(!e)e={};t._trackers.forEach(function(t){t.scrape(e)})};h.prototype.setInterval=function(e){var t=this;n("setInterval");t._intervalMs=e;t._trackers.forEach(function(t){t.setInterval(e)})};h.prototype.destroy=function(e){var t=this;n("destroy");t._trackers.forEach(function(e){e.destroy();e.setInterval(0)});t._trackers=[];if(e)i.nextTick(function(){e(null)})};h.prototype._defaultAnnounceOpts=function(e){var t=this;if(!e)e={};if(e.numWant==null)e.numWant=t._numWant;if(e.uploaded==null)e.uploaded=0;if(e.downloaded==null)e.downloaded=0;if(e.left==null&&t.torrentLength!=null){e.left=t.torrentLength-e.downloaded}return e}}).call(this,e("_process"),e("buffer").Buffer)},{"./lib/common":27,"./lib/http-tracker":30,"./lib/udp-tracker":30,"./lib/websocket-tracker":28,_process:34,buffer:36,debug:40,events:45,inherits:55,once:72,url:118}],26:[function(e,t,i){(function(t){var r=e("querystring");i.IPV4_RE=/^[\d\.]+$/;i.IPV6_RE=/^[\da-fA-F:]+$/;i.CONNECTION_ID=t.concat([n(1047),n(655366528)]);i.ACTIONS={CONNECT:0,ANNOUNCE:1,SCRAPE:2,ERROR:3};i.EVENTS={update:0,completed:1,started:2,stopped:3};i.EVENT_IDS={0:"update",1:"completed",2:"started",3:"stopped"};i.EVENT_NAMES={update:"update",completed:"complete",started:"start",stopped:"stop"};function n(e){var i=new t(4);i.writeUInt32BE(e,0);return i}i.toUInt32=n;i.querystringParse=function(e){var t=r.unescape;r.unescape=unescape;var i=r.parse(e);r.unescape=t;return i};i.querystringStringify=function(e){var t=r.escape;r.escape=escape;var i=r.stringify(e);i=i.replace(/[\@\*\/\+]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()});r.escape=t;return i}}).call(this,e("buffer").Buffer)},{buffer:36,querystring:91}],27:[function(e,t,i){(function(t){var r=e("xtend/mutable");i.DEFAULT_ANNOUNCE_INTERVAL=30*60*1e3;i.DEFAULT_ANNOUNCE_PEERS=50;i.MAX_ANNOUNCE_PEERS=82;i.binaryToHex=function(e){return new t(e,"binary").toString("hex")};i.hexToBinary=function(e){return new t(e,"hex").toString("binary")};var n=e("./common-node");r(i,n)}).call(this,e("buffer").Buffer)},{"./common-node":26,buffer:36,"xtend/mutable":125}],28:[function(e,t,i){t.exports=h;var r=e("debug")("bittorrent-tracker:websocket-tracker");var n=e("events").EventEmitter;var a=e("hat");var s=e("inherits");var o=e("simple-peer");var f=e("simple-websocket");var l=e("./common");var c={};var u=30*1e3;var p=5*1e3;s(h,n);function h(e,t,i){var a=this;n.call(a);r("new websocket tracker %s",t);a.client=e;a.destroyed=false;a._opts=i;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()}h.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(i){e.offers=i;if(t._trackerId){e.trackerid=t._trackerId}t._send(e)})};h.prototype.scrape=function(e){var t=this;if(t.destroyed)return;t._onSocketError(new Error("scrape not supported "+t._announceUrl))};h.prototype.setInterval=function(e){var t=this;clearInterval(t._interval);t._intervalMs=e;if(e){var i=t.announce.bind(t,t.client._defaultAnnounceOpts());t._interval=setInterval(i,t._intervalMs)}};h.prototype.destroy=function(){var e=this;if(e.destroyed)return;e.destroyed=true;e._socket.removeListener("data",e._onSocketDataBound);e._socket.removeListener("close",e._onSocketCloseBound);e._socket.removeListener("error",e._onSocketErrorBound);e._onSocketErrorBound=null;e._onSocketDataBound=null;e._onSocketCloseBound=null;e._socket.on("error",d);try{e._socket.close()}catch(t){}e._socket=null};h.prototype._openSocket=function(){var e=this;e._onSocketErrorBound=e._onSocketError.bind(e);e._onSocketDataBound=e._onSocketData.bind(e);e._onSocketCloseBound=e._onSocketClose.bind(e);e._socket=c[e._announceUrl];if(!e._socket){e._socket=c[e._announceUrl]=new f(e._announceUrl)}e._socket.on("data",e._onSocketDataBound);e._socket.on("close",e._onSocketCloseBound);e._socket.on("error",e._onSocketErrorBound)};h.prototype._onSocketData=function(e){var t=this;if(t.destroyed)return;if(!(typeof e==="object"&&e!==null)){return t.client.emit("warning",new Error("Invalid tracker response"))}if(e.info_hash!==t.client._infoHashBinary){r("ignoring websocket data from %s for %s (looking for %s: reused socket)",t._announceUrl,l.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 i=e["failure reason"];if(i)return t.client.emit("warning",new Error(i));var n=e["warning message"];if(n)t.client.emit("warning",new Error(n));var a=e.interval||e["min interval"];if(a&&!t._opts.interval&&t._intervalMs!==0){t.setInterval(a*1e3)}var s=e["tracker id"];if(s){t._trackerId=s}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 o({trickle:false,config:t.client._rtcConfig,wrtc:t.client._wrtc});f.id=l.binaryToHex(e.peer_id);f.once("signal",function(i){var r={info_hash:t.client._infoHashBinary,peer_id:t.client._peerIdBinary,to_peer_id:e.peer_id,answer:i,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[l.binaryToHex(e.offer_id)];if(f){f.id=l.binaryToHex(e.peer_id);f.signal(e.answer);t.client.emit("peer",f)}else{r("got unexpected answer: "+JSON.stringify(e.answer))}}};h.prototype._onSocketClose=function(){var e=this;if(e.destroyed)return;e.destroy();e._startReconnectTimer()};h.prototype._onSocketError=function(e){var t=this;if(t.destroyed)return;t.destroy();t.client.emit("warning",e);t._startReconnectTimer()};h.prototype._startReconnectTimer=function(){var e=this;var t=Math.floor(Math.random()*u)+p;setTimeout(function(){e.destroyed=false;e._openSocket()},t);r("reconnecting socket in %s ms",t)};h.prototype._send=function(e){var t=this;if(t.destroyed)return;var i=JSON.stringify(e);r("send %s",i);t._socket.send(i)};h.prototype._generateOffers=function(e,t){var i=this;var n=[];r("generating %s offers",e);for(var s=0;s<e;++s){f()}function f(){var e=a(160);var t=i._peers[e]=new o({initiator:true,trickle:false,config:i.client._rtcConfig,wrtc:i.client._wrtc});t.once("signal",function(t){n.push({offer:t,offer_id:l.hexToBinary(e)});c()})}function c(){if(n.length===e){r("generated %s offers",e);t(n)}}};function d(){}},{"./common":27,debug:40,events:45,hat:49,inherits:55,"simple-peer":107,"simple-websocket":109}],29:[function(e,t,i){(function(i){var r=e("inherits");var n=e("readable-stream").Transform;var a=e("defined");t.exports=s;r(s,n);function s(e,t){if(!(this instanceof s))return new s(e,t);n.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}s.prototype._transform=function(e,t,r){this._bufferedBytes+=e.length;this._buffered.push(e);while(this._bufferedBytes>=this.size){var n=i.concat(this._buffered);this._bufferedBytes-=this.size;this.push(n.slice(0,this.size));this._buffered=[n.slice(this.size,n.length)]}r()};s.prototype._flush=function(){if(this._bufferedBytes&&this._zeroPadding){var e=new i(this.size-this._bufferedBytes);e.fill(0);this._buffered.push(e);this.push(i.concat(this._buffered));this._buffered=null}else if(this._bufferedBytes){this.push(i.concat(this._buffered));this._buffered=null}this.push(null)}}).call(this,e("buffer").Buffer)},{buffer:36,defined:42,inherits:55,"readable-stream":101}],30:[function(e,t,i){},{}],31:[function(e,t,i){(function(t,r){var n=e("pako/lib/zlib/messages");var a=e("pako/lib/zlib/zstream");var s=e("pako/lib/zlib/deflate.js");var o=e("pako/lib/zlib/inflate.js");var f=e("pako/lib/zlib/constants");for(var l in f){i[l]=f[l]}i.NONE=0;i.DEFLATE=1;i.INFLATE=2;i.GZIP=3;i.GUNZIP=4;i.DEFLATERAW=5;i.INFLATERAW=6;i.UNZIP=7;function c(e){if(e<i.DEFLATE||e>i.UNZIP)throw new TypeError("Bad argument");this.mode=e;this.init_done=false;this.write_in_progress=false;this.pending_close=false;this.windowBits=0;this.level=0;this.memLevel=0;this.strategy=0;this.dictionary=null}c.prototype.init=function(e,t,r,n,f){this.windowBits=e;this.level=t;this.memLevel=r;this.strategy=n;if(this.mode===i.GZIP||this.mode===i.GUNZIP)this.windowBits+=16;if(this.mode===i.UNZIP)this.windowBits+=32;if(this.mode===i.DEFLATERAW||this.mode===i.INFLATERAW)this.windowBits=-this.windowBits;this.strm=new a;switch(this.mode){case i.DEFLATE:case i.GZIP:case i.DEFLATERAW:var l=s.deflateInit2(this.strm,this.level,i.Z_DEFLATED,this.windowBits,this.memLevel,this.strategy);break;case i.INFLATE:case i.GUNZIP:case i.INFLATERAW:case i.UNZIP:var l=o.inflateInit2(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}if(l!==i.Z_OK){this._error(l);return}this.write_in_progress=false;this.init_done=true};c.prototype.params=function(){throw new Error("deflateParams Not supported")};c.prototype._writeCheck=function(){if(!this.init_done)throw new Error("write before init");if(this.mode===i.NONE)throw new Error("already finalized");if(this.write_in_progress)throw new Error("write already in progress");if(this.pending_close)throw new Error("close is pending")};c.prototype.write=function(e,i,r,n,a,s,o){this._writeCheck();this.write_in_progress=true;var f=this;t.nextTick(function(){f.write_in_progress=false;var t=f._write(e,i,r,n,a,s,o);f.callback(t[0],t[1]);if(f.pending_close)f.close()});return this};function u(e,t){for(var i=0;i<e.length;i++){this[t+i]=e[i]}}c.prototype.writeSync=function(e,t,i,r,n,a,s){this._writeCheck();return this._write(e,t,i,r,n,a,s)};c.prototype._write=function(e,t,n,a,f,l,c){this.write_in_progress=true;if(e!==i.Z_NO_FLUSH&&e!==i.Z_PARTIAL_FLUSH&&e!==i.Z_SYNC_FLUSH&&e!==i.Z_FULL_FLUSH&&e!==i.Z_FINISH&&e!==i.Z_BLOCK){throw new Error("Invalid flush value")}if(t==null){t=new r(0);a=0;n=0}if(f._set)f.set=f._set;else f.set=u;var p=this.strm;p.avail_in=a;p.input=t;p.next_in=n;p.avail_out=c;p.output=f;p.next_out=l;switch(this.mode){case i.DEFLATE:case i.GZIP:case i.DEFLATERAW:var h=s.deflate(p,e);break;case i.UNZIP:case i.INFLATE:case i.GUNZIP:case i.INFLATERAW:var h=o.inflate(p,e);break;default:throw new Error("Unknown mode "+this.mode)}if(h!==i.Z_STREAM_END&&h!==i.Z_OK){this._error(h)}this.write_in_progress=false;return[p.avail_in,p.avail_out]};c.prototype.close=function(){if(this.write_in_progress){this.pending_close=true;return}this.pending_close=false;if(this.mode===i.DEFLATE||this.mode===i.GZIP||this.mode===i.DEFLATERAW){s.deflateEnd(this.strm)}else{o.inflateEnd(this.strm)}this.mode=i.NONE};c.prototype.reset=function(){switch(this.mode){case i.DEFLATE:case i.DEFLATERAW:var e=s.deflateReset(this.strm);break;case i.INFLATE:case i.INFLATERAW:var e=o.inflateReset(this.strm);break}if(e!==i.Z_OK){this._error(e)}};c.prototype._error=function(e){this.onerror(n[e]+": "+this.strm.msg,e);this.write_in_progress=false;if(this.pending_close)this.close()};i.Zlib=c}).call(this,e("_process"),e("buffer").Buffer)},{_process:34,buffer:36,"pako/lib/zlib/constants":75,"pako/lib/zlib/deflate.js":77,"pako/lib/zlib/inflate.js":79,"pako/lib/zlib/messages":81,"pako/lib/zlib/zstream":83}],32:[function(e,t,i){(function(t,r){var n=e("_stream_transform");var a=e("./binding");var s=e("util");var o=e("assert").ok;a.Z_MIN_WINDOWBITS=8;a.Z_MAX_WINDOWBITS=15;a.Z_DEFAULT_WINDOWBITS=15;a.Z_MIN_CHUNK=64;a.Z_MAX_CHUNK=Infinity;a.Z_DEFAULT_CHUNK=16*1024;a.Z_MIN_MEMLEVEL=1;a.Z_MAX_MEMLEVEL=9;a.Z_DEFAULT_MEMLEVEL=8;a.Z_MIN_LEVEL=-1;a.Z_MAX_LEVEL=9;a.Z_DEFAULT_LEVEL=a.Z_DEFAULT_COMPRESSION;Object.keys(a).forEach(function(e){if(e.match(/^Z/))i[e]=a[e]});i.codes={Z_OK:a.Z_OK,Z_STREAM_END:a.Z_STREAM_END,Z_NEED_DICT:a.Z_NEED_DICT,Z_ERRNO:a.Z_ERRNO,Z_STREAM_ERROR:a.Z_STREAM_ERROR,Z_DATA_ERROR:a.Z_DATA_ERROR,Z_MEM_ERROR:a.Z_MEM_ERROR,Z_BUF_ERROR:a.Z_BUF_ERROR,Z_VERSION_ERROR:a.Z_VERSION_ERROR};Object.keys(i.codes).forEach(function(e){i.codes[i.codes[e]]=e});i.Deflate=c;i.Inflate=u;i.Gzip=p;i.Gunzip=h;i.DeflateRaw=d;i.InflateRaw=m;i.Unzip=v;i.createDeflate=function(e){return new c(e)};i.createInflate=function(e){return new u(e)};i.createDeflateRaw=function(e){return new d(e)};i.createInflateRaw=function(e){return new m(e)};i.createGzip=function(e){return new p(e)};i.createGunzip=function(e){return new h(e)};i.createUnzip=function(e){return new v(e)};i.deflate=function(e,t,i){if(typeof t==="function"){i=t;t={}}return f(new c(t),e,i)};i.deflateSync=function(e,t){return l(new c(t),e)};i.gzip=function(e,t,i){if(typeof t==="function"){i=t;t={}}return f(new p(t),e,i)};i.gzipSync=function(e,t){return l(new p(t),e)};i.deflateRaw=function(e,t,i){if(typeof t==="function"){i=t;t={}}return f(new d(t),e,i)};i.deflateRawSync=function(e,t){return l(new d(t),e)};i.unzip=function(e,t,i){if(typeof t==="function"){i=t;t={}}return f(new v(t),e,i)};i.unzipSync=function(e,t){return l(new v(t),e)};i.inflate=function(e,t,i){if(typeof t==="function"){i=t;t={}}return f(new u(t),e,i)};i.inflateSync=function(e,t){return l(new u(t),e)};i.gunzip=function(e,t,i){if(typeof t==="function"){i=t;t={}}return f(new h(t),e,i)};i.gunzipSync=function(e,t){return l(new h(t),e)};i.inflateRaw=function(e,t,i){if(typeof t==="function"){i=t;t={}}return f(new m(t),e,i)};i.inflateRawSync=function(e,t){return l(new m(t),e)};function f(e,t,i){var n=[];var a=0;e.on("error",o);e.on("end",f);e.end(t);s();function s(){var t;while(null!==(t=e.read())){n.push(t);a+=t.length}e.once("readable",s)}function o(t){e.removeListener("end",f);e.removeListener("readable",s);i(t)}function f(){var t=r.concat(n,a);n=[];i(null,t);e.close()}}function l(e,t){if(typeof t==="string")t=new r(t);if(!r.isBuffer(t))throw new TypeError("Not a string or buffer");var i=a.Z_FINISH;return e._processChunk(t,i)}function c(e){if(!(this instanceof c))return new c(e);g.call(this,e,a.DEFLATE)}function u(e){if(!(this instanceof u))return new u(e);g.call(this,e,a.INFLATE)}function p(e){if(!(this instanceof p))return new p(e);g.call(this,e,a.GZIP)}function h(e){if(!(this instanceof h))return new h(e);g.call(this,e,a.GUNZIP)}function d(e){if(!(this instanceof d))return new d(e);g.call(this,e,a.DEFLATERAW)}function m(e){if(!(this instanceof m))return new m(e);g.call(this,e,a.INFLATERAW)}function v(e){if(!(this instanceof v))return new v(e);g.call(this,e,a.UNZIP)}function g(e,t){this._opts=e=e||{};this._chunkSize=e.chunkSize||i.Z_DEFAULT_CHUNK;n.call(this,e);if(e.flush){if(e.flush!==a.Z_NO_FLUSH&&e.flush!==a.Z_PARTIAL_FLUSH&&e.flush!==a.Z_SYNC_FLUSH&&e.flush!==a.Z_FULL_FLUSH&&e.flush!==a.Z_FINISH&&e.flush!==a.Z_BLOCK){throw new Error("Invalid flush flag: "+e.flush)}}this._flushFlag=e.flush||a.Z_NO_FLUSH;if(e.chunkSize){if(e.chunkSize<i.Z_MIN_CHUNK||e.chunkSize>i.Z_MAX_CHUNK){throw new Error("Invalid chunk size: "+e.chunkSize)}}if(e.windowBits){if(e.windowBits<i.Z_MIN_WINDOWBITS||e.windowBits>i.Z_MAX_WINDOWBITS){throw new Error("Invalid windowBits: "+e.windowBits)}}if(e.level){if(e.level<i.Z_MIN_LEVEL||e.level>i.Z_MAX_LEVEL){throw new Error("Invalid compression level: "+e.level)}}if(e.memLevel){if(e.memLevel<i.Z_MIN_MEMLEVEL||e.memLevel>i.Z_MAX_MEMLEVEL){throw new Error("Invalid memLevel: "+e.memLevel)}}if(e.strategy){if(e.strategy!=i.Z_FILTERED&&e.strategy!=i.Z_HUFFMAN_ONLY&&e.strategy!=i.Z_RLE&&e.strategy!=i.Z_FIXED&&e.strategy!=i.Z_DEFAULT_STRATEGY){throw new Error("Invalid strategy: "+e.strategy)}}if(e.dictionary){if(!r.isBuffer(e.dictionary)){throw new Error("Invalid dictionary: it should be a Buffer instance")}}this._binding=new a.Zlib(t);var s=this;this._hadError=false;this._binding.onerror=function(e,t){s._binding=null;s._hadError=true;var r=new Error(e);r.errno=t;r.code=i.codes[t];s.emit("error",r)};var o=i.Z_DEFAULT_COMPRESSION;if(typeof e.level==="number")o=e.level;var f=i.Z_DEFAULT_STRATEGY;if(typeof e.strategy==="number")f=e.strategy;this._binding.init(e.windowBits||i.Z_DEFAULT_WINDOWBITS,o,e.memLevel||i.Z_DEFAULT_MEMLEVEL,f,e.dictionary);this._buffer=new r(this._chunkSize);this._offset=0;this._closed=false;this._level=o;this._strategy=f;this.once("end",this.close)}s.inherits(g,n);g.prototype.params=function(e,r,n){if(e<i.Z_MIN_LEVEL||e>i.Z_MAX_LEVEL){throw new RangeError("Invalid compression level: "+e)}if(r!=i.Z_FILTERED&&r!=i.Z_HUFFMAN_ONLY&&r!=i.Z_RLE&&r!=i.Z_FIXED&&r!=i.Z_DEFAULT_STRATEGY){throw new TypeError("Invalid strategy: "+r)}if(this._level!==e||this._strategy!==r){var s=this;this.flush(a.Z_SYNC_FLUSH,function(){s._binding.params(e,r);if(!s._hadError){s._level=e;s._strategy=r;if(n)n()}})}else{t.nextTick(n)}};g.prototype.reset=function(){return this._binding.reset()};g.prototype._flush=function(e){this._transform(new r(0),"",e)};g.prototype.flush=function(e,i){var n=this._writableState;if(typeof e==="function"||e===void 0&&!i){i=e;e=a.Z_FULL_FLUSH}if(n.ended){if(i)t.nextTick(i)}else if(n.ending){if(i)this.once("end",i)}else if(n.needDrain){var s=this;this.once("drain",function(){s.flush(i)})}else{this._flushFlag=e;this.write(new r(0),"",i)}};g.prototype.close=function(e){if(e)t.nextTick(e);if(this._closed)return;this._closed=true;this._binding.close();var i=this;t.nextTick(function(){i.emit("close")})};g.prototype._transform=function(e,t,i){var n;var s=this._writableState;var o=s.ending||s.ended;var f=o&&(!e||s.length===e.length);if(!e===null&&!r.isBuffer(e))return i(new Error("invalid input"));if(f)n=a.Z_FINISH;else{n=this._flushFlag;if(e.length>=s.length){this._flushFlag=this._opts.flush||a.Z_NO_FLUSH}}var l=this;this._processChunk(e,n,i)};g.prototype._processChunk=function(e,t,i){var n=e&&e.length;var a=this._chunkSize-this._offset;var s=0;var f=this;var l=typeof i==="function";if(!l){var c=[];var u=0;var p;this.on("error",function(e){p=e});do{var h=this._binding.writeSync(t,e,s,n,this._buffer,this._offset,a)}while(!this._hadError&&v(h[0],h[1]));if(this._hadError){throw p}var d=r.concat(c,u);this.close();return d}var m=this._binding.write(t,e,s,n,this._buffer,this._offset,a);m.buffer=e;m.callback=v;function v(p,h){if(f._hadError)return;var d=a-h;o(d>=0,"have should not go down");if(d>0){var m=f._buffer.slice(f._offset,f._offset+d);f._offset+=d;if(l){f.push(m)}else{c.push(m);u+=m.length}}if(h===0||f._offset>=f._chunkSize){a=f._chunkSize;f._offset=0;f._buffer=new r(f._chunkSize)}if(h===0){s+=n-p;n=p;if(!l)return true;var g=f._binding.write(t,e,s,n,f._buffer,f._offset,f._chunkSize);g.callback=v;g.buffer=e;return}if(!l)return false;i()}};s.inherits(c,g);s.inherits(u,g);s.inherits(p,g);s.inherits(h,g);s.inherits(d,g);s.inherits(m,g);s.inherits(v,g)}).call(this,e("_process"),e("buffer").Buffer)},{"./binding":31,_process:34,_stream_transform:102,assert:13,buffer:36,util:121}],33:[function(e,t,i){arguments[4][30][0].apply(i,arguments)},{dup:30}],34:[function(e,t,i){var r=t.exports={};var n=[];var a=false;var s;var o=-1;function f(){a=false;if(s.length){n=s.concat(n)}else{o=-1}if(n.length){l()}}function l(){if(a){return}var e=setTimeout(f);a=true;var t=n.length;while(t){s=n;n=[];while(++o<t){s[o].run()}o=-1;t=n.length}s=null;a=false;clearTimeout(e)}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){t[i-1]=arguments[i]}}n.push(new c(e,t));if(n.length===1&&!a){setTimeout(l,0)}};function c(e,t){this.fun=e;this.array=t}c.prototype.run=function(){this.fun.apply(null,this.array)};r.title="browser";r.browser=true;r.env={};r.argv=[];r.version="";r.versions={};function u(){}r.on=u;r.addListener=u;r.once=u;r.off=u;r.removeListener=u;r.removeAllListeners=u;r.emit=u;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}},{}],35:[function(t,i,r){(function(t){(function(n){var a=typeof r=="object"&&r&&!r.nodeType&&r;var s=typeof i=="object"&&i&&!i.nodeType&&i;var o=typeof t=="object"&&t;if(o.global===o||o.window===o||o.self===o){n=o}var f,l=2147483647,c=36,u=1,p=26,h=38,d=700,m=72,v=128,g="-",_=/^xn--/,y=/[^\x20-\x7E]/,b=/[\x2E\u3002\uFF0E\uFF61]/g,w={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},x=c-u,k=Math.floor,S=String.fromCharCode,E;function A(e){throw RangeError(w[e])}function U(e,t){var i=e.length;var r=[];while(i--){r[i]=t(e[i])}return r}function T(e,t){var i=e.split("@");var r="";if(i.length>1){r=i[0]+"@";e=i[1]}e=e.replace(b,".");var n=e.split(".");var a=U(n,t).join(".");return r+a}function I(e){var t=[],i=0,r=e.length,n,a;while(i<r){n=e.charCodeAt(i++);if(n>=55296&&n<=56319&&i<r){a=e.charCodeAt(i++);if((a&64512)==56320){t.push(((n&1023)<<10)+(a&1023)+65536)}else{t.push(n);i--}}else{t.push(n)}}return t}function L(e){return U(e,function(e){var t="";if(e>65535){e-=65536;t+=S(e>>>10&1023|55296);e=56320|e&1023}t+=S(e);return t}).join("")}function B(e){if(e-48<10){return e-22}if(e-65<26){return e-65}if(e-97<26){return e-97}return c}function z(e,t){return e+22+75*(e<26)-((t!=0)<<5)}function R(e,t,i){var r=0;e=i?k(e/d):e>>1;e+=k(e/t);for(;e>x*p>>1;r+=c){e=k(e/x)}return k(r+(x+1)*e/(e+h))}function C(e){var t=[],i=e.length,r,n=0,a=v,s=m,o,f,h,d,_,y,b,w,x;o=e.lastIndexOf(g);if(o<0){o=0}for(f=0;f<o;++f){if(e.charCodeAt(f)>=128){A("not-basic")}t.push(e.charCodeAt(f))}for(h=o>0?o+1:0;h<i;){for(d=n,_=1,y=c;;y+=c){if(h>=i){A("invalid-input")}b=B(e.charCodeAt(h++));if(b>=c||b>k((l-n)/_)){A("overflow")}n+=b*_;w=y<=s?u:y>=s+p?p:y-s;if(b<w){break}x=c-w;if(_>k(l/x)){A("overflow")}_*=x}r=t.length+1;s=R(n-d,r,d==0);if(k(n/r)>l-a){A("overflow")}a+=k(n/r);n%=r;t.splice(n++,0,a)}return L(t)}function F(e){var t,i,r,n,a,s,o,f,h,d,_,y=[],b,w,x,E;e=I(e);b=e.length;t=v;i=0;a=m;for(s=0;s<b;++s){_=e[s];if(_<128){y.push(S(_))}}r=n=y.length;if(n){y.push(g)}while(r<b){for(o=l,s=0;s<b;++s){_=e[s];if(_>=t&&_<o){o=_}}w=r+1;if(o-t>k((l-i)/w)){A("overflow")}i+=(o-t)*w;t=o;for(s=0;s<b;++s){_=e[s];if(_<t&&++i>l){A("overflow")}if(_==t){for(f=i,h=c;;h+=c){d=h<=a?u:h>=a+p?p:h-a;if(f<d){break}E=f-d;x=c-d;y.push(S(z(d+E%x,0)));f=k(E/x)}y.push(S(z(f,0)));a=R(i,w,r==n);i=0;++r}}++i;++t}return y.join("")}function O(e){return T(e,function(e){return _.test(e)?C(e.slice(4).toLowerCase()):e})}function N(e){return T(e,function(e){return y.test(e)?"xn--"+F(e):e})}f={version:"1.3.2",ucs2:{decode:I,encode:L},decode:C,encode:F,toASCII:N,toUnicode:O};if(typeof e=="function"&&typeof e.amd=="object"&&e.amd){e("punycode",function(){return f})}else if(a&&s){if(i.exports==a){s.exports=f}else{for(E in f){f.hasOwnProperty(E)&&(a[E]=f[E])}}}else{n.punycode=f}})(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],36:[function(e,t,i){var r=e("base64-js");var n=e("ieee754");var a=e("is-array");i.Buffer=f;i.SlowBuffer=y;i.INSPECT_MAX_BYTES=50;f.poolSize=8192;var s={};f.TYPED_ARRAY_SUPPORT=function(){function e(){}try{var t=new ArrayBuffer(0);var i=new Uint8Array(t);i.foo=function(){return 42};i.constructor=e;return i.foo()===42&&i.constructor===e&&typeof i.subarray==="function"&&new Uint8Array(1).subarray(1,1).byteLength===0}catch(r){return false}}();function o(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}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 l(this,e)}if(typeof e==="string"){return c(this,e,arguments.length>1?arguments[1]:"utf8")}return u(this,e)}function l(e,t){e=g(e,t<0?0:_(t)|0);if(!f.TYPED_ARRAY_SUPPORT){for(var i=0;i<t;i++){e[i]=0}}return e}function c(e,t,i){if(typeof i!=="string"||i==="")i="utf8";var r=b(t,i)|0;e=g(e,r);e.write(t,i);return e}function u(e,t){if(f.isBuffer(t))return p(e,t);if(a(t))return h(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 d(e,t)}if(t.length)return m(e,t);return v(e,t)}function p(e,t){var i=_(t.length)|0;e=g(e,i);t.copy(e,0,0,i);return e}function h(e,t){var i=_(t.length)|0;e=g(e,i);for(var r=0;r<i;r+=1){e[r]=t[r]&255}return e}function d(e,t){var i=_(t.length)|0;e=g(e,i);for(var r=0;r<i;r+=1){e[r]=t[r]&255}return e}function m(e,t){var i=_(t.length)|0;e=g(e,i);for(var r=0;r<i;r+=1){e[r]=t[r]&255}return e}function v(e,t){var i;var r=0;if(t.type==="Buffer"&&a(t.data)){i=t.data;r=_(i.length)|0}e=g(e,r);for(var n=0;n<r;n+=1){e[n]=i[n]&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 i=t!==0&&t<=f.poolSize>>>1;if(i)e.parent=s;return e}function _(e){if(e>=o()){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+o().toString(16)+" bytes")}return e|0}function y(e,t){if(!(this instanceof y))return new y(e,t);var i=new f(e,t);delete i.parent;return i}f.isBuffer=function J(e){return!!(e!=null&&e._isBuffer)};f.compare=function Q(e,t){if(!f.isBuffer(e)||!f.isBuffer(t)){throw new TypeError("Arguments must be Buffers")}if(e===t)return 0;var i=e.length;var r=t.length;var n=0;var a=Math.min(i,r);while(n<a){if(e[n]!==t[n])break;++n}if(n!==a){i=e[n];r=t[n]}if(i<r)return-1;if(r<i)return 1;return 0};f.isEncoding=function ee(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 te(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 i;if(t===undefined){t=0;for(i=0;i<e.length;i++){t+=e[i].length;
+}}var r=new f(t);var n=0;for(i=0;i<e.length;i++){var s=e[i];s.copy(r,n);n+=s.length}return r};function b(e,t){if(typeof e!=="string")e=""+e;var i=e.length;if(i===0)return 0;var r=false;for(;;){switch(t){case"ascii":case"binary":case"raw":case"raws":return i;case"utf8":case"utf-8":return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i*2;case"hex":return i>>>1;case"base64":return K(e).length;default:if(r)return W(e).length;t=(""+t).toLowerCase();r=true}}}f.byteLength=b;f.prototype.length=undefined;f.prototype.parent=undefined;function w(e,t,i){var r=false;t=t|0;i=i===undefined||i===Infinity?this.length:i|0;if(!e)e="utf8";if(t<0)t=0;if(i>this.length)i=this.length;if(i<=t)return"";while(true){switch(e){case"hex":return z(this,t,i);case"utf8":case"utf-8":return I(this,t,i);case"ascii":return L(this,t,i);case"binary":return B(this,t,i);case"base64":return T(this,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,i);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase();r=true}}}f.prototype.toString=function ie(){var e=this.length|0;if(e===0)return"";if(arguments.length===0)return I(this,0,e);return w.apply(this,arguments)};f.prototype.equals=function re(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 ne(){var e="";var t=i.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 ae(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 se(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 i(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 i(this,[e],t)}function i(e,t,i){var r=-1;for(var n=0;i+n<e.length;n++){if(e[i+n]===t[r===-1?0:n-r]){if(r===-1)r=n;if(n-r+1===t.length)return i+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 fe(e,t){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(e,t)};function x(e,t,i,r){i=Number(i)||0;var n=e.length-i;if(!r){r=n}else{r=Number(r);if(r>n){r=n}}var a=t.length;if(a%2!==0)throw new Error("Invalid hex string");if(r>a/2){r=a/2}for(var s=0;s<r;s++){var o=parseInt(t.substr(s*2,2),16);if(isNaN(o))throw new Error("Invalid hex string");e[i+s]=o}return s}function k(e,t,i,r){return $(W(t,e.length-i),e,i,r)}function S(e,t,i,r){return $(V(t),e,i,r)}function E(e,t,i,r){return S(e,t,i,r)}function A(e,t,i,r){return $(K(t),e,i,r)}function U(e,t,i,r){return $(Y(t,e.length-i),e,i,r)}f.prototype.write=function le(e,t,i,r){if(t===undefined){r="utf8";i=this.length;t=0}else if(i===undefined&&typeof t==="string"){r=t;i=this.length;t=0}else if(isFinite(t)){t=t|0;if(isFinite(i)){i=i|0;if(r===undefined)r="utf8"}else{r=i;i=undefined}}else{var n=r;r=t;t=i|0;i=n}var a=this.length-t;if(i===undefined||i>a)i=a;if(e.length>0&&(i<0||t<0)||t>this.length){throw new RangeError("attempt to write outside buffer bounds")}if(!r)r="utf8";var s=false;for(;;){switch(r){case"hex":return x(this,e,t,i);case"utf8":case"utf-8":return k(this,e,t,i);case"ascii":return S(this,e,t,i);case"binary":return E(this,e,t,i);case"base64":return A(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,t,i);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase();s=true}}};f.prototype.toJSON=function ce(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(e,t,i){if(t===0&&i===e.length){return r.fromByteArray(e)}else{return r.fromByteArray(e.slice(t,i))}}function I(e,t,i){var r="";var n="";i=Math.min(e.length,i);for(var a=t;a<i;a++){if(e[a]<=127){r+=X(n)+String.fromCharCode(e[a]);n=""}else{n+="%"+e[a].toString(16)}}return r+X(n)}function L(e,t,i){var r="";i=Math.min(e.length,i);for(var n=t;n<i;n++){r+=String.fromCharCode(e[n]&127)}return r}function B(e,t,i){var r="";i=Math.min(e.length,i);for(var n=t;n<i;n++){r+=String.fromCharCode(e[n])}return r}function z(e,t,i){var r=e.length;if(!t||t<0)t=0;if(!i||i<0||i>r)i=r;var n="";for(var a=t;a<i;a++){n+=Z(e[a])}return n}function R(e,t,i){var r=e.slice(t,i);var n="";for(var a=0;a<r.length;a+=2){n+=String.fromCharCode(r[a]+r[a+1]*256)}return n}f.prototype.slice=function ue(e,t){var i=this.length;e=~~e;t=t===undefined?i:~~t;if(e<0){e+=i;if(e<0)e=0}else if(e>i){e=i}if(t<0){t+=i;if(t<0)t=0}else if(t>i){t=i}if(t<e)t=e;var r;if(f.TYPED_ARRAY_SUPPORT){r=f._augment(this.subarray(e,t))}else{var n=t-e;r=new f(n,undefined);for(var a=0;a<n;a++){r[a]=this[a+e]}}if(r.length)r.parent=this.parent||this;return r};function C(e,t,i){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>i)throw new RangeError("Trying to access beyond buffer length")}f.prototype.readUIntLE=function pe(e,t,i){e=e|0;t=t|0;if(!i)C(e,t,this.length);var r=this[e];var n=1;var a=0;while(++a<t&&(n*=256)){r+=this[e+a]*n}return r};f.prototype.readUIntBE=function he(e,t,i){e=e|0;t=t|0;if(!i){C(e,t,this.length)}var r=this[e+--t];var n=1;while(t>0&&(n*=256)){r+=this[e+--t]*n}return r};f.prototype.readUInt8=function de(e,t){if(!t)C(e,1,this.length);return this[e]};f.prototype.readUInt16LE=function me(e,t){if(!t)C(e,2,this.length);return this[e]|this[e+1]<<8};f.prototype.readUInt16BE=function ve(e,t){if(!t)C(e,2,this.length);return this[e]<<8|this[e+1]};f.prototype.readUInt32LE=function ge(e,t){if(!t)C(e,4,this.length);return(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};f.prototype.readUInt32BE=function _e(e,t){if(!t)C(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,i){e=e|0;t=t|0;if(!i)C(e,t,this.length);var r=this[e];var n=1;var a=0;while(++a<t&&(n*=256)){r+=this[e+a]*n}n*=128;if(r>=n)r-=Math.pow(2,8*t);return r};f.prototype.readIntBE=function be(e,t,i){e=e|0;t=t|0;if(!i)C(e,t,this.length);var r=t;var n=1;var a=this[e+--r];while(r>0&&(n*=256)){a+=this[e+--r]*n}n*=128;if(a>=n)a-=Math.pow(2,8*t);return a};f.prototype.readInt8=function we(e,t){if(!t)C(e,1,this.length);if(!(this[e]&128))return this[e];return(255-this[e]+1)*-1};f.prototype.readInt16LE=function xe(e,t){if(!t)C(e,2,this.length);var i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};f.prototype.readInt16BE=function ke(e,t){if(!t)C(e,2,this.length);var i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};f.prototype.readInt32LE=function Se(e,t){if(!t)C(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)C(e,4,this.length);return this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};f.prototype.readFloatLE=function Ae(e,t){if(!t)C(e,4,this.length);return n.read(this,e,true,23,4)};f.prototype.readFloatBE=function Ue(e,t){if(!t)C(e,4,this.length);return n.read(this,e,false,23,4)};f.prototype.readDoubleLE=function Te(e,t){if(!t)C(e,8,this.length);return n.read(this,e,true,52,8)};f.prototype.readDoubleBE=function Ie(e,t){if(!t)C(e,8,this.length);return n.read(this,e,false,52,8)};function F(e,t,i,r,n,a){if(!f.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(t>n||t<a)throw new RangeError("value is out of bounds");if(i+r>e.length)throw new RangeError("index out of range")}f.prototype.writeUIntLE=function Le(e,t,i,r){e=+e;t=t|0;i=i|0;if(!r)F(this,e,t,i,Math.pow(2,8*i),0);var n=1;var a=0;this[t]=e&255;while(++a<i&&(n*=256)){this[t+a]=e/n&255}return t+i};f.prototype.writeUIntBE=function Be(e,t,i,r){e=+e;t=t|0;i=i|0;if(!r)F(this,e,t,i,Math.pow(2,8*i),0);var n=i-1;var a=1;this[t+n]=e&255;while(--n>=0&&(a*=256)){this[t+n]=e/a&255}return t+i};f.prototype.writeUInt8=function ze(e,t,i){e=+e;t=t|0;if(!i)F(this,e,t,1,255,0);if(!f.TYPED_ARRAY_SUPPORT)e=Math.floor(e);this[t]=e;return t+1};function O(e,t,i,r){if(t<0)t=65535+t+1;for(var n=0,a=Math.min(e.length-i,2);n<a;n++){e[i+n]=(t&255<<8*(r?n:1-n))>>>(r?n:1-n)*8}}f.prototype.writeUInt16LE=function Re(e,t,i){e=+e;t=t|0;if(!i)F(this,e,t,2,65535,0);if(f.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8}else{O(this,e,t,true)}return t+2};f.prototype.writeUInt16BE=function Ce(e,t,i){e=+e;t=t|0;if(!i)F(this,e,t,2,65535,0);if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>8;this[t+1]=e}else{O(this,e,t,false)}return t+2};function N(e,t,i,r){if(t<0)t=4294967295+t+1;for(var n=0,a=Math.min(e.length-i,4);n<a;n++){e[i+n]=t>>>(r?n:3-n)*8&255}}f.prototype.writeUInt32LE=function Fe(e,t,i){e=+e;t=t|0;if(!i)F(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{N(this,e,t,true)}return t+4};f.prototype.writeUInt32BE=function Oe(e,t,i){e=+e;t=t|0;if(!i)F(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{N(this,e,t,false)}return t+4};f.prototype.writeIntLE=function Ne(e,t,i,r){e=+e;t=t|0;if(!r){var n=Math.pow(2,8*i-1);F(this,e,t,i,n-1,-n)}var a=0;var s=1;var o=e<0?1:0;this[t]=e&255;while(++a<i&&(s*=256)){this[t+a]=(e/s>>0)-o&255}return t+i};f.prototype.writeIntBE=function Pe(e,t,i,r){e=+e;t=t|0;if(!r){var n=Math.pow(2,8*i-1);F(this,e,t,i,n-1,-n)}var a=i-1;var s=1;var o=e<0?1:0;this[t+a]=e&255;while(--a>=0&&(s*=256)){this[t+a]=(e/s>>0)-o&255}return t+i};f.prototype.writeInt8=function De(e,t,i){e=+e;t=t|0;if(!i)F(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 Me(e,t,i){e=+e;t=t|0;if(!i)F(this,e,t,2,32767,-32768);if(f.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8}else{O(this,e,t,true)}return t+2};f.prototype.writeInt16BE=function je(e,t,i){e=+e;t=t|0;if(!i)F(this,e,t,2,32767,-32768);if(f.TYPED_ARRAY_SUPPORT){this[t]=e>>>8;this[t+1]=e}else{O(this,e,t,false)}return t+2};f.prototype.writeInt32LE=function He(e,t,i){e=+e;t=t|0;if(!i)F(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{N(this,e,t,true)}return t+4};f.prototype.writeInt32BE=function qe(e,t,i){e=+e;t=t|0;if(!i)F(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{N(this,e,t,false)}return t+4};function P(e,t,i,r,n,a){if(t>n||t<a)throw new RangeError("value is out of bounds");if(i+r>e.length)throw new RangeError("index out of range");if(i<0)throw new RangeError("index out of range")}function D(e,t,i,r,a){if(!a){P(e,t,i,4,3.4028234663852886e38,-3.4028234663852886e38)}n.write(e,t,i,r,23,4);return i+4}f.prototype.writeFloatLE=function Ge(e,t,i){return D(this,e,t,true,i)};f.prototype.writeFloatBE=function Ze(e,t,i){return D(this,e,t,false,i)};function M(e,t,i,r,a){if(!a){P(e,t,i,8,1.7976931348623157e308,-1.7976931348623157e308)}n.write(e,t,i,r,52,8);return i+8}f.prototype.writeDoubleLE=function We(e,t,i){return M(this,e,t,true,i)};f.prototype.writeDoubleBE=function Ve(e,t,i){return M(this,e,t,false,i)};f.prototype.copy=function Ye(e,t,i,r){if(!i)i=0;if(!r&&r!==0)r=this.length;if(t>=e.length)t=e.length;if(!t)t=0;if(r>0&&r<i)r=i;if(r===i)return 0;if(e.length===0||this.length===0)return 0;if(t<0){throw new RangeError("targetStart out of bounds")}if(i<0||i>=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-i){r=e.length-t+i}var n=r-i;if(n<1e3||!f.TYPED_ARRAY_SUPPORT){for(var a=0;a<n;a++){e[a+t]=this[a+i]}}else{e._set(this.subarray(i,i+n),t)}return n};f.prototype.fill=function Ke(e,t,i){if(!e)e=0;if(!t)t=0;if(!i)i=this.length;if(i<t)throw new RangeError("end < start");if(i===t)return;if(this.length===0)return;if(t<0||t>=this.length)throw new RangeError("start out of bounds");if(i<0||i>this.length)throw new RangeError("end out of bounds");var r;if(typeof e==="number"){for(r=t;r<i;r++){this[r]=e}}else{var n=W(e.toString());var a=n.length;for(r=t;r<i;r++){this[r]=n[r%a]}}return this};f.prototype.toArrayBuffer=function $e(){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,i=e.length;t<i;t+=1){e[t]=this[t]}return e.buffer}}else{throw new TypeError("Buffer.toArrayBuffer not supported in this browser")}};var j=f.prototype;f._augment=function Xe(e){e.constructor=f;e._isBuffer=true;e._set=e.set;e.get=j.get;e.set=j.set;e.write=j.write;e.toString=j.toString;e.toLocaleString=j.toString;e.toJSON=j.toJSON;e.equals=j.equals;e.compare=j.compare;e.indexOf=j.indexOf;e.copy=j.copy;e.slice=j.slice;e.readUIntLE=j.readUIntLE;e.readUIntBE=j.readUIntBE;e.readUInt8=j.readUInt8;e.readUInt16LE=j.readUInt16LE;e.readUInt16BE=j.readUInt16BE;e.readUInt32LE=j.readUInt32LE;e.readUInt32BE=j.readUInt32BE;e.readIntLE=j.readIntLE;e.readIntBE=j.readIntBE;e.readInt8=j.readInt8;e.readInt16LE=j.readInt16LE;e.readInt16BE=j.readInt16BE;e.readInt32LE=j.readInt32LE;e.readInt32BE=j.readInt32BE;e.readFloatLE=j.readFloatLE;e.readFloatBE=j.readFloatBE;e.readDoubleLE=j.readDoubleLE;e.readDoubleBE=j.readDoubleBE;e.writeUInt8=j.writeUInt8;e.writeUIntLE=j.writeUIntLE;e.writeUIntBE=j.writeUIntBE;e.writeUInt16LE=j.writeUInt16LE;e.writeUInt16BE=j.writeUInt16BE;e.writeUInt32LE=j.writeUInt32LE;e.writeUInt32BE=j.writeUInt32BE;e.writeIntLE=j.writeIntLE;e.writeIntBE=j.writeIntBE;e.writeInt8=j.writeInt8;e.writeInt16LE=j.writeInt16LE;e.writeInt16BE=j.writeInt16BE;e.writeInt32LE=j.writeInt32LE;e.writeInt32BE=j.writeInt32BE;e.writeFloatLE=j.writeFloatLE;e.writeFloatBE=j.writeFloatBE;e.writeDoubleLE=j.writeDoubleLE;e.writeDoubleBE=j.writeDoubleBE;e.fill=j.fill;e.inspect=j.inspect;e.toArrayBuffer=j.toArrayBuffer;return e};var H=/[^+\/0-9A-z\-]/g;function q(e){e=G(e).replace(H,"");if(e.length<2)return"";while(e.length%4!==0){e=e+"="}return e}function G(e){if(e.trim)return e.trim();return e.replace(/^\s+|\s+$/g,"")}function Z(e){if(e<16)return"0"+e.toString(16);return e.toString(16)}function W(e,t){t=t||Infinity;var i;var r=e.length;var n=null;var a=[];var s=0;for(;s<r;s++){i=e.charCodeAt(s);if(i>55295&&i<57344){if(n){if(i<56320){if((t-=3)>-1)a.push(239,191,189);n=i;continue}else{i=n-55296<<10|i-56320|65536;n=null}}else{if(i>56319){if((t-=3)>-1)a.push(239,191,189);continue}else if(s+1===r){if((t-=3)>-1)a.push(239,191,189);continue}else{n=i;continue}}}else if(n){if((t-=3)>-1)a.push(239,191,189);n=null}if(i<128){if((t-=1)<0)break;a.push(i)}else if(i<2048){if((t-=2)<0)break;a.push(i>>6|192,i&63|128)}else if(i<65536){if((t-=3)<0)break;a.push(i>>12|224,i>>6&63|128,i&63|128)}else if(i<2097152){if((t-=4)<0)break;a.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else{throw new Error("Invalid code point")}}return a}function V(e){var t=[];for(var i=0;i<e.length;i++){t.push(e.charCodeAt(i)&255)}return t}function Y(e,t){var i,r,n;var a=[];for(var s=0;s<e.length;s++){if((t-=2)<0)break;i=e.charCodeAt(s);r=i>>8;n=i%256;a.push(n);a.push(r)}return a}function K(e){return r.toByteArray(q(e))}function $(e,t,i,r){for(var n=0;n<r;n++){if(n+i>=t.length||n>=e.length)break;t[n+i]=e[n]}return n}function X(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}},{"base64-js":14,ieee754:54,"is-array":56}],37:[function(e,t,i){t.exports=function(e,t){var i=Infinity;var r=0;var n=null;t.sort(function(e,t){return e-t});for(var a=0,s=t.length;a<s;a++){r=Math.abs(e-t[a]);if(r>=i){break}i=r;n=t[a]}return n}},{}],38:[function(e,t,i){(function(e){function t(e){return Array.isArray(e)}i.isArray=t;function r(e){return typeof e==="boolean"}i.isBoolean=r;function n(e){return e===null}i.isNull=n;function a(e){return e==null}i.isNullOrUndefined=a;function s(e){return typeof e==="number"}i.isNumber=s;function o(e){return typeof e==="string"}i.isString=o;function f(e){return typeof e==="symbol"}i.isSymbol=f;function l(e){return e===void 0}i.isUndefined=l;function c(e){return u(e)&&g(e)==="[object RegExp]"}i.isRegExp=c;function u(e){return typeof e==="object"&&e!==null}i.isObject=u;function p(e){return u(e)&&g(e)==="[object Date]"}i.isDate=p;function h(e){return u(e)&&(g(e)==="[object Error]"||e instanceof Error)}i.isError=h;function d(e){return typeof e==="function"}i.isFunction=d;function m(e){return e===null||typeof e==="boolean"||typeof e==="number"||typeof e==="string"||typeof e==="symbol"||typeof e==="undefined"}i.isPrimitive=m;function v(t){return e.isBuffer(t)}i.isBuffer=v;function g(e){return Object.prototype.toString.call(e)}}).call(this,e("buffer").Buffer)},{buffer:36}],39:[function(e,t,i){(function(i,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 n=e("bencode");var a=e("block-stream2");var s=e("piece-length");var o=e("path");var f=e("dezalgo");var l=e("filestream/read");var c=e("flatten");var u=e("fs");var p=e("is-file");var h=e("junk");var d=e("multistream");var m=e("once");var v=e("run-parallel");var g=e("simple-sha1");var _=e("stream");function y(e,t,i){if(typeof t==="function"){i=t;t={}}if(!t)t={};b(e,t,function(e,r,n){if(e)return i(e);t.singleFileTorrent=n;A(r,t,i)})}function b(e,t,i){if(typeof t==="function"){i=t;t={}}if(!t)t={};i=f(i);if(Array.isArray(e)&&e.length===0)throw new Error("invalid input type");if(I(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"&&o.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 n=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 i(e);a=t;s()})}else{s()}function s(){v(e.map(function(e){return function(i){var s={};if(T(e)){s.getStream=B(e);s.length=e.size}else if(r.isBuffer(e)){s.getStream=z(e);s.length=e.length}else if(L(e)){if(!t.pieceLength){throw new Error("must specify `pieceLength` option if input is Stream")}s.getStream=C(e,s);s.length=0}else if(typeof e==="string"){if(typeof u.readdir!=="function"){throw new Error("filesystem paths do not work in the browser")}var f=n>1||a;w(e,f,i);return}else{throw new Error("invalid input type")}if(!e.name)throw new Error("missing requied `name` property on input");s.path=e.name.split(o.sep);i(null,s)}}),function(e,t){if(e)return i(e);t=c(t);i(null,t,a)})}}function w(e,t,i){k(e,x,function(r,n){if(r)return i(r);if(Array.isArray(n))n=c(n);else n=[n];e=o.normalize(e);if(t){e=e.slice(0,e.lastIndexOf(o.sep)+1)}if(e[e.length-1]!==o.sep)e+=o.sep;n.forEach(function(t){t.getStream=R(t.path);t.path=t.path.replace(e,"").split(o.sep)});i(null,n)})}function x(e,t){t=m(t);u.stat(e,function(i,r){if(i)return t(i);var n={length:r.size,path:e};t(null,n)})}function k(e,t,i){u.readdir(e,function(r,n){if(r&&r.code==="ENOTDIR"){t(e,i)}else if(r){i(r)}else{v(n.filter(S).filter(h.not).map(function(i){return function(r){k(o.join(e,i),t,r)}}),i)}})}function S(e){return e[0]!=="."}function E(e,t,i){i=m(i);var n=[];var s=0;var o=e.map(function(e){return e.getStream});var f=0;var l=0;var c=false;var u=new d(o);var p=new a(t,{zeroPadding:false});u.on("error",_);u.pipe(p).on("data",h).on("end",v).on("error",_);function h(e){s+=e.length;var t=l;g(e,function(e){n[t]=e;f-=1;b()});f+=1;l+=1}function v(){c=true;b()}function _(e){y();i(e)}function y(){u.removeListener("error",_);p.removeListener("data",h);p.removeListener("end",v);p.removeListener("error",_)}function b(){if(c&&f===0){y();i(null,new r(n.join(""),"hex"),s)}}}function A(e,r,a){var o=r.announceList;if(!o){if(typeof r.announce==="string")o=[[r.announce]];else if(Array.isArray(r.announce)){o=r.announce.map(function(e){return[e]})}}if(!o)o=[];if(i.WEBTORRENT_ANNOUNCE){if(typeof i.WEBTORRENT_ANNOUNCE==="string"){o.push([[i.WEBTORRENT_ANNOUNCE]])}else if(Array.isArray(i.WEBTORRENT_ANNOUNCE)){o=o.concat(i.WEBTORRENT_ANNOUNCE.map(function(e){return[e]}))}}if(o.length===0){o=o.concat(t.exports.announceList)}var f={info:{name:r.name},announce:o[0][0],"announce-list":o,"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 l=r.pieceLength||s(e.reduce(U,0));f.info["piece length"]=l;E(e,l,function(t,i,s){if(t)return a(t);f.info.pieces=i;e.forEach(function(e){delete e.getStream});if(r.singleFileTorrent){f.info.length=s}else{f.info.files=e}a(null,n.encode(f))})}function U(e,t){return e+t.length}function T(e){return typeof Blob!=="undefined"&&e instanceof Blob}function I(e){return typeof FileList==="function"&&e instanceof FileList}function L(e){return typeof e==="object"&&typeof e.pipe==="function"}function B(e){return function(){return new l(e)}}function z(e){return function(){var t=new _.PassThrough;t.end(e);return t}}function R(e){return function(){return u.createReadStream(e)}}function C(e,t){return function(){var i=new _.Transform;i._transform=function(e,i,r){t.length+=e.length;this.push(e);r()};e.pipe(i);return i}}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},e("buffer").Buffer)},{bencode:15,"block-stream2":29,buffer:36,dezalgo:43,"filestream/read":46,flatten:47,fs:33,"is-file":57,junk:60,multistream:71,once:72,path:86,"piece-length":87,"run-parallel":104,"simple-sha1":108,stream:111}],40:[function(e,t,i){i=t.exports=e("./debug");i.log=a;i.formatArgs=n;i.save=s;i.load=o;i.useColors=r;i.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:f();i.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}i.formatters.j=function(e){return JSON.stringify(e)};function n(){var e=arguments;var t=this.useColors;e[0]=(t?"%c":"")+this.namespace+(t?" %c":" ")+e[0]+(t?"%c ":" ")+"+"+i.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 n=0;var a=0;e[0].replace(/%[a-z%]/g,function(e){if("%%"===e)return;n++;if("%c"===e){a=n}});e.splice(a,0,r);return e}function a(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function s(e){try{if(null==e){i.storage.removeItem("debug")}else{i.storage.debug=e}}catch(t){}}function o(){var e;try{e=i.storage.debug}catch(t){}return e}i.enable(o());function f(){try{return window.localStorage}catch(e){}}},{"./debug":41}],41:[function(e,t,i){i=t.exports=s;i.coerce=c;i.disable=f;i.enable=o;i.enabled=l;i.humanize=e("ms");i.names=[];i.skips=[];i.formatters={};var r=0;var n;function a(){return i.colors[r++%i.colors.length]}function s(e){function t(){}t.enabled=false;function r(){var e=r;var t=+new Date;var s=t-(n||t);e.diff=s;e.prev=n;e.curr=t;n=t;if(null==e.useColors)e.useColors=i.useColors();if(null==e.color&&e.useColors)e.color=a();var o=Array.prototype.slice.call(arguments);o[0]=i.coerce(o[0]);if("string"!==typeof o[0]){o=["%o"].concat(o)}var f=0;o[0]=o[0].replace(/%([a-z%])/g,function(t,r){if(t==="%%")return t;f++;var n=i.formatters[r];if("function"===typeof n){var a=o[f];t=n.call(e,a);o.splice(f,1);f--}return t});if("function"===typeof i.formatArgs){o=i.formatArgs.apply(e,o)}var l=r.log||i.log||console.log.bind(console);l.apply(e,o)}r.enabled=true;var s=i.enabled(e)?r:t;s.namespace=e;return s}function o(e){i.save(e);var t=(e||"").split(/[\s,]+/);var r=t.length;for(var n=0;n<r;n++){if(!t[n])continue;e=t[n].replace(/\*/g,".*?");if(e[0]==="-"){i.skips.push(new RegExp("^"+e.substr(1)+"$"))}else{i.names.push(new RegExp("^"+e+"$"))}}}function f(){i.enable("")}function l(e){var t,r;for(t=0,r=i.skips.length;t<r;t++){if(i.skips[t].test(e)){return false}}for(t=0,r=i.names.length;t<r;t++){if(i.names[t].test(e)){return true}}return false}function c(e){if(e instanceof Error)return e.stack||e.message;return e}},{ms:70}],42:[function(e,t,i){t.exports=function(){for(var e=0;e<arguments.length;e++){if(arguments[e]!==undefined)return arguments[e]}}},{}],43:[function(e,t,i){var r=e("wrappy");t.exports=r(a);var n=e("asap");function a(e){var t=true;n(function(){t=false});return function i(){var i=arguments;var r=this;if(t)n(function(){e.apply(r,i)});else e.apply(r,i)}}},{asap:11,wrappy:123}],44:[function(e,t,i){var r=e("once");var n=function(){};var a=function(e){return e.setHeader&&typeof e.abort==="function"};var s=function(e){return e.stdio&&Array.isArray(e.stdio)&&e.stdio.length===3};var o=function(e,t,i){if(typeof t==="function")return o(e,null,t);if(!t)t={};i=r(i||n);var f=e._writableState;var l=e._readableState;var c=t.readable||t.readable!==false&&e.readable;var u=t.writable||t.writable!==false&&e.writable;var p=function(){if(!e.writable)h()};var h=function(){u=false;if(!c)i()};var d=function(){c=false;if(!u)i()};var m=function(e){i(e?new Error("exited with error code: "+e):null)};var v=function(){if(c&&!(l&&l.ended))return i(new Error("premature close"));if(u&&!(f&&f.ended))return i(new Error("premature close"))};var g=function(){e.req.on("finish",h)};if(a(e)){e.on("complete",h);e.on("abort",v);if(e.req)g();else e.on("request",g)}else if(u&&!f){e.on("end",p);e.on("close",p)}if(s(e))e.on("exit",m);e.on("end",d);e.on("finish",h);if(t.error!==false)e.on("error",i);e.on("close",v);return function(){e.removeListener("complete",h);e.removeListener("abort",v);e.removeListener("request",g);if(e.req)e.req.removeListener("finish",h);e.removeListener("end",p);e.removeListener("close",p);e.removeListener("finish",h);e.removeListener("exit",m);e.removeListener("end",d);e.removeListener("error",i);e.removeListener("close",v)}};t.exports=o},{once:72}],45:[function(e,t,i){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,i,r,a,f,l;if(!this._events)this._events={};if(e==="error"){if(!this._events.error||s(this._events.error)&&!this._events.error.length){t=arguments[1];if(t instanceof Error){throw t}throw TypeError('Uncaught, unspecified "error" event.')}}i=this._events[e];if(o(i))return false;if(n(i)){switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.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];i.apply(this,a)}}else if(s(i)){r=arguments.length;a=new Array(r-1);for(f=1;f<r;f++)a[f-1]=arguments[f];l=i.slice();r=l.length;for(f=0;f<r;f++)l[f].apply(this,a)}return true};r.prototype.addListener=function(e,t){var i;if(!n(t))throw TypeError("listener must be a function");if(!this._events)this._events={};if(this._events.newListener)this.emit("newListener",e,n(t.listener)?t.listener:t);if(!this._events[e])this._events[e]=t;else if(s(this._events[e]))this._events[e].push(t);else this._events[e]=[this._events[e],t];if(s(this._events[e])&&!this._events[e].warned){var i;if(!o(this._maxListeners)){i=this._maxListeners}else{i=r.defaultMaxListeners}if(i&&i>0&&this._events[e].length>i){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(!n(t))throw TypeError("listener must be a function");var i=false;function r(){this.removeListener(e,r);if(!i){i=true;t.apply(this,arguments)}}r.listener=t;this.on(e,r);return this};r.prototype.removeListener=function(e,t){var i,r,a,o;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;i=this._events[e];a=i.length;r=-1;if(i===t||n(i.listener)&&i.listener===t){delete this._events[e];if(this._events.removeListener)this.emit("removeListener",e,t)}else if(s(i)){for(o=a;o-->0;){if(i[o]===t||i[o].listener&&i[o].listener===t){r=o;break}}if(r<0)return this;if(i.length===1){i.length=0;delete this._events[e]}else{i.splice(r,1)}if(this._events.removeListener)this.emit("removeListener",e,t)}return this};r.prototype.removeAllListeners=function(e){var t,i;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}i=this._events[e];if(n(i)){this.removeListener(e,i)}else{while(i.length)this.removeListener(e,i[i.length-1])}delete this._events[e];return this};r.prototype.listeners=function(e){var t;if(!this._events||!this._events[e])t=[];else if(n(this._events[e]))t=[this._events[e]];else t=this._events[e].slice();return t};r.listenerCount=function(e,t){var i;if(!e._events||!e._events[t])i=0;else if(n(e._events[t]))i=1;else i=e._events[t].length;return i};function n(e){return typeof e==="function"}function a(e){return typeof e==="number"}function s(e){return typeof e==="object"&&e!==null}function o(e){return e===void 0}},{}],46:[function(e,t,i){var r=e("stream").Readable;var n=e("inherits");var a=/^.*\.(\w+)$/;var s=e("typedarray-to-buffer");function o(e,t){var i=this;if(!(this instanceof o)){return new o(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 i.emit("error",e)}if(Array.isArray(t)){t.forEach(function(e){i.push(e)})}i._ready=true;i.emit("_ready")})}n(o,r);t.exports=o;o.prototype._generateHeaderBlocks=function(e,t,i){i(null,[])};o.prototype._read=function(){if(!this._ready){this.once("_ready",this._read.bind(this));return}var e=this;var t=this.reader;var i=this._offset;var r=this._offset+this._chunkSize;if(r>this._size)r=this._size;if(i===this._size){this.destroy();this.push(null);return}t.onload=function(){e._offset=r;e.push(s(t.result))};t.onerror=function(){e.emit("error",t.error)};t.readAsArrayBuffer(this._file.slice(i,r))};o.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:55,stream:111,"typedarray-to-buffer":116}],47:[function(e,t,i){t.exports=function r(e,t){t=typeof t=="number"?t:Infinity;return i(e,1);function i(e,r){return e.reduce(function(e,n){if(Array.isArray(n)&&r<t){return e.concat(i(n,r+1))}else{return e.concat(n)}},[])}}},{}],48:[function(e,t,i){t.exports=function r(){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}},{}],49:[function(e,t,i){var r=t.exports=function(e,t){if(!t)t=16;if(e===undefined)e=128;if(e<=0)return"0";var i=Math.log(Math.pow(2,e))/Math.log(t);for(var n=2;i===Infinity;n*=2){i=Math.log(Math.pow(2,e/n))/Math.log(t)*n}var a=i-Math.floor(i);var s="";for(var n=0;n<Math.floor(i);n++){var o=Math.floor(Math.random()*t).toString(t);s=o+s}if(a){var f=Math.pow(t,a);var o=Math.floor(Math.random()*f).toString(t);s=o+s}var l=parseInt(s,t);if(l!==Infinity&&l>=Math.pow(2,e)){return r(e,t)}else return s};r.rack=function(e,t,i){var n=function(n){var s=0;do{if(s++>10){if(i)e+=i;else throw new Error("too many ID collisions, use more bits")}var o=r(e,t)}while(Object.hasOwnProperty.call(a,o));a[o]=n;return o};var a=n.hats={};n.get=function(e){return n.hats[e]};n.set=function(e,t){n.hats[e]=t;return n};n.bits=e||128;n.base=t||16;return n}},{}],50:[function(e,t,i){var r=t.exports;var n=e("events").EventEmitter;var a=e("./lib/request");var s=e("url");r.request=function(e,t){if(typeof e==="string"){e=s.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 i=new a(new o,e);if(t)i.on("response",t);return i};r.get=function(e,t){e.method="GET";var i=r.request(e,t);i.end();return i};r.Agent=function(){};r.Agent.defaultMaxSockets=4;var o=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 i=new window.ActiveXObject(e[t]);return function(){if(i){var r=i;i=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":51,events:45,url:118}],51:[function(e,t,i){var r=e("stream");var n=e("./response");var a=e("Base64");var s=e("inherits");var o=t.exports=function(e,t){var i=this;i.writable=true;i.xhr=e;i.body=[];i.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",i.uri,true);e.onerror=function(e){i.emit("error",new Error("Network error"))};i._headers={};if(t.headers){var s=f(t.headers);for(var o=0;o<s.length;o++){var l=s[o];if(!i.isSafeRequestHeader(l))continue;var c=t.headers[l];i.setHeader(l,c)}}if(t.auth){this.setHeader("Authorization","Basic "+a.btoa(t.auth))}var u=new n;u.on("close",function(){i.emit("close")});u.on("ready",function(){i.emit("response",u)});u.on("error",function(e){i.emit("error",e)});e.onreadystatechange=function(){if(e.__aborted)return;u.handle(e)}};s(o,r);o.prototype.setHeader=function(e,t){this._headers[e.toLowerCase()]=t};o.prototype.getHeader=function(e){return this._headers[e.toLowerCase()]};o.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]};o.prototype.write=function(e){this.body.push(e)};o.prototype.destroy=function(e){this.xhr.__aborted=true;this.xhr.abort();this.emit("close")};o.prototype.end=function(e){if(e!==undefined)this.body.push(e);var t=f(this._headers);for(var i=0;i<t.length;i++){var r=t[i];var n=this._headers[r];if(l(n)){for(var a=0;a<n.length;a++){this.xhr.setRequestHeader(r,n[a])}}else this.xhr.setRequestHeader(r,n)}if(this.body.length===0){this.xhr.send("")}else if(typeof this.body[0]==="string"){this.xhr.send(this.body.join(""))}else if(l(this.body[0])){var s=[];for(var i=0;i<this.body.length;i++){s.push.apply(s,this.body[i])}this.xhr.send(s)}else if(/Array/.test(Object.prototype.toString.call(this.body[0]))){var o=0;for(var i=0;i<this.body.length;i++){o+=this.body[i].length}var s=new this.body[0].constructor(o);var c=0;for(var i=0;i<this.body.length;i++){var p=this.body[i];for(var a=0;a<p.length;a++){s[c++]=p[a]}}this.xhr.send(s)}else if(u(this.body[0])){this.xhr.send(this.body[0])}else{var s="";for(var i=0;i<this.body.length;i++){s+=this.body[i].toString()}this.xhr.send(s)}};o.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"];o.prototype.isSafeRequestHeader=function(e){if(!e)return false;return c(o.unsafeHeaders,e.toLowerCase())===-1};var f=Object.keys||function(e){var t=[];for(var i in e)t.push(i);return t};var l=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};var c=function(e,t){if(e.indexOf)return e.indexOf(t);for(var i=0;i<e.length;i++){if(e[i]===t)return i}return-1};var u=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":52,Base64:9,inherits:55,stream:111}],52:[function(e,t,i){var r=e("stream");var n=e("util");var a=t.exports=function(e){this.offset=0;this.readable=true};n.inherits(a,r);var s={streaming:true,status2:true};function o(e){var t=e.getAllResponseHeaders().split(/\r?\n/);var i={};for(var r=0;r<t.length;r++){var n=t[r];if(n==="")continue;var a=n.match(/^([^:]+):\s*(.*)/);if(a){var s=a[1].toLowerCase(),o=a[2];if(i[s]!==undefined){if(f(i[s])){i[s].push(o)}else{i[s]=[i[s],o]}}else{i[s]=o}}else{i[n]=true}}return i}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&&s.status2){try{this.statusCode=e.status;this.headers=o(e)}catch(t){s.status2=false}if(s.status2){this.emit("ready")}}else if(s.streaming&&e.readyState===3){try{if(!this.statusCode){this.statusCode=e.status;this.headers=o(e);this.emit("ready")}}catch(t){}try{this._emitData(e)}catch(t){s.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:111,util:121}],53:[function(e,t,i){var r=e("http");var n=t.exports;for(var a in r){if(r.hasOwnProperty(a))n[a]=r[a]}n.request=function(e,t){if(!e)e={};e.scheme="https";return r.request.call(this,e,t)}},{http:50}],54:[function(e,t,i){i.read=function(e,t,i,r,n){var a,s;var o=n*8-r-1;var f=(1<<o)-1;var l=f>>1;var c=-7;var u=i?n-1:0;var p=i?-1:1;var h=e[t+u];u+=p;a=h&(1<<-c)-1;h>>=-c;c+=o;for(;c>0;a=a*256+e[t+u],u+=p,c-=8){}s=a&(1<<-c)-1;a>>=-c;c+=r;for(;c>0;s=s*256+e[t+u],u+=p,c-=8){}if(a===0){a=1-l}else if(a===f){return s?NaN:(h?-1:1)*Infinity}else{s=s+Math.pow(2,r);a=a-l}return(h?-1:1)*s*Math.pow(2,a-r)};i.write=function(e,t,i,r,n,a){var s,o,f;var l=a*8-n-1;var c=(1<<l)-1;var u=c>>1;var p=n===23?Math.pow(2,-24)-Math.pow(2,-77):0;var h=r?0:a-1;var d=r?1:-1;var m=t<0||t===0&&1/t<0?1:0;t=Math.abs(t);if(isNaN(t)||t===Infinity){o=isNaN(t)?1:0;s=c}else{s=Math.floor(Math.log(t)/Math.LN2);if(t*(f=Math.pow(2,-s))<1){s--;f*=2}if(s+u>=1){t+=p/f}else{t+=p*Math.pow(2,1-u)}if(t*f>=2){s++;f/=2}if(s+u>=c){o=0;s=c}else if(s+u>=1){o=(t*f-1)*Math.pow(2,n);s=s+u}else{o=t*Math.pow(2,u-1)*Math.pow(2,n);s=0}}for(;n>=8;e[i+h]=o&255,h+=d,o/=256,n-=8){}s=s<<n|o;l+=n;for(;l>0;e[i+h]=s&255,h+=d,s/=256,l-=8){}e[i+h-d]|=m*128}},{}],55:[function(e,t,i){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 n(e,t){e.super_=t;var i=function(){};i.prototype=t.prototype;e.prototype=new i;e.prototype.constructor=e}}},{}],56:[function(e,t,i){var r=Array.isArray;var n=Object.prototype.toString;t.exports=r||function(e){return!!e&&"[object Array]"==n.call(e)}},{}],57:[function(e,t,i){"use strict";var r=e("fs");t.exports=function a(e,t){if(!t)return n(e);r.stat(e,function(e,i){if(e)return t(e);return t(null,i.isFile())})};t.exports.sync=n;function n(e){return r.existsSync(e)&&r.statSync(e).isFile()}},{fs:33}],58:[function(e,t,i){t.exports=a;a.strict=s;a.loose=o;var r=Object.prototype.toString;var n={"[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 s(e)||o(e)}function s(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 o(e){return n[r.call(e)]}},{}],59:[function(e,t,i){t.exports=Array.isArray||function(e){return Object.prototype.toString.call(e)=="[object Array]"}},{}],60:[function(e,t,i){"use strict";i.re=/^npm-debug\.log$|^\..*\.swp$|^\.DS_Store$|^\.AppleDouble$|^\.LSOverride$|^Icon[\r\?]?|^\._.*|^\.Spotlight-V100$|\.Trashes|^__MACOSX$|~$|^Thumbs\.db$|^ehthumbs\.db$|^Desktop\.ini$/;i.is=function(e){return i.re.test(e)};i.not=i.isnt=function(e){return!i.is(e)}},{}],61:[function(e,t,i){(function(i){t.exports=s;t.exports.decode=s;t.exports.encode=o;var r=e("thirty-two");var n=e("xtend");var a=e("uniq");function s(e){var t={};var n=e.split("magnet:?")[1];var s=n&&n.length>=0?n.split("&"):[];s.forEach(function(e){var i=e.split("=");if(i.length!==2)return;var r=i[0];var n=i[1];if(r==="dn")n=decodeURIComponent(n).replace(/\+/g," ");if(r==="tr"||r==="xs"||r==="as"||r==="ws"){n=decodeURIComponent(n)}if(r==="kt")n=decodeURIComponent(n).split("+");if(t[r]){if(Array.isArray(t[r])){t[r].push(n)}else{var a=t[r];t[r]=[a,n]}}else{t[r]=n}});var o;if(t.xt){var f=Array.isArray(t.xt)?t.xt:[t.xt];f.forEach(function(e){if(o=e.match(/^urn:btih:(.{40})/)){t.infoHash=new i(o[1],"hex").toString("hex")}else if(o=e.match(/^urn:btih:(.{32})/)){var n=r.decode(o[1]);t.infoHash=new i(n,"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 o(e){e=n(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(i,r){var n=Array.isArray(e[i])?e[i]:[e[i]];n.forEach(function(e,n){if((r>0||n>0)&&(i!=="kt"||n===0))t+="&";if(i==="dn")e=encodeURIComponent(e).replace(/%20/g,"+");if(i==="tr"||i==="xs"||i==="as"||i==="ws"){e=encodeURIComponent(e)}if(i==="kt")e=encodeURIComponent(e);if(i==="kt"&&n>0)t+="+"+e;else t+=i+"="+e})});return t}}).call(this,e("buffer").Buffer)},{buffer:36,"thirty-two":113,uniq:117,xtend:124}],62:[function(e,t,i){(function(i){var r=e("path");var n=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 n=0;n<r.length;n++){if(i.env.DEBUG_MIME&&this.types[r]){console.warn(this._loading.replace(/.*\//,""),'changes "'+r[n]+'" extension type from '+this.types[r]+" to "+t)}this.types[r[n]]=t}if(!this.extensions[t]){this.extensions[t]=r[0]}}};a.prototype.load=function(e){this._loading=e;var t={},i=n.readFileSync(e,"ascii"),r=i.split(/[\r\n]+/);r.forEach(function(e){var i=e.replace(/\s*#.*|^\s*|\s*$/g,"").split(/\s+/);t[i.shift()]=i});this.define(t);this._loading=null};a.prototype.lookup=function(e,t){var i=e.replace(/.*[\.\/\\]/,"").toLowerCase();return this.types[i]||t||this.default_type};a.prototype.extension=function(e){var t=e.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase();return this.extensions[t]};var s=new a;s.define(e("./types.json"));s.default_type=s.lookup("bin");s.Mime=a;s.charsets={lookup:function(e,t){return/^text\//.test(e)?"UTF-8":t}};t.exports=s}).call(this,e("_process"))},{"./types.json":63,_process:34,fs:33,path:86}],63:[function(e,t,i){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"]}},{}],64:[function(e,t,i){var r=function(e,t,i){this._byteOffset=t||0;if(e instanceof ArrayBuffer){this.buffer=e}else if(typeof e=="object"){this.dataView=e;if(t){this._byteOffset+=t}}else{this.buffer=new ArrayBuffer(e||0)}this.position=0;this.endianness=i==null?r.LITTLE_ENDIAN:i};t.exports=r;r.prototype={};r.prototype.save=function(e){var t=new Blob([this.buffer]);var i=window.webkitURL||window.URL;if(i&&i.createObjectURL){var r=i.createObjectURL(t);var n=document.createElement("a");n.setAttribute("href",r);n.setAttribute("download",e);n.click();i.revokeObjectURL(r)}else{throw"DataStream.save: Can't create object URL."}};r.BIG_ENDIAN=false;r.LITTLE_ENDIAN=true;r.prototype._dynamicSize=true;Object.defineProperty(r.prototype,"dynamicSize",{get:function(){return this._dynamicSize},set:function(e){if(!e){this._trimAlloc()}this._dynamicSize=e}});r.prototype._byteLength=0;Object.defineProperty(r.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}});Object.defineProperty(r.prototype,"buffer",{get:function(){this._trimAlloc();return this._buffer},set:function(e){this._buffer=e;this._dataView=new DataView(this._buffer,this._byteOffset);this._byteLength=this._buffer.byteLength}});Object.defineProperty(r.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e;this._dataView=new DataView(this._buffer,this._byteOffset);this._byteLength=this._buffer.byteLength}});Object.defineProperty(r.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset;this._buffer=e.buffer;this._dataView=new DataView(this._buffer,this._byteOffset);this._byteLength=this._byteOffset+e.byteLength}});r.prototype._realloc=function(e){if(!this._dynamicSize){return}var t=this._byteOffset+this.position+e;var i=this._buffer.byteLength;if(t<=i){if(t>this._byteLength){this._byteLength=t}return}if(i<1){i=1}while(t>i){i*=2}var r=new ArrayBuffer(i);var n=new Uint8Array(this._buffer);var a=new Uint8Array(r,0,n.length);a.set(n);this.buffer=r;this._byteLength=t};r.prototype._trimAlloc=function(){if(this._byteLength==this._buffer.byteLength){return}var e=new ArrayBuffer(this._byteLength);var t=new Uint8Array(e);var i=new Uint8Array(this._buffer,0,t.length);t.set(i);this.buffer=e};r.prototype.shift=function(e){var t=new ArrayBuffer(this._byteLength-e);var i=new Uint8Array(t);var r=new Uint8Array(this._buffer,e,i.length);i.set(r);this.buffer=t;this.position-=e};r.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t};r.prototype.isEof=function(){return this.position>=this._byteLength};r.prototype.mapInt32Array=function(e,t){this._realloc(e*4);var i=new Int32Array(this._buffer,this.byteOffset+this.position,e);r.arrayToNative(i,t==null?this.endianness:t);this.position+=e*4;return i};r.prototype.mapInt16Array=function(e,t){this._realloc(e*2);var i=new Int16Array(this._buffer,this.byteOffset+this.position,e);r.arrayToNative(i,t==null?this.endianness:t);this.position+=e*2;return i};r.prototype.mapInt8Array=function(e){this._realloc(e*1);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);this.position+=e*1;return t};r.prototype.mapUint32Array=function(e,t){this._realloc(e*4);var i=new Uint32Array(this._buffer,this.byteOffset+this.position,e);r.arrayToNative(i,t==null?this.endianness:t);this.position+=e*4;return i};r.prototype.mapUint16Array=function(e,t){this._realloc(e*2);var i=new Uint16Array(this._buffer,this.byteOffset+this.position,e);r.arrayToNative(i,t==null?this.endianness:t);this.position+=e*2;return i};r.prototype.mapUint8Array=function(e){this._realloc(e*1);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);this.position+=e*1;return t};r.prototype.mapFloat64Array=function(e,t){this._realloc(e*8);var i=new Float64Array(this._buffer,this.byteOffset+this.position,e);r.arrayToNative(i,t==null?this.endianness:t);this.position+=e*8;return i};r.prototype.mapFloat32Array=function(e,t){this._realloc(e*4);var i=new Float32Array(this._buffer,this.byteOffset+this.position,e);r.arrayToNative(i,t==null?this.endianness:t);this.position+=e*4;return i};r.prototype.readInt32Array=function(e,t){e=e==null?this.byteLength-this.position/4:e;var i=new Int32Array(e);r.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT);r.arrayToNative(i,t==null?this.endianness:t);this.position+=i.byteLength;return i};r.prototype.readInt16Array=function(e,t){e=e==null?this.byteLength-this.position/2:e;var i=new Int16Array(e);r.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT);r.arrayToNative(i,t==null?this.endianness:t);this.position+=i.byteLength;return i};r.prototype.readInt8Array=function(e){e=e==null?this.byteLength-this.position:e;var t=new Int8Array(e);r.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT);this.position+=t.byteLength;return t};r.prototype.readUint32Array=function(e,t){e=e==null?this.byteLength-this.position/4:e;var i=new Uint32Array(e);r.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT);r.arrayToNative(i,t==null?this.endianness:t);this.position+=i.byteLength;return i};r.prototype.readUint16Array=function(e,t){e=e==null?this.byteLength-this.position/2:e;var i=new Uint16Array(e);r.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT);r.arrayToNative(i,t==null?this.endianness:t);this.position+=i.byteLength;return i};r.prototype.readUint8Array=function(e){e=e==null?this.byteLength-this.position:e;var t=new Uint8Array(e);r.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT);this.position+=t.byteLength;return t};r.prototype.readFloat64Array=function(e,t){e=e==null?this.byteLength-this.position/8:e;var i=new Float64Array(e);r.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT);r.arrayToNative(i,t==null?this.endianness:t);this.position+=i.byteLength;return i};r.prototype.readFloat32Array=function(e,t){e=e==null?this.byteLength-this.position/4:e;var i=new Float32Array(e);r.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT);r.arrayToNative(i,t==null?this.endianness:t);this.position+=i.byteLength;return i};r.prototype.writeInt32Array=function(e,t){this._realloc(e.length*4);if(e instanceof Int32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0){r.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength);this.mapInt32Array(e.length,t)}else{for(var i=0;i<e.length;i++){this.writeInt32(e[i],t)}}};r.prototype.writeInt16Array=function(e,t){this._realloc(e.length*2);if(e instanceof Int16Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0){r.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength);this.mapInt16Array(e.length,t)}else{for(var i=0;i<e.length;i++){this.writeInt16(e[i],t)}}};r.prototype.writeInt8Array=function(e){this._realloc(e.length*1);if(e instanceof Int8Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0){r.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength);this.mapInt8Array(e.length)}else{for(var t=0;t<e.length;t++){this.writeInt8(e[t])}}};r.prototype.writeUint32Array=function(e,t){this._realloc(e.length*4);if(e instanceof Uint32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0){r.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength);this.mapUint32Array(e.length,t)}else{for(var i=0;i<e.length;i++){this.writeUint32(e[i],t)}}};r.prototype.writeUint16Array=function(e,t){this._realloc(e.length*2);if(e instanceof Uint16Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0){r.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength);this.mapUint16Array(e.length,t)}else{for(var i=0;i<e.length;i++){this.writeUint16(e[i],t)}}};r.prototype.writeUint8Array=function(e){this._realloc(e.length*1);if(e instanceof Uint8Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0){r.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength);this.mapUint8Array(e.length)}else{for(var t=0;t<e.length;t++){this.writeUint8(e[t])}}};r.prototype.writeFloat64Array=function(e,t){this._realloc(e.length*8);if(e instanceof Float64Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0){r.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength);this.mapFloat64Array(e.length,t)}else{for(var i=0;i<e.length;i++){this.writeFloat64(e[i],t)}}};r.prototype.writeFloat32Array=function(e,t){this._realloc(e.length*4);if(e instanceof Float32Array&&this.byteOffset+this.position%e.BYTES_PER_ELEMENT===0){r.memcpy(this._buffer,this.byteOffset+this.position,e.buffer,0,e.byteLength);this.mapFloat32Array(e.length,t)}else{for(var i=0;i<e.length;i++){this.writeFloat32(e[i],t)}}};r.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,e==null?this.endianness:e);this.position+=4;return t};r.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,e==null?this.endianness:e);this.position+=2;return t};r.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);this.position+=1;return e};r.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,e==null?this.endianness:e);this.position+=4;return t};r.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,e==null?this.endianness:e);this.position+=2;return t};r.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);this.position+=1;return e};r.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,e==null?this.endianness:e);this.position+=4;return t};r.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,e==null?this.endianness:e);this.position+=8;return t};r.prototype.writeInt32=function(e,t){this._realloc(4);this._dataView.setInt32(this.position,e,t==null?this.endianness:t);this.position+=4};r.prototype.writeInt16=function(e,t){this._realloc(2);this._dataView.setInt16(this.position,e,t==null?this.endianness:t);this.position+=2};r.prototype.writeInt8=function(e){this._realloc(1);this._dataView.setInt8(this.position,e);this.position+=1};r.prototype.writeUint32=function(e,t){this._realloc(4);this._dataView.setUint32(this.position,e,t==null?this.endianness:t);this.position+=4};r.prototype.writeUint16=function(e,t){this._realloc(2);this._dataView.setUint16(this.position,e,t==null?this.endianness:t);this.position+=2};r.prototype.writeUint8=function(e){this._realloc(1);this._dataView.setUint8(this.position,e);this.position+=1};r.prototype.writeFloat32=function(e,t){this._realloc(4);this._dataView.setFloat32(this.position,e,t==null?this.endianness:t);this.position+=4};r.prototype.writeFloat64=function(e,t){this._realloc(8);this._dataView.setFloat64(this.position,e,t==null?this.endianness:t);this.position+=8};r.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0;r.memcpy=function(e,t,i,r,n){var a=new Uint8Array(e,t,n);var s=new Uint8Array(i,r,n);a.set(s)};r.arrayToNative=function(e,t){if(t==this.endianness){return e}else{return this.flipArrayEndianness(e)}};r.nativeToEndian=function(e,t){if(this.endianness==t){return e}else{return this.flipArrayEndianness(e)}};r.flipArrayEndianness=function(e){var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);for(var i=0;i<e.byteLength;i+=e.BYTES_PER_ELEMENT){for(var r=i+e.BYTES_PER_ELEMENT-1,n=i;r>n;r--,n++){var a=t[n];t[n]=t[r];t[r]=a}}return e};r.prototype.failurePosition=0;r.prototype.readStruct=function(e){var t={},i,r,n;var a=this.position;for(var s=0;s<e.length;s+=2){i=e[s+1];r=this.readType(i,t);if(r==null){if(this.failurePosition===0){this.failurePosition=this.position}this.position=a;return null}t[e[s]]=r}return t};r.prototype.readUCS2String=function(e,t){return String.fromCharCode.apply(null,this.readUint16Array(e,t))};r.prototype.writeUCS2String=function(e,t,i){if(i==null){i=e.length}for(var r=0;r<e.length&&r<i;r++){this.writeUint16(e.charCodeAt(r),t)}for(;r<i;r++){this.writeUint16(0)}};r.prototype.readString=function(e,t){if(t==null||t=="ASCII"){return String.fromCharCode.apply(null,this.mapUint8Array(e==null?this.byteLength-this.position:e))}else{return new TextDecoder(t).decode(this.mapUint8Array(e))}};r.prototype.writeString=function(e,t,i){var r=0;if(t==null||t=="ASCII"){if(i!=null){var n=Math.min(e.length,i);for(r=0;r<n;r++){this.writeUint8(e.charCodeAt(r))}for(;r<i;r++){this.writeUint8(0)}}else{for(r=0;r<e.length;r++){this.writeUint8(e.charCodeAt(r))}}}else{this.writeUint8Array(new TextEncoder(t).encode(e.substring(0,i)))}};r.prototype.readCString=function(e){var t=this.byteLength-this.position;var i=new Uint8Array(this._buffer,this._byteOffset+this.position);var r=t;if(e!=null){r=Math.min(e,t)}for(var n=0;n<r&&i[n]!==0;n++);var a=String.fromCharCode.apply(null,this.mapUint8Array(n));if(e!=null){this.position+=r-n}else if(n!=t){this.position+=1}return a};r.prototype.writeCString=function(e,t){var i=0;if(t!=null){var r=Math.min(e.length,t);for(i=0;i<r;i++){this.writeUint8(e.charCodeAt(i))}for(;i<t;i++){this.writeUint8(0)}}else{for(i=0;i<e.length;i++){this.writeUint8(e.charCodeAt(i))}this.writeUint8(0)}};r.prototype.readType=function(e,t){if(typeof e=="function"){return e(this,t)}else if(typeof e=="object"&&!(e instanceof Array)){return e.get(this,t)}else if(e instanceof Array&&e.length!=3){return this.readStruct(e,t)}var i=null;var n=null;var a="ASCII";var s=this.position;var o;var f;var l;if(typeof e=="string"&&/:/.test(e)){o=e.split(":");e=o[0];n=parseInt(o[1])}if(typeof e=="string"&&/,/.test(e)){o=e.split(",");e=o[0];a=parseInt(o[1])}switch(e){case"uint8":i=this.readUint8();break;case"int8":i=this.readInt8();break;case"uint16":i=this.readUint16(this.endianness);break;case"int16":i=this.readInt16(this.endianness);break;case"uint32":i=this.readUint32(this.endianness);break;case"int32":i=this.readInt32(this.endianness);break;case"float32":i=this.readFloat32(this.endianness);break;case"float64":i=this.readFloat64(this.endianness);break;case"uint16be":i=this.readUint16(r.BIG_ENDIAN);break;case"int16be":i=this.readInt16(r.BIG_ENDIAN);break;case"uint32be":i=this.readUint32(r.BIG_ENDIAN);break;case"int32be":i=this.readInt32(r.BIG_ENDIAN);break;case"float32be":i=this.readFloat32(r.BIG_ENDIAN);break;case"float64be":i=this.readFloat64(r.BIG_ENDIAN);break;case"uint16le":i=this.readUint16(r.LITTLE_ENDIAN);break;case"int16le":i=this.readInt16(r.LITTLE_ENDIAN);break;case"uint32le":i=this.readUint32(r.LITTLE_ENDIAN);break;case"int32le":i=this.readInt32(r.LITTLE_ENDIAN);break;case"float32le":i=this.readFloat32(r.LITTLE_ENDIAN);break;case"float64le":i=this.readFloat64(r.LITTLE_ENDIAN);break;case"cstring":i=this.readCString(n);break;case"string":i=this.readString(n,a);break;case"u16string":i=this.readUCS2String(n,this.endianness);break;case"u16stringle":i=this.readUCS2String(n,r.LITTLE_ENDIAN);break;case"u16stringbe":i=this.readUCS2String(n,r.BIG_ENDIAN);break;default:if(e.length==3){var c=e[1];var u=e[2];var p=0;if(typeof u=="function"){p=u(t,this,e)}else if(typeof u=="string"&&t[u]!=null){p=parseInt(t[u])}else{p=parseInt(u)}if(typeof c=="string"){var h=c.replace(/(le|be)$/,"");var d=null;if(/le$/.test(c)){d=r.LITTLE_ENDIAN}else if(/be$/.test(c)){d=r.BIG_ENDIAN}if(u=="*"){p=null}switch(h){case"uint8":i=this.readUint8Array(p);break;case"uint16":i=this.readUint16Array(p,d);break;case"uint32":i=this.readUint32Array(p,d);break;case"int8":i=this.readInt8Array(p);break;case"int16":i=this.readInt16Array(p,d);break;case"int32":i=this.readInt32Array(p,d);break;case"float32":i=this.readFloat32Array(p,d);break;case"float64":i=this.readFloat64Array(p,d);break;case"cstring":case"utf16string":case"string":if(p==null){i=[];while(!this.isEof()){l=this.readType(c,t);if(l==null)break;i.push(l)}}else{i=new Array(p);for(f=0;f<p;f++){i[f]=this.readType(c,t)}}break}}else{if(u=="*"){i=[];var m=this.buffer;while(true){var v=this.position;try{var g=this.readType(c,t);if(g==null){this.position=v;break}i.push(g)}catch(_){this.position=v;break}}}else{i=new Array(p);for(f=0;f<p;f++){l=this.readType(c,t);if(l==null)return null;i[f]=l}}}break}}if(n!=null){this.position=s+n}return i};r.prototype.writeStruct=function(e,t){for(var i=0;i<e.length;i+=2){var r=e[i+1];this.writeType(r,t[e[i]],t)}};r.prototype.writeType=function(e,t,i){var n;if(typeof e=="function"){return e(this,t)}else if(typeof e=="object"&&!(e instanceof Array)){return e.set(this,t,i)}var a=null;var s="ASCII";var o=this.position;if(typeof e=="string"&&/:/.test(e)){n=e.split(":");e=n[0];a=parseInt(n[1])}if(typeof e=="string"&&/,/.test(e)){n=e.split(",");e=n[0];s=parseInt(n[1])}switch(e){case"uint8":this.writeUint8(t);break;case"int8":this.writeInt8(t);break;case"uint16":this.writeUint16(t,this.endianness);break;case"int16":this.writeInt16(t,this.endianness);break;case"uint32":this.writeUint32(t,this.endianness);break;case"int32":this.writeInt32(t,this.endianness);break;case"float32":this.writeFloat32(t,this.endianness);break;case"float64":this.writeFloat64(t,this.endianness);break;case"uint16be":this.writeUint16(t,r.BIG_ENDIAN);break;case"int16be":this.writeInt16(t,r.BIG_ENDIAN);break;case"uint32be":this.writeUint32(t,r.BIG_ENDIAN);break;case"int32be":this.writeInt32(t,r.BIG_ENDIAN);break;case"float32be":this.writeFloat32(t,r.BIG_ENDIAN);break;case"float64be":this.writeFloat64(t,r.BIG_ENDIAN);break;case"uint16le":this.writeUint16(t,r.LITTLE_ENDIAN);break;case"int16le":this.writeInt16(t,r.LITTLE_ENDIAN);break;case"uint32le":this.writeUint32(t,r.LITTLE_ENDIAN);break;case"int32le":this.writeInt32(t,r.LITTLE_ENDIAN);break;case"float32le":this.writeFloat32(t,r.LITTLE_ENDIAN);break;case"float64le":this.writeFloat64(t,r.LITTLE_ENDIAN);break;case"cstring":this.writeCString(t,a);break;case"string":this.writeString(t,s,a);break;case"u16string":this.writeUCS2String(t,this.endianness,a);break;case"u16stringle":this.writeUCS2String(t,r.LITTLE_ENDIAN,a);break;case"u16stringbe":this.writeUCS2String(t,r.BIG_ENDIAN,a);break;default:if(e.length==3){var f=e[1];for(var l=0;l<t.length;l++){this.writeType(f,t[l])}break}else{this.writeStruct(e,t);break}}if(a!=null){this.position=o;this._realloc(a);this.position=o+a}};var n=Math.pow(2,32);i.MAX_SIZE=n;r.prototype.readUint64=function(){return this.readUint32()*n+this.readUint32()};r.prototype.writeUint64=function(e){var t=Math.floor(e/n);this.writeUint32(t);this.writeUint32(e&4294967295)};r.prototype.readUint24=function(){return(this.readUint8()<<16)+(this.readUint8()<<8)+this.readUint8()};r.prototype.writeUint24=function(e){this.writeUint8((e&16711680)>>16);this.writeUint8((e&65280)>>8);this.writeUint8(e&255)};r.prototype.adjustUint32=function(e,t){var i=this.position;this.seek(e);this.writeUint32(t);this.seek(i)}},{}],65:[function(e,t,r){var n=e("./DataStream");var a=e("./descriptor");var s=e("./log");var o={ERR_NOT_ENOUGH_DATA:0,OK:1,boxCodes:["mdat","avcC","hvcC","ftyp","payl","vmhd","smhd","hmhd","dref","elst"],fullBoxCodes:["mvhd","tkhd","mdhd","hdlr","smhd","hmhd","nhmd","url ","urn ","ctts","cslg","stco","co64","stsc","stss","stsz","stz2","stts","stsh","mehd","trex","mfhd","tfhd","trun","tfdt","esds","subs","txtC"],containerBoxCodes:[["moov",["trak"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl"],["mvex",["trex"]],["moof",["traf"]],["traf",["trun"]],["vttc"],["tref"]],sampleEntryCodes:[{prefix:"Visual",types:["mp4v","avc1","avc2","avc3","avc4","avcp","drac","encv","mjp2","mvc1","mvc2","resv","s263","svc1","vc-1","hvc1","hev1"]},{prefix:"Audio",types:["mp4a","ac-3","alac","dra1","dtsc","dtse",,"dtsh","dtsl","ec-3","enca","g719","g726","m4ae","mlpa","raw ","samr","sawb","sawp","sevc","sqcp","ssmv","twos"]
+},{prefix:"Hint",types:["fdp ","m2ts","pm2t","prtp","rm2t","rrtp","rsrp","rtp ","sm2t","srtp"]},{prefix:"Metadata",types:["metx","mett","urim"]},{prefix:"Subtitle",types:["stpp","wvtt","sbtt","tx3g","stxt"]}],trackReferenceTypes:["scal"],initialize:function(){var e,t;var i;o.FullBox.prototype=new o.Box;o.ContainerBox.prototype=new o.Box;o.stsdBox.prototype=new o.FullBox;o.SampleEntry.prototype=new o.FullBox;o.TrackReferenceTypeBox.prototype=new o.Box;i=o.boxCodes.length;for(e=0;e<i;e++){o[o.boxCodes[e]+"Box"]=function(e){return function(t){o.Box.call(this,o.boxCodes[e],t)}}(e);o[o.boxCodes[e]+"Box"].prototype=new o.Box}i=o.fullBoxCodes.length;for(e=0;e<i;e++){o[o.fullBoxCodes[e]+"Box"]=function(e){return function(t){o.FullBox.call(this,o.fullBoxCodes[e],t)}}(e);o[o.fullBoxCodes[e]+"Box"].prototype=new o.FullBox}i=o.containerBoxCodes.length;for(e=0;e<i;e++){o[o.containerBoxCodes[e][0]+"Box"]=function(e,t){return function(i){o.ContainerBox.call(this,o.containerBoxCodes[e][0],i);if(t){this.subBoxNames=t;var r=t.length;for(var n=0;n<r;n++){this[t[n]+"s"]=[]}}}}(e,o.containerBoxCodes[e][1]);o[o.containerBoxCodes[e][0]+"Box"].prototype=new o.ContainerBox}i=o.sampleEntryCodes.length;for(t=0;t<i;t++){var r=o.sampleEntryCodes[t].prefix;var n=o.sampleEntryCodes[t].types;var a=n.length;o[r+"SampleEntry"]=function(e,t){o.SampleEntry.call(this,e,t)};o[r+"SampleEntry"].prototype=new o.SampleEntry;for(e=0;e<a;e++){o[n[e]+"Box"]=function(e,t){return function(i){o[o.sampleEntryCodes[e].prefix+"SampleEntry"].call(this,o.sampleEntryCodes[e].types[t],i)}}(t,e);o[n[e]+"Box"].prototype=new o[r+"SampleEntry"]}}i=o.trackReferenceTypes.length;for(e=0;e<i;e++){o[o.trackReferenceTypes[e]+"Box"]=function(e){return function(t){o.TrackReferenceTypeBox.call(this,o.trackReferenceTypes[e],t)}}(e);o[o.trackReferenceTypes[e]+"Box"].prototype=new o.Box}},Box:function(e,t){this.type=e;this.size=t},FullBox:function(e,t){o.Box.call(this,e,t);this.flags=0;this.version=0},ContainerBox:function(e,t){o.Box.call(this,e,t);this.boxes=[]},SampleEntry:function(e,t){o.Box.call(this,e,t);this.boxes=[]},TrackReferenceTypeBox:function(e,t){o.Box.call(this,e,t);this.track_ids=[]},stsdBox:function(e){o.FullBox.call(this,"stsd",e);this.entries=[]},parseOneBox:function(e,t){var i;var r=e.position;var n=0;if(e.byteLength-e.position<8){s.d("BoxParser","Not enough data in stream to parse the type and size of the box");return{code:o.ERR_NOT_ENOUGH_DATA}}var a=e.readUint32();var f=e.readString(4);s.d("BoxParser","Found box of type "+f+" and size "+a+" at position "+r+" in the current buffer ("+(e.buffer.fileStart+r)+" in the file)");n=8;if(a==1){if(e.byteLength-e.position<8){e.seek(r);s.w("BoxParser",'Not enough data in stream to parse the extended size of the "'+f+'" box');return{code:o.ERR_NOT_ENOUGH_DATA}}a=e.readUint64();n+=8}else if(a===0){throw"Unlimited box size not supported"}if(r+a>e.byteLength){e.seek(r);s.w("BoxParser",'Not enough data in stream to parse the entire "'+f+'" box');return{code:o.ERR_NOT_ENOUGH_DATA,type:f,size:a,hdr_size:n}}if(o[f+"Box"]){i=new o[f+"Box"](a-n)}else{if(t){i=new o.SampleEntry(f,a-n)}else{i=new o.Box(f,a-n)}}i.hdr_size=n;i.start=r;i.fileStart=r+e.buffer.fileStart;i.parse(e);e.seek(r+a);return{code:o.OK,box:i,size:a}}};t.exports=o;o.initialize();o.Box.prototype.parse=function(e){if(this.type!="mdat"){this.data=e.readUint8Array(this.size)}else{e.seek(this.start+this.size+this.hdr_size)}};o.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8();this.flags=e.readUint24();this.size-=4};o.ContainerBox.prototype.parse=function(e){var t;var i;var r;r=e.position;while(e.position<r+this.size){t=o.parseOneBox(e);i=t.box;this.boxes.push(i);if(this.subBoxNames&&this.subBoxNames.indexOf(i.type)!=-1){this[this.subBoxNames+"s"].push(i)}else{this[i.type]=i}}};o.SampleEntry.prototype.isVideo=function(){return false};o.SampleEntry.prototype.isAudio=function(){return false};o.SampleEntry.prototype.isSubtitle=function(){return false};o.SampleEntry.prototype.isMetadata=function(){return false};o.SampleEntry.prototype.isHint=function(){return false};o.SampleEntry.prototype.getCodec=function(){return this.type};o.SampleEntry.prototype.getWidth=function(){return""};o.SampleEntry.prototype.getHeight=function(){return""};o.SampleEntry.prototype.getChannelCount=function(){return""};o.SampleEntry.prototype.getSampleRate=function(){return""};o.SampleEntry.prototype.getSampleSize=function(){return""};o.SampleEntry.prototype.parseHeader=function(e){this.start=e.position;e.readUint8Array(6);this.data_reference_index=e.readUint16()};o.SampleEntry.prototype.parse=function(e){this.parseHeader(e);e.seek(this.start+this.size)};o.SampleEntry.prototype.parseFooter=function(e){var t;var i;while(e.position<this.start+this.size){t=o.parseOneBox(e,false);i=t.box;this.boxes.push(i);this[i.type]=i}};o.VisualSampleEntry.prototype.parse=function(e){this.parseHeader(e);e.readUint16();e.readUint16();e.readUint32Array(3);this.width=e.readUint16();this.height=e.readUint16();this.horizresolution=e.readUint32();this.vertresolution=e.readUint32();e.readUint32();this.frame_count=e.readUint16();this.compressorname=e.readString(32);this.depth=e.readUint16();e.readUint16();this.parseFooter(e)};o.VisualSampleEntry.prototype.isVideo=function(){return true};o.VisualSampleEntry.prototype.getWidth=function(){return this.width};o.VisualSampleEntry.prototype.getHeight=function(){return this.height};o.AudioSampleEntry.prototype.parse=function(e){this.parseHeader(e);e.readUint32Array(2);this.channel_count=e.readUint16();this.samplesize=e.readUint16();e.readUint16();e.readUint16();this.samplerate=e.readUint32()/(1<<16);this.parseFooter(e)};o.AudioSampleEntry.prototype.isAudio=function(){return true};o.AudioSampleEntry.prototype.getChannelCount=function(){return this.channel_count};o.AudioSampleEntry.prototype.getSampleRate=function(){return this.samplerate};o.AudioSampleEntry.prototype.getSampleSize=function(){return this.samplesize};o.SubtitleSampleEntry.prototype.parse=function(e){this.parseHeader(e);this.parseFooter(e)};o.SubtitleSampleEntry.prototype.isSubtitle=function(){return true};o.MetadataSampleEntry.prototype.parse=function(e){this.parseHeader(e);this.parseFooter(e)};o.MetadataSampleEntry.prototype.isMetadata=function(){return true};o.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint8Array(this.size)};o.metxBox.prototype.parse=function(e){this.parseHeader(e);this.content_encoding=e.readCString();this.namespace=e.readCString();this.schema_location=e.readCString();this.parseFooter(e)};o.mettBox.prototype.parse=function(e){this.parseHeader(e);this.content_encoding=e.readCString();this.mime_format=e.readCString();this.parseFooter(e)};o.sbttBox.prototype.parse=function(e){this.parseHeader(e);this.content_encoding=e.readCString();this.mime_format=e.readCString();this.parseFooter(e)};o.stxtBox.prototype.parse=function(e){this.parseHeader(e);this.content_encoding=e.readCString();this.mime_format=e.readCString();this.parseFooter(e)};o.stppBox.prototype.parse=function(e){this.parseHeader(e);this.namespace=e.readCString();this.schema_location=e.readCString();this.auxiliary_mime_types=e.readCString();this.parseFooter(e)};o.tx3gBox.prototype.parse=function(e){this.parseHeader(e);this.displayFlags=e.readUint32();this.horizontal_justification=e.readInt8();this.vertical_justification=e.readInt8();this.bg_color_rgba=e.readUint8Array(4);this.box_record=e.readInt16Array(4);this.style_record=e.readUint8Array(12);this.parseFooter(e)};o.ftypBox.prototype.parse=function(e){this.major_brand=e.readString(4);this.minor_version=e.readUint32();this.size-=8;this.compatible_brands=[];var t=0;while(this.size>=4){this.compatible_brands[t]=e.readString(4);this.size-=4;t++}};o.mvhdBox.prototype.parse=function(e){this.flags=0;this.parseFullHeader(e);if(this.version==1){this.creation_time=e.readUint64();this.modification_time=e.readUint64();this.timescale=e.readUint32();this.duration=e.readUint64()}else{this.creation_time=e.readUint32();this.modification_time=e.readUint32();this.timescale=e.readUint32();this.duration=e.readUint32()}this.rate=e.readUint32();this.volume=e.readUint16()>>8;e.readUint16();e.readUint32Array(2);this.matrix=e.readUint32Array(9);e.readUint32Array(6);this.next_track_id=e.readUint32()};o.TKHD_FLAG_ENABLED=1;o.TKHD_FLAG_IN_MOVIE=2;o.TKHD_FLAG_IN_PREVIEW=4;o.tkhdBox.prototype.parse=function(e){this.parseFullHeader(e);if(this.version==1){this.creation_time=e.readUint64();this.modification_time=e.readUint64();this.track_id=e.readUint32();e.readUint32();this.duration=e.readUint64()}else{this.creation_time=e.readUint32();this.modification_time=e.readUint32();this.track_id=e.readUint32();e.readUint32();this.duration=e.readUint32()}e.readUint32Array(2);this.layer=e.readInt16();this.alternate_group=e.readInt16();this.volume=e.readInt16()>>8;e.readUint16();this.matrix=e.readInt32Array(9);this.width=e.readUint32();this.height=e.readUint32()};o.mdhdBox.prototype.parse=function(e){this.parseFullHeader(e);if(this.version==1){this.creation_time=e.readUint64();this.modification_time=e.readUint64();this.timescale=e.readUint32();this.duration=e.readUint64()}else{this.creation_time=e.readUint32();this.modification_time=e.readUint32();this.timescale=e.readUint32();this.duration=e.readUint32()}this.language=e.readUint16();var t=[];t[0]=this.language>>10&31;t[1]=this.language>>5&31;t[2]=this.language&31;this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96);e.readUint16()};o.hdlrBox.prototype.parse=function(e){this.parseFullHeader(e);if(this.version===0){e.readUint32();this.handler=e.readString(4);e.readUint32Array(3);this.name=e.readCString()}else{this.data=e.readUint8Array(size)}};o.stsdBox.prototype.parse=function(e){var t;var r;this.parseFullHeader(e);r=e.readUint32();for(i=1;i<=r;i++){t=o.parseOneBox(e,true);this.entries.push(t.box)}};o.avcCBox.prototype.parse=function(e){var t;var i;var r;this.configurationVersion=e.readUint8();this.AVCProfileIndication=e.readUint8();this.profile_compatibility=e.readUint8();this.AVCLevelIndication=e.readUint8();this.lengthSizeMinusOne=e.readUint8()&3;i=e.readUint8()&31;this.size-=6;this.SPS=new Array(i);for(t=0;t<i;t++){r=e.readUint16();this.SPS[t]=e.readUint8Array(r);this.size-=2+r}i=e.readUint8();this.size--;this.PPS=new Array(i);for(t=0;t<i;t++){r=e.readUint16();this.PPS[t]=e.readUint8Array(r);this.size-=2+r}if(this.size>0){this.ext=e.readUint8Array(this.size)}};o.hvcCBox.prototype.parse=function(e){var t;var i;var r;var n;this.configurationVersion=e.readUint8();n=e.readUint8();this.general_profile_space=n>>6;this.general_tier_flag=(n&32)>>5;this.general_profile_idc=n&31;this.general_profile_compatibility=e.readUint32();this.general_constraint_indicator=e.readUint8Array(6);this.general_level_idc=e.readUint8();this.min_spatial_segmentation_idc=e.readUint16()&4095;this.parallelismType=e.readUint8()&3;this.chromaFormat=e.readUint8()&3;this.bitDepthLumaMinus8=e.readUint8()&7;this.bitDepthChromaMinus8=e.readUint8()&7;this.avgFrameRate=e.readUint16();n=e.readUint8();this.constantFrameRate=n>>6;this.numTemporalLayers=(n&13)>>3;this.temporalIdNested=(n&4)>>2;this.lengthSizeMinusOne=n&3;this.nalu_arrays=[];numOfArrays=e.readUint8();for(t=0;t<numOfArrays;t++){var a=[];this.nalu_arrays.push(a);n=e.readUint8();a.completeness=(n&128)>>7;a.nalu_type=n&63;numNalus=e.readUint16();for(j=0;j<numNalus;j++){var s={};a.push(s);r=e.readUint16();s.data=e.readUint8Array(r)}}};function f(e,t){var i=Number(e).toString(16);t=typeof t==="undefined"||t===null?t=2:t;while(i.length<t){i="0"+i}return i}o.avc1Box.prototype.getCodec=function(){var e=o.SampleEntry.prototype.getCodec.call(this);if(this.avcC){return e+"."+f(this.avcC.AVCProfileIndication)+""+f(this.avcC.profile_compatibility)+""+f(this.avcC.AVCLevelIndication)}else{return e}};o.hvc1Box.prototype.getCodec=function(){var e;var t=o.SampleEntry.prototype.getCodec.call(this);if(this.hvcC){t+=".";switch(this.hvcC.general_profile_space){case 0:t+="";break;case 1:t+="A";break;case 2:t+="B";break;case 3:t+="C";break}t+=this.hvcC.general_profile_idc;t+=".";var i=this.hvcC.general_profile_compatibility;var r=0;for(e=0;e<32;e++){r|=i&1;if(e==31)break;r<<=1;i>>=1}t+=f(r,0);t+=".";if(this.hvcC.general_tier_flag===0){t+="L"}else{t+="H"}t+=this.hvcC.general_level_idc;var n=false;var a="";for(e=5;e>=0;e--){if(this.hvcC.general_constraint_indicator[e]||n){a="."+f(this.hvcC.general_constraint_indicator[e],0)+a;n=true}}t+=a}return t};o.mp4aBox.prototype.getCodec=function(){var e=o.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI();var i=this.esds.esd.getAudioConfig();return e+"."+f(t)+(i?"."+i:"")}else{return e}};o.esdsBox.prototype.parse=function(e){this.parseFullHeader(e);this.data=e.readUint8Array(this.size);this.size=0;var t=new a;this.esd=t.parseOneDescriptor(new n(this.data.buffer,0,n.BIG_ENDIAN))};o.txtCBox.prototype.parse=function(e){this.parseFullHeader(e);this.config=e.readCString()};o.cttsBox.prototype.parse=function(e){var t;var i;this.parseFullHeader(e);t=e.readUint32();this.sample_counts=[];this.sample_offsets=[];if(this.version===0){for(i=0;i<t;i++){this.sample_counts.push(e.readUint32());this.sample_offsets.push(e.readInt32())}}else if(this.version==1){for(i=0;i<t;i++){this.sample_counts.push(e.readUint32());this.sample_offsets.push(e.readInt32())}}else{this.data=e.readUint8Array(this.size-4)}};o.cttsBox.prototype.unpack=function(e){var t,i,r;r=0;for(t=0;t<this.sample_counts.length;t++){for(i=0;i<this.sample_counts[t];i++){e[r].pts=e[r].dts+this.sample_offsets[t];r++}}};o.cslgBox.prototype.parse=function(e){var t;this.parseFullHeader(e);if(this.version===0){this.compositionToDTSShift=e.readInt32();this.leastDecodeToDisplayDelta=e.readInt32();this.greatestDecodeToDisplayDelta=e.readInt32();this.compositionStartTime=e.readInt32();this.compositionEndTime=e.readInt32()}else{this.data=e.readUint8Array(this.size-4)}};o.sttsBox.prototype.parse=function(e){var t;var i;this.parseFullHeader(e);t=e.readUint32();this.sample_counts=[];this.sample_deltas=[];if(this.version===0){for(i=0;i<t;i++){this.sample_counts.push(e.readUint32());this.sample_deltas.push(e.readUint32())}}else{this.data=e.readUint8Array(this.size-4)}};o.sttsBox.prototype.unpack=function(e){var t,i,r;r=0;for(t=0;t<this.sample_counts.length;t++){for(i=0;i<this.sample_counts[t];i++){if(r===0){e[r].dts=0}else{e[r].dts=e[r-1].dts+this.sample_deltas[t]}r++}}};o.stssBox.prototype.parse=function(e){var t;this.parseFullHeader(e);t=e.readUint32();if(this.version===0){this.sample_numbers=e.readUint32Array(t)}else{this.data=e.readUint8Array(this.size-4)}};o.stshBox.prototype.parse=function(e){var t;var i;this.parseFullHeader(e);t=e.readUint32();this.shadowed_sample_numbers=[];this.sync_sample_numbers=[];if(this.version===0){for(i=0;i<t;i++){this.shadowed_sample_numbers.push(e.readUint32());this.sync_sample_numbers.push(e.readUint32())}}else{this.data=e.readUint8Array(this.size-4)}};o.stcoBox.prototype.parse=function(e){var t;this.parseFullHeader(e);t=e.readUint32();if(this.version===0){this.chunk_offsets=e.readUint32Array(t)}else{this.data=e.readUint8Array(this.size-4)}};o.stcoBox.prototype.unpack=function(e){var t;for(t=0;t<this.chunk_offsets.length;t++){e[t].offset=this.chunk_offsets[t]}};o.co64Box.prototype.parse=function(e){var t;var i;this.parseFullHeader(e);t=e.readUint32();this.chunk_offsets=[];if(this.version===0){for(i=0;i<t;i++){this.chunk_offsets.push(e.readUint64())}}else{this.data=e.readUint8Array(this.size-4)}};o.stscBox.prototype.parse=function(e){var t;var i;this.parseFullHeader(e);t=e.readUint32();this.first_chunk=[];this.samples_per_chunk=[];this.sample_description_index=[];if(this.version===0){for(i=0;i<t;i++){this.first_chunk.push(e.readUint32());this.samples_per_chunk.push(e.readUint32());this.sample_description_index.push(e.readUint32())}}else{this.data=e.readUint8Array(this.size-4)}};o.stscBox.prototype.unpack=function(e){var t,i,r,n,a;n=0;a=0;for(t=0;t<this.first_chunk.length;t++){for(i=0;i<(t+1<this.first_chunk.length?this.first_chunk[t+1]:Infinity);i++){a++;for(r=0;r<this.samples_per_chunk[t];r++){if(e[n]){e[n].description_index=this.sample_description_index[t];e[n].chunk_index=a}else{return}n++}}}};o.stszBox.prototype.parse=function(e){var t;var i;var r;this.parseFullHeader(e);this.sample_sizes=[];if(this.version===0){i=e.readUint32();r=e.readUint32();if(i===0){this.sample_sizes=e.readUint32Array(r)}else{this.sample_sizes=[];for(t=0;t<r;t++){this.sample_sizes[t]=i}}}else{this.data=e.readUint8Array(this.size)}};o.stszBox.prototype.unpack=function(e){var t;for(t=0;t<this.sample_sizes.length;t++){e[t].size=this.sample_sizes[t]}};o.mehdBox.prototype.parse=function(e){this.parseFullHeader(e);if(this.version==1){this.fragment_duration=e.readUint64()}else{this.fragment_duration=e.readUint32()}};o.trexBox.prototype.parse=function(e){this.parseFullHeader(e);this.track_id=e.readUint32();this.default_sample_description_index=e.readUint32();this.default_sample_duration=e.readUint32();this.default_sample_size=e.readUint32();this.default_sample_flags=e.readUint32()};o.mfhdBox.prototype.parse=function(e){this.parseFullHeader(e);this.sequence_number=e.readUint32()};o.TFHD_FLAG_BASE_DATA_OFFSET=1;o.TFHD_FLAG_SAMPLE_DESC=2;o.TFHD_FLAG_SAMPLE_DUR=8;o.TFHD_FLAG_SAMPLE_SIZE=16;o.TFHD_FLAG_SAMPLE_FLAGS=32;o.TFHD_FLAG_DUR_EMPTY=65536;o.TFHD_FLAG_DEFAULT_BASE_IS_MOOF=131072;o.tfhdBox.prototype.parse=function(e){var t=0;this.parseFullHeader(e);this.track_id=e.readUint32();if(this.size>t&&this.flags&o.TFHD_FLAG_BASE_DATA_OFFSET){this.base_data_offset=e.readUint64();t+=8}else{this.base_data_offset=0}if(this.size>t&&this.flags&o.TFHD_FLAG_SAMPLE_DESC){this.default_sample_description_index=e.readUint32();t+=4}else{this.default_sample_description_index=0}if(this.size>t&&this.flags&o.TFHD_FLAG_SAMPLE_DUR){this.default_sample_duration=e.readUint32();t+=4}else{this.default_sample_duration=0}if(this.size>t&&this.flags&o.TFHD_FLAG_SAMPLE_SIZE){this.default_sample_size=e.readUint32();t+=4}else{this.default_sample_size=0}if(this.size>t&&this.flags&o.TFHD_FLAG_SAMPLE_FLAGS){this.default_sample_flags=e.readUint32();t+=4}else{this.default_sample_flags=0}};o.TRUN_FLAGS_DATA_OFFSET=1;o.TRUN_FLAGS_FIRST_FLAG=4;o.TRUN_FLAGS_DURATION=256;o.TRUN_FLAGS_SIZE=512;o.TRUN_FLAGS_FLAGS=1024;o.TRUN_FLAGS_CTS_OFFSET=2048;o.trunBox.prototype.parse=function(e){var t=0;this.parseFullHeader(e);this.sample_count=e.readUint32();t+=4;if(this.size>t&&this.flags&o.TRUN_FLAGS_DATA_OFFSET){this.data_offset=e.readInt32();t+=4}else{this.data_offset=0}if(this.size>t&&this.flags&o.TRUN_FLAGS_FIRST_FLAG){this.first_sample_flags=e.readUint32();t+=4}else{this.first_sample_flags=0}this.sample_duration=[];this.sample_size=[];this.sample_flags=[];this.sample_composition_time_offset=[];if(this.size>t){for(var i=0;i<this.sample_count;i++){if(this.flags&o.TRUN_FLAGS_DURATION){this.sample_duration[i]=e.readUint32()}if(this.flags&o.TRUN_FLAGS_SIZE){this.sample_size[i]=e.readUint32()}if(this.flags&o.TRUN_FLAGS_FLAGS){this.sample_flags[i]=e.readUint32()}if(this.flags&o.TRUN_FLAGS_CTS_OFFSET){if(this.version===0){this.sample_composition_time_offset[i]=e.readUint32()}else{this.sample_composition_time_offset[i]=e.readInt32()}}}}};o.tfdtBox.prototype.parse=function(e){this.parseFullHeader(e);if(this.version==1){this.baseMediaDecodeTime=e.readUint64()}else{this.baseMediaDecodeTime=e.readUint32()}};o.paylBox.prototype.parse=function(e){this.text=e.readString(this.size)};o.subsBox.prototype.parse=function(e){var t,i;var r;var n;this.parseFullHeader(e);r=e.readUint32();this.samples=[];for(t=0;t<r;t++){var a={};this.samples[t]=a;a.sample_delta=e.readUint32();a.subsamples=[];n=e.readUint16();if(n>0){for(i=0;i<n;i++){var s={};a.subsamples.push(s);if(this.version==1){s.size=e.readUint32()}else{s.size=e.readUint16()}s.priority=e.readUint8();s.discardable=e.readUint8();s.reserved=e.readUint32()}}}};o.Box.prototype.writeHeader=function(e,t){this.size+=8;if(this.size>n.MAX_SIZE){this.size+=8}s.d("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.position+(t||""));if(this.size>n.MAX_SIZE){e.writeUint32(1)}else{this.sizePosition=e.position;e.writeUint32(this.size)}e.writeString(this.type,null,4);if(this.size>n.MAX_SIZE){e.writeUint64(this.size)}};o.FullBox.prototype.writeHeader=function(e){this.size+=4;o.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags);e.writeUint8(this.version);e.writeUint24(this.flags)};o.Box.prototype.write=function(e){if(this.type==="mdat"){if(this.data){this.size=this.data.length;this.writeHeader(e);e.writeUint8Array(this.data)}}else{this.size=this.data.length;this.writeHeader(e);e.writeUint8Array(this.data)}};o.ContainerBox.prototype.write=function(e){this.size=0;this.writeHeader(e);for(var t=0;t<this.boxes.length;t++){if(this.boxes[t]){this.boxes[t].write(e);this.size+=this.boxes[t].size}}s.d("BoxWriter","Adjusting box "+this.type+" with new size "+this.size);e.adjustUint32(this.sizePosition,this.size)};o.TrackReferenceTypeBox.prototype.write=function(e){this.size=this.track_ids.length*4;this.writeHeader(e);e.writeUint32Array(this.track_ids)};o.ftypBox.prototype.write=function(e){this.size=8+4*this.compatible_brands.length;this.writeHeader(e);e.writeString(this.major_brand,null,4);e.writeUint32(this.minor_version);for(var t=0;t<this.compatible_brands.length;t++){e.writeString(this.compatible_brands[t],null,4)}};o.mvhdBox.prototype.write=function(e){this.version=0;this.flags=0;this.size=23*4+2*2;this.writeHeader(e);e.writeUint32(this.creation_time);e.writeUint32(this.modification_time);e.writeUint32(this.timescale);e.writeUint32(this.duration);e.writeUint32(this.rate);e.writeUint16(this.volume<<8);e.writeUint16(0);e.writeUint32(0);e.writeUint32(0);e.writeUint32Array(this.matrix);e.writeUint32(0);e.writeUint32(0);e.writeUint32(0);e.writeUint32(0);e.writeUint32(0);e.writeUint32(0);e.writeUint32(this.next_track_id)};o.tkhdBox.prototype.write=function(e){this.version=0;this.size=4*18+2*4;this.writeHeader(e);e.writeUint32(this.creation_time);e.writeUint32(this.modification_time);e.writeUint32(this.track_id);e.writeUint32(0);e.writeUint32(this.duration);e.writeUint32(0);e.writeUint32(0);e.writeInt16(this.layer);e.writeInt16(this.alternate_group);e.writeInt16(this.volume<<8);e.writeUint16(0);e.writeInt32Array(this.matrix);e.writeUint32(this.width);e.writeUint32(this.height)};o.mdhdBox.prototype.write=function(e){this.size=4*4+2*2;this.flags=0;this.version=0;this.writeHeader(e);e.writeUint32(this.creation_time);e.writeUint32(this.modification_time);e.writeUint32(this.timescale);e.writeUint32(this.duration);e.writeUint16(this.language);e.writeUint16(0)};o.hdlrBox.prototype.write=function(e){this.size=5*4+this.name.length+1;this.version=0;this.flags=0;this.writeHeader(e);e.writeUint32(0);e.writeString(this.handler,null,4);e.writeUint32(0);e.writeUint32(0);e.writeUint32(0);e.writeCString(this.name)};o.stsdBox.prototype.write=function(e){var t;this.version=0;this.flags=0;this.size=0;this.writeHeader(e);e.writeUint32(this.entries.length);this.size+=4;for(t=0;t<this.entries.length;t++){this.entries[t].write(e);this.size+=this.entries[t].size}s.d("BoxWriter","Adjusting box "+this.type+" with new size "+this.size);e.adjustUint32(this.sizePosition,this.size)};o.SampleEntry.prototype.writeHeader=function(e){this.size=8;o.Box.prototype.writeHeader.call(this,e);e.writeUint8(0);e.writeUint8(0);e.writeUint8(0);e.writeUint8(0);e.writeUint8(0);e.writeUint8(0);e.writeUint16(this.data_reference_index)};o.SampleEntry.prototype.writeFooter=function(e){for(var t=0;t<this.boxes.length;t++){this.boxes[t].write(e);this.size+=this.boxes[t].size}s.d("BoxWriter","Adjusting box "+this.type+" with new size "+this.size);e.adjustUint32(this.sizePosition,this.size)};o.SampleEntry.prototype.write=function(e){this.writeHeader(e);this.writeFooter(e)};o.VisualSampleEntry.prototype.write=function(e){this.writeHeader(e);this.size+=2*7+6*4+32;e.writeUint16(0);e.writeUint16(0);e.writeUint32(0);e.writeUint32(0);e.writeUint32(0);e.writeUint16(this.width-this.width%2);e.writeUint16(this.height-this.height%2);e.writeUint32(this.horizresolution);e.writeUint32(this.vertresolution);e.writeUint32(0);e.writeUint16(this.frame_count);e.writeString(this.compressorname,null,32);e.writeUint16(this.depth);e.writeInt16(-1);this.writeFooter(e)};o.AudioSampleEntry.prototype.write=function(e){this.writeHeader(e);this.size+=2*4+3*4;e.writeUint32(0);e.writeUint32(0);e.writeUint16(this.channel_count);e.writeUint16(this.samplesize);e.writeUint16(0);e.writeUint16(0);e.writeUint32(this.samplerate<<16);this.writeFooter(e)};o.avcCBox.prototype.write=function(e){var t;this.size=7;for(t=0;t<this.SPS.length;t++){this.size+=2+this.SPS[t].length}for(t=0;t<this.PPS.length;t++){this.size+=2+this.PPS[t].length}if(this.ext){this.size+=this.ext.length}this.writeHeader(e);e.writeUint8(this.configurationVersion);e.writeUint8(this.AVCProfileIndication);e.writeUint8(this.profile_compatibility);e.writeUint8(this.AVCLevelIndication);e.writeUint8(this.lengthSizeMinusOne+(63<<2));e.writeUint8(this.SPS.length+(7<<5));for(t=0;t<this.SPS.length;t++){e.writeUint16(this.SPS[t].length);e.writeUint8Array(this.SPS[t])}e.writeUint8(this.PPS.length);for(t=0;t<this.PPS.length;t++){e.writeUint16(this.PPS[t].length);e.writeUint8Array(this.PPS[t])}if(this.ext){e.writeUint8Array(this.ext)}};o.cttsBox.prototype.write=function(e){var t;this.version=1;this.flags=0;this.size=4+8*this.sample_counts.length;this.writeHeader(e);e.writeUint32(this.sample_counts.length);for(t=0;t<this.sample_counts.length;t++){e.writeUint32(this.sample_counts[t]);e.writeInt32(this.sample_offsets[t])}};o.cslgBox.prototype.write=function(e){var t;this.version=0;this.flags=0;this.size=4*5;this.writeHeader(e);e.writeInt32(this.compositionToDTSShift);e.writeInt32(this.leastDecodeToDisplayDelta);e.writeInt32(this.greatestDecodeToDisplayDelta);e.writeInt32(this.compositionStartTime);e.writeInt32(this.compositionEndTime)};o.sttsBox.prototype.write=function(e){var t;this.version=0;this.flags=0;this.size=4+8*this.sample_counts.length;this.writeHeader(e);e.writeUint32(this.sample_counts.length);for(t=0;t<this.sample_counts.length;t++){e.writeUint32(this.sample_counts[t]);e.writeUint32(this.sample_deltas[t])}};o.stssBox.prototype.write=function(e){this.version=0;this.flags=0;this.size=4+4*this.sample_numbers.length;this.writeHeader(e);e.writeUint32(this.sample_numbers.length);e.writeUint32Array(this.sample_numbers)};o.stshBox.prototype.write=function(e){var t;this.version=0;this.flags=0;this.size=4+8*this.shadowed_sample_numbers.length;this.writeHeader(e);e.writeUint32(this.shadowed_sample_numbers.length);for(t=0;t<this.shadowed_sample_numbers.length;t++){e.writeUint32(this.shadowed_sample_numbers[t]);e.writeUint32(this.sync_sample_numbers[t])}};o.stcoBox.prototype.write=function(e){this.version=0;this.flags=0;this.size=4+4*this.chunk_offsets.length;this.writeHeader(e);e.writeUint32(this.chunk_offsets.length);e.writeUint32Array(this.chunk_offsets)};o.co64Box.prototype.write=function(e){var t;this.version=0;this.flags=0;this.size=4+8*this.chunk_offsets.length;this.writeHeader(e);e.writeUint32(this.chunk_offsets.length);for(t=0;t<this.chunk_offsets.length;t++){e.writeUint64(this.chunk_offsets[t])}};o.stscBox.prototype.write=function(e){var t;this.version=0;this.flags=0;this.size=4+12*this.first_chunk.length;this.writeHeader(e);e.writeUint32(this.first_chunk.length);for(t=0;t<this.first_chunk.length;t++){e.writeUint32(this.first_chunk[t]);e.writeUint32(this.samples_per_chunk[t]);e.writeUint32(this.sample_description_index[t])}};o.stszBox.prototype.write=function(e){var t;this.version=0;this.flags=0;this.size=8+12*this.sample_sizes.length;this.writeHeader(e);e.writeUint32(0);e.writeUint32(this.sample_sizes.length);e.writeUint32Array(this.sample_sizes)};o.mehdBox.prototype.write=function(e){this.version=0;this.flags=0;this.size=4;this.writeHeader(e);e.writeUint32(this.fragment_duration)};o.trexBox.prototype.write=function(e){this.version=0;this.flags=0;this.size=4*5;this.writeHeader(e);e.writeUint32(this.track_id);e.writeUint32(this.default_sample_description_index);e.writeUint32(this.default_sample_duration);e.writeUint32(this.default_sample_size);e.writeUint32(this.default_sample_flags)};o.mfhdBox.prototype.write=function(e){this.version=0;this.flags=0;this.size=4;this.writeHeader(e);e.writeUint32(this.sequence_number)};o.tfhdBox.prototype.write=function(e){this.version=0;this.size=4;if(this.flags&o.TFHD_FLAG_BASE_OFFSET){this.size+=8}if(this.flags&o.TFHD_FLAG_SAMPLE_DESC){this.size+=4}if(this.flags&o.TFHD_FLAG_SAMPLE_DUR){this.size+=4}if(this.flags&o.TFHD_FLAG_SAMPLE_SIZE){this.size+=4}if(this.flags&o.TFHD_FLAG_SAMPLE_FLAGS){this.size+=4}this.writeHeader(e);e.writeUint32(this.track_id);if(this.flags&o.TFHD_FLAG_BASE_OFFSET){e.writeUint64(this.base_data_offset)}if(this.flags&o.TFHD_FLAG_SAMPLE_DESC){e.writeUint32(this.default_sample_description_index)}if(this.flags&o.TFHD_FLAG_SAMPLE_DUR){e.writeUint32(this.default_sample_duration)}if(this.flags&o.TFHD_FLAG_SAMPLE_SIZE){e.writeUint32(this.default_sample_size)}if(this.flags&o.TFHD_FLAG_SAMPLE_FLAGS){e.writeUint32(this.default_sample_flags)}};o.trunBox.prototype.write=function(e){this.version=0;this.size=4;if(this.flags&o.TRUN_FLAGS_DATA_OFFSET){this.size+=4}if(this.flags&o.TRUN_FLAGS_FIRST_FLAG){this.size+=4}if(this.flags&o.TRUN_FLAGS_DURATION){this.size+=4*this.sample_duration.length}if(this.flags&o.TRUN_FLAGS_SIZE){this.size+=4*this.sample_size.length}if(this.flags&o.TRUN_FLAGS_FLAGS){this.size+=4*this.sample_flags.length}if(this.flags&o.TRUN_FLAGS_CTS_OFFSET){this.size+=4*this.sample_composition_time_offset.length}this.writeHeader(e);e.writeUint32(this.sample_count);if(this.flags&o.TRUN_FLAGS_DATA_OFFSET){this.data_offset_position=e.position;e.writeInt32(this.data_offset)}if(this.flags&o.TRUN_FLAGS_FIRST_FLAG){e.writeUint32(this.first_sample_flags)}for(var t=0;t<this.sample_count;t++){if(this.flags&o.TRUN_FLAGS_DURATION){e.writeUint32(this.sample_duration[t])}if(this.flags&o.TRUN_FLAGS_SIZE){e.writeUint32(this.sample_size[t])}if(this.flags&o.TRUN_FLAGS_FLAGS){e.writeUint32(this.sample_flags[t])}if(this.flags&o.TRUN_FLAGS_CTS_OFFSET){if(this.version===0){e.writeUint32(this.sample_composition_time_offset[t])}else{e.writeInt32(this.sample_composition_time_offset[t])}}}};o.tfdtBox.prototype.write=function(e){this.version=0;this.flags=0;this.size=4;this.writeHeader(e);if(this.version==1){e.writeUint64(this.baseMediaDecodeTime)}else{e.writeUint32(this.baseMediaDecodeTime)}}},{"./DataStream":64,"./descriptor":66,"./log":68}],66:[function(e,t,i){var r=e("./log");var n=function(){var e=3;var t=4;var i=5;var n=6;var a=[];a[e]="ES_Descriptor";a[t]="DecoderConfigDescriptor";a[i]="DecoderSpecificInfo";a[n]="SLConfigDescriptor";var s=this;var o={};this.parseOneDescriptor=function(e){var t=0;var i=0;var n;var s;var f;n=e.readUint8();t++;f=e.readUint8();t++;while(f&128){i=(f&127)<<7;f=e.readUint8();t++}i+=f&127;r.d("MPEG4DescriptorParser","Found "+(a[n]|"Descriptor "+n)+", size "+i+" at position "+e.position);if(a[n]){s=new o[a[n]](i)}else{s=new o.Descriptor(i)}s.parse(e);return s};o.Descriptor=function(e,t){this.tag=e;this.size=t;this.descs=[]};o.Descriptor.prototype.parse=function(e){this.data=e.readUint8Array(this.size)};o.Descriptor.prototype.findDescriptor=function(e){for(var t=0;t<this.descs.length;t++){if(this.descs[t].tag==e){return this.descs[t]}}return null};o.Descriptor.prototype.parseRemainingDescriptors=function(e){var t=e.position;while(e.position<t+this.size){var i=s.parseOneDescriptor(e);this.descs.push(i)}};o.ES_Descriptor=function(t){o.Descriptor.call(this,e,t)};o.ES_Descriptor.prototype=new o.Descriptor;o.ES_Descriptor.prototype.parse=function(e){this.ES_ID=e.readUint16();this.flags=e.readUint8();this.size-=3;if(this.flags&128){this.dependsOn_ES_ID=e.readUint16();this.size-=2}else{this.dependsOn_ES_ID=0}if(this.flags&64){var t=e.readUint8();this.URL=e.readString(t);this.size-=t+1;
+}else{this.URL=null}if(this.flags&32){this.OCR_ES_ID=e.readUint16();this.size-=2}else{this.OCR_ES_ID=0}this.parseRemainingDescriptors(e)};o.ES_Descriptor.prototype.getOTI=function(e){var i=this.findDescriptor(t);if(i){return i.oti}else{return 0}};o.ES_Descriptor.prototype.getAudioConfig=function(e){var r=this.findDescriptor(t);if(!r)return null;var n=r.findDescriptor(i);if(n&&n.data){return(n.data[0]&248)>>3}else{return null}};o.DecoderConfigDescriptor=function(e){o.Descriptor.call(this,t,e)};o.DecoderConfigDescriptor.prototype=new o.Descriptor;o.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8();this.streamType=e.readUint8();this.bufferSize=e.readUint24();this.maxBitrate=e.readUint32();this.avgBitrate=e.readUint32();this.size-=13;this.parseRemainingDescriptors(e)};o.DecoderSpecificInfo=function(e){o.Descriptor.call(this,i,e)};o.DecoderSpecificInfo.prototype=new o.Descriptor;o.SLConfigDescriptor=function(e){o.Descriptor.call(this,n,e)};o.SLConfigDescriptor.prototype=new o.Descriptor;return this};t.exports=n},{"./log":68}],67:[function(e,t,i){var r=e("./box");var n=e("./DataStream");var a=e("./log");var s=function(e){this.stream=e;this.boxes=[];this.mdats=[];this.moofs=[];this.isProgressive=false;this.lastMoofIndex=0;this.lastBoxStartPosition=0;this.parsingMdat=null;this.moovStartFound=false;this.samplesDataSize=0;this.nextParsePosition=0};t.exports=s;s.prototype.mergeNextBuffer=function(){var e;if(this.stream.bufferIndex+1<this.stream.nextBuffers.length){e=this.stream.nextBuffers[this.stream.bufferIndex+1];if(e.fileStart===this.stream.buffer.fileStart+this.stream.buffer.byteLength){var t=this.stream.buffer.byteLength;var i=this.stream.buffer.usedBytes;var r=this.stream.buffer.fileStart;this.stream.nextBuffers[this.stream.bufferIndex]=ArrayBuffer.concat(this.stream.buffer,e);this.stream.buffer=this.stream.nextBuffers[this.stream.bufferIndex];this.stream.nextBuffers.splice(this.stream.bufferIndex+1,1);this.stream.buffer.usedBytes=i;this.stream.buffer.fileStart=r;a.d("ISOFile","Concatenating buffer for box parsing (length: "+t+"->"+this.stream.buffer.byteLength+")");return true}else{return false}}else{return false}};s.prototype.parse=function(){var e;var t;var i;a.d("ISOFile","Starting parsing with buffer #"+this.stream.bufferIndex+" (fileStart: "+this.stream.buffer.fileStart+" - Length: "+this.stream.buffer.byteLength+") from position "+this.lastBoxStartPosition+" ("+(this.stream.buffer.fileStart+this.lastBoxStartPosition)+" in the file)");this.stream.seek(this.lastBoxStartPosition);while(true){if(this.parsingMdat!==null){i=this.parsingMdat;e=this.reposition(false,i.fileStart+i.hdr_size+i.size);if(e){a.d("ISOFile","Found 'mdat' end in buffer #"+this.stream.bufferIndex);this.parsingMdat=null;continue}else{this.nextParsePosition=this.findEndContiguousBuf(this.stream.bufferIndex);return}}else{this.lastBoxStartPosition=this.stream.position;t=r.parseOneBox(this.stream);if(t.code===r.ERR_NOT_ENOUGH_DATA){if(t.type==="mdat"){i=new r[t.type+"Box"](t.size-t.hdr_size);this.parsingMdat=i;this.mdats.push(i);i.fileStart=this.stream.buffer.fileStart+this.stream.position;i.hdr_size=t.hdr_size;this.stream.buffer.usedBytes+=t.hdr_size;e=this.reposition(false,i.fileStart+i.hdr_size+i.size);if(e){this.parsingMdat=null;continue}else{if(!this.moovStartFound){this.nextParsePosition=i.fileStart+i.size+i.hdr_size}else{this.nextParsePosition=this.findEndContiguousBuf(this.stream.bufferIndex)}return}}else{if(t.type==="moov"){this.moovStartFound=true;if(this.mdats.length===0){this.isProgressive=true}}else if(t.type==="free"){e=this.reposition(false,this.stream.buffer.fileStart+this.stream.position+t.size);if(e){continue}else{this.nextParsePosition=this.stream.buffer.fileStart+this.stream.position+t.size;return}}merged=this.mergeNextBuffer();if(merged){this.nextParsePosition=this.stream.buffer.fileStart+this.stream.buffer.byteLength;continue}else{if(!t.type){this.nextParsePosition=this.stream.buffer.fileStart+this.stream.buffer.byteLength}else{if(this.moovStartFound){this.nextParsePosition=this.stream.buffer.fileStart+this.stream.buffer.byteLength}else{this.nextParsePosition=this.stream.buffer.fileStart+this.stream.position+t.size}}return}}}else{i=t.box;this.boxes.push(i);switch(i.type){case"mdat":this.mdats.push(i);i.fileStart=this.stream.buffer.fileStart+i.start;break;case"moof":this.moofs.push(i);break;case"moov":this.moovStartFound=true;if(this.mdats.length===0){this.isProgressive=true}default:if(this[i.type]!==undefined){a.w("ISOFile","Duplicate Box of type: "+i.type+", overriding previous occurrence")}this[i.type]=i;break}if(i.type==="mdat"){this.stream.buffer.usedBytes+=i.hdr_size}else{this.stream.buffer.usedBytes+=t.size}}}}};s.prototype.reposition=function(e,t){var i;i=this.findPosition(e,t);if(i!==-1){this.stream.buffer=this.stream.nextBuffers[i];this.stream.bufferIndex=i;this.stream.position=t-this.stream.buffer.fileStart;a.d("ISOFile","Repositioning parser at buffer position: "+this.stream.position);return true}else{return false}};s.prototype.findPosition=function(e,t){var i;var r=null;var n=-1;if(e===true){i=0}else{i=this.stream.bufferIndex}while(i<this.stream.nextBuffers.length){r=this.stream.nextBuffers[i];if(r.fileStart<=t){n=i}else{break}i++}if(n!==-1){r=this.stream.nextBuffers[n];if(r.fileStart+r.byteLength>=t){a.d("ISOFile","Found position in existing buffer #"+n);return n}else{return-1}}else{return-1}};s.prototype.findEndContiguousBuf=function(e){var t;var i;var r;i=this.stream.nextBuffers[e];if(this.stream.nextBuffers.length>e+1){for(t=e+1;t<this.stream.nextBuffers.length;t++){r=this.stream.nextBuffers[t];if(r.fileStart===i.fileStart+i.byteLength){i=r}else{break}}}return i.fileStart+i.byteLength};s.prototype.write=function(e){for(var t=0;t<this.boxes.length;t++){this.boxes[t].write(e)}};s.prototype.writeInitializationSegment=function(e){var t;var i;var n;var s;var o;a.d("ISOFile","Generating initialization segment");this.ftyp.write(e);if(this.moov.mvex){this.initial_duration=this.moov.mvex.mehd.fragment_duration;i=-1;for(t=0;t<this.moov.boxes.length;t++){o=this.moov.boxes[t];if(o===this.moov.mvex){i=t}}if(i>-1){this.moov.boxes.splice(i,1)}this.moov.mvex=null}this.moov.mvex=new r.mvexBox;this.moov.boxes.push(this.moov.mvex);this.moov.mvex.mehd=new r.mehdBox;this.moov.mvex.boxes.push(this.moov.mvex.mehd);this.moov.mvex.mehd.fragment_duration=this.initial_duration;for(t=0;t<this.moov.traks.length;t++){if(this.moov.traks[t].ignore)continue;s=new r.trexBox;this.moov.mvex.boxes.push(s);s.track_id=this.moov.traks[t].tkhd.track_id;s.default_sample_description_index=1;s.default_sample_duration=this.moov.traks[t].samples.length>0?this.moov.traks[t].samples[0].duration:0;s.default_sample_size=0;s.default_sample_flags=1<<16}this.moov.write(e)};s.prototype.resetTables=function(){var e;var t,i,r,n,a,s,o,f;this.initial_duration=this.moov.mvhd.duration;this.moov.mvhd.duration=0;for(e=0;e<this.moov.traks.length;e++){t=this.moov.traks[e];t.tkhd.duration=0;t.mdia.mdhd.duration=0;i=t.mdia.minf.stbl.stco||t.mdia.minf.stbl.co64;i.chunk_offsets=[];r=t.mdia.minf.stbl.stsc;r.first_chunk=[];r.samples_per_chunk=[];r.sample_description_index=[];n=t.mdia.minf.stbl.stsz;n.sample_sizes=[];a=t.mdia.minf.stbl.stts;a.sample_counts=[];a.sample_deltas=[];s=t.mdia.minf.stbl.ctts;if(s){s.sample_counts=[];s.sample_offsets=[]}o=t.mdia.minf.stbl.stss;if(o){o.sample_numbers=new Uint32Array(0)}f=t.mdia.minf.stbl.sdtp;var l=t.mdia.minf.stbl.boxes.indexOf(f);if(l!=-1)t.mdia.minf.stbl.boxes[l]=null}};s.prototype.buildSampleLists=function(){var e,t,i;var r,n,a,s,o,f,l,c,u;var p,h,d,m,v;var g,_,y,b,w,x;this.originalMvex=this.moov.mvex;for(e=0;e<this.moov.traks.length;e++){r=this.moov.traks[e];r.samples=[];n=r.mdia.minf.stbl.stco||r.mdia.minf.stbl.co64;a=r.mdia.minf.stbl.stsc;s=r.mdia.minf.stbl.stsz;o=r.mdia.minf.stbl.stts;f=r.mdia.minf.stbl.ctts;l=r.mdia.minf.stbl.stss;c=r.mdia.minf.stbl.stsd;u=r.mdia.minf.stbl.subs;g=-1;_=-1;y=-1;b=-1;w=0;subs_entry_index=0;last_subs_sample_index=0;for(t=0;t<s.sample_sizes.length;t++){var k={};k.number=t;k.track_id=r.tkhd.track_id;k.timescale=r.mdia.mdhd.timescale;r.samples[t]=k;k.size=s.sample_sizes[t];if(t===0){h=1;p=0;k.chunk_index=h;k.chunk_run_index=p;v=a.samples_per_chunk[p];m=0;if(p+1<a.first_chunk.length){d=a.first_chunk[p+1]-1}else{d=Infinity}}else{if(t<v){k.chunk_index=h;k.chunk_run_index=p}else{h++;k.chunk_index=h;m=0;if(h<=d){}else{p++;if(p+1<a.first_chunk.length){d=a.first_chunk[p+1]-1}else{d=Infinity}}k.chunk_run_index=p;v+=a.samples_per_chunk[p]}}k.description=c.entries[a.sample_description_index[k.chunk_run_index]-1];k.offset=n.chunk_offsets[k.chunk_index-1]+m;m+=k.size;if(t>g){_++;if(g<0){g=0}g+=o.sample_counts[_]}if(t>0){r.samples[t-1].duration=o.sample_deltas[_];k.dts=r.samples[t-1].dts+r.samples[t-1].duration}else{k.dts=0}if(f){if(t>y){b++;y+=f.sample_counts[b]}k.cts=r.samples[t].dts+f.sample_offsets[b]}else{k.cts=k.dts}if(l){if(t==l.sample_numbers[w]-1){k.is_rap=true;w++}else{k.is_rap=false}}else{k.is_rap=true}if(u){if(u.samples[subs_entry_index].sample_delta+last_subs_sample_index==t){k.subsamples=u.samples[subs_entry_index].subsamples;last_subs_sample_index+=u.samples[subs_entry_index].sample_delta}}}if(t>0)r.samples[t-1].duration=r.mdia.mdhd.duration-r.samples[t-1].dts}};s.prototype.updateSampleLists=function(){var e,t,i;var n,a,s,o;var f;var l,c,u,p,h;var d;while(this.lastMoofIndex<this.moofs.length){l=this.moofs[this.lastMoofIndex];this.lastMoofIndex++;if(l.type=="moof"){c=l;for(e=0;e<c.trafs.length;e++){u=c.trafs[e];p=this.getTrackById(u.tfhd.track_id);h=this.getTrexById(u.tfhd.track_id);if(u.tfhd.flags&r.TFHD_FLAG_SAMPLE_DESC){n=u.tfhd.default_sample_description_index}else{n=h.default_sample_description_index}if(u.tfhd.flags&r.TFHD_FLAG_SAMPLE_DUR){a=u.tfhd.default_sample_duration}else{a=h.default_sample_duration}if(u.tfhd.flags&r.TFHD_FLAG_SAMPLE_SIZE){s=u.tfhd.default_sample_size}else{s=h.default_sample_size}if(u.tfhd.flags&r.TFHD_FLAG_SAMPLE_FLAGS){o=u.tfhd.default_sample_flags}else{o=h.default_sample_flags}for(t=0;t<u.truns.length;t++){var m=u.truns[t];for(i=0;i<m.sample_count;i++){d={};u.first_sample_index=p.samples.length;p.samples.push(d);d.track_id=p.tkhd.track_id;d.timescale=p.mdia.mdhd.timescale;d.description=p.mdia.minf.stbl.stsd.entries[n-1];d.size=s;if(m.flags&r.TRUN_FLAGS_SIZE){d.size=m.sample_size[i]}d.duration=a;if(m.flags&r.TRUN_FLAGS_DURATION){d.duration=m.sample_duration[i]}if(p.first_traf_merged||i>0){d.dts=p.samples[p.samples.length-2].dts+p.samples[p.samples.length-2].duration}else{if(u.tfdt){d.dts=u.tfdt.baseMediaDecodeTime}else{d.dts=0}p.first_traf_merged=true}d.cts=d.dts;if(m.flags&r.TRUN_FLAGS_CTS_OFFSET){d.cts=d.dts+m.sample_composition_time_offset[i]}sample_flags=o;if(m.flags&r.TRUN_FLAGS_FLAGS){sample_flags=m.sample_flags[i]}else if(i===0&&m.flags&r.TRUN_FLAGS_FIRST_FLAG){sample_flags=m.first_sample_flags}d.is_rap=sample_flags>>16&1?false:true;var v=u.tfhd.flags&r.TFHD_FLAG_BASE_DATA_OFFSET?true:false;var g=u.tfhd.flags&r.TFHD_FLAG_DEFAULT_BASE_IS_MOOF?true:false;var _=m.flags&r.TRUN_FLAGS_DATA_OFFSET?true:false;var y=0;if(!v){if(!g){if(t===0){y=c.fileStart}else{y=f}}else{y=c.fileStart}}else{y=u.tfhd.base_data_offset}if(t===0&&i===0){if(_){d.offset=y+m.data_offset}else{d.offset=y}}else{d.offset=f}f=d.offset+d.size}}if(u.subs){var b=u.first_sample_index;for(t=0;t<u.subs.samples.length;t++){b+=u.subs.samples[t].sample_delta;d=p.samples[b-1];d.subsamples=u.subs.samples[t].subsamples}}}}}};s.prototype.getCodecs=function(){var e;var t="";for(e=0;e<this.moov.traks.length;e++){var i=this.moov.traks[e];if(e>0){t+=","}t+=i.mdia.minf.stbl.stsd.entries[0].getCodec()}return t};s.prototype.getTrexById=function(e){var t;if(!this.originalMvex)return null;for(t=0;t<this.originalMvex.trexs.length;t++){var i=this.originalMvex.trexs[t];if(i.track_id==e)return i}return null};s.prototype.getTrackById=function(e){for(var t=0;t<this.moov.traks.length;t++){var i=this.moov.traks[t];if(i.tkhd.track_id==e)return i}return null};s.prototype.getSample=function(e,t){var i;var r;var s=e.samples[t];if(!this.moov){return null}if(!s.data){s.data=new Uint8Array(s.size);s.alreadyRead=0;this.samplesDataSize+=s.size;a.d("ISOFile","Allocating sample #"+t+" on track #"+e.tkhd.track_id+" of size "+s.size+" (total: "+this.samplesDataSize+")")}else if(s.alreadyRead==s.size){return s}for(r=0;r<this.stream.nextBuffers.length;r++){i=this.stream.nextBuffers[r];if(s.offset+s.alreadyRead>=i.fileStart&&s.offset+s.alreadyRead<i.fileStart+i.byteLength){var o=i.byteLength-(s.offset+s.alreadyRead-i.fileStart);if(s.size-s.alreadyRead<=o){a.d("ISOFile","Getting sample #"+t+" data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-i.fileStart)+" size: "+(s.size-s.alreadyRead)+")");n.memcpy(s.data.buffer,s.alreadyRead,i,s.offset+s.alreadyRead-i.fileStart,s.size-s.alreadyRead);s.alreadyRead=s.size;i.usedBytes+=s.size-s.alreadyRead;if(i.usedBytes===i.byteLength){this.stream.nextBuffers.splice(r,1);r--}return s}else{a.d("ISOFile","Getting sample data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-i.fileStart)+" size: "+o+")");n.memcpy(s.data.buffer,s.alreadyRead,i,s.offset+s.alreadyRead-i.fileStart,o);s.alreadyRead+=o;i.usedBytes+=o;if(i.usedBytes===i.byteLength){this.stream.nextBuffers.splice(r,1);r--}}}}return null};s.prototype.releaseSample=function(e,t){var i=e.samples[t];i.data=null;this.samplesDataSize-=i.size;return i.size}},{"./DataStream":64,"./box":65,"./log":68}],68:[function(e,t,i){var r=function(){var e=new Date;var t=4;var i=3;var n=2;var a=1;var s=t;var o={setLogLevel:function(e){if(e==this.d)s=a;else if(e==this.i)s=n;else if(e==this.w)s=i;else if(e==this.e)s=t;else s=t},d:function(t,i){if(a>=s){console.debug("["+r.getDurationString(new Date-e,1e3)+"]","["+t+"]",i)}},i:function(t,i){if(n>=s){console.info("["+r.getDurationString(new Date-e,1e3)+"]","["+t+"]",i)}},w:function(t,n){if(i>=s){console.warn("["+r.getDurationString(new Date-e,1e3)+"]","["+t+"]",n)}},e:function(i,n){if(t>=s){console.error("["+r.getDurationString(new Date-e,1e3)+"]","["+i+"]",n)}}};return o}();t.exports=r;r.getDurationString=function(e,t){function i(e,t){var i=""+e;var r=i.split(".");while(r[0].length<t){r[0]="0"+r[0]}return r.join(".")}var r=t||1;var n=e/r;var a=Math.floor(n/3600);n-=a*3600;var s=Math.floor(n/60);n-=s*60;var o=n*1e3;n=Math.floor(n);o-=n*1e3;o=Math.floor(o);return""+a+":"+i(s,2)+":"+i(n,2)+"."+i(o,3)};r.printRanges=function(e){var t=e.length;if(t>0){var i="";for(var n=0;n<t;n++){if(n>0)i+=",";i+="["+r.getDurationString(e.start(n))+","+r.getDurationString(e.end(n))+"]"}return i}else{return"(empty)"}}},{}],69:[function(e,t,r){var n=e("./box");var a=e("./DataStream");var s=e("./isofile");var o=e("./log");var f=function(){this.inputStream=null;this.nextBuffers=[];this.inputIsoFile=null;this.onMoovStart=null;this.moovStartSent=false;this.onReady=null;this.readySent=false;this.onSegment=null;this.onSamples=null;this.onError=null;this.sampleListBuilt=false;this.fragmentedTracks=[];this.extractedTracks=[];this.isFragmentationStarted=false;this.nextMoofNumber=0};t.exports=f;f.prototype.setSegmentOptions=function(e,t,i){var r=this.inputIsoFile.getTrackById(e);if(r){var n={};this.fragmentedTracks.push(n);n.id=e;n.user=t;n.trak=r;r.nextSample=0;n.segmentStream=null;n.nb_samples=1e3;n.rapAlignement=true;if(i){if(i.nbSamples)n.nb_samples=i.nbSamples;if(i.rapAlignement)n.rapAlignement=i.rapAlignement}}};f.prototype.unsetSegmentOptions=function(e){var t=-1;for(var i=0;i<this.fragmentedTracks.length;i++){var r=this.fragmentedTracks[i];if(r.id==e){t=i}}if(t>-1){this.fragmentedTracks.splice(t,1)}};f.prototype.setExtractionOptions=function(e,t,i){var r=this.inputIsoFile.getTrackById(e);if(r){var n={};this.extractedTracks.push(n);n.id=e;n.user=t;n.trak=r;r.nextSample=0;n.nb_samples=1e3;n.samples=[];if(i){if(i.nbSamples)n.nb_samples=i.nbSamples}}};f.prototype.unsetExtractionOptions=function(e){var t=-1;for(var i=0;i<this.extractedTracks.length;i++){var r=this.extractedTracks[i];if(r.id==e){t=i}}if(t>-1){this.extractedTracks.splice(t,1)}};f.prototype.createSingleSampleMoof=function(e){var t=new n.moofBox;var i=new n.mfhdBox;i.sequence_number=this.nextMoofNumber;this.nextMoofNumber++;t.boxes.push(i);var r=new n.trafBox;t.boxes.push(r);var a=new n.tfhdBox;r.boxes.push(a);a.track_id=e.track_id;a.flags=n.TFHD_FLAG_DEFAULT_BASE_IS_MOOF;var s=new n.tfdtBox;r.boxes.push(s);s.baseMediaDecodeTime=e.dts;var o=new n.trunBox;r.boxes.push(o);t.trun=o;o.flags=n.TRUN_FLAGS_DATA_OFFSET|n.TRUN_FLAGS_DURATION|n.TRUN_FLAGS_SIZE|n.TRUN_FLAGS_FLAGS|n.TRUN_FLAGS_CTS_OFFSET;o.data_offset=0;o.first_sample_flags=0;o.sample_count=1;o.sample_duration=[];o.sample_duration[0]=e.duration;o.sample_size=[];o.sample_size[0]=e.size;o.sample_flags=[];o.sample_flags[0]=0;o.sample_composition_time_offset=[];o.sample_composition_time_offset[0]=e.cts-e.dts;return t};f.prototype.createFragment=function(e,t,i,r){var s=this.inputIsoFile.getTrackById(t);var f=this.inputIsoFile.getSample(s,i);if(f==null){if(this.nextSeekPosition){this.nextSeekPosition=Math.min(s.samples[i].offset,this.nextSeekPosition)}else{this.nextSeekPosition=s.samples[i].offset}return null}var l=r||new a;l.endianness=a.BIG_ENDIAN;var c=this.createSingleSampleMoof(f);c.write(l);c.trun.data_offset=c.size+8;o.d("BoxWriter","Adjusting data_offset with new value "+c.trun.data_offset);l.adjustUint32(c.trun.data_offset_position,c.trun.data_offset);var u=new n.mdatBox;u.data=f.data;u.write(l);return l};ArrayBuffer.concat=function(e,t){o.d("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var i=new Uint8Array(e.byteLength+t.byteLength);i.set(new Uint8Array(e),0);i.set(new Uint8Array(t),e.byteLength);return i.buffer};f.prototype.reduceBuffer=function(e,t,i){var r;r=new Uint8Array(i);r.set(new Uint8Array(e,t,i));r.buffer.fileStart=e.fileStart+t;r.buffer.usedBytes=0;return r.buffer};f.prototype.insertBuffer=function(e){var t=true;for(var i=0;i<this.nextBuffers.length;i++){var r=this.nextBuffers[i];if(e.fileStart<=r.fileStart){if(e.fileStart===r.fileStart){if(e.byteLength>r.byteLength){this.nextBuffers.splice(i,1);i--;continue}else{o.w("MP4Box","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}}else{if(e.fileStart+e.byteLength<=r.fileStart){}else{e=this.reduceBuffer(e,0,r.fileStart-e.fileStart)}o.d("MP4Box","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")");this.nextBuffers.splice(i,0,e);if(i===0&&this.inputStream!==null){this.inputStream.buffer=e}}t=false;break}else if(e.fileStart<r.fileStart+r.byteLength){var n=r.fileStart+r.byteLength-e.fileStart;var a=e.byteLength-n;if(a>0){e=this.reduceBuffer(e,n,a)}else{t=false;break}}}if(t){o.d("MP4Box","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")");this.nextBuffers.push(e);if(i===0&&this.inputStream!==null){this.inputStream.buffer=e}}};f.prototype.processSamples=function(){var e;var t;if(this.isFragmentationStarted&&this.onSegment!==null){for(e=0;e<this.fragmentedTracks.length;e++){var i=this.fragmentedTracks[e];t=i.trak;while(t.nextSample<t.samples.length){o.d("MP4Box","Creating media fragment on track #"+i.id+" for sample "+t.nextSample);var r=this.createFragment(this.inputIsoFile,i.id,t.nextSample,i.segmentStream);if(r){i.segmentStream=r;t.nextSample++}else{break}if(t.nextSample%i.nb_samples===0||t.nextSample>=t.samples.length){o.i("MP4Box","Sending fragmented data on track #"+i.id+" for samples ["+(t.nextSample-i.nb_samples)+","+(t.nextSample-1)+"]");if(this.onSegment){this.onSegment(i.id,i.user,i.segmentStream.buffer,t.nextSample)}i.segmentStream=null;if(i!==this.fragmentedTracks[e]){break}}}}}if(this.onSamples!==null){for(e=0;e<this.extractedTracks.length;e++){var n=this.extractedTracks[e];t=n.trak;while(t.nextSample<t.samples.length){o.d("MP4Box","Exporting on track #"+n.id+" sample #"+t.nextSample);var a=this.inputIsoFile.getSample(t,t.nextSample);if(a){t.nextSample++;n.samples.push(a)}else{return}if(t.nextSample%n.nb_samples===0||t.nextSample>=t.samples.length){o.d("MP4Box","Sending samples on track #"+n.id+" for sample "+t.nextSample);if(this.onSamples){this.onSamples(n.id,n.user,n.samples)}n.samples=[];if(n!==this.extractedTracks[e]){break}}}}}};f.prototype.appendBuffer=function(e){var t;var i;if(e===null||e===undefined){throw"Buffer must be defined and non empty"}if(e.fileStart===undefined){throw"Buffer must have a fileStart property"}if(e.byteLength===0){o.w("MP4Box","Ignoring empty buffer (fileStart: "+e.fileStart+")");return}e.usedBytes=0;this.insertBuffer(e);if(!this.inputStream){if(this.nextBuffers.length>0){i=this.nextBuffers[0];if(i.fileStart===0){this.inputStream=new a(i,0,a.BIG_ENDIAN);this.inputStream.nextBuffers=this.nextBuffers;this.inputStream.bufferIndex=0}else{o.w("MP4Box","The first buffer should have a fileStart of 0");return}}else{o.w("MP4Box","No buffer to start parsing from");return}}if(!this.inputIsoFile){this.inputIsoFile=new s(this.inputStream)}this.inputIsoFile.parse();if(this.inputIsoFile.moovStartFound&&!this.moovStartSent){this.moovStartSent=true;if(this.onMoovStart)this.onMoovStart()}if(this.inputIsoFile.moov){if(!this.sampleListBuilt){this.inputIsoFile.buildSampleLists();this.sampleListBuilt=true}this.inputIsoFile.updateSampleLists();if(this.onReady&&!this.readySent){var r=this.getInfo();this.readySent=true;this.onReady(r)}this.processSamples();if(this.nextSeekPosition){t=this.nextSeekPosition;this.nextSeekPosition=undefined}else{t=this.inputIsoFile.nextParsePosition}var n=this.inputIsoFile.findPosition(true,t);if(n!==-1){t=this.inputIsoFile.findEndContiguousBuf(n)}o.i("MP4Box","Next buffer to fetch should have a fileStart position of "+t);return t}else{if(this.inputIsoFile!==null){return this.inputIsoFile.nextParsePosition}else{return 0}}};f.prototype.getInfo=function(){var e={};var t;var r;var n;var a=new Date(4,0,1,0,0,0,0).getTime();e.duration=this.inputIsoFile.moov.mvhd.duration;e.timescale=this.inputIsoFile.moov.mvhd.timescale;e.isFragmented=this.inputIsoFile.moov.mvex!=null;if(e.isFragmented&&this.inputIsoFile.moov.mvex.mehd){e.fragment_duration=this.inputIsoFile.moov.mvex.mehd.fragment_duration}else{e.fragment_duration=0}e.isProgressive=this.inputIsoFile.isProgressive;e.hasIOD=this.inputIsoFile.moov.iods!=null;e.brands=[];e.brands.push(this.inputIsoFile.ftyp.major_brand);e.brands=e.brands.concat(this.inputIsoFile.ftyp.compatible_brands);e.created=new Date(a+this.inputIsoFile.moov.mvhd.creation_time*1e3);e.modified=new Date(a+this.inputIsoFile.moov.mvhd.modification_time*1e3);e.tracks=[];e.audioTracks=[];e.videoTracks=[];e.subtitleTracks=[];e.metadataTracks=[];e.hintTracks=[];e.otherTracks=[];for(i=0;i<this.inputIsoFile.moov.traks.length;i++){t=this.inputIsoFile.moov.traks[i];n=t.mdia.minf.stbl.stsd.entries[0];r={};e.tracks.push(r);r.id=t.tkhd.track_id;r.references=[];if(t.tref){for(j=0;j<t.tref.boxes.length;j++){ref={};r.references.push(ref);ref.type=t.tref.boxes[j].type;ref.track_ids=t.tref.boxes[j].track_ids}}r.created=new Date(a+t.tkhd.creation_time*1e3);r.modified=new Date(a+t.tkhd.modification_time*1e3);r.movie_duration=t.tkhd.duration;r.layer=t.tkhd.layer;r.alternate_group=t.tkhd.alternate_group;r.volume=t.tkhd.volume;r.matrix=t.tkhd.matrix;r.track_width=t.tkhd.width/(1<<16);r.track_height=t.tkhd.height/(1<<16);r.timescale=t.mdia.mdhd.timescale;r.duration=t.mdia.mdhd.duration;r.codec=n.getCodec();r.language=t.mdia.mdhd.languageString;r.nb_samples=t.samples.length;r.size=0;for(j=0;j<r.nb_samples;j++){r.size+=t.samples[j].size}r.bitrate=r.size*8*r.timescale/r.duration;if(n.isAudio()){e.audioTracks.push(r);r.audio={};r.audio.sample_rate=n.getSampleRate();r.audio.channel_count=n.getChannelCount();r.audio.sample_size=n.getSampleSize()}else if(n.isVideo()){e.videoTracks.push(r);r.video={};r.video.width=n.getWidth();r.video.height=n.getHeight()}else if(n.isSubtitle()){e.subtitleTracks.push(r)}else if(n.isHint()){e.hintTracks.push(r)}else if(n.isMetadata()){e.metadataTracks.push(r)}else{e.otherTracks.push(r)}}return e};f.prototype.getInitializationSegment=function(){var e=new a;e.endianness=a.BIG_ENDIAN;this.inputIsoFile.writeInitializationSegment(e);return e.buffer};f.prototype.writeFile=function(){var e=new a;e.endianness=a.BIG_ENDIAN;this.inputIsoFile.write(e);return e.buffer};f.prototype.initializeSegmentation=function(){var e;var t;var i;var r;var n;if(this.onSegment===null){o.w("MP4Box","No segmentation callback set!")}if(!this.isFragmentationStarted){this.isFragmentationStarted=true;this.nextMoofNumber=0;this.inputIsoFile.resetTables()}r=[];for(e=0;e<this.fragmentedTracks.length;e++){for(t=0;t<this.inputIsoFile.moov.boxes.length;t++){i=this.inputIsoFile.moov.boxes[t];if(i&&i.type==="trak"){this.inputIsoFile.moov.boxes[t].ignore=true;this.inputIsoFile.moov.boxes[t]=null}}n=this.inputIsoFile.getTrackById(this.fragmentedTracks[e].id);delete n.ignore;for(t=0;t<this.inputIsoFile.moov.boxes.length;t++){i=this.inputIsoFile.moov.boxes[t];if(i==null){this.inputIsoFile.moov.boxes[t]=n;break}}seg={};seg.id=n.tkhd.track_id;seg.user=this.fragmentedTracks[e].user;seg.buffer=this.getInitializationSegment();r.push(seg)}return r};f.prototype.releaseUsedSamples=function(e,t){var i=0;var r=this.inputIsoFile.getTrackById(e);if(!r.lastValidSample)r.lastValidSample=0;for(var n=r.lastValidSample;n<t;n++){i+=this.inputIsoFile.releaseSample(r,n)}o.d("MP4Box","Track #"+e+" released samples up to "+t+" (total size: "+i+", remaining: "+this.inputIsoFile.samplesDataSize+")");r.lastValidSample=t};f.prototype.flush=function(){o.i("MP4Box","Flushing remaining samples");this.inputIsoFile.updateSampleLists();this.processSamples()};f.prototype.seekTrack=function(e,t,i){var r;var n;var a=Infinity;var s=0;var f=Infinity;var l=0;var c=0;var u;for(r=0;r<i.samples.length;r++){n=i.samples[r];if(r===0){f=n.offset;c=0;u=n.timescale}else if(n.cts>e*n.timescale){f=i.samples[r-1].offset;c=r-1;break}if(t&&n.is_rap){a=n.offset;s=n.cts;l=r}}if(t){i.nextSample=l;o.i("MP4Box","Seeking to RAP sample #"+i.nextSample+" on track "+i.tkhd.track_id+", time "+o.getDurationString(s,u)+" and offset: "+a);return{offset:a,time:s/u}}else{i.nextSample=c;o.i("MP4Box","Seeking to non-RAP sample #"+i.nextSample+" on track "+i.tkhd.track_id+", time "+o.getDurationString(e)+" and offset: "+a);return{offset:f,time:e}}};f.prototype.seek=function(e,t){var i=this.inputIsoFile.moov;var r;var n;var a;var s={offset:Infinity,time:Infinity};if(!this.inputIsoFile.moov){throw"Cannot seek: moov not received!"}else{for(a=0;a<i.traks.length;a++){r=i.traks[a];n=this.seekTrack(e,t,r);if(n.offset<s.offset){s.offset=n.offset}if(n.time<s.time){s.time=n.time}}if(s.offset===Infinity){s={offset:this.inputIsoFile.nextParsePosition,time:0}}else{var f=this.inputIsoFile.findPosition(true,s.offset);if(f!==-1){s.offset=this.inputIsoFile.findEndContiguousBuf(f)}}o.i("MP4Box","Seeking at time "+o.getDurationString(s.time,1)+" needs a buffer with a fileStart position of "+s.offset);return s}}},{"./DataStream":64,"./box":65,"./isofile":67,"./log":68}],70:[function(e,t,i){var r=1e3;var n=r*60;var a=n*60;var s=a*24;var o=s*365.25;t.exports=function(e,t){t=t||{};if("string"==typeof e)return f(e);return t.long?c(e):l(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 i=parseFloat(t[1]);var f=(t[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return i*o;case"days":case"day":case"d":return i*s;case"hours":case"hour":case"hrs":case"hr":case"h":return i*a;case"minutes":case"minute":case"mins":case"min":case"m":return i*n;case"seconds":case"second":case"secs":case"sec":case"s":return i*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return i}}function l(e){if(e>=s)return Math.round(e/s)+"d";if(e>=a)return Math.round(e/a)+"h";if(e>=n)return Math.round(e/n)+"m";if(e>=r)return Math.round(e/r)+"s";return e+"ms"}function c(e){return u(e,s,"day")||u(e,a,"hour")||u(e,n,"minute")||u(e,r,"second")||e+" ms"}function u(e,t,i){if(e<t)return;if(e<t*1.5)return Math.floor(e/t)+" "+i;return Math.ceil(e/t)+" "+i+"s"}},{}],71:[function(e,t,i){t.exports=a;var r=e("inherits");var n=e("stream");r(a,n.Readable);function a(e,t){if(!(this instanceof a))return new a(e,t);n.Readable.call(this,t);this.destroyed=false;this._drained=false;this._forwarding=false;this._current=null;this._queue=e.map(s);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=s(t());if(!t){e.destroy();e.push(null);return}e._current=t;t.on("readable",i);t.on("end",n);t.on("error",a);t.on("close",r);function i(){e._forward()}function r(){if(!t._readableState.ended){e.destroy()}}function n(){e._current=null;t.removeListener("readable",i);t.removeListener("end",n);t.removeListener("error",a);t.removeListener("close",r);e._next()}function a(t){e.destroy(t)}};function s(e){if(!e||typeof e==="function"||e._readableState)return e;var t=(new n.Readable).wrap(e);if(e.destroy){t.destroy=e.destroy.bind(e)}return t}},{inherits:55,stream:111}],72:[function(e,t,i){var r=e("wrappy");t.exports=r(n);n.proto=n(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return n(this)},configurable:true})});function n(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:123}],73:[function(e,t,i){"use strict";var r=typeof Uint8Array!=="undefined"&&typeof Uint16Array!=="undefined"&&typeof Int32Array!=="undefined";i.assign=function(e){var t=Array.prototype.slice.call(arguments,1);while(t.length){var i=t.shift();if(!i){continue}if(typeof i!=="object"){throw new TypeError(i+"must be non-object")}for(var r in i){if(i.hasOwnProperty(r)){e[r]=i[r]}}}return e};i.shrinkBuf=function(e,t){if(e.length===t){return e}if(e.subarray){return e.subarray(0,t)}e.length=t;return e};var n={arraySet:function(e,t,i,r,n){if(t.subarray&&e.subarray){e.set(t.subarray(i,i+r),n);return}for(var a=0;a<r;a++){e[n+a]=t[i+a]}},flattenChunks:function(e){var t,i,r,n,a,s;r=0;for(t=0,i=e.length;t<i;t++){r+=e[t].length}s=new Uint8Array(r);n=0;for(t=0,i=e.length;t<i;t++){a=e[t];s.set(a,n);n+=a.length}return s}};var a={arraySet:function(e,t,i,r,n){for(var a=0;a<r;a++){e[n+a]=t[i+a]}},flattenChunks:function(e){return[].concat.apply([],e)}};i.setTyped=function(e){if(e){i.Buf8=Uint8Array;i.Buf16=Uint16Array;i.Buf32=Int32Array;i.assign(i,n)}else{i.Buf8=Array;i.Buf16=Array;i.Buf32=Array;i.assign(i,a)}};i.setTyped(r)},{}],74:[function(e,t,i){"use strict";function r(e,t,i,r){var n=e&65535|0,a=e>>>16&65535|0,s=0;while(i!==0){s=i>2e3?2e3:i;i-=s;do{n=n+t[r++]|0;a=a+n|0}while(--s);n%=65521;a%=65521}return n|a<<16|0}t.exports=r},{}],75:[function(e,t,i){t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],76:[function(e,t,i){"use strict";function r(){var e,t=[];for(var i=0;i<256;i++){e=i;for(var r=0;r<8;r++){e=e&1?3988292384^e>>>1:e>>>1}t[i]=e}return t}var n=r();function a(e,t,i,r){var a=n,s=r+i;e=e^-1;for(var o=r;o<s;o++){
+e=e>>>8^a[(e^t[o])&255]}return e^-1}t.exports=a},{}],77:[function(e,t,i){"use strict";var r=e("../utils/common");var n=e("./trees");var a=e("./adler32");var s=e("./crc32");var o=e("./messages");var f=0;var l=1;var c=3;var u=4;var p=5;var h=0;var d=1;var m=-2;var v=-3;var g=-5;var _=-1;var y=1;var b=2;var w=3;var x=4;var k=0;var S=2;var E=8;var A=9;var U=15;var T=8;var I=29;var L=256;var B=L+1+I;var z=30;var R=19;var C=2*B+1;var F=15;var O=3;var N=258;var P=N+O+1;var D=32;var M=42;var j=69;var H=73;var q=91;var G=103;var Z=113;var W=666;var V=1;var Y=2;var K=3;var $=4;var X=3;function J(e,t){e.msg=o[t];return t}function Q(e){return(e<<1)-(e>4?9:0)}function ee(e){var t=e.length;while(--t>=0){e[t]=0}}function te(e){var t=e.state;var i=t.pending;if(i>e.avail_out){i=e.avail_out}if(i===0){return}r.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out);e.next_out+=i;t.pending_out+=i;e.total_out+=i;e.avail_out-=i;t.pending-=i;if(t.pending===0){t.pending_out=0}}function ie(e,t){n._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t);e.block_start=e.strstart;te(e.strm)}function re(e,t){e.pending_buf[e.pending++]=t}function ne(e,t){e.pending_buf[e.pending++]=t>>>8&255;e.pending_buf[e.pending++]=t&255}function ae(e,t,i,n){var o=e.avail_in;if(o>n){o=n}if(o===0){return 0}e.avail_in-=o;r.arraySet(t,e.input,e.next_in,o,i);if(e.state.wrap===1){e.adler=a(e.adler,t,o,i)}else if(e.state.wrap===2){e.adler=s(e.adler,t,o,i)}e.next_in+=o;e.total_in+=o;return o}function se(e,t){var i=e.max_chain_length;var r=e.strstart;var n;var a;var s=e.prev_length;var o=e.nice_match;var f=e.strstart>e.w_size-P?e.strstart-(e.w_size-P):0;var l=e.window;var c=e.w_mask;var u=e.prev;var p=e.strstart+N;var h=l[r+s-1];var d=l[r+s];if(e.prev_length>=e.good_match){i>>=2}if(o>e.lookahead){o=e.lookahead}do{n=t;if(l[n+s]!==d||l[n+s-1]!==h||l[n]!==l[r]||l[++n]!==l[r+1]){continue}r+=2;n++;do{}while(l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&r<p);a=N-(p-r);r=p-N;if(a>s){e.match_start=t;s=a;if(a>=o){break}h=l[r+s-1];d=l[r+s]}}while((t=u[t&c])>f&&--i!==0);if(s<=e.lookahead){return s}return e.lookahead}function oe(e){var t=e.w_size;var i,n,a,s,o;do{s=e.window_size-e.lookahead-e.strstart;if(e.strstart>=t+(t-P)){r.arraySet(e.window,e.window,t,t,0);e.match_start-=t;e.strstart-=t;e.block_start-=t;n=e.hash_size;i=n;do{a=e.head[--i];e.head[i]=a>=t?a-t:0}while(--n);n=t;i=n;do{a=e.prev[--i];e.prev[i]=a>=t?a-t:0}while(--n);s+=t}if(e.strm.avail_in===0){break}n=ae(e.strm,e.window,e.strstart+e.lookahead,s);e.lookahead+=n;if(e.lookahead+e.insert>=O){o=e.strstart-e.insert;e.ins_h=e.window[o];e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;while(e.insert){e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+O-1])&e.hash_mask;e.prev[o&e.w_mask]=e.head[e.ins_h];e.head[e.ins_h]=o;o++;e.insert--;if(e.lookahead+e.insert<O){break}}}}while(e.lookahead<P&&e.strm.avail_in!==0)}function fe(e,t){var i=65535;if(i>e.pending_buf_size-5){i=e.pending_buf_size-5}for(;;){if(e.lookahead<=1){oe(e);if(e.lookahead===0&&t===f){return V}if(e.lookahead===0){break}}e.strstart+=e.lookahead;e.lookahead=0;var r=e.block_start+i;if(e.strstart===0||e.strstart>=r){e.lookahead=e.strstart-r;e.strstart=r;ie(e,false);if(e.strm.avail_out===0){return V}}if(e.strstart-e.block_start>=e.w_size-P){ie(e,false);if(e.strm.avail_out===0){return V}}}e.insert=0;if(t===u){ie(e,true);if(e.strm.avail_out===0){return K}return $}if(e.strstart>e.block_start){ie(e,false);if(e.strm.avail_out===0){return V}}return V}function le(e,t){var i;var r;for(;;){if(e.lookahead<P){oe(e);if(e.lookahead<P&&t===f){return V}if(e.lookahead===0){break}}i=0;if(e.lookahead>=O){e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+O-1])&e.hash_mask;i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h];e.head[e.ins_h]=e.strstart}if(i!==0&&e.strstart-i<=e.w_size-P){e.match_length=se(e,i)}if(e.match_length>=O){r=n._tr_tally(e,e.strstart-e.match_start,e.match_length-O);e.lookahead-=e.match_length;if(e.match_length<=e.max_lazy_match&&e.lookahead>=O){e.match_length--;do{e.strstart++;e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+O-1])&e.hash_mask;i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h];e.head[e.ins_h]=e.strstart}while(--e.match_length!==0);e.strstart++}else{e.strstart+=e.match_length;e.match_length=0;e.ins_h=e.window[e.strstart];e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask}}else{r=n._tr_tally(e,0,e.window[e.strstart]);e.lookahead--;e.strstart++}if(r){ie(e,false);if(e.strm.avail_out===0){return V}}}e.insert=e.strstart<O-1?e.strstart:O-1;if(t===u){ie(e,true);if(e.strm.avail_out===0){return K}return $}if(e.last_lit){ie(e,false);if(e.strm.avail_out===0){return V}}return Y}function ce(e,t){var i;var r;var a;for(;;){if(e.lookahead<P){oe(e);if(e.lookahead<P&&t===f){return V}if(e.lookahead===0){break}}i=0;if(e.lookahead>=O){e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+O-1])&e.hash_mask;i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h];e.head[e.ins_h]=e.strstart}e.prev_length=e.match_length;e.prev_match=e.match_start;e.match_length=O-1;if(i!==0&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-P){e.match_length=se(e,i);if(e.match_length<=5&&(e.strategy===y||e.match_length===O&&e.strstart-e.match_start>4096)){e.match_length=O-1}}if(e.prev_length>=O&&e.match_length<=e.prev_length){a=e.strstart+e.lookahead-O;r=n._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-O);e.lookahead-=e.prev_length-1;e.prev_length-=2;do{if(++e.strstart<=a){e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+O-1])&e.hash_mask;i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h];e.head[e.ins_h]=e.strstart}}while(--e.prev_length!==0);e.match_available=0;e.match_length=O-1;e.strstart++;if(r){ie(e,false);if(e.strm.avail_out===0){return V}}}else if(e.match_available){r=n._tr_tally(e,0,e.window[e.strstart-1]);if(r){ie(e,false)}e.strstart++;e.lookahead--;if(e.strm.avail_out===0){return V}}else{e.match_available=1;e.strstart++;e.lookahead--}}if(e.match_available){r=n._tr_tally(e,0,e.window[e.strstart-1]);e.match_available=0}e.insert=e.strstart<O-1?e.strstart:O-1;if(t===u){ie(e,true);if(e.strm.avail_out===0){return K}return $}if(e.last_lit){ie(e,false);if(e.strm.avail_out===0){return V}}return Y}function ue(e,t){var i;var r;var a,s;var o=e.window;for(;;){if(e.lookahead<=N){oe(e);if(e.lookahead<=N&&t===f){return V}if(e.lookahead===0){break}}e.match_length=0;if(e.lookahead>=O&&e.strstart>0){a=e.strstart-1;r=o[a];if(r===o[++a]&&r===o[++a]&&r===o[++a]){s=e.strstart+N;do{}while(r===o[++a]&&r===o[++a]&&r===o[++a]&&r===o[++a]&&r===o[++a]&&r===o[++a]&&r===o[++a]&&r===o[++a]&&a<s);e.match_length=N-(s-a);if(e.match_length>e.lookahead){e.match_length=e.lookahead}}}if(e.match_length>=O){i=n._tr_tally(e,1,e.match_length-O);e.lookahead-=e.match_length;e.strstart+=e.match_length;e.match_length=0}else{i=n._tr_tally(e,0,e.window[e.strstart]);e.lookahead--;e.strstart++}if(i){ie(e,false);if(e.strm.avail_out===0){return V}}}e.insert=0;if(t===u){ie(e,true);if(e.strm.avail_out===0){return K}return $}if(e.last_lit){ie(e,false);if(e.strm.avail_out===0){return V}}return Y}function pe(e,t){var i;for(;;){if(e.lookahead===0){oe(e);if(e.lookahead===0){if(t===f){return V}break}}e.match_length=0;i=n._tr_tally(e,0,e.window[e.strstart]);e.lookahead--;e.strstart++;if(i){ie(e,false);if(e.strm.avail_out===0){return V}}}e.insert=0;if(t===u){ie(e,true);if(e.strm.avail_out===0){return K}return $}if(e.last_lit){ie(e,false);if(e.strm.avail_out===0){return V}}return Y}var he=function(e,t,i,r,n){this.good_length=e;this.max_lazy=t;this.nice_length=i;this.max_chain=r;this.func=n};var de;de=[new he(0,0,0,0,fe),new he(4,4,8,4,le),new he(4,5,16,8,le),new he(4,6,32,32,le),new he(4,4,16,16,ce),new he(8,16,32,32,ce),new he(8,16,128,128,ce),new he(8,32,128,256,ce),new he(32,128,258,1024,ce),new he(32,258,258,4096,ce)];function me(e){e.window_size=2*e.w_size;ee(e.head);e.max_lazy_match=de[e.level].max_lazy;e.good_match=de[e.level].good_length;e.nice_match=de[e.level].nice_length;e.max_chain_length=de[e.level].max_chain;e.strstart=0;e.block_start=0;e.lookahead=0;e.insert=0;e.match_length=e.prev_length=O-1;e.match_available=0;e.ins_h=0}function ve(){this.strm=null;this.status=0;this.pending_buf=null;this.pending_buf_size=0;this.pending_out=0;this.pending=0;this.wrap=0;this.gzhead=null;this.gzindex=0;this.method=E;this.last_flush=-1;this.w_size=0;this.w_bits=0;this.w_mask=0;this.window=null;this.window_size=0;this.prev=null;this.head=null;this.ins_h=0;this.hash_size=0;this.hash_bits=0;this.hash_mask=0;this.hash_shift=0;this.block_start=0;this.match_length=0;this.prev_match=0;this.match_available=0;this.strstart=0;this.match_start=0;this.lookahead=0;this.prev_length=0;this.max_chain_length=0;this.max_lazy_match=0;this.level=0;this.strategy=0;this.good_match=0;this.nice_match=0;this.dyn_ltree=new r.Buf16(C*2);this.dyn_dtree=new r.Buf16((2*z+1)*2);this.bl_tree=new r.Buf16((2*R+1)*2);ee(this.dyn_ltree);ee(this.dyn_dtree);ee(this.bl_tree);this.l_desc=null;this.d_desc=null;this.bl_desc=null;this.bl_count=new r.Buf16(F+1);this.heap=new r.Buf16(2*B+1);ee(this.heap);this.heap_len=0;this.heap_max=0;this.depth=new r.Buf16(2*B+1);ee(this.depth);this.l_buf=0;this.lit_bufsize=0;this.last_lit=0;this.d_buf=0;this.opt_len=0;this.static_len=0;this.matches=0;this.insert=0;this.bi_buf=0;this.bi_valid=0}function ge(e){var t;if(!e||!e.state){return J(e,m)}e.total_in=e.total_out=0;e.data_type=S;t=e.state;t.pending=0;t.pending_out=0;if(t.wrap<0){t.wrap=-t.wrap}t.status=t.wrap?M:Z;e.adler=t.wrap===2?0:1;t.last_flush=f;n._tr_init(t);return h}function _e(e){var t=ge(e);if(t===h){me(e.state)}return t}function ye(e,t){if(!e||!e.state){return m}if(e.state.wrap!==2){return m}e.state.gzhead=t;return h}function be(e,t,i,n,a,s){if(!e){return m}var o=1;if(t===_){t=6}if(n<0){o=0;n=-n}else if(n>15){o=2;n-=16}if(a<1||a>A||i!==E||n<8||n>15||t<0||t>9||s<0||s>x){return J(e,m)}if(n===8){n=9}var f=new ve;e.state=f;f.strm=e;f.wrap=o;f.gzhead=null;f.w_bits=n;f.w_size=1<<f.w_bits;f.w_mask=f.w_size-1;f.hash_bits=a+7;f.hash_size=1<<f.hash_bits;f.hash_mask=f.hash_size-1;f.hash_shift=~~((f.hash_bits+O-1)/O);f.window=new r.Buf8(f.w_size*2);f.head=new r.Buf16(f.hash_size);f.prev=new r.Buf16(f.w_size);f.lit_bufsize=1<<a+6;f.pending_buf_size=f.lit_bufsize*4;f.pending_buf=new r.Buf8(f.pending_buf_size);f.d_buf=f.lit_bufsize>>1;f.l_buf=(1+2)*f.lit_bufsize;f.level=t;f.strategy=s;f.method=i;return _e(e)}function we(e,t){return be(e,t,E,U,T,k)}function xe(e,t){var i,r;var a,o;if(!e||!e.state||t>p||t<0){return e?J(e,m):m}r=e.state;if(!e.output||!e.input&&e.avail_in!==0||r.status===W&&t!==u){return J(e,e.avail_out===0?g:m)}r.strm=e;i=r.last_flush;r.last_flush=t;if(r.status===M){if(r.wrap===2){e.adler=0;re(r,31);re(r,139);re(r,8);if(!r.gzhead){re(r,0);re(r,0);re(r,0);re(r,0);re(r,0);re(r,r.level===9?2:r.strategy>=b||r.level<2?4:0);re(r,X);r.status=Z}else{re(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(!r.gzhead.extra?0:4)+(!r.gzhead.name?0:8)+(!r.gzhead.comment?0:16));re(r,r.gzhead.time&255);re(r,r.gzhead.time>>8&255);re(r,r.gzhead.time>>16&255);re(r,r.gzhead.time>>24&255);re(r,r.level===9?2:r.strategy>=b||r.level<2?4:0);re(r,r.gzhead.os&255);if(r.gzhead.extra&&r.gzhead.extra.length){re(r,r.gzhead.extra.length&255);re(r,r.gzhead.extra.length>>8&255)}if(r.gzhead.hcrc){e.adler=s(e.adler,r.pending_buf,r.pending,0)}r.gzindex=0;r.status=j}}else{var v=E+(r.w_bits-8<<4)<<8;var _=-1;if(r.strategy>=b||r.level<2){_=0}else if(r.level<6){_=1}else if(r.level===6){_=2}else{_=3}v|=_<<6;if(r.strstart!==0){v|=D}v+=31-v%31;r.status=Z;ne(r,v);if(r.strstart!==0){ne(r,e.adler>>>16);ne(r,e.adler&65535)}e.adler=1}}if(r.status===j){if(r.gzhead.extra){a=r.pending;while(r.gzindex<(r.gzhead.extra.length&65535)){if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>a){e.adler=s(e.adler,r.pending_buf,r.pending-a,a)}te(e);a=r.pending;if(r.pending===r.pending_buf_size){break}}re(r,r.gzhead.extra[r.gzindex]&255);r.gzindex++}if(r.gzhead.hcrc&&r.pending>a){e.adler=s(e.adler,r.pending_buf,r.pending-a,a)}if(r.gzindex===r.gzhead.extra.length){r.gzindex=0;r.status=H}}else{r.status=H}}if(r.status===H){if(r.gzhead.name){a=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>a){e.adler=s(e.adler,r.pending_buf,r.pending-a,a)}te(e);a=r.pending;if(r.pending===r.pending_buf_size){o=1;break}}if(r.gzindex<r.gzhead.name.length){o=r.gzhead.name.charCodeAt(r.gzindex++)&255}else{o=0}re(r,o)}while(o!==0);if(r.gzhead.hcrc&&r.pending>a){e.adler=s(e.adler,r.pending_buf,r.pending-a,a)}if(o===0){r.gzindex=0;r.status=q}}else{r.status=q}}if(r.status===q){if(r.gzhead.comment){a=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>a){e.adler=s(e.adler,r.pending_buf,r.pending-a,a)}te(e);a=r.pending;if(r.pending===r.pending_buf_size){o=1;break}}if(r.gzindex<r.gzhead.comment.length){o=r.gzhead.comment.charCodeAt(r.gzindex++)&255}else{o=0}re(r,o)}while(o!==0);if(r.gzhead.hcrc&&r.pending>a){e.adler=s(e.adler,r.pending_buf,r.pending-a,a)}if(o===0){r.status=G}}else{r.status=G}}if(r.status===G){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size){te(e)}if(r.pending+2<=r.pending_buf_size){re(r,e.adler&255);re(r,e.adler>>8&255);e.adler=0;r.status=Z}}else{r.status=Z}}if(r.pending!==0){te(e);if(e.avail_out===0){r.last_flush=-1;return h}}else if(e.avail_in===0&&Q(t)<=Q(i)&&t!==u){return J(e,g)}if(r.status===W&&e.avail_in!==0){return J(e,g)}if(e.avail_in!==0||r.lookahead!==0||t!==f&&r.status!==W){var y=r.strategy===b?pe(r,t):r.strategy===w?ue(r,t):de[r.level].func(r,t);if(y===K||y===$){r.status=W}if(y===V||y===K){if(e.avail_out===0){r.last_flush=-1}return h}if(y===Y){if(t===l){n._tr_align(r)}else if(t!==p){n._tr_stored_block(r,0,0,false);if(t===c){ee(r.head);if(r.lookahead===0){r.strstart=0;r.block_start=0;r.insert=0}}}te(e);if(e.avail_out===0){r.last_flush=-1;return h}}}if(t!==u){return h}if(r.wrap<=0){return d}if(r.wrap===2){re(r,e.adler&255);re(r,e.adler>>8&255);re(r,e.adler>>16&255);re(r,e.adler>>24&255);re(r,e.total_in&255);re(r,e.total_in>>8&255);re(r,e.total_in>>16&255);re(r,e.total_in>>24&255)}else{ne(r,e.adler>>>16);ne(r,e.adler&65535)}te(e);if(r.wrap>0){r.wrap=-r.wrap}return r.pending!==0?h:d}function ke(e){var t;if(!e||!e.state){return m}t=e.state.status;if(t!==M&&t!==j&&t!==H&&t!==q&&t!==G&&t!==Z&&t!==W){return J(e,m)}e.state=null;return t===Z?J(e,v):h}i.deflateInit=we;i.deflateInit2=be;i.deflateReset=_e;i.deflateResetKeep=ge;i.deflateSetHeader=ye;i.deflate=xe;i.deflateEnd=ke;i.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":73,"./adler32":74,"./crc32":76,"./messages":81,"./trees":82}],78:[function(e,t,i){"use strict";var r=30;var n=12;t.exports=function a(e,t){var i;var a;var s;var o;var f;var l;var c;var u;var p;var h;var d;var m;var v;var g;var _;var y;var b;var w;var x;var k;var S;var E;var A;var U,T;i=e.state;a=e.next_in;U=e.input;s=a+(e.avail_in-5);o=e.next_out;T=e.output;f=o-(t-e.avail_out);l=o+(e.avail_out-257);c=i.dmax;u=i.wsize;p=i.whave;h=i.wnext;d=i.window;m=i.hold;v=i.bits;g=i.lencode;_=i.distcode;y=(1<<i.lenbits)-1;b=(1<<i.distbits)-1;e:do{if(v<15){m+=U[a++]<<v;v+=8;m+=U[a++]<<v;v+=8}w=g[m&y];t:for(;;){x=w>>>24;m>>>=x;v-=x;x=w>>>16&255;if(x===0){T[o++]=w&65535}else if(x&16){k=w&65535;x&=15;if(x){if(v<x){m+=U[a++]<<v;v+=8}k+=m&(1<<x)-1;m>>>=x;v-=x}if(v<15){m+=U[a++]<<v;v+=8;m+=U[a++]<<v;v+=8}w=_[m&b];i:for(;;){x=w>>>24;m>>>=x;v-=x;x=w>>>16&255;if(x&16){S=w&65535;x&=15;if(v<x){m+=U[a++]<<v;v+=8;if(v<x){m+=U[a++]<<v;v+=8}}S+=m&(1<<x)-1;if(S>c){e.msg="invalid distance too far back";i.mode=r;break e}m>>>=x;v-=x;x=o-f;if(S>x){x=S-x;if(x>p){if(i.sane){e.msg="invalid distance too far back";i.mode=r;break e}}E=0;A=d;if(h===0){E+=u-x;if(x<k){k-=x;do{T[o++]=d[E++]}while(--x);E=o-S;A=T}}else if(h<x){E+=u+h-x;x-=h;if(x<k){k-=x;do{T[o++]=d[E++]}while(--x);E=0;if(h<k){x=h;k-=x;do{T[o++]=d[E++]}while(--x);E=o-S;A=T}}}else{E+=h-x;if(x<k){k-=x;do{T[o++]=d[E++]}while(--x);E=o-S;A=T}}while(k>2){T[o++]=A[E++];T[o++]=A[E++];T[o++]=A[E++];k-=3}if(k){T[o++]=A[E++];if(k>1){T[o++]=A[E++]}}}else{E=o-S;do{T[o++]=T[E++];T[o++]=T[E++];T[o++]=T[E++];k-=3}while(k>2);if(k){T[o++]=T[E++];if(k>1){T[o++]=T[E++]}}}}else if((x&64)===0){w=_[(w&65535)+(m&(1<<x)-1)];continue i}else{e.msg="invalid distance code";i.mode=r;break e}break}}else if((x&64)===0){w=g[(w&65535)+(m&(1<<x)-1)];continue t}else if(x&32){i.mode=n;break e}else{e.msg="invalid literal/length code";i.mode=r;break e}break}}while(a<s&&o<l);k=v>>3;a-=k;v-=k<<3;m&=(1<<v)-1;e.next_in=a;e.next_out=o;e.avail_in=a<s?5+(s-a):5-(a-s);e.avail_out=o<l?257+(l-o):257-(o-l);i.hold=m;i.bits=v;return}},{}],79:[function(e,t,i){"use strict";var r=e("../utils/common");var n=e("./adler32");var a=e("./crc32");var s=e("./inffast");var o=e("./inftrees");var f=0;var l=1;var c=2;var u=4;var p=5;var h=6;var d=0;var m=1;var v=2;var g=-2;var _=-3;var y=-4;var b=-5;var w=8;var x=1;var k=2;var S=3;var E=4;var A=5;var U=6;var T=7;var I=8;var L=9;var B=10;var z=11;var R=12;var C=13;var F=14;var O=15;var N=16;var P=17;var D=18;var M=19;var j=20;var H=21;var q=22;var G=23;var Z=24;var W=25;var V=26;var Y=27;var K=28;var $=29;var X=30;var J=31;var Q=32;var ee=852;var te=592;var ie=15;var re=ie;function ne(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function ae(){this.mode=0;this.last=false;this.wrap=0;this.havedict=false;this.flags=0;this.dmax=0;this.check=0;this.total=0;this.head=null;this.wbits=0;this.wsize=0;this.whave=0;this.wnext=0;this.window=null;this.hold=0;this.bits=0;this.length=0;this.offset=0;this.extra=0;this.lencode=null;this.distcode=null;this.lenbits=0;this.distbits=0;this.ncode=0;this.nlen=0;this.ndist=0;this.have=0;this.next=null;this.lens=new r.Buf16(320);this.work=new r.Buf16(288);this.lendyn=null;this.distdyn=null;this.sane=0;this.back=0;this.was=0}function se(e){var t;if(!e||!e.state){return g}t=e.state;e.total_in=e.total_out=t.total=0;e.msg="";if(t.wrap){e.adler=t.wrap&1}t.mode=x;t.last=0;t.havedict=0;t.dmax=32768;t.head=null;t.hold=0;t.bits=0;t.lencode=t.lendyn=new r.Buf32(ee);t.distcode=t.distdyn=new r.Buf32(te);t.sane=1;t.back=-1;return d}function oe(e){var t;if(!e||!e.state){return g}t=e.state;t.wsize=0;t.whave=0;t.wnext=0;return se(e)}function fe(e,t){var i;var r;if(!e||!e.state){return g}r=e.state;if(t<0){i=0;t=-t}else{i=(t>>4)+1;if(t<48){t&=15}}if(t&&(t<8||t>15)){return g}if(r.window!==null&&r.wbits!==t){r.window=null}r.wrap=i;r.wbits=t;return oe(e)}function le(e,t){var i;var r;if(!e){return g}r=new ae;e.state=r;r.window=null;i=fe(e,t);if(i!==d){e.state=null}return i}function ce(e){return le(e,re)}var ue=true;var pe,he;function de(e){if(ue){var t;pe=new r.Buf32(512);he=new r.Buf32(32);t=0;while(t<144){e.lens[t++]=8}while(t<256){e.lens[t++]=9}while(t<280){e.lens[t++]=7}while(t<288){e.lens[t++]=8}o(l,e.lens,0,288,pe,0,e.work,{bits:9});t=0;while(t<32){e.lens[t++]=5}o(c,e.lens,0,32,he,0,e.work,{bits:5});ue=false}e.lencode=pe;e.lenbits=9;e.distcode=he;e.distbits=5}function me(e,t,i,n){var a;var s=e.state;if(s.window===null){s.wsize=1<<s.wbits;s.wnext=0;s.whave=0;s.window=new r.Buf8(s.wsize)}if(n>=s.wsize){r.arraySet(s.window,t,i-s.wsize,s.wsize,0);s.wnext=0;s.whave=s.wsize}else{a=s.wsize-s.wnext;if(a>n){a=n}r.arraySet(s.window,t,i-n,a,s.wnext);n-=a;if(n){r.arraySet(s.window,t,i-n,n,0);s.wnext=n;s.whave=s.wsize}else{s.wnext+=a;if(s.wnext===s.wsize){s.wnext=0}if(s.whave<s.wsize){s.whave+=a}}}return 0}function ve(e,t){var i;var ee,te;var ie;var re;var ae,se;var oe;var fe;var le,ce;var ue;var pe;var he;var ve=0;var ge,_e,ye;var be,we,xe;var ke;var Se;var Ee=new r.Buf8(4);var Ae;var Ue;var Te=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0){return g}i=e.state;if(i.mode===R){i.mode=C}re=e.next_out;te=e.output;se=e.avail_out;ie=e.next_in;ee=e.input;ae=e.avail_in;oe=i.hold;fe=i.bits;le=ae;ce=se;Se=d;e:for(;;){switch(i.mode){case x:if(i.wrap===0){i.mode=C;break}while(fe<16){if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}if(i.wrap&2&&oe===35615){i.check=0;Ee[0]=oe&255;Ee[1]=oe>>>8&255;i.check=a(i.check,Ee,2,0);oe=0;fe=0;i.mode=k;break}i.flags=0;if(i.head){i.head.done=false}if(!(i.wrap&1)||(((oe&255)<<8)+(oe>>8))%31){e.msg="incorrect header check";i.mode=X;break}if((oe&15)!==w){e.msg="unknown compression method";i.mode=X;break}oe>>>=4;fe-=4;ke=(oe&15)+8;if(i.wbits===0){i.wbits=ke}else if(ke>i.wbits){e.msg="invalid window size";i.mode=X;break}i.dmax=1<<ke;e.adler=i.check=1;i.mode=oe&512?B:R;oe=0;fe=0;break;case k:while(fe<16){if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}i.flags=oe;if((i.flags&255)!==w){e.msg="unknown compression method";i.mode=X;break}if(i.flags&57344){e.msg="unknown header flags set";i.mode=X;break}if(i.head){i.head.text=oe>>8&1}if(i.flags&512){Ee[0]=oe&255;Ee[1]=oe>>>8&255;i.check=a(i.check,Ee,2,0)}oe=0;fe=0;i.mode=S;case S:while(fe<32){if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}if(i.head){i.head.time=oe}if(i.flags&512){Ee[0]=oe&255;Ee[1]=oe>>>8&255;Ee[2]=oe>>>16&255;Ee[3]=oe>>>24&255;i.check=a(i.check,Ee,4,0)}oe=0;fe=0;i.mode=E;case E:while(fe<16){if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}if(i.head){i.head.xflags=oe&255;i.head.os=oe>>8}if(i.flags&512){Ee[0]=oe&255;Ee[1]=oe>>>8&255;i.check=a(i.check,Ee,2,0)}oe=0;fe=0;i.mode=A;case A:if(i.flags&1024){while(fe<16){if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}i.length=oe;if(i.head){i.head.extra_len=oe}if(i.flags&512){Ee[0]=oe&255;Ee[1]=oe>>>8&255;i.check=a(i.check,Ee,2,0)}oe=0;fe=0}else if(i.head){i.head.extra=null}i.mode=U;case U:if(i.flags&1024){ue=i.length;if(ue>ae){ue=ae}if(ue){if(i.head){ke=i.head.extra_len-i.length;if(!i.head.extra){i.head.extra=new Array(i.head.extra_len)}r.arraySet(i.head.extra,ee,ie,ue,ke)}if(i.flags&512){i.check=a(i.check,ee,ue,ie)}ae-=ue;ie+=ue;i.length-=ue}if(i.length){break e}}i.length=0;i.mode=T;case T:if(i.flags&2048){if(ae===0){break e}ue=0;do{ke=ee[ie+ue++];if(i.head&&ke&&i.length<65536){i.head.name+=String.fromCharCode(ke)}}while(ke&&ue<ae);if(i.flags&512){i.check=a(i.check,ee,ue,ie)}ae-=ue;ie+=ue;if(ke){break e}}else if(i.head){i.head.name=null}i.length=0;i.mode=I;case I:if(i.flags&4096){if(ae===0){break e}ue=0;do{ke=ee[ie+ue++];if(i.head&&ke&&i.length<65536){i.head.comment+=String.fromCharCode(ke)}}while(ke&&ue<ae);if(i.flags&512){i.check=a(i.check,ee,ue,ie)}ae-=ue;ie+=ue;if(ke){break e}}else if(i.head){i.head.comment=null}i.mode=L;case L:if(i.flags&512){while(fe<16){if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}if(oe!==(i.check&65535)){e.msg="header crc mismatch";i.mode=X;break}oe=0;fe=0}if(i.head){i.head.hcrc=i.flags>>9&1;i.head.done=true}e.adler=i.check=0;i.mode=R;break;case B:while(fe<32){if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}e.adler=i.check=ne(oe);oe=0;fe=0;i.mode=z;case z:if(i.havedict===0){e.next_out=re;e.avail_out=se;e.next_in=ie;e.avail_in=ae;i.hold=oe;i.bits=fe;return v}e.adler=i.check=1;i.mode=R;case R:if(t===p||t===h){break e}case C:if(i.last){oe>>>=fe&7;fe-=fe&7;i.mode=Y;break}while(fe<3){if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}i.last=oe&1;oe>>>=1;fe-=1;switch(oe&3){case 0:i.mode=F;break;case 1:de(i);i.mode=j;if(t===h){oe>>>=2;fe-=2;break e}break;case 2:i.mode=P;break;case 3:e.msg="invalid block type";i.mode=X}oe>>>=2;fe-=2;break;case F:oe>>>=fe&7;fe-=fe&7;while(fe<32){if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}if((oe&65535)!==(oe>>>16^65535)){e.msg="invalid stored block lengths";i.mode=X;break}i.length=oe&65535;oe=0;fe=0;i.mode=O;if(t===h){break e}case O:i.mode=N;case N:ue=i.length;if(ue){if(ue>ae){ue=ae}if(ue>se){ue=se}if(ue===0){break e}r.arraySet(te,ee,ie,ue,re);ae-=ue;ie+=ue;se-=ue;re+=ue;i.length-=ue;break}i.mode=R;break;case P:while(fe<14){if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}i.nlen=(oe&31)+257;oe>>>=5;fe-=5;i.ndist=(oe&31)+1;oe>>>=5;fe-=5;i.ncode=(oe&15)+4;oe>>>=4;fe-=4;if(i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols";i.mode=X;break}i.have=0;i.mode=D;case D:while(i.have<i.ncode){while(fe<3){if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}i.lens[Te[i.have++]]=oe&7;oe>>>=3;fe-=3}while(i.have<19){i.lens[Te[i.have++]]=0}i.lencode=i.lendyn;i.lenbits=7;Ae={bits:i.lenbits};Se=o(f,i.lens,0,19,i.lencode,0,i.work,Ae);i.lenbits=Ae.bits;if(Se){e.msg="invalid code lengths set";i.mode=X;break}i.have=0;i.mode=M;case M:while(i.have<i.nlen+i.ndist){for(;;){ve=i.lencode[oe&(1<<i.lenbits)-1];ge=ve>>>24;_e=ve>>>16&255;ye=ve&65535;if(ge<=fe){break}if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}if(ye<16){oe>>>=ge;fe-=ge;i.lens[i.have++]=ye}else{if(ye===16){Ue=ge+2;while(fe<Ue){if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}oe>>>=ge;fe-=ge;if(i.have===0){e.msg="invalid bit length repeat";i.mode=X;break}ke=i.lens[i.have-1];ue=3+(oe&3);oe>>>=2;fe-=2}else if(ye===17){Ue=ge+3;while(fe<Ue){if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}oe>>>=ge;fe-=ge;ke=0;ue=3+(oe&7);oe>>>=3;fe-=3}else{Ue=ge+7;while(fe<Ue){if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}oe>>>=ge;fe-=ge;ke=0;ue=11+(oe&127);oe>>>=7;fe-=7}if(i.have+ue>i.nlen+i.ndist){e.msg="invalid bit length repeat";i.mode=X;break}while(ue--){i.lens[i.have++]=ke}}}if(i.mode===X){break}if(i.lens[256]===0){e.msg="invalid code -- missing end-of-block";i.mode=X;break}i.lenbits=9;Ae={bits:i.lenbits};Se=o(l,i.lens,0,i.nlen,i.lencode,0,i.work,Ae);i.lenbits=Ae.bits;if(Se){e.msg="invalid literal/lengths set";i.mode=X;break}i.distbits=6;i.distcode=i.distdyn;Ae={bits:i.distbits};Se=o(c,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,Ae);i.distbits=Ae.bits;if(Se){e.msg="invalid distances set";i.mode=X;break}i.mode=j;if(t===h){break e}case j:i.mode=H;case H:if(ae>=6&&se>=258){e.next_out=re;e.avail_out=se;e.next_in=ie;e.avail_in=ae;i.hold=oe;i.bits=fe;s(e,ce);re=e.next_out;te=e.output;se=e.avail_out;ie=e.next_in;ee=e.input;ae=e.avail_in;oe=i.hold;fe=i.bits;if(i.mode===R){i.back=-1}break}i.back=0;for(;;){ve=i.lencode[oe&(1<<i.lenbits)-1];ge=ve>>>24;_e=ve>>>16&255;ye=ve&65535;if(ge<=fe){break}if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}if(_e&&(_e&240)===0){be=ge;we=_e;xe=ye;for(;;){ve=i.lencode[xe+((oe&(1<<be+we)-1)>>be)];ge=ve>>>24;_e=ve>>>16&255;ye=ve&65535;if(be+ge<=fe){break}if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}oe>>>=be;fe-=be;i.back+=be}oe>>>=ge;fe-=ge;i.back+=ge;i.length=ye;if(_e===0){i.mode=V;break}if(_e&32){i.back=-1;i.mode=R;break}if(_e&64){e.msg="invalid literal/length code";i.mode=X;break}i.extra=_e&15;i.mode=q;case q:if(i.extra){Ue=i.extra;while(fe<Ue){if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}i.length+=oe&(1<<i.extra)-1;oe>>>=i.extra;fe-=i.extra;i.back+=i.extra}i.was=i.length;i.mode=G;case G:for(;;){ve=i.distcode[oe&(1<<i.distbits)-1];ge=ve>>>24;_e=ve>>>16&255;ye=ve&65535;if(ge<=fe){break}if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}if((_e&240)===0){be=ge;we=_e;xe=ye;for(;;){ve=i.distcode[xe+((oe&(1<<be+we)-1)>>be)];ge=ve>>>24;_e=ve>>>16&255;ye=ve&65535;if(be+ge<=fe){break}if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}oe>>>=be;fe-=be;i.back+=be}oe>>>=ge;fe-=ge;i.back+=ge;if(_e&64){e.msg="invalid distance code";i.mode=X;break}i.offset=ye;i.extra=_e&15;i.mode=Z;case Z:if(i.extra){Ue=i.extra;while(fe<Ue){if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}i.offset+=oe&(1<<i.extra)-1;oe>>>=i.extra;fe-=i.extra;i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back";i.mode=X;break}i.mode=W;case W:if(se===0){break e}ue=ce-se;if(i.offset>ue){ue=i.offset-ue;if(ue>i.whave){if(i.sane){e.msg="invalid distance too far back";i.mode=X;break}}if(ue>i.wnext){ue-=i.wnext;pe=i.wsize-ue}else{pe=i.wnext-ue}if(ue>i.length){ue=i.length}he=i.window}else{he=te;pe=re-i.offset;ue=i.length}if(ue>se){ue=se}se-=ue;i.length-=ue;do{te[re++]=he[pe++]}while(--ue);if(i.length===0){i.mode=H}break;case V:if(se===0){break e}te[re++]=i.length;se--;i.mode=H;break;case Y:if(i.wrap){while(fe<32){if(ae===0){break e}ae--;oe|=ee[ie++]<<fe;fe+=8}ce-=se;e.total_out+=ce;i.total+=ce;if(ce){e.adler=i.check=i.flags?a(i.check,te,ce,re-ce):n(i.check,te,ce,re-ce)}ce=se;if((i.flags?oe:ne(oe))!==i.check){e.msg="incorrect data check";i.mode=X;break}oe=0;fe=0}i.mode=K;case K:if(i.wrap&&i.flags){while(fe<32){if(ae===0){break e}ae--;oe+=ee[ie++]<<fe;fe+=8}if(oe!==(i.total&4294967295)){e.msg="incorrect length check";i.mode=X;break}oe=0;fe=0}i.mode=$;case $:Se=m;break e;case X:Se=_;break e;case J:return y;case Q:default:return g}}e.next_out=re;e.avail_out=se;e.next_in=ie;e.avail_in=ae;i.hold=oe;i.bits=fe;if(i.wsize||ce!==e.avail_out&&i.mode<X&&(i.mode<Y||t!==u)){if(me(e,e.output,e.next_out,ce-e.avail_out)){i.mode=J;return y}}le-=e.avail_in;ce-=e.avail_out;e.total_in+=le;e.total_out+=ce;i.total+=ce;if(i.wrap&&ce){e.adler=i.check=i.flags?a(i.check,te,ce,e.next_out-ce):n(i.check,te,ce,e.next_out-ce)}e.data_type=i.bits+(i.last?64:0)+(i.mode===R?128:0)+(i.mode===j||i.mode===O?256:0);if((le===0&&ce===0||t===u)&&Se===d){Se=b}return Se}function ge(e){if(!e||!e.state){return g}var t=e.state;if(t.window){t.window=null}e.state=null;return d}function _e(e,t){var i;if(!e||!e.state){return g}i=e.state;if((i.wrap&2)===0){return g}i.head=t;t.done=false;return d}i.inflateReset=oe;i.inflateReset2=fe;i.inflateResetKeep=se;i.inflateInit=ce;i.inflateInit2=le;i.inflate=ve;i.inflateEnd=ge;i.inflateGetHeader=_e;i.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":73,"./adler32":74,"./crc32":76,"./inffast":78,"./inftrees":80}],80:[function(e,t,i){"use strict";var r=e("../utils/common");var n=15;var a=852;var s=592;var o=0;var f=1;var l=2;var c=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0];var u=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78];var p=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0];var h=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function d(e,t,i,m,v,g,_,y){var b=y.bits;var w=0;var x=0;var k=0,S=0;var E=0;var A=0;var U=0;var T=0;var I=0;var L=0;var B;var z;var R;var C;var F;var O=null;var N=0;var P;var D=new r.Buf16(n+1);var M=new r.Buf16(n+1);var j=null;var H=0;var q,G,Z;for(w=0;w<=n;w++){D[w]=0}for(x=0;x<m;x++){D[t[i+x]]++}E=b;for(S=n;S>=1;S--){if(D[S]!==0){break}}if(E>S){E=S}if(S===0){v[g++]=1<<24|64<<16|0;v[g++]=1<<24|64<<16|0;y.bits=1;return 0}for(k=1;k<S;k++){if(D[k]!==0){break}}if(E<k){E=k}T=1;for(w=1;w<=n;w++){T<<=1;T-=D[w];if(T<0){return-1}}if(T>0&&(e===o||S!==1)){return-1}M[1]=0;for(w=1;w<n;w++){M[w+1]=M[w]+D[w]}for(x=0;x<m;x++){if(t[i+x]!==0){_[M[t[i+x]]++]=x}}if(e===o){O=j=_;P=19}else if(e===f){O=c;N-=257;j=u;H-=257;P=256}else{O=p;j=h;P=-1}L=0;x=0;w=k;F=g;A=E;U=0;R=-1;I=1<<E;C=I-1;if(e===f&&I>a||e===l&&I>s){return 1}var W=0;for(;;){W++;q=w-U;if(_[x]<P){G=0;Z=_[x]}else if(_[x]>P){G=j[H+_[x]];Z=O[N+_[x]]}else{G=32+64;Z=0}B=1<<w-U;z=1<<A;k=z;do{z-=B;v[F+(L>>U)+z]=q<<24|G<<16|Z|0}while(z!==0);B=1<<w-1;while(L&B){B>>=1}if(B!==0){L&=B-1;L+=B}else{L=0}x++;if(--D[w]===0){if(w===S){break}w=t[i+_[x]]}if(w>E&&(L&C)!==R){if(U===0){U=E}F+=k;A=w-U;T=1<<A;while(A+U<S){T-=D[A+U];if(T<=0){break}A++;T<<=1}I+=1<<A;if(e===f&&I>a||e===l&&I>s){return 1}R=L&C;v[R]=E<<24|A<<16|F-g|0}}if(L!==0){v[F+L]=w-U<<24|64<<16|0}y.bits=E;return 0}},{"../utils/common":73}],81:[function(e,t,i){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],82:[function(e,t,i){"use strict";var r=e("../utils/common");var n=4;var a=0;var s=1;var o=2;function f(e){var t=e.length;while(--t>=0){e[t]=0}}var l=0;var c=1;var u=2;var p=3;var h=258;var d=29;var m=256;var v=m+1+d;var g=30;var _=19;var y=2*v+1;var b=15;var w=16;var x=7;var k=256;var S=16;var E=17;var A=18;var U=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];var T=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];var I=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];var L=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];var B=512;var z=new Array((v+2)*2);f(z);var R=new Array(g*2);f(R);var C=new Array(B);f(C);var F=new Array(h-p+1);f(F);var O=new Array(d);f(O);var N=new Array(g);
+f(N);var P=function(e,t,i,r,n){this.static_tree=e;this.extra_bits=t;this.extra_base=i;this.elems=r;this.max_length=n;this.has_stree=e&&e.length};var D;var M;var j;var H=function(e,t){this.dyn_tree=e;this.max_code=0;this.stat_desc=t};function q(e){return e<256?C[e]:C[256+(e>>>7)]}function G(e,t){e.pending_buf[e.pending++]=t&255;e.pending_buf[e.pending++]=t>>>8&255}function Z(e,t,i){if(e.bi_valid>w-i){e.bi_buf|=t<<e.bi_valid&65535;G(e,e.bi_buf);e.bi_buf=t>>w-e.bi_valid;e.bi_valid+=i-w}else{e.bi_buf|=t<<e.bi_valid&65535;e.bi_valid+=i}}function W(e,t,i){Z(e,i[t*2],i[t*2+1])}function V(e,t){var i=0;do{i|=e&1;e>>>=1;i<<=1}while(--t>0);return i>>>1}function Y(e){if(e.bi_valid===16){G(e,e.bi_buf);e.bi_buf=0;e.bi_valid=0}else if(e.bi_valid>=8){e.pending_buf[e.pending++]=e.bi_buf&255;e.bi_buf>>=8;e.bi_valid-=8}}function K(e,t){var i=t.dyn_tree;var r=t.max_code;var n=t.stat_desc.static_tree;var a=t.stat_desc.has_stree;var s=t.stat_desc.extra_bits;var o=t.stat_desc.extra_base;var f=t.stat_desc.max_length;var l;var c,u;var p;var h;var d;var m=0;for(p=0;p<=b;p++){e.bl_count[p]=0}i[e.heap[e.heap_max]*2+1]=0;for(l=e.heap_max+1;l<y;l++){c=e.heap[l];p=i[i[c*2+1]*2+1]+1;if(p>f){p=f;m++}i[c*2+1]=p;if(c>r){continue}e.bl_count[p]++;h=0;if(c>=o){h=s[c-o]}d=i[c*2];e.opt_len+=d*(p+h);if(a){e.static_len+=d*(n[c*2+1]+h)}}if(m===0){return}do{p=f-1;while(e.bl_count[p]===0){p--}e.bl_count[p]--;e.bl_count[p+1]+=2;e.bl_count[f]--;m-=2}while(m>0);for(p=f;p!==0;p--){c=e.bl_count[p];while(c!==0){u=e.heap[--l];if(u>r){continue}if(i[u*2+1]!==p){e.opt_len+=(p-i[u*2+1])*i[u*2];i[u*2+1]=p}c--}}}function $(e,t,i){var r=new Array(b+1);var n=0;var a;var s;for(a=1;a<=b;a++){r[a]=n=n+i[a-1]<<1}for(s=0;s<=t;s++){var o=e[s*2+1];if(o===0){continue}e[s*2]=V(r[o]++,o)}}function X(){var e;var t;var i;var r;var n;var a=new Array(b+1);i=0;for(r=0;r<d-1;r++){O[r]=i;for(e=0;e<1<<U[r];e++){F[i++]=r}}F[i-1]=r;n=0;for(r=0;r<16;r++){N[r]=n;for(e=0;e<1<<T[r];e++){C[n++]=r}}n>>=7;for(;r<g;r++){N[r]=n<<7;for(e=0;e<1<<T[r]-7;e++){C[256+n++]=r}}for(t=0;t<=b;t++){a[t]=0}e=0;while(e<=143){z[e*2+1]=8;e++;a[8]++}while(e<=255){z[e*2+1]=9;e++;a[9]++}while(e<=279){z[e*2+1]=7;e++;a[7]++}while(e<=287){z[e*2+1]=8;e++;a[8]++}$(z,v+1,a);for(e=0;e<g;e++){R[e*2+1]=5;R[e*2]=V(e,5)}D=new P(z,U,m+1,v,b);M=new P(R,T,0,g,b);j=new P(new Array(0),I,0,_,x)}function J(e){var t;for(t=0;t<v;t++){e.dyn_ltree[t*2]=0}for(t=0;t<g;t++){e.dyn_dtree[t*2]=0}for(t=0;t<_;t++){e.bl_tree[t*2]=0}e.dyn_ltree[k*2]=1;e.opt_len=e.static_len=0;e.last_lit=e.matches=0}function Q(e){if(e.bi_valid>8){G(e,e.bi_buf)}else if(e.bi_valid>0){e.pending_buf[e.pending++]=e.bi_buf}e.bi_buf=0;e.bi_valid=0}function ee(e,t,i,n){Q(e);if(n){G(e,i);G(e,~i)}r.arraySet(e.pending_buf,e.window,t,i,e.pending);e.pending+=i}function te(e,t,i,r){var n=t*2;var a=i*2;return e[n]<e[a]||e[n]===e[a]&&r[t]<=r[i]}function ie(e,t,i){var r=e.heap[i];var n=i<<1;while(n<=e.heap_len){if(n<e.heap_len&&te(t,e.heap[n+1],e.heap[n],e.depth)){n++}if(te(t,r,e.heap[n],e.depth)){break}e.heap[i]=e.heap[n];i=n;n<<=1}e.heap[i]=r}function re(e,t,i){var r;var n;var a=0;var s;var o;if(e.last_lit!==0){do{r=e.pending_buf[e.d_buf+a*2]<<8|e.pending_buf[e.d_buf+a*2+1];n=e.pending_buf[e.l_buf+a];a++;if(r===0){W(e,n,t)}else{s=F[n];W(e,s+m+1,t);o=U[s];if(o!==0){n-=O[s];Z(e,n,o)}r--;s=q(r);W(e,s,i);o=T[s];if(o!==0){r-=N[s];Z(e,r,o)}}}while(a<e.last_lit)}W(e,k,t)}function ne(e,t){var i=t.dyn_tree;var r=t.stat_desc.static_tree;var n=t.stat_desc.has_stree;var a=t.stat_desc.elems;var s,o;var f=-1;var l;e.heap_len=0;e.heap_max=y;for(s=0;s<a;s++){if(i[s*2]!==0){e.heap[++e.heap_len]=f=s;e.depth[s]=0}else{i[s*2+1]=0}}while(e.heap_len<2){l=e.heap[++e.heap_len]=f<2?++f:0;i[l*2]=1;e.depth[l]=0;e.opt_len--;if(n){e.static_len-=r[l*2+1]}}t.max_code=f;for(s=e.heap_len>>1;s>=1;s--){ie(e,i,s)}l=a;do{s=e.heap[1];e.heap[1]=e.heap[e.heap_len--];ie(e,i,1);o=e.heap[1];e.heap[--e.heap_max]=s;e.heap[--e.heap_max]=o;i[l*2]=i[s*2]+i[o*2];e.depth[l]=(e.depth[s]>=e.depth[o]?e.depth[s]:e.depth[o])+1;i[s*2+1]=i[o*2+1]=l;e.heap[1]=l++;ie(e,i,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1];K(e,t);$(i,f,e.bl_count)}function ae(e,t,i){var r;var n=-1;var a;var s=t[0*2+1];var o=0;var f=7;var l=4;if(s===0){f=138;l=3}t[(i+1)*2+1]=65535;for(r=0;r<=i;r++){a=s;s=t[(r+1)*2+1];if(++o<f&&a===s){continue}else if(o<l){e.bl_tree[a*2]+=o}else if(a!==0){if(a!==n){e.bl_tree[a*2]++}e.bl_tree[S*2]++}else if(o<=10){e.bl_tree[E*2]++}else{e.bl_tree[A*2]++}o=0;n=a;if(s===0){f=138;l=3}else if(a===s){f=6;l=3}else{f=7;l=4}}}function se(e,t,i){var r;var n=-1;var a;var s=t[0*2+1];var o=0;var f=7;var l=4;if(s===0){f=138;l=3}for(r=0;r<=i;r++){a=s;s=t[(r+1)*2+1];if(++o<f&&a===s){continue}else if(o<l){do{W(e,a,e.bl_tree)}while(--o!==0)}else if(a!==0){if(a!==n){W(e,a,e.bl_tree);o--}W(e,S,e.bl_tree);Z(e,o-3,2)}else if(o<=10){W(e,E,e.bl_tree);Z(e,o-3,3)}else{W(e,A,e.bl_tree);Z(e,o-11,7)}o=0;n=a;if(s===0){f=138;l=3}else if(a===s){f=6;l=3}else{f=7;l=4}}}function oe(e){var t;ae(e,e.dyn_ltree,e.l_desc.max_code);ae(e,e.dyn_dtree,e.d_desc.max_code);ne(e,e.bl_desc);for(t=_-1;t>=3;t--){if(e.bl_tree[L[t]*2+1]!==0){break}}e.opt_len+=3*(t+1)+5+5+4;return t}function fe(e,t,i,r){var n;Z(e,t-257,5);Z(e,i-1,5);Z(e,r-4,4);for(n=0;n<r;n++){Z(e,e.bl_tree[L[n]*2+1],3)}se(e,e.dyn_ltree,t-1);se(e,e.dyn_dtree,i-1)}function le(e){var t=4093624447;var i;for(i=0;i<=31;i++,t>>>=1){if(t&1&&e.dyn_ltree[i*2]!==0){return a}}if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0){return s}for(i=32;i<m;i++){if(e.dyn_ltree[i*2]!==0){return s}}return a}var ce=false;function ue(e){if(!ce){X();ce=true}e.l_desc=new H(e.dyn_ltree,D);e.d_desc=new H(e.dyn_dtree,M);e.bl_desc=new H(e.bl_tree,j);e.bi_buf=0;e.bi_valid=0;J(e)}function pe(e,t,i,r){Z(e,(l<<1)+(r?1:0),3);ee(e,t,i,true)}function he(e){Z(e,c<<1,3);W(e,k,z);Y(e)}function de(e,t,i,r){var a,s;var f=0;if(e.level>0){if(e.strm.data_type===o){e.strm.data_type=le(e)}ne(e,e.l_desc);ne(e,e.d_desc);f=oe(e);a=e.opt_len+3+7>>>3;s=e.static_len+3+7>>>3;if(s<=a){a=s}}else{a=s=i+5}if(i+4<=a&&t!==-1){pe(e,t,i,r)}else if(e.strategy===n||s===a){Z(e,(c<<1)+(r?1:0),3);re(e,z,R)}else{Z(e,(u<<1)+(r?1:0),3);fe(e,e.l_desc.max_code+1,e.d_desc.max_code+1,f+1);re(e,e.dyn_ltree,e.dyn_dtree)}J(e);if(r){Q(e)}}function me(e,t,i){e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255;e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255;e.pending_buf[e.l_buf+e.last_lit]=i&255;e.last_lit++;if(t===0){e.dyn_ltree[i*2]++}else{e.matches++;t--;e.dyn_ltree[(F[i]+m+1)*2]++;e.dyn_dtree[q(t)*2]++}return e.last_lit===e.lit_bufsize-1}i._tr_init=ue;i._tr_stored_block=pe;i._tr_flush_block=de;i._tr_tally=me;i._tr_align=he},{"../utils/common":73}],83:[function(e,t,i){"use strict";function r(){this.input=null;this.next_in=0;this.avail_in=0;this.total_in=0;this.output=null;this.next_out=0;this.avail_out=0;this.total_out=0;this.msg="";this.state=null;this.data_type=2;this.adler=0}t.exports=r},{}],84:[function(e,t,i){(function(i){t.exports=o;t.exports.decode=o;t.exports.encode=f;var r=e("bencode");var n=e("path");var a=e("simple-sha1");var s=e("uniq");function o(e){if(i.isBuffer(e)){e=r.decode(e)}u(e.info,"info");u(e.info["name.utf-8"]||e.info.name,"info.name");u(e.info["piece length"],"info['piece length']");u(e.info.pieces,"info.pieces");if(e.info.files){e.info.files.forEach(function(e){u(typeof e.length==="number","info.files[0].length");u(e["path.utf-8"]||e.path,"info.files[0].path")})}else{u(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.utf-8"]||e.info.name).toString();t.private=!!e.info.private;if(e["creation date"])t.created=new Date(e["creation date"]*1e3);if(i.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)}s(t.announce);if(i.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 o=e.info.files||[e.info];t.files=o.map(function(e,i){var r=[].concat(t.name,e["path.utf-8"]||e.path||[]).map(function(e){return e.toString()});return{path:n.join.apply(null,[n.sep].concat(r)).slice(1),name:r[r.length-1],length:e.length,offset:o.slice(0,i).reduce(l,0)}});t.length=o.reduce(l,0);var f=t.files[t.files.length-1];t.pieceLength=e.info["piece length"];t.lastPieceLength=(f.offset+f.length)%t.pieceLength||t.pieceLength;t.pieces=c(e.info.pieces);return t}function f(e){var t={info:e.info};t["announce-list"]=e.announce.map(function(e){if(!t.announce)t.announce=e;e=new i(e,"utf8");return[e]});if(e.created){t["creation date"]=e.created.getTime()/1e3|0}if(e.urlList){t["url-list"]=e.urlList}return r.encode(t)}function l(e,t){return e+t.length}function c(e){var t=[];for(var i=0;i<e.length;i+=20){t.push(e.slice(i,i+20).toString("hex"))}return t}function u(e,t){if(!e)throw new Error("Torrent is missing required field: "+t)}}).call(this,e("buffer").Buffer)},{bencode:15,buffer:36,path:86,"simple-sha1":108,uniq:117}],85:[function(e,t,i){(function(i){t.exports=f;t.exports.remote=l;var r=e("dezalgo");var n=e("fs");var a=e("simple-get");var s=e("magnet-uri");var o=e("parse-torrent-file");t.exports.toMagnetURI=s.encode;t.exports.toTorrentFile=o.encode;function f(e){var t=e&&e.length;if(typeof e==="string"&&/magnet:/.test(e)){return s(e)}else if(typeof e==="string"&&(t===40||t===32)){return s("magnet:?xt=urn:btih:"+e)}else if(i.isBuffer(e)&&t===20){return s("magnet:?xt=urn:btih:"+e.toString("hex"))}else if(i.isBuffer(e)){return o(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 l(e,t){var i;if(typeof t!=="function")throw new Error("second argument must be a Function");t=r(t);try{i=f(e)}catch(s){}if(i&&i.infoHash){t(null,i)}else if(typeof a==="function"&&/^https?:/.test(e)){a.concat({url:e,headers:{"user-agent":"WebTorrent (http://webtorrent.io)"}},function(e,i){if(e){e=new Error("Error downloading torrent: "+e.message);return t(e)}o(i)})}else if(typeof n.readFile==="function"&&typeof e==="string"){n.readFile(e,function(e,i){if(e)return t(new Error("Invalid torrent identifier"));o(i)})}else{t(new Error("Invalid torrent identifier"))}function o(e){try{i=f(e)}catch(r){return t(r)}if(i&&i.infoHash)t(null,i);else t(new Error("Invalid torrent identifier"))}}}).call(this,e("buffer").Buffer)},{buffer:36,dezalgo:43,fs:33,"magnet-uri":61,"parse-torrent-file":84,"simple-get":30}],86:[function(e,t,i){(function(e){function t(e,t){var i=0;for(var r=e.length-1;r>=0;r--){var n=e[r];if(n==="."){e.splice(r,1)}else if(n===".."){e.splice(r,1);i++}else if(i){e.splice(r,1);i--}}if(t){for(;i--;i){e.unshift("..")}}return e}var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var n=function(e){return r.exec(e).slice(1)};i.resolve=function(){var i="",r=false;for(var n=arguments.length-1;n>=-1&&!r;n--){var s=n>=0?arguments[n]:e.cwd();if(typeof s!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!s){continue}i=s+"/"+i;r=s.charAt(0)==="/"}i=t(a(i.split("/"),function(e){return!!e}),!r).join("/");return(r?"/":"")+i||"."};i.normalize=function(e){var r=i.isAbsolute(e),n=s(e,-1)==="/";e=t(a(e.split("/"),function(e){return!!e}),!r).join("/");if(!e&&!r){e="."}if(e&&n){e+="/"}return(r?"/":"")+e};i.isAbsolute=function(e){return e.charAt(0)==="/"};i.join=function(){var e=Array.prototype.slice.call(arguments,0);return i.normalize(a(e,function(e,t){if(typeof e!=="string"){throw new TypeError("Arguments to path.join must be strings")}return e}).join("/"))};i.relative=function(e,t){e=i.resolve(e).substr(1);t=i.resolve(t).substr(1);function r(e){var t=0;for(;t<e.length;t++){if(e[t]!=="")break}var i=e.length-1;for(;i>=0;i--){if(e[i]!=="")break}if(t>i)return[];return e.slice(t,i-t+1)}var n=r(e.split("/"));var a=r(t.split("/"));var s=Math.min(n.length,a.length);var o=s;for(var f=0;f<s;f++){if(n[f]!==a[f]){o=f;break}}var l=[];for(var f=o;f<n.length;f++){l.push("..")}l=l.concat(a.slice(o));return l.join("/")};i.sep="/";i.delimiter=":";i.dirname=function(e){var t=n(e),i=t[0],r=t[1];if(!i&&!r){return"."}if(r){r=r.substr(0,r.length-1)}return i+r};i.basename=function(e,t){var i=n(e)[2];if(t&&i.substr(-1*t.length)===t){i=i.substr(0,i.length-t.length)}return i};i.extname=function(e){return n(e)[3]};function a(e,t){if(e.filter)return e.filter(t);var i=[];for(var r=0;r<e.length;r++){if(t(e[r],r,e))i.push(e[r])}return i}var s="ab".substr(-1)==="b"?function(e,t,i){return e.substr(t,i)}:function(e,t,i){if(t<0)t=e.length+t;return e.substr(t,i)}}).call(this,e("_process"))},{_process:34}],87:[function(e,t,i){var r=e("closest-to");var n=[];for(var a=14;a<=22;a++){n.push(Math.pow(2,a))}t.exports=function(e){return r(e/Math.pow(2,10),n)}},{"closest-to":37}],88:[function(e,t,i){var r=e("once");var n=e("end-of-stream");var a=e("fs");var s=function(){};var o=function(e){return typeof e==="function"};var f=function(e){return(e instanceof(a.ReadStream||s)||e instanceof(a.WriteStream||s))&&o(e.close)};var l=function(e){return e.setHeader&&o(e.abort)};var c=function(e,t,i,a){a=r(a);var s=false;e.on("close",function(){s=true});n(e,{readable:t,writable:i},function(e){if(e)return a(e);s=true;a()});var c=false;return function(t){if(s)return;if(c)return;c=true;if(f(e))return e.close();if(l(e))return e.abort();if(o(e.destroy))return e.destroy();a(t||new Error("stream was destroyed"))}};var u=function(e){e()};var p=function(e,t){return e.pipe(t)};var h=function(){var e=Array.prototype.slice.call(arguments);var t=o(e[e.length-1]||s)&&e.pop()||s;if(Array.isArray(e[0]))e=e[0];if(e.length<2)throw new Error("pump requires two streams per minimum");var i;var r=e.map(function(n,a){var s=a<e.length-1;var o=a>0;return c(n,s,o,function(e){if(!i)i=e;if(e)r.forEach(u);if(s)return;r.forEach(u);t(i)})});return e.reduce(p)};t.exports=h},{"end-of-stream":44,fs:33,once:72}],89:[function(e,t,i){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,i,a){t=t||"&";i=i||"=";var s={};if(typeof e!=="string"||e.length===0){return s}var o=/\+/g;e=e.split(t);var f=1e3;if(a&&typeof a.maxKeys==="number"){f=a.maxKeys}var l=e.length;if(f>0&&l>f){l=f}for(var c=0;c<l;++c){var u=e[c].replace(o,"%20"),p=u.indexOf(i),h,d,m,v;if(p>=0){h=u.substr(0,p);d=u.substr(p+1)}else{h=u;d=""}m=decodeURIComponent(h);v=decodeURIComponent(d);if(!r(s,m)){s[m]=v}else if(n(s[m])){s[m].push(v)}else{s[m]=[s[m],v]}}return s};var n=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}},{}],90:[function(e,t,i){"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,i,o){t=t||"&";i=i||"=";if(e===null){e=undefined}if(typeof e==="object"){return a(s(e),function(s){var o=encodeURIComponent(r(s))+i;if(n(e[s])){return a(e[s],function(e){return o+encodeURIComponent(r(e))}).join(t)}else{return o+encodeURIComponent(r(e[s]))}}).join(t)}if(!o)return"";return encodeURIComponent(r(o))+i+encodeURIComponent(r(e))};var n=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};function a(e,t){if(e.map)return e.map(t);var i=[];for(var r=0;r<e.length;r++){i.push(t(e[r],r))}return i}var s=Object.keys||function(e){var t=[];for(var i in e){if(Object.prototype.hasOwnProperty.call(e,i))t.push(i)}return t}},{}],91:[function(e,t,i){"use strict";i.decode=i.parse=e("./decode");i.encode=i.stringify=e("./encode")},{"./decode":89,"./encode":90}],92:[function(e,t,i){t.exports=function(e,t){var i=true;var r=t.indexOf("=");if(-1==r)return-2;var n=t.slice(r+1).split(",").map(function(t){var t=t.split("-"),r=parseInt(t[0],10),n=parseInt(t[1],10);if(isNaN(r)){r=e-n;n=e-1}else if(isNaN(n)){n=e-1}if(n>e-1)n=e-1;if(isNaN(r)||isNaN(n)||r>n||r<0)i=false;return{start:r,end:n}});n.type=t.slice(0,r);return i?n:-1}},{}],93:[function(e,t,i){t.exports=n;t.exports.filter=a;var r=e("events").EventEmitter;function n(e,t,i){if(!Array.isArray(i))i=[i];var r=[];i.forEach(function(i){var n=function(){var e=[].slice.call(arguments);e.unshift(i);t.emit.apply(t,e)};r.push(n);e.on(i,n)});return function n(){i.forEach(function(t,i){e.removeListener(t,r[i])})}}function a(e,t){var i=new r;n(e,i,t);return i}},{events:45}],94:[function(e,t,i){t.exports=e("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":95}],95:[function(e,t,i){(function(i){t.exports=o;var r=Object.keys||function(e){var t=[];for(var i in e)t.push(i);return t};var n=e("core-util-is");n.inherits=e("inherits");var a=e("./_stream_readable");var s=e("./_stream_writable");n.inherits(o,a);l(r(s.prototype),function(e){if(!o.prototype[e])o.prototype[e]=s.prototype[e]});function o(e){if(!(this instanceof o))return new o(e);a.call(this,e);s.call(this,e);if(e&&e.readable===false)this.readable=false;if(e&&e.writable===false)this.writable=false;this.allowHalfOpen=true;if(e&&e.allowHalfOpen===false)this.allowHalfOpen=false;this.once("end",f)}function f(){if(this.allowHalfOpen||this._writableState.ended)return;i.nextTick(this.end.bind(this))}function l(e,t){for(var i=0,r=e.length;i<r;i++){t(e[i],i)}}}).call(this,e("_process"))},{"./_stream_readable":97,"./_stream_writable":99,_process:34,"core-util-is":38,inherits:55}],96:[function(e,t,i){t.exports=a;var r=e("./_stream_transform");var n=e("core-util-is");n.inherits=e("inherits");n.inherits(a,r);function a(e){if(!(this instanceof a))return new a(e);r.call(this,e)}a.prototype._transform=function(e,t,i){i(null,e)}},{"./_stream_transform":98,"core-util-is":38,inherits:55}],97:[function(e,t,i){(function(i){t.exports=u;var r=e("isarray");var n=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 s=e("stream");var o=e("core-util-is");o.inherits=e("inherits");var f;var l=e("util");if(l&&l.debuglog){l=l.debuglog("stream")}else{l=function(){}}o.inherits(u,s);function c(t,i){var r=e("./_stream_duplex");t=t||{};var n=t.highWaterMark;var a=t.objectMode?16:16*1024;this.highWaterMark=n||n===0?n: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(i 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 u(t){var i=e("./_stream_duplex");if(!(this instanceof u))return new u(t);this._readableState=new c(t,this);this.readable=true;s.call(this)}u.prototype.push=function(e,t){var i=this._readableState;if(o.isString(e)&&!i.objectMode){t=t||i.defaultEncoding;if(t!==i.encoding){e=new n(e,t);t=""}}return p(this,i,e,t,false)};u.prototype.unshift=function(e){var t=this._readableState;return p(this,t,e,"",true)};function p(e,t,i,r,n){var a=g(t,i);if(a){e.emit("error",a)}else if(o.isNullOrUndefined(i)){t.reading=false;if(!t.ended)_(e,t)}else if(t.objectMode||i&&i.length>0){if(t.ended&&!n){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&n){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{if(t.decoder&&!n&&!r)i=t.decoder.write(i);if(!n)t.reading=false;if(t.flowing&&t.length===0&&!t.sync){e.emit("data",i);e.read(0)}else{t.length+=t.objectMode?1:i.length;if(n)t.buffer.unshift(i);else t.buffer.push(i);if(t.needReadable)y(e)}w(e,t)}}else if(!n){t.reading=false}return h(t)}function h(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;return this};var d=8388608;function m(e){if(e>=d){e=d}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)||o.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}u.prototype.read=function(e){l("read",e);var t=this._readableState;var i=e;if(!o.isNumber(e)||e>0)t.emittedReadable=false;if(e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended)){l("read: emitReadable",t.length,t.ended);if(t.length===0&&t.ended)T(this);else y(this);return null}e=v(e,t);if(e===0&&t.ended){if(t.length===0)T(this);return null}var r=t.needReadable;l("need readable",r);if(t.length===0||t.length-e<t.highWaterMark){r=true;l("length less than watermark",r)}if(t.ended||t.reading){r=false;l("reading or ended",r)}if(r){l("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(i,t);var n;if(e>0)n=U(e,t);else n=null;if(o.isNull(n)){t.needReadable=true;e=0}t.length-=e;if(t.length===0&&!t.ended)t.needReadable=true;if(i!==e&&t.ended&&t.length===0)T(this);if(!o.isNull(n))this.emit("data",n);return n};function g(e,t){var i=null;if(!o.isBuffer(t)&&!o.isString(t)&&!o.isNullOrUndefined(t)&&!e.objectMode){i=new TypeError("Invalid non-string/buffer chunk")}return i}function _(e,t){if(t.decoder&&!t.ended){var i=t.decoder.end();if(i&&i.length){t.buffer.push(i);t.length+=t.objectMode?1:i.length}}t.ended=true;y(e)}function y(e){var t=e._readableState;t.needReadable=false;if(!t.emittedReadable){l("emitReadable",t.flowing);t.emittedReadable=true;if(t.sync)i.nextTick(function(){b(e)});else b(e)}}function b(e){l("emit readable");e.emit("readable");A(e)}function w(e,t){if(!t.readingMore){t.readingMore=true;i.nextTick(function(){x(e,t)})}}function x(e,t){var i=t.length;while(!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark){l("maybeReadMore read 0");e.read(0);if(i===t.length)break;else i=t.length}t.readingMore=false}u.prototype._read=function(e){this.emit("error",new Error("not implemented"))};u.prototype.pipe=function(e,t){var n=this;var s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e);break}s.pipesCount+=1;l("pipe count=%d opts=%j",s.pipesCount,t);var o=(!t||t.end!==false)&&e!==i.stdout&&e!==i.stderr;var f=o?u:h;if(s.endEmitted)i.nextTick(f);else n.once("end",f);e.on("unpipe",c);function c(e){l("onunpipe");if(e===n){h()}}function u(){l("onend");e.end()}var p=k(n);e.on("drain",p);function h(){l("cleanup");e.removeListener("close",v);e.removeListener("finish",g);e.removeListener("drain",p);e.removeListener("error",m);e.removeListener("unpipe",c);n.removeListener("end",u);n.removeListener("end",h);n.removeListener("data",d);if(s.awaitDrain&&(!e._writableState||e._writableState.needDrain))p()}n.on("data",d);function d(t){l("ondata");var i=e.write(t);if(false===i){l("false write response, pause",n._readableState.awaitDrain);n._readableState.awaitDrain++;n.pause()}}function m(t){l("onerror",t);_();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);_()}e.once("close",v);function g(){l("onfinish");e.removeListener("close",v);_()}e.once("finish",g);function _(){l("unpipe");n.unpipe(e)}e.emit("pipe",n);if(!s.flowing){l("pipe resume");n.resume()}return e};function k(e){return function(){var t=e._readableState;l("pipeOnDrain",t.awaitDrain);if(t.awaitDrain)t.awaitDrain--;if(t.awaitDrain===0&&a.listenerCount(e,"data")){t.flowing=true;A(e)}}}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;t.flowing=false;if(e)e.emit("unpipe",this);return this}if(!e){var i=t.pipes;var r=t.pipesCount;t.pipes=null;t.pipesCount=0;t.flowing=false;for(var n=0;n<r;n++)i[n].emit("unpipe",this);return this}var n=L(t.pipes,e);if(n===-1)return this;t.pipes.splice(n,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 r=s.prototype.on.call(this,e,t);if(e==="data"&&false!==this._readableState.flowing){this.resume()}if(e==="readable"&&this.readable){var n=this._readableState;if(!n.readableListening){n.readableListening=true;n.emittedReadable=false;n.needReadable=true;if(!n.reading){var a=this;i.nextTick(function(){l("readable nexttick read 0");a.read(0)})}else if(n.length){y(this,n)}}}return r};u.prototype.addListener=u.prototype.on;u.prototype.resume=function(){var e=this._readableState;if(!e.flowing){l("resume");e.flowing=true;if(!e.reading){l("resume read 0");this.read(0)}S(this,e)}return this};function S(e,t){if(!t.resumeScheduled){t.resumeScheduled=true;i.nextTick(function(){E(e,t)})}}function E(e,t){t.resumeScheduled=false;e.emit("resume");A(e);if(t.flowing&&!t.reading)e.read(0)}u.prototype.pause=function(){l("call pause flowing=%j",this._readableState.flowing);if(false!==this._readableState.flowing){l("pause");this._readableState.flowing=false;this.emit("pause")}return this};function A(e){var t=e._readableState;l("flow",t.flowing);if(t.flowing){do{var i=e.read()}while(null!==i&&t.flowing)}}u.prototype.wrap=function(e){var t=this._readableState;var i=false;var r=this;e.on("end",function(){l("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(n){l("wrapped data");if(t.decoder)n=t.decoder.write(n);if(!n||!t.objectMode&&!n.length)return;var a=r.push(n);if(!a){i=true;e.pause()}});for(var n in e){if(o.isFunction(e[n])&&o.isUndefined(this[n])){this[n]=function(t){return function(){return e[t].apply(e,arguments)}}(n)}}var a=["error","close","destroy","pause","resume"];I(a,function(t){e.on(t,r.emit.bind(r,t))});r._read=function(t){l("wrapped _read",t);if(i){i=false;e.resume()}};return r};u._fromList=U;function U(e,t){var i=t.buffer;var r=t.length;var a=!!t.decoder;var s=!!t.objectMode;var o;if(i.length===0)return null;if(r===0)o=null;else if(s)o=i.shift();else if(!e||e>=r){if(a)o=i.join("");else o=n.concat(i,r);i.length=0}else{if(e<i[0].length){var f=i[0];o=f.slice(0,e);i[0]=f.slice(e)}else if(e===i[0].length){o=i.shift()}else{if(a)o="";else o=new n(e);var l=0;for(var c=0,u=i.length;c<u&&l<e;c++){var f=i[0];var p=Math.min(e-l,f.length);if(a)o+=f.slice(0,p);else f.copy(o,l,0,p);if(p<f.length)i[0]=f.slice(p);else i.shift();l+=p}}}return o}function T(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");if(!t.endEmitted){t.ended=true;i.nextTick(function(){if(!t.endEmitted&&t.length===0){t.endEmitted=true;e.readable=false;e.emit("end")}})}}function I(e,t){for(var i=0,r=e.length;i<r;i++){t(e[i],i)}}function L(e,t){for(var i=0,r=e.length;i<r;i++){if(e[i]===t)return i}return-1}}).call(this,e("_process"))},{"./_stream_duplex":95,_process:34,buffer:36,"core-util-is":38,events:45,inherits:55,isarray:59,stream:111,"string_decoder/":112,util:30}],98:[function(e,t,i){t.exports=o;var r=e("./_stream_duplex");var n=e("core-util-is");n.inherits=e("inherits");n.inherits(o,r);function a(e,t){this.afterTransform=function(e,i){return s(t,e,i)};this.needTransform=false;this.transforming=false;this.writecb=null;this.writechunk=null}function s(e,t,i){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(!n.isNullOrUndefined(i))e.push(i);if(a)a(t);var s=e._readableState;s.reading=false;if(s.needReadable||s.length<s.highWaterMark){e._read(s.highWaterMark)}}function o(e){if(!(this instanceof o))return new o(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(n.isFunction(this._flush))this._flush(function(e){f(t,e)});else f(t)})}o.prototype.push=function(e,t){this._transformState.needTransform=false;return r.prototype.push.call(this,e,t)};o.prototype._transform=function(e,t,i){throw new Error("not implemented")};o.prototype._write=function(e,t,i){var r=this._transformState;r.writecb=i;r.writechunk=e;r.writeencoding=t;if(!r.transforming){var n=this._readableState;if(r.needTransform||n.needReadable||n.length<n.highWaterMark)this._read(n.highWaterMark)}};o.prototype._read=function(e){var t=this._transformState;if(!n.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 i=e._writableState;var r=e._transformState;if(i.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":95,"core-util-is":38,inherits:55}],99:[function(e,t,i){(function(i){t.exports=f;var r=e("buffer").Buffer;f.WritableState=o;var n=e("core-util-is");n.inherits=e("inherits");var a=e("stream");n.inherits(f,a);function s(e,t,i){this.chunk=e;this.encoding=t;this.callback=i}function o(t,i){var r=e("./_stream_duplex");t=t||{};var n=t.highWaterMark;var a=t.objectMode?16:16*1024;this.highWaterMark=n||n===0?n:a;this.objectMode=!!t.objectMode;if(i 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 s=t.decodeStrings===false;this.decodeStrings=!s;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(i,e)};this.writecb=null;this.writelen=0;this.buffer=[];this.pendingcb=0;this.prefinished=false;this.errorEmitted=false}function f(t){var i=e("./_stream_duplex");if(!(this instanceof f)&&!(this instanceof i))return new f(t);this._writableState=new o(t,this);this.writable=true;a.call(this)}f.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))};function l(e,t,r){var n=new Error("write after end");e.emit("error",n);i.nextTick(function(){r(n)})}function c(e,t,r,a){var s=true;if(!n.isBuffer(r)&&!n.isString(r)&&!n.isNullOrUndefined(r)&&!t.objectMode){var o=new TypeError("Invalid non-string/buffer chunk");e.emit("error",o);i.nextTick(function(){a(o)});s=false}return s}f.prototype.write=function(e,t,i){var r=this._writableState;var a=false;if(n.isFunction(t)){i=t;t=null}if(n.isBuffer(e))t="buffer";else if(!t)t=r.defaultEncoding;if(!n.isFunction(i))i=function(){};if(r.ended)l(this,r,i);else if(c(this,r,e,i)){r.pendingcb++;a=p(this,r,e,t,i)}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)y(this,e)}};function u(e,t,i){if(!e.objectMode&&e.decodeStrings!==false&&n.isString(t)){t=new r(t,i)}return t}function p(e,t,i,r,a){i=u(t,i,r);if(n.isBuffer(i))r="buffer";var o=t.objectMode?1:i.length;t.length+=o;var f=t.length<t.highWaterMark;if(!f)t.needDrain=true;if(t.writing||t.corked)t.buffer.push(new s(i,r,a));else h(e,t,false,o,i,r,a);return f}function h(e,t,i,r,n,a,s){t.writelen=r;t.writecb=s;t.writing=true;t.sync=true;if(i)e._writev(n,t.onwrite);else e._write(n,a,t.onwrite);t.sync=false}function d(e,t,r,n,a){if(r)i.nextTick(function(){t.pendingcb--;a(n)});else{t.pendingcb--;a(n)}e._writableState.errorEmitted=true;
+e.emit("error",n)}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 n=r.sync;var a=r.writecb;m(r);if(t)d(e,r,n,t,a);else{var s=b(e,r);if(!s&&!r.corked&&!r.bufferProcessing&&r.buffer.length){y(e,r)}if(n){i.nextTick(function(){g(e,r,s,a)})}else{g(e,r,s,a)}}}function g(e,t,i,r){if(!i)_(e,t);t.pendingcb--;r();x(e,t)}function _(e,t){if(t.length===0&&t.needDrain){t.needDrain=false;e.emit("drain")}}function y(e,t){t.bufferProcessing=true;if(e._writev&&t.buffer.length>1){var i=[];for(var r=0;r<t.buffer.length;r++)i.push(t.buffer[r].callback);t.pendingcb++;h(e,t,true,t.length,t.buffer,"",function(e){for(var r=0;r<i.length;r++){t.pendingcb--;i[r](e)}});t.buffer=[]}else{for(var r=0;r<t.buffer.length;r++){var n=t.buffer[r];var a=n.chunk;var s=n.encoding;var o=n.callback;var f=t.objectMode?1:a.length;h(e,t,false,f,a,s,o);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,i){i(new Error("not implemented"))};f.prototype._writev=null;f.prototype.end=function(e,t,i){var r=this._writableState;if(n.isFunction(e)){i=e;e=null;t=null}else if(n.isFunction(t)){i=t;t=null}if(!n.isNullOrUndefined(e))this.write(e,t);if(r.corked){r.corked=1;this.uncork()}if(!r.ending&&!r.finished)k(this,r,i)};function b(e,t){return t.ending&&t.length===0&&!t.finished&&!t.writing}function w(e,t){if(!t.prefinished){t.prefinished=true;e.emit("prefinish")}}function x(e,t){var i=b(e,t);if(i){if(t.pendingcb===0){w(e,t);t.finished=true;e.emit("finish")}else w(e,t)}return i}function k(e,t,r){t.ending=true;x(e,t);if(r){if(t.finished)i.nextTick(r);else e.once("finish",r)}t.ended=true}}).call(this,e("_process"))},{"./_stream_duplex":95,_process:34,buffer:36,"core-util-is":38,inherits:55,stream:111}],100:[function(e,t,i){t.exports=e("./lib/_stream_passthrough.js")},{"./lib/_stream_passthrough.js":96}],101:[function(e,t,i){i=t.exports=e("./lib/_stream_readable.js");i.Stream=e("stream");i.Readable=i;i.Writable=e("./lib/_stream_writable.js");i.Duplex=e("./lib/_stream_duplex.js");i.Transform=e("./lib/_stream_transform.js");i.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":95,"./lib/_stream_passthrough.js":96,"./lib/_stream_readable.js":97,"./lib/_stream_transform.js":98,"./lib/_stream_writable.js":99,stream:111}],102:[function(e,t,i){t.exports=e("./lib/_stream_transform.js")},{"./lib/_stream_transform.js":98}],103:[function(e,t,i){t.exports=e("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":99}],104:[function(e,t,i){var r=e("dezalgo");t.exports=function(e,t){if(t)t=r(t);var i,n,a;if(Array.isArray(e)){i=[];n=e.length}else{a=Object.keys(e);i={};n=a.length}function s(e,r,a){i[e]=a;if(--n===0||r){if(t)t(r,i);t=null}}if(!n){if(t)t(null,i);t=null}else if(a){a.forEach(function(t){e[t](s.bind(undefined,t))})}else{e.forEach(function(e,t){e(s.bind(undefined,t))})}}},{dezalgo:43}],105:[function(e,t,i){(function(e){(function(){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 r(e){"use strict";var t={fill:0};var a=function(e){for(e+=9;e%64>0;e+=1);return e};var s=function(e,t){for(var i=t>>2;i<e.length;i++)e[i]=0};var o=function(e,t,i){e[t>>2]|=128<<24-(t%4<<3);e[((t>>2)+2&~15)+14]=i>>29;e[((t>>2)+2&~15)+15]=i<<3};var f=function(e,t,i,r,n){var a=this,s,o=n%4,f=r%4,l=r-f;if(l>0){switch(o){case 0:e[n+3|0]=a.charCodeAt(i);case 1:e[n+2|0]=a.charCodeAt(i+1);case 2:e[n+1|0]=a.charCodeAt(i+2);case 3:e[n|0]=a.charCodeAt(i+3)}}for(s=o;s<l;s=s+4|0){t[n+s>>2]=a.charCodeAt(i+s)<<24|a.charCodeAt(i+s+1)<<16|a.charCodeAt(i+s+2)<<8|a.charCodeAt(i+s+3)}switch(f){case 3:e[n+l+1|0]=a.charCodeAt(i+l+2);case 2:e[n+l+2|0]=a.charCodeAt(i+l+1);case 1:e[n+l+3|0]=a.charCodeAt(i+l)}};var l=function(e,t,i,r,n){var a=this,s,o=n%4,f=r%4,l=r-f;if(l>0){switch(o){case 0:e[n+3|0]=a[i];case 1:e[n+2|0]=a[i+1];case 2:e[n+1|0]=a[i+2];case 3:e[n|0]=a[i+3]}}for(s=4-o;s<l;s=s+=4|0){t[n+s>>2]=a[i+s]<<24|a[i+s+1]<<16|a[i+s+2]<<8|a[i+s+3]}switch(f){case 3:e[n+l+1|0]=a[i+l+2];case 2:e[n+l+2|0]=a[i+l+1];case 1:e[n+l+3|0]=a[i+l]}};var c=function(e,t,i,r,a){var s=this,o,f=a%4,l=r%4,c=r-l;var u=new Uint8Array(n.readAsArrayBuffer(s.slice(i,i+r)));if(c>0){switch(f){case 0:e[a+3|0]=u[0];case 1:e[a+2|0]=u[1];case 2:e[a+1|0]=u[2];case 3:e[a|0]=u[3]}}for(o=4-f;o<c;o=o+=4|0){t[a+o>>2]=u[o]<<24|u[o+1]<<16|u[o+2]<<8|u[o+3]}switch(l){case 3:e[a+c+1|0]=u[c+2];case 2:e[a+c+2|0]=u[c+1];case 1:e[a+c+3|0]=u[c]}};var u=function(e){switch(i.getDataType(e)){case"string":return f.bind(e);case"array":return l.bind(e);case"buffer":return l.bind(e);case"arraybuffer":return l.bind(new Uint8Array(e));case"view":return l.bind(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));case"blob":return c.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 h=function(e){var t,i,r="0123456789abcdef",n=[],a=new Uint8Array(e);for(t=0;t<a.length;t++){i=a[t];n[t]=r.charAt(i>>4&15)+r.charAt(i>>0&15)}return n.join("")};var d=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=a(e);t.heap=new ArrayBuffer(d(t.padMaxChunkLen+320+20));t.h32=new Int32Array(t.heap);t.h8=new Int8Array(t.heap);t.core=new r._core({Int32Array:Int32Array,DataView:DataView},{},t.heap);t.buffer=null};m(e||64*1024);var v=function(e,t){var i=new Int32Array(e,t+320,5);i[0]=1732584193;i[1]=-271733879;i[2]=-1732584194;i[3]=271733878;i[4]=-1009589776};var g=function(e,i){var r=a(e);var n=new Int32Array(t.heap,0,r>>2);s(n,e);o(n,e,i);return r};var _=function(e,i,r){u(e)(t.h8,t.h32,i,r,0)};var y=function(e,i,r,n,a){var s=r;if(a){s=g(r,n)}_(e,i,r);t.core.hash(s,t.padMaxChunkLen)};var b=function(e,t){var i=new Int32Array(e,t+320,5);var r=new Int32Array(5);var n=new DataView(r.buffer);n.setInt32(0,i[0],false);n.setInt32(4,i[1],false);n.setInt32(8,i[2],false);n.setInt32(12,i[3],false);n.setInt32(16,i[4],false);return r};var w=this.rawDigest=function(e){var i=e.byteLength||e.length||e.size||0;v(t.heap,t.padMaxChunkLen);var r=0,n=t.maxChunkLen,a;for(r=0;i>r+n;r+=n){y(e,r,n,i,false)}y(e,r,i-r,i,true);return b(t.heap,t.padMaxChunkLen)};this.digest=this.digestFromString=this.digestFromBuffer=this.digestFromArrayBuffer=function(e){return h(w(e).buffer)}}r._core=function s(e,t,i){"use asm";var r=new e.Int32Array(i);function n(e,t){e=e|0;t=t|0;var i=0,n=0,a=0,s=0,o=0,f=0,l=0,c=0,u=0,p=0,h=0,d=0,m=0,v=0;a=r[t+320>>2]|0;o=r[t+324>>2]|0;l=r[t+328>>2]|0;u=r[t+332>>2]|0;h=r[t+336>>2]|0;for(i=0;(i|0)<(e|0);i=i+64|0){s=a;f=o;c=l;p=u;d=h;for(n=0;(n|0)<64;n=n+4|0){v=r[i+n>>2]|0;m=((a<<5|a>>>27)+(o&l|~o&u)|0)+((v+h|0)+1518500249|0)|0;h=u;u=l;l=o<<30|o>>>2;o=a;a=m;r[e+n>>2]=v}for(n=e+64|0;(n|0)<(e+80|0);n=n+4|0){v=(r[n-12>>2]^r[n-32>>2]^r[n-56>>2]^r[n-64>>2])<<1|(r[n-12>>2]^r[n-32>>2]^r[n-56>>2]^r[n-64>>2])>>>31;m=((a<<5|a>>>27)+(o&l|~o&u)|0)+((v+h|0)+1518500249|0)|0;h=u;u=l;l=o<<30|o>>>2;o=a;a=m;r[n>>2]=v}for(n=e+80|0;(n|0)<(e+160|0);n=n+4|0){v=(r[n-12>>2]^r[n-32>>2]^r[n-56>>2]^r[n-64>>2])<<1|(r[n-12>>2]^r[n-32>>2]^r[n-56>>2]^r[n-64>>2])>>>31;m=((a<<5|a>>>27)+(o^l^u)|0)+((v+h|0)+1859775393|0)|0;h=u;u=l;l=o<<30|o>>>2;o=a;a=m;r[n>>2]=v}for(n=e+160|0;(n|0)<(e+240|0);n=n+4|0){v=(r[n-12>>2]^r[n-32>>2]^r[n-56>>2]^r[n-64>>2])<<1|(r[n-12>>2]^r[n-32>>2]^r[n-56>>2]^r[n-64>>2])>>>31;m=((a<<5|a>>>27)+(o&l|o&u|l&u)|0)+((v+h|0)-1894007588|0)|0;h=u;u=l;l=o<<30|o>>>2;o=a;a=m;r[n>>2]=v}for(n=e+240|0;(n|0)<(e+320|0);n=n+4|0){v=(r[n-12>>2]^r[n-32>>2]^r[n-56>>2]^r[n-64>>2])<<1|(r[n-12>>2]^r[n-32>>2]^r[n-56>>2]^r[n-64>>2])>>>31;m=((a<<5|a>>>27)+(o^l^u)|0)+((v+h|0)-899497514|0)|0;h=u;u=l;l=o<<30|o>>>2;o=a;a=m;r[n>>2]=v}a=a+s|0;o=o+f|0;l=l+c|0;u=u+p|0;h=h+d|0}r[t+320>>2]=a;r[t+324>>2]=o;r[t+328>>2]=l;r[t+332>>2]=u;r[t+336>>2]=h}return{hash:n}};if(typeof t!=="undefined"){t.exports=r}else if(typeof window!=="undefined"){window.Rusha=r}if(typeof FileReaderSync!=="undefined"){var n=new FileReaderSync,a=new r(4*1024*1024);self.onmessage=function o(e){var t,i=e.data.data;try{t=a.digest(i);self.postMessage({id:e.data.id,hash:t})}catch(r){self.postMessage({id:e.data.id,error:r.name})}}}})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],106:[function(e,t,i){(function(i){t.exports=f;var r=e("http");var n=e("https");var a=e("once");var s=e("url");var o=e("zlib");function f(e,t){if(typeof e==="string")e={url:e};t=a(t);if(e.maxRedirects===0){t(new Error("too many redirects"));return}if(!e.maxRedirects)e.maxRedirects=10;if(e.url)l(e);if(!e.headers)e.headers={};var i=e.body;e.body=undefined;if(i&&!e.method)e.method="POST";var s=Object.keys(e.headers).some(function(e){return e.toLowerCase()==="accept-encoding"});if(!s)e.headers["accept-encoding"]="gzip, deflate";var c=e.protocol==="https:"?n:r;var u=c.request(e,function(i){if(i.statusCode>=300&&i.statusCode<400&&"location"in i.headers){e.url=i.headers.location;l(e);i.resume();e.maxRedirects-=1;return f(e,t)}if(["gzip","deflate"].indexOf(i.headers["content-encoding"])!==-1){var r=o.createUnzip();i.pipe(r);i.on("close",function(){r.emit("close")});r.httpVersion=i.httpVersion;r.headers=i.headers;r.trailers=i.trailers;r.setTimeout=i.setTimeout.bind(i);r.method=i.method;r.url=i.url;r.statusCode=i.statusCode;r.socket=i.socket;t(null,r)}else{t(null,i)}});u.on("error",t);u.end(i);return u}t.exports.concat=function(e,t){return f(e,function(e,r){if(e)return t(e);var n=[];r.on("data",function(e){n.push(e)});r.on("end",function(){t(null,i.concat(n),r)})})};["get","post","put","patch","head","delete"].forEach(function(e){t.exports[e]=function(t,i){if(typeof t==="string")t={url:t};t.method=e.toUpperCase();return f(t,i)}});function l(e){var t=s.parse(e.url);if(t.hostname)e.hostname=t.hostname;if(t.port)e.port=t.port;if(t.protocol)e.protocol=t.protocol;e.path=t.path;delete e.url}}).call(this,e("buffer").Buffer)},{buffer:36,http:50,https:53,once:72,url:118,zlib:32}],107:[function(e,t,i){(function(i){t.exports=u;var r=e("debug")("simple-peer");var n=e("get-browser-rtc");var a=e("hat");var s=e("inherits");var o=e("is-typedarray");var f=e("once");var l=e("stream");var c=e("typedarray-to-buffer");s(u,l.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;l.Duplex.call(t,e);t.initiator=e.initiator||false;t.channelConfig=e.channelConfig||u.channelConfig;t.channelName=e.channelName||a(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||n();if(!t._wrtc){if(typeof window==="undefined"){throw new Error("No WebRTC support: Specify `opts.wrtc` option in this environment")}else{throw new Error("No WebRTC support: Not a supported browser")}}t._maxBufferedAmount=e.highWaterMark;t._pcReady=false;t._channelReady=false;t._iceComplete=false;t._channel=null;t._pendingCandidates=[];t._chunk=null;t._cb=null;t._interval=null;t._reconnectTimeout=null;t._pc=new t._wrtc.RTCPeerConnection(t.config,t.constraints);t._pc.oniceconnectionstatechange=t._onIceConnectionStateChange.bind(t);t._pc.onsignalingstatechange=t._onSignalingStateChange.bind(t);t._pc.onicecandidate=t._onIceCandidate.bind(t);if(t.stream)t._pc.addStream(t.stream);t._pc.onaddstream=t._onAddStream.bind(t);if(t.initiator){t._setupData({channel:t._pc.createDataChannel(t.channelName,t.channelConfig)});t._pc.onnegotiationneeded=f(t._createOffer.bind(t));if(typeof window==="undefined"||!window.webkitRTCPeerConnection){t._pc.onnegotiationneeded()}}else{t._pc.ondatachannel=t._setupData.bind(t)}t.on("finish",function(){if(t.connected){setTimeout(function(){t._destroy()},100)}else{t.once("connect",function(){setTimeout(function(){t._destroy()},100)})}})}u.WEBRTC_SUPPORT=!!n();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(i){e={}}}t._debug("signal()");function r(e){try{t._pc.addIceCandidate(new t._wrtc.RTCIceCandidate(e),p,t._onError.bind(t))}catch(i){t._destroy(new Error("error adding candidate: "+i.message))}}if(e.sdp){t._pc.setRemoteDescription(new t._wrtc.RTCSessionDescription(e),function(){if(t.destroyed)return;if(t._pc.remoteDescription.type==="offer")t._createAnswer();t._pendingCandidates.forEach(r);t._pendingCandidates=[]},t._onError.bind(t))}if(e.candidate){if(t._pc.remoteDescription)r(e.candidate);else t._pendingCandidates.push(e.candidate)}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)&&!i.isBuffer(e)&&typeof e!=="string"&&(typeof Blob==="undefined"||!(e instanceof Blob))){e=JSON.stringify(e)}if(i.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 i=this;if(i.destroyed)return;if(t)i.once("close",t);i._debug("destroy (error: %s)",e&&e.message);i.readable=i.writable=false;if(!i._readableState.ended)i.push(null);if(!i._writableState.finished)i.end();i.destroyed=true;i.connected=false;i._pcReady=false;i._channelReady=false;i._chunk=null;i._cb=null;clearInterval(i._interval);clearTimeout(i._reconnectTimeout);if(i._pc){try{i._pc.close()}catch(e){}i._pc.oniceconnectionstatechange=null;i._pc.onsignalingstatechange=null;i._pc.onicecandidate=null}if(i._channel){try{i._channel.close()}catch(e){}i._channel.onmessage=null;i._channel.onopen=null;i._channel.onclose=null}i._pc=null;i._channel=null;if(e)i.emit("error",e);i.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,i){var r=this;if(r.destroyed)return i(new Error("cannot write after peer is destroyed"));if(r.connected){try{r.send(e)}catch(n){return r._onError(n)}if(r._channel.bufferedAmount>r._maxBufferedAmount){r._debug("start backpressure: bufferedAmount %d",r._channel.bufferedAmount);r._cb=i}else{i(null)}}else{r._debug("write before connect");r._chunk=e;r._cb=i}};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 i=function(){var i=e._pc.localDescription||t;e._debug("signal");e.emit("signal",{type:i.type,sdp:i.sdp})};if(e.trickle||e._iceComplete)i();else e.once("_iceComplete",i)},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 i=function(){var i=e._pc.localDescription||t;e._debug("signal");e.emit("signal",{type:i.type,sdp:i.sdp})};if(e.trickle||e._iceComplete)i();else e.once("_iceComplete",i)},e._onError.bind(e),e.answerConstraints)};u.prototype._onIceConnectionStateChange=function(){var e=this;if(e.destroyed)return;var t=e._pc.iceGatheringState;var i=e._pc.iceConnectionState;e._debug("iceConnectionStateChange %s %s",t,i);e.emit("iceConnectionStateChange",t,i);if(i==="connected"||i==="completed"){clearTimeout(e._reconnectTimeout);e._pcReady=true;e._maybeReady()}if(i==="disconnected"){if(e.reconnectTimer){clearTimeout(e._reconnectTimeout);e._reconnectTimeout=setTimeout(function(){e._destroy()},e.reconnectTimer)}else{e._destroy()}}if(i==="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 i=[];e.forEach(function(e){i.push(e)});t(i)},e._onError.bind(e))}else{e._pc.getStats(function(e){var i=[];e.result().forEach(function(e){var t={};e.names().forEach(function(i){t[i]=e.stat(i)});t.id=e.id;t.type=e.type;t.timestamp=e.timestamp;i.push(t)});t(i)})}function t(t){t.forEach(function(t){if(t.type==="remotecandidate"){e.remoteAddress=t.ipAddress;e.remoteFamily="IPv4";e.remotePort=Number(t.portNumber);e._debug("connect remote: %s:%s (%s)",e.remoteAddress,e.remotePort,e.remoteFamily)}else if(t.type==="localcandidate"&&t.candidateType==="host"){e.localAddress=t.ipAddress;e.localPort=Number(t.portNumber);e._debug("connect local: %s:%s",e.localAddress,e.localPort)}});e._connecting=false;e.connected=true;if(e._chunk){try{e.send(e._chunk)}catch(i){return e._onError(i)}e._chunk=null;e._debug('sent chunk from "write before connect"');var r=e._cb;e._cb=null;r(null)}e._interval=setInterval(function(){if(!e._cb||!e._channel||e._channel.bufferedAmount>e._maxBufferedAmount)return;e._debug("ending backpressure: bufferedAmount %d",e._channel.bufferedAmount);var t=e._cb;e._cb=null;t(null)},150);if(e._interval.unref)e._interval.unref();e._debug("connect");e.emit("connect")}};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 i=e.data;t._debug("read: %d bytes",i.byteLength||i.length);if(i instanceof ArrayBuffer){i=c(new Uint8Array(i));t.push(i)}else{try{i=JSON.parse(i)}catch(r){}t.emit("data",i)}};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 i=e.channelName&&e.channelName.substring(0,7);t[0]="["+i+"] "+t[0];r.apply(null,t)};function p(){}}).call(this,e("buffer").Buffer)},{buffer:36,debug:40,"get-browser-rtc":48,hat:49,inherits:55,"is-typedarray":58,once:72,stream:111,"typedarray-to-buffer":116}],108:[function(e,t,i){var r=e("rusha");var n=new r;var a=window.crypto||window.msCrypto||{};var s=a.subtle||a.webkitSubtle;var o=n.digest.bind(n);try{s.digest({name:"sha-1"},new Uint8Array).catch(function(){s=false})}catch(f){s=false}function l(e,t){if(!s){setTimeout(t,0,o(e));return}if(typeof e==="string"){e=c(e)}s.digest({name:"sha-1"},e).then(function i(e){t(u(new Uint8Array(e)))},function r(i){t(o(e))})}function c(e){var t=e.length;var i=new Uint8Array(t);for(var r=0;r<t;r++){i[r]=e.charCodeAt(r)}return i}function u(e){var t=e.length;var i=[];for(var r=0;r<t;r++){var n=e[r];i.push((n>>>4).toString(16));i.push((n&15).toString(16))}return i.join("")}t.exports=l;t.exports.sync=o},{rusha:105}],109:[function(e,t,i){(function(i){t.exports=c;var r=e("debug")("simple-websocket");var n=e("inherits");var a=e("is-typedarray");var s=e("stream");var o=e("typedarray-to-buffer");var f=e("ws");var l=typeof window!=="undefined"?window.WebSocket:f;n(c,s.Duplex);function c(e,t){var i=this;if(!(i instanceof c))return new c(e,t);if(!t)t={};r("new websocket: %s %o",e,t);t.allowHalfOpen=false;if(t.highWaterMark==null)t.highWaterMark=1024*1024;s.Duplex.call(i,t);i.url=e;i.connected=false;i.destroyed=false;i._maxBufferedAmount=t.highWaterMark;i._chunk=null;i._cb=null;i._interval=null;i._ws=new l(i.url);i._ws.binaryType="arraybuffer";i._ws.onopen=i._onOpen.bind(i);i._ws.onmessage=i._onMessage.bind(i);i._ws.onclose=i._onClose.bind(i);i._ws.onerror=function(){i._onError(new Error("connection error to "+i.url))};i.on("finish",function(){if(i.connected){setTimeout(function(){i._destroy()},100)}else{i.once("connect",function(){setTimeout(function(){i._destroy()},100)})}})}c.prototype.send=function(e){var t=this;if(!a.strict(e)&&!(e instanceof ArrayBuffer)&&!i.isBuffer(e)&&typeof e!=="string"&&(typeof Blob==="undefined"||!(e instanceof Blob))){e=JSON.stringify(e)}var n=e.length||e.byteLength||e.size;t._ws.send(e);r("write: %d bytes",n)};c.prototype.destroy=function(e){var t=this;t._destroy(null,e)};c.prototype._destroy=function(e,t){var i=this;if(i.destroyed)return;if(t)i.once("close",t);r("destroy (error: %s)",e&&e.message);this.readable=this.writable=false;if(!i._readableState.ended)i.push(null);if(!i._writableState.finished)i.end();i.connected=false;i.destroyed=true;clearInterval(i._interval);i._interval=null;i._chunk=null;i._cb=null;if(i._ws){try{i._ws.close()}catch(e){}i._ws.onopen=null;i._ws.onmessage=null;i._ws.onclose=null;i._ws.onerror=null}i._ws=null;if(e)i.emit("error",e);i.emit("close")};c.prototype._read=function(){};c.prototype._write=function(e,t,i){var n=this;if(n.destroyed)return i(new Error("cannot write after socket is destroyed"));if(n.connected){try{n.send(e)}catch(a){return n._onError(a)}if(typeof f!=="function"&&n._ws.bufferedAmount>n._maxBufferedAmount){r("start backpressure: bufferedAmount %d",n._ws.bufferedAmount);n._cb=i}else{i(null)}}else{r("write before connect");n._chunk=e;n._cb=i}};c.prototype._onMessage=function(e){var t=this;if(t.destroyed)return;var n=e.data;r("read: %d bytes",n.byteLength||n.length);if(n instanceof ArrayBuffer){n=o(new Uint8Array(n));t.push(n)}else if(i.isBuffer(n)){t.push(n)}else{try{n=JSON.parse(n)}catch(a){}t.emit("data",n)}};c.prototype._onOpen=function(){var e=this;if(e.connected||e.destroyed)return;e.connected=true;if(e._chunk){try{e.send(e._chunk)}catch(t){return e._onError(t)}e._chunk=null;r('sent chunk from "write before connect"');var i=e._cb;e._cb=null;i(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")};c.prototype._onClose=function(){var e=this;if(e.destroyed)return;r("on close");e._destroy()};c.prototype._onError=function(e){var t=this;if(t.destroyed)return;r("error: %s",e.message||e);t._destroy(e)}}).call(this,e("buffer").Buffer)},{buffer:36,debug:40,inherits:55,"is-typedarray":58,stream:111,"typedarray-to-buffer":116,ws:30}],110:[function(e,t,i){var r=1;var n=65535;var a=4;var s=function(){r=r+1&n};var o=setInterval(s,1e3/a|0);if(o.unref)o.unref();t.exports=function(e){var t=a*(e||5);var i=[0];var s=1;var o=r-1&n;return function(e){var f=r-o&n;if(f>t)f=t;o=r;while(f--){if(s===t)s=0;i[s]=i[s===0?t-1:s-1];s++}if(e)i[s-1]+=e;var l=i[s-1];var c=i.length<t?0:i[s===t?0:s];return i.length<a?l:(l-c)*a/i.length}}},{}],111:[function(e,t,i){t.exports=a;var r=e("events").EventEmitter;var n=e("inherits");n(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 i=this;function n(t){if(e.writable){if(false===e.write(t)&&i.pause){i.pause()}}}i.on("data",n);function a(){if(i.readable&&i.resume){i.resume()}}e.on("drain",a);if(!e._isStdio&&(!t||t.end!==false)){i.on("end",o);i.on("close",f)}var s=false;function o(){if(s)return;s=true;e.end()}function f(){if(s)return;s=true;if(typeof e.destroy==="function")e.destroy()}function l(e){c();if(r.listenerCount(this,"error")===0){throw e}}i.on("error",l);e.on("error",l);function c(){i.removeListener("data",n);e.removeListener("drain",a);i.removeListener("end",o);i.removeListener("close",f);i.removeListener("error",l);e.removeListener("error",l);i.removeListener("end",c);i.removeListener("close",c);e.removeListener("close",c)}i.on("end",c);i.on("close",c);e.on("close",c);e.emit("pipe",i);return e}},{events:45,inherits:55,"readable-stream/duplex.js":94,"readable-stream/passthrough.js":100,"readable-stream/readable.js":101,"readable-stream/transform.js":102,"readable-stream/writable.js":103}],112:[function(e,t,i){var r=e("buffer").Buffer;var n=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&&!n(e)){throw new Error("Unknown encoding: "+e)}}var s=i.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=l;break;default:this.write=o;return}this.charBuffer=new r(6);this.charReceived=0;this.charLength=0};s.prototype.write=function(e){var t="";while(this.charLength){var i=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;e.copy(this.charBuffer,this.charReceived,0,i);this.charReceived+=i;if(this.charReceived<this.charLength){return""}e=e.slice(i,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 n=e.length;if(this.charLength){e.copy(this.charBuffer,0,e.length-this.charReceived,n);n-=this.charReceived}t+=e.toString(this.encoding,0,n);var n=t.length-1;var r=t.charCodeAt(n);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,n)}return t};s.prototype.detectIncompleteChar=function(e){var t=e.length>=3?3:e.length;for(;t>0;t--){var i=e[e.length-t];if(t==1&&i>>5==6){this.charLength=2;break}if(t<=2&&i>>4==14){this.charLength=3;break}if(t<=3&&i>>3==30){this.charLength=4;break}}this.charReceived=t};s.prototype.end=function(e){var t="";if(e&&e.length)t=this.write(e);if(this.charReceived){var i=this.charReceived;var r=this.charBuffer;var n=this.encoding;t+=r.slice(0,i).toString(n)}return t};function o(e){return e.toString(this.encoding)}function f(e){this.charReceived=e.length%2;this.charLength=this.charReceived?2:0}function l(e){this.charReceived=e.length%3;this.charLength=this.charReceived?3:0}},{buffer:36}],113:[function(e,t,i){var r=e("./thirty-two");i.encode=r.encode;i.decode=r.decode},{"./thirty-two":114}],114:[function(e,t,i){(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 n(e){var t=Math.floor(e.length/5);return e.length%5==0?t:t+1}i.encode=function(i){var r=0;var a=0;var s=0;var o=0;var f=new e(n(i)*8);if(!e.isBuffer(i)){i=new e(i)}while(r<i.length){var l=i[r];if(s>3){o=l&255>>s;s=(s+5)%8;o=o<<s|(r+1<i.length?i[r+1]:0)>>8-s;r++}else{o=l>>8-(s+5)&31;s=(s+5)%8;if(s==0)r++}f[a]=t.charCodeAt(o);a++}for(r=a;r<f.length;r++)f[r]=61;return f};i.decode=function(t){var i=0;var n=0;var a;var s=0;if(!e.isBuffer(t)){t=new e(t)}var o=new e(Math.ceil(t.length*5/8));for(var f=0;f<t.length;f++){if(t[f]==61){break}var l=t[f]-48;if(l<r.length){n=r[l];if(i<=3){i=(i+5)%8;if(i==0){a|=n;o[s]=a;s++;a=0}else{a|=255&n<<8-i}}else{i=(i+5)%8;a|=255&n>>>i;o[s]=a;s++;a=255&n<<8-i}}else{throw new Error("Invalid input - it is not base32 encoded string")}}return o.slice(0,s)}}).call(this,e("buffer").Buffer)},{buffer:36}],115:[function(e,t,i){(function(i){t.exports=c;var r=e("debug")("torrent-discovery");var n=e("bittorrent-dht/client");var a=e("events").EventEmitter;var s=e("xtend/mutable");var o=e("inherits");var f=e("re-emitter");var l=e("bittorrent-tracker/client");o(c,a);function c(e){var t=this;if(!(t instanceof c))return new c(e);a.call(t);s(t,{announce:[],dht:typeof n==="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(!i.browser&&!t.port)throw new Error("port required");if(t.dht)t._createDHT(t.dhtPort)}c.prototype.setTorrent=function(e){var t=this;if(t.torrent)return;if(e&&e.infoHash){t.torrent=e;t.infoHash=e.infoHash}else{if(t.infoHash)return;t.infoHash=e}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))}};c.prototype.stop=function(e){var t=this;if(t.tracker){if(t.tracker.stop)t.tracker.stop();if(t.tracker.destroy)t.tracker.destroy()}if(!t._externalDHT&&t.dht&&t.dht.destroy)t.dht.destroy(e);else i.nextTick(function(){e(null)})};c.prototype._createDHT=function(e){var t=this;if(!t._externalDHT)t.dht=new n;f(t.dht,t,["error","warning"]);t.dht.on("peer",function(e,i){if(i===t.infoHash)t.emit("peer",e)});if(!t._externalDHT)t.dht.listen(e)};c.prototype._createTracker=function(){var e=this;if(!e.tracker)return;var t=e.torrent||{infoHash:e.infoHash,announce:e.announce};var i={rtcConfig:e.rtcConfig,wrtc:e.wrtc};e.tracker=new l(e.peerId,e.port,t,i);f(e.tracker,e,["peer","warning","error"]);e.tracker.start()};c.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:34,"bittorrent-dht/client":30,"bittorrent-tracker/client":25,debug:40,events:45,inherits:55,"re-emitter":93,"xtend/mutable":125}],116:[function(e,t,i){(function(i){var r=e("is-typedarray").strict;t.exports=function(e){var t=i.TYPED_ARRAY_SUPPORT?i._augment:function(e){return new i(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 i(e)}}}).call(this,e("buffer").Buffer)},{buffer:36,"is-typedarray":58}],117:[function(e,t,i){"use strict";function r(e,t){var i=1,r=e.length,n=e[0],a=e[0];for(var s=1;s<r;++s){a=n;n=e[s];if(t(n,a)){if(s===i){i++;continue}e[i++]=n}}e.length=i;return e}function n(e){var t=1,i=e.length,r=e[0],n=e[0];for(var a=1;a<i;++a,n=r){n=r;r=e[a];if(r!==n){if(a===t){t++;continue}e[t++]=r}}e.length=t;return e}function a(e,t,i){if(e.length===0){return e}if(t){if(!i){e.sort(t)}return r(e,t)}if(!i){e.sort()}return n(e)}t.exports=a},{}],118:[function(e,t,i){var r=e("punycode");i.parse=y;i.resolve=w;i.resolveObject=x;i.format=b;i.Url=n;function n(){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,s=/:[0-9]*$/,o=["<",">",'"',"`"," ","\r","\n"," "],f=["{","}","|","\\","^","`"].concat(o),l=["'"].concat(f),c=["%","/","?",";","#"].concat(l),u=["/","?","#"],p=255,h=/^[a-z0-9A-Z_-]{0,63}$/,d=/^([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},_=e("querystring");function y(e,t,i){if(e&&S(e)&&e instanceof n)return e;var r=new n;r.parse(e,t,i);return r}n.prototype.parse=function(e,t,i){if(!k(e)){throw new TypeError("Parameter 'url' must be a string, not "+typeof e)}var n=e;n=n.trim();var s=a.exec(n);if(s){s=s[0];var o=s.toLowerCase();this.protocol=o;n=n.substr(s.length)}if(i||s||n.match(/^\/\/[^@\/]+@[^@\/]+/)){var f=n.substr(0,2)==="//";if(f&&!(s&&v[s])){n=n.substr(2);this.slashes=true}}if(!v[s]&&(f||s&&!g[s])){var y=-1;for(var b=0;b<u.length;b++){var w=n.indexOf(u[b]);if(w!==-1&&(y===-1||w<y))y=w}var x,S;if(y===-1){S=n.lastIndexOf("@")}else{S=n.lastIndexOf("@",y)}if(S!==-1){x=n.slice(0,S);n=n.slice(S+1);this.auth=decodeURIComponent(x)}y=-1;for(var b=0;b<c.length;b++){var w=n.indexOf(c[b]);if(w!==-1&&(y===-1||w<y))y=w}if(y===-1)y=n.length;this.host=n.slice(0,y);n=n.slice(y);this.parseHost();this.hostname=this.hostname||"";var E=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!E){var A=this.hostname.split(/\./);for(var b=0,U=A.length;b<U;b++){var T=A[b];if(!T)continue;if(!T.match(h)){var I="";for(var L=0,B=T.length;L<B;L++){if(T.charCodeAt(L)>127){I+="x"}else{I+=T[L]}}if(!I.match(h)){var z=A.slice(0,b);var R=A.slice(b+1);var C=T.match(d);if(C){z.push(C[1]);R.unshift(C[2])}if(R.length){n="/"+R.join(".")+n}this.hostname=z.join(".");break}}}}if(this.hostname.length>p){this.hostname=""}else{this.hostname=this.hostname.toLowerCase()}if(!E){var F=this.hostname.split(".");var O=[];for(var b=0;b<F.length;++b){var N=F[b];O.push(N.match(/[^A-Za-z0-9_-]/)?"xn--"+r.encode(N):N)}this.hostname=O.join(".")}var P=this.port?":"+this.port:"";var D=this.hostname||"";this.host=D+P;this.href+=this.host;if(E){this.hostname=this.hostname.substr(1,this.hostname.length-2);if(n[0]!=="/"){n="/"+n}}}if(!m[o]){for(var b=0,U=l.length;b<U;b++){var M=l[b];var j=encodeURIComponent(M);if(j===M){j=escape(M)}n=n.split(M).join(j)}}var H=n.indexOf("#");if(H!==-1){this.hash=n.substr(H);n=n.slice(0,H)}var q=n.indexOf("?");if(q!==-1){this.search=n.substr(q);this.query=n.substr(q+1);if(t){this.query=_.parse(this.query)}n=n.slice(0,q)}else if(t){this.search="";this.query={}}if(n)this.pathname=n;if(g[o]&&this.hostname&&!this.pathname){this.pathname="/"}if(this.pathname||this.search){var P=this.pathname||"";var N=this.search||"";this.path=P+N}this.href=this.format();return this};function b(e){if(k(e))e=y(e);if(!(e instanceof n))return n.prototype.format.call(e);return e.format()}n.prototype.format=function(){var e=this.auth||"";if(e){e=encodeURIComponent(e);e=e.replace(/%3A/i,":");e+="@"}var t=this.protocol||"",i=this.pathname||"",r=this.hash||"",n=false,a="";if(this.host){n=e+this.host}else if(this.hostname){n=e+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]");if(this.port){n+=":"+this.port}}if(this.query&&S(this.query)&&Object.keys(this.query).length){a=_.stringify(this.query)}var s=this.search||a&&"?"+a||"";if(t&&t.substr(-1)!==":")t+=":";if(this.slashes||(!t||g[t])&&n!==false){n="//"+(n||"");if(i&&i.charAt(0)!=="/")i="/"+i}else if(!n){n=""}if(r&&r.charAt(0)!=="#")r="#"+r;if(s&&s.charAt(0)!=="?")s="?"+s;i=i.replace(/[?#]/g,function(e){return encodeURIComponent(e)});s=s.replace("#","%23");return t+n+i+s+r};function w(e,t){return y(e,false,true).resolve(t)}n.prototype.resolve=function(e){return this.resolveObject(y(e,false,true)).format()};function x(e,t){if(!e)return t;return y(e,false,true).resolveObject(t)}n.prototype.resolveObject=function(e){if(k(e)){var t=new n;t.parse(e,false,true);e=t}var i=new n;Object.keys(this).forEach(function(e){i[e]=this[e]},this);i.hash=e.hash;if(e.href===""){i.href=i.format();return i}if(e.slashes&&!e.protocol){Object.keys(e).forEach(function(t){if(t!=="protocol")i[t]=e[t]});if(g[i.protocol]&&i.hostname&&!i.pathname){i.path=i.pathname="/"}i.href=i.format();return i}if(e.protocol&&e.protocol!==i.protocol){if(!g[e.protocol]){Object.keys(e).forEach(function(t){i[t]=e[t]});i.href=i.format();return i}i.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("");i.pathname=r.join("/")}else{i.pathname=e.pathname}i.search=e.search;i.query=e.query;i.host=e.host||"";i.auth=e.auth;i.hostname=e.hostname||e.host;i.port=e.port;if(i.pathname||i.search){var a=i.pathname||"";var s=i.search||"";i.path=a+s}i.slashes=i.slashes||e.slashes;i.href=i.format();return i}var o=i.pathname&&i.pathname.charAt(0)==="/",f=e.host||e.pathname&&e.pathname.charAt(0)==="/",l=f||o||i.host&&e.pathname,c=l,u=i.pathname&&i.pathname.split("/")||[],r=e.pathname&&e.pathname.split("/")||[],p=i.protocol&&!g[i.protocol];if(p){i.hostname="";i.port=null;if(i.host){if(u[0]==="")u[0]=i.host;else u.unshift(i.host)}i.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}l=l&&(r[0]===""||u[0]==="")}if(f){i.host=e.host||e.host===""?e.host:i.host;i.hostname=e.hostname||e.hostname===""?e.hostname:i.hostname;i.search=e.search;i.query=e.query;u=r}else if(r.length){if(!u)u=[];u.pop();u=u.concat(r);i.search=e.search;i.query=e.query}else if(!A(e.search)){if(p){i.hostname=i.host=u.shift();var h=i.host&&i.host.indexOf("@")>0?i.host.split("@"):false;if(h){i.auth=h.shift();i.host=i.hostname=h.shift()}}i.search=e.search;i.query=e.query;if(!E(i.pathname)||!E(i.search)){i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")}i.href=i.format();return i}if(!u.length){i.pathname=null;if(i.search){i.path="/"+i.search}else{i.path=null}i.href=i.format();return i}var d=u.slice(-1)[0];var m=(i.host||e.host)&&(d==="."||d==="..")||d==="";var _=0;for(var y=u.length;y>=0;y--){d=u[y];if(d=="."){u.splice(y,1)}else if(d===".."){u.splice(y,1);_++}else if(_){u.splice(y,1);_--}}if(!l&&!c){for(;_--;_){u.unshift("..")}}if(l&&u[0]!==""&&(!u[0]||u[0].charAt(0)!=="/")){u.unshift("")}if(m&&u.join("/").substr(-1)!=="/"){u.push("")}var b=u[0]===""||u[0]&&u[0].charAt(0)==="/";if(p){i.hostname=i.host=b?"":u.length?u.shift():"";var h=i.host&&i.host.indexOf("@")>0?i.host.split("@"):false;if(h){i.auth=h.shift();i.host=i.hostname=h.shift()}}l=l||i.host&&u.length;if(l&&!b){u.unshift("")}if(!u.length){i.pathname=null;i.path=null}else{i.pathname=u.join("/")}if(!E(i.pathname)||!E(i.search)){i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")}i.auth=e.auth||i.auth;i.slashes=i.slashes||e.slashes;i.href=i.format();return i};n.prototype.parseHost=function(){var e=this.host;var t=s.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 S(e){return typeof e==="object"&&e!==null}function E(e){return e===null}function A(e){return e==null}},{punycode:35,querystring:91}],119:[function(e,t,i){(function(i){var r=e("bencode");var n=e("bitfield");var a=e("events").EventEmitter;var s=e("inherits");var o=e("simple-sha1");var f=1e7;var l=1e3;var c=16*1024;t.exports=function(e){s(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 n(0,{grow:l});if(i.isBuffer(e)){this.setMetadata(e)}}t.prototype.name="ut_metadata";t.prototype.onHandshake=function(e,t,i){this._infoHash=e;this._infoHashHex=e.toString("hex")};t.prototype.onExtendedHandshake=function(e){if(!e.m||!e.m.ut_metadata){return this.emit("warning",new Error("Peer does not support ut_metadata"))}if(!e.metadata_size){return this.emit("warning",new Error("Peer does not have metadata"))}if(e.metadata_size>f){return this.emit("warning",new Error("Peer gave maliciously large metadata size"))}this._metadataSize=e.metadata_size;this._numPieces=Math.ceil(this._metadataSize/c);this._remainingRejects=this._numPieces*2;if(this._fetching){this._requestPieces()}};t.prototype.onMessage=function(e){var t,i;try{var n=e.toString();var a=n.indexOf("ee")+2;t=r.decode(n.substring(0,a));i=e.slice(a)}catch(s){return}switch(t.msg_type){case 0:this._onRequest(t.piece);break;case 1:this._onData(t.piece,i,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(i){}if(this._infoHashHex&&this._infoHashHex!==o.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 n=r.encode(e);if(i.isBuffer(t)){n=i.concat([n,t])}this._wire.extended("ut_metadata",n)};t.prototype._request=function(e){this._send({msg_type:0,piece:e})};t.prototype._data=function(e,t,i){var r={msg_type:1,piece:e};if(typeof i==="number"){r.total_size=i}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*c;var i=t+c;if(i>this._metadataSize){i=this._metadataSize}var r=this.metadata.slice(t,i);this._data(e,r,this._metadataSize)};t.prototype._onData=function(e,t,i){if(t.length>c){return}t.copy(this.metadata,e*c);this._bitfield.set(e);this._checkDone()};t.prototype._onReject=function(e){if(this._remainingRejects>0&&this._fetching){this._request(e);this._remainingRejects-=1}else{this.emit("warning",new Error('Peer sent "reject" too much'))}};t.prototype._requestPieces=function(){this.metadata=new i(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 i=this.setMetadata(this.metadata);if(!i){this._failedMetadata()}};t.prototype._failedMetadata=function(){this._bitfield=new n(0,{grow:l});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:15,bitfield:19,buffer:36,events:45,inherits:55,"simple-sha1":108}],120:[function(e,t,i){t.exports=function r(e){return e&&typeof e==="object"&&typeof e.copy==="function"&&typeof e.fill==="function"&&typeof e.readUInt8==="function"}},{}],121:[function(e,t,i){(function(t,r){var n=/%[sdj%]/g;i.format=function(e){if(!x(e)){var t=[];for(var i=0;i<arguments.length;i++){t.push(o(arguments[i]))}return t.join(" ")}var i=1;var r=arguments;var a=r.length;var s=String(e).replace(n,function(e){if(e==="%%")return"%";if(i>=a)return e;switch(e){case"%s":return String(r[i++]);case"%d":return Number(r[i++]);case"%j":try{return JSON.stringify(r[i++])}catch(t){return"[Circular]"}default:return e}});for(var f=r[i];i<a;f=r[++i]){if(y(f)||!A(f)){s+=" "+f}else{s+=" "+o(f)}}return s};i.deprecate=function(e,n){if(S(r.process)){return function(){return i.deprecate(e,n).apply(this,arguments)}}if(t.noDeprecation===true){return e}var a=false;function s(){if(!a){if(t.throwDeprecation){throw new Error(n)}else if(t.traceDeprecation){console.trace(n)}else{console.error(n)}a=true}return e.apply(this,arguments)}return s};var a={};var s;i.debuglog=function(e){if(S(s))s=t.env.NODE_DEBUG||"";e=e.toUpperCase();if(!a[e]){if(new RegExp("\\b"+e+"\\b","i").test(s)){var r=t.pid;a[e]=function(){var t=i.format.apply(i,arguments);console.error("%s %d: %s",e,r,t)}}else{a[e]=function(){}}}return a[e]};function o(e,t){var r={seen:[],stylize:l};if(arguments.length>=3)r.depth=arguments[2];if(arguments.length>=4)r.colors=arguments[3];if(_(t)){r.showHidden=t}else if(t){i._extend(r,t)}if(S(r.showHidden))r.showHidden=false;if(S(r.depth))r.depth=2;if(S(r.colors))r.colors=false;if(S(r.customInspect))r.customInspect=true;if(r.colors)r.stylize=f;return u(r,e,r.depth)}i.inspect=o;o.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]};o.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};function f(e,t){var i=o.styles[t];if(i){return"["+o.colors[i][0]+"m"+e+"["+o.colors[i][1]+"m"}else{return e}}function l(e,t){return e}function c(e){var t={};e.forEach(function(e,i){t[e]=true});return t}function u(e,t,r){if(e.customInspect&&t&&I(t.inspect)&&t.inspect!==i.inspect&&!(t.constructor&&t.constructor.prototype===t)){var n=t.inspect(r,e);if(!x(n)){n=u(e,n,r)}return n}var a=p(e,t);if(a){return a}var s=Object.keys(t);var o=c(s);if(e.showHidden){s=Object.getOwnPropertyNames(t)}if(T(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0)){return h(t)}if(s.length===0){if(I(t)){var f=t.name?": "+t.name:"";return e.stylize("[Function"+f+"]","special")}if(E(t)){return e.stylize(RegExp.prototype.toString.call(t),"regexp")}if(U(t)){return e.stylize(Date.prototype.toString.call(t),"date")}if(T(t)){return h(t)}}var l="",_=false,y=["{","}"];if(g(t)){_=true;y=["[","]"]}if(I(t)){var b=t.name?": "+t.name:"";l=" [Function"+b+"]"}if(E(t)){l=" "+RegExp.prototype.toString.call(t)}if(U(t)){l=" "+Date.prototype.toUTCString.call(t)}if(T(t)){l=" "+h(t)}if(s.length===0&&(!_||t.length==0)){return y[0]+l+y[1]}if(r<0){if(E(t)){return e.stylize(RegExp.prototype.toString.call(t),"regexp")}else{return e.stylize("[Object]","special")}}e.seen.push(t);var w;if(_){w=d(e,t,r,o,s)}else{w=s.map(function(i){return m(e,t,r,o,i,_)})}e.seen.pop();return v(w,l,y)}function p(e,t){if(S(t))return e.stylize("undefined","undefined");if(x(t)){var i="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(i,"string")}if(w(t))return e.stylize(""+t,"number");if(_(t))return e.stylize(""+t,"boolean");if(y(t))return e.stylize("null","null")}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,i,r,n){var a=[];for(var s=0,o=t.length;s<o;++s){if(F(t,String(s))){a.push(m(e,t,i,r,String(s),true))}else{a.push("")}}n.forEach(function(n){if(!n.match(/^\d+$/)){a.push(m(e,t,i,r,n,true))}});return a}function m(e,t,i,r,n,a){var s,o,f;f=Object.getOwnPropertyDescriptor(t,n)||{value:t[n]};if(f.get){if(f.set){o=e.stylize("[Getter/Setter]","special")}else{o=e.stylize("[Getter]","special")}}else{if(f.set){o=e.stylize("[Setter]","special")}}if(!F(r,n)){s="["+n+"]"}if(!o){if(e.seen.indexOf(f.value)<0){if(y(i)){o=u(e,f.value,null)}else{o=u(e,f.value,i-1)}if(o.indexOf("\n")>-1){if(a){o=o.split("\n").map(function(e){return" "+e}).join("\n").substr(2)}else{o="\n"+o.split("\n").map(function(e){return" "+e}).join("\n")}}}else{o=e.stylize("[Circular]","special")}}if(S(s)){if(a&&n.match(/^\d+$/)){return o}s=JSON.stringify(""+n);if(s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){s=s.substr(1,s.length-2);s=e.stylize(s,"name")}else{s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");s=e.stylize(s,"string")}}return s+": "+o}function v(e,t,i){var r=0;var n=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(n>60){return i[0]+(t===""?"":t+"\n ")+" "+e.join(",\n ")+" "+i[1]}return i[0]+t+" "+e.join(", ")+" "+i[1]}function g(e){return Array.isArray(e)}i.isArray=g;function _(e){return typeof e==="boolean"}i.isBoolean=_;function y(e){return e===null}i.isNull=y;function b(e){return e==null}i.isNullOrUndefined=b;function w(e){return typeof e==="number"}i.isNumber=w;function x(e){return typeof e==="string"}i.isString=x;function k(e){return typeof e==="symbol"}i.isSymbol=k;function S(e){return e===void 0}i.isUndefined=S;function E(e){return A(e)&&B(e)==="[object RegExp]"}i.isRegExp=E;function A(e){return typeof e==="object"&&e!==null}i.isObject=A;function U(e){return A(e)&&B(e)==="[object Date]"}i.isDate=U;function T(e){return A(e)&&(B(e)==="[object Error]"||e instanceof Error)}i.isError=T;function I(e){return typeof e==="function"}i.isFunction=I;function L(e){return e===null||typeof e==="boolean"||typeof e==="number"||typeof e==="string"||typeof e==="symbol"||typeof e==="undefined"}i.isPrimitive=L;i.isBuffer=e("./support/isBuffer");function B(e){return Object.prototype.toString.call(e)}function z(e){return e<10?"0"+e.toString(10):e.toString(10)}var R=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function C(){var e=new Date;var t=[z(e.getHours()),z(e.getMinutes()),z(e.getSeconds())].join(":");return[e.getDate(),R[e.getMonth()],t].join(" ")}i.log=function(){console.log("%s - %s",C(),i.format.apply(i,arguments))};i.inherits=e("inherits");i._extend=function(e,t){if(!t||!A(t))return e;var i=Object.keys(t);var r=i.length;while(r--){e[i[r]]=t[i[r]]}return e};function F(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":120,_process:34,inherits:55}],122:[function(e,t,i){var r=e("debug")();var n=e("mp4box");var a=1e7;var s=1e6;var o=5e3;t.exports=function(e,t,i){i=i||{};var l=i.debugTrack||-1;var c=[];t.addEventListener("waiting",function(){if(h){b(t.currentTime)}});var u=new MediaSource;u.addEventListener("sourceopen",function(){y(0)});t.src=window.URL.createObjectURL(u);var p=new n;p.onError=function(e){r("MP4Box error: %s",e.message);if(_){_()}if(u.readyState==="open"){u.endOfStream("decode")}};var h=false;var d=0;var m={};p.onReady=function(e){r("MP4 info: %o",e);e.tracks.forEach(function(e){var t;if(e.video){t="video/mp4"}else if(e.audio){t="audio/mp4"}else{return}t+='; codecs="'+e.codec+'"';if(MediaSource.isTypeSupported(t)){var i=u.addSourceBuffer(t);var r={buffer:i,arrayBuffers:[],meta:e,ended:false};i.addEventListener("updateend",x.bind(null,r));p.setSegmentOptions(e.id,null,{nbSamples:e.video?1:100});m[e.id]=r}});if(Object.keys(m).length===0){u.endOfStream("decode");return}var t=p.initializeSegmentation();t.forEach(function(e){w(m[e.id],e.buffer);if(e.id===l){f("init-track-"+l+".mp4",[e.buffer]);c.push(e.buffer)}});h=true};p.onSegment=function(e,t,i,r){var n=m[e];w(n,i,r===n.meta.nb_samples);if(e===l&&c){c.push(i);if(r>1e3){f("track-"+l+".mp4",c);c=null}}};var v;var g=null;var _=null;function y(t){if(t===e.length){p.flush();return}if(g&&t===v){return}if(g){g.destroy();_()}v=t;var i={start:v,end:e.length-1};g=e.createReadStream(i);function n(e){g.pause();if(d<=a){k()}var t=e.toArrayBuffer();t.fileStart=v;v+=t.byteLength;var i;try{i=p.appendBuffer(t)}catch(n){r("MP4Box threw exception: %s",n.message);if(u.readyState==="open"){u.endOfStream("decode")}g.destroy();_();return}y(i)}g.on("data",n);function s(){_();y(v)}g.on("end",s);function o(e){r("Stream error: %s",e.message);if(u.readyState==="open"){u.endOfStream("network")}}g.on("error",o);_=function(){g.removeListener("data",n);g.removeListener("end",s);g.removeListener("error",o);g=null;_=null}}function b(e){var t=p.seek(e,true);r("Seeking to time: %d",e);r("Seeked file offset: %d",t.offset);y(t.offset);k()}function w(e,t,i){d+=t.byteLength;e.arrayBuffers.push({buffer:t,ended:i||false});x(e)}function x(e){if(e.buffer.updating||e.arrayBuffers.length===0)return;var t=e.arrayBuffers.shift();var i=false;try{e.buffer.appendBuffer(t.buffer);e.ended=t.ended;i=true}catch(n){r("SourceBuffer error: %s",n.message);e.arrayBuffers.unshift(t);setTimeout(function(){x(e)},o)}if(i){d-=t.buffer.byteLength;if(d<=s){k()}S()}}function k(){setTimeout(function(){if(g){if(g.isPaused?g.isPaused():!g._readableState.flowing){g.resume()}}})}function S(){if(u.readyState!=="open"){return}var e=Object.keys(m).every(function(e){var t=m[e];return t.ended&&!t.buffer.updating});if(e&&u.readyState==="open"){u.endOfStream()}}};function f(e,t){var i=new Blob(t);var r=URL.createObjectURL(i);var n=document.createElement("a");n.setAttribute("href",r);n.setAttribute("download",e);n.click()}},{debug:40,mp4box:69}],123:[function(e,t,i){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){i[t]=e[t]});return i;function i(){var t=new Array(arguments.length);for(var i=0;i<t.length;i++){t[i]=arguments[i]}var r=e.apply(this,t);var n=t[t.length-1];if(typeof r==="function"&&r!==n){Object.keys(n).forEach(function(e){r[e]=n[e]})}return r}}},{}],124:[function(e,t,i){t.exports=r;function r(){var e={};for(var t=0;t<arguments.length;t++){var i=arguments[t];for(var r in i){if(i.hasOwnProperty(r)){e[r]=i[r]}}}return e}},{}],125:[function(e,t,i){t.exports=r;function r(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i){if(i.hasOwnProperty(r)){e[r]=i[r]}}}return e}},{}],126:[function(e,t,i){t.exports=function r(e,t,i){if(t===undefined){return function(t,i){return r(e,t,i)}}if(i===undefined)i="0";e-=t.toString().length;if(e>0)return new Array(e+(/\./.test(t)?2:1)).join(i)+t;return t+""}},{}],127:[function(e,t,i){t.exports={name:"webtorrent",description:"Streaming torrent client",version:"0.52.1",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",videostream:"^1.1.4","windows-no-runnable":"0.0.6",xtend:"^4.0.0","zero-fill":"^2.2.0"},devDependencies:{"bittorrent-tracker":"^5.0.0",brfs:"^1.2.0",browserify:"^10.0.0",finalhandler:"^0.3.6","run-auto":"^1.0.0","serve-static":"^1.9.3","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"}}},{}],128:[function(e,t,i){(function(i,r,n){t.exports=k;var a=e("create-torrent");var s=e("debug")("webtorrent");var o=e("bittorrent-dht/client");var f=e("events").EventEmitter;var l=e("xtend");var c=e("hat");var u=e("inherits");var p=e("load-ip-set");var h=e("run-parallel");var d=e("parse-torrent");var m=e("speedometer");var v=e("zero-fill");var g=e("path");var _=e("./lib/fs-storage");var y=e("./lib/storage");var b=e("./lib/torrent");u(k,f);var w=e("./package.json").version;var x=w.match(/([0-9]+)/g).slice(0,2).map(v(2)).join("");function k(e){var t=this;if(!(t instanceof k))return new k(e);if(!e)e={};f.call(t);if(!s.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 _==="function"?_:y;t.peerId=e.peerId===undefined?new n("-WW"+x+"-"+c(48),"utf8"):typeof e.peerId==="string"?new n(e.peerId,"hex"):e.peerId;t.peerIdHex=t.peerId.toString("hex");t.nodeId=e.nodeId===undefined?new n(c(160),"hex"):typeof e.nodeId==="string"?new n(e.nodeId,"hex"):e.nodeId;t.nodeIdHex=t.nodeId.toString("hex");if(e.dht!==false&&typeof o==="function"){t.dht=new o(l({nodeId:t.nodeId},e.dht));t.dht.listen(e.dhtPort)}s("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,i){if(e)return t.error("failed to load blocklist: "+e.message);t.blocked=i;a()})}else i.nextTick(a);function a(){if(t.destroyed)return;t.ready=true;t.emit("ready")}}Object.defineProperty(k.prototype,"ratio",{get:function(){var e=this;var t=e.torrents.reduce(function(e,t){return e+t.uploaded},0);var i=e.torrents.reduce(function(e,t){return e+t.downloaded},0)||1;return t/i}});k.prototype.get=function(e){var t=this;if(e instanceof b)return e;var i;try{i=d(e)}catch(r){return null}if(!i.infoHash)throw new Error("Invalid torrent identifier");for(var n=0,a=t.torrents.length;n<a;n++){var s=t.torrents[n];if(s.infoHash===i.infoHash)return s}return null};k.prototype.add=k.prototype.download=function(e,t,r){var n=this;if(n.destroyed)throw new Error("client is destroyed");s("add");if(typeof t==="function"){r=t;t={}}if(!t)t={};if(!t.storage)t.storage=n.storage;t.client=n;var a=n.get(e);function o(){s("on torrent");if(typeof r==="function")r(a)}if(a){if(a.ready)i.nextTick(o);else a.on("ready",o)}else{a=new b(e,t);n.torrents.push(a);a.on("error",function(e){n.emit("error",e,a);n.remove(a)});a.on("listening",function(e){n.emit("listening",e,a)});a.on("ready",function(){o();n.emit("torrent",a)})}return a};k.prototype.seed=function(e,t,i){var r=this;if(r.destroyed)throw new Error("client is destroyed");s("seed");if(typeof t==="function"){i=t;t={}}if(!t)t={};t.noVerify=true;t.createdBy="WebTorrent/"+w;if(typeof e==="string"&&!t.path)t.path=g.dirname(e);var n;var o=r.add(undefined,t,function(e){var t=[function(t){e.storage.load(n,t)}];if(r.dht){t.push(function(t){e.on("dhtAnnounce",t)})}h(t,function(t){if(t)return r.emit("error",t);f();r.emit("seed",e)})});a.parseInput(e,t,function(i,s){if(i)return r.emit("error",i);n=s.map(function(e){return e.getStream});a(e,t,function(e,t){if(e)return r.emit("error",e);if(r.destroyed)return;var i=r.get(t);if(i){o.destroy();f();return}else{o._onTorrentId(t)}})});function f(){s("on seed");if(typeof i==="function")i(o)}return o};k.prototype.remove=function(e,t){var i=this;var r=i.get(e);if(!r)throw new Error("No torrent with id "+e);s("remove");i.torrents.splice(i.torrents.indexOf(r),1);r.destroy(t)};k.prototype.address=function(){var e=this;return{address:"0.0.0.0",family:"IPv4",port:e.torrentPort}};k.prototype.destroy=function(e){var t=this;t.destroyed=true;s("destroy");var i=t.torrents.map(function(e){return function(i){t.remove(e,i)}});if(t.dht){i.push(function(e){t.dht.destroy(e)})}h(i,e)}}).call(this,e("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},e("buffer").Buffer)},{"./lib/fs-storage":30,"./lib/storage":7,"./lib/torrent":8,"./package.json":127,_process:34,"bittorrent-dht/client":30,buffer:36,"create-torrent":39,debug:40,events:45,hat:49,inherits:55,"load-ip-set":30,"parse-torrent":85,path:86,"run-parallel":104,speedometer:110,xtend:124,"zero-fill":126}]},{},[128])(128)});