mirror of
https://github.com/leoherzog/TorrentParts.git
synced 2026-10-28 18:54:10 -07:00
Tweak newTrackOn and Update Dependencies
This commit is contained in:
3 files changed
+2663
-737
No files matched your search
+2621
-702
File diff suppressed because it is too large.
Load diff
Vendored
+41
-34
@@ -1,95 +1,102 @@
|
||||
!function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){var c="function"==typeof require&&require;if(!a&&c)return c(o,!0);if(s)return s(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[o]={exports:{}};t[o][0].call(l.exports,(function(e){return r(t[o][1][e]||e)}),l,l.exports,e,t,n,i)}return n[o].exports}for(var s="function"==typeof require&&require,o=0;o<i.length;o++)r(i[o]);return r}({1:[function(e,t,n){(function(e){(function(){"use strict";function t(e){var t=e.getBoundingClientRect();return{width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left,x:t.left,y:t.top}}function i(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function r(e){var t=i(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function s(e){return e instanceof i(e).Element||e instanceof Element}function o(e){return e instanceof i(e).HTMLElement||e instanceof HTMLElement}function a(e){return"undefined"!=typeof ShadowRoot&&(e instanceof i(e).ShadowRoot||e instanceof ShadowRoot)}function c(e){return e?(e.nodeName||"").toLowerCase():null}function u(e){return((s(e)?e.ownerDocument:e.document)||window.document).documentElement}function l(e){return t(u(e)).left+r(e).scrollLeft}function d(e){return i(e).getComputedStyle(e)}function f(e){var t=d(e),n=t.overflow,i=t.overflowX,r=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+i)}function p(e,n,s){void 0===s&&(s=!1);var a,d,p=u(n),h=t(e),m=o(n),b={scrollLeft:0,scrollTop:0},g={x:0,y:0};return(m||!m&&!s)&&(("body"!==c(n)||f(p))&&(b=(a=n)!==i(a)&&o(a)?{scrollLeft:(d=a).scrollLeft,scrollTop:d.scrollTop}:r(a)),o(n)?((g=t(n)).x+=n.clientLeft,g.y+=n.clientTop):p&&(g.x=l(p))),{x:h.left+b.scrollLeft-g.x,y:h.top+b.scrollTop-g.y,width:h.width,height:h.height}}function h(e){var n=t(e),i=e.offsetWidth,r=e.offsetHeight;return Math.abs(n.width-i)<=1&&(i=n.width),Math.abs(n.height-r)<=1&&(r=n.height),{x:e.offsetLeft,y:e.offsetTop,width:i,height:r}}function m(e){return"html"===c(e)?e:e.assignedSlot||e.parentNode||(a(e)?e.host:null)||u(e)}function b(e){return["html","body","#document"].indexOf(c(e))>=0?e.ownerDocument.body:o(e)&&f(e)?e:b(m(e))}function g(e,t){var n;void 0===t&&(t=[]);var r=b(e),s=r===(null==(n=e.ownerDocument)?void 0:n.body),o=i(r),a=s?[o].concat(o.visualViewport||[],f(r)?r:[]):r,c=t.concat(a);return s?c:c.concat(g(m(a)))}function v(e){return["table","td","th"].indexOf(c(e))>=0}function y(e){return o(e)&&"fixed"!==d(e).position?e.offsetParent:null}function _(e){for(var t=i(e),n=y(e);n&&v(n)&&"static"===d(n).position;)n=y(n);return n&&("html"===c(n)||"body"===c(n)&&"static"===d(n).position)?t:n||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&o(e)&&"fixed"===d(e).position)return null;for(var n=m(e);o(n)&&["html","body"].indexOf(c(n))<0;){var i=d(n);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return n;n=n.parentNode}return null}(e)||t}Object.defineProperty(n,"__esModule",{value:!0});var w="top",x="bottom",k="right",E="left",S="auto",M=[w,x,k,E],A="start",I="end",j="viewport",C="popper",T=M.reduce((function(e,t){return e.concat([t+"-"+A,t+"-"+I])}),[]),B=[].concat(M,[S]).reduce((function(e,t){return e.concat([t,t+"-"+A,t+"-"+I])}),[]),R=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function L(e){var t=new Map,n=new Set,i=[];function r(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var i=t.get(e);i&&r(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||r(e)})),i}function O(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return[].concat(n).reduce((function(e,t){return e.replace(/%s/,t)}),e)}var P='Popper: modifier "%s" provided an invalid %s property, expected %s but got %s',U=["name","enabled","phase","fn","effect","requires","options"];function q(e){return e.split("-")[0]}var D=Math.max,N=Math.min,z=Math.round;function H(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&a(n)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function F(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function W(e,n){return n===j?F(function(e){var t=i(e),n=u(e),r=t.visualViewport,s=n.clientWidth,o=n.clientHeight,a=0,c=0;return r&&(s=r.width,o=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(a=r.offsetLeft,c=r.offsetTop)),{width:s,height:o,x:a+l(e),y:c}}(e)):o(n)?function(e){var n=t(e);return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clienLine truncated
|
||||
!function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){var c="function"==typeof require&&require;if(!a&&c)return c(o,!0);if(s)return s(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[o]={exports:{}};t[o][0].call(l.exports,(function(e){return r(t[o][1][e]||e)}),l,l.exports,e,t,n,i)}return n[o].exports}for(var s="function"==typeof require&&require,o=0;o<i.length;o++)r(i[o]);return r}({1:[function(e,t,n){(function(e){(function(){"use strict";function t(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function i(e){return e instanceof t(e).Element||e instanceof Element}function r(e){return e instanceof t(e).HTMLElement||e instanceof HTMLElement}function s(e){return"undefined"!=typeof ShadowRoot&&(e instanceof t(e).ShadowRoot||e instanceof ShadowRoot)}Object.defineProperty(n,"__esModule",{value:!0});var o=Math.round;function a(e,t){void 0===t&&(t=!1);var n=e.getBoundingClientRect(),i=1,s=1;return r(e)&&t&&(i=n.width/e.offsetWidth||1,s=n.height/e.offsetHeight||1),{width:o(n.width/i),height:o(n.height/s),top:o(n.top/s),right:o(n.right/i),bottom:o(n.bottom/s),left:o(n.left/i),x:o(n.left/i),y:o(n.top/s)}}function c(e){var n=t(e);return{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function u(e){return e?(e.nodeName||"").toLowerCase():null}function l(e){return((i(e)?e.ownerDocument:e.document)||window.document).documentElement}function d(e){return a(l(e)).left+c(e).scrollLeft}function f(e){return t(e).getComputedStyle(e)}function p(e){var t=f(e),n=t.overflow,i=t.overflowX,r=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+i)}function h(e,n,i){void 0===i&&(i=!1);var s,o,f=r(n),h=r(n)&&function(e){var t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,i=t.height/e.offsetHeight||1;return 1!==n||1!==i}(n),m=l(n),b=a(e,h),g={scrollLeft:0,scrollTop:0},v={x:0,y:0};return(f||!f&&!i)&&(("body"!==u(n)||p(m))&&(g=(s=n)!==t(s)&&r(s)?{scrollLeft:(o=s).scrollLeft,scrollTop:o.scrollTop}:c(s)),r(n)?((v=a(n,!0)).x+=n.clientLeft,v.y+=n.clientTop):m&&(v.x=d(m))),{x:b.left+g.scrollLeft-v.x,y:b.top+g.scrollTop-v.y,width:b.width,height:b.height}}function m(e){var t=a(e),n=e.offsetWidth,i=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-i)<=1&&(i=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:i}}function b(e){return"html"===u(e)?e:e.assignedSlot||e.parentNode||(s(e)?e.host:null)||l(e)}function g(e){return["html","body","#document"].indexOf(u(e))>=0?e.ownerDocument.body:r(e)&&p(e)?e:g(b(e))}function v(e,n){var i;void 0===n&&(n=[]);var r=g(e),s=r===(null==(i=e.ownerDocument)?void 0:i.body),o=t(r),a=s?[o].concat(o.visualViewport||[],p(r)?r:[]):r,c=n.concat(a);return s?c:c.concat(v(b(a)))}function y(e){return["table","td","th"].indexOf(u(e))>=0}function _(e){return r(e)&&"fixed"!==f(e).position?e.offsetParent:null}function w(e){for(var n=t(e),i=_(e);i&&y(i)&&"static"===f(i).position;)i=_(i);return i&&("html"===u(i)||"body"===u(i)&&"static"===f(i).position)?n:i||function(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox");if(-1!==navigator.userAgent.indexOf("Trident")&&r(e)&&"fixed"===f(e).position)return null;for(var n=b(e);r(n)&&["html","body"].indexOf(u(n))<0;){var i=f(n);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return n;n=n.parentNode}return null}(e)||n}var x="top",k="bottom",E="right",S="left",M="auto",A=[x,k,E,S],I="start",T="end",j="viewport",C="popper",B=A.reduce((function(e,t){return e.concat([t+"-"+I,t+"-"+T])}),[]),R=[].concat(A,[M]).reduce((function(e,t){return e.concat([t,t+"-"+I,t+"-"+T])}),[]),L=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function O(e){var t=new Map,n=new Set,i=[];function r(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var i=t.get(e);i&&r(i)}})),i.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||r(e)})),i}function P(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return[].concat(n).reduce((function(e,t){return e.replace(/%s/,t)}),e)}var U='Popper: modifier "%s" provided an invalid %s property, expected %s but got %s',q=["name","enabled","phase","fn","effect","requires","options"];function N(e){return e.split("-")[0]}var D=Math.max,z=Math.min,H=Math.round;function F(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&s(n)){var i=t;do{if(i&&e.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function W(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function V(e,n){return n===j?W(function(e){var n=t(e),i=l(e),r=n.visualViewport,s=i.clientWidth,o=i.clientHeight,a=0,c=0;return r&&(s=r.width,o=r.height,/^((?!chrome|android)Line truncated
|
||||
/*! bittorrent-protocol. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */
|
||||
const i=e("unordered-array-remove"),r=e("bencode"),s=e("bitfield").default,o=e("crypto"),a=e("debug")("bittorrent-protocol"),c=e("randombytes"),u=e("simple-sha1"),l=e("speedometer"),d=e("readable-stream"),f=e("rc4"),p=n.from("BitTorrent protocol"),h=n.from([0,0,0,0]),m=n.from([0,0,0,1,0]),b=n.from([0,0,0,1,1]),g=n.from([0,0,0,1,2]),v=n.from([0,0,0,1,3]),y=[0,0,0,0,0,0,0,0],_=[0,0,0,3,9,0,0],w=n.from([0,0,0,0,0,0,0,0]),x=n.from([0,0,1,2]),k=n.from([0,0,0,2]);function E(e,t){for(let n=e.length;n--;)e[n]^=t[n];return e}class S{constructor(e,t,n,i){this.piece=e,this.offset=t,this.length=n,this.callback=i}}class M extends d.Duplex{constructor(e=null,t=0,n=!1){super(),this._debugId=c(4).toString("hex"),this._debug("new wire"),this.peerId=null,this.peerIdBuffer=null,this.type=e,this.amChoking=!0,this.amInterested=!1,this.peerChoking=!0,this.peerInterested=!1,this.peerPieces=new s(0,{grow:4e5}),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=l(),this.downloadSpeed=l(),this._keepAliveInterval=null,this._timeout=null,this._timeoutMs=0,this._timeoutExpiresAt=null,this.destroyed=!1,this._finished=!1,this._parserSize=0,this._parser=null,this._buffer=[],this._bufferSize=0,this._peEnabled=n,n?(this._dh=o.createDiffieHellman("ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a36210000000000090563","hex",2),this._myPubKey=this._dh.generateKeys("hex")):this._myPubKey=null,this._peerPubKey=null,this._sharedSecret=null,this._peerCryptoProvide=[],this._cryptoHandshakeDone=!1,this._cryptoSyncPattern=null,this._waitMaxBytes=null,this._encryptionMethod=null,this._encryptGenerator=null,this._decryptGenerator=null,this._setGenerators=!1,this.once("finish",(()=>this._onFinish())),this.on("finish",this._onFinish),this._debug("type:",this.type),"tcpIncoming"===this.type&&this._peEnabled?this._determineHandshakeType():"tcpOutgoing"===this.type&&this._peEnabled&&0===t?this._parsePe2():this._parseHandshake(null)}setKeepAlive(e){this._debug("setKeepAlive %s",e),clearInterval(this._keepAliveInterval),!1!==e&&(this._keepAliveInterval=setInterval((()=>{this.keepAlive()}),55e3))}setTimeout(e,t){this._debug("setTimeout ms=%d unref=%s",e,t),this._timeoutMs=e,this._timeoutUnref=!!t,this._resetTimeout(!0)}destroy(){this.destroyed||(this.destroyed=!0,this._debug("destroy"),this.emit("close"),this.end())}end(...e){this._debug("end"),this._onUninterested(),this._onChoke(),super.end(...e)}use(e){const t=e.prototype.name;if(!t)throw new Error('Extension class requires a "name" property on the prototype');this._debug("use extension.name=%s",t);const n=this._nextExt,i=new e(this);function r(){}"function"!=typeof i.onHandshake&&(i.onHandshake=r),"function"!=typeof i.onExtendedHandshake&&(i.onExtendedHandshake=r),"function"!=typeof i.onMessage&&(i.onMessage=r),this.extendedMapping[n]=t,this._ext[t]=i,this[t]=i,this._nextExt+=1}keepAlive(){this._debug("keep-alive"),this._push(h)}sendPe1(){if(this._peEnabled){const e=Math.floor(513*Math.random()),t=c(e);this._push(n.concat([n.from(this._myPubKey,"hex"),t]))}}sendPe2(){const e=Math.floor(513*Math.random()),t=c(e);this._push(n.concat([n.from(this._myPubKey,"hex"),t]))}sendPe3(e){this.setEncrypt(this._sharedSecret,e);const t=n.from(u.sync(n.from(this._utfToHex("req1")+this._sharedSecret,"hex")),"hex"),i=E(n.from(u.sync(n.from(this._utfToHex("req2")+e,"hex")),"hex"),n.from(u.sync(n.from(this._utfToHex("req3")+this._sharedSecret,"hex")),"hex")),r=c(2).readUInt16BE(0)%512,s=c(r);let o=n.alloc(14+r+2);w.copy(o),x.copy(o,8),o.writeInt16BE(r,12),s.copy(o,14),o.writeInt16BE(0,14+r),o=this._encryptHandshake(o),this._push(n.concat([t,i,o]))}sendPe4(e){this.setEncrypt(this._sharedSecret,e);const t=c(2).readUInt16BE(0)%512,i=c(t);let r=n.alloc(14+t);w.copy(r),k.copy(r,8),r.writeInt16BE(t,12),i.copy(r,14),r=this._encryptHandshake(r),this._push(r),this._cryptoHandshakeDone=!0,this._debug("completed crypto handshake")}handshake(e,t,i){let r,s;if("string"==typeof e?(e=e.toLowerCase(),r=n.from(e,"hex")):(r=e,e=r.toString("hex")),"string"==typeof t?s=n.from(t,"hex"):(s=t,t=s.toString("hex")),this._infoHash=r,20!==r.length||20!==s.length)throw new Error("infoHash and peerId MUST have length 20");this._debug("handshake i=%s p=%s exts=%o",e,t,i);const o=n.from(y);o[5]|=16,i&&i.dht&&(o[7]|=1),this._push(n.concat([p,o,r,s])),this._handshakeSent=!0,this.peerExtensions.extended&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()}_sendExtendedHandshake(){const e=Object.assign({},this.extendedHandshake);e.m={};for(const t in this.extendedMapping){const n=this.extendedMapping[t];e.m[n]=Number(t)}this.extended(0,r.encode(e)),this._extendedHandshakeSent=!0}choke(){if(!this.amChoking){for(this.amChoking=!0,this._dLine truncated
|
||||
const i=e("unordered-array-remove"),r=e("bencode"),s=e("bitfield").default,o=e("crypto"),a=e("debug")("bittorrent-protocol"),c=e("randombytes"),u=e("simple-sha1"),l=e("speedometer"),d=e("readable-stream"),f=e("rc4"),p=n.from("BitTorrent protocol"),h=n.from([0,0,0,0]),m=n.from([0,0,0,1,0]),b=n.from([0,0,0,1,1]),g=n.from([0,0,0,1,2]),v=n.from([0,0,0,1,3]),y=[0,0,0,0,0,0,0,0],_=[0,0,0,3,9,0,0],w=n.from([0,0,0,0,0,0,0,0]),x=n.from([0,0,1,2]),k=n.from([0,0,0,2]);function E(e,t){for(let n=e.length;n--;)e[n]^=t[n];return e}class S{constructor(e,t,n,i){this.piece=e,this.offset=t,this.length=n,this.callback=i}}class M extends d.Duplex{constructor(e=null,t=0,n=!1){super(),this._debugId=c(4).toString("hex"),this._debug("new wire"),this.peerId=null,this.peerIdBuffer=null,this.type=e,this.amChoking=!0,this.amInterested=!1,this.peerChoking=!0,this.peerInterested=!1,this.peerPieces=new s(0,{grow:4e5}),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=l(),this.downloadSpeed=l(),this._keepAliveInterval=null,this._timeout=null,this._timeoutMs=0,this._timeoutExpiresAt=null,this.destroyed=!1,this._finished=!1,this._parserSize=0,this._parser=null,this._buffer=[],this._bufferSize=0,this._peEnabled=n,n?(this._dh=o.createDiffieHellman("ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a36210000000000090563","hex",2),this._myPubKey=this._dh.generateKeys("hex")):this._myPubKey=null,this._peerPubKey=null,this._sharedSecret=null,this._peerCryptoProvide=[],this._cryptoHandshakeDone=!1,this._cryptoSyncPattern=null,this._waitMaxBytes=null,this._encryptionMethod=null,this._encryptGenerator=null,this._decryptGenerator=null,this._setGenerators=!1,this.once("finish",(()=>this._onFinish())),this.on("finish",this._onFinish),this._debug("type:",this.type),"tcpIncoming"===this.type&&this._peEnabled?this._determineHandshakeType():"tcpOutgoing"===this.type&&this._peEnabled&&0===t?this._parsePe2():this._parseHandshake(null)}setKeepAlive(e){this._debug("setKeepAlive %s",e),clearInterval(this._keepAliveInterval),!1!==e&&(this._keepAliveInterval=setInterval((()=>{this.keepAlive()}),55e3))}setTimeout(e,t){this._debug("setTimeout ms=%d unref=%s",e,t),this._timeoutMs=e,this._timeoutUnref=!!t,this._resetTimeout(!0)}destroy(){this.destroyed||(this.destroyed=!0,this._debug("destroy"),this.emit("close"),this.end())}end(...e){this._debug("end"),this._onUninterested(),this._onChoke(),super.end(...e)}use(e){const t=e.prototype.name;if(!t)throw new Error('Extension class requires a "name" property on the prototype');this._debug("use extension.name=%s",t);const n=this._nextExt,i=new e(this);function r(){}"function"!=typeof i.onHandshake&&(i.onHandshake=r),"function"!=typeof i.onExtendedHandshake&&(i.onExtendedHandshake=r),"function"!=typeof i.onMessage&&(i.onMessage=r),this.extendedMapping[n]=t,this._ext[t]=i,this[t]=i,this._nextExt+=1}keepAlive(){this._debug("keep-alive"),this._push(h)}sendPe1(){if(this._peEnabled){const e=Math.floor(513*Math.random()),t=c(e);this._push(n.concat([n.from(this._myPubKey,"hex"),t]))}}sendPe2(){const e=Math.floor(513*Math.random()),t=c(e);this._push(n.concat([n.from(this._myPubKey,"hex"),t]))}sendPe3(e){this.setEncrypt(this._sharedSecret,e);const t=n.from(u.sync(n.from(this._utfToHex("req1")+this._sharedSecret,"hex")),"hex"),i=E(n.from(u.sync(n.from(this._utfToHex("req2")+e,"hex")),"hex"),n.from(u.sync(n.from(this._utfToHex("req3")+this._sharedSecret,"hex")),"hex")),r=c(2).readUInt16BE(0)%512,s=c(r);let o=n.alloc(14+r+2);w.copy(o),x.copy(o,8),o.writeInt16BE(r,12),s.copy(o,14),o.writeInt16BE(0,14+r),o=this._encryptHandshake(o),this._push(n.concat([t,i,o]))}sendPe4(e){this.setEncrypt(this._sharedSecret,e);const t=c(2).readUInt16BE(0)%512,i=c(t);let r=n.alloc(14+t);w.copy(r),k.copy(r,8),r.writeInt16BE(t,12),i.copy(r,14),r=this._encryptHandshake(r),this._push(r),this._cryptoHandshakeDone=!0,this._debug("completed crypto handshake")}handshake(e,t,i){let r,s;if("string"==typeof e?(e=e.toLowerCase(),r=n.from(e,"hex")):(r=e,e=r.toString("hex")),"string"==typeof t?s=n.from(t,"hex"):(s=t,t=s.toString("hex")),this._infoHash=r,20!==r.length||20!==s.length)throw new Error("infoHash and peerId MUST have length 20");this._debug("handshake i=%s p=%s exts=%o",e,t,i);const o=n.from(y);o[5]|=16,i&&i.dht&&(o[7]|=1),this._push(n.concat([p,o,r,s])),this._handshakeSent=!0,this.peerExtensions.extended&&!this._extendedHandshakeSent&&this._sendExtendedHandshake()}_sendExtendedHandshake(){const e=Object.assign({},this.extendedHandshake);e.m={};for(const t in this.extendedMapping){const n=this.extendedMapping[t];e.m[n]=Number(t)}this.extended(0,r.encode(e)),this._extendedHandshakeSent=!0}choke(){if(!this.amChoking){for(this.amChoking=!0,this._dLine truncated
|
||||
/*! blob-to-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
t.exports=function(t,n){if("undefined"==typeof Blob||!(t instanceof Blob))throw new Error("first argument must be a Blob");if("function"!=typeof n)throw new Error("second argument must be a function");const i=new FileReader;i.addEventListener("loadend",(function t(r){i.removeEventListener("loadend",t,!1),r.error?n(r.error):n(null,e.from(i.result))}),!1),i.readAsArrayBuffer(t)}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:114}],53:[function(e,t,n){(function(n){(function(){const{Transform:i}=e("readable-stream");t.exports=class extends i{constructor(e,t={}){super(t),"object"==typeof e&&(e=(t=e).size),this.size=e||512;const{nopad:n,zeroPadding:i=!0}=t;this._zeroPadding=!n&&!!i,this._buffered=[],this._bufferedBytes=0}_transform(e,t,i){for(this._bufferedBytes+=e.length,this._buffered.push(e);this._bufferedBytes>=this.size;){this._bufferedBytes-=this.size;const e=[];let t=0;for(;t<this.size;){const n=this._buffered.shift();if(t+n.length<=this.size)e.push(n),t+=n.length;else{const i=this.size-t;e.push(n.slice(0,i)),t+=i,this._buffered.unshift(n.slice(i))}}this.push(n.concat(e,this.size))}i()}_flush(){if(this._bufferedBytes&&this._zeroPadding){const e=n.alloc(this.size-this._bufferedBytes);this._buffered.push(e),this.push(n.concat(this._buffered)),this._buffered=null}else this._bufferedBytes&&(this.push(n.concat(this._buffered)),this._buffered=null);this.push(null)}}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:114,"readable-stream":68}],54:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{dup:30}],55:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{"./_stream_readable":57,"./_stream_writable":59,_process:333,dup:31,inherits:245}],56:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{"./_stream_transform":58,dup:32,inherits:245}],57:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"../errors":54,"./_stream_duplex":55,"./internal/streams/async_iterator":60,"./internal/streams/buffer_list":61,"./internal/streams/destroy":62,"./internal/streams/from":64,"./internal/streams/state":66,"./internal/streams/stream":67,_process:333,buffer:114,dup:33,events:194,inherits:245,"string_decoder/":466,util:71}],58:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{"../errors":54,"./_stream_duplex":55,dup:34,inherits:245}],59:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{"../errors":54,"./_stream_duplex":55,"./internal/streams/destroy":62,"./internal/streams/state":66,"./internal/streams/stream":67,_process:333,buffer:114,dup:35,inherits:245,"util-deprecate":485}],60:[function(e,t,n){arguments[4][36][0].apply(n,arguments)},{"./end-of-stream":63,_process:333,dup:36}],61:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{buffer:114,dup:37,util:71}],62:[function(e,t,n){arguments[4][38][0].apply(n,arguments)},{_process:333,dup:38}],63:[function(e,t,n){arguments[4][39][0].apply(n,arguments)},{"../../../errors":54,dup:39}],64:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{dup:40}],65:[function(e,t,n){arguments[4][41][0].apply(n,arguments)},{"../../../errors":54,"./end-of-stream":63,dup:41}],66:[function(e,t,n){arguments[4][42][0].apply(n,arguments)},{"../../../errors":54,dup:42}],67:[function(e,t,n){arguments[4][43][0].apply(n,arguments)},{dup:43,events:194}],68:[function(e,t,n){arguments[4][44][0].apply(n,arguments)},{"./lib/_stream_duplex.js":55,"./lib/_stream_passthrough.js":56,"./lib/_stream_readable.js":57,"./lib/_stream_transform.js":58,"./lib/_stream_writable.js":59,"./lib/internal/streams/end-of-stream.js":63,"./lib/internal/streams/pipeline.js":65,dup:44}],69:[function(e,t,n){!function(t,n){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function s(e,t,n){if(s.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"==typeof t?t.exports=s:n.BN=s,s.BN=s,s.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:e("buffer").Buffer}catch(e){}function a(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void i(!1,"Invalid character in "+e)}function c(e,t,n){var i=a(e,n);return n-1>=t&&(i|=a(e,n-1)<<4),i}function u(e,t,n,r){for(var s=0,o=0,a=Math.min(e.length,n),c=t;c<a;c++){var u=e.charCodeAt(c)-48;s*=r,o=u>=49?u-49+10:u>=17?u-17+10:u,i(u>=0&&o<r,"Invalid character"),s+=o}return s}function l(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(s.isBN=function(e){return e instanceof s||null!==e&&"object"==typeof e&&e.constructor.wordSize===s.wordSize&&Array.isArray(e.words)},s.max=function(e,t){return e.cmp(t)>0?e:t},s.min=function(e,t){return e.cmp(t)<0?e:t},s.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),i(t=Line truncated
|
||||
t.exports=function(t,n){if("undefined"==typeof Blob||!(t instanceof Blob))throw new Error("first argument must be a Blob");if("function"!=typeof n)throw new Error("second argument must be a function");const i=new FileReader;i.addEventListener("loadend",(function t(r){i.removeEventListener("loadend",t,!1),r.error?n(r.error):n(null,e.from(i.result))}),!1),i.readAsArrayBuffer(t)}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:116}],55:[function(e,t,n){(function(n){(function(){const{Transform:i}=e("readable-stream");t.exports=class extends i{constructor(e,t={}){super(t),"object"==typeof e&&(e=(t=e).size),this.size=e||512;const{nopad:n,zeroPadding:i=!0}=t;this._zeroPadding=!n&&!!i,this._buffered=[],this._bufferedBytes=0}_transform(e,t,i){for(this._bufferedBytes+=e.length,this._buffered.push(e);this._bufferedBytes>=this.size;){this._bufferedBytes-=this.size;const e=[];let t=0;for(;t<this.size;){const n=this._buffered.shift();if(t+n.length<=this.size)e.push(n),t+=n.length;else{const i=this.size-t;e.push(n.slice(0,i)),t+=i,this._buffered.unshift(n.slice(i))}}this.push(n.concat(e,this.size))}i()}_flush(){if(this._bufferedBytes&&this._zeroPadding){const e=n.alloc(this.size-this._bufferedBytes);this._buffered.push(e),this.push(n.concat(this._buffered)),this._buffered=null}else this._bufferedBytes&&(this.push(n.concat(this._buffered)),this._buffered=null);this.push(null)}}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:116,"readable-stream":70}],56:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{dup:32}],57:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"./_stream_readable":59,"./_stream_writable":61,_process:342,dup:33,inherits:249}],58:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{"./_stream_transform":60,dup:34,inherits:249}],59:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{"../errors":56,"./_stream_duplex":57,"./internal/streams/async_iterator":62,"./internal/streams/buffer_list":63,"./internal/streams/destroy":64,"./internal/streams/from":66,"./internal/streams/state":68,"./internal/streams/stream":69,_process:342,buffer:116,dup:35,events:196,inherits:249,"string_decoder/":481,util:73}],60:[function(e,t,n){arguments[4][36][0].apply(n,arguments)},{"../errors":56,"./_stream_duplex":57,dup:36,inherits:249}],61:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{"../errors":56,"./_stream_duplex":57,"./internal/streams/destroy":64,"./internal/streams/state":68,"./internal/streams/stream":69,_process:342,buffer:116,dup:37,inherits:249,"util-deprecate":500}],62:[function(e,t,n){arguments[4][38][0].apply(n,arguments)},{"./end-of-stream":65,_process:342,dup:38}],63:[function(e,t,n){arguments[4][39][0].apply(n,arguments)},{buffer:116,dup:39,util:73}],64:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{_process:342,dup:40}],65:[function(e,t,n){arguments[4][41][0].apply(n,arguments)},{"../../../errors":56,dup:41}],66:[function(e,t,n){arguments[4][42][0].apply(n,arguments)},{dup:42}],67:[function(e,t,n){arguments[4][43][0].apply(n,arguments)},{"../../../errors":56,"./end-of-stream":65,dup:43}],68:[function(e,t,n){arguments[4][44][0].apply(n,arguments)},{"../../../errors":56,dup:44}],69:[function(e,t,n){arguments[4][45][0].apply(n,arguments)},{dup:45,events:196}],70:[function(e,t,n){arguments[4][46][0].apply(n,arguments)},{"./lib/_stream_duplex.js":57,"./lib/_stream_passthrough.js":58,"./lib/_stream_readable.js":59,"./lib/_stream_transform.js":60,"./lib/_stream_writable.js":61,"./lib/internal/streams/end-of-stream.js":65,"./lib/internal/streams/pipeline.js":67,dup:46}],71:[function(e,t,n){!function(t,n){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function s(e,t,n){if(s.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"==typeof t?t.exports=s:n.BN=s,s.BN=s,s.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:e("buffer").Buffer}catch(e){}function a(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void i(!1,"Invalid character in "+e)}function c(e,t,n){var i=a(e,n);return n-1>=t&&(i|=a(e,n-1)<<4),i}function u(e,t,n,r){for(var s=0,o=0,a=Math.min(e.length,n),c=t;c<a;c++){var u=e.charCodeAt(c)-48;s*=r,o=u>=49?u-49+10:u>=17?u-17+10:u,i(u>=0&&o<r,"Invalid character"),s+=o}return s}function l(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(s.isBN=function(e){return e instanceof s||null!==e&&"object"==typeof e&&e.constructor.wordSize===s.wordSize&&Array.isArray(e.words)},s.max=function(e,t){return e.cmp(t)>0?e:t},s.min=function(e,t){return e.cmp(t)<0?e:t},s.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),i(t=Line truncated
|
||||
/*!
|
||||
* The buffer module from node.js, for the browser.
|
||||
*
|
||||
* @author Feross Aboukhadijeh <https://feross.org>
|
||||
* @license MIT
|
||||
*/
|
||||
"use strict";var t=e("base64-js"),i=e("ieee754");n.Buffer=o,n.SlowBuffer=function(e){+e!=e&&(e=0);return o.alloc(+e)},n.INSPECT_MAX_BYTES=50;var r=2147483647;function s(e){if(e>r)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=o.prototype,t}function o(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return a(e,t,n)}function a(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|f(e,t),i=s(n),r=i.write(e,t);r!==n&&(i=i.slice(0,r));return i}(e,t);if(ArrayBuffer.isView(e))return l(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(N(e,ArrayBuffer)||e&&N(e.buffer,ArrayBuffer))return function(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');var i;i=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n);return i.__proto__=o.prototype,i}(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return o.from(i,t,n);var r=function(e){if(o.isBuffer(e)){var t=0|d(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||z(e.length)?s(0):l(e);if("Buffer"===e.type&&Array.isArray(e.data))return l(e.data)}(e);if(r)return r;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return c(e),s(e<0?0:0|d(e))}function l(e){for(var t=e.length<0?0:0|d(e.length),n=s(t),i=0;i<t;i+=1)n[i]=255&e[i];return n}function d(e){if(e>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||N(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(e).length;default:if(r)return i?-1:U(e).length;t=(""+t).toLowerCase(),r=!0}}function p(e,t,n){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,n);case"utf8":case"utf-8":return E(this,t,n);case"ascii":return M(this,t,n);case"latin1":case"binary":return A(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function h(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function m(e,t,n,i,r){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),z(n=+n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=o.from(t,i)),o.isBuffer(t))return 0===t.length?-1:b(e,t,n,i,r);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,i,r){var s,o=1,a=e.length,c=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,n/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(r){var l=-1;for(s=n;s<a;s++)if(u(e,s)===u(t,-1===l?0:s-l)){if(-1===l&&(l=s),s-l+1===c)return l*o}else-1!==l&&(s-=s-l),l=-1}else for(n+c>a&&(n=a-c),s=n;s>=0;s--){for(var d=!0,f=0;f<c;f++)if(u(e,s+f)!==u(t,f)){d=!1;break}if(d)return s}return-1}function g(e,t,n,i){n=Number(n)||0;var r=e.length-n;i?(i=Number(i))>r&&(i=r):i=r;var s=t.length;i>s/2&&(i=s/2);for(var o=0;o<i;++o){var a=parseInt(t.substr(2*o,2),16);if(z(a))return o;e[n+o]=a}return o}funcLine truncated
|
||||
"use strict";var t=e("base64-js"),i=e("ieee754");n.Buffer=o,n.SlowBuffer=function(e){+e!=e&&(e=0);return o.alloc(+e)},n.INSPECT_MAX_BYTES=50;var r=2147483647;function s(e){if(e>r)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=o.prototype,t}function o(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return a(e,t,n)}function a(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|f(e,t),i=s(n),r=i.write(e,t);r!==n&&(i=i.slice(0,r));return i}(e,t);if(ArrayBuffer.isView(e))return l(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(D(e,ArrayBuffer)||e&&D(e.buffer,ArrayBuffer))return function(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');var i;i=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n);return i.__proto__=o.prototype,i}(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return o.from(i,t,n);var r=function(e){if(o.isBuffer(e)){var t=0|d(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||z(e.length)?s(0):l(e);if("Buffer"===e.type&&Array.isArray(e.data))return l(e.data)}(e);if(r)return r;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return c(e),s(e<0?0:0|d(e))}function l(e){for(var t=e.length<0?0:0|d(e.length),n=s(t),i=0;i<t;i+=1)n[i]=255&e[i];return n}function d(e){if(e>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||D(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(e).length;default:if(r)return i?-1:U(e).length;t=(""+t).toLowerCase(),r=!0}}function p(e,t,n){var i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,n);case"utf8":case"utf-8":return E(this,t,n);case"ascii":return M(this,t,n);case"latin1":case"binary":return A(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function h(e,t,n){var i=e[t];e[t]=e[n],e[n]=i}function m(e,t,n,i,r){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),z(n=+n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=o.from(t,i)),o.isBuffer(t))return 0===t.length?-1:b(e,t,n,i,r);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,i,r){var s,o=1,a=e.length,c=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,n/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(r){var l=-1;for(s=n;s<a;s++)if(u(e,s)===u(t,-1===l?0:s-l)){if(-1===l&&(l=s),s-l+1===c)return l*o}else-1!==l&&(s-=s-l),l=-1}else for(n+c>a&&(n=a-c),s=n;s>=0;s--){for(var d=!0,f=0;f<c;f++)if(u(e,s+f)!==u(t,f)){d=!1;break}if(d)return s}return-1}function g(e,t,n,i){n=Number(n)||0;var r=e.length-n;i?(i=Number(i))>r&&(i=r):i=r;var s=t.length;i>s/2&&(i=s/2);for(var o=0;o<i;++o){var a=parseInt(t.substr(2*o,2),16);if(z(a))return o;e[n+o]=a}return o}funcLine truncated
|
||||
/*!
|
||||
* bytes
|
||||
* Copyright(c) 2012-2014 TJ Holowaychuk
|
||||
* Copyright(c) 2015 Jed Watson
|
||||
* MIT Licensed
|
||||
*/
|
||||
"use strict";t.exports=function(e,t){if("string"==typeof e)return c(e);if("number"==typeof e)return a(e,t);return null},t.exports.format=a,t.exports.parse=c;var i=/\B(?=(\d{3})+(?!\d))/g,r=/(?:\.0*|(\.[^0]+)0+)$/,s={b:1,kb:1024,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},o=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function a(e,t){if(!Number.isFinite(e))return null;var n=Math.abs(e),o=t&&t.thousandsSeparator||"",a=t&&t.unitSeparator||"",c=t&&void 0!==t.decimalPlaces?t.decimalPlaces:2,u=Boolean(t&&t.fixedDecimals),l=t&&t.unit||"";l&&s[l.toLowerCase()]||(l=n>=s.pb?"PB":n>=s.tb?"TB":n>=s.gb?"GB":n>=s.mb?"MB":n>=s.kb?"KB":"B");var d=(e/s[l.toLowerCase()]).toFixed(c);return u||(d=d.replace(r,"$1")),o&&(d=d.replace(i,o)),d+a+l}function c(e){if("number"==typeof e&&!isNaN(e))return e;if("string"!=typeof e)return null;var t,n=o.exec(e),i="b";return n?(t=parseFloat(n[1]),i=n[4].toLowerCase()):(t=parseInt(e,10),i="b"),Math.floor(s[i]*t)}},{}],121:[function(e,t,n){
|
||||
"use strict";t.exports=function(e,t){if("string"==typeof e)return c(e);if("number"==typeof e)return a(e,t);return null},t.exports.format=a,t.exports.parse=c;var i=/\B(?=(\d{3})+(?!\d))/g,r=/(?:\.0*|(\.[^0]+)0+)$/,s={b:1,kb:1024,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},o=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function a(e,t){if(!Number.isFinite(e))return null;var n=Math.abs(e),o=t&&t.thousandsSeparator||"",a=t&&t.unitSeparator||"",c=t&&void 0!==t.decimalPlaces?t.decimalPlaces:2,u=Boolean(t&&t.fixedDecimals),l=t&&t.unit||"";l&&s[l.toLowerCase()]||(l=n>=s.pb?"PB":n>=s.tb?"TB":n>=s.gb?"GB":n>=s.mb?"MB":n>=s.kb?"KB":"B");var d=(e/s[l.toLowerCase()]).toFixed(c);return u||(d=d.replace(r,"$1")),o&&(d=d.replace(i,o)),d+a+l}function c(e){if("number"==typeof e&&!isNaN(e))return e;if("string"!=typeof e)return null;var t,n=o.exec(e),i="b";return n?(t=parseFloat(n[1]),i=n[4].toLowerCase()):(t=parseInt(e,10),i="b"),Math.floor(s[i]*t)}},{}],123:[function(e,t,n){
|
||||
/*! cache-chunk-store. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
const i=e("lru"),r=e("queue-microtask");t.exports=class{constructor(e,t){if(this.store=e,this.chunkLength=e.chunkLength,this.inProgressGets=new Map,!this.store||!this.store.get||!this.store.put)throw new Error("First argument must be abstract-chunk-store compliant");this.cache=new i(t)}put(e,t,n=(()=>{})){if(!this.cache)return r((()=>n(new Error("CacheStore closed"))));this.cache.remove(e),this.store.put(e,t,n)}get(e,t,n=(()=>{})){if("function"==typeof t)return this.get(e,null,t);if(!this.cache)return r((()=>n(new Error("CacheStore closed"))));t||(t={});let i=this.cache.get(e);if(i){const e=t.offset||0,s=t.length||i.length-e;return 0===e&&s===i.length||(i=i.slice(e,s+e)),r((()=>n(null,i)))}let s=this.inProgressGets.get(e);const o=!!s;s||(s=[],this.inProgressGets.set(e,s)),s.push({opts:t,cb:n}),o||this.store.get(e,((t,n)=>{t||null==this.cache||this.cache.set(e,n);const i=this.inProgressGets.get(e);this.inProgressGets.delete(e);for(const{opts:e,cb:r}of i)if(t)r(t);else{const t=e.offset||0,i=e.length||n.length-t;let s=n;0===t&&i===n.length||(s=n.slice(t,i+t)),r(null,s)}}))}close(e=(()=>{})){if(!this.cache)return r((()=>e(new Error("CacheStore closed"))));this.cache=null,this.store.close(e)}destroy(e=(()=>{})){if(!this.cache)return r((()=>e(new Error("CacheStore closed"))));this.cache=null,this.store.destroy(e)}}},{lru:249,"queue-microtask":346}],122:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{dup:30}],123:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{"./_stream_readable":125,"./_stream_writable":127,_process:333,dup:31,inherits:245}],124:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{"./_stream_transform":126,dup:32,inherits:245}],125:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"../errors":122,"./_stream_duplex":123,"./internal/streams/async_iterator":128,"./internal/streams/buffer_list":129,"./internal/streams/destroy":130,"./internal/streams/from":132,"./internal/streams/state":134,"./internal/streams/stream":135,_process:333,buffer:114,dup:33,events:194,inherits:245,"string_decoder/":466,util:71}],126:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{"../errors":122,"./_stream_duplex":123,dup:34,inherits:245}],127:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{"../errors":122,"./_stream_duplex":123,"./internal/streams/destroy":130,"./internal/streams/state":134,"./internal/streams/stream":135,_process:333,buffer:114,dup:35,inherits:245,"util-deprecate":485}],128:[function(e,t,n){arguments[4][36][0].apply(n,arguments)},{"./end-of-stream":131,_process:333,dup:36}],129:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{buffer:114,dup:37,util:71}],130:[function(e,t,n){arguments[4][38][0].apply(n,arguments)},{_process:333,dup:38}],131:[function(e,t,n){arguments[4][39][0].apply(n,arguments)},{"../../../errors":122,dup:39}],132:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{dup:40}],133:[function(e,t,n){arguments[4][41][0].apply(n,arguments)},{"../../../errors":122,"./end-of-stream":131,dup:41}],134:[function(e,t,n){arguments[4][42][0].apply(n,arguments)},{"../../../errors":122,dup:42}],135:[function(e,t,n){arguments[4][43][0].apply(n,arguments)},{dup:43,events:194}],136:[function(e,t,n){arguments[4][44][0].apply(n,arguments)},{"./lib/_stream_duplex.js":123,"./lib/_stream_passthrough.js":124,"./lib/_stream_readable.js":125,"./lib/_stream_transform.js":126,"./lib/_stream_writable.js":127,"./lib/internal/streams/end-of-stream.js":131,"./lib/internal/streams/pipeline.js":133,dup:44}],137:[function(e,t,n){const i=e("block-stream2"),r=e("readable-stream");class s extends r.Writable{constructor(e,t,n={}){if(super(n),!e||!e.put||!e.get)throw new Error("First argument must be an abstract-chunk-store compliant store");if(!(t=Number(t)))throw new Error("Second argument must be a chunk length");const r=void 0!==n.zeroPadding&&n.zeroPadding;this._blockstream=new i(t,{...n,zeroPadding:r}),this._outstandingPuts=0,this._storeMaxOutstandingPuts=n.storeMaxOutstandingPuts||16;let s=0;this._blockstream.on("data",(t=>{this.destroyed||(this._outstandingPuts+=1,this._outstandingPuts>=this._storeMaxOutstandingPuts&&this._blockstream.pause(),e.put(s,t,(e=>{if(e)return this.destroy(e);this._outstandingPuts-=1,this._outstandingPuts<this._storeMaxOutstandingPuts&&this._blockstream.resume(),0===this._outstandingPuts&&"function"==typeof this._finalCb&&(this._finalCb(null),this._finalCb=null)})),s+=1)})).on("error",(e=>{this.destroy(e)}))}_write(e,t,n){this._blockstream.write(e,t,n)}_final(e){this._blockstream.end(),this._blockstream.once("end",(()=>{0===this._outstandingPuts?e(null):this._finalCb=e}))}destroy(e){this.destroyed||(this.destroyed=!0,e&&this.emit("error",e),this.emit("close"))}}t.exports=s},{"block-stream2":53,"readable-stream":136}],138:[function(e,t,n){var i=e("safe-buffer").Buffer,r=e("stream").Transform,s=e("string_decoder").StringDecoder;function o(e){r.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigestLine truncated
|
||||
const i=e("lru"),r=e("queue-microtask");t.exports=class{constructor(e,t){if(this.store=e,this.chunkLength=e.chunkLength,this.inProgressGets=new Map,!this.store||!this.store.get||!this.store.put)throw new Error("First argument must be abstract-chunk-store compliant");this.cache=new i(t)}put(e,t,n=(()=>{})){if(!this.cache)return r((()=>n(new Error("CacheStore closed"))));this.cache.remove(e),this.store.put(e,t,n)}get(e,t,n=(()=>{})){if("function"==typeof t)return this.get(e,null,t);if(!this.cache)return r((()=>n(new Error("CacheStore closed"))));t||(t={});let i=this.cache.get(e);if(i){const e=t.offset||0,s=t.length||i.length-e;return 0===e&&s===i.length||(i=i.slice(e,s+e)),r((()=>n(null,i)))}let s=this.inProgressGets.get(e);const o=!!s;s||(s=[],this.inProgressGets.set(e,s)),s.push({opts:t,cb:n}),o||this.store.get(e,((t,n)=>{t||null==this.cache||this.cache.set(e,n);const i=this.inProgressGets.get(e);this.inProgressGets.delete(e);for(const{opts:e,cb:r}of i)if(t)r(t);else{const t=e.offset||0,i=e.length||n.length-t;let s=n;0===t&&i===n.length||(s=n.slice(t,i+t)),r(null,s)}}))}close(e=(()=>{})){if(!this.cache)return r((()=>e(new Error("CacheStore closed"))));this.cache=null,this.store.close(e)}destroy(e=(()=>{})){if(!this.cache)return r((()=>e(new Error("CacheStore closed"))));this.cache=null,this.store.destroy(e)}}},{lru:258,"queue-microtask":355}],124:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{dup:32}],125:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"./_stream_readable":127,"./_stream_writable":129,_process:342,dup:33,inherits:249}],126:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{"./_stream_transform":128,dup:34,inherits:249}],127:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{"../errors":124,"./_stream_duplex":125,"./internal/streams/async_iterator":130,"./internal/streams/buffer_list":131,"./internal/streams/destroy":132,"./internal/streams/from":134,"./internal/streams/state":136,"./internal/streams/stream":137,_process:342,buffer:116,dup:35,events:196,inherits:249,"string_decoder/":481,util:73}],128:[function(e,t,n){arguments[4][36][0].apply(n,arguments)},{"../errors":124,"./_stream_duplex":125,dup:36,inherits:249}],129:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{"../errors":124,"./_stream_duplex":125,"./internal/streams/destroy":132,"./internal/streams/state":136,"./internal/streams/stream":137,_process:342,buffer:116,dup:37,inherits:249,"util-deprecate":500}],130:[function(e,t,n){arguments[4][38][0].apply(n,arguments)},{"./end-of-stream":133,_process:342,dup:38}],131:[function(e,t,n){arguments[4][39][0].apply(n,arguments)},{buffer:116,dup:39,util:73}],132:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{_process:342,dup:40}],133:[function(e,t,n){arguments[4][41][0].apply(n,arguments)},{"../../../errors":124,dup:41}],134:[function(e,t,n){arguments[4][42][0].apply(n,arguments)},{dup:42}],135:[function(e,t,n){arguments[4][43][0].apply(n,arguments)},{"../../../errors":124,"./end-of-stream":133,dup:43}],136:[function(e,t,n){arguments[4][44][0].apply(n,arguments)},{"../../../errors":124,dup:44}],137:[function(e,t,n){arguments[4][45][0].apply(n,arguments)},{dup:45,events:196}],138:[function(e,t,n){arguments[4][46][0].apply(n,arguments)},{"./lib/_stream_duplex.js":125,"./lib/_stream_passthrough.js":126,"./lib/_stream_readable.js":127,"./lib/_stream_transform.js":128,"./lib/_stream_writable.js":129,"./lib/internal/streams/end-of-stream.js":133,"./lib/internal/streams/pipeline.js":135,dup:46}],139:[function(e,t,n){const i=e("block-stream2"),r=e("readable-stream");class s extends r.Writable{constructor(e,t,n={}){if(super(n),!e||!e.put||!e.get)throw new Error("First argument must be an abstract-chunk-store compliant store");if(!(t=Number(t)))throw new Error("Second argument must be a chunk length");const r=void 0!==n.zeroPadding&&n.zeroPadding;this._blockstream=new i(t,{...n,zeroPadding:r}),this._outstandingPuts=0,this._storeMaxOutstandingPuts=n.storeMaxOutstandingPuts||16;let s=0;this._blockstream.on("data",(t=>{this.destroyed||(this._outstandingPuts+=1,this._outstandingPuts>=this._storeMaxOutstandingPuts&&this._blockstream.pause(),e.put(s,t,(e=>{if(e)return this.destroy(e);this._outstandingPuts-=1,this._outstandingPuts<this._storeMaxOutstandingPuts&&this._blockstream.resume(),0===this._outstandingPuts&&"function"==typeof this._finalCb&&(this._finalCb(null),this._finalCb=null)})),s+=1)})).on("error",(e=>{this.destroy(e)}))}_write(e,t,n){this._blockstream.write(e,t,n)}_final(e){this._blockstream.end(),this._blockstream.once("end",(()=>{0===this._outstandingPuts?e(null):this._finalCb=e}))}destroy(e){this.destroyed||(this.destroyed=!0,e&&this.emit("error",e),this.emit("close"))}}t.exports=s},{"block-stream2":55,"readable-stream":138}],140:[function(e,t,n){var i=e("safe-buffer").Buffer,r=e("stream").Transform,s=e("string_decoder").StringDecoder;function o(e){r.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigestLine truncated
|
||||
/*!
|
||||
* clipboard.js v2.0.8
|
||||
* https://clipboardjs.com/
|
||||
*
|
||||
* Licensed MIT © Zeno Rocha
|
||||
*/
|
||||
var i,r;i=this,r=function(){return function(){var e={134:function(e,t,n){"use strict";n.d(t,{default:function(){return y}});var i=n(279),r=n.n(i),s=n(370),o=n.n(s),a=n(817),c=n.n(a);function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var d=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.resolveOptions(t),this.initSelection()}var t,n,i;return t=e,(n=[{key:"resolveOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action=e.action,this.container=e.container,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"createFakeElement",value:function(){var e="rtl"===document.documentElement.getAttribute("dir");this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px";var t=window.pageYOffset||document.documentElement.scrollTop;return this.fakeElem.style.top="".concat(t,"px"),this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.fakeElem}},{key:"selectFake",value:function(){var e=this,t=this.createFakeElement();this.fakeHandlerCallback=function(){return e.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.container.appendChild(t),this.selectedText=c()(t),this.copyText(),this.removeFake()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=c()(this.target),this.copyText()}},{key:"copyText",value:function(){var e;try{e=document.execCommand(this.action)}catch(t){e=!1}this.handleResult(e)}},{key:"handleResult",value:function(e){this.emitter.emit(e?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),document.activeElement.blur(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=e,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(e){if(void 0!==e){if(!e||"object"!==u(e)||1!==e.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&e.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(e.hasAttribute("readonly")||e.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=e}},get:function(){return this._target}}])&&l(t.prototype,n),i&&l(t,i),e}();function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=g(e);if(t){var r=g(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return b(this,n)}}function b(e,t){return!t||"object"!==f(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){var n="data-clipboard-".concat(e);iLine truncated
|
||||
var i,r;i=this,r=function(){return function(){var e={134:function(e,t,n){"use strict";n.d(t,{default:function(){return y}});var i=n(279),r=n.n(i),s=n(370),o=n.n(s),a=n(817),c=n.n(a);function u(e){return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function l(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var d=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.resolveOptions(t),this.initSelection()}var t,n,i;return t=e,(n=[{key:"resolveOptions",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.action=e.action,this.container=e.container,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""}},{key:"initSelection",value:function(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"createFakeElement",value:function(){var e="rtl"===document.documentElement.getAttribute("dir");this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[e?"right":"left"]="-9999px";var t=window.pageYOffset||document.documentElement.scrollTop;return this.fakeElem.style.top="".concat(t,"px"),this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.fakeElem}},{key:"selectFake",value:function(){var e=this,t=this.createFakeElement();this.fakeHandlerCallback=function(){return e.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.container.appendChild(t),this.selectedText=c()(t),this.copyText(),this.removeFake()}},{key:"removeFake",value:function(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function(){this.selectedText=c()(this.target),this.copyText()}},{key:"copyText",value:function(){var e;try{e=document.execCommand(this.action)}catch(t){e=!1}this.handleResult(e)}},{key:"handleResult",value:function(e){this.emitter.emit(e?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function(){this.trigger&&this.trigger.focus(),document.activeElement.blur(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function(){this.removeFake()}},{key:"action",set:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=e,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function(){return this._action}},{key:"target",set:function(e){if(void 0!==e){if(!e||"object"!==u(e)||1!==e.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&e.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(e.hasAttribute("readonly")||e.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=e}},get:function(){return this._target}}])&&l(t.prototype,n),i&&l(t,i),e}();function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=g(e);if(t){var r=g(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return b(this,n)}}function b(e,t){return!t||"object"!==f(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){var n="data-clipboard-".concat(e);iLine truncated
|
||||
/*! create-torrent. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */
|
||||
const r=e("bencode"),s=e("block-stream2"),o=e("piece-length"),a=e("path"),c=e("filestream/read"),u=e("is-file"),l=e("junk"),d=e("multistream"),f=e("once"),p=e("run-parallel"),h=e("queue-microtask"),m=e("simple-sha1"),b=e("readable-stream"),g=e("./get-files");function v(e){return e.reduce(((e,t)=>Array.isArray(t)?e.concat(v(t)):e.concat(t)),[])}function y(e,t,n){var r;if(r=e,"undefined"!=typeof FileList&&r instanceof FileList&&(e=Array.from(e)),Array.isArray(e)||(e=[e]),0===e.length)throw new Error("invalid input type");e.forEach((e=>{if(null==e)throw new Error(`invalid input type: ${e}`)})),1!==(e=e.map((e=>x(e)&&"string"==typeof e.path&&"function"==typeof g?e.path:e))).length||"string"==typeof e[0]||e[0].name||(e[0].name=t.name);let s=null;e.forEach(((t,n)=>{if("string"==typeof t)return;let i=t.fullPath||t.name;i||(i=`Unknown File ${n+1}`,t.unknownName=!0),t.path=i.split("/"),t.path[0]||t.path.shift(),t.path.length<2?s=null:0===n&&e.length>1?s=t.path[0]:t.path[0]!==s&&(s=null)}));(void 0===t.filterJunkFiles||t.filterJunkFiles)&&(e=e.filter((e=>"string"==typeof e||!_(e.path)))),s&&e.forEach((e=>{const t=(i.isBuffer(e)||k(e))&&!e.path;"string"==typeof e||t||e.path.shift()})),!t.name&&s&&(t.name=s),t.name||e.some((e=>"string"==typeof e?(t.name=a.basename(e),!0):!e.unknownName&&(t.name=e.path[e.path.length-1],!0))),t.name||(t.name=`Unnamed Torrent ${Date.now()}`);const o=e.reduce(((e,t)=>e+Number("string"==typeof t)),0);let l=1===e.length;if(1===e.length&&"string"==typeof e[0]){if("function"!=typeof g)throw new Error("filesystem paths do not work in the browser");u(e[0],((e,t)=>{if(e)return n(e);l=t,d()}))}else h(d);function d(){p(e.map((e=>t=>{const n={};if(x(e))n.getStream=function(e){return()=>new c(e)}(e),n.length=e.size;else if(i.isBuffer(e))n.getStream=(r=e,()=>{const e=new b.PassThrough;return e.end(r),e}),n.length=e.length;else{if(!k(e)){if("string"==typeof e){if("function"!=typeof g)throw new Error("filesystem paths do not work in the browser");return void g(e,o>1||l,t)}throw new Error("invalid input type")}n.getStream=function(e,t){return()=>{const n=new b.Transform;return n._transform=function(e,n,i){t.length+=e.length,this.push(e),i()},e.pipe(n),n}}(e,n),n.length=0}var r;n.path=e.path,t(null,n)})),((e,t)=>{if(e)return n(e);t=v(t),n(null,t,l)}))}}function _(e){const t=e[e.length-1];return"."===t[0]&&l.is(t)}function w(e,t){return e+t.length}function x(e){return"undefined"!=typeof Blob&&e instanceof Blob}function k(e){return"object"==typeof e&&null!=e&&"function"==typeof e.pipe}t.exports=function(e,a,c){"function"==typeof a&&([a,c]=[c,a]),y(e,a=a?Object.assign({},a):{},((e,u,l)=>{if(e)return c(e);a.singleFileTorrent=l,function(e,a,c){let u=a.announceList;u||("string"==typeof a.announce?u=[[a.announce]]:Array.isArray(a.announce)&&(u=a.announce.map((e=>[e]))));u||(u=[]);n.WEBTORRENT_ANNOUNCE&&("string"==typeof n.WEBTORRENT_ANNOUNCE?u.push([[n.WEBTORRENT_ANNOUNCE]]):Array.isArray(n.WEBTORRENT_ANNOUNCE)&&(u=u.concat(n.WEBTORRENT_ANNOUNCE.map((e=>[e])))));void 0===a.announce&&void 0===a.announceList&&(u=u.concat(t.exports.announceList));"string"==typeof a.urlList&&(a.urlList=[a.urlList]);const l={info:{name:a.name},"creation date":Math.ceil((Number(a.creationDate)||Date.now())/1e3),encoding:"UTF-8"};0!==u.length&&(l.announce=u[0][0],l["announce-list"]=u);void 0!==a.comment&&(l.comment=a.comment);void 0!==a.createdBy&&(l["created by"]=a.createdBy);void 0!==a.private&&(l.info.private=Number(a.private));void 0!==a.info&&Object.assign(l.info,a.info);void 0!==a.sslCert&&(l.info["ssl-cert"]=a.sslCert);void 0!==a.urlList&&(l["url-list"]=a.urlList);const p=e.reduce(w,0),h=a.pieceLength||o(p);l.info["piece length"]=h,function(e,t,n,r,o){o=f(o);const a=[];let c=0,u=0;const l=e.map((e=>e.getStream));let p=0,h=0,b=!1;const g=new d(l),v=new s(t,{zeroPadding:!1});function y(e){c+=e.length;const t=h;m(e,(i=>{a[t]=i,p-=1,p<5&&v.resume(),u+=e.length,r.onProgress&&r.onProgress(u,n),k()})),p+=1,p>=5&&v.pause(),h+=1}function _(){b=!0,k()}function w(e){x(),o(e)}function x(){g.removeListener("error",w),v.removeListener("data",y),v.removeListener("end",_),v.removeListener("error",w)}function k(){b&&0===p&&(x(),o(null,i.from(a.join(""),"hex"),c))}g.on("error",w),g.pipe(v).on("data",y).on("end",_).on("error",w)}(e,h,p,a,((t,n,i)=>{if(t)return c(t);l.info.pieces=n,e.forEach((e=>{delete e.getStream})),a.singleFileTorrent?l.info.length=i:l.info.files=e,c(null,r.encode(l))}))}(u,a,c)}))},t.exports.parseInput=function(e,t,n){"function"==typeof t&&([t,n]=[n,t]),y(e,t=t?Object.assign({},t):{},n)},t.exports.announceList=[["udp://tracker.leechers-paradise.org:6969"],["udp://tracker.coppersurfer.tk:6969"],["udp://tracker.opentrackr.org:1337"],["udp://explodie.org:6969"],["udp://tracker.empire-js.us:1337"],["wss://tracker.btorrent.xyz"],["wss://tracker.openwebtorrent.com"]],t.exports.isJunkPath=_}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)Line truncated
|
||||
const i=e("bencode"),r=e("block-stream2"),s=e("piece-length"),o=e("path"),a=e("filestream/read"),c=e("is-file"),u=e("junk"),l=e("multistream"),d=e("once"),f=e("run-parallel"),p=e("queue-microtask"),h=e("simple-sha1"),m=e("readable-stream"),b=e("./get-files");function g(e,t,i){var r;if(r=e,"undefined"!=typeof FileList&&r instanceof FileList&&(e=Array.from(e)),Array.isArray(e)||(e=[e]),0===e.length)throw new Error("invalid input type");e.forEach((e=>{if(null==e)throw new Error(`invalid input type: ${e}`)})),1!==(e=e.map((e=>_(e)&&"string"==typeof e.path&&"function"==typeof b?e.path:e))).length||"string"==typeof e[0]||e[0].name||(e[0].name=t.name);let s=null;e.forEach(((t,n)=>{if("string"==typeof t)return;let i=t.fullPath||t.name;i||(i=`Unknown File ${n+1}`,t.unknownName=!0),t.path=i.split("/"),t.path[0]||t.path.shift(),t.path.length<2?s=null:0===n&&e.length>1?s=t.path[0]:t.path[0]!==s&&(s=null)}));(void 0===t.filterJunkFiles||t.filterJunkFiles)&&(e=e.filter((e=>"string"==typeof e||!v(e.path)))),s&&e.forEach((e=>{const t=(n.isBuffer(e)||w(e))&&!e.path;"string"==typeof e||t||e.path.shift()})),!t.name&&s&&(t.name=s),t.name||e.some((e=>"string"==typeof e?(t.name=o.basename(e),!0):!e.unknownName&&(t.name=e.path[e.path.length-1],!0))),t.name||(t.name=`Unnamed Torrent ${Date.now()}`);const u=e.reduce(((e,t)=>e+Number("string"==typeof t)),0);let l=1===e.length;if(1===e.length&&"string"==typeof e[0]){if("function"!=typeof b)throw new Error("filesystem paths do not work in the browser");c(e[0],((e,t)=>{if(e)return i(e);l=t,d()}))}else p(d);function d(){f(e.map((e=>t=>{const i={};if(_(e))i.getStream=function(e){return()=>new a(e)}(e),i.length=e.size;else if(n.isBuffer(e))i.getStream=(r=e,()=>{const e=new m.PassThrough;return e.end(r),e}),i.length=e.length;else{if(!w(e)){if("string"==typeof e){if("function"!=typeof b)throw new Error("filesystem paths do not work in the browser");return void b(e,u>1||l,t)}throw new Error("invalid input type")}i.getStream=function(e,t){return()=>{const n=new m.Transform;return n._transform=function(e,n,i){t.length+=e.length,this.push(e),i()},e.pipe(n),n}}(e,i),i.length=0}var r;i.path=e.path,t(null,i)})),((e,t)=>{if(e)return i(e);t=t.flat(),i(null,t,l)}))}}function v(e){const t=e[e.length-1];return"."===t[0]&&u.is(t)}function y(e,t){return e+t.length}function _(e){return"undefined"!=typeof Blob&&e instanceof Blob}function w(e){return"object"==typeof e&&null!=e&&"function"==typeof e.pipe}t.exports=function(e,o,a){"function"==typeof o&&([o,a]=[a,o]),g(e,o=o?Object.assign({},o):{},((e,c,u)=>{if(e)return a(e);o.singleFileTorrent=u,function(e,o,a){let c=o.announceList;c||("string"==typeof o.announce?c=[[o.announce]]:Array.isArray(o.announce)&&(c=o.announce.map((e=>[e]))));c||(c=[]);globalThis.WEBTORRENT_ANNOUNCE&&("string"==typeof globalThis.WEBTORRENT_ANNOUNCE?c.push([[globalThis.WEBTORRENT_ANNOUNCE]]):Array.isArray(globalThis.WEBTORRENT_ANNOUNCE)&&(c=c.concat(globalThis.WEBTORRENT_ANNOUNCE.map((e=>[e])))));void 0===o.announce&&void 0===o.announceList&&(c=c.concat(t.exports.announceList));"string"==typeof o.urlList&&(o.urlList=[o.urlList]);const u={info:{name:o.name},"creation date":Math.ceil((Number(o.creationDate)||Date.now())/1e3),encoding:"UTF-8"};0!==c.length&&(u.announce=c[0][0],u["announce-list"]=c);void 0!==o.comment&&(u.comment=o.comment);void 0!==o.createdBy&&(u["created by"]=o.createdBy);void 0!==o.private&&(u.info.private=Number(o.private));void 0!==o.info&&Object.assign(u.info,o.info);void 0!==o.sslCert&&(u.info["ssl-cert"]=o.sslCert);void 0!==o.urlList&&(u["url-list"]=o.urlList);const f=e.reduce(y,0),p=o.pieceLength||s(f);u.info["piece length"]=p,function(e,t,i,s,o){o=d(o);const a=[];let c=0,u=0;const f=e.map((e=>e.getStream));let p=0,m=0,b=!1;const g=new l(f),v=new r(t,{zeroPadding:!1});function y(e){c+=e.length;const t=m;h(e,(n=>{a[t]=n,p-=1,p<5&&v.resume(),u+=e.length,s.onProgress&&s.onProgress(u,i),k()})),p+=1,p>=5&&v.pause(),m+=1}function _(){b=!0,k()}function w(e){x(),o(e)}function x(){g.removeListener("error",w),v.removeListener("data",y),v.removeListener("end",_),v.removeListener("error",w)}function k(){b&&0===p&&(x(),o(null,n.from(a.join(""),"hex"),c))}g.on("error",w),g.pipe(v).on("data",y).on("end",_).on("error",w)}(e,p,f,o,((t,n,r)=>{if(t)return a(t);u.info.pieces=n,e.forEach((e=>{delete e.getStream})),o.singleFileTorrent?u.info.length=r:u.info.files=e,a(null,i.encode(u))}))}(c,o,a)}))},t.exports.parseInput=function(e,t,n){"function"==typeof t&&([t,n]=[n,t]),g(e,t=t?Object.assign({},t):{},n)},t.exports.announceList=[["udp://tracker.leechers-paradise.org:6969"],["udp://tracker.coppersurfer.tk:6969"],["udp://tracker.opentrackr.org:1337"],["udp://explodie.org:6969"],["udp://tracker.empire-js.us:1337"],["wss://tracker.btorrent.xyz"],["wss://tracker.openwebtorrent.com"]],t.exports.isJunkPath=v}).call(this)}).call(this,e("buffer").Buffer)},{"./get-files":73,bencode:23,"block-stream2":55,buffer:116,"filestream/read":215,"is-file":73,junk:253,multistream:310,once:327,path:334,Line truncated
|
||||
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
n.read=function(e,t,n,i,r){var s,o,a=8*r-i-1,c=(1<<a)-1,u=c>>1,l=-7,d=n?r-1:0,f=n?-1:1,p=e[t+d];for(d+=f,s=p&(1<<-l)-1,p>>=-l,l+=a;l>0;s=256*s+e[t+d],d+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=i;l>0;o=256*o+e[t+d],d+=f,l-=8);if(0===s)s=1-u;else{if(s===c)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,i),s-=u}return(p?-1:1)*o*Math.pow(2,s-i)},n.write=function(e,t,n,i,r,s){var o,a,c,u=8*s-r-1,l=(1<<u)-1,d=l>>1,f=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:s-1,h=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(o++,c/=2),o+d>=l?(a=0,o=l):o+d>=1?(a=(t*c-1)*Math.pow(2,r),o+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,r),o=0));r>=8;e[n+p]=255&a,p+=h,a/=256,r-=8);for(o=o<<r|a,u+=r;u>0;e[n+p]=255&o,p+=h,o/=256,u-=8);e[n+p-h]|=128*m}},{}],244:[function(e,t,n){
|
||||
n.read=function(e,t,n,i,r){var s,o,a=8*r-i-1,c=(1<<a)-1,u=c>>1,l=-7,d=n?r-1:0,f=n?-1:1,p=e[t+d];for(d+=f,s=p&(1<<-l)-1,p>>=-l,l+=a;l>0;s=256*s+e[t+d],d+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=i;l>0;o=256*o+e[t+d],d+=f,l-=8);if(0===s)s=1-u;else{if(s===c)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,i),s-=u}return(p?-1:1)*o*Math.pow(2,s-i)},n.write=function(e,t,n,i,r,s){var o,a,c,u=8*s-r-1,l=(1<<u)-1,d=l>>1,f=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:s-1,h=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(o++,c/=2),o+d>=l?(a=0,o=l):o+d>=1?(a=(t*c-1)*Math.pow(2,r),o+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,r),o=0));r>=8;e[n+p]=255&a,p+=h,a/=256,r-=8);for(o=o<<r|a,u+=r;u>0;e[n+p]=255&o,p+=h,o/=256,u-=8);e[n+p-h]|=128*m}},{}],248:[function(e,t,n){
|
||||
/*! immediate-chunk-store. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
const i=e("queue-microtask");t.exports=class{constructor(e){if(this.store=e,this.chunkLength=e.chunkLength,!this.store||!this.store.get||!this.store.put)throw new Error("First argument must be abstract-chunk-store compliant");this.mem=[]}put(e,t,n=(()=>{})){this.mem[e]=t,this.store.put(e,t,(t=>{this.mem[e]=null,n(t)}))}get(e,t,n=(()=>{})){if("function"==typeof t)return this.get(e,null,t);let r=this.mem[e];if(!r)return this.store.get(e,t,n);t||(t={});const s=t.offset||0,o=t.length||r.length-s;0===s&&o===r.length||(r=r.slice(s,o+s)),i((()=>n(null,r)))}close(e=(()=>{})){this.store.close(e)}destroy(e=(()=>{})){this.store.destroy(e)}}},{"queue-microtask":346}],245:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},{}],246:[function(e,t,n){t.exports=function(e){for(var t=0,n=e.length;t<n;++t)if(e.charCodeAt(t)>127)return!1;return!0}},{}],247:[function(e,t,n){t.exports=s,s.strict=o,s.loose=a;var i=Object.prototype.toString,r={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function s(e){return o(e)||a(e)}function o(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function a(e){return r[i.call(e)]}},{}],248:[function(e,t,n){"use strict";n.re=()=>{throw new Error("`junk.re` was renamed to `junk.regex`")},n.regex=new RegExp(["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^Desktop\\.ini$","@eaDir$"].join("|")),n.is=e=>n.regex.test(e),n.not=e=>!n.is(e),n.default=t.exports},{}],249:[function(e,t,n){var i=e("events"),r=e("inherits");function s(e){if(!(this instanceof s))return new s(e);"number"==typeof e&&(e={max:e}),e||(e={}),i.EventEmitter.call(this),this.cache={},this.head=this.tail=null,this.length=0,this.max=e.max||1e3,this.maxAge=e.maxAge||0}t.exports=s,r(s,i.EventEmitter),Object.defineProperty(s.prototype,"keys",{get:function(){return Object.keys(this.cache)}}),s.prototype.clear=function(){this.cache={},this.head=this.tail=null,this.length=0},s.prototype.remove=function(e){if("string"!=typeof e&&(e=""+e),this.cache.hasOwnProperty(e)){var t=this.cache[e];return delete this.cache[e],this._unlink(e,t.prev,t.next),t.value}},s.prototype._unlink=function(e,t,n){this.length--,0===this.length?this.head=this.tail=null:this.head===e?(this.head=t,this.cache[this.head].next=null):this.tail===e?(this.tail=n,this.cache[this.tail].prev=null):(this.cache[t].next=n,this.cache[n].prev=t)},s.prototype.peek=function(e){if(this.cache.hasOwnProperty(e)){var t=this.cache[e];if(this._checkAge(e,t))return t.value}},s.prototype.set=function(e,t){var n;if("string"!=typeof e&&(e=""+e),this.cache.hasOwnProperty(e)){if((n=this.cache[e]).value=t,this.maxAge&&(n.modified=Date.now()),e===this.head)return t;this._unlink(e,n.prev,n.next)}else n={value:t,modified:0,next:null,prev:null},this.maxAge&&(n.modified=Date.now()),this.cache[e]=n,this.length===this.max&&this.evict();return this.length++,n.next=null,n.prev=this.head,this.head&&(this.cache[this.head].next=e),this.head=e,this.tail||(this.tail=e),t},s.prototype._checkAge=function(e,t){return!(this.maxAge&&Date.now()-t.modified>this.maxAge)||(this.remove(e),this.emit("evict",{key:e,value:t.value}),!1)},s.prototype.get=function(e){if("string"!=typeof e&&(e=""+e),this.cache.hasOwnProperty(e)){var t=this.cache[e];if(this._checkAge(e,t))return this.head!==e&&(e===this.tail?(this.tail=t.next,this.cache[this.tail].prev=null):this.cache[t.prev].next=t.next,this.cache[t.next].prev=t.prev,this.cache[this.head].next=e,t.prev=this.head,t.next=null,this.head=e),t.value}},s.prototype.evict=function(){if(this.tail){var e=this.tail,t=this.remove(this.tail);this.emit("evict",{key:e,value:t})}}},{events:194,inherits:245}],250:[function(e,t,n){(function(n){(function(){
|
||||
const i=e("queue-microtask");t.exports=class{constructor(e){if(this.store=e,this.chunkLength=e.chunkLength,!this.store||!this.store.get||!this.store.put)throw new Error("First argument must be abstract-chunk-store compliant");this.mem=[]}put(e,t,n=(()=>{})){this.mem[e]=t,this.store.put(e,t,(t=>{this.mem[e]=null,n(t)}))}get(e,t,n=(()=>{})){if("function"==typeof t)return this.get(e,null,t);let r=this.mem[e];if(!r)return this.store.get(e,t,n);t||(t={});const s=t.offset||0,o=t.length||r.length-s;0===s&&o===r.length||(r=r.slice(s,o+s)),i((()=>n(null,r)))}close(e=(()=>{})){this.store.close(e)}destroy(e=(()=>{})){this.store.destroy(e)}}},{"queue-microtask":355}],249:[function(e,t,n){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},{}],250:[function(e,t,n){t.exports=function(e){for(var t=0,n=e.length;t<n;++t)if(e.charCodeAt(t)>127)return!1;return!0}},{}],251:[function(e,t,n){function i(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}
|
||||
/*!
|
||||
* Determine if an object is a Buffer
|
||||
*
|
||||
* @author Feross Aboukhadijeh <https://feross.org>
|
||||
* @license MIT
|
||||
*/
|
||||
t.exports=function(e){return null!=e&&(i(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&i(e.slice(0,0))}(e)||!!e._isBuffer)}},{}],252:[function(e,t,n){t.exports=s,s.strict=o,s.loose=a;var i=Object.prototype.toString,r={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function s(e){return o(e)||a(e)}function o(e){return e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array}function a(e){return r[i.call(e)]}},{}],253:[function(e,t,n){"use strict";n.re=()=>{throw new Error("`junk.re` was renamed to `junk.regex`")},n.regex=new RegExp(["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^Desktop\\.ini$","@eaDir$"].join("|")),n.is=e=>n.regex.test(e),n.not=e=>!n.is(e),n.default=t.exports},{}],254:[function(e,t,n){n.RateLimiter=e("./lib/rateLimiter"),n.TokenBucket=e("./lib/tokenBucket")},{"./lib/rateLimiter":256,"./lib/tokenBucket":257}],255:[function(e,t,n){(function(e){(function(){t.exports=function(){if(void 0!==e&&e.hrtime){var t=e.hrtime(),n=t[0],i=t[1];return 1e3*n+Math.floor(i/1e6)}return(new Date).getTime()}}).call(this)}).call(this,e("_process"))},{_process:342}],256:[function(e,t,n){(function(n){(function(){var i=e("./tokenBucket"),r=e("./clock"),s=function(e,t,n){this.tokenBucket=new i(e,e,t,null),this.tokenBucket.content=e,this.curIntervalStart=r(),this.tokensThisInterval=0,this.fireImmediately=n};s.prototype={tokenBucket:null,curIntervalStart:0,tokensThisInterval:0,fireImmediately:!1,removeTokens:function(e,t){if(e>this.tokenBucket.bucketSize)return n.nextTick(t.bind(null,"Requested tokens "+e+" exceeds maximum tokens per interval "+this.tokenBucket.bucketSize,null)),!1;var i=this,s=r();if((s<this.curIntervalStart||s-this.curIntervalStart>=this.tokenBucket.interval)&&(this.curIntervalStart=s,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval){if(this.fireImmediately)n.nextTick(t.bind(null,null,-1));else{var o=Math.ceil(this.curIntervalStart+this.tokenBucket.interval-s);setTimeout((function(){i.tokenBucket.removeTokens(e,a)}),o)}return!1}return this.tokenBucket.removeTokens(e,a);function a(n,r){if(n)return t(n,null);i.tokensThisInterval+=e,t(null,r)}},tryRemoveTokens:function(e){if(e>this.tokenBucket.bucketSize)return!1;var t=r();if((t<this.curIntervalStart||t-this.curIntervalStart>=this.tokenBucket.interval)&&(this.curIntervalStart=t,this.tokensThisInterval=0),e>this.tokenBucket.tokensPerInterval-this.tokensThisInterval)return!1;var n=this.tokenBucket.tryRemoveTokens(e);return n&&(this.tokensThisInterval+=e),n},getTokensRemaining:function(){return this.tokenBucket.drip(),this.tokenBucket.content}},t.exports=s}).call(this)}).call(this,e("_process"))},{"./clock":255,"./tokenBucket":257,_process:342}],257:[function(e,t,n){(function(e){(function(){var n=function(e,t,n,i){if(this.bucketSize=e,this.tokensPerInterval=t,"string"==typeof n)switch(n){case"sec":case"second":this.interval=1e3;break;case"min":case"minute":this.interval=6e4;break;case"hr":case"hour":this.interval=36e5;break;case"day":this.interval=864e5;break;default:throw new Error("Invaid interval "+n)}else this.interval=n;this.parentBucket=i,this.content=0,this.lastDrip=+new Date};n.prototype={bucketSize:1,tokensPerInterval:1,interval:1e3,parentBucket:null,content:0,lastDrip:0,removeTokens:function(t,n){var i=this;return this.bucketSize?t>this.bucketSize?(e.nextTick(n.bind(null,"Requested tokens "+t+" exceeds bucket size "+this.bucketSize,null)),!1):(this.drip(),t>this.content?r():this.parentBucket?this.parentBucket.removeTokens(t,(function(e,s){return e?n(e,null):t>i.content?r():(i.content-=t,void n(null,Math.min(s,i.content)))})):(this.content-=t,e.nextTick(n.bind(null,null,this.content)),!0)):(e.nextTick(n.bind(null,null,t,Number.POSITIVE_INFINITY)),!0);function r(){var e=Math.ceil((t-i.content)*(i.interval/i.tokensPerInterval));return setTimeout((function(){i.removeTokens(t,n)}),e),!1}},tryRemoveTokens:function(e){return!this.bucketSize||!(e>this.bucketSize)&&(this.drip(),!(e>this.content)&&(!(this.parentBucket&&!this.parentBucket.tryRemoveTokens(e))&&(this.content-=e,!0)))},drip:function(){if(this.tokensPerInterval){var e=+new Date,t=Math.max(e-this.lastDrip,0);this.lastDrip=e;var n=t*(this.tokensPerInterval/this.interval);this.content=Math.min(this.content+n,this.bucketSize)}else this.content=this.bucketSize}},t.exports=n}).call(this)}).call(this,e("_process"))},{_process:342}],258:[function(e,t,n){var i=e("events"),r=e("inherits");function s(e){if(!(Line truncated
|
||||
/*! lt_donthave. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */
|
||||
const i=e("unordered-array-remove"),{EventEmitter:r}=e("events"),s=e("debug")("lt_donthave");t.exports=()=>{class e extends r{constructor(e){super(),this._peerSupports=!1,this._wire=e}onExtendedHandshake(){this._peerSupports=!0}onMessage(e){let t;try{t=e.readUInt32BE()}catch(e){return}this._wire.peerPieces.get(t)&&(s("got donthave %d",t),this._wire.peerPieces.set(t,!1),this.emit("donthave",t),this._failRequests(t))}donthave(e){if(!this._peerSupports)return;s("donthave %d",e);const t=n.alloc(4);t.writeUInt32BE(e),this._wire.extended("lt_donthave",t)}_failRequests(e){const t=this._wire.requests;for(let n=0;n<t.length;n++){const r=t[n];r.piece===e&&(i(t,n),n-=1,this._wire._callback(r,new Error("peer sent donthave"),null))}}}return e.prototype.name="lt_donthave",e}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:114,debug:251,events:194,"unordered-array-remove":478}],251:[function(e,t,n){arguments[4][27][0].apply(n,arguments)},{"./common":252,_process:333,dup:27}],252:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{dup:28,ms:253}],253:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{dup:29}],254:[function(e,t,n){(function(n){(function(){
|
||||
const i=e("unordered-array-remove"),{EventEmitter:r}=e("events"),s=e("debug")("lt_donthave");t.exports=()=>{class e extends r{constructor(e){super(),this._peerSupports=!1,this._wire=e}onExtendedHandshake(){this._peerSupports=!0}onMessage(e){let t;try{t=e.readUInt32BE()}catch(e){return}this._wire.peerPieces.get(t)&&(s("got donthave %d",t),this._wire.peerPieces.set(t,!1),this.emit("donthave",t),this._failRequests(t))}donthave(e){if(!this._peerSupports)return;s("donthave %d",e);const t=n.alloc(4);t.writeUInt32BE(e),this._wire.extended("lt_donthave",t)}_failRequests(e){const t=this._wire.requests;for(let n=0;n<t.length;n++){const r=t[n];r.piece===e&&(i(t,n),n-=1,this._wire._callback(r,new Error("peer sent donthave"),null))}}}return e.prototype.name="lt_donthave",e}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:116,debug:260,events:196,"unordered-array-remove":493}],260:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{"./common":261,_process:342,dup:29}],261:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{dup:30,ms:262}],262:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],263:[function(e,t,n){(function(n){(function(){
|
||||
/*! magnet-uri. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */
|
||||
t.exports=s,t.exports.decode=s,t.exports.encode=function(e){e=Object.assign({},e);let t=new Set;e.xt&&"string"==typeof e.xt&&t.add(e.xt);e.xt&&Array.isArray(e.xt)&&(t=new Set(e.xt));e.infoHashBuffer&&t.add(`urn:btih:${e.infoHashBuffer.toString("hex")}`);e.infoHash&&t.add(`urn:btih:${e.infoHash}`);e.infoHashV2Buffer&&t.add(e.xt=`urn:btmh:1220${e.infoHashV2Buffer.toString("hex")}`);e.infoHashV2&&t.add(`urn:btmh:1220${e.infoHashV2}`);const n=Array.from(t);1===n.length&&(e.xt=n[0]);n.length>1&&(e.xt=n);e.publicKeyBuffer&&(e.xs=`urn:btpk:${e.publicKeyBuffer.toString("hex")}`);e.publicKey&&(e.xs=`urn:btpk:${e.publicKey}`);e.name&&(e.dn=e.name);e.keywords&&(e.kt=e.keywords);e.announce&&(e.tr=e.announce);e.urlList&&(e.ws=e.urlList,delete e.as);e.peerAddresses&&(e["x.pe"]=e.peerAddresses);let i="magnet:?";return Object.keys(e).filter((e=>2===e.length||"x.pe"===e)).forEach(((t,n)=>{const s=Array.isArray(e[t])?e[t]:[e[t]];s.forEach(((e,r)=>{(n>0||r>0)&&("kt"!==t&&"so"!==t||0===r)&&(i+="&"),"dn"===t&&(e=encodeURIComponent(e).replace(/%20/g,"+")),"tr"!==t&&"as"!==t&&"ws"!==t||(e=encodeURIComponent(e)),"xs"!==t||e.startsWith("urn:btpk:")||(e=encodeURIComponent(e)),"kt"===t&&(e=encodeURIComponent(e)),"so"!==t&&(i+="kt"===t&&r>0?`+${e}`:`${t}=${e}`)})),"so"===t&&(i+=`${t}=${r.compose(s)}`)})),i};const i=e("thirty-two"),r=e("bep53-range");function s(e){const t={},s=e.split("magnet:?")[1];let o;if((s&&s.length>=0?s.split("&"):[]).forEach((e=>{const n=e.split("=");if(2!==n.length)return;const i=n[0];let s=n[1];"dn"===i&&(s=decodeURIComponent(s).replace(/\+/g," ")),"tr"!==i&&"xs"!==i&&"as"!==i&&"ws"!==i||(s=decodeURIComponent(s)),"kt"===i&&(s=decodeURIComponent(s).split("+")),"ix"===i&&(s=Number(s)),"so"===i&&(s=r.parse(decodeURIComponent(s).split(","))),t[i]?(Array.isArray(t[i])||(t[i]=[t[i]]),t[i].push(s)):t[i]=s})),t.xt){(Array.isArray(t.xt)?t.xt:[t.xt]).forEach((e=>{if(o=e.match(/^urn:btih:(.{40})/))t.infoHash=o[1].toLowerCase();else if(o=e.match(/^urn:btih:(.{32})/)){const e=i.decode(o[1]);t.infoHash=n.from(e,"binary").toString("hex")}else(o=e.match(/^urn:btmh:1220(.{64})/))&&(t.infoHashV2=o[1].toLowerCase())}))}if(t.xs){(Array.isArray(t.xs)?t.xs:[t.xs]).forEach((e=>{(o=e.match(/^urn:btpk:(.{64})/))&&(t.publicKey=o[1].toLowerCase())}))}return t.infoHash&&(t.infoHashBuffer=n.from(t.infoHash,"hex")),t.infoHashV2&&(t.infoHashV2Buffer=n.from(t.infoHashV2,"hex")),t.publicKey&&(t.publicKeyBuffer=n.from(t.publicKey,"hex")),t.dn&&(t.name=t.dn),t.kt&&(t.keywords=t.kt),t.announce=[],("string"==typeof t.tr||Array.isArray(t.tr))&&(t.announce=t.announce.concat(t.tr)),t.urlList=[],("string"==typeof t.as||Array.isArray(t.as))&&(t.urlList=t.urlList.concat(t.as)),("string"==typeof t.ws||Array.isArray(t.ws))&&(t.urlList=t.urlList.concat(t.ws)),t.peerAddresses=[],("string"==typeof t["x.pe"]||Array.isArray(t["x.pe"]))&&(t.peerAddresses=t.peerAddresses.concat(t["x.pe"])),t.announce=Array.from(new Set(t.announce)),t.urlList=Array.from(new Set(t.urlList)),t.peerAddresses=Array.from(new Set(t.peerAddresses)),t}}).call(this)}).call(this,e("buffer").Buffer)},{"bep53-range":23,buffer:114,"thirty-two":467}],255:[function(e,t,n){"use strict";var i=e("inherits"),r=e("hash-base"),s=e("safe-buffer").Buffer,o=new Array(16);function a(){r.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function c(e,t){return e<<t|e>>>32-t}function u(e,t,n,i,r,s,o){return c(e+(t&n|~t&i)+r+s|0,o)+t|0}function l(e,t,n,i,r,s,o){return c(e+(t&i|n&~i)+r+s|0,o)+t|0}function d(e,t,n,i,r,s,o){return c(e+(t^n^i)+r+s|0,o)+t|0}function f(e,t,n,i,r,s,o){return c(e+(n^(t|~i))+r+s|0,o)+t|0}i(a,r),a.prototype._update=function(){for(var e=o,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,i=this._b,r=this._c,s=this._d;n=u(n,i,r,s,e[0],3614090360,7),s=u(s,n,i,r,e[1],3905402710,12),r=u(r,s,n,i,e[2],606105819,17),i=u(i,r,s,n,e[3],3250441966,22),n=u(n,i,r,s,e[4],4118548399,7),s=u(s,n,i,r,e[5],1200080426,12),r=u(r,s,n,i,e[6],2821735955,17),i=u(i,r,s,n,e[7],4249261313,22),n=u(n,i,r,s,e[8],1770035416,7),s=u(s,n,i,r,e[9],2336552879,12),r=u(r,s,n,i,e[10],4294925233,17),i=u(i,r,s,n,e[11],2304563134,22),n=u(n,i,r,s,e[12],1804603682,7),s=u(s,n,i,r,e[13],4254626195,12),r=u(r,s,n,i,e[14],2792965006,17),n=l(n,i=u(i,r,s,n,e[15],1236535329,22),r,s,e[1],4129170786,5),s=l(s,n,i,r,e[6],3225465664,9),r=l(r,s,n,i,e[11],643717713,14),i=l(i,r,s,n,e[0],3921069994,20),n=l(n,i,r,s,e[5],3593408605,5),s=l(s,n,i,r,e[10],38016083,9),r=l(r,s,n,i,e[15],3634488961,14),i=l(i,r,s,n,e[4],3889429448,20),n=l(n,i,r,s,e[9],568446438,5),s=l(s,n,i,r,e[14],3275163606,9),r=l(r,s,n,i,e[3],4107603335,14),i=l(i,r,s,n,e[8],1163531501,20),n=l(n,i,r,s,e[13],2850285829,5),s=l(s,n,i,r,e[2],4243563512,9),r=l(r,s,n,i,e[7],1735328473,14),n=d(n,i=l(i,r,s,n,e[12],2368359562,20),r,s,e[5],4294588738,4),s=d(s,n,i,r,e[8],2272392833,11),r=d(r,s,n,i,e[11],1839030562,16),i=d(i,r,s,n,e[14],4259657740,23),n=d(n,i,r,s,e[1],2763975236,4),s=d(s,n,i,r,e[4],1272893353,11),r=d(r,s,n,i,e[7],4139469664,16),i=Line truncated
|
||||
t.exports=s,t.exports.decode=s,t.exports.encode=function(e){e=Object.assign({},e);let t=new Set;e.xt&&"string"==typeof e.xt&&t.add(e.xt);e.xt&&Array.isArray(e.xt)&&(t=new Set(e.xt));e.infoHashBuffer&&t.add(`urn:btih:${e.infoHashBuffer.toString("hex")}`);e.infoHash&&t.add(`urn:btih:${e.infoHash}`);e.infoHashV2Buffer&&t.add(e.xt=`urn:btmh:1220${e.infoHashV2Buffer.toString("hex")}`);e.infoHashV2&&t.add(`urn:btmh:1220${e.infoHashV2}`);const n=Array.from(t);1===n.length&&(e.xt=n[0]);n.length>1&&(e.xt=n);e.publicKeyBuffer&&(e.xs=`urn:btpk:${e.publicKeyBuffer.toString("hex")}`);e.publicKey&&(e.xs=`urn:btpk:${e.publicKey}`);e.name&&(e.dn=e.name);e.keywords&&(e.kt=e.keywords);e.announce&&(e.tr=e.announce);e.urlList&&(e.ws=e.urlList,delete e.as);e.peerAddresses&&(e["x.pe"]=e.peerAddresses);let i="magnet:?";return Object.keys(e).filter((e=>2===e.length||"x.pe"===e)).forEach(((t,n)=>{const s=Array.isArray(e[t])?e[t]:[e[t]];s.forEach(((e,r)=>{(n>0||r>0)&&("kt"!==t&&"so"!==t||0===r)&&(i+="&"),"dn"===t&&(e=encodeURIComponent(e).replace(/%20/g,"+")),"tr"!==t&&"as"!==t&&"ws"!==t||(e=encodeURIComponent(e)),"xs"!==t||e.startsWith("urn:btpk:")||(e=encodeURIComponent(e)),"kt"===t&&(e=encodeURIComponent(e)),"so"!==t&&(i+="kt"===t&&r>0?`+${e}`:`${t}=${e}`)})),"so"===t&&(i+=`${t}=${r.compose(s)}`)})),i};const i=e("thirty-two"),r=e("bep53-range");function s(e){const t={},s=e.split("magnet:?")[1];let o;if((s&&s.length>=0?s.split("&"):[]).forEach((e=>{const n=e.split("=");if(2!==n.length)return;const i=n[0];let s=n[1];"dn"===i&&(s=decodeURIComponent(s).replace(/\+/g," ")),"tr"!==i&&"xs"!==i&&"as"!==i&&"ws"!==i||(s=decodeURIComponent(s)),"kt"===i&&(s=decodeURIComponent(s).split("+")),"ix"===i&&(s=Number(s)),"so"===i&&(s=r.parse(decodeURIComponent(s).split(","))),t[i]?(Array.isArray(t[i])||(t[i]=[t[i]]),t[i].push(s)):t[i]=s})),t.xt){(Array.isArray(t.xt)?t.xt:[t.xt]).forEach((e=>{if(o=e.match(/^urn:btih:(.{40})/))t.infoHash=o[1].toLowerCase();else if(o=e.match(/^urn:btih:(.{32})/)){const e=i.decode(o[1]);t.infoHash=n.from(e,"binary").toString("hex")}else(o=e.match(/^urn:btmh:1220(.{64})/))&&(t.infoHashV2=o[1].toLowerCase())}))}if(t.xs){(Array.isArray(t.xs)?t.xs:[t.xs]).forEach((e=>{(o=e.match(/^urn:btpk:(.{64})/))&&(t.publicKey=o[1].toLowerCase())}))}return t.infoHash&&(t.infoHashBuffer=n.from(t.infoHash,"hex")),t.infoHashV2&&(t.infoHashV2Buffer=n.from(t.infoHashV2,"hex")),t.publicKey&&(t.publicKeyBuffer=n.from(t.publicKey,"hex")),t.dn&&(t.name=t.dn),t.kt&&(t.keywords=t.kt),t.announce=[],("string"==typeof t.tr||Array.isArray(t.tr))&&(t.announce=t.announce.concat(t.tr)),t.urlList=[],("string"==typeof t.as||Array.isArray(t.as))&&(t.urlList=t.urlList.concat(t.as)),("string"==typeof t.ws||Array.isArray(t.ws))&&(t.urlList=t.urlList.concat(t.ws)),t.peerAddresses=[],("string"==typeof t["x.pe"]||Array.isArray(t["x.pe"]))&&(t.peerAddresses=t.peerAddresses.concat(t["x.pe"])),t.announce=Array.from(new Set(t.announce)),t.urlList=Array.from(new Set(t.urlList)),t.peerAddresses=Array.from(new Set(t.peerAddresses)),t}}).call(this)}).call(this,e("buffer").Buffer)},{"bep53-range":25,buffer:116,"thirty-two":482}],264:[function(e,t,n){"use strict";var i=e("inherits"),r=e("hash-base"),s=e("safe-buffer").Buffer,o=new Array(16);function a(){r.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function c(e,t){return e<<t|e>>>32-t}function u(e,t,n,i,r,s,o){return c(e+(t&n|~t&i)+r+s|0,o)+t|0}function l(e,t,n,i,r,s,o){return c(e+(t&i|n&~i)+r+s|0,o)+t|0}function d(e,t,n,i,r,s,o){return c(e+(t^n^i)+r+s|0,o)+t|0}function f(e,t,n,i,r,s,o){return c(e+(n^(t|~i))+r+s|0,o)+t|0}i(a,r),a.prototype._update=function(){for(var e=o,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var n=this._a,i=this._b,r=this._c,s=this._d;n=u(n,i,r,s,e[0],3614090360,7),s=u(s,n,i,r,e[1],3905402710,12),r=u(r,s,n,i,e[2],606105819,17),i=u(i,r,s,n,e[3],3250441966,22),n=u(n,i,r,s,e[4],4118548399,7),s=u(s,n,i,r,e[5],1200080426,12),r=u(r,s,n,i,e[6],2821735955,17),i=u(i,r,s,n,e[7],4249261313,22),n=u(n,i,r,s,e[8],1770035416,7),s=u(s,n,i,r,e[9],2336552879,12),r=u(r,s,n,i,e[10],4294925233,17),i=u(i,r,s,n,e[11],2304563134,22),n=u(n,i,r,s,e[12],1804603682,7),s=u(s,n,i,r,e[13],4254626195,12),r=u(r,s,n,i,e[14],2792965006,17),n=l(n,i=u(i,r,s,n,e[15],1236535329,22),r,s,e[1],4129170786,5),s=l(s,n,i,r,e[6],3225465664,9),r=l(r,s,n,i,e[11],643717713,14),i=l(i,r,s,n,e[0],3921069994,20),n=l(n,i,r,s,e[5],3593408605,5),s=l(s,n,i,r,e[10],38016083,9),r=l(r,s,n,i,e[15],3634488961,14),i=l(i,r,s,n,e[4],3889429448,20),n=l(n,i,r,s,e[9],568446438,5),s=l(s,n,i,r,e[14],3275163606,9),r=l(r,s,n,i,e[3],4107603335,14),i=l(i,r,s,n,e[8],1163531501,20),n=l(n,i,r,s,e[13],2850285829,5),s=l(s,n,i,r,e[2],4243563512,9),r=l(r,s,n,i,e[7],1735328473,14),n=d(n,i=l(i,r,s,n,e[12],2368359562,20),r,s,e[5],4294588738,4),s=d(s,n,i,r,e[8],2272392833,11),r=d(r,s,n,i,e[11],1839030562,16),i=d(i,r,s,n,e[14],4259657740,23),n=d(n,i,r,s,e[1],2763975236,4),s=d(s,n,i,r,e[4],1272893353,11),r=d(r,s,n,i,e[7],4139469664,16),i=Line truncated
|
||||
/*! mediasource. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
t.exports=a;var i=e("inherits"),r=e("readable-stream"),s=e("to-arraybuffer"),o="undefined"!=typeof window&&window.MediaSource;function a(e,t){var n=this;if(!(n instanceof a))return new a(e,t);if(!o)throw new Error("web browser lacks MediaSource support");t||(t={}),n._debug=t.debug,n._bufferDuration=t.bufferDuration||60,n._elem=e,n._mediaSource=new o,n._streams=[],n.detailedError=null,n._errorHandler=function(){n._elem.removeEventListener("error",n._errorHandler),n._streams.slice().forEach((function(e){e.destroy(n._elem.error)}))},n._elem.addEventListener("error",n._errorHandler),n._elem.src=window.URL.createObjectURL(n._mediaSource)}function c(e,t){var n=this;if(r.Writable.call(n),n._wrapper=e,n._elem=e._elem,n._mediaSource=e._mediaSource,n._allStreams=e._streams,n._allStreams.push(n),n._bufferDuration=e._bufferDuration,n._sourceBuffer=null,n._debugBuffers=[],n._openHandler=function(){n._onSourceOpen()},n._flowHandler=function(){n._flow()},n._errorHandler=function(e){n.destroyed||n.emit("error",e)},"string"==typeof t)n._type=t,"open"===n._mediaSource.readyState?n._createSourceBuffer():n._mediaSource.addEventListener("sourceopen",n._openHandler);else if(null===t._sourceBuffer)t.destroy(),n._type=t._type,n._mediaSource.addEventListener("sourceopen",n._openHandler);else{if(!t._sourceBuffer)throw new Error("The argument to MediaElementWrapper.createWriteStream must be a string or a previous stream returned from that function");t.destroy(),n._type=t._type,n._sourceBuffer=t._sourceBuffer,n._debugBuffers=t._debugBuffers,n._sourceBuffer.addEventListener("updateend",n._flowHandler),n._sourceBuffer.addEventListener("error",n._errorHandler)}n._elem.addEventListener("timeupdate",n._flowHandler),n.on("error",(function(e){n._wrapper.error(e)})),n.on("finish",(function(){if(!n.destroyed&&(n._finished=!0,n._allStreams.every((function(e){return e._finished})))){n._wrapper._dumpDebugData();try{n._mediaSource.endOfStream()}catch(e){}}}))}a.prototype.createWriteStream=function(e){return new c(this,e)},a.prototype.error=function(e){var t=this;t.detailedError||(t.detailedError=e),t._dumpDebugData();try{t._mediaSource.endOfStream("decode")}catch(e){}try{window.URL.revokeObjectURL(t._elem.src)}catch(e){}},a.prototype._dumpDebugData=function(){var e=this;e._debug&&(e._debug=!1,e._streams.forEach((function(e,t){var n,i,r;n=e._debugBuffers,i="mediasource-stream-"+t,(r=document.createElement("a")).href=window.URL.createObjectURL(new window.Blob(n)),r.download=i,r.click()})))},i(c,r.Writable),c.prototype._onSourceOpen=function(){var e=this;e.destroyed||(e._mediaSource.removeEventListener("sourceopen",e._openHandler),e._createSourceBuffer())},c.prototype.destroy=function(e){var t=this;t.destroyed||(t.destroyed=!0,t._allStreams.splice(t._allStreams.indexOf(t),1),t._mediaSource.removeEventListener("sourceopen",t._openHandler),t._elem.removeEventListener("timeupdate",t._flowHandler),t._sourceBuffer&&(t._sourceBuffer.removeEventListener("updateend",t._flowHandler),t._sourceBuffer.removeEventListener("error",t._errorHandler),"open"===t._mediaSource.readyState&&t._sourceBuffer.abort()),e&&t.emit("error",e),t.emit("close"))},c.prototype._createSourceBuffer=function(){var e=this;if(!e.destroyed)if(o.isTypeSupported(e._type)){if(e._sourceBuffer=e._mediaSource.addSourceBuffer(e._type),e._sourceBuffer.addEventListener("updateend",e._flowHandler),e._sourceBuffer.addEventListener("error",e._errorHandler),e._cb){var t=e._cb;e._cb=null,t()}}else e.destroy(new Error("The provided type is not supported"))},c.prototype._write=function(e,t,n){var i=this;if(!i.destroyed)if(i._sourceBuffer){if(i._sourceBuffer.updating)return n(new Error("Cannot append buffer while source buffer updating"));var r=s(e);i._wrapper._debug&&i._debugBuffers.push(r);try{i._sourceBuffer.appendBuffer(r)}catch(e){return void i.destroy(e)}i._cb=n}else i._cb=function(r){if(r)return n(r);i._write(e,t,n)}},c.prototype._flow=function(){var e=this;if(!e.destroyed&&e._sourceBuffer&&!e._sourceBuffer.updating&&!("open"===e._mediaSource.readyState&&e._getBufferDuration()>e._bufferDuration)&&e._cb){var t=e._cb;e._cb=null,t()}};c.prototype._getBufferDuration=function(){for(var e=this._sourceBuffer.buffered,t=this._elem.currentTime,n=-1,i=0;i<e.length;i++){var r=e.start(i),s=e.end(i)+0;if(r>t)break;(n>=0||t<=s)&&(n=s)}var o=n-t;return o<0&&(o=0),o}},{inherits:245,"readable-stream":271,"to-arraybuffer":470}],257:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{dup:30}],258:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{"./_stream_readable":260,"./_stream_writable":262,_process:333,dup:31,inherits:245}],259:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{"./_stream_transform":261,dup:32,inherits:245}],260:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"../errors":257,"./_stream_duplex":258,"./internal/streams/async_iterator":263,"./internal/streams/buffer_list":264,"./internal/streams/destroy":265,"./internal/streams/from":267,"./internal/streams/state":269Line truncated
|
||||
t.exports=a;var i=e("inherits"),r=e("readable-stream"),s=e("to-arraybuffer"),o="undefined"!=typeof window&&window.MediaSource;function a(e,t){var n=this;if(!(n instanceof a))return new a(e,t);if(!o)throw new Error("web browser lacks MediaSource support");t||(t={}),n._debug=t.debug,n._bufferDuration=t.bufferDuration||60,n._elem=e,n._mediaSource=new o,n._streams=[],n.detailedError=null,n._errorHandler=function(){n._elem.removeEventListener("error",n._errorHandler),n._streams.slice().forEach((function(e){e.destroy(n._elem.error)}))},n._elem.addEventListener("error",n._errorHandler),n._elem.src=window.URL.createObjectURL(n._mediaSource)}function c(e,t){var n=this;if(r.Writable.call(n),n._wrapper=e,n._elem=e._elem,n._mediaSource=e._mediaSource,n._allStreams=e._streams,n._allStreams.push(n),n._bufferDuration=e._bufferDuration,n._sourceBuffer=null,n._debugBuffers=[],n._openHandler=function(){n._onSourceOpen()},n._flowHandler=function(){n._flow()},n._errorHandler=function(e){n.destroyed||n.emit("error",e)},"string"==typeof t)n._type=t,"open"===n._mediaSource.readyState?n._createSourceBuffer():n._mediaSource.addEventListener("sourceopen",n._openHandler);else if(null===t._sourceBuffer)t.destroy(),n._type=t._type,n._mediaSource.addEventListener("sourceopen",n._openHandler);else{if(!t._sourceBuffer)throw new Error("The argument to MediaElementWrapper.createWriteStream must be a string or a previous stream returned from that function");t.destroy(),n._type=t._type,n._sourceBuffer=t._sourceBuffer,n._debugBuffers=t._debugBuffers,n._sourceBuffer.addEventListener("updateend",n._flowHandler),n._sourceBuffer.addEventListener("error",n._errorHandler)}n._elem.addEventListener("timeupdate",n._flowHandler),n.on("error",(function(e){n._wrapper.error(e)})),n.on("finish",(function(){if(!n.destroyed&&(n._finished=!0,n._allStreams.every((function(e){return e._finished})))){n._wrapper._dumpDebugData();try{n._mediaSource.endOfStream()}catch(e){}}}))}a.prototype.createWriteStream=function(e){return new c(this,e)},a.prototype.error=function(e){var t=this;t.detailedError||(t.detailedError=e),t._dumpDebugData();try{t._mediaSource.endOfStream("decode")}catch(e){}try{window.URL.revokeObjectURL(t._elem.src)}catch(e){}},a.prototype._dumpDebugData=function(){var e=this;e._debug&&(e._debug=!1,e._streams.forEach((function(e,t){var n,i,r;n=e._debugBuffers,i="mediasource-stream-"+t,(r=document.createElement("a")).href=window.URL.createObjectURL(new window.Blob(n)),r.download=i,r.click()})))},i(c,r.Writable),c.prototype._onSourceOpen=function(){var e=this;e.destroyed||(e._mediaSource.removeEventListener("sourceopen",e._openHandler),e._createSourceBuffer())},c.prototype.destroy=function(e){var t=this;t.destroyed||(t.destroyed=!0,t._allStreams.splice(t._allStreams.indexOf(t),1),t._mediaSource.removeEventListener("sourceopen",t._openHandler),t._elem.removeEventListener("timeupdate",t._flowHandler),t._sourceBuffer&&(t._sourceBuffer.removeEventListener("updateend",t._flowHandler),t._sourceBuffer.removeEventListener("error",t._errorHandler),"open"===t._mediaSource.readyState&&t._sourceBuffer.abort()),e&&t.emit("error",e),t.emit("close"))},c.prototype._createSourceBuffer=function(){var e=this;if(!e.destroyed)if(o.isTypeSupported(e._type)){if(e._sourceBuffer=e._mediaSource.addSourceBuffer(e._type),e._sourceBuffer.addEventListener("updateend",e._flowHandler),e._sourceBuffer.addEventListener("error",e._errorHandler),e._cb){var t=e._cb;e._cb=null,t()}}else e.destroy(new Error("The provided type is not supported"))},c.prototype._write=function(e,t,n){var i=this;if(!i.destroyed)if(i._sourceBuffer){if(i._sourceBuffer.updating)return n(new Error("Cannot append buffer while source buffer updating"));var r=s(e);i._wrapper._debug&&i._debugBuffers.push(r);try{i._sourceBuffer.appendBuffer(r)}catch(e){return void i.destroy(e)}i._cb=n}else i._cb=function(r){if(r)return n(r);i._write(e,t,n)}},c.prototype._flow=function(){var e=this;if(!e.destroyed&&e._sourceBuffer&&!e._sourceBuffer.updating&&!("open"===e._mediaSource.readyState&&e._getBufferDuration()>e._bufferDuration)&&e._cb){var t=e._cb;e._cb=null,t()}};c.prototype._getBufferDuration=function(){for(var e=this._sourceBuffer.buffered,t=this._elem.currentTime,n=-1,i=0;i<e.length;i++){var r=e.start(i),s=e.end(i)+0;if(r>t)break;(n>=0||t<=s)&&(n=s)}var o=n-t;return o<0&&(o=0),o}},{inherits:249,"readable-stream":280,"to-arraybuffer":485}],266:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{dup:32}],267:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"./_stream_readable":269,"./_stream_writable":271,_process:342,dup:33,inherits:249}],268:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{"./_stream_transform":270,dup:34,inherits:249}],269:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{"../errors":266,"./_stream_duplex":267,"./internal/streams/async_iterator":272,"./internal/streams/buffer_list":273,"./internal/streams/destroy":274,"./internal/streams/from":276,"./internal/streams/state":278Line truncated
|
||||
/*!
|
||||
* mime-db
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* MIT Licensed
|
||||
*/
|
||||
t.exports=e("./db.json")},{"./db.json":275}],277:[function(e,t,n){
|
||||
t.exports=e("./db.json")},{"./db.json":284}],286:[function(e,t,n){
|
||||
/*!
|
||||
* mime-types
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
"use strict";var i,r,s,o=e("mime-db"),a=e("path").extname,c=/^\s*([^;\s]*)(?:;|\s|$)/,u=/^text\//i;function l(e){if(!e||"string"!=typeof e)return!1;var t=c.exec(e),n=t&&o[t[1].toLowerCase()];return n&&n.charset?n.charset:!(!t||!u.test(t[1]))&&"UTF-8"}n.charset=l,n.charsets={lookup:l},n.contentType=function(e){if(!e||"string"!=typeof e)return!1;var t=-1===e.indexOf("/")?n.lookup(e):e;if(!t)return!1;if(-1===t.indexOf("charset")){var i=n.charset(t);i&&(t+="; charset="+i.toLowerCase())}return t},n.extension=function(e){if(!e||"string"!=typeof e)return!1;var t=c.exec(e),i=t&&n.extensions[t[1].toLowerCase()];if(!i||!i.length)return!1;return i[0]},n.extensions=Object.create(null),n.lookup=function(e){if(!e||"string"!=typeof e)return!1;var t=a("x."+e).toLowerCase().substr(1);if(!t)return!1;return n.types[t]||!1},n.types=Object.create(null),i=n.extensions,r=n.types,s=["nginx","apache",void 0,"iana"],Object.keys(o).forEach((function(e){var t=o[e],n=t.extensions;if(n&&n.length){i[e]=n;for(var a=0;a<n.length;a++){var c=n[a];if(r[c]){var u=s.indexOf(o[r[c]].source),l=s.indexOf(t.source);if("application/octet-stream"!==r[c]&&(u>l||u===l&&"application/"===r[c].substr(0,12)))continue}r[c]=e}}}))},{"mime-db":276,path:325}],278:[function(e,t,n){function i(e,t){if(!e)throw new Error(t||"Assertion failed")}t.exports=i,i.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)}},{}],279:[function(e,t,n){"use strict";var i=n;function r(e){return 1===e.length?"0"+e:e}function s(e){for(var t="",n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}i.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var i=0;i<e.length;i++)n[i]=0|e[i];return n}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(i=0;i<e.length;i+=2)n.push(parseInt(e[i]+e[i+1],16))}else for(i=0;i<e.length;i++){var r=e.charCodeAt(i),s=r>>8,o=255&r;s?n.push(s,o):n.push(o)}return n},i.zero2=r,i.toHex=s,i.encode=function(e,t){return"hex"===t?s(e):e}},{}],280:[function(e,t,n){(function(t){(function(){var i=e("./index"),r=e("./descriptor"),s=e("uint64be"),o=20828448e5;n.fullBoxes={};function a(e,t,n){for(var i=t;i<n;i++)e[i]=0}function c(e,t,n){t.writeUInt32BE(Math.floor((e.getTime()+o)/1e3),n)}function u(e,t,n){t.writeUIntBE(Math.floor((e.getTime()+o)/1e3),n,6)}function l(e,t,n){t.writeUInt16BE(Math.floor(e)%65536,n),t.writeUInt16BE(Math.floor(256*e*256)%65536,n+2)}function d(e,t,n){e||(e=[0,0,0,0,0,0,0,0,0]);for(var i=0;i<e.length;i++)l(e[i],t,n+4*i)}function f(e){for(var t=new Array(e.length/4),n=0;n<t.length;n++)t[n]=m(e,4*n);return t}function p(e,t){return new Date(1e3*e.readUIntBE(t,6)-o)}function h(e,t){return new Date(1e3*e.readUInt32BE(t)-o)}function m(e,t){return e.readUInt16BE(t)+e.readUInt16BE(t+2)/65536}function b(e,t){return e[t]+e[t+1]/256}function g(e,t,n){var i;for(i=0;i<n&&0!==e[t+i];i++);return e.toString("utf8",t,t+i)}["mvhd","tkhd","mdhd","vmhd","smhd","stsd","esds","stsz","stco","co64","stss","stts","ctts","stsc","dref","elst","hdlr","mehd","trex","mfhd","tfhd","tfdt","trun"].forEach((function(e){n.fullBoxes[e]=!0})),n.ftyp={},n.ftyp.encode=function(e,i,r){i=i?i.slice(r):t.alloc(n.ftyp.encodingLength(e));var s=e.compatibleBrands||[];i.write(e.brand,0,4,"ascii"),i.writeUInt32BE(e.brandVersion,4);for(var o=0;o<s.length;o++)i.write(s[o],8+4*o,4,"ascii");return n.ftyp.encode.bytes=8+4*s.length,i},n.ftyp.decode=function(e,t){for(var n=(e=e.slice(t)).toString("ascii",0,4),i=e.readUInt32BE(4),r=[],s=8;s<e.length;s+=4)r.push(e.toString("ascii",s,s+4));return{brand:n,brandVersion:i,compatibleBrands:r}},n.ftyp.encodingLength=function(e){return 8+4*(e.compatibleBrands||[]).length},n.mvhd={},n.mvhd.encode=function(e,i,r){return i=i?i.slice(r):t.alloc(96),c(e.ctime||new Date,i,0),c(e.mtime||new Date,i,4),i.writeUInt32BE(e.timeScale||0,8),i.writeUInt32BE(e.duration||0,12),l(e.preferredRate||0,i,16),function(e,t,n){t[n]=Math.floor(e)%256,t[n+1]=Math.floor(256*e)%256}(e.preferredVolume||0,i,20),a(i,22,32),d(e.matrix,i,32),i.writeUInt32BE(e.previewTime||0,68),i.writeUInt32BE(e.previewDuration||0,72),i.writeUInt32BE(e.posterTime||0,76),i.writeUInt32BE(e.selectionTime||0,80),i.writeUInt32BE(e.selectionDuration||0,84),i.writeUInt32BE(e.currentTime||0,88),i.writeUInt32BE(e.nextTrackId||0,92),n.mvhd.encode.bytes=96,i},n.mvhd.decode=function(e,t){return{ctime:h(e=e.slice(t),0),mtime:h(e,4),timeScale:e.readUInt32BE(8),duration:e.readUInt32BE(12),preferredRate:m(e,16),preferredVolume:b(e,20),matrix:f(e.slice(32,68)),previewTime:e.readUInt32BE(68),previewDuration:e.readUInt32BE(72),posterTime:e.readUInt32BE(76),selectionTime:e.readUInt32BE(80),selectionDuration:e.readUInt32BE(84),currentTime:e.readUInt32BE(88),nextTrackId:e.readUInt32BE(92)}},n.mvhd.encodingLength=function(e){return 96},n.tkhd={},n.tkhd.encode=function(e,i,r){return i=i?i.slice(r):t.alloc(80),c(e.ctime||new Date,i,0),c(e.mtime||new Date,i,4),i.writeUInt32BE(e.trackId||0,8),a(i,12,16),i.writeUInt32BE(e.duratLine truncated
|
||||
"use strict";var i,r,s,o=e("mime-db"),a=e("path").extname,c=/^\s*([^;\s]*)(?:;|\s|$)/,u=/^text\//i;function l(e){if(!e||"string"!=typeof e)return!1;var t=c.exec(e),n=t&&o[t[1].toLowerCase()];return n&&n.charset?n.charset:!(!t||!u.test(t[1]))&&"UTF-8"}n.charset=l,n.charsets={lookup:l},n.contentType=function(e){if(!e||"string"!=typeof e)return!1;var t=-1===e.indexOf("/")?n.lookup(e):e;if(!t)return!1;if(-1===t.indexOf("charset")){var i=n.charset(t);i&&(t+="; charset="+i.toLowerCase())}return t},n.extension=function(e){if(!e||"string"!=typeof e)return!1;var t=c.exec(e),i=t&&n.extensions[t[1].toLowerCase()];if(!i||!i.length)return!1;return i[0]},n.extensions=Object.create(null),n.lookup=function(e){if(!e||"string"!=typeof e)return!1;var t=a("x."+e).toLowerCase().substr(1);if(!t)return!1;return n.types[t]||!1},n.types=Object.create(null),i=n.extensions,r=n.types,s=["nginx","apache",void 0,"iana"],Object.keys(o).forEach((function(e){var t=o[e],n=t.extensions;if(n&&n.length){i[e]=n;for(var a=0;a<n.length;a++){var c=n[a];if(r[c]){var u=s.indexOf(o[r[c]].source),l=s.indexOf(t.source);if("application/octet-stream"!==r[c]&&(u>l||u===l&&"application/"===r[c].substr(0,12)))continue}r[c]=e}}}))},{"mime-db":285,path:334}],287:[function(e,t,n){function i(e,t){if(!e)throw new Error(t||"Assertion failed")}t.exports=i,i.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)}},{}],288:[function(e,t,n){"use strict";var i=n;function r(e){return 1===e.length?"0"+e:e}function s(e){for(var t="",n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}i.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var i=0;i<e.length;i++)n[i]=0|e[i];return n}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(i=0;i<e.length;i+=2)n.push(parseInt(e[i]+e[i+1],16))}else for(i=0;i<e.length;i++){var r=e.charCodeAt(i),s=r>>8,o=255&r;s?n.push(s,o):n.push(o)}return n},i.zero2=r,i.toHex=s,i.encode=function(e,t){return"hex"===t?s(e):e}},{}],289:[function(e,t,n){(function(t){(function(){var i=e("./index"),r=e("./descriptor"),s=e("uint64be"),o=20828448e5;n.fullBoxes={};function a(e,t,n){for(var i=t;i<n;i++)e[i]=0}function c(e,t,n){t.writeUInt32BE(Math.floor((e.getTime()+o)/1e3),n)}function u(e,t,n){t.writeUIntBE(Math.floor((e.getTime()+o)/1e3),n,6)}function l(e,t,n){t.writeUInt16BE(Math.floor(e)%65536,n),t.writeUInt16BE(Math.floor(256*e*256)%65536,n+2)}function d(e,t,n){e||(e=[0,0,0,0,0,0,0,0,0]);for(var i=0;i<e.length;i++)l(e[i],t,n+4*i)}function f(e){for(var t=new Array(e.length/4),n=0;n<t.length;n++)t[n]=m(e,4*n);return t}function p(e,t){return new Date(1e3*e.readUIntBE(t,6)-o)}function h(e,t){return new Date(1e3*e.readUInt32BE(t)-o)}function m(e,t){return e.readUInt16BE(t)+e.readUInt16BE(t+2)/65536}function b(e,t){return e[t]+e[t+1]/256}function g(e,t,n){var i;for(i=0;i<n&&0!==e[t+i];i++);return e.toString("utf8",t,t+i)}["mvhd","tkhd","mdhd","vmhd","smhd","stsd","esds","stsz","stco","co64","stss","stts","ctts","stsc","dref","elst","hdlr","mehd","trex","mfhd","tfhd","tfdt","trun"].forEach((function(e){n.fullBoxes[e]=!0})),n.ftyp={},n.ftyp.encode=function(e,i,r){i=i?i.slice(r):t.alloc(n.ftyp.encodingLength(e));var s=e.compatibleBrands||[];i.write(e.brand,0,4,"ascii"),i.writeUInt32BE(e.brandVersion,4);for(var o=0;o<s.length;o++)i.write(s[o],8+4*o,4,"ascii");return n.ftyp.encode.bytes=8+4*s.length,i},n.ftyp.decode=function(e,t){for(var n=(e=e.slice(t)).toString("ascii",0,4),i=e.readUInt32BE(4),r=[],s=8;s<e.length;s+=4)r.push(e.toString("ascii",s,s+4));return{brand:n,brandVersion:i,compatibleBrands:r}},n.ftyp.encodingLength=function(e){return 8+4*(e.compatibleBrands||[]).length},n.mvhd={},n.mvhd.encode=function(e,i,r){return i=i?i.slice(r):t.alloc(96),c(e.ctime||new Date,i,0),c(e.mtime||new Date,i,4),i.writeUInt32BE(e.timeScale||0,8),i.writeUInt32BE(e.duration||0,12),l(e.preferredRate||0,i,16),function(e,t,n){t[n]=Math.floor(e)%256,t[n+1]=Math.floor(256*e)%256}(e.preferredVolume||0,i,20),a(i,22,32),d(e.matrix,i,32),i.writeUInt32BE(e.previewTime||0,68),i.writeUInt32BE(e.previewDuration||0,72),i.writeUInt32BE(e.posterTime||0,76),i.writeUInt32BE(e.selectionTime||0,80),i.writeUInt32BE(e.selectionDuration||0,84),i.writeUInt32BE(e.currentTime||0,88),i.writeUInt32BE(e.nextTrackId||0,92),n.mvhd.encode.bytes=96,i},n.mvhd.decode=function(e,t){return{ctime:h(e=e.slice(t),0),mtime:h(e,4),timeScale:e.readUInt32BE(8),duration:e.readUInt32BE(12),preferredRate:m(e,16),preferredVolume:b(e,20),matrix:f(e.slice(32,68)),previewTime:e.readUInt32BE(68),previewDuration:e.readUInt32BE(72),posterTime:e.readUInt32BE(76),selectionTime:e.readUInt32BE(80),selectionDuration:e.readUInt32BE(84),currentTime:e.readUInt32BE(88),nextTrackId:e.readUInt32BE(92)}},n.mvhd.encodingLength=function(e){return 96},n.tkhd={},n.tkhd.encode=function(e,i,r){return i=i?i.slice(r):t.alloc(80),c(e.ctime||new Date,i,0),c(e.mtime||new Date,i,4),i.writeUInt32BE(e.trackId||0,8),a(i,12,16),i.writeUInt32BE(e.duratLine truncated
|
||||
/*! multistream. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
const i=e("readable-stream"),r=e("once");function s(e){return a(e,{objectMode:!0,highWaterMark:16})}function o(e){return a(e)}function a(e,t){if(!e||"function"==typeof e||e._readableState)return e;const n=new i.Readable(t).wrap(e);return e.destroy&&(n.destroy=e.destroy.bind(e)),n}class c extends i.Readable{constructor(e,t){super({...t,autoDestroy:!0}),this._drained=!1,this._forwarding=!1,this._current=null,this._toStreams2=t&&t.objectMode?s:o,"function"==typeof e?this._queue=e:(this._queue=e.map(this._toStreams2),this._queue.forEach((e=>{"function"!=typeof e&&this._attachErrorListener(e)}))),this._next()}_read(){this._drained=!0,this._forward()}_forward(){if(this._forwarding||!this._drained||!this._current)return;let e;for(this._forwarding=!0;this._drained&&null!==(e=this._current.read());)this._drained=this.push(e);this._forwarding=!1}_destroy(e,t){let n=[];if(this._current&&n.push(this._current),"function"!=typeof this._queue&&(n=n.concat(this._queue)),0===n.length)t(e);else{let i=n.length,s=e;n.forEach((n=>{!function(e,t,n){if(!e.destroy||e.destroyed)n(t);else{const i=r((e=>n(e||t)));e.on("error",i).on("close",(()=>i())).destroy(t,i)}}(n,e,(e=>{s=s||e,0==--i&&t(s)}))}))}}_next(){if(this._current=null,"function"==typeof this._queue)this._queue(((e,t)=>{if(e)return this.destroy(e);t=this._toStreams2(t),this._attachErrorListener(t),this._gotNextStream(t)}));else{let e=this._queue.shift();"function"==typeof e&&(e=this._toStreams2(e()),this._attachErrorListener(e)),this._gotNextStream(e)}}_gotNextStream(e){if(!e)return void this.push(null);this._current=e,this._forward();const t=()=>{this._forward()},n=()=>{if(!e._readableState.ended&&!e.destroyed){const e=new Error("ERR_STREAM_PREMATURE_CLOSE");e.code="ERR_STREAM_PREMATURE_CLOSE",this.destroy(e)}},i=()=>{this._current=null,e.removeListener("readable",t),e.removeListener("end",i),e.removeListener("close",n),e.destroy(),this._next()};e.on("readable",t),e.once("end",i),e.once("close",n)}_attachErrorListener(e){if(!e)return;const t=n=>{e.removeListener("error",t),this.destroy(n)};e.once("error",t)}}c.obj=e=>new c(e,{objectMode:!0,highWaterMark:16}),t.exports=c},{once:318,"readable-stream":316}],302:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{dup:30}],303:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{"./_stream_readable":305,"./_stream_writable":307,_process:333,dup:31,inherits:245}],304:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{"./_stream_transform":306,dup:32,inherits:245}],305:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"../errors":302,"./_stream_duplex":303,"./internal/streams/async_iterator":308,"./internal/streams/buffer_list":309,"./internal/streams/destroy":310,"./internal/streams/from":312,"./internal/streams/state":314,"./internal/streams/stream":315,_process:333,buffer:114,dup:33,events:194,inherits:245,"string_decoder/":466,util:71}],306:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{"../errors":302,"./_stream_duplex":303,dup:34,inherits:245}],307:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{"../errors":302,"./_stream_duplex":303,"./internal/streams/destroy":310,"./internal/streams/state":314,"./internal/streams/stream":315,_process:333,buffer:114,dup:35,inherits:245,"util-deprecate":485}],308:[function(e,t,n){arguments[4][36][0].apply(n,arguments)},{"./end-of-stream":311,_process:333,dup:36}],309:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{buffer:114,dup:37,util:71}],310:[function(e,t,n){arguments[4][38][0].apply(n,arguments)},{_process:333,dup:38}],311:[function(e,t,n){arguments[4][39][0].apply(n,arguments)},{"../../../errors":302,dup:39}],312:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{dup:40}],313:[function(e,t,n){arguments[4][41][0].apply(n,arguments)},{"../../../errors":302,"./end-of-stream":311,dup:41}],314:[function(e,t,n){arguments[4][42][0].apply(n,arguments)},{"../../../errors":302,dup:42}],315:[function(e,t,n){arguments[4][43][0].apply(n,arguments)},{dup:43,events:194}],316:[function(e,t,n){arguments[4][44][0].apply(n,arguments)},{"./lib/_stream_duplex.js":303,"./lib/_stream_passthrough.js":304,"./lib/_stream_readable.js":305,"./lib/_stream_transform.js":306,"./lib/_stream_writable.js":307,"./lib/internal/streams/end-of-stream.js":311,"./lib/internal/streams/pipeline.js":313,dup:44}],317:[function(e,t,n){t.exports=function(e,t){var n=null;return e.on(t,(function(e){if(n){var t=n;n=null,t(e)}})),function(e){n=e}}},{}],318:[function(e,t,n){var i=e("wrappy");function r(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function s(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}t.exports=i(r),t.exports.strict=i(s),r.proto=r((function(){Object.defineProperty(Function.prototype,"once",{value:function(){Line truncated
|
||||
const i=e("readable-stream"),r=e("once");function s(e){return a(e,{objectMode:!0,highWaterMark:16})}function o(e){return a(e)}function a(e,t){if(!e||"function"==typeof e||e._readableState)return e;const n=new i.Readable(t).wrap(e);return e.destroy&&(n.destroy=e.destroy.bind(e)),n}class c extends i.Readable{constructor(e,t){super({...t,autoDestroy:!0}),this._drained=!1,this._forwarding=!1,this._current=null,this._toStreams2=t&&t.objectMode?s:o,"function"==typeof e?this._queue=e:(this._queue=e.map(this._toStreams2),this._queue.forEach((e=>{"function"!=typeof e&&this._attachErrorListener(e)}))),this._next()}_read(){this._drained=!0,this._forward()}_forward(){if(this._forwarding||!this._drained||!this._current)return;let e;for(this._forwarding=!0;this._drained&&null!==(e=this._current.read());)this._drained=this.push(e);this._forwarding=!1}_destroy(e,t){let n=[];if(this._current&&n.push(this._current),"function"!=typeof this._queue&&(n=n.concat(this._queue)),0===n.length)t(e);else{let i=n.length,s=e;n.forEach((n=>{!function(e,t,n){if(!e.destroy||e.destroyed)n(t);else{const i=r((e=>n(e||t)));e.on("error",i).on("close",(()=>i())).destroy(t,i)}}(n,e,(e=>{s=s||e,0==--i&&t(s)}))}))}}_next(){if(this._current=null,"function"==typeof this._queue)this._queue(((e,t)=>{if(e)return this.destroy(e);t=this._toStreams2(t),this._attachErrorListener(t),this._gotNextStream(t)}));else{let e=this._queue.shift();"function"==typeof e&&(e=this._toStreams2(e()),this._attachErrorListener(e)),this._gotNextStream(e)}}_gotNextStream(e){if(!e)return void this.push(null);this._current=e,this._forward();const t=()=>{this._forward()},n=()=>{if(!e._readableState.ended&&!e.destroyed){const e=new Error("ERR_STREAM_PREMATURE_CLOSE");e.code="ERR_STREAM_PREMATURE_CLOSE",this.destroy(e)}},i=()=>{this._current=null,e.removeListener("readable",t),e.removeListener("end",i),e.removeListener("close",n),e.destroy(),this._next()};e.on("readable",t),e.once("end",i),e.once("close",n)}_attachErrorListener(e){if(!e)return;const t=n=>{e.removeListener("error",t),this.destroy(n)};e.once("error",t)}}c.obj=e=>new c(e,{objectMode:!0,highWaterMark:16}),t.exports=c},{once:327,"readable-stream":325}],311:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{dup:32}],312:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"./_stream_readable":314,"./_stream_writable":316,_process:342,dup:33,inherits:249}],313:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{"./_stream_transform":315,dup:34,inherits:249}],314:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{"../errors":311,"./_stream_duplex":312,"./internal/streams/async_iterator":317,"./internal/streams/buffer_list":318,"./internal/streams/destroy":319,"./internal/streams/from":321,"./internal/streams/state":323,"./internal/streams/stream":324,_process:342,buffer:116,dup:35,events:196,inherits:249,"string_decoder/":481,util:73}],315:[function(e,t,n){arguments[4][36][0].apply(n,arguments)},{"../errors":311,"./_stream_duplex":312,dup:36,inherits:249}],316:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{"../errors":311,"./_stream_duplex":312,"./internal/streams/destroy":319,"./internal/streams/state":323,"./internal/streams/stream":324,_process:342,buffer:116,dup:37,inherits:249,"util-deprecate":500}],317:[function(e,t,n){arguments[4][38][0].apply(n,arguments)},{"./end-of-stream":320,_process:342,dup:38}],318:[function(e,t,n){arguments[4][39][0].apply(n,arguments)},{buffer:116,dup:39,util:73}],319:[function(e,t,n){arguments[4][40][0].apply(n,arguments)},{_process:342,dup:40}],320:[function(e,t,n){arguments[4][41][0].apply(n,arguments)},{"../../../errors":311,dup:41}],321:[function(e,t,n){arguments[4][42][0].apply(n,arguments)},{dup:42}],322:[function(e,t,n){arguments[4][43][0].apply(n,arguments)},{"../../../errors":311,"./end-of-stream":320,dup:43}],323:[function(e,t,n){arguments[4][44][0].apply(n,arguments)},{"../../../errors":311,dup:44}],324:[function(e,t,n){arguments[4][45][0].apply(n,arguments)},{dup:45,events:196}],325:[function(e,t,n){arguments[4][46][0].apply(n,arguments)},{"./lib/_stream_duplex.js":312,"./lib/_stream_passthrough.js":313,"./lib/_stream_readable.js":314,"./lib/_stream_transform.js":315,"./lib/_stream_writable.js":316,"./lib/internal/streams/end-of-stream.js":320,"./lib/internal/streams/pipeline.js":322,dup:46}],326:[function(e,t,n){t.exports=function(e,t){var n=null;return e.on(t,(function(e){if(n){var t=n;n=null,t(e)}})),function(e){n=e}}},{}],327:[function(e,t,n){var i=e("wrappy");function r(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function s(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}t.exports=i(r),t.exports.strict=i(s),r.proto=r((function(){Object.defineProperty(Function.prototype,"once",{value:function(){Line truncated
|
||||
/*! parse-torrent. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */
|
||||
const i=e("bencode"),r=e("blob-to-buffer"),s=e("fs"),o=e("simple-get"),a=e("magnet-uri"),c=e("path"),u=e("simple-sha1"),l=e("queue-microtask");function d(e){if("string"==typeof e&&/^(stream-)?magnet:/.test(e)){const t=a(e);if(!t.infoHash)throw new Error("Invalid torrent identifier");return t}if("string"==typeof e&&(/^[a-f0-9]{40}$/i.test(e)||/^[a-z2-7]{32}$/i.test(e)))return a(`magnet:?xt=urn:btih:${e}`);if(n.isBuffer(e)&&20===e.length)return a(`magnet:?xt=urn:btih:${e.toString("hex")}`);if(n.isBuffer(e))return function(e){n.isBuffer(e)&&(e=i.decode(e));p(e.info,"info"),p(e.info["name.utf-8"]||e.info.name,"info.name"),p(e.info["piece length"],"info['piece length']"),p(e.info.pieces,"info.pieces"),e.info.files?e.info.files.forEach((e=>{p("number"==typeof e.length,"info.files[0].length"),p(e["path.utf-8"]||e.path,"info.files[0].path")})):p("number"==typeof e.info.length,"info.length");const t={info:e.info,infoBuffer:i.encode(e.info),name:(e.info["name.utf-8"]||e.info.name).toString(),announce:[]};t.infoHash=u.sync(t.infoBuffer),t.infoHashBuffer=n.from(t.infoHash,"hex"),void 0!==e.info.private&&(t.private=!!e.info.private);e["creation date"]&&(t.created=new Date(1e3*e["creation date"]));e["created by"]&&(t.createdBy=e["created by"].toString());n.isBuffer(e.comment)&&(t.comment=e.comment.toString());Array.isArray(e["announce-list"])&&e["announce-list"].length>0?e["announce-list"].forEach((e=>{e.forEach((e=>{t.announce.push(e.toString())}))})):e.announce&&t.announce.push(e.announce.toString());n.isBuffer(e["url-list"])&&(e["url-list"]=e["url-list"].length>0?[e["url-list"]]:[]);t.urlList=(e["url-list"]||[]).map((e=>e.toString())),t.announce=Array.from(new Set(t.announce)),t.urlList=Array.from(new Set(t.urlList));const r=e.info.files||[e.info];t.files=r.map(((e,n)=>{const i=[].concat(t.name,e["path.utf-8"]||e.path||[]).map((e=>e.toString()));return{path:c.join.apply(null,[c.sep].concat(i)).slice(1),name:i[i.length-1],length:e.length,offset:r.slice(0,n).reduce(f,0)}})),t.length=r.reduce(f,0);const s=t.files[t.files.length-1];return t.pieceLength=e.info["piece length"],t.lastPieceLength=(s.offset+s.length)%t.pieceLength||t.pieceLength,t.pieces=function(e){const t=[];for(let n=0;n<e.length;n+=20)t.push(e.slice(n,n+20).toString("hex"));return t}(e.info.pieces),t}(e);if(e&&e.infoHash)return e.infoHash=e.infoHash.toLowerCase(),e.announce||(e.announce=[]),"string"==typeof e.announce&&(e.announce=[e.announce]),e.urlList||(e.urlList=[]),e;throw new Error("Invalid torrent identifier")}function f(e,t){return e+t.length}function p(e,t){if(!e)throw new Error(`Torrent is missing required field: ${t}`)}t.exports=d,t.exports.remote=function e(t,n,i){if("function"==typeof n)return e(t,{},n);if("function"!=typeof i)throw new Error("second argument must be a Function");let a;try{a=d(t)}catch(e){}a&&a.infoHash?l((()=>{i(null,a)})):(c=t,"undefined"!=typeof Blob&&c instanceof Blob?r(t,((e,t)=>{if(e)return i(new Error(`Error converting Blob: ${e.message}`));u(t)})):"function"==typeof o&&/^https?:/.test(t)?(n=Object.assign({url:t,timeout:3e4,headers:{"user-agent":"WebTorrent (https://webtorrent.io)"}},n),o.concat(n,((e,t,n)=>{if(e)return i(new Error(`Error downloading torrent: ${e.message}`));u(n)}))):"function"==typeof s.readFile&&"string"==typeof t?s.readFile(t,((e,t)=>{if(e)return i(new Error("Invalid torrent identifier"));u(t)})):l((()=>{i(new Error("Invalid torrent identifier"))})));var c;function u(e){try{a=d(e)}catch(e){return i(e)}a&&a.infoHash?i(null,a):i(new Error("Invalid torrent identifier"))}},t.exports.toMagnetURI=a.encode,t.exports.toTorrentFile=function(e){const t={info:e.info};t["announce-list"]=(e.announce||[]).map((e=>(t.announce||(t.announce=e),[e=n.from(e,"utf8")]))),t["url-list"]=e.urlList||[],void 0!==e.private&&(t.private=Number(e.private));e.created&&(t["creation date"]=e.created.getTime()/1e3|0);e.createdBy&&(t["created by"]=e.createdBy);e.comment&&(t.comment=e.comment);return i.encode(t)},n.alloc(0)}).call(this)}).call(this,e("buffer").Buffer)},{bencode:22,"blob-to-buffer":52,buffer:114,fs:71,"magnet-uri":254,path:325,"queue-microtask":346,"simple-get":387,"simple-sha1":407}],325:[function(e,t,n){(function(e){(function(){"use strict";function n(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function i(e,t){for(var n,i="",r=0,s=-1,o=0,a=0;a<=e.length;++a){if(a<e.length)n=e.charCodeAt(a);else{if(47===n)break;n=47}if(47===n){if(s===a-1||1===o);else if(s!==a-1&&2===o){if(i.length<2||2!==r||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){var c=i.lastIndexOf("/");if(c!==i.length-1){-1===c?(i="",r=0):r=(i=i.slice(0,c)).length-1-i.lastIndexOf("/"),s=a,o=0;continue}}else if(2===i.length||1===i.length){i="",r=0,s=a,o=0;continue}t&&(i.length>0?i+="/..":i="..",r=2)}else i.length>0?i+="/"+e.slice(s+1,a):i=e.slice(s+1,a),r=a-s-1;s=a,o=0}else 46===n&&-1!==o?++o:o=-1}return i}var r={resolve:function(){for(var t,r="",s=!1,o=arguments.length-1;o>=-1Line truncated
|
||||
const i=e("bencode"),r=e("blob-to-buffer"),s=e("fs"),o=e("simple-get"),a=e("magnet-uri"),c=e("path"),u=e("simple-sha1"),l=e("queue-microtask");function d(e){if("string"==typeof e&&/^(stream-)?magnet:/.test(e)){const t=a(e);if(!t.infoHash)throw new Error("Invalid torrent identifier");return t}if("string"==typeof e&&(/^[a-f0-9]{40}$/i.test(e)||/^[a-z2-7]{32}$/i.test(e)))return a(`magnet:?xt=urn:btih:${e}`);if(n.isBuffer(e)&&20===e.length)return a(`magnet:?xt=urn:btih:${e.toString("hex")}`);if(n.isBuffer(e))return function(e){n.isBuffer(e)&&(e=i.decode(e));p(e.info,"info"),p(e.info["name.utf-8"]||e.info.name,"info.name"),p(e.info["piece length"],"info['piece length']"),p(e.info.pieces,"info.pieces"),e.info.files?e.info.files.forEach((e=>{p("number"==typeof e.length,"info.files[0].length"),p(e["path.utf-8"]||e.path,"info.files[0].path")})):p("number"==typeof e.info.length,"info.length");const t={info:e.info,infoBuffer:i.encode(e.info),name:(e.info["name.utf-8"]||e.info.name).toString(),announce:[]};t.infoHash=u.sync(t.infoBuffer),t.infoHashBuffer=n.from(t.infoHash,"hex"),void 0!==e.info.private&&(t.private=!!e.info.private);e["creation date"]&&(t.created=new Date(1e3*e["creation date"]));e["created by"]&&(t.createdBy=e["created by"].toString());n.isBuffer(e.comment)&&(t.comment=e.comment.toString());Array.isArray(e["announce-list"])&&e["announce-list"].length>0?e["announce-list"].forEach((e=>{e.forEach((e=>{t.announce.push(e.toString())}))})):e.announce&&t.announce.push(e.announce.toString());n.isBuffer(e["url-list"])&&(e["url-list"]=e["url-list"].length>0?[e["url-list"]]:[]);t.urlList=(e["url-list"]||[]).map((e=>e.toString())),t.announce=Array.from(new Set(t.announce)),t.urlList=Array.from(new Set(t.urlList));const r=e.info.files||[e.info];t.files=r.map(((e,n)=>{const i=[].concat(t.name,e["path.utf-8"]||e.path||[]).map((e=>e.toString()));return{path:c.join.apply(null,[c.sep].concat(i)).slice(1),name:i[i.length-1],length:e.length,offset:r.slice(0,n).reduce(f,0)}})),t.length=r.reduce(f,0);const s=t.files[t.files.length-1];return t.pieceLength=e.info["piece length"],t.lastPieceLength=(s.offset+s.length)%t.pieceLength||t.pieceLength,t.pieces=function(e){const t=[];for(let n=0;n<e.length;n+=20)t.push(e.slice(n,n+20).toString("hex"));return t}(e.info.pieces),t}(e);if(e&&e.infoHash)return e.infoHash=e.infoHash.toLowerCase(),e.announce||(e.announce=[]),"string"==typeof e.announce&&(e.announce=[e.announce]),e.urlList||(e.urlList=[]),e;throw new Error("Invalid torrent identifier")}function f(e,t){return e+t.length}function p(e,t){if(!e)throw new Error(`Torrent is missing required field: ${t}`)}t.exports=d,t.exports.remote=function e(t,n,i){if("function"==typeof n)return e(t,{},n);if("function"!=typeof i)throw new Error("second argument must be a Function");let a;try{a=d(t)}catch(e){}a&&a.infoHash?l((()=>{i(null,a)})):(c=t,"undefined"!=typeof Blob&&c instanceof Blob?r(t,((e,t)=>{if(e)return i(new Error(`Error converting Blob: ${e.message}`));u(t)})):"function"==typeof o&&/^https?:/.test(t)?(n=Object.assign({url:t,timeout:3e4,headers:{"user-agent":"WebTorrent (https://webtorrent.io)"}},n),o.concat(n,((e,t,n)=>{if(e)return i(new Error(`Error downloading torrent: ${e.message}`));u(n)}))):"function"==typeof s.readFile&&"string"==typeof t?s.readFile(t,((e,t)=>{if(e)return i(new Error("Invalid torrent identifier"));u(t)})):l((()=>{i(new Error("Invalid torrent identifier"))})));var c;function u(e){try{a=d(e)}catch(e){return i(e)}a&&a.infoHash?i(null,a):i(new Error("Invalid torrent identifier"))}},t.exports.toMagnetURI=a.encode,t.exports.toTorrentFile=function(e){const t={info:e.info};t["announce-list"]=(e.announce||[]).map((e=>(t.announce||(t.announce=e),[e=n.from(e,"utf8")]))),t["url-list"]=e.urlList||[],void 0!==e.private&&(t.private=Number(e.private));e.created&&(t["creation date"]=e.created.getTime()/1e3|0);e.createdBy&&(t["created by"]=e.createdBy);e.comment&&(t.comment=e.comment);return i.encode(t)},n.alloc(0)}).call(this)}).call(this,e("buffer").Buffer)},{bencode:23,"blob-to-buffer":54,buffer:116,fs:73,"magnet-uri":263,path:334,"queue-microtask":355,"simple-get":397,"simple-sha1":417}],334:[function(e,t,n){(function(e){(function(){"use strict";function n(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function i(e,t){for(var n,i="",r=0,s=-1,o=0,a=0;a<=e.length;++a){if(a<e.length)n=e.charCodeAt(a);else{if(47===n)break;n=47}if(47===n){if(s===a-1||1===o);else if(s!==a-1&&2===o){if(i.length<2||2!==r||46!==i.charCodeAt(i.length-1)||46!==i.charCodeAt(i.length-2))if(i.length>2){var c=i.lastIndexOf("/");if(c!==i.length-1){-1===c?(i="",r=0):r=(i=i.slice(0,c)).length-1-i.lastIndexOf("/"),s=a,o=0;continue}}else if(2===i.length||1===i.length){i="",r=0,s=a,o=0;continue}t&&(i.length>0?i+="/..":i="..",r=2)}else i.length>0?i+="/"+e.slice(s+1,a):i=e.slice(s+1,a),r=a-s-1;s=a,o=0}else 46===n&&-1!==o?++o:o=-1}return i}var r={resolve:function(){for(var t,r="",s=!1,o=arguments.length-1;o>=-1Line truncated
|
||||
/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
let n;t.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:e):e=>(n||(n=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],347:[function(e,t,n){t.exports=function(e){var t=0;return function(){if(t===e.length)return null;var n=e.length-t,i=Math.random()*n|0,r=e[t+i],s=e[t];return e[t]=r,e[t+i]=s,t++,r}}},{}],348:[function(e,t,n){(function(n,i){(function(){"use strict";var r=65536,s=4294967295;var o=e("safe-buffer").Buffer,a=i.crypto||i.msCrypto;a&&a.getRandomValues?t.exports=function(e,t){if(e>s)throw new RangeError("requested too many random bytes");var i=o.allocUnsafe(e);if(e>0)if(e>r)for(var c=0;c<e;c+=r)a.getRandomValues(i.slice(c,c+r));else a.getRandomValues(i);if("function"==typeof t)return n.nextTick((function(){t(null,i)}));return i}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:333,"safe-buffer":376}],349:[function(e,t,n){(function(t,i){(function(){"use strict";function r(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var s=e("safe-buffer"),o=e("randombytes"),a=s.Buffer,c=s.kMaxLength,u=i.crypto||i.msCrypto,l=Math.pow(2,32)-1;function d(e,t){if("number"!=typeof e||e!=e)throw new TypeError("offset must be a number");if(e>l||e<0)throw new TypeError("offset must be a uint32");if(e>c||e>t)throw new RangeError("offset out of range")}function f(e,t,n){if("number"!=typeof e||e!=e)throw new TypeError("size must be a number");if(e>l||e<0)throw new TypeError("size must be a uint32");if(e+t>n||e>c)throw new RangeError("buffer too small")}function p(e,n,i,r){if(t.browser){var s=e.buffer,a=new Uint8Array(s,n,i);return u.getRandomValues(a),r?void t.nextTick((function(){r(null,e)})):e}if(!r)return o(i).copy(e,n),e;o(i,(function(t,i){if(t)return r(t);i.copy(e,n),r(null,e)}))}u&&u.getRandomValues||!t.browser?(n.randomFill=function(e,t,n,r){if(!(a.isBuffer(e)||e instanceof i.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof t)r=t,t=0,n=e.length;else if("function"==typeof n)r=n,n=e.length-t;else if("function"!=typeof r)throw new TypeError('"cb" argument must be a function');return d(t,e.length),f(n,t,e.length),p(e,t,n,r)},n.randomFillSync=function(e,t,n){void 0===t&&(t=0);if(!(a.isBuffer(e)||e instanceof i.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');d(t,e.length),void 0===n&&(n=e.length-t);return f(n,t,e.length),p(e,t,n)}):(n.randomFill=r,n.randomFillSync=r)}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:333,randombytes:348,"safe-buffer":376}],350:[function(e,t,n){const{Writable:i,PassThrough:r}=e("readable-stream");t.exports=class extends i{constructor(e,t={}){super(t),this.destroyed=!1,this._queue=[],this._position=e||0,this._cb=null,this._buffer=null,this._out=null}_write(e,t,n){let i=!0;for(;;){if(this.destroyed)return;if(0===this._queue.length)return this._buffer=e,void(this._cb=n);this._buffer=null;var r=this._queue[0];const t=Math.max(r.start-this._position,0),s=r.end-this._position;if(t>=e.length)return this._position+=e.length,n(null);let o;if(s>e.length){this._position+=e.length,o=0===t?e:e.slice(t),i=r.stream.write(o)&&i;break}this._position+=s,o=0===t&&s===e.length?e:e.slice(t,s),i=r.stream.write(o)&&i,r.last&&r.stream.end(),e=e.slice(s),this._queue.shift()}i?n(null):r.stream.once("drain",n.bind(null,null))}slice(e){if(this.destroyed)return null;Array.isArray(e)||(e=[e]);const t=new r;return e.forEach(((n,i)=>{this._queue.push({start:n.start,end:n.end,stream:t,last:i===e.length-1})})),this._buffer&&this._write(this._buffer,null,this._cb),t}destroy(e){this.destroyed||(this.destroyed=!0,e&&this.emit("error",e))}}},{"readable-stream":365}],351:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{dup:30}],352:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{"./_stream_readable":354,"./_stream_writable":356,_process:333,dup:31,inherits:245}],353:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{"./_stream_transform":355,dup:32,inherits:245}],354:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"../errors":351,"./_stream_duplex":352,"./internal/streams/async_iterator":357,"./internal/streams/buffer_list":358,"./internal/streams/destroy":359,"./internal/streams/from":361,"./internal/streams/state":363,"./internal/streams/stream":364,_process:333,buffer:114,dup:33,events:194,inherits:245,"string_decoder/":466,util:71}],355:[function(e,t,n){arguments[4][34][0].apply(nLine truncated
|
||||
let n;t.exports="function"==typeof queueMicrotask?queueMicrotask.bind("undefined"!=typeof window?window:e):e=>(n||(n=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],356:[function(e,t,n){t.exports="function"==typeof queueMicrotask?queueMicrotask:e=>Promise.resolve().then(e)},{}],357:[function(e,t,n){t.exports=function(e){var t=0;return function(){if(t===e.length)return null;var n=e.length-t,i=Math.random()*n|0,r=e[t+i],s=e[t];return e[t]=r,e[t+i]=s,t++,r}}},{}],358:[function(e,t,n){(function(n,i){(function(){"use strict";var r=65536,s=4294967295;var o=e("safe-buffer").Buffer,a=i.crypto||i.msCrypto;a&&a.getRandomValues?t.exports=function(e,t){if(e>s)throw new RangeError("requested too many random bytes");var i=o.allocUnsafe(e);if(e>0)if(e>r)for(var c=0;c<e;c+=r)a.getRandomValues(i.slice(c,c+r));else a.getRandomValues(i);if("function"==typeof t)return n.nextTick((function(){t(null,i)}));return i}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:342,"safe-buffer":386}],359:[function(e,t,n){(function(t,i){(function(){"use strict";function r(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var s=e("safe-buffer"),o=e("randombytes"),a=s.Buffer,c=s.kMaxLength,u=i.crypto||i.msCrypto,l=Math.pow(2,32)-1;function d(e,t){if("number"!=typeof e||e!=e)throw new TypeError("offset must be a number");if(e>l||e<0)throw new TypeError("offset must be a uint32");if(e>c||e>t)throw new RangeError("offset out of range")}function f(e,t,n){if("number"!=typeof e||e!=e)throw new TypeError("size must be a number");if(e>l||e<0)throw new TypeError("size must be a uint32");if(e+t>n||e>c)throw new RangeError("buffer too small")}function p(e,n,i,r){if(t.browser){var s=e.buffer,a=new Uint8Array(s,n,i);return u.getRandomValues(a),r?void t.nextTick((function(){r(null,e)})):e}if(!r)return o(i).copy(e,n),e;o(i,(function(t,i){if(t)return r(t);i.copy(e,n),r(null,e)}))}u&&u.getRandomValues||!t.browser?(n.randomFill=function(e,t,n,r){if(!(a.isBuffer(e)||e instanceof i.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof t)r=t,t=0,n=e.length;else if("function"==typeof n)r=n,n=e.length-t;else if("function"!=typeof r)throw new TypeError('"cb" argument must be a function');return d(t,e.length),f(n,t,e.length),p(e,t,n,r)},n.randomFillSync=function(e,t,n){void 0===t&&(t=0);if(!(a.isBuffer(e)||e instanceof i.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');d(t,e.length),void 0===n&&(n=e.length-t);return f(n,t,e.length),p(e,t,n)}):(n.randomFill=r,n.randomFillSync=r)}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:342,randombytes:358,"safe-buffer":386}],360:[function(e,t,n){const{Writable:i,PassThrough:r}=e("readable-stream");t.exports=class extends i{constructor(e,t={}){super(t),this.destroyed=!1,this._queue=[],this._position=e||0,this._cb=null,this._buffer=null,this._out=null}_write(e,t,n){let i=!0;for(;;){if(this.destroyed)return;if(0===this._queue.length)return this._buffer=e,void(this._cb=n);this._buffer=null;var r=this._queue[0];const t=Math.max(r.start-this._position,0),s=r.end-this._position;if(t>=e.length)return this._position+=e.length,n(null);let o;if(s>e.length){this._position+=e.length,o=0===t?e:e.slice(t),i=r.stream.write(o)&&i;break}this._position+=s,o=0===t&&s===e.length?e:e.slice(t,s),i=r.stream.write(o)&&i,r.last&&r.stream.end(),e=e.slice(s),this._queue.shift()}i?n(null):r.stream.once("drain",n.bind(null,null))}slice(e){if(this.destroyed)return null;Array.isArray(e)||(e=[e]);const t=new r;return e.forEach(((n,i)=>{this._queue.push({start:n.start,end:n.end,stream:t,last:i===e.length-1})})),this._buffer&&this._write(this._buffer,null,this._cb),t}destroy(e){this.destroyed||(this.destroyed=!0,e&&this.emit("error",e))}}},{"readable-stream":375}],361:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{dup:32}],362:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"./_stream_readable":364,"./_stream_writable":366,_process:342,dup:33,inherits:249}],363:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{"./_stream_transform":365,dup:34,inherits:249}],364:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{"../errors":361,"./_stream_duplex":362,"./internal/streams/async_iterator":367,"./internal/streams/buffer_list":368,"./internal/streams/destroy":369,"./internal/streams/from":371,"./internal/streams/state":373,"./internal/streams/stream":374,_process:342,buffer:1Line truncated
|
||||
/*! render-media. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
n.render=function(e,t,n,i){"function"==typeof n&&(i=n,n={});n||(n={});i||(i=()=>{});y(e),_(n),"string"==typeof t&&(t=document.querySelector(t));g(e,(i=>{if(t.nodeName!==i.toUpperCase()){const n=o.extname(e.name).toLowerCase();throw new Error(`Cannot render "${n}" inside a "${t.nodeName.toLowerCase()}" element, expected "${i}"`)}return"video"!==i&&"audio"!==i||w(t,n),t}),n,i)},n.append=function(e,t,n,i){"function"==typeof n&&(i=n,n={});n||(n={});i||(i=()=>{});y(e),_(n),"string"==typeof t&&(t=document.querySelector(t));if(t&&("VIDEO"===t.nodeName||"AUDIO"===t.nodeName))throw new Error("Invalid video/audio node argument. Argument must be root element that video/audio tag will be appended to.");function r(e){const n=document.createElement(e);return t.appendChild(n),n}g(e,(function(e){return"video"===e||"audio"===e?function(e){const i=r(e);return w(i,n),t.appendChild(i),i}(e):r(e)}),n,(function(e,t){e&&t&&t.remove(),i(e,t)}))},n.mime=e("./lib/mime.json");const i=e("debug")("render-media"),r=e("is-ascii"),s=e("mediasource"),o=e("path"),a=e("stream-to-blob-url"),c=e("videostream"),u=[".m4a",".m4b",".m4p",".m4v",".mp4"],l=[".m4v",".mkv",".mp4",".webm"],d=[].concat(l,[".m4a",".m4b",".m4p",".mp3"]),f=[".mov",".ogv"],p=[".aac",".oga",".ogg",".wav",".flac"],h=[".bmp",".gif",".jpeg",".jpg",".png",".svg"],m=[".css",".html",".js",".md",".pdf",".srt",".txt"],b="undefined"!=typeof window&&window.MediaSource;function g(e,t,n,a){const g=o.extname(e.name).toLowerCase();let y,_=0;function w(){return!("number"==typeof e.length&&e.length>n.maxBlobLength)||(i("File length too large for Blob URL approach: %d (max: %d)",e.length,n.maxBlobLength),M(new Error(`File length too large for Blob URL approach: ${e.length} (max: ${n.maxBlobLength})`)),!1)}function x(n){w()&&(y=t(n),v(e,((e,t)=>{if(e)return M(e);y.addEventListener("error",M),y.addEventListener("loadstart",k),y.addEventListener("loadedmetadata",E),y.src=t})))}function k(){if(y.removeEventListener("loadstart",k),n.autoplay){const e=y.play();void 0!==e&&e.catch(M)}}function E(){y.removeEventListener("loadedmetadata",E),a(null,y)}function S(){v(e,((e,n)=>{if(e)return M(e);".pdf"!==g?(y=t("iframe"),y.sandbox="allow-forms allow-scripts",y.src=n):(y=t("object"),y.setAttribute("typemustmatch",!0),y.setAttribute("type","application/pdf"),y.setAttribute("data",n)),a(null,y)}))}function M(t){t.message=`Error rendering file "${e.name}": ${t.message}`,i(t.message),a(t)}d.includes(g)?function(){const n=l.includes(g)?"video":"audio";b?u.includes(g)?r():a():d();function r(){i(`Use \`videostream\` package for ${e.name}`),h(),y.addEventListener("error",f),y.addEventListener("loadstart",k),y.addEventListener("loadedmetadata",E),new c(e,y)}function a(){i(`Use MediaSource API for ${e.name}`),h(),y.addEventListener("error",p),y.addEventListener("loadstart",k),y.addEventListener("loadedmetadata",E);const t=new s(y).createWriteStream((n=e.name,{".m4a":'audio/mp4; codecs="mp4a.40.5"',".m4b":'audio/mp4; codecs="mp4a.40.5"',".m4p":'audio/mp4; codecs="mp4a.40.5"',".m4v":'video/mp4; codecs="avc1.640029, mp4a.40.5"',".mkv":'video/webm; codecs="avc1.640029, mp4a.40.5"',".mp3":"audio/mpeg",".mp4":'video/mp4; codecs="avc1.640029, mp4a.40.5"',".webm":'video/webm; codecs="vorbis, vp8"'}[o.extname(n).toLowerCase()]));var n;e.createReadStream().pipe(t),_&&(y.currentTime=_)}function d(){i(`Use Blob URL for ${e.name}`),h(),y.addEventListener("error",M),y.addEventListener("loadstart",k),y.addEventListener("loadedmetadata",E),v(e,((e,t)=>{if(e)return M(e);y.src=t,_&&(y.currentTime=_)}))}function f(e){i("videostream error: fallback to MediaSource API: %o",e.message||e),y.removeEventListener("error",f),y.removeEventListener("loadedmetadata",E),a()}function p(e){i("MediaSource API error: fallback to Blob URL: %o",e.message||e),w()&&(y.removeEventListener("error",p),y.removeEventListener("loadedmetadata",E),d())}function h(){y||(y=t(n),y.addEventListener("progress",(()=>{_=y.currentTime})))}}():f.includes(g)?x("video"):p.includes(g)?x("audio"):h.includes(g)?(y=t("img"),v(e,((t,n)=>{if(t)return M(t);y.src=n,y.alt=e.name,a(null,y)}))):m.includes(g)?S():function(){i('Unknown file extension "%s" - will attempt to render into iframe',g);let t="";function n(){r(t)?(i('File extension "%s" appears ascii, so will render.',g),S()):(i('File extension "%s" appears non-ascii, will not render.',g),a(new Error(`Unsupported file type "${g}": Cannot append to DOM`)))}e.createReadStream({start:0,end:1e3}).setEncoding("utf8").on("data",(e=>{t+=e})).on("end",n).on("error",a)}()}function v(e,t){const i=o.extname(e.name).toLowerCase();a(e.createReadStream(),n.mime[i]).then((e=>t(null,e)),(e=>t(e)))}function y(e){if(null==e)throw new Error("file cannot be null or undefined");if("string"!=typeof e.name)throw new Error("missing or invalid file.name property");if("function"!=typeof e.createReadStream)throw new Error("missing or invalid file.createReadStream property")}function _(e){null==e.autoplay&&(e.autoplay=!1),null==e.muted&&(e.muted=!1),nLine truncated
|
||||
n.render=function(e,t,n,i){"function"==typeof n&&(i=n,n={});n||(n={});i||(i=()=>{});y(e),_(n),"string"==typeof t&&(t=document.querySelector(t));g(e,(i=>{if(t.nodeName!==i.toUpperCase()){const n=o.extname(e.name).toLowerCase();throw new Error(`Cannot render "${n}" inside a "${t.nodeName.toLowerCase()}" element, expected "${i}"`)}return"video"!==i&&"audio"!==i||w(t,n),t}),n,i)},n.append=function(e,t,n,i){"function"==typeof n&&(i=n,n={});n||(n={});i||(i=()=>{});y(e),_(n),"string"==typeof t&&(t=document.querySelector(t));if(t&&("VIDEO"===t.nodeName||"AUDIO"===t.nodeName))throw new Error("Invalid video/audio node argument. Argument must be root element that video/audio tag will be appended to.");function r(e){const n=document.createElement(e);return t.appendChild(n),n}g(e,(function(e){return"video"===e||"audio"===e?function(e){const i=r(e);return w(i,n),t.appendChild(i),i}(e):r(e)}),n,(function(e,t){e&&t&&t.remove(),i(e,t)}))},n.mime=e("./lib/mime.json");const i=e("debug")("render-media"),r=e("is-ascii"),s=e("mediasource"),o=e("path"),a=e("stream-to-blob-url"),c=e("videostream"),u=[".m4a",".m4b",".m4p",".m4v",".mp4"],l=[".m4v",".mkv",".mp4",".webm"],d=[].concat(l,[".m4a",".m4b",".m4p",".mp3"]),f=[".mov",".ogv"],p=[".aac",".oga",".ogg",".wav",".flac"],h=[".bmp",".gif",".jpeg",".jpg",".png",".svg"],m=[".css",".html",".js",".md",".pdf",".srt",".txt"],b="undefined"!=typeof window&&window.MediaSource;function g(e,t,n,a){const g=o.extname(e.name).toLowerCase();let y,_=0;function w(){return!("number"==typeof e.length&&e.length>n.maxBlobLength)||(i("File length too large for Blob URL approach: %d (max: %d)",e.length,n.maxBlobLength),M(new Error(`File length too large for Blob URL approach: ${e.length} (max: ${n.maxBlobLength})`)),!1)}function x(n){w()&&(y=t(n),v(e,((e,t)=>{if(e)return M(e);y.addEventListener("error",M),y.addEventListener("loadstart",k),y.addEventListener("loadedmetadata",E),y.src=t})))}function k(){if(y.removeEventListener("loadstart",k),n.autoplay){const e=y.play();void 0!==e&&e.catch(M)}}function E(){y.removeEventListener("loadedmetadata",E),a(null,y)}function S(){v(e,((e,n)=>{if(e)return M(e);".pdf"!==g?(y=t("iframe"),y.sandbox="allow-forms allow-scripts",y.src=n):(y=t("object"),y.setAttribute("typemustmatch",!0),y.setAttribute("type","application/pdf"),y.setAttribute("data",n)),a(null,y)}))}function M(t){t.message=`Error rendering file "${e.name}": ${t.message}`,i(t.message),a(t)}d.includes(g)?function(){const n=l.includes(g)?"video":"audio";b?u.includes(g)?r():a():d();function r(){i(`Use \`videostream\` package for ${e.name}`),h(),y.addEventListener("error",f),y.addEventListener("loadstart",k),y.addEventListener("loadedmetadata",E),new c(e,y)}function a(){i(`Use MediaSource API for ${e.name}`),h(),y.addEventListener("error",p),y.addEventListener("loadstart",k),y.addEventListener("loadedmetadata",E);const t=new s(y).createWriteStream((n=e.name,{".m4a":'audio/mp4; codecs="mp4a.40.5"',".m4b":'audio/mp4; codecs="mp4a.40.5"',".m4p":'audio/mp4; codecs="mp4a.40.5"',".m4v":'video/mp4; codecs="avc1.640029, mp4a.40.5"',".mkv":'video/webm; codecs="avc1.640029, mp4a.40.5"',".mp3":"audio/mpeg",".mp4":'video/mp4; codecs="avc1.640029, mp4a.40.5"',".webm":'video/webm; codecs="vorbis, vp8"'}[o.extname(n).toLowerCase()]));var n;e.createReadStream().pipe(t),_&&(y.currentTime=_)}function d(){i(`Use Blob URL for ${e.name}`),h(),y.addEventListener("error",M),y.addEventListener("loadstart",k),y.addEventListener("loadedmetadata",E),v(e,((e,t)=>{if(e)return M(e);y.src=t,_&&(y.currentTime=_)}))}function f(e){i("videostream error: fallback to MediaSource API: %o",e.message||e),y.removeEventListener("error",f),y.removeEventListener("loadedmetadata",E),a()}function p(e){i("MediaSource API error: fallback to Blob URL: %o",e.message||e),w()&&(y.removeEventListener("error",p),y.removeEventListener("loadedmetadata",E),d())}function h(){y||(y=t(n),y.addEventListener("progress",(()=>{_=y.currentTime})))}}():f.includes(g)?x("video"):p.includes(g)?x("audio"):h.includes(g)?(y=t("img"),v(e,((t,n)=>{if(t)return M(t);y.src=n,y.alt=e.name,a(null,y)}))):m.includes(g)?S():function(){i('Unknown file extension "%s" - will attempt to render into iframe',g);let t="";function n(){r(t)?(i('File extension "%s" appears ascii, so will render.',g),S()):(i('File extension "%s" appears non-ascii, will not render.',g),a(new Error(`Unsupported file type "${g}": Cannot append to DOM`)))}e.createReadStream({start:0,end:1e3}).setEncoding("utf8").on("data",(e=>{t+=e})).on("end",n).on("error",a)}()}function v(e,t){const i=o.extname(e.name).toLowerCase();a(e.createReadStream(),n.mime[i]).then((e=>t(null,e)),(e=>t(e)))}function y(e){if(null==e)throw new Error("file cannot be null or undefined");if("string"!=typeof e.name)throw new Error("missing or invalid file.name property");if("function"!=typeof e.createReadStream)throw new Error("missing or invalid file.createReadStream property")}function _(e){null==e.autoplay&&(e.autoplay=!1),null==e.muted&&(e.muted=!1),nLine truncated
|
||||
/*! run-parallel-limit. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
t.exports=function(e,t,n){if("number"!=typeof t)throw new Error("second argument must be a Number");let r,s,o,a,c,u,l=!0;Array.isArray(e)?(r=[],o=s=e.length):(a=Object.keys(e),r={},o=s=a.length);function d(e){function t(){n&&n(e,r),n=null}l?i(t):t()}function f(t,n,i){if(r[t]=i,n&&(c=!0),0==--o||n)d(n);else if(!c&&u<s){let t;a?(t=a[u],u+=1,e[t]((function(e,n){f(t,e,n)}))):(t=u,u+=1,e[t]((function(e,n){f(t,e,n)})))}}u=t,o?a?a.some((function(n,i){return e[n]((function(e,t){f(n,e,t)})),i===t-1})):e.some((function(e,n){return e((function(e,t){f(n,e,t)})),n===t-1})):d(null);l=!1};const i=e("queue-microtask")},{"queue-microtask":346}],374:[function(e,t,n){
|
||||
t.exports=function(e,t,n){if("number"!=typeof t)throw new Error("second argument must be a Number");let r,s,o,a,c,u,l=!0;Array.isArray(e)?(r=[],o=s=e.length):(a=Object.keys(e),r={},o=s=a.length);function d(e){function t(){n&&n(e,r),n=null}l?i(t):t()}function f(t,n,i){if(r[t]=i,n&&(c=!0),0==--o||n)d(n);else if(!c&&u<s){let t;a?(t=a[u],u+=1,e[t]((function(e,n){f(t,e,n)}))):(t=u,u+=1,e[t]((function(e,n){f(t,e,n)})))}}u=t,o?a?a.some((function(n,i){return e[n]((function(e,t){f(n,e,t)})),i===t-1})):e.some((function(e,n){return e((function(e,t){f(n,e,t)})),n===t-1})):d(null);l=!1};const i=e("queue-microtask")},{"queue-microtask":355}],384:[function(e,t,n){
|
||||
/*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
t.exports=function(e,t){let n,r,s,o=!0;Array.isArray(e)?(n=[],r=e.length):(s=Object.keys(e),n={},r=s.length);function a(e){function r(){t&&t(e,n),t=null}o?i(r):r()}function c(e,t,i){n[e]=i,(0==--r||t)&&a(t)}r?s?s.forEach((function(t){e[t]((function(e,n){c(t,e,n)}))})):e.forEach((function(e,t){e((function(e,n){c(t,e,n)}))})):a(null);o=!1};const i=e("queue-microtask")},{"queue-microtask":346}],375:[function(e,t,n){var i,r;i="undefined"!=typeof self?self:this,r=function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){var i=n(5),r=n(1),s=r.toHex,o=r.ceilHeapSize,a=n(6),c=function(e){for(e+=9;e%64>0;e+=1);return e},u=function(e,t){var n=new Int32Array(e,t+320,5),i=new Int32Array(5),r=new DataView(i.buffer);return r.setInt32(0,n[0],!1),r.setInt32(4,n[1],!1),r.setInt32(8,n[2],!1),r.setInt32(12,n[3],!1),r.setInt32(16,n[4],!1),i},l=function(){function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(t=t||65536)%64>0)throw new Error("Chunk size must be a multiple of 128 bit");this._offset=0,this._maxChunkLen=t,this._padMaxChunkLen=c(t),this._heap=new ArrayBuffer(o(this._padMaxChunkLen+320+20)),this._h32=new Int32Array(this._heap),this._h8=new Int8Array(this._heap),this._core=new i({Int32Array:Int32Array},{},this._heap)}return e.prototype._initState=function(e,t){this._offset=0;var n=new Int32Array(e,t+320,5);n[0]=1732584193,n[1]=-271733879,n[2]=-1732584194,n[3]=271733878,n[4]=-1009589776},e.prototype._padChunk=function(e,t){var n=c(e),i=new Int32Array(this._heap,0,n>>2);return function(e,t){var n=new Uint8Array(e.buffer),i=t%4,r=t-i;switch(i){case 0:n[r+3]=0;case 1:n[r+2]=0;case 2:n[r+1]=0;case 3:n[r+0]=0}for(var s=1+(t>>2);s<e.length;s++)e[s]=0}(i,e),function(e,t,n){e[t>>2]|=128<<24-(t%4<<3),e[14+(2+(t>>2)&-16)]=n/(1<<29)|0,e[15+(2+(t>>2)&-16)]=n<<3}(i,e,t),n},e.prototype._write=function(e,t,n,i){a(e,this._h8,this._h32,t,n,i||0)},e.prototype._coreCall=function(e,t,n,i,r){var s=n;this._write(e,t,n),r&&(s=this._padChunk(n,i)),this._core.hash(s,this._padMaxChunkLen)},e.prototype.rawDigest=function(e){var t=e.byteLength||e.length||e.size||0;this._initState(this._heap,this._padMaxChunkLen);var n=0,i=this._maxChunkLen;for(n=0;t>n+i;n+=i)this._coreCall(e,n,i,t,!1);return this._coreCall(e,n,t-n,t,!0),u(this._heap,this._padMaxChunkLen)},e.prototype.digest=function(e){return s(this.rawDigest(e).buffer)},e.prototype.digestFromString=function(e){return this.digest(e)},e.prototype.digestFromBuffer=function(e){return this.digest(e)},e.prototype.digestFromArrayBuffer=function(e){return this.digest(e)},e.prototype.resetState=function(){return this._initState(this._heap,this._padMaxChunkLen),this},e.prototype.append=function(e){var t=0,n=e.byteLength||e.length||e.size||0,i=this._offset%this._maxChunkLen,r=void 0;for(this._offset+=n;t<n;)r=Math.min(n-t,this._maxChunkLen-i),this._write(e,t,r,i),t+=r,(i+=r)===this._maxChunkLen&&(this._core.hash(this._maxChunkLen,this._padMaxChunkLen),i=0);return this},e.prototype.getState=function(){var e=void 0;if(this._offset%this._maxChunkLen)e=this._heap.slice(0);else{var t=new Int32Array(this._heap,this._padMaxChunkLen+320,5);e=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}return{offset:this._offset,heap:e}},e.prototype.setState=function(e){return this._offset=e.offset,20===e.heap.byteLength?new Int32Array(this._heap,this._padMaxChunkLen+320,5).set(new Int32Array(e.heap)):this._h32.set(new Int32Array(e.heap)),this},e.prototype.rawEnd=function(){var e=this._offset,t=e%this._maxChunkLen,n=this._padChunk(t,e);this._core.hash(n,this._padMaxChunkLen);var i=u(this._heap,this._padMaxChunkLen);return this._initState(this._heap,this._padMaxChunkLen),i},e.prototype.end=function(){return s(this.rawEnd().buffer)},e}();e.exports=l,e.exports._core=i},function(e,t){for(var n=new Array(256),i=0;i<256;i++)n[i]=(i<16?"0":"")+i.toString(16);e.exports.toHex=function(e){for(var t=new Uint8Array(e),i=new Array(e.byteLength),r=0;r<i.length;r++)i[r]=n[t[r]];return i.join("")},e.exports.ceilHeapSize=function(e){var t=0;if(e<=65536)return 65536;if(e<16777216)for(t=1;t<e;t<<=1);else for(t=16777216;t<e;t+=16777216);return t},e.exports.isDedicatedWorkerScope=function(e){var t="WorkerGlobalScope"in e&&e instanceof e.WorkerGlobalScope,n="SharedWorkerGlobalScope"in e&&e instanceof e.SharedWorkerGlobalScope,i="ServiceWorkerGlobalScope"in e&&e instanceof e.ServiceWorkerGlobalScope;return t&&!n&&!i}},function(e,t,n){e.exports=function(){var e=n(0),t=function(e,n,i,r,s){var o=new self.FileReader;o.onloadend=function(){if(o.erroLine truncated
|
||||
t.exports=function(e,t){let n,r,s,o=!0;Array.isArray(e)?(n=[],r=e.length):(s=Object.keys(e),n={},r=s.length);function a(e){function r(){t&&t(e,n),t=null}o?i(r):r()}function c(e,t,i){n[e]=i,(0==--r||t)&&a(t)}r?s?s.forEach((function(t){e[t]((function(e,n){c(t,e,n)}))})):e.forEach((function(e,t){e((function(e,n){c(t,e,n)}))})):a(null);o=!1};const i=e("queue-microtask")},{"queue-microtask":355}],385:[function(e,t,n){var i,r;i="undefined"!=typeof self?self:this,r=function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t,n){var i=n(5),r=n(1),s=r.toHex,o=r.ceilHeapSize,a=n(6),c=function(e){for(e+=9;e%64>0;e+=1);return e},u=function(e,t){var n=new Int32Array(e,t+320,5),i=new Int32Array(5),r=new DataView(i.buffer);return r.setInt32(0,n[0],!1),r.setInt32(4,n[1],!1),r.setInt32(8,n[2],!1),r.setInt32(12,n[3],!1),r.setInt32(16,n[4],!1),i},l=function(){function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(t=t||65536)%64>0)throw new Error("Chunk size must be a multiple of 128 bit");this._offset=0,this._maxChunkLen=t,this._padMaxChunkLen=c(t),this._heap=new ArrayBuffer(o(this._padMaxChunkLen+320+20)),this._h32=new Int32Array(this._heap),this._h8=new Int8Array(this._heap),this._core=new i({Int32Array:Int32Array},{},this._heap)}return e.prototype._initState=function(e,t){this._offset=0;var n=new Int32Array(e,t+320,5);n[0]=1732584193,n[1]=-271733879,n[2]=-1732584194,n[3]=271733878,n[4]=-1009589776},e.prototype._padChunk=function(e,t){var n=c(e),i=new Int32Array(this._heap,0,n>>2);return function(e,t){var n=new Uint8Array(e.buffer),i=t%4,r=t-i;switch(i){case 0:n[r+3]=0;case 1:n[r+2]=0;case 2:n[r+1]=0;case 3:n[r+0]=0}for(var s=1+(t>>2);s<e.length;s++)e[s]=0}(i,e),function(e,t,n){e[t>>2]|=128<<24-(t%4<<3),e[14+(2+(t>>2)&-16)]=n/(1<<29)|0,e[15+(2+(t>>2)&-16)]=n<<3}(i,e,t),n},e.prototype._write=function(e,t,n,i){a(e,this._h8,this._h32,t,n,i||0)},e.prototype._coreCall=function(e,t,n,i,r){var s=n;this._write(e,t,n),r&&(s=this._padChunk(n,i)),this._core.hash(s,this._padMaxChunkLen)},e.prototype.rawDigest=function(e){var t=e.byteLength||e.length||e.size||0;this._initState(this._heap,this._padMaxChunkLen);var n=0,i=this._maxChunkLen;for(n=0;t>n+i;n+=i)this._coreCall(e,n,i,t,!1);return this._coreCall(e,n,t-n,t,!0),u(this._heap,this._padMaxChunkLen)},e.prototype.digest=function(e){return s(this.rawDigest(e).buffer)},e.prototype.digestFromString=function(e){return this.digest(e)},e.prototype.digestFromBuffer=function(e){return this.digest(e)},e.prototype.digestFromArrayBuffer=function(e){return this.digest(e)},e.prototype.resetState=function(){return this._initState(this._heap,this._padMaxChunkLen),this},e.prototype.append=function(e){var t=0,n=e.byteLength||e.length||e.size||0,i=this._offset%this._maxChunkLen,r=void 0;for(this._offset+=n;t<n;)r=Math.min(n-t,this._maxChunkLen-i),this._write(e,t,r,i),t+=r,(i+=r)===this._maxChunkLen&&(this._core.hash(this._maxChunkLen,this._padMaxChunkLen),i=0);return this},e.prototype.getState=function(){var e=void 0;if(this._offset%this._maxChunkLen)e=this._heap.slice(0);else{var t=new Int32Array(this._heap,this._padMaxChunkLen+320,5);e=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}return{offset:this._offset,heap:e}},e.prototype.setState=function(e){return this._offset=e.offset,20===e.heap.byteLength?new Int32Array(this._heap,this._padMaxChunkLen+320,5).set(new Int32Array(e.heap)):this._h32.set(new Int32Array(e.heap)),this},e.prototype.rawEnd=function(){var e=this._offset,t=e%this._maxChunkLen,n=this._padChunk(t,e);this._core.hash(n,this._padMaxChunkLen);var i=u(this._heap,this._padMaxChunkLen);return this._initState(this._heap,this._padMaxChunkLen),i},e.prototype.end=function(){return s(this.rawEnd().buffer)},e}();e.exports=l,e.exports._core=i},function(e,t){for(var n=new Array(256),i=0;i<256;i++)n[i]=(i<16?"0":"")+i.toString(16);e.exports.toHex=function(e){for(var t=new Uint8Array(e),i=new Array(e.byteLength),r=0;r<i.length;r++)i[r]=n[t[r]];return i.join("")},e.exports.ceilHeapSize=function(e){var t=0;if(e<=65536)return 65536;if(e<16777216)for(t=1;t<e;t<<=1);else for(t=16777216;t<e;t+=16777216);return t},e.exports.isDedicatedWorkerScope=function(e){var t="WorkerGlobalScope"in e&&e instanceof e.WorkerGlobalScope,n="SharedWorkerGlobalScope"in e&&e instanceof e.SharedWorkerGlobalScope,i="ServiceWorkerGlobalScope"in e&&e instanceof e.ServiceWorkerGlobalScope;return t&&!n&&!i}},function(e,t,n){e.exports=function(){var e=n(0),t=function(e,n,i,r,s){var o=new self.FileReader;o.onloadend=function(){if(o.erroLine truncated
|
||||
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
var i=e("buffer"),r=i.Buffer;function s(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=i:(s(i,n),n.Buffer=o),o.prototype=Object.create(r.prototype),s(r,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},{buffer:114}],377:[function(e,t,n){(function(n){(function(){"use strict";var i,r=e("buffer"),s=r.Buffer,o={};for(i in r)r.hasOwnProperty(i)&&"SlowBuffer"!==i&&"Buffer"!==i&&(o[i]=r[i]);var a=o.Buffer={};for(i in s)s.hasOwnProperty(i)&&"allocUnsafe"!==i&&"allocUnsafeSlow"!==i&&(a[i]=s[i]);if(o.Buffer.prototype=s.prototype,a.from&&a.from!==Uint8Array.from||(a.from=function(e,t,n){if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return s(e,t,n)}),a.alloc||(a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var i=s(e);return t&&0!==t.length?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i}),!o.kStringMaxLength)try{o.kStringMaxLength=n.binding("buffer").kStringMaxLength}catch(e){}o.constants||(o.constants={MAX_LENGTH:o.kMaxLength},o.kStringMaxLength&&(o.constants.MAX_STRING_LENGTH=o.kStringMaxLength)),t.exports=o}).call(this)}).call(this,e("_process"))},{_process:333,buffer:114}],378:[function(e,t,n){var i=e("safe-buffer").Buffer;function r(e,t){this._block=i.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}r.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=i.from(e,t));for(var n=this._block,r=this._blockSize,s=e.length,o=this._len,a=0;a<s;){for(var c=o%r,u=Math.min(s-a,r-c),l=0;l<u;l++)n[c+l]=e[a+l];a+=u,(o+=u)%r==0&&this._update(n)}return this._len+=s,this},r.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var i=(4294967295&n)>>>0,r=(n-i)/4294967296;this._block.writeUInt32BE(r,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var s=this._hash();return e?s.toString(e):s},r.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=r},{"safe-buffer":376}],379:[function(e,t,n){(n=t.exports=function(e){e=e.toLowerCase();var t=n[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t}).sha=e("./sha"),n.sha1=e("./sha1"),n.sha224=e("./sha224"),n.sha256=e("./sha256"),n.sha384=e("./sha384"),n.sha512=e("./sha512")},{"./sha":380,"./sha1":381,"./sha224":382,"./sha256":383,"./sha384":384,"./sha512":385}],380:[function(e,t,n){var i=e("inherits"),r=e("./hash"),s=e("safe-buffer").Buffer,o=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function c(){this.init(),this._w=a,r.call(this,64,56)}function u(e){return e<<30|e>>>2}function l(e,t,n,i){return 0===e?t&n|~t&i:2===e?t&n|t&i|n&i:t^n^i}i(c,r),c.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},c.prototype._update=function(e){for(var t,n=this._w,i=0|this._a,r=0|this._b,s=0|this._c,a=0|this._d,c=0|this._e,d=0;d<16;++d)n[d]=e.readInt32BE(4*d);for(;d<80;++d)n[d]=n[d-3]^n[d-8]^n[d-14]^n[d-16];for(var f=0;f<80;++f){var p=~~(f/20),h=0|((t=i)<<5|t>>>27)+l(p,r,s,a)+c+n[f]+o[p];c=a,a=s,s=u(r),r=i,i=h}this._a=i+this._a|0,this._b=r+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=c+this._e|0},c.prototype._hash=function(){var e=s.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=c},{"./hash":378,inherits:245,"safe-buffer":376}],381:[function(e,t,n){var i=e("inherits"),r=e("./hash"),s=e("safe-buffer").Buffer,o=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function c(){this.init(),this._w=a,r.call(this,64,56)}function u(e){return e<<5|e>>>27}function l(e){return e<<30|e>>>2}function d(e,t,n,i){return 0===e?t&n|~t&i:2===e?t&n|t&i|n&i:t^n^i}i(c,r),c.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._dLine truncated
|
||||
var i=e("buffer"),r=i.Buffer;function s(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=i:(s(i,n),n.Buffer=o),o.prototype=Object.create(r.prototype),s(r,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},{buffer:116}],387:[function(e,t,n){(function(n){(function(){"use strict";var i,r=e("buffer"),s=r.Buffer,o={};for(i in r)r.hasOwnProperty(i)&&"SlowBuffer"!==i&&"Buffer"!==i&&(o[i]=r[i]);var a=o.Buffer={};for(i in s)s.hasOwnProperty(i)&&"allocUnsafe"!==i&&"allocUnsafeSlow"!==i&&(a[i]=s[i]);if(o.Buffer.prototype=s.prototype,a.from&&a.from!==Uint8Array.from||(a.from=function(e,t,n){if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof e);if(e&&void 0===e.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);return s(e,t,n)}),a.alloc||(a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError('The "size" argument must be of type number. Received type '+typeof e);if(e<0||e>=2*(1<<30))throw new RangeError('The value "'+e+'" is invalid for option "size"');var i=s(e);return t&&0!==t.length?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i}),!o.kStringMaxLength)try{o.kStringMaxLength=n.binding("buffer").kStringMaxLength}catch(e){}o.constants||(o.constants={MAX_LENGTH:o.kMaxLength},o.kStringMaxLength&&(o.constants.MAX_STRING_LENGTH=o.kStringMaxLength)),t.exports=o}).call(this)}).call(this,e("_process"))},{_process:342,buffer:116}],388:[function(e,t,n){var i=e("safe-buffer").Buffer;function r(e,t){this._block=i.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}r.prototype.update=function(e,t){"string"==typeof e&&(t=t||"utf8",e=i.from(e,t));for(var n=this._block,r=this._blockSize,s=e.length,o=this._len,a=0;a<s;){for(var c=o%r,u=Math.min(s-a,r-c),l=0;l<u;l++)n[c+l]=e[a+l];a+=u,(o+=u)%r==0&&this._update(n)}return this._len+=s,this},r.prototype.digest=function(e){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var i=(4294967295&n)>>>0,r=(n-i)/4294967296;this._block.writeUInt32BE(r,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var s=this._hash();return e?s.toString(e):s},r.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=r},{"safe-buffer":386}],389:[function(e,t,n){(n=t.exports=function(e){e=e.toLowerCase();var t=n[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t}).sha=e("./sha"),n.sha1=e("./sha1"),n.sha224=e("./sha224"),n.sha256=e("./sha256"),n.sha384=e("./sha384"),n.sha512=e("./sha512")},{"./sha":390,"./sha1":391,"./sha224":392,"./sha256":393,"./sha384":394,"./sha512":395}],390:[function(e,t,n){var i=e("inherits"),r=e("./hash"),s=e("safe-buffer").Buffer,o=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function c(){this.init(),this._w=a,r.call(this,64,56)}function u(e){return e<<30|e>>>2}function l(e,t,n,i){return 0===e?t&n|~t&i:2===e?t&n|t&i|n&i:t^n^i}i(c,r),c.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},c.prototype._update=function(e){for(var t,n=this._w,i=0|this._a,r=0|this._b,s=0|this._c,a=0|this._d,c=0|this._e,d=0;d<16;++d)n[d]=e.readInt32BE(4*d);for(;d<80;++d)n[d]=n[d-3]^n[d-8]^n[d-14]^n[d-16];for(var f=0;f<80;++f){var p=~~(f/20),h=0|((t=i)<<5|t>>>27)+l(p,r,s,a)+c+n[f]+o[p];c=a,a=s,s=u(r),r=i,i=h}this._a=i+this._a|0,this._b=r+this._b|0,this._c=s+this._c|0,this._d=a+this._d|0,this._e=c+this._e|0},c.prototype._hash=function(){var e=s.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=c},{"./hash":388,inherits:249,"safe-buffer":386}],391:[function(e,t,n){var i=e("inherits"),r=e("./hash"),s=e("safe-buffer").Buffer,o=[1518500249,1859775393,-1894007588,-899497514],a=new Array(80);function c(){this.init(),this._w=a,r.call(this,64,56)}function u(e){return e<<5|e>>>27}function l(e){return e<<30|e>>>2}function d(e,t,n,i){return 0===e?t&n|~t&i:2===e?t&n|t&i|n&i:t^n^i}i(c,r),c.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._dLine truncated
|
||||
/*! simple-concat. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
t.exports=function(t,n){var i=[];t.on("data",(function(e){i.push(e)})),t.once("end",(function(){n&&n(null,e.concat(i)),n=null})),t.once("error",(function(e){n&&n(e),n=null}))}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:114}],387:[function(e,t,n){(function(n){(function(){
|
||||
t.exports=function(t,n){var i=[];t.on("data",(function(e){i.push(e)})),t.once("end",(function(){n&&n(null,e.concat(i)),n=null})),t.once("error",(function(e){n&&n(e),n=null}))}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:116}],397:[function(e,t,n){(function(n){(function(){
|
||||
/*! simple-get. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
t.exports=d;const i=e("simple-concat"),r=e("decompress-response"),s=e("http"),o=e("https"),a=e("once"),c=e("querystring"),u=e("url"),l=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;function d(e,t){if(e=Object.assign({maxRedirects:10},"string"==typeof e?{url:e}:e),t=a(t),e.url){const{hostname:t,port:n,protocol:i,auth:r,path:s}=u.parse(e.url);delete e.url,t||n||i||r?Object.assign(e,{hostname:t,port:n,protocol:i,auth:r,path:s}):e.path=s}const i={"accept-encoding":"gzip, deflate"};let f;e.headers&&Object.keys(e.headers).forEach((t=>i[t.toLowerCase()]=e.headers[t])),e.headers=i,e.body?f=e.json&&!l(e.body)?JSON.stringify(e.body):e.body:e.form&&(f="string"==typeof e.form?e.form:c.stringify(e.form),e.headers["content-type"]="application/x-www-form-urlencoded"),f&&(e.method||(e.method="POST"),l(f)||(e.headers["content-length"]=n.byteLength(f)),e.json&&!e.form&&(e.headers["content-type"]="application/json")),delete e.body,delete e.form,e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const p=("https:"===e.protocol?o:s).request(e,(n=>{if(!1!==e.followRedirects&&n.statusCode>=300&&n.statusCode<400&&n.headers.location)return e.url=n.headers.location,delete e.headers.host,n.resume(),"POST"===e.method&&[301,302].includes(n.statusCode)&&(e.method="GET",delete e.headers["content-length"],delete e.headers["content-type"]),0==e.maxRedirects--?t(new Error("too many redirects")):d(e,t);const i="function"==typeof r&&"HEAD"!==e.method;t(null,i?r(n):n)}));return p.on("timeout",(()=>{p.abort(),t(new Error("Request timed out"))})),p.on("error",t),l(f)?f.on("error",t).pipe(p):p.end(f),p}d.concat=(e,t)=>d(e,((n,r)=>{if(n)return t(n);i(r,((n,i)=>{if(n)return t(n);if(e.json)try{i=JSON.parse(i.toString())}catch(n){return t(n,r,i)}t(null,r,i)}))})),["get","post","put","patch","head","delete"].forEach((e=>{d[e]=(t,n)=>("string"==typeof t&&(t={url:t}),d(Object.assign({method:e.toUpperCase()},t),n))}))}).call(this)}).call(this,e("buffer").Buffer)},{buffer:114,"decompress-response":71,http:444,https:242,once:318,querystring:345,"simple-concat":386,url:479}],388:[function(e,t,n){
|
||||
t.exports=d;const i=e("simple-concat"),r=e("decompress-response"),s=e("http"),o=e("https"),a=e("once"),c=e("querystring"),u=e("url"),l=e=>null!==e&&"object"==typeof e&&"function"==typeof e.pipe;function d(e,t){if(e=Object.assign({maxRedirects:10},"string"==typeof e?{url:e}:e),t=a(t),e.url){const{hostname:t,port:n,protocol:i,auth:r,path:s}=u.parse(e.url);delete e.url,t||n||i||r?Object.assign(e,{hostname:t,port:n,protocol:i,auth:r,path:s}):e.path=s}const i={"accept-encoding":"gzip, deflate"};let f;e.headers&&Object.keys(e.headers).forEach((t=>i[t.toLowerCase()]=e.headers[t])),e.headers=i,e.body?f=e.json&&!l(e.body)?JSON.stringify(e.body):e.body:e.form&&(f="string"==typeof e.form?e.form:c.stringify(e.form),e.headers["content-type"]="application/x-www-form-urlencoded"),f&&(e.method||(e.method="POST"),l(f)||(e.headers["content-length"]=n.byteLength(f)),e.json&&!e.form&&(e.headers["content-type"]="application/json")),delete e.body,delete e.form,e.json&&(e.headers.accept="application/json"),e.method&&(e.method=e.method.toUpperCase());const p=("https:"===e.protocol?o:s).request(e,(n=>{if(!1!==e.followRedirects&&n.statusCode>=300&&n.statusCode<400&&n.headers.location)return e.url=n.headers.location,delete e.headers.host,n.resume(),"POST"===e.method&&[301,302].includes(n.statusCode)&&(e.method="GET",delete e.headers["content-length"],delete e.headers["content-type"]),0==e.maxRedirects--?t(new Error("too many redirects")):d(e,t);const i="function"==typeof r&&"HEAD"!==e.method;t(null,i?r(n):n)}));return p.on("timeout",(()=>{p.abort(),t(new Error("Request timed out"))})),p.on("error",t),l(f)?f.on("error",t).pipe(p):p.end(f),p}d.concat=(e,t)=>d(e,((n,r)=>{if(n)return t(n);i(r,((n,i)=>{if(n)return t(n);if(e.json)try{i=JSON.parse(i.toString())}catch(n){return t(n,r,i)}t(null,r,i)}))})),["get","post","put","patch","head","delete"].forEach((e=>{d[e]=(t,n)=>("string"==typeof t&&(t={url:t}),d(Object.assign({method:e.toUpperCase()},t),n))}))}).call(this)}).call(this,e("buffer").Buffer)},{buffer:116,"decompress-response":73,http:458,https:246,once:327,querystring:354,"simple-concat":396,url:494}],398:[function(e,t,n){
|
||||
/*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
const i=e("debug")("simple-peer"),r=e("get-browser-rtc"),s=e("randombytes"),o=e("readable-stream"),a=e("queue-microtask"),c=e("err-code"),{Buffer:u}=e("buffer"),l=65536;function d(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}class f extends o.Duplex{constructor(e){if(super(e=Object.assign({allowHalfOpen:!1},e)),this._id=s(4).toString("hex").slice(0,7),this._debug("new peer %o",e),this.channelName=e.initiator?e.channelName||s(20).toString("hex"):null,this.initiator=e.initiator||!1,this.channelConfig=e.channelConfig||f.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},f.config,e.config),this.offerOptions=e.offerOptions||{},this.answerOptions=e.answerOptions||{},this.sdpTransform=e.sdpTransform||(e=>e),this.streams=e.streams||(e.stream?[e.stream]:[]),this.trickle=void 0===e.trickle||e.trickle,this.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,this.iceCompleteTimeout=e.iceCompleteTimeout||5e3,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:r(),!this._wrtc)throw"undefined"==typeof window?c(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):c(new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(e){return void this.destroy(c(e,"ERR_PC_CONSTRUCTOR"))}this._isReactNativeWebrtc="number"==typeof this._pc._peerConnectionId,this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=e=>{this._onIceCandidate(e)},"object"==typeof this._pc.peerIdentity&&this._pc.peerIdentity.catch((e=>{this.destroy(c(e,"ERR_PC_PEER_IDENTITY"))})),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=e=>{this._setupData(e)},this.streams&&this.streams.forEach((e=>{this.addStream(e)})),this._pc.ontrack=e=>{this._onTrack(e)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&"open"===this._channel.readyState}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(e){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}this._debug("signal()"),e.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),e.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(e.candidate):this._pendingCandidates.push(e.candidate)),e.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(e)).then((()=>{this.destroyed||(this._pendingCandidates.forEach((e=>{this._addIceCandidate(e)})),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())})).catch((e=>{this.destroy(c(e,"ERR_SET_REMOTE_DESCRIPTION"))})),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||this.destroy(c(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(e){const t=new this._wrtc.RTCIceCandidate(e);this._pc.addIceCandidate(t).catch((e=>{var n;!t.address||t.address.endsWith(".local")?(n="Ignoring unsupported ICE candidate.",console.warn(n)):this.destroy(c(e,"ERR_ADD_ICE_CANDIDATE"))}))}send(e){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(e)}}addTransceiver(e,t){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(e){this.destroy(c(e,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transLine truncated
|
||||
const i=e("debug")("simple-peer"),r=e("get-browser-rtc"),s=e("randombytes"),o=e("readable-stream"),a=e("queue-microtask"),c=e("err-code"),{Buffer:u}=e("buffer"),l=65536;function d(e){return e.replace(/a=ice-options:trickle\s\n/g,"")}class f extends o.Duplex{constructor(e){if(super(e=Object.assign({allowHalfOpen:!1},e)),this._id=s(4).toString("hex").slice(0,7),this._debug("new peer %o",e),this.channelName=e.initiator?e.channelName||s(20).toString("hex"):null,this.initiator=e.initiator||!1,this.channelConfig=e.channelConfig||f.channelConfig,this.channelNegotiated=this.channelConfig.negotiated,this.config=Object.assign({},f.config,e.config),this.offerOptions=e.offerOptions||{},this.answerOptions=e.answerOptions||{},this.sdpTransform=e.sdpTransform||(e=>e),this.streams=e.streams||(e.stream?[e.stream]:[]),this.trickle=void 0===e.trickle||e.trickle,this.allowHalfTrickle=void 0!==e.allowHalfTrickle&&e.allowHalfTrickle,this.iceCompleteTimeout=e.iceCompleteTimeout||5e3,this.destroyed=!1,this.destroying=!1,this._connected=!1,this.remoteAddress=void 0,this.remoteFamily=void 0,this.remotePort=void 0,this.localAddress=void 0,this.localFamily=void 0,this.localPort=void 0,this._wrtc=e.wrtc&&"object"==typeof e.wrtc?e.wrtc:r(),!this._wrtc)throw"undefined"==typeof window?c(new Error("No WebRTC support: Specify `opts.wrtc` option in this environment"),"ERR_WEBRTC_SUPPORT"):c(new Error("No WebRTC support: Not a supported browser"),"ERR_WEBRTC_SUPPORT");this._pcReady=!1,this._channelReady=!1,this._iceComplete=!1,this._iceCompleteTimer=null,this._channel=null,this._pendingCandidates=[],this._isNegotiating=!1,this._firstNegotiation=!0,this._batchedNegotiation=!1,this._queuedNegotiation=!1,this._sendersAwaitingStable=[],this._senderMap=new Map,this._closingInterval=null,this._remoteTracks=[],this._remoteStreams=[],this._chunk=null,this._cb=null,this._interval=null;try{this._pc=new this._wrtc.RTCPeerConnection(this.config)}catch(e){return void this.destroy(c(e,"ERR_PC_CONSTRUCTOR"))}this._isReactNativeWebrtc="number"==typeof this._pc._peerConnectionId,this._pc.oniceconnectionstatechange=()=>{this._onIceStateChange()},this._pc.onicegatheringstatechange=()=>{this._onIceStateChange()},this._pc.onconnectionstatechange=()=>{this._onConnectionStateChange()},this._pc.onsignalingstatechange=()=>{this._onSignalingStateChange()},this._pc.onicecandidate=e=>{this._onIceCandidate(e)},"object"==typeof this._pc.peerIdentity&&this._pc.peerIdentity.catch((e=>{this.destroy(c(e,"ERR_PC_PEER_IDENTITY"))})),this.initiator||this.channelNegotiated?this._setupData({channel:this._pc.createDataChannel(this.channelName,this.channelConfig)}):this._pc.ondatachannel=e=>{this._setupData(e)},this.streams&&this.streams.forEach((e=>{this.addStream(e)})),this._pc.ontrack=e=>{this._onTrack(e)},this._debug("initial negotiation"),this._needsNegotiation(),this._onFinishBound=()=>{this._onFinish()},this.once("finish",this._onFinishBound)}get bufferSize(){return this._channel&&this._channel.bufferedAmount||0}get connected(){return this._connected&&"open"===this._channel.readyState}address(){return{port:this.localPort,family:this.localFamily,address:this.localAddress}}signal(e){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot signal after peer is destroyed"),"ERR_DESTROYED");if("string"==typeof e)try{e=JSON.parse(e)}catch(t){e={}}this._debug("signal()"),e.renegotiate&&this.initiator&&(this._debug("got request to renegotiate"),this._needsNegotiation()),e.transceiverRequest&&this.initiator&&(this._debug("got request for transceiver"),this.addTransceiver(e.transceiverRequest.kind,e.transceiverRequest.init)),e.candidate&&(this._pc.remoteDescription&&this._pc.remoteDescription.type?this._addIceCandidate(e.candidate):this._pendingCandidates.push(e.candidate)),e.sdp&&this._pc.setRemoteDescription(new this._wrtc.RTCSessionDescription(e)).then((()=>{this.destroyed||(this._pendingCandidates.forEach((e=>{this._addIceCandidate(e)})),this._pendingCandidates=[],"offer"===this._pc.remoteDescription.type&&this._createAnswer())})).catch((e=>{this.destroy(c(e,"ERR_SET_REMOTE_DESCRIPTION"))})),e.sdp||e.candidate||e.renegotiate||e.transceiverRequest||this.destroy(c(new Error("signal() called with invalid signal data"),"ERR_SIGNALING"))}}_addIceCandidate(e){const t=new this._wrtc.RTCIceCandidate(e);this._pc.addIceCandidate(t).catch((e=>{var n;!t.address||t.address.endsWith(".local")?(n="Ignoring unsupported ICE candidate.",console.warn(n)):this.destroy(c(e,"ERR_ADD_ICE_CANDIDATE"))}))}send(e){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot send after peer is destroyed"),"ERR_DESTROYED");this._channel.send(e)}}addTransceiver(e,t){if(!this.destroying){if(this.destroyed)throw c(new Error("cannot addTransceiver after peer is destroyed"),"ERR_DESTROYED");if(this._debug("addTransceiver()"),this.initiator)try{this._pc.addTransceiver(e,t),this._needsNegotiation()}catch(e){this.destroy(c(e,"ERR_ADD_TRANSCEIVER"))}else this.emit("signal",{type:"transceiverRequest",transLine truncated
|
||||
/*! simple-websocket. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
const i=e("debug")("simple-websocket"),r=e("randombytes"),s=e("readable-stream"),o=e("queue-microtask"),a=e("ws"),c="function"!=typeof a?WebSocket:a;class u extends s.Duplex{constructor(e={}){if("string"==typeof e&&(e={url:e}),super(e=Object.assign({allowHalfOpen:!1},e)),null==e.url&&null==e.socket)throw new Error("Missing required `url` or `socket` option");if(null!=e.url&&null!=e.socket)throw new Error("Must specify either `url` or `socket` option, not both");if(this._id=r(4).toString("hex").slice(0,7),this._debug("new websocket: %o",e),this.connected=!1,this.destroyed=!1,this._chunk=null,this._cb=null,this._interval=null,e.socket)this.url=e.socket.url,this._ws=e.socket,this.connected=e.socket.readyState===c.OPEN;else{this.url=e.url;try{this._ws="function"==typeof a?new c(e.url,null,{...e,encoding:void 0}):new c(e.url)}catch(e){return void o((()=>this.destroy(e)))}}this._ws.binaryType="arraybuffer",e.socket&&this.connected?o((()=>this._handleOpen())):this._ws.onopen=()=>this._handleOpen(),this._ws.onmessage=e=>this._handleMessage(e),this._ws.onclose=()=>this._handleClose(),this._ws.onerror=e=>this._handleError(e),this._handleFinishBound=()=>this._handleFinish(),this.once("finish",this._handleFinishBound)}send(e){this._ws.send(e)}destroy(e){this._destroy(e,(()=>{}))}_destroy(e,t){if(!this.destroyed){if(this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this.connected=!1,this.destroyed=!0,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._handleFinishBound&&this.removeListener("finish",this._handleFinishBound),this._handleFinishBound=null,this._ws){const t=this._ws,n=()=>{t.onclose=null};if(t.readyState===c.CLOSED)n();else try{t.onclose=n,t.close()}catch(e){n()}t.onopen=null,t.onmessage=null,t.onerror=()=>{}}this._ws=null,e&&this.emit("error",e),this.emit("close"),t()}}_read(){}_write(e,t,n){if(this.destroyed)return n(new Error("cannot write after socket is destroyed"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(e)}"function"!=typeof a&&this._ws.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._ws.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n}_handleOpen(){if(!this.connected&&!this.destroyed){if(this.connected=!0,this._chunk){try{this.send(this._chunk)}catch(e){return this.destroy(e)}this._chunk=null,this._debug('sent chunk from "write before connect"');const e=this._cb;this._cb=null,e(null)}"function"!=typeof a&&(this._interval=setInterval((()=>this._onInterval()),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}}_handleMessage(e){if(this.destroyed)return;let t=e.data;t instanceof ArrayBuffer&&(t=n.from(t)),this.push(t)}_handleClose(){this.destroyed||(this._debug("on close"),this.destroy())}_handleError(e){this.destroy(new Error(`Error connecting to ${this.url}`))}_handleFinish(){if(this.destroyed)return;const e=()=>{setTimeout((()=>this.destroy()),1e3)};this.connected?e():this.once("connect",e)}_onInterval(){if(!this._cb||!this._ws||this._ws.bufferedAmount>65536)return;this._debug("ending backpressure: bufferedAmount %d",this._ws.bufferedAmount);const e=this._cb;this._cb=null,e(null)}_debug(){const e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],i.apply(null,e)}}u.WEBSOCKET_SUPPORT=!!c,t.exports=u}).call(this)}).call(this,e("buffer").Buffer)},{buffer:114,debug:410,"queue-microtask":346,randombytes:348,"readable-stream":427,ws:71}],410:[function(e,t,n){arguments[4][27][0].apply(n,arguments)},{"./common":411,_process:333,dup:27}],411:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{dup:28,ms:412}],412:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{dup:29}],413:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{dup:30}],414:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{"./_stream_readable":416,"./_stream_writable":418,_process:333,dup:31,inherits:245}],415:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{"./_stream_transform":417,dup:32,inherits:245}],416:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"../errors":413,"./_stream_duplex":414,"./internal/streams/async_iterator":419,"./internal/streams/buffer_list":420,"./internal/streams/destroy":421,"./internal/streams/from":423,"./internal/streams/state":425,"./internal/streams/stream":426,_process:333,buffer:114,dup:33,events:194,inherits:245,"string_decoder/":466,util:71}],417:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{"../errors":413,"./_stream_duplex":414,dup:34,inherits:245}],418:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{"../errors":413,"./_stream_duplex":414,"./internal/streams/destroy":421,"./internal/streams/state":425,"./internal/streams/stream":426,_process:333,buffer:114,dup:35,inherits:245,"util-deprecate":485}],419:[function(e,t,n){arguments[4][36][Line truncated
|
||||
const i=e("debug")("simple-websocket"),r=e("randombytes"),s=e("readable-stream"),o=e("queue-microtask"),a=e("ws"),c="function"!=typeof a?WebSocket:a;class u extends s.Duplex{constructor(e={}){if("string"==typeof e&&(e={url:e}),super(e=Object.assign({allowHalfOpen:!1},e)),null==e.url&&null==e.socket)throw new Error("Missing required `url` or `socket` option");if(null!=e.url&&null!=e.socket)throw new Error("Must specify either `url` or `socket` option, not both");if(this._id=r(4).toString("hex").slice(0,7),this._debug("new websocket: %o",e),this.connected=!1,this.destroyed=!1,this._chunk=null,this._cb=null,this._interval=null,e.socket)this.url=e.socket.url,this._ws=e.socket,this.connected=e.socket.readyState===c.OPEN;else{this.url=e.url;try{this._ws="function"==typeof a?new c(e.url,null,{...e,encoding:void 0}):new c(e.url)}catch(e){return void o((()=>this.destroy(e)))}}this._ws.binaryType="arraybuffer",e.socket&&this.connected?o((()=>this._handleOpen())):this._ws.onopen=()=>this._handleOpen(),this._ws.onmessage=e=>this._handleMessage(e),this._ws.onclose=()=>this._handleClose(),this._ws.onerror=e=>this._handleError(e),this._handleFinishBound=()=>this._handleFinish(),this.once("finish",this._handleFinishBound)}send(e){this._ws.send(e)}destroy(e){this._destroy(e,(()=>{}))}_destroy(e,t){if(!this.destroyed){if(this._debug("destroy (error: %s)",e&&(e.message||e)),this.readable=this.writable=!1,this._readableState.ended||this.push(null),this._writableState.finished||this.end(),this.connected=!1,this.destroyed=!0,clearInterval(this._interval),this._interval=null,this._chunk=null,this._cb=null,this._handleFinishBound&&this.removeListener("finish",this._handleFinishBound),this._handleFinishBound=null,this._ws){const t=this._ws,n=()=>{t.onclose=null};if(t.readyState===c.CLOSED)n();else try{t.onclose=n,t.close()}catch(e){n()}t.onopen=null,t.onmessage=null,t.onerror=()=>{}}this._ws=null,e&&this.emit("error",e),this.emit("close"),t()}}_read(){}_write(e,t,n){if(this.destroyed)return n(new Error("cannot write after socket is destroyed"));if(this.connected){try{this.send(e)}catch(e){return this.destroy(e)}"function"!=typeof a&&this._ws.bufferedAmount>65536?(this._debug("start backpressure: bufferedAmount %d",this._ws.bufferedAmount),this._cb=n):n(null)}else this._debug("write before connect"),this._chunk=e,this._cb=n}_handleOpen(){if(!this.connected&&!this.destroyed){if(this.connected=!0,this._chunk){try{this.send(this._chunk)}catch(e){return this.destroy(e)}this._chunk=null,this._debug('sent chunk from "write before connect"');const e=this._cb;this._cb=null,e(null)}"function"!=typeof a&&(this._interval=setInterval((()=>this._onInterval()),150),this._interval.unref&&this._interval.unref()),this._debug("connect"),this.emit("connect")}}_handleMessage(e){if(this.destroyed)return;let t=e.data;t instanceof ArrayBuffer&&(t=n.from(t)),this.push(t)}_handleClose(){this.destroyed||(this._debug("on close"),this.destroy())}_handleError(e){this.destroy(new Error(`Error connecting to ${this.url}`))}_handleFinish(){if(this.destroyed)return;const e=()=>{setTimeout((()=>this.destroy()),1e3)};this.connected?e():this.once("connect",e)}_onInterval(){if(!this._cb||!this._ws||this._ws.bufferedAmount>65536)return;this._debug("ending backpressure: bufferedAmount %d",this._ws.bufferedAmount);const e=this._cb;this._cb=null,e(null)}_debug(){const e=[].slice.call(arguments);e[0]="["+this._id+"] "+e[0],i.apply(null,e)}}u.WEBSOCKET_SUPPORT=!!c,t.exports=u}).call(this)}).call(this,e("buffer").Buffer)},{buffer:116,debug:420,"queue-microtask":355,randombytes:358,"readable-stream":437,ws:73}],420:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{"./common":421,_process:342,dup:29}],421:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{dup:30,ms:422}],422:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],423:[function(e,t,n){arguments[4][32][0].apply(n,arguments)},{dup:32}],424:[function(e,t,n){arguments[4][33][0].apply(n,arguments)},{"./_stream_readable":426,"./_stream_writable":428,_process:342,dup:33,inherits:249}],425:[function(e,t,n){arguments[4][34][0].apply(n,arguments)},{"./_stream_transform":427,dup:34,inherits:249}],426:[function(e,t,n){arguments[4][35][0].apply(n,arguments)},{"../errors":423,"./_stream_duplex":424,"./internal/streams/async_iterator":429,"./internal/streams/buffer_list":430,"./internal/streams/destroy":431,"./internal/streams/from":433,"./internal/streams/state":435,"./internal/streams/stream":436,_process:342,buffer:116,dup:35,events:196,inherits:249,"string_decoder/":481,util:73}],427:[function(e,t,n){arguments[4][36][0].apply(n,arguments)},{"../errors":423,"./_stream_duplex":424,dup:36,inherits:249}],428:[function(e,t,n){arguments[4][37][0].apply(n,arguments)},{"../errors":423,"./_stream_duplex":424,"./internal/streams/destroy":431,"./internal/streams/state":435,"./internal/streams/stream":436,_process:342,buffer:116,dup:37,inherits:249,"util-deprecate":500}],429:[function(e,t,n){arguments[4][38][Line truncated
|
||||
/*! stream-to-blob-url. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
t.exports=async function(e,t){const n=await i(e,t);return URL.createObjectURL(n)};const i=e("stream-to-blob")},{"stream-to-blob":464}],464:[function(e,t,n){
|
||||
t.exports=async function(e,t){const n=await i(e,t);return URL.createObjectURL(n)};const i=e("stream-to-blob")},{"stream-to-blob":478}],478:[function(e,t,n){
|
||||
/*! stream-to-blob. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
t.exports=function(e,t){if(null!=t&&"string"!=typeof t)throw new Error("Invalid mimetype, expected string.");return new Promise(((n,i)=>{const r=[];e.on("data",(e=>r.push(e))).once("end",(()=>{const e=null!=t?new Blob(r,{type:t}):new Blob(r);n(e)})).once("error",i)}))}},{}],465:[function(e,t,n){(function(n){(function(){
|
||||
t.exports=function(e,t){if(null!=t&&"string"!=typeof t)throw new Error("Invalid mimetype, expected string.");return new Promise(((n,i)=>{const r=[];e.on("data",(e=>r.push(e))).once("end",(()=>{const e=null!=t?new Blob(r,{type:t}):new Blob(r);n(e)})).once("error",i)}))}},{}],479:[function(e,t,n){(function(n){(function(){
|
||||
/*! stream-with-known-length-to-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||
var i=e("once");t.exports=function(e,t,r){r=i(r);var s=n.alloc(t),o=0;e.on("data",(function(e){e.copy(s,o),o+=e.length})).on("end",(function(){r(null,s)})).on("error",r)}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:114,once:318}],466:[function(e,t,n){"use strict";var i=e("safe-buffer").Buffer,r=i.isEncoding||function(e){switch((e=""+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!0;default:return!1}};function s(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(i.isEncoding===r||!r(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=d,t=3;break;default:return this.write=f,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function l(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}n.StringDecoder=s,s.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},s.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},s.prototype.text=function(e,t){var n=function(e,t,n){var i=t.length-1;if(i<n)return 0;var r=o(t[i]);if(r>=0)return r>0&&(e.lastNeed=r-1),r;if(--i<n||-2===r)return 0;if((r=o(t[i]))>=0)return r>0&&(e.lastNeed=r-2),r;if(--i<n||-2===r)return 0;if((r=o(t[i]))>=0)return r>0&&(2===r?r=0:e.lastNeed=r-3),r;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":376}],467:[function(e,t,n){var i=e("./thirty-two");n.encode=i.encode,n.decode=i.decode},{"./thirty-two":468}],468:[function(e,t,n){(function(e){(function(){"use strict";var t=[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];n.encode=function(t){e.isBuffer(t)||(t=new e(t));for(var n,i,r=0,s=0,o=0,a=0,c=new e(8*(n=t,i=Math.floor(n.length/5),n.length%5==0?i:i+1));r<t.length;){var u=t[r];o>3?(a=(a=u&255>>o)<<(o=(o+5)%8)|(r+1<t.length?t[r+1]:0)>>8-o,r++):(a=u>>8-(o+5)&31,0===(o=(o+5)%8)&&r++),c[s]="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".charCodeAt(a),s++}for(r=s;r<c.length;r++)c[r]=61;return c},n.decode=function(n){var i,r=0,s=0,o=0;e.isBuffer(n)||(n=new e(n));for(var a=new e(Math.ceil(5*n.length/8)),c=0;c<n.length&&61!==n[c];c++){var u=n[c]-48;if(!(u<t.length))throw new Error("Invalid input - it is not base32 encoded string");s=t[u],r<=3?0===(r=(r+5)%8)?(i|=s,a[o]=i,o++,i=0):i|=255&s<<8-r:(i|=255&s>>>(r=(r+5)%8),a[o]=i,o++,i=Line truncated
|
||||
var i=e("once");t.exports=function(e,t,r){r=i(r);var s=n.alloc(t),o=0;e.on("data",(function(e){e.copy(s,o),o+=e.length})).on("end",(function(){r(null,s)})).on("error",r)}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:116,once:327}],480:[function(e,t,n){const{EventEmitter:i}=e("events"),r=new Error("Stream was destroyed"),s=new Error("Premature close"),o=e("queue-tick"),a=e("fast-fifo"),c=33554431,u=1^c,l=64,d=128,f=256,p=512,h=1024,m=2048,b=4096,g=8192,v=16392,y=384^c,_=65536,w=2<<16,x=4<<16,k=8<<16,E=16<<16,S=32<<16,M=64<<16,A=8454144,I=256<<16,T=33488895,j=33423359,C=65544,B=33488887,R=2105344,L=6|R,O=8470536,P=8404999,U=589831,q=Symbol.asyncIterator||Symbol("asyncIterator");class N{constructor(e,{highWaterMark:t=16384,map:n=null,mapWritable:i,byteLength:r,byteLengthWritable:s}={}){this.stream=e,this.queue=new a,this.highWaterMark=t,this.buffered=0,this.error=null,this.pipeline=null,this.byteLength=s||r||oe,this.map=i||n,this.afterWrite=K.bind(this),this.afterUpdateNextTick=X.bind(this)}get ended(){return 0!=(this.stream._duplexState&S)}push(e){return null!==this.map&&(e=this.map(e)),this.buffered+=this.byteLength(e),this.queue.push(e),this.buffered<this.highWaterMark?(this.stream._duplexState|=k,!0):(this.stream._duplexState|=1572864,!1)}shift(){const e=this.queue.shift(),t=this.stream;return this.buffered-=this.byteLength(e),0===this.buffered&&(t._duplexState&=33030143),e}end(e){"function"==typeof e?this.stream.once("finish",e):null!=e&&this.push(e),this.stream._duplexState=(this.stream._duplexState|I)&j}autoBatch(e,t){const n=[],i=this.stream;for(n.push(e);589824==(i._duplexState&U);)n.push(i._writableState.shift());if(0!=(7&i._duplexState))return t(null);i._writev(n,t)}update(){const e=this.stream;for(;(e._duplexState&U)===k;){const t=this.shift();e._duplexState|=327680,e._write(t,this.afterWrite),e._duplexState&=33292287}0==(196608&e._duplexState)&&this.updateNonPrimary()}updateNonPrimary(){const e=this.stream;if((17301511&e._duplexState)===I)return e._duplexState=16777215&(e._duplexState|_),void e._final(W.bind(this));2!=(6&e._duplexState)?1==(e._duplexState&P)&&(e._duplexState=(e._duplexState|C)&u,e._open(Y.bind(this))):0==(e._duplexState&O)&&(e._duplexState|=C,e._destroy(V.bind(this)))}updateNextTick(){0==(this.stream._duplexState&A)&&(this.stream._duplexState|=A,o(this.afterUpdateNextTick))}}class D{constructor(e,{highWaterMark:t=16384,map:n=null,mapReadable:i,byteLength:r,byteLengthReadable:s}={}){this.stream=e,this.queue=new a,this.highWaterMark=t,this.buffered=0,this.error=null,this.pipeline=null,this.byteLength=s||r||oe,this.map=i||n,this.pipeTo=null,this.afterRead=$.bind(this),this.afterUpdateNextTick=G.bind(this)}get ended(){return 0!=(this.stream._duplexState&g)}pipe(e,t){if(null!==this.pipeTo)throw new Error("Can only pipe to one destination");if(this.stream._duplexState|=f,this.pipeTo=e,this.pipeline=new H(this.stream,e,t||null),t&&this.stream.on("error",ae),se(e))e._writableState.pipeline=this.pipeline,t&&e.on("error",ae),e.on("finish",this.pipeline.finished.bind(this.pipeline));else{const t=this.pipeline.done.bind(this.pipeline,e),n=this.pipeline.done.bind(this.pipeline,e,null);e.on("error",t),e.on("close",n),e.on("finish",this.pipeline.finished.bind(this.pipeline))}e.on("drain",F.bind(this)),this.stream.emit("piping",e),e.emit("pipe",this.stream)}push(e){const t=this.stream;return null===e?(this.highWaterMark=0,t._duplexState=33521647&(t._duplexState|p),!1):(null!==this.map&&(e=this.map(e)),this.buffered+=this.byteLength(e),this.queue.push(e),t._duplexState=33521663&(t._duplexState|l),this.buffered<this.highWaterMark)}shift(){const e=this.queue.shift();return this.buffered-=this.byteLength(e),0===this.buffered&&(this.stream._duplexState&=33550271),e}unshift(e){let t;const n=[];for(;void 0!==(t=this.queue.shift());)n.push(t);this.push(e);for(let e=0;e<n.length;e++)this.queue.push(n[e])}read(){const e=this.stream;if((8263&e._duplexState)===l){const t=this.shift();return 0!=(e._duplexState&h)&&e.emit("data",t),null!==this.pipeTo&&!1===this.pipeTo.write(t)&&(e._duplexState&=y),t}return null}drain(){const e=this.stream;for(;(8263&e._duplexState)===l&&0!=(384&e._duplexState);){const t=this.shift();0!=(e._duplexState&h)&&e.emit("data",t),null!==this.pipeTo&&!1===this.pipeTo.write(t)&&(e._duplexState&=y)}}update(){const e=this.stream;for(this.drain();this.buffered<this.highWaterMark&&0==(41487&e._duplexState);)e._duplexState|=32808,e._read(this.afterRead),e._duplexState&=33554399,0==(8&e._duplexState)&&this.drain();2112==(6215&e._duplexState)&&(e._duplexState|=b,e.emit("readable")),0==(24&e._duplexState)&&this.updateNonPrimary()}updateNonPrimary(){const e=this.stream;(583&e._duplexState)===p&&(e._duplexState=33553919&(e._duplexState|g),e.emit("end"),(e._duplexState&L)===R&&(e._duplexState|=2),null!==this.pipeTo&&this.pipeTo.end()),2!=(6&e._duplexState)?1==(e._duplexState&P)&&(e._duplexState=(e._duplexState|C)&u,e._open(Y.bind(this))):0==(e._duplexState&O)&&(e._duplexState|=C,e._destrLine truncated
|
||||
/**!
|
||||
* tippy.js v6.3.1
|
||||
* (c) 2017-2021 atomiks
|
||||
* MIT License
|
||||
*/
|
||||
"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=e("@popperjs/core"),r="tippy-content",s="tippy-backdrop",o="tippy-arrow",a="tippy-svg-arrow",c={passive:!0,capture:!0};function u(e,t,n){if(Array.isArray(e)){var i=e[t];return null==i?Array.isArray(n)?n[t]:n:i}return e}function l(e,t){var n={}.toString.call(e);return 0===n.indexOf("[object")&&n.indexOf(t+"]")>-1}function d(e,t){return"function"==typeof e?e.apply(void 0,t):e}function f(e,t){return 0===t?e:function(i){clearTimeout(n),n=setTimeout((function(){e(i)}),t)};var n}function p(e,t){var n=Object.assign({},e);return t.forEach((function(e){delete n[e]})),n}function h(e){return[].concat(e)}function m(e,t){-1===e.indexOf(t)&&e.push(t)}function b(e){return e.split("-")[0]}function g(e){return[].slice.call(e)}function v(){return document.createElement("div")}function y(e){return["Element","Fragment"].some((function(t){return l(e,t)}))}function _(e){return l(e,"MouseEvent")}function w(e){return!(!e||!e._tippy||e._tippy.reference!==e)}function x(e){return y(e)?[e]:function(e){return l(e,"NodeList")}(e)?g(e):Array.isArray(e)?e:g(document.querySelectorAll(e))}function k(e,t){e.forEach((function(e){e&&(e.style.transitionDuration=t+"ms")}))}function E(e,t){e.forEach((function(e){e&&e.setAttribute("data-state",t)}))}function S(e){var t,n=h(e)[0];return(null==n||null==(t=n.ownerDocument)?void 0:t.body)?n.ownerDocument:document}function M(e,t,n){var i=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(t){e[i](t,n)}))}var A={isTouch:!1},I=0;function j(){A.isTouch||(A.isTouch=!0,window.performance&&document.addEventListener("mousemove",C))}function C(){var e=performance.now();e-I<20&&(A.isTouch=!1,document.removeEventListener("mousemove",C)),I=e}function T(){var e=document.activeElement;if(w(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}var B,R="undefined"!=typeof window&&"undefined"!=typeof document?navigator.userAgent:"",L=/MSIE |Trident\//.test(R);function O(e){return[e+"() was called on a"+("destroy"===e?"n already-":" ")+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function P(e){return e.replace(/[ \t]{2,}/g," ").replace(/^[ \t]*/gm,"").trim()}function U(e){return P("\n %ctippy.js\n\n %c"+P(e)+"\n\n %c👷 This is a development-only message. It will be removed in production.\n ")}function q(e){return[U(e),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}function D(e,t){var n;e&&!B.has(t)&&(B.add(t),(n=console).warn.apply(n,q(t)))}function N(e,t){var n;e&&!B.has(t)&&(B.add(t),(n=console).error.apply(n,q(t)))}"production"!==t.env.NODE_ENV&&(B=new Set);var z={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},H=Object.assign({appendTo:function(){return document.body},aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},z,{},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),F=Object.keys(H);function W(e){var t=(e.plugins||[]).reduce((function(t,n){var i=n.name,r=n.defaultValue;return i&&(t[i]=void 0!==e[i]?e[i]:r),t}),{});return Object.assign({},e,{},t)}function V(e,t){var n=Object.assign({},t,{content:d(t.content,[e])},t.ignoreAttributes?{}:function(e,t){return(t?Object.keys(W(Object.assign({},H,{plugins:t}))):F).reduce((function(t,n){var i=(e.getAttribute("data-tippy-"+n)||"").trim();if(!i)return t;if("content"===n)t[n]=i;else try{t[n]=JSON.parse(i)}catch(e){t[n]=i}return t}),{})}(e,t.plugins));return n.aria=Object.assign({},H.aria,{},n.aria),n.aria={expanded:"auto"===n.aria.expanded?t.interactive:n.aria.expanded,content:"auto"===n.aria.content?t.interactive?null:"describedby":n.aria.content},n}function K(e,t){void 0===e&&(e={}),void 0===t&&(t=[]),Object.keys(e).forEach((function(e){var n,i,r=p(H,Object.keys(z)),s=(n=r,i=e,!{}.hasOwnProperty.call(n,i));s&&(s=0===t.filter((function(t){return t.name===e})).length),D(s,["`"+e+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.","\n\n","All props: https://atomiks.github.io/tippyjs/v6/all-props/\n","Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))}))}function $(e,t){e.innerHTML=t}function G(e){var t=v();return!0===e?t.className=o:(t.className=a,y(e)?t.appendChild(e):$(t,e)),t}function X(e,t){y(t.content)?($(e,""),e.appendChild(t.content)):Line truncated
|
||||
"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=e("@popperjs/core"),r="tippy-content",s="tippy-backdrop",o="tippy-arrow",a="tippy-svg-arrow",c={passive:!0,capture:!0};function u(e,t,n){if(Array.isArray(e)){var i=e[t];return null==i?Array.isArray(n)?n[t]:n:i}return e}function l(e,t){var n={}.toString.call(e);return 0===n.indexOf("[object")&&n.indexOf(t+"]")>-1}function d(e,t){return"function"==typeof e?e.apply(void 0,t):e}function f(e,t){return 0===t?e:function(i){clearTimeout(n),n=setTimeout((function(){e(i)}),t)};var n}function p(e,t){var n=Object.assign({},e);return t.forEach((function(e){delete n[e]})),n}function h(e){return[].concat(e)}function m(e,t){-1===e.indexOf(t)&&e.push(t)}function b(e){return e.split("-")[0]}function g(e){return[].slice.call(e)}function v(){return document.createElement("div")}function y(e){return["Element","Fragment"].some((function(t){return l(e,t)}))}function _(e){return l(e,"MouseEvent")}function w(e){return!(!e||!e._tippy||e._tippy.reference!==e)}function x(e){return y(e)?[e]:function(e){return l(e,"NodeList")}(e)?g(e):Array.isArray(e)?e:g(document.querySelectorAll(e))}function k(e,t){e.forEach((function(e){e&&(e.style.transitionDuration=t+"ms")}))}function E(e,t){e.forEach((function(e){e&&e.setAttribute("data-state",t)}))}function S(e){var t,n=h(e)[0];return(null==n||null==(t=n.ownerDocument)?void 0:t.body)?n.ownerDocument:document}function M(e,t,n){var i=t+"EventListener";["transitionend","webkitTransitionEnd"].forEach((function(t){e[i](t,n)}))}var A={isTouch:!1},I=0;function T(){A.isTouch||(A.isTouch=!0,window.performance&&document.addEventListener("mousemove",j))}function j(){var e=performance.now();e-I<20&&(A.isTouch=!1,document.removeEventListener("mousemove",j)),I=e}function C(){var e=document.activeElement;if(w(e)){var t=e._tippy;e.blur&&!t.state.isVisible&&e.blur()}}var B,R="undefined"!=typeof window&&"undefined"!=typeof document?navigator.userAgent:"",L=/MSIE |Trident\//.test(R);function O(e){return[e+"() was called on a"+("destroy"===e?"n already-":" ")+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function P(e){return e.replace(/[ \t]{2,}/g," ").replace(/^[ \t]*/gm,"").trim()}function U(e){return P("\n %ctippy.js\n\n %c"+P(e)+"\n\n %c👷 This is a development-only message. It will be removed in production.\n ")}function q(e){return[U(e),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}function N(e,t){var n;e&&!B.has(t)&&(B.add(t),(n=console).warn.apply(n,q(t)))}function D(e,t){var n;e&&!B.has(t)&&(B.add(t),(n=console).error.apply(n,q(t)))}"production"!==t.env.NODE_ENV&&(B=new Set);var z={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},H=Object.assign({appendTo:function(){return document.body},aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},z,{},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),F=Object.keys(H);function W(e){var t=(e.plugins||[]).reduce((function(t,n){var i=n.name,r=n.defaultValue;return i&&(t[i]=void 0!==e[i]?e[i]:r),t}),{});return Object.assign({},e,{},t)}function V(e,t){var n=Object.assign({},t,{content:d(t.content,[e])},t.ignoreAttributes?{}:function(e,t){return(t?Object.keys(W(Object.assign({},H,{plugins:t}))):F).reduce((function(t,n){var i=(e.getAttribute("data-tippy-"+n)||"").trim();if(!i)return t;if("content"===n)t[n]=i;else try{t[n]=JSON.parse(i)}catch(e){t[n]=i}return t}),{})}(e,t.plugins));return n.aria=Object.assign({},H.aria,{},n.aria),n.aria={expanded:"auto"===n.aria.expanded?t.interactive:n.aria.expanded,content:"auto"===n.aria.content?t.interactive?null:"describedby":n.aria.content},n}function K(e,t){void 0===e&&(e={}),void 0===t&&(t=[]),Object.keys(e).forEach((function(e){var n,i,r=p(H,Object.keys(z)),s=(n=r,i=e,!{}.hasOwnProperty.call(n,i));s&&(s=0===t.filter((function(t){return t.name===e})).length),N(s,["`"+e+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.","\n\n","All props: https://atomiks.github.io/tippyjs/v6/all-props/\n","Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))}))}function $(e,t){e.innerHTML=t}function G(e){var t=v();return!0===e?t.className=o:(t.className=a,y(e)?t.appendChild(e):$(t,e)),t}function X(e,t){y(t.content)?($(e,""),e.appendChild(t.content)):Line truncated
|
||||
/*! torrent-discovery. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */
|
||||
const i=e("debug")("torrent-discovery"),r=e("bittorrent-dht/client"),s=e("events").EventEmitter,o=e("run-parallel"),a=e("bittorrent-tracker/client"),c=e("bittorrent-lsd");t.exports=class extends s{constructor(e){if(super(),!e.peerId)throw new Error("Option `peerId` is required");if(!e.infoHash)throw new Error("Option `infoHash` is required");if(!n.browser&&!e.port)throw new Error("Option `port` is required");this.peerId="string"==typeof e.peerId?e.peerId:e.peerId.toString("hex"),this.infoHash="string"==typeof e.infoHash?e.infoHash.toLowerCase():e.infoHash.toString("hex"),this._port=e.port,this._userAgent=e.userAgent,this.destroyed=!1,this._announce=e.announce||[],this._intervalMs=e.intervalMs||9e5,this._trackerOpts=null,this._dhtAnnouncing=!1,this._dhtTimeout=!1,this._internalDHT=!1,this._onWarning=e=>{this.emit("warning",e)},this._onError=e=>{this.emit("error",e)},this._onDHTPeer=(e,t)=>{t.toString("hex")===this.infoHash&&this.emit("peer",`${e.host}:${e.port}`,"dht")},this._onTrackerPeer=e=>{this.emit("peer",e,"tracker")},this._onTrackerAnnounce=()=>{this.emit("trackerAnnounce")},this._onLSDPeer=(e,t)=>{this.emit("peer",e,"lsd")};const t=(e,t)=>{const n=new r(t);return n.on("warning",this._onWarning),n.on("error",this._onError),n.listen(e),this._internalDHT=!0,n};!1===e.tracker?this.tracker=null:e.tracker&&"object"==typeof e.tracker?(this._trackerOpts=Object.assign({},e.tracker),this.tracker=this._createTracker()):this.tracker=this._createTracker(),!1===e.dht||"function"!=typeof r?this.dht=null:e.dht&&"function"==typeof e.dht.addNode?this.dht=e.dht:e.dht&&"object"==typeof e.dht?this.dht=t(e.dhtPort,e.dht):this.dht=t(e.dhtPort),this.dht&&(this.dht.on("peer",this._onDHTPeer),this._dhtAnnounce()),!1===e.lsd||"function"!=typeof c?this.lsd=null:this.lsd=this._createLSD()}updatePort(e){e!==this._port&&(this._port=e,this.dht&&this._dhtAnnounce(),this.tracker&&(this.tracker.stop(),this.tracker.destroy((()=>{this.tracker=this._createTracker()}))))}complete(e){this.tracker&&this.tracker.complete(e)}destroy(e){if(this.destroyed)return;this.destroyed=!0,clearTimeout(this._dhtTimeout);const t=[];this.tracker&&(this.tracker.stop(),this.tracker.removeListener("warning",this._onWarning),this.tracker.removeListener("error",this._onError),this.tracker.removeListener("peer",this._onTrackerPeer),this.tracker.removeListener("update",this._onTrackerAnnounce),t.push((e=>{this.tracker.destroy(e)}))),this.dht&&this.dht.removeListener("peer",this._onDHTPeer),this._internalDHT&&(this.dht.removeListener("warning",this._onWarning),this.dht.removeListener("error",this._onError),t.push((e=>{this.dht.destroy(e)}))),this.lsd&&(this.lsd.removeListener("warning",this._onWarning),this.lsd.removeListener("error",this._onError),this.lsd.removeListener("peer",this._onLSDPeer),t.push((e=>{this.lsd.destroy(e)}))),o(t,e),this.dht=null,this.tracker=null,this.lsd=null,this._announce=null}_createTracker(){const e=Object.assign({},this._trackerOpts,{infoHash:this.infoHash,announce:this._announce,peerId:this.peerId,port:this._port,userAgent:this._userAgent}),t=new a(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}_dhtAnnounce(){this._dhtAnnouncing||(i("dht announce"),this._dhtAnnouncing=!0,clearTimeout(this._dhtTimeout),this.dht.announce(this.infoHash,this._port,(e=>{this._dhtAnnouncing=!1,i("dht announce complete"),e&&this.emit("warning",e),this.emit("dhtAnnounce"),this.destroyed||(this._dhtTimeout=setTimeout((()=>{this._dhtAnnounce()}),this._intervalMs+Math.floor(Math.random()*this._intervalMs/5)),this._dhtTimeout.unref&&this._dhtTimeout.unref())})))}_createLSD(){const e=Object.assign({},{infoHash:this.infoHash,peerId:this.peerId,port:this._port}),t=new c(e);return t.on("warning",this._onWarning),t.on("error",this._onError),t.on("peer",this._onLSDPeer),t.start(),t}}}).call(this)}).call(this,e("_process"))},{_process:333,"bittorrent-dht/client":71,"bittorrent-lsd":71,"bittorrent-tracker/client":45,debug:472,events:194,"run-parallel":374}],472:[function(e,t,n){arguments[4][27][0].apply(n,arguments)},{"./common":473,_process:333,dup:27}],473:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{dup:28,ms:474}],474:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{dup:29}],475:[function(e,t,n){(function(e){(function(){
|
||||
const i=e("debug")("torrent-discovery"),r=e("bittorrent-dht/client"),s=e("events").EventEmitter,o=e("run-parallel"),a=e("bittorrent-tracker/client"),c=e("bittorrent-lsd");t.exports=class extends s{constructor(e){if(super(),!e.peerId)throw new Error("Option `peerId` is required");if(!e.infoHash)throw new Error("Option `infoHash` is required");if(!n.browser&&!e.port)throw new Error("Option `port` is required");this.peerId="string"==typeof e.peerId?e.peerId:e.peerId.toString("hex"),this.infoHash="string"==typeof e.infoHash?e.infoHash.toLowerCase():e.infoHash.toString("hex"),this._port=e.port,this._userAgent=e.userAgent,this.destroyed=!1,this._announce=e.announce||[],this._intervalMs=e.intervalMs||9e5,this._trackerOpts=null,this._dhtAnnouncing=!1,this._dhtTimeout=!1,this._internalDHT=!1,this._onWarning=e=>{this.emit("warning",e)},this._onError=e=>{this.emit("error",e)},this._onDHTPeer=(e,t)=>{t.toString("hex")===this.infoHash&&this.emit("peer",`${e.host}:${e.port}`,"dht")},this._onTrackerPeer=e=>{this.emit("peer",e,"tracker")},this._onTrackerAnnounce=()=>{this.emit("trackerAnnounce")},this._onLSDPeer=(e,t)=>{this.emit("peer",e,"lsd")};const t=(e,t)=>{const n=new r(t);return n.on("warning",this._onWarning),n.on("error",this._onError),n.listen(e),this._internalDHT=!0,n};!1===e.tracker?this.tracker=null:e.tracker&&"object"==typeof e.tracker?(this._trackerOpts=Object.assign({},e.tracker),this.tracker=this._createTracker()):this.tracker=this._createTracker(),!1===e.dht||"function"!=typeof r?this.dht=null:e.dht&&"function"==typeof e.dht.addNode?this.dht=e.dht:e.dht&&"object"==typeof e.dht?this.dht=t(e.dhtPort,e.dht):this.dht=t(e.dhtPort),this.dht&&(this.dht.on("peer",this._onDHTPeer),this._dhtAnnounce()),!1===e.lsd||"function"!=typeof c?this.lsd=null:this.lsd=this._createLSD()}updatePort(e){e!==this._port&&(this._port=e,this.dht&&this._dhtAnnounce(),this.tracker&&(this.tracker.stop(),this.tracker.destroy((()=>{this.tracker=this._createTracker()}))))}complete(e){this.tracker&&this.tracker.complete(e)}destroy(e){if(this.destroyed)return;this.destroyed=!0,clearTimeout(this._dhtTimeout);const t=[];this.tracker&&(this.tracker.stop(),this.tracker.removeListener("warning",this._onWarning),this.tracker.removeListener("error",this._onError),this.tracker.removeListener("peer",this._onTrackerPeer),this.tracker.removeListener("update",this._onTrackerAnnounce),t.push((e=>{this.tracker.destroy(e)}))),this.dht&&this.dht.removeListener("peer",this._onDHTPeer),this._internalDHT&&(this.dht.removeListener("warning",this._onWarning),this.dht.removeListener("error",this._onError),t.push((e=>{this.dht.destroy(e)}))),this.lsd&&(this.lsd.removeListener("warning",this._onWarning),this.lsd.removeListener("error",this._onError),this.lsd.removeListener("peer",this._onLSDPeer),t.push((e=>{this.lsd.destroy(e)}))),o(t,e),this.dht=null,this.tracker=null,this.lsd=null,this._announce=null}_createTracker(){const e=Object.assign({},this._trackerOpts,{infoHash:this.infoHash,announce:this._announce,peerId:this.peerId,port:this._port,userAgent:this._userAgent}),t=new a(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}_dhtAnnounce(){this._dhtAnnouncing||(i("dht announce"),this._dhtAnnouncing=!0,clearTimeout(this._dhtTimeout),this.dht.announce(this.infoHash,this._port,(e=>{this._dhtAnnouncing=!1,i("dht announce complete"),e&&this.emit("warning",e),this.emit("dhtAnnounce"),this.destroyed||(this._dhtTimeout=setTimeout((()=>{this._dhtAnnounce()}),this._intervalMs+Math.floor(Math.random()*this._intervalMs/5)),this._dhtTimeout.unref&&this._dhtTimeout.unref())})))}_createLSD(){const e=Object.assign({},{infoHash:this.infoHash,peerId:this.peerId,port:this._port}),t=new c(e);return t.on("warning",this._onWarning),t.on("error",this._onError),t.on("peer",this._onLSDPeer),t.start(),t}}}).call(this)}).call(this,e("_process"))},{_process:342,"bittorrent-dht/client":73,"bittorrent-lsd":73,"bittorrent-tracker/client":47,debug:487,events:196,"run-parallel":384}],487:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{"./common":488,_process:342,dup:29}],488:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{dup:30,ms:489}],489:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],490:[function(e,t,n){(function(e){(function(){
|
||||
/*! torrent-piece. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */
|
||||
const n=16384;class i{constructor(e){this.length=e,this.missing=e,this.sources=null,this._chunks=Math.ceil(e/n),this._remainder=e%n||n,this._buffered=0,this._buffer=null,this._cancellations=null,this._reservations=0,this._flushed=!1}chunkLength(e){return e===this._chunks-1?this._remainder:n}chunkLengthRemaining(e){return this.length-e*n}chunkOffset(e){return e*n}reserve(){return this.init()?this._cancellations.length?this._cancellations.pop():this._reservations<this._chunks?this._reservations++:-1:-1}reserveRemaining(){if(!this.init())return-1;if(this._cancellations.length||this._reservations<this._chunks){let e=this._reservations;for(;this._cancellations.length;)e=Math.min(e,this._cancellations.pop());return this._reservations=this._chunks,e}return-1}cancel(e){this.init()&&this._cancellations.push(e)}cancelRemaining(e){this.init()&&(this._reservations=e)}get(e){return this.init()?this._buffer[e]:null}set(e,t,i){if(!this.init())return!1;const r=t.length,s=Math.ceil(r/n);for(let r=0;r<s;r++)if(!this._buffer[e+r]){const s=r*n,o=t.slice(s,s+n);this._buffered++,this._buffer[e+r]=o,this.missing-=o.length,this.sources.includes(i)||this.sources.push(i)}return this._buffered===this._chunks}flush(){if(!this._buffer||this._chunks!==this._buffered)return null;const t=e.concat(this._buffer,this.length);return this._buffer=null,this._cancellations=null,this.sources=null,this._flushed=!0,t}init(){return!this._flushed&&(this._buffer||(this._buffer=new Array(this._chunks),this._cancellations=[],this.sources=[]),!0)}}Object.defineProperty(i,"BLOCK_LENGTH",{value:n}),t.exports=i}).call(this)}).call(this,e("buffer").Buffer)},{buffer:114}],476:[function(e,t,n){(function(n){(function(){var i=e("is-typedarray").strict;t.exports=function(e){if(i(e)){var t=n.from(e.buffer);return e.byteLength!==e.buffer.byteLength&&(t=t.slice(e.byteOffset,e.byteOffset+e.byteLength)),t}return n.from(e)}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:114,"is-typedarray":247}],477:[function(e,t,n){var i=e("buffer-alloc"),r=Math.pow(2,32);n.encodingLength=function(){return 8},n.encode=function(e,t,n){t||(t=i(8)),n||(n=0);var s=Math.floor(e/r),o=e-s*r;return t.writeUInt32BE(s,n),t.writeUInt32BE(o,n+4),t},n.decode=function(e,t){t||(t=0);var n=e.readUInt32BE(t),i=e.readUInt32BE(t+4);return n*r+i},n.encode.bytes=8,n.decode.bytes=8},{"buffer-alloc":116}],478:[function(e,t,n){t.exports=function(e,t){if(t>=e.length||t<0)return;var n=e.pop();if(t<e.length){var i=e[t];return e[t]=n,i}return n}},{}],479:[function(e,t,n){"use strict";var i=e("punycode"),r=e("./util");function s(){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}n.parse=y,n.resolve=function(e,t){return y(e,!1,!0).resolve(t)},n.resolveObject=function(e,t){return e?y(e,!1,!0).resolveObject(t):t},n.format=function(e){r.isString(e)&&(e=y(e));return e instanceof s?e.format():s.prototype.format.call(e)},n.Url=s;var o=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,c=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(u),d=["%","/","?",";","#"].concat(l),f=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},b={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=e("querystring");function y(e,t,n){if(e&&r.isObject(e)&&e instanceof s)return e;var i=new s;return i.parse(e,t,n),i}s.prototype.parse=function(e,t,n){if(!r.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var s=e.indexOf("?"),a=-1!==s&&s<e.indexOf("#")?"?":"#",u=e.split(a);u[0]=u[0].replace(/\\/g,"/");var y=e=u.join(a);if(y=y.trim(),!n&&1===e.split("#").length){var _=c.exec(y);if(_)return this.path=y,this.href=y,this.pathname=_[1],_[2]?(this.search=_[2],this.query=t?v.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var w=o.exec(y);if(w){var x=(w=w[0]).toLowerCase();this.protocol=x,y=y.substr(w.length)}if(n||w||y.match(/^\/\/[^@\/]+@[^@\/]+/)){var k="//"===y.substr(0,2);!k||w&&b[w]||(y=y.substr(2),this.slashes=!0)}if(!b[w]&&(k||w&&!g[w])){for(var E,S,M=-1,A=0;A<f.length;A++){-1!==(I=y.indexOf(f[A]))&&(-1===M||I<M)&&(M=I)}-1!==(S=-1===M?y.lastIndexOf("@"):y.lastIndexOf("@",M))&&(E=y.slice(0,S),y=y.slice(S+1),this.auth=decodeURIComponent(E)),M=-1;for(A=0;A<d.length;A++){var I;-1!==(I=y.indexOf(d[A]))&&(-1===M||I<M)&&(M=I)}-1===M&&(M=y.length),this.host=y.slice(0,M),y=y.slice(M),this.parseHost(),this.hostname=this.hostname||"";var j="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!j)for(var C=this.hostname.split(/\./),T=(A=0,C.length);A<T;A++){var B=C[A];if(B&&!B.match(p)){for(var R="",L=0,O=B.length;L<O;L++)B.charCodeAt(L)>127?R+="x":R+=B[L];if(!R.match(p)){var P=C.slice(0,A),U=C.slice(A+1),q=B.matchLine truncated
|
||||
const n=16384;class i{constructor(e){this.length=e,this.missing=e,this.sources=null,this._chunks=Math.ceil(e/n),this._remainder=e%n||n,this._buffered=0,this._buffer=null,this._cancellations=null,this._reservations=0,this._flushed=!1}chunkLength(e){return e===this._chunks-1?this._remainder:n}chunkLengthRemaining(e){return this.length-e*n}chunkOffset(e){return e*n}reserve(){return this.init()?this._cancellations.length?this._cancellations.pop():this._reservations<this._chunks?this._reservations++:-1:-1}reserveRemaining(){if(!this.init())return-1;if(this._cancellations.length||this._reservations<this._chunks){let e=this._reservations;for(;this._cancellations.length;)e=Math.min(e,this._cancellations.pop());return this._reservations=this._chunks,e}return-1}cancel(e){this.init()&&this._cancellations.push(e)}cancelRemaining(e){this.init()&&(this._reservations=e)}get(e){return this.init()?this._buffer[e]:null}set(e,t,i){if(!this.init())return!1;const r=t.length,s=Math.ceil(r/n);for(let r=0;r<s;r++)if(!this._buffer[e+r]){const s=r*n,o=t.slice(s,s+n);this._buffered++,this._buffer[e+r]=o,this.missing-=o.length,this.sources.includes(i)||this.sources.push(i)}return this._buffered===this._chunks}flush(){if(!this._buffer||this._chunks!==this._buffered)return null;const t=e.concat(this._buffer,this.length);return this._buffer=null,this._cancellations=null,this.sources=null,this._flushed=!0,t}init(){return!this._flushed&&(this._buffer||(this._buffer=new Array(this._chunks),this._cancellations=[],this.sources=[]),!0)}}Object.defineProperty(i,"BLOCK_LENGTH",{value:n}),t.exports=i}).call(this)}).call(this,e("buffer").Buffer)},{buffer:116}],491:[function(e,t,n){(function(n){(function(){var i=e("is-typedarray").strict;t.exports=function(e){if(i(e)){var t=n.from(e.buffer);return e.byteLength!==e.buffer.byteLength&&(t=t.slice(e.byteOffset,e.byteOffset+e.byteLength)),t}return n.from(e)}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:116,"is-typedarray":252}],492:[function(e,t,n){var i=e("buffer-alloc"),r=Math.pow(2,32);n.encodingLength=function(){return 8},n.encode=function(e,t,n){t||(t=i(8)),n||(n=0);var s=Math.floor(e/r),o=e-s*r;return t.writeUInt32BE(s,n),t.writeUInt32BE(o,n+4),t},n.decode=function(e,t){t||(t=0);var n=e.readUInt32BE(t),i=e.readUInt32BE(t+4);return n*r+i},n.encode.bytes=8,n.decode.bytes=8},{"buffer-alloc":118}],493:[function(e,t,n){t.exports=function(e,t){if(t>=e.length||t<0)return;var n=e.pop();if(t<e.length){var i=e[t];return e[t]=n,i}return n}},{}],494:[function(e,t,n){"use strict";var i=e("punycode"),r=e("./util");function s(){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}n.parse=y,n.resolve=function(e,t){return y(e,!1,!0).resolve(t)},n.resolveObject=function(e,t){return e?y(e,!1,!0).resolveObject(t):t},n.format=function(e){r.isString(e)&&(e=y(e));return e instanceof s?e.format():s.prototype.format.call(e)},n.Url=s;var o=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,c=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(u),d=["%","/","?",";","#"].concat(l),f=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,h=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},b={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=e("querystring");function y(e,t,n){if(e&&r.isObject(e)&&e instanceof s)return e;var i=new s;return i.parse(e,t,n),i}s.prototype.parse=function(e,t,n){if(!r.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var s=e.indexOf("?"),a=-1!==s&&s<e.indexOf("#")?"?":"#",u=e.split(a);u[0]=u[0].replace(/\\/g,"/");var y=e=u.join(a);if(y=y.trim(),!n&&1===e.split("#").length){var _=c.exec(y);if(_)return this.path=y,this.href=y,this.pathname=_[1],_[2]?(this.search=_[2],this.query=t?v.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search="",this.query={}),this}var w=o.exec(y);if(w){var x=(w=w[0]).toLowerCase();this.protocol=x,y=y.substr(w.length)}if(n||w||y.match(/^\/\/[^@\/]+@[^@\/]+/)){var k="//"===y.substr(0,2);!k||w&&b[w]||(y=y.substr(2),this.slashes=!0)}if(!b[w]&&(k||w&&!g[w])){for(var E,S,M=-1,A=0;A<f.length;A++){-1!==(I=y.indexOf(f[A]))&&(-1===M||I<M)&&(M=I)}-1!==(S=-1===M?y.lastIndexOf("@"):y.lastIndexOf("@",M))&&(E=y.slice(0,S),y=y.slice(S+1),this.auth=decodeURIComponent(E)),M=-1;for(A=0;A<d.length;A++){var I;-1!==(I=y.indexOf(d[A]))&&(-1===M||I<M)&&(M=I)}-1===M&&(M=y.length),this.host=y.slice(0,M),y=y.slice(M),this.parseHost(),this.hostname=this.hostname||"";var T="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!T)for(var j=this.hostname.split(/\./),C=(A=0,j.length);A<C;A++){var B=j[A];if(B&&!B.match(p)){for(var R="",L=0,O=B.length;L<O;L++)B.charCodeAt(L)>127?R+="x":R+=B[L];if(!R.match(p)){var P=j.slice(0,A),U=j.slice(A+1),q=B.matchLine truncated
|
||||
/*! ut_metadata. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */
|
||||
const{EventEmitter:i}=e("events"),r=e("bencode"),s=e("bitfield").default,o=e("debug")("ut_metadata"),a=e("simple-sha1"),c=16384;t.exports=e=>{class t extends i{constructor(t){super(),this._wire=t,this._fetching=!1,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._bitfield=new s(0,{grow:1e3}),n.isBuffer(e)&&this.setMetadata(e)}onHandshake(e,t,n){this._infoHash=e}onExtendedHandshake(e){return e.m&&e.m.ut_metadata?e.metadata_size?"number"!=typeof e.metadata_size||1e7<e.metadata_size||e.metadata_size<=0?this.emit("warning",new Error("Peer gave invalid metadata size")):(this._metadataSize=e.metadata_size,this._numPieces=Math.ceil(this._metadataSize/c),this._remainingRejects=2*this._numPieces,void this._requestPieces()):this.emit("warning",new Error("Peer does not have metadata")):this.emit("warning",new Error("Peer does not support ut_metadata"))}onMessage(e){let t,n;try{const i=e.toString(),s=i.indexOf("ee")+2;t=r.decode(i.substring(0,s)),n=e.slice(s)}catch(e){return}switch(t.msg_type){case 0:this._onRequest(t.piece);break;case 1:this._onData(t.piece,n,t.total_size);break;case 2:this._onReject(t.piece)}}fetch(){this._metadataComplete||(this._fetching=!0,this._metadataSize&&this._requestPieces())}cancel(){this._fetching=!1}setMetadata(e){if(this._metadataComplete)return!0;o("set metadata");try{const t=r.decode(e).info;t&&(e=r.encode(t))}catch(e){}return(!this._infoHash||this._infoHash===a.sync(e))&&(this.cancel(),this.metadata=e,this._metadataComplete=!0,this._metadataSize=this.metadata.length,this._wire.extendedHandshake.metadata_size=this._metadataSize,this.emit("metadata",r.encode({info:r.decode(this.metadata)})),!0)}_send(e,t){let i=r.encode(e);n.isBuffer(t)&&(i=n.concat([i,t])),this._wire.extended("ut_metadata",i)}_request(e){this._send({msg_type:0,piece:e})}_data(e,t,n){const i={msg_type:1,piece:e};"number"==typeof n&&(i.total_size=n),this._send(i,t)}_reject(e){this._send({msg_type:2,piece:e})}_onRequest(e){if(!this._metadataComplete)return void this._reject(e);const t=e*c;let n=t+c;n>this._metadataSize&&(n=this._metadataSize);const i=this.metadata.slice(t,n);this._data(e,i,this._metadataSize)}_onData(e,t,n){t.length>c||!this._fetching||(t.copy(this.metadata,e*c),this._bitfield.set(e),this._checkDone())}_onReject(e){this._remainingRejects>0&&this._fetching?(this._request(e),this._remainingRejects-=1):this.emit("warning",new Error('Peer sent "reject" too much'))}_requestPieces(){if(this._fetching){this.metadata=n.alloc(this._metadataSize);for(let e=0;e<this._numPieces;e++)this._request(e)}}_checkDone(){let e=!0;for(let t=0;t<this._numPieces;t++)if(!this._bitfield.get(t)){e=!1;break}if(!e)return;this.setMetadata(this.metadata)||this._failedMetadata()}_failedMetadata(){this._bitfield=new s(0,{grow:1e3}),this._remainingRejects-=this._numPieces,this._remainingRejects>0?this._requestPieces():this.emit("warning",new Error("Peer sent invalid metadata"))}}return t.prototype.name="ut_metadata",t}}).call(this)}).call(this,e("buffer").Buffer)},{bencode:22,bitfield:25,buffer:114,debug:482,events:194,"simple-sha1":407}],482:[function(e,t,n){arguments[4][27][0].apply(n,arguments)},{"./common":483,_process:333,dup:27}],483:[function(e,t,n){arguments[4][28][0].apply(n,arguments)},{dup:28,ms:484}],484:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{dup:29}],485:[function(e,t,n){(function(e){(function(){function n(t){try{if(!e.localStorage)return!1}catch(e){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(e,t){if(n("noDeprecation"))return e;var i=!1;return function(){if(!i){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],486:[function(e,t,n){(function(n){(function(){const i=e("binary-search"),r=e("events"),s=e("mp4-stream"),o=e("mp4-box-encoding"),a=e("range-slice-stream");class c{constructor(e,t){this._entries=e,this._countName=t||"count",this._index=0,this._offset=0,this.value=this._entries[0]}inc(){this._offset++,this._offset>=this._entries[this._index][this._countName]&&(this._index++,this._offset=0),this.value=this._entries[this._index]}}const u=1;t.exports=class extends r{constructor(e){super(),this._tracks=[],this._file=e,this._decoder=null,this._findMoov(0)}_findMoov(e){this._decoder&&this._decoder.destroy();let t=0;this._decoder=s.decode();const n=this._file.createReadStream({start:e});n.pipe(this._decoder);const i=r=>{"moov"===r.type?(this._decoder.removeListener("box",i),this._decoder.decode((e=>{n.destroy();try{this._processMoov(e)}catch(e){e.message=`Cannot parse mp4 file: ${e.message}`,this.emit("error",e)}}))):r.length<4096?(t+=r.length,this._decoder.ignore()):(this._decoder.removeListener("box",i),t+=r.length,n.destroy(),this._decoder.destroy(),this._findMoov(e+t))};this._decoder.on("box",i)}_procLine truncated
|
||||
const{EventEmitter:i}=e("events"),r=e("bencode"),s=e("bitfield").default,o=e("debug")("ut_metadata"),a=e("simple-sha1"),c=16384;t.exports=e=>{class t extends i{constructor(t){super(),this._wire=t,this._fetching=!1,this._metadataComplete=!1,this._metadataSize=null,this._remainingRejects=null,this._bitfield=new s(0,{grow:1e3}),n.isBuffer(e)&&this.setMetadata(e)}onHandshake(e,t,n){this._infoHash=e}onExtendedHandshake(e){return e.m&&e.m.ut_metadata?e.metadata_size?"number"!=typeof e.metadata_size||1e7<e.metadata_size||e.metadata_size<=0?this.emit("warning",new Error("Peer gave invalid metadata size")):(this._metadataSize=e.metadata_size,this._numPieces=Math.ceil(this._metadataSize/c),this._remainingRejects=2*this._numPieces,void this._requestPieces()):this.emit("warning",new Error("Peer does not have metadata")):this.emit("warning",new Error("Peer does not support ut_metadata"))}onMessage(e){let t,n;try{const i=e.toString(),s=i.indexOf("ee")+2;t=r.decode(i.substring(0,s)),n=e.slice(s)}catch(e){return}switch(t.msg_type){case 0:this._onRequest(t.piece);break;case 1:this._onData(t.piece,n,t.total_size);break;case 2:this._onReject(t.piece)}}fetch(){this._metadataComplete||(this._fetching=!0,this._metadataSize&&this._requestPieces())}cancel(){this._fetching=!1}setMetadata(e){if(this._metadataComplete)return!0;o("set metadata");try{const t=r.decode(e).info;t&&(e=r.encode(t))}catch(e){}return(!this._infoHash||this._infoHash===a.sync(e))&&(this.cancel(),this.metadata=e,this._metadataComplete=!0,this._metadataSize=this.metadata.length,this._wire.extendedHandshake.metadata_size=this._metadataSize,this.emit("metadata",r.encode({info:r.decode(this.metadata)})),!0)}_send(e,t){let i=r.encode(e);n.isBuffer(t)&&(i=n.concat([i,t])),this._wire.extended("ut_metadata",i)}_request(e){this._send({msg_type:0,piece:e})}_data(e,t,n){const i={msg_type:1,piece:e};"number"==typeof n&&(i.total_size=n),this._send(i,t)}_reject(e){this._send({msg_type:2,piece:e})}_onRequest(e){if(!this._metadataComplete)return void this._reject(e);const t=e*c;let n=t+c;n>this._metadataSize&&(n=this._metadataSize);const i=this.metadata.slice(t,n);this._data(e,i,this._metadataSize)}_onData(e,t,n){t.length>c||!this._fetching||(t.copy(this.metadata,e*c),this._bitfield.set(e),this._checkDone())}_onReject(e){this._remainingRejects>0&&this._fetching?(this._request(e),this._remainingRejects-=1):this.emit("warning",new Error('Peer sent "reject" too much'))}_requestPieces(){if(this._fetching){this.metadata=n.alloc(this._metadataSize);for(let e=0;e<this._numPieces;e++)this._request(e)}}_checkDone(){let e=!0;for(let t=0;t<this._numPieces;t++)if(!this._bitfield.get(t)){e=!1;break}if(!e)return;this.setMetadata(this.metadata)||this._failedMetadata()}_failedMetadata(){this._bitfield=new s(0,{grow:1e3}),this._remainingRejects-=this._numPieces,this._remainingRejects>0?this._requestPieces():this.emit("warning",new Error("Peer sent invalid metadata"))}}return t.prototype.name="ut_metadata",t}}).call(this)}).call(this,e("buffer").Buffer)},{bencode:23,bitfield:27,buffer:116,debug:497,events:196,"simple-sha1":417}],497:[function(e,t,n){arguments[4][29][0].apply(n,arguments)},{"./common":498,_process:342,dup:29}],498:[function(e,t,n){arguments[4][30][0].apply(n,arguments)},{dup:30,ms:499}],499:[function(e,t,n){arguments[4][31][0].apply(n,arguments)},{dup:31}],500:[function(e,t,n){(function(e){(function(){function n(t){try{if(!e.localStorage)return!1}catch(e){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(e,t){if(n("noDeprecation"))return e;var i=!1;return function(){if(!i){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],501:[function(e,t,n){(function(n){(function(){const i=e("binary-search"),r=e("events"),s=e("mp4-stream"),o=e("mp4-box-encoding"),a=e("range-slice-stream");class c{constructor(e,t){this._entries=e,this._countName=t||"count",this._index=0,this._offset=0,this.value=this._entries[0]}inc(){this._offset++,this._offset>=this._entries[this._index][this._countName]&&(this._index++,this._offset=0),this.value=this._entries[this._index]}}const u=1;t.exports=class extends r{constructor(e){super(),this._tracks=[],this._file=e,this._decoder=null,this._findMoov(0)}_findMoov(e){this._decoder&&this._decoder.destroy();let t=0;this._decoder=s.decode();const n=this._file.createReadStream({start:e});n.pipe(this._decoder);const i=r=>{"moov"===r.type?(this._decoder.removeListener("box",i),this._decoder.decode((e=>{n.destroy();try{this._processMoov(e)}catch(e){e.message=`Cannot parse mp4 file: ${e.message}`,this.emit("error",e)}}))):r.length<4096?(t+=r.length,this._decoder.ignore()):(this._decoder.removeListener("box",i),t+=r.length,n.destroy(),this._decoder.destroy(),this._findMoov(e+t))};this._decoder.on("box",i)}_procLine truncated
|
||||
/*! webtorrent. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */
|
||||
const{EventEmitter:r}=e("events"),s=e("simple-concat"),o=e("create-torrent"),a=e("debug")("webtorrent"),c=e("bittorrent-dht/client"),u=e("load-ip-set"),l=e("run-parallel"),d=e("parse-torrent"),f=e("path"),p=e("simple-peer"),h=e("randombytes"),m=e("speedometer"),b=e("queue-microtask"),g=e("./lib/conn-pool"),v=e("./lib/torrent"),y=e("./package.json").version,_=y.replace(/\d*./g,(e=>("0"+e%100).slice(-2))).slice(0,4),w=`-WW${_}-`;class x extends r{constructor(e={}){super(),"string"==typeof e.peerId?this.peerId=e.peerId:i.isBuffer(e.peerId)?this.peerId=e.peerId.toString("hex"):this.peerId=i.from(w+h(9).toString("base64")).toString("hex"),this.peerIdBuffer=i.from(this.peerId,"hex"),"string"==typeof e.nodeId?this.nodeId=e.nodeId:i.isBuffer(e.nodeId)?this.nodeId=e.nodeId.toString("hex"):this.nodeId=h(20).toString("hex"),this.nodeIdBuffer=i.from(this.nodeId,"hex"),this._debugId=this.peerId.toString("hex").substring(0,7),this.destroyed=!1,this.listening=!1,this.torrentPort=e.torrentPort||0,this.dhtPort=e.dhtPort||0,this.tracker=void 0!==e.tracker?e.tracker:{},this.lsd=!1!==e.lsd,this.torrents=[],this.maxConns=Number(e.maxConns)||55,this.utp=x.UTP_SUPPORT&&!1!==e.utp,this._debug("new webtorrent (peerId %s, nodeId %s, port %s)",this.peerId,this.nodeId,this.torrentPort),this.tracker&&("object"!=typeof this.tracker&&(this.tracker={}),n.WRTC&&!this.tracker.wrtc&&(this.tracker.wrtc=n.WRTC)),"function"==typeof g?this._connPool=new g(this):b((()=>{this._onListening()})),this._downloadSpeed=m(),this._uploadSpeed=m(),!1!==e.dht&&"function"==typeof c?(this.dht=new c(Object.assign({},{nodeId:this.nodeId},e.dht)),this.dht.once("error",(e=>{this._destroy(e)})),this.dht.once("listening",(()=>{const e=this.dht.address();e&&(this.dhtPort=e.port)})),this.dht.setMaxListeners(0),this.dht.listen(this.dhtPort)):this.dht=!1,this.enableWebSeeds=!1!==e.webSeeds;const t=()=>{this.destroyed||(this.ready=!0,this.emit("ready"))};"function"==typeof u&&null!=e.blocklist?u(e.blocklist,{headers:{"user-agent":`WebTorrent/${y} (https://webtorrent.io)`}},((e,n)=>{if(e)return this.error(`Failed to load blocklist: ${e.message}`);this.blocked=n,t()})):b(t)}get downloadSpeed(){return this._downloadSpeed()}get uploadSpeed(){return this._uploadSpeed()}get progress(){const e=this.torrents.filter((e=>1!==e.progress));return e.reduce(((e,t)=>e+t.downloaded),0)/(e.reduce(((e,t)=>e+(t.length||0)),0)||1)}get ratio(){return this.torrents.reduce(((e,t)=>e+t.uploaded),0)/(this.torrents.reduce(((e,t)=>e+t.received),0)||1)}get(e){if(e instanceof v){if(this.torrents.includes(e))return e}else{let t;try{t=d(e)}catch(e){}if(!t)return null;if(!t.infoHash)throw new Error("Invalid torrent identifier");for(const e of this.torrents)if(e.infoHash===t.infoHash)return e}return null}add(e,t={},n=(()=>{})){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,n]=[{},t]);const i=()=>{if(!this.destroyed)for(const e of this.torrents)if(e.infoHash===s.infoHash&&e!==s)return void s._destroy(new Error(`Cannot add duplicate torrent ${s.infoHash}`))},r=()=>{this.destroyed||(n(s),this.emit("torrent",s))};this._debug("add"),t=t?Object.assign({},t):{};const s=new v(e,this,t);return this.torrents.push(s),s.once("_infoHash",i),s.once("ready",r),s.once("close",(function e(){s.removeListener("_infoHash",i),s.removeListener("ready",r),s.removeListener("close",e)})),s}seed(e,t,n){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,n]=[{},t]),this._debug("seed"),(t=t?Object.assign({},t):{}).skipVerify=!0;const i="string"==typeof e;i&&(t.path=f.dirname(e)),t.createdBy||(t.createdBy=`WebTorrent/${_}`);const r=e=>{this._debug("on seed"),"function"==typeof n&&n(e),e.emit("seed"),this.emit("seed",e)},a=this.add(null,t,(e=>{const n=[n=>{if(i||t.preloadedStore)return n();e.load(c,n)}];this.dht&&n.push((t=>{e.once("dhtAnnounce",t)})),l(n,(t=>{if(!this.destroyed)return t?e._destroy(t):void r(e)}))}));let c;var u;return u=e,"undefined"!=typeof FileList&&u instanceof FileList?e=Array.from(e):Array.isArray(e)||(e=[e]),l(e.map((e=>n=>{!t.preloadedStore&&function(e){return"object"==typeof e&&null!=e&&"function"==typeof e.pipe}(e)?s(e,((t,i)=>{if(t)return n(t);i.name=e.name,n(null,i)})):n(null,e)})),((e,n)=>{if(!this.destroyed)return e?a._destroy(e):void o.parseInput(n,t,((e,i)=>{if(!this.destroyed){if(e)return a._destroy(e);c=i.map((e=>e.getStream)),o(n,t,((e,t)=>{if(this.destroyed)return;if(e)return a._destroy(e);const n=this.get(t);n?a._destroy(new Error(`Cannot add duplicate torrent ${n.infoHash}`)):a._onTorrentId(t)}))}}))})),a}remove(e,t,n){if("function"==typeof t)return this.remove(e,null,t);this._debug("remove");if(!this.get(e))throw new Error(`No torrent with id ${e}`);this._remove(e,t,n)}_remove(e,t,n){if("function"==typeof t)return this._remove(e,null,t);const i=this.get(e);i&&(this.torrents.splice(this.torrents.indexOf(i),1),i.destroy(t,n))}address(){return this.listening?this._connPool?this._connPool.tcpServer.address():{address:"0.0.0.0",faLine truncated
|
||||
const{EventEmitter:i}=e("events"),r=e("simple-concat"),s=e("create-torrent"),o=e("debug")("webtorrent"),a=e("bittorrent-dht/client"),c=e("load-ip-set"),u=e("run-parallel"),l=e("parse-torrent"),d=e("path"),f=e("simple-peer"),p=e("queue-microtask"),h=e("randombytes"),m=e("speedometer"),{ThrottleGroup:b}=e("speed-limiter"),g=e("./lib/conn-pool"),v=e("./lib/torrent"),y=e("./package.json").version,_=y.replace(/\d*./g,(e=>("0"+e%100).slice(-2))).slice(0,4),w=`-WW${_}-`;class x extends i{constructor(e={}){super(),"string"==typeof e.peerId?this.peerId=e.peerId:n.isBuffer(e.peerId)?this.peerId=e.peerId.toString("hex"):this.peerId=n.from(w+h(9).toString("base64")).toString("hex"),this.peerIdBuffer=n.from(this.peerId,"hex"),"string"==typeof e.nodeId?this.nodeId=e.nodeId:n.isBuffer(e.nodeId)?this.nodeId=e.nodeId.toString("hex"):this.nodeId=h(20).toString("hex"),this.nodeIdBuffer=n.from(this.nodeId,"hex"),this._debugId=this.peerId.toString("hex").substring(0,7),this.destroyed=!1,this.listening=!1,this.torrentPort=e.torrentPort||0,this.dhtPort=e.dhtPort||0,this.tracker=void 0!==e.tracker?e.tracker:{},this.lsd=!1!==e.lsd,this.torrents=[],this.maxConns=Number(e.maxConns)||55,this.utp=x.UTP_SUPPORT&&!1!==e.utp,this._downloadLimit=Math.max("number"==typeof e.downloadLimit?e.downloadLimit:-1,-1),this._uploadLimit=Math.max("number"==typeof e.uploadLimit?e.uploadLimit:-1,-1),this._debug("new webtorrent (peerId %s, nodeId %s, port %s)",this.peerId,this.nodeId,this.torrentPort),this.throttleGroups={down:new b({rate:Math.max(this._downloadLimit,0),enabled:this._downloadLimit>=0}),up:new b({rate:Math.max(this._uploadLimit,0),enabled:this._uploadLimit>=0})},this.tracker&&("object"!=typeof this.tracker&&(this.tracker={}),globalThis.WRTC&&!this.tracker.wrtc&&(this.tracker.wrtc=globalThis.WRTC)),"function"==typeof g?this._connPool=new g(this):p((()=>{this._onListening()})),this._downloadSpeed=m(),this._uploadSpeed=m(),!1!==e.dht&&"function"==typeof a?(this.dht=new a(Object.assign({},{nodeId:this.nodeId},e.dht)),this.dht.once("error",(e=>{this._destroy(e)})),this.dht.once("listening",(()=>{const e=this.dht.address();e&&(this.dhtPort=e.port)})),this.dht.setMaxListeners(0),this.dht.listen(this.dhtPort)):this.dht=!1,this.enableWebSeeds=!1!==e.webSeeds;const t=()=>{this.destroyed||(this.ready=!0,this.emit("ready"))};"function"==typeof c&&null!=e.blocklist?c(e.blocklist,{headers:{"user-agent":`WebTorrent/${y} (https://webtorrent.io)`}},((e,n)=>{if(e)return console.error(`Failed to load blocklist: ${e.message}`);this.blocked=n,t()})):p(t)}get downloadSpeed(){return this._downloadSpeed()}get uploadSpeed(){return this._uploadSpeed()}get progress(){const e=this.torrents.filter((e=>1!==e.progress));return e.reduce(((e,t)=>e+t.downloaded),0)/(e.reduce(((e,t)=>e+(t.length||0)),0)||1)}get ratio(){return this.torrents.reduce(((e,t)=>e+t.uploaded),0)/(this.torrents.reduce(((e,t)=>e+t.received),0)||1)}get(e){if(e instanceof v){if(this.torrents.includes(e))return e}else{let t;try{t=l(e)}catch(e){}if(!t)return null;if(!t.infoHash)throw new Error("Invalid torrent identifier");for(const e of this.torrents)if(e.infoHash===t.infoHash)return e}return null}add(e,t={},n=(()=>{})){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,n]=[{},t]);const i=()=>{if(!this.destroyed)for(const e of this.torrents)if(e.infoHash===s.infoHash&&e!==s)return void s._destroy(new Error(`Cannot add duplicate torrent ${s.infoHash}`))},r=()=>{this.destroyed||(n(s),this.emit("torrent",s))};this._debug("add"),t=t?Object.assign({},t):{};const s=new v(e,this,t);return this.torrents.push(s),s.once("_infoHash",i),s.once("ready",r),s.once("close",(function e(){s.removeListener("_infoHash",i),s.removeListener("ready",r),s.removeListener("close",e)})),s}seed(e,t,n){if(this.destroyed)throw new Error("client is destroyed");"function"==typeof t&&([t,n]=[{},t]),this._debug("seed"),(t=t?Object.assign({},t):{}).skipVerify=!0;const i="string"==typeof e;i&&(t.path=d.dirname(e)),t.createdBy||(t.createdBy=`WebTorrent/${_}`);const o=e=>{this._debug("on seed"),"function"==typeof n&&n(e),e.emit("seed"),this.emit("seed",e)},a=this.add(null,t,(e=>{const n=[n=>{if(i||t.preloadedStore)return n();e.load(c,n)}];this.dht&&n.push((t=>{e.once("dhtAnnounce",t)})),u(n,(t=>{if(!this.destroyed)return t?e._destroy(t):void o(e)}))}));let c;var l;return l=e,"undefined"!=typeof FileList&&l instanceof FileList?e=Array.from(e):Array.isArray(e)||(e=[e]),u(e.map((e=>n=>{!t.preloadedStore&&function(e){return"object"==typeof e&&null!=e&&"function"==typeof e.pipe}(e)?r(e,((t,i)=>{if(t)return n(t);i.name=e.name,n(null,i)})):n(null,e)})),((e,n)=>{if(!this.destroyed)return e?a._destroy(e):void s.parseInput(n,t,((e,i)=>{if(!this.destroyed){if(e)return a._destroy(e);c=i.map((e=>e.getStream)),s(n,t,((e,t)=>{if(this.destroyed)return;if(e)return a._destroy(e);const n=this.get(t);n?a._destroy(new Error(`Cannot add duplicate torrent ${n.infoHash}`)):a._onTorrentId(t)}))}}))})),a}remove(e,t,n){if("function"Line truncated
|
||||
+1
-1
@@ -449,7 +449,7 @@ async function addCurrentTrackers() {
|
||||
addTrackers.className = 'disabled';
|
||||
addTrackers.innerHTML = 'Adding...';
|
||||
try {
|
||||
let response = await fetch("https://newtrackon.com/api/100"); // get trackers with 100% uptime
|
||||
let response = await fetch("https://newtrackon.com/api/stable"); // get trackers with 95% uptime
|
||||
let trackers = await response.text();
|
||||
parsed.announce = parsed.announce.concat(trackers.split('\n\n'));
|
||||
parsed.announce.push("http://bt1.archive.org:6969/announce");
|
||||
|
||||
Reference in new issue
Block a user