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,mBAAqB,SAAK,QAAQ,WAA0B8V,EAAQvW,UAAW,QAErFS,IAAiB8V,EAAQ9V,aAC3B,OAAO8V,EAIX,OAAO,IACT,EAGF2rB,GAAWjd,eAAiB,iBAC5Bid,GAAWG,YAAc,cACzBH,GAAW5N,QAAU,E","sources":["webpack://webtorrent/webpack/runtime/create fake namespace object","webpack://webtorrent/./node_modules/base64-js/index.js","webpack://webtorrent/./node_modules/block-iterator/index.js","webpack://webtorrent/./node_modules/buffer/index.js","webpack://webtorrent/./node_modules/cache-chunk-store/index.js","webpack://webtorrent/./node_modules/clone/clone.js","webpack://webtorrent/./node_modules/cpus/browser.js","webpack://webtorrent/./node_modules/debug/src/browser.js","webpack://webtorrent/./node_modules/debug/src/common.js","webpack://webtorrent/./node_modules/end-of-stream/index.js","webpack://webtorrent/./node_modules/err-code/index.js","webpack://webtorrent/./node_modules/escape-html/index.js","webpack://webtorrent/./node_modules/events/events.js","webpack://webtorrent/./node_modules/fast-fifo/fixed-size.js","webpack://webtorrent/./node_modules/fast-fifo/index.js","webpack://webtorrent/./node_modules/fast-readable-async-iterator/index.js","webpack://webtorrent/./node_modules/get-browser-rtc/index.js","webpack://webtorrent/./node_modules/idb-chunk-store/index.js","webpack://webtorrent/./node_modules/idb/build/esm/wrap-idb-value.js","webpack://webtorrent/./node_modules/idb/build/esm/index.js","webpack://webtorrent/./node_modules/ieee754/index.js","webpack://webtorrent/./node_modules/immediate-chunk-store/index.js","webpack://webtorrent/./node_modules/inherits/inherits_browser.js","webpack://webtorrent/./node_modules/join-async-iterator/index.js","webpack://webtorrent/./node_modules/junk/index.js","webpack://webtorrent/./node_modules/limiter/index.js","webpack://webtorrent/./node_modules/limiter/lib/clock.js","webpack://webtorrent/./node_modules/limiter/lib/rateLimiter.js","webpack://webtorrent/./node_modules/limiter/lib/tokenBucket.js","webpack://webtorrent/./node_modules/lru/index.js","webpack://webtorrent/./node_modules/lt_donthave/index.js","webpack://webtorrent/./node_modules/memory-chunk-store/index.js","webpack://webtorrent/./node_modules/mime/Mime.js","webpack://webtorrent/./node_modules/mime/lite.js","webpack://webtorrent/./node_modules/mime/types/standard.js","webpack://webtorrent/./node_modules/ms/index.js","webpack://webtorrent/./node_modules/once/once.js","webpack://webtorrent/./node_modules/path-browserify/index.js","webpack://webtorrent/./node_modules/piece-length/index.js","webpack://webtorrent/./node_modules/pump/index.js","webpack://webtorrent/./node_modules/queue-microtask/index.js","webpack://webtorrent/./node_modules/queue-tick/queue-microtask.js","webpack://webtorrent/./node_modules/random-iterate/index.js","webpack://webtorrent/./node_modules/range-parser/index.js","webpack://webtorrent/./node_modules/rc4/rc4.js","webpack://webtorrent/./node_modules/run-parallel-limit/index.js","webpack://webtorrent/./node_modules/run-parallel/index.js","webpack://webtorrent/./node_modules/speed-limiter/index.js","webpack://webtorrent/./node_modules/speed-limiter/lib/throttle-group.js","webpack://webtorrent/./node_modules/speed-limiter/lib/throttle.js","webpack://webtorrent/./node_modules/speed-limiter/lib/utils.js","webpack://webtorrent/./node_modules/streamx/index.js","webpack://webtorrent/./node_modules/thirty-two/lib/thirty-two/index.js","webpack://webtorrent/./node_modules/thirty-two/lib/thirty-two/thirty-two.js","webpack://webtorrent/./node_modules/throughput/index.js","webpack://webtorrent/./node_modules/torrent-piece/index.js","webpack://webtorrent/./node_modules/unordered-array-remove/index.js","webpack://webtorrent/./node_modules/wrappy/wrappy.js","webpack://webtorrent/./lib/peer.js","webpack://webtorrent/./node_modules/bencode/lib/util.js","webpack://webtorrent/./node_modules/bencode/lib/encode.js","webpack://webtorrent/./node_modules/bencode/lib/decode.js","webpack://webtorrent/./node_modules/bencode/lib/encoding-length.js","webpack://webtorrent/./node_modules/bencode/index.js","webpack://webtorrent/./node_modules/bitfield/lib/esm/index.js","webpack://webtorrent/./node_modules/bittorrent-protocol/index.js","webpack://webtorrent/./node_modules/uint8-util/util.js","webpack://webtorrent/./node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js","webpack://webtorrent/./node_modules/uint8-util/browser.js","webpack://webtorrent/./polyfills/process-fast.js","webpack://webtorrent/webpack/bootstrap","webpack://webtorrent/webpack/runtime/define property getters","webpack://webtorrent/webpack/runtime/hasOwnProperty shorthand","webpack://webtorrent/webpack/runtime/make namespace object","webpack://webtorrent/./node_modules/create-torrent/index.js","webpack://webtorrent/./node_modules/cross-fetch-ponyfill/browser.js","webpack://webtorrent/./node_modules/bep53-range/index.js","webpack://webtorrent/./node_modules/magnet-uri/index.js","webpack://webtorrent/./node_modules/parse-torrent/index.js","webpack://webtorrent/./node_modules/@thaunknown/simple-peer/index.js","webpack://webtorrent/./node_modules/addr-to-ip-port/index.js","webpack://webtorrent/./node_modules/chunk-store-iterator/index.js","webpack://webtorrent/./node_modules/bittorrent-tracker/lib/common.js","webpack://webtorrent/./node_modules/@thaunknown/simple-websocket/index.js","webpack://webtorrent/./node_modules/bittorrent-tracker/lib/client/tracker.js","webpack://webtorrent/./node_modules/bittorrent-tracker/lib/client/websocket-tracker.js","webpack://webtorrent/./node_modules/bittorrent-tracker/client.js","webpack://webtorrent/./node_modules/torrent-discovery/index.js","webpack://webtorrent/./node_modules/fsa-chunk-store/index.js","webpack://webtorrent/./node_modules/hybrid-chunk-store/index.js","webpack://webtorrent/./node_modules/ut_metadata/index.js","webpack://webtorrent/./lib/file-iterator.js","webpack://webtorrent/./lib/file.js","webpack://webtorrent/./lib/rarity-map.js","webpack://webtorrent/./lib/webconn.js","webpack://webtorrent/./lib/torrent.js","webpack://webtorrent/./lib/server.js","webpack://webtorrent/./index.js"],"sourcesContent":["var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));\n\t}\n\tdef['default'] = () => (value);\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","function concat (chunks, size) {\r\n if (typeof chunks[0] === 'string') return chunks.join('')\r\n if (typeof chunks[0] === 'number') return new Uint8Array(chunks)\r\n const b = new Uint8Array(size)\r\n let offset = 0\r\n for (let i = 0, l = chunks.length; i < l; i++) {\r\n const chunk = chunks[i]\r\n b.set(chunk, offset)\r\n offset += chunk.byteLength || chunk.length\r\n }\r\n\r\n return b\r\n}\r\n\r\nmodule.exports = async function * (iterator, size = 512, opts = {}) {\r\n if (typeof size === 'object') {\r\n opts = size\r\n size = opts.size\r\n }\r\n let { nopad, zeroPadding = true } = opts\r\n\r\n if (nopad) zeroPadding = false\r\n\r\n let buffered = []\r\n let bufferedBytes = 0\r\n\r\n for await (const value of iterator) {\r\n bufferedBytes += value.byteLength || value.length || 1\r\n buffered.push(value)\r\n\r\n if (bufferedBytes >= size) {\r\n const b = concat(buffered, bufferedBytes)\r\n let offset = 0\r\n\r\n while (bufferedBytes >= size) {\r\n yield b.slice(offset, offset + size)\r\n bufferedBytes -= size\r\n offset += size\r\n }\r\n\r\n buffered = [b.slice(offset, b.length)]\r\n }\r\n }\r\n if (bufferedBytes) yield concat(buffered, zeroPadding ? size : bufferedBytes)\r\n}\r\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh <https://feross.org>\n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nconst base64 = require('base64-js')\nconst ieee754 = require('ieee754')\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return '<Buffer ' + str + '>'\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n","/*! cache-chunk-store. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */\nconst LRU = require('lru')\nconst queueMicrotask = require('queue-microtask')\n\nclass CacheStore {\n constructor (store, opts) {\n this.store = store\n this.chunkLength = store.chunkLength\n this.inProgressGets = new Map() // Map from chunk index to info on callbacks waiting for that chunk\n\n if (!this.store || !this.store.get || !this.store.put) {\n throw new Error('First argument must be abstract-chunk-store compliant')\n }\n\n this.cache = new LRU(opts)\n }\n\n put (index, buf, cb = () => {}) {\n if (!this.cache) {\n return queueMicrotask(() => cb(new Error('CacheStore closed')))\n }\n\n this.cache.remove(index)\n this.store.put(index, buf, cb)\n }\n\n get (index, opts, cb = () => {}) {\n if (typeof opts === 'function') return this.get(index, null, opts)\n\n if (!this.cache) {\n return queueMicrotask(() => cb(new Error('CacheStore closed')))\n }\n\n if (!opts) opts = {}\n\n let buf = this.cache.get(index)\n if (buf) {\n const offset = opts.offset || 0\n const len = opts.length || (buf.length - offset)\n if (offset !== 0 || len !== buf.length) {\n buf = buf.slice(offset, len + offset)\n }\n return queueMicrotask(() => cb(null, buf))\n }\n\n // See if a get for this index has already started\n let waiters = this.inProgressGets.get(index)\n const getAlreadyStarted = !!waiters\n if (!waiters) {\n waiters = []\n this.inProgressGets.set(index, waiters)\n }\n\n waiters.push({\n opts,\n cb\n })\n\n if (!getAlreadyStarted) {\n this.store.get(index, (err, buf) => {\n if (!err && this.cache != null) this.cache.set(index, buf)\n\n const inProgressEntry = this.inProgressGets.get(index)\n this.inProgressGets.delete(index)\n\n for (const { opts, cb } of inProgressEntry) {\n if (err) {\n cb(err)\n } else {\n const offset = opts.offset || 0\n const len = opts.length || (buf.length - offset)\n let slicedBuf = buf\n if (offset !== 0 || len !== buf.length) {\n slicedBuf = buf.slice(offset, len + offset)\n }\n cb(null, slicedBuf)\n }\n }\n })\n }\n }\n\n close (cb = () => {}) {\n if (!this.cache) {\n return queueMicrotask(() => cb(new Error('CacheStore closed')))\n }\n\n this.cache = null\n this.store.close(cb)\n }\n\n destroy (cb = () => {}) {\n if (!this.cache) {\n return queueMicrotask(() => cb(new Error('CacheStore closed')))\n }\n\n this.cache = null\n this.store.destroy(cb)\n }\n}\n\nmodule.exports = CacheStore\n","var clone = (function() {\n'use strict';\n\nfunction _instanceof(obj, type) {\n return type != null && obj instanceof type;\n}\n\nvar nativeMap;\ntry {\n nativeMap = Map;\n} catch(_) {\n // maybe a reference error because no `Map`. Give it a dummy value that no\n // value will ever be an instanceof.\n nativeMap = function() {};\n}\n\nvar nativeSet;\ntry {\n nativeSet = Set;\n} catch(_) {\n nativeSet = function() {};\n}\n\nvar nativePromise;\ntry {\n nativePromise = Promise;\n} catch(_) {\n nativePromise = function() {};\n}\n\n/**\n * Clones (copies) an Object using deep copying.\n *\n * This function supports circular references by default, but if you are certain\n * there are no circular references in your object, you can save some CPU time\n * by calling clone(obj, false).\n *\n * Caution: if `circular` is false and `parent` contains circular references,\n * your program may enter an infinite loop and crash.\n *\n * @param `parent` - the object to be cloned\n * @param `circular` - set to true if the object to be cloned may contain\n * circular references. (optional - true by default)\n * @param `depth` - set to a number if the object is only to be cloned to\n * a particular depth. (optional - defaults to Infinity)\n * @param `prototype` - sets the prototype to be used when cloning an object.\n * (optional - defaults to parent prototype).\n * @param `includeNonEnumerable` - set to true if the non-enumerable properties\n * should be cloned as well. Non-enumerable properties on the prototype\n * chain will be ignored. (optional - false by default)\n*/\nfunction clone(parent, circular, depth, prototype, includeNonEnumerable) {\n if (typeof circular === 'object') {\n depth = circular.depth;\n prototype = circular.prototype;\n includeNonEnumerable = circular.includeNonEnumerable;\n circular = circular.circular;\n }\n // maintain two arrays for circular references, where corresponding parents\n // and children have the same index\n var allParents = [];\n var allChildren = [];\n\n var useBuffer = typeof Buffer != 'undefined';\n\n if (typeof circular == 'undefined')\n circular = true;\n\n if (typeof depth == 'undefined')\n depth = Infinity;\n\n // recurse this function so we don't reset allParents and allChildren\n function _clone(parent, depth) {\n // cloning null always returns null\n if (parent === null)\n return null;\n\n if (depth === 0)\n return parent;\n\n var child;\n var proto;\n if (typeof parent != 'object') {\n return parent;\n }\n\n if (_instanceof(parent, nativeMap)) {\n child = new nativeMap();\n } else if (_instanceof(parent, nativeSet)) {\n child = new nativeSet();\n } else if (_instanceof(parent, nativePromise)) {\n child = new nativePromise(function (resolve, reject) {\n parent.then(function(value) {\n resolve(_clone(value, depth - 1));\n }, function(err) {\n reject(_clone(err, depth - 1));\n });\n });\n } else if (clone.__isArray(parent)) {\n child = [];\n } else if (clone.__isRegExp(parent)) {\n child = new RegExp(parent.source, __getRegExpFlags(parent));\n if (parent.lastIndex) child.lastIndex = parent.lastIndex;\n } else if (clone.__isDate(parent)) {\n child = new Date(parent.getTime());\n } else if (useBuffer && Buffer.isBuffer(parent)) {\n if (Buffer.allocUnsafe) {\n // Node.js >= 4.5.0\n child = Buffer.allocUnsafe(parent.length);\n } else {\n // Older Node.js versions\n child = new Buffer(parent.length);\n }\n parent.copy(child);\n return child;\n } else if (_instanceof(parent, Error)) {\n child = Object.create(parent);\n } else {\n if (typeof prototype == 'undefined') {\n proto = Object.getPrototypeOf(parent);\n child = Object.create(proto);\n }\n else {\n child = Object.create(prototype);\n proto = prototype;\n }\n }\n\n if (circular) {\n var index = allParents.indexOf(parent);\n\n if (index != -1) {\n return allChildren[index];\n }\n allParents.push(parent);\n allChildren.push(child);\n }\n\n if (_instanceof(parent, nativeMap)) {\n parent.forEach(function(value, key) {\n var keyChild = _clone(key, depth - 1);\n var valueChild = _clone(value, depth - 1);\n child.set(keyChild, valueChild);\n });\n }\n if (_instanceof(parent, nativeSet)) {\n parent.forEach(function(value) {\n var entryChild = _clone(value, depth - 1);\n child.add(entryChild);\n });\n }\n\n for (var i in parent) {\n var attrs;\n if (proto) {\n attrs = Object.getOwnPropertyDescriptor(proto, i);\n }\n\n if (attrs && attrs.set == null) {\n continue;\n }\n child[i] = _clone(parent[i], depth - 1);\n }\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(parent);\n for (var i = 0; i < symbols.length; i++) {\n // Don't need to worry about cloning a symbol because it is a primitive,\n // like a number or string.\n var symbol = symbols[i];\n var descriptor = Object.getOwnPropertyDescriptor(parent, symbol);\n if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {\n continue;\n }\n child[symbol] = _clone(parent[symbol], depth - 1);\n if (!descriptor.enumerable) {\n Object.defineProperty(child, symbol, {\n enumerable: false\n });\n }\n }\n }\n\n if (includeNonEnumerable) {\n var allPropertyNames = Object.getOwnPropertyNames(parent);\n for (var i = 0; i < allPropertyNames.length; i++) {\n var propertyName = allPropertyNames[i];\n var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName);\n if (descriptor && descriptor.enumerable) {\n continue;\n }\n child[propertyName] = _clone(parent[propertyName], depth - 1);\n Object.defineProperty(child, propertyName, {\n enumerable: false\n });\n }\n }\n\n return child;\n }\n\n return _clone(parent, depth);\n}\n\n/**\n * Simple flat clone using prototype, accepts only objects, usefull for property\n * override on FLAT configuration object (no nested props).\n *\n * USE WITH CAUTION! This may not behave as you wish if you do not know how this\n * works.\n */\nclone.clonePrototype = function clonePrototype(parent) {\n if (parent === null)\n return null;\n\n var c = function () {};\n c.prototype = parent;\n return new c();\n};\n\n// private utility functions\n\nfunction __objToStr(o) {\n return Object.prototype.toString.call(o);\n}\nclone.__objToStr = __objToStr;\n\nfunction __isDate(o) {\n return typeof o === 'object' && __objToStr(o) === '[object Date]';\n}\nclone.__isDate = __isDate;\n\nfunction __isArray(o) {\n return typeof o === 'object' && __objToStr(o) === '[object Array]';\n}\nclone.__isArray = __isArray;\n\nfunction __isRegExp(o) {\n return typeof o === 'object' && __objToStr(o) === '[object RegExp]';\n}\nclone.__isRegExp = __isRegExp;\n\nfunction __getRegExpFlags(re) {\n var flags = '';\n if (re.global) flags += 'g';\n if (re.ignoreCase) flags += 'i';\n if (re.multiline) flags += 'm';\n return flags;\n}\nclone.__getRegExpFlags = __getRegExpFlags;\n\nreturn clone;\n})();\n\nif (typeof module === 'object' && module.exports) {\n module.exports = clone;\n}\n","module.exports = function cpus () {\n var num = navigator.hardwareConcurrency || 1\n var cpus = []\n for (var i = 0; i < num; i++) {\n cpus.push({\n model: '',\n speed: 0,\n times: { user: 0, nice: 0, sys: 0, idle: 0, irq: 0 }\n })\n }\n return cpus\n}\n","/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug');\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\t\tlet namespacesCache;\n\t\tlet enabledCache;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => {\n\t\t\t\tif (enableOverride !== null) {\n\t\t\t\t\treturn enableOverride;\n\t\t\t\t}\n\t\t\t\tif (namespacesCache !== createDebug.namespaces) {\n\t\t\t\t\tnamespacesCache = createDebug.namespaces;\n\t\t\t\t\tenabledCache = createDebug.enabled(namespace);\n\t\t\t\t}\n\n\t\t\t\treturn enabledCache;\n\t\t\t},\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\t\tcreateDebug.namespaces = namespaces;\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tlet i;\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '').split(/[\\s,]+/);\n\t\tconst len = split.length;\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (!split[i]) {\n\t\t\t\t// ignore empty strings\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tnamespaces = split[i].replace(/\\*/g, '.*?');\n\n\t\t\tif (namespaces[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(new RegExp('^' + namespaces + '$'));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names.map(toNamespace),\n\t\t\t...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tif (name[name.length - 1] === '*') {\n\t\t\treturn true;\n\t\t}\n\n\t\tlet i;\n\t\tlet len;\n\n\t\tfor (i = 0, len = createDebug.skips.length; i < len; i++) {\n\t\t\tif (createDebug.skips[i].test(name)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0, len = createDebug.names.length; i < len; i++) {\n\t\t\tif (createDebug.names[i].test(name)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Convert regexp to namespace\n\t*\n\t* @param {RegExp} regxep\n\t* @return {String} namespace\n\t* @api private\n\t*/\n\tfunction toNamespace(regexp) {\n\t\treturn regexp.toString()\n\t\t\t.substring(2, regexp.toString().length - 2)\n\t\t\t.replace(/\\.\\*\\?$/, '*');\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n","var once = require('once');\n\nvar noop = function() {};\n\nvar isRequest = function(stream) {\n\treturn stream.setHeader && typeof stream.abort === 'function';\n};\n\nvar isChildProcess = function(stream) {\n\treturn stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3\n};\n\nvar eos = function(stream, opts, callback) {\n\tif (typeof opts === 'function') return eos(stream, null, opts);\n\tif (!opts) opts = {};\n\n\tcallback = once(callback || noop);\n\n\tvar ws = stream._writableState;\n\tvar rs = stream._readableState;\n\tvar readable = opts.readable || (opts.readable !== false && stream.readable);\n\tvar writable = opts.writable || (opts.writable !== false && stream.writable);\n\tvar cancelled = false;\n\n\tvar onlegacyfinish = function() {\n\t\tif (!stream.writable) onfinish();\n\t};\n\n\tvar onfinish = function() {\n\t\twritable = false;\n\t\tif (!readable) callback.call(stream);\n\t};\n\n\tvar onend = function() {\n\t\treadable = false;\n\t\tif (!writable) callback.call(stream);\n\t};\n\n\tvar onexit = function(exitCode) {\n\t\tcallback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null);\n\t};\n\n\tvar onerror = function(err) {\n\t\tcallback.call(stream, err);\n\t};\n\n\tvar onclose = function() {\n\t\tprocess.nextTick(onclosenexttick);\n\t};\n\n\tvar onclosenexttick = function() {\n\t\tif (cancelled) return;\n\t\tif (readable && !(rs && (rs.ended && !rs.destroyed))) return callback.call(stream, new Error('premature close'));\n\t\tif (writable && !(ws && (ws.ended && !ws.destroyed))) return callback.call(stream, new Error('premature close'));\n\t};\n\n\tvar onrequest = function() {\n\t\tstream.req.on('finish', onfinish);\n\t};\n\n\tif (isRequest(stream)) {\n\t\tstream.on('complete', onfinish);\n\t\tstream.on('abort', onclose);\n\t\tif (stream.req) onrequest();\n\t\telse stream.on('request', onrequest);\n\t} else if (writable && !ws) { // legacy streams\n\t\tstream.on('end', onlegacyfinish);\n\t\tstream.on('close', onlegacyfinish);\n\t}\n\n\tif (isChildProcess(stream)) stream.on('exit', onexit);\n\n\tstream.on('end', onend);\n\tstream.on('finish', onfinish);\n\tif (opts.error !== false) stream.on('error', onerror);\n\tstream.on('close', onclose);\n\n\treturn function() {\n\t\tcancelled = true;\n\t\tstream.removeListener('complete', onfinish);\n\t\tstream.removeListener('abort', onclose);\n\t\tstream.removeListener('request', onrequest);\n\t\tif (stream.req) stream.req.removeListener('finish', onfinish);\n\t\tstream.removeListener('end', onlegacyfinish);\n\t\tstream.removeListener('close', onlegacyfinish);\n\t\tstream.removeListener('finish', onfinish);\n\t\tstream.removeListener('exit', onexit);\n\t\tstream.removeListener('end', onend);\n\t\tstream.removeListener('error', onerror);\n\t\tstream.removeListener('close', onclose);\n\t};\n};\n\nmodule.exports = eos;\n","'use strict';\n\n/**\n * @typedef {{ [key: string]: any }} Extensions\n * @typedef {Error} Err\n * @property {string} message\n */\n\n/**\n *\n * @param {Error} obj\n * @param {Extensions} props\n * @returns {Error & Extensions}\n */\nfunction assign(obj, props) {\n for (const key in props) {\n Object.defineProperty(obj, key, {\n value: props[key],\n enumerable: true,\n configurable: true,\n });\n }\n\n return obj;\n}\n\n/**\n *\n * @param {any} err - An Error\n * @param {string|Extensions} code - A string code or props to set on the error\n * @param {Extensions} [props] - Props to set on the error\n * @returns {Error & Extensions}\n */\nfunction createError(err, code, props) {\n if (!err || typeof err === 'string') {\n throw new TypeError('Please pass an Error to err-code');\n }\n\n if (!props) {\n props = {};\n }\n\n if (typeof code === 'object') {\n props = code;\n code = '';\n }\n\n if (code) {\n props.code = code;\n }\n\n try {\n return assign(err, props);\n } catch (_) {\n props.message = err.message;\n props.stack = err.stack;\n\n const ErrClass = function () {};\n\n ErrClass.prototype = Object.create(Object.getPrototypeOf(err));\n\n // @ts-ignore\n const output = assign(new ErrClass(), props);\n\n return output;\n }\n}\n\nmodule.exports = createError;\n","/*!\n * escape-html\n * Copyright(c) 2012-2013 TJ Holowaychuk\n * Copyright(c) 2015 Andreas Lubbe\n * Copyright(c) 2015 Tiancheng \"Timothy\" Gu\n * MIT Licensed\n */\n\n'use strict';\n\n/**\n * Module variables.\n * @private\n */\n\nvar matchHtmlRegExp = /[\"'&<>]/;\n\n/**\n * Module exports.\n * @public\n */\n\nmodule.exports = escapeHtml;\n\n/**\n * Escape special characters in the given string of html.\n *\n * @param {string} string The string to escape for inserting into HTML\n * @return {string}\n * @public\n */\n\nfunction escapeHtml(string) {\n var str = '' + string;\n var match = matchHtmlRegExp.exec(str);\n\n if (!match) {\n return str;\n }\n\n var escape;\n var html = '';\n var index = 0;\n var lastIndex = 0;\n\n for (index = match.index; index < str.length; index++) {\n switch (str.charCodeAt(index)) {\n case 34: // \"\n escape = '"';\n break;\n case 38: // &\n escape = '&';\n break;\n case 39: // '\n escape = ''';\n break;\n case 60: // <\n escape = '<';\n break;\n case 62: // >\n escape = '>';\n break;\n default:\n continue;\n }\n\n if (lastIndex !== index) {\n html += str.substring(lastIndex, index);\n }\n\n lastIndex = index + 1;\n html += escape;\n }\n\n return lastIndex !== index\n ? html + str.substring(lastIndex, index)\n : html;\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nvar objectCreate = Object.create || objectCreatePolyfill\nvar objectKeys = Object.keys || objectKeysPolyfill\nvar bind = Function.prototype.bind || functionBindPolyfill\n\nfunction EventEmitter() {\n if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) {\n this._events = objectCreate(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n}\nmodule.exports = EventEmitter;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nvar hasDefineProperty;\ntry {\n var o = {};\n if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 });\n hasDefineProperty = o.x === 0;\n} catch (err) { hasDefineProperty = false }\nif (hasDefineProperty) {\n Object.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n // check whether the input is a positive number (whose value is zero or\n // greater and not a NaN).\n if (typeof arg !== 'number' || arg < 0 || arg !== arg)\n throw new TypeError('\"defaultMaxListeners\" must be a positive number');\n defaultMaxListeners = arg;\n }\n });\n} else {\n EventEmitter.defaultMaxListeners = defaultMaxListeners;\n}\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || isNaN(n))\n throw new TypeError('\"n\" argument must be a positive number');\n this._maxListeners = n;\n return this;\n};\n\nfunction $getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return $getMaxListeners(this);\n};\n\n// These standalone emit* functions are used to optimize calling of event\n// handlers for fast cases because emit() itself often has a variable number of\n// arguments and can be deoptimized because of that. These functions always have\n// the same number of arguments and thus do not get deoptimized, so the code\n// inside them can execute faster.\nfunction emitNone(handler, isFn, self) {\n if (isFn)\n handler.call(self);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self);\n }\n}\nfunction emitOne(handler, isFn, self, arg1) {\n if (isFn)\n handler.call(self, arg1);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self, arg1);\n }\n}\nfunction emitTwo(handler, isFn, self, arg1, arg2) {\n if (isFn)\n handler.call(self, arg1, arg2);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self, arg1, arg2);\n }\n}\nfunction emitThree(handler, isFn, self, arg1, arg2, arg3) {\n if (isFn)\n handler.call(self, arg1, arg2, arg3);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].call(self, arg1, arg2, arg3);\n }\n}\n\nfunction emitMany(handler, isFn, self, args) {\n if (isFn)\n handler.apply(self, args);\n else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n listeners[i].apply(self, args);\n }\n}\n\nEventEmitter.prototype.emit = function emit(type) {\n var er, handler, len, args, i, events;\n var doError = (type === 'error');\n\n events = this._events;\n if (events)\n doError = (doError && events.error == null);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n if (arguments.length > 1)\n er = arguments[1];\n if (er instanceof Error) {\n throw er; // Unhandled 'error' event\n } else {\n // At least give some kind of context to the user\n var err = new Error('Unhandled \"error\" event. (' + er + ')');\n err.context = er;\n throw err;\n }\n return false;\n }\n\n handler = events[type];\n\n if (!handler)\n return false;\n\n var isFn = typeof handler === 'function';\n len = arguments.length;\n switch (len) {\n // fast cases\n case 1:\n emitNone(handler, isFn, this);\n break;\n case 2:\n emitOne(handler, isFn, this, arguments[1]);\n break;\n case 3:\n emitTwo(handler, isFn, this, arguments[1], arguments[2]);\n break;\n case 4:\n emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);\n break;\n // slower\n default:\n args = new Array(len - 1);\n for (i = 1; i < len; i++)\n args[i - 1] = arguments[i];\n emitMany(handler, isFn, this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n if (typeof listener !== 'function')\n throw new TypeError('\"listener\" argument must be a function');\n\n events = target._events;\n if (!events) {\n events = target._events = objectCreate(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (!existing) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n } else {\n // If we've already got an array, just append.\n if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n }\n\n // Check for listener leak\n if (!existing.warned) {\n m = $getMaxListeners(target);\n if (m && m > 0 && existing.length > m) {\n existing.warned = true;\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' \"' + String(type) + '\" listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit.');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n if (typeof console === 'object' && console.warn) {\n console.warn('%s: %s', w.name, w.message);\n }\n }\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n switch (arguments.length) {\n case 0:\n return this.listener.call(this.target);\n case 1:\n return this.listener.call(this.target, arguments[0]);\n case 2:\n return this.listener.call(this.target, arguments[0], arguments[1]);\n case 3:\n return this.listener.call(this.target, arguments[0], arguments[1],\n arguments[2]);\n default:\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; ++i)\n args[i] = arguments[i];\n this.listener.apply(this.target, args);\n }\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = bind.call(onceWrapper, state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n if (typeof listener !== 'function')\n throw new TypeError('\"listener\" argument must be a function');\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n if (typeof listener !== 'function')\n throw new TypeError('\"listener\" argument must be a function');\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n if (typeof listener !== 'function')\n throw new TypeError('\"listener\" argument must be a function');\n\n events = this._events;\n if (!events)\n return this;\n\n list = events[type];\n if (!list)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = objectCreate(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else\n spliceOne(list, position);\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (!events)\n return this;\n\n // not listening for removeListener, no need to emit\n if (!events.removeListener) {\n if (arguments.length === 0) {\n this._events = objectCreate(null);\n this._eventsCount = 0;\n } else if (events[type]) {\n if (--this._eventsCount === 0)\n this._events = objectCreate(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = objectKeys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = objectCreate(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (!events)\n return [];\n\n var evlistener = events[type];\n if (!evlistener)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];\n};\n\n// About 1.5x faster than the two-arg version of Array#splice().\nfunction spliceOne(list, index) {\n for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)\n list[i] = list[k];\n list.pop();\n}\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction objectCreatePolyfill(proto) {\n var F = function() {};\n F.prototype = proto;\n return new F;\n}\nfunction objectKeysPolyfill(obj) {\n var keys = [];\n for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) {\n keys.push(k);\n }\n return k;\n}\nfunction functionBindPolyfill(context) {\n var fn = this;\n return function () {\n return fn.apply(context, arguments);\n };\n}\n","module.exports = class FixedFIFO {\n constructor (hwm) {\n if (!(hwm > 0) || ((hwm - 1) & hwm) !== 0) throw new Error('Max size for a FixedFIFO should be a power of two')\n this.buffer = new Array(hwm)\n this.mask = hwm - 1\n this.top = 0\n this.btm = 0\n this.next = null\n }\n\n push (data) {\n if (this.buffer[this.top] !== undefined) return false\n this.buffer[this.top] = data\n this.top = (this.top + 1) & this.mask\n return true\n }\n\n shift () {\n const last = this.buffer[this.btm]\n if (last === undefined) return undefined\n this.buffer[this.btm] = undefined\n this.btm = (this.btm + 1) & this.mask\n return last\n }\n\n peek () {\n return this.buffer[this.btm]\n }\n\n isEmpty () {\n return this.buffer[this.btm] === undefined\n }\n}\n","const FixedFIFO = require('./fixed-size')\n\nmodule.exports = class FastFIFO {\n constructor (hwm) {\n this.hwm = hwm || 16\n this.head = new FixedFIFO(this.hwm)\n this.tail = this.head\n this.length = 0\n }\n\n push (val) {\n this.length++\n if (!this.head.push(val)) {\n const prev = this.head\n this.head = prev.next = new FixedFIFO(2 * this.head.buffer.length)\n this.head.push(val)\n }\n }\n\n shift () {\n if (this.length !== 0) this.length--\n const val = this.tail.shift()\n if (val === undefined && this.tail.next) {\n const next = this.tail.next\n this.tail.next = null\n this.tail = next\n return this.tail.shift()\n }\n\n return val\n }\n\n peek () {\n return this.tail.peek()\n }\n\n isEmpty () {\n return this.head.isEmpty()\n }\n}\n","if (typeof ReadableStream !== 'undefined' && !ReadableStream.prototype[Symbol.asyncIterator]) {\r\n ReadableStream.prototype[Symbol.asyncIterator] = function () {\r\n const reader = this.getReader()\r\n let last = reader.read()\r\n return {\r\n next () {\r\n const temp = last\r\n last = reader.read()\r\n return temp\r\n },\r\n return () {\r\n last.then(() => reader.releaseLock())\r\n },\r\n throw (err) {\r\n this.return()\r\n throw err\r\n },\r\n [Symbol.asyncIterator] () {\r\n return this\r\n }\r\n }\r\n }\r\n}\r\n","// originally pulled out of simple-peer\n\nmodule.exports = function getBrowserRTC () {\n if (typeof globalThis === 'undefined') return null\n var wrtc = {\n RTCPeerConnection: globalThis.RTCPeerConnection || globalThis.mozRTCPeerConnection ||\n globalThis.webkitRTCPeerConnection,\n RTCSessionDescription: globalThis.RTCSessionDescription ||\n globalThis.mozRTCSessionDescription || globalThis.webkitRTCSessionDescription,\n RTCIceCandidate: globalThis.RTCIceCandidate || globalThis.mozRTCIceCandidate ||\n globalThis.webkitRTCIceCandidate\n }\n if (!wrtc.RTCPeerConnection) return null\n return wrtc\n}\n","'use strict'\nconst idb = require('idb')\n\nconst EventEmitter = require('events').EventEmitter\nconst queueMicrotask = require('queue-microtask')\n\nclass Storage extends EventEmitter {\n constructor (chunkLength, opts) {\n if (!opts) opts = {}\n super()\n\n this.chunkLength = Number(chunkLength)\n if (!this.chunkLength) throw new Error('First argument must be a chunk length')\n\n this.closed = false\n this.destroyed = false\n this.length = Number(opts.length) || Infinity\n this.name = opts.name || 'idb-chunk-store'\n\n if (this.length !== Infinity) {\n this.lastChunkLength = (this.length % this.chunkLength) || this.chunkLength\n this.lastChunkIndex = Math.ceil(this.length / this.chunkLength) - 1\n }\n\n this.dbPromise = idb.openDB(this.name, undefined, {\n upgrade: (db) => {\n db.createObjectStore('chunks')\n },\n blocking: () => {\n // Fires if the database is deleted from outside this Storage object\n this.close()\n },\n terminated: () => {\n this.closed = true\n this.emit('error', new Error('Database unexpectedly closed'))\n }\n })\n }\n\n put (index, buf, cb = () => {}) {\n if (this.closed) return queueMicrotask(() => cb(new Error('Storage is closed')))\n\n const isLastChunk = (index === this.lastChunkIndex)\n if (isLastChunk && buf.length !== this.lastChunkLength) {\n return queueMicrotask(() => cb(new Error('Last chunk length must be ' + this.lastChunkLength)))\n }\n if (!isLastChunk && buf.length !== this.chunkLength) {\n return queueMicrotask(() => cb(new Error('Chunk length must be ' + this.chunkLength)))\n }\n\n // Zero-copy coerce Buffer to Uint8Array\n buf = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength)\n\n // If the backing buffer is larger, copy out only the relevant slice\n // so extra data doesn't get saved to indexeddb\n if (buf.byteOffset !== 0 || buf.byteLength !== buf.buffer.byteLength) {\n buf = buf.slice()\n }\n\n ;(async () => {\n try {\n const db = await this.dbPromise\n await db.put('chunks', buf, index)\n } catch (err) {\n cb(err)\n return\n }\n\n cb(null)\n })()\n }\n\n get (index, opts, cb = () => {}) {\n if (typeof opts === 'function') return this.get(index, {}, opts)\n if (!opts) opts = {}\n if (this.closed) return queueMicrotask(() => cb(new Error('Storage is closed')))\n\n ;(async () => {\n let rawResult\n try {\n const db = await this.dbPromise\n rawResult = await db.get('chunks', index)\n } catch (err) {\n cb(err)\n return\n }\n\n // rawResult should be undefined if the chunk is not found,\n // but some old browsers occasionally return null\n if (rawResult == null) {\n const err = new Error('Chunk not found')\n err.notFound = true\n cb(err)\n return\n }\n\n let buf = Buffer.from(rawResult.buffer, rawResult.byteOffset, rawResult.byteLength)\n\n const offset = opts.offset || 0\n const len = opts.length || (buf.length - offset)\n\n if (offset !== 0 || len !== buf.length) {\n buf = buf.slice(offset, len + offset)\n }\n\n cb(null, buf)\n })()\n }\n\n close (cb = () => {}) {\n if (this.closed) return queueMicrotask(() => cb(new Error('Storage is closed')))\n this.closed = true\n\n ;(async () => {\n try {\n const db = await this.dbPromise\n db.close()\n } catch (err) {\n cb(err)\n return\n }\n\n cb(null)\n })()\n }\n\n destroy (cb = () => {}) {\n if (this.closed) return queueMicrotask(() => cb(new Error('Storage is closed')))\n if (this.destroyed) return queueMicrotask(() => cb(new Error('Storage is destroyed')))\n this.destroyed = true\n\n this.close(async (err) => {\n if (err) {\n cb(err)\n return\n }\n\n try {\n await idb.deleteDB(this.name)\n } catch (err) {\n cb(err)\n return\n }\n\n cb(null)\n })\n }\n}\nmodule.exports = Storage\n","const instanceOfAny = (object, constructors) => constructors.some((c) => object instanceof c);\n\nlet idbProxyableTypes;\nlet cursorAdvanceMethods;\n// This is a function to prevent it throwing up in node environments.\nfunction getIdbProxyableTypes() {\n return (idbProxyableTypes ||\n (idbProxyableTypes = [\n IDBDatabase,\n IDBObjectStore,\n IDBIndex,\n IDBCursor,\n IDBTransaction,\n ]));\n}\n// This is a function to prevent it throwing up in node environments.\nfunction getCursorAdvanceMethods() {\n return (cursorAdvanceMethods ||\n (cursorAdvanceMethods = [\n IDBCursor.prototype.advance,\n IDBCursor.prototype.continue,\n IDBCursor.prototype.continuePrimaryKey,\n ]));\n}\nconst cursorRequestMap = new WeakMap();\nconst transactionDoneMap = new WeakMap();\nconst transactionStoreNamesMap = new WeakMap();\nconst transformCache = new WeakMap();\nconst reverseTransformCache = new WeakMap();\nfunction promisifyRequest(request) {\n const promise = new Promise((resolve, reject) => {\n const unlisten = () => {\n request.removeEventListener('success', success);\n request.removeEventListener('error', error);\n };\n const success = () => {\n resolve(wrap(request.result));\n unlisten();\n };\n const error = () => {\n reject(request.error);\n unlisten();\n };\n request.addEventListener('success', success);\n request.addEventListener('error', error);\n });\n promise\n .then((value) => {\n // Since cursoring reuses the IDBRequest (*sigh*), we cache it for later retrieval\n // (see wrapFunction).\n if (value instanceof IDBCursor) {\n cursorRequestMap.set(value, request);\n }\n // Catching to avoid \"Uncaught Promise exceptions\"\n })\n .catch(() => { });\n // This mapping exists in reverseTransformCache but doesn't doesn't exist in transformCache. This\n // is because we create many promises from a single IDBRequest.\n reverseTransformCache.set(promise, request);\n return promise;\n}\nfunction cacheDonePromiseForTransaction(tx) {\n // Early bail if we've already created a done promise for this transaction.\n if (transactionDoneMap.has(tx))\n return;\n const done = new Promise((resolve, reject) => {\n const unlisten = () => {\n tx.removeEventListener('complete', complete);\n tx.removeEventListener('error', error);\n tx.removeEventListener('abort', error);\n };\n const complete = () => {\n resolve();\n unlisten();\n };\n const error = () => {\n reject(tx.error || new DOMException('AbortError', 'AbortError'));\n unlisten();\n };\n tx.addEventListener('complete', complete);\n tx.addEventListener('error', error);\n tx.addEventListener('abort', error);\n });\n // Cache it for later retrieval.\n transactionDoneMap.set(tx, done);\n}\nlet idbProxyTraps = {\n get(target, prop, receiver) {\n if (target instanceof IDBTransaction) {\n // Special handling for transaction.done.\n if (prop === 'done')\n return transactionDoneMap.get(target);\n // Polyfill for objectStoreNames because of Edge.\n if (prop === 'objectStoreNames') {\n return target.objectStoreNames || transactionStoreNamesMap.get(target);\n }\n // Make tx.store return the only store in the transaction, or undefined if there are many.\n if (prop === 'store') {\n return receiver.objectStoreNames[1]\n ? undefined\n : receiver.objectStore(receiver.objectStoreNames[0]);\n }\n }\n // Else transform whatever we get back.\n return wrap(target[prop]);\n },\n set(target, prop, value) {\n target[prop] = value;\n return true;\n },\n has(target, prop) {\n if (target instanceof IDBTransaction &&\n (prop === 'done' || prop === 'store')) {\n return true;\n }\n return prop in target;\n },\n};\nfunction replaceTraps(callback) {\n idbProxyTraps = callback(idbProxyTraps);\n}\nfunction wrapFunction(func) {\n // Due to expected object equality (which is enforced by the caching in `wrap`), we\n // only create one new func per func.\n // Edge doesn't support objectStoreNames (booo), so we polyfill it here.\n if (func === IDBDatabase.prototype.transaction &&\n !('objectStoreNames' in IDBTransaction.prototype)) {\n return function (storeNames, ...args) {\n const tx = func.call(unwrap(this), storeNames, ...args);\n transactionStoreNamesMap.set(tx, storeNames.sort ? storeNames.sort() : [storeNames]);\n return wrap(tx);\n };\n }\n // Cursor methods are special, as the behaviour is a little more different to standard IDB. In\n // IDB, you advance the cursor and wait for a new 'success' on the IDBRequest that gave you the\n // cursor. It's kinda like a promise that can resolve with many values. That doesn't make sense\n // with real promises, so each advance methods returns a new promise for the cursor object, or\n // undefined if the end of the cursor has been reached.\n if (getCursorAdvanceMethods().includes(func)) {\n return function (...args) {\n // Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use\n // the original object.\n func.apply(unwrap(this), args);\n return wrap(cursorRequestMap.get(this));\n };\n }\n return function (...args) {\n // Calling the original function with the proxy as 'this' causes ILLEGAL INVOCATION, so we use\n // the original object.\n return wrap(func.apply(unwrap(this), args));\n };\n}\nfunction transformCachableValue(value) {\n if (typeof value === 'function')\n return wrapFunction(value);\n // This doesn't return, it just creates a 'done' promise for the transaction,\n // which is later returned for transaction.done (see idbObjectHandler).\n if (value instanceof IDBTransaction)\n cacheDonePromiseForTransaction(value);\n if (instanceOfAny(value, getIdbProxyableTypes()))\n return new Proxy(value, idbProxyTraps);\n // Return the same value back if we're not going to transform it.\n return value;\n}\nfunction wrap(value) {\n // We sometimes generate multiple promises from a single IDBRequest (eg when cursoring), because\n // IDB is weird and a single IDBRequest can yield many responses, so these can't be cached.\n if (value instanceof IDBRequest)\n return promisifyRequest(value);\n // If we've already transformed this value before, reuse the transformed value.\n // This is faster, but it also provides object equality.\n if (transformCache.has(value))\n return transformCache.get(value);\n const newValue = transformCachableValue(value);\n // Not all types are transformed.\n // These may be primitive types, so they can't be WeakMap keys.\n if (newValue !== value) {\n transformCache.set(value, newValue);\n reverseTransformCache.set(newValue, value);\n }\n return newValue;\n}\nconst unwrap = (value) => reverseTransformCache.get(value);\n\nexport { reverseTransformCache as a, instanceOfAny as i, replaceTraps as r, unwrap as u, wrap as w };\n","import { w as wrap, r as replaceTraps } from './wrap-idb-value.js';\nexport { u as unwrap, w as wrap } from './wrap-idb-value.js';\n\n/**\n * Open a database.\n *\n * @param name Name of the database.\n * @param version Schema version.\n * @param callbacks Additional callbacks.\n */\nfunction openDB(name, version, { blocked, upgrade, blocking, terminated } = {}) {\n const request = indexedDB.open(name, version);\n const openPromise = wrap(request);\n if (upgrade) {\n request.addEventListener('upgradeneeded', (event) => {\n upgrade(wrap(request.result), event.oldVersion, event.newVersion, wrap(request.transaction));\n });\n }\n if (blocked)\n request.addEventListener('blocked', () => blocked());\n openPromise\n .then((db) => {\n if (terminated)\n db.addEventListener('close', () => terminated());\n if (blocking)\n db.addEventListener('versionchange', () => blocking());\n })\n .catch(() => { });\n return openPromise;\n}\n/**\n * Delete a database.\n *\n * @param name Name of the database.\n */\nfunction deleteDB(name, { blocked } = {}) {\n const request = indexedDB.deleteDatabase(name);\n if (blocked)\n request.addEventListener('blocked', () => blocked());\n return wrap(request).then(() => undefined);\n}\n\nconst readMethods = ['get', 'getKey', 'getAll', 'getAllKeys', 'count'];\nconst writeMethods = ['put', 'add', 'delete', 'clear'];\nconst cachedMethods = new Map();\nfunction getMethod(target, prop) {\n if (!(target instanceof IDBDatabase &&\n !(prop in target) &&\n typeof prop === 'string')) {\n return;\n }\n if (cachedMethods.get(prop))\n return cachedMethods.get(prop);\n const targetFuncName = prop.replace(/FromIndex$/, '');\n const useIndex = prop !== targetFuncName;\n const isWrite = writeMethods.includes(targetFuncName);\n if (\n // Bail if the target doesn't exist on the target. Eg, getAll isn't in Edge.\n !(targetFuncName in (useIndex ? IDBIndex : IDBObjectStore).prototype) ||\n !(isWrite || readMethods.includes(targetFuncName))) {\n return;\n }\n const method = async function (storeName, ...args) {\n // isWrite ? 'readwrite' : undefined gzipps better, but fails in Edge :(\n const tx = this.transaction(storeName, isWrite ? 'readwrite' : 'readonly');\n let target = tx.store;\n if (useIndex)\n target = target.index(args.shift());\n // Must reject if op rejects.\n // If it's a write operation, must reject if tx.done rejects.\n // Must reject with op rejection first.\n // Must resolve with op value.\n // Must handle both promises (no unhandled rejections)\n return (await Promise.all([\n target[targetFuncName](...args),\n isWrite && tx.done,\n ]))[0];\n };\n cachedMethods.set(prop, method);\n return method;\n}\nreplaceTraps((oldTraps) => ({\n ...oldTraps,\n get: (target, prop, receiver) => getMethod(target, prop) || oldTraps.get(target, prop, receiver),\n has: (target, prop) => !!getMethod(target, prop) || oldTraps.has(target, prop),\n}));\n\nexport { deleteDB, openDB };\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","/*! immediate-chunk-store. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */\n// TODO: remove when window.queueMicrotask() is well supported\nconst queueMicrotask = require('queue-microtask')\n\nclass ImmediateStore {\n constructor (store) {\n this.store = store\n this.chunkLength = store.chunkLength\n\n if (!this.store || !this.store.get || !this.store.put) {\n throw new Error('First argument must be abstract-chunk-store compliant')\n }\n\n this.mem = []\n }\n\n put (index, buf, cb = () => {}) {\n this.mem[index] = buf\n this.store.put(index, buf, err => {\n this.mem[index] = null\n cb(err)\n })\n }\n\n get (index, opts, cb = () => {}) {\n if (typeof opts === 'function') return this.get(index, null, opts)\n\n let buf = this.mem[index]\n\n // if the chunk isn't in the immediate memory cache\n if (!buf) {\n return this.store.get(index, opts, cb)\n }\n\n if (!opts) opts = {}\n\n const offset = opts.offset || 0\n const len = opts.length || (buf.length - offset)\n\n if (offset !== 0 || len !== buf.length) {\n buf = buf.slice(offset, len + offset)\n }\n queueMicrotask(() => cb(null, buf))\n }\n\n close (cb = () => {}) {\n this.store.close(cb)\n }\n\n destroy (cb = () => {}) {\n this.store.destroy(cb)\n }\n}\n\nmodule.exports = ImmediateStore\n","if (typeof Object.create === 'function') {\n // implementation from standard node.js 'util' module\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n })\n }\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n if (superCtor) {\n ctor.super_ = superCtor\n var TempCtor = function () {}\n TempCtor.prototype = superCtor.prototype\n ctor.prototype = new TempCtor()\n ctor.prototype.constructor = ctor\n }\n }\n}\n","module.exports = async function * (iterators) {\r\n for (let iterator of iterators) {\r\n // can be lazy functions returning streams\r\n if (typeof iterator === 'function') iterator = iterator()\r\n yield * iterator\r\n }\r\n}\r\n","'use strict';\n\nconst blacklist = [\n\t// # All\n\t'^npm-debug\\\\.log$', // Error log for npm\n\t'^\\\\..*\\\\.swp$', // Swap file for vim state\n\n\t// # macOS\n\t'^\\\\.DS_Store$', // Stores custom folder attributes\n\t'^\\\\.AppleDouble$', // Stores additional file resources\n\t'^\\\\.LSOverride$', // Contains the absolute path to the app to be used\n\t'^Icon\\\\r$', // Custom Finder icon: http://superuser.com/questions/298785/icon-file-on-os-x-desktop\n\t'^\\\\._.*', // Thumbnail\n\t'^\\\\.Spotlight-V100(?:$|\\\\/)', // Directory that might appear on external disk\n\t'\\\\.Trashes', // File that might appear on external disk\n\t'^__MACOSX$', // Resource fork\n\n\t// # Linux\n\t'~$', // Backup file\n\n\t// # Windows\n\t'^Thumbs\\\\.db$', // Image file cache\n\t'^ehthumbs\\\\.db$', // Folder config file\n\t'^Desktop\\\\.ini$', // Stores custom folder attributes\n\t'@eaDir$' // Synology Diskstation \"hidden\" folder where the server stores thumbnails\n];\n\nexports.re = () => {\n\tthrow new Error('`junk.re` was renamed to `junk.regex`');\n};\n\nexports.regex = new RegExp(blacklist.join('|'));\n\nexports.is = filename => exports.regex.test(filename);\n\nexports.not = filename => !exports.is(filename);\n\n// TODO: Remove this for the next major release\nexports.default = module.exports;\n","\r\nexports.RateLimiter = require('./lib/rateLimiter');\r\nexports.TokenBucket = require('./lib/tokenBucket');\r\n","var getMilliseconds = function() {\r\n if (typeof process !== 'undefined' && process.hrtime) {\r\n var hrtime = process.hrtime();\r\n var seconds = hrtime[0];\r\n var nanoseconds = hrtime[1];\r\n\r\n return seconds * 1e3 + Math.floor(nanoseconds / 1e6);\r\n }\r\n\r\n return new Date().getTime();\r\n}\r\n\r\nmodule.exports = getMilliseconds;\r\n","var TokenBucket = require('./tokenBucket');\r\nvar getMilliseconds = require('./clock');\r\n\r\n/**\r\n * A generic rate limiter. Underneath the hood, this uses a token bucket plus\r\n * an additional check to limit how many tokens we can remove each interval.\r\n * @author John Hurliman <jhurliman@jhurliman.org>\r\n *\r\n * @param {Number} tokensPerInterval Maximum number of tokens that can be\r\n * removed at any given moment and over the course of one interval.\r\n * @param {String|Number} interval The interval length in milliseconds, or as\r\n * one of the following strings: 'second', 'minute', 'hour', day'.\r\n * @param {Boolean} fireImmediately Optional. Whether or not the callback\r\n * will fire immediately when rate limiting is in effect (default is false).\r\n */\r\nvar RateLimiter = function(tokensPerInterval, interval, fireImmediately) {\r\n this.tokenBucket = new TokenBucket(tokensPerInterval, tokensPerInterval,\r\n interval, null);\r\n\r\n // Fill the token bucket to start\r\n this.tokenBucket.content = tokensPerInterval;\r\n\r\n this.curIntervalStart = getMilliseconds();\r\n this.tokensThisInterval = 0;\r\n this.fireImmediately = fireImmediately;\r\n};\r\n\r\nRateLimiter.prototype = {\r\n tokenBucket: null,\r\n curIntervalStart: 0,\r\n tokensThisInterval: 0,\r\n fireImmediately: false,\r\n\r\n /**\r\n * Remove the requested number of tokens and fire the given callback. If the\r\n * rate limiter contains enough tokens and we haven't spent too many tokens\r\n * in this interval already, this will happen immediately. Otherwise, the\r\n * removal and callback will happen when enough tokens become available.\r\n * @param {Number} count The number of tokens to remove.\r\n * @param {Function} callback(err, remainingTokens)\r\n * @returns {Boolean} True if the callback was fired immediately, otherwise\r\n * false.\r\n */\r\n removeTokens: function(count, callback) {\r\n // Make sure the request isn't for more than we can handle\r\n if (count > this.tokenBucket.bucketSize) {\r\n process.nextTick(callback.bind(null, 'Requested tokens ' + count +\r\n ' exceeds maximum tokens per interval ' + this.tokenBucket.bucketSize,\r\n null));\r\n return false;\r\n }\r\n\r\n var self = this;\r\n var now = getMilliseconds();\r\n\r\n // Advance the current interval and reset the current interval token count\r\n // if needed\r\n if (now < this.curIntervalStart\r\n || now - this.curIntervalStart >= this.tokenBucket.interval) {\r\n this.curIntervalStart = now;\r\n this.tokensThisInterval = 0;\r\n }\r\n\r\n // If we don't have enough tokens left in this interval, wait until the\r\n // next interval\r\n if (count > this.tokenBucket.tokensPerInterval - this.tokensThisInterval) {\r\n if (this.fireImmediately) {\r\n process.nextTick(callback.bind(null, null, -1));\r\n } else {\r\n var waitInterval = Math.ceil(\r\n this.curIntervalStart + this.tokenBucket.interval - now);\r\n\r\n setTimeout(function() {\r\n self.tokenBucket.removeTokens(count, afterTokensRemoved);\r\n }, waitInterval);\r\n }\r\n return false;\r\n }\r\n\r\n // Remove the requested number of tokens from the token bucket\r\n return this.tokenBucket.removeTokens(count, afterTokensRemoved);\r\n\r\n function afterTokensRemoved(err, tokensRemaining) {\r\n if (err) return callback(err, null);\r\n\r\n self.tokensThisInterval += count;\r\n callback(null, tokensRemaining);\r\n }\r\n },\r\n\r\n /**\r\n * Attempt to remove the requested number of tokens and return immediately.\r\n * If the bucket (and any parent buckets) contains enough tokens and we\r\n * haven't spent too many tokens in this interval already, this will return\r\n * true. Otherwise, false is returned.\r\n * @param {Number} count The number of tokens to remove.\r\n * @param {Boolean} True if the tokens were successfully removed, otherwise\r\n * false.\r\n */\r\n tryRemoveTokens: function(count) {\r\n // Make sure the request isn't for more than we can handle\r\n if (count > this.tokenBucket.bucketSize)\r\n return false;\r\n\r\n var now = getMilliseconds();\r\n\r\n // Advance the current interval and reset the current interval token count\r\n // if needed\r\n if (now < this.curIntervalStart\r\n || now - this.curIntervalStart >= this.tokenBucket.interval) {\r\n this.curIntervalStart = now;\r\n this.tokensThisInterval = 0;\r\n }\r\n\r\n // If we don't have enough tokens left in this interval, return false\r\n if (count > this.tokenBucket.tokensPerInterval - this.tokensThisInterval)\r\n return false;\r\n\r\n // Try to remove the requested number of tokens from the token bucket\r\n var removed = this.tokenBucket.tryRemoveTokens(count);\r\n if (removed) {\r\n this.tokensThisInterval += count;\r\n }\r\n return removed;\r\n },\r\n\r\n /**\r\n * Returns the number of tokens remaining in the TokenBucket.\r\n * @returns {Number} The number of tokens remaining.\r\n */\r\n getTokensRemaining: function () {\r\n this.tokenBucket.drip();\r\n return this.tokenBucket.content;\r\n }\r\n};\r\n\r\nmodule.exports = RateLimiter;\r\n","\r\n/**\r\n * A hierarchical token bucket for rate limiting. See\r\n * http://en.wikipedia.org/wiki/Token_bucket for more information.\r\n * @author John Hurliman <jhurliman@cull.tv>\r\n *\r\n * @param {Number} bucketSize Maximum number of tokens to hold in the bucket.\r\n * Also known as the burst rate.\r\n * @param {Number} tokensPerInterval Number of tokens to drip into the bucket\r\n * over the course of one interval.\r\n * @param {String|Number} interval The interval length in milliseconds, or as\r\n * one of the following strings: 'second', 'minute', 'hour', day'.\r\n * @param {TokenBucket} parentBucket Optional. A token bucket that will act as\r\n * the parent of this bucket.\r\n */\r\nvar TokenBucket = function(bucketSize, tokensPerInterval, interval, parentBucket) {\r\n this.bucketSize = bucketSize;\r\n this.tokensPerInterval = tokensPerInterval;\r\n\r\n if (typeof interval === 'string') {\r\n switch (interval) {\r\n case 'sec': case 'second':\r\n this.interval = 1000; break;\r\n case 'min': case 'minute':\r\n this.interval = 1000 * 60; break;\r\n case 'hr': case 'hour':\r\n this.interval = 1000 * 60 * 60; break;\r\n case 'day':\r\n this.interval = 1000 * 60 * 60 * 24; break;\r\n default:\r\n throw new Error('Invaid interval ' + interval);\r\n }\r\n } else {\r\n this.interval = interval;\r\n }\r\n\r\n this.parentBucket = parentBucket;\r\n this.content = 0;\r\n this.lastDrip = +new Date();\r\n};\r\n\r\nTokenBucket.prototype = {\r\n bucketSize: 1,\r\n tokensPerInterval: 1,\r\n interval: 1000,\r\n parentBucket: null,\r\n content: 0,\r\n lastDrip: 0,\r\n\r\n /**\r\n * Remove the requested number of tokens and fire the given callback. If the\r\n * bucket (and any parent buckets) contains enough tokens this will happen\r\n * immediately. Otherwise, the removal and callback will happen when enough\r\n * tokens become available.\r\n * @param {Number} count The number of tokens to remove.\r\n * @param {Function} callback(err, remainingTokens)\r\n * @returns {Boolean} True if the callback was fired immediately, otherwise\r\n * false.\r\n */\r\n removeTokens: function(count, callback) {\r\n var self = this;\r\n\r\n // Is this an infinite size bucket?\r\n if (!this.bucketSize) {\r\n process.nextTick(callback.bind(null, null, count, Number.POSITIVE_INFINITY));\r\n return true;\r\n }\r\n\r\n // Make sure the bucket can hold the requested number of tokens\r\n if (count > this.bucketSize) {\r\n process.nextTick(callback.bind(null, 'Requested tokens ' + count + ' exceeds bucket size ' +\r\n this.bucketSize, null));\r\n return false;\r\n }\r\n\r\n // Drip new tokens into this bucket\r\n this.drip();\r\n\r\n // If we don't have enough tokens in this bucket, come back later\r\n if (count > this.content)\r\n return comeBackLater();\r\n\r\n if (this.parentBucket) {\r\n // Remove the requested from the parent bucket first\r\n return this.parentBucket.removeTokens(count, function(err, remainingTokens) {\r\n if (err) return callback(err, null);\r\n\r\n // Check that we still have enough tokens in this bucket\r\n if (count > self.content)\r\n return comeBackLater();\r\n\r\n // Tokens were removed from the parent bucket, now remove them from\r\n // this bucket and fire the callback. Note that we look at the current\r\n // bucket and parent bucket's remaining tokens and return the smaller\r\n // of the two values\r\n self.content -= count;\r\n callback(null, Math.min(remainingTokens, self.content));\r\n });\r\n } else {\r\n // Remove the requested tokens from this bucket and fire the callback\r\n this.content -= count;\r\n process.nextTick(callback.bind(null, null, this.content));\r\n return true;\r\n }\r\n\r\n function comeBackLater() {\r\n // How long do we need to wait to make up the difference in tokens?\r\n var waitInterval = Math.ceil(\r\n (count - self.content) * (self.interval / self.tokensPerInterval));\r\n setTimeout(function() { self.removeTokens(count, callback); }, waitInterval);\r\n return false;\r\n }\r\n },\r\n\r\n /**\r\n * Attempt to remove the requested number of tokens and return immediately.\r\n * If the bucket (and any parent buckets) contains enough tokens this will\r\n * return true, otherwise false is returned.\r\n * @param {Number} count The number of tokens to remove.\r\n * @param {Boolean} True if the tokens were successfully removed, otherwise\r\n * false.\r\n */\r\n tryRemoveTokens: function(count) {\r\n // Is this an infinite size bucket?\r\n if (!this.bucketSize)\r\n return true;\r\n\r\n // Make sure the bucket can hold the requested number of tokens\r\n if (count > this.bucketSize)\r\n return false;\r\n\r\n // Drip new tokens into this bucket\r\n this.drip();\r\n\r\n // If we don't have enough tokens in this bucket, return false\r\n if (count > this.content)\r\n return false;\r\n\r\n // Try to remove the requested tokens from the parent bucket\r\n if (this.parentBucket && !this.parentBucket.tryRemoveTokens(count))\r\n return false;\r\n\r\n // Remove the requested tokens from this bucket and return\r\n this.content -= count;\r\n return true;\r\n },\r\n\r\n /**\r\n * Add any new tokens to the bucket since the last drip.\r\n * @returns {Boolean} True if new tokens were added, otherwise false.\r\n */\r\n drip: function() {\r\n if (!this.tokensPerInterval) {\r\n this.content = this.bucketSize;\r\n return;\r\n }\r\n\r\n var now = +new Date();\r\n var deltaMS = Math.max(now - this.lastDrip, 0);\r\n this.lastDrip = now;\r\n\r\n var dripAmount = deltaMS * (this.tokensPerInterval / this.interval);\r\n this.content = Math.min(this.content + dripAmount, this.bucketSize);\r\n }\r\n};\r\n\r\nmodule.exports = TokenBucket;\r\n","var events = require('events')\nvar inherits = require('inherits')\n\nmodule.exports = LRU\n\nfunction LRU (opts) {\n if (!(this instanceof LRU)) return new LRU(opts)\n if (typeof opts === 'number') opts = {max: opts}\n if (!opts) opts = {}\n events.EventEmitter.call(this)\n this.cache = {}\n this.head = this.tail = null\n this.length = 0\n this.max = opts.max || 1000\n this.maxAge = opts.maxAge || 0\n}\n\ninherits(LRU, events.EventEmitter)\n\nObject.defineProperty(LRU.prototype, 'keys', {\n get: function () { return Object.keys(this.cache) }\n})\n\nLRU.prototype.clear = function () {\n this.cache = {}\n this.head = this.tail = null\n this.length = 0\n}\n\nLRU.prototype.remove = function (key) {\n if (typeof key !== 'string') key = '' + key\n if (!this.cache.hasOwnProperty(key)) return\n\n var element = this.cache[key]\n delete this.cache[key]\n this._unlink(key, element.prev, element.next)\n return element.value\n}\n\nLRU.prototype._unlink = function (key, prev, next) {\n this.length--\n\n if (this.length === 0) {\n this.head = this.tail = null\n } else {\n if (this.head === key) {\n this.head = prev\n this.cache[this.head].next = null\n } else if (this.tail === key) {\n this.tail = next\n this.cache[this.tail].prev = null\n } else {\n this.cache[prev].next = next\n this.cache[next].prev = prev\n }\n }\n}\n\nLRU.prototype.peek = function (key) {\n if (!this.cache.hasOwnProperty(key)) return\n\n var element = this.cache[key]\n\n if (!this._checkAge(key, element)) return\n return element.value\n}\n\nLRU.prototype.set = function (key, value) {\n if (typeof key !== 'string') key = '' + key\n\n var element\n\n if (this.cache.hasOwnProperty(key)) {\n element = this.cache[key]\n element.value = value\n if (this.maxAge) element.modified = Date.now()\n\n // If it's already the head, there's nothing more to do:\n if (key === this.head) return value\n this._unlink(key, element.prev, element.next)\n } else {\n element = {value: value, modified: 0, next: null, prev: null}\n if (this.maxAge) element.modified = Date.now()\n this.cache[key] = element\n\n // Eviction is only possible if the key didn't already exist:\n if (this.length === this.max) this.evict()\n }\n\n this.length++\n element.next = null\n element.prev = this.head\n\n if (this.head) this.cache[this.head].next = key\n this.head = key\n\n if (!this.tail) this.tail = key\n return value\n}\n\nLRU.prototype._checkAge = function (key, element) {\n if (this.maxAge && (Date.now() - element.modified) > this.maxAge) {\n this.remove(key)\n this.emit('evict', {key: key, value: element.value})\n return false\n }\n return true\n}\n\nLRU.prototype.get = function (key) {\n if (typeof key !== 'string') key = '' + key\n if (!this.cache.hasOwnProperty(key)) return\n\n var element = this.cache[key]\n\n if (!this._checkAge(key, element)) return\n\n if (this.head !== key) {\n if (key === this.tail) {\n this.tail = element.next\n this.cache[this.tail].prev = null\n } else {\n // Set prev.next -> element.next:\n this.cache[element.prev].next = element.next\n }\n\n // Set element.next.prev -> element.prev:\n this.cache[element.next].prev = element.prev\n\n // Element is the new head\n this.cache[this.head].next = key\n element.prev = this.head\n element.next = null\n this.head = key\n }\n\n return element.value\n}\n\nLRU.prototype.evict = function () {\n if (!this.tail) return\n var key = this.tail\n var value = this.remove(this.tail)\n this.emit('evict', {key: key, value: value})\n}\n","/*! lt_donthave. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */\nconst arrayRemove = require('unordered-array-remove')\nconst { EventEmitter } = require('events')\nconst debug = require('debug')('lt_donthave')\n\nmodule.exports = () => {\n class ltDontHave extends EventEmitter {\n constructor (wire) {\n super()\n\n this._peerSupports = false\n this._wire = wire\n }\n\n onExtendedHandshake () {\n this._peerSupports = true\n }\n\n onMessage (buf) {\n let index\n try {\n index = buf.readUInt32BE()\n } catch (err) {\n // drop invalid messages\n return\n }\n\n if (!this._wire.peerPieces.get(index)) return\n debug('got donthave %d', index)\n this._wire.peerPieces.set(index, false)\n\n this.emit('donthave', index)\n this._failRequests(index)\n }\n\n donthave (index) {\n if (!this._peerSupports) return\n\n debug('donthave %d', index)\n const buf = Buffer.alloc(4)\n buf.writeUInt32BE(index)\n\n this._wire.extended('lt_donthave', buf)\n }\n\n _failRequests (index) {\n const requests = this._wire.requests\n for (let i = 0; i < requests.length; i++) {\n const req = requests[i]\n if (req.piece === index) {\n arrayRemove(requests, i)\n i -= 1 // Check the new value at the same slot\n this._wire._callback(req, new Error('peer sent donthave'), null)\n }\n }\n }\n }\n\n // Name of the bittorrent-protocol extension\n ltDontHave.prototype.name = 'lt_donthave'\n\n return ltDontHave\n}\n","module.exports = Storage\n\nconst queueMicrotask = require('queue-microtask')\n\nfunction Storage (chunkLength, opts) {\n if (!(this instanceof Storage)) return new Storage(chunkLength, opts)\n if (!opts) opts = {}\n\n this.chunkLength = Number(chunkLength)\n if (!this.chunkLength) throw new Error('First argument must be a chunk length')\n\n this.chunks = []\n this.closed = false\n this.length = Number(opts.length) || Infinity\n\n if (this.length !== Infinity) {\n this.lastChunkLength = (this.length % this.chunkLength) || this.chunkLength\n this.lastChunkIndex = Math.ceil(this.length / this.chunkLength) - 1\n }\n}\n\nStorage.prototype.put = function (index, buf, cb = () => {}) {\n if (this.closed) return queueMicrotask(() => cb(new Error('Storage is closed')))\n\n const isLastChunk = (index === this.lastChunkIndex)\n if (isLastChunk && buf.length !== this.lastChunkLength) {\n return queueMicrotask(() => cb(new Error('Last chunk length must be ' + this.lastChunkLength)))\n }\n if (!isLastChunk && buf.length !== this.chunkLength) {\n return queueMicrotask(() => cb(new Error('Chunk length must be ' + this.chunkLength)))\n }\n this.chunks[index] = buf\n queueMicrotask(() => cb(null))\n}\n\nStorage.prototype.get = function (index, opts, cb = () => {}) {\n if (typeof opts === 'function') return this.get(index, null, opts)\n if (this.closed) return queueMicrotask(() => cb(new Error('Storage is closed')))\n\n let buf = this.chunks[index]\n\n if (!buf) {\n const err = new Error('Chunk not found')\n err.notFound = true\n return queueMicrotask(() => cb(err))\n }\n\n if (!opts) opts = {}\n\n const offset = opts.offset || 0\n const len = opts.length || (buf.length - offset)\n\n if (offset !== 0 || len !== buf.length) {\n buf = buf.slice(offset, len + offset)\n }\n\n queueMicrotask(() => cb(null, buf))\n}\n\nStorage.prototype.close = Storage.prototype.destroy = function (cb = () => {}) {\n if (this.closed) return queueMicrotask(() => cb(new Error('Storage is closed')))\n this.closed = true\n this.chunks = null\n queueMicrotask(() => cb(null))\n}\n","'use strict';\n\n/**\n * @param typeMap [Object] Map of MIME type -> Array[extensions]\n * @param ...\n */\nfunction Mime() {\n this._types = Object.create(null);\n this._extensions = Object.create(null);\n\n for (let i = 0; i < arguments.length; i++) {\n this.define(arguments[i]);\n }\n\n this.define = this.define.bind(this);\n this.getType = this.getType.bind(this);\n this.getExtension = this.getExtension.bind(this);\n}\n\n/**\n * Define mimetype -> extension mappings. Each key is a mime-type that maps\n * to an array of extensions associated with the type. The first extension is\n * used as the default extension for the type.\n *\n * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']});\n *\n * If a type declares an extension that has already been defined, an error will\n * be thrown. To suppress this error and force the extension to be associated\n * with the new type, pass `force`=true. Alternatively, you may prefix the\n * extension with \"*\" to map the type to extension, without mapping the\n * extension to the type.\n *\n * e.g. mime.define({'audio/wav', ['wav']}, {'audio/x-wav', ['*wav']});\n *\n *\n * @param map (Object) type definitions\n * @param force (Boolean) if true, force overriding of existing definitions\n */\nMime.prototype.define = function(typeMap, force) {\n for (let type in typeMap) {\n let extensions = typeMap[type].map(function(t) {\n return t.toLowerCase();\n });\n type = type.toLowerCase();\n\n for (let i = 0; i < extensions.length; i++) {\n const ext = extensions[i];\n\n // '*' prefix = not the preferred type for this extension. So fixup the\n // extension, and skip it.\n if (ext[0] === '*') {\n continue;\n }\n\n if (!force && (ext in this._types)) {\n throw new Error(\n 'Attempt to change mapping for \"' + ext +\n '\" extension from \"' + this._types[ext] + '\" to \"' + type +\n '\". Pass `force=true` to allow this, otherwise remove \"' + ext +\n '\" from the list of extensions for \"' + type + '\".'\n );\n }\n\n this._types[ext] = type;\n }\n\n // Use first extension as default\n if (force || !this._extensions[type]) {\n const ext = extensions[0];\n this._extensions[type] = (ext[0] !== '*') ? ext : ext.substr(1);\n }\n }\n};\n\n/**\n * Lookup a mime type based on extension\n */\nMime.prototype.getType = function(path) {\n path = String(path);\n let last = path.replace(/^.*[/\\\\]/, '').toLowerCase();\n let ext = last.replace(/^.*\\./, '').toLowerCase();\n\n let hasPath = last.length < path.length;\n let hasDot = ext.length < last.length - 1;\n\n return (hasDot || !hasPath) && this._types[ext] || null;\n};\n\n/**\n * Return file extension associated with a mime type\n */\nMime.prototype.getExtension = function(type) {\n type = /^\\s*([^;\\s]*)/.test(type) && RegExp.$1;\n return type && this._extensions[type.toLowerCase()] || null;\n};\n\nmodule.exports = Mime;\n","'use strict';\n\nlet Mime = require('./Mime');\nmodule.exports = new Mime(require('./types/standard'));\n","module.exports = {\"application/andrew-inset\":[\"ez\"],\"application/applixware\":[\"aw\"],\"application/atom+xml\":[\"atom\"],\"application/atomcat+xml\":[\"atomcat\"],\"application/atomdeleted+xml\":[\"atomdeleted\"],\"application/atomsvc+xml\":[\"atomsvc\"],\"application/atsc-dwd+xml\":[\"dwd\"],\"application/atsc-held+xml\":[\"held\"],\"application/atsc-rsat+xml\":[\"rsat\"],\"application/bdoc\":[\"bdoc\"],\"application/calendar+xml\":[\"xcs\"],\"application/ccxml+xml\":[\"ccxml\"],\"application/cdfx+xml\":[\"cdfx\"],\"application/cdmi-capability\":[\"cdmia\"],\"application/cdmi-container\":[\"cdmic\"],\"application/cdmi-domain\":[\"cdmid\"],\"application/cdmi-object\":[\"cdmio\"],\"application/cdmi-queue\":[\"cdmiq\"],\"application/cu-seeme\":[\"cu\"],\"application/dash+xml\":[\"mpd\"],\"application/davmount+xml\":[\"davmount\"],\"application/docbook+xml\":[\"dbk\"],\"application/dssc+der\":[\"dssc\"],\"application/dssc+xml\":[\"xdssc\"],\"application/ecmascript\":[\"es\",\"ecma\"],\"application/emma+xml\":[\"emma\"],\"application/emotionml+xml\":[\"emotionml\"],\"application/epub+zip\":[\"epub\"],\"application/exi\":[\"exi\"],\"application/express\":[\"exp\"],\"application/fdt+xml\":[\"fdt\"],\"application/font-tdpfr\":[\"pfr\"],\"application/geo+json\":[\"geojson\"],\"application/gml+xml\":[\"gml\"],\"application/gpx+xml\":[\"gpx\"],\"application/gxf\":[\"gxf\"],\"application/gzip\":[\"gz\"],\"application/hjson\":[\"hjson\"],\"application/hyperstudio\":[\"stk\"],\"application/inkml+xml\":[\"ink\",\"inkml\"],\"application/ipfix\":[\"ipfix\"],\"application/its+xml\":[\"its\"],\"application/java-archive\":[\"jar\",\"war\",\"ear\"],\"application/java-serialized-object\":[\"ser\"],\"application/java-vm\":[\"class\"],\"application/javascript\":[\"js\",\"mjs\"],\"application/json\":[\"json\",\"map\"],\"application/json5\":[\"json5\"],\"application/jsonml+json\":[\"jsonml\"],\"application/ld+json\":[\"jsonld\"],\"application/lgr+xml\":[\"lgr\"],\"application/lost+xml\":[\"lostxml\"],\"application/mac-binhex40\":[\"hqx\"],\"application/mac-compactpro\":[\"cpt\"],\"application/mads+xml\":[\"mads\"],\"application/manifest+json\":[\"webmanifest\"],\"application/marc\":[\"mrc\"],\"application/marcxml+xml\":[\"mrcx\"],\"application/mathematica\":[\"ma\",\"nb\",\"mb\"],\"application/mathml+xml\":[\"mathml\"],\"application/mbox\":[\"mbox\"],\"application/mediaservercontrol+xml\":[\"mscml\"],\"application/metalink+xml\":[\"metalink\"],\"application/metalink4+xml\":[\"meta4\"],\"application/mets+xml\":[\"mets\"],\"application/mmt-aei+xml\":[\"maei\"],\"application/mmt-usd+xml\":[\"musd\"],\"application/mods+xml\":[\"mods\"],\"application/mp21\":[\"m21\",\"mp21\"],\"application/mp4\":[\"mp4s\",\"m4p\"],\"application/msword\":[\"doc\",\"dot\"],\"application/mxf\":[\"mxf\"],\"application/n-quads\":[\"nq\"],\"application/n-triples\":[\"nt\"],\"application/node\":[\"cjs\"],\"application/octet-stream\":[\"bin\",\"dms\",\"lrf\",\"mar\",\"so\",\"dist\",\"distz\",\"pkg\",\"bpk\",\"dump\",\"elc\",\"deploy\",\"exe\",\"dll\",\"deb\",\"dmg\",\"iso\",\"img\",\"msi\",\"msp\",\"msm\",\"buffer\"],\"application/oda\":[\"oda\"],\"application/oebps-package+xml\":[\"opf\"],\"application/ogg\":[\"ogx\"],\"application/omdoc+xml\":[\"omdoc\"],\"application/onenote\":[\"onetoc\",\"onetoc2\",\"onetmp\",\"onepkg\"],\"application/oxps\":[\"oxps\"],\"application/p2p-overlay+xml\":[\"relo\"],\"application/patch-ops-error+xml\":[\"xer\"],\"application/pdf\":[\"pdf\"],\"application/pgp-encrypted\":[\"pgp\"],\"application/pgp-signature\":[\"asc\",\"sig\"],\"application/pics-rules\":[\"prf\"],\"application/pkcs10\":[\"p10\"],\"application/pkcs7-mime\":[\"p7m\",\"p7c\"],\"application/pkcs7-signature\":[\"p7s\"],\"application/pkcs8\":[\"p8\"],\"application/pkix-attr-cert\":[\"ac\"],\"application/pkix-cert\":[\"cer\"],\"application/pkix-crl\":[\"crl\"],\"application/pkix-pkipath\":[\"pkipath\"],\"application/pkixcmp\":[\"pki\"],\"application/pls+xml\":[\"pls\"],\"application/postscript\":[\"ai\",\"eps\",\"ps\"],\"application/provenance+xml\":[\"provx\"],\"application/pskc+xml\":[\"pskcxml\"],\"application/raml+yaml\":[\"raml\"],\"application/rdf+xml\":[\"rdf\",\"owl\"],\"application/reginfo+xml\":[\"rif\"],\"application/relax-ng-compact-syntax\":[\"rnc\"],\"application/resource-lists+xml\":[\"rl\"],\"application/resource-lists-diff+xml\":[\"rld\"],\"application/rls-services+xml\":[\"rs\"],\"application/route-apd+xml\":[\"rapd\"],\"application/route-s-tsid+xml\":[\"sls\"],\"application/route-usd+xml\":[\"rusd\"],\"application/rpki-ghostbusters\":[\"gbr\"],\"application/rpki-manifest\":[\"mft\"],\"application/rpki-roa\":[\"roa\"],\"application/rsd+xml\":[\"rsd\"],\"application/rss+xml\":[\"rss\"],\"application/rtf\":[\"rtf\"],\"application/sbml+xml\":[\"sbml\"],\"application/scvp-cv-request\":[\"scq\"],\"application/scvp-cv-response\":[\"scs\"],\"application/scvp-vp-request\":[\"spq\"],\"application/scvp-vp-response\":[\"spp\"],\"application/sdp\":[\"sdp\"],\"application/senml+xml\":[\"senmlx\"],\"application/sensml+xml\":[\"sensmlx\"],\"application/set-payment-initiation\":[\"setpay\"],\"application/set-registration-initiation\":[\"setreg\"],\"application/shf+xml\":[\"shf\"],\"application/sieve\":[\"siv\",\"sieve\"],\"application/smil+xml\":[\"smi\",\"smil\"],\"application/sparql-query\":[\"rq\"],\"application/sparql-results+xml\":[\"srx\"],\"application/srgs\":[\"gram\"],\"application/srgs+xml\":[\"grxml\"],\"application/sru+xml\":[\"sru\"],\"application/ssdl+xml\":[\"ssdl\"],\"application/ssml+xml\":[\"ssml\"],\"application/swid+xml\":[\"swidtag\"],\"application/tei+xml\":[\"tei\",\"teicorpus\"],\"application/thraud+xml\":[\"tfi\"],\"application/timestamped-data\":[\"tsd\"],\"application/toml\":[\"toml\"],\"application/trig\":[\"trig\"],\"application/ttml+xml\":[\"ttml\"],\"application/ubjson\":[\"ubj\"],\"application/urc-ressheet+xml\":[\"rsheet\"],\"application/urc-targetdesc+xml\":[\"td\"],\"application/voicexml+xml\":[\"vxml\"],\"application/wasm\":[\"wasm\"],\"application/widget\":[\"wgt\"],\"application/winhlp\":[\"hlp\"],\"application/wsdl+xml\":[\"wsdl\"],\"application/wspolicy+xml\":[\"wspolicy\"],\"application/xaml+xml\":[\"xaml\"],\"application/xcap-att+xml\":[\"xav\"],\"application/xcap-caps+xml\":[\"xca\"],\"application/xcap-diff+xml\":[\"xdf\"],\"application/xcap-el+xml\":[\"xel\"],\"application/xcap-ns+xml\":[\"xns\"],\"application/xenc+xml\":[\"xenc\"],\"application/xhtml+xml\":[\"xhtml\",\"xht\"],\"application/xliff+xml\":[\"xlf\"],\"application/xml\":[\"xml\",\"xsl\",\"xsd\",\"rng\"],\"application/xml-dtd\":[\"dtd\"],\"application/xop+xml\":[\"xop\"],\"application/xproc+xml\":[\"xpl\"],\"application/xslt+xml\":[\"*xsl\",\"xslt\"],\"application/xspf+xml\":[\"xspf\"],\"application/xv+xml\":[\"mxml\",\"xhvml\",\"xvml\",\"xvm\"],\"application/yang\":[\"yang\"],\"application/yin+xml\":[\"yin\"],\"application/zip\":[\"zip\"],\"audio/3gpp\":[\"*3gpp\"],\"audio/adpcm\":[\"adp\"],\"audio/amr\":[\"amr\"],\"audio/basic\":[\"au\",\"snd\"],\"audio/midi\":[\"mid\",\"midi\",\"kar\",\"rmi\"],\"audio/mobile-xmf\":[\"mxmf\"],\"audio/mp3\":[\"*mp3\"],\"audio/mp4\":[\"m4a\",\"mp4a\"],\"audio/mpeg\":[\"mpga\",\"mp2\",\"mp2a\",\"mp3\",\"m2a\",\"m3a\"],\"audio/ogg\":[\"oga\",\"ogg\",\"spx\",\"opus\"],\"audio/s3m\":[\"s3m\"],\"audio/silk\":[\"sil\"],\"audio/wav\":[\"wav\"],\"audio/wave\":[\"*wav\"],\"audio/webm\":[\"weba\"],\"audio/xm\":[\"xm\"],\"font/collection\":[\"ttc\"],\"font/otf\":[\"otf\"],\"font/ttf\":[\"ttf\"],\"font/woff\":[\"woff\"],\"font/woff2\":[\"woff2\"],\"image/aces\":[\"exr\"],\"image/apng\":[\"apng\"],\"image/avif\":[\"avif\"],\"image/bmp\":[\"bmp\"],\"image/cgm\":[\"cgm\"],\"image/dicom-rle\":[\"drle\"],\"image/emf\":[\"emf\"],\"image/fits\":[\"fits\"],\"image/g3fax\":[\"g3\"],\"image/gif\":[\"gif\"],\"image/heic\":[\"heic\"],\"image/heic-sequence\":[\"heics\"],\"image/heif\":[\"heif\"],\"image/heif-sequence\":[\"heifs\"],\"image/hej2k\":[\"hej2\"],\"image/hsj2\":[\"hsj2\"],\"image/ief\":[\"ief\"],\"image/jls\":[\"jls\"],\"image/jp2\":[\"jp2\",\"jpg2\"],\"image/jpeg\":[\"jpeg\",\"jpg\",\"jpe\"],\"image/jph\":[\"jph\"],\"image/jphc\":[\"jhc\"],\"image/jpm\":[\"jpm\"],\"image/jpx\":[\"jpx\",\"jpf\"],\"image/jxr\":[\"jxr\"],\"image/jxra\":[\"jxra\"],\"image/jxrs\":[\"jxrs\"],\"image/jxs\":[\"jxs\"],\"image/jxsc\":[\"jxsc\"],\"image/jxsi\":[\"jxsi\"],\"image/jxss\":[\"jxss\"],\"image/ktx\":[\"ktx\"],\"image/ktx2\":[\"ktx2\"],\"image/png\":[\"png\"],\"image/sgi\":[\"sgi\"],\"image/svg+xml\":[\"svg\",\"svgz\"],\"image/t38\":[\"t38\"],\"image/tiff\":[\"tif\",\"tiff\"],\"image/tiff-fx\":[\"tfx\"],\"image/webp\":[\"webp\"],\"image/wmf\":[\"wmf\"],\"message/disposition-notification\":[\"disposition-notification\"],\"message/global\":[\"u8msg\"],\"message/global-delivery-status\":[\"u8dsn\"],\"message/global-disposition-notification\":[\"u8mdn\"],\"message/global-headers\":[\"u8hdr\"],\"message/rfc822\":[\"eml\",\"mime\"],\"model/3mf\":[\"3mf\"],\"model/gltf+json\":[\"gltf\"],\"model/gltf-binary\":[\"glb\"],\"model/iges\":[\"igs\",\"iges\"],\"model/mesh\":[\"msh\",\"mesh\",\"silo\"],\"model/mtl\":[\"mtl\"],\"model/obj\":[\"obj\"],\"model/step+xml\":[\"stpx\"],\"model/step+zip\":[\"stpz\"],\"model/step-xml+zip\":[\"stpxz\"],\"model/stl\":[\"stl\"],\"model/vrml\":[\"wrl\",\"vrml\"],\"model/x3d+binary\":[\"*x3db\",\"x3dbz\"],\"model/x3d+fastinfoset\":[\"x3db\"],\"model/x3d+vrml\":[\"*x3dv\",\"x3dvz\"],\"model/x3d+xml\":[\"x3d\",\"x3dz\"],\"model/x3d-vrml\":[\"x3dv\"],\"text/cache-manifest\":[\"appcache\",\"manifest\"],\"text/calendar\":[\"ics\",\"ifb\"],\"text/coffeescript\":[\"coffee\",\"litcoffee\"],\"text/css\":[\"css\"],\"text/csv\":[\"csv\"],\"text/html\":[\"html\",\"htm\",\"shtml\"],\"text/jade\":[\"jade\"],\"text/jsx\":[\"jsx\"],\"text/less\":[\"less\"],\"text/markdown\":[\"markdown\",\"md\"],\"text/mathml\":[\"mml\"],\"text/mdx\":[\"mdx\"],\"text/n3\":[\"n3\"],\"text/plain\":[\"txt\",\"text\",\"conf\",\"def\",\"list\",\"log\",\"in\",\"ini\"],\"text/richtext\":[\"rtx\"],\"text/rtf\":[\"*rtf\"],\"text/sgml\":[\"sgml\",\"sgm\"],\"text/shex\":[\"shex\"],\"text/slim\":[\"slim\",\"slm\"],\"text/spdx\":[\"spdx\"],\"text/stylus\":[\"stylus\",\"styl\"],\"text/tab-separated-values\":[\"tsv\"],\"text/troff\":[\"t\",\"tr\",\"roff\",\"man\",\"me\",\"ms\"],\"text/turtle\":[\"ttl\"],\"text/uri-list\":[\"uri\",\"uris\",\"urls\"],\"text/vcard\":[\"vcard\"],\"text/vtt\":[\"vtt\"],\"text/xml\":[\"*xml\"],\"text/yaml\":[\"yaml\",\"yml\"],\"video/3gpp\":[\"3gp\",\"3gpp\"],\"video/3gpp2\":[\"3g2\"],\"video/h261\":[\"h261\"],\"video/h263\":[\"h263\"],\"video/h264\":[\"h264\"],\"video/iso.segment\":[\"m4s\"],\"video/jpeg\":[\"jpgv\"],\"video/jpm\":[\"*jpm\",\"jpgm\"],\"video/mj2\":[\"mj2\",\"mjp2\"],\"video/mp2t\":[\"ts\"],\"video/mp4\":[\"mp4\",\"mp4v\",\"mpg4\"],\"video/mpeg\":[\"mpeg\",\"mpg\",\"mpe\",\"m1v\",\"m2v\"],\"video/ogg\":[\"ogv\"],\"video/quicktime\":[\"qt\",\"mov\"],\"video/webm\":[\"webm\"]};","/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n","var wrappy = require('wrappy')\nmodule.exports = wrappy(once)\nmodule.exports.strict = wrappy(onceStrict)\n\nonce.proto = once(function () {\n Object.defineProperty(Function.prototype, 'once', {\n value: function () {\n return once(this)\n },\n configurable: true\n })\n\n Object.defineProperty(Function.prototype, 'onceStrict', {\n value: function () {\n return onceStrict(this)\n },\n configurable: true\n })\n})\n\nfunction once (fn) {\n var f = function () {\n if (f.called) return f.value\n f.called = true\n return f.value = fn.apply(this, arguments)\n }\n f.called = false\n return f\n}\n\nfunction onceStrict (fn) {\n var f = function () {\n if (f.called)\n throw new Error(f.onceError)\n f.called = true\n return f.value = fn.apply(this, arguments)\n }\n var name = fn.name || 'Function wrapped with `once`'\n f.onceError = name + \" shouldn't be called more than once\"\n f.called = false\n return f\n}\n","// 'path' module extracted from Node.js v8.11.1 (only the posix part)\n// transplited with Babel\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nfunction assertPath(path) {\n if (typeof path !== 'string') {\n throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));\n }\n}\n\n// Resolves . and .. elements in a path with directory names\nfunction normalizeStringPosix(path, allowAboveRoot) {\n var res = '';\n var lastSegmentLength = 0;\n var lastSlash = -1;\n var dots = 0;\n var code;\n for (var i = 0; i <= path.length; ++i) {\n if (i < path.length)\n code = path.charCodeAt(i);\n else if (code === 47 /*/*/)\n break;\n else\n code = 47 /*/*/;\n if (code === 47 /*/*/) {\n if (lastSlash === i - 1 || dots === 1) {\n // NOOP\n } else if (lastSlash !== i - 1 && dots === 2) {\n if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {\n if (res.length > 2) {\n var lastSlashIndex = res.lastIndexOf('/');\n if (lastSlashIndex !== res.length - 1) {\n if (lastSlashIndex === -1) {\n res = '';\n lastSegmentLength = 0;\n } else {\n res = res.slice(0, lastSlashIndex);\n lastSegmentLength = res.length - 1 - res.lastIndexOf('/');\n }\n lastSlash = i;\n dots = 0;\n continue;\n }\n } else if (res.length === 2 || res.length === 1) {\n res = '';\n lastSegmentLength = 0;\n lastSlash = i;\n dots = 0;\n continue;\n }\n }\n if (allowAboveRoot) {\n if (res.length > 0)\n res += '/..';\n else\n res = '..';\n lastSegmentLength = 2;\n }\n } else {\n if (res.length > 0)\n res += '/' + path.slice(lastSlash + 1, i);\n else\n res = path.slice(lastSlash + 1, i);\n lastSegmentLength = i - lastSlash - 1;\n }\n lastSlash = i;\n dots = 0;\n } else if (code === 46 /*.*/ && dots !== -1) {\n ++dots;\n } else {\n dots = -1;\n }\n }\n return res;\n}\n\nfunction _format(sep, pathObject) {\n var dir = pathObject.dir || pathObject.root;\n var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');\n if (!dir) {\n return base;\n }\n if (dir === pathObject.root) {\n return dir + base;\n }\n return dir + sep + base;\n}\n\nvar posix = {\n // path.resolve([from ...], to)\n resolve: function resolve() {\n var resolvedPath = '';\n var resolvedAbsolute = false;\n var cwd;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path;\n if (i >= 0)\n path = arguments[i];\n else {\n if (cwd === undefined)\n cwd = process.cwd();\n path = cwd;\n }\n\n assertPath(path);\n\n // Skip empty entries\n if (path.length === 0) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);\n\n if (resolvedAbsolute) {\n if (resolvedPath.length > 0)\n return '/' + resolvedPath;\n else\n return '/';\n } else if (resolvedPath.length > 0) {\n return resolvedPath;\n } else {\n return '.';\n }\n },\n\n normalize: function normalize(path) {\n assertPath(path);\n\n if (path.length === 0) return '.';\n\n var isAbsolute = path.charCodeAt(0) === 47 /*/*/;\n var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;\n\n // Normalize the path\n path = normalizeStringPosix(path, !isAbsolute);\n\n if (path.length === 0 && !isAbsolute) path = '.';\n if (path.length > 0 && trailingSeparator) path += '/';\n\n if (isAbsolute) return '/' + path;\n return path;\n },\n\n isAbsolute: function isAbsolute(path) {\n assertPath(path);\n return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;\n },\n\n join: function join() {\n if (arguments.length === 0)\n return '.';\n var joined;\n for (var i = 0; i < arguments.length; ++i) {\n var arg = arguments[i];\n assertPath(arg);\n if (arg.length > 0) {\n if (joined === undefined)\n joined = arg;\n else\n joined += '/' + arg;\n }\n }\n if (joined === undefined)\n return '.';\n return posix.normalize(joined);\n },\n\n relative: function relative(from, to) {\n assertPath(from);\n assertPath(to);\n\n if (from === to) return '';\n\n from = posix.resolve(from);\n to = posix.resolve(to);\n\n if (from === to) return '';\n\n // Trim any leading backslashes\n var fromStart = 1;\n for (; fromStart < from.length; ++fromStart) {\n if (from.charCodeAt(fromStart) !== 47 /*/*/)\n break;\n }\n var fromEnd = from.length;\n var fromLen = fromEnd - fromStart;\n\n // Trim any leading backslashes\n var toStart = 1;\n for (; toStart < to.length; ++toStart) {\n if (to.charCodeAt(toStart) !== 47 /*/*/)\n break;\n }\n var toEnd = to.length;\n var toLen = toEnd - toStart;\n\n // Compare paths to find the longest common path from root\n var length = fromLen < toLen ? fromLen : toLen;\n var lastCommonSep = -1;\n var i = 0;\n for (; i <= length; ++i) {\n if (i === length) {\n if (toLen > length) {\n if (to.charCodeAt(toStart + i) === 47 /*/*/) {\n // We get here if `from` is the exact base path for `to`.\n // For example: from='/foo/bar'; to='/foo/bar/baz'\n return to.slice(toStart + i + 1);\n } else if (i === 0) {\n // We get here if `from` is the root\n // For example: from='/'; to='/foo'\n return to.slice(toStart + i);\n }\n } else if (fromLen > length) {\n if (from.charCodeAt(fromStart + i) === 47 /*/*/) {\n // We get here if `to` is the exact base path for `from`.\n // For example: from='/foo/bar/baz'; to='/foo/bar'\n lastCommonSep = i;\n } else if (i === 0) {\n // We get here if `to` is the root.\n // For example: from='/foo'; to='/'\n lastCommonSep = 0;\n }\n }\n break;\n }\n var fromCode = from.charCodeAt(fromStart + i);\n var toCode = to.charCodeAt(toStart + i);\n if (fromCode !== toCode)\n break;\n else if (fromCode === 47 /*/*/)\n lastCommonSep = i;\n }\n\n var out = '';\n // Generate the relative path based on the path difference between `to`\n // and `from`\n for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {\n if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {\n if (out.length === 0)\n out += '..';\n else\n out += '/..';\n }\n }\n\n // Lastly, append the rest of the destination (`to`) path that comes after\n // the common path parts\n if (out.length > 0)\n return out + to.slice(toStart + lastCommonSep);\n else {\n toStart += lastCommonSep;\n if (to.charCodeAt(toStart) === 47 /*/*/)\n ++toStart;\n return to.slice(toStart);\n }\n },\n\n _makeLong: function _makeLong(path) {\n return path;\n },\n\n dirname: function dirname(path) {\n assertPath(path);\n if (path.length === 0) return '.';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? '/' : '.';\n if (hasRoot && end === 1) return '//';\n return path.slice(0, end);\n },\n\n basename: function basename(path, ext) {\n if (ext !== undefined && typeof ext !== 'string') throw new TypeError('\"ext\" argument must be a string');\n assertPath(path);\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {\n if (ext.length === path.length && ext === path) return '';\n var extIdx = ext.length - 1;\n var firstNonSlashEnd = -1;\n for (i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else {\n if (firstNonSlashEnd === -1) {\n // We saw the first non-path separator, remember this index in case\n // we need it if the extension ends up not matching\n matchedSlash = false;\n firstNonSlashEnd = i + 1;\n }\n if (extIdx >= 0) {\n // Try to match the explicit extension\n if (code === ext.charCodeAt(extIdx)) {\n if (--extIdx === -1) {\n // We matched the extension, so mark this as the end of our path\n // component\n end = i;\n }\n } else {\n // Extension does not match, so our result is the entire path\n // component\n extIdx = -1;\n end = firstNonSlashEnd;\n }\n }\n }\n }\n\n if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;\n return path.slice(start, end);\n } else {\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return '';\n return path.slice(start, end);\n }\n },\n\n extname: function extname(path) {\n assertPath(path);\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return '';\n }\n return path.slice(startDot, end);\n },\n\n format: function format(pathObject) {\n if (pathObject === null || typeof pathObject !== 'object') {\n throw new TypeError('The \"pathObject\" argument must be of type Object. Received type ' + typeof pathObject);\n }\n return _format('/', pathObject);\n },\n\n parse: function parse(path) {\n assertPath(path);\n\n var ret = { root: '', dir: '', base: '', ext: '', name: '' };\n if (path.length === 0) return ret;\n var code = path.charCodeAt(0);\n var isAbsolute = code === 47 /*/*/;\n var start;\n if (isAbsolute) {\n ret.root = '/';\n start = 1;\n } else {\n start = 0;\n }\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n var i = path.length - 1;\n\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n\n // Get non-dir info\n for (; i >= start; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly '..'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n if (end !== -1) {\n if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);\n }\n } else {\n if (startPart === 0 && isAbsolute) {\n ret.name = path.slice(1, startDot);\n ret.base = path.slice(1, end);\n } else {\n ret.name = path.slice(startPart, startDot);\n ret.base = path.slice(startPart, end);\n }\n ret.ext = path.slice(startDot, end);\n }\n\n if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';\n\n return ret;\n },\n\n sep: '/',\n delimiter: ':',\n win32: null,\n posix: null\n};\n\nposix.posix = posix;\n\nmodule.exports = posix;\n","module.exports = length\n\nfunction length (bytes) {\n return Math.max(16384, 1 << Math.log2(bytes < 1024 ? 1 : bytes / 1024) + 0.5 | 0)\n}\n","var once = require('once')\nvar eos = require('end-of-stream')\nvar fs = require('fs') // we only need fs to get the ReadStream and WriteStream prototypes\n\nvar noop = function () {}\nvar ancient = /^v?\\.0/.test(process.version)\n\nvar isFn = function (fn) {\n return typeof fn === 'function'\n}\n\nvar isFS = function (stream) {\n if (!ancient) return false // newer node version do not need to care about fs is a special way\n if (!fs) return false // browser\n return (stream instanceof (fs.ReadStream || noop) || stream instanceof (fs.WriteStream || noop)) && isFn(stream.close)\n}\n\nvar isRequest = function (stream) {\n return stream.setHeader && isFn(stream.abort)\n}\n\nvar destroyer = function (stream, reading, writing, callback) {\n callback = once(callback)\n\n var closed = false\n stream.on('close', function () {\n closed = true\n })\n\n eos(stream, {readable: reading, writable: writing}, function (err) {\n if (err) return callback(err)\n closed = true\n callback()\n })\n\n var destroyed = false\n return function (err) {\n if (closed) return\n if (destroyed) return\n destroyed = true\n\n if (isFS(stream)) return stream.close(noop) // use close for fs streams to avoid fd leaks\n if (isRequest(stream)) return stream.abort() // request.destroy just do .end - .abort is what we want\n\n if (isFn(stream.destroy)) return stream.destroy()\n\n callback(err || new Error('stream was destroyed'))\n }\n}\n\nvar call = function (fn) {\n fn()\n}\n\nvar pipe = function (from, to) {\n return from.pipe(to)\n}\n\nvar pump = function () {\n var streams = Array.prototype.slice.call(arguments)\n var callback = isFn(streams[streams.length - 1] || noop) && streams.pop() || noop\n\n if (Array.isArray(streams[0])) streams = streams[0]\n if (streams.length < 2) throw new Error('pump requires two streams per minimum')\n\n var error\n var destroys = streams.map(function (stream, i) {\n var reading = i < streams.length - 1\n var writing = i > 0\n return destroyer(stream, reading, writing, function (err) {\n if (!error) error = err\n if (err) destroys.forEach(call)\n if (reading) return\n destroys.forEach(call)\n callback(error)\n })\n })\n\n return streams.reduce(pipe)\n}\n\nmodule.exports = pump\n","/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */\nlet promise\n\nmodule.exports = typeof queueMicrotask === 'function'\n ? queueMicrotask.bind(typeof window !== 'undefined' ? window : global)\n // reuse resolved promise, and allocate it lazily\n : cb => (promise || (promise = Promise.resolve()))\n .then(cb)\n .catch(err => setTimeout(() => { throw err }, 0))\n","module.exports = typeof queueMicrotask === 'function' ? queueMicrotask : (fn) => Promise.resolve().then(fn)\n","var iterate = function (list) {\n var offset = 0\n return function () {\n if (offset === list.length) return null\n\n var len = list.length - offset\n var i = (Math.random() * len) | 0\n var el = list[offset + i]\n\n var tmp = list[offset]\n list[offset] = el\n list[offset + i] = tmp\n offset++\n\n return el\n }\n}\n\nmodule.exports = iterate\n","/*!\n * range-parser\n * Copyright(c) 2012-2014 TJ Holowaychuk\n * Copyright(c) 2015-2016 Douglas Christopher Wilson\n * MIT Licensed\n */\n\n'use strict'\n\n/**\n * Module exports.\n * @public\n */\n\nmodule.exports = rangeParser\n\n/**\n * Parse \"Range\" header `str` relative to the given file `size`.\n *\n * @param {Number} size\n * @param {String} str\n * @param {Object} [options]\n * @return {Array}\n * @public\n */\n\nfunction rangeParser (size, str, options) {\n if (typeof str !== 'string') {\n throw new TypeError('argument str must be a string')\n }\n\n var index = str.indexOf('=')\n\n if (index === -1) {\n return -2\n }\n\n // split the range string\n var arr = str.slice(index + 1).split(',')\n var ranges = []\n\n // add ranges type\n ranges.type = str.slice(0, index)\n\n // parse all ranges\n for (var i = 0; i < arr.length; i++) {\n var range = arr[i].split('-')\n var start = parseInt(range[0], 10)\n var end = parseInt(range[1], 10)\n\n // -nnn\n if (isNaN(start)) {\n start = size - end\n end = size - 1\n // nnn-\n } else if (isNaN(end)) {\n end = size - 1\n }\n\n // limit last-byte-pos to current length\n if (end > size - 1) {\n end = size - 1\n }\n\n // invalid or unsatisifiable\n if (isNaN(start) || isNaN(end) || start > end || start < 0) {\n continue\n }\n\n // add range\n ranges.push({\n start: start,\n end: end\n })\n }\n\n if (ranges.length < 1) {\n // unsatisifiable\n return -1\n }\n\n return options && options.combine\n ? combineRanges(ranges)\n : ranges\n}\n\n/**\n * Combine overlapping & adjacent ranges.\n * @private\n */\n\nfunction combineRanges (ranges) {\n var ordered = ranges.map(mapWithIndex).sort(sortByRangeStart)\n\n for (var j = 0, i = 1; i < ordered.length; i++) {\n var range = ordered[i]\n var current = ordered[j]\n\n if (range.start > current.end + 1) {\n // next range\n ordered[++j] = range\n } else if (range.end > current.end) {\n // extend range\n current.end = range.end\n current.index = Math.min(current.index, range.index)\n }\n }\n\n // trim ordered array\n ordered.length = j + 1\n\n // generate combined range\n var combined = ordered.sort(sortByRangeIndex).map(mapWithoutIndex)\n\n // copy ranges type\n combined.type = ranges.type\n\n return combined\n}\n\n/**\n * Map function to add index value to ranges.\n * @private\n */\n\nfunction mapWithIndex (range, index) {\n return {\n start: range.start,\n end: range.end,\n index: index\n }\n}\n\n/**\n * Map function to remove index value from ranges.\n * @private\n */\n\nfunction mapWithoutIndex (range) {\n return {\n start: range.start,\n end: range.end\n }\n}\n\n/**\n * Sort function to sort ranges by index.\n * @private\n */\n\nfunction sortByRangeIndex (a, b) {\n return a.index - b.index\n}\n\n/**\n * Sort function to sort ranges by start position.\n * @private\n */\n\nfunction sortByRangeStart (a, b) {\n return a.start - b.start\n}\n","\"use strict\";\n\n// Based on RC4 algorithm, as described in\n// http://en.wikipedia.org/wiki/RC4\n\nfunction isInteger(n) {\n return parseInt(n, 10) === n;\n}\n\nfunction createRC4(N) {\n function identityPermutation() {\n var s = new Array(N);\n for (var i = 0; i < N; i++) {\n s[i] = i;\n }\n return s;\n }\n\n // :: string | array integer -> array integer\n function seed(key) {\n if (key === undefined) {\n key = new Array(N);\n for (var k = 0; k < N; k++) {\n key[k] = Math.floor(Math.random() * N);\n }\n } else if (typeof key === \"string\") {\n // to string\n key = \"\" + key;\n key = key.split(\"\").map(function (c) { return c.charCodeAt(0) % N; });\n } else if (Array.isArray(key)) {\n if (!key.every(function (v) {\n return typeof v === \"number\" && v === (v | 0);\n })) {\n throw new TypeError(\"invalid seed key specified: not array of integers\");\n }\n } else {\n throw new TypeError(\"invalid seed key specified\");\n }\n\n var keylen = key.length;\n\n // resed state\n var s = identityPermutation();\n\n var j = 0;\n for (var i = 0; i < N; i++) {\n j = (j + s[i] + key[i % keylen]) % N;\n var tmp = s[i];\n s[i] = s[j];\n s[j] = tmp;\n }\n\n return s;\n }\n\n /* eslint-disable no-shadow */\n function RC4(key) {\n this.s = seed(key);\n this.i = 0;\n this.j = 0;\n }\n /* eslint-enable no-shadow */\n\n RC4.prototype.randomNative = function () {\n this.i = (this.i + 1) % N;\n this.j = (this.j + this.s[this.i]) % N;\n\n var tmp = this.s[this.i];\n this.s[this.i] = this.s[this.j];\n this.s[this.j] = tmp;\n\n var k = this.s[(this.s[this.i] + this.s[this.j]) % N];\n\n return k;\n };\n\n RC4.prototype.randomUInt32 = function () {\n var a = this.randomByte();\n var b = this.randomByte();\n var c = this.randomByte();\n var d = this.randomByte();\n\n return ((a * 256 + b) * 256 + c) * 256 + d;\n };\n\n RC4.prototype.randomFloat = function () {\n return this.randomUInt32() / 0x100000000;\n };\n\n RC4.prototype.random = function () {\n var a;\n var b;\n\n if (arguments.length === 1) {\n a = 0;\n b = arguments[0];\n } else if (arguments.length === 2) {\n a = arguments[0];\n b = arguments[1];\n } else {\n throw new TypeError(\"random takes one or two integer arguments\");\n }\n\n if (!isInteger(a) || !isInteger(b)) {\n throw new TypeError(\"random takes one or two integer arguments\");\n }\n\n return a + this.randomUInt32() % (b - a + 1);\n };\n\n RC4.prototype.currentState = function () {\n return {\n i: this.i,\n j: this.j,\n s: this.s.slice(), // copy\n };\n };\n\n RC4.prototype.setState = function (state) {\n var s = state.s;\n var i = state.i;\n var j = state.j;\n\n /* eslint-disable yoda */\n if (!(i === (i | 0) && 0 <= i && i < N)) {\n throw new Error(\"state.i should be integer [0, \" + (N - 1) + \"]\");\n }\n\n if (!(j === (j | 0) && 0 <= j && j < N)) {\n throw new Error(\"state.j should be integer [0, \" + (N - 1) + \"]\");\n }\n /* eslint-enable yoda */\n\n // check length\n if (!Array.isArray(s) || s.length !== N) {\n throw new Error(\"state should be array of length \" + N);\n }\n\n // check that all params are there\n for (var k = 0; k < N; k++) {\n if (s.indexOf(k) === -1) {\n throw new Error(\"state should be permutation of 0..\" + (N - 1) + \": \" + k + \" is missing\");\n }\n }\n\n this.i = i;\n this.j = j;\n this.s = s.slice(); // assign copy\n };\n\n return RC4;\n}\n\nvar RC4 = createRC4(256);\nRC4.prototype.randomByte = RC4.prototype.randomNative;\n\nvar RC4small = createRC4(16);\nRC4small.prototype.randomByte = function () {\n var a = this.randomNative();\n var b = this.randomNative();\n\n return a * 16 + b;\n};\n\nvar ordA = \"a\".charCodeAt(0);\nvar ord0 = \"0\".charCodeAt(0);\n\nfunction toHex(n) {\n return n < 10 ? String.fromCharCode(ord0 + n) : String.fromCharCode(ordA + n - 10);\n}\n\nfunction fromHex(c) {\n return parseInt(c, 16);\n}\n\nRC4small.prototype.currentStateString = function () {\n var state = this.currentState();\n\n var i = toHex(state.i);\n var j = toHex(state.j);\n\n var res = i + j + state.s.map(toHex).join(\"\");\n return res;\n};\n\nRC4small.prototype.setStateString = function (stateString) {\n if (!stateString.match(/^[0-9a-f]{18}$/)) {\n throw new TypeError(\"RC4small stateString should be 18 hex character string\");\n }\n\n var i = fromHex(stateString[0]);\n var j = fromHex(stateString[1]);\n var s = stateString.split(\"\").slice(2).map(fromHex);\n\n this.setState({\n i: i,\n j: j,\n s: s,\n });\n};\n\nRC4.RC4small = RC4small;\n\nmodule.exports = RC4;\n","/*! run-parallel-limit. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */\nmodule.exports = runParallelLimit\n\nconst queueMicrotask = require('queue-microtask')\n\nfunction runParallelLimit (tasks, limit, cb) {\n if (typeof limit !== 'number') throw new Error('second argument must be a Number')\n let results, len, pending, keys, isErrored\n let isSync = true\n let next\n\n if (Array.isArray(tasks)) {\n results = []\n pending = len = tasks.length\n } else {\n keys = Object.keys(tasks)\n results = {}\n pending = len = keys.length\n }\n\n function done (err) {\n function end () {\n if (cb) cb(err, results)\n cb = null\n }\n if (isSync) queueMicrotask(end)\n else end()\n }\n\n function each (i, err, result) {\n results[i] = result\n if (err) isErrored = true\n if (--pending === 0 || err) {\n done(err)\n } else if (!isErrored && next < len) {\n let key\n if (keys) {\n key = keys[next]\n next += 1\n tasks[key](function (err, result) { each(key, err, result) })\n } else {\n key = next\n next += 1\n tasks[key](function (err, result) { each(key, err, result) })\n }\n }\n }\n\n next = limit\n if (!pending) {\n // empty\n done(null)\n } else if (keys) {\n // object\n keys.some(function (key, i) {\n tasks[key](function (err, result) { each(key, err, result) })\n if (i === limit - 1) return true // early return\n return false\n })\n } else {\n // array\n tasks.some(function (task, i) {\n task(function (err, result) { each(i, err, result) })\n if (i === limit - 1) return true // early return\n return false\n })\n }\n\n isSync = false\n}\n","/*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */\nmodule.exports = runParallel\n\nconst queueMicrotask = require('queue-microtask')\n\nfunction runParallel (tasks, cb) {\n let results, pending, keys\n let isSync = true\n\n if (Array.isArray(tasks)) {\n results = []\n pending = tasks.length\n } else {\n keys = Object.keys(tasks)\n results = {}\n pending = keys.length\n }\n\n function done (err) {\n function end () {\n if (cb) cb(err, results)\n cb = null\n }\n if (isSync) queueMicrotask(end)\n else end()\n }\n\n function each (i, err, result) {\n results[i] = result\n if (--pending === 0 || err) {\n done(err)\n }\n }\n\n if (!pending) {\n // empty\n done(null)\n } else if (keys) {\n // object\n keys.forEach(function (key) {\n tasks[key](function (err, result) { each(key, err, result) })\n })\n } else {\n // array\n tasks.forEach(function (task, i) {\n task(function (err, result) { each(i, err, result) })\n })\n }\n\n isSync = false\n}\n","const Throttle = require('./lib/throttle')\nconst ThrottleGroup = require('./lib/throttle-group')\n\nmodule.exports = {\n Throttle,\n ThrottleGroup\n}\n","const { TokenBucket } = require('limiter')\nconst Throttle = require('./throttle')\n\nclass ThrottleGroup {\n constructor (opts = {}) {\n if (typeof opts !== 'object') throw new Error('Options must be an object')\n\n this.throttles = []\n this.setEnabled(opts.enabled)\n this.setRate(opts.rate, opts.chunksize)\n }\n\n getEnabled () {\n return this._enabled\n }\n\n getRate () {\n // Note: bucketSize === tokensPerInterval\n return this.bucket.tokensPerInterval\n }\n\n getChunksize () {\n return this.chunksize\n }\n\n setEnabled (val = true) {\n if (typeof val !== 'boolean') throw new Error('Enabled must be a boolean')\n\n this._enabled = val\n for (const throttle of this.throttles) {\n throttle.setEnabled(val)\n }\n }\n\n setRate (rate, chunksize = null) {\n // Note: rate = 0, means we should stop processing chunks\n if (!Number.isInteger(rate) || rate < 0) throw new Error('Rate must be an integer bigger than zero')\n rate = parseInt(rate)\n\n if (chunksize && (typeof chunksize !== 'number' || chunksize <= 0)) throw new Error('Chunksize must be bigger than zero')\n chunksize = chunksize || Math.max(parseInt(rate / 10), 1)\n chunksize = parseInt(chunksize)\n if (rate > 0 && chunksize > rate) throw new Error('Chunk size must be smaller than rate')\n\n if (!this.bucket) this.bucket = new TokenBucket(rate, rate, 'second', null)\n\n this.bucket.bucketSize = rate\n this.bucket.tokensPerInterval = rate\n this.chunksize = chunksize\n }\n\n setChunksize (chunksize) {\n if (!Number.isInteger(chunksize) || chunksize <= 0) throw new Error('Chunk size must be an integer bigger than zero')\n const rate = this.getRate()\n chunksize = parseInt(chunksize)\n if (rate > 0 && chunksize > rate) throw new Error('Chunk size must be smaller than rate')\n this.chunksize = chunksize\n }\n\n throttle (opts = {}) {\n if (typeof opts !== 'object') throw new Error('Options must be an object')\n\n const newThrottle = new Throttle({\n ...opts,\n group: this\n })\n\n return newThrottle\n }\n\n destroy () {\n for (const throttle of this.throttles) {\n throttle.destroy()\n }\n\n this.throttles = []\n }\n\n _addThrottle (throttle) {\n if (!(throttle instanceof Throttle)) throw new Error('Throttle must be an instance of Throttle')\n\n this.throttles.push(throttle)\n }\n\n _removeThrottle (throttle) {\n const index = this.throttles.indexOf(throttle)\n if (index > -1) this.throttles.splice(index, 1)\n }\n}\n\nmodule.exports = ThrottleGroup\n","const { EventEmitter } = require('events')\nconst { Transform } = require('streamx')\nconst { wait } = require('./utils')\n\nclass Throttle extends Transform {\n constructor (opts = {}) {\n super()\n\n if (typeof opts !== 'object') throw new Error('Options must be an object')\n\n const params = Object.assign({}, opts)\n\n if (params.group && !(params.group instanceof ThrottleGroup)) throw new Error('Group must be an instanece of ThrottleGroup')\n else if (!params.group) params.group = new ThrottleGroup(params)\n\n this._setEnabled(params.enabled || params.group.enabled)\n this._group = params.group\n this._emitter = new EventEmitter()\n this._destroyed = false\n\n this._group._addThrottle(this)\n }\n\n getEnabled () {\n return this._enabled\n }\n\n getGroup () {\n return this._group\n }\n\n _setEnabled (val = true) {\n if (typeof val !== 'boolean') throw new Error('Enabled must be a boolean')\n this._enabled = val\n }\n\n setEnabled (val) {\n this._setEnabled(val)\n if (this._enabled) this._emitter.emit('enabled')\n else this._emitter.emit('disabled')\n }\n\n _transform (chunk, done) {\n this._processChunk(chunk, done)\n }\n\n /* async _waitForPositiveRate () {\n // Stop pushing chunks if rate is zero\n while (this._group.getRate() === 0 && !this._destroyed && this._areBothEnabled()) {\n await wait(1 * 1000) // wait 1 second\n }\n } */\n\n async _waitForTokens (amount) {\n // Wait for enabled, destroyed or tokens\n return new Promise((resolve, reject) => {\n let done = false\n const self = this\n function isDone (err) {\n self._emitter.removeListener('disabled', isDone)\n self._emitter.removeListener('destroyed', isDone)\n\n if (done) return\n done = true\n if (err) return reject(err)\n resolve()\n }\n this._emitter.once('disabled', isDone)\n this._emitter.once('destroyed', isDone)\n // TODO: next version remove lisener in \"isDone\"\n this._group.bucket.removeTokens(amount, isDone)\n })\n }\n\n _areBothEnabled () {\n return this._enabled && this._group.getEnabled()\n }\n\n /* async _throttleChunk (size) {\n // Stop pushing chunks if rate is zero\n await this._waitForPositiveRate()\n if (this._destroyed) return\n if (!this._areBothEnabled()) return\n\n // Get tokens from bucket\n await this._waitForTokens(size)\n } */\n\n async _processChunk (chunk, done) {\n if (!this._areBothEnabled()) return done(null, chunk)\n\n let pos = 0\n let chunksize = this._group.getChunksize()\n let slice = chunk.slice(pos, pos + chunksize)\n while (slice.length > 0) {\n // Check here again because we might be in the middle of a big chunk\n // with a lot of small slices\n if (this._areBothEnabled()) {\n try {\n // WAIT FOR POSITIVE RATE\n // Stop pushing chunks if rate is zero\n while (this._group.getRate() === 0 && !this._destroyed && this._areBothEnabled()) {\n await wait(1000) // wait 1 second\n if (this._destroyed) return\n }\n\n // WAIT FOR TOKENS\n if (this._areBothEnabled() && !this._group.bucket.tryRemoveTokens(slice.length)) {\n await this._waitForTokens(slice.length)\n if (this._destroyed) return\n }\n } catch (err) {\n return done(err)\n }\n }\n\n this.push(slice)\n pos += chunksize\n\n // Calculate params for next slice\n chunksize = (this._areBothEnabled())\n ? this._group.getChunksize() // Chunksize might have changed\n : chunk.length - pos // Get the rest of the chunk\n slice = chunk.slice(pos, pos + chunksize)\n }\n\n return done()\n }\n\n destroy (...args) {\n this._group._removeThrottle(this)\n\n this._destroyed = true\n this._emitter.emit('destroyed')\n\n super.destroy(...args)\n }\n}\n\nmodule.exports = Throttle\n\n// Fix circular dependency\nconst ThrottleGroup = require('./throttle-group')\n","function wait (time) {\n return new Promise((resolve) => setTimeout(resolve, time))\n}\n\nmodule.exports = {\n wait\n}\n","const { EventEmitter } = require('events')\nconst STREAM_DESTROYED = new Error('Stream was destroyed')\nconst PREMATURE_CLOSE = new Error('Premature close')\n\nconst queueTick = require('queue-tick')\nconst FIFO = require('fast-fifo')\n\n/* eslint-disable no-multi-spaces */\n\n// 26 bits used total (4 from shared, 13 from read, and 9 from write)\nconst MAX = ((1 << 26) - 1)\n\n// Shared state\nconst OPENING = 0b0001\nconst PREDESTROYING = 0b0010\nconst DESTROYING = 0b0100\nconst DESTROYED = 0b1000\n\nconst NOT_OPENING = MAX ^ OPENING\nconst NOT_PREDESTROYING = MAX ^ PREDESTROYING\n\n// Read state (4 bit offset from shared state)\nconst READ_ACTIVE = 0b0000000000001 << 4\nconst READ_PRIMARY = 0b0000000000010 << 4\nconst READ_SYNC = 0b0000000000100 << 4\nconst READ_QUEUED = 0b0000000001000 << 4\nconst READ_RESUMED = 0b0000000010000 << 4\nconst READ_PIPE_DRAINED = 0b0000000100000 << 4\nconst READ_ENDING = 0b0000001000000 << 4\nconst READ_EMIT_DATA = 0b0000010000000 << 4\nconst READ_EMIT_READABLE = 0b0000100000000 << 4\nconst READ_EMITTED_READABLE = 0b0001000000000 << 4\nconst READ_DONE = 0b0010000000000 << 4\nconst READ_NEXT_TICK = 0b0100000000001 << 4 // also active\nconst READ_NEEDS_PUSH = 0b1000000000000 << 4\n\n// Combined read state\nconst READ_FLOWING = READ_RESUMED | READ_PIPE_DRAINED\nconst READ_ACTIVE_AND_SYNC = READ_ACTIVE | READ_SYNC\nconst READ_ACTIVE_AND_SYNC_AND_NEEDS_PUSH = READ_ACTIVE | READ_SYNC | READ_NEEDS_PUSH\nconst READ_PRIMARY_AND_ACTIVE = READ_PRIMARY | READ_ACTIVE\nconst READ_EMIT_READABLE_AND_QUEUED = READ_EMIT_READABLE | READ_QUEUED\n\nconst READ_NOT_ACTIVE = MAX ^ READ_ACTIVE\nconst READ_NON_PRIMARY = MAX ^ READ_PRIMARY\nconst READ_NON_PRIMARY_AND_PUSHED = MAX ^ (READ_PRIMARY | READ_NEEDS_PUSH)\nconst READ_NOT_SYNC = MAX ^ READ_SYNC\nconst READ_PUSHED = MAX ^ READ_NEEDS_PUSH\nconst READ_PAUSED = MAX ^ READ_RESUMED\nconst READ_NOT_QUEUED = MAX ^ (READ_QUEUED | READ_EMITTED_READABLE)\nconst READ_NOT_ENDING = MAX ^ READ_ENDING\nconst READ_PIPE_NOT_DRAINED = MAX ^ READ_FLOWING\nconst READ_NOT_NEXT_TICK = MAX ^ READ_NEXT_TICK\n\n// Write state (17 bit offset, 4 bit offset from shared state and 13 from read state)\nconst WRITE_ACTIVE = 0b000000001 << 17\nconst WRITE_PRIMARY = 0b000000010 << 17\nconst WRITE_SYNC = 0b000000100 << 17\nconst WRITE_QUEUED = 0b000001000 << 17\nconst WRITE_UNDRAINED = 0b000010000 << 17\nconst WRITE_DONE = 0b000100000 << 17\nconst WRITE_EMIT_DRAIN = 0b001000000 << 17\nconst WRITE_NEXT_TICK = 0b010000001 << 17 // also active\nconst WRITE_FINISHING = 0b100000000 << 17\n\nconst WRITE_NOT_ACTIVE = MAX ^ WRITE_ACTIVE\nconst WRITE_NOT_SYNC = MAX ^ WRITE_SYNC\nconst WRITE_NON_PRIMARY = MAX ^ WRITE_PRIMARY\nconst WRITE_NOT_FINISHING = MAX ^ WRITE_FINISHING\nconst WRITE_DRAINED = MAX ^ WRITE_UNDRAINED\nconst WRITE_NOT_QUEUED = MAX ^ WRITE_QUEUED\nconst WRITE_NOT_NEXT_TICK = MAX ^ WRITE_NEXT_TICK\n\n// Combined shared state\nconst ACTIVE = READ_ACTIVE | WRITE_ACTIVE\nconst NOT_ACTIVE = MAX ^ ACTIVE\nconst DONE = READ_DONE | WRITE_DONE\nconst DESTROY_STATUS = DESTROYING | DESTROYED | PREDESTROYING\nconst OPEN_STATUS = DESTROY_STATUS | OPENING\nconst AUTO_DESTROY = DESTROY_STATUS | DONE\nconst NON_PRIMARY = WRITE_NON_PRIMARY & READ_NON_PRIMARY\nconst ACTIVE_OR_TICKING = WRITE_NEXT_TICK | READ_NEXT_TICK\nconst TICKING = ACTIVE_OR_TICKING & NOT_ACTIVE\nconst IS_OPENING = OPEN_STATUS | TICKING\n\n// Combined shared state and read state\nconst READ_PRIMARY_STATUS = OPEN_STATUS | READ_ENDING | READ_DONE\nconst READ_STATUS = OPEN_STATUS | READ_DONE | READ_QUEUED\nconst READ_ENDING_STATUS = OPEN_STATUS | READ_ENDING | READ_QUEUED\nconst READ_READABLE_STATUS = OPEN_STATUS | READ_EMIT_READABLE | READ_QUEUED | READ_EMITTED_READABLE\nconst SHOULD_NOT_READ = OPEN_STATUS | READ_ACTIVE | READ_ENDING | READ_DONE | READ_NEEDS_PUSH\nconst READ_BACKPRESSURE_STATUS = DESTROY_STATUS | READ_ENDING | READ_DONE\n\n// Combined write state\nconst WRITE_PRIMARY_STATUS = OPEN_STATUS | WRITE_FINISHING | WRITE_DONE\nconst WRITE_QUEUED_AND_UNDRAINED = WRITE_QUEUED | WRITE_UNDRAINED\nconst WRITE_QUEUED_AND_ACTIVE = WRITE_QUEUED | WRITE_ACTIVE\nconst WRITE_DRAIN_STATUS = WRITE_QUEUED | WRITE_UNDRAINED | OPEN_STATUS | WRITE_ACTIVE\nconst WRITE_STATUS = OPEN_STATUS | WRITE_ACTIVE | WRITE_QUEUED\nconst WRITE_PRIMARY_AND_ACTIVE = WRITE_PRIMARY | WRITE_ACTIVE\nconst WRITE_ACTIVE_AND_SYNC = WRITE_ACTIVE | WRITE_SYNC\nconst WRITE_FINISHING_STATUS = OPEN_STATUS | WRITE_FINISHING | WRITE_QUEUED_AND_ACTIVE | WRITE_DONE\nconst WRITE_BACKPRESSURE_STATUS = WRITE_UNDRAINED | DESTROY_STATUS | WRITE_FINISHING | WRITE_DONE\n\nconst asyncIterator = Symbol.asyncIterator || Symbol('asyncIterator')\n\nclass WritableState {\n constructor (stream, { highWaterMark = 16384, map = null, mapWritable, byteLength, byteLengthWritable } = {}) {\n this.stream = stream\n this.queue = new FIFO()\n this.highWaterMark = highWaterMark\n this.buffered = 0\n this.error = null\n this.pipeline = null\n this.byteLength = byteLengthWritable || byteLength || defaultByteLength\n this.map = mapWritable || map\n this.afterWrite = afterWrite.bind(this)\n this.afterUpdateNextTick = updateWriteNT.bind(this)\n }\n\n get ended () {\n return (this.stream._duplexState & WRITE_DONE) !== 0\n }\n\n push (data) {\n if (this.map !== null) data = this.map(data)\n\n this.buffered += this.byteLength(data)\n this.queue.push(data)\n\n if (this.buffered < this.highWaterMark) {\n this.stream._duplexState |= WRITE_QUEUED\n return true\n }\n\n this.stream._duplexState |= WRITE_QUEUED_AND_UNDRAINED\n return false\n }\n\n shift () {\n const data = this.queue.shift()\n const stream = this.stream\n\n this.buffered -= this.byteLength(data)\n if (this.buffered === 0) stream._duplexState &= WRITE_NOT_QUEUED\n\n return data\n }\n\n end (data) {\n if (typeof data === 'function') this.stream.once('finish', data)\n else if (data !== undefined && data !== null) this.push(data)\n this.stream._duplexState = (this.stream._duplexState | WRITE_FINISHING) & WRITE_NON_PRIMARY\n }\n\n autoBatch (data, cb) {\n const buffer = []\n const stream = this.stream\n\n buffer.push(data)\n while ((stream._duplexState & WRITE_STATUS) === WRITE_QUEUED_AND_ACTIVE) {\n buffer.push(stream._writableState.shift())\n }\n\n if ((stream._duplexState & OPEN_STATUS) !== 0) return cb(null)\n stream._writev(buffer, cb)\n }\n\n update () {\n const stream = this.stream\n\n while ((stream._duplexState & WRITE_STATUS) === WRITE_QUEUED) {\n const data = this.shift()\n stream._duplexState |= WRITE_ACTIVE_AND_SYNC\n stream._write(data, this.afterWrite)\n stream._duplexState &= WRITE_NOT_SYNC\n }\n\n if ((stream._duplexState & WRITE_PRIMARY_AND_ACTIVE) === 0) this.updateNonPrimary()\n }\n\n updateNonPrimary () {\n const stream = this.stream\n\n if ((stream._duplexState & WRITE_FINISHING_STATUS) === WRITE_FINISHING) {\n stream._duplexState = (stream._duplexState | WRITE_ACTIVE) & WRITE_NOT_FINISHING\n stream._final(afterFinal.bind(this))\n return\n }\n\n if ((stream._duplexState & DESTROY_STATUS) === DESTROYING) {\n if ((stream._duplexState & ACTIVE_OR_TICKING) === 0) {\n stream._duplexState |= ACTIVE\n stream._destroy(afterDestroy.bind(this))\n }\n return\n }\n\n if ((stream._duplexState & IS_OPENING) === OPENING) {\n stream._duplexState = (stream._duplexState | ACTIVE) & NOT_OPENING\n stream._open(afterOpen.bind(this))\n }\n }\n\n updateNextTick () {\n if ((this.stream._duplexState & WRITE_NEXT_TICK) !== 0) return\n this.stream._duplexState |= WRITE_NEXT_TICK\n queueTick(this.afterUpdateNextTick)\n }\n}\n\nclass ReadableState {\n constructor (stream, { highWaterMark = 16384, map = null, mapReadable, byteLength, byteLengthReadable } = {}) {\n this.stream = stream\n this.queue = new FIFO()\n this.highWaterMark = highWaterMark\n this.buffered = 0\n this.error = null\n this.pipeline = null\n this.byteLength = byteLengthReadable || byteLength || defaultByteLength\n this.map = mapReadable || map\n this.pipeTo = null\n this.afterRead = afterRead.bind(this)\n this.afterUpdateNextTick = updateReadNT.bind(this)\n }\n\n get ended () {\n return (this.stream._duplexState & READ_DONE) !== 0\n }\n\n pipe (pipeTo, cb) {\n if (this.pipeTo !== null) throw new Error('Can only pipe to one destination')\n if (typeof cb !== 'function') cb = null\n\n this.stream._duplexState |= READ_PIPE_DRAINED\n this.pipeTo = pipeTo\n this.pipeline = new Pipeline(this.stream, pipeTo, cb)\n\n if (cb) this.stream.on('error', noop) // We already error handle this so supress crashes\n\n if (isStreamx(pipeTo)) {\n pipeTo._writableState.pipeline = this.pipeline\n if (cb) pipeTo.on('error', noop) // We already error handle this so supress crashes\n pipeTo.on('finish', this.pipeline.finished.bind(this.pipeline)) // TODO: just call finished from pipeTo itself\n } else {\n const onerror = this.pipeline.done.bind(this.pipeline, pipeTo)\n const onclose = this.pipeline.done.bind(this.pipeline, pipeTo, null) // onclose has a weird bool arg\n pipeTo.on('error', onerror)\n pipeTo.on('close', onclose)\n pipeTo.on('finish', this.pipeline.finished.bind(this.pipeline))\n }\n\n pipeTo.on('drain', afterDrain.bind(this))\n this.stream.emit('piping', pipeTo)\n pipeTo.emit('pipe', this.stream)\n }\n\n push (data) {\n const stream = this.stream\n\n if (data === null) {\n this.highWaterMark = 0\n stream._duplexState = (stream._duplexState | READ_ENDING) & READ_NON_PRIMARY_AND_PUSHED\n return false\n }\n\n if (this.map !== null) data = this.map(data)\n this.buffered += this.byteLength(data)\n this.queue.push(data)\n\n stream._duplexState = (stream._duplexState | READ_QUEUED) & READ_PUSHED\n\n return this.buffered < this.highWaterMark\n }\n\n shift () {\n const data = this.queue.shift()\n\n this.buffered -= this.byteLength(data)\n if (this.buffered === 0) this.stream._duplexState &= READ_NOT_QUEUED\n return data\n }\n\n unshift (data) {\n let tail\n const pending = []\n\n while ((tail = this.queue.shift()) !== undefined) {\n pending.push(tail)\n }\n\n this.push(data)\n\n for (let i = 0; i < pending.length; i++) {\n this.queue.push(pending[i])\n }\n }\n\n read () {\n const stream = this.stream\n\n if ((stream._duplexState & READ_STATUS) === READ_QUEUED) {\n const data = this.shift()\n if (this.pipeTo !== null && this.pipeTo.write(data) === false) stream._duplexState &= READ_PIPE_NOT_DRAINED\n if ((stream._duplexState & READ_EMIT_DATA) !== 0) stream.emit('data', data)\n return data\n }\n\n return null\n }\n\n drain () {\n const stream = this.stream\n\n while ((stream._duplexState & READ_STATUS) === READ_QUEUED && (stream._duplexState & READ_FLOWING) !== 0) {\n const data = this.shift()\n if (this.pipeTo !== null && this.pipeTo.write(data) === false) stream._duplexState &= READ_PIPE_NOT_DRAINED\n if ((stream._duplexState & READ_EMIT_DATA) !== 0) stream.emit('data', data)\n }\n }\n\n update () {\n const stream = this.stream\n\n this.drain()\n\n while (this.buffered < this.highWaterMark && (stream._duplexState & SHOULD_NOT_READ) === 0) {\n stream._duplexState |= READ_ACTIVE_AND_SYNC_AND_NEEDS_PUSH\n stream._read(this.afterRead)\n stream._duplexState &= READ_NOT_SYNC\n if ((stream._duplexState & READ_ACTIVE) === 0) this.drain()\n }\n\n if ((stream._duplexState & READ_READABLE_STATUS) === READ_EMIT_READABLE_AND_QUEUED) {\n stream._duplexState |= READ_EMITTED_READABLE\n stream.emit('readable')\n }\n\n if ((stream._duplexState & READ_PRIMARY_AND_ACTIVE) === 0) this.updateNonPrimary()\n }\n\n updateNonPrimary () {\n const stream = this.stream\n\n if ((stream._duplexState & READ_ENDING_STATUS) === READ_ENDING) {\n stream._duplexState = (stream._duplexState | READ_DONE) & READ_NOT_ENDING\n stream.emit('end')\n if ((stream._duplexState & AUTO_DESTROY) === DONE) stream._duplexState |= DESTROYING\n if (this.pipeTo !== null) this.pipeTo.end()\n }\n\n if ((stream._duplexState & DESTROY_STATUS) === DESTROYING) {\n if ((stream._duplexState & ACTIVE_OR_TICKING) === 0) {\n stream._duplexState |= ACTIVE\n stream._destroy(afterDestroy.bind(this))\n }\n return\n }\n\n if ((stream._duplexState & IS_OPENING) === OPENING) {\n stream._duplexState = (stream._duplexState | ACTIVE) & NOT_OPENING\n stream._open(afterOpen.bind(this))\n }\n }\n\n updateNextTick () {\n if ((this.stream._duplexState & READ_NEXT_TICK) !== 0) return\n this.stream._duplexState |= READ_NEXT_TICK\n queueTick(this.afterUpdateNextTick)\n }\n}\n\nclass TransformState {\n constructor (stream) {\n this.data = null\n this.afterTransform = afterTransform.bind(stream)\n this.afterFinal = null\n }\n}\n\nclass Pipeline {\n constructor (src, dst, cb) {\n this.from = src\n this.to = dst\n this.afterPipe = cb\n this.error = null\n this.pipeToFinished = false\n }\n\n finished () {\n this.pipeToFinished = true\n }\n\n done (stream, err) {\n if (err) this.error = err\n\n if (stream === this.to) {\n this.to = null\n\n if (this.from !== null) {\n if ((this.from._duplexState & READ_DONE) === 0 || !this.pipeToFinished) {\n this.from.destroy(this.error || new Error('Writable stream closed prematurely'))\n }\n return\n }\n }\n\n if (stream === this.from) {\n this.from = null\n\n if (this.to !== null) {\n if ((stream._duplexState & READ_DONE) === 0) {\n this.to.destroy(this.error || new Error('Readable stream closed before ending'))\n }\n return\n }\n }\n\n if (this.afterPipe !== null) this.afterPipe(this.error)\n this.to = this.from = this.afterPipe = null\n }\n}\n\nfunction afterDrain () {\n this.stream._duplexState |= READ_PIPE_DRAINED\n if ((this.stream._duplexState & READ_ACTIVE_AND_SYNC) === 0) this.updateNextTick()\n else this.drain()\n}\n\nfunction afterFinal (err) {\n const stream = this.stream\n if (err) stream.destroy(err)\n if ((stream._duplexState & DESTROY_STATUS) === 0) {\n stream._duplexState |= WRITE_DONE\n stream.emit('finish')\n }\n if ((stream._duplexState & AUTO_DESTROY) === DONE) {\n stream._duplexState |= DESTROYING\n }\n\n stream._duplexState &= WRITE_NOT_ACTIVE\n this.update()\n}\n\nfunction afterDestroy (err) {\n const stream = this.stream\n\n if (!err && this.error !== STREAM_DESTROYED) err = this.error\n if (err) stream.emit('error', err)\n stream._duplexState |= DESTROYED\n stream.emit('close')\n\n const rs = stream._readableState\n const ws = stream._writableState\n\n if (rs !== null && rs.pipeline !== null) rs.pipeline.done(stream, err)\n if (ws !== null && ws.pipeline !== null) ws.pipeline.done(stream, err)\n}\n\nfunction afterWrite (err) {\n const stream = this.stream\n\n if (err) stream.destroy(err)\n stream._duplexState &= WRITE_NOT_ACTIVE\n\n if ((stream._duplexState & WRITE_DRAIN_STATUS) === WRITE_UNDRAINED) {\n stream._duplexState &= WRITE_DRAINED\n if ((stream._duplexState & WRITE_EMIT_DRAIN) === WRITE_EMIT_DRAIN) {\n stream.emit('drain')\n }\n }\n\n if ((stream._duplexState & WRITE_SYNC) === 0) this.update()\n}\n\nfunction afterRead (err) {\n if (err) this.stream.destroy(err)\n this.stream._duplexState &= READ_NOT_ACTIVE\n if ((this.stream._duplexState & READ_SYNC) === 0) this.update()\n}\n\nfunction updateReadNT () {\n this.stream._duplexState &= READ_NOT_NEXT_TICK\n this.update()\n}\n\nfunction updateWriteNT () {\n this.stream._duplexState &= WRITE_NOT_NEXT_TICK\n this.update()\n}\n\nfunction afterOpen (err) {\n const stream = this.stream\n\n if (err) stream.destroy(err)\n\n if ((stream._duplexState & DESTROYING) === 0) {\n if ((stream._duplexState & READ_PRIMARY_STATUS) === 0) stream._duplexState |= READ_PRIMARY\n if ((stream._duplexState & WRITE_PRIMARY_STATUS) === 0) stream._duplexState |= WRITE_PRIMARY\n stream.emit('open')\n }\n\n stream._duplexState &= NOT_ACTIVE\n\n if (stream._writableState !== null) {\n stream._writableState.update()\n }\n\n if (stream._readableState !== null) {\n stream._readableState.update()\n }\n}\n\nfunction afterTransform (err, data) {\n if (data !== undefined && data !== null) this.push(data)\n this._writableState.afterWrite(err)\n}\n\nclass Stream extends EventEmitter {\n constructor (opts) {\n super()\n\n this._duplexState = 0\n this._readableState = null\n this._writableState = null\n\n if (opts) {\n if (opts.open) this._open = opts.open\n if (opts.destroy) this._destroy = opts.destroy\n if (opts.predestroy) this._predestroy = opts.predestroy\n if (opts.signal) {\n opts.signal.addEventListener('abort', abort.bind(this))\n }\n }\n }\n\n _open (cb) {\n cb(null)\n }\n\n _destroy (cb) {\n cb(null)\n }\n\n _predestroy () {\n // does nothing\n }\n\n get readable () {\n return this._readableState !== null ? true : undefined\n }\n\n get writable () {\n return this._writableState !== null ? true : undefined\n }\n\n get destroyed () {\n return (this._duplexState & DESTROYED) !== 0\n }\n\n get destroying () {\n return (this._duplexState & DESTROY_STATUS) !== 0\n }\n\n destroy (err) {\n if ((this._duplexState & DESTROY_STATUS) === 0) {\n if (!err) err = STREAM_DESTROYED\n this._duplexState = (this._duplexState | DESTROYING) & NON_PRIMARY\n\n if (this._readableState !== null) this._readableState.error = err\n if (this._writableState !== null) this._writableState.error = err\n\n this._duplexState |= PREDESTROYING\n this._predestroy()\n this._duplexState &= NOT_PREDESTROYING\n\n if (this._readableState !== null) this._readableState.updateNextTick()\n if (this._writableState !== null) this._writableState.updateNextTick()\n }\n }\n\n on (name, fn) {\n if (this._readableState !== null) {\n if (name === 'data') {\n this._duplexState |= (READ_EMIT_DATA | READ_RESUMED)\n this._readableState.updateNextTick()\n }\n if (name === 'readable') {\n this._duplexState |= READ_EMIT_READABLE\n this._readableState.updateNextTick()\n }\n }\n\n if (this._writableState !== null) {\n if (name === 'drain') {\n this._duplexState |= WRITE_EMIT_DRAIN\n this._writableState.updateNextTick()\n }\n }\n\n return super.on(name, fn)\n }\n}\n\nclass Readable extends Stream {\n constructor (opts) {\n super(opts)\n\n this._duplexState |= OPENING | WRITE_DONE\n this._readableState = new ReadableState(this, opts)\n\n if (opts) {\n if (opts.read) this._read = opts.read\n if (opts.eagerOpen) this.resume().pause()\n }\n }\n\n _read (cb) {\n cb(null)\n }\n\n pipe (dest, cb) {\n this._readableState.pipe(dest, cb)\n this._readableState.updateNextTick()\n return dest\n }\n\n read () {\n this._readableState.updateNextTick()\n return this._readableState.read()\n }\n\n push (data) {\n this._readableState.updateNextTick()\n return this._readableState.push(data)\n }\n\n unshift (data) {\n this._readableState.updateNextTick()\n return this._readableState.unshift(data)\n }\n\n resume () {\n this._duplexState |= READ_RESUMED\n this._readableState.updateNextTick()\n return this\n }\n\n pause () {\n this._duplexState &= READ_PAUSED\n return this\n }\n\n static _fromAsyncIterator (ite, opts) {\n let destroy\n\n const rs = new Readable({\n ...opts,\n read (cb) {\n ite.next().then(push).then(cb.bind(null, null)).catch(cb)\n },\n predestroy () {\n destroy = ite.return()\n },\n destroy (cb) {\n if (!destroy) return cb(null)\n destroy.then(cb.bind(null, null)).catch(cb)\n }\n })\n\n return rs\n\n function push (data) {\n if (data.done) rs.push(null)\n else rs.push(data.value)\n }\n }\n\n static from (data, opts) {\n if (isReadStreamx(data)) return data\n if (data[asyncIterator]) return this._fromAsyncIterator(data[asyncIterator](), opts)\n if (!Array.isArray(data)) data = data === undefined ? [] : [data]\n\n let i = 0\n return new Readable({\n ...opts,\n read (cb) {\n this.push(i === data.length ? null : data[i++])\n cb(null)\n }\n })\n }\n\n static isBackpressured (rs) {\n return (rs._duplexState & READ_BACKPRESSURE_STATUS) !== 0 || rs._readableState.buffered >= rs._readableState.highWaterMark\n }\n\n static isPaused (rs) {\n return (rs._duplexState & READ_RESUMED) === 0\n }\n\n [asyncIterator] () {\n const stream = this\n\n let error = null\n let promiseResolve = null\n let promiseReject = null\n\n this.on('error', (err) => { error = err })\n this.on('readable', onreadable)\n this.on('close', onclose)\n\n return {\n [asyncIterator] () {\n return this\n },\n next () {\n return new Promise(function (resolve, reject) {\n promiseResolve = resolve\n promiseReject = reject\n const data = stream.read()\n if (data !== null) ondata(data)\n else if ((stream._duplexState & DESTROYED) !== 0) ondata(null)\n })\n },\n return () {\n return destroy(null)\n },\n throw (err) {\n return destroy(err)\n }\n }\n\n function onreadable () {\n if (promiseResolve !== null) ondata(stream.read())\n }\n\n function onclose () {\n if (promiseResolve !== null) ondata(null)\n }\n\n function ondata (data) {\n if (promiseReject === null) return\n if (error) promiseReject(error)\n else if (data === null && (stream._duplexState & READ_DONE) === 0) promiseReject(STREAM_DESTROYED)\n else promiseResolve({ value: data, done: data === null })\n promiseReject = promiseResolve = null\n }\n\n function destroy (err) {\n stream.destroy(err)\n return new Promise((resolve, reject) => {\n if (stream._duplexState & DESTROYED) return resolve({ value: undefined, done: true })\n stream.once('close', function () {\n if (err) reject(err)\n else resolve({ value: undefined, done: true })\n })\n })\n }\n }\n}\n\nclass Writable extends Stream {\n constructor (opts) {\n super(opts)\n\n this._duplexState |= OPENING | READ_DONE\n this._writableState = new WritableState(this, opts)\n\n if (opts) {\n if (opts.writev) this._writev = opts.writev\n if (opts.write) this._write = opts.write\n if (opts.final) this._final = opts.final\n }\n }\n\n _writev (batch, cb) {\n cb(null)\n }\n\n _write (data, cb) {\n this._writableState.autoBatch(data, cb)\n }\n\n _final (cb) {\n cb(null)\n }\n\n static isBackpressured (ws) {\n return (ws._duplexState & WRITE_BACKPRESSURE_STATUS) !== 0\n }\n\n write (data) {\n this._writableState.updateNextTick()\n return this._writableState.push(data)\n }\n\n end (data) {\n this._writableState.updateNextTick()\n this._writableState.end(data)\n return this\n }\n}\n\nclass Duplex extends Readable { // and Writable\n constructor (opts) {\n super(opts)\n\n this._duplexState = OPENING\n this._writableState = new WritableState(this, opts)\n\n if (opts) {\n if (opts.writev) this._writev = opts.writev\n if (opts.write) this._write = opts.write\n if (opts.final) this._final = opts.final\n }\n }\n\n _writev (batch, cb) {\n cb(null)\n }\n\n _write (data, cb) {\n this._writableState.autoBatch(data, cb)\n }\n\n _final (cb) {\n cb(null)\n }\n\n write (data) {\n this._writableState.updateNextTick()\n return this._writableState.push(data)\n }\n\n end (data) {\n this._writableState.updateNextTick()\n this._writableState.end(data)\n return this\n }\n}\n\nclass Transform extends Duplex {\n constructor (opts) {\n super(opts)\n this._transformState = new TransformState(this)\n\n if (opts) {\n if (opts.transform) this._transform = opts.transform\n if (opts.flush) this._flush = opts.flush\n }\n }\n\n _write (data, cb) {\n if (this._readableState.buffered >= this._readableState.highWaterMark) {\n this._transformState.data = data\n } else {\n this._transform(data, this._transformState.afterTransform)\n }\n }\n\n _read (cb) {\n if (this._transformState.data !== null) {\n const data = this._transformState.data\n this._transformState.data = null\n cb(null)\n this._transform(data, this._transformState.afterTransform)\n } else {\n cb(null)\n }\n }\n\n _transform (data, cb) {\n cb(null, data)\n }\n\n _flush (cb) {\n cb(null)\n }\n\n _final (cb) {\n this._transformState.afterFinal = cb\n this._flush(transformAfterFlush.bind(this))\n }\n}\n\nclass PassThrough extends Transform {}\n\nfunction transformAfterFlush (err, data) {\n const cb = this._transformState.afterFinal\n if (err) return cb(err)\n if (data !== null && data !== undefined) this.push(data)\n this.push(null)\n cb(null)\n}\n\nfunction pipelinePromise (...streams) {\n return new Promise((resolve, reject) => {\n return pipeline(...streams, (err) => {\n if (err) return reject(err)\n resolve()\n })\n })\n}\n\nfunction pipeline (stream, ...streams) {\n const all = Array.isArray(stream) ? [...stream, ...streams] : [stream, ...streams]\n const done = (all.length && typeof all[all.length - 1] === 'function') ? all.pop() : null\n\n if (all.length < 2) throw new Error('Pipeline requires at least 2 streams')\n\n let src = all[0]\n let dest = null\n let error = null\n\n for (let i = 1; i < all.length; i++) {\n dest = all[i]\n\n if (isStreamx(src)) {\n src.pipe(dest, onerror)\n } else {\n errorHandle(src, true, i > 1, onerror)\n src.pipe(dest)\n }\n\n src = dest\n }\n\n if (done) {\n let fin = false\n\n dest.on('finish', () => { fin = true })\n dest.on('error', err => { error = error || err })\n dest.on('close', () => done(error || (fin ? null : PREMATURE_CLOSE)))\n }\n\n return dest\n\n function errorHandle (s, rd, wr, onerror) {\n s.on('error', onerror)\n s.on('close', onclose)\n\n function onclose () {\n if (rd && s._readableState && !s._readableState.ended) return onerror(PREMATURE_CLOSE)\n if (wr && s._writableState && !s._writableState.ended) return onerror(PREMATURE_CLOSE)\n }\n }\n\n function onerror (err) {\n if (!err || error) return\n error = err\n\n for (const s of all) {\n s.destroy(err)\n }\n }\n}\n\nfunction isStream (stream) {\n return !!stream._readableState || !!stream._writableState\n}\n\nfunction isStreamx (stream) {\n return typeof stream._duplexState === 'number' && isStream(stream)\n}\n\nfunction getStreamError (stream) {\n return (stream._readableState && stream._readableState.error) || (stream._writableState && stream._writableState.error)\n}\n\nfunction isReadStreamx (stream) {\n return isStreamx(stream) && stream.readable\n}\n\nfunction isTypedArray (data) {\n return typeof data === 'object' && data !== null && typeof data.byteLength === 'number'\n}\n\nfunction defaultByteLength (data) {\n return isTypedArray(data) ? data.byteLength : 1024\n}\n\nfunction noop () {}\n\nfunction abort () {\n this.destroy(new Error('Stream aborted.'))\n}\n\nmodule.exports = {\n pipeline,\n pipelinePromise,\n isStream,\n isStreamx,\n getStreamError,\n Stream,\n Writable,\n Readable,\n Duplex,\n Transform,\n // Export PassThrough for compatibility with Node.js core's stream module\n PassThrough\n}\n","/* \nCopyright (c) 2011, Chris Umbel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in \nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN \nTHE SOFTWARE.\n*/\n\nvar base32 = require('./thirty-two');\n\nexports.encode = base32.encode;\nexports.decode = base32.decode;\n","/*\nCopyright (c) 2011, Chris Umbel\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n*/\n'use strict';\n\nvar charTable = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567\";\nvar byteTable = [\n 0xff, 0xff, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,\n 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,\n 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,\n 0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,\n 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,\n 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,\n 0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff\n];\n\nfunction quintetCount(buff) {\n var quintets = Math.floor(buff.length / 5);\n return buff.length % 5 === 0 ? quintets: quintets + 1;\n}\n\nexports.encode = function(plain) {\n if(!Buffer.isBuffer(plain)){\n \tplain = new Buffer(plain);\n }\n var i = 0;\n var j = 0;\n var shiftIndex = 0;\n var digit = 0;\n var encoded = new Buffer(quintetCount(plain) * 8);\n\n /* byte by byte isn't as pretty as quintet by quintet but tests a bit\n faster. will have to revisit. */\n while(i < plain.length) {\n var current = plain[i];\n\n if(shiftIndex > 3) {\n digit = current & (0xff >> shiftIndex);\n shiftIndex = (shiftIndex + 5) % 8;\n digit = (digit << shiftIndex) | ((i + 1 < plain.length) ?\n plain[i + 1] : 0) >> (8 - shiftIndex);\n i++;\n } else {\n digit = (current >> (8 - (shiftIndex + 5))) & 0x1f;\n shiftIndex = (shiftIndex + 5) % 8;\n if(shiftIndex === 0) i++;\n }\n\n encoded[j] = charTable.charCodeAt(digit);\n j++;\n }\n\n for(i = j; i < encoded.length; i++) {\n encoded[i] = 0x3d; //'='.charCodeAt(0)\n }\n\n return encoded;\n};\n\nexports.decode = function(encoded) {\n var shiftIndex = 0;\n var plainDigit = 0;\n var plainChar;\n var plainPos = 0;\n if(!Buffer.isBuffer(encoded)){\n \tencoded = new Buffer(encoded);\n }\n var decoded = new Buffer(Math.ceil(encoded.length * 5 / 8));\n\n /* byte by byte isn't as pretty as octet by octet but tests a bit\n faster. will have to revisit. */\n for(var i = 0; i < encoded.length; i++) {\n \tif(encoded[i] === 0x3d){ //'='\n \t\tbreak;\n \t}\n\n var encodedByte = encoded[i] - 0x30;\n\n if(encodedByte < byteTable.length) {\n plainDigit = byteTable[encodedByte];\n\n if(shiftIndex <= 3) {\n shiftIndex = (shiftIndex + 5) % 8;\n\n if(shiftIndex === 0) {\n plainChar |= plainDigit;\n decoded[plainPos] = plainChar;\n plainPos++;\n plainChar = 0;\n } else {\n plainChar |= 0xff & (plainDigit << (8 - shiftIndex));\n }\n } else {\n shiftIndex = (shiftIndex + 5) % 8;\n plainChar |= 0xff & (plainDigit >>> shiftIndex);\n decoded[plainPos] = plainChar;\n plainPos++;\n\n plainChar = 0xff & (plainDigit << (8 - shiftIndex));\n }\n } else {\n \tthrow new Error('Invalid input - it is not base32 encoded string');\n }\n }\n\n return decoded.slice(0, plainPos);\n};\n","const maxTick = 65535\r\nconst resolution = 10\r\nconst timeDiff = 1000 / resolution\r\nfunction getTick (start) {\r\n return (+Date.now() - start) / timeDiff & 65535\r\n}\r\n\r\nmodule.exports = function (seconds) {\r\n const start = +Date.now()\r\n\r\n const size = resolution * (seconds || 5)\r\n const buffer = [0]\r\n let pointer = 1\r\n let last = (getTick(start) - 1) & maxTick\r\n\r\n return function (delta) {\r\n const tick = getTick(start)\r\n let dist = (tick - last) & maxTick\r\n if (dist > size) dist = size\r\n last = tick\r\n\r\n while (dist--) {\r\n if (pointer === size) pointer = 0\r\n buffer[pointer] = buffer[pointer === 0 ? size - 1 : pointer - 1]\r\n pointer++\r\n }\r\n\r\n if (delta) buffer[pointer - 1] += delta\r\n\r\n const top = buffer[pointer - 1]\r\n const btm = buffer.length < size ? 0 : buffer[pointer === size ? 0 : pointer]\r\n\r\n return buffer.length < resolution ? top : (top - btm) * resolution / buffer.length\r\n }\r\n}\r\n","/*! torrent-piece. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */\nconst BLOCK_LENGTH = 1 << 14\n\nclass Piece {\n constructor (length) {\n this.length = length\n this.missing = length\n this.sources = null\n\n this._chunks = Math.ceil(length / BLOCK_LENGTH)\n this._remainder = (length % BLOCK_LENGTH) || BLOCK_LENGTH\n this._buffered = 0\n this._buffer = null\n this._cancellations = null\n this._reservations = 0\n this._flushed = false\n }\n\n chunkLength (i) {\n return i === this._chunks - 1 ? this._remainder : BLOCK_LENGTH\n }\n\n chunkLengthRemaining (i) {\n return this.length - (i * BLOCK_LENGTH)\n }\n\n chunkOffset (i) {\n return i * BLOCK_LENGTH\n }\n\n reserve () {\n if (!this.init()) return -1\n if (this._cancellations.length) return this._cancellations.pop()\n if (this._reservations < this._chunks) return this._reservations++\n return -1\n }\n\n reserveRemaining () {\n if (!this.init()) return -1\n if (this._cancellations.length || this._reservations < this._chunks) {\n let min = this._reservations\n while (this._cancellations.length) {\n min = Math.min(min, this._cancellations.pop())\n }\n this._reservations = this._chunks\n return min\n }\n return -1\n }\n\n cancel (i) {\n if (!this.init()) return\n this._cancellations.push(i)\n }\n\n cancelRemaining (i) {\n if (!this.init()) return\n this._reservations = i\n }\n\n get (i) {\n if (!this.init()) return null\n return this._buffer[i]\n }\n\n set (i, data, source) {\n if (!this.init()) return false\n const len = data.length\n const blocks = Math.ceil(len / BLOCK_LENGTH)\n for (let j = 0; j < blocks; j++) {\n if (!this._buffer[i + j]) {\n const offset = j * BLOCK_LENGTH\n const splitData = data.slice(offset, offset + BLOCK_LENGTH)\n this._buffered++\n this._buffer[i + j] = splitData\n this.missing -= splitData.length\n if (!this.sources.includes(source)) {\n this.sources.push(source)\n }\n }\n }\n return this._buffered === this._chunks\n }\n\n flush () {\n if (!this._buffer || this._chunks !== this._buffered) return null\n const buffer = Buffer.concat(this._buffer, this.length)\n this._buffer = null\n this._cancellations = null\n this.sources = null\n this._flushed = true\n return buffer\n }\n\n init () {\n if (this._flushed) return false\n if (this._buffer) return true\n this._buffer = new Array(this._chunks)\n this._cancellations = []\n this.sources = []\n return true\n }\n}\n\nObject.defineProperty(Piece, 'BLOCK_LENGTH', { value: BLOCK_LENGTH })\n\nmodule.exports = Piece\n","module.exports = remove\n\nfunction remove (arr, i) {\n if (i >= arr.length || i < 0) return\n var last = arr.pop()\n if (i < arr.length) {\n var tmp = arr[i]\n arr[i] = last\n return tmp\n }\n return last\n}\n","// Returns a wrapper function that returns a wrapped callback\n// The wrapper function should do some stuff, and return a\n// presumably different callback function.\n// This makes sure that own properties are retained, so that\n// decorations and such are not lost along the way.\nmodule.exports = wrappy\nfunction wrappy (fn, cb) {\n if (fn && cb) return wrappy(fn)(cb)\n\n if (typeof fn !== 'function')\n throw new TypeError('need wrapper function')\n\n Object.keys(fn).forEach(function (k) {\n wrapper[k] = fn[k]\n })\n\n return wrapper\n\n function wrapper() {\n var args = new Array(arguments.length)\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i]\n }\n var ret = fn.apply(this, args)\n var cb = args[args.length-1]\n if (typeof ret === 'function' && ret !== cb) {\n Object.keys(cb).forEach(function (k) {\n ret[k] = cb[k]\n })\n }\n return ret\n }\n}\n","import EventEmitter from 'events'\nimport { Transform, pipeline } from 'streamx'\nimport arrayRemove from 'unordered-array-remove'\nimport debugFactory from 'debug'\nimport Wire from 'bittorrent-protocol'\n\nconst CONNECT_TIMEOUT_TCP = 5_000\nconst CONNECT_TIMEOUT_UTP = 5_000\nconst CONNECT_TIMEOUT_WEBRTC = 25_000\nconst HANDSHAKE_TIMEOUT = 25_000\n\n// Types of peers\nconst TYPE_TCP_INCOMING = 'tcpIncoming'\nconst TYPE_TCP_OUTGOING = 'tcpOutgoing'\nconst TYPE_UTP_INCOMING = 'utpIncoming'\nconst TYPE_UTP_OUTGOING = 'utpOutgoing'\nconst TYPE_WEBRTC = 'webrtc'\nconst TYPE_WEBSEED = 'webSeed'\n\n// Source used to obtain the peer\nconst SOURCE_MANUAL = 'manual'\nconst SOURCE_TRACKER = 'tracker'\nconst SOURCE_DHT = 'dht'\nconst SOURCE_LSD = 'lsd'\nconst SOURCE_UT_PEX = 'ut_pex'\n\nconst debug = debugFactory('webtorrent:peer')\n\nlet secure = false\n\nexport const enableSecure = () => {\n secure = true\n}\n\n/**\n * Peer. Represents a peer in the torrent swarm.\n *\n * @param {string} id \"ip:port\" string, peer id (for WebRTC peers), or url (for Web Seeds)\n * @param {string} type the type of the peer\n */\nexport default class Peer extends EventEmitter {\n constructor (id, type) {\n super()\n\n this.id = id\n this.type = type\n\n debug('new %s Peer %s', type, id)\n\n this.addr = null\n this.conn = null\n this.swarm = null\n this.wire = null\n this.source = null\n\n this.connected = false\n this.destroyed = false\n this.timeout = null // handshake timeout\n this.retries = 0 // outgoing TCP connection retry count\n\n this.sentPe1 = false\n this.sentPe2 = false\n this.sentPe3 = false\n this.sentPe4 = false\n this.sentHandshake = false\n }\n\n /**\n * Called once the peer is connected (i.e. fired 'connect' event)\n * @param {Socket} conn\n */\n onConnect () {\n if (this.destroyed) return\n this.connected = true\n\n debug('Peer %s connected', this.id)\n\n clearTimeout(this.connectTimeout)\n\n const conn = this.conn\n conn.once('end', () => {\n this.destroy()\n })\n conn.once('close', () => {\n this.destroy()\n })\n conn.once('finish', () => {\n this.destroy()\n })\n conn.once('error', err => {\n this.destroy(err)\n })\n\n const wire = this.wire = new Wire(this.type, this.retries, secure)\n\n wire.once('end', () => {\n this.destroy()\n })\n wire.once('close', () => {\n this.destroy()\n })\n wire.once('finish', () => {\n this.destroy()\n })\n wire.once('error', err => {\n this.destroy(err)\n })\n\n wire.once('pe1', () => {\n this.onPe1()\n })\n wire.once('pe2', () => {\n this.onPe2()\n })\n wire.once('pe3', () => {\n this.onPe3()\n })\n wire.once('pe4', () => {\n this.onPe4()\n })\n wire.once('handshake', (infoHash, peerId) => {\n this.onHandshake(infoHash, peerId)\n })\n this.startHandshakeTimeout()\n\n this.setThrottlePipes()\n\n if (this.swarm) {\n if (this.type === 'tcpOutgoing') {\n if (secure && this.retries === 0 && !this.sentPe1) this.sendPe1()\n else if (!this.sentHandshake) this.handshake()\n } else if (this.type !== 'tcpIncoming' && !this.sentHandshake) this.handshake()\n }\n }\n\n sendPe1 () {\n this.wire.sendPe1()\n this.sentPe1 = true\n }\n\n onPe1 () {\n this.sendPe2()\n }\n\n sendPe2 () {\n this.wire.sendPe2()\n this.sentPe2 = true\n }\n\n onPe2 () {\n this.sendPe3()\n }\n\n sendPe3 () {\n this.wire.sendPe3(this.swarm.infoHash)\n this.sentPe3 = true\n }\n\n onPe3 (infoHashHash) {\n if (this.swarm) {\n if (this.swarm.infoHashHash !== infoHashHash) {\n this.destroy(new Error('unexpected crypto handshake info hash for this swarm'))\n }\n this.sendPe4()\n }\n }\n\n sendPe4 () {\n this.wire.sendPe4(this.swarm.infoHash)\n this.sentPe4 = true\n }\n\n onPe4 () {\n if (!this.sentHandshake) this.handshake()\n }\n\n clearPipes () {\n this.conn.unpipe()\n this.wire.unpipe()\n }\n\n setThrottlePipes () {\n const self = this\n pipeline(\n this.conn,\n this.throttleGroups.down.throttle(),\n new Transform({\n transform (chunk, callback) {\n self.emit('download', chunk.length)\n if (self.destroyed) return\n callback(null, chunk)\n }\n }),\n this.wire,\n this.throttleGroups.up.throttle(),\n new Transform({\n transform (chunk, callback) {\n self.emit('upload', chunk.length)\n if (self.destroyed) return\n callback(null, chunk)\n }\n }),\n this.conn\n )\n }\n\n /**\n * Called when handshake is received from remote peer.\n * @param {string} infoHash\n * @param {string} peerId\n */\n onHandshake (infoHash, peerId) {\n if (!this.swarm) return // `this.swarm` not set yet, so do nothing\n if (this.destroyed) return\n\n if (this.swarm.destroyed) {\n return this.destroy(new Error('swarm already destroyed'))\n }\n if (infoHash !== this.swarm.infoHash) {\n return this.destroy(new Error('unexpected handshake info hash for this swarm'))\n }\n if (peerId === this.swarm.peerId) {\n return this.destroy(new Error('refusing to connect to ourselves'))\n }\n\n debug('Peer %s got handshake %s', this.id, infoHash)\n\n clearTimeout(this.handshakeTimeout)\n\n this.retries = 0\n\n let addr = this.addr\n if (!addr && this.conn.remoteAddress && this.conn.remotePort) {\n addr = `${this.conn.remoteAddress}:${this.conn.remotePort}`\n }\n this.swarm._onWire(this.wire, addr)\n\n // swarm could be destroyed in user's 'wire' event handler\n if (!this.swarm || this.swarm.destroyed) return\n\n if (!this.sentHandshake) this.handshake()\n }\n\n handshake () {\n const opts = {\n dht: this.swarm.private ? false : !!this.swarm.client.dht,\n fast: true\n }\n this.wire.handshake(this.swarm.infoHash, this.swarm.client.peerId, opts)\n this.sentHandshake = true\n }\n\n startConnectTimeout () {\n clearTimeout(this.connectTimeout)\n\n const connectTimeoutValues = {\n webrtc: CONNECT_TIMEOUT_WEBRTC,\n tcpOutgoing: CONNECT_TIMEOUT_TCP,\n utpOutgoing: CONNECT_TIMEOUT_UTP\n }\n\n this.connectTimeout = setTimeout(() => {\n this.destroy(new Error('connect timeout'))\n }, connectTimeoutValues[this.type])\n if (this.connectTimeout.unref) this.connectTimeout.unref()\n }\n\n startHandshakeTimeout () {\n clearTimeout(this.handshakeTimeout)\n this.handshakeTimeout = setTimeout(() => {\n this.destroy(new Error('handshake timeout'))\n }, HANDSHAKE_TIMEOUT)\n if (this.handshakeTimeout.unref) this.handshakeTimeout.unref()\n }\n\n destroy (err) {\n if (this.destroyed) return\n this.destroyed = true\n this.connected = false\n\n debug('destroy %s %s (error: %s)', this.type, this.id, err && (err.message || err))\n\n clearTimeout(this.connectTimeout)\n clearTimeout(this.handshakeTimeout)\n\n const swarm = this.swarm\n const conn = this.conn\n const wire = this.wire\n\n this.swarm = null\n this.conn = null\n this.wire = null\n\n if (swarm && wire) {\n arrayRemove(swarm.wires, swarm.wires.indexOf(wire))\n }\n if (conn) {\n conn.on('error', () => {})\n conn.destroy()\n }\n if (wire) wire.destroy()\n if (swarm) swarm.removePeer(this.id)\n }\n}\n\nPeer.TYPE_TCP_INCOMING = TYPE_TCP_INCOMING\nPeer.TYPE_TCP_OUTGOING = TYPE_TCP_OUTGOING\nPeer.TYPE_UTP_INCOMING = TYPE_UTP_INCOMING\nPeer.TYPE_UTP_OUTGOING = TYPE_UTP_OUTGOING\nPeer.TYPE_WEBRTC = TYPE_WEBRTC\nPeer.TYPE_WEBSEED = TYPE_WEBSEED\n\nPeer.SOURCE_MANUAL = SOURCE_MANUAL\nPeer.SOURCE_TRACKER = SOURCE_TRACKER\nPeer.SOURCE_DHT = SOURCE_DHT\nPeer.SOURCE_LSD = SOURCE_LSD\nPeer.SOURCE_UT_PEX = SOURCE_UT_PEX\n\n/**\n * WebRTC peer connections start out connected, because WebRTC peers require an\n * \"introduction\" (i.e. WebRTC signaling), and there's no equivalent to an IP address\n * that lets you refer to a WebRTC endpoint.\n */\nPeer.createWebRTCPeer = (conn, swarm, throttleGroups) => {\n const peer = new Peer(conn.id, 'webrtc')\n peer.conn = conn\n peer.swarm = swarm\n peer.throttleGroups = throttleGroups\n\n if (peer.conn.connected) {\n peer.onConnect()\n } else {\n const cleanup = () => {\n peer.conn.removeListener('connect', onConnect)\n peer.conn.removeListener('error', onError)\n }\n const onConnect = () => {\n cleanup()\n peer.onConnect()\n }\n const onError = err => {\n cleanup()\n peer.destroy(err)\n }\n peer.conn.once('connect', onConnect)\n peer.conn.once('error', onError)\n peer.startConnectTimeout()\n }\n\n return peer\n}\n\n/**\n * Incoming TCP peers start out connected, because the remote peer connected to the\n * listening port of the TCP server. Until the remote peer sends a handshake, we don't\n * know what swarm the connection is intended for.\n */\nPeer.createTCPIncomingPeer = (conn, throttleGroups) => {\n return Peer._createIncomingPeer(conn, TYPE_TCP_INCOMING, throttleGroups)\n}\n\n/**\n * Incoming uTP peers start out connected, because the remote peer connected to the\n * listening port of the uTP server. Until the remote peer sends a handshake, we don't\n * know what swarm the connection is intended for.\n */\nPeer.createUTPIncomingPeer = (conn, throttleGroups) => {\n return Peer._createIncomingPeer(conn, TYPE_UTP_INCOMING, throttleGroups)\n}\n\n/**\n * Outgoing TCP peers start out with just an IP address. At some point (when there is an\n * available connection), the client can attempt to connect to the address.\n */\nPeer.createTCPOutgoingPeer = (addr, swarm, throttleGroups) => {\n return Peer._createOutgoingPeer(addr, swarm, TYPE_TCP_OUTGOING, throttleGroups)\n}\n\n/**\n * Outgoing uTP peers start out with just an IP address. At some point (when there is an\n * available connection), the client can attempt to connect to the address.\n */\nPeer.createUTPOutgoingPeer = (addr, swarm, throttleGroups) => {\n return Peer._createOutgoingPeer(addr, swarm, TYPE_UTP_OUTGOING, throttleGroups)\n}\n\nPeer._createIncomingPeer = (conn, type, throttleGroups) => {\n const addr = `${conn.remoteAddress}:${conn.remotePort}`\n const peer = new Peer(addr, type)\n peer.conn = conn\n peer.addr = addr\n peer.throttleGroups = throttleGroups\n\n peer.onConnect()\n\n return peer\n}\n\nPeer._createOutgoingPeer = (addr, swarm, type, throttleGroups) => {\n const peer = new Peer(addr, type)\n peer.addr = addr\n peer.swarm = swarm\n peer.throttleGroups = throttleGroups\n\n return peer\n}\n\n/**\n * Peer that represents a Web Seed (BEP17 / BEP19).\n */\n\nPeer.createWebSeedPeer = (conn, id, swarm, throttleGroups) => {\n const peer = new Peer(id, TYPE_WEBSEED)\n\n peer.swarm = swarm\n peer.conn = conn\n peer.throttleGroups = throttleGroups\n\n peer.onConnect()\n\n return peer\n}\n","export function digitCount (value) {\n // Add a digit for negative numbers, as the sign will be prefixed\n const sign = value < 0 ? 1 : 0\n // Guard against negative numbers & zero going into log10(),\n // as that would return -Infinity\n value = Math.abs(Number(value || 1))\n return Math.floor(Math.log10(value)) + 1 + sign\n}\n\nexport function getType (value) {\n if (ArrayBuffer.isView(value)) return 'arraybufferview'\n if (Array.isArray(value)) return 'array'\n if (value instanceof Number) return 'number'\n if (value instanceof Boolean) return 'boolean'\n if (value instanceof Set) return 'set'\n if (value instanceof Map) return 'map'\n if (value instanceof String) return 'string'\n if (value instanceof ArrayBuffer) return 'arraybuffer'\n return typeof value\n}\n","import { concat, text2arr } from 'uint8-util'\nimport { getType } from './util.js'\n\n/**\n * Encodes data in bencode.\n *\n * @param {Uint8Array|Array|String|Object|Number|Boolean} data\n * @return {Uint8Array}\n */\nfunction encode (data, buffer, offset) {\n const buffers = []\n let result = null\n\n encode._encode(buffers, data)\n result = concat(buffers)\n encode.bytes = result.length\n\n if (ArrayBuffer.isView(buffer)) {\n buffer.set(result, offset)\n return buffer\n }\n\n return result\n}\n\nencode.bytes = -1\nencode._floatConversionDetected = false\n\nencode._encode = function (buffers, data) {\n if (data == null) { return }\n\n switch (getType(data)) {\n case 'object': encode.dict(buffers, data); break\n case 'map': encode.dictMap(buffers, data); break\n case 'array': encode.list(buffers, data); break\n case 'set': encode.listSet(buffers, data); break\n case 'string': encode.string(buffers, data); break\n case 'number': encode.number(buffers, data); break\n case 'boolean': encode.number(buffers, data); break\n case 'arraybufferview': encode.buffer(buffers, new Uint8Array(data.buffer, data.byteOffset, data.byteLength)); break\n case 'arraybuffer': encode.buffer(buffers, new Uint8Array(data)); break\n }\n}\n\nconst buffE = new Uint8Array([0x65])\nconst buffD = new Uint8Array([0x64])\nconst buffL = new Uint8Array([0x6C])\n\nencode.buffer = function (buffers, data) {\n buffers.push(text2arr(data.length + ':'), data)\n}\n\nencode.string = function (buffers, data) {\n buffers.push(text2arr(text2arr(data).byteLength + ':' + data))\n}\n\nencode.number = function (buffers, data) {\n const maxLo = 0x80000000\n const hi = (data / maxLo) << 0\n const lo = (data % maxLo) << 0\n const val = hi * maxLo + lo\n\n buffers.push(text2arr('i' + val + 'e'))\n\n if (val !== data && !encode._floatConversionDetected) {\n encode._floatConversionDetected = true\n console.warn(\n 'WARNING: Possible data corruption detected with value \"' + data + '\":',\n 'Bencoding only defines support for integers, value was converted to \"' + val + '\"'\n )\n console.trace()\n }\n}\n\nencode.dict = function (buffers, data) {\n buffers.push(buffD)\n\n let j = 0\n let k\n // fix for issue #13 - sorted dicts\n const keys = Object.keys(data).sort()\n const kl = keys.length\n\n for (; j < kl; j++) {\n k = keys[j]\n if (data[k] == null) continue\n encode.string(buffers, k)\n encode._encode(buffers, data[k])\n }\n\n buffers.push(buffE)\n}\n\nencode.dictMap = function (buffers, data) {\n buffers.push(buffD)\n\n const keys = Array.from(data.keys()).sort()\n\n for (const key of keys) {\n if (data.get(key) == null) continue\n ArrayBuffer.isView(key)\n ? encode._encode(buffers, key)\n : encode.string(buffers, String(key))\n encode._encode(buffers, data.get(key))\n }\n\n buffers.push(buffE)\n}\n\nencode.list = function (buffers, data) {\n let i = 0\n const c = data.length\n buffers.push(buffL)\n\n for (; i < c; i++) {\n if (data[i] == null) continue\n encode._encode(buffers, data[i])\n }\n\n buffers.push(buffE)\n}\n\nencode.listSet = function (buffers, data) {\n buffers.push(buffL)\n\n for (const item of data) {\n if (item == null) continue\n encode._encode(buffers, item)\n }\n\n buffers.push(buffE)\n}\n\nexport default encode\n","import { arr2text, text2arr } from 'uint8-util'\n\nconst INTEGER_START = 0x69 // 'i'\nconst STRING_DELIM = 0x3A // ':'\nconst DICTIONARY_START = 0x64 // 'd'\nconst LIST_START = 0x6C // 'l'\nconst END_OF_TYPE = 0x65 // 'e'\n\n/**\n * replaces parseInt(buffer.toString('ascii', start, end)).\n * For strings with less then ~30 charachters, this is actually a lot faster.\n *\n * @param {Uint8Array} data\n * @param {Number} start\n * @param {Number} end\n * @return {Number} calculated number\n */\nfunction getIntFromBuffer (buffer, start, end) {\n let sum = 0\n let sign = 1\n\n for (let i = start; i < end; i++) {\n const num = buffer[i]\n\n if (num < 58 && num >= 48) {\n sum = sum * 10 + (num - 48)\n continue\n }\n\n if (i === start && num === 43) { // +\n continue\n }\n\n if (i === start && num === 45) { // -\n sign = -1\n continue\n }\n\n if (num === 46) { // .\n // its a float. break here.\n break\n }\n\n throw new Error('not a number: buffer[' + i + '] = ' + num)\n }\n\n return sum * sign\n}\n\n/**\n * Decodes bencoded data.\n *\n * @param {Uint8Array} data\n * @param {Number} start (optional)\n * @param {Number} end (optional)\n * @param {String} encoding (optional)\n * @return {Object|Array|Uint8Array|String|Number}\n */\nfunction decode (data, start, end, encoding) {\n if (data == null || data.length === 0) {\n return null\n }\n\n if (typeof start !== 'number' && encoding == null) {\n encoding = start\n start = undefined\n }\n\n if (typeof end !== 'number' && encoding == null) {\n encoding = end\n end = undefined\n }\n\n decode.position = 0\n decode.encoding = encoding || null\n\n decode.data = !(ArrayBuffer.isView(data))\n ? text2arr(data)\n : new Uint8Array(data.slice(start, end))\n\n decode.bytes = decode.data.length\n\n return decode.next()\n}\n\ndecode.bytes = 0\ndecode.position = 0\ndecode.data = null\ndecode.encoding = null\n\ndecode.next = function () {\n switch (decode.data[decode.position]) {\n case DICTIONARY_START:\n return decode.dictionary()\n case LIST_START:\n return decode.list()\n case INTEGER_START:\n return decode.integer()\n default:\n return decode.buffer()\n }\n}\n\ndecode.find = function (chr) {\n let i = decode.position\n const c = decode.data.length\n const d = decode.data\n\n while (i < c) {\n if (d[i] === chr) return i\n i++\n }\n\n throw new Error(\n 'Invalid data: Missing delimiter \"' +\n String.fromCharCode(chr) + '\" [0x' +\n chr.toString(16) + ']'\n )\n}\n\ndecode.dictionary = function () {\n decode.position++\n\n const dict = {}\n\n while (decode.data[decode.position] !== END_OF_TYPE) {\n dict[arr2text(decode.buffer())] = decode.next()\n }\n\n decode.position++\n\n return dict\n}\n\ndecode.list = function () {\n decode.position++\n\n const lst = []\n\n while (decode.data[decode.position] !== END_OF_TYPE) {\n lst.push(decode.next())\n }\n\n decode.position++\n\n return lst\n}\n\ndecode.integer = function () {\n const end = decode.find(END_OF_TYPE)\n const number = getIntFromBuffer(decode.data, decode.position + 1, end)\n\n decode.position += end + 1 - decode.position\n\n return number\n}\n\ndecode.buffer = function () {\n let sep = decode.find(STRING_DELIM)\n const length = getIntFromBuffer(decode.data, decode.position, sep)\n const end = ++sep + length\n\n decode.position = end\n\n return decode.encoding\n ? arr2text(decode.data.slice(sep, end))\n : decode.data.slice(sep, end)\n}\n\nexport default decode\n","import { text2arr } from 'uint8-util'\nimport { digitCount, getType } from './util.js'\n\nfunction listLength (list) {\n let length = 1 + 1 // type marker + end-of-type marker\n\n for (const value of list) {\n length += encodingLength(value)\n }\n\n return length\n}\n\nfunction mapLength (map) {\n let length = 1 + 1 // type marker + end-of-type marker\n\n for (const [key, value] of map) {\n const keyLength = text2arr(key).byteLength\n length += digitCount(keyLength) + 1 + keyLength\n length += encodingLength(value)\n }\n\n return length\n}\n\nfunction objectLength (value) {\n let length = 1 + 1 // type marker + end-of-type marker\n const keys = Object.keys(value)\n\n for (let i = 0; i < keys.length; i++) {\n const keyLength = text2arr(keys[i]).byteLength\n length += digitCount(keyLength) + 1 + keyLength\n length += encodingLength(value[keys[i]])\n }\n\n return length\n}\n\nfunction stringLength (value) {\n const length = text2arr(value).byteLength\n return digitCount(length) + 1 + length\n}\n\nfunction arrayBufferLength (value) {\n const length = value.byteLength - value.byteOffset\n return digitCount(length) + 1 + length\n}\n\nfunction encodingLength (value) {\n const length = 0\n\n if (value == null) return length\n\n const type = getType(value)\n\n switch (type) {\n case 'arraybufferview': return arrayBufferLength(value)\n case 'string': return stringLength(value)\n case 'array': case 'set': return listLength(value)\n case 'number': return 1 + digitCount(Math.floor(value)) + 1\n case 'bigint': return 1 + value.toString().length + 1\n case 'object': return objectLength(value)\n case 'map': return mapLength(value)\n default:\n throw new TypeError(`Unsupported value of type \"${type}\"`)\n }\n}\n\nexport default encodingLength\n","import encode from './lib/encode.js'\nimport decode from './lib/decode.js'\nimport byteLength from './lib/encoding-length.js'\n/**\n * Determines the amount of bytes\n * needed to encode the given value\n * @param {Object|Array|Uint8Array|String|Number|Boolean} value\n * @return {Number} byteCount\n */\nconst encodingLength = byteLength\nexport default { encode, decode, byteLength, encodingLength }\n","function getByteSize(num) {\n let out = num >> 3;\n if (num % 8 !== 0)\n out++;\n return out;\n}\nexport default class BitField {\n /**\n *\n *\n * @param data Either a number representing the maximum number of supported bytes, or a Uint8Array.\n * @param opts Options for the bitfield.\n */\n constructor(data = 0, opts) {\n const grow = opts === null || opts === void 0 ? void 0 : opts.grow;\n this.grow = (grow && isFinite(grow) && getByteSize(grow)) || grow || 0;\n this.buffer =\n typeof data === \"number\" ? new Uint8Array(getByteSize(data)) : data;\n }\n /**\n * Get a particular bit.\n *\n * @param i Bit index to retrieve.\n * @returns A boolean indicating whether the `i`th bit is set.\n */\n get(i) {\n const j = i >> 3;\n return j < this.buffer.length && !!(this.buffer[j] & (128 >> i % 8));\n }\n /**\n * Set a particular bit.\n *\n * Will grow the underlying array if the bit is out of bounds and the `grow` option is set.\n *\n * @param i Bit index to set.\n * @param value Value to set the bit to. Defaults to `true`.\n */\n set(i, value = true) {\n const j = i >> 3;\n if (value) {\n if (this.buffer.length < j + 1) {\n const length = Math.max(j + 1, Math.min(2 * this.buffer.length, this.grow));\n if (length <= this.grow) {\n const newBuffer = new Uint8Array(length);\n newBuffer.set(this.buffer);\n this.buffer = newBuffer;\n }\n }\n // Set\n this.buffer[j] |= 128 >> i % 8;\n }\n else if (j < this.buffer.length) {\n // Clear\n this.buffer[j] &= ~(128 >> i % 8);\n }\n }\n /**\n * Loop through the bits in the bitfield.\n *\n * @param fn Function to be called with the bit value and index.\n * @param start Index of the first bit to look at.\n * @param end Index of the first bit that should no longer be considered.\n */\n forEach(fn, start = 0, end = this.buffer.length * 8) {\n for (let i = start, j = i >> 3, y = 128 >> i % 8, byte = this.buffer[j]; i < end; i++) {\n fn(!!(byte & y), i);\n y = y === 1 ? ((byte = this.buffer[++j]), 128) : y >> 1;\n }\n }\n}\n//# sourceMappingURL=index.js.map","/*! bittorrent-protocol. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */\nimport bencode from 'bencode'\nimport BitField from 'bitfield'\nimport crypto from 'crypto'\nimport Debug from 'debug'\nimport RC4 from 'rc4'\nimport { Duplex } from 'streamx'\nimport { hash, concat, equal, hex2arr, arr2hex, text2arr, arr2text, randomBytes } from 'uint8-util'\nimport throughput from 'throughput'\nimport arrayRemove from 'unordered-array-remove'\n\nconst debug = Debug('bittorrent-protocol')\n\nconst BITFIELD_GROW = 400000\nconst KEEP_ALIVE_TIMEOUT = 55000\nconst ALLOWED_FAST_SET_MAX_LENGTH = 100\n\nconst MESSAGE_PROTOCOL = text2arr('\\u0013BitTorrent protocol')\nconst MESSAGE_KEEP_ALIVE = new Uint8Array([0x00, 0x00, 0x00, 0x00])\nconst MESSAGE_CHOKE = new Uint8Array([0x00, 0x00, 0x00, 0x01, 0x00])\nconst MESSAGE_UNCHOKE = new Uint8Array([0x00, 0x00, 0x00, 0x01, 0x01])\nconst MESSAGE_INTERESTED = new Uint8Array([0x00, 0x00, 0x00, 0x01, 0x02])\nconst MESSAGE_UNINTERESTED = new Uint8Array([0x00, 0x00, 0x00, 0x01, 0x03])\n\nconst MESSAGE_RESERVED = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]\nconst MESSAGE_PORT = [0x00, 0x00, 0x00, 0x03, 0x09, 0x00, 0x00]\n\n// BEP6 Fast Extension\nconst MESSAGE_HAVE_ALL = new Uint8Array([0x00, 0x00, 0x00, 0x01, 0x0E])\nconst MESSAGE_HAVE_NONE = new Uint8Array([0x00, 0x00, 0x00, 0x01, 0x0F])\n\nconst DH_PRIME = 'ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a36210000000000090563'\nconst DH_GENERATOR = 2\nconst VC = new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])\nconst CRYPTO_PROVIDE = new Uint8Array([0x00, 0x00, 0x01, 0x02])\nconst CRYPTO_SELECT = new Uint8Array([0x00, 0x00, 0x00, 0x02]) // always try to choose RC4 encryption instead of plaintext\n\nfunction xor (a, b) {\n for (let len = a.length; len--;) a[len] ^= b[len]\n return a\n}\n\nclass Request {\n constructor (piece, offset, length, callback) {\n this.piece = piece\n this.offset = offset\n this.length = length\n this.callback = callback\n }\n}\n\nclass HaveAllBitField {\n constructor () {\n this.buffer = new Uint8Array() // dummy\n }\n\n get (index) {\n return true\n }\n\n set (index) {}\n}\n\nclass Wire extends Duplex {\n constructor (type = null, retries = 0, peEnabled = false) {\n super()\n\n this._debugId = arr2hex(randomBytes(4))\n this._debug('new wire')\n\n this.peerId = null // remote peer id (hex string)\n this.peerIdBuffer = null // remote peer id (buffer)\n this.type = type // connection type ('webrtc', 'tcpIncoming', 'tcpOutgoing', 'webSeed')\n\n this.amChoking = true // are we choking the peer?\n this.amInterested = false // are we interested in the peer?\n\n this.peerChoking = true // is the peer choking us?\n this.peerInterested = false // is the peer interested in us?\n\n // The largest torrent that I know of (the Geocities archive) is ~641 GB and has\n // ~41,000 pieces. Therefore, cap bitfield to 10x larger (400,000 bits) to support all\n // possible torrents but prevent malicious peers from growing bitfield to fill memory.\n this.peerPieces = new BitField(0, { grow: BITFIELD_GROW })\n\n this.extensions = {}\n this.peerExtensions = {}\n\n this.requests = [] // outgoing\n this.peerRequests = [] // incoming\n\n this.extendedMapping = {} // number -> string, ex: 1 -> 'ut_metadata'\n this.peerExtendedMapping = {} // string -> number, ex: 9 -> 'ut_metadata'\n\n // The extended handshake to send, minus the \"m\" field, which gets automatically\n // filled from `this.extendedMapping`\n this.extendedHandshake = {}\n\n this.peerExtendedHandshake = {} // remote peer's extended handshake\n\n // BEP6 Fast Estension\n this.hasFast = false // is fast extension enabled?\n this.allowedFastSet = [] // allowed fast set\n this.peerAllowedFastSet = [] // peer's allowed fast set\n\n this._ext = {} // string -> function, ex 'ut_metadata' -> ut_metadata()\n this._nextExt = 1\n\n this.uploaded = 0\n this.downloaded = 0\n this.uploadSpeed = throughput()\n this.downloadSpeed = throughput()\n\n this._keepAliveInterval = null\n this._timeout = null\n this._timeoutMs = 0\n this._timeoutExpiresAt = null\n\n this._finished = false\n\n this._parserSize = 0 // number of needed bytes to parse next message from remote peer\n this._parser = null // function to call once `this._parserSize` bytes are available\n\n this._buffer = [] // incomplete message data\n this._bufferSize = 0 // cached total length of buffers in `this._buffer`\n\n this._peEnabled = peEnabled\n if (peEnabled) {\n this._dh = crypto.createDiffieHellman(DH_PRIME, 'hex', DH_GENERATOR) // crypto object used to generate keys/secret\n this._myPubKey = this._dh.generateKeys('hex') // my DH public key\n } else {\n this._myPubKey = null\n }\n this._peerPubKey = null // peer's DH public key\n this._sharedSecret = null // shared DH secret\n this._peerCryptoProvide = [] // encryption methods provided by peer; we expect this to always contain 0x02\n this._cryptoHandshakeDone = false\n\n this._cryptoSyncPattern = null // the pattern to search for when resynchronizing after receiving pe1/pe2\n this._waitMaxBytes = null // the maximum number of bytes resynchronization must occur within\n this._encryptionMethod = null // 1 for plaintext, 2 for RC4\n this._encryptGenerator = null // RC4 keystream generator for encryption\n this._decryptGenerator = null // RC4 keystream generator for decryption\n this._setGenerators = false // a flag for whether setEncrypt() has successfully completed\n\n this.once('finish', () => this._onFinish())\n\n this.on('finish', this._onFinish)\n this._debug('type:', this.type)\n\n if (this.type === 'tcpIncoming' && this._peEnabled) {\n // If we are not the initiator, we should wait to see if the client begins\n // with PE/MSE handshake or the standard bittorrent handshake.\n this._determineHandshakeType()\n } else if (this.type === 'tcpOutgoing' && this._peEnabled && retries === 0) {\n this._parsePe2()\n } else {\n this._parseHandshake(null)\n }\n }\n\n /**\n * Set whether to send a \"keep-alive\" ping (sent every 55s)\n * @param {boolean} enable\n */\n setKeepAlive (enable) {\n this._debug('setKeepAlive %s', enable)\n clearInterval(this._keepAliveInterval)\n if (enable === false) return\n this._keepAliveInterval = setInterval(() => {\n this.keepAlive()\n }, KEEP_ALIVE_TIMEOUT)\n }\n\n /**\n * Set the amount of time to wait before considering a request to be \"timed out\"\n * @param {number} ms\n * @param {boolean=} unref (should the timer be unref'd? default: false)\n */\n setTimeout (ms, unref) {\n this._debug('setTimeout ms=%d unref=%s', ms, unref)\n this._timeoutMs = ms\n this._timeoutUnref = !!unref\n this._resetTimeout(true)\n }\n\n destroy () {\n if (this.destroyed) return\n this._debug('destroy')\n this.end()\n return this\n }\n\n end (data) {\n if (this.destroyed || this.destroying) return\n this._debug('end')\n this._onUninterested()\n this._onChoke()\n return super.end(data)\n }\n\n /**\n * Use the specified protocol extension.\n * @param {function} Extension\n */\n use (Extension) {\n const name = Extension.prototype.name\n if (!name) {\n throw new Error('Extension class requires a \"name\" property on the prototype')\n }\n this._debug('use extension.name=%s', name)\n\n const ext = this._nextExt\n const handler = new Extension(this)\n\n function noop () {}\n\n if (typeof handler.onHandshake !== 'function') {\n handler.onHandshake = noop\n }\n if (typeof handler.onExtendedHandshake !== 'function') {\n handler.onExtendedHandshake = noop\n }\n if (typeof handler.onMessage !== 'function') {\n handler.onMessage = noop\n }\n\n this.extendedMapping[ext] = name\n this._ext[name] = handler\n this[name] = handler\n\n this._nextExt += 1\n }\n\n //\n // OUTGOING MESSAGES\n //\n\n /**\n * Message \"keep-alive\": <len=0000>\n */\n keepAlive () {\n this._debug('keep-alive')\n this._push(MESSAGE_KEEP_ALIVE)\n }\n\n sendPe1 () {\n if (this._peEnabled) {\n const padALen = Math.floor(Math.random() * 513)\n const padA = randomBytes(padALen)\n this._push(concat([hex2arr(this._myPubKey), padA]))\n }\n }\n\n sendPe2 () {\n const padBLen = Math.floor(Math.random() * 513)\n const padB = randomBytes(padBLen)\n this._push(concat([hex2arr(this._myPubKey), padB]))\n }\n\n async sendPe3 (infoHash) {\n await this.setEncrypt(this._sharedSecret, infoHash)\n\n const hash1Buffer = await hash(hex2arr(this._utfToHex('req1') + this._sharedSecret))\n\n const hash2Buffer = await hash(hex2arr(this._utfToHex('req2') + infoHash))\n const hash3Buffer = await hash(hex2arr(this._utfToHex('req3') + this._sharedSecret))\n const hashesXorBuffer = xor(hash2Buffer, hash3Buffer)\n\n const padCLen = new DataView(randomBytes(2).buffer).getUint16(0) % 512\n const padCBuffer = randomBytes(padCLen)\n\n let vcAndProvideBuffer = new Uint8Array(8 + 4 + 2 + padCLen + 2)\n vcAndProvideBuffer.set(VC)\n vcAndProvideBuffer.set(CRYPTO_PROVIDE, 8)\n\n const view = new DataView(vcAndProvideBuffer.buffer)\n\n view.setInt16(12, padCLen) // pad C length\n padCBuffer.copy(vcAndProvideBuffer, 14)\n view.setInt16(14 + padCLen, 0) // IA length\n vcAndProvideBuffer = this._encryptHandshake(vcAndProvideBuffer)\n\n this._push(concat([hash1Buffer, hashesXorBuffer, vcAndProvideBuffer]))\n }\n\n async sendPe4 (infoHash) {\n await this.setEncrypt(this._sharedSecret, infoHash)\n\n const padDLen = new DataView(randomBytes(2).buffer).getUint16(0) % 512\n const padDBuffer = randomBytes(padDLen)\n let vcAndSelectBuffer = new Uint8Array(8 + 4 + 2 + padDLen)\n const view = new DataView(vcAndSelectBuffer.buffer)\n\n vcAndSelectBuffer.set(VC)\n vcAndSelectBuffer.set(CRYPTO_SELECT, 8)\n view.setInt16(12, padDLen) // lenD?\n vcAndSelectBuffer.set(padDBuffer, 14)\n vcAndSelectBuffer = this._encryptHandshake(vcAndSelectBuffer)\n this._push(vcAndSelectBuffer)\n this._cryptoHandshakeDone = true\n this._debug('completed crypto handshake')\n }\n\n /**\n * Message: \"handshake\" <pstrlen><pstr><reserved><info_hash><peer_id>\n * @param {Uint8Array|string} infoHash (as Buffer or *hex* string)\n * @param {Uint8Array|string} peerId\n * @param {Object} extensions\n */\n handshake (infoHash, peerId, extensions) {\n let infoHashBuffer\n let peerIdBuffer\n if (typeof infoHash === 'string') {\n infoHash = infoHash.toLowerCase()\n infoHashBuffer = hex2arr(infoHash)\n } else {\n infoHashBuffer = infoHash\n infoHash = arr2hex(infoHashBuffer)\n }\n if (typeof peerId === 'string') {\n peerIdBuffer = hex2arr(peerId)\n } else {\n peerIdBuffer = peerId\n peerId = arr2hex(peerIdBuffer)\n }\n\n this._infoHash = infoHashBuffer\n\n if (infoHashBuffer.length !== 20 || peerIdBuffer.length !== 20) {\n throw new Error('infoHash and peerId MUST have length 20')\n }\n\n this._debug('handshake i=%s p=%s exts=%o', infoHash, peerId, extensions)\n\n const reserved = new Uint8Array(MESSAGE_RESERVED)\n\n this.extensions = {\n extended: true,\n dht: !!(extensions && extensions.dht),\n fast: !!(extensions && extensions.fast)\n }\n\n reserved[5] |= 0x10 // enable extended message\n if (this.extensions.dht) reserved[7] |= 0x01\n if (this.extensions.fast) reserved[7] |= 0x04\n\n // BEP6 Fast Extension: The extension is enabled only if both ends of the connection set this bit.\n if (this.extensions.fast && this.peerExtensions.fast) {\n this._debug('fast extension is enabled')\n this.hasFast = true\n }\n this._push(concat([MESSAGE_PROTOCOL, reserved, infoHashBuffer, peerIdBuffer]))\n this._handshakeSent = true\n\n if (this.peerExtensions.extended && !this._extendedHandshakeSent) {\n // Peer's handshake indicated support already\n // (incoming connection)\n this._sendExtendedHandshake()\n }\n }\n\n /* Peer supports BEP-0010, send extended handshake.\n *\n * This comes after the 'handshake' event to give the user a chance to populate\n * `this.extendedHandshake` and `this.extendedMapping` before the extended handshake\n * is sent to the remote peer.\n */\n _sendExtendedHandshake () {\n // Create extended message object from registered extensions\n const msg = Object.assign({}, this.extendedHandshake)\n msg.m = {}\n for (const ext in this.extendedMapping) {\n const name = this.extendedMapping[ext]\n msg.m[name] = Number(ext)\n }\n\n // Send extended handshake\n this.extended(0, bencode.encode(msg))\n this._extendedHandshakeSent = true\n }\n\n /**\n * Message \"choke\": <len=0001><id=0>\n */\n choke () {\n if (this.amChoking) return\n this.amChoking = true\n this._debug('choke')\n this._push(MESSAGE_CHOKE)\n\n if (this.hasFast) {\n // BEP6: If a peer sends a choke, it MUST reject all requests from the peer to whom the choke\n // was sent except it SHOULD NOT reject requests for pieces that are in the allowed fast set.\n let allowedCount = 0\n while (this.peerRequests.length > allowedCount) { // until only allowed requests are left\n const request = this.peerRequests[allowedCount] // first non-allowed request\n if (this.allowedFastSet.includes(request.piece)) {\n ++allowedCount // count request as allowed\n } else {\n this.reject(request.piece, request.offset, request.length) // removes from this.peerRequests\n }\n }\n } else {\n while (this.peerRequests.length) {\n this.peerRequests.pop()\n }\n }\n }\n\n /**\n * Message \"unchoke\": <len=0001><id=1>\n */\n unchoke () {\n if (!this.amChoking) return\n this.amChoking = false\n this._debug('unchoke')\n this._push(MESSAGE_UNCHOKE)\n }\n\n /**\n * Message \"interested\": <len=0001><id=2>\n */\n interested () {\n if (this.amInterested) return\n this.amInterested = true\n this._debug('interested')\n this._push(MESSAGE_INTERESTED)\n }\n\n /**\n * Message \"uninterested\": <len=0001><id=3>\n */\n uninterested () {\n if (!this.amInterested) return\n this.amInterested = false\n this._debug('uninterested')\n this._push(MESSAGE_UNINTERESTED)\n }\n\n /**\n * Message \"have\": <len=0005><id=4><piece index>\n * @param {number} index\n */\n have (index) {\n this._debug('have %d', index)\n this._message(4, [index], null)\n }\n\n /**\n * Message \"bitfield\": <len=0001+X><id=5><bitfield>\n * @param {BitField|Buffer} bitfield\n */\n bitfield (bitfield) {\n this._debug('bitfield')\n if (!ArrayBuffer.isView(bitfield)) bitfield = bitfield.buffer\n this._message(5, [], bitfield)\n }\n\n /**\n * Message \"request\": <len=0013><id=6><index><begin><length>\n * @param {number} index\n * @param {number} offset\n * @param {number} length\n * @param {function} cb\n */\n request (index, offset, length, cb) {\n if (!cb) cb = () => {}\n if (this._finished) return cb(new Error('wire is closed'))\n\n if (this.peerChoking && !(this.hasFast && this.peerAllowedFastSet.includes(index))) {\n return cb(new Error('peer is choking'))\n }\n\n this._debug('request index=%d offset=%d length=%d', index, offset, length)\n\n this.requests.push(new Request(index, offset, length, cb))\n if (!this._timeout) {\n this._resetTimeout(true)\n }\n this._message(6, [index, offset, length], null)\n }\n\n /**\n * Message \"piece\": <len=0009+X><id=7><index><begin><block>\n * @param {number} index\n * @param {number} offset\n * @param {Uint8Array} buffer\n */\n piece (index, offset, buffer) {\n this._debug('piece index=%d offset=%d', index, offset)\n this._message(7, [index, offset], buffer)\n this.uploaded += buffer.length\n this.uploadSpeed(buffer.length)\n this.emit('upload', buffer.length)\n }\n\n /**\n * Message \"cancel\": <len=0013><id=8><index><begin><length>\n * @param {number} index\n * @param {number} offset\n * @param {number} length\n */\n cancel (index, offset, length) {\n this._debug('cancel index=%d offset=%d length=%d', index, offset, length)\n this._callback(\n this._pull(this.requests, index, offset, length),\n new Error('request was cancelled'),\n null\n )\n this._message(8, [index, offset, length], null)\n }\n\n /**\n * Message: \"port\" <len=0003><id=9><listen-port>\n * @param {Number} port\n */\n port (port) {\n this._debug('port %d', port)\n const message = new Uint8Array(MESSAGE_PORT)\n const view = new DataView(message.buffer)\n view.setUint16(5, port)\n this._push(message)\n }\n\n /**\n * Message: \"suggest\" <len=0x0005><id=0x0D><piece index> (BEP6)\n * @param {number} index\n */\n suggest (index) {\n if (!this.hasFast) throw Error('fast extension is disabled')\n this._debug('suggest %d', index)\n this._message(0x0D, [index], null)\n }\n\n /**\n * Message: \"have-all\" <len=0x0001><id=0x0E> (BEP6)\n */\n haveAll () {\n if (!this.hasFast) throw Error('fast extension is disabled')\n this._debug('have-all')\n this._push(MESSAGE_HAVE_ALL)\n }\n\n /**\n * Message: \"have-none\" <len=0x0001><id=0x0F> (BEP6)\n */\n haveNone () {\n if (!this.hasFast) throw Error('fast extension is disabled')\n this._debug('have-none')\n this._push(MESSAGE_HAVE_NONE)\n }\n\n /**\n * Message \"reject\": <len=0x000D><id=0x10><index><offset><length> (BEP6)\n * @param {number} index\n * @param {number} offset\n * @param {number} length\n */\n reject (index, offset, length) {\n if (!this.hasFast) throw Error('fast extension is disabled')\n this._debug('reject index=%d offset=%d length=%d', index, offset, length)\n this._pull(this.peerRequests, index, offset, length)\n this._message(0x10, [index, offset, length], null)\n }\n\n /**\n * Message: \"allowed-fast\" <len=0x0005><id=0x11><piece index> (BEP6)\n * @param {number} index\n */\n allowedFast (index) {\n if (!this.hasFast) throw Error('fast extension is disabled')\n this._debug('allowed-fast %d', index)\n if (!this.allowedFastSet.includes(index)) this.allowedFastSet.push(index)\n this._message(0x11, [index], null)\n }\n\n /**\n * Message: \"extended\" <len=0005+X><id=20><ext-number><payload>\n * @param {number|string} ext\n * @param {Object} obj\n */\n extended (ext, obj) {\n this._debug('extended ext=%s', ext)\n if (typeof ext === 'string' && this.peerExtendedMapping[ext]) {\n ext = this.peerExtendedMapping[ext]\n }\n if (typeof ext === 'number') {\n const extId = new Uint8Array([ext])\n const buf = ArrayBuffer.isView(obj) ? obj : bencode.encode(obj)\n\n this._message(20, [], concat([extId, buf]))\n } else {\n throw new Error(`Unrecognized extension: ${ext}`)\n }\n }\n\n /**\n * Sets the encryption method for this wire, as per PSE/ME specification\n *\n * @param {string} sharedSecret: A hex-encoded string, which is the shared secret agreed\n * upon from DH key exchange\n * @param {string} infoHash: A hex-encoded info hash\n * @returns boolean, true if encryption setting succeeds, false if it fails.\n */\n async setEncrypt (sharedSecret, infoHash) {\n let encryptKeyBuf\n let encryptKeyIntArray\n let decryptKeyBuf\n let decryptKeyIntArray\n switch (this.type) {\n case 'tcpIncoming':\n encryptKeyBuf = await hash(hex2arr(this._utfToHex('keyB') + sharedSecret + infoHash))\n decryptKeyBuf = await hash(hex2arr(this._utfToHex('keyA') + sharedSecret + infoHash))\n encryptKeyIntArray = []\n for (const value of encryptKeyBuf.values()) {\n encryptKeyIntArray.push(value)\n }\n decryptKeyIntArray = []\n for (const value of decryptKeyBuf.values()) {\n decryptKeyIntArray.push(value)\n }\n this._encryptGenerator = new RC4(encryptKeyIntArray)\n this._decryptGenerator = new RC4(decryptKeyIntArray)\n break\n case 'tcpOutgoing':\n encryptKeyBuf = await hash(hex2arr(this._utfToHex('keyA') + sharedSecret + infoHash))\n decryptKeyBuf = await hash(hex2arr(this._utfToHex('keyB') + sharedSecret + infoHash))\n encryptKeyIntArray = []\n for (const value of encryptKeyBuf.values()) {\n encryptKeyIntArray.push(value)\n }\n decryptKeyIntArray = []\n for (const value of decryptKeyBuf.values()) {\n decryptKeyIntArray.push(value)\n }\n this._encryptGenerator = new RC4(encryptKeyIntArray)\n this._decryptGenerator = new RC4(decryptKeyIntArray)\n break\n default:\n return false\n }\n\n // Discard the first 1024 bytes, as per MSE/PE implementation\n for (let i = 0; i < 1024; i++) {\n this._encryptGenerator.randomByte()\n this._decryptGenerator.randomByte()\n }\n\n this._setGenerators = true\n return true\n }\n\n /**\n * Send a message to the remote peer.\n */\n _message (id, numbers, data) {\n const dataLength = data ? data.length : 0\n const buffer = new Uint8Array(5 + (4 * numbers.length))\n const view = new DataView(buffer.buffer)\n\n view.setUint32(0, buffer.length + dataLength - 4)\n buffer[4] = id\n for (let i = 0; i < numbers.length; i++) {\n view.setUint32(5 + (4 * i), numbers[i])\n }\n\n this._push(buffer)\n if (data) this._push(data)\n }\n\n _push (data) {\n if (this._finished) return\n if (this._encryptionMethod === 2 && this._cryptoHandshakeDone) {\n data = this._encrypt(data)\n }\n return this.push(data)\n }\n\n //\n // INCOMING MESSAGES\n //\n\n _onKeepAlive () {\n this._debug('got keep-alive')\n this.emit('keep-alive')\n }\n\n _onPe1 (pubKeyBuffer) {\n this._peerPubKey = arr2hex(pubKeyBuffer)\n this._sharedSecret = this._dh.computeSecret(this._peerPubKey, 'hex', 'hex')\n this.emit('pe1')\n }\n\n _onPe2 (pubKeyBuffer) {\n this._peerPubKey = arr2hex(pubKeyBuffer)\n this._sharedSecret = this._dh.computeSecret(this._peerPubKey, 'hex', 'hex')\n this.emit('pe2')\n }\n\n async _onPe3 (hashesXorBuffer) {\n const hash3 = await (arr2hex(this._utfToHex('req3') + this._sharedSecret))\n const sKeyHash = arr2hex(xor(hash3, hashesXorBuffer))\n this.emit('pe3', sKeyHash)\n }\n\n _onPe3Encrypted (vcBuffer, peerProvideBuffer) {\n if (!equal(vcBuffer, VC)) {\n this._debug('Error: verification constant did not match')\n this.destroy()\n return\n }\n\n for (const provideByte of peerProvideBuffer.values()) {\n if (provideByte !== 0) {\n this._peerCryptoProvide.push(provideByte)\n }\n }\n if (this._peerCryptoProvide.includes(2)) {\n this._encryptionMethod = 2\n } else {\n this._debug('Error: RC4 encryption method not provided by peer')\n this.destroy()\n }\n }\n\n _onPe4 (peerSelectBuffer) {\n this._encryptionMethod = peerSelectBuffer[3]\n if (!CRYPTO_PROVIDE.includes(this._encryptionMethod)) {\n this._debug('Error: peer selected invalid crypto method')\n this.destroy()\n }\n this._cryptoHandshakeDone = true\n this._debug('crypto handshake done')\n this.emit('pe4')\n }\n\n _onHandshake (infoHashBuffer, peerIdBuffer, extensions) {\n const infoHash = arr2hex(infoHashBuffer)\n const peerId = arr2hex(peerIdBuffer)\n\n this._debug('got handshake i=%s p=%s exts=%o', infoHash, peerId, extensions)\n\n this.peerId = peerId\n this.peerIdBuffer = peerIdBuffer\n this.peerExtensions = extensions\n\n // BEP6 Fast Extension: The extension is enabled only if both ends of the connection set this bit.\n if (this.extensions.fast && this.peerExtensions.fast) {\n this._debug('fast extension is enabled')\n this.hasFast = true\n }\n\n this.emit('handshake', infoHash, peerId, extensions)\n\n for (const name in this._ext) {\n this._ext[name].onHandshake(infoHash, peerId, extensions)\n }\n\n if (extensions.extended && this._handshakeSent &&\n !this._extendedHandshakeSent) {\n // outgoing connection\n this._sendExtendedHandshake()\n }\n }\n\n _onChoke () {\n this.peerChoking = true\n this._debug('got choke')\n this.emit('choke')\n if (!this.hasFast) {\n // BEP6 Fast Extension: Choke no longer implicitly rejects all pending requests\n while (this.requests.length) {\n this._callback(this.requests.pop(), new Error('peer is choking'), null)\n }\n }\n }\n\n _onUnchoke () {\n this.peerChoking = false\n this._debug('got unchoke')\n this.emit('unchoke')\n }\n\n _onInterested () {\n this.peerInterested = true\n this._debug('got interested')\n this.emit('interested')\n }\n\n _onUninterested () {\n this.peerInterested = false\n this._debug('got uninterested')\n this.emit('uninterested')\n }\n\n _onHave (index) {\n if (this.peerPieces.get(index)) return\n this._debug('got have %d', index)\n\n this.peerPieces.set(index, true)\n this.emit('have', index)\n }\n\n _onBitField (buffer) {\n this.peerPieces = new BitField(buffer)\n this._debug('got bitfield')\n this.emit('bitfield', this.peerPieces)\n }\n\n _onRequest (index, offset, length) {\n if (this.amChoking && !(this.hasFast && this.allowedFastSet.includes(index))) {\n // BEP6: If a peer receives a request from a peer its choking, the peer receiving\n // the request SHOULD send a reject unless the piece is in the allowed fast set.\n if (this.hasFast) this.reject(index, offset, length)\n return\n }\n this._debug('got request index=%d offset=%d length=%d', index, offset, length)\n\n const respond = (err, buffer) => {\n if (request !== this._pull(this.peerRequests, index, offset, length)) return\n if (err) {\n this._debug('error satisfying request index=%d offset=%d length=%d (%s)', index, offset, length, err.message)\n if (this.hasFast) this.reject(index, offset, length)\n return\n }\n this.piece(index, offset, buffer)\n }\n\n const request = new Request(index, offset, length, respond)\n this.peerRequests.push(request)\n this.emit('request', index, offset, length, respond)\n }\n\n _onPiece (index, offset, buffer) {\n this._debug('got piece index=%d offset=%d', index, offset)\n this._callback(this._pull(this.requests, index, offset, buffer.length), null, buffer)\n this.downloaded += buffer.length\n this.downloadSpeed(buffer.length)\n this.emit('download', buffer.length)\n this.emit('piece', index, offset, buffer)\n }\n\n _onCancel (index, offset, length) {\n this._debug('got cancel index=%d offset=%d length=%d', index, offset, length)\n this._pull(this.peerRequests, index, offset, length)\n this.emit('cancel', index, offset, length)\n }\n\n _onPort (port) {\n this._debug('got port %d', port)\n this.emit('port', port)\n }\n\n _onSuggest (index) {\n if (!this.hasFast) {\n // BEP6: the peer MUST close the connection\n this._debug('Error: got suggest whereas fast extension is disabled')\n this.destroy()\n return\n }\n this._debug('got suggest %d', index)\n this.emit('suggest', index)\n }\n\n _onHaveAll () {\n if (!this.hasFast) {\n // BEP6: the peer MUST close the connection\n this._debug('Error: got have-all whereas fast extension is disabled')\n this.destroy()\n return\n }\n this._debug('got have-all')\n this.peerPieces = new HaveAllBitField()\n this.emit('have-all')\n }\n\n _onHaveNone () {\n if (!this.hasFast) {\n // BEP6: the peer MUST close the connection\n this._debug('Error: got have-none whereas fast extension is disabled')\n this.destroy()\n return\n }\n this._debug('got have-none')\n this.emit('have-none')\n }\n\n _onReject (index, offset, length) {\n if (!this.hasFast) {\n // BEP6: the peer MUST close the connection\n this._debug('Error: got reject whereas fast extension is disabled')\n this.destroy()\n return\n }\n this._debug('got reject index=%d offset=%d length=%d', index, offset, length)\n this._callback(\n this._pull(this.requests, index, offset, length),\n new Error('request was rejected'),\n null\n )\n this.emit('reject', index, offset, length)\n }\n\n _onAllowedFast (index) {\n if (!this.hasFast) {\n // BEP6: the peer MUST close the connection\n this._debug('Error: got allowed-fast whereas fast extension is disabled')\n this.destroy()\n return\n }\n this._debug('got allowed-fast %d', index)\n if (!this.peerAllowedFastSet.includes(index)) this.peerAllowedFastSet.push(index)\n if (this.peerAllowedFastSet.length > ALLOWED_FAST_SET_MAX_LENGTH) this.peerAllowedFastSet.shift()\n this.emit('allowed-fast', index)\n }\n\n _onExtended (ext, buf) {\n if (ext === 0) {\n let info\n try {\n info = bencode.decode(buf)\n } catch (err) {\n this._debug('ignoring invalid extended handshake: %s', err.message || err)\n }\n\n if (!info) return\n this.peerExtendedHandshake = info\n\n if (typeof info.m === 'object') {\n for (const name in info.m) {\n this.peerExtendedMapping[name] = Number(info.m[name].toString())\n }\n }\n for (const name in this._ext) {\n if (this.peerExtendedMapping[name]) {\n this._ext[name].onExtendedHandshake(this.peerExtendedHandshake)\n }\n }\n this._debug('got extended handshake')\n this.emit('extended', 'handshake', this.peerExtendedHandshake)\n } else {\n if (this.extendedMapping[ext]) {\n ext = this.extendedMapping[ext] // friendly name for extension\n if (this._ext[ext]) {\n // there is an registered extension handler, so call it\n this._ext[ext].onMessage(buf)\n }\n }\n this._debug('got extended message ext=%s', ext)\n this.emit('extended', ext, buf)\n }\n }\n\n _onTimeout () {\n this._debug('request timed out')\n this._callback(this.requests.shift(), new Error('request has timed out'), null)\n this.emit('timeout')\n }\n\n /**\n * Duplex stream method. Called whenever the remote peer has data for us. Data that the\n * remote peer sends gets buffered (i.e. not actually processed) until the right number\n * of bytes have arrived, determined by the last call to `this._parse(number, callback)`.\n * Once enough bytes have arrived to process the message, the callback function\n * (i.e. `this._parser`) gets called with the full buffer of data.\n * @param {Uint8Array} data\n * @param {function} cb\n */\n _write (data, cb) {\n if (this._encryptionMethod === 2 && this._cryptoHandshakeDone) {\n data = this._decrypt(data)\n }\n this._bufferSize += data.length\n this._buffer.push(data)\n if (this._buffer.length > 1) {\n this._buffer = [concat(this._buffer, this._bufferSize)]\n }\n // now this._buffer is an array containing a single Buffer\n if (this._cryptoSyncPattern) {\n const index = this._buffer[0].indexOf(this._cryptoSyncPattern)\n if (index !== -1) {\n this._buffer[0] = this._buffer[0].slice(index + this._cryptoSyncPattern.length)\n this._bufferSize -= (index + this._cryptoSyncPattern.length)\n this._cryptoSyncPattern = null\n } else if (this._bufferSize + data.length > this._waitMaxBytes + this._cryptoSyncPattern.length) {\n this._debug('Error: could not resynchronize')\n this.destroy()\n return\n }\n }\n\n while (this._bufferSize >= this._parserSize && !this._cryptoSyncPattern) {\n if (this._parserSize === 0) {\n this._parser(new Uint8Array())\n } else {\n const buffer = this._buffer[0]\n // console.log('buffer:', this._buffer)\n this._bufferSize -= this._parserSize\n this._buffer = this._bufferSize\n ? [buffer.slice(this._parserSize)]\n : []\n this._parser(buffer.slice(0, this._parserSize))\n }\n }\n\n cb(null) // Signal that we're ready for more data\n }\n\n _callback (request, err, buffer) {\n if (!request) return\n\n this._resetTimeout(!this.peerChoking && !this._finished)\n\n request.callback(err, buffer)\n }\n\n _resetTimeout (setAgain) {\n if (!setAgain || !this._timeoutMs || !this.requests.length) {\n clearTimeout(this._timeout)\n this._timeout = null\n this._timeoutExpiresAt = null\n return\n }\n\n const timeoutExpiresAt = Date.now() + this._timeoutMs\n\n if (this._timeout) {\n // If existing expiration is already within 5% of correct, it's close enough\n if (timeoutExpiresAt - this._timeoutExpiresAt < this._timeoutMs * 0.05) {\n return\n }\n clearTimeout(this._timeout)\n }\n\n this._timeoutExpiresAt = timeoutExpiresAt\n this._timeout = setTimeout(() => this._onTimeout(), this._timeoutMs)\n if (this._timeoutUnref && this._timeout.unref) this._timeout.unref()\n }\n\n /**\n * Takes a number of bytes that the local peer is waiting to receive from the remote peer\n * in order to parse a complete message, and a callback function to be called once enough\n * bytes have arrived.\n * @param {number} size\n * @param {function} parser\n */\n _parse (size, parser) {\n this._parserSize = size\n this._parser = parser\n }\n\n _parseUntil (pattern, maxBytes) {\n this._cryptoSyncPattern = pattern\n this._waitMaxBytes = maxBytes\n }\n\n /**\n * Handle the first 4 bytes of a message, to determine the length of bytes that must be\n * waited for in order to have the whole message.\n * @param {Uint8Array} buffer\n */\n _onMessageLength (buffer) {\n const length = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength).getUint32(0)\n if (length > 0) {\n this._parse(length, this._onMessage)\n } else {\n this._onKeepAlive()\n this._parse(4, this._onMessageLength)\n }\n }\n\n /**\n * Handle a message from the remote peer.\n * @param {Uint8Array} buffer\n */\n _onMessage (buffer) {\n this._parse(4, this._onMessageLength)\n const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength)\n switch (buffer[0]) {\n case 0:\n return this._onChoke()\n case 1:\n return this._onUnchoke()\n case 2:\n return this._onInterested()\n case 3:\n return this._onUninterested()\n case 4:\n return this._onHave(view.getUint32(1))\n case 5:\n return this._onBitField(buffer.slice(1))\n case 6:\n return this._onRequest(\n view.getUint32(1),\n view.getUint32(5),\n view.getUint32(9)\n )\n case 7:\n return this._onPiece(\n view.getUint32(1),\n view.getUint32(5),\n buffer.slice(9)\n )\n case 8:\n return this._onCancel(\n view.getUint32(1),\n view.getUint32(5),\n view.getUint32(9)\n )\n case 9:\n return this._onPort(view.getUint16(1))\n case 0x0D:\n return this._onSuggest(view.getUint32(1))\n case 0x0E:\n return this._onHaveAll()\n case 0x0F:\n return this._onHaveNone()\n case 0x10:\n return this._onReject(\n view.getUint32(1),\n view.getUint32(5),\n view.getUint32(9)\n )\n case 0x11:\n return this._onAllowedFast(view.getUint32(1))\n case 20:\n return this._onExtended(buffer[1], buffer.slice(2))\n default:\n this._debug('got unknown message')\n return this.emit('unknownmessage', buffer)\n }\n }\n\n _determineHandshakeType () {\n this._parse(1, pstrLenBuffer => {\n const pstrlen = pstrLenBuffer[0]\n if (pstrlen === 19) {\n this._parse(pstrlen + 48, this._onHandshakeBuffer)\n } else {\n this._parsePe1(pstrLenBuffer)\n }\n })\n }\n\n _parsePe1 (pubKeyPrefix) {\n this._parse(95, pubKeySuffix => {\n this._onPe1(concat([pubKeyPrefix, pubKeySuffix]))\n this._parsePe3()\n })\n }\n\n _parsePe2 () {\n this._parse(96, pubKey => {\n this._onPe2(pubKey)\n while (!this._setGenerators) {\n // Wait until generators have been set\n }\n this._parsePe4()\n })\n }\n\n // Handles the unencrypted portion of step 4\n async _parsePe3 () {\n const hash1Buffer = await hash(hex2arr(this._utfToHex('req1') + this._sharedSecret))\n // synchronize on HASH('req1', S)\n this._parseUntil(hash1Buffer, 512)\n this._parse(20, buffer => {\n this._onPe3(buffer)\n while (!this._setGenerators) {\n // Wait until generators have been set\n }\n this._parsePe3Encrypted()\n })\n }\n\n _parsePe3Encrypted () {\n this._parse(14, buffer => {\n const vcBuffer = this._decryptHandshake(buffer.slice(0, 8))\n const peerProvideBuffer = this._decryptHandshake(buffer.slice(8, 12))\n const padCLen = new DataView(this._decryptHandshake(buffer.slice(12, 14)).buffer).getUint16(0)\n this._parse(padCLen, padCBuffer => {\n padCBuffer = this._decryptHandshake(padCBuffer)\n this._parse(2, iaLenBuf => {\n const iaLen = new DataView(this._decryptHandshake(iaLenBuf).buffer).getUint16(0)\n this._parse(iaLen, iaBuffer => {\n iaBuffer = this._decryptHandshake(iaBuffer)\n this._onPe3Encrypted(vcBuffer, peerProvideBuffer, padCBuffer, iaBuffer)\n const pstrlen = iaLen ? iaBuffer[0] : null\n const protocol = iaLen ? iaBuffer.slice(1, 20) : null\n if (pstrlen === 19 && arr2text(protocol) === 'BitTorrent protocol') {\n this._onHandshakeBuffer(iaBuffer.slice(1))\n } else {\n this._parseHandshake()\n }\n })\n })\n })\n })\n }\n\n _parsePe4 () {\n // synchronize on ENCRYPT(VC).\n // since we encrypt using bitwise xor, decryption and encryption are the same operation.\n // calling _decryptHandshake here advances the decrypt generator keystream forward 8 bytes\n const vcBufferEncrypted = this._decryptHandshake(VC)\n this._parseUntil(vcBufferEncrypted, 512)\n this._parse(6, buffer => {\n const peerSelectBuffer = this._decryptHandshake(buffer.slice(0, 4))\n const padDLen = new DataView(this._decryptHandshake(buffer.slice(4, 6)).buffer).getUint16(0)\n this._parse(padDLen, padDBuf => {\n this._decryptHandshake(padDBuf)\n this._onPe4(peerSelectBuffer)\n this._parseHandshake(null)\n })\n })\n }\n\n /**\n * Reads the handshake as specified by the bittorrent wire protocol.\n */\n _parseHandshake () {\n this._parse(1, buffer => {\n const pstrlen = buffer[0]\n if (pstrlen !== 19) {\n this._debug('Error: wire not speaking BitTorrent protocol (%s)', pstrlen.toString())\n this.end()\n return\n }\n this._parse(pstrlen + 48, this._onHandshakeBuffer)\n })\n }\n\n _onHandshakeBuffer (handshake) {\n const protocol = handshake.slice(0, 19)\n if (arr2text(protocol) !== 'BitTorrent protocol') {\n this._debug('Error: wire not speaking BitTorrent protocol (%s)', arr2text(protocol))\n this.end()\n return\n }\n handshake = handshake.slice(19)\n this._onHandshake(handshake.slice(8, 28), handshake.slice(28, 48), {\n dht: !!(handshake[7] & 0x01), // see bep_0005\n fast: !!(handshake[7] & 0x04), // see bep_0006\n extended: !!(handshake[5] & 0x10) // see bep_0010\n })\n this._parse(4, this._onMessageLength)\n }\n\n _onFinish () {\n this._finished = true\n\n this.push(null) // stream cannot be half open, so signal the end of it\n while (this.read()) {\n // body intentionally empty\n // consume and discard the rest of the stream data\n }\n\n clearInterval(this._keepAliveInterval)\n this._parse(Number.MAX_VALUE, () => {})\n while (this.peerRequests.length) {\n this.peerRequests.pop()\n }\n while (this.requests.length) {\n this._callback(this.requests.pop(), new Error('wire was closed'), null)\n }\n }\n\n _debug (...args) {\n args[0] = `[${this._debugId}] ${args[0]}`\n debug(...args)\n }\n\n _pull (requests, piece, offset, length) {\n for (let i = 0; i < requests.length; i++) {\n const req = requests[i]\n if (req.piece === piece && req.offset === offset && req.length === length) {\n arrayRemove(requests, i)\n return req\n }\n }\n return null\n }\n\n _encryptHandshake (buf) {\n const crypt = new Uint8Array(buf)\n if (!this._encryptGenerator) {\n this._debug('Warning: Encrypting without any generator')\n return crypt\n }\n\n for (let i = 0; i < buf.length; i++) {\n const keystream = this._encryptGenerator.randomByte()\n crypt[i] = crypt[i] ^ keystream\n }\n\n return crypt\n }\n\n _encrypt (buf) {\n const crypt = new Uint8Array(buf)\n\n if (!this._encryptGenerator || this._encryptionMethod !== 2) {\n return crypt\n }\n for (let i = 0; i < buf.length; i++) {\n const keystream = this._encryptGenerator.randomByte()\n crypt[i] = crypt[i] ^ keystream\n }\n\n return crypt\n }\n\n _decryptHandshake (buf) {\n const decrypt = new Uint8Array(buf)\n\n if (!this._decryptGenerator) {\n this._debug('Warning: Decrypting without any generator')\n return decrypt\n }\n for (let i = 0; i < buf.length; i++) {\n const keystream = this._decryptGenerator.randomByte()\n decrypt[i] = decrypt[i] ^ keystream\n }\n\n return decrypt\n }\n\n _decrypt (buf) {\n const decrypt = new Uint8Array(buf)\n\n if (!this._decryptGenerator || this._encryptionMethod !== 2) {\n return decrypt\n }\n for (let i = 0; i < buf.length; i++) {\n const keystream = this._decryptGenerator.randomByte()\n decrypt[i] = decrypt[i] ^ keystream\n }\n\n return decrypt\n }\n\n _utfToHex (str) {\n return arr2hex(text2arr(str))\n }\n}\n\nexport default Wire\n","/* Common package for dealing with hex/string/uint8 conversions (and sha1 hashing)\r\n*\r\n* @author Jimmy Wärting <jimmy@warting.se> (https://jimmy.warting.se/opensource)\r\n* @license MIT\r\n*/\r\nexport const alphabet = '0123456789abcdef'\r\nconst encodeLookup = []\r\nconst decodeLookup = []\r\n\r\nfor (let i = 0; i < 256; i++) {\r\n encodeLookup[i] = alphabet[i >> 4 & 0xf] + alphabet[i & 0xf]\r\n if (i < 16) {\r\n if (i < 10) {\r\n decodeLookup[0x30 + i] = i\r\n } else {\r\n decodeLookup[0x61 - 10 + i] = i\r\n }\r\n }\r\n}\r\n\r\nexport const arr2hex = data => {\r\n const length = data.length\r\n let string = ''\r\n let i = 0\r\n while (i < length) {\r\n string += encodeLookup[data[i++]]\r\n }\r\n return string\r\n}\r\n\r\nexport const hex2arr = str => {\r\n const sizeof = str.length >> 1\r\n const length = sizeof << 1\r\n const array = new Uint8Array(sizeof)\r\n let n = 0\r\n let i = 0\r\n while (i < length) {\r\n array[n++] = decodeLookup[str.charCodeAt(i++)] << 4 | decodeLookup[str.charCodeAt(i++)]\r\n }\r\n return array\r\n}\r\n\r\nexport const concat = (chunks, size) => {\r\n if (!size) {\r\n size = 0\r\n let i = chunks.length || chunks.byteLength || 0\r\n while (i--) size += chunks[i].length\r\n }\r\n const b = new Uint8Array(size)\r\n let offset = 0\r\n for (const chunk of chunks) {\r\n b.set(chunk, offset)\r\n offset += chunk.byteLength || chunk.length\r\n }\r\n\r\n return b\r\n}\r\n\r\nexport const equal = (a, b) => {\r\n if (a.byteLength !== b.byteLength) return false\r\n for (let i = a.length; i > -1; i -= 1) {\r\n if ((a[i] !== b[i])) return false\r\n }\r\n return true\r\n}\r\n","/*\n * base64-arraybuffer 1.0.2 <https://github.com/niklasvh/base64-arraybuffer>\n * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>\n * Released under MIT License\n */\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n// Use a lookup table to find the index.\nvar lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);\nfor (var i = 0; i < chars.length; i++) {\n lookup[chars.charCodeAt(i)] = i;\n}\nvar encode = function (arraybuffer) {\n var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = '';\n for (i = 0; i < len; i += 3) {\n base64 += chars[bytes[i] >> 2];\n base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];\n base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];\n base64 += chars[bytes[i + 2] & 63];\n }\n if (len % 3 === 2) {\n base64 = base64.substring(0, base64.length - 1) + '=';\n }\n else if (len % 3 === 1) {\n base64 = base64.substring(0, base64.length - 2) + '==';\n }\n return base64;\n};\nvar decode = function (base64) {\n var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;\n if (base64[base64.length - 1] === '=') {\n bufferLength--;\n if (base64[base64.length - 2] === '=') {\n bufferLength--;\n }\n }\n var arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer);\n for (i = 0; i < len; i += 4) {\n encoded1 = lookup[base64.charCodeAt(i)];\n encoded2 = lookup[base64.charCodeAt(i + 1)];\n encoded3 = lookup[base64.charCodeAt(i + 2)];\n encoded4 = lookup[base64.charCodeAt(i + 3)];\n bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);\n bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);\n bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);\n }\n return arraybuffer;\n};\n\nexport { decode, encode };\n//# sourceMappingURL=base64-arraybuffer.es5.js.map\n","import { arr2hex, alphabet } from './util.js'\r\nimport { decode, encode } from 'base64-arraybuffer'\r\n\r\nconst decoder = new TextDecoder()\r\n// 50% slower at < 48 chars, but little impact at 4M OPS/s vs 8M OPS/s\r\nexport const arr2text = (data, enc) => {\r\n if (!enc) return decoder.decode(data)\r\n const dec = new TextDecoder(enc)\r\n return dec.decode(data)\r\n}\r\n\r\n// sacrifice ~20% speed for bundle size\r\nconst encoder = new TextEncoder()\r\nexport const text2arr = str => encoder.encode(str)\r\n\r\nexport const arr2base = data => encode(data)\r\n\r\nexport const base2arr = str => new Uint8Array(decode(str))\r\n\r\nexport const bin2hex = str => {\r\n let res = ''\r\n let c\r\n let i = 0\r\n const len = str.length\r\n\r\n while (i < len) {\r\n c = str.charCodeAt(i++)\r\n res += alphabet[c >> 4]\r\n res += alphabet[c & 0xF]\r\n }\r\n\r\n return res\r\n}\r\n\r\nconst MAX_ARGUMENTS_LENGTH = 0x10000\r\nexport const hex2bin = hex => {\r\n const points = new Array(hex.length / 2)\r\n for (let i = 0, l = hex.length / 2; i < l; ++i) {\r\n points[i] = parseInt(hex.substr(i * 2, 2), 16)\r\n }\r\n if (points.length <= MAX_ARGUMENTS_LENGTH) return String.fromCharCode(...points)\r\n\r\n let res = ''\r\n let i = 0\r\n while (i < points.length) {\r\n res += String.fromCharCode(...points.slice(i, i += MAX_ARGUMENTS_LENGTH))\r\n }\r\n return res\r\n}\r\n\r\nconst scope = typeof window !== 'undefined' ? window : self\r\nconst crypto = scope.crypto || scope.msCrypto || {}\r\nconst subtle = crypto.subtle || crypto.webkitSubtle\r\n\r\nconst formatMap = {\r\n hex: arr2hex,\r\n base64: arr2base\r\n}\r\n\r\nexport const hash = async (data, format, algo = 'sha-1') => {\r\n if (!subtle) throw new Error('no web crypto support')\r\n if (typeof data === 'string') data = text2arr(data)\r\n const out = new Uint8Array(await subtle.digest(algo, data))\r\n return format ? formatMap[format](out) : out\r\n}\r\n\r\nexport const randomBytes = size => {\r\n const view = new Uint8Array(size)\r\n return crypto.getRandomValues(view)\r\n}\r\n\r\nexport * from './util.js'\r\n","/*!\n * Fast node `require('process')` for modern browsers\n *\n * @author Mathias Rasmussen <mathiasvr@gmail.com>\n * @license MIT\n */\nimport queueMicrotask from 'queue-microtask'\n\nconst title = 'browser'\nconst browser = true\nconst env = {}\nconst argv = []\nconst version = ''\nconst versions = {}\n\nfunction noop () {}\n\nconst on = noop\nconst addListener = noop\nconst once = noop\nconst off = noop\nconst removeListener = noop\nconst removeAllListeners = noop\nconst emit = noop\nconst prependListener = noop\nconst prependOnceListener = noop\n\nconst nextTick = (func, ...args) => queueMicrotask(() => func(...args))\n\nconst listeners = (name) => []\n\nconst cwd = () => '/'\nconst umask = () => 0\nconst binding = (name) => { throw new Error('process.binding is not supported') }\nconst chdir = (dir) => { throw new Error('process.chdir is not supported') }\n\nexport {\n title, browser, env, argv, version, versions, on, addListener, once, off, removeListener,\n removeAllListeners, emit, prependListener, prependOnceListener, nextTick, listeners, cwd, umask, binding, chdir\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/*! create-torrent. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */\nimport bencode from 'bencode'\nimport blockIterator from 'block-iterator'\nimport calcPieceLength from 'piece-length'\nimport corePath from 'path'\nimport isFile from 'is-file'\nimport junk from 'junk'\nimport joinIterator from 'join-async-iterator'\nimport parallel from 'run-parallel'\nimport queueMicrotask from 'queue-microtask'\nimport { hash, hex2arr } from 'uint8-util'\nimport 'fast-readable-async-iterator'\n\nimport getFiles from './get-files.js' // browser exclude\n\nconst announceList = [\n ['udp://tracker.leechers-paradise.org:6969'],\n ['udp://tracker.coppersurfer.tk:6969'],\n ['udp://tracker.opentrackr.org:1337'],\n ['udp://explodie.org:6969'],\n ['udp://tracker.empire-js.us:1337'],\n ['wss://tracker.btorrent.xyz'],\n ['wss://tracker.openwebtorrent.com']\n]\n\n/**\n * Create a torrent.\n * @param {string|File|FileList|Buffer|Stream|Array.<string|File|Buffer|Stream>} input\n * @param {Object} opts\n * @param {string=} opts.name\n * @param {Date=} opts.creationDate\n * @param {string=} opts.comment\n * @param {string=} opts.createdBy\n * @param {boolean|number=} opts.private\n * @param {number=} opts.pieceLength\n * @param {Array.<Array.<string>>=} opts.announceList\n * @param {Array.<string>=} opts.urlList\n * @param {Object=} opts.info\n * @param {Function} opts.onProgress\n * @param {function} cb\n * @return {Buffer} buffer of .torrent file data\n */\nfunction createTorrent (input, opts, cb) {\n if (typeof opts === 'function') [opts, cb] = [cb, opts]\n opts = opts ? Object.assign({}, opts) : {}\n\n _parseInput(input, opts, (err, files, singleFileTorrent) => {\n if (err) return cb(err)\n opts.singleFileTorrent = singleFileTorrent\n onFiles(files, opts, cb)\n })\n}\n\nfunction parseInput (input, opts, cb) {\n if (typeof opts === 'function') [opts, cb] = [cb, opts]\n opts = opts ? Object.assign({}, opts) : {}\n _parseInput(input, opts, cb)\n}\n\nconst pathSymbol = Symbol('itemPath')\n\n/**\n * Parse input file and return file information.\n */\nfunction _parseInput (input, opts, cb) {\n if (isFileList(input)) input = Array.from(input)\n if (!Array.isArray(input)) input = [input]\n\n if (input.length === 0) throw new Error('invalid input type')\n\n input.forEach(item => {\n if (item == null) throw new Error(`invalid input type: ${item}`)\n })\n\n // In Electron, use the true file path\n input = input.map(item => {\n if (isBlob(item) && typeof item.path === 'string' && typeof getFiles === 'function') return item.path\n return item\n })\n\n // If there's just one file, allow the name to be set by `opts.name`\n if (input.length === 1 && typeof input[0] !== 'string' && !input[0].name) input[0].name = opts.name\n\n let commonPrefix = null\n input.forEach((item, i) => {\n if (typeof item === 'string') {\n return\n }\n\n let path = item.fullPath || item.name\n if (!path) {\n path = `Unknown File ${i + 1}`\n item.unknownName = true\n }\n\n item[pathSymbol] = path.split('/')\n\n // Remove initial slash\n if (!item[pathSymbol][0]) {\n item[pathSymbol].shift()\n }\n\n if (item[pathSymbol].length < 2) { // No real prefix\n commonPrefix = null\n } else if (i === 0 && input.length > 1) { // The first file has a prefix\n commonPrefix = item[pathSymbol][0]\n } else if (item[pathSymbol][0] !== commonPrefix) { // The prefix doesn't match\n commonPrefix = null\n }\n })\n\n const filterJunkFiles = opts.filterJunkFiles === undefined ? true : opts.filterJunkFiles\n if (filterJunkFiles) {\n // Remove junk files\n input = input.filter(item => {\n if (typeof item === 'string') {\n return true\n }\n return !isJunkPath(item[pathSymbol])\n })\n }\n\n if (commonPrefix) {\n input.forEach(item => {\n const pathless = (ArrayBuffer.isView(item) || isReadable(item)) && !item[pathSymbol]\n if (typeof item === 'string' || pathless) return\n item[pathSymbol].shift()\n })\n }\n\n if (!opts.name && commonPrefix) {\n opts.name = commonPrefix\n }\n\n if (!opts.name) {\n // use first user-set file name\n input.some(item => {\n if (typeof item === 'string') {\n opts.name = corePath.basename(item)\n return true\n } else if (!item.unknownName) {\n opts.name = item[pathSymbol][item[pathSymbol].length - 1]\n return true\n }\n return false\n })\n }\n\n if (!opts.name) {\n opts.name = `Unnamed Torrent ${Date.now()}`\n }\n\n const numPaths = input.reduce((sum, item) => sum + Number(typeof item === 'string'), 0)\n\n let isSingleFileTorrent = (input.length === 1)\n\n if (input.length === 1 && typeof input[0] === 'string') {\n if (typeof getFiles !== 'function') {\n throw new Error('filesystem paths do not work in the browser')\n }\n // If there's a single path, verify it's a file before deciding this is a single\n // file torrent\n isFile(input[0], (err, pathIsFile) => {\n if (err) return cb(err)\n isSingleFileTorrent = pathIsFile\n processInput()\n })\n } else {\n queueMicrotask(processInput)\n }\n\n function processInput () {\n parallel(input.map(item => cb => {\n const file = {}\n\n if (isBlob(item)) {\n file.getStream = item.stream()\n file.length = item.size\n } else if (ArrayBuffer.isView(item)) {\n file.getStream = [item] // wrap in iterable to write entire buffer at once instead of unwrapping all bytes\n file.length = item.length\n } else if (isReadable(item)) {\n file.getStream = getStreamStream(item, file)\n file.length = 0\n } else if (typeof item === 'string') {\n if (typeof getFiles !== 'function') {\n throw new Error('filesystem paths do not work in the browser')\n }\n const keepRoot = numPaths > 1 || isSingleFileTorrent\n getFiles(item, keepRoot, cb)\n return // early return!\n } else {\n throw new Error('invalid input type')\n }\n file.path = item[pathSymbol]\n cb(null, file)\n }), (err, files) => {\n if (err) return cb(err)\n files = files.flat()\n cb(null, files, isSingleFileTorrent)\n })\n }\n}\n\nconst MAX_OUTSTANDING_HASHES = 5\n\nasync function getPieceList (files, pieceLength, estimatedTorrentLength, opts, cb) {\n const pieces = []\n let length = 0\n let hashedLength = 0\n\n const streams = files.map(file => file.getStream)\n\n const onProgress = opts.onProgress\n\n let remainingHashes = 0\n let pieceNum = 0\n let ended = false\n\n const iterator = blockIterator(joinIterator(streams), pieceLength, { zeroPadding: false })\n try {\n for await (const chunk of iterator) {\n await new Promise(resolve => {\n length += chunk.length\n const i = pieceNum\n ++pieceNum\n if (++remainingHashes < MAX_OUTSTANDING_HASHES) resolve()\n hash(chunk, 'hex').then(hash => {\n pieces[i] = hash\n --remainingHashes\n hashedLength += chunk.length\n if (onProgress) onProgress(hashedLength, estimatedTorrentLength)\n resolve()\n if (ended && remainingHashes === 0) cb(null, hex2arr(pieces.join('')), length)\n })\n })\n }\n if (remainingHashes === 0) return cb(null, hex2arr(pieces.join('')), length)\n ended = true\n } catch (err) {\n cb(err)\n }\n}\n\nfunction onFiles (files, opts, cb) {\n let _announceList = opts.announceList\n\n if (!_announceList) {\n if (typeof opts.announce === 'string') _announceList = [[opts.announce]]\n else if (Array.isArray(opts.announce)) {\n _announceList = opts.announce.map(u => [u])\n }\n }\n\n if (!_announceList) _announceList = []\n\n if (globalThis.WEBTORRENT_ANNOUNCE) {\n if (typeof globalThis.WEBTORRENT_ANNOUNCE === 'string') {\n _announceList.push([[globalThis.WEBTORRENT_ANNOUNCE]])\n } else if (Array.isArray(globalThis.WEBTORRENT_ANNOUNCE)) {\n _announceList = _announceList.concat(globalThis.WEBTORRENT_ANNOUNCE.map(u => [u]))\n }\n }\n\n // When no trackers specified, use some reasonable defaults\n if (opts.announce === undefined && opts.announceList === undefined) {\n _announceList = _announceList.concat(announceList)\n }\n\n if (typeof opts.urlList === 'string') opts.urlList = [opts.urlList]\n\n const torrent = {\n info: {\n name: opts.name\n },\n 'creation date': Math.ceil((Number(opts.creationDate) || Date.now()) / 1000),\n encoding: 'UTF-8'\n }\n\n if (_announceList.length !== 0) {\n torrent.announce = _announceList[0][0]\n torrent['announce-list'] = _announceList\n }\n\n if (opts.comment !== undefined) torrent.comment = opts.comment\n\n if (opts.createdBy !== undefined) torrent['created by'] = opts.createdBy\n\n if (opts.private !== undefined) torrent.info.private = Number(opts.private)\n\n if (opts.info !== undefined) Object.assign(torrent.info, opts.info)\n\n // \"ssl-cert\" key is for SSL torrents, see:\n // - http://blog.libtorrent.org/2012/01/bittorrent-over-ssl/\n // - http://www.libtorrent.org/manual-ref.html#ssl-torrents\n // - http://www.libtorrent.org/reference-Create_Torrents.html\n if (opts.sslCert !== undefined) torrent.info['ssl-cert'] = opts.sslCert\n\n if (opts.urlList !== undefined) torrent['url-list'] = opts.urlList\n\n const estimatedTorrentLength = files.reduce(sumLength, 0)\n const pieceLength = opts.pieceLength || calcPieceLength(estimatedTorrentLength)\n torrent.info['piece length'] = pieceLength\n\n getPieceList(\n files,\n pieceLength,\n estimatedTorrentLength,\n opts,\n (err, pieces, torrentLength) => {\n if (err) return cb(err)\n torrent.info.pieces = pieces\n\n files.forEach(file => {\n delete file.getStream\n })\n\n if (opts.singleFileTorrent) {\n torrent.info.length = torrentLength\n } else {\n torrent.info.files = files\n }\n\n cb(null, bencode.encode(torrent))\n }\n )\n}\n\n/**\n * Determine if a a file is junk based on its path\n * (defined as hidden OR recognized by the `junk` package)\n *\n * @param {string} path\n * @return {boolean}\n */\nfunction isJunkPath (path) {\n const filename = path[path.length - 1]\n return filename[0] === '.' && junk.is(filename)\n}\n\n/**\n * Accumulator to sum file lengths\n * @param {number} sum\n * @param {Object} file\n * @return {number}\n */\nfunction sumLength (sum, file) {\n return sum + file.length\n}\n\n/**\n * Check if `obj` is a W3C `Blob` object (which `File` inherits from)\n * @param {*} obj\n * @return {boolean}\n */\nfunction isBlob (obj) {\n return typeof Blob !== 'undefined' && obj instanceof Blob\n}\n\n/**\n * Check if `obj` is a W3C `FileList` object\n * @param {*} obj\n * @return {boolean}\n */\nfunction isFileList (obj) {\n return typeof FileList !== 'undefined' && obj instanceof FileList\n}\n\n/**\n * Check if `obj` is a node Readable stream\n * @param {*} obj\n * @return {boolean}\n */\nfunction isReadable (obj) {\n return typeof obj === 'object' && obj != null && typeof obj.pipe === 'function'\n}\n\n/**\n * Convert a readable stream to a lazy async iterator. Adds instrumentation to track\n * the number of bytes in the stream and set `file.length`.\n *\n * @generator\n * @param {Stream} readable\n * @param {Object} file\n * @return {Uint8Array} stream data/chunk\n */\nasync function * getStreamStream (readable, file) {\n for await (const chunk of readable) {\n file.length += chunk.length\n yield chunk\n }\n}\n\nexport default createTorrent\nexport { parseInput, announceList, isJunkPath }\n","export const Blob = self.Blob\r\nexport const File = self.File\r\nexport const FormData = self.FormData\r\nexport const Headers = self.Headers\r\nexport const Request = self.Request\r\nexport const Response = self.Response\r\nexport const AbortController = self.AbortController\r\nexport const AbortSignal = self.AbortSignal\r\n\r\nexport const fetch = self.fetch || (() => { throw new Error('global fetch is not available!') })\r\nexport default fetch\r\n","function composeRange (range) {\n return range\n .reduce((acc, cur, idx, arr) => {\n if (idx === 0 || cur !== arr[idx - 1] + 1) acc.push([])\n acc[acc.length - 1].push(cur)\n return acc\n }, [])\n .map((cur) => {\n return cur.length > 1 ? `${cur[0]}-${cur[cur.length - 1]}` : `${cur[0]}`\n })\n}\n\nfunction parseRange (range) {\n const generateRange = (start, end = start) => Array.from({ length: end - start + 1 }, (cur, idx) => idx + start)\n\n return range\n .reduce((acc, cur, idx, arr) => {\n const r = cur.split('-').map(cur => parseInt(cur))\n return acc.concat(generateRange(...r))\n }, [])\n}\n\nexport default parseRange\n\nexport {\n parseRange as parse,\n composeRange as compose\n}\n","/*! magnet-uri. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */\nimport base32 from 'thirty-two'\nimport { parse, compose } from 'bep53-range'\nimport { hex2arr, arr2hex, bin2hex } from 'uint8-util'\n\n/**\n * Parse a magnet URI and return an object of keys/values\n *\n * @param {string} uri\n * @return {Object} parsed uri\n */\nfunction magnetURIDecode (uri) {\n const result = {}\n\n // Support 'magnet:' and 'stream-magnet:' uris\n const data = uri.split('magnet:?')[1]\n\n const params = (data && data.length >= 0)\n ? data.split('&')\n : []\n\n params.forEach(param => {\n const keyval = param.split('=')\n\n // This keyval is invalid, skip it\n if (keyval.length !== 2) return\n\n const key = keyval[0]\n let val = keyval[1]\n\n // Clean up torrent name\n if (key === 'dn') val = decodeURIComponent(val).replace(/\\+/g, ' ')\n\n // Address tracker (tr), exact source (xs), and acceptable source (as) are encoded\n // URIs, so decode them\n if (key === 'tr' || key === 'xs' || key === 'as' || key === 'ws') {\n val = decodeURIComponent(val)\n }\n\n // Return keywords as an array\n if (key === 'kt') val = decodeURIComponent(val).split('+')\n\n // Cast file index (ix) to a number\n if (key === 'ix') val = Number(val)\n\n // bep53\n if (key === 'so') val = parse(decodeURIComponent(val).split(','))\n\n // If there are repeated parameters, return an array of values\n if (result[key]) {\n if (!Array.isArray(result[key])) {\n result[key] = [result[key]]\n }\n\n result[key].push(val)\n } else {\n result[key] = val\n }\n })\n\n // Convenience properties for parity with `parse-torrent-file` module\n let m\n if (result.xt) {\n const xts = Array.isArray(result.xt) ? result.xt : [result.xt]\n xts.forEach(xt => {\n if ((m = xt.match(/^urn:btih:(.{40})/))) {\n result.infoHash = m[1].toLowerCase()\n } else if ((m = xt.match(/^urn:btih:(.{32})/))) {\n const decodedStr = base32.decode(m[1])\n result.infoHash = bin2hex(decodedStr.toString('binary'))\n } else if ((m = xt.match(/^urn:btmh:1220(.{64})/))) {\n result.infoHashV2 = m[1].toLowerCase()\n }\n })\n }\n\n if (result.xs) {\n const xss = Array.isArray(result.xs) ? result.xs : [result.xs]\n xss.forEach(xs => {\n if ((m = xs.match(/^urn:btpk:(.{64})/))) {\n result.publicKey = m[1].toLowerCase()\n }\n })\n }\n\n if (result.infoHash) result.infoHashBuffer = hex2arr(result.infoHash)\n if (result.infoHashV2) result.infoHashV2Buffer = hex2arr(result.infoHashV2)\n if (result.publicKey) result.publicKeyBuffer = hex2arr(result.publicKey)\n\n if (result.dn) result.name = result.dn\n if (result.kt) result.keywords = result.kt\n\n result.announce = []\n if (typeof result.tr === 'string' || Array.isArray(result.tr)) {\n result.announce = result.announce.concat(result.tr)\n }\n\n result.urlList = []\n if (typeof result.as === 'string' || Array.isArray(result.as)) {\n result.urlList = result.urlList.concat(result.as)\n }\n if (typeof result.ws === 'string' || Array.isArray(result.ws)) {\n result.urlList = result.urlList.concat(result.ws)\n }\n\n result.peerAddresses = []\n if (typeof result['x.pe'] === 'string' || Array.isArray(result['x.pe'])) {\n result.peerAddresses = result.peerAddresses.concat(result['x.pe'])\n }\n\n // remove duplicates by converting to Set and back\n result.announce = Array.from(new Set(result.announce))\n result.urlList = Array.from(new Set(result.urlList))\n result.peerAddresses = Array.from(new Set(result.peerAddresses))\n\n return result\n}\n\nfunction magnetURIEncode (obj) {\n obj = Object.assign({}, obj) // clone obj, so we can mutate it\n\n // support using convenience names, in addition to spec names\n // (example: `infoHash` for `xt`, `name` for `dn`)\n\n // Deduplicate xt by using a set\n let xts = new Set()\n if (obj.xt && typeof obj.xt === 'string') xts.add(obj.xt)\n if (obj.xt && Array.isArray(obj.xt)) xts = new Set(obj.xt)\n if (obj.infoHashBuffer) xts.add(`urn:btih:${arr2hex(obj.infoHashBuffer)}`)\n if (obj.infoHash) xts.add(`urn:btih:${obj.infoHash}`)\n if (obj.infoHashV2Buffer) xts.add(obj.xt = `urn:btmh:1220${arr2hex(obj.infoHashV2Buffer)}`)\n if (obj.infoHashV2) xts.add(`urn:btmh:1220${obj.infoHashV2}`)\n const xtsDeduped = Array.from(xts)\n if (xtsDeduped.length === 1) obj.xt = xtsDeduped[0]\n if (xtsDeduped.length > 1) obj.xt = xtsDeduped\n\n if (obj.publicKeyBuffer) obj.xs = `urn:btpk:${arr2hex(obj.publicKeyBuffer)}`\n if (obj.publicKey) obj.xs = `urn:btpk:${obj.publicKey}`\n if (obj.name) obj.dn = obj.name\n if (obj.keywords) obj.kt = obj.keywords\n if (obj.announce) obj.tr = obj.announce\n if (obj.urlList) {\n obj.ws = obj.urlList\n delete obj.as\n }\n if (obj.peerAddresses) obj['x.pe'] = obj.peerAddresses\n\n let result = 'magnet:?'\n Object.keys(obj)\n .filter(key => key.length === 2 || key === 'x.pe')\n .forEach((key, i) => {\n const values = Array.isArray(obj[key]) ? obj[key] : [obj[key]]\n values.forEach((val, j) => {\n if ((i > 0 || j > 0) && ((key !== 'kt' && key !== 'so') || j === 0)) result += '&'\n\n if (key === 'dn') val = encodeURIComponent(val).replace(/%20/g, '+')\n if (key === 'tr' || key === 'as' || key === 'ws') {\n val = encodeURIComponent(val)\n }\n // Don't URI encode BEP46 keys\n if (key === 'xs' && !val.startsWith('urn:btpk:')) {\n val = encodeURIComponent(val)\n }\n if (key === 'kt') val = encodeURIComponent(val)\n if (key === 'so') return\n\n if (key === 'kt' && j > 0) result += `+${val}`\n else result += `${key}=${val}`\n })\n if (key === 'so') result += `${key}=${compose(values)}`\n })\n\n return result\n}\n\nexport default magnetURIDecode\nexport { magnetURIDecode as decode, magnetURIEncode as encode }\n","/*! parse-torrent. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */\n\nimport bencode from 'bencode'\nimport fs from 'fs' // browser exclude\nimport fetch from 'cross-fetch-ponyfill'\nimport magnet, { encode } from 'magnet-uri'\nimport path from 'path'\nimport { hash, arr2hex, text2arr, arr2text } from 'uint8-util'\nimport queueMicrotask from 'queue-microtask'\n\n/**\n * Parse a torrent identifier (magnet uri, .torrent file, info hash)\n * @param {string|ArrayBufferView|Object} torrentId\n * @return {Object}\n */\nasync function parseTorrent (torrentId) {\n if (typeof torrentId === 'string' && /^(stream-)?magnet:/.test(torrentId)) {\n // if magnet uri (string)\n const torrentObj = magnet(torrentId)\n\n // infoHash won't be defined if a non-bittorrent magnet is passed\n if (!torrentObj.infoHash) {\n throw new Error('Invalid torrent identifier')\n }\n\n return torrentObj\n } else if (typeof torrentId === 'string' && (/^[a-f0-9]{40}$/i.test(torrentId) || /^[a-z2-7]{32}$/i.test(torrentId))) {\n // if info hash (hex/base-32 string)\n return magnet(`magnet:?xt=urn:btih:${torrentId}`)\n } else if (ArrayBuffer.isView(torrentId) && torrentId.length === 20) {\n // if info hash (buffer)\n return magnet(`magnet:?xt=urn:btih:${arr2hex(torrentId)}`)\n } else if (ArrayBuffer.isView(torrentId)) {\n // if .torrent file (buffer)\n return await decodeTorrentFile(torrentId) // might throw\n } else if (torrentId && torrentId.infoHash) {\n // if parsed torrent (from `parse-torrent` or `magnet-uri`)\n torrentId.infoHash = torrentId.infoHash.toLowerCase()\n\n if (!torrentId.announce) torrentId.announce = []\n\n if (typeof torrentId.announce === 'string') {\n torrentId.announce = [torrentId.announce]\n }\n\n if (!torrentId.urlList) torrentId.urlList = []\n\n return torrentId\n } else {\n throw new Error('Invalid torrent identifier')\n }\n}\n\nasync function parseTorrentRemote (torrentId, opts, cb) {\n if (typeof opts === 'function') return parseTorrentRemote(torrentId, {}, opts)\n if (typeof cb !== 'function') throw new Error('second argument must be a Function')\n\n let parsedTorrent\n try {\n parsedTorrent = await parseTorrent(torrentId)\n } catch (err) {\n // If torrent fails to parse, it could be a Blob, http/https URL or\n // filesystem path, so don't consider it an error yet.\n }\n\n if (parsedTorrent && parsedTorrent.infoHash) {\n queueMicrotask(() => {\n cb(null, parsedTorrent)\n })\n } else if (isBlob(torrentId)) {\n try {\n const torrentBuf = new Uint8Array(await torrentId.arrayBuffer())\n parseOrThrow(torrentBuf)\n } catch (err) {\n return cb(new Error(`Error converting Blob: ${err.message}`))\n }\n } else if (/^https?:/.test(torrentId)) {\n try {\n const res = await fetch(torrentId, {\n headers: { 'user-agent': 'WebTorrent (https://webtorrent.io)' },\n signal: AbortSignal.timeout(30 * 1000),\n ...opts\n })\n const torrentBuf = new Uint8Array(await res.arrayBuffer())\n parseOrThrow(torrentBuf)\n } catch (err) {\n return cb(new Error(`Error downloading torrent: ${err.message}`))\n }\n } else if (typeof fs.readFile === 'function' && typeof torrentId === 'string') {\n // assume it's a filesystem path\n fs.readFile(torrentId, (err, torrentBuf) => {\n if (err) return cb(new Error('Invalid torrent identifier'))\n parseOrThrow(torrentBuf)\n })\n } else {\n queueMicrotask(() => {\n cb(new Error('Invalid torrent identifier'))\n })\n }\n\n async function parseOrThrow (torrentBuf) {\n try {\n parsedTorrent = await parseTorrent(torrentBuf)\n } catch (err) {\n return cb(err)\n }\n if (parsedTorrent && parsedTorrent.infoHash) cb(null, parsedTorrent)\n else cb(new Error('Invalid torrent identifier'))\n }\n}\n\n/**\n * Parse a torrent. Throws an exception if the torrent is missing required fields.\n * @param {ArrayBufferView|Object} torrent\n * @return {Object} parsed torrent\n */\nasync function decodeTorrentFile (torrent) {\n if (ArrayBuffer.isView(torrent)) {\n torrent = bencode.decode(torrent)\n }\n\n // sanity check\n ensure(torrent.info, 'info')\n ensure(torrent.info['name.utf-8'] || torrent.info.name, 'info.name')\n ensure(torrent.info['piece length'], 'info[\\'piece length\\']')\n ensure(torrent.info.pieces, 'info.pieces')\n\n if (torrent.info.files) {\n torrent.info.files.forEach(file => {\n ensure(typeof file.length === 'number', 'info.files[0].length')\n ensure(file['path.utf-8'] || file.path, 'info.files[0].path')\n })\n } else {\n ensure(typeof torrent.info.length === 'number', 'info.length')\n }\n\n const result = {\n info: torrent.info,\n infoBuffer: bencode.encode(torrent.info),\n name: arr2text(torrent.info['name.utf-8'] || torrent.info.name),\n announce: []\n }\n\n result.infoHashBuffer = await hash(result.infoBuffer)\n result.infoHash = arr2hex(result.infoHashBuffer)\n\n if (torrent.info.private !== undefined) result.private = !!torrent.info.private\n\n if (torrent['creation date']) result.created = new Date(torrent['creation date'] * 1000)\n if (torrent['created by']) result.createdBy = arr2text(torrent['created by'])\n\n if (ArrayBuffer.isView(torrent.comment)) result.comment = arr2text(torrent.comment)\n\n // announce and announce-list will be missing if metadata fetched via ut_metadata\n if (Array.isArray(torrent['announce-list']) && torrent['announce-list'].length > 0) {\n torrent['announce-list'].forEach(urls => {\n urls.forEach(url => {\n result.announce.push(arr2text(url))\n })\n })\n } else if (torrent.announce) {\n result.announce.push(arr2text(torrent.announce))\n }\n\n // handle url-list (BEP19 / web seeding)\n if (ArrayBuffer.isView(torrent['url-list'])) {\n // some clients set url-list to empty string\n torrent['url-list'] = torrent['url-list'].length > 0\n ? [torrent['url-list']]\n : []\n }\n result.urlList = (torrent['url-list'] || []).map(url => arr2text(url))\n\n // remove duplicates by converting to Set and back\n result.announce = Array.from(new Set(result.announce))\n result.urlList = Array.from(new Set(result.urlList))\n\n const files = torrent.info.files || [torrent.info]\n result.files = files.map((file, i) => {\n const parts = [].concat(result.name, file['path.utf-8'] || file.path || []).map(p => ArrayBuffer.isView(p) ? arr2text(p) : p)\n return {\n path: path.join.apply(null, [path.sep].concat(parts)).slice(1),\n name: parts[parts.length - 1],\n length: file.length,\n offset: files.slice(0, i).reduce(sumLength, 0)\n }\n })\n\n result.length = files.reduce(sumLength, 0)\n\n const lastFile = result.files[result.files.length - 1]\n\n result.pieceLength = torrent.info['piece length']\n result.lastPieceLength = ((lastFile.offset + lastFile.length) % result.pieceLength) || result.pieceLength\n result.pieces = splitPieces(torrent.info.pieces)\n\n return result\n}\n\n/**\n * Convert a parsed torrent object back into a .torrent file buffer.\n * @param {Object} parsed parsed torrent\n * @return {Uint8Array}\n */\nfunction encodeTorrentFile (parsed) {\n const torrent = {\n info: parsed.info\n }\n\n torrent['announce-list'] = (parsed.announce || []).map(url => {\n if (!torrent.announce) torrent.announce = url\n url = text2arr(url)\n return [url]\n })\n\n torrent['url-list'] = parsed.urlList || []\n\n if (parsed.private !== undefined) {\n torrent.private = Number(parsed.private)\n }\n\n if (parsed.created) {\n torrent['creation date'] = (parsed.created.getTime() / 1000) | 0\n }\n\n if (parsed.createdBy) {\n torrent['created by'] = parsed.createdBy\n }\n\n if (parsed.comment) {\n torrent.comment = parsed.comment\n }\n\n return bencode.encode(torrent)\n}\n\n/**\n * Check if `obj` is a W3C `Blob` or `File` object\n * @param {*} obj\n * @return {boolean}\n */\nfunction isBlob (obj) {\n return typeof Blob !== 'undefined' && obj instanceof Blob\n}\n\nfunction sumLength (sum, file) {\n return sum + file.length\n}\n\nfunction splitPieces (buf) {\n const pieces = []\n for (let i = 0; i < buf.length; i += 20) {\n pieces.push(arr2hex(buf.slice(i, i + 20)))\n }\n return pieces\n}\n\nfunction ensure (bool, fieldName) {\n if (!bool) throw new Error(`Torrent is missing required field: ${fieldName}`)\n}\n\n// Workaround Browserify v13 bug\n// https://github.com/substack/node-browserify/issues/1483\n;(() => { Buffer.alloc(0) })()\n\nexport default parseTorrent\nconst toMagnetURI = encode\nexport { parseTorrentRemote as remote, encodeTorrentFile as toTorrentFile, toMagnetURI }\n","/*! simple-peer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */\r\nimport debug from 'debug'\r\nimport getBrowserRTC from 'get-browser-rtc'\r\nimport { Duplex } from 'streamx'\r\nimport queueMicrotask from 'queue-microtask' // TODO: remove when Node 10 is not supported\r\nimport errCode from 'err-code'\r\nimport { randomBytes, arr2hex, text2arr } from 'uint8-util'\r\n\r\nconst Debug = debug('simple-peer')\r\n\r\nconst MAX_BUFFERED_AMOUNT = 64 * 1024\r\nconst ICECOMPLETE_TIMEOUT = 5 * 1000\r\nconst CHANNEL_CLOSING_TIMEOUT = 5 * 1000\r\n\r\n// HACK: Filter trickle lines when trickle is disabled #354\r\nfunction filterTrickle (sdp) {\r\n return sdp.replace(/a=ice-options:trickle\\s\\n/g, '')\r\n}\r\n\r\nfunction warn (message) {\r\n console.warn(message)\r\n}\r\n\r\n/**\r\n * WebRTC peer connection. Same API as node core `net.Socket`, plus a few extra methods.\r\n * Duplex stream.\r\n * @param {Object} opts\r\n */\r\nclass Peer extends Duplex {\r\n constructor (opts) {\r\n opts = Object.assign({\r\n allowHalfOpen: false\r\n }, opts)\r\n\r\n super(opts)\r\n\r\n this.__objectMode = !!opts.objectMode // streamx is objectMode by default, so implement readable's fuctionality\r\n\r\n this._id = arr2hex(randomBytes(4)).slice(0, 7)\r\n this._debug('new peer %o', opts)\r\n\r\n this.channelName = opts.initiator\r\n ? opts.channelName || arr2hex(randomBytes(20))\r\n : null\r\n\r\n this.initiator = opts.initiator || false\r\n this.channelConfig = opts.channelConfig || Peer.channelConfig\r\n this.channelNegotiated = this.channelConfig.negotiated\r\n this.config = Object.assign({}, Peer.config, opts.config)\r\n this.offerOptions = opts.offerOptions || {}\r\n this.answerOptions = opts.answerOptions || {}\r\n this.sdpTransform = opts.sdpTransform || (sdp => sdp)\r\n this.streams = opts.streams || (opts.stream ? [opts.stream] : []) // support old \"stream\" option\r\n this.trickle = opts.trickle !== undefined ? opts.trickle : true\r\n this.allowHalfTrickle = opts.allowHalfTrickle !== undefined ? opts.allowHalfTrickle : false\r\n this.iceCompleteTimeout = opts.iceCompleteTimeout || ICECOMPLETE_TIMEOUT\r\n\r\n this._destroying = false\r\n this._connected = false\r\n\r\n this.remoteAddress = undefined\r\n this.remoteFamily = undefined\r\n this.remotePort = undefined\r\n this.localAddress = undefined\r\n this.localFamily = undefined\r\n this.localPort = undefined\r\n\r\n this._wrtc = (opts.wrtc && typeof opts.wrtc === 'object')\r\n ? opts.wrtc\r\n : getBrowserRTC()\r\n\r\n if (!this._wrtc) {\r\n if (typeof window === 'undefined') {\r\n throw errCode(new Error('No WebRTC support: Specify `opts.wrtc` option in this environment'), 'ERR_WEBRTC_SUPPORT')\r\n } else {\r\n throw errCode(new Error('No WebRTC support: Not a supported browser'), 'ERR_WEBRTC_SUPPORT')\r\n }\r\n }\r\n\r\n this._pcReady = false\r\n this._channelReady = false\r\n this._iceComplete = false // ice candidate trickle done (got null candidate)\r\n this._iceCompleteTimer = null // send an offer/answer anyway after some timeout\r\n this._channel = null\r\n this._pendingCandidates = []\r\n\r\n this._isNegotiating = false // is this peer waiting for negotiation to complete?\r\n this._firstNegotiation = true\r\n this._batchedNegotiation = false // batch synchronous negotiations\r\n this._queuedNegotiation = false // is there a queued negotiation request?\r\n this._sendersAwaitingStable = []\r\n this._senderMap = new Map()\r\n this._closingInterval = null\r\n\r\n this._remoteTracks = []\r\n this._remoteStreams = []\r\n\r\n this._chunk = null\r\n this._cb = null\r\n this._interval = null\r\n\r\n try {\r\n this._pc = new (this._wrtc.RTCPeerConnection)(this.config)\r\n } catch (err) {\r\n this.__destroy(errCode(err, 'ERR_PC_CONSTRUCTOR'))\r\n return\r\n }\r\n\r\n // We prefer feature detection whenever possible, but sometimes that's not\r\n // possible for certain implementations.\r\n this._isReactNativeWebrtc = typeof this._pc._peerConnectionId === 'number'\r\n\r\n this._pc.oniceconnectionstatechange = () => {\r\n this._onIceStateChange()\r\n }\r\n this._pc.onicegatheringstatechange = () => {\r\n this._onIceStateChange()\r\n }\r\n this._pc.onconnectionstatechange = () => {\r\n this._onConnectionStateChange()\r\n }\r\n this._pc.onsignalingstatechange = () => {\r\n this._onSignalingStateChange()\r\n }\r\n this._pc.onicecandidate = event => {\r\n this._onIceCandidate(event)\r\n }\r\n\r\n // HACK: Fix for odd Firefox behavior, see: https://github.com/feross/simple-peer/pull/783\r\n if (typeof this._pc.peerIdentity === 'object') {\r\n this._pc.peerIdentity.catch(err => {\r\n this.__destroy(errCode(err, 'ERR_PC_PEER_IDENTITY'))\r\n })\r\n }\r\n\r\n // Other spec events, unused by this implementation:\r\n // - onconnectionstatechange\r\n // - onicecandidateerror\r\n // - onfingerprintfailure\r\n // - onnegotiationneeded\r\n\r\n if (this.initiator || this.channelNegotiated) {\r\n this._setupData({\r\n channel: this._pc.createDataChannel(this.channelName, this.channelConfig)\r\n })\r\n } else {\r\n this._pc.ondatachannel = event => {\r\n this._setupData(event)\r\n }\r\n }\r\n\r\n if (this.streams) {\r\n this.streams.forEach(stream => {\r\n this.addStream(stream)\r\n })\r\n }\r\n this._pc.ontrack = event => {\r\n this._onTrack(event)\r\n }\r\n\r\n this._debug('initial negotiation')\r\n this._needsNegotiation()\r\n\r\n this._onFinishBound = () => {\r\n this._onFinish()\r\n }\r\n this.once('finish', this._onFinishBound)\r\n }\r\n\r\n get bufferSize () {\r\n return (this._channel && this._channel.bufferedAmount) || 0\r\n }\r\n\r\n // HACK: it's possible channel.readyState is \"closing\" before peer.destroy() fires\r\n // https://bugs.chromium.org/p/chromium/issues/detail?id=882743\r\n get connected () {\r\n return (this._connected && this._channel.readyState === 'open')\r\n }\r\n\r\n address () {\r\n return { port: this.localPort, family: this.localFamily, address: this.localAddress }\r\n }\r\n\r\n signal (data) {\r\n if (this._destroying) return\r\n if (this.destroyed) throw errCode(new Error('cannot signal after peer is destroyed'), 'ERR_DESTROYED')\r\n if (typeof data === 'string') {\r\n try {\r\n data = JSON.parse(data)\r\n } catch (err) {\r\n data = {}\r\n }\r\n }\r\n this._debug('signal()')\r\n\r\n if (data.renegotiate && this.initiator) {\r\n this._debug('got request to renegotiate')\r\n this._needsNegotiation()\r\n }\r\n if (data.transceiverRequest && this.initiator) {\r\n this._debug('got request for transceiver')\r\n this.addTransceiver(data.transceiverRequest.kind, data.transceiverRequest.init)\r\n }\r\n if (data.candidate) {\r\n if (this._pc.remoteDescription && this._pc.remoteDescription.type) {\r\n this._addIceCandidate(data.candidate)\r\n } else {\r\n this._pendingCandidates.push(data.candidate)\r\n }\r\n }\r\n if (data.sdp) {\r\n this._pc.setRemoteDescription(new (this._wrtc.RTCSessionDescription)(data))\r\n .then(() => {\r\n if (this.destroyed) return\r\n\r\n this._pendingCandidates.forEach(candidate => {\r\n this._addIceCandidate(candidate)\r\n })\r\n this._pendingCandidates = []\r\n\r\n if (this._pc.remoteDescription.type === 'offer') this._createAnswer()\r\n })\r\n .catch(err => {\r\n this.__destroy(errCode(err, 'ERR_SET_REMOTE_DESCRIPTION'))\r\n })\r\n }\r\n if (!data.sdp && !data.candidate && !data.renegotiate && !data.transceiverRequest) {\r\n this.__destroy(errCode(new Error('signal() called with invalid signal data'), 'ERR_SIGNALING'))\r\n }\r\n }\r\n\r\n _addIceCandidate (candidate) {\r\n const iceCandidateObj = new this._wrtc.RTCIceCandidate(candidate)\r\n this._pc.addIceCandidate(iceCandidateObj)\r\n .catch(err => {\r\n if (!iceCandidateObj.address || iceCandidateObj.address.endsWith('.local')) {\r\n warn('Ignoring unsupported ICE candidate.')\r\n } else {\r\n this.__destroy(errCode(err, 'ERR_ADD_ICE_CANDIDATE'))\r\n }\r\n })\r\n }\r\n\r\n /**\r\n * Send text/binary data to the remote peer.\r\n * @param {ArrayBufferView|ArrayBuffer|Uint8Array|string|Blob} chunk\r\n */\r\n send (chunk) {\r\n if (this._destroying) return\r\n if (this.destroyed) throw errCode(new Error('cannot send after peer is destroyed'), 'ERR_DESTROYED')\r\n this._channel.send(chunk)\r\n }\r\n\r\n /**\r\n * Add a Transceiver to the connection.\r\n * @param {String} kind\r\n * @param {Object} init\r\n */\r\n addTransceiver (kind, init) {\r\n if (this._destroying) return\r\n if (this.destroyed) throw errCode(new Error('cannot addTransceiver after peer is destroyed'), 'ERR_DESTROYED')\r\n this._debug('addTransceiver()')\r\n\r\n if (this.initiator) {\r\n try {\r\n this._pc.addTransceiver(kind, init)\r\n this._needsNegotiation()\r\n } catch (err) {\r\n this.__destroy(errCode(err, 'ERR_ADD_TRANSCEIVER'))\r\n }\r\n } else {\r\n this.emit('signal', { // request initiator to renegotiate\r\n type: 'transceiverRequest',\r\n transceiverRequest: { kind, init }\r\n })\r\n }\r\n }\r\n\r\n /**\r\n * Add a MediaStream to the connection.\r\n * @param {MediaStream} stream\r\n */\r\n addStream (stream) {\r\n if (this._destroying) return\r\n if (this.destroyed) throw errCode(new Error('cannot addStream after peer is destroyed'), 'ERR_DESTROYED')\r\n this._debug('addStream()')\r\n\r\n stream.getTracks().forEach(track => {\r\n this.addTrack(track, stream)\r\n })\r\n }\r\n\r\n /**\r\n * Add a MediaStreamTrack to the connection.\r\n * @param {MediaStreamTrack} track\r\n * @param {MediaStream} stream\r\n */\r\n addTrack (track, stream) {\r\n if (this._destroying) return\r\n if (this.destroyed) throw errCode(new Error('cannot addTrack after peer is destroyed'), 'ERR_DESTROYED')\r\n this._debug('addTrack()')\r\n\r\n const submap = this._senderMap.get(track) || new Map() // nested Maps map [track, stream] to sender\r\n let sender = submap.get(stream)\r\n if (!sender) {\r\n sender = this._pc.addTrack(track, stream)\r\n submap.set(stream, sender)\r\n this._senderMap.set(track, submap)\r\n this._needsNegotiation()\r\n } else if (sender.removed) {\r\n throw errCode(new Error('Track has been removed. You should enable/disable tracks that you want to re-add.'), 'ERR_SENDER_REMOVED')\r\n } else {\r\n throw errCode(new Error('Track has already been added to that stream.'), 'ERR_SENDER_ALREADY_ADDED')\r\n }\r\n }\r\n\r\n /**\r\n * Replace a MediaStreamTrack by another in the connection.\r\n * @param {MediaStreamTrack} oldTrack\r\n * @param {MediaStreamTrack} newTrack\r\n * @param {MediaStream} stream\r\n */\r\n replaceTrack (oldTrack, newTrack, stream) {\r\n if (this._destroying) return\r\n if (this.destroyed) throw errCode(new Error('cannot replaceTrack after peer is destroyed'), 'ERR_DESTROYED')\r\n this._debug('replaceTrack()')\r\n\r\n const submap = this._senderMap.get(oldTrack)\r\n const sender = submap ? submap.get(stream) : null\r\n if (!sender) {\r\n throw errCode(new Error('Cannot replace track that was never added.'), 'ERR_TRACK_NOT_ADDED')\r\n }\r\n if (newTrack) this._senderMap.set(newTrack, submap)\r\n\r\n if (sender.replaceTrack != null) {\r\n sender.replaceTrack(newTrack)\r\n } else {\r\n this.__destroy(errCode(new Error('replaceTrack is not supported in this browser'), 'ERR_UNSUPPORTED_REPLACETRACK'))\r\n }\r\n }\r\n\r\n /**\r\n * Remove a MediaStreamTrack from the connection.\r\n * @param {MediaStreamTrack} track\r\n * @param {MediaStream} stream\r\n */\r\n removeTrack (track, stream) {\r\n if (this._destroying) return\r\n if (this.destroyed) throw errCode(new Error('cannot removeTrack after peer is destroyed'), 'ERR_DESTROYED')\r\n this._debug('removeSender()')\r\n\r\n const submap = this._senderMap.get(track)\r\n const sender = submap ? submap.get(stream) : null\r\n if (!sender) {\r\n throw errCode(new Error('Cannot remove track that was never added.'), 'ERR_TRACK_NOT_ADDED')\r\n }\r\n try {\r\n sender.removed = true\r\n this._pc.removeTrack(sender)\r\n } catch (err) {\r\n if (err.name === 'NS_ERROR_UNEXPECTED') {\r\n this._sendersAwaitingStable.push(sender) // HACK: Firefox must wait until (signalingState === stable) https://bugzilla.mozilla.org/show_bug.cgi?id=1133874\r\n } else {\r\n this.__destroy(errCode(err, 'ERR_REMOVE_TRACK'))\r\n }\r\n }\r\n this._needsNegotiation()\r\n }\r\n\r\n /**\r\n * Remove a MediaStream from the connection.\r\n * @param {MediaStream} stream\r\n */\r\n removeStream (stream) {\r\n if (this._destroying) return\r\n if (this.destroyed) throw errCode(new Error('cannot removeStream after peer is destroyed'), 'ERR_DESTROYED')\r\n this._debug('removeSenders()')\r\n\r\n stream.getTracks().forEach(track => {\r\n this.removeTrack(track, stream)\r\n })\r\n }\r\n\r\n _needsNegotiation () {\r\n this._debug('_needsNegotiation')\r\n if (this._batchedNegotiation) return // batch synchronous renegotiations\r\n this._batchedNegotiation = true\r\n queueMicrotask(() => {\r\n this._batchedNegotiation = false\r\n if (this.initiator || !this._firstNegotiation) {\r\n this._debug('starting batched negotiation')\r\n this.negotiate()\r\n } else {\r\n this._debug('non-initiator initial negotiation request discarded')\r\n }\r\n this._firstNegotiation = false\r\n })\r\n }\r\n\r\n negotiate () {\r\n if (this._destroying) return\r\n if (this.destroyed) throw errCode(new Error('cannot negotiate after peer is destroyed'), 'ERR_DESTROYED')\r\n\r\n if (this.initiator) {\r\n if (this._isNegotiating) {\r\n this._queuedNegotiation = true\r\n this._debug('already negotiating, queueing')\r\n } else {\r\n this._debug('start negotiation')\r\n setTimeout(() => { // HACK: Chrome crashes if we immediately call createOffer\r\n this._createOffer()\r\n }, 0)\r\n }\r\n } else {\r\n if (this._isNegotiating) {\r\n this._queuedNegotiation = true\r\n this._debug('already negotiating, queueing')\r\n } else {\r\n this._debug('requesting negotiation from initiator')\r\n this.emit('signal', { // request initiator to renegotiate\r\n type: 'renegotiate',\r\n renegotiate: true\r\n })\r\n }\r\n }\r\n this._isNegotiating = true\r\n }\r\n\r\n _final (cb) {\r\n if (!this._readableState.ended) this.push(null)\r\n cb(null)\r\n }\r\n\r\n __destroy (err) {\r\n this.end()\r\n this._destroy(() => {}, err)\r\n }\r\n\r\n _destroy (cb, err) {\r\n if (this.destroyed || this._destroying) return\r\n this._destroying = true\r\n\r\n this._debug('destroying (error: %s)', err && (err.message || err))\r\n\r\n setTimeout(() => { // allow events concurrent with the call to _destroy() to fire (see #692)\r\n this._connected = false\r\n this._pcReady = false\r\n this._channelReady = false\r\n this._remoteTracks = null\r\n this._remoteStreams = null\r\n this._senderMap = null\r\n\r\n clearInterval(this._closingInterval)\r\n this._closingInterval = null\r\n\r\n clearInterval(this._interval)\r\n this._interval = null\r\n this._chunk = null\r\n this._cb = null\r\n\r\n if (this._onFinishBound) this.removeListener('finish', this._onFinishBound)\r\n this._onFinishBound = null\r\n\r\n if (this._channel) {\r\n try {\r\n this._channel.close()\r\n } catch (err) {}\r\n\r\n // allow events concurrent with destruction to be handled\r\n this._channel.onmessage = null\r\n this._channel.onopen = null\r\n this._channel.onclose = null\r\n this._channel.onerror = null\r\n }\r\n if (this._pc) {\r\n try {\r\n this._pc.close()\r\n } catch (err) {}\r\n\r\n // allow events concurrent with destruction to be handled\r\n this._pc.oniceconnectionstatechange = null\r\n this._pc.onicegatheringstatechange = null\r\n this._pc.onsignalingstatechange = null\r\n this._pc.onicecandidate = null\r\n this._pc.ontrack = null\r\n this._pc.ondatachannel = null\r\n }\r\n this._pc = null\r\n this._channel = null\r\n if (err) this.emit('error', err)\r\n cb()\r\n }, 0)\r\n }\r\n\r\n _setupData (event) {\r\n if (!event.channel) {\r\n // In some situations `pc.createDataChannel()` returns `undefined` (in wrtc),\r\n // which is invalid behavior. Handle it gracefully.\r\n // See: https://github.com/feross/simple-peer/issues/163\r\n return this.__destroy(errCode(new Error('Data channel event is missing `channel` property'), 'ERR_DATA_CHANNEL'))\r\n }\r\n\r\n this._channel = event.channel\r\n this._channel.binaryType = 'arraybuffer'\r\n\r\n if (typeof this._channel.bufferedAmountLowThreshold === 'number') {\r\n this._channel.bufferedAmountLowThreshold = MAX_BUFFERED_AMOUNT\r\n }\r\n\r\n this.channelName = this._channel.label\r\n\r\n this._channel.onmessage = event => {\r\n this._onChannelMessage(event)\r\n }\r\n this._channel.onbufferedamountlow = () => {\r\n this._onChannelBufferedAmountLow()\r\n }\r\n this._channel.onopen = () => {\r\n this._onChannelOpen()\r\n }\r\n this._channel.onclose = () => {\r\n this._onChannelClose()\r\n }\r\n this._channel.onerror = event => {\r\n const err = event.error instanceof Error\r\n ? event.error\r\n : new Error(`Datachannel error: ${event.message} ${event.filename}:${event.lineno}:${event.colno}`)\r\n this.__destroy(errCode(err, 'ERR_DATA_CHANNEL'))\r\n }\r\n\r\n // HACK: Chrome will sometimes get stuck in readyState \"closing\", let's check for this condition\r\n // https://bugs.chromium.org/p/chromium/issues/detail?id=882743\r\n let isClosing = false\r\n this._closingInterval = setInterval(() => { // No \"onclosing\" event\r\n if (this._channel && this._channel.readyState === 'closing') {\r\n if (isClosing) this._onChannelClose() // closing timed out: equivalent to onclose firing\r\n isClosing = true\r\n } else {\r\n isClosing = false\r\n }\r\n }, CHANNEL_CLOSING_TIMEOUT)\r\n }\r\n\r\n _write (chunk, cb) {\r\n if (this.destroyed) return cb(errCode(new Error('cannot write after peer is destroyed'), 'ERR_DATA_CHANNEL'))\r\n\r\n if (this._connected) {\r\n try {\r\n this.send(chunk)\r\n } catch (err) {\r\n return this.__destroy(errCode(err, 'ERR_DATA_CHANNEL'))\r\n }\r\n if (this._channel.bufferedAmount > MAX_BUFFERED_AMOUNT) {\r\n this._debug('start backpressure: bufferedAmount %d', this._channel.bufferedAmount)\r\n this._cb = cb\r\n } else {\r\n cb(null)\r\n }\r\n } else {\r\n this._debug('write before connect')\r\n this._chunk = chunk\r\n this._cb = cb\r\n }\r\n }\r\n\r\n // When stream finishes writing, close socket. Half open connections are not\r\n // supported.\r\n _onFinish () {\r\n if (this.destroyed) return\r\n\r\n // Wait a bit before destroying so the socket flushes.\r\n // TODO: is there a more reliable way to accomplish this?\r\n const destroySoon = () => {\r\n setTimeout(() => this.__destroy(), 1000)\r\n }\r\n\r\n if (this._connected) {\r\n destroySoon()\r\n } else {\r\n this.once('connect', destroySoon)\r\n }\r\n }\r\n\r\n _startIceCompleteTimeout () {\r\n if (this.destroyed) return\r\n if (this._iceCompleteTimer) return\r\n this._debug('started iceComplete timeout')\r\n this._iceCompleteTimer = setTimeout(() => {\r\n if (!this._iceComplete) {\r\n this._iceComplete = true\r\n this._debug('iceComplete timeout completed')\r\n this.emit('iceTimeout')\r\n this.emit('_iceComplete')\r\n }\r\n }, this.iceCompleteTimeout)\r\n }\r\n\r\n _createOffer () {\r\n if (this.destroyed) return\r\n\r\n this._pc.createOffer(this.offerOptions)\r\n .then(offer => {\r\n if (this.destroyed) return\r\n if (!this.trickle && !this.allowHalfTrickle) offer.sdp = filterTrickle(offer.sdp)\r\n offer.sdp = this.sdpTransform(offer.sdp)\r\n\r\n const sendOffer = () => {\r\n if (this.destroyed) return\r\n const signal = this._pc.localDescription || offer\r\n this._debug('signal')\r\n this.emit('signal', {\r\n type: signal.type,\r\n sdp: signal.sdp\r\n })\r\n }\r\n\r\n const onSuccess = () => {\r\n this._debug('createOffer success')\r\n if (this.destroyed) return\r\n if (this.trickle || this._iceComplete) sendOffer()\r\n else this.once('_iceComplete', sendOffer) // wait for candidates\r\n }\r\n\r\n const onError = err => {\r\n this.__destroy(errCode(err, 'ERR_SET_LOCAL_DESCRIPTION'))\r\n }\r\n\r\n this._pc.setLocalDescription(offer)\r\n .then(onSuccess)\r\n .catch(onError)\r\n })\r\n .catch(err => {\r\n this.__destroy(errCode(err, 'ERR_CREATE_OFFER'))\r\n })\r\n }\r\n\r\n _requestMissingTransceivers () {\r\n if (this._pc.getTransceivers) {\r\n this._pc.getTransceivers().forEach(transceiver => {\r\n if (!transceiver.mid && transceiver.sender.track && !transceiver.requested) {\r\n transceiver.requested = true // HACK: Safari returns negotiated transceivers with a null mid\r\n this.addTransceiver(transceiver.sender.track.kind)\r\n }\r\n })\r\n }\r\n }\r\n\r\n _createAnswer () {\r\n if (this.destroyed) return\r\n\r\n this._pc.createAnswer(this.answerOptions)\r\n .then(answer => {\r\n if (this.destroyed) return\r\n if (!this.trickle && !this.allowHalfTrickle) answer.sdp = filterTrickle(answer.sdp)\r\n answer.sdp = this.sdpTransform(answer.sdp)\r\n\r\n const sendAnswer = () => {\r\n if (this.destroyed) return\r\n const signal = this._pc.localDescription || answer\r\n this._debug('signal')\r\n this.emit('signal', {\r\n type: signal.type,\r\n sdp: signal.sdp\r\n })\r\n if (!this.initiator) this._requestMissingTransceivers()\r\n }\r\n\r\n const onSuccess = () => {\r\n if (this.destroyed) return\r\n if (this.trickle || this._iceComplete) sendAnswer()\r\n else this.once('_iceComplete', sendAnswer)\r\n }\r\n\r\n const onError = err => {\r\n this.__destroy(errCode(err, 'ERR_SET_LOCAL_DESCRIPTION'))\r\n }\r\n\r\n this._pc.setLocalDescription(answer)\r\n .then(onSuccess)\r\n .catch(onError)\r\n })\r\n .catch(err => {\r\n this.__destroy(errCode(err, 'ERR_CREATE_ANSWER'))\r\n })\r\n }\r\n\r\n _onConnectionStateChange () {\r\n if (this.destroyed || this._destroying) return\r\n if (this._pc.connectionState === 'failed') {\r\n this.__destroy(errCode(new Error('Connection failed.'), 'ERR_CONNECTION_FAILURE'))\r\n }\r\n }\r\n\r\n _onIceStateChange () {\r\n if (this.destroyed) return\r\n const iceConnectionState = this._pc.iceConnectionState\r\n const iceGatheringState = this._pc.iceGatheringState\r\n\r\n this._debug(\r\n 'iceStateChange (connection: %s) (gathering: %s)',\r\n iceConnectionState,\r\n iceGatheringState\r\n )\r\n this.emit('iceStateChange', iceConnectionState, iceGatheringState)\r\n\r\n if (iceConnectionState === 'connected' || iceConnectionState === 'completed') {\r\n this._pcReady = true\r\n this._maybeReady()\r\n }\r\n if (iceConnectionState === 'failed') {\r\n this.__destroy(errCode(new Error('Ice connection failed.'), 'ERR_ICE_CONNECTION_FAILURE'))\r\n }\r\n if (iceConnectionState === 'closed') {\r\n this.__destroy(errCode(new Error('Ice connection closed.'), 'ERR_ICE_CONNECTION_CLOSED'))\r\n }\r\n }\r\n\r\n getStats (cb) {\r\n // statreports can come with a value array instead of properties\r\n const flattenValues = report => {\r\n if (Object.prototype.toString.call(report.values) === '[object Array]') {\r\n report.values.forEach(value => {\r\n Object.assign(report, value)\r\n })\r\n }\r\n return report\r\n }\r\n\r\n // Promise-based getStats() (standard)\r\n if (this._pc.getStats.length === 0 || this._isReactNativeWebrtc) {\r\n this._pc.getStats()\r\n .then(res => {\r\n const reports = []\r\n res.forEach(report => {\r\n reports.push(flattenValues(report))\r\n })\r\n cb(null, reports)\r\n }, err => cb(err))\r\n\r\n // Single-parameter callback-based getStats() (non-standard)\r\n } else if (this._pc.getStats.length > 0) {\r\n this._pc.getStats(res => {\r\n // If we destroy connection in `connect` callback this code might happen to run when actual connection is already closed\r\n if (this.destroyed) return\r\n\r\n const reports = []\r\n res.result().forEach(result => {\r\n const report = {}\r\n result.names().forEach(name => {\r\n report[name] = result.stat(name)\r\n })\r\n report.id = result.id\r\n report.type = result.type\r\n report.timestamp = result.timestamp\r\n reports.push(flattenValues(report))\r\n })\r\n cb(null, reports)\r\n }, err => cb(err))\r\n\r\n // Unknown browser, skip getStats() since it's anyone's guess which style of\r\n // getStats() they implement.\r\n } else {\r\n cb(null, [])\r\n }\r\n }\r\n\r\n _maybeReady () {\r\n this._debug('maybeReady pc %s channel %s', this._pcReady, this._channelReady)\r\n if (this._connected || this._connecting || !this._pcReady || !this._channelReady) return\r\n\r\n this._connecting = true\r\n\r\n // HACK: We can't rely on order here, for details see https://github.com/js-platform/node-webrtc/issues/339\r\n const findCandidatePair = () => {\r\n if (this.destroyed || this._destroying) return\r\n\r\n this.getStats((err, items) => {\r\n if (this.destroyed || this._destroying) return\r\n\r\n // Treat getStats error as non-fatal. It's not essential.\r\n if (err) items = []\r\n\r\n const remoteCandidates = {}\r\n const localCandidates = {}\r\n const candidatePairs = {}\r\n let foundSelectedCandidatePair = false\r\n\r\n items.forEach(item => {\r\n // TODO: Once all browsers support the hyphenated stats report types, remove\r\n // the non-hypenated ones\r\n if (item.type === 'remotecandidate' || item.type === 'remote-candidate') {\r\n remoteCandidates[item.id] = item\r\n }\r\n if (item.type === 'localcandidate' || item.type === 'local-candidate') {\r\n localCandidates[item.id] = item\r\n }\r\n if (item.type === 'candidatepair' || item.type === 'candidate-pair') {\r\n candidatePairs[item.id] = item\r\n }\r\n })\r\n\r\n const setSelectedCandidatePair = selectedCandidatePair => {\r\n foundSelectedCandidatePair = true\r\n\r\n let local = localCandidates[selectedCandidatePair.localCandidateId]\r\n\r\n if (local && (local.ip || local.address)) {\r\n // Spec\r\n this.localAddress = local.ip || local.address\r\n this.localPort = Number(local.port)\r\n } else if (local && local.ipAddress) {\r\n // Firefox\r\n this.localAddress = local.ipAddress\r\n this.localPort = Number(local.portNumber)\r\n } else if (typeof selectedCandidatePair.googLocalAddress === 'string') {\r\n // TODO: remove this once Chrome 58 is released\r\n local = selectedCandidatePair.googLocalAddress.split(':')\r\n this.localAddress = local[0]\r\n this.localPort = Number(local[1])\r\n }\r\n if (this.localAddress) {\r\n this.localFamily = this.localAddress.includes(':') ? 'IPv6' : 'IPv4'\r\n }\r\n\r\n let remote = remoteCandidates[selectedCandidatePair.remoteCandidateId]\r\n\r\n if (remote && (remote.ip || remote.address)) {\r\n // Spec\r\n this.remoteAddress = remote.ip || remote.address\r\n this.remotePort = Number(remote.port)\r\n } else if (remote && remote.ipAddress) {\r\n // Firefox\r\n this.remoteAddress = remote.ipAddress\r\n this.remotePort = Number(remote.portNumber)\r\n } else if (typeof selectedCandidatePair.googRemoteAddress === 'string') {\r\n // TODO: remove this once Chrome 58 is released\r\n remote = selectedCandidatePair.googRemoteAddress.split(':')\r\n this.remoteAddress = remote[0]\r\n this.remotePort = Number(remote[1])\r\n }\r\n if (this.remoteAddress) {\r\n this.remoteFamily = this.remoteAddress.includes(':') ? 'IPv6' : 'IPv4'\r\n }\r\n\r\n this._debug(\r\n 'connect local: %s:%s remote: %s:%s',\r\n this.localAddress,\r\n this.localPort,\r\n this.remoteAddress,\r\n this.remotePort\r\n )\r\n }\r\n\r\n items.forEach(item => {\r\n // Spec-compliant\r\n if (item.type === 'transport' && item.selectedCandidatePairId) {\r\n setSelectedCandidatePair(candidatePairs[item.selectedCandidatePairId])\r\n }\r\n\r\n // Old implementations\r\n if (\r\n (item.type === 'googCandidatePair' && item.googActiveConnection === 'true') ||\r\n ((item.type === 'candidatepair' || item.type === 'candidate-pair') && item.selected)\r\n ) {\r\n setSelectedCandidatePair(item)\r\n }\r\n })\r\n\r\n // Ignore candidate pair selection in browsers like Safari 11 that do not have any local or remote candidates\r\n // But wait until at least 1 candidate pair is available\r\n if (!foundSelectedCandidatePair && (!Object.keys(candidatePairs).length || Object.keys(localCandidates).length)) {\r\n setTimeout(findCandidatePair, 100)\r\n return\r\n } else {\r\n this._connecting = false\r\n this._connected = true\r\n }\r\n\r\n if (this._chunk) {\r\n try {\r\n this.send(this._chunk)\r\n } catch (err) {\r\n return this.__destroy(errCode(err, 'ERR_DATA_CHANNEL'))\r\n }\r\n this._chunk = null\r\n this._debug('sent chunk from \"write before connect\"')\r\n\r\n const cb = this._cb\r\n this._cb = null\r\n cb(null)\r\n }\r\n\r\n // If `bufferedAmountLowThreshold` and 'onbufferedamountlow' are unsupported,\r\n // fallback to using setInterval to implement backpressure.\r\n if (typeof this._channel.bufferedAmountLowThreshold !== 'number') {\r\n this._interval = setInterval(() => this._onInterval(), 150)\r\n if (this._interval.unref) this._interval.unref()\r\n }\r\n\r\n this._debug('connect')\r\n this.emit('connect')\r\n })\r\n }\r\n findCandidatePair()\r\n }\r\n\r\n _onInterval () {\r\n if (!this._cb || !this._channel || this._channel.bufferedAmount > MAX_BUFFERED_AMOUNT) {\r\n return\r\n }\r\n this._onChannelBufferedAmountLow()\r\n }\r\n\r\n _onSignalingStateChange () {\r\n if (this.destroyed) return\r\n\r\n if (this._pc.signalingState === 'stable') {\r\n this._isNegotiating = false\r\n\r\n // HACK: Firefox doesn't yet support removing tracks when signalingState !== 'stable'\r\n this._debug('flushing sender queue', this._sendersAwaitingStable)\r\n this._sendersAwaitingStable.forEach(sender => {\r\n this._pc.removeTrack(sender)\r\n this._queuedNegotiation = true\r\n })\r\n this._sendersAwaitingStable = []\r\n\r\n if (this._queuedNegotiation) {\r\n this._debug('flushing negotiation queue')\r\n this._queuedNegotiation = false\r\n this._needsNegotiation() // negotiate again\r\n } else {\r\n this._debug('negotiated')\r\n this.emit('negotiated')\r\n }\r\n }\r\n\r\n this._debug('signalingStateChange %s', this._pc.signalingState)\r\n this.emit('signalingStateChange', this._pc.signalingState)\r\n }\r\n\r\n _onIceCandidate (event) {\r\n if (this.destroyed) return\r\n if (event.candidate && this.trickle) {\r\n this.emit('signal', {\r\n type: 'candidate',\r\n candidate: {\r\n candidate: event.candidate.candidate,\r\n sdpMLineIndex: event.candidate.sdpMLineIndex,\r\n sdpMid: event.candidate.sdpMid\r\n }\r\n })\r\n } else if (!event.candidate && !this._iceComplete) {\r\n this._iceComplete = true\r\n this.emit('_iceComplete')\r\n }\r\n // as soon as we've received one valid candidate start timeout\r\n if (event.candidate) {\r\n this._startIceCompleteTimeout()\r\n }\r\n }\r\n\r\n _onChannelMessage (event) {\r\n if (this.destroyed) return\r\n let data = event.data\r\n if (data instanceof ArrayBuffer) {\r\n data = new Uint8Array(data)\r\n } else if (this.__objectMode === false) {\r\n data = text2arr(data)\r\n }\r\n this.push(data)\r\n }\r\n\r\n _onChannelBufferedAmountLow () {\r\n if (this.destroyed || !this._cb) return\r\n this._debug('ending backpressure: bufferedAmount %d', this._channel.bufferedAmount)\r\n const cb = this._cb\r\n this._cb = null\r\n cb(null)\r\n }\r\n\r\n _onChannelOpen () {\r\n if (this._connected || this.destroyed) return\r\n this._debug('on channel open')\r\n this._channelReady = true\r\n this._maybeReady()\r\n }\r\n\r\n _onChannelClose () {\r\n if (this.destroyed) return\r\n this._debug('on channel close')\r\n this.__destroy()\r\n }\r\n\r\n _onTrack (event) {\r\n if (this.destroyed) return\r\n\r\n event.streams.forEach(eventStream => {\r\n this._debug('on track')\r\n this.emit('track', event.track, eventStream)\r\n\r\n this._remoteTracks.push({\r\n track: event.track,\r\n stream: eventStream\r\n })\r\n\r\n if (this._remoteStreams.some(remoteStream => {\r\n return remoteStream.id === eventStream.id\r\n })) return // Only fire one 'stream' event, even though there may be multiple tracks per stream\r\n\r\n this._remoteStreams.push(eventStream)\r\n queueMicrotask(() => {\r\n this._debug('on stream')\r\n this.emit('stream', eventStream) // ensure all tracks have been added\r\n })\r\n })\r\n }\r\n\r\n _debug () {\r\n const args = [].slice.call(arguments)\r\n args[0] = '[' + this._id + '] ' + args[0]\r\n Debug.apply(null, args)\r\n }\r\n}\r\n\r\nPeer.WEBRTC_SUPPORT = !!getBrowserRTC()\r\n\r\n/**\r\n * Expose peer and data channel config for overriding all Peer\r\n * instances. Otherwise, just set opts.config or opts.channelConfig\r\n * when constructing a Peer.\r\n */\r\nPeer.config = {\r\n iceServers: [\r\n {\r\n urls: [\r\n 'stun:stun.l.google.com:19302',\r\n 'stun:global.stun.twilio.com:3478'\r\n ]\r\n }\r\n ],\r\n sdpSemantics: 'unified-plan'\r\n}\r\n\r\nPeer.channelConfig = {}\r\n\r\nexport default Peer\r\n","const ADDR_RE = /^\\[?([^\\]]+)]?:(\\d+)$/ // ipv4/ipv6/hostname + port\n\nlet cache = new Map()\n\n// reset cache when it gets to 100,000 elements (~ 600KB of ipv4 addresses)\n// so it will not grow to consume all memory in long-running processes\nexport default function addrToIPPort (addr) {\n if (cache.size === 100000) cache.clear()\n if (!cache.has(addr)) {\n const m = ADDR_RE.exec(addr)\n if (!m) throw new Error(`invalid addr: ${addr}`)\n cache.set(addr, [ m[1], Number(m[2]) ])\n }\n return cache.get(addr)\n}\n","import blockIterator from 'block-iterator'\r\n\r\nasync function * chunkStoreRead (store, opts = {}) {\r\n if (store?.[Symbol.asyncIterator]) {\r\n yield * store[Symbol.asyncIterator](opts.offset)\r\n return\r\n }\r\n if (!store?.get) throw new Error('First argument must be an abstract-chunk-store compliant store')\r\n\r\n const chunkLength = opts.chunkLength || store.chunkLength\r\n if (!chunkLength) throw new Error('missing required `chunkLength` property')\r\n\r\n let length = opts.length || store.length\r\n if (!Number.isFinite(length)) throw new Error('missing required `length` property')\r\n\r\n const offset = opts.offset || 0\r\n\r\n const get = (i, length, offset) => new Promise((resolve, reject) => {\r\n store.get(i, { offset, length }, (err, chunk) => {\r\n if (err) reject(err)\r\n resolve(chunk)\r\n })\r\n })\r\n\r\n let index = Math.floor(offset / chunkLength)\r\n const chunkOffset = offset % chunkLength\r\n if (offset) {\r\n const target = Math.min(length, chunkLength - chunkOffset)\r\n length -= target\r\n yield get(index++, target, chunkOffset)\r\n }\r\n\r\n for (let remainingLength = length; remainingLength > 0; ++index, remainingLength -= chunkLength) {\r\n yield get(index, Math.min(remainingLength, chunkLength))\r\n }\r\n}\r\n\r\nasync function chunkStoreWrite (store, stream, opts = {}) {\r\n if (!store?.put) throw new Error('First argument must be an abstract-chunk-store compliant store')\r\n\r\n const chunkLength = opts.chunkLength || store.chunkLength\r\n if (!chunkLength) throw new Error('missing required `chunkLength` property')\r\n\r\n const storeMaxOutstandingPuts = opts.storeMaxOutstandingPuts || 16\r\n let outstandingPuts = 0\r\n\r\n let index = 0\r\n\r\n let cb = () => {}\r\n let ended = false\r\n\r\n for await (const chunk of blockIterator(stream, chunkLength, { zeroPadding: opts.zeroPadding || false })) {\r\n await new Promise(resolve => {\r\n if (outstandingPuts++ <= storeMaxOutstandingPuts) resolve()\r\n store.put(index++, chunk, err => {\r\n if (err) throw err\r\n --outstandingPuts\r\n resolve()\r\n if (ended && outstandingPuts === 0) cb()\r\n })\r\n })\r\n }\r\n if (outstandingPuts === 0) return\r\n ended = new Promise(resolve => { cb = resolve })\r\n await ended\r\n}\r\n\r\nexport { chunkStoreRead, chunkStoreWrite }\r\nexport default { chunkStoreRead, chunkStoreWrite }\r\n","/**\n * Functions/constants needed by both the client and server.\n */\nimport * as common from './common-node.js'\nexport * from './common-node.js'\n\nexport const DEFAULT_ANNOUNCE_PEERS = 50\nexport const MAX_ANNOUNCE_PEERS = 82\n\n// HACK: Fix for WHATWG URL object not parsing non-standard URL schemes like\n// 'udp:'. Just replace it with 'http:' since we only need a few properties.\n//\n// Note: Only affects Chrome and Firefox. Works fine in Node.js, Safari, and\n// Edge.\n//\n// Note: UDP trackers aren't used in the normal browser build, but they are\n// used in a Chrome App build (i.e. by Brave Browser).\n//\n// Bug reports:\n// - Chrome: https://bugs.chromium.org/p/chromium/issues/detail?id=734880\n// - Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=1374505\nexport const parseUrl = str => {\n const url = new URL(str.replace(/^udp:/, 'http:'))\n\n if (str.match(/^udp:/)) {\n Object.defineProperties(url, {\n href: { value: url.href.replace(/^http/, 'udp') },\n protocol: { value: url.protocol.replace(/^http/, 'udp') },\n origin: { value: url.origin.replace(/^http/, 'udp') }\n })\n }\n\n return url\n}\n\nexport default {\n DEFAULT_ANNOUNCE_PEERS,\n MAX_ANNOUNCE_PEERS,\n parseUrl,\n ...common\n}\n","/*! simple-websocket. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */\r\n/* global WebSocket */\r\n\r\nimport Debug from 'debug'\r\nimport queueMicrotask from 'queue-microtask' // TODO: remove when Node 10 is not supported\r\nimport ws from 'ws' // websockets in node - will be empty object in browser\r\nimport { Duplex } from 'streamx'\r\nimport { text2arr, randomBytes, arr2hex } from 'uint8-util'\r\n\r\nconst debug = Debug('simple-websocket')\r\n\r\nconst _WebSocket = typeof ws !== 'function' ? WebSocket : ws\r\n\r\nconst MAX_BUFFERED_AMOUNT = 64 * 1024\r\n\r\n/**\r\n * WebSocket. Same API as node core `net.Socket`. Duplex stream.\r\n * @param {Object} opts\r\n * @param {string=} opts.url websocket server url\r\n * @param {string=} opts.socket raw websocket instance to wrap\r\n */\r\nexport default class Socket extends Duplex {\r\n constructor (opts = {}) {\r\n // Support simple usage: `new Socket(url)`\r\n if (typeof opts === 'string') {\r\n opts = { url: opts }\r\n }\r\n\r\n opts = Object.assign({\r\n allowHalfOpen: false\r\n }, opts)\r\n\r\n super(opts)\r\n\r\n this.__objectMode = !!opts.objectMode // streamx is objectMode by default, so implement readable's fuctionality\r\n if (opts.objectMode != null) delete opts.objectMode // causes error with ws...\r\n\r\n if (opts.url == null && opts.socket == null) {\r\n throw new Error('Missing required `url` or `socket` option')\r\n }\r\n if (opts.url != null && opts.socket != null) {\r\n throw new Error('Must specify either `url` or `socket` option, not both')\r\n }\r\n\r\n this._id = arr2hex(randomBytes(4)).slice(0, 7)\r\n this._debug('new websocket: %o', opts)\r\n\r\n this.connected = false\r\n\r\n this._chunk = null\r\n this._cb = null\r\n this._interval = null\r\n\r\n if (opts.socket) {\r\n this.url = opts.socket.url\r\n this._ws = opts.socket\r\n this.connected = opts.socket.readyState === _WebSocket.OPEN\r\n } else {\r\n this.url = opts.url\r\n try {\r\n if (typeof ws === 'function') {\r\n // `ws` package accepts options\r\n this._ws = new _WebSocket(opts.url, {\r\n ...opts,\r\n encoding: undefined // encoding option breaks ws internals\r\n })\r\n } else {\r\n this._ws = new _WebSocket(opts.url)\r\n }\r\n } catch (err) {\r\n queueMicrotask(() => this.destroy(err))\r\n return\r\n }\r\n }\r\n\r\n this._ws.binaryType = 'arraybuffer'\r\n\r\n if (opts.socket && this.connected) {\r\n queueMicrotask(() => this._handleOpen())\r\n } else {\r\n this._ws.onopen = () => this._handleOpen()\r\n }\r\n\r\n this._ws.onmessage = event => this._handleMessage(event)\r\n this._ws.onclose = () => this._handleClose()\r\n this._ws.onerror = err => this._handleError(err)\r\n\r\n this._handleFinishBound = () => this._handleFinish()\r\n this.once('finish', this._handleFinishBound)\r\n }\r\n\r\n /**\r\n * Send text/binary data to the WebSocket server.\r\n * @param {TypedArrayView|ArrayBuffer|Uint8Array|string|Blob|Object} chunk\r\n */\r\n send (chunk) {\r\n this._ws.send(chunk)\r\n }\r\n\r\n _final (cb) {\r\n if (!this._readableState.ended) this.push(null)\r\n cb(null)\r\n }\r\n\r\n _destroy (cb) {\r\n if (this.destroyed) return\r\n if (!this._writableState.ended) this.end()\r\n\r\n this.connected = false\r\n\r\n clearInterval(this._interval)\r\n this._interval = null\r\n this._chunk = null\r\n this._cb = null\r\n\r\n if (this._handleFinishBound) {\r\n this.removeListener('finish', this._handleFinishBound)\r\n }\r\n this._handleFinishBound = null\r\n\r\n if (this._ws) {\r\n const ws = this._ws\r\n const onClose = () => {\r\n ws.onclose = null\r\n }\r\n if (ws.readyState === _WebSocket.CLOSED) {\r\n onClose()\r\n } else {\r\n try {\r\n ws.onclose = onClose\r\n ws.close()\r\n } catch (err) {\r\n onClose()\r\n }\r\n }\r\n\r\n ws.onopen = null\r\n ws.onmessage = null\r\n ws.onerror = () => {}\r\n }\r\n this._ws = null\r\n\r\n cb()\r\n }\r\n\r\n _write (chunk, cb) {\r\n if (this.destroyed) return cb(new Error('cannot write after socket is destroyed'))\r\n\r\n if (this.connected) {\r\n try {\r\n this.send(chunk)\r\n } catch (err) {\r\n return this.destroy(err)\r\n }\r\n if (typeof ws !== 'function' && this._ws.bufferedAmount > MAX_BUFFERED_AMOUNT) {\r\n this._debug('start backpressure: bufferedAmount %d', this._ws.bufferedAmount)\r\n this._cb = cb\r\n } else {\r\n cb(null)\r\n }\r\n } else {\r\n this._debug('write before connect')\r\n this._chunk = chunk\r\n this._cb = cb\r\n }\r\n }\r\n\r\n _handleOpen () {\r\n if (this.connected || this.destroyed) return\r\n this.connected = true\r\n\r\n if (this._chunk) {\r\n try {\r\n this.send(this._chunk)\r\n } catch (err) {\r\n return this.destroy(err)\r\n }\r\n this._chunk = null\r\n this._debug('sent chunk from \"write before connect\"')\r\n\r\n const cb = this._cb\r\n this._cb = null\r\n cb(null)\r\n }\r\n\r\n // Backpressure is not implemented in Node.js. The `ws` module has a buggy\r\n // `bufferedAmount` property. See: https://github.com/websockets/ws/issues/492\r\n if (typeof ws !== 'function') {\r\n this._interval = setInterval(() => this._onInterval(), 150)\r\n if (this._interval.unref) this._interval.unref()\r\n }\r\n\r\n this._debug('connect')\r\n this.emit('connect')\r\n }\r\n\r\n _handleMessage (event) {\r\n if (this.destroyed) return\r\n let data = event.data\r\n if (data instanceof ArrayBuffer) data = new Uint8Array(data)\r\n if (this.__objectMode === false) data = text2arr(data)\r\n this.push(data)\r\n }\r\n\r\n _handleClose () {\r\n if (this.destroyed) return\r\n this._debug('on close')\r\n this.destroy()\r\n }\r\n\r\n _handleError (_) {\r\n this.destroy(new Error(`Error connecting to ${this.url}`))\r\n }\r\n\r\n // When stream finishes writing, close socket. Half open connections are not\r\n // supported.\r\n _handleFinish () {\r\n if (this.destroyed) return\r\n\r\n // Wait a bit before destroying so the socket flushes.\r\n // TODO: is there a more reliable way to accomplish this?\r\n const destroySoon = () => {\r\n setTimeout(() => this.destroy(), 1000)\r\n }\r\n\r\n if (this.connected) {\r\n destroySoon()\r\n } else {\r\n this.once('connect', destroySoon)\r\n }\r\n }\r\n\r\n _onInterval () {\r\n if (!this._cb || !this._ws || this._ws.bufferedAmount > MAX_BUFFERED_AMOUNT) {\r\n return\r\n }\r\n this._debug('ending backpressure: bufferedAmount %d', this._ws.bufferedAmount)\r\n const cb = this._cb\r\n this._cb = null\r\n cb(null)\r\n }\r\n\r\n _debug () {\r\n const args = [].slice.call(arguments)\r\n args[0] = '[' + this._id + '] ' + args[0]\r\n debug.apply(null, args)\r\n }\r\n}\r\n\r\nSocket.WEBSOCKET_SUPPORT = !!_WebSocket\r\n","import EventEmitter from 'events'\n\nclass Tracker extends EventEmitter {\n constructor (client, announceUrl) {\n super()\n\n this.client = client\n this.announceUrl = announceUrl\n\n this.interval = null\n this.destroyed = false\n }\n\n setInterval (intervalMs) {\n if (intervalMs == null) intervalMs = this.DEFAULT_ANNOUNCE_INTERVAL\n\n clearInterval(this.interval)\n\n if (intervalMs) {\n this.interval = setInterval(() => {\n this.announce(this.client._defaultAnnounceOpts())\n }, intervalMs)\n if (this.interval.unref) this.interval.unref()\n }\n }\n}\n\nexport default Tracker\n","import clone from 'clone'\nimport Debug from 'debug'\nimport Peer from '@thaunknown/simple-peer'\nimport Socket from '@thaunknown/simple-websocket'\nimport Socks from 'socks'\nimport { arr2text, arr2hex, hex2bin, bin2hex, randomBytes } from 'uint8-util'\n\nimport { DESTROY_TIMEOUT } from '../common.js'\nimport Tracker from './tracker.js'\n\nconst debug = Debug('bittorrent-tracker:websocket-tracker')\n\n// Use a socket pool, so tracker clients share WebSocket objects for the same server.\n// In practice, WebSockets are pretty slow to establish, so this gives a nice performance\n// boost, and saves browser resources.\nconst socketPool = {}\n\nconst RECONNECT_MINIMUM = 10 * 1000\nconst RECONNECT_MAXIMUM = 60 * 60 * 1000\nconst RECONNECT_VARIANCE = 5 * 60 * 1000\nconst OFFER_TIMEOUT = 50 * 1000\n\nclass WebSocketTracker extends Tracker {\n constructor (client, announceUrl) {\n super(client, announceUrl)\n debug('new websocket tracker %s', announceUrl)\n\n this.peers = {} // peers (offer id -> peer)\n this.socket = null\n\n this.reconnecting = false\n this.retries = 0\n this.reconnectTimer = null\n\n // Simple boolean flag to track whether the socket has received data from\n // the websocket server since the last time socket.send() was called.\n this.expectingResponse = false\n\n this._openSocket()\n }\n\n announce (opts) {\n if (this.destroyed || this.reconnecting) return\n if (!this.socket.connected) {\n this.socket.once('connect', () => {\n this.announce(opts)\n })\n return\n }\n\n const params = Object.assign({}, opts, {\n action: 'announce',\n info_hash: this.client._infoHashBinary,\n peer_id: this.client._peerIdBinary\n })\n if (this._trackerId) params.trackerid = this._trackerId\n\n if (opts.event === 'stopped' || opts.event === 'completed') {\n // Don't include offers with 'stopped' or 'completed' event\n this._send(params)\n } else {\n // Limit the number of offers that are generated, since it can be slow\n const numwant = Math.min(opts.numwant, 5)\n\n this._generateOffers(numwant, offers => {\n params.numwant = numwant\n params.offers = offers\n this._send(params)\n })\n }\n }\n\n scrape (opts) {\n if (this.destroyed || this.reconnecting) return\n if (!this.socket.connected) {\n this.socket.once('connect', () => {\n this.scrape(opts)\n })\n return\n }\n\n const infoHashes = (Array.isArray(opts.infoHash) && opts.infoHash.length > 0)\n ? opts.infoHash.map(infoHash => hex2bin(infoHash))\n : (opts.infoHash && hex2bin(opts.infoHash)) || this.client._infoHashBinary\n const params = {\n action: 'scrape',\n info_hash: infoHashes\n }\n\n this._send(params)\n }\n\n destroy (cb = noop) {\n if (this.destroyed) return cb(null)\n\n this.destroyed = true\n\n clearInterval(this.interval)\n clearTimeout(this.reconnectTimer)\n\n // Destroy peers\n for (const peerId in this.peers) {\n const peer = this.peers[peerId]\n clearTimeout(peer.trackerTimeout)\n peer.destroy()\n }\n this.peers = null\n\n if (this.socket) {\n this.socket.removeListener('connect', this._onSocketConnectBound)\n this.socket.removeListener('data', this._onSocketDataBound)\n this.socket.removeListener('close', this._onSocketCloseBound)\n this.socket.removeListener('error', this._onSocketErrorBound)\n this.socket = null\n }\n\n this._onSocketConnectBound = null\n this._onSocketErrorBound = null\n this._onSocketDataBound = null\n this._onSocketCloseBound = null\n\n if (socketPool[this.announceUrl]) {\n socketPool[this.announceUrl].consumers -= 1\n }\n\n // Other instances are using the socket, so there's nothing left to do here\n if (socketPool[this.announceUrl].consumers > 0) return cb()\n\n let socket = socketPool[this.announceUrl]\n delete socketPool[this.announceUrl]\n socket.on('error', noop) // ignore all future errors\n socket.once('close', cb)\n\n let timeout\n\n // If there is no data response expected, destroy immediately.\n if (!this.expectingResponse) return destroyCleanup()\n\n // Otherwise, wait a short time for potential responses to come in from the\n // server, then force close the socket.\n timeout = setTimeout(destroyCleanup, DESTROY_TIMEOUT)\n\n // But, if a response comes from the server before the timeout fires, do cleanup\n // right away.\n socket.once('data', destroyCleanup)\n\n function destroyCleanup () {\n if (timeout) {\n clearTimeout(timeout)\n timeout = null\n }\n socket.removeListener('data', destroyCleanup)\n socket.destroy()\n socket = null\n }\n }\n\n _openSocket () {\n this.destroyed = false\n\n if (!this.peers) this.peers = {}\n\n this._onSocketConnectBound = () => {\n this._onSocketConnect()\n }\n this._onSocketErrorBound = err => {\n this._onSocketError(err)\n }\n this._onSocketDataBound = data => {\n this._onSocketData(data)\n }\n this._onSocketCloseBound = () => {\n this._onSocketClose()\n }\n\n this.socket = socketPool[this.announceUrl]\n if (this.socket) {\n socketPool[this.announceUrl].consumers += 1\n if (this.socket.connected) {\n this._onSocketConnectBound()\n }\n } else {\n const parsedUrl = new URL(this.announceUrl)\n let agent\n if (this.client._proxyOpts) {\n agent = parsedUrl.protocol === 'wss:' ? this.client._proxyOpts.httpsAgent : this.client._proxyOpts.httpAgent\n if (!agent && this.client._proxyOpts.socksProxy) {\n agent = new Socks.Agent(clone(this.client._proxyOpts.socksProxy), (parsedUrl.protocol === 'wss:'))\n }\n }\n this.socket = socketPool[this.announceUrl] = new Socket({ url: this.announceUrl, agent })\n this.socket.consumers = 1\n this.socket.once('connect', this._onSocketConnectBound)\n }\n\n this.socket.on('data', this._onSocketDataBound)\n this.socket.once('close', this._onSocketCloseBound)\n this.socket.once('error', this._onSocketErrorBound)\n }\n\n _onSocketConnect () {\n if (this.destroyed) return\n\n if (this.reconnecting) {\n this.reconnecting = false\n this.retries = 0\n this.announce(this.client._defaultAnnounceOpts())\n }\n }\n\n _onSocketData (data) {\n if (this.destroyed) return\n\n this.expectingResponse = false\n\n try {\n data = JSON.parse(arr2text(data))\n } catch (err) {\n this.client.emit('warning', new Error('Invalid tracker response'))\n return\n }\n\n if (data.action === 'announce') {\n this._onAnnounceResponse(data)\n } else if (data.action === 'scrape') {\n this._onScrapeResponse(data)\n } else {\n this._onSocketError(new Error(`invalid action in WS response: ${data.action}`))\n }\n }\n\n _onAnnounceResponse (data) {\n if (data.info_hash !== this.client._infoHashBinary) {\n debug(\n 'ignoring websocket data from %s for %s (looking for %s: reused socket)',\n this.announceUrl, bin2hex(data.info_hash), this.client.infoHash\n )\n return\n }\n\n if (data.peer_id && data.peer_id === this.client._peerIdBinary) {\n // ignore offers/answers from this client\n return\n }\n\n debug(\n 'received %s from %s for %s',\n JSON.stringify(data), this.announceUrl, this.client.infoHash\n )\n\n const failure = data['failure reason']\n if (failure) return this.client.emit('warning', new Error(failure))\n\n const warning = data['warning message']\n if (warning) this.client.emit('warning', new Error(warning))\n\n const interval = data.interval || data['min interval']\n if (interval) this.setInterval(interval * 1000)\n\n const trackerId = data['tracker id']\n if (trackerId) {\n // If absent, do not discard previous trackerId value\n this._trackerId = trackerId\n }\n\n if (data.complete != null) {\n const response = Object.assign({}, data, {\n announce: this.announceUrl,\n infoHash: bin2hex(data.info_hash)\n })\n this.client.emit('update', response)\n }\n\n let peer\n if (data.offer && data.peer_id) {\n debug('creating peer (from remote offer)')\n peer = this._createPeer()\n peer.id = bin2hex(data.peer_id)\n peer.once('signal', answer => {\n const params = {\n action: 'announce',\n info_hash: this.client._infoHashBinary,\n peer_id: this.client._peerIdBinary,\n to_peer_id: data.peer_id,\n answer,\n offer_id: data.offer_id\n }\n if (this._trackerId) params.trackerid = this._trackerId\n this._send(params)\n })\n this.client.emit('peer', peer)\n peer.signal(data.offer)\n }\n\n if (data.answer && data.peer_id) {\n const offerId = bin2hex(data.offer_id)\n peer = this.peers[offerId]\n if (peer) {\n peer.id = bin2hex(data.peer_id)\n this.client.emit('peer', peer)\n peer.signal(data.answer)\n\n clearTimeout(peer.trackerTimeout)\n peer.trackerTimeout = null\n delete this.peers[offerId]\n } else {\n debug(`got unexpected answer: ${JSON.stringify(data.answer)}`)\n }\n }\n }\n\n _onScrapeResponse (data) {\n data = data.files || {}\n\n const keys = Object.keys(data)\n if (keys.length === 0) {\n this.client.emit('warning', new Error('invalid scrape response'))\n return\n }\n\n keys.forEach(infoHash => {\n // TODO: optionally handle data.flags.min_request_interval\n // (separate from announce interval)\n const response = Object.assign(data[infoHash], {\n announce: this.announceUrl,\n infoHash: bin2hex(infoHash)\n })\n this.client.emit('scrape', response)\n })\n }\n\n _onSocketClose () {\n if (this.destroyed) return\n this.destroy()\n this._startReconnectTimer()\n }\n\n _onSocketError (err) {\n if (this.destroyed) return\n this.destroy()\n // errors will often happen if a tracker is offline, so don't treat it as fatal\n this.client.emit('warning', err)\n this._startReconnectTimer()\n }\n\n _startReconnectTimer () {\n const ms = Math.floor(Math.random() * RECONNECT_VARIANCE) + Math.min(Math.pow(2, this.retries) * RECONNECT_MINIMUM, RECONNECT_MAXIMUM)\n\n this.reconnecting = true\n clearTimeout(this.reconnectTimer)\n this.reconnectTimer = setTimeout(() => {\n this.retries++\n this._openSocket()\n }, ms)\n if (this.reconnectTimer.unref) this.reconnectTimer.unref()\n\n debug('reconnecting socket in %s ms', ms)\n }\n\n _send (params) {\n if (this.destroyed) return\n this.expectingResponse = true\n const message = JSON.stringify(params)\n debug('send %s', message)\n this.socket.send(message)\n }\n\n _generateOffers (numwant, cb) {\n const self = this\n const offers = []\n debug('generating %s offers', numwant)\n\n for (let i = 0; i < numwant; ++i) {\n generateOffer()\n }\n checkDone()\n\n function generateOffer () {\n const offerId = arr2hex(randomBytes(20))\n debug('creating peer (from _generateOffers)')\n const peer = self.peers[offerId] = self._createPeer({ initiator: true })\n peer.once('signal', offer => {\n offers.push({\n offer,\n offer_id: hex2bin(offerId)\n })\n checkDone()\n })\n peer.trackerTimeout = setTimeout(() => {\n debug('tracker timeout: destroying peer')\n peer.trackerTimeout = null\n delete self.peers[offerId]\n peer.destroy()\n }, OFFER_TIMEOUT)\n if (peer.trackerTimeout.unref) peer.trackerTimeout.unref()\n }\n\n function checkDone () {\n if (offers.length === numwant) {\n debug('generated %s offers', numwant)\n cb(offers)\n }\n }\n }\n\n _createPeer (opts) {\n const self = this\n\n opts = Object.assign({\n trickle: false,\n config: self.client._rtcConfig,\n wrtc: self.client._wrtc\n }, opts)\n\n const peer = new Peer(opts)\n\n peer.once('error', onError)\n peer.once('connect', onConnect)\n\n return peer\n\n // Handle peer 'error' events that are fired *before* the peer is emitted in\n // a 'peer' event.\n function onError (err) {\n self.client.emit('warning', new Error(`Connection error: ${err.message}`))\n peer.destroy()\n }\n\n // Once the peer is emitted in a 'peer' event, then it's the consumer's\n // responsibility to listen for errors, so the listeners are removed here.\n function onConnect () {\n peer.removeListener('error', onError)\n peer.removeListener('connect', onConnect)\n }\n }\n}\n\nWebSocketTracker.prototype.DEFAULT_ANNOUNCE_INTERVAL = 30 * 1000 // 30 seconds\n// Normally this shouldn't be accessed but is occasionally useful\nWebSocketTracker._socketPool = socketPool\n\nfunction noop () {}\n\nexport default WebSocketTracker\n","import Debug from 'debug'\nimport EventEmitter from 'events'\nimport once from 'once'\nimport parallel from 'run-parallel'\nimport Peer from '@thaunknown/simple-peer'\nimport queueMicrotask from 'queue-microtask'\nimport { hex2arr, hex2bin, text2arr, arr2hex, arr2text } from 'uint8-util'\n\nimport common from './lib/common.js'\nimport HTTPTracker from './lib/client/http-tracker.js' // empty object in browser\nimport UDPTracker from './lib/client/udp-tracker.js' // empty object in browser\nimport WebSocketTracker from './lib/client/websocket-tracker.js'\n\nconst debug = Debug('bittorrent-tracker:client')\n\n/**\n * BitTorrent tracker client.\n *\n * Find torrent peers, to help a torrent client participate in a torrent swarm.\n *\n * @param {Object} opts options object\n * @param {string|Uint8Array} opts.infoHash torrent info hash\n * @param {string|Uint8Array} opts.peerId peer id\n * @param {string|Array.<string>} opts.announce announce\n * @param {number} opts.port torrent client listening port\n * @param {function} opts.getAnnounceOpts callback to provide data to tracker\n * @param {number} opts.rtcConfig RTCPeerConnection configuration object\n * @param {number} opts.userAgent User-Agent header for http requests\n * @param {number} opts.wrtc custom webrtc impl (useful in node.js)\n * @param {object} opts.proxyOpts proxy options (useful in node.js)\n */\nclass Client extends EventEmitter {\n constructor (opts = {}) {\n super()\n\n if (!opts.peerId) throw new Error('Option `peerId` is required')\n if (!opts.infoHash) throw new Error('Option `infoHash` is required')\n if (!opts.announce) throw new Error('Option `announce` is required')\n if (!process.browser && !opts.port) throw new Error('Option `port` is required')\n\n this.peerId = typeof opts.peerId === 'string'\n ? opts.peerId\n : arr2hex(opts.peerId)\n this._peerIdBuffer = hex2arr(this.peerId)\n this._peerIdBinary = hex2bin(this.peerId)\n\n this.infoHash = typeof opts.infoHash === 'string'\n ? opts.infoHash.toLowerCase()\n : arr2hex(opts.infoHash)\n this._infoHashBuffer = hex2arr(this.infoHash)\n this._infoHashBinary = hex2bin(this.infoHash)\n\n debug('new client %s', this.infoHash)\n\n this.destroyed = false\n\n this._port = opts.port\n this._getAnnounceOpts = opts.getAnnounceOpts\n this._rtcConfig = opts.rtcConfig\n this._userAgent = opts.userAgent\n this._proxyOpts = opts.proxyOpts\n\n // Support lazy 'wrtc' module initialization\n // See: https://github.com/webtorrent/webtorrent-hybrid/issues/46\n this._wrtc = typeof opts.wrtc === 'function' ? opts.wrtc() : opts.wrtc\n\n let announce = typeof opts.announce === 'string'\n ? [opts.announce]\n : opts.announce == null ? [] : opts.announce\n\n // Remove trailing slash from trackers to catch duplicates\n announce = announce.map(announceUrl => {\n if (ArrayBuffer.isView(announceUrl)) announceUrl = arr2text(announceUrl)\n if (announceUrl[announceUrl.length - 1] === '/') {\n announceUrl = announceUrl.substring(0, announceUrl.length - 1)\n }\n return announceUrl\n })\n // remove duplicates by converting to Set and back\n announce = Array.from(new Set(announce))\n\n const webrtcSupport = this._wrtc !== false && (!!this._wrtc || Peer.WEBRTC_SUPPORT)\n\n const nextTickWarn = err => {\n queueMicrotask(() => {\n this.emit('warning', err)\n })\n }\n\n this._trackers = announce\n .map(announceUrl => {\n let parsedUrl\n try {\n parsedUrl = common.parseUrl(announceUrl)\n } catch (err) {\n nextTickWarn(new Error(`Invalid tracker URL: ${announceUrl}`))\n return null\n }\n\n const port = parsedUrl.port\n if (port < 0 || port > 65535) {\n nextTickWarn(new Error(`Invalid tracker port: ${announceUrl}`))\n return null\n }\n\n const protocol = parsedUrl.protocol\n if ((protocol === 'http:' || protocol === 'https:') &&\n typeof HTTPTracker === 'function') {\n return new HTTPTracker(this, announceUrl)\n } else if (protocol === 'udp:' && typeof UDPTracker === 'function') {\n return new UDPTracker(this, announceUrl)\n } else if ((protocol === 'ws:' || protocol === 'wss:') && webrtcSupport) {\n // Skip ws:// trackers on https:// sites because they throw SecurityError\n if (protocol === 'ws:' && typeof window !== 'undefined' &&\n window.location.protocol === 'https:') {\n nextTickWarn(new Error(`Unsupported tracker protocol: ${announceUrl}`))\n return null\n }\n return new WebSocketTracker(this, announceUrl)\n } else {\n nextTickWarn(new Error(`Unsupported tracker protocol: ${announceUrl}`))\n return null\n }\n })\n .filter(Boolean)\n }\n\n /**\n * Send a `start` announce to the trackers.\n * @param {Object} opts\n * @param {number=} opts.uploaded\n * @param {number=} opts.downloaded\n * @param {number=} opts.left (if not set, calculated automatically)\n */\n start (opts) {\n opts = this._defaultAnnounceOpts(opts)\n opts.event = 'started'\n debug('send `start` %o', opts)\n this._announce(opts)\n\n // start announcing on intervals\n this._trackers.forEach(tracker => {\n tracker.setInterval()\n })\n }\n\n /**\n * Send a `stop` announce to the trackers.\n * @param {Object} opts\n * @param {number=} opts.uploaded\n * @param {number=} opts.downloaded\n * @param {number=} opts.numwant\n * @param {number=} opts.left (if not set, calculated automatically)\n */\n stop (opts) {\n opts = this._defaultAnnounceOpts(opts)\n opts.event = 'stopped'\n debug('send `stop` %o', opts)\n this._announce(opts)\n }\n\n /**\n * Send a `complete` announce to the trackers.\n * @param {Object} opts\n * @param {number=} opts.uploaded\n * @param {number=} opts.downloaded\n * @param {number=} opts.numwant\n * @param {number=} opts.left (if not set, calculated automatically)\n */\n complete (opts) {\n if (!opts) opts = {}\n opts = this._defaultAnnounceOpts(opts)\n opts.event = 'completed'\n debug('send `complete` %o', opts)\n this._announce(opts)\n }\n\n /**\n * Send a `update` announce to the trackers.\n * @param {Object} opts\n * @param {number=} opts.uploaded\n * @param {number=} opts.downloaded\n * @param {number=} opts.numwant\n * @param {number=} opts.left (if not set, calculated automatically)\n */\n update (opts) {\n opts = this._defaultAnnounceOpts(opts)\n if (opts.event) delete opts.event\n debug('send `update` %o', opts)\n this._announce(opts)\n }\n\n _announce (opts) {\n this._trackers.forEach(tracker => {\n // tracker should not modify `opts` object, it's passed to all trackers\n tracker.announce(opts)\n })\n }\n\n /**\n * Send a scrape request to the trackers.\n * @param {Object} opts\n */\n scrape (opts) {\n debug('send `scrape`')\n if (!opts) opts = {}\n this._trackers.forEach(tracker => {\n // tracker should not modify `opts` object, it's passed to all trackers\n tracker.scrape(opts)\n })\n }\n\n setInterval (intervalMs) {\n debug('setInterval %d', intervalMs)\n this._trackers.forEach(tracker => {\n tracker.setInterval(intervalMs)\n })\n }\n\n destroy (cb) {\n if (this.destroyed) return\n this.destroyed = true\n debug('destroy')\n\n const tasks = this._trackers.map(tracker => cb => {\n tracker.destroy(cb)\n })\n\n parallel(tasks, cb)\n\n this._trackers = []\n this._getAnnounceOpts = null\n }\n\n _defaultAnnounceOpts (opts = {}) {\n if (opts.numwant == null) opts.numwant = common.DEFAULT_ANNOUNCE_PEERS\n\n if (opts.uploaded == null) opts.uploaded = 0\n if (opts.downloaded == null) opts.downloaded = 0\n\n if (this._getAnnounceOpts) opts = Object.assign({}, opts, this._getAnnounceOpts())\n\n return opts\n }\n}\n\n/**\n * Simple convenience function to scrape a tracker for an info hash without needing to\n * create a Client, pass it a parsed torrent, etc. Support scraping a tracker for multiple\n * torrents at the same time.\n * @params {Object} opts\n * @param {string|Array.<string>} opts.infoHash\n * @param {string} opts.announce\n * @param {function} cb\n */\nClient.scrape = (opts, cb) => {\n cb = once(cb)\n\n if (!opts.infoHash) throw new Error('Option `infoHash` is required')\n if (!opts.announce) throw new Error('Option `announce` is required')\n\n const clientOpts = Object.assign({}, opts, {\n infoHash: Array.isArray(opts.infoHash) ? opts.infoHash[0] : opts.infoHash,\n peerId: text2arr('01234567890123456789'), // dummy value\n port: 6881 // dummy value\n })\n\n const client = new Client(clientOpts)\n client.once('error', cb)\n client.once('warning', cb)\n\n let len = Array.isArray(opts.infoHash) ? opts.infoHash.length : 1\n const results = {}\n client.on('scrape', data => {\n len -= 1\n results[data.infoHash] = data\n if (len === 0) {\n client.destroy()\n const keys = Object.keys(results)\n if (keys.length === 1) {\n cb(null, results[keys[0]])\n } else {\n cb(null, results)\n }\n }\n })\n\n client.scrape({ infoHash: opts.infoHash })\n return client\n}\n\nexport default Client\n","/*! torrent-discovery. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */\nimport Debug from 'debug'\nimport { Client as DHT } from 'bittorrent-dht' // empty object in browser\nimport { EventEmitter } from 'events'\nimport parallel from 'run-parallel'\nimport { Client as Tracker } from 'bittorrent-tracker'\nimport LSD from 'bittorrent-lsd'\n\nconst debug = Debug('torrent-discovery')\n\nclass Discovery extends EventEmitter {\n constructor (opts) {\n super()\n\n if (!opts.peerId) throw new Error('Option `peerId` is required')\n if (!opts.infoHash) throw new Error('Option `infoHash` is required')\n if (!process.browser && !opts.port) throw new Error('Option `port` is required')\n\n this.peerId = typeof opts.peerId === 'string'\n ? opts.peerId\n : opts.peerId.toString('hex')\n this.infoHash = typeof opts.infoHash === 'string'\n ? opts.infoHash.toLowerCase()\n : opts.infoHash.toString('hex')\n this._port = opts.port // torrent port\n this._userAgent = opts.userAgent // User-Agent header for http requests\n\n this.destroyed = false\n\n this._announce = opts.announce || []\n this._intervalMs = opts.intervalMs || (15 * 60 * 1000)\n this._trackerOpts = null\n this._dhtAnnouncing = false\n this._dhtTimeout = false\n this._internalDHT = false // is the DHT created internally?\n\n this._onWarning = err => {\n this.emit('warning', err)\n }\n this._onError = err => {\n this.emit('error', err)\n }\n this._onDHTPeer = (peer, infoHash) => {\n if (infoHash.toString('hex') !== this.infoHash) return\n this.emit('peer', `${peer.host}:${peer.port}`, 'dht')\n }\n this._onTrackerPeer = peer => {\n this.emit('peer', peer, 'tracker')\n }\n this._onTrackerAnnounce = () => {\n this.emit('trackerAnnounce')\n }\n this._onLSDPeer = (peer, infoHash) => {\n this.emit('peer', peer, 'lsd')\n }\n\n const createDHT = (port, opts) => {\n const dht = new DHT(opts)\n dht.on('warning', this._onWarning)\n dht.on('error', this._onError)\n dht.listen(port)\n this._internalDHT = true\n return dht\n }\n\n if (opts.tracker === false) {\n this.tracker = null\n } else if (opts.tracker && typeof opts.tracker === 'object') {\n this._trackerOpts = Object.assign({}, opts.tracker)\n this.tracker = this._createTracker()\n } else {\n this.tracker = this._createTracker()\n }\n\n if (opts.dht === false || typeof DHT !== 'function') {\n this.dht = null\n } else if (opts.dht && typeof opts.dht.addNode === 'function') {\n this.dht = opts.dht\n } else if (opts.dht && typeof opts.dht === 'object') {\n this.dht = createDHT(opts.dhtPort, opts.dht)\n } else {\n this.dht = createDHT(opts.dhtPort)\n }\n\n if (this.dht) {\n this.dht.on('peer', this._onDHTPeer)\n this._dhtAnnounce()\n }\n\n if (opts.lsd === false || typeof LSD !== 'function') {\n this.lsd = null\n } else {\n this.lsd = this._createLSD()\n }\n }\n\n updatePort (port) {\n if (port === this._port) return\n this._port = port\n\n if (this.dht) this._dhtAnnounce()\n\n if (this.tracker) {\n this.tracker.stop()\n this.tracker.destroy(() => {\n this.tracker = this._createTracker()\n })\n }\n }\n\n complete (opts) {\n if (this.tracker) {\n this.tracker.complete(opts)\n }\n }\n\n destroy (cb) {\n if (this.destroyed) return\n this.destroyed = true\n\n clearTimeout(this._dhtTimeout)\n\n const tasks = []\n\n if (this.tracker) {\n this.tracker.stop()\n this.tracker.removeListener('warning', this._onWarning)\n this.tracker.removeListener('error', this._onError)\n this.tracker.removeListener('peer', this._onTrackerPeer)\n this.tracker.removeListener('update', this._onTrackerAnnounce)\n tasks.push(cb => {\n this.tracker.destroy(cb)\n })\n }\n\n if (this.dht) {\n this.dht.removeListener('peer', this._onDHTPeer)\n }\n\n if (this._internalDHT) {\n this.dht.removeListener('warning', this._onWarning)\n this.dht.removeListener('error', this._onError)\n tasks.push(cb => {\n this.dht.destroy(cb)\n })\n }\n\n if (this.lsd) {\n this.lsd.removeListener('warning', this._onWarning)\n this.lsd.removeListener('error', this._onError)\n this.lsd.removeListener('peer', this._onLSDPeer)\n tasks.push(cb => {\n this.lsd.destroy(cb)\n })\n }\n\n parallel(tasks, cb)\n\n // cleanup\n this.dht = null\n this.tracker = null\n this.lsd = null\n this._announce = null\n }\n\n _createTracker () {\n const opts = Object.assign({}, this._trackerOpts, {\n infoHash: this.infoHash,\n announce: this._announce,\n peerId: this.peerId,\n port: this._port,\n userAgent: this._userAgent\n })\n\n const tracker = new Tracker(opts)\n tracker.on('warning', this._onWarning)\n tracker.on('error', this._onError)\n tracker.on('peer', this._onTrackerPeer)\n tracker.on('update', this._onTrackerAnnounce)\n tracker.setInterval(this._intervalMs)\n tracker.start()\n return tracker\n }\n\n _dhtAnnounce () {\n if (this._dhtAnnouncing) return\n debug('dht announce')\n\n this._dhtAnnouncing = true\n clearTimeout(this._dhtTimeout)\n\n this.dht.announce(this.infoHash, this._port, err => {\n this._dhtAnnouncing = false\n debug('dht announce complete')\n\n if (err) this.emit('warning', err)\n this.emit('dhtAnnounce')\n\n if (!this.destroyed) {\n this._dhtTimeout = setTimeout(() => {\n this._dhtAnnounce()\n }, this._intervalMs + Math.floor(Math.random() * this._intervalMs / 5))\n if (this._dhtTimeout.unref) this._dhtTimeout.unref()\n }\n })\n }\n\n _createLSD () {\n const opts = Object.assign({}, {\n infoHash: this.infoHash,\n peerId: this.peerId,\n port: this._port\n })\n\n const lsd = new LSD(opts)\n lsd.on('warning', this._onWarning)\n lsd.on('error', this._onError)\n lsd.on('peer', this._onLSDPeer)\n lsd.start()\n return lsd\n }\n}\n\nexport default Discovery\n","// this can be bad when multiple instances of this app are running\r\nif (typeof navigator !== 'undefined' && navigator.storage?.getDirectory) {\r\n navigator.storage.getDirectory().then(storageDir => {\r\n storageDir.removeEntry('chunks', { recursive: true })\r\n })\r\n}\r\n\r\nconst noop = () => {}\r\nconst err = (cb = noop, err) => queueMicrotask(() => cb(new Error(err)))\r\nexport default class FSAChunkStore {\r\n constructor (chunkLength, opts = {}) {\r\n this.chunkLength = Number(chunkLength)\r\n\r\n if (!this.chunkLength) {\r\n throw new Error('First argument must be a chunk length')\r\n }\r\n\r\n if (typeof navigator === 'undefined' || !navigator.storage?.getDirectory) {\r\n throw new Error('FSA API is not supported')\r\n }\r\n\r\n this.closed = false\r\n\r\n this.name = opts.name || crypto.randomUUID()\r\n\r\n this.chunks = [] // individual chunks, required for reads :/\r\n\r\n this.rootDirPromise = opts.rootDir || navigator.storage.getDirectory()\r\n this.storageDirPromise = (async () => {\r\n const rootDir = await this.rootDirPromise\r\n return rootDir.getDirectoryHandle(this.name, { create: true })\r\n })()\r\n // if there are no files the chunks are the storage\r\n this.chunksDirPromise = this.storageDirPromise\r\n\r\n if (opts.files && opts.rootDir) {\r\n this.chunkMap = [] // full files\r\n this.directoryMap = {}\r\n // if files exist, use throwaway, wipeable folder for chunks which are a cache\r\n this.chunksDirPromise = this._getChunksDirHandle()\r\n this.files = opts.files.map((file, i, files) => {\r\n if (file.path == null) throw new Error('File is missing `path` property')\r\n if (file.length == null) throw new Error('File is missing `length` property')\r\n if (file.offset == null) {\r\n if (i === 0) {\r\n file.offset = 0\r\n } else {\r\n const prevFile = files[i - 1]\r\n file.offset = prevFile.offset + prevFile.length\r\n }\r\n }\r\n\r\n // file handles\r\n if (file.handle == null) file.handle = this._createFileHandle({ path: file.path })\r\n file.blob = this._createBlobReference(file.handle)\r\n\r\n // file chunkMap\r\n const fileStart = file.offset\r\n const fileEnd = file.offset + file.length\r\n\r\n const firstChunk = Math.floor(fileStart / this.chunkLength)\r\n const lastChunk = Math.floor((fileEnd - 1) / this.chunkLength)\r\n\r\n for (let i = firstChunk; i <= lastChunk; ++i) {\r\n const chunkStart = i * this.chunkLength\r\n const chunkEnd = chunkStart + this.chunkLength\r\n\r\n const from = (fileStart < chunkStart) ? 0 : fileStart - chunkStart\r\n const to = (fileEnd > chunkEnd) ? this.chunkLength : fileEnd - chunkStart\r\n const offset = (fileStart > chunkStart) ? 0 : chunkStart - fileStart\r\n\r\n if (!this.chunkMap[i]) this.chunkMap[i] = []\r\n\r\n this.chunkMap[i].push({ from, to, offset, file })\r\n }\r\n\r\n return file\r\n })\r\n\r\n // close streams is page is frozen/unloaded, they will re-open if the user returns via BFC\r\n window.addEventListener('pagehide', () => this.cleanup())\r\n\r\n this.length = this.files.reduce((sum, file) => sum + file.length, 0)\r\n if (opts.length != null && opts.length !== this.length) {\r\n throw new Error('total `files` length is not equal to explicit `length` option')\r\n }\r\n } else {\r\n this.length = Number(opts.length) || Infinity\r\n }\r\n\r\n if (this.length !== Infinity) {\r\n this.lastChunkLength = this.length % this.chunkLength || this.chunkLength\r\n this.lastChunkIndex = Math.ceil(this.length / this.chunkLength) - 1\r\n }\r\n }\r\n\r\n async _getChunkHandle (index) {\r\n let chunk = this.chunks[index]\r\n if (!chunk) {\r\n const storageDir = await this.chunksDirPromise\r\n this.chunks[index] = chunk = await storageDir.getFileHandle(index, { create: true })\r\n }\r\n return chunk\r\n }\r\n\r\n async _createFileHandle (opts) {\r\n const fileName = opts.path.slice(opts.path.lastIndexOf('/') + 1)\r\n return (await this._getDirectoryHandle(opts)).getFileHandle(fileName, { create: true })\r\n }\r\n\r\n async _createBlobReference (handle) {\r\n return (await handle).getFile()\r\n }\r\n\r\n // recursive, equiv of cd and mkdirp\r\n async _getDirectoryHandle (opts) {\r\n const lastIndex = opts.path.lastIndexOf('/')\r\n if (lastIndex === -1 || lastIndex === 0) return this.storageDirPromise\r\n const path = opts.path = opts.path.slice(0, lastIndex)\r\n if (!this.directoryMap[path]) {\r\n this.directoryMap[path] = (async () => {\r\n const parent = await this._getDirectoryHandle(opts)\r\n return parent.getDirectoryHandle(path.slice(path.lastIndexOf('/') + 1), { create: true })\r\n })()\r\n }\r\n return this.directoryMap[path]\r\n }\r\n\r\n async _getChunksDirHandle () {\r\n const storageDir = await navigator.storage.getDirectory()\r\n const chunksDir = await storageDir.getDirectoryHandle('chunks', { create: true })\r\n return chunksDir.getDirectoryHandle(this.name, { create: true })\r\n }\r\n\r\n async put (index, buf, cb = noop) {\r\n try {\r\n await this._put(index, buf)\r\n cb(null)\r\n return null\r\n } catch (e) {\r\n queueMicrotask(() => cb(e))\r\n return e\r\n }\r\n }\r\n\r\n // wrapped in prep for callback drop\r\n async _put (index, buf) {\r\n if (this.closed) throw new Error('Storage is closed')\r\n\r\n const isLastChunk = index === this.lastChunkIndex\r\n if (isLastChunk && buf.length !== this.lastChunkLength) throw new Error(`Last chunk length must be ${this.lastChunkLength}`)\r\n if (!isLastChunk && buf.length !== this.chunkLength) throw new Error(`Chunk length must be ${this.chunkLength}`)\r\n\r\n const chunkWrite = (async () => {\r\n const chunk = await this._getChunkHandle(index)\r\n const stream = await chunk.createWritable({ keepExistingData: false })\r\n await stream.write(buf)\r\n await stream.close()\r\n })()\r\n\r\n if (!this.files) return chunkWrite\r\n\r\n const targets = this.chunkMap[index]\r\n if (!targets) throw new Error('No files matching the request range')\r\n const promises = targets.map(async ({ file, offset, from, to }) => {\r\n if (!file.stream) {\r\n file.stream = await (await file.handle).createWritable({\r\n keepExistingData: true\r\n })\r\n }\r\n await file.stream.write({ type: 'write', position: offset, data: buf.slice(from, to) })\r\n })\r\n promises.push(chunkWrite)\r\n await Promise.all(promises)\r\n }\r\n\r\n async get (index, opts, cb = noop) {\r\n if (opts == null) opts = {}\r\n try {\r\n const data = await this._get(index, opts)\r\n cb(null, data)\r\n return data\r\n } catch (e) {\r\n cb(e)\r\n return e\r\n }\r\n }\r\n\r\n // wrapped in prep for callback drop\r\n async _get (index, opts) {\r\n if (typeof opts === 'function') return this.get(index, undefined, opts)\r\n if (this.closed) throw new Error('Storage is closed')\r\n\r\n const isLastChunk = index === this.lastChunkIndex\r\n const chunkLength = isLastChunk ? this.lastChunkLength : this.chunkLength\r\n\r\n const rangeFrom = opts.offset || 0\r\n const rangeTo = opts.length ? rangeFrom + opts.length : chunkLength\r\n const len = opts.length || chunkLength - rangeFrom\r\n\r\n if (rangeFrom < 0 || rangeFrom < 0 || rangeTo > chunkLength) throw new Error('Invalid offset and/or length')\r\n\r\n if (rangeFrom === rangeTo) return new Uint8Array(0)\r\n\r\n if (!this.files || this.chunks[index]) {\r\n const chunk = await this._getChunkHandle(index)\r\n let file = await chunk.getFile()\r\n if (rangeFrom !== 0 || len !== chunkLength) {\r\n file = file.slice(rangeFrom, len + rangeFrom)\r\n }\r\n const buf = await file.arrayBuffer()\r\n\r\n if (buf.byteLength === 0) throw new Error(`Index ${index} does not exist`)\r\n return new Uint8Array(buf)\r\n }\r\n\r\n // if chunk was GC'ed\r\n let targets = this.chunkMap[index]\r\n if (!targets) throw new Error('No files matching the request range')\r\n if (opts) {\r\n targets = targets.filter(({ from, to }) => to > rangeFrom && from < rangeTo)\r\n if (targets.length === 0) throw new Error('No files matching the request range')\r\n }\r\n\r\n const promises = targets.map(async ({ from, to, offset, file }) => {\r\n if (opts) {\r\n if (to > rangeTo) to = rangeTo\r\n if (from < rangeFrom) {\r\n offset += (rangeFrom - from)\r\n from = rangeFrom\r\n }\r\n }\r\n const blob = await file.blob\r\n return blob.slice(offset, offset + to - from)\r\n })\r\n const values = await Promise.all(promises)\r\n const buf = values.length === 1 ? await values[0].arrayBuffer() : await new Blob(values).arrayBuffer()\r\n if (buf.byteLength === 0) throw new Error(`Index ${index} does not exist`)\r\n return new Uint8Array(buf)\r\n }\r\n\r\n async close (cb = noop) {\r\n if (this.closed) return err(cb, 'Storage is closed')\r\n\r\n this.closed = true\r\n this.chunkMap = null\r\n this.directoryMap = null\r\n if (this.files) await this.cleanup()\r\n queueMicrotask(() => cb(null))\r\n }\r\n\r\n async cleanup () {\r\n const streams = []\r\n for (const file of this.files) {\r\n if (file.stream) {\r\n streams.push(file.stream.close())\r\n file.stream = null\r\n }\r\n }\r\n const clearChunks = (async () => {\r\n const storageDir = await this.chunksDirPromise\r\n this.chunks = []\r\n for await (const key of storageDir.keys()) {\r\n await storageDir.removeEntry(key, { recursive: true })\r\n }\r\n this.chunksDirPromise = await this._getChunksDirHandle()\r\n })()\r\n await Promise.all(streams)\r\n for (const file of this.files) {\r\n file.blob = this._createBlobReference(file.handle)\r\n }\r\n await clearChunks\r\n }\r\n\r\n async destroy (cb = noop) {\r\n this.close(async (err) => {\r\n if (err) {\r\n cb(err)\r\n return\r\n }\r\n try {\r\n const rootDir = await this.rootDirPromise\r\n await rootDir.removeEntry(this.name, { recursive: true })\r\n } catch (err) {\r\n cb(err)\r\n return\r\n }\r\n cb(null)\r\n })\r\n }\r\n}\r\n","import FSAccessChunkStore from 'fsa-chunk-store'\r\nimport IDBChunkStore from 'idb-chunk-store'\r\nimport MemoryChunkStore from 'memory-chunk-store'\r\nimport CacheChunkStore from 'cache-chunk-store'\r\n\r\nconst isChrome = !!((typeof globalThis !== 'undefined' && globalThis) || (typeof self !== 'undefined' && self) || (typeof window !== 'undefined' && window) || (typeof global !== 'undefined' && global)).chrome\r\n\r\nconst limit = isChrome ? Infinity : 2147483648 - 16777216 // 2GB - 16MB\r\n\r\nconst FSASupport = typeof navigator !== 'undefined' && navigator.storage?.getDirectory && FileSystemFileHandle?.prototype?.createWritable\r\n\r\nconst noop = () => {}\r\n\r\nexport default class HybridChunkStore {\r\n constructor (chunkLength, opts = {}) {\r\n this.chunkLength = Number(chunkLength)\r\n if (!this.chunkLength) throw new Error('First argument must be a chunk length')\r\n\r\n this.length = Number(opts.length) || Infinity\r\n\r\n this.limit = opts.limit || limit\r\n this.fallbackStore = null\r\n this.dataStore = null\r\n this.chunkCount = 0\r\n this.stores = []\r\n\r\n this._init(opts)\r\n if (this.dataStore) {\r\n if (opts.max > 0) this.dataStore = new CacheChunkStore(this.dataStore, { max: opts.max })\r\n this.stores.push(this.dataStore)\r\n }\r\n this.stores.push(this.fallbackStore)\r\n\r\n // check if chunk stores have asyncIterators\r\n\r\n // if (this.stores.every(store => !!store[Symbol.asyncIterator])) {\r\n // this[Symbol.asyncIterator] = joinIterator(this.stores)\r\n // }\r\n }\r\n\r\n _init (opts) {\r\n if (opts.onlyMem || this.limit < this.chunkLength) {\r\n this.fallbackStore = new MemoryChunkStore(this.chunkLength, opts)\r\n return\r\n }\r\n const ChunkStore = FSASupport ? FSAccessChunkStore : IDBChunkStore\r\n if (this.limit >= this.length) {\r\n this.fallbackStore = new ChunkStore(this.chunkLength, opts)\r\n return\r\n }\r\n\r\n this.chunkCount = Math.floor(Math.min(this.length, this.limit) / this.chunkLength)\r\n const length = this.chunkCount * this.chunkLength\r\n const remaining = this.length - length\r\n this.dataStore = new ChunkStore(this.chunkLength, { ...opts, length })\r\n this.fallbackStore = new MemoryChunkStore(this.chunkLength, { ...opts, length: remaining })\r\n }\r\n\r\n get (index, opts, cb) {\r\n if (index >= this.chunkCount) {\r\n this.fallbackStore.get(index - this.chunkCount, opts, cb)\r\n } else {\r\n this.dataStore.get(index, opts, cb)\r\n }\r\n }\r\n\r\n put (index, buf, cb) {\r\n if (index >= this.chunkCount) {\r\n this.fallbackStore.put(index - this.chunkCount, buf, cb)\r\n } else {\r\n this.dataStore.put(index, buf, cb)\r\n }\r\n }\r\n\r\n close (cb = noop) {\r\n Promise.all(this.stores.map(store => new Promise(resolve => store.close(resolve)))).then(values => {\r\n const err = values.find(value => value)\r\n cb(err)\r\n })\r\n }\r\n\r\n destroy (cb = noop) {\r\n Promise.all(this.stores.map(store => new Promise(resolve => store.destroy(resolve)))).then(values => {\r\n const err = values.find(value => value)\r\n cb(err)\r\n })\r\n }\r\n}\r\n","/*! ut_metadata. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */\nimport { EventEmitter } from 'events'\nimport bencode from 'bencode'\nimport BitField from 'bitfield'\nimport Debug from 'debug'\nimport { hash, arr2text, concat } from 'uint8-util'\n\nconst debug = Debug('ut_metadata')\n\nconst MAX_METADATA_SIZE = 1E7 // 10 MB\nconst BITFIELD_GROW = 1E3\nconst PIECE_LENGTH = 1 << 14 // 16 KiB\n\nexport default metadata => {\n class utMetadata extends EventEmitter {\n constructor (wire) {\n super()\n\n this._wire = wire\n\n this._fetching = false\n this._metadataComplete = false\n this._metadataSize = null\n // how many reject messages to tolerate before quitting\n this._remainingRejects = null\n\n // The largest torrent file that I know of is ~1-2MB, which is ~100\n // pieces. Therefore, cap the bitfield to 10x that (1000 pieces) so a\n // malicious peer can't make it grow to fill all memory.\n this._bitfield = new BitField(0, { grow: BITFIELD_GROW })\n\n if (ArrayBuffer.isView(metadata)) {\n this.setMetadata(metadata)\n }\n }\n\n onHandshake (infoHash, peerId, extensions) {\n this._infoHash = infoHash\n }\n\n onExtendedHandshake (handshake) {\n if (!handshake.m || !handshake.m.ut_metadata) {\n return this.emit('warning', new Error('Peer does not support ut_metadata'))\n }\n if (!handshake.metadata_size) {\n return this.emit('warning', new Error('Peer does not have metadata'))\n }\n if (typeof handshake.metadata_size !== 'number' ||\n MAX_METADATA_SIZE < handshake.metadata_size ||\n handshake.metadata_size <= 0) {\n return this.emit('warning', new Error('Peer gave invalid metadata size'))\n }\n\n this._metadataSize = handshake.metadata_size\n this._numPieces = Math.ceil(this._metadataSize / PIECE_LENGTH)\n this._remainingRejects = this._numPieces * 2\n\n this._requestPieces()\n }\n\n onMessage (buf) {\n let dict\n let trailer\n try {\n const str = arr2text(buf)\n const trailerIndex = str.indexOf('ee') + 2\n dict = bencode.decode(str.substring(0, trailerIndex))\n trailer = buf.slice(trailerIndex)\n } catch (err) {\n // drop invalid messages\n return\n }\n\n switch (dict.msg_type) {\n case 0:\n // ut_metadata request (from peer)\n // example: { 'msg_type': 0, 'piece': 0 }\n this._onRequest(dict.piece)\n break\n case 1:\n // ut_metadata data (in response to our request)\n // example: { 'msg_type': 1, 'piece': 0, 'total_size': 3425 }\n this._onData(dict.piece, trailer, dict.total_size)\n break\n case 2:\n // ut_metadata reject (peer doesn't have piece we requested)\n // { 'msg_type': 2, 'piece': 0 }\n this._onReject(dict.piece)\n break\n }\n }\n\n /**\n * Ask the peer to send metadata.\n * @public\n */\n fetch () {\n if (this._metadataComplete) {\n return\n }\n this._fetching = true\n if (this._metadataSize) {\n this._requestPieces()\n }\n }\n\n /**\n * Stop asking the peer to send metadata.\n * @public\n */\n cancel () {\n this._fetching = false\n }\n\n async setMetadata (metadata) {\n if (this._metadataComplete) return true\n debug('set metadata')\n\n // if full torrent dictionary was passed in, pull out just `info` key\n try {\n const info = bencode.decode(metadata).info\n if (info) {\n metadata = bencode.encode(info)\n }\n } catch (err) {}\n\n // check hash\n if (this._infoHash && this._infoHash !== await hash(metadata, 'hex')) {\n return false\n }\n\n this.cancel()\n\n this.metadata = metadata\n this._metadataComplete = true\n this._metadataSize = this.metadata.length\n this._wire.extendedHandshake.metadata_size = this._metadataSize\n\n this.emit('metadata', bencode.encode({\n info: bencode.decode(this.metadata)\n }))\n\n return true\n }\n\n _send (dict, trailer) {\n let buf = bencode.encode(dict)\n if (ArrayBuffer.isView(trailer)) {\n buf = concat([buf, trailer])\n }\n this._wire.extended('ut_metadata', buf)\n }\n\n _request (piece) {\n this._send({ msg_type: 0, piece })\n }\n\n _data (piece, buf, totalSize) {\n const msg = { msg_type: 1, piece }\n if (typeof totalSize === 'number') {\n msg.total_size = totalSize\n }\n this._send(msg, buf)\n }\n\n _reject (piece) {\n this._send({ msg_type: 2, piece })\n }\n\n _onRequest (piece) {\n if (!this._metadataComplete) {\n this._reject(piece)\n return\n }\n const start = piece * PIECE_LENGTH\n let end = start + PIECE_LENGTH\n if (end > this._metadataSize) {\n end = this._metadataSize\n }\n const buf = this.metadata.slice(start, end)\n this._data(piece, buf, this._metadataSize)\n }\n\n _onData (piece, buf, totalSize) {\n if (buf.length > PIECE_LENGTH || !this._fetching) {\n return\n }\n this.metadata.set(buf, piece * PIECE_LENGTH)\n this._bitfield.set(piece)\n this._checkDone()\n }\n\n _onReject (piece) {\n if (this._remainingRejects > 0 && this._fetching) {\n // If we haven't been rejected too much,\n // then try to request the piece again\n this._request(piece)\n this._remainingRejects -= 1\n } else {\n this.emit('warning', new Error('Peer sent \"reject\" too much'))\n }\n }\n\n _requestPieces () {\n if (!this._fetching) return\n this.metadata = new Uint8Array(this._metadataSize)\n for (let piece = 0; piece < this._numPieces; piece++) {\n this._request(piece)\n }\n }\n\n async _checkDone () {\n let done = true\n for (let piece = 0; piece < this._numPieces; piece++) {\n if (!this._bitfield.get(piece)) {\n done = false\n break\n }\n }\n if (!done) return\n\n // attempt to set metadata -- may fail sha1 check\n const success = await this.setMetadata(this.metadata)\n\n if (!success) {\n this._failedMetadata()\n }\n }\n\n _failedMetadata () {\n // reset bitfield & try again\n this._bitfield = new BitField(0, { grow: BITFIELD_GROW })\n this._remainingRejects -= this._numPieces\n if (this._remainingRejects > 0) {\n this._requestPieces()\n } else {\n this.emit('warning', new Error('Peer sent invalid metadata'))\n }\n }\n }\n\n // Name of the bittorrent-protocol extension\n utMetadata.prototype.name = 'ut_metadata'\n\n return utMetadata\n}\n","import debugFactory from 'debug'\nimport EventEmitter from 'events'\n\nconst debug = debugFactory('webtorrent:file-iterator')\n\n/**\n * Async iterator of a torrent file\n *\n * @param {File} file\n * @param {Object} opts\n * @param {number} opts.start iterator slice of file, starting from this byte (inclusive)\n * @param {number} opts.end iterator slice of file, ending with this byte (inclusive)\n */\nexport default class FileIterator extends EventEmitter {\n constructor (file, { start, end }) {\n super()\n\n this._torrent = file._torrent\n\n this._pieceLength = file._torrent.pieceLength\n\n this._startPiece = (start + file.offset) / this._pieceLength | 0\n this._endPiece = (end + file.offset) / this._pieceLength | 0\n\n this._piece = this._startPiece\n this._offset = (start + file.offset) - (this._startPiece * this._pieceLength)\n\n this._missing = end - start + 1\n this._criticalLength = Math.min((1024 * 1024 / this._pieceLength) | 0, 2)\n\n this._torrent.select(this._startPiece, this._endPiece, true, () => {\n this.emit('_notify')\n })\n this.destroyed = false\n }\n\n [Symbol.asyncIterator] () {\n return this\n }\n\n next () {\n return new Promise((resolve, reject) => {\n if (this._missing === 0 || this.destroyed) {\n resolve({ done: true })\n return this.destroy()\n }\n const pump = (index, opts) => {\n if (!this._torrent.bitfield.get(index)) {\n this._torrent.critical(index, index + this._criticalLength)\n const listener = () => {\n if (this._torrent.bitfield.get(index)) {\n this.removeListener('_notify', listener)\n pump(index, opts)\n }\n }\n return this.on('_notify', listener)\n }\n\n if (this._torrent.destroyed) return reject(new Error('Torrent removed'))\n\n this._torrent.store.get(index, opts, (err, buffer) => {\n if (this.destroyed) return resolve({ done: true }) // prevent hanging\n debug('read %s and yielding (length %s) (err %s)', index, buffer?.length, err?.message)\n\n if (err) return reject(err)\n\n // prevent re-wrapping outside of promise\n resolve({ value: buffer, done: false })\n })\n }\n\n const length = Math.min(this._missing, this._pieceLength - this._offset)\n\n pump(this._piece++, { length, offset: this._offset })\n this._missing -= length\n this._offset = 0\n })\n }\n\n async return () {\n this.destroy()\n const { value } = await this.next()\n return { done: true, value }\n }\n\n async throw (err) {\n throw err\n }\n\n destroy (cb = () => {}, err) {\n if (this.destroyed) return\n this.destroyed = true\n if (!this._torrent.destroyed) {\n this._torrent.deselect(this._startPiece, this._endPiece, true)\n }\n this.emit('return')\n cb(err)\n }\n}\n","import EventEmitter from 'events'\nimport { Readable } from 'streamx'\nimport { chunkStoreRead } from 'chunk-store-iterator'\nimport mime from 'mime/lite.js'\nimport FileIterator from './file-iterator.js'\n\nexport default class File extends EventEmitter {\n constructor (torrent, file) {\n super()\n\n this._torrent = torrent\n this._destroyed = false\n this._fileStreams = new Set()\n this._iterators = new Set()\n\n this.name = file.name\n this.path = file.path\n this.length = file.length\n this.size = file.length\n this.type = mime.getType(this.name) || 'application/octet-stream'\n this.offset = file.offset\n\n this.done = false\n\n const start = file.offset\n const end = start + file.length - 1\n\n this._startPiece = start / this._torrent.pieceLength | 0\n this._endPiece = end / this._torrent.pieceLength | 0\n\n if (this.length === 0) {\n this.done = true\n this.emit('done')\n }\n\n this._client = torrent.client\n }\n\n get downloaded () {\n if (this._destroyed || !this._torrent.bitfield) return 0\n\n const { pieces, bitfield, pieceLength, lastPieceLength } = this._torrent\n const { _startPiece: start, _endPiece: end } = this\n\n const getPieceLength = (pieceIndex) => (\n pieceIndex === pieces.length - 1 ? lastPieceLength : pieceLength\n )\n\n const getPieceDownloaded = (pieceIndex) => {\n const len = pieceIndex === pieces.length - 1 ? lastPieceLength : pieceLength\n if (bitfield.get(pieceIndex)) {\n // verified data\n return len\n } else {\n // \"in progress\" data\n return len - pieces[pieceIndex].missing\n }\n }\n\n let downloaded = 0\n for (let index = start; index <= end; index += 1) {\n const pieceDownloaded = getPieceDownloaded(index)\n downloaded += pieceDownloaded\n\n if (index === start) {\n // First piece may have an offset, e.g. irrelevant bytes from the end of\n // the previous file\n const irrelevantFirstPieceBytes = this.offset % pieceLength\n downloaded -= Math.min(irrelevantFirstPieceBytes, pieceDownloaded)\n }\n\n if (index === end) {\n // Last piece may have an offset, e.g. irrelevant bytes from the start\n // of the next file\n const irrelevantLastPieceBytes = getPieceLength(end) - (this.offset + this.length) % pieceLength\n downloaded -= Math.min(irrelevantLastPieceBytes, pieceDownloaded)\n }\n }\n\n return downloaded\n }\n\n get progress () {\n return this.length ? this.downloaded / this.length : 0\n }\n\n select (priority) {\n if (this.length === 0) return\n this._torrent.select(this._startPiece, this._endPiece, priority)\n }\n\n deselect () {\n if (this.length === 0) return\n this._torrent.deselect(this._startPiece, this._endPiece, false)\n }\n\n [Symbol.asyncIterator] (opts = {}) {\n if (this.length === 0) return (async function * empty () {})()\n\n const { start = 0 } = opts ?? {}\n const end = (opts?.end && opts.end < this.length)\n ? opts.end\n : this.length - 1\n\n if (this.done) {\n return chunkStoreRead(this._torrent.store, { offset: start + this.offset, length: end - start + 1 })\n }\n\n const iterator = new FileIterator(this, { start, end })\n this._iterators.add(iterator)\n iterator.once('return', () => {\n this._iterators.delete(iterator)\n })\n\n return iterator\n }\n\n createReadStream (opts) {\n const iterator = this[Symbol.asyncIterator](opts)\n const fileStream = Readable.from(iterator)\n\n this._fileStreams.add(fileStream)\n fileStream.once('close', () => {\n this._fileStreams.delete(fileStream)\n })\n\n return fileStream\n }\n\n async arrayBuffer (opts) {\n const data = new Uint8Array(this.length)\n let offset = 0\n for await (const chunk of this[Symbol.asyncIterator](opts)) {\n data.set(chunk, offset)\n offset += chunk.length\n }\n return data.buffer\n }\n\n async blob (opts) {\n return new Blob([await this.arrayBuffer(opts)], { type: this.type })\n }\n\n stream (opts) {\n let iterator\n return new ReadableStream({\n start () {\n iterator = this[Symbol.asyncIterator](opts)\n },\n async pull ({ close, enqueue }) {\n const { value, done } = await iterator.next()\n\n if (done) {\n close()\n } else {\n enqueue(value)\n }\n },\n cancel () {\n iterator.return()\n }\n })\n }\n\n get streamURL () {\n if (!this._client._server) throw new Error('No server created')\n const url = `${this._client._server.pathname}/${this._torrent.infoHash}/${encodeURI(this.path)}`\n return url\n }\n\n streamTo (elem) {\n elem.src = this.streamURL\n return elem\n }\n\n includes (piece) {\n return this._startPiece <= piece && this._endPiece >= piece\n }\n\n _destroy () {\n this._destroyed = true\n this._torrent = null\n\n for (const fileStream of this._fileStreams) {\n fileStream.destroy()\n }\n this._fileStreams.clear()\n for (const iterator of this._iterators) {\n iterator.destroy()\n }\n this._iterators.clear()\n }\n}\n","/**\n * Mapping of torrent pieces to their respective availability in the torrent swarm. Used\n * by the torrent manager for implementing the rarest piece first selection strategy.\n */\nexport default class RarityMap {\n constructor (torrent) {\n this._torrent = torrent\n this._numPieces = torrent.pieces.length\n this._pieces = new Array(this._numPieces)\n\n this._onWire = wire => {\n this.recalculate()\n this._initWire(wire)\n }\n this._onWireHave = index => {\n this._pieces[index] += 1\n }\n this._onWireBitfield = () => {\n this.recalculate()\n }\n\n this._torrent.wires.forEach(wire => {\n this._initWire(wire)\n })\n this._torrent.on('wire', this._onWire)\n this.recalculate()\n }\n\n /**\n * Get the index of the rarest piece. Optionally, pass a filter function to exclude\n * certain pieces (for instance, those that we already have).\n *\n * @param {function} pieceFilterFunc\n * @return {number} index of rarest piece, or -1\n */\n getRarestPiece (pieceFilterFunc) {\n let candidates = []\n let min = Infinity\n\n for (let i = 0; i < this._numPieces; ++i) {\n if (pieceFilterFunc && !pieceFilterFunc(i)) continue\n\n const availability = this._pieces[i]\n if (availability === min) {\n candidates.push(i)\n } else if (availability < min) {\n candidates = [i]\n min = availability\n }\n }\n\n if (candidates.length) {\n // if there are multiple pieces with the same availability, choose one randomly\n return candidates[Math.random() * candidates.length | 0]\n } else {\n return -1\n }\n }\n\n destroy () {\n this._torrent.removeListener('wire', this._onWire)\n this._torrent.wires.forEach(wire => {\n this._cleanupWireEvents(wire)\n })\n this._torrent = null\n this._pieces = null\n\n this._onWire = null\n this._onWireHave = null\n this._onWireBitfield = null\n }\n\n _initWire (wire) {\n wire._onClose = () => {\n this._cleanupWireEvents(wire)\n for (let i = 0; i < this._numPieces; ++i) {\n this._pieces[i] -= wire.peerPieces.get(i)\n }\n }\n\n wire.on('have', this._onWireHave)\n wire.on('bitfield', this._onWireBitfield)\n wire.once('close', wire._onClose)\n }\n\n /**\n * Recalculates piece availability across all peers in the torrent.\n */\n recalculate () {\n this._pieces.fill(0)\n\n for (const wire of this._torrent.wires) {\n for (let i = 0; i < this._numPieces; ++i) {\n this._pieces[i] += wire.peerPieces.get(i)\n }\n }\n }\n\n _cleanupWireEvents (wire) {\n wire.removeListener('have', this._onWireHave)\n wire.removeListener('bitfield', this._onWireBitfield)\n if (wire._onClose) wire.removeListener('close', wire._onClose)\n wire._onClose = null\n }\n}\n","import BitField from 'bitfield'\nimport debugFactory from 'debug'\nimport fetch from 'cross-fetch-ponyfill'\nimport ltDontHave from 'lt_donthave'\nimport { hash, concat } from 'uint8-util'\nimport Wire from 'bittorrent-protocol'\nimport once from 'once'\n\nimport info from '../package.json' assert { type: 'json' }\n\nconst debug = debugFactory('webtorrent:webconn')\nconst VERSION = info.version\n\nconst SOCKET_TIMEOUT = 60000\nconst RETRY_DELAY = 10000\n\n/**\n * Converts requests for torrent blocks into http range requests.\n * @param {string} url web seed url\n * @param {Object} torrent\n */\nexport default class WebConn extends Wire {\n constructor (url, torrent) {\n super()\n\n this.url = url\n this.connId = url // Unique id to deduplicate web seeds\n this._torrent = torrent\n\n this._init(url)\n }\n\n _init (url) {\n this.setKeepAlive(true)\n\n this.use(ltDontHave())\n\n this.once('handshake', async (infoHash, peerId) => {\n const hex = await hash(url, 'hex') // Used as the peerId for this fake remote peer\n if (this.destroyed) return\n this.handshake(infoHash, hex)\n\n const numPieces = this._torrent.pieces.length\n const bitfield = new BitField(numPieces)\n for (let i = 0; i <= numPieces; i++) {\n bitfield.set(i, true)\n }\n this.bitfield(bitfield)\n })\n\n this.once('interested', () => {\n debug('interested')\n this.unchoke()\n })\n\n this.on('uninterested', () => { debug('uninterested') })\n this.on('choke', () => { debug('choke') })\n this.on('unchoke', () => { debug('unchoke') })\n this.on('bitfield', () => { debug('bitfield') })\n this.lt_donthave.on('donthave', () => { debug('donthave') })\n\n this.on('request', (pieceIndex, offset, length, callback) => {\n debug('request pieceIndex=%d offset=%d length=%d', pieceIndex, offset, length)\n this.httpRequest(pieceIndex, offset, length, (err, data) => {\n if (err) {\n // Cancel all in progress requests for this piece\n this.lt_donthave.donthave(pieceIndex)\n\n // Wait a little while before saying the webseed has the failed piece again\n const retryTimeout = setTimeout(() => {\n if (this.destroyed) return\n\n this.have(pieceIndex)\n }, RETRY_DELAY)\n if (retryTimeout.unref) retryTimeout.unref()\n }\n\n callback(err, data)\n })\n })\n }\n\n async httpRequest (pieceIndex, offset, length, cb) {\n cb = once(cb)\n const pieceOffset = pieceIndex * this._torrent.pieceLength\n const rangeStart = pieceOffset + offset /* offset within whole torrent */\n const rangeEnd = rangeStart + length - 1\n\n // Web seed URL format:\n // For single-file torrents, make HTTP range requests directly to the web seed URL\n // For multi-file torrents, add the torrent folder and file name to the URL\n const files = this._torrent.files\n let requests\n if (files.length <= 1) {\n requests = [{\n url: this.url,\n start: rangeStart,\n end: rangeEnd\n }]\n } else {\n const requestedFiles = files.filter(file => file.offset <= rangeEnd && (file.offset + file.length) > rangeStart)\n if (requestedFiles.length < 1) {\n return cb(new Error('Could not find file corresponding to web seed range request'))\n }\n\n requests = requestedFiles.map(requestedFile => {\n const fileEnd = requestedFile.offset + requestedFile.length - 1\n const url = this.url +\n (this.url[this.url.length - 1] === '/' ? '' : '/') +\n requestedFile.path.replace(this._torrent.path, '')\n return {\n url,\n fileOffsetInRange: Math.max(requestedFile.offset - rangeStart, 0),\n start: Math.max(rangeStart - requestedFile.offset, 0),\n end: Math.min(fileEnd, rangeEnd - requestedFile.offset)\n }\n })\n }\n let chunks\n try {\n chunks = await Promise.all(requests.map(async ({ start, end, url }) => {\n debug(\n 'Requesting url=%s pieceIndex=%d offset=%d length=%d start=%d end=%d',\n url, pieceIndex, offset, length, start, end\n )\n const res = await fetch(url, {\n cache: 'no-store',\n method: 'GET',\n headers: {\n 'Cache-Control': 'no-store',\n 'user-agent': `WebTorrent/${VERSION} (https://webtorrent.io)`,\n range: `bytes=${start}-${end}`\n },\n signal: AbortSignal.timeout(SOCKET_TIMEOUT)\n })\n if (!res.ok) throw new Error(`Unexpected HTTP status code ${res.status}`)\n const data = new Uint8Array(await res.arrayBuffer())\n\n debug('Got data of length %d', data.length)\n\n return data\n }))\n } catch (e) {\n return cb(e)\n }\n\n cb(null, concat(chunks))\n }\n\n destroy () {\n super.destroy()\n this._torrent = null\n }\n}\n","import EventEmitter from 'events'\nimport fs from 'fs'\nimport net from 'net' // browser exclude\nimport os from 'os' // browser exclude\nimport path from 'path'\nimport addrToIPPort from 'addr-to-ip-port'\nimport BitField from 'bitfield'\nimport CacheChunkStore from 'cache-chunk-store'\nimport { chunkStoreWrite } from 'chunk-store-iterator'\nimport cpus from 'cpus'\nimport debugFactory from 'debug'\nimport Discovery from 'torrent-discovery'\nimport FSChunkStore from 'fs-chunk-store' // browser: `hybrid-chunk-store`\nimport fetch from 'cross-fetch-ponyfill'\nimport ImmediateChunkStore from 'immediate-chunk-store'\nimport ltDontHave from 'lt_donthave'\nimport MemoryChunkStore from 'memory-chunk-store'\nimport HybridChunkStore from 'hybrid-chunk-store'\nimport joinIterator from 'join-async-iterator'\nimport parallel from 'run-parallel'\nimport parallelLimit from 'run-parallel-limit'\nimport parseTorrent, { toMagnetURI, toTorrentFile, remote } from 'parse-torrent'\nimport Piece from 'torrent-piece'\nimport queueMicrotask from 'queue-microtask'\nimport randomIterate from 'random-iterate'\nimport { hash, arr2hex } from 'uint8-util'\nimport throughput from 'throughput'\nimport utMetadata from 'ut_metadata'\nimport utPex from 'ut_pex' // browser exclude\n\nimport File from './file.js'\nimport Peer from './peer.js'\nimport RarityMap from './rarity-map.js'\nimport utp from './utp.js' // browser exclude\nimport WebConn from './webconn.js'\n\nimport info from '../package.json' assert { type: 'json' }\n\nconst debug = debugFactory('webtorrent:torrent')\nconst MAX_BLOCK_LENGTH = 128 * 1024\nconst PIECE_TIMEOUT = 30_000\nconst CHOKE_TIMEOUT = 5_000\nconst SPEED_THRESHOLD = 3 * Piece.BLOCK_LENGTH\n\nconst PIPELINE_MIN_DURATION = 0.5\nconst PIPELINE_MAX_DURATION = 1\n\nconst RECHOKE_INTERVAL = 10_000 // 10 seconds\nconst RECHOKE_OPTIMISTIC_DURATION = 2 // 30 seconds\n\nconst DEFAULT_NO_PEERS_INTERVAL = 30_000 // 30 seconds\n\n// IndexedDB chunk stores used in the browser benefit from high concurrency\nconst FILESYSTEM_CONCURRENCY = process.browser ? cpus().length : 2\n\nconst RECONNECT_WAIT = [1_000, 5_000, 15_000]\n\nconst VERSION = info.version\nconst USER_AGENT = `WebTorrent/${VERSION} (https://webtorrent.io)`\n\nlet TMP\ntry {\n TMP = path.join(fs.statSync('/tmp') && '/tmp', 'webtorrent')\n} catch (err) {\n TMP = path.join(typeof os.tmpdir === 'function' ? os.tmpdir() : '/', 'webtorrent')\n}\n\nconst IDLE_CALLBACK = typeof window !== 'undefined' && typeof window.requestIdleCallback === 'function' && window.requestIdleCallback\n\nexport default class Torrent extends EventEmitter {\n constructor (torrentId, client, opts) {\n super()\n\n this._debugId = 'unknown infohash'\n this.client = client\n\n this.announce = opts.announce\n this.urlList = opts.urlList\n\n this.path = opts.path || TMP\n this.addUID = opts.addUID || false\n this.rootDir = opts.rootDir || null\n this.skipVerify = !!opts.skipVerify\n this._store = opts.store || FSChunkStore\n this._preloadedStore = opts.preloadedStore || null\n this._storeCacheSlots = opts.storeCacheSlots !== undefined ? opts.storeCacheSlots : 20\n this._destroyStoreOnDestroy = opts.destroyStoreOnDestroy || false\n this.store = null\n this.storeOpts = opts.storeOpts\n\n this._getAnnounceOpts = opts.getAnnounceOpts\n\n // if defined, `opts.private` overrides default privacy of torrent\n if (typeof opts.private === 'boolean') this.private = opts.private\n\n this.strategy = opts.strategy || 'sequential'\n\n this.maxWebConns = opts.maxWebConns || 4\n\n this._rechokeNumSlots = (opts.uploads === false || opts.uploads === 0)\n ? 0\n : (+opts.uploads || 10)\n this._rechokeOptimisticWire = null\n this._rechokeOptimisticTime = 0\n this._rechokeIntervalId = null\n this._noPeersIntervalId = null\n this._noPeersIntervalTime = opts.noPeersIntervalTime ? opts.noPeersIntervalTime * 1000 : DEFAULT_NO_PEERS_INTERVAL\n\n this.ready = false\n this.destroyed = false\n this.paused = opts.paused || false\n this.done = false\n\n this.metadata = null\n this.files = []\n\n // Pieces that need to be downloaded, indexed by piece index\n this.pieces = []\n\n this._amInterested = false\n this._selections = []\n this._critical = []\n\n this.wires = [] // open wires (added *after* handshake)\n\n this._queue = [] // queue of outgoing tcp peers to connect to\n this._peers = {} // connected peers (addr/peerId -> Peer)\n this._peersLength = 0 // number of elements in `this._peers` (cache, for perf)\n\n // stats\n this.received = 0\n this.uploaded = 0\n this._downloadSpeed = throughput()\n this._uploadSpeed = throughput()\n\n // for cleanup\n this._servers = []\n this._xsRequests = []\n\n // TODO: remove this and expose a hook instead\n // optimization: don't recheck every file if it hasn't changed\n this._fileModtimes = opts.fileModtimes\n\n if (torrentId !== null) this._onTorrentId(torrentId)\n\n this._debug('new torrent')\n }\n\n get timeRemaining () {\n if (this.done) return 0\n if (this.downloadSpeed === 0) return Infinity\n return ((this.length - this.downloaded) / this.downloadSpeed) * 1000\n }\n\n get downloaded () {\n if (!this.bitfield) return 0\n let downloaded = 0\n for (let index = 0, len = this.pieces.length; index < len; ++index) {\n if (this.bitfield.get(index)) { // verified data\n downloaded += (index === len - 1) ? this.lastPieceLength : this.pieceLength\n } else { // \"in progress\" data\n const piece = this.pieces[index]\n downloaded += (piece.length - piece.missing)\n }\n }\n return downloaded\n }\n\n // TODO: re-enable this. The number of missing pieces. Used to implement 'end game' mode.\n // Object.defineProperty(Storage.prototype, 'numMissing', {\n // get: function () {\n // var self = this\n // var numMissing = self.pieces.length\n // for (var index = 0, len = self.pieces.length; index < len; index++) {\n // numMissing -= self.bitfield.get(index)\n // }\n // return numMissing\n // }\n // })\n\n get downloadSpeed () { return this._downloadSpeed() }\n\n get uploadSpeed () { return this._uploadSpeed() }\n\n get progress () { return this.length ? this.downloaded / this.length : 0 }\n\n get ratio () { return this.uploaded / (this.received || this.length) }\n\n get numPeers () { return this.wires.length }\n\n get torrentFileBlob () {\n if (!this.torrentFile) return null\n return new Blob([this.torrentFile], { type: 'application/x-bittorrent' })\n }\n\n get _numQueued () {\n return this._queue.length + (this._peersLength - this._numConns)\n }\n\n get _numConns () {\n let numConns = 0\n for (const id in this._peers) {\n if (this._peers[id].connected) numConns += 1\n }\n return numConns\n }\n\n async _onTorrentId (torrentId) {\n if (this.destroyed) return\n\n let parsedTorrent\n try { parsedTorrent = await parseTorrent(torrentId) } catch (err) {}\n if (parsedTorrent) {\n // Attempt to set infoHash property synchronously\n this.infoHash = parsedTorrent.infoHash\n this._debugId = arr2hex(parsedTorrent.infoHash).substring(0, 7)\n queueMicrotask(() => {\n if (this.destroyed) return\n this._onParsedTorrent(parsedTorrent)\n })\n } else {\n // If torrentId failed to parse, it could be in a form that requires an async\n // operation, i.e. http/https link, filesystem path, or Blob.\n remote(torrentId, (err, parsedTorrent) => {\n if (this.destroyed) return\n if (err) return this._destroy(err)\n this._onParsedTorrent(parsedTorrent)\n })\n }\n }\n\n _onParsedTorrent (parsedTorrent) {\n if (this.destroyed) return\n\n this._processParsedTorrent(parsedTorrent)\n\n if (!this.infoHash) {\n return this._destroy(new Error('Malformed torrent data: No info hash'))\n }\n\n this._rechokeIntervalId = setInterval(() => {\n this._rechoke()\n }, RECHOKE_INTERVAL)\n if (this._rechokeIntervalId.unref) this._rechokeIntervalId.unref()\n\n // Private 'infoHash' event allows client.add to check for duplicate torrents and\n // destroy them before the normal 'infoHash' event is emitted. Prevents user\n // applications from needing to deal with duplicate 'infoHash' events.\n this.emit('_infoHash', this.infoHash)\n if (this.destroyed) return\n\n this.emit('infoHash', this.infoHash)\n if (this.destroyed) return // user might destroy torrent in event handler\n\n if (this.client.listening) {\n this._onListening()\n } else {\n this.client.once('listening', () => {\n this._onListening()\n })\n }\n }\n\n _processParsedTorrent (parsedTorrent) {\n this._debugId = arr2hex(parsedTorrent.infoHash).substring(0, 7)\n\n if (typeof this.private !== 'undefined') {\n // `private` option overrides default, only if it's defined\n parsedTorrent.private = this.private\n }\n\n if (this.announce) {\n // Allow specifying trackers via `opts` parameter\n parsedTorrent.announce = parsedTorrent.announce.concat(this.announce)\n }\n\n if (this.client.tracker && global.WEBTORRENT_ANNOUNCE && !parsedTorrent.private) {\n // So `webtorrent-hybrid` can force specific trackers to be used\n parsedTorrent.announce = parsedTorrent.announce.concat(global.WEBTORRENT_ANNOUNCE)\n }\n\n if (this.urlList) {\n // Allow specifying web seeds via `opts` parameter\n parsedTorrent.urlList = parsedTorrent.urlList.concat(this.urlList)\n }\n\n // remove duplicates by converting to Set and back\n parsedTorrent.announce = Array.from(new Set(parsedTorrent.announce))\n parsedTorrent.urlList = Array.from(new Set(parsedTorrent.urlList))\n\n Object.assign(this, parsedTorrent)\n\n this.magnetURI = toMagnetURI(parsedTorrent)\n this.torrentFile = toTorrentFile(parsedTorrent)\n }\n\n _onListening () {\n if (this.destroyed) return\n\n if (this.info) {\n // if full metadata was included in initial torrent id, use it immediately. Otherwise,\n // wait for torrent-discovery to find peers and ut_metadata to get the metadata.\n this._onMetadata(this)\n } else {\n if (this.xs) this._getMetadataFromServer()\n this._startDiscovery()\n }\n }\n\n _startDiscovery () {\n if (this.discovery || this.destroyed) return\n\n let trackerOpts = this.client.tracker\n if (trackerOpts) {\n trackerOpts = Object.assign({}, this.client.tracker, {\n getAnnounceOpts: () => {\n if (this.destroyed) return\n\n const opts = {\n uploaded: this.uploaded,\n downloaded: this.downloaded,\n left: Math.max(this.length - this.downloaded, 0)\n }\n if (this.client.tracker.getAnnounceOpts) {\n Object.assign(opts, this.client.tracker.getAnnounceOpts())\n }\n if (this._getAnnounceOpts) {\n // TODO: consider deprecating this, as it's redundant with the former case\n Object.assign(opts, this._getAnnounceOpts())\n }\n return opts\n }\n })\n }\n\n // add BEP09 peer-address\n if (this.peerAddresses) {\n this.peerAddresses.forEach(peer => this.addPeer(peer, Peer.SOURCE_MANUAL))\n }\n\n // begin discovering peers via DHT and trackers\n this.discovery = new Discovery({\n infoHash: this.infoHash,\n announce: this.announce,\n peerId: this.client.peerId,\n dht: !this.private && this.client.dht,\n tracker: trackerOpts,\n port: this.client.torrentPort,\n userAgent: USER_AGENT,\n lsd: this.client.lsd\n })\n\n this.discovery.on('error', (err) => {\n this._destroy(err)\n })\n\n this.discovery.on('peer', (peer, source) => {\n this._debug('peer %s discovered via %s', peer, source)\n // Don't create new outgoing TCP connections when torrent is done\n if (typeof peer === 'string' && this.done) return\n this.addPeer(peer, source)\n })\n\n this.discovery.on('trackerAnnounce', () => {\n this.emit('trackerAnnounce')\n })\n\n this.discovery.on('dhtAnnounce', () => {\n this.emit('dhtAnnounce')\n })\n\n this.discovery.on('warning', (err) => {\n this.emit('warning', err)\n })\n\n this._noPeersIntervalId = setInterval(() => {\n if (this.destroyed) return\n\n const counters = {\n [Peer.SOURCE_TRACKER]: {\n enabled: !!this.client.tracker,\n numPeers: 0\n },\n [Peer.SOURCE_DHT]: {\n enabled: !!this.client.dht,\n numPeers: 0\n },\n [Peer.SOURCE_LSD]: {\n enabled: !!this.client.lsd,\n numPeers: 0\n },\n [Peer.SOURCE_UT_PEX]: {\n enabled: (this.client.utPex && typeof utPex === 'function'),\n numPeers: 0\n }\n }\n for (const peer of Object.values(this._peers)) {\n const counter = counters[peer.source]\n if (typeof counter !== 'undefined') counter.numPeers++\n }\n for (const source of Object.keys(counters)) {\n const counter = counters[source]\n if (counter.enabled && counter.numPeers === 0) this.emit('noPeers', source)\n }\n }, this._noPeersIntervalTime)\n if (this._noPeersIntervalId.unref) this._noPeersIntervalId.unref()\n }\n\n _getMetadataFromServer () {\n // to allow function hoisting\n const self = this\n\n const urls = Array.isArray(this.xs) ? this.xs : [this.xs]\n\n self._xsRequestsController = new AbortController()\n\n const signal = self._xsRequestsController.signal\n\n const tasks = urls.map(url => cb => {\n getMetadataFromURL(url, cb)\n })\n parallel(tasks)\n\n async function getMetadataFromURL (url, cb) {\n if (url.indexOf('http://') !== 0 && url.indexOf('https://') !== 0) {\n self.emit('warning', new Error(`skipping non-http xs param: ${url}`))\n return cb(null)\n }\n\n const opts = {\n method: 'GET',\n headers: {\n 'user-agent': USER_AGENT\n },\n signal\n }\n let res\n try {\n res = await fetch(url, opts)\n } catch (err) {\n self.emit('warning', new Error(`http error from xs param: ${url}`))\n return cb(null)\n }\n\n if (self.destroyed) return cb(null)\n if (self.metadata) return cb(null)\n\n if (res.status !== 200) {\n self.emit('warning', new Error(`non-200 status code ${res.status} from xs param: ${url}`))\n return cb(null)\n }\n let torrent\n try {\n torrent = new Uint8Array(await res.arrayBuffer())\n } catch (e) {\n self.emit('warning', e)\n return cb(null)\n }\n\n let parsedTorrent\n try {\n parsedTorrent = await parseTorrent(torrent)\n } catch (err) {}\n\n if (!parsedTorrent) {\n self.emit('warning', new Error(`got invalid torrent file from xs param: ${url}`))\n return cb(null)\n }\n\n if (parsedTorrent.infoHash !== self.infoHash) {\n self.emit('warning', new Error(`got torrent file with incorrect info hash from xs param: ${url}`))\n return cb(null)\n }\n self._onMetadata(parsedTorrent)\n cb(null)\n }\n }\n\n /**\n * Called when the full torrent metadata is received.\n */\n async _onMetadata (metadata) {\n if (this.metadata || this.destroyed) return\n this._debug('got metadata')\n\n this._xsRequestsController?.abort()\n this._xsRequestsController = null\n\n let parsedTorrent\n if (metadata && metadata.infoHash) {\n // `metadata` is a parsed torrent (from parse-torrent module)\n parsedTorrent = metadata\n } else {\n try {\n parsedTorrent = await parseTorrent(metadata)\n } catch (err) {\n return this._destroy(err)\n }\n }\n\n this._processParsedTorrent(parsedTorrent)\n this.metadata = this.torrentFile\n\n // add web seed urls (BEP19)\n if (this.client.enableWebSeeds) {\n this.urlList.forEach(url => {\n this.addWebSeed(url)\n })\n }\n\n this._rarityMap = new RarityMap(this)\n\n this.files = this.files.map(file => new File(this, file))\n\n let rawStore = this._preloadedStore\n if (!rawStore) {\n rawStore = new this._store(this.pieceLength, {\n ...this.storeOpts,\n torrent: this,\n path: this.path,\n files: this.files,\n length: this.length,\n name: this.name + ' - ' + this.infoHash.slice(0, 8),\n addUID: this.addUID,\n rootDir: this.rootDir,\n max: this._storeCacheSlots\n })\n }\n\n // don't use the cache if the store is already in memory\n if (this._storeCacheSlots > 0 && !(rawStore instanceof MemoryChunkStore || rawStore instanceof HybridChunkStore)) {\n rawStore = new CacheChunkStore(rawStore, {\n max: this._storeCacheSlots\n })\n }\n\n this.store = new ImmediateChunkStore(\n rawStore\n )\n\n // Select only specified files (BEP53) http://www.bittorrent.org/beps/bep_0053.html\n if (this.so) {\n this.files.forEach((v, i) => {\n if (this.so.includes(i)) {\n this.files[i].select()\n } else {\n this.files[i].deselect()\n }\n })\n } else {\n // start off selecting the entire torrent with low priority\n if (this.pieces.length !== 0) {\n this.select(0, this.pieces.length - 1, false)\n }\n }\n\n this._hashes = this.pieces\n\n this.pieces = this.pieces.map((hash, i) => {\n const pieceLength = (i === this.pieces.length - 1)\n ? this.lastPieceLength\n : this.pieceLength\n return new Piece(pieceLength)\n })\n\n this._reservations = this.pieces.map(() => [])\n\n this.bitfield = new BitField(this.pieces.length)\n\n // Emit 'metadata' before 'ready' and 'done'\n this.emit('metadata')\n\n // User might destroy torrent in response to 'metadata' event\n if (this.destroyed) return\n\n if (this.skipVerify) {\n // Skip verifying exisitng data and just assume it's correct\n this._markAllVerified()\n this._onStore()\n } else {\n const onPiecesVerified = (err) => {\n if (err) return this._destroy(err)\n this._debug('done verifying')\n this._onStore()\n }\n\n this._debug('verifying existing torrent data')\n if (this._fileModtimes && this._store === FSChunkStore) {\n // don't verify if the files haven't been modified since we last checked\n this.getFileModtimes((err, fileModtimes) => {\n if (err) return this._destroy(err)\n\n const unchanged = this.files.map((_, index) => fileModtimes[index] === this._fileModtimes[index]).every(x => x)\n\n if (unchanged) {\n this._markAllVerified()\n this._onStore()\n } else {\n this._verifyPieces(onPiecesVerified)\n }\n })\n } else {\n this._verifyPieces(onPiecesVerified)\n }\n }\n }\n\n /*\n * TODO: remove this\n * Gets the last modified time of every file on disk for this torrent.\n * Only valid in Node, not in the browser.\n */\n getFileModtimes (cb) {\n const ret = []\n parallelLimit(this.files.map((file, index) => cb => {\n const filePath = this.addUID ? path.join(this.name + ' - ' + this.infoHash.slice(0, 8)) : path.join(this.path, file.path)\n fs.stat(filePath, (err, stat) => {\n if (err && err.code !== 'ENOENT') return cb(err)\n ret[index] = stat && stat.mtime.getTime()\n cb(null)\n })\n }), FILESYSTEM_CONCURRENCY, err => {\n this._debug('done getting file modtimes')\n cb(err, ret)\n })\n }\n\n _verifyPieces (cb) {\n parallelLimit(this.pieces.map((piece, index) => cb => {\n if (this.destroyed) return cb(new Error('torrent is destroyed'))\n\n const getOpts = {}\n // Specify length for the last piece in case it is zero-padded\n if (index === this.pieces.length - 1) {\n getOpts.length = this.lastPieceLength\n }\n this.store.get(index, getOpts, async (err, buf) => {\n if (this.destroyed) return cb(new Error('torrent is destroyed'))\n\n if (err) return queueMicrotask(() => cb(null)) // ignore error\n\n const hex = await hash(buf, 'hex')\n if (this.destroyed) return cb(new Error('torrent is destroyed'))\n\n if (hex === this._hashes[index]) {\n this._debug('piece verified %s', index)\n this._markVerified(index)\n } else {\n this._markUnverified(index)\n this._debug('piece invalid %s', index)\n }\n cb(null)\n })\n }), FILESYSTEM_CONCURRENCY, cb)\n }\n\n rescanFiles (cb) {\n if (this.destroyed) throw new Error('torrent is destroyed')\n if (!cb) cb = noop\n\n this._verifyPieces((err) => {\n if (err) {\n this._destroy(err)\n return cb(err)\n }\n\n this._checkDone()\n cb(null)\n })\n }\n\n _markAllVerified () {\n for (let index = 0; index < this.pieces.length; index++) {\n this._markVerified(index)\n }\n }\n\n _markVerified (index) {\n this.pieces[index] = null\n this._reservations[index] = null\n this.bitfield.set(index, true)\n }\n\n _markUnverified (index) {\n const len = (index === this.pieces.length - 1)\n ? this.lastPieceLength\n : this.pieceLength\n this.pieces[index] = new Piece(len)\n this.bitfield.set(index, false)\n this.select(index, index, 1)\n this.files.forEach(file => {\n if (file.done && file.includes(index)) file.done = false\n })\n }\n\n _hasAllPieces () {\n for (let index = 0; index < this.pieces.length; index++) {\n if (!this.bitfield.get(index)) return false\n }\n return true\n }\n\n _hasNoPieces () {\n return !this._hasMorePieces(0)\n }\n\n _hasMorePieces (threshold) {\n let count = 0\n for (let index = 0; index < this.pieces.length; index++) {\n if (this.bitfield.get(index)) {\n count += 1\n if (count > threshold) return true\n }\n }\n return false\n }\n\n /**\n * Called when the metadata, listening server, and underlying chunk store is initialized.\n */\n _onStore () {\n if (this.destroyed) return\n this._debug('on store')\n\n // Start discovery before emitting 'ready'\n this._startDiscovery()\n\n this.ready = true\n this.emit('ready')\n\n // Files may start out done if the file was already in the store\n this._checkDone()\n\n // In case any selections were made before torrent was ready\n this._updateSelections()\n\n // Start requesting pieces after we have initially verified them\n this.wires.forEach(wire => {\n // If we didn't have the metadata at the time ut_metadata was initialized for this\n // wire, we still want to make it available to the peer in case they request it.\n if (wire.ut_metadata) wire.ut_metadata.setMetadata(this.metadata)\n\n this._onWireWithMetadata(wire)\n })\n }\n\n destroy (opts, cb) {\n if (typeof opts === 'function') return this.destroy(null, opts)\n\n this._destroy(null, opts, cb)\n }\n\n _destroy (err, opts, cb) {\n if (typeof opts === 'function') return this._destroy(err, null, opts)\n if (this.destroyed) return\n this.destroyed = true\n this._debug('destroy')\n\n this.client._remove(this)\n\n clearInterval(this._rechokeIntervalId)\n\n clearInterval(this._noPeersIntervalId)\n\n this._xsRequestsController?.abort()\n\n if (this._rarityMap) {\n this._rarityMap.destroy()\n }\n\n for (const id in this._peers) {\n this.removePeer(id)\n }\n\n this.files.forEach(file => {\n if (file instanceof File) file._destroy()\n })\n\n const tasks = this._servers.map(server => cb => {\n server.destroy(cb)\n })\n\n if (this.discovery) {\n tasks.push(cb => {\n this.discovery.destroy(cb)\n })\n }\n\n if (this.store) {\n let destroyStore = this._destroyStoreOnDestroy\n if (opts && opts.destroyStore !== undefined) {\n destroyStore = opts.destroyStore\n }\n tasks.push(cb => {\n if (destroyStore) {\n this.store.destroy(cb)\n } else {\n this.store.close(cb)\n }\n })\n }\n\n parallel(tasks, cb)\n\n if (err) {\n // Torrent errors are emitted at `torrent.on('error')`. If there are no 'error'\n // event handlers on the torrent instance, then the error will be emitted at\n // `client.on('error')`. This prevents throwing an uncaught exception\n // (unhandled 'error' event), but it makes it impossible to distinguish client\n // errors versus torrent errors. Torrent errors are not fatal, and the client\n // is still usable afterwards. Therefore, always listen for errors in both\n // places (`client.on('error')` and `torrent.on('error')`).\n if (this.listenerCount('error') === 0) {\n this.client.emit('error', err)\n } else {\n this.emit('error', err)\n }\n }\n\n this.emit('close')\n\n this.client = null\n this.files = []\n this.discovery = null\n this.store = null\n this._rarityMap = null\n this._peers = null\n this._servers = null\n this._xsRequests = null\n }\n\n addPeer (peer, source) {\n if (this.destroyed) throw new Error('torrent is destroyed')\n if (!this.infoHash) throw new Error('addPeer() must not be called before the `infoHash` event')\n\n let host\n\n if (this.client.blocked) {\n if (typeof peer === 'string') {\n let parts\n try {\n parts = addrToIPPort(peer)\n } catch (e) {\n this._debug('ignoring peer: invalid %s', peer)\n this.emit('invalidPeer', peer)\n return false\n }\n host = parts[0]\n } else if (typeof peer.remoteAddress === 'string') {\n host = peer.remoteAddress\n }\n\n if (host && this.client.blocked.contains(host)) {\n this._debug('ignoring peer: blocked %s', peer)\n if (typeof peer !== 'string') peer.destroy()\n this.emit('blockedPeer', peer)\n return false\n }\n }\n\n // if the utp connection fails to connect, then it is replaced with a tcp connection to the same ip:port\n\n const type = (this.client.utp && this._isIPv4(host)) ? 'utp' : 'tcp'\n const wasAdded = !!this._addPeer(peer, type, source)\n\n if (wasAdded) {\n this.emit('peer', peer)\n } else {\n this.emit('invalidPeer', peer)\n }\n return wasAdded\n }\n\n _addPeer (peer, type, source) {\n if (this.destroyed) {\n if (typeof peer !== 'string') peer.destroy()\n return null\n }\n if (typeof peer === 'string' && !this._validAddr(peer)) {\n this._debug('ignoring peer: invalid %s', peer)\n return null\n }\n\n const id = (peer && peer.id) || peer\n if (this._peers[id]) {\n this._debug('ignoring peer: duplicate (%s)', id)\n if (typeof peer !== 'string') peer.destroy()\n return null\n }\n\n if (this.paused) {\n this._debug('ignoring peer: torrent is paused')\n if (typeof peer !== 'string') peer.destroy()\n return null\n }\n\n this._debug('add peer %s', id)\n\n let newPeer\n if (typeof peer === 'string') {\n // `peer` is an addr (\"ip:port\" string)\n newPeer = type === 'utp'\n ? Peer.createUTPOutgoingPeer(peer, this, this.client.throttleGroups)\n : Peer.createTCPOutgoingPeer(peer, this, this.client.throttleGroups)\n } else {\n // `peer` is a WebRTC connection (simple-peer)\n newPeer = Peer.createWebRTCPeer(peer, this, this.client.throttleGroups)\n }\n\n this._registerPeer(newPeer)\n\n if (typeof peer === 'string') {\n // `peer` is an addr (\"ip:port\" string)\n this._queue.push(newPeer)\n this._drain()\n }\n\n return newPeer\n }\n\n addWebSeed (urlOrConn) {\n if (this.destroyed) throw new Error('torrent is destroyed')\n\n let id\n let conn\n if (typeof urlOrConn === 'string') {\n id = urlOrConn\n\n if (!/^https?:\\/\\/.+/.test(id)) {\n this.emit('warning', new Error(`ignoring invalid web seed: ${id}`))\n this.emit('invalidPeer', id)\n return\n }\n\n if (this._peers[id]) {\n this.emit('warning', new Error(`ignoring duplicate web seed: ${id}`))\n this.emit('invalidPeer', id)\n return\n }\n\n conn = new WebConn(id, this)\n } else if (urlOrConn && typeof urlOrConn.connId === 'string') {\n conn = urlOrConn\n id = conn.connId\n\n if (this._peers[id]) {\n this.emit('warning', new Error(`ignoring duplicate web seed: ${id}`))\n this.emit('invalidPeer', id)\n return\n }\n } else {\n this.emit('warning', new Error('addWebSeed must be passed a string or connection object with id property'))\n return\n }\n\n this._debug('add web seed %s', id)\n\n const newPeer = Peer.createWebSeedPeer(conn, id, this, this.client.throttleGroups)\n\n this._registerPeer(newPeer)\n\n this.emit('peer', id)\n }\n\n /**\n * Called whenever a new incoming TCP peer connects to this torrent swarm. Called with a\n * peer that has already sent a handshake.\n */\n _addIncomingPeer (peer) {\n if (this.destroyed) return peer.destroy(new Error('torrent is destroyed'))\n if (this.paused) return peer.destroy(new Error('torrent is paused'))\n\n this._debug('add incoming peer %s', peer.id)\n\n this._registerPeer(peer)\n }\n\n _registerPeer (newPeer) {\n newPeer.on('download', downloaded => {\n if (this.destroyed) return\n this.received += downloaded\n this._downloadSpeed(downloaded)\n this.client._downloadSpeed(downloaded)\n this.emit('download', downloaded)\n if (this.destroyed) return\n this.client.emit('download', downloaded)\n })\n\n newPeer.on('upload', uploaded => {\n if (this.destroyed) return\n this.uploaded += uploaded\n this._uploadSpeed(uploaded)\n this.client._uploadSpeed(uploaded)\n this.emit('upload', uploaded)\n if (this.destroyed) return\n this.client.emit('upload', uploaded)\n })\n\n this._peers[newPeer.id] = newPeer\n this._peersLength += 1\n }\n\n removePeer (peer) {\n const id = peer?.id || peer\n if (peer && !peer.id) peer = this._peers?.[id]\n\n if (!peer) return\n peer.destroy()\n\n if (this.destroyed) return\n\n this._debug('removePeer %s', id)\n\n delete this._peers[id]\n this._peersLength -= 1\n\n // If torrent swarm was at capacity before, try to open a new connection now\n this._drain()\n }\n\n select (start, end, priority, notify) {\n if (this.destroyed) throw new Error('torrent is destroyed')\n\n if (start < 0 || end < start || this.pieces.length <= end) {\n throw new Error(`invalid selection ${start} : ${end}`)\n }\n priority = Number(priority) || 0\n\n this._debug('select %s-%s (priority %s)', start, end, priority)\n\n this._selections.push({\n from: start,\n to: end,\n offset: 0,\n priority,\n notify: notify || noop\n })\n\n this._selections.sort((a, b) => b.priority - a.priority)\n\n this._updateSelections()\n }\n\n deselect (start, end, priority) {\n if (this.destroyed) throw new Error('torrent is destroyed')\n\n priority = Number(priority) || 0\n this._debug('deselect %s-%s (priority %s)', start, end, priority)\n\n for (let i = 0; i < this._selections.length; ++i) {\n const s = this._selections[i]\n if (s.from === start && s.to === end && s.priority === priority) {\n this._selections.splice(i, 1)\n break\n }\n }\n\n this._updateSelections()\n }\n\n critical (start, end) {\n if (this.destroyed) throw new Error('torrent is destroyed')\n\n this._debug('critical %s-%s', start, end)\n\n for (let i = start; i <= end; ++i) {\n this._critical[i] = true\n }\n\n this._updateSelections()\n }\n\n _onWire (wire, addr) {\n this._debug('got wire %s (%s)', wire._debugId, addr || 'Unknown')\n\n this.wires.push(wire)\n\n if (addr) {\n // Sometimes RTCPeerConnection.getStats() doesn't return an ip:port for peers\n const parts = addrToIPPort(addr)\n wire.remoteAddress = parts[0]\n wire.remotePort = parts[1]\n }\n\n // When peer sends PORT message, add that DHT node to routing table\n if (this.client.dht && this.client.dht.listening) {\n wire.on('port', port => {\n if (this.destroyed || this.client.dht.destroyed) {\n return\n }\n if (!wire.remoteAddress) {\n return this._debug('ignoring PORT from peer with no address')\n }\n if (port === 0 || port > 65536) {\n return this._debug('ignoring invalid PORT from peer')\n }\n\n this._debug('port: %s (from %s)', port, addr)\n this.client.dht.addNode({ host: wire.remoteAddress, port })\n })\n }\n\n wire.on('timeout', () => {\n this._debug('wire timeout (%s)', addr)\n // TODO: this might be destroying wires too eagerly\n wire.destroy()\n })\n\n // Timeout for piece requests to this peer\n if (wire.type !== 'webSeed') { // webseeds always send 'unhave' on http timeout\n wire.setTimeout(PIECE_TIMEOUT, true)\n }\n\n // Send KEEP-ALIVE (every 60s) so peers will not disconnect the wire\n wire.setKeepAlive(true)\n\n // use ut_metadata extension\n wire.use(utMetadata(this.metadata))\n\n wire.ut_metadata.on('warning', err => {\n this._debug('ut_metadata warning: %s', err.message)\n })\n\n if (!this.metadata) {\n wire.ut_metadata.on('metadata', metadata => {\n this._debug('got metadata via ut_metadata')\n this._onMetadata(metadata)\n })\n wire.ut_metadata.fetch()\n }\n\n // use ut_pex extension if the torrent is not flagged as private\n if (this.client.utPex && typeof utPex === 'function' && !this.private) {\n wire.use(utPex())\n\n wire.ut_pex.on('peer', peer => {\n // Only add potential new peers when we're not seeding\n if (this.done) return\n this._debug('ut_pex: got peer: %s (from %s)', peer, addr)\n this.addPeer(peer, Peer.SOURCE_UT_PEX)\n })\n\n wire.ut_pex.on('dropped', peer => {\n // the remote peer believes a given peer has been dropped from the torrent swarm.\n // if we're not currently connected to it, then remove it from the queue.\n const peerObj = this._peers[peer]\n if (peerObj && !peerObj.connected) {\n this._debug('ut_pex: dropped peer: %s (from %s)', peer, addr)\n this.removePeer(peer)\n }\n })\n\n wire.once('close', () => {\n // Stop sending updates to remote peer\n wire.ut_pex.reset()\n })\n }\n\n wire.use(ltDontHave())\n\n // Hook to allow user-defined `bittorrent-protocol` extensions\n // More info: https://github.com/webtorrent/bittorrent-protocol#extension-api\n this.emit('wire', wire, addr)\n\n if (this.ready) {\n queueMicrotask(() => {\n // This allows wire.handshake() to be called (by Peer.onHandshake) before any\n // messages get sent on the wire\n this._onWireWithMetadata(wire)\n })\n }\n }\n\n _onWireWithMetadata (wire) {\n let timeoutId = null\n\n const onChokeTimeout = () => {\n if (this.destroyed || wire.destroyed) return\n\n if (this._numQueued > 2 * (this._numConns - this.numPeers) &&\n wire.amInterested) {\n wire.destroy()\n } else {\n timeoutId = setTimeout(onChokeTimeout, CHOKE_TIMEOUT)\n if (timeoutId.unref) timeoutId.unref()\n }\n }\n\n let i\n const updateSeedStatus = () => {\n if (wire.peerPieces.buffer.length !== this.bitfield.buffer.length) return\n for (i = 0; i < this.pieces.length; ++i) {\n if (!wire.peerPieces.get(i)) return\n }\n wire.isSeeder = true\n wire.choke() // always choke seeders\n }\n\n wire.on('bitfield', () => {\n updateSeedStatus()\n this._update()\n this._updateWireInterest(wire)\n })\n\n wire.on('have', () => {\n updateSeedStatus()\n this._update()\n this._updateWireInterest(wire)\n })\n\n wire.lt_donthave.on('donthave', () => {\n updateSeedStatus()\n this._update()\n this._updateWireInterest(wire)\n })\n\n // fast extension (BEP6)\n wire.on('have-all', () => {\n wire.isSeeder = true\n wire.choke() // always choke seeders\n this._update()\n this._updateWireInterest(wire)\n })\n\n // fast extension (BEP6)\n wire.on('have-none', () => {\n wire.isSeeder = false\n this._update()\n this._updateWireInterest(wire)\n })\n\n // fast extension (BEP6)\n wire.on('allowed-fast', (index) => {\n this._update()\n })\n\n wire.once('interested', () => {\n wire.unchoke()\n })\n\n wire.once('close', () => {\n clearTimeout(timeoutId)\n })\n\n wire.on('choke', () => {\n clearTimeout(timeoutId)\n timeoutId = setTimeout(onChokeTimeout, CHOKE_TIMEOUT)\n if (timeoutId.unref) timeoutId.unref()\n })\n\n wire.on('unchoke', () => {\n clearTimeout(timeoutId)\n this._update()\n })\n\n wire.on('request', (index, offset, length, cb) => {\n if (length > MAX_BLOCK_LENGTH) {\n // Per spec, disconnect from peers that request >128KB\n return wire.destroy()\n }\n if (this.pieces[index]) return\n this.store.get(index, { offset, length }, cb)\n })\n\n // always send bitfield or equivalent fast extension message (required)\n if (wire.hasFast && this._hasAllPieces()) wire.haveAll()\n else if (wire.hasFast && this._hasNoPieces()) wire.haveNone()\n else wire.bitfield(this.bitfield)\n\n // initialize interest in case bitfield message was already received before above handler was registered\n this._updateWireInterest(wire)\n\n // Send PORT message to peers that support DHT\n if (wire.peerExtensions.dht && this.client.dht && this.client.dht.listening) {\n wire.port(this.client.dht.address().port)\n }\n\n if (wire.type !== 'webSeed') { // do not choke on webseeds\n timeoutId = setTimeout(onChokeTimeout, CHOKE_TIMEOUT)\n if (timeoutId.unref) timeoutId.unref()\n }\n\n wire.isSeeder = false\n updateSeedStatus()\n }\n\n /**\n * Called on selection changes.\n */\n _updateSelections () {\n if (!this.ready || this.destroyed) return\n\n queueMicrotask(() => {\n this._gcSelections()\n })\n this._updateInterest()\n this._update()\n }\n\n /**\n * Garbage collect selections with respect to the store's current state.\n */\n _gcSelections () {\n for (let i = 0; i < this._selections.length; ++i) {\n const s = this._selections[i]\n const oldOffset = s.offset\n\n // check for newly downloaded pieces in selection\n while (this.bitfield.get(s.from + s.offset) && s.from + s.offset < s.to) {\n s.offset += 1\n }\n\n if (oldOffset !== s.offset) s.notify()\n if (s.to !== s.from + s.offset) continue\n if (!this.bitfield.get(s.from + s.offset)) continue\n\n this._selections.splice(i, 1) // remove fully downloaded selection\n i -= 1 // decrement i to offset splice\n\n s.notify()\n this._updateInterest()\n }\n\n if (!this._selections.length) this.emit('idle')\n }\n\n /**\n * Update interested status for all peers.\n */\n _updateInterest () {\n const prev = this._amInterested\n this._amInterested = !!this._selections.length\n\n this.wires.forEach(wire => this._updateWireInterest(wire))\n\n if (prev === this._amInterested) return\n if (this._amInterested) this.emit('interested')\n else this.emit('uninterested')\n }\n\n _updateWireInterest (wire) {\n let interested = false\n for (let index = 0; index < this.pieces.length; ++index) {\n if (this.pieces[index] && wire.peerPieces.get(index)) {\n interested = true\n break\n }\n }\n\n if (interested) wire.interested()\n else wire.uninterested()\n }\n\n /**\n * Heartbeat to update all peers and their requests.\n */\n _update () {\n if (IDLE_CALLBACK) {\n IDLE_CALLBACK(() => this._updateWireWrapper(), { timeout: 250 })\n } else {\n this._updateWireWrapper()\n }\n }\n\n _updateWireWrapper () {\n if (this.destroyed) return\n // update wires in random order for better request distribution\n const ite = randomIterate(this.wires)\n let wire\n while ((wire = ite())) {\n this._updateWire(wire)\n }\n }\n\n /**\n * Attempts to update a peer's requests\n */\n _updateWire (wire) {\n if (wire.destroyed) return false\n // to allow function hoisting\n const self = this\n\n const minOutstandingRequests = getBlockPipelineLength(wire, PIPELINE_MIN_DURATION)\n if (wire.requests.length >= minOutstandingRequests) return\n const maxOutstandingRequests = getBlockPipelineLength(wire, PIPELINE_MAX_DURATION)\n\n if (wire.peerChoking) {\n if (wire.hasFast && wire.peerAllowedFastSet.length > 0 &&\n !this._hasMorePieces(wire.peerAllowedFastSet.length - 1)) {\n requestAllowedFastSet()\n }\n return\n }\n\n if (!wire.downloaded) return validateWire()\n\n trySelectWire(false) || trySelectWire(true)\n\n function requestAllowedFastSet () {\n if (wire.requests.length >= maxOutstandingRequests) return false\n\n for (const piece of wire.peerAllowedFastSet) {\n if (wire.peerPieces.get(piece) && !self.bitfield.get(piece)) {\n while (self._request(wire, piece, false) &&\n wire.requests.length < maxOutstandingRequests) {\n // body intentionally empty\n // request all non-reserved blocks in this piece\n }\n }\n\n if (wire.requests.length < maxOutstandingRequests) continue\n\n return true\n }\n\n return false\n }\n\n function genPieceFilterFunc (start, end, tried, rank) {\n return i => i >= start && i <= end && !(i in tried) && wire.peerPieces.get(i) && (!rank || rank(i))\n }\n\n // TODO: Do we need both validateWire and trySelectWire?\n function validateWire () {\n if (wire.requests.length) return\n\n let i = self._selections.length\n while (i--) {\n const next = self._selections[i]\n let piece\n if (self.strategy === 'rarest') {\n const start = next.from + next.offset\n const end = next.to\n const len = end - start + 1\n const tried = {}\n let tries = 0\n const filter = genPieceFilterFunc(start, end, tried)\n\n while (tries < len) {\n piece = self._rarityMap.getRarestPiece(filter)\n if (piece < 0) break\n if (self._request(wire, piece, false)) return\n tried[piece] = true\n tries += 1\n }\n } else {\n for (piece = next.to; piece >= next.from + next.offset; --piece) {\n if (!wire.peerPieces.get(piece)) continue\n if (self._request(wire, piece, false)) return\n }\n }\n }\n\n // TODO: wire failed to validate as useful; should we close it?\n // probably not, since 'have' and 'bitfield' messages might be coming\n }\n\n function speedRanker () {\n const speed = wire.downloadSpeed() || 1\n if (speed > SPEED_THRESHOLD) return () => true\n\n const secs = Math.max(1, wire.requests.length) * Piece.BLOCK_LENGTH / speed\n let tries = 10\n let ptr = 0\n\n return index => {\n if (!tries || self.bitfield.get(index)) return true\n\n let missing = self.pieces[index].missing\n\n for (; ptr < self.wires.length; ptr++) {\n const otherWire = self.wires[ptr]\n const otherSpeed = otherWire.downloadSpeed()\n\n if (otherSpeed < SPEED_THRESHOLD) continue\n if (otherSpeed <= speed) continue\n if (!otherWire.peerPieces.get(index)) continue\n if ((missing -= otherSpeed * secs) > 0) continue\n\n tries--\n return false\n }\n\n return true\n }\n }\n\n function shufflePriority (i) {\n let last = i\n for (let j = i; j < self._selections.length && self._selections[j].priority; j++) {\n last = j\n }\n const tmp = self._selections[i]\n self._selections[i] = self._selections[last]\n self._selections[last] = tmp\n }\n\n function trySelectWire (hotswap) {\n if (wire.requests.length >= maxOutstandingRequests) return true\n const rank = speedRanker()\n\n for (let i = 0; i < self._selections.length; i++) {\n const next = self._selections[i]\n\n let piece\n if (self.strategy === 'rarest') {\n const start = next.from + next.offset\n const end = next.to\n const len = end - start + 1\n const tried = {}\n let tries = 0\n const filter = genPieceFilterFunc(start, end, tried, rank)\n\n while (tries < len) {\n piece = self._rarityMap.getRarestPiece(filter)\n if (piece < 0) break\n\n while (self._request(wire, piece, self._critical[piece] || hotswap) &&\n wire.requests.length < maxOutstandingRequests) {\n // body intentionally empty\n // request all non-reserved blocks in this piece\n }\n\n if (wire.requests.length < maxOutstandingRequests) {\n tried[piece] = true\n tries++\n continue\n }\n\n if (next.priority) shufflePriority(i)\n return true\n }\n } else {\n for (piece = next.from + next.offset; piece <= next.to; piece++) {\n if (!wire.peerPieces.get(piece) || !rank(piece)) continue\n\n while (self._request(wire, piece, self._critical[piece] || hotswap) &&\n wire.requests.length < maxOutstandingRequests) {\n // body intentionally empty\n // request all non-reserved blocks in piece\n }\n\n if (wire.requests.length < maxOutstandingRequests) continue\n\n if (next.priority) shufflePriority(i)\n return true\n }\n }\n }\n\n return false\n }\n }\n\n /**\n * Called periodically to update the choked status of all peers, handling optimistic\n * unchoking as described in BEP3.\n */\n _rechoke () {\n if (!this.ready) return\n\n // wires in increasing order of quality (pop() gives next best peer)\n const wireStack =\n this.wires\n .map(wire => ({ wire, random: Math.random() })) // insert a random seed for randomizing the sort\n .sort((objA, objB) => {\n const wireA = objA.wire\n const wireB = objB.wire\n\n // prefer peers that send us data faster\n if (wireA.downloadSpeed() !== wireB.downloadSpeed()) {\n return wireA.downloadSpeed() - wireB.downloadSpeed()\n }\n\n // then prefer peers that can download data from us faster\n if (wireA.uploadSpeed() !== wireB.uploadSpeed()) {\n return wireA.uploadSpeed() - wireB.uploadSpeed()\n }\n\n // then prefer already unchoked peers (to minimize fibrillation)\n if (wireA.amChoking !== wireB.amChoking) {\n return wireA.amChoking ? -1 : 1 // choking < unchoked\n }\n\n // otherwise random order\n return objA.random - objB.random\n })\n .map(obj => obj.wire) // return array of wires (remove random seed)\n\n if (this._rechokeOptimisticTime <= 0) {\n // clear old optimistic peer, so it can be rechoked normally and then replaced\n this._rechokeOptimisticWire = null\n } else {\n this._rechokeOptimisticTime -= 1\n }\n\n let numInterestedUnchoked = 0\n // leave one rechoke slot open for optimistic unchoking\n while (wireStack.length > 0 && numInterestedUnchoked < this._rechokeNumSlots - 1) {\n const wire = wireStack.pop() // next best quality peer\n\n if (wire.isSeeder || wire === this._rechokeOptimisticWire) {\n continue\n }\n\n wire.unchoke()\n\n // only stop unchoking once we fill the slots with interested peers that will actually download\n if (wire.peerInterested) {\n numInterestedUnchoked++\n }\n }\n\n // fill optimistic unchoke slot if empty\n if (this._rechokeOptimisticWire === null && this._rechokeNumSlots > 0) {\n // don't optimistically unchoke uninterested peers\n const remaining = wireStack.filter(wire => wire.peerInterested)\n\n if (remaining.length > 0) {\n // select random remaining (not yet unchoked) peer\n const newOptimisticPeer = remaining[randomInt(remaining.length)]\n\n newOptimisticPeer.unchoke()\n\n this._rechokeOptimisticWire = newOptimisticPeer\n\n this._rechokeOptimisticTime = RECHOKE_OPTIMISTIC_DURATION\n }\n }\n\n // choke the rest\n wireStack\n .filter(wire => wire !== this._rechokeOptimisticWire) // except the optimistically unchoked peer\n .forEach(wire => wire.choke())\n }\n\n /**\n * Attempts to cancel a slow block request from another wire such that the\n * given wire may effectively swap out the request for one of its own.\n */\n _hotswap (wire, index) {\n const speed = wire.downloadSpeed()\n if (speed < Piece.BLOCK_LENGTH) return false\n if (!this._reservations[index]) return false\n\n const r = this._reservations[index]\n if (!r) {\n return false\n }\n\n let minSpeed = Infinity\n let minWire\n\n let i\n for (i = 0; i < r.length; i++) {\n const otherWire = r[i]\n if (!otherWire || otherWire === wire) continue\n\n const otherSpeed = otherWire.downloadSpeed()\n if (otherSpeed >= SPEED_THRESHOLD) continue\n if (2 * otherSpeed > speed || otherSpeed > minSpeed) continue\n\n minWire = otherWire\n minSpeed = otherSpeed\n }\n\n if (!minWire) return false\n\n for (i = 0; i < r.length; i++) {\n if (r[i] === minWire) r[i] = null\n }\n\n for (i = 0; i < minWire.requests.length; i++) {\n const req = minWire.requests[i]\n if (req.piece !== index) continue\n\n this.pieces[index].cancel((req.offset / Piece.BLOCK_LENGTH) | 0)\n }\n\n this.emit('hotswap', minWire, wire, index)\n return true\n }\n\n /**\n * Attempts to request a block from the given wire.\n */\n _request (wire, index, hotswap) {\n const self = this\n const numRequests = wire.requests.length\n const isWebSeed = wire.type === 'webSeed'\n\n if (self.bitfield.get(index)) return false\n\n const maxOutstandingRequests = isWebSeed\n ? Math.min(\n getPiecePipelineLength(wire, PIPELINE_MAX_DURATION, self.pieceLength),\n self.maxWebConns\n )\n : getBlockPipelineLength(wire, PIPELINE_MAX_DURATION)\n\n if (numRequests >= maxOutstandingRequests) return false\n // var endGame = (wire.requests.length === 0 && self.store.numMissing < 30)\n\n const piece = self.pieces[index]\n let reservation = isWebSeed ? piece.reserveRemaining() : piece.reserve()\n\n if (reservation === -1 && hotswap && self._hotswap(wire, index)) {\n reservation = isWebSeed ? piece.reserveRemaining() : piece.reserve()\n }\n if (reservation === -1) return false\n\n let r = self._reservations[index]\n if (!r) r = self._reservations[index] = []\n let i = r.indexOf(null)\n if (i === -1) i = r.length\n r[i] = wire\n\n const chunkOffset = piece.chunkOffset(reservation)\n const chunkLength = isWebSeed ? piece.chunkLengthRemaining(reservation) : piece.chunkLength(reservation)\n\n wire.request(index, chunkOffset, chunkLength, async function onChunk (err, chunk) {\n if (self.destroyed) return\n\n // TODO: what is this for?\n if (!self.ready) return self.once('ready', () => { onChunk(err, chunk) })\n\n if (r[i] === wire) r[i] = null\n\n if (piece !== self.pieces[index]) return onUpdateTick()\n\n if (err) {\n self._debug(\n 'error getting piece %s (offset: %s length: %s) from %s: %s',\n index, chunkOffset, chunkLength, `${wire.remoteAddress}:${wire.remotePort}`,\n err.message\n )\n isWebSeed ? piece.cancelRemaining(reservation) : piece.cancel(reservation)\n onUpdateTick()\n return\n }\n\n self._debug(\n 'got piece %s (offset: %s length: %s) from %s',\n index, chunkOffset, chunkLength, `${wire.remoteAddress}:${wire.remotePort}`\n )\n\n if (!piece.set(reservation, chunk, wire)) return onUpdateTick()\n\n const buf = piece.flush()\n\n // TODO: might need to set self.pieces[index] = null here since sha1 is async\n\n const hex = await hash(buf, 'hex')\n if (self.destroyed) return\n\n if (hex === self._hashes[index]) {\n self._debug('piece verified %s', index)\n\n self.store.put(index, buf, err => {\n if (err) {\n self._destroy(err)\n return\n } else {\n self.pieces[index] = null\n self._markVerified(index)\n self.wires.forEach(wire => {\n wire.have(index)\n })\n }\n // We also check `self.destroyed` since `torrent.destroy()` could have been\n // called in the `torrent.on('done')` handler, triggered by `_checkDone()`.\n if (self._checkDone() && !self.destroyed) self.discovery.complete()\n onUpdateTick()\n })\n } else {\n self.pieces[index] = new Piece(piece.length)\n self.emit('warning', new Error(`Piece ${index} failed verification`))\n onUpdateTick()\n }\n })\n\n function onUpdateTick () {\n queueMicrotask(() => { self._update() })\n }\n\n return true\n }\n\n _checkDone () {\n if (this.destroyed) return\n\n // are any new files done?\n this.files.forEach(file => {\n if (file.done) return\n for (let i = file._startPiece; i <= file._endPiece; ++i) {\n if (!this.bitfield.get(i)) return\n }\n file.done = true\n file.emit('done')\n this._debug(`file done: ${file.name}`)\n })\n\n // is the torrent done? (if all current selections are satisfied, or there are\n // no selections, then torrent is done)\n let done = true\n\n for (const selection of this._selections) {\n for (let piece = selection.from; piece <= selection.to; piece++) {\n if (!this.bitfield.get(piece)) {\n done = false\n break\n }\n }\n if (!done) break\n }\n\n if (!this.done && done) {\n this.done = true\n this._debug(`torrent done: ${this.infoHash}`)\n this.emit('done')\n } else {\n this.done = false\n }\n this._gcSelections()\n\n return done\n }\n\n async load (streams, cb) {\n if (this.destroyed) throw new Error('torrent is destroyed')\n if (!this.ready) return this.once('ready', () => { this.load(streams, cb) })\n\n if (!Array.isArray(streams)) streams = [streams]\n if (!cb) cb = noop\n\n try {\n await chunkStoreWrite(this.store, joinIterator(streams), { chunkLength: this.pieceLength })\n this._markAllVerified()\n this._checkDone()\n cb(null)\n } catch (err) {\n cb(err)\n return err\n }\n }\n\n pause () {\n if (this.destroyed) return\n this._debug('pause')\n this.paused = true\n }\n\n resume () {\n if (this.destroyed) return\n this._debug('resume')\n this.paused = false\n this._drain()\n }\n\n _debug () {\n const args = [].slice.call(arguments)\n args[0] = `[${this.client ? this.client._debugId : 'No Client'}] [${this._debugId}] ${args[0]}`\n debug(...args)\n }\n\n /**\n * Pop a peer off the FIFO queue and connect to it. When _drain() gets called,\n * the queue will usually have only one peer in it, except when there are too\n * many peers (over `this.maxConns`) in which case they will just sit in the\n * queue until another connection closes.\n */\n _drain () {\n this._debug('_drain numConns %s maxConns %s', this._numConns, this.client.maxConns)\n if (typeof net.connect !== 'function' || this.destroyed || this.paused ||\n this._numConns >= this.client.maxConns) {\n return\n }\n this._debug('drain (%s queued, %s/%s peers)', this._numQueued, this.numPeers, this.client.maxConns)\n\n const peer = this._queue.shift()\n if (!peer) return // queue could be empty\n\n this._debug('%s connect attempt to %s', peer.type, peer.addr)\n\n const parts = addrToIPPort(peer.addr)\n const opts = {\n host: parts[0],\n port: parts[1]\n }\n\n if (this.client.utp && peer.type === Peer.TYPE_UTP_OUTGOING) {\n peer.conn = utp.connect(opts.port, opts.host)\n } else {\n peer.conn = net.connect(opts)\n }\n\n const conn = peer.conn\n\n conn.once('connect', () => { if (!this.destroyed) peer.onConnect() })\n conn.once('error', err => { peer.destroy(err) })\n peer.startConnectTimeout()\n\n // When connection closes, attempt reconnect after timeout (with exponential backoff)\n conn.on('close', () => {\n if (this.destroyed) return\n\n if (peer.retries >= RECONNECT_WAIT.length) {\n if (this.client.utp) {\n const newPeer = this._addPeer(peer.addr, 'tcp', peer.source)\n if (newPeer) newPeer.retries = 0\n } else {\n this._debug(\n 'conn %s closed: will not re-add (max %s attempts)',\n peer.addr, RECONNECT_WAIT.length\n )\n }\n return\n }\n\n const ms = RECONNECT_WAIT[peer.retries]\n this._debug(\n 'conn %s closed: will re-add to queue in %sms (attempt %s)',\n peer.addr, ms, peer.retries + 1\n )\n\n const reconnectTimeout = setTimeout(() => {\n if (this.destroyed) return\n const host = addrToIPPort(peer.addr)[0]\n const type = (this.client.utp && this._isIPv4(host)) ? 'utp' : 'tcp'\n const newPeer = this._addPeer(peer.addr, type, peer.source)\n if (newPeer) newPeer.retries = peer.retries + 1\n }, ms)\n if (reconnectTimeout.unref) reconnectTimeout.unref()\n })\n }\n\n /**\n * Returns `true` if string is valid IPv4/6 address.\n * @param {string} addr\n * @return {boolean}\n */\n _validAddr (addr) {\n let parts\n try {\n parts = addrToIPPort(addr)\n } catch (e) {\n return false\n }\n const host = parts[0]\n const port = parts[1]\n return port > 0 && port < 65535 &&\n !(host === '127.0.0.1' && port === this.client.torrentPort)\n }\n\n /**\n * Return `true` if string is a valid IPv4 address.\n * @param {string} addr\n * @return {boolean}\n */\n _isIPv4 (addr) {\n const IPv4Pattern = /^((?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$/\n return IPv4Pattern.test(addr)\n }\n}\n\nfunction getBlockPipelineLength (wire, duration) {\n let length = 2 + Math.ceil(duration * wire.downloadSpeed() / Piece.BLOCK_LENGTH)\n\n // Honor reqq (maximum number of outstanding request messages) if specified by peer\n if (wire.peerExtendedHandshake) {\n const reqq = wire.peerExtendedHandshake.reqq\n if (typeof reqq === 'number' && reqq > 0) {\n length = Math.min(length, reqq)\n }\n }\n\n return length\n}\n\nfunction getPiecePipelineLength (wire, duration, pieceLength) {\n return 1 + Math.ceil(duration * wire.downloadSpeed() / pieceLength)\n}\n\n/**\n * Returns a random integer in [0,high)\n */\nfunction randomInt (high) {\n return Math.random() * high | 0\n}\n\nfunction noop () {}\n","import http from 'http'\nimport escapeHtml from 'escape-html'\nimport pump from 'pump'\nimport rangeParser from 'range-parser'\nimport queueMicrotask from 'queue-microtask'\nimport { Readable } from 'streamx'\n\nconst keepAliveTime = 20000\n\nclass ServerBase {\n constructor (client, opts = {}) {\n this.client = client\n if (!opts.origin) opts.origin = '*' // allow all origins by default\n this.opts = opts\n this.pendingReady = new Set()\n }\n\n static serveIndexPage (res, torrents, pathname) {\n const listHtml = torrents\n .map(torrent => (\n `<li>\n <a href=\"${escapeHtml(pathname)}/${torrent.infoHash}\">\n ${escapeHtml(torrent.name)}\n </a>\n (${escapeHtml(torrent.length)} bytes)\n </li>`\n ))\n .join('<br>')\n\n res.status = 200\n res.headers['Content-Type'] = 'text/html'\n res.body = getPageHTML(\n 'WebTorrent',\n `<h1>WebTorrent</h1>\n <ol>${listHtml}</ol>`\n )\n\n return res\n }\n\n isOriginAllowed (req) {\n // When `origin` option is `false`, deny all cross-origin requests\n if (this.opts.origin === false) return false\n\n // The user allowed all origins\n if (this.opts.origin === '*') return true\n\n // Allow requests where the 'Origin' header matches the `opts.origin` setting\n return req.headers.origin === this.opts.origin\n }\n\n static serveMethodNotAllowed (res) {\n res.status = 405\n res.headers['Content-Type'] = 'text/html'\n\n res.body = getPageHTML(\n '405 - Method Not Allowed',\n '<h1>405 - Method Not Allowed</h1>'\n )\n\n return res\n }\n\n static serve404Page (res) {\n res.status = 404\n res.headers['Content-Type'] = 'text/html'\n\n res.body = getPageHTML(\n '404 - Not Found',\n '<h1>404 - Not Found</h1>'\n )\n return res\n }\n\n static serveTorrentPage (torrent, res, pathname) {\n const listHtml = torrent.files\n .map(file => (\n `<li>\n <a href=\"${escapeHtml(pathname)}/${torrent.infoHash}/${escapeHtml(file.path)}\">\n ${escapeHtml(file.path)}\n </a>\n (${escapeHtml(file.length)} bytes)\n </li>`\n ))\n .join('<br>')\n\n res.status = 200\n res.headers['Content-Type'] = 'text/html'\n\n res.body = getPageHTML(\n `${escapeHtml(torrent.name)} - WebTorrent`,\n `<h1>${escapeHtml(torrent.name)}</h1>\n <ol>${listHtml}</ol>`\n )\n\n return res\n }\n\n static serveOptionsRequest (req, res) {\n res.status = 204 // no content\n res.headers['Access-Control-Max-Age'] = '600'\n res.headers['Access-Control-Allow-Methods'] = 'GET,HEAD'\n\n if (req.headers['access-control-request-headers']) {\n res.headers['Access-Control-Allow-Headers'] = req.headers['access-control-request-headers']\n }\n return res\n }\n\n static serveFile (file, req, res) {\n res.status = 200\n\n // Disable caching as data is local anyways\n res.headers.Expires = '0'\n res.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate, max-age=0'\n // Support range-requests\n res.headers['Accept-Ranges'] = 'bytes'\n res.headers['Content-Type'] = file.type\n // Support DLNA streaming\n res.headers['transferMode.dlna.org'] = 'Streaming'\n res.headers['contentFeatures.dlna.org'] = 'DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000'\n\n // Force the browser to download the file if if it's opened in a new tab\n // Set name of file (for \"Save Page As...\" dialog)\n if (req.destination === 'document') {\n res.headers['Content-Type'] = 'application/octet-stream'\n res.headers['Content-Disposition'] = `attachment; filename*=UTF-8''${encodeRFC5987(file.name)}`\n res.body = 'DOWNLOAD'\n } else {\n res.headers['Content-Disposition'] = `inline; filename*=UTF-8''${encodeRFC5987(file.name)}`\n }\n\n // `rangeParser` returns an array of ranges, or an error code (number) if\n // there was an error parsing the range.\n let range = rangeParser(file.length, req.headers.range || '')\n\n if (Array.isArray(range)) {\n res.status = 206 // indicates that range-request was understood\n\n // no support for multi-range request, just use the first range\n range = range[0]\n\n res.headers['Content-Range'] = `bytes ${range.start}-${range.end}/${file.length}`\n\n res.headers['Content-Length'] = range.end - range.start + 1\n } else {\n res.statusCode = 200\n range = null\n res.headers['Content-Length'] = file.length\n }\n\n if (req.method === 'GET') {\n const iterator = file[Symbol.asyncIterator](range)\n let transform = null\n file.emit('iterator', { iterator, req, file }, target => {\n transform = target\n })\n\n const stream = Readable.from(transform || iterator)\n let pipe = null\n file.emit('stream', { stream, req, file }, target => {\n pipe = pump(stream, target)\n })\n\n res.body = pipe || stream\n } else {\n res.body = false\n }\n return res\n }\n\n async onRequest (req, cb) {\n let pathname = new URL(req.url, 'http://example.com').pathname\n pathname = pathname.slice(pathname.indexOf(this.pathname) + this.pathname.length + 1)\n\n const res = {\n headers: {\n // Prevent browser mime-type sniffing\n 'X-Content-Type-Options': 'nosniff',\n // Defense-in-depth: Set a strict Content Security Policy to mitigate XSS\n 'Content-Security-Policy': \"base-uri 'none'; frame-ancestors 'none'; form-action 'none';\"\n }\n }\n\n // Allow cross-origin requests (CORS)\n if (this.isOriginAllowed(req)) {\n res.headers['Access-Control-Allow-Origin'] = this.opts.origin === '*' ? '*' : req.headers.origin\n }\n\n if (pathname === 'favicon.ico') {\n return cb(ServerBase.serve404Page(res))\n }\n\n // Allow CORS requests to specify arbitrary headers, e.g. 'Range',\n // by responding to the OPTIONS preflight request with the specified\n // origin and requested headers.\n if (req.method === 'OPTIONS') {\n if (this.isOriginAllowed(req)) return cb(ServerBase.serveOptionsRequest(req, res))\n else return cb(ServerBase.serveMethodNotAllowed(res))\n }\n\n const onReady = async () => {\n this.pendingReady.delete(onReady)\n const res = await handleRequest()\n cb(res)\n }\n\n const handleRequest = async () => {\n if (pathname === '') {\n return ServerBase.serveIndexPage(res, this.client.torrents, this.pathname)\n }\n\n let [infoHash, ...filePath] = pathname.split('/')\n filePath = decodeURI(filePath.join('/'))\n\n const torrent = await this.client.get(infoHash)\n if (!infoHash || !torrent) {\n return ServerBase.serve404Page(res)\n }\n\n if (!filePath) {\n return ServerBase.serveTorrentPage(torrent, res, this.pathname)\n }\n\n const file = torrent.files.find(file => file.path.replace(/\\\\/g, '/') === filePath)\n if (!file) {\n return ServerBase.serve404Page(res)\n }\n return ServerBase.serveFile(file, req, res)\n }\n\n if (req.method === 'GET' || req.method === 'HEAD') {\n if (this.client.ready) {\n const res = await handleRequest()\n return cb(res)\n } else {\n this.pendingReady.add(onReady)\n this.client.once('ready', onReady)\n return\n }\n }\n\n return ServerBase.serveMethodNotAllowed(res)\n }\n\n close (cb = () => {}) {\n this.closed = true\n this.pendingReady.forEach(onReady => {\n this.client.removeListener('ready', onReady)\n })\n this.pendingReady.clear()\n queueMicrotask(cb)\n }\n\n destroy (cb = () => {}) {\n // Only call `server.close` if user has not called it already\n if (this.closed) queueMicrotask(cb)\n else this.close(cb)\n this.client = null\n }\n}\n\nclass NodeServer extends ServerBase {\n constructor (client, opts) {\n super(client, opts)\n\n this.server = http.createServer()\n this._listen = this.server.listen\n this.server.listen = this.listen.bind(this)\n this._close = this.server.close\n this.server.close = this.close.bind(this)\n\n this.sockets = new Set()\n this.closed = false\n this.pathname = opts?.pathname || '/webtorrent'\n }\n\n wrapRequest (req, res) {\n // If a 'hostname' string is specified, deny requests with a 'Host'\n // header that does not match the origin of the torrent server to prevent\n // DNS rebinding attacks.\n if (this.opts.hostname && req.headers.host !== `${this.opts.hostname}:${this.server.address().port}`) {\n return req.destroy()\n }\n\n if (!new URL(req.url, 'http://example.com').pathname.startsWith(this.pathname)) {\n return req.destroy()\n }\n\n this.onRequest(req, ({ status, headers, body }) => {\n res.writeHead(status, headers)\n\n if (body instanceof Readable) { // this is probably a bad way of checking? idk\n pump(body, res)\n } else {\n res.end(body)\n }\n })\n }\n\n onConnection (socket) {\n socket.setTimeout(36000000)\n this.sockets.add(socket)\n socket.once('close', () => {\n this.sockets.delete(socket)\n })\n }\n\n address () {\n return this.server.address()\n }\n\n listen (...args) {\n this.closed = false\n this.server.on('connection', this.onConnection.bind(this))\n this.server.on('request', this.wrapRequest.bind(this))\n return this._listen.apply(this.server, args)\n }\n\n close (cb = () => {}) {\n this.server.removeAllListeners('connection')\n this.server.removeAllListeners('request')\n super.close()\n this._close.call(this.server, cb)\n }\n\n destroy (cb) {\n this.sockets.forEach(socket => {\n socket.destroy()\n })\n super.destroy(cb)\n }\n}\n\nclass BrowserServer extends ServerBase {\n constructor (client, opts) {\n super(client, opts)\n\n this.registration = opts.controller\n this.workerKeepAliveInterval = null\n this.workerPortCount = 0\n\n const scope = new URL(opts.controller.scope)\n this.pathname = scope.pathname + 'webtorrent'\n this._address = {\n port: scope.port,\n family: 'IPv4', // might be a bad idea?\n address: scope.hostname\n }\n\n this.boundHandler = this.wrapRequest.bind(this)\n navigator.serviceWorker.addEventListener('message', this.boundHandler)\n // test if browser supports cancelling sw Readable Streams\n fetch(`${this.pathname}/cancel/`).then(res => {\n res.body.cancel()\n })\n }\n\n wrapRequest (event) {\n const req = event.data\n\n if (!req?.type === 'webtorrent' || !req.url) return null\n\n const [port] = event.ports\n this.onRequest(req, ({ status, headers, body }) => {\n const asyncIterator = body instanceof Readable && body[Symbol.asyncIterator]()\n\n const cleanup = () => {\n port.onmessage = null\n if (body?.destroy) body.destroy()\n this.workerPortCount--\n if (!this.workerPortCount) {\n clearInterval(this.workerKeepAliveInterval)\n this.workerKeepAliveInterval = null\n }\n }\n\n port.onmessage = async msg => {\n if (msg.data) {\n let chunk\n try {\n chunk = (await asyncIterator.next()).value\n } catch (e) {\n // chunk is yet to be downloaded or it somehow failed, should this be logged?\n }\n port.postMessage(chunk)\n if (!chunk) cleanup()\n if (!this.workerKeepAliveInterval) {\n this.workerKeepAliveInterval = setInterval(() => fetch(`${this.pathname}/keepalive/`), keepAliveTime)\n }\n } else {\n cleanup()\n }\n }\n this.workerPortCount++\n port.postMessage({\n status,\n headers,\n body: asyncIterator ? 'STREAM' : body\n })\n })\n }\n\n // for compatibility with node version\n listen (_, cb) {\n cb()\n }\n\n address () {\n return this._address\n }\n\n close (cb) {\n navigator.serviceWorker.removeEventListener('message', this.boundHandler)\n super.close(cb)\n }\n\n destroy (cb) {\n super.destroy(cb)\n }\n}\n\n// NOTE: Arguments must already be HTML-escaped\nfunction getPageHTML (title, pageHtml) {\n return `\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <title>${title}</title>\n </head>\n <body>\n ${pageHtml}\n </body>\n </html>\n `\n}\n\n// From https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent\nfunction encodeRFC5987 (str) {\n return encodeURIComponent(str)\n // Note that although RFC3986 reserves \"!\", RFC5987 does not,\n // so we do not need to escape it\n .replace(/['()]/g, escape) // i.e., %27 %28 %29\n .replace(/\\*/g, '%2A')\n // The following are not required for percent-encoding per RFC5987,\n // so we can allow for a little better readability over the wire: |`^\n .replace(/%(?:7C|60|5E)/g, unescape)\n}\n\nexport { NodeServer, BrowserServer }\n","/*! webtorrent. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */\nimport EventEmitter from 'events'\nimport path from 'path'\nimport createTorrent, { parseInput } from 'create-torrent'\nimport debugFactory from 'debug'\nimport { Client as DHT } from 'bittorrent-dht' // browser exclude\nimport loadIPSet from 'load-ip-set' // browser exclude\nimport parallel from 'run-parallel'\nimport parseTorrent from 'parse-torrent'\nimport Peer from '@thaunknown/simple-peer'\nimport queueMicrotask from 'queue-microtask'\nimport { hash, hex2arr, arr2hex, arr2base, text2arr, randomBytes, concat } from 'uint8-util'\nimport throughput from 'throughput'\nimport { ThrottleGroup } from 'speed-limiter'\nimport ConnPool from './lib/conn-pool.js' // browser exclude\nimport Torrent from './lib/torrent.js'\nimport { NodeServer, BrowserServer } from './lib/server.js'\n\nimport info from './package.json' assert { type: 'json' }\nconst VERSION = info.version\n\nconst debug = debugFactory('webtorrent')\n\n/**\n * Version number in Azureus-style. Generated from major and minor semver version.\n * For example:\n * '0.16.1' -> '0016'\n * '1.2.5' -> '0102'\n */\nconst VERSION_STR = VERSION\n .replace(/\\d*./g, v => `0${v % 100}`.slice(-2))\n .slice(0, 4)\n\n/**\n * Version prefix string (used in peer ID). WebTorrent uses the Azureus-style\n * encoding: '-', two characters for client id ('WW'), four ascii digits for version\n * number, '-', followed by random numbers.\n * For example:\n * '-WW0102-'...\n */\nconst VERSION_PREFIX = `-WW${VERSION_STR}-`\n\n/**\n * WebTorrent Client\n * @param {Object=} opts\n */\nexport default class WebTorrent extends EventEmitter {\n constructor (opts = {}) {\n super()\n\n if (typeof opts.peerId === 'string') {\n this.peerId = opts.peerId\n } else if (ArrayBuffer.isView(opts.peerId)) {\n this.peerId = arr2hex(opts.peerId)\n } else {\n this.peerId = arr2hex(text2arr(VERSION_PREFIX + arr2base(randomBytes(9))))\n }\n this.peerIdBuffer = hex2arr(this.peerId)\n\n if (typeof opts.nodeId === 'string') {\n this.nodeId = opts.nodeId\n } else if (ArrayBuffer.isView(opts.nodeId)) {\n this.nodeId = arr2hex(opts.nodeId)\n } else {\n this.nodeId = arr2hex(randomBytes(20))\n }\n this.nodeIdBuffer = hex2arr(this.nodeId)\n\n this._debugId = arr2hex(this.peerId).substring(0, 7)\n\n this.destroyed = false\n this.listening = false\n this.torrentPort = opts.torrentPort || 0\n this.dhtPort = opts.dhtPort || 0\n this.tracker = opts.tracker !== undefined ? opts.tracker : {}\n this.lsd = opts.lsd !== false\n this.utPex = opts.utPex !== false\n this.torrents = []\n this.maxConns = Number(opts.maxConns) || 55\n this.utp = WebTorrent.UTP_SUPPORT && opts.utp !== false\n\n this._downloadLimit = Math.max((typeof opts.downloadLimit === 'number') ? opts.downloadLimit : -1, -1)\n this._uploadLimit = Math.max((typeof opts.uploadLimit === 'number') ? opts.uploadLimit : -1, -1)\n\n if (opts.secure === true) {\n import('./lib/peer.js').then(({ enableSecure }) => enableSecure())\n }\n\n this._debug(\n 'new webtorrent (peerId %s, nodeId %s, port %s)',\n this.peerId, this.nodeId, this.torrentPort\n )\n\n this.throttleGroups = {\n down: new ThrottleGroup({ rate: Math.max(this._downloadLimit, 0), enabled: this._downloadLimit >= 0 }),\n up: new ThrottleGroup({ rate: Math.max(this._uploadLimit, 0), enabled: this._uploadLimit >= 0 })\n }\n\n if (this.tracker) {\n if (typeof this.tracker !== 'object') this.tracker = {}\n if (globalThis.WRTC && !this.tracker.wrtc) this.tracker.wrtc = globalThis.WRTC\n }\n\n if (typeof ConnPool === 'function') {\n this._connPool = new ConnPool(this)\n } else {\n queueMicrotask(() => {\n this._onListening()\n })\n }\n\n // stats\n this._downloadSpeed = throughput()\n this._uploadSpeed = throughput()\n\n if (opts.dht !== false && typeof DHT === 'function' /* browser exclude */) {\n // use a single DHT instance for all torrents, so the routing table can be reused\n this.dht = new DHT(Object.assign({}, { nodeId: this.nodeId }, opts.dht))\n\n this.dht.once('error', err => {\n this._destroy(err)\n })\n\n this.dht.once('listening', () => {\n const address = this.dht.address()\n if (address) this.dhtPort = address.port\n })\n\n // Ignore warning when there are > 10 torrents in the client\n this.dht.setMaxListeners(0)\n\n this.dht.listen(this.dhtPort)\n } else {\n this.dht = false\n }\n\n // Enable or disable BEP19 (Web Seeds). Enabled by default:\n this.enableWebSeeds = opts.webSeeds !== false\n\n const ready = () => {\n if (this.destroyed) return\n this.ready = true\n this.emit('ready')\n }\n\n if (typeof loadIPSet === 'function' && opts.blocklist != null) {\n loadIPSet(opts.blocklist, {\n headers: {\n 'user-agent': `WebTorrent/${VERSION} (https://webtorrent.io)`\n }\n }, (err, ipSet) => {\n if (err) return console.error(`Failed to load blocklist: ${err.message}`)\n this.blocked = ipSet\n ready()\n })\n } else {\n queueMicrotask(ready)\n }\n }\n\n /**\n * Creates an http server to serve the contents of this torrent,\n * dynamically fetching the needed torrent pieces to satisfy http requests.\n * Range requests are supported.\n *\n * @param {Object} options\n * @param {String} force\n * @return {BrowserServer||NodeServer}\n */\n createServer (options, force) {\n if (this.destroyed) throw new Error('torrent is destroyed')\n if (this._server) throw new Error('server already created')\n if ((typeof window === 'undefined' || force === 'node') && force !== 'browser') {\n // node implementation\n this._server = new NodeServer(this, options)\n return this._server\n } else {\n // browser implementation\n if (!(options?.controller instanceof ServiceWorkerRegistration)) throw new Error('Invalid worker registration')\n if (options.controller.active.state !== 'activated') throw new Error('Worker isn\\'t activated')\n this._server = new BrowserServer(this, options)\n return this._server\n }\n }\n\n get downloadSpeed () { return this._downloadSpeed() }\n\n get uploadSpeed () { return this._uploadSpeed() }\n\n get progress () {\n const torrents = this.torrents.filter(torrent => torrent.progress !== 1)\n const downloaded = torrents.reduce((total, torrent) => total + torrent.downloaded, 0)\n const length = torrents.reduce((total, torrent) => total + (torrent.length || 0), 0) || 1\n return downloaded / length\n }\n\n get ratio () {\n const uploaded = this.torrents.reduce((total, torrent) => total + torrent.uploaded, 0)\n const received = this.torrents.reduce((total, torrent) => total + torrent.received, 0) || 1\n return uploaded / received\n }\n\n /**\n * Returns the torrent with the given `torrentId`. Convenience method. Easier than\n * searching through the `client.torrents` array. Returns `null` if no matching torrent\n * found.\n *\n * @param {string|Buffer|Object|Torrent} torrentId\n * @return {Promise<Torrent|null>}\n */\n async get (torrentId) {\n if (torrentId instanceof Torrent) {\n if (this.torrents.includes(torrentId)) return torrentId\n } else {\n const torrents = this.torrents\n let parsed\n try { parsed = await parseTorrent(torrentId) } catch (err) {}\n if (!parsed) return null\n if (!parsed.infoHash) throw new Error('Invalid torrent identifier')\n\n for (const torrent of torrents) {\n if (torrent.infoHash === parsed.infoHash) return torrent\n }\n }\n return null\n }\n\n /**\n * Start downloading a new torrent. Aliased as `client.download`.\n * @param {string|Buffer|Object} torrentId\n * @param {Object} opts torrent-specific options\n * @param {function=} ontorrent called when the torrent is ready (has metadata)\n */\n add (torrentId, opts = {}, ontorrent = () => {}) {\n if (this.destroyed) throw new Error('client is destroyed')\n if (typeof opts === 'function') [opts, ontorrent] = [{}, opts]\n\n const onInfoHash = () => {\n if (this.destroyed) return\n for (const t of this.torrents) {\n if (t.infoHash === torrent.infoHash && t !== torrent) {\n torrent._destroy(new Error(`Cannot add duplicate torrent ${torrent.infoHash}`))\n ontorrent(t)\n return\n }\n }\n }\n\n const onReady = () => {\n if (this.destroyed) return\n ontorrent(torrent)\n this.emit('torrent', torrent)\n }\n\n function onClose () {\n torrent.removeListener('_infoHash', onInfoHash)\n torrent.removeListener('ready', onReady)\n torrent.removeListener('close', onClose)\n }\n\n this._debug('add')\n opts = opts ? Object.assign({}, opts) : {}\n\n const torrent = new Torrent(torrentId, this, opts)\n this.torrents.push(torrent)\n\n torrent.once('_infoHash', onInfoHash)\n torrent.once('ready', onReady)\n torrent.once('close', onClose)\n\n return torrent\n }\n\n /**\n * Start seeding a new file/folder.\n * @param {string|File|FileList|Buffer|Array.<string|File|Buffer>} input\n * @param {Object=} opts\n * @param {function=} onseed called when torrent is seeding\n */\n seed (input, opts, onseed) {\n if (this.destroyed) throw new Error('client is destroyed')\n if (typeof opts === 'function') [opts, onseed] = [{}, opts]\n\n this._debug('seed')\n opts = opts ? Object.assign({}, opts) : {}\n\n // no need to verify the hashes we create\n opts.skipVerify = true\n\n const isFilePath = typeof input === 'string'\n\n // When seeding from fs path, initialize store from that path to avoid a copy\n if (isFilePath) opts.path = path.dirname(input)\n if (!opts.createdBy) opts.createdBy = `WebTorrent/${VERSION_STR}`\n\n const onTorrent = torrent => {\n const tasks = [\n cb => {\n // when a filesystem path is specified or the store is preloaded, files are already in the FS store\n if (isFilePath || opts.preloadedStore) return cb()\n torrent.load(streams, cb)\n }\n ]\n if (this.dht) {\n tasks.push(cb => {\n torrent.once('dhtAnnounce', cb)\n })\n }\n parallel(tasks, err => {\n if (this.destroyed) return\n if (err) return torrent._destroy(err)\n _onseed(torrent)\n })\n }\n\n const _onseed = torrent => {\n this._debug('on seed')\n if (typeof onseed === 'function') onseed(torrent)\n torrent.emit('seed')\n this.emit('seed', torrent)\n }\n\n const torrent = this.add(null, opts, onTorrent)\n let streams\n\n if (isFileList(input)) input = Array.from(input)\n else if (!Array.isArray(input)) input = [input]\n\n parallel(input.map(item => async cb => {\n if (!opts.preloadedStore && isReadable(item)) {\n const chunks = []\n try {\n for await (const chunk of item) {\n chunks.push(chunk)\n }\n } catch (err) {\n return cb(err)\n }\n const buf = concat(chunks)\n buf.name = item.name\n cb(null, buf)\n } else {\n cb(null, item)\n }\n }), (err, input) => {\n if (this.destroyed) return\n if (err) return torrent._destroy(err)\n\n parseInput(input, opts, (err, files) => {\n if (this.destroyed) return\n if (err) return torrent._destroy(err)\n\n streams = files.map(file => file.getStream)\n\n createTorrent(input, opts, async (err, torrentBuf) => {\n if (this.destroyed) return\n if (err) return torrent._destroy(err)\n\n const existingTorrent = await this.get(torrentBuf)\n if (existingTorrent) {\n console.warn('A torrent with the same id is already being seeded')\n torrent._destroy()\n if (typeof onseed === 'function') onseed(existingTorrent)\n } else {\n torrent._onTorrentId(torrentBuf)\n }\n })\n })\n })\n\n return torrent\n }\n\n /**\n * Remove a torrent from the client.\n * @param {string|Buffer|Torrent} torrentId\n * @param {function} cb\n */\n async remove (torrentId, opts, cb) {\n if (typeof opts === 'function') return this.remove(torrentId, null, opts)\n\n this._debug('remove')\n const torrent = await this.get(torrentId)\n if (!torrent) throw new Error(`No torrent with id ${torrentId}`)\n this._remove(torrent, opts, cb)\n }\n\n _remove (torrent, opts, cb) {\n if (!torrent) return\n if (typeof opts === 'function') return this._remove(torrent, null, opts)\n this.torrents.splice(this.torrents.indexOf(torrent), 1)\n torrent.destroy(opts, cb)\n if (this.dht) {\n this.dht._tables.remove(torrent.infoHash)\n }\n }\n\n address () {\n if (!this.listening) return null\n return this._connPool\n ? this._connPool.tcpServer.address()\n : { address: '0.0.0.0', family: 'IPv4', port: 0 }\n }\n\n /**\n * Set global download throttle rate.\n * @param {Number} rate (must be bigger or equal than zero, or -1 to disable throttling)\n */\n throttleDownload (rate) {\n rate = Number(rate)\n if (isNaN(rate) || !isFinite(rate) || rate < -1) return false\n this._downloadLimit = rate\n if (this._downloadLimit < 0) return this.throttleGroups.down.setEnabled(false)\n this.throttleGroups.down.setEnabled(true)\n this.throttleGroups.down.setRate(this._downloadLimit)\n }\n\n /**\n * Set global upload throttle rate\n * @param {Number} rate (must be bigger or equal than zero, or -1 to disable throttling)\n */\n throttleUpload (rate) {\n rate = Number(rate)\n if (isNaN(rate) || !isFinite(rate) || rate < -1) return false\n this._uploadLimit = rate\n if (this._uploadLimit < 0) return this.throttleGroups.up.setEnabled(false)\n this.throttleGroups.up.setEnabled(true)\n this.throttleGroups.up.setRate(this._uploadLimit)\n }\n\n /**\n * Destroy the client, including all torrents and connections to peers.\n * @param {function} cb\n */\n destroy (cb) {\n if (this.destroyed) throw new Error('client already destroyed')\n this._destroy(null, cb)\n }\n\n _destroy (err, cb) {\n this._debug('client destroy')\n this.destroyed = true\n\n const tasks = this.torrents.map(torrent => cb => {\n torrent.destroy(cb)\n })\n\n if (this._connPool) {\n tasks.push(cb => {\n this._connPool.destroy(cb)\n })\n }\n\n if (this.dht) {\n tasks.push(cb => {\n this.dht.destroy(cb)\n })\n }\n\n if (this._server) {\n tasks.push(cb => {\n this._server.destroy(cb)\n })\n }\n\n parallel(tasks, cb)\n\n if (err) this.emit('error', err)\n\n this.torrents = []\n this._connPool = null\n this.dht = null\n\n this.throttleGroups.down.destroy()\n this.throttleGroups.up.destroy()\n }\n\n _onListening () {\n this._debug('listening')\n this.listening = true\n\n if (this._connPool) {\n // Sometimes server.address() returns `null` in Docker.\n const address = this._connPool.tcpServer.address()\n if (address) this.torrentPort = address.port\n }\n\n this.emit('listening')\n }\n\n _debug () {\n const args = [].slice.call(arguments)\n args[0] = `[${this._debugId}] ${args[0]}`\n debug(...args)\n }\n\n async _getByHash (infoHashHash) {\n for (const torrent of this.torrents) {\n if (!torrent.infoHashHash) {\n torrent.infoHashHash = await hash(hex2arr('72657132' /* 'req2' */ + torrent.infoHash), 'hex')\n }\n if (infoHashHash === torrent.infoHashHash) {\n return torrent\n }\n }\n\n return null\n }\n}\n\nWebTorrent.WEBRTC_SUPPORT = Peer.WEBRTC_SUPPORT\nWebTorrent.UTP_SUPPORT = ConnPool.UTP_SUPPORT\nWebTorrent.VERSION = VERSION\n\n/**\n * Check if `obj` is a node Readable stream\n * @param {*} obj\n * @return {boolean}\n */\nfunction isReadable (obj) {\n return typeof obj === 'object' && obj != null && typeof obj.pipe === 'function'\n}\n\n/**\n * Check if `obj` is a W3C `FileList` object\n * @param {*} obj\n * @return {boolean}\n */\nfunction isFileList (obj) {\n return typeof FileList !== 'undefined' && obj instanceof FileList\n}\n"],"names":["leafPrototypes","getProto","exports","byteLength","b64","lens","getLens","validLen","placeHoldersLen","toByteArray","tmp","i","arr","Arr","_byteLength","curByte","len","revLookup","charCodeAt","fromByteArray","uint8","length","extraBytes","parts","maxChunkLength","len2","push","encodeChunk","lookup","join","Uint8Array","Array","code","Error","indexOf","start","end","num","output","concat","chunks","size","b","offset","l","chunk","set","module","async","iterator","opts","nopad","zeroPadding","buffered","bufferedBytes","value","slice","base64","ieee754","customInspectSymbol","Symbol","Buffer","K_MAX_LENGTH","createBuffer","RangeError","buf","Object","setPrototypeOf","prototype","arg","encodingOrOffset","TypeError","allocUnsafe","from","string","encoding","isEncoding","actual","write","fromString","ArrayBuffer","isView","arrayView","isInstance","copy","fromArrayBuffer","buffer","byteOffset","fromArrayLike","fromArrayView","SharedArrayBuffer","valueOf","obj","isBuffer","checked","undefined","numberIsNaN","type","isArray","data","fromObject","toPrimitive","assertSize","array","toString","mustMatch","arguments","loweredCase","utf8ToBytes","base64ToBytes","toLowerCase","slowToString","this","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","n","m","bidirectionalIndexOf","val","dir","arrayIndexOf","call","lastIndexOf","indexSize","arrLength","valLength","String","read","readUInt16BE","foundIndex","found","j","hexWrite","Number","remaining","strLen","parsed","parseInt","substr","utf8Write","blitBuffer","asciiWrite","str","byteArray","asciiToBytes","base64Write","ucs2Write","units","c","hi","lo","utf16leToBytes","Math","min","res","firstByte","codePoint","bytesPerSequence","secondByte","thirdByte","fourthByte","tempCodePoint","codePoints","MAX_ARGUMENTS_LENGTH","fromCharCode","apply","decodeCodePointsArray","TYPED_ARRAY_SUPPORT","proto","foo","e","typedArraySupport","console","error","defineProperty","enumerable","get","poolSize","alloc","fill","allocUnsafeSlow","_isBuffer","compare","a","x","y","list","pos","swap16","swap32","swap64","toLocaleString","equals","inspect","max","replace","trim","target","thisStart","thisEnd","thisCopy","targetCopy","includes","isFinite","toJSON","_arr","ret","out","hexSliceLookupTable","bytes","checkOffset","ext","checkInt","wrtBigUInt64LE","checkIntBI","BigInt","wrtBigUInt64BE","checkIEEE754","writeFloat","littleEndian","noAssert","writeDouble","newBuf","subarray","readUintLE","readUIntLE","mul","readUintBE","readUIntBE","readUint8","readUInt8","readUint16LE","readUInt16LE","readUint16BE","readUint32LE","readUInt32LE","readUint32BE","readUInt32BE","readBigUInt64LE","defineBigIntMethod","validateNumber","first","last","boundsError","readBigUInt64BE","readIntLE","pow","readIntBE","readInt8","readInt16LE","readInt16BE","readInt32LE","readInt32BE","readBigInt64LE","readBigInt64BE","readFloatLE","readFloatBE","readDoubleLE","readDoubleBE","writeUintLE","writeUIntLE","writeUintBE","writeUIntBE","writeUint8","writeUInt8","writeUint16LE","writeUInt16LE","writeUint16BE","writeUInt16BE","writeUint32LE","writeUInt32LE","writeUint32BE","writeUInt32BE","writeBigUInt64LE","writeBigUInt64BE","writeIntLE","limit","sub","writeIntBE","writeInt8","writeInt16LE","writeInt16BE","writeInt32LE","writeInt32BE","writeBigInt64LE","writeBigInt64BE","writeFloatLE","writeFloatBE","writeDoubleLE","writeDoubleBE","targetStart","copyWithin","errors","E","sym","getMessage","Base","constructor","super","writable","configurable","name","stack","message","addNumericalSeparator","range","ERR_OUT_OF_RANGE","checkBounds","ERR_INVALID_ARG_TYPE","floor","ERR_BUFFER_OUT_OF_BOUNDS","input","msg","received","isInteger","abs","INVALID_BASE64_RE","Infinity","leadSurrogate","split","base64clean","src","dst","alphabet","table","i16","fn","BufferBigIntNotDefined","LRU","queueMicrotask","store","chunkLength","inProgressGets","Map","put","cache","index","cb","remove","waiters","getAlreadyStarted","err","inProgressEntry","delete","slicedBuf","close","destroy","clone","_instanceof","nativeMap","nativeSet","nativePromise","_","Set","Promise","parent","circular","depth","includeNonEnumerable","allParents","allChildren","useBuffer","_clone","child","resolve","reject","then","__isArray","__isRegExp","RegExp","source","__getRegExpFlags","lastIndex","__isDate","Date","getTime","create","getPrototypeOf","forEach","key","keyChild","valueChild","entryChild","add","attrs","getOwnPropertyDescriptor","getOwnPropertySymbols","symbols","symbol","descriptor","allPropertyNames","getOwnPropertyNames","propertyName","__objToStr","o","re","flags","global","ignoreCase","multiline","clonePrototype","navigator","hardwareConcurrency","cpus","model","speed","times","user","nice","sys","idle","irq","formatArgs","args","useColors","namespace","humanize","diff","color","splice","lastC","match","save","namespaces","storage","setItem","removeItem","load","r","getItem","process","env","DEBUG","window","__nwjs","userAgent","document","documentElement","style","WebkitAppearance","firebug","exception","$1","localStorage","localstorage","warned","warn","colors","log","debug","formatters","v","JSON","stringify","createDebug","prevTime","namespacesCache","enabledCache","enableOverride","enabled","self","curr","ms","prev","coerce","unshift","format","formatter","selectColor","extend","init","delimiter","newDebug","toNamespace","regexp","substring","default","disable","names","map","skips","enable","test","keys","hash","once","noop","eos","stream","callback","ws","_writableState","rs","_readableState","readable","cancelled","onlegacyfinish","onfinish","onend","onexit","exitCode","onerror","onclose","nextTick","onclosenexttick","ended","destroyed","onrequest","req","on","setHeader","abort","isRequest","stdio","isChildProcess","removeListener","assign","props","ErrClass","matchHtmlRegExp","escape","exec","html","objectCreate","F","objectKeys","k","hasOwnProperty","bind","Function","context","EventEmitter","_events","_eventsCount","_maxListeners","hasDefineProperty","defaultMaxListeners","$getMaxListeners","that","_addListener","listener","prepend","events","existing","newListener","emit","w","emitter","count","onceWrapper","fired","wrapFn","_onceWrap","state","wrapped","_listeners","unwrap","evlistener","unwrapListeners","arrayClone","listenerCount","setMaxListeners","isNaN","getMaxListeners","er","handler","doError","isFn","listeners","emitNone","arg1","emitOne","arg2","emitTwo","arg3","emitThree","emitMany","addListener","prependListener","prependOnceListener","position","originalListener","shift","pop","spliceOne","removeAllListeners","rawListeners","eventNames","Reflect","ownKeys","hwm","mask","top","btm","next","peek","isEmpty","FixedFIFO","head","tail","ReadableStream","asyncIterator","reader","getReader","temp","return","releaseLock","throw","globalThis","wrtc","RTCPeerConnection","mozRTCPeerConnection","webkitRTCPeerConnection","RTCSessionDescription","mozRTCSessionDescription","webkitRTCSessionDescription","RTCIceCandidate","mozRTCIceCandidate","webkitRTCIceCandidate","idb","closed","lastChunkLength","lastChunkIndex","ceil","dbPromise","openDB","upgrade","db","createObjectStore","blocking","terminated","isLastChunk","rawResult","notFound","deleteDB","instanceOfAny","object","constructors","some","idbProxyableTypes","cursorAdvanceMethods","cursorRequestMap","WeakMap","transactionDoneMap","transactionStoreNamesMap","transformCache","reverseTransformCache","idbProxyTraps","prop","receiver","IDBTransaction","objectStoreNames","objectStore","wrap","has","wrapFunction","func","IDBDatabase","transaction","IDBCursor","advance","continue","continuePrimaryKey","storeNames","tx","sort","transformCachableValue","done","unlisten","removeEventListener","complete","DOMException","addEventListener","cacheDonePromiseForTransaction","IDBObjectStore","IDBIndex","Proxy","IDBRequest","request","promise","success","result","catch","promisifyRequest","newValue","version","blocked","indexedDB","open","openPromise","event","oldVersion","newVersion","deleteDatabase","readMethods","writeMethods","cachedMethods","getMethod","targetFuncName","useIndex","isWrite","method","storeName","all","oldTraps","isLE","mLen","nBytes","eLen","eMax","eBias","nBits","d","s","NaN","rt","LN2","mem","ctor","superCtor","super_","TempCtor","iterators","regex","is","filename","not","RateLimiter","TokenBucket","hrtime","seconds","nanoseconds","getMilliseconds","tokensPerInterval","interval","fireImmediately","tokenBucket","content","curIntervalStart","tokensThisInterval","removeTokens","bucketSize","now","waitInterval","setTimeout","afterTokensRemoved","tokensRemaining","tryRemoveTokens","removed","getTokensRemaining","drip","parentBucket","lastDrip","comeBackLater","remainingTokens","POSITIVE_INFINITY","deltaMS","dripAmount","inherits","maxAge","clear","element","_unlink","_checkAge","modified","evict","arrayRemove","ltDontHave","wire","_peerSupports","_wire","onExtendedHandshake","onMessage","peerPieces","_failRequests","donthave","extended","requests","piece","_callback","Storage","Mime","_types","_extensions","define","getType","getExtension","typeMap","force","extensions","t","path","hasPath","h","plural","msAbs","isPlural","round","options","parseFloat","parse","long","fmtLong","fmtShort","wrappy","f","called","onceStrict","onceError","strict","assertPath","normalizeStringPosix","allowAboveRoot","lastSegmentLength","lastSlash","dots","lastSlashIndex","posix","cwd","resolvedPath","resolvedAbsolute","normalize","isAbsolute","trailingSeparator","joined","relative","to","fromStart","fromEnd","fromLen","toStart","toLen","lastCommonSep","fromCode","_makeLong","dirname","hasRoot","matchedSlash","basename","extIdx","firstNonSlashEnd","extname","startDot","startPart","preDotState","pathObject","sep","root","base","_format","win32","log2","fs","ancient","destroyer","reading","writing","ReadStream","WriteStream","isFS","pipe","streams","destroys","reduce","random","el","mapWithIndex","mapWithoutIndex","sortByRangeIndex","sortByRangeStart","ranges","combine","ordered","current","combined","combineRanges","createRC4","N","seed","every","keylen","identityPermutation","RC4","randomNative","randomUInt32","randomByte","randomFloat","currentState","setState","RC4small","ordA","ord0","toHex","fromHex","currentStateString","setStateString","stateString","tasks","results","pending","isErrored","isSync","each","task","Throttle","ThrottleGroup","throttles","setEnabled","setRate","rate","chunksize","getEnabled","_enabled","getRate","bucket","getChunksize","throttle","setChunksize","group","_addThrottle","_removeThrottle","Transform","wait","params","_setEnabled","_group","_emitter","_destroyed","getGroup","_transform","_processChunk","amount","isDone","_areBothEnabled","_waitForTokens","time","STREAM_DESTROYED","PREMATURE_CLOSE","queueTick","FIFO","MAX","NOT_OPENING","READ_ACTIVE","READ_QUEUED","READ_RESUMED","READ_ENDING","READ_EMIT_DATA","READ_EMIT_READABLE","READ_EMITTED_READABLE","READ_DONE","READ_NEXT_TICK","READ_PIPE_NOT_DRAINED","WRITE_ACTIVE","WRITE_PRIMARY","WRITE_SYNC","WRITE_QUEUED","WRITE_UNDRAINED","WRITE_DONE","WRITE_EMIT_DRAIN","WRITE_NEXT_TICK","WRITE_FINISHING","WRITE_NOT_ACTIVE","WRITE_NON_PRIMARY","ACTIVE","NOT_ACTIVE","DONE","DESTROY_STATUS","DESTROYING","OPEN_STATUS","AUTO_DESTROY","ACTIVE_OR_TICKING","IS_OPENING","WRITE_QUEUED_AND_ACTIVE","WRITE_STATUS","WritableState","highWaterMark","mapWritable","byteLengthWritable","queue","pipeline","defaultByteLength","afterWrite","afterUpdateNextTick","updateWriteNT","_duplexState","autoBatch","_writev","update","_write","updateNonPrimary","_final","afterFinal","_open","afterOpen","_destroy","afterDestroy","updateNextTick","ReadableState","mapReadable","byteLengthReadable","pipeTo","afterRead","updateReadNT","Pipeline","isStreamx","finished","afterDrain","drain","_read","READ_PRIMARY","TransformState","afterTransform","afterPipe","pipeToFinished","Stream","predestroy","_predestroy","signal","destroying","Readable","OPENING","eagerOpen","resume","pause","dest","static","ite","_fromAsyncIterator","promiseResolve","promiseReject","ondata","Duplex","writev","final","batch","_transformState","transform","flush","_flush","transformAfterFlush","errorHandle","fin","rd","wr","isStream","isTypedArray","pipelinePromise","getStreamError","Writable","PassThrough","base32","encode","decode","byteTable","plain","buff","quintets","shiftIndex","digit","encoded","plainChar","plainDigit","plainPos","decoded","encodedByte","getTick","pointer","delta","tick","dist","BLOCK_LENGTH","Piece","missing","sources","_chunks","_remainder","_buffered","_buffer","_cancellations","_reservations","_flushed","chunkLengthRemaining","chunkOffset","reserve","reserveRemaining","cancel","cancelRemaining","blocks","splitData","wrapper","TYPE_TCP_INCOMING","TYPE_TCP_OUTGOING","TYPE_UTP_INCOMING","TYPE_UTP_OUTGOING","TYPE_WEBSEED","secure","enableSecure","Peer","id","addr","conn","swarm","connected","timeout","retries","sentPe1","sentPe2","sentPe3","sentPe4","sentHandshake","onConnect","clearTimeout","connectTimeout","onPe1","onPe2","onPe3","onPe4","infoHash","peerId","onHandshake","startHandshakeTimeout","setThrottlePipes","sendPe1","handshake","sendPe2","sendPe3","infoHashHash","sendPe4","clearPipes","unpipe","throttleGroups","down","up","handshakeTimeout","remoteAddress","remotePort","_onWire","dht","private","client","fast","startConnectTimeout","connectTimeoutValues","webrtc","tcpOutgoing","utpOutgoing","unref","wires","removePeer","TYPE_WEBRTC","SOURCE_MANUAL","SOURCE_TRACKER","SOURCE_DHT","SOURCE_LSD","SOURCE_UT_PEX","createWebRTCPeer","peer","cleanup","onError","createTCPIncomingPeer","_createIncomingPeer","createUTPIncomingPeer","createTCPOutgoingPeer","_createOutgoingPeer","createUTPOutgoingPeer","createWebSeedPeer","digitCount","sign","log10","Boolean","buffers","_encode","_floatConversionDetected","dict","dictMap","listSet","number","buffE","buffD","buffL","maxLo","trace","kl","item","getIntFromBuffer","sum","dictionary","integer","find","chr","lst","encodingLength","arrayBufferLength","stringLength","listLength","keyLength","objectLength","mapLength","getByteSize","BitField","grow","newBuffer","byte","MESSAGE_PROTOCOL","MESSAGE_KEEP_ALIVE","MESSAGE_CHOKE","MESSAGE_UNCHOKE","MESSAGE_INTERESTED","MESSAGE_UNINTERESTED","MESSAGE_RESERVED","MESSAGE_PORT","MESSAGE_HAVE_ALL","MESSAGE_HAVE_NONE","VC","CRYPTO_PROVIDE","CRYPTO_SELECT","xor","Request","HaveAllBitField","Wire","peEnabled","_debugId","_debug","peerIdBuffer","amChoking","amInterested","peerChoking","peerInterested","peerExtensions","peerRequests","extendedMapping","peerExtendedMapping","extendedHandshake","peerExtendedHandshake","hasFast","allowedFastSet","peerAllowedFastSet","_ext","_nextExt","uploaded","downloaded","uploadSpeed","downloadSpeed","_keepAliveInterval","_timeout","_timeoutMs","_timeoutExpiresAt","_finished","_parserSize","_parser","_bufferSize","_peEnabled","_dh","_myPubKey","generateKeys","_peerPubKey","_sharedSecret","_peerCryptoProvide","_cryptoHandshakeDone","_cryptoSyncPattern","_waitMaxBytes","_encryptionMethod","_encryptGenerator","_decryptGenerator","_setGenerators","_onFinish","_determineHandshakeType","_parsePe2","_parseHandshake","setKeepAlive","clearInterval","setInterval","keepAlive","_timeoutUnref","_resetTimeout","_onUninterested","_onChoke","use","Extension","_push","padALen","padA","padBLen","padB","setEncrypt","hash1Buffer","_utfToHex","hashesXorBuffer","padCLen","DataView","getUint16","padCBuffer","vcAndProvideBuffer","view","setInt16","_encryptHandshake","padDLen","padDBuffer","vcAndSelectBuffer","infoHashBuffer","_infoHash","reserved","_handshakeSent","_extendedHandshakeSent","_sendExtendedHandshake","choke","allowedCount","unchoke","interested","uninterested","have","_message","bitfield","_pull","port","setUint16","suggest","haveAll","haveNone","allowedFast","extId","sharedSecret","encryptKeyBuf","encryptKeyIntArray","decryptKeyBuf","decryptKeyIntArray","values","numbers","dataLength","setUint32","_encrypt","_onKeepAlive","_onPe1","pubKeyBuffer","computeSecret","_onPe2","hash3","sKeyHash","_onPe3Encrypted","vcBuffer","peerProvideBuffer","provideByte","_onPe4","peerSelectBuffer","_onHandshake","_onUnchoke","_onInterested","_onHave","_onBitField","_onRequest","respond","_onPiece","_onCancel","_onPort","_onSuggest","_onHaveAll","_onHaveNone","_onReject","_onAllowedFast","_onExtended","info","_onTimeout","_decrypt","setAgain","timeoutExpiresAt","_parse","parser","_parseUntil","pattern","maxBytes","_onMessageLength","getUint32","_onMessage","pstrLenBuffer","pstrlen","_onHandshakeBuffer","_parsePe1","pubKeyPrefix","pubKeySuffix","_parsePe3","pubKey","_parsePe4","_onPe3","_parsePe3Encrypted","_decryptHandshake","iaLenBuf","iaLen","iaBuffer","protocol","vcBufferEncrypted","padDBuf","MAX_VALUE","crypt","keystream","decrypt","encodeLookup","decodeLookup","arr2hex","hex2arr","sizeof","equal","chars","decoder","TextDecoder","arr2text","enc","encoder","TextEncoder","text2arr","arr2base","arraybuffer","bin2hex","hex2bin","hex","points","scope","crypto","msCrypto","subtle","webkitSubtle","formatMap","algo","digest","randomBytes","getRandomValues","title","browser","argv","versions","off","umask","binding","chdir","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","mode","__esModule","ns","def","definition","toStringTag","announceList","pathSymbol","_parseInput","FileList","isBlob","commonPrefix","fullPath","unknownName","filterJunkFiles","filter","junk","isJunkPath","pathless","isReadable","numPaths","isSingleFileTorrent","pathIsFile","processInput","file","getStream","getStreamStream","files","flat","MAX_OUTSTANDING_HASHES","sumLength","Blob","singleFileTorrent","_announceList","announce","u","WEBTORRENT_ANNOUNCE","urlList","torrent","creationDate","comment","createdBy","sslCert","estimatedTorrentLength","pieceLength","pieces","hashedLength","onProgress","remainingHashes","pieceNum","getPieceList","torrentLength","bencode","onFiles","File","FormData","Headers","Response","AbortController","AbortSignal","fetch","parseRange","acc","cur","idx","generateRange","uri","param","keyval","decodeURIComponent","xt","decodedStr","infoHashV2","xs","publicKey","infoHashV2Buffer","publicKeyBuffer","dn","kt","keywords","tr","as","peerAddresses","parseTorrent","torrentId","torrentObj","ensure","infoBuffer","created","urls","url","p","lastFile","lastPieceLength","splitPieces","decodeTorrentFile","parseTorrentRemote","parsedTorrent","parseOrThrow","arrayBuffer","headers","torrentBuf","bool","fieldName","toMagnetURI","xts","xtsDeduped","encodeURIComponent","startsWith","Debug","MAX_BUFFERED_AMOUNT","filterTrickle","sdp","allowHalfOpen","__objectMode","objectMode","_id","channelName","initiator","channelConfig","channelNegotiated","negotiated","config","offerOptions","answerOptions","sdpTransform","trickle","allowHalfTrickle","iceCompleteTimeout","_destroying","_connected","remoteFamily","localAddress","localFamily","localPort","_wrtc","_pcReady","_channelReady","_iceComplete","_iceCompleteTimer","_channel","_pendingCandidates","_isNegotiating","_firstNegotiation","_batchedNegotiation","_queuedNegotiation","_sendersAwaitingStable","_senderMap","_closingInterval","_remoteTracks","_remoteStreams","_chunk","_cb","_interval","_pc","__destroy","_isReactNativeWebrtc","_peerConnectionId","oniceconnectionstatechange","_onIceStateChange","onicegatheringstatechange","onconnectionstatechange","_onConnectionStateChange","onsignalingstatechange","_onSignalingStateChange","onicecandidate","_onIceCandidate","peerIdentity","_setupData","channel","createDataChannel","ondatachannel","addStream","ontrack","_onTrack","_needsNegotiation","_onFinishBound","bufferSize","bufferedAmount","readyState","address","family","renegotiate","transceiverRequest","addTransceiver","kind","candidate","remoteDescription","_addIceCandidate","setRemoteDescription","_createAnswer","iceCandidateObj","addIceCandidate","endsWith","send","getTracks","track","addTrack","submap","sender","replaceTrack","oldTrack","newTrack","removeTrack","removeStream","negotiate","_createOffer","onmessage","onopen","binaryType","bufferedAmountLowThreshold","label","_onChannelMessage","onbufferedamountlow","_onChannelBufferedAmountLow","_onChannelOpen","_onChannelClose","lineno","colno","isClosing","destroySoon","_startIceCompleteTimeout","createOffer","offer","sendOffer","localDescription","setLocalDescription","_requestMissingTransceivers","getTransceivers","transceiver","mid","requested","createAnswer","answer","sendAnswer","connectionState","iceConnectionState","iceGatheringState","_maybeReady","getStats","flattenValues","report","reports","stat","timestamp","_connecting","findCandidatePair","items","remoteCandidates","localCandidates","candidatePairs","foundSelectedCandidatePair","setSelectedCandidatePair","selectedCandidatePair","local","localCandidateId","ip","ipAddress","portNumber","googLocalAddress","remote","remoteCandidateId","googRemoteAddress","selectedCandidatePairId","googActiveConnection","selected","_onInterval","signalingState","sdpMLineIndex","sdpMid","eventStream","remoteStream","WEBRTC_SUPPORT","iceServers","sdpSemantics","ADDR_RE","addrToIPPort","chunkStoreRead","remainingLength","chunkStoreWrite","storeMaxOutstandingPuts","outstandingPuts","DEFAULT_ANNOUNCE_PEERS","MAX_ANNOUNCE_PEERS","parseUrl","URL","defineProperties","href","origin","_WebSocket","WebSocket","Socket","socket","_ws","OPEN","_handleOpen","_handleMessage","_handleClose","_handleError","_handleFinishBound","_handleFinish","onClose","CLOSED","WEBSOCKET_SUPPORT","announceUrl","intervalMs","DEFAULT_ANNOUNCE_INTERVAL","_defaultAnnounceOpts","socketPool","WebSocketTracker","peers","reconnecting","reconnectTimer","expectingResponse","_openSocket","action","info_hash","_infoHashBinary","peer_id","_peerIdBinary","_trackerId","trackerid","_send","numwant","_generateOffers","offers","scrape","trackerTimeout","_onSocketConnectBound","_onSocketDataBound","_onSocketCloseBound","_onSocketErrorBound","consumers","destroyCleanup","DESTROY_TIMEOUT","_onSocketConnect","_onSocketError","_onSocketData","_onSocketClose","parsedUrl","agent","_proxyOpts","httpsAgent","httpAgent","socksProxy","_onAnnounceResponse","_onScrapeResponse","failure","warning","trackerId","response","_createPeer","to_peer_id","offer_id","offerId","_startReconnectTimer","generateOffer","checkDone","_rtcConfig","_socketPool","_peerIdBuffer","_infoHashBuffer","_port","_getAnnounceOpts","getAnnounceOpts","rtcConfig","_userAgent","proxyOpts","webrtcSupport","nextTickWarn","_trackers","common","location","_announce","tracker","stop","clientOpts","Discovery","_intervalMs","_trackerOpts","_dhtAnnouncing","_dhtTimeout","_internalDHT","_onWarning","_onError","_onDHTPeer","host","_onTrackerPeer","_onTrackerAnnounce","_onLSDPeer","createDHT","listen","_createTracker","addNode","dhtPort","_dhtAnnounce","lsd","_createLSD","updatePort","getDirectory","storageDir","removeEntry","recursive","FSAChunkStore","randomUUID","rootDirPromise","rootDir","storageDirPromise","getDirectoryHandle","chunksDirPromise","chunkMap","directoryMap","_getChunksDirHandle","prevFile","handle","_createFileHandle","blob","_createBlobReference","fileStart","fileEnd","firstChunk","lastChunk","chunkStart","getFileHandle","fileName","_getDirectoryHandle","getFile","_put","chunkWrite","_getChunkHandle","createWritable","keepExistingData","targets","promises","_get","rangeFrom","rangeTo","clearChunks","chrome","FSASupport","FileSystemFileHandle","HybridChunkStore","fallbackStore","dataStore","chunkCount","stores","_init","onlyMem","ChunkStore","PIECE_LENGTH","metadata","utMetadata","_fetching","_metadataComplete","_metadataSize","_remainingRejects","_bitfield","setMetadata","ut_metadata","metadata_size","_numPieces","_requestPieces","trailer","trailerIndex","msg_type","_onData","total_size","_request","_data","totalSize","_reject","_checkDone","_failedMetadata","FileIterator","_torrent","_pieceLength","_startPiece","_endPiece","_piece","_offset","_missing","_criticalLength","select","pump","critical","deselect","_fileStreams","_iterators","_client","getPieceDownloaded","pieceIndex","pieceDownloaded","irrelevantFirstPieceBytes","irrelevantLastPieceBytes","progress","priority","createReadStream","fileStream","enqueue","streamURL","_server","pathname","encodeURI","streamTo","elem","RarityMap","_pieces","recalculate","_initWire","_onWireHave","_onWireBitfield","getRarestPiece","pieceFilterFunc","candidates","availability","_cleanupWireEvents","_onClose","VERSION","WebConn","connId","numPieces","lt_donthave","httpRequest","retryTimeout","rangeStart","rangeEnd","requestedFiles","requestedFile","fileOffsetInRange","ok","status","CHOKE_TIMEOUT","SPEED_THRESHOLD","FILESYSTEM_CONCURRENCY","RECONNECT_WAIT","USER_AGENT","TMP","IDLE_CALLBACK","requestIdleCallback","Torrent","addUID","skipVerify","_store","_preloadedStore","preloadedStore","_storeCacheSlots","storeCacheSlots","_destroyStoreOnDestroy","destroyStoreOnDestroy","storeOpts","strategy","maxWebConns","_rechokeNumSlots","uploads","_rechokeOptimisticWire","_rechokeOptimisticTime","_rechokeIntervalId","_noPeersIntervalId","_noPeersIntervalTime","noPeersIntervalTime","ready","paused","_amInterested","_selections","_critical","_queue","_peers","_peersLength","_downloadSpeed","throughput","_uploadSpeed","_servers","_xsRequests","_fileModtimes","fileModtimes","_onTorrentId","timeRemaining","ratio","numPeers","torrentFileBlob","torrentFile","_numQueued","_numConns","numConns","_onParsedTorrent","_processParsedTorrent","_rechoke","listening","_onListening","magnetURI","_onMetadata","_getMetadataFromServer","_startDiscovery","discovery","trackerOpts","left","addPeer","torrentPort","counters","utPex","counter","_xsRequestsController","getMetadataFromURL","enableWebSeeds","addWebSeed","_rarityMap","rawStore","so","_hashes","_markAllVerified","_onStore","onPiecesVerified","getFileModtimes","_verifyPieces","filePath","mtime","getOpts","_markVerified","_markUnverified","rescanFiles","_hasAllPieces","_hasNoPieces","_hasMorePieces","threshold","_updateSelections","_onWireWithMetadata","_remove","server","destroyStore","contains","utp","_isIPv4","wasAdded","_addPeer","_validAddr","newPeer","_registerPeer","_drain","urlOrConn","_addIncomingPeer","notify","ut_pex","peerObj","reset","timeoutId","onChokeTimeout","updateSeedStatus","isSeeder","_update","_updateWireInterest","_gcSelections","_updateInterest","oldOffset","_updateWireWrapper","_updateWire","minOutstandingRequests","getBlockPipelineLength","maxOutstandingRequests","requestAllowedFastSet","tried","tries","genPieceFilterFunc","validateWire","trySelectWire","rank","shufflePriority","hotswap","secs","ptr","otherWire","otherSpeed","speedRanker","wireStack","objA","objB","wireA","wireB","numInterestedUnchoked","newOptimisticPeer","high","_hotswap","minWire","minSpeed","numRequests","isWebSeed","duration","getPiecePipelineLength","reservation","onUpdateTick","onChunk","selection","maxConns","reconnectTimeout","reqq","ServerBase","pendingReady","torrents","listHtml","body","getPageHTML","isOriginAllowed","Expires","destination","encodeRFC5987","statusCode","serve404Page","serveOptionsRequest","serveMethodNotAllowed","onReady","handleRequest","serveIndexPage","decodeURI","serveTorrentPage","serveFile","NodeServer","_listen","_close","sockets","wrapRequest","hostname","onRequest","writeHead","onConnection","BrowserServer","registration","controller","workerKeepAliveInterval","workerPortCount","_address","boundHandler","serviceWorker","ports","postMessage","pageHtml","unescape","VERSION_STR","VERSION_PREFIX","WebTorrent","nodeId","nodeIdBuffer","UTP_SUPPORT","_downloadLimit","downloadLimit","_uploadLimit","uploadLimit","WRTC","_connPool","webSeeds","blocklist","ipSet","createServer","ServiceWorkerRegistration","active","total","ontorrent","onInfoHash","onseed","isFilePath","_onseed","parseInput","existingTorrent","_tables","tcpServer","throttleDownload","throttleUpload"],"sourceRoot":""}