site-musique/vendor/cacheP2P/cachep2p.min.js

11 lines
258 KiB
JavaScript
Raw Normal View History

2016-11-20 00:19:24 +01:00
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.CacheP2P=e()}}(function(){var e;return function t(e,n,r){function o(s,a){if(!n[s]){if(!e[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[s]={exports:{}};e[s][0].call(f.exports,function(t){var n=e[s][1][t];return o(n?n:t)},f,f.exports,t,e,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)o(r[s]);return o}({1:[function(e,t){var n=/^\[?([^\]]+)\]?:(\d+)$/,r={},o=0;t.exports=function(e){if(1e5===o&&t.exports.reset(),!r[e]){var i=n.exec(e);if(!i)throw new Error("invalid addr: "+e);r[e]=[i[1],Number(i[2])],o+=1}return r[e]},t.exports.reset=function(){r={},o=0}},{}],2:[function(e,t,n){"use strict";function r(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function o(e){return 3*e.length/4-r(e)}function i(e){var t,n,o,i,s,a,u=e.length;s=r(e),a=new d(3*u/4-s),o=s>0?u-4:u;var c=0;for(t=0,n=0;o>t;t+=4,n+=3)i=f[e.charCodeAt(t)]<<18|f[e.charCodeAt(t+1)]<<12|f[e.charCodeAt(t+2)]<<6|f[e.charCodeAt(t+3)],a[c++]=i>>16&255,a[c++]=i>>8&255,a[c++]=255&i;return 2===s?(i=f[e.charCodeAt(t)]<<2|f[e.charCodeAt(t+1)]>>4,a[c++]=255&i):1===s&&(i=f[e.charCodeAt(t)]<<10|f[e.charCodeAt(t+1)]<<4|f[e.charCodeAt(t+2)]>>2,a[c++]=i>>8&255,a[c++]=255&i),a}function s(e){return c[e>>18&63]+c[e>>12&63]+c[e>>6&63]+c[63&e]}function a(e,t,n){for(var r,o=[],i=t;n>i;i+=3)r=(e[i]<<16)+(e[i+1]<<8)+e[i+2],o.push(s(r));return o.join("")}function u(e){for(var t,n=e.length,r=n%3,o="",i=[],s=16383,u=0,f=n-r;f>u;u+=s)i.push(a(e,u,u+s>f?f:u+s));return 1===r?(t=e[n-1],o+=c[t>>2],o+=c[t<<4&63],o+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],o+=c[t>>10],o+=c[t>>4&63],o+=c[t<<2&63],o+="="),i.push(o),i.join("")}n.byteLength=o,n.toByteArray=i,n.fromByteArray=u;for(var c=[],f=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,p=h.length;p>l;++l)c[l]=h[l],f[h.charCodeAt(l)]=l;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63},{}],3:[function(e,t){(function(e){function n(t,r,o,i){return"number"!=typeof r&&null==i&&(i=r,r=void 0),"number"!=typeof o&&null==i&&(i=o,o=void 0),n.position=0,n.encoding=i||null,n.data=e.isBuffer(t)?t.slice(r,o):new e(t),n.bytes=n.data.length,n.next()}n.bytes=0,n.position=0,n.data=null,n.encoding=null,n.next=function(){switch(n.data[n.position]){case 100:return n.dictionary();case 108:return n.list();case 105:return n.integer();default:return n.buffer()}},n.find=function(e){for(var t=n.position,r=n.data.length,o=n.data;r>t;){if(o[t]===e)return t;t++}throw new Error('Invalid data: Missing delimiter "'+String.fromCharCode(e)+'" [0x'+e.toString(16)+"]")},n.dictionary=function(){n.position++;for(var e={};101!==n.data[n.position];)e[n.buffer()]=n.next();return n.position++,e},n.list=function(){n.position++;for(var e=[];101!==n.data[n.position];)e.push(n.next());return n.position++,e},n.integer=function(){var e=n.find(101),t=n.data.toString("ascii",n.position+1,e);return n.position+=e+1-n.position,parseInt(t,10)},n.buffer=function(){var e=n.find(58),t=parseInt(n.data.toString("ascii",n.position,e),10),r=++e+t;return n.position=r,n.encoding?n.data.toString(n.encoding,e,r):n.data.slice(e,r)},t.exports=n}).call(this,e("buffer").Buffer)},{buffer:18}],4:[function(e,t){(function(e){function n(t,r,o){var i=[],s=null;return n._encode(i,t),s=e.concat(i),n.bytes=s.length,e.isBuffer(r)?(s.copy(r,o),r):s}n.bytes=-1,n._floatConversionDetected=!1,n._encode=function(t,r){if(e.isBuffer(r))return t.push(new e(r.length+":")),void t.push(r);switch(typeof r){case"string":n.buffer(t,r);break;case"number":n.number(t,r);break;case"object":r.constructor===Array?n.list(t,r):n.dict(t,r);break;case"boolean":n.number(t,r
if("Buffer"===e.type&&Array.isArray(e.data))return new o(e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},n.allocUnsafeSlow=function(e){if("function"==typeof o.allocUnsafeSlow)return o.allocUnsafeSlow(e);if("number"!=typeof e)throw new TypeError("size must be a number");if(e>=s)throw new RangeError("size is too large");return new i(e)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{buffer:18}],18:[function(e,t,n){(function(t){"use strict";function r(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(t){return!1}}function o(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(e,t){if(o()<t)throw new RangeError("Invalid typed array length");return s.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=s.prototype):(null===e&&(e=new s(t)),e.length=t),e}function s(e,t,n){if(!(s.TYPED_ARRAY_SUPPORT||this instanceof s))return new s(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return a(this,e,t,n)}function a(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?l(e,t,n,r):"string"==typeof t?d(e,t,n):p(e,t)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(0>e)throw new RangeError('"size" argument must not be negative')}function c(e,t,n,r){return u(t),0>=t?i(e,t):void 0!==n?"string"==typeof r?i(e,t).fill(n,r):i(e,t).fill(n):i(e,t)}function f(e,t){if(u(t),e=i(e,0>t?0:0|m(t)),!s.TYPED_ARRAY_SUPPORT)for(var n=0;t>n;++n)e[n]=0;return e}function d(e,t,n){if(("string"!=typeof n||""===n)&&(n="utf8"),!s.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|y(t,n);e=i(e,r);var o=e.write(t,n);return o!==r&&(e=e.slice(0,o)),e}function h(e,t){var n=t.length<0?0:0|m(t.length);e=i(e,n);for(var r=0;n>r;r+=1)e[r]=255&t[r];return e}function l(e,t,n,r){if(t.byteLength,0>n||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),s.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=s.prototype):e=h(e,t),e}function p(e,t){if(s.isBuffer(t)){var n=0|m(t.length);return e=i(e,n),0===e.length?e:(t.copy(e,0,0,n),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||X(t.length)?i(e,0):h(e,t);if("Buffer"===t.type&&Z(t.data))return h(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function m(e){if(e>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function g(e){return+e!=e&&(e=0),s.alloc(+e)}function y(e,t){if(s.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Y(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return $(e).length;default:if(r)return Y(e).length;t=(""+t).toLowerCase(),r=!0}}function _(e,t,n){var r=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),0>=n)return"";if(n>>>=0,t>>>=0,t>=n)return"";for(e||(e="utf8");;)switch(e){case"hex":return U(this,t,n);case"utf8":case"utf-8":return T(this,t,n);case"ascii":return L(this,t,n);case"latin1":case"binary":return R(this,t,n);case"base64":return A(this,t,n);ca
n.save(e);for(var t=(e||"").split(/[\s,]+/),r=t.length,o=0;r>o;o++)t[o]&&(e=t[o].replace(/\*/g,".*?"),"-"===e[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))}function s(){n.enable("")}function a(e){var t,r;for(t=0,r=n.skips.length;r>t;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;r>t;t++)if(n.names[t].test(e))return!0;return!1}function u(e){return e instanceof Error?e.stack||e.message:e}n=t.exports=o,n.coerce=u,n.disable=s,n.enable=i,n.enabled=a,n.humanize=e("ms"),n.names=[],n.skips=[],n.formatters={};var c,f=0},{ms:52}],26:[function(e,t){t.exports=function(){for(var e=0;e<arguments.length;e++)if(void 0!==arguments[e])return arguments[e]}},{}],27:[function(e,t){var n=e("once"),r=function(){},o=function(e){return e.setHeader&&"function"==typeof e.abort},i=function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length},s=function(e,t,a){if("function"==typeof t)return s(e,null,t);t||(t={}),a=n(a||r);var u=e._writableState,c=e._readableState,f=t.readable||t.readable!==!1&&e.readable,d=t.writable||t.writable!==!1&&e.writable,h=function(){e.writable||l()},l=function(){d=!1,f||a()},p=function(){f=!1,d||a()},m=function(e){a(e?new Error("exited with error code: "+e):null)},g=function(){return(!f||c&&c.ended)&&(!d||u&&u.ended)?void 0:a(new Error("premature close"))},y=function(){e.req.on("finish",l)};return o(e)?(e.on("complete",l),e.on("abort",g),e.req?y():e.on("request",y)):d&&!u&&(e.on("end",h),e.on("close",h)),i(e)&&e.on("exit",m),e.on("end",p),e.on("finish",l),t.error!==!1&&e.on("error",a),e.on("close",g),function(){e.removeListener("complete",l),e.removeListener("abort",g),e.removeListener("request",y),e.req&&e.req.removeListener("finish",l),e.removeListener("end",h),e.removeListener("close",h),e.removeListener("finish",l),e.removeListener("exit",m),e.removeListener("end",p),e.removeListener("error",a),e.removeListener("close",g)}};t.exports=s},{once:28}],28:[function(e,t){function n(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}var r=e("wrappy");t.exports=r(n),n.proto=n(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return n(this)},configurable:!0})})},{wrappy:120}],29:[function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function i(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,a,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var f=new Error('Uncaught, unspecified "error" event. ('+t+")");throw f.context=t,f}if(n=this._events[e],s(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),n.apply(this,a)}else if(i(n))for(a=Array.prototype.slice.call(arguments,1),c=n.slice(),o=c.length,u=0;o>u;u++)c[u].apply(this,a);return!0},n.prototype.addListener=function(e,t){var o;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?i(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,i(this._events[e])&&!this._events[e].warned&&(o=s(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,o&&o>0&&this._events[e].length>o&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase l
n.mfhd.encode=function(e,r,o){return r=r?r.slice(o):new t(4),r.writeUInt32BE(e.sequenceNumber||0,0),n.mfhd.encode.bytes=4,r},n.mfhd.decode=function(e){return{sequenceNumber:e.readUint32BE(0)}},n.mfhd.encodingLength=function(){return 4},n.tfhd={},n.tfhd.encode=function(e,r,o){return r=r?r.slice(o):new t(4),r.writeUInt32BE(e.trackId,0),n.tfhd.encode.bytes=4,r},n.tfhd.decode=function(){},n.tfhd.encodingLength=function(){return 4},n.tfdt={},n.tfdt.encode=function(e,r,o){return r=r?r.slice(o):new t(4),r.writeUInt32BE(e.baseMediaDecodeTime||0,0),n.tfdt.encode.bytes=4,r},n.tfdt.decode=function(){},n.tfdt.encodingLength=function(){return 4},n.trun={},n.trun.encode=function(e,r,o){r=r?r.slice(o):new t(8+16*e.entries.length),r.writeUInt32BE(e.entries.length,0),r.writeInt32BE(e.dataOffset,4);for(var i=8,s=0;s<e.entries.length;s++){var a=e.entries[s];r.writeUInt32BE(a.sampleDuration,i),i+=4,r.writeUInt32BE(a.sampleSize,i),i+=4,r.writeUInt32BE(a.sampleFlags,i),i+=4,r.writeUInt32BE(a.sampleCompositionTimeOffset,i),i+=4}n.trun.encode.bytes=i},n.trun.decode=function(){},n.trun.encodingLength=function(e){return 8+16*e.entries.length},n.mdat={},n.mdat.encode=function(e,t,r){e.buffer?(e.buffer.copy(t,r),n.mdat.encode.bytes=e.buffer.length):n.mdat.encode.bytes=n.mdat.encodingLength(e)},n.mdat.decode=function(e,n,r){return{buffer:new t(e.slice(n,r))}},n.mdat.encodingLength=function(e){return e.buffer?e.buffer.length:e.contentLength}}).call(this,e("buffer").Buffer)},{"./descriptor":47,"./index":48,buffer:18}],47:[function(e,t,n){(function(e){var t={3:"ESDescriptor",4:"DecoderConfigDescriptor",5:"DecoderSpecificInfo",6:"SLConfigDescriptor"};n.Descriptor={},n.Descriptor.decode=function(r,o,i){var s,a=r.readUInt8(o),u=o+1,c=0;do s=r.readUInt8(u++),c=c<<7|127&s;while(128&s);var f,d=t[a];return f=n[d]?n[d].decode(r,u,i):{buffer:new e(r.slice(u,u+c))},f.tag=a,f.tagName=d,f.length=u-o+c,f.contentsLen=c,f},n.DescriptorArray={},n.DescriptorArray.decode=function(e,r,o){for(var i=r,s={};o>=i+2;){var a=n.Descriptor.decode(e,i,o);i+=a.length;var u=t[a.tag]||"Descriptor"+a.tag;s[u]=a}return s},n.ESDescriptor={},n.ESDescriptor.decode=function(e,t,r){var o=e.readUInt8(t+2),i=t+3;if(128&o&&(i+=2),64&o){var s=e.readUInt8(i);i+=s+1}return 32&o&&(i+=2),n.DescriptorArray.decode(e,i,r)},n.DecoderConfigDescriptor={},n.DecoderConfigDescriptor.decode=function(e,t,r){var o=e.readUInt8(t),i=n.DescriptorArray.decode(e,t+13,r);return i.oti=o,i}}).call(this,e("buffer").Buffer)},{buffer:18}],48:[function(e,t,n){(function(t){var r=e("uint64be"),o=e("./boxes"),i=4294967295,s=n,a=n.containers={moov:["mvhd","meta","traks","mvex"],trak:["tkhd","tref","trgr","edts","meta","mdia","udta"],edts:["elst"],mdia:["mdhd","hdlr","elng","minf"],minf:["vmhd","smhd","hmhd","sthd","nmhd","dinf","stbl"],dinf:["dref"],stbl:["stsd","stts","ctts","cslg","stsc","stsz","stz2","stco","co64","stss","stsh","padb","stdp","sdtp","sbgps","sgpds","subss","saizs","saios"],mvex:["mehd","trexs","leva"],moof:["mfhd","meta","trafs"],traf:["tfhd","trun","sbgps","sgpds","subss","saizs","saios","tfdt","meta"]};s.encode=function(e,n,r){return s.encodingLength(e),r=r||0,n=n||new t(e.length),s._encode(e,n,r)},s._encode=function(e,t,n){var u=e.type,c=e.length;c>i&&(c=1),t.writeUInt32BE(c,n),t.write(e.type,n+4,4,"ascii");var f=n+8;if(1===c&&(r.encode(e.length,t,f),f+=8),o.fullBoxes[u]&&(t.writeUInt32BE(e.flags||0,f),t.writeUInt8(e.version||0,f),f+=4),a[u]){var d=a[u];d.forEach(function(n){if(5===n.length){var r=e[n]||[];n=n.substr(0,4),r.forEach(function(e){s._encode(e,t,f),f+=s.encode.bytes})}else e[n]&&(s._encode(e[n],t,f),f+=s.encode.bytes)}),e.otherBoxes&&e.otherBoxes.forEach(function(e){s._encode(e,t,f),f+=s.encode.bytes})}else if(o[u]){var h=o[u].encode;h(e,t,f),f+=h.bytes}else{if(!e.buffer)throw new Error("Either `type` must be set to a known type (not'"+u+"') or `buffer` must be set");var l=e.buffer;l.copy(t,f),f+=e.buffer.length}return s.encode.bytes=f-n,t},s.readHeaders=function(e,t,n){if(t=t||0,n=n||e.length,8>n-t)return 8;var i=e.readUInt32BE(t),s=e.toString("ascii",t+4,t+8),a=t+8;if(1===i){if(16>n-t)ret
t=t||{},this.objectMode=!!t.objectMode,n instanceof q&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var r=t.highWaterMark,o=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:o,this.highWaterMark=~~this.highWaterMark,this.buffer=new D,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(H||(H=e("string_decoder/").StringDecoder),this.decoder=new H(t.encoding),this.encoding=t.encoding)}function i(t){return q=q||e("./_stream_duplex"),this instanceof i?(this._readableState=new o(t,this),this.readable=!0,t&&"function"==typeof t.read&&(this._read=t.read),void L.call(this)):new i(t)}function s(e,t,n,r,o){var i=f(t,n);if(i)e.emit("error",i);else if(null===n)t.reading=!1,d(e,t);else if(t.objectMode||n&&n.length>0)if(t.ended&&!o){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&o){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else{var c;!t.decoder||o||r||(n=t.decoder.write(n),c=!t.objectMode&&0===n.length),o||(t.reading=!1),c||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,o?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&h(e))),p(e,t)}else o||(t.reading=!1);return a(t)}function a(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function u(e){return e>=N?e=N:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function c(e,t){return 0>=e||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function f(e,t){var n=null;return U.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function d(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,h(e)}}function h(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(j("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?T(l,e):l(e))}function l(e){j("emit readable"),e.emit("readable"),b(e)}function p(e,t){t.readingMore||(t.readingMore=!0,T(m,e,t))}function m(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(j("maybeReadMore read 0"),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function g(e){return function(){var t=e._readableState;j("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&R(e,"data")&&(t.flowing=!0,b(e))}}function y(e){j("readable nexttick read 0"),e.read(0)}function _(e,t){t.resumeScheduled||(t.resumeScheduled=!0,T(v,e,t))}function v(e,t){t.reading||(j("resume read 0"),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit("resume"),b(e),t.flowing&&!t.reading&&e.read(0)}function b(e){var t=e._readableState;for(j("flow",t.flowing);t.flowing&&null!==e.read(););}function w(e,t){if(0===t.length)return null;var n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=E(e,t.buffer,t.decoder),n}function E(e,t,n){var r;return e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):r=e===t.head.data.length?t.shift():n?k(e,t):x(e,t),r}function k(e,t){var n=t.head,r=1,o=n.data;for(e-=o.length;n=n.next;){var i=n.data,s=e>i.length?i.length:e;if(o+=s===i.length?i:i.slice(0,e),e-=s,0===e){s===i.length?(++r,t.head=n.next?n.next:t.tail=null):(t.head=n,n.data=i.slice(s));break}++r}return t.length-=r,o}function x(e,t){var n=P.allocUnsafe(e),r=t.head,o=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var i=r.data,s=e>i.length?i.length:e;if(i.copy(n,n.length-e,0,s),e-=s,0===e){s===i.length?(++o,t.head=r.next?r.next:t.tai
l=d,d=c,c=a<<30|a>>>2,a=i,i=m,o[r>>2]=g;for(r=e+240|0;(r|0)<(e+320|0);r=r+4|0)g=(o[r-12>>2]^o[r-32>>2]^o[r-56>>2]^o[r-64>>2])<<1|(o[r-12>>2]^o[r-32>>2]^o[r-56>>2]^o[r-64>>2])>>>31,m=((i<<5|i>>>27)+(a^c^d)|0)+((g+l|0)-899497514|0)|0,l=d,d=c,c=a<<30|a>>>2,a=i,i=m,o[r>>2]=g;i=i+s|0,a=a+u|0,c=c+f|0,d=d+h|0,l=l+p|0}o[t+320>>2]=i,o[t+324>>2]=a,o[t+328>>2]=c,o[t+332>>2]=d,o[t+336>>2]=l}var o=new e.Int32Array(n);return{hash:r}},"undefined"!=typeof t?t.exports=n:"undefined"!=typeof window&&(window.Rusha=n),"undefined"!=typeof FileReaderSync){var o=new FileReaderSync,i=new n(4194304);self.onmessage=function(e){var t,n=e.data.data;try{t=i.digest(n),self.postMessage({id:e.data.id,hash:t})}catch(r){self.postMessage({id:e.data.id,error:r.name})}}}}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],82:[function(e,t){t.exports=e("buffer")},{buffer:18}],83:[function(e,t){(function(e){t.exports=function(t,n){var r=[];t.on("data",function(e){r.push(e)}),t.once("end",function(){n&&n(null,e.concat(r)),n=null}),t.once("error",function(e){n&&n(e),n=null})}}).call(this,e("buffer").Buffer)},{buffer:18}],84:[function(e,t){(function(n){function r(e,t){e="string"==typeof e?{url:e}:Object.assign({},e),t=u(t),e.url&&o(e),null==e.headers&&(e.headers={}),null==e.maxRedirects&&(e.maxRedirects=10);var i;e.form&&(i="string"==typeof e.form?e.form:c.stringify(e.form)),e.body&&(i=e.json?JSON.stringify(e.body):e.body),e.json&&(e.headers.accept="application/json"),e.json&&i&&(e.headers["content-type"]="application/json"),e.form&&(e.headers["content-type"]="application/x-www-form-urlencoded"),i&&(e.headers["content-length"]=n.byteLength(i)),delete e.body,delete e.form,i&&!e.method&&(e.method="POST"),e.method&&(e.method=e.method.toUpperCase());var d=Object.keys(e.headers).some(function(e){return"accept-encoding"===e.toLowerCase()});d||(e.headers["accept-encoding"]="gzip, deflate");var h="https:"===e.protocol?a:s,l=h.request(e,function(n){if(n.statusCode>=300&&n.statusCode<400&&"location"in n.headers)return e.url=n.headers.location,o(e),n.resume(),e.maxRedirects-=1,void(e.maxRedirects>0?r(e,t):t(new Error("too many redirects")));var i="function"==typeof f&&"HEAD"!==e.method;t(null,i?f(n):n)});return l.on("error",t),l.end(i),l}function o(e){var t=d.parse(e.url);t.hostname&&(e.hostname=t.hostname),t.port&&(e.port=t.port),t.protocol&&(e.protocol=t.protocol),t.auth&&(e.auth=t.auth),e.path=t.path,delete e.url}t.exports=r;var i=e("simple-concat"),s=e("http"),a=e("https"),u=e("once"),c=e("querystring"),f=e("unzip-response"),d=e("url");r.concat=function(e,t){return r(e,function(n,r){return n?t(n):void i(r,function(n,o){if(n)return t(n);if(e.json)try{o=JSON.parse(o.toString())}catch(n){return t(n,r,o)}t(null,r,o)})})},["get","post","put","patch","head","delete"].forEach(function(e){r[e]=function(t,n){return"string"==typeof t&&(t={url:t}),t.method=e.toUpperCase(),r(t,n)}})}).call(this,e("buffer").Buffer)},{buffer:18,http:89,https:33,once:55,querystring:66,"simple-concat":83,"unzip-response":15,url:106}],85:[function(e,t){(function(n){function r(e){var t=this;if(!(t instanceof r))return new r(e);if(t.channelName=e.initiator?e.channelName||u(20).toString("hex"):null,t._debug("new peer %o",e),e||(e={}),e.allowHalfOpen=!1,null==e.highWaterMark&&(e.highWaterMark=1048576),c.Duplex.call(t,e),t.initiator=e.initiator||!1,t.channelConfig=e.channelConfig||r.channelConfig,t.config=e.config||r.config,t.constraints=e.constraints||r.constraints,t.offerConstraints=e.offerConstraints||{},t.answerConstraints=e.answerConstraints||{},t.reconnectTimer=e.reconnectTimer||!1,t.sdpTransform=e.sdpTransform||function(e){return e},t.stream=e.stream||!1,t.trickle=void 0!==e.trickle?e.trickle:!0,t.destroyed=!1,t.connected=!1,t.remoteAddress=void 0,t.remoteFamily=void 0,t.remotePort=void 0,t.localAddress=void 0,t.localPort=void 0,t._isWrtc=!!e.wrtc,t._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:s(),!t._wrtc)throw new Error("undefined"==typeof window?"No WebRTC support: Specify `opts.wrtc` option in this environment":"No WebRTC suppo
u(r,s),r.prototype.updatePort=function(e){var t=this;e!==t._port&&(t._port=e,t.dht&&t._dhtAnnounce(),t.tracker&&(t.tracker.stop(),t.tracker.destroy(function(){t.tracker=t._createTracker()})))},r.prototype.complete=function(e){this.tracker&&this.tracker.complete(e)},r.prototype.destroy=function(e){var t=this;if(!t.destroyed){t.destroyed=!0,clearTimeout(t._dhtTimeout);var n=[];t.tracker&&(t.tracker.stop(),t.tracker.removeListener("warning",t._onWarning),t.tracker.removeListener("error",t._onError),t.tracker.removeListener("peer",t._onTrackerPeer),t.tracker.removeListener("update",t._onTrackerAnnounce),n.push(function(e){t.tracker.destroy(e)})),t.dht&&t.dht.removeListener("peer",t._onDHTPeer),t._internalDHT&&(t.dht.removeListener("warning",t._onWarning),t.dht.removeListener("error",t._onError),n.push(function(e){t.dht.destroy(e)})),c(n,e),t.dht=null,t.tracker=null,t._announce=null}},r.prototype._createTracker=function(){var e=a(this._trackerOpts,{infoHash:this.infoHash,announce:this._announce,peerId:this.peerId,port:this._port}),t=new f(e);return t.on("warning",this._onWarning),t.on("error",this._onError),t.on("peer",this._onTrackerPeer),t.on("update",this._onTrackerAnnounce),t.setInterval(this._intervalMs),t.start(),t},r.prototype._dhtAnnounce=function(){function e(){return t._intervalMs+Math.floor(Math.random()*t._intervalMs/5)}var t=this;t._dhtAnnouncing||(o("dht announce"),t._dhtAnnouncing=!0,clearTimeout(t._dhtTimeout),t.dht.announce(t.infoHash,t._port,function(n){t._dhtAnnouncing=!1,o("dht announce complete"),n&&t.emit("warning",n),t.emit("dhtAnnounce"),t.destroyed||(t._dhtTimeout=setTimeout(function(){t._dhtAnnounce()},e()),t._dhtTimeout.unref&&t._dhtTimeout.unref())}))}}).call(this,e("_process"))},{_process:61,"bittorrent-dht/client":15,"bittorrent-tracker/client":9,debug:24,events:29,inherits:36,"run-parallel":80,xtend:121}],101:[function(e,t){(function(e){function n(e){return this instanceof n?(this.length=e,this.missing=e,this.sources=null,this._chunks=Math.ceil(e/r),this._remainder=e%r||r,this._buffered=0,this._buffer=null,this._cancellations=null,this._reservations=0,void(this._flushed=!1)):new n(e)}t.exports=n;var r=16384;n.BLOCK_LENGTH=r,n.prototype.chunkLength=function(e){return e===this._chunks-1?this._remainder:r},n.prototype.chunkLengthRemaining=function(e){return this.length-e*r},n.prototype.chunkOffset=function(e){return e*r},n.prototype.reserve=function(){return this.init()?this._cancellations.length?this._cancellations.pop():this._reservations<this._chunks?this._reservations++:-1:-1},n.prototype.reserveRemaining=function(){if(!this.init())return-1;if(this._reservations<this._chunks){var e=this._reservations;return this._reservations=this._chunks,e}return-1},n.prototype.cancel=function(e){this.init()&&this._cancellations.push(e)},n.prototype.cancelRemaining=function(e){this.init()&&(this._reservations=e)},n.prototype.get=function(e){return this.init()?this._buffer[e]:null},n.prototype.set=function(e,t,n){if(!this.init())return!1;for(var o=t.length,i=Math.ceil(o/r),s=0;i>s;s++)if(!this._buffer[e+s]){var a=s*r,u=t.slice(a,a+r);this._buffered++,this._buffer[e+s]=u,this.missing-=u.length,-1===this.sources.indexOf(n)&&this.sources.push(n)}return this._buffered===this._chunks},n.prototype.flush=function(){if(!this._buffer||this._chunks!==this._buffered)return null;var t=e.concat(this._buffer,this.length);return this._buffer=null,this._cancellations=null,this.sources=null,this._flushed=!0,t},n.prototype.init=function(){return this._flushed?!1:this._buffer?!0:(this._buffer=new Array(this._chunks),this._cancellations=[],this.sources=[],!0)}}).call(this,e("buffer").Buffer)},{buffer:18}],102:[function(e,t){(function(n){var r=e("is-typedarray").strict;t.exports=function(e){if(r(e)){var t=new n(e.buffer);return e.byteLength!==e.buffer.byteLength&&(t=t.slice(e.byteOffset,e.byteOffset+e.byteLength)),t}return new n(e)}}).call(this,e("buffer").Buffer)},{buffer:18,"is-typedarray":40}],103:[function(e,t,n){(function(e){var t=4294967295;n.encodingLength=function(){return 8},n.encode=function(n,r,o){r||(r=new e(8)),o||(o=
this._destroyed=!1,this.name=t.name,this.path=t.path,this.length=t.length,this.offset=t.offset,this.done=!1;var n=t.offset,r=n+t.length-1;this._startPiece=n/this._torrent.pieceLength|0,this._endPiece=r/this._torrent.pieceLength|0,0===this.length&&(this.done=!0,this.emit("done"))}t.exports=r;var o=e("end-of-stream"),i=e("events").EventEmitter,s=e("./file-stream"),a=e("inherits"),u=e("path"),c=e("render-media"),f=e("readable-stream"),d=e("stream-to-blob"),h=e("stream-to-blob-url"),l=e("stream-with-known-length-to-buffer");a(r,i),r.prototype.select=function(e){0!==this.length&&this._torrent.select(this._startPiece,this._endPiece,e)},r.prototype.deselect=function(){0!==this.length&&this._torrent.deselect(this._startPiece,this._endPiece,!1)},r.prototype.createReadStream=function(e){var t=this;if(0===this.length){var r=new f.PassThrough;return n.nextTick(function(){r.end()}),r}var i=new s(t,e);return t._torrent.select(i._startPiece,i._endPiece,!0,function(){i._notify()}),o(i,function(){t._destroyed||t._torrent.destroyed||t._torrent.deselect(i._startPiece,i._endPiece,!0)}),i},r.prototype.getBuffer=function(e){l(this.createReadStream(),this.length,e)},r.prototype.getBlob=function(e){if("undefined"==typeof window)throw new Error("browser-only method");d(this.createReadStream(),this._getMimeType(),e)},r.prototype.getBlobURL=function(e){if("undefined"==typeof window)throw new Error("browser-only method");h(this.createReadStream(),this._getMimeType(),e)},r.prototype.appendTo=function(e,t,n){if("undefined"==typeof window)throw new Error("browser-only method");c.append(this,e,t,n)},r.prototype.renderTo=function(e,t,n){if("undefined"==typeof window)throw new Error("browser-only method");c.render(this,e,t,n)},r.prototype._getMimeType=function(){return c.mime[u.extname(this.name).toLowerCase()]},r.prototype._destroy=function(){this._destroyed=!0,this._torrent=null}}).call(this,e("_process"))},{"./file-stream":113,_process:61,"end-of-stream":27,events:29,inherits:36,path:58,"readable-stream":76,"render-media":77,"stream-to-blob":94,"stream-to-blob-url":93,"stream-with-known-length-to-buffer":95}],115:[function(e,t,n){function r(e,t){var n=this;n.id=e,n.type=t,s("new Peer %s",e),n.addr=null,n.conn=null,n.swarm=null,n.wire=null,n.connected=!1,n.destroyed=!1,n.timeout=null,n.retries=0,n.sentHandshake=!1}function o(){}var i=e("unordered-array-remove"),s=e("debug")("webtorrent:peer"),a=e("bittorrent-protocol"),u=e("./webconn"),c=5e3,f=25e3,d=25e3;n.createWebRTCPeer=function(e,t){var n=new r(e.id,"webrtc");return n.conn=e,n.swarm=t,n.conn.connected?n.onConnect():(n.conn.once("connect",function(){n.onConnect()}),n.conn.once("error",function(e){n.destroy(e)}),n.startConnectTimeout()),n},n.createTCPIncomingPeer=function(e){var t=e.remoteAddress+":"+e.remotePort,n=new r(t,"tcpIncoming");return n.conn=e,n.addr=t,n.onConnect(),n},n.createTCPOutgoingPeer=function(e,t){var n=new r(e,"tcpOutgoing");return n.addr=e,n.swarm=t,n},n.createWebSeedPeer=function(e,t){var n=new r(e,"webSeed");return n.swarm=t,n.conn=new u(e,t),n.onConnect(),n},r.prototype.onConnect=function(){var e=this;if(!e.destroyed){e.connected=!0,s("Peer %s connected",e.id),clearTimeout(e.connectTimeout);var t=e.conn;t.once("end",function(){e.destroy()}),t.once("close",function(){e.destroy()}),t.once("finish",function(){e.destroy()}),t.once("error",function(t){e.destroy(t)});var n=e.wire=new a;n.type=e.type,n.once("end",function(){e.destroy()}),n.once("close",function(){e.destroy()}),n.once("finish",function(){e.destroy()}),n.once("error",function(t){e.destroy(t)}),n.once("handshake",function(t,n){e.onHandshake(t,n)}),e.startHandshakeTimeout(),t.pipe(n).pipe(t),e.swarm&&!e.sentHandshake&&e.handshake()}},r.prototype.onHandshake=function(e,t){var n=this;if(n.swarm&&!n.destroyed){if(n.swarm.destroyed)return n.destroy(new Error("swarm already destroyed"));if(e!==n.swarm.infoHash)return n.destroy(new Error("unexpected handshake info hash for this swarm"));if(t===n.swarm.peerId)return n.destroy(new Error("refusing to connect to ourselves"));s("Peer %s got handshake %s",n.id,e),clearTimeout(n.ha
var a,u=this,c=e*u._torrent.pieceLength,d=c+t,h=d+n-1,l=u._torrent.files;if(l.length<=1)a=[{url:u.url,start:d,end:h}];else{var p=l.filter(function(e){return e.offset<=h&&e.offset+e.length>d});if(p.length<1)return r(new Error("Could not find file corresponnding to web seed range request"));a=p.map(function(e){var t=e.offset+e.length-1,n=u.url+("/"===u.url[u.url.length-1]?"":"/")+e.path;return{url:n,fileOffsetInRange:Math.max(e.offset-d,0),start:Math.max(d-e.offset,0),end:Math.min(t,h-e.offset)}})}var m,g=0,y=!1;a.length>1&&(m=o.alloc(n)),a.forEach(function(o){function u(e,t){return e.statusCode<200||e.statusCode>=300?(y=!0,r(new Error("Unexpected HTTP status code "+e.statusCode))):(i("Got data of length %d",t.length),void(1===a.length?r(null,t):(t.copy(m,o.fileOffsetInRange),++g===a.length&&r(null,m))))}var c=o.url,d=o.start,h=o.end;i("Requesting url=%s pieceIndex=%d offset=%d length=%d start=%d end=%d",c,e,t,n,d,h);var l={url:c,method:"GET",headers:{"user-agent":"WebTorrent/"+f+" (https://webtorrent.io)",range:"bytes="+d+"-"+h}};s.concat(l,function(e,t,n){return y?void 0:e?"undefined"==typeof window||c.startsWith(window.location.origin+"/")?(y=!0,r(e)):s.head(c,function(t,n){if(!y){if(t)return y=!0,r(t);if(n.statusCode<200||n.statusCode>=300)return y=!0,r(new Error("Unexpected HTTP status code "+n.statusCode));if(n.url===c)return y=!0,r(e);l.url=n.url,s.concat(l,function(e,t,n){return y?void 0:e?(y=!0,r(e)):void u(t,n)})}}):void u(t,n)})})},n.prototype.destroy=function(){c.prototype.destroy.call(this),this._torrent=null}},{"../package.json":119,bitfield:7,"bittorrent-protocol":8,debug:24,inherits:36,"safe-buffer":82,"simple-get":84,"simple-sha1":86}],119:[function(e,t){t.exports={version:"0.97.2"}},{}],120:[function(e,t){function n(e,t){function r(){for(var t=new Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),o=t[t.length-1];return"function"==typeof r&&r!==o&&Object.keys(o).forEach(function(e){r[e]=o[e]}),r}if(e&&t)return n(e)(t);if("function"!=typeof e)throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(t){r[t]=e[t]}),r}t.exports=n},{}],121:[function(e,t){function n(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];for(var o in n)r.call(n,o)&&(e[o]=n[o])}return e}t.exports=n;var r=Object.prototype.hasOwnProperty},{}],122:[function(e,t){function n(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)r.call(n,o)&&(e[o]=n[o])}return e}t.exports=n;var r=Object.prototype.hasOwnProperty},{}],123:[function(e,t){t.exports=function n(e,t,r){return void 0===t?function(t,r){return n(e,t,r)}:(void 0===r&&(r="0"),e-=t.toString().length,e>0?new Array(e+(/\./.test(t)?2:1)).join(r)+t:t+"")}},{}],124:[function(e,t){function n(e,t){function r(e){e.files.forEach(function(e){e.getBuffer(function(e,t){if(e)return log(e.message);var n=JSON.parse(t.toString("utf8"));o(n.page,function(e){return e!=c.security_sha1[n.url]?void c.emit("message","Cached version of "+n.url+" received, has wrong security hash, rejecting it."):(c.emit("message","Cached version of "+n.url+" has a verified security hash! Proceeding by changing links in page."),f[n.url]=n,c.update_links(),void(window.onpopstate=function(e){document.documentElement.innerHTML=e.state.page,document.title=p+" "+e.state.title,window.scrollTo(0,0),c.emit("onpopstate",e);for(var t=document.getElementsByTagName("a"),n=0;n<t.length;n++)Object.keys(f).indexOf(t[n].href)>-1?t[n].onclick=function(e){e.preventDefault(),document.documentElement.innerHTML=f[e.target.href].page,document.title=p+" "+f[e.target.href].title,window.history.pushState({page:f[e.target.href].page,title:f[e.target.href].title},"",e.target.href),setTimeout(function(){window.scrollTo(0,0)},10)}:c.fetch(t[n])}))})})})}var c=this;return"function"==typeof e&&(t=e),document.security_sha1&&(c.security_sha1=document.security_sha1),p=e&&e.cached_mark?e.cached_mark:"* ",c instanceof n?(u.call(c),c.emit("message","Initializing CacheP2P..."),window.onpopstate=function(e){console.log("onpopstate called",e)},c.announceList=[["udp://tracker.o