From 1ec85b27f831021bd4eb742b4ccffa15c4c7a5d0 Mon Sep 17 00:00:00 2001 From: Michael Heuberger Date: Fri, 13 Dec 2024 15:31:36 +1300 Subject: [PATCH] bump vc --- package-lock.json | 8 +- package.json | 2 +- src/php/fields/videomail.php | 2 +- target/js/videomail-client/index.cjs | 20991 ------------------------- target/js/videomail-client/index.js | 26 +- target/php/fields/videomail.php | 2 +- 6 files changed, 17 insertions(+), 21014 deletions(-) delete mode 100644 target/js/videomail-client/index.cjs diff --git a/package-lock.json b/package-lock.json index 08f2bed..b7f67ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "6.0.0", "license": "CC0-1.0", "dependencies": { - "videomail-client": "10.0.18" + "videomail-client": "10.0.19" }, "devDependencies": { "@babel/core": "7.26.0", @@ -17409,9 +17409,9 @@ } }, "node_modules/videomail-client": { - "version": "10.0.18", - "resolved": "https://registry.npmjs.org/videomail-client/-/videomail-client-10.0.18.tgz", - "integrity": "sha512-kYhPs5ohUVUyx76LijwWwicjn0RBCcvrZj3pldjaiynkx2Q2Duw7HFRj7ZHVeSzMF56Ay8mxPuLrnuf/zt6FAg==", + "version": "10.0.19", + "resolved": "https://registry.npmjs.org/videomail-client/-/videomail-client-10.0.19.tgz", + "integrity": "sha512-kCDm6Y2X1YbizcRbT/SrPmKeCDXoVJPsr5aP6upQuQk6epEtv7g1HrLsDHxlBk6ix/FDYgLdwPAtrNVO4t+lyg==", "license": "CC0-1.0", "dependencies": { "animitter": "3.0.0", diff --git a/package.json b/package.json index 02466a8..713d0fd 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ ] }, "dependencies": { - "videomail-client": "10.0.18" + "videomail-client": "10.0.19" }, "devDependencies": { "@babel/core": "7.26.0", diff --git a/src/php/fields/videomail.php b/src/php/fields/videomail.php index 3f2a181..477481a 100755 --- a/src/php/fields/videomail.php +++ b/src/php/fields/videomail.php @@ -160,7 +160,7 @@ public function enqueueScripts() { wp_enqueue_script( 'nf-videomail-client', - NF_Videomail::$jsUrl . 'videomail-client/index.cjs', + NF_Videomail::$jsUrl . 'videomail-client/index.js', array(), NF_Videomail::VERSION ); diff --git a/target/js/videomail-client/index.cjs b/target/js/videomail-client/index.cjs deleted file mode 100644 index 309bd9c..0000000 --- a/target/js/videomail-client/index.cjs +++ /dev/null @@ -1,20991 +0,0 @@ -var __webpack_modules__ = { - "./node_modules/animitter/index.js": function(module, exports1, __webpack_require__) { - var EventEmitter = __webpack_require__("./node_modules/events/events.js")/* .EventEmitter */ .EventEmitter, inherits = __webpack_require__("./node_modules/inherits/inherits_browser.js"), raf = __webpack_require__("./node_modules/raf/index.js"), methods; - //the same as off window unless polyfilled or in node - var defaultRAFObject = { - requestAnimationFrame: raf, - cancelAnimationFrame: raf.cancel - }; - function returnTrue() { - return true; - } - //manage FPS if < 60, else return true; - function makeThrottle(fps) { - var delay = 1000 / fps; - var lastTime = Date.now(); - if (fps <= 0 || fps === 1 / 0) return returnTrue; - //if an fps throttle has been set then we'll assume - //it natively runs at 60fps, - var half = Math.ceil(1000 / 60) / 2; - return function() { - //if a custom fps is requested - var now = Date.now(); - //is this frame within 8.5ms of the target? - //if so then next frame is gonna be too late - if (now - lastTime < delay - half) return false; - lastTime = now; - return true; - }; - } - /** - * Animitter provides event-based loops for the browser and node, - * using `requestAnimationFrame` - * @param {Object} [opts] - * @param {Number} [opts.fps=Infinity] the framerate requested, defaults to as fast as it can (60fps on window) - * @param {Number} [opts.delay=0] milliseconds delay between invoking `start` and initializing the loop - * @param {Object} [opts.requestAnimationFrameObject=global] the object on which to find `requestAnimationFrame` and `cancelAnimationFrame` methods - * @param {Boolean} [opts.fixedDelta=false] if true, timestamps will pretend to be executed at fixed intervals always - * @constructor - */ function Animitter(opts) { - opts = opts || {}; - this.__delay = opts.delay || 0; - /** @expose */ this.fixedDelta = !!opts.fixedDelta; - /** @expose */ this.frameCount = 0; - /** @expose */ this.deltaTime = 0; - /** @expose */ this.elapsedTime = 0; - /** @private */ this.__running = false; - /** @private */ this.__completed = false; - this.setFPS(opts.fps || 1 / 0); - this.setRequestAnimationFrameObject(opts.requestAnimationFrameObject || defaultRAFObject); - } - inherits(Animitter, EventEmitter); - function onStart(scope) { - var now = Date.now(); - var rAFID; - //dont let a second animation start on the same object - //use *.on('update',fn)* instead - if (scope.__running) return scope; - exports1.running += 1; - scope.__running = true; - scope.__lastTime = now; - scope.deltaTime = 0; - //emit **start** once at the beginning - scope.emit('start', scope.deltaTime, 0, scope.frameCount); - var lastRAFObject = scope.requestAnimationFrameObject; - var drawFrame = function() { - if (lastRAFObject !== scope.requestAnimationFrameObject) { - //if the requestAnimationFrameObject switched in-between, - //then re-request with the new one to ensure proper update execution context - //i.e. VRDisplay#submitFrame() may only be requested through VRDisplay#requestAnimationFrame(drawFrame) - lastRAFObject = scope.requestAnimationFrameObject; - scope.requestAnimationFrameObject.requestAnimationFrame(drawFrame); - return; - } - if (scope.__isReadyForUpdate()) scope.update(); - if (scope.__running) rAFID = scope.requestAnimationFrameObject.requestAnimationFrame(drawFrame); - else scope.requestAnimationFrameObject.cancelAnimationFrame(rAFID); - }; - scope.requestAnimationFrameObject.requestAnimationFrame(drawFrame); - return scope; - } - methods = { - //EventEmitter Aliases - off: EventEmitter.prototype.removeListener, - trigger: EventEmitter.prototype.emit, - /** - * stops the animation and marks it as completed - * @emit Animitter#complete - * @returns {Animitter} - */ complete: function() { - this.stop(); - this.__completed = true; - this.emit('complete', this.frameCount, this.deltaTime); - return this; - }, - /** - * stops the animation and removes all listeners - * @emit Animitter#stop - * @returns {Animitter} - */ dispose: function() { - this.stop(); - this.removeAllListeners(); - return this; - }, - /** - * get milliseconds between the last 2 updates - * - * @return {Number} - */ getDeltaTime: function() { - return this.deltaTime; - }, - /** - * get the total milliseconds that the animation has ran. - * This is the cumlative value of the deltaTime between frames - * - * @return {Number} - */ getElapsedTime: function() { - return this.elapsedTime; - }, - /** - * get the instances frames per second as calculated by the last delta - * - * @return {Number} - */ getFPS: function() { - return this.deltaTime > 0 ? 1000 / this.deltaTime : 0; - }, - /** - * get the explicit FPS limit set via `Animitter#setFPS(fps)` or - * via the initial `options.fps` property - * - * @returns {Number} either as set or Infinity - */ getFPSLimit: function() { - return this.__fps; - }, - /** - * get the number of frames that have occurred - * - * @return {Number} - */ getFrameCount: function() { - return this.frameCount; - }, - /** - * get the object providing `requestAnimationFrame` - * and `cancelAnimationFrame` methods - * @return {Object} - */ getRequestAnimationFrameObject: function() { - return this.requestAnimationFrameObject; - }, - /** - * is the animation loop active - * - * @return {boolean} - */ isRunning: function() { - return this.__running; - }, - /** - * is the animation marked as completed - * - * @return {boolean} - */ isCompleted: function() { - return this.__completed; - }, - /** - * reset the animation loop, marks as incomplete, - * leaves listeners intact - * - * @emit Animitter#reset - * @return {Animitter} - */ reset: function() { - this.stop(); - this.__completed = false; - this.__lastTime = 0; - this.deltaTime = 0; - this.elapsedTime = 0; - this.frameCount = 0; - this.emit('reset', 0, 0, this.frameCount); - return this; - }, - /** - * set the framerate for the animation loop - * - * @param {Number} fps - * @return {Animitter} - */ setFPS: function(fps) { - this.__fps = fps; - this.__isReadyForUpdate = makeThrottle(fps); - return this; - }, - /** - * set the object that will provide `requestAnimationFrame` - * and `cancelAnimationFrame` methods to this instance - * @param {Object} object - * @return {Animitter} - */ setRequestAnimationFrameObject: function(object) { - if ('function' != typeof object.requestAnimationFrame || 'function' != typeof object.cancelAnimationFrame) throw new Error("Invalid object provide to `setRequestAnimationFrameObject`"); - this.requestAnimationFrameObject = object; - return this; - }, - /** - * start an animation loop - * @emit Animitter#start - * @return {Animitter} - */ start: function() { - var self1 = this; - if (this.__delay) setTimeout(function() { - onStart(self1); - }, this.__delay); - else onStart(this); - return this; - }, - /** - * stops the animation loop, does not mark as completed - * - * @emit Animitter#stop - * @return {Animitter} - */ stop: function() { - if (this.__running) { - this.__running = false; - exports1.running -= 1; - this.emit('stop', this.deltaTime, this.elapsedTime, this.frameCount); - } - return this; - }, - /** - * update the animation loop once - * - * @emit Animitter#update - * @return {Animitter} - */ update: function() { - this.frameCount++; - /** @private */ var now = Date.now(); - this.__lastTime = this.__lastTime || now; - this.deltaTime = this.fixedDelta || exports1.globalFixedDelta ? 1000 / Math.min(60, this.__fps) : now - this.__lastTime; - this.elapsedTime += this.deltaTime; - this.__lastTime = now; - this.emit('update', this.deltaTime, this.elapsedTime, this.frameCount); - return this; - } - }; - for(var method in methods)Animitter.prototype[method] = methods[method]; - /** - * create an animitter instance, - * @param {Object} [options] - * @param {Function} fn( deltaTime:Number, elapsedTime:Number, frameCount:Number ) - * @returns {Animitter} - */ function createAnimitter(options, fn) { - if (1 === arguments.length && 'function' == typeof options) { - fn = options; - options = {}; - } - var _instance = new Animitter(options); - if (fn) _instance.on('update', fn); - return _instance; - } - module.exports = exports1 = createAnimitter; - /** - * create an animitter instance, - * where the scope is bound in all functions - * @param {Object} [options] - * @param {Function} fn( deltaTime:Number, elapsedTime:Number, frameCount:Number ) - * @returns {Animitter} - */ exports1.bound = function(options, fn) { - var loop = createAnimitter(options, fn), functionKeys = functions(Animitter.prototype), hasBind = !!Function.prototype.bind, fnKey; - for(var i = 0; i < functionKeys.length; i++){ - fnKey = functionKeys[i]; - loop[fnKey] = hasBind ? loop[fnKey].bind(loop) : bind(loop[fnKey], loop); - } - return loop; - }; - exports1.Animitter = Animitter; - /** - * if true, all `Animitter` instances will behave as if `options.fixedDelta = true` - */ exports1.globalFixedDelta = false; - //helpful to inherit from when using bundled - exports1.EventEmitter = EventEmitter; - //keep a global counter of all loops running, helpful to watch in dev tools - exports1.running = 0; - function bind(fn, scope) { - if ('function' == typeof fn.bind) return fn.bind(scope); - return function() { - return fn.apply(scope, arguments); - }; - } - function functions(obj) { - var keys = Object.keys(obj); - var arr = []; - for(var i = 0; i < keys.length; i++)if ('function' == typeof obj[keys[i]]) arr.push(keys[i]); - return arr; - } - //polyfill Date.now for real-old browsers - Date.now = Date.now || function() { - return new Date().getTime(); - }; - }, - "./node_modules/base64-js/index.js": function(__unused_webpack_module, exports1) { - "use strict"; - exports1.byteLength = byteLength; - exports1.toByteArray = toByteArray; - exports1.fromByteArray = fromByteArray; - var lookup = []; - var revLookup = []; - var Arr = 'undefined' != typeof Uint8Array ? Uint8Array : Array; - var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - for(var i = 0, len = code.length; i < len; ++i){ - lookup[i] = code[i]; - revLookup[code.charCodeAt(i)] = i; - } - // Support decoding URL-safe base64 strings, as Node.js does. - // See: https://en.wikipedia.org/wiki/Base64#URL_applications - revLookup['-'.charCodeAt(0)] = 62; - revLookup['_'.charCodeAt(0)] = 63; - function getLens(b64) { - var len = b64.length; - if (len % 4 > 0) throw new Error('Invalid string. Length must be a multiple of 4'); - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('='); - if (-1 === validLen) validLen = len; - var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4; - return [ - validLen, - placeHoldersLen - ]; - } - // base64 is 4/3 + up to two characters of the original data - function byteLength(b64) { - var lens = getLens(b64); - var validLen = lens[0]; - var placeHoldersLen = lens[1]; - return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; - } - function _byteLength(b64, validLen, placeHoldersLen) { - return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; - } - function toByteArray(b64) { - var tmp; - var lens = getLens(b64); - var validLen = lens[0]; - var placeHoldersLen = lens[1]; - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)); - var curByte = 0; - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 ? validLen - 4 : validLen; - var i; - for(i = 0; i < len; i += 4){ - tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)]; - arr[curByte++] = tmp >> 16 & 0xFF; - arr[curByte++] = tmp >> 8 & 0xFF; - arr[curByte++] = 0xFF & tmp; - } - if (2 === placeHoldersLen) { - tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4; - arr[curByte++] = 0xFF & tmp; - } - if (1 === placeHoldersLen) { - tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2; - arr[curByte++] = tmp >> 8 & 0xFF; - arr[curByte++] = 0xFF & tmp; - } - return arr; - } - function tripletToBase64(num) { - return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[0x3F & num]; - } - function encodeChunk(uint8, start, end) { - var tmp; - var output = []; - for(var i = start; i < end; i += 3){ - tmp = (uint8[i] << 16 & 0xFF0000) + (uint8[i + 1] << 8 & 0xFF00) + (0xFF & uint8[i + 2]); - output.push(tripletToBase64(tmp)); - } - return output.join(''); - } - function fromByteArray(uint8) { - var tmp; - var len = uint8.length; - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - ; - var parts = []; - var maxChunkLength = 16383 // must be multiple of 3 - ; - // go through the array every three bytes, we'll deal with trailing stuff later - for(var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength)parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength)); - // pad the end with zeros, but make sure to not forget the extra bytes - if (1 === extraBytes) { - tmp = uint8[len - 1]; - parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 0x3F] + '=='); - } else if (2 === extraBytes) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1]; - parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 0x3F] + lookup[tmp << 2 & 0x3F] + '='); - } - return parts.join(''); - } - }, - "./node_modules/buffer/index.js": function(__unused_webpack_module, exports1, __webpack_require__) { - "use strict"; - /*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ /* eslint-disable no-proto */ var base64 = __webpack_require__("./node_modules/base64-js/index.js"); - var ieee754 = __webpack_require__("./node_modules/ieee754/index.js"); - var customInspectSymbol = 'function' == typeof Symbol && 'function' // eslint-disable-line dot-notation - == typeof Symbol['for'] ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation - : null; - exports1.Buffer = Buffer; - exports1.SlowBuffer = SlowBuffer; - exports1.INSPECT_MAX_BYTES = 50; - var K_MAX_LENGTH = 0x7fffffff; - exports1.kMaxLength = K_MAX_LENGTH; - /** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Print warning and recommend using `buffer` v4.x which has an Object - * implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * We report that the browser does not support typed arrays if the are not subclassable - * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` - * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support - * for __proto__ and has a buggy typed array implementation. - */ Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport(); - if (!Buffer.TYPED_ARRAY_SUPPORT && 'undefined' != typeof console && 'function' == typeof console.error) console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."); - function typedArraySupport() { - // Can typed array instances can be augmented? - try { - var arr = new Uint8Array(1); - var proto = { - foo: function() { - return 42; - } - }; - Object.setPrototypeOf(proto, Uint8Array.prototype); - Object.setPrototypeOf(arr, proto); - return 42 === arr.foo(); - } catch (e) { - return false; - } - } - Object.defineProperty(Buffer.prototype, 'parent', { - enumerable: true, - get: function() { - if (!Buffer.isBuffer(this)) return; - return this.buffer; - } - }); - Object.defineProperty(Buffer.prototype, 'offset', { - enumerable: true, - get: function() { - if (!Buffer.isBuffer(this)) return; - return this.byteOffset; - } - }); - function createBuffer(length) { - if (length > K_MAX_LENGTH) throw new RangeError('The value "' + length + '" is invalid for option "size"'); - // Return an augmented `Uint8Array` instance - var buf = new Uint8Array(length); - Object.setPrototypeOf(buf, Buffer.prototype); - return buf; - } - /** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ function Buffer(arg, encodingOrOffset, length) { - // Common case. - if ('number' == typeof arg) { - if ('string' == typeof encodingOrOffset) throw new TypeError('The "string" argument must be of type string. Received type number'); - return allocUnsafe(arg); - } - return from(arg, encodingOrOffset, length); - } - Buffer.poolSize = 8192 // not used by this implementation - ; - function from(value, encodingOrOffset, length) { - if ('string' == typeof value) return fromString(value, encodingOrOffset); - if (ArrayBuffer.isView(value)) return fromArrayView(value); - if (null == value) throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); - if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) return fromArrayBuffer(value, encodingOrOffset, length); - if ('undefined' != typeof SharedArrayBuffer && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) return fromArrayBuffer(value, encodingOrOffset, length); - if ('number' == typeof value) throw new TypeError('The "value" argument must not be of type number. Received type number'); - var valueOf = value.valueOf && value.valueOf(); - if (null != valueOf && valueOf !== value) return Buffer.from(valueOf, encodingOrOffset, length); - var b = fromObject(value); - if (b) return b; - if ('undefined' != typeof Symbol && null != Symbol.toPrimitive && 'function' == typeof value[Symbol.toPrimitive]) return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length); - throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value); - } - /** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ Buffer.from = function(value, encodingOrOffset, length) { - return from(value, encodingOrOffset, length); - }; - // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: - // https://github.com/feross/buffer/pull/148 - Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype); - Object.setPrototypeOf(Buffer, Uint8Array); - function assertSize(size) { - if ('number' != typeof size) throw new TypeError('"size" argument must be of type number'); - if (size < 0) throw new RangeError('The value "' + size + '" is invalid for option "size"'); - } - function alloc(size, fill, encoding) { - assertSize(size); - if (size <= 0) return createBuffer(size); - if (void 0 !== fill) // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpreted as a start offset. - return 'string' == typeof encoding ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill); - return createBuffer(size); - } - /** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ Buffer.alloc = function(size, fill, encoding) { - return alloc(size, fill, encoding); - }; - function allocUnsafe(size) { - assertSize(size); - return createBuffer(size < 0 ? 0 : 0 | checked(size)); - } - /** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ Buffer.allocUnsafe = function(size) { - return allocUnsafe(size); - }; - /** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ Buffer.allocUnsafeSlow = function(size) { - return allocUnsafe(size); - }; - function fromString(string, encoding) { - if ('string' != typeof encoding || '' === encoding) encoding = 'utf8'; - if (!Buffer.isEncoding(encoding)) throw new TypeError('Unknown encoding: ' + encoding); - var length = 0 | byteLength(string, encoding); - var buf = createBuffer(length); - var actual = buf.write(string, encoding); - if (actual !== length) // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - buf = buf.slice(0, actual); - return buf; - } - function fromArrayLike(array) { - var length = array.length < 0 ? 0 : 0 | checked(array.length); - var buf = createBuffer(length); - for(var i = 0; i < length; i += 1)buf[i] = 255 & array[i]; - return buf; - } - function fromArrayView(arrayView) { - if (isInstance(arrayView, Uint8Array)) { - var copy = new Uint8Array(arrayView); - return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength); - } - return fromArrayLike(arrayView); - } - function fromArrayBuffer(array, byteOffset, length) { - if (byteOffset < 0 || array.byteLength < byteOffset) throw new RangeError('"offset" is outside of buffer bounds'); - if (array.byteLength < byteOffset + (length || 0)) throw new RangeError('"length" is outside of buffer bounds'); - var buf; - buf = void 0 === byteOffset && void 0 === length ? new Uint8Array(array) : void 0 === length ? new Uint8Array(array, byteOffset) : new Uint8Array(array, byteOffset, length); - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(buf, Buffer.prototype); - return buf; - } - function fromObject(obj) { - if (Buffer.isBuffer(obj)) { - var len = 0 | checked(obj.length); - var buf = createBuffer(len); - if (0 === buf.length) return buf; - obj.copy(buf, 0, 0, len); - return buf; - } - if (void 0 !== obj.length) { - if ('number' != typeof obj.length || numberIsNaN(obj.length)) return createBuffer(0); - return fromArrayLike(obj); - } - if ('Buffer' === obj.type && Array.isArray(obj.data)) return fromArrayLike(obj.data); - } - function checked(length) { - // Note: cannot use `length < K_MAX_LENGTH` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= K_MAX_LENGTH) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + ' bytes'); - return 0 | length; - } - function SlowBuffer(length) { - if (+length != length) length = 0; - return Buffer.alloc(+length); - } - Buffer.isBuffer = function(b) { - return null != b && true === b._isBuffer && b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false - ; - }; - Buffer.compare = function(a, b) { - if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength); - if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength); - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); - if (a === b) return 0; - var x = a.length; - var y = b.length; - for(var i = 0, len = Math.min(x, y); i < len; ++i)if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } - if (x < y) return -1; - if (y < x) return 1; - return 0; - }; - Buffer.isEncoding = function(encoding) { - switch(String(encoding).toLowerCase()){ - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true; - default: - return false; - } - }; - Buffer.concat = function(list, length) { - if (!Array.isArray(list)) throw new TypeError('"list" argument must be an Array of Buffers'); - if (0 === list.length) return Buffer.alloc(0); - var i; - if (void 0 === length) { - length = 0; - for(i = 0; i < list.length; ++i)length += list[i].length; - } - var buffer = Buffer.allocUnsafe(length); - var pos = 0; - for(i = 0; i < list.length; ++i){ - var buf = list[i]; - if (isInstance(buf, Uint8Array)) { - if (pos + buf.length > buffer.length) Buffer.from(buf).copy(buffer, pos); - else Uint8Array.prototype.set.call(buffer, buf, pos); - } else if (Buffer.isBuffer(buf)) buf.copy(buffer, pos); - else throw new TypeError('"list" argument must be an Array of Buffers'); - pos += buf.length; - } - return buffer; - }; - function byteLength(string, encoding) { - if (Buffer.isBuffer(string)) return string.length; - if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) return string.byteLength; - if ('string' != typeof string) throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string); - var len = string.length; - var mustMatch = arguments.length > 2 && true === arguments[2]; - if (!mustMatch && 0 === len) return 0; - // Use a for loop to avoid recursion - var loweredCase = false; - for(;;)switch(encoding){ - case 'ascii': - case 'latin1': - case 'binary': - return len; - case 'utf8': - case 'utf-8': - return utf8ToBytes(string).length; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return 2 * len; - case 'hex': - return len >>> 1; - case 'base64': - return base64ToBytes(string).length; - default: - if (loweredCase) return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 - ; - encoding = ('' + encoding).toLowerCase(); - loweredCase = true; - } - } - Buffer.byteLength = byteLength; - function slowToString(encoding, start, end) { - var loweredCase = false; - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (void 0 === start || start < 0) start = 0; - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) return ''; - if (void 0 === end || end > this.length) end = this.length; - if (end <= 0) return ''; - // Force coercion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0; - start >>>= 0; - if (end <= start) return ''; - if (!encoding) encoding = 'utf8'; - while(true)switch(encoding){ - case 'hex': - return hexSlice(this, start, end); - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end); - case 'ascii': - return asciiSlice(this, start, end); - case 'latin1': - case 'binary': - return latin1Slice(this, start, end); - case 'base64': - return base64Slice(this, start, end); - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end); - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); - encoding = (encoding + '').toLowerCase(); - loweredCase = true; - } - } - // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) - // to detect a Buffer instance. It's not possible to use `instanceof Buffer` - // reliably in a browserify context because there could be multiple different - // copies of the 'buffer' package in use. This method works even for Buffer - // instances that were created from another copy of the `buffer` package. - // See: https://github.com/feross/buffer/issues/154 - Buffer.prototype._isBuffer = true; - function swap(b, n, m) { - var i = b[n]; - b[n] = b[m]; - b[m] = i; - } - Buffer.prototype.swap16 = function() { - var len = this.length; - if (len % 2 !== 0) throw new RangeError('Buffer size must be a multiple of 16-bits'); - for(var i = 0; i < len; i += 2)swap(this, i, i + 1); - return this; - }; - Buffer.prototype.swap32 = function() { - var len = this.length; - if (len % 4 !== 0) throw new RangeError('Buffer size must be a multiple of 32-bits'); - for(var i = 0; i < len; i += 4){ - swap(this, i, i + 3); - swap(this, i + 1, i + 2); - } - return this; - }; - Buffer.prototype.swap64 = function() { - var len = this.length; - if (len % 8 !== 0) throw new RangeError('Buffer size must be a multiple of 64-bits'); - for(var i = 0; i < len; i += 8){ - swap(this, i, i + 7); - swap(this, i + 1, i + 6); - swap(this, i + 2, i + 5); - swap(this, i + 3, i + 4); - } - return this; - }; - Buffer.prototype.toString = function() { - var length = this.length; - if (0 === length) return ''; - if (0 === arguments.length) return utf8Slice(this, 0, length); - return slowToString.apply(this, arguments); - }; - Buffer.prototype.toLocaleString = Buffer.prototype.toString; - Buffer.prototype.equals = function(b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer'); - if (this === b) return true; - return 0 === Buffer.compare(this, b); - }; - Buffer.prototype.inspect = function() { - var str = ''; - var max = exports1.INSPECT_MAX_BYTES; - str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim(); - if (this.length > max) str += ' ... '; - return ''; - }; - if (customInspectSymbol) Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect; - Buffer.prototype.compare = function(target, start, end, thisStart, thisEnd) { - if (isInstance(target, Uint8Array)) target = Buffer.from(target, target.offset, target.byteLength); - if (!Buffer.isBuffer(target)) throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target); - if (void 0 === start) start = 0; - if (void 0 === end) end = target ? target.length : 0; - if (void 0 === thisStart) thisStart = 0; - if (void 0 === thisEnd) thisEnd = this.length; - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) throw new RangeError('out of range index'); - if (thisStart >= thisEnd && start >= end) return 0; - if (thisStart >= thisEnd) return -1; - if (start >= end) return 1; - start >>>= 0; - end >>>= 0; - thisStart >>>= 0; - thisEnd >>>= 0; - if (this === target) return 0; - var x = thisEnd - thisStart; - var y = end - start; - var len = Math.min(x, y); - var thisCopy = this.slice(thisStart, thisEnd); - var targetCopy = target.slice(start, end); - for(var i = 0; i < len; ++i)if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i]; - y = targetCopy[i]; - break; - } - if (x < y) return -1; - if (y < x) return 1; - return 0; - }; - // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, - // OR the last index of `val` in `buffer` at offset <= `byteOffset`. - // - // Arguments: - // - buffer - a Buffer to search - // - val - a string, Buffer, or number - // - byteOffset - an index into `buffer`; will be clamped to an int32 - // - encoding - an optional encoding, relevant is val is a string - // - dir - true for indexOf, false for lastIndexOf - function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (0 === buffer.length) return -1; - // Normalize byteOffset - if ('string' == typeof byteOffset) { - encoding = byteOffset; - byteOffset = 0; - } else if (byteOffset > 0x7fffffff) byteOffset = 0x7fffffff; - else if (byteOffset < -2147483648) byteOffset = -2147483648; - byteOffset = +byteOffset // Coerce to Number. - ; - if (numberIsNaN(byteOffset)) // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : buffer.length - 1; - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset; - if (byteOffset >= buffer.length) { - if (dir) return -1; - byteOffset = buffer.length - 1; - } else if (byteOffset < 0) { - if (!dir) return -1; - byteOffset = 0; - } - // Normalize val - if ('string' == typeof val) val = Buffer.from(val, encoding); - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (0 === val.length) return -1; - return arrayIndexOf(buffer, val, byteOffset, encoding, dir); - } - if ('number' == typeof val) { - val &= 0xFF // Search for a byte value [0-255] - ; - if ('function' == typeof Uint8Array.prototype.indexOf) { - if (dir) return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset); - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset); - } - return arrayIndexOf(buffer, [ - val - ], byteOffset, encoding, dir); - } - throw new TypeError('val must be string, number or Buffer'); - } - function arrayIndexOf(arr, val, byteOffset, encoding, dir) { - var indexSize = 1; - var arrLength = arr.length; - var valLength = val.length; - if (void 0 !== encoding) { - encoding = String(encoding).toLowerCase(); - if ('ucs2' === encoding || 'ucs-2' === encoding || 'utf16le' === encoding || 'utf-16le' === encoding) { - if (arr.length < 2 || val.length < 2) return -1; - indexSize = 2; - arrLength /= 2; - valLength /= 2; - byteOffset /= 2; - } - } - function read(buf, i) { - if (1 === indexSize) return buf[i]; - return buf.readUInt16BE(i * indexSize); - } - var i; - if (dir) { - var foundIndex = -1; - for(i = byteOffset; i < arrLength; i++)if (read(arr, i) === read(val, -1 === foundIndex ? 0 : i - foundIndex)) { - if (-1 === foundIndex) foundIndex = i; - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize; - } else { - if (-1 !== foundIndex) i -= i - foundIndex; - foundIndex = -1; - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength; - for(i = byteOffset; i >= 0; i--){ - var found = true; - for(var j = 0; j < valLength; j++)if (read(arr, i + j) !== read(val, j)) { - found = false; - break; - } - if (found) return i; - } - } - return -1; - } - Buffer.prototype.includes = function(val, byteOffset, encoding) { - return -1 !== this.indexOf(val, byteOffset, encoding); - }; - Buffer.prototype.indexOf = function(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true); - }; - Buffer.prototype.lastIndexOf = function(val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false); - }; - function hexWrite(buf, string, offset, length) { - offset = Number(offset) || 0; - var remaining = buf.length - offset; - if (length) { - length = Number(length); - if (length > remaining) length = remaining; - } else length = remaining; - var strLen = string.length; - if (length > strLen / 2) length = strLen / 2; - for(var i = 0; i < length; ++i){ - var parsed = parseInt(string.substr(2 * i, 2), 16); - if (numberIsNaN(parsed)) break; - buf[offset + i] = parsed; - } - return i; - } - function utf8Write(buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length); - } - function asciiWrite(buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length); - } - function base64Write(buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length); - } - function ucs2Write(buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length); - } - Buffer.prototype.write = function(string, offset, length, encoding) { - // Buffer#write(string) - if (void 0 === offset) { - encoding = 'utf8'; - length = this.length; - offset = 0; - // Buffer#write(string, encoding) - } else if (void 0 === length && 'string' == typeof offset) { - encoding = offset; - length = this.length; - offset = 0; - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset >>>= 0; - if (isFinite(length)) { - length >>>= 0; - if (void 0 === encoding) encoding = 'utf8'; - } else { - encoding = length; - length = void 0; - } - } else throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported'); - var remaining = this.length - offset; - if (void 0 === length || length > remaining) length = remaining; - if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) throw new RangeError('Attempt to write outside buffer bounds'); - if (!encoding) encoding = 'utf8'; - var loweredCase = false; - for(;;)switch(encoding){ - case 'hex': - return hexWrite(this, string, offset, length); - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length); - case 'ascii': - case 'latin1': - case 'binary': - return asciiWrite(this, string, offset, length); - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length); - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length); - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); - encoding = ('' + encoding).toLowerCase(); - loweredCase = true; - } - }; - Buffer.prototype.toJSON = function() { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - }; - }; - function base64Slice(buf, start, end) { - if (0 === start && end === buf.length) return base64.fromByteArray(buf); - return base64.fromByteArray(buf.slice(start, end)); - } - function utf8Slice(buf, start, end) { - end = Math.min(buf.length, end); - var res = []; - var i = start; - while(i < end){ - var firstByte = buf[i]; - var codePoint = null; - var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1; - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint; - switch(bytesPerSequence){ - case 1: - if (firstByte < 0x80) codePoint = firstByte; - break; - case 2: - secondByte = buf[i + 1]; - if ((0xC0 & secondByte) === 0x80) { - tempCodePoint = (0x1F & firstByte) << 0x6 | 0x3F & secondByte; - if (tempCodePoint > 0x7F) codePoint = tempCodePoint; - } - break; - case 3: - secondByte = buf[i + 1]; - thirdByte = buf[i + 2]; - if ((0xC0 & secondByte) === 0x80 && (0xC0 & thirdByte) === 0x80) { - tempCodePoint = (0xF & firstByte) << 0xC | (0x3F & secondByte) << 0x6 | 0x3F & thirdByte; - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) codePoint = tempCodePoint; - } - break; - case 4: - secondByte = buf[i + 1]; - thirdByte = buf[i + 2]; - fourthByte = buf[i + 3]; - if ((0xC0 & secondByte) === 0x80 && (0xC0 & thirdByte) === 0x80 && (0xC0 & fourthByte) === 0x80) { - tempCodePoint = (0xF & firstByte) << 0x12 | (0x3F & secondByte) << 0xC | (0x3F & thirdByte) << 0x6 | 0x3F & fourthByte; - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) codePoint = tempCodePoint; - } - } - } - if (null === codePoint) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD; - bytesPerSequence = 1; - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000; - res.push(codePoint >>> 10 & 0x3FF | 0xD800); - codePoint = 0xDC00 | 0x3FF & codePoint; - } - res.push(codePoint); - i += bytesPerSequence; - } - return decodeCodePointsArray(res); - } - // Based on http://stackoverflow.com/a/22747272/680742, the browser with - // the lowest limit is Chrome, with 0x10000 args. - // We go 1 magnitude less, for safety - var MAX_ARGUMENTS_LENGTH = 0x1000; - function decodeCodePointsArray(codePoints) { - var len = codePoints.length; - if (len <= MAX_ARGUMENTS_LENGTH) return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - ; - // Decode in chunks to avoid "call stack size exceeded". - var res = ''; - var i = 0; - while(i < len)res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)); - return res; - } - function asciiSlice(buf, start, end) { - var ret = ''; - end = Math.min(buf.length, end); - for(var i = start; i < end; ++i)ret += String.fromCharCode(0x7F & buf[i]); - return ret; - } - function latin1Slice(buf, start, end) { - var ret = ''; - end = Math.min(buf.length, end); - for(var i = start; i < end; ++i)ret += String.fromCharCode(buf[i]); - return ret; - } - function hexSlice(buf, start, end) { - var len = buf.length; - if (!start || start < 0) start = 0; - if (!end || end < 0 || end > len) end = len; - var out = ''; - for(var i = start; i < end; ++i)out += hexSliceLookupTable[buf[i]]; - return out; - } - function utf16leSlice(buf, start, end) { - var bytes = buf.slice(start, end); - var res = ''; - // If bytes.length is odd, the last 8 bits must be ignored (same as node.js) - for(var i = 0; i < bytes.length - 1; i += 2)res += String.fromCharCode(bytes[i] + 256 * bytes[i + 1]); - return res; - } - Buffer.prototype.slice = function(start, end) { - var len = this.length; - start = ~~start; - end = void 0 === end ? len : ~~end; - if (start < 0) { - start += len; - if (start < 0) start = 0; - } else if (start > len) start = len; - if (end < 0) { - end += len; - if (end < 0) end = 0; - } else if (end > len) end = len; - if (end < start) end = start; - var newBuf = this.subarray(start, end); - // Return an augmented `Uint8Array` instance - Object.setPrototypeOf(newBuf, Buffer.prototype); - return newBuf; - }; - /* - * Need to make sure that buffer isn't trying to write out of bounds. - */ function checkOffset(offset, ext, length) { - if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint'); - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length'); - } - Buffer.prototype.readUintLE = Buffer.prototype.readUIntLE = function(offset, byteLength, noAssert) { - offset >>>= 0; - byteLength >>>= 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - var val = this[offset]; - var mul = 1; - var i = 0; - while(++i < byteLength && (mul *= 0x100))val += this[offset + i] * mul; - return val; - }; - Buffer.prototype.readUintBE = Buffer.prototype.readUIntBE = function(offset, byteLength, noAssert) { - offset >>>= 0; - byteLength >>>= 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - var val = this[offset + --byteLength]; - var mul = 1; - while(byteLength > 0 && (mul *= 0x100))val += this[offset + --byteLength] * mul; - return val; - }; - Buffer.prototype.readUint8 = Buffer.prototype.readUInt8 = function(offset, noAssert) { - offset >>>= 0; - if (!noAssert) checkOffset(offset, 1, this.length); - return this[offset]; - }; - Buffer.prototype.readUint16LE = Buffer.prototype.readUInt16LE = function(offset, noAssert) { - offset >>>= 0; - if (!noAssert) checkOffset(offset, 2, this.length); - return this[offset] | this[offset + 1] << 8; - }; - Buffer.prototype.readUint16BE = Buffer.prototype.readUInt16BE = function(offset, noAssert) { - offset >>>= 0; - if (!noAssert) checkOffset(offset, 2, this.length); - return this[offset] << 8 | this[offset + 1]; - }; - Buffer.prototype.readUint32LE = Buffer.prototype.readUInt32LE = function(offset, noAssert) { - offset >>>= 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + 0x1000000 * this[offset + 3]; - }; - Buffer.prototype.readUint32BE = Buffer.prototype.readUInt32BE = function(offset, noAssert) { - offset >>>= 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return 0x1000000 * this[offset] + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); - }; - Buffer.prototype.readIntLE = function(offset, byteLength, noAssert) { - offset >>>= 0; - byteLength >>>= 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - var val = this[offset]; - var mul = 1; - var i = 0; - while(++i < byteLength && (mul *= 0x100))val += this[offset + i] * mul; - mul *= 0x80; - if (val >= mul) val -= Math.pow(2, 8 * byteLength); - return val; - }; - Buffer.prototype.readIntBE = function(offset, byteLength, noAssert) { - offset >>>= 0; - byteLength >>>= 0; - if (!noAssert) checkOffset(offset, byteLength, this.length); - var i = byteLength; - var mul = 1; - var val = this[offset + --i]; - while(i > 0 && (mul *= 0x100))val += this[offset + --i] * mul; - mul *= 0x80; - if (val >= mul) val -= Math.pow(2, 8 * byteLength); - return val; - }; - Buffer.prototype.readInt8 = function(offset, noAssert) { - offset >>>= 0; - if (!noAssert) checkOffset(offset, 1, this.length); - if (!(0x80 & this[offset])) return this[offset]; - return (0xff - this[offset] + 1) * -1; - }; - Buffer.prototype.readInt16LE = function(offset, noAssert) { - offset >>>= 0; - if (!noAssert) checkOffset(offset, 2, this.length); - var val = this[offset] | this[offset + 1] << 8; - return 0x8000 & val ? 0xFFFF0000 | val : val; - }; - Buffer.prototype.readInt16BE = function(offset, noAssert) { - offset >>>= 0; - if (!noAssert) checkOffset(offset, 2, this.length); - var val = this[offset + 1] | this[offset] << 8; - return 0x8000 & val ? 0xFFFF0000 | val : val; - }; - Buffer.prototype.readInt32LE = function(offset, noAssert) { - offset >>>= 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; - }; - Buffer.prototype.readInt32BE = function(offset, noAssert) { - offset >>>= 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; - }; - Buffer.prototype.readFloatLE = function(offset, noAssert) { - offset >>>= 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return ieee754.read(this, offset, true, 23, 4); - }; - Buffer.prototype.readFloatBE = function(offset, noAssert) { - offset >>>= 0; - if (!noAssert) checkOffset(offset, 4, this.length); - return ieee754.read(this, offset, false, 23, 4); - }; - Buffer.prototype.readDoubleLE = function(offset, noAssert) { - offset >>>= 0; - if (!noAssert) checkOffset(offset, 8, this.length); - return ieee754.read(this, offset, true, 52, 8); - }; - Buffer.prototype.readDoubleBE = function(offset, noAssert) { - offset >>>= 0; - if (!noAssert) checkOffset(offset, 8, this.length); - return ieee754.read(this, offset, false, 52, 8); - }; - function checkInt(buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance'); - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); - if (offset + ext > buf.length) throw new RangeError('Index out of range'); - } - Buffer.prototype.writeUintLE = Buffer.prototype.writeUIntLE = function(value, offset, byteLength, noAssert) { - value = +value; - offset >>>= 0; - byteLength >>>= 0; - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1; - checkInt(this, value, offset, byteLength, maxBytes, 0); - } - var mul = 1; - var i = 0; - this[offset] = 0xFF & value; - while(++i < byteLength && (mul *= 0x100))this[offset + i] = value / mul & 0xFF; - return offset + byteLength; - }; - Buffer.prototype.writeUintBE = Buffer.prototype.writeUIntBE = function(value, offset, byteLength, noAssert) { - value = +value; - offset >>>= 0; - byteLength >>>= 0; - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1; - checkInt(this, value, offset, byteLength, maxBytes, 0); - } - var i = byteLength - 1; - var mul = 1; - this[offset + i] = 0xFF & value; - while(--i >= 0 && (mul *= 0x100))this[offset + i] = value / mul & 0xFF; - return offset + byteLength; - }; - Buffer.prototype.writeUint8 = Buffer.prototype.writeUInt8 = function(value, offset, noAssert) { - value = +value; - offset >>>= 0; - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0); - this[offset] = 0xff & value; - return offset + 1; - }; - Buffer.prototype.writeUint16LE = Buffer.prototype.writeUInt16LE = function(value, offset, noAssert) { - value = +value; - offset >>>= 0; - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); - this[offset] = 0xff & value; - this[offset + 1] = value >>> 8; - return offset + 2; - }; - Buffer.prototype.writeUint16BE = Buffer.prototype.writeUInt16BE = function(value, offset, noAssert) { - value = +value; - offset >>>= 0; - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); - this[offset] = value >>> 8; - this[offset + 1] = 0xff & value; - return offset + 2; - }; - Buffer.prototype.writeUint32LE = Buffer.prototype.writeUInt32LE = function(value, offset, noAssert) { - value = +value; - offset >>>= 0; - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); - this[offset + 3] = value >>> 24; - this[offset + 2] = value >>> 16; - this[offset + 1] = value >>> 8; - this[offset] = 0xff & value; - return offset + 4; - }; - Buffer.prototype.writeUint32BE = Buffer.prototype.writeUInt32BE = function(value, offset, noAssert) { - value = +value; - offset >>>= 0; - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = 0xff & value; - return offset + 4; - }; - Buffer.prototype.writeIntLE = function(value, offset, byteLength, noAssert) { - value = +value; - offset >>>= 0; - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1); - checkInt(this, value, offset, byteLength, limit - 1, -limit); - } - var i = 0; - var mul = 1; - var sub = 0; - this[offset] = 0xFF & value; - while(++i < byteLength && (mul *= 0x100)){ - if (value < 0 && 0 === sub && 0 !== this[offset + i - 1]) sub = 1; - this[offset + i] = (value / mul >> 0) - sub & 0xFF; - } - return offset + byteLength; - }; - Buffer.prototype.writeIntBE = function(value, offset, byteLength, noAssert) { - value = +value; - offset >>>= 0; - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1); - checkInt(this, value, offset, byteLength, limit - 1, -limit); - } - var i = byteLength - 1; - var mul = 1; - var sub = 0; - this[offset + i] = 0xFF & value; - while(--i >= 0 && (mul *= 0x100)){ - if (value < 0 && 0 === sub && 0 !== this[offset + i + 1]) sub = 1; - this[offset + i] = (value / mul >> 0) - sub & 0xFF; - } - return offset + byteLength; - }; - Buffer.prototype.writeInt8 = function(value, offset, noAssert) { - value = +value; - offset >>>= 0; - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -128); - if (value < 0) value = 0xff + value + 1; - this[offset] = 0xff & value; - return offset + 1; - }; - Buffer.prototype.writeInt16LE = function(value, offset, noAssert) { - value = +value; - offset >>>= 0; - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768); - this[offset] = 0xff & value; - this[offset + 1] = value >>> 8; - return offset + 2; - }; - Buffer.prototype.writeInt16BE = function(value, offset, noAssert) { - value = +value; - offset >>>= 0; - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -32768); - this[offset] = value >>> 8; - this[offset + 1] = 0xff & value; - return offset + 2; - }; - Buffer.prototype.writeInt32LE = function(value, offset, noAssert) { - value = +value; - offset >>>= 0; - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648); - this[offset] = 0xff & value; - this[offset + 1] = value >>> 8; - this[offset + 2] = value >>> 16; - this[offset + 3] = value >>> 24; - return offset + 4; - }; - Buffer.prototype.writeInt32BE = function(value, offset, noAssert) { - value = +value; - offset >>>= 0; - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -2147483648); - if (value < 0) value = 0xffffffff + value + 1; - this[offset] = value >>> 24; - this[offset + 1] = value >>> 16; - this[offset + 2] = value >>> 8; - this[offset + 3] = 0xff & value; - return offset + 4; - }; - function checkIEEE754(buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range'); - if (offset < 0) throw new RangeError('Index out of range'); - } - function writeFloat(buf, value, offset, littleEndian, noAssert) { - value = +value; - offset >>>= 0; - if (!noAssert) checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -340282346638528860000000000000000000000); - ieee754.write(buf, value, offset, littleEndian, 23, 4); - return offset + 4; - } - Buffer.prototype.writeFloatLE = function(value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert); - }; - Buffer.prototype.writeFloatBE = function(value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert); - }; - function writeDouble(buf, value, offset, littleEndian, noAssert) { - value = +value; - offset >>>= 0; - if (!noAssert) checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000); - ieee754.write(buf, value, offset, littleEndian, 52, 8); - return offset + 8; - } - Buffer.prototype.writeDoubleLE = function(value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert); - }; - Buffer.prototype.writeDoubleBE = function(value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert); - }; - // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) - Buffer.prototype.copy = function(target, targetStart, start, end) { - if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer'); - if (!start) start = 0; - if (!end && 0 !== end) end = this.length; - if (targetStart >= target.length) targetStart = target.length; - if (!targetStart) targetStart = 0; - if (end > 0 && end < start) end = start; - // Copy 0 bytes; we're done - if (end === start) return 0; - if (0 === target.length || 0 === this.length) return 0; - // Fatal error conditions - if (targetStart < 0) throw new RangeError('targetStart out of bounds'); - if (start < 0 || start >= this.length) throw new RangeError('Index out of range'); - if (end < 0) throw new RangeError('sourceEnd out of bounds'); - // Are we oob? - if (end > this.length) end = this.length; - if (target.length - targetStart < end - start) end = target.length - targetStart + start; - var len = end - start; - if (this === target && 'function' == typeof Uint8Array.prototype.copyWithin) // Use built-in when available, missing from IE11 - this.copyWithin(targetStart, start, end); - else Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart); - return len; - }; - // Usage: - // buffer.fill(number[, offset[, end]]) - // buffer.fill(buffer[, offset[, end]]) - // buffer.fill(string[, offset[, end]][, encoding]) - Buffer.prototype.fill = function(val, start, end, encoding) { - // Handle string cases: - if ('string' == typeof val) { - if ('string' == typeof start) { - encoding = start; - start = 0; - end = this.length; - } else if ('string' == typeof end) { - encoding = end; - end = this.length; - } - if (void 0 !== encoding && 'string' != typeof encoding) throw new TypeError('encoding must be a string'); - if ('string' == typeof encoding && !Buffer.isEncoding(encoding)) throw new TypeError('Unknown encoding: ' + encoding); - if (1 === val.length) { - var code = val.charCodeAt(0); - if ('utf8' === encoding && code < 128 || 'latin1' === encoding) // Fast path: If `val` fits into a single byte, use that numeric value. - val = code; - } - } else if ('number' == typeof val) val &= 255; - else if ('boolean' == typeof val) val = Number(val); - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) throw new RangeError('Out of range index'); - if (end <= start) return this; - start >>>= 0; - end = void 0 === end ? this.length : end >>> 0; - if (!val) val = 0; - var i; - if ('number' == typeof val) for(i = start; i < end; ++i)this[i] = val; - else { - var bytes = Buffer.isBuffer(val) ? val : Buffer.from(val, encoding); - var len = bytes.length; - if (0 === len) throw new TypeError('The value "' + val + '" is invalid for argument "value"'); - for(i = 0; i < end - start; ++i)this[i + start] = bytes[i % len]; - } - return this; - }; - // HELPER FUNCTIONS - // ================ - var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g; - function base64clean(str) { - // Node takes equal signs as end of the Base64 encoding - str = str.split('=')[0]; - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = str.trim().replace(INVALID_BASE64_RE, ''); - // Node converts strings with length < 2 to '' - if (str.length < 2) return ''; - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while(str.length % 4 !== 0)str += '='; - return str; - } - function utf8ToBytes(string, units) { - units = units || 1 / 0; - var codePoint; - var length = string.length; - var leadSurrogate = null; - var bytes = []; - for(var i = 0; i < length; ++i){ - codePoint = string.charCodeAt(i); - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - continue; - } - if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - continue; - } - // valid lead - leadSurrogate = codePoint; - continue; - } - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - leadSurrogate = codePoint; - continue; - } - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000; - } else if (leadSurrogate) // valid bmp char, but last char was a lead - { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); - } - leadSurrogate = null; - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break; - bytes.push(codePoint); - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break; - bytes.push(codePoint >> 0x6 | 0xC0, 0x3F & codePoint | 0x80); - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break; - bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, 0x3F & codePoint | 0x80); - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break; - bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, 0x3F & codePoint | 0x80); - } else throw new Error('Invalid code point'); - } - return bytes; - } - function asciiToBytes(str) { - var byteArray = []; - for(var i = 0; i < str.length; ++i)// Node's code seems to be doing this and not & 0x7F.. - byteArray.push(0xFF & str.charCodeAt(i)); - return byteArray; - } - function utf16leToBytes(str, units) { - var c, hi, lo; - var byteArray = []; - for(var i = 0; i < str.length; ++i){ - if ((units -= 2) < 0) break; - c = str.charCodeAt(i); - hi = c >> 8; - lo = c % 256; - byteArray.push(lo); - byteArray.push(hi); - } - return byteArray; - } - function base64ToBytes(str) { - return base64.toByteArray(base64clean(str)); - } - function blitBuffer(src, dst, offset, length) { - for(var i = 0; i < length; ++i){ - if (i + offset >= dst.length || i >= src.length) break; - dst[i + offset] = src[i]; - } - return i; - } - // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass - // the `instanceof` check but they should be treated as of that type. - // See: https://github.com/feross/buffer/issues/166 - function isInstance(obj, type) { - return obj instanceof type || null != obj && null != obj.constructor && null != obj.constructor.name && obj.constructor.name === type.name; - } - function numberIsNaN(obj) { - // For IE11 support - return obj !== obj // eslint-disable-line no-self-compare - ; - } - // Create lookup table for `toString('hex')` - // See: https://github.com/feross/buffer/issues/219 - var hexSliceLookupTable = function() { - var alphabet = '0123456789abcdef'; - var table = new Array(256); - for(var i = 0; i < 16; ++i){ - var i16 = 16 * i; - for(var j = 0; j < 16; ++j)table[i16 + j] = alphabet[i] + alphabet[j]; - } - return table; - }(); - }, - "./node_modules/call-bind/callBound.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var GetIntrinsic = __webpack_require__("./node_modules/get-intrinsic/index.js"); - var callBind = __webpack_require__("./node_modules/call-bind/index.js"); - var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); - module.exports = function(name, allowMissing) { - var intrinsic = GetIntrinsic(name, !!allowMissing); - if ('function' == typeof intrinsic && $indexOf(name, '.prototype.') > -1) return callBind(intrinsic); - return intrinsic; - }; - }, - "./node_modules/call-bind/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var bind = __webpack_require__("./node_modules/function-bind/index.js"); - var GetIntrinsic = __webpack_require__("./node_modules/get-intrinsic/index.js"); - var setFunctionLength = __webpack_require__("./node_modules/set-function-length/index.js"); - var $TypeError = __webpack_require__("./node_modules/es-errors/type.js"); - var $apply = GetIntrinsic('%Function.prototype.apply%'); - var $call = GetIntrinsic('%Function.prototype.call%'); - var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); - var $defineProperty = __webpack_require__("./node_modules/es-define-property/index.js"); - var $max = GetIntrinsic('%Math.max%'); - module.exports = function(originalFunction) { - if ('function' != typeof originalFunction) throw new $TypeError('a function is required'); - var func = $reflectApply(bind, $call, arguments); - return setFunctionLength(func, 1 + $max(0, originalFunction.length - (arguments.length - 1)), true); - }; - var applyBind = function() { - return $reflectApply(bind, $apply, arguments); - }; - if ($defineProperty) $defineProperty(module.exports, 'apply', { - value: applyBind - }); - else module.exports.apply = applyBind; - }, - "./node_modules/component-emitter/index.js": function(module) { - module.exports = Emitter; - /** - * Initialize a new `Emitter`. - * - * @api public - */ function Emitter(obj) { - if (obj) return mixin(obj); - } - /** - * Mixin the emitter properties. - * - * @param {Object} obj - * @return {Object} - * @api private - */ function mixin(obj) { - for(var key in Emitter.prototype)obj[key] = Emitter.prototype[key]; - return obj; - } - /** - * Listen on the given `event` with `fn`. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ Emitter.prototype.on = Emitter.prototype.addEventListener = function(event, fn) { - this._callbacks = this._callbacks || {}; - (this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn); - return this; - }; - /** - * Adds an `event` listener that will be invoked a single - * time then automatically removed. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ Emitter.prototype.once = function(event, fn) { - function on() { - this.off(event, on); - fn.apply(this, arguments); - } - on.fn = fn; - this.on(event, on); - return this; - }; - /** - * Remove the given callback for `event` or all - * registered callbacks. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function(event, fn) { - this._callbacks = this._callbacks || {}; - // all - if (0 == arguments.length) { - this._callbacks = {}; - return this; - } - // specific event - var callbacks = this._callbacks['$' + event]; - if (!callbacks) return this; - // remove all handlers - if (1 == arguments.length) { - delete this._callbacks['$' + event]; - return this; - } - // remove specific handler - var cb; - for(var i = 0; i < callbacks.length; i++){ - cb = callbacks[i]; - if (cb === fn || cb.fn === fn) { - callbacks.splice(i, 1); - break; - } - } - // Remove event specific arrays for event types that no - // one is subscribed for to avoid memory leak. - if (0 === callbacks.length) delete this._callbacks['$' + event]; - return this; - }; - /** - * Emit `event` with the given args. - * - * @param {String} event - * @param {Mixed} ... - * @return {Emitter} - */ Emitter.prototype.emit = function(event) { - this._callbacks = this._callbacks || {}; - var args = new Array(arguments.length - 1), callbacks = this._callbacks['$' + event]; - for(var i = 1; i < arguments.length; i++)args[i - 1] = arguments[i]; - if (callbacks) { - callbacks = callbacks.slice(0); - for(var i = 0, len = callbacks.length; i < len; ++i)callbacks[i].apply(this, args); - } - return this; - }; - /** - * Return array of callbacks for `event`. - * - * @param {String} event - * @return {Array} - * @api public - */ Emitter.prototype.listeners = function(event) { - this._callbacks = this._callbacks || {}; - return this._callbacks['$' + event] || []; - }; - /** - * Check if this emitter has `event` handlers. - * - * @param {String} event - * @return {Boolean} - * @api public - */ Emitter.prototype.hasListeners = function(event) { - return !!this.listeners(event).length; - }; - }, - "./node_modules/contains/index.js": function(module) { - var DOCUMENT_POSITION_CONTAINED_BY = 16; - module.exports = contains; - function contains(container, elem) { - if (container.contains) return container.contains(elem); - var comparison = container.compareDocumentPosition(elem); - return 0 === comparison || comparison & DOCUMENT_POSITION_CONTAINED_BY; - } - }, - "./node_modules/core-util-is/lib/util.js": function(__unused_webpack_module, exports1, __webpack_require__) { - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - // NOTE: These type checking functions intentionally don't use `instanceof` - // because it is fragile and can be easily faked with `Object.create()`. - function isArray(arg) { - if (Array.isArray) return Array.isArray(arg); - return '[object Array]' === objectToString(arg); - } - exports1.isArray = isArray; - function isBoolean(arg) { - return 'boolean' == typeof arg; - } - exports1.isBoolean = isBoolean; - function isNull(arg) { - return null === arg; - } - exports1.isNull = isNull; - function isNullOrUndefined(arg) { - return null == arg; - } - exports1.isNullOrUndefined = isNullOrUndefined; - function isNumber(arg) { - return 'number' == typeof arg; - } - exports1.isNumber = isNumber; - function isString(arg) { - return 'string' == typeof arg; - } - exports1.isString = isString; - function isSymbol(arg) { - return 'symbol' == typeof arg; - } - exports1.isSymbol = isSymbol; - function isUndefined(arg) { - return void 0 === arg; - } - exports1.isUndefined = isUndefined; - function isRegExp(re) { - return '[object RegExp]' === objectToString(re); - } - exports1.isRegExp = isRegExp; - function isObject(arg) { - return 'object' == typeof arg && null !== arg; - } - exports1.isObject = isObject; - function isDate(d) { - return '[object Date]' === objectToString(d); - } - exports1.isDate = isDate; - function isError(e) { - return '[object Error]' === objectToString(e) || e instanceof Error; - } - exports1.isError = isError; - function isFunction(arg) { - return 'function' == typeof arg; - } - exports1.isFunction = isFunction; - function isPrimitive(arg) { - return null === arg || 'boolean' == typeof arg || 'number' == typeof arg || 'string' == typeof arg || 'symbol' == typeof arg || // ES6 symbol - void 0 === arg; - } - exports1.isPrimitive = isPrimitive; - exports1.isBuffer = __webpack_require__("./node_modules/buffer/index.js")/* .Buffer.isBuffer */ .Buffer.isBuffer; - function objectToString(o) { - return Object.prototype.toString.call(o); - } - }, - "./node_modules/deepmerge/dist/cjs.js": function(module) { - "use strict"; - var isMergeableObject = function(value) { - return isNonNullObject(value) && !isSpecial(value); - }; - function isNonNullObject(value) { - return !!value && 'object' == typeof value; - } - function isSpecial(value) { - var stringValue = Object.prototype.toString.call(value); - return '[object RegExp]' === stringValue || '[object Date]' === stringValue || isReactElement(value); - } - // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 - var canUseSymbol = 'function' == typeof Symbol && Symbol.for; - var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; - function isReactElement(value) { - return value.$$typeof === REACT_ELEMENT_TYPE; - } - function emptyTarget(val) { - return Array.isArray(val) ? [] : {}; - } - function cloneUnlessOtherwiseSpecified(value, options) { - return false !== options.clone && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value; - } - function defaultArrayMerge(target, source, options) { - return target.concat(source).map(function(element) { - return cloneUnlessOtherwiseSpecified(element, options); - }); - } - function getMergeFunction(key, options) { - if (!options.customMerge) return deepmerge; - var customMerge = options.customMerge(key); - return 'function' == typeof customMerge ? customMerge : deepmerge; - } - function getEnumerableOwnPropertySymbols(target) { - return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) { - return Object.propertyIsEnumerable.call(target, symbol); - }) : []; - } - function getKeys(target) { - return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)); - } - function propertyIsOnObject(object, property) { - try { - return property in object; - } catch (_) { - return false; - } - } - // Protects from prototype poisoning and unexpected merging up the prototype chain. - function propertyIsUnsafe(target, key) { - return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, - && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, - && Object.propertyIsEnumerable.call(target, key) // and also unsafe if they're nonenumerable. - ); - } - function mergeObject(target, source, options) { - var destination = {}; - if (options.isMergeableObject(target)) getKeys(target).forEach(function(key) { - destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); - }); - getKeys(source).forEach(function(key) { - if (propertyIsUnsafe(target, key)) return; - if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) destination[key] = getMergeFunction(key, options)(target[key], source[key], options); - else destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); - }); - return destination; - } - function deepmerge(target, source, options) { - options = options || {}; - options.arrayMerge = options.arrayMerge || defaultArrayMerge; - options.isMergeableObject = options.isMergeableObject || isMergeableObject; - // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() - // implementations can use it. The caller may not replace it. - options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; - var sourceIsArray = Array.isArray(source); - var targetIsArray = Array.isArray(target); - var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; - if (!sourceAndTargetTypesMatch) return cloneUnlessOtherwiseSpecified(source, options); - if (sourceIsArray) return options.arrayMerge(target, source, options); - return mergeObject(target, source, options); - } - deepmerge.all = function(array, options) { - if (!Array.isArray(array)) throw new Error('first argument should be an array'); - return array.reduce(function(prev, next) { - return deepmerge(prev, next, options); - }, {}); - }; - var deepmerge_1 = deepmerge; - module.exports = deepmerge_1; - }, - "./node_modules/define-data-property/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var $defineProperty = __webpack_require__("./node_modules/es-define-property/index.js"); - var $SyntaxError = __webpack_require__("./node_modules/es-errors/syntax.js"); - var $TypeError = __webpack_require__("./node_modules/es-errors/type.js"); - var gopd = __webpack_require__("./node_modules/gopd/index.js"); - /** @type {import('.')} */ module.exports = function(obj, property, value) { - if (!obj || 'object' != typeof obj && 'function' != typeof obj) throw new $TypeError('`obj` must be an object or a function`'); - if ('string' != typeof property && 'symbol' != typeof property) throw new $TypeError('`property` must be a string or a symbol`'); - if (arguments.length > 3 && 'boolean' != typeof arguments[3] && null !== arguments[3]) throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null'); - if (arguments.length > 4 && 'boolean' != typeof arguments[4] && null !== arguments[4]) throw new $TypeError('`nonWritable`, if provided, must be a boolean or null'); - if (arguments.length > 5 && 'boolean' != typeof arguments[5] && null !== arguments[5]) throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null'); - if (arguments.length > 6 && 'boolean' != typeof arguments[6]) throw new $TypeError('`loose`, if provided, must be a boolean'); - var nonEnumerable = arguments.length > 3 ? arguments[3] : null; - var nonWritable = arguments.length > 4 ? arguments[4] : null; - var nonConfigurable = arguments.length > 5 ? arguments[5] : null; - var loose = arguments.length > 6 && arguments[6]; - /* @type {false | TypedPropertyDescriptor} */ var desc = !!gopd && gopd(obj, property); - if ($defineProperty) $defineProperty(obj, property, { - configurable: null === nonConfigurable && desc ? desc.configurable : !nonConfigurable, - enumerable: null === nonEnumerable && desc ? desc.enumerable : !nonEnumerable, - value: value, - writable: null === nonWritable && desc ? desc.writable : !nonWritable - }); - else if (!loose && (nonEnumerable || nonWritable || nonConfigurable)) throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.'); - else // must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable - obj[property] = value; // eslint-disable-line no-param-reassign - }; - }, - "./node_modules/defined/index.js": function(module) { - "use strict"; - module.exports = function() { - for(var i = 0; i < arguments.length; i++)if (void 0 !== arguments[i]) return arguments[i]; - }; - }, - "./node_modules/document-visibility/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var document1 = __webpack_require__("./node_modules/global/document.js"); - var Event1 = __webpack_require__("./node_modules/geval/source.js"); - var Keys = __webpack_require__("./node_modules/document-visibility/keys.js"); - module.exports = Visibility; - function Visibility() { - var keys = Keys(document1); - if (!keys) return noopShim(); - return { - visible: visible, - onChange: Event1(listen) - }; - function visible() { - return !document1[keys.hidden]; - } - function listen(broadcast) { - document1.addEventListener(keys.event, function() { - broadcast(visible()); - }); - } - } - function noopShim() { - return { - visible: function() { - return true; - }, - onChange: noop - }; - } - function noop() {} - }, - "./node_modules/document-visibility/keys.js": function(module) { - "use strict"; - module.exports = keys; - function keys(document1) { - var prefix = detectPrefix(document1); - if (null == prefix) return; - return { - hidden: lowercaseFirst(prefix + 'Hidden'), - event: prefix + 'visibilitychange' - }; - } - function detectPrefix(document1) { - if (null != document1.hidden) return ''; - if (null != document1.mozHidden) return 'moz'; - if (null != document1.msHidden) return 'ms'; - if (null != document1.webkitHidden) return 'webkit'; - } - function lowercaseFirst(string) { - return string.substring(0, 1).toLowerCase() + string.substring(1); - } - }, - "./node_modules/duplexify/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - /* provided dependency */ var Buffer = __webpack_require__("./node_modules/buffer/index.js")["Buffer"]; - /* provided dependency */ var process = __webpack_require__("./node_modules/process/browser.js"); - var stream = __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/readable-browser.js"); - var eos = __webpack_require__("./node_modules/end-of-stream/index.js"); - var inherits = __webpack_require__("./node_modules/inherits/inherits_browser.js"); - var shift = __webpack_require__("./node_modules/stream-shift/index.js"); - var SIGNAL_FLUSH = Buffer.from && Buffer.from !== Uint8Array.from ? Buffer.from([ - 0 - ]) : new Buffer([ - 0 - ]); - var onuncork = function(self1, fn) { - if (self1._corked) self1.once('uncork', fn); - else fn(); - }; - var autoDestroy = function(self1, err) { - if (self1._autoDestroy) self1.destroy(err); - }; - var destroyer = function(self1, end) { - return function(err) { - if (err) autoDestroy(self1, 'premature close' === err.message ? null : err); - else if (end && !self1._ended) self1.end(); - }; - }; - var end = function(ws, fn) { - if (!ws) return fn(); - if (ws._writableState && ws._writableState.finished) return fn(); - if (ws._writableState) return ws.end(fn); - ws.end(); - fn(); - }; - var toStreams2 = function(rs) { - return new stream.Readable({ - objectMode: true, - highWaterMark: 16 - }).wrap(rs); - }; - var Duplexify = function(writable, readable, opts) { - if (!(this instanceof Duplexify)) return new Duplexify(writable, readable, opts); - stream.Duplex.call(this, opts); - this._writable = null; - this._readable = null; - this._readable2 = null; - this._autoDestroy = !opts || false !== opts.autoDestroy; - this._forwardDestroy = !opts || false !== opts.destroy; - this._forwardEnd = !opts || false !== opts.end; - this._corked = 1 // start corked - ; - this._ondrain = null; - this._drained = false; - this._forwarding = false; - this._unwrite = null; - this._unread = null; - this._ended = false; - this.destroyed = false; - if (writable) this.setWritable(writable); - if (readable) this.setReadable(readable); - }; - inherits(Duplexify, stream.Duplex); - Duplexify.obj = function(writable, readable, opts) { - if (!opts) opts = {}; - opts.objectMode = true; - opts.highWaterMark = 16; - return new Duplexify(writable, readable, opts); - }; - Duplexify.prototype.cork = function() { - if (1 === ++this._corked) this.emit('cork'); - }; - Duplexify.prototype.uncork = function() { - if (this._corked && 0 === --this._corked) this.emit('uncork'); - }; - Duplexify.prototype.setWritable = function(writable) { - if (this._unwrite) this._unwrite(); - if (this.destroyed) { - if (writable && writable.destroy) writable.destroy(); - return; - } - if (null === writable || false === writable) { - this.end(); - return; - } - var self1 = this; - var unend = eos(writable, { - writable: true, - readable: false - }, destroyer(this, this._forwardEnd)); - var ondrain = function() { - var ondrain = self1._ondrain; - self1._ondrain = null; - if (ondrain) ondrain(); - }; - var clear = function() { - self1._writable.removeListener('drain', ondrain); - unend(); - }; - if (this._unwrite) process.nextTick(ondrain) // force a drain on stream reset to avoid livelocks - ; - this._writable = writable; - this._writable.on('drain', ondrain); - this._unwrite = clear; - this.uncork() // always uncork setWritable - ; - }; - Duplexify.prototype.setReadable = function(readable) { - if (this._unread) this._unread(); - if (this.destroyed) { - if (readable && readable.destroy) readable.destroy(); - return; - } - if (null === readable || false === readable) { - this.push(null); - this.resume(); - return; - } - var self1 = this; - var unend = eos(readable, { - writable: false, - readable: true - }, destroyer(this)); - var onreadable = function() { - self1._forward(); - }; - var onend = function() { - self1.push(null); - }; - var clear = function() { - self1._readable2.removeListener('readable', onreadable); - self1._readable2.removeListener('end', onend); - unend(); - }; - this._drained = true; - this._readable = readable; - this._readable2 = readable._readableState ? readable : toStreams2(readable); - this._readable2.on('readable', onreadable); - this._readable2.on('end', onend); - this._unread = clear; - this._forward(); - }; - Duplexify.prototype._read = function() { - this._drained = true; - this._forward(); - }; - Duplexify.prototype._forward = function() { - if (this._forwarding || !this._readable2 || !this._drained) return; - this._forwarding = true; - var data; - while(this._drained && null !== (data = shift(this._readable2))){ - if (this.destroyed) continue; - this._drained = this.push(data); - } - this._forwarding = false; - }; - Duplexify.prototype.destroy = function(err) { - if (this.destroyed) return; - this.destroyed = true; - var self1 = this; - process.nextTick(function() { - self1._destroy(err); - }); - }; - Duplexify.prototype._destroy = function(err) { - if (err) { - var ondrain = this._ondrain; - this._ondrain = null; - if (ondrain) ondrain(err); - else this.emit('error', err); - } - if (this._forwardDestroy) { - if (this._readable && this._readable.destroy) this._readable.destroy(); - if (this._writable && this._writable.destroy) this._writable.destroy(); - } - this.emit('close'); - }; - Duplexify.prototype._write = function(data, enc, cb) { - if (this.destroyed) return cb(); - if (this._corked) return onuncork(this, this._write.bind(this, data, enc, cb)); - if (data === SIGNAL_FLUSH) return this._finish(cb); - if (!this._writable) return cb(); - if (false === this._writable.write(data)) this._ondrain = cb; - else cb(); - }; - Duplexify.prototype._finish = function(cb) { - var self1 = this; - this.emit('preend'); - onuncork(this, function() { - end(self1._forwardEnd && self1._writable, function() { - // haxx to not emit prefinish twice - if (false === self1._writableState.prefinished) self1._writableState.prefinished = true; - self1.emit('prefinish'); - onuncork(self1, cb); - }); - }); - }; - Duplexify.prototype.end = function(data, enc, cb) { - if ('function' == typeof data) return this.end(null, null, data); - if ('function' == typeof enc) return this.end(data, null, enc); - this._ended = true; - if (data) this.write(data); - if (!this._writableState.ending) this.write(SIGNAL_FLUSH); - return stream.Writable.prototype.end.call(this, cb); - }; - module.exports = Duplexify; - }, - "./node_modules/duplexify/node_modules/readable-stream/lib/_stream_duplex.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - // a duplex stream is just a stream that is both readable and writable. - // Since JS doesn't have multiple prototypal inheritance, this class - // prototypally inherits from Readable, and then parasitically from - // Writable. - /**/ var pna = __webpack_require__("./node_modules/process-nextick-args/index.js"); - /**/ /**/ var objectKeys = Object.keys || function(obj) { - var keys = []; - for(var key in obj)keys.push(key); - return keys; - }; - /**/ module.exports = Duplex; - /**/ var util = Object.create(__webpack_require__("./node_modules/core-util-is/lib/util.js")); - util.inherits = __webpack_require__("./node_modules/inherits/inherits_browser.js"); - /**/ var Readable = __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/lib/_stream_readable.js"); - var Writable = __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js"); - util.inherits(Duplex, Readable); - // avoid scope creep, the keys array can then be collected - var keys = objectKeys(Writable.prototype); - for(var v = 0; v < keys.length; v++){ - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; - } - function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options); - Readable.call(this, options); - Writable.call(this, options); - if (options && false === options.readable) this.readable = false; - if (options && false === options.writable) this.writable = false; - this.allowHalfOpen = true; - if (options && false === options.allowHalfOpen) this.allowHalfOpen = false; - this.once('end', onend); - } - Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function() { - return this._writableState.highWaterMark; - } - }); - // the no-half-open enforcer - function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) return; - // no more data can be written. - // But allow more writes to happen in this tick. - pna.nextTick(onEndNT, this); - } - function onEndNT(self1) { - self1.end(); - } - Object.defineProperty(Duplex.prototype, 'destroyed', { - get: function() { - if (void 0 === this._readableState || void 0 === this._writableState) return false; - return this._readableState.destroyed && this._writableState.destroyed; - }, - set: function(value) { - // we ignore the value if the stream - // has not been initialized yet - if (void 0 === this._readableState || void 0 === this._writableState) return; - // backward compatibility, the user is explicitly - // managing destroyed - this._readableState.destroyed = value; - this._writableState.destroyed = value; - } - }); - Duplex.prototype._destroy = function(err, cb) { - this.push(null); - this.end(); - pna.nextTick(cb, err); - }; - }, - "./node_modules/duplexify/node_modules/readable-stream/lib/_stream_passthrough.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - // a passthrough stream. - // basically just the most minimal sort of Transform stream. - // Every written chunk gets output as-is. - module.exports = PassThrough; - var Transform = __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/lib/_stream_transform.js"); - /**/ var util = Object.create(__webpack_require__("./node_modules/core-util-is/lib/util.js")); - util.inherits = __webpack_require__("./node_modules/inherits/inherits_browser.js"); - /**/ util.inherits(PassThrough, Transform); - function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options); - Transform.call(this, options); - } - PassThrough.prototype._transform = function(chunk, encoding, cb) { - cb(null, chunk); - }; - }, - "./node_modules/duplexify/node_modules/readable-stream/lib/_stream_readable.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - /* provided dependency */ var process = __webpack_require__("./node_modules/process/browser.js"); - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - /**/ var pna = __webpack_require__("./node_modules/process-nextick-args/index.js"); - /**/ module.exports = Readable; - /**/ var isArray = __webpack_require__("./node_modules/isarray/index.js"); - /**/ /**/ var Duplex; - /**/ Readable.ReadableState = ReadableState; - /**/ __webpack_require__("./node_modules/events/events.js")/* .EventEmitter */ .EventEmitter; - var EElistenerCount = function(emitter, type) { - return emitter.listeners(type).length; - }; - /**/ /**/ var Stream = __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/stream-browser.js"); - /**/ /**/ var Buffer = __webpack_require__("./node_modules/duplexify/node_modules/safe-buffer/index.js")/* .Buffer */ .Buffer; - var OurUint8Array = (void 0 !== __webpack_require__.g ? __webpack_require__.g : 'undefined' != typeof window ? window : 'undefined' != typeof self ? self : {}).Uint8Array || function() {}; - function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); - } - function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; - } - /**/ /**/ var util = Object.create(__webpack_require__("./node_modules/core-util-is/lib/util.js")); - util.inherits = __webpack_require__("./node_modules/inherits/inherits_browser.js"); - /**/ /**/ var debugUtil = __webpack_require__("?d57a"); - var debug = void 0; - debug = debugUtil && debugUtil.debuglog ? debugUtil.debuglog('stream') : function() {}; - /**/ var BufferList = __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/BufferList.js"); - var destroyImpl = __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/destroy.js"); - var StringDecoder; - util.inherits(Readable, Stream); - var kProxyEvents = [ - 'error', - 'close', - 'destroy', - 'pause', - 'resume' - ]; - function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if ('function' == typeof emitter.prependListener) return emitter.prependListener(event, fn); - // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - if (emitter._events && emitter._events[event]) { - if (isArray(emitter._events[event])) emitter._events[event].unshift(fn); - else emitter._events[event] = [ - fn, - emitter._events[event] - ]; - } else emitter.on(event, fn); - } - function ReadableState(options, stream) { - Duplex = Duplex || __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/lib/_stream_duplex.js"); - options = options || {}; - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - var isDuplex = stream instanceof Duplex; - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; - if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - var readableHwm = options.readableHighWaterMark; - var defaultHwm = this.objectMode ? 16 : 16384; - if (hwm || 0 === hwm) this.highWaterMark = hwm; - else if (isDuplex && (readableHwm || 0 === readableHwm)) this.highWaterMark = readableHwm; - else this.highWaterMark = defaultHwm; - // cast to ints. - this.highWaterMark = Math.floor(this.highWaterMark); - // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift() - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; - // a flag to be able to tell if the event 'readable'/'data' is emitted - // immediately, or on a later tick. We set this to true at first, because - // any actions that shouldn't happen until "later" should generally also - // not happen before the first read call. - this.sync = true; - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - // has it been destroyed - this.destroyed = false; - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; - // if true, a maybeReadMore has been scheduled - this.readingMore = false; - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) StringDecoder = __webpack_require__("./node_modules/duplexify/node_modules/string_decoder/lib/string_decoder.js")/* .StringDecoder */ .StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } - } - function Readable(options) { - Duplex = Duplex || __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/lib/_stream_duplex.js"); - if (!(this instanceof Readable)) return new Readable(options); - this._readableState = new ReadableState(options, this); - // legacy - this.readable = true; - if (options) { - if ('function' == typeof options.read) this._read = options.read; - if ('function' == typeof options.destroy) this._destroy = options.destroy; - } - Stream.call(this); - } - Object.defineProperty(Readable.prototype, 'destroyed', { - get: function() { - if (void 0 === this._readableState) return false; - return this._readableState.destroyed; - }, - set: function(value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._readableState) return; - // backward compatibility, the user is explicitly - // managing destroyed - this._readableState.destroyed = value; - } - }); - Readable.prototype.destroy = destroyImpl.destroy; - Readable.prototype._undestroy = destroyImpl.undestroy; - Readable.prototype._destroy = function(err, cb) { - this.push(null); - cb(err); - }; - // Manually shove something into the read() buffer. - // This returns true if the highWaterMark has not been hit yet, - // similar to how Writable.write() returns true if you should - // write() some more. - Readable.prototype.push = function(chunk, encoding) { - var state = this._readableState; - var skipChunkCheck; - if (state.objectMode) skipChunkCheck = true; - else if ('string' == typeof chunk) { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = Buffer.from(chunk, encoding); - encoding = ''; - } - skipChunkCheck = true; - } - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); - }; - // Unshift should *always* be something directly out of read() - Readable.prototype.unshift = function(chunk) { - return readableAddChunk(this, chunk, null, true, false); - }; - function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { - var state = stream._readableState; - if (null === chunk) { - state.reading = false; - onEofChunk(stream, state); - } else { - var er; - if (!skipChunkCheck) er = chunkInvalid(state, chunk); - if (er) stream.emit('error', er); - else if (state.objectMode || chunk && chunk.length > 0) { - if ('string' != typeof chunk && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) chunk = _uint8ArrayToBuffer(chunk); - if (addToFront) { - if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event')); - else addChunk(stream, state, chunk, true); - } else if (state.ended) stream.emit('error', new Error('stream.push() after EOF')); - else { - state.reading = false; - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk); - if (state.objectMode || 0 !== chunk.length) addChunk(stream, state, chunk, false); - else maybeReadMore(stream, state); - } else addChunk(stream, state, chunk, false); - } - } else if (!addToFront) state.reading = false; - } - return needMoreData(state); - } - function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && 0 === state.length && !state.sync) { - stream.emit('data', chunk); - stream.read(0); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk); - else state.buffer.push(chunk); - if (state.needReadable) emitReadable(stream); - } - maybeReadMore(stream, state); - } - function chunkInvalid(state, chunk) { - var er; - if (!_isUint8Array(chunk) && 'string' != typeof chunk && void 0 !== chunk && !state.objectMode) er = new TypeError('Invalid non-string/buffer chunk'); - return er; - } - // if it's past the high water mark, we can push in some more. - // Also, if we have no data yet, we can stand some - // more bytes. This is to work around cases where hwm=0, - // such as the repl. Also, if the push() triggered a - // readable event, and the user called read(largeNumber) such that - // needReadable was set, then we ought to push more, so that another - // 'readable' event will be triggered. - function needMoreData(state) { - return !state.ended && (state.needReadable || state.length < state.highWaterMark || 0 === state.length); - } - Readable.prototype.isPaused = function() { - return false === this._readableState.flowing; - }; - // backwards compatibility. - Readable.prototype.setEncoding = function(enc) { - if (!StringDecoder) StringDecoder = __webpack_require__("./node_modules/duplexify/node_modules/string_decoder/lib/string_decoder.js")/* .StringDecoder */ .StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; - return this; - }; - // Don't raise the hwm > 8MB - var MAX_HWM = 0x800000; - function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) n = MAX_HWM; - else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - return n; - } - // This function is designed to be inlinable, so please take care when making - // changes to the function body. - function howMuchToRead(n, state) { - if (n <= 0 || 0 === state.length && state.ended) return 0; - if (state.objectMode) return 1; - if (n !== n) { - // Only flow one buffer at a time - if (state.flowing && state.length) return state.buffer.head.data.length; - return state.length; - } - // If we're asking for more than the current hwm, then raise the hwm. - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) return n; - // Don't have enough - if (!state.ended) { - state.needReadable = true; - return 0; - } - return state.length; - } - // you can override either this method, or the async _read(n) below. - Readable.prototype.read = function(n) { - debug('read', n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; - if (0 !== n) state.emittedReadable = false; - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (0 === n && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (0 === state.length && state.ended) endReadable(this); - else emitReadable(this); - return null; - } - n = howMuchToRead(n, state); - // if we've ended, and we're now clear, then finish it up. - if (0 === n && state.ended) { - if (0 === state.length) endReadable(this); - return null; - } - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - debug('need readable', doRead); - // if we currently have less than the highWaterMark, then also read some - if (0 === state.length || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } else if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (0 === state.length) state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (!state.reading) n = howMuchToRead(nOrig, state); - } - var ret; - ret = n > 0 ? fromList(n, state) : null; - if (null === ret) { - state.needReadable = true; - n = 0; - } else state.length -= n; - if (0 === state.length) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true; - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended) endReadable(this); - } - if (null !== ret) this.emit('data', ret); - return ret; - }; - function onEofChunk(stream, state) { - if (state.ended) return; - if (state.decoder) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - // emit 'readable' now to make sure it gets picked up. - emitReadable(stream); - } - // Don't emit readable right away in sync mode, because this can trigger - // another read() call => stack overflow. This way, it might trigger - // a nextTick recursion warning, but that's not so bad. - function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - if (state.sync) pna.nextTick(emitReadable_, stream); - else emitReadable_(stream); - } - } - function emitReadable_(stream) { - debug('emit readable'); - stream.emit('readable'); - flow(stream); - } - // at this point, the user has presumably seen the 'readable' event, - // and called read() to consume some data. that may have triggered - // in turn another _read(n) call, in which case reading = true if - // it's in progress. - // However, if we're not ended, or reading, and the length < hwm, - // then go ahead and try to read some more preemptively. - function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - pna.nextTick(maybeReadMore_, stream, state); - } - } - function maybeReadMore_(stream, state) { - var len = state.length; - while(!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark){ - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) break; - len = state.length; - } - state.readingMore = false; - } - // abstract method. to be overridden in specific implementation classes. - // call cb(er, data) where data is <= n in length. - // for virtual (non-string, non-buffer) streams, "length" is somewhat - // arbitrary, and perhaps not very meaningful. - Readable.prototype._read = function(n) { - this.emit('error', new Error('_read() is not implemented')); - }; - Readable.prototype.pipe = function(dest, pipeOpts) { - var src = this; - var state = this._readableState; - switch(state.pipesCount){ - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [ - state.pipes, - dest - ]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - var doEnd = (!pipeOpts || false !== pipeOpts.end) && dest !== process.stdout && dest !== process.stderr; - var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) pna.nextTick(endFn); - else src.once('end', endFn); - dest.on('unpipe', onunpipe); - function onunpipe(readable, unpipeInfo) { - debug('onunpipe'); - if (readable === src) { - if (unpipeInfo && false === unpipeInfo.hasUnpiped) { - unpipeInfo.hasUnpiped = true; - cleanup(); - } - } - } - function onend() { - debug('onend'); - dest.end(); - } - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - var cleanedUp = false; - function cleanup() { - debug('cleanup'); - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', unpipe); - src.removeListener('data', ondata); - cleanedUp = true; - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); - } - // If the user pushes more data while we're writing to dest then we'll end up - // in ondata again. However, we only want to increase awaitDrain once because - // dest will only emit one 'drain' event for the multiple writes. - // => Introduce a guard on increasing awaitDrain. - var increasedAwaitDrain = false; - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - increasedAwaitDrain = false; - var ret = dest.write(chunk); - if (false === ret && !increasedAwaitDrain) { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if ((1 === state.pipesCount && state.pipes === dest || state.pipesCount > 1 && -1 !== indexOf(state.pipes, dest)) && !cleanedUp) { - debug('false write response, pause', state.awaitDrain); - state.awaitDrain++; - increasedAwaitDrain = true; - } - src.pause(); - } - } - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (0 === EElistenerCount(dest, 'error')) dest.emit('error', er); - } - // Make sure our error handler is attached before userland ones. - prependListener(dest, 'error', onerror); - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } - // tell the dest that it's being piped to - dest.emit('pipe', src); - // start the flow if it hasn't been started already. - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } - return dest; - }; - function pipeOnDrain(src) { - return function() { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) state.awaitDrain--; - if (0 === state.awaitDrain && EElistenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; - } - Readable.prototype.unpipe = function(dest) { - var state = this._readableState; - var unpipeInfo = { - hasUnpiped: false - }; - // if we're not piping anywhere, then do nothing. - if (0 === state.pipesCount) return this; - // just one destination. most common case. - if (1 === state.pipesCount) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) return this; - if (!dest) dest = state.pipes; - // got a match. - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) dest.emit('unpipe', this, unpipeInfo); - return this; - } - // slow case. multiple pipe destinations. - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - for(var i = 0; i < len; i++)dests[i].emit('unpipe', this, { - hasUnpiped: false - }); - return this; - } - // try to find the right one. - var index = indexOf(state.pipes, dest); - if (-1 === index) return this; - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (1 === state.pipesCount) state.pipes = state.pipes[0]; - dest.emit('unpipe', this, unpipeInfo); - return this; - }; - // set up data events if they are asked for - // Ensure readable listeners eventually get something - Readable.prototype.on = function(ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - if ('data' === ev) // Start flowing on next tick if stream isn't explicitly paused - { - if (false !== this._readableState.flowing) this.resume(); - } else if ('readable' === ev) { - var state = this._readableState; - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.emittedReadable = false; - if (state.reading) { - if (state.length) emitReadable(this); - } else pna.nextTick(nReadingNextTick, this); - } - } - return res; - }; - Readable.prototype.addListener = Readable.prototype.on; - function nReadingNextTick(self1) { - debug('readable nexttick read 0'); - self1.read(0); - } - // pause() and resume() are remnants of the legacy readable stream API - // If the user uses them, then switch into old mode. - Readable.prototype.resume = function() { - var state = this._readableState; - if (!state.flowing) { - debug('resume'); - state.flowing = true; - resume(this, state); - } - return this; - }; - function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - pna.nextTick(resume_, stream, state); - } - } - function resume_(stream, state) { - if (!state.reading) { - debug('resume read 0'); - stream.read(0); - } - state.resumeScheduled = false; - state.awaitDrain = 0; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) stream.read(0); - } - Readable.prototype.pause = function() { - debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - return this; - }; - function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - while(state.flowing && null !== stream.read()); - } - // wrap an old-style stream as the async data source. - // This is *not* part of the readable stream interface. - // It is an ugly unfortunate mess of history. - Readable.prototype.wrap = function(stream) { - var _this = this; - var state = this._readableState; - var paused = false; - stream.on('end', function() { - debug('wrapped end'); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) _this.push(chunk); - } - _this.push(null); - }); - stream.on('data', function(chunk) { - debug('wrapped data'); - if (state.decoder) chunk = state.decoder.write(chunk); - // don't skip over falsy values in objectMode - if (state.objectMode && null == chunk) return; - if (!state.objectMode && (!chunk || !chunk.length)) return; - var ret = _this.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - // proxy all the other methods. - // important when wrapping filters and duplexes. - for(var i in stream)if (void 0 === this[i] && 'function' == typeof stream[i]) this[i] = function(method) { - return function() { - return stream[method].apply(stream, arguments); - }; - }(i); - // proxy certain important events. - for(var n = 0; n < kProxyEvents.length; n++)stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - // when we try to consume some more bytes, simply unpause the - // underlying stream. - this._read = function(n) { - debug('wrapped _read', n); - if (paused) { - paused = false; - stream.resume(); - } - }; - return this; - }; - Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function() { - return this._readableState.highWaterMark; - } - }); - // exposed for testing purposes only. - Readable._fromList = fromList; - // Pluck off n bytes from an array of buffers. - // Length is the combined lengths of all the buffers in the list. - // This function is designed to be inlinable, so please take care when making - // changes to the function body. - function fromList(n, state) { - // nothing buffered - if (0 === state.length) return null; - var ret; - if (state.objectMode) ret = state.buffer.shift(); - else if (!n || n >= state.length) { - // read it all, truncate the list - ret = state.decoder ? state.buffer.join('') : 1 === state.buffer.length ? state.buffer.head.data : state.buffer.concat(state.length); - state.buffer.clear(); - } else // read part of list - ret = fromListPartial(n, state.buffer, state.decoder); - return ret; - } - // Extracts only enough buffered data to satisfy the amount requested. - // This function is designed to be inlinable, so please take care when making - // changes to the function body. - function fromListPartial(n, list, hasStrings) { - var ret; - if (n < list.head.data.length) { - // slice is the same for buffers and strings - ret = list.head.data.slice(0, n); - list.head.data = list.head.data.slice(n); - } else // first chunk is a perfect match - ret = n === list.head.data.length ? list.shift() : hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); - return ret; - } - // Copies a specified amount of characters from the list of buffered data - // chunks. - // This function is designed to be inlinable, so please take care when making - // changes to the function body. - function copyFromBufferString(n, list) { - var p = list.head; - var c = 1; - var ret = p.data; - n -= ret.length; - while(p = p.next){ - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) ret += str; - else ret += str.slice(0, n); - n -= nb; - if (0 === n) { - if (nb === str.length) { - ++c; - if (p.next) list.head = p.next; - else list.head = list.tail = null; - } else { - list.head = p; - p.data = str.slice(nb); - } - break; - } - ++c; - } - list.length -= c; - return ret; - } - // Copies a specified amount of bytes from the list of buffered data chunks. - // This function is designed to be inlinable, so please take care when making - // changes to the function body. - function copyFromBuffer(n, list) { - var ret = Buffer.allocUnsafe(n); - var p = list.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; - while(p = p.next){ - var buf = p.data; - var nb = n > buf.length ? buf.length : n; - buf.copy(ret, ret.length - n, 0, nb); - n -= nb; - if (0 === n) { - if (nb === buf.length) { - ++c; - if (p.next) list.head = p.next; - else list.head = list.tail = null; - } else { - list.head = p; - p.data = buf.slice(nb); - } - break; - } - ++c; - } - list.length -= c; - return ret; - } - function endReadable(stream) { - var state = stream._readableState; - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); - if (!state.endEmitted) { - state.ended = true; - pna.nextTick(endReadableNT, state, stream); - } - } - function endReadableNT(state, stream) { - // Check that we didn't get one last unshift. - if (!state.endEmitted && 0 === state.length) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } - } - function indexOf(xs, x) { - for(var i = 0, l = xs.length; i < l; i++)if (xs[i] === x) return i; - return -1; - } - }, - "./node_modules/duplexify/node_modules/readable-stream/lib/_stream_transform.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - // a transform stream is a readable/writable stream where you do - // something with the data. Sometimes it's called a "filter", - // but that's not a great name for it, since that implies a thing where - // some bits pass through, and others are simply ignored. (That would - // be a valid example of a transform, of course.) - // - // While the output is causally related to the input, it's not a - // necessarily symmetric or synchronous transformation. For example, - // a zlib stream might take multiple plain-text writes(), and then - // emit a single compressed chunk some time in the future. - // - // Here's how this works: - // - // The Transform stream has all the aspects of the readable and writable - // stream classes. When you write(chunk), that calls _write(chunk,cb) - // internally, and returns false if there's a lot of pending writes - // buffered up. When you call read(), that calls _read(n) until - // there's enough pending readable data buffered up. - // - // In a transform stream, the written data is placed in a buffer. When - // _read(n) is called, it transforms the queued up data, calling the - // buffered _write cb's as it consumes chunks. If consuming a single - // written chunk would result in multiple output chunks, then the first - // outputted bit calls the readcb, and subsequent chunks just go into - // the read buffer, and will cause it to emit 'readable' if necessary. - // - // This way, back-pressure is actually determined by the reading side, - // since _read has to be called to start processing a new chunk. However, - // a pathological inflate type of transform can cause excessive buffering - // here. For example, imagine a stream where every byte of input is - // interpreted as an integer from 0-255, and then results in that many - // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in - // 1kb of data being output. In this case, you could write a very small - // amount of input, and end up with a very large amount of output. In - // such a pathological inflating mechanism, there'd be no way to tell - // the system to stop doing the transform. A single 4MB write could - // cause the system to run out of memory. - // - // However, even in such a pathological case, only a single written chunk - // would be consumed, and then the rest would wait (un-transformed) until - // the results of the previous transformed chunk were consumed. - module.exports = Transform; - var Duplex = __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/lib/_stream_duplex.js"); - /**/ var util = Object.create(__webpack_require__("./node_modules/core-util-is/lib/util.js")); - util.inherits = __webpack_require__("./node_modules/inherits/inherits_browser.js"); - /**/ util.inherits(Transform, Duplex); - function afterTransform(er, data) { - var ts = this._transformState; - ts.transforming = false; - var cb = ts.writecb; - if (!cb) return this.emit('error', new Error('write callback called multiple times')); - ts.writechunk = null; - ts.writecb = null; - if (null != data) this.push(data); - cb(er); - var rs = this._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); - } - function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options); - Duplex.call(this, options); - this._transformState = { - afterTransform: afterTransform.bind(this), - needTransform: false, - transforming: false, - writecb: null, - writechunk: null, - writeencoding: null - }; - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; - if (options) { - if ('function' == typeof options.transform) this._transform = options.transform; - if ('function' == typeof options.flush) this._flush = options.flush; - } - // When the writable side finishes, then flush out anything remaining. - this.on('prefinish', prefinish); - } - function prefinish() { - var _this = this; - if ('function' == typeof this._flush) this._flush(function(er, data) { - done(_this, er, data); - }); - else done(this, null, null); - } - Transform.prototype.push = function(chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); - }; - // This is the part where you do stuff! - // override this function in implementation classes. - // 'chunk' is an input chunk. - // - // Call `push(newChunk)` to pass along transformed output - // to the readable side. You may call 'push' zero or more times. - // - // Call `cb(err)` when you are done with this chunk. If you pass - // an error, then that'll put the hurt on the whole operation. If you - // never call cb(), then you'll never get another chunk. - Transform.prototype._transform = function(chunk, encoding, cb) { - throw new Error('_transform() is not implemented'); - }; - Transform.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); - } - }; - // Doesn't matter what the args are here. - // _transform does all the work. - // That we got here means that the readable side wants more data. - Transform.prototype._read = function(n) { - var ts = this._transformState; - if (null !== ts.writechunk && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - }; - Transform.prototype._destroy = function(err, cb) { - var _this2 = this; - Duplex.prototype._destroy.call(this, err, function(err2) { - cb(err2); - _this2.emit('close'); - }); - }; - function done(stream, er, data) { - if (er) return stream.emit('error', er); - if (null != data) stream.push(data); - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0'); - if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming'); - return stream.push(null); - } - }, - "./node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - /* provided dependency */ var process = __webpack_require__("./node_modules/process/browser.js"); - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - // A bit simpler than readable streams. - // Implement an async ._write(chunk, encoding, cb), and it'll handle all - // the drain event emission and buffering. - /**/ var pna = __webpack_require__("./node_modules/process-nextick-args/index.js"); - /**/ module.exports = Writable; - // It seems a linked list but it is not - // there will be only 2 of these for each stream - function CorkedRequest(state) { - var _this = this; - this.next = null; - this.entry = null; - this.finish = function() { - onCorkedFinish(_this, state); - }; - } - /* */ /**/ var asyncWrite = !process.browser && [ - 'v0.10', - 'v0.9.' - ].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; - /**/ /**/ var Duplex; - /**/ Writable.WritableState = WritableState; - /**/ var util = Object.create(__webpack_require__("./node_modules/core-util-is/lib/util.js")); - util.inherits = __webpack_require__("./node_modules/inherits/inherits_browser.js"); - /**/ /**/ var internalUtil = { - deprecate: __webpack_require__("./node_modules/util-deprecate/browser.js") - }; - /**/ /**/ var Stream = __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/stream-browser.js"); - /**/ /**/ var Buffer = __webpack_require__("./node_modules/duplexify/node_modules/safe-buffer/index.js")/* .Buffer */ .Buffer; - var OurUint8Array = (void 0 !== __webpack_require__.g ? __webpack_require__.g : 'undefined' != typeof window ? window : 'undefined' != typeof self ? self : {}).Uint8Array || function() {}; - function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); - } - function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; - } - /**/ var destroyImpl = __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/destroy.js"); - util.inherits(Writable, Stream); - function nop() {} - function WritableState(options, stream) { - Duplex = Duplex || __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/lib/_stream_duplex.js"); - options = options || {}; - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - var isDuplex = stream instanceof Duplex; - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; - if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - var writableHwm = options.writableHighWaterMark; - var defaultHwm = this.objectMode ? 16 : 16384; - if (hwm || 0 === hwm) this.highWaterMark = hwm; - else if (isDuplex && (writableHwm || 0 === writableHwm)) this.highWaterMark = writableHwm; - else this.highWaterMark = defaultHwm; - // cast to ints. - this.highWaterMark = Math.floor(this.highWaterMark); - // if _final has been called - this.finalCalled = false; - // drain event flag. - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; - // has it been destroyed - this.destroyed = false; - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = false === options.decodeStrings; - this.decodeStrings = !noDecode; - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; - // a flag to see when we're in the middle of a write. - this.writing = false; - // when true all writes will be buffered until .uncork() call - this.corked = 0; - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; - // the callback that's passed to _write(chunk,cb) - this.onwrite = function(er) { - onwrite(stream, er); - }; - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; - // the amount that is being written when _write is called. - this.writelen = 0; - this.bufferedRequest = null; - this.lastBufferedRequest = null; - // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - this.pendingcb = 0; - // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - this.prefinished = false; - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; - // count buffered requests - this.bufferedRequestCount = 0; - // allocate the first CorkedRequest, there is always - // one allocated and free to use, and we maintain at most two - this.corkedRequestsFree = new CorkedRequest(this); - } - WritableState.prototype.getBuffer = function() { - var current = this.bufferedRequest; - var out = []; - while(current){ - out.push(current); - current = current.next; - } - return out; - }; - (function() { - try { - Object.defineProperty(WritableState.prototype, 'buffer', { - get: internalUtil.deprecate(function() { - return this.getBuffer(); - }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", 'DEP0003') - }); - } catch (_) {} - })(); - // Test _writableState for inheritance to account for Duplex streams, - // whose prototype chain only points to Readable. - var realHasInstance; - if ('function' == typeof Symbol && Symbol.hasInstance && 'function' == typeof Function.prototype[Symbol.hasInstance]) { - realHasInstance = Function.prototype[Symbol.hasInstance]; - Object.defineProperty(Writable, Symbol.hasInstance, { - value: function(object) { - if (realHasInstance.call(this, object)) return true; - if (this !== Writable) return false; - return object && object._writableState instanceof WritableState; - } - }); - } else realHasInstance = function(object) { - return object instanceof this; - }; - function Writable(options) { - Duplex = Duplex || __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/lib/_stream_duplex.js"); - // Writable ctor is applied to Duplexes, too. - // `realHasInstance` is necessary because using plain `instanceof` - // would return false, as no `_writableState` property is attached. - // Trying to use the custom `instanceof` for Writable here will also break the - // Node.js LazyTransform implementation, which has a non-trivial getter for - // `_writableState` that would lead to infinite recursion. - if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) return new Writable(options); - this._writableState = new WritableState(options, this); - // legacy. - this.writable = true; - if (options) { - if ('function' == typeof options.write) this._write = options.write; - if ('function' == typeof options.writev) this._writev = options.writev; - if ('function' == typeof options.destroy) this._destroy = options.destroy; - if ('function' == typeof options.final) this._final = options.final; - } - Stream.call(this); - } - // Otherwise people can pipe Writable streams, which is just wrong. - Writable.prototype.pipe = function() { - this.emit('error', new Error('Cannot pipe, not readable')); - }; - function writeAfterEnd(stream, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - pna.nextTick(cb, er); - } - // Checks that a user-supplied chunk is valid, especially for the particular - // mode the stream is in. Currently this means that `null` is never accepted - // and undefined/non-string values are only allowed in object mode. - function validChunk(stream, state, chunk, cb) { - var valid = true; - var er = false; - if (null === chunk) er = new TypeError('May not write null values to stream'); - else if ('string' != typeof chunk && void 0 !== chunk && !state.objectMode) er = new TypeError('Invalid non-string/buffer chunk'); - if (er) { - stream.emit('error', er); - pna.nextTick(cb, er); - valid = false; - } - return valid; - } - Writable.prototype.write = function(chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - var isBuf = !state.objectMode && _isUint8Array(chunk); - if (isBuf && !Buffer.isBuffer(chunk)) chunk = _uint8ArrayToBuffer(chunk); - if ('function' == typeof encoding) { - cb = encoding; - encoding = null; - } - if (isBuf) encoding = 'buffer'; - else if (!encoding) encoding = state.defaultEncoding; - if ('function' != typeof cb) cb = nop; - if (state.ended) writeAfterEnd(this, cb); - else if (isBuf || validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); - } - return ret; - }; - Writable.prototype.cork = function() { - var state = this._writableState; - state.corked++; - }; - Writable.prototype.uncork = function() { - var state = this._writableState; - if (state.corked) { - state.corked--; - if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); - } - }; - Writable.prototype.setDefaultEncoding = function(encoding) { - // node::ParseEncoding() requires lower case. - if ('string' == typeof encoding) encoding = encoding.toLowerCase(); - if (!([ - 'hex', - 'utf8', - 'utf-8', - 'ascii', - 'binary', - 'base64', - 'ucs2', - 'ucs-2', - 'utf16le', - 'utf-16le', - 'raw' - ].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); - this._writableState.defaultEncoding = encoding; - return this; - }; - function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && false !== state.decodeStrings && 'string' == typeof chunk) chunk = Buffer.from(chunk, encoding); - return chunk; - } - Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function() { - return this._writableState.highWaterMark; - } - }); - // if we're already writing something, then just put this - // in the queue, and wait our turn. Otherwise, call _write - // If we return false, then we need a drain event, so set that flag. - function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { - if (!isBuf) { - var newChunk = decodeChunk(state, chunk, encoding); - if (chunk !== newChunk) { - isBuf = true; - encoding = 'buffer'; - chunk = newChunk; - } - } - var len = state.objectMode ? 1 : chunk.length; - state.length += len; - var ret = state.length < state.highWaterMark; - // we must ensure that previous needDrain will not be reset to false. - if (!ret) state.needDrain = true; - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = { - chunk: chunk, - encoding: encoding, - isBuf: isBuf, - callback: cb, - next: null - }; - if (last) last.next = state.lastBufferedRequest; - else state.bufferedRequest = state.lastBufferedRequest; - state.bufferedRequestCount += 1; - } else doWrite(stream, state, false, len, chunk, encoding, cb); - return ret; - } - function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (writev) stream._writev(chunk, state.onwrite); - else stream._write(chunk, encoding, state.onwrite); - state.sync = false; - } - function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - if (sync) { - // defer the callback if we are being called synchronously - // to avoid piling up things on the stack - pna.nextTick(cb, er); - // this can emit finish, and it will always happen - // after error - pna.nextTick(finishMaybe, stream, state); - stream._writableState.errorEmitted = true; - stream.emit('error', er); - } else { - // the caller expect this to happen before if - // it is async - cb(er); - stream._writableState.errorEmitted = true; - stream.emit('error', er); - // this can emit finish, but finish must - // always follow error - finishMaybe(stream, state); - } - } - function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; - } - function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - onwriteStateUpdate(state); - if (er) onwriteError(stream, state, sync, er, cb); - else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(state); - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(stream, state); - if (sync) /**/ asyncWrite(afterWrite, stream, state, finished, cb); - else afterWrite(stream, state, finished, cb); - } - } - function afterWrite(stream, state, finished, cb) { - if (!finished) onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); - } - // Must force callback to be called on nextTick, so that we don't - // emit 'drain' before the write() consumer gets the 'false' return - // value, and has a chance to attach a 'drain' listener. - function onwriteDrain(stream, state) { - if (0 === state.length && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } - } - // if there's something in the buffer waiting, then process it - function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; - if (stream._writev && entry && entry.next) { - // Fast case, write everything using _writev() - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; - var count = 0; - var allBuffers = true; - while(entry){ - buffer[count] = entry; - if (!entry.isBuf) allBuffers = false; - entry = entry.next; - count += 1; - } - buffer.allBuffers = allBuffers; - doWrite(stream, state, true, state.length, buffer, '', holder.finish); - // doWrite is almost always async, defer these to save a bit of time - // as the hot path ends with doWrite - state.pendingcb++; - state.lastBufferedRequest = null; - if (holder.next) { - state.corkedRequestsFree = holder.next; - holder.next = null; - } else state.corkedRequestsFree = new CorkedRequest(state); - state.bufferedRequestCount = 0; - } else { - // Slow case, write chunks one-by-one - while(entry){ - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - state.bufferedRequestCount--; - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) break; - } - if (null === entry) state.lastBufferedRequest = null; - } - state.bufferedRequest = entry; - state.bufferProcessing = false; - } - Writable.prototype._write = function(chunk, encoding, cb) { - cb(new Error('_write() is not implemented')); - }; - Writable.prototype._writev = null; - Writable.prototype.end = function(chunk, encoding, cb) { - var state = this._writableState; - if ('function' == typeof chunk) { - cb = chunk; - chunk = null; - encoding = null; - } else if ('function' == typeof encoding) { - cb = encoding; - encoding = null; - } - if (null != chunk) this.write(chunk, encoding); - // .end() fully uncorks - if (state.corked) { - state.corked = 1; - this.uncork(); - } - // ignore unnecessary end() calls. - if (!state.ending) endWritable(this, state, cb); - }; - function needFinish(state) { - return state.ending && 0 === state.length && null === state.bufferedRequest && !state.finished && !state.writing; - } - function callFinal(stream, state) { - stream._final(function(err) { - state.pendingcb--; - if (err) stream.emit('error', err); - state.prefinished = true; - stream.emit('prefinish'); - finishMaybe(stream, state); - }); - } - function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if ('function' == typeof stream._final) { - state.pendingcb++; - state.finalCalled = true; - pna.nextTick(callFinal, stream, state); - } else { - state.prefinished = true; - stream.emit('prefinish'); - } - } - } - function finishMaybe(stream, state) { - var need = needFinish(state); - if (need) { - prefinish(stream, state); - if (0 === state.pendingcb) { - state.finished = true; - stream.emit('finish'); - } - } - return need; - } - function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) pna.nextTick(cb); - else stream.once('finish', cb); - } - state.ended = true; - stream.writable = false; - } - function onCorkedFinish(corkReq, state, err) { - var entry = corkReq.entry; - corkReq.entry = null; - while(entry){ - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } - // reuse the free corkReq. - state.corkedRequestsFree.next = corkReq; - } - Object.defineProperty(Writable.prototype, 'destroyed', { - get: function() { - if (void 0 === this._writableState) return false; - return this._writableState.destroyed; - }, - set: function(value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._writableState) return; - // backward compatibility, the user is explicitly - // managing destroyed - this._writableState.destroyed = value; - } - }); - Writable.prototype.destroy = destroyImpl.destroy; - Writable.prototype._undestroy = destroyImpl.undestroy; - Writable.prototype._destroy = function(err, cb) { - this.end(); - cb(err); - }; - }, - "./node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/BufferList.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); - } - var Buffer = __webpack_require__("./node_modules/duplexify/node_modules/safe-buffer/index.js")/* .Buffer */ .Buffer; - var util = __webpack_require__("?f049"); - function copyBuffer(src, target, offset) { - src.copy(target, offset); - } - module.exports = function() { - function BufferList() { - _classCallCheck(this, BufferList); - this.head = null; - this.tail = null; - this.length = 0; - } - BufferList.prototype.push = function(v) { - var entry = { - data: v, - next: null - }; - if (this.length > 0) this.tail.next = entry; - else this.head = entry; - this.tail = entry; - ++this.length; - }; - BufferList.prototype.unshift = function(v) { - var entry = { - data: v, - next: this.head - }; - if (0 === this.length) this.tail = entry; - this.head = entry; - ++this.length; - }; - BufferList.prototype.shift = function() { - if (0 === this.length) return; - var ret = this.head.data; - if (1 === this.length) this.head = this.tail = null; - else this.head = this.head.next; - --this.length; - return ret; - }; - BufferList.prototype.clear = function() { - this.head = this.tail = null; - this.length = 0; - }; - BufferList.prototype.join = function(s) { - if (0 === this.length) return ''; - var p = this.head; - var ret = '' + p.data; - while(p = p.next)ret += s + p.data; - return ret; - }; - BufferList.prototype.concat = function(n) { - if (0 === this.length) return Buffer.alloc(0); - var ret = Buffer.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - while(p){ - copyBuffer(p.data, ret, i); - i += p.data.length; - p = p.next; - } - return ret; - }; - return BufferList; - }(); - if (util && util.inspect && util.inspect.custom) module.exports.prototype[util.inspect.custom] = function() { - var obj = util.inspect({ - length: this.length - }); - return this.constructor.name + ' ' + obj; - }; - }, - "./node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/destroy.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - /**/ var pna = __webpack_require__("./node_modules/process-nextick-args/index.js"); - /**/ // undocumented cb() API, needed for core, not for public API - function destroy(err, cb) { - var _this = this; - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; - if (readableDestroyed || writableDestroyed) { - if (cb) cb(err); - else if (err) { - if (this._writableState) { - if (!this._writableState.errorEmitted) { - this._writableState.errorEmitted = true; - pna.nextTick(emitErrorNT, this, err); - } - } else pna.nextTick(emitErrorNT, this, err); - } - return this; - } - // we set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks - if (this._readableState) this._readableState.destroyed = true; - // if this is a duplex stream mark the writable part as destroyed as well - if (this._writableState) this._writableState.destroyed = true; - this._destroy(err || null, function(err) { - if (!cb && err) { - if (_this._writableState) { - if (!_this._writableState.errorEmitted) { - _this._writableState.errorEmitted = true; - pna.nextTick(emitErrorNT, _this, err); - } - } else pna.nextTick(emitErrorNT, _this, err); - } else if (cb) cb(err); - }); - return this; - } - function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; - } - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finalCalled = false; - this._writableState.prefinished = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; - } - } - function emitErrorNT(self1, err) { - self1.emit('error', err); - } - module.exports = { - destroy: destroy, - undestroy: undestroy - }; - }, - "./node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/stream-browser.js": function(module, __unused_webpack_exports, __webpack_require__) { - module.exports = __webpack_require__("./node_modules/events/events.js")/* .EventEmitter */ .EventEmitter; - }, - "./node_modules/duplexify/node_modules/readable-stream/readable-browser.js": function(module, exports1, __webpack_require__) { - exports1 = module.exports = __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/lib/_stream_readable.js"); - exports1.Stream = exports1; - exports1.Readable = exports1; - exports1.Writable = __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js"); - exports1.Duplex = __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/lib/_stream_duplex.js"); - exports1.Transform = __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/lib/_stream_transform.js"); - exports1.PassThrough = __webpack_require__("./node_modules/duplexify/node_modules/readable-stream/lib/_stream_passthrough.js"); - }, - "./node_modules/duplexify/node_modules/safe-buffer/index.js": function(module, exports1, __webpack_require__) { - /* eslint-disable node/no-deprecated-api */ var buffer = __webpack_require__("./node_modules/buffer/index.js"); - var Buffer = buffer.Buffer; - // alternative to using Object.keys for old browsers - function copyProps(src, dst) { - for(var key in src)dst[key] = src[key]; - } - if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) module.exports = buffer; - else { - // Copy properties from require('buffer') - copyProps(buffer, exports1); - exports1.Buffer = SafeBuffer; - } - function SafeBuffer(arg, encodingOrOffset, length) { - return Buffer(arg, encodingOrOffset, length); - } - // Copy static methods from Buffer - copyProps(Buffer, SafeBuffer); - SafeBuffer.from = function(arg, encodingOrOffset, length) { - if ('number' == typeof arg) throw new TypeError('Argument must not be a number'); - return Buffer(arg, encodingOrOffset, length); - }; - SafeBuffer.alloc = function(size, fill, encoding) { - if ('number' != typeof size) throw new TypeError('Argument must be a number'); - var buf = Buffer(size); - if (void 0 !== fill) { - if ('string' == typeof encoding) buf.fill(fill, encoding); - else buf.fill(fill); - } else buf.fill(0); - return buf; - }; - SafeBuffer.allocUnsafe = function(size) { - if ('number' != typeof size) throw new TypeError('Argument must be a number'); - return Buffer(size); - }; - SafeBuffer.allocUnsafeSlow = function(size) { - if ('number' != typeof size) throw new TypeError('Argument must be a number'); - return buffer.SlowBuffer(size); - }; - }, - "./node_modules/duplexify/node_modules/string_decoder/lib/string_decoder.js": function(__unused_webpack_module, exports1, __webpack_require__) { - "use strict"; - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - /**/ var Buffer = __webpack_require__("./node_modules/duplexify/node_modules/safe-buffer/index.js")/* .Buffer */ .Buffer; - /**/ var isEncoding = Buffer.isEncoding || function(encoding) { - encoding = '' + encoding; - switch(encoding && encoding.toLowerCase()){ - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - case 'raw': - return true; - default: - return false; - } - }; - function _normalizeEncoding(enc) { - if (!enc) return 'utf8'; - var retried; - while(true)switch(enc){ - case 'utf8': - case 'utf-8': - return 'utf8'; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return 'utf16le'; - case 'latin1': - case 'binary': - return 'latin1'; - case 'base64': - case 'ascii': - case 'hex': - return enc; - default: - if (retried) return; // undefined - enc = ('' + enc).toLowerCase(); - retried = true; - } - } - // Do not cache `Buffer.isEncoding` when checking encoding names as some - // modules monkey-patch it to support additional encodings - function normalizeEncoding(enc) { - var nenc = _normalizeEncoding(enc); - if ('string' != typeof nenc && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); - return nenc || enc; - } - // StringDecoder provides an interface for efficiently splitting a series of - // buffers into a series of JS strings without breaking apart multi-byte - // characters. - exports1.StringDecoder = StringDecoder; - function StringDecoder(encoding) { - this.encoding = normalizeEncoding(encoding); - var nb; - switch(this.encoding){ - case 'utf16le': - this.text = utf16Text; - this.end = utf16End; - nb = 4; - break; - case 'utf8': - this.fillLast = utf8FillLast; - nb = 4; - break; - case 'base64': - this.text = base64Text; - this.end = base64End; - nb = 3; - break; - default: - this.write = simpleWrite; - this.end = simpleEnd; - return; - } - this.lastNeed = 0; - this.lastTotal = 0; - this.lastChar = Buffer.allocUnsafe(nb); - } - StringDecoder.prototype.write = function(buf) { - if (0 === buf.length) return ''; - var r; - var i; - if (this.lastNeed) { - r = this.fillLast(buf); - if (void 0 === r) return ''; - i = this.lastNeed; - this.lastNeed = 0; - } else i = 0; - if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); - return r || ''; - }; - StringDecoder.prototype.end = utf8End; - // Returns only complete characters in a Buffer - StringDecoder.prototype.text = utf8Text; - // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer - StringDecoder.prototype.fillLast = function(buf) { - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); - this.lastNeed -= buf.length; - }; - // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a - // continuation byte. If an invalid byte is detected, -2 is returned. - function utf8CheckByte(byte) { - if (byte <= 0x7F) return 0; - if (byte >> 5 === 0x06) return 2; - if (byte >> 4 === 0x0E) return 3; - else if (byte >> 3 === 0x1E) return 4; - return byte >> 6 === 0x02 ? -1 : -2; - } - // Checks at most 3 bytes at the end of a Buffer in order to detect an - // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) - // needed to complete the UTF-8 character (if applicable) are returned. - function utf8CheckIncomplete(self1, buf, i) { - var j = buf.length - 1; - if (j < i) return 0; - var nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self1.lastNeed = nb - 1; - return nb; - } - if (--j < i || -2 === nb) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self1.lastNeed = nb - 2; - return nb; - } - if (--j < i || -2 === nb) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) { - if (2 === nb) nb = 0; - else self1.lastNeed = nb - 3; - } - return nb; - } - return 0; - } - // Validates as many continuation bytes for a multi-byte UTF-8 character as - // needed or are available. If we see a non-continuation byte where we expect - // one, we "replace" the validated continuation bytes we've seen so far with - // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding - // behavior. The continuation byte check is included three times in the case - // where all of the continuation bytes for a character exist in the same buffer. - // It is also done this way as a slight performance increase instead of using a - // loop. - function utf8CheckExtraBytes(self1, buf, p) { - if ((0xC0 & buf[0]) !== 0x80) { - self1.lastNeed = 0; - return '\ufffd'; - } - if (self1.lastNeed > 1 && buf.length > 1) { - if ((0xC0 & buf[1]) !== 0x80) { - self1.lastNeed = 1; - return '\ufffd'; - } - if (self1.lastNeed > 2 && buf.length > 2) { - if ((0xC0 & buf[2]) !== 0x80) { - self1.lastNeed = 2; - return '\ufffd'; - } - } - } - } - // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. - function utf8FillLast(buf) { - var p = this.lastTotal - this.lastNeed; - var r = utf8CheckExtraBytes(this, buf, p); - if (void 0 !== r) return r; - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, p, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, p, 0, buf.length); - this.lastNeed -= buf.length; - } - // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a - // partial character, the character's bytes are buffered until the required - // number of bytes are available. - function utf8Text(buf, i) { - var total = utf8CheckIncomplete(this, buf, i); - if (!this.lastNeed) return buf.toString('utf8', i); - this.lastTotal = total; - var end = buf.length - (total - this.lastNeed); - buf.copy(this.lastChar, 0, end); - return buf.toString('utf8', i, end); - } - // For UTF-8, a replacement character is added when ending on a partial - // character. - function utf8End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + '\ufffd'; - return r; - } - // UTF-16LE typically needs two bytes per character, but even if we have an even - // number of bytes available, we need to check if we end on a leading/high - // surrogate. In that case, we need to wait for the next two bytes in order to - // decode the last character properly. - function utf16Text(buf, i) { - if ((buf.length - i) % 2 === 0) { - var r = buf.toString('utf16le', i); - if (r) { - var c = r.charCodeAt(r.length - 1); - if (c >= 0xD800 && c <= 0xDBFF) { - this.lastNeed = 2; - this.lastTotal = 4; - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - return r.slice(0, -1); - } - } - return r; - } - this.lastNeed = 1; - this.lastTotal = 2; - this.lastChar[0] = buf[buf.length - 1]; - return buf.toString('utf16le', i, buf.length - 1); - } - // For UTF-16LE we do not explicitly append special replacement characters if we - // end on a partial character, we simply let v8 handle that. - function utf16End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) { - var end = this.lastTotal - this.lastNeed; - return r + this.lastChar.toString('utf16le', 0, end); - } - return r; - } - function base64Text(buf, i) { - var n = (buf.length - i) % 3; - if (0 === n) return buf.toString('base64', i); - this.lastNeed = 3 - n; - this.lastTotal = 3; - if (1 === n) this.lastChar[0] = buf[buf.length - 1]; - else { - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - } - return buf.toString('base64', i, buf.length - n); - } - function base64End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); - return r; - } - // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) - function simpleWrite(buf) { - return buf.toString(this.encoding); - } - function simpleEnd(buf) { - return buf && buf.length ? this.write(buf) : ''; - } - }, - "./node_modules/end-of-stream/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - /* provided dependency */ var process = __webpack_require__("./node_modules/process/browser.js"); - var once = __webpack_require__("./node_modules/once/once.js"); - var noop = function() {}; - var isRequest = function(stream) { - return stream.setHeader && 'function' == typeof stream.abort; - }; - var isChildProcess = function(stream) { - return stream.stdio && Array.isArray(stream.stdio) && 3 === stream.stdio.length; - }; - var eos = function(stream, opts, callback) { - if ('function' == typeof opts) return eos(stream, null, opts); - if (!opts) opts = {}; - callback = once(callback || noop); - var ws = stream._writableState; - var rs = stream._readableState; - var readable = opts.readable || false !== opts.readable && stream.readable; - var writable = opts.writable || false !== opts.writable && stream.writable; - var cancelled = false; - var onlegacyfinish = function() { - if (!stream.writable) onfinish(); - }; - var onfinish = function() { - writable = false; - if (!readable) callback.call(stream); - }; - var onend = function() { - readable = false; - if (!writable) callback.call(stream); - }; - var onexit = function(exitCode) { - callback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null); - }; - var onerror = function(err) { - callback.call(stream, err); - }; - var onclose = function() { - process.nextTick(onclosenexttick); - }; - var onclosenexttick = function() { - if (cancelled) return; - if (readable && !(rs && rs.ended && !rs.destroyed)) return callback.call(stream, new Error('premature close')); - if (writable && !(ws && ws.ended && !ws.destroyed)) return callback.call(stream, new Error('premature close')); - }; - var onrequest = function() { - stream.req.on('finish', onfinish); - }; - if (isRequest(stream)) { - stream.on('complete', onfinish); - stream.on('abort', onclose); - if (stream.req) onrequest(); - else stream.on('request', onrequest); - } else if (writable && !ws) { - stream.on('end', onlegacyfinish); - stream.on('close', onlegacyfinish); - } - if (isChildProcess(stream)) stream.on('exit', onexit); - stream.on('end', onend); - stream.on('finish', onfinish); - if (false !== opts.error) stream.on('error', onerror); - stream.on('close', onclose); - return function() { - cancelled = true; - stream.removeListener('complete', onfinish); - stream.removeListener('abort', onclose); - stream.removeListener('request', onrequest); - if (stream.req) stream.req.removeListener('finish', onfinish); - stream.removeListener('end', onlegacyfinish); - stream.removeListener('close', onlegacyfinish); - stream.removeListener('finish', onfinish); - stream.removeListener('exit', onexit); - stream.removeListener('end', onend); - stream.removeListener('error', onerror); - stream.removeListener('close', onclose); - }; - }; - module.exports = eos; - }, - "./node_modules/es-define-property/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var GetIntrinsic = __webpack_require__("./node_modules/get-intrinsic/index.js"); - /** @type {import('.')} */ var $defineProperty = GetIntrinsic('%Object.defineProperty%', true) || false; - if ($defineProperty) try { - $defineProperty({}, 'a', { - value: 1 - }); - } catch (e) { - // IE 8 has a broken defineProperty - $defineProperty = false; - } - module.exports = $defineProperty; - }, - "./node_modules/es-errors/eval.js": function(module) { - "use strict"; - /** @type {import('./eval')} */ module.exports = EvalError; - }, - "./node_modules/es-errors/index.js": function(module) { - "use strict"; - /** @type {import('.')} */ module.exports = Error; - }, - "./node_modules/es-errors/range.js": function(module) { - "use strict"; - /** @type {import('./range')} */ module.exports = RangeError; - }, - "./node_modules/es-errors/ref.js": function(module) { - "use strict"; - /** @type {import('./ref')} */ module.exports = ReferenceError; - }, - "./node_modules/es-errors/syntax.js": function(module) { - "use strict"; - /** @type {import('./syntax')} */ module.exports = SyntaxError; - }, - "./node_modules/es-errors/type.js": function(module) { - "use strict"; - /** @type {import('./type')} */ module.exports = TypeError; - }, - "./node_modules/es-errors/uri.js": function(module) { - "use strict"; - /** @type {import('./uri')} */ module.exports = URIError; - }, - "./node_modules/events/events.js": function(module) { - "use strict"; - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - var R = 'object' == typeof Reflect ? Reflect : null; - var ReflectApply = R && 'function' == typeof R.apply ? R.apply : function(target, receiver, args) { - return Function.prototype.apply.call(target, receiver, args); - }; - var ReflectOwnKeys; - ReflectOwnKeys = R && 'function' == typeof R.ownKeys ? R.ownKeys : Object.getOwnPropertySymbols ? function(target) { - return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target)); - } : function(target) { - return Object.getOwnPropertyNames(target); - }; - function ProcessEmitWarning(warning) { - if (console && console.warn) console.warn(warning); - } - var NumberIsNaN = Number.isNaN || function(value) { - return value !== value; - }; - function EventEmitter() { - EventEmitter.init.call(this); - } - module.exports = EventEmitter; - module.exports.once = once; - // Backwards-compat with node 0.10.x - EventEmitter.EventEmitter = EventEmitter; - EventEmitter.prototype._events = void 0; - EventEmitter.prototype._eventsCount = 0; - EventEmitter.prototype._maxListeners = void 0; - // By default EventEmitters will print a warning if more than 10 listeners are - // added to it. This is a useful default which helps finding memory leaks. - var defaultMaxListeners = 10; - function checkListener(listener) { - if ('function' != typeof listener) throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); - } - Object.defineProperty(EventEmitter, 'defaultMaxListeners', { - enumerable: true, - get: function() { - return defaultMaxListeners; - }, - set: function(arg) { - if ('number' != typeof arg || arg < 0 || NumberIsNaN(arg)) throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); - defaultMaxListeners = arg; - } - }); - EventEmitter.init = function() { - if (void 0 === this._events || this._events === Object.getPrototypeOf(this)._events) { - this._events = Object.create(null); - this._eventsCount = 0; - } - this._maxListeners = this._maxListeners || void 0; - }; - // Obviously not all Emitters should be limited to 10. This function allows - // that to be increased. Set to zero for unlimited. - EventEmitter.prototype.setMaxListeners = function(n) { - if ('number' != typeof n || n < 0 || NumberIsNaN(n)) throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); - this._maxListeners = n; - return this; - }; - function _getMaxListeners(that) { - if (void 0 === that._maxListeners) return EventEmitter.defaultMaxListeners; - return that._maxListeners; - } - EventEmitter.prototype.getMaxListeners = function() { - return _getMaxListeners(this); - }; - EventEmitter.prototype.emit = function(type) { - var args = []; - for(var i = 1; i < arguments.length; i++)args.push(arguments[i]); - var doError = 'error' === type; - var events = this._events; - if (void 0 !== events) doError = doError && void 0 === events.error; - else if (!doError) return false; - // If there is no 'error' event listener then throw. - if (doError) { - var er; - if (args.length > 0) er = args[0]; - if (er instanceof Error) // Note: The comments on the `throw` lines are intentional, they show - // up in Node's output if this results in an unhandled exception. - throw er; // Unhandled 'error' event - // At least give some kind of context to the user - var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); - err.context = er; - throw err; // Unhandled 'error' event - } - var handler = events[type]; - if (void 0 === handler) return false; - if ('function' == typeof handler) ReflectApply(handler, this, args); - else { - var len = handler.length; - var listeners = arrayClone(handler, len); - for(var i = 0; i < len; ++i)ReflectApply(listeners[i], this, args); - } - return true; - }; - function _addListener(target, type, listener, prepend) { - var m; - var events; - var existing; - checkListener(listener); - events = target._events; - if (void 0 === events) { - events = target._events = Object.create(null); - target._eventsCount = 0; - } else { - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (void 0 !== events.newListener) { - target.emit('newListener', type, listener.listener ? listener.listener : listener); - // Re-assign `events` because a newListener handler could have caused the - // this._events to be assigned to a new object - events = target._events; - } - existing = events[type]; - } - if (void 0 === existing) { - // Optimize the case of one listener. Don't need the extra array object. - existing = events[type] = listener; - ++target._eventsCount; - } else { - if ('function' == typeof existing) // Adding the second element, need to change to array. - existing = events[type] = prepend ? [ - listener, - existing - ] : [ - existing, - listener - ]; - else if (prepend) existing.unshift(listener); - else existing.push(listener); - // Check for listener leak - m = _getMaxListeners(target); - if (m > 0 && existing.length > m && !existing.warned) { - existing.warned = true; - // No error code for this since it is a Warning - // eslint-disable-next-line no-restricted-syntax - var w = new Error('Possible EventEmitter memory leak detected. ' + existing.length + ' ' + String(type) + " listeners added. Use emitter.setMaxListeners() to increase limit"); - w.name = 'MaxListenersExceededWarning'; - w.emitter = target; - w.type = type; - w.count = existing.length; - ProcessEmitWarning(w); - } - } - return target; - } - EventEmitter.prototype.addListener = function(type, listener) { - return _addListener(this, type, listener, false); - }; - EventEmitter.prototype.on = EventEmitter.prototype.addListener; - EventEmitter.prototype.prependListener = function(type, listener) { - return _addListener(this, type, listener, true); - }; - function onceWrapper() { - if (!this.fired) { - this.target.removeListener(this.type, this.wrapFn); - this.fired = true; - if (0 === arguments.length) return this.listener.call(this.target); - return this.listener.apply(this.target, arguments); - } - } - function _onceWrap(target, type, listener) { - var state = { - fired: false, - wrapFn: void 0, - target: target, - type: type, - listener: listener - }; - var wrapped = onceWrapper.bind(state); - wrapped.listener = listener; - state.wrapFn = wrapped; - return wrapped; - } - EventEmitter.prototype.once = function(type, listener) { - checkListener(listener); - this.on(type, _onceWrap(this, type, listener)); - return this; - }; - EventEmitter.prototype.prependOnceListener = function(type, listener) { - checkListener(listener); - this.prependListener(type, _onceWrap(this, type, listener)); - return this; - }; - // Emits a 'removeListener' event if and only if the listener was removed. - EventEmitter.prototype.removeListener = function(type, listener) { - var list, events, position, i, originalListener; - checkListener(listener); - events = this._events; - if (void 0 === events) return this; - list = events[type]; - if (void 0 === list) return this; - if (list === listener || list.listener === listener) { - if (0 === --this._eventsCount) this._events = Object.create(null); - else { - delete events[type]; - if (events.removeListener) this.emit('removeListener', type, list.listener || listener); - } - } else if ('function' != typeof list) { - position = -1; - for(i = list.length - 1; i >= 0; i--)if (list[i] === listener || list[i].listener === listener) { - originalListener = list[i].listener; - position = i; - break; - } - if (position < 0) return this; - if (0 === position) list.shift(); - else spliceOne(list, position); - if (1 === list.length) events[type] = list[0]; - if (void 0 !== events.removeListener) this.emit('removeListener', type, originalListener || listener); - } - return this; - }; - EventEmitter.prototype.off = EventEmitter.prototype.removeListener; - EventEmitter.prototype.removeAllListeners = function(type) { - var listeners, events, i; - events = this._events; - if (void 0 === events) return this; - // not listening for removeListener, no need to emit - if (void 0 === events.removeListener) { - if (0 === arguments.length) { - this._events = Object.create(null); - this._eventsCount = 0; - } else if (void 0 !== events[type]) { - if (0 === --this._eventsCount) this._events = Object.create(null); - else delete events[type]; - } - return this; - } - // emit removeListener for all listeners on all events - if (0 === arguments.length) { - var keys = Object.keys(events); - var key; - for(i = 0; i < keys.length; ++i){ - key = keys[i]; - if ('removeListener' !== key) this.removeAllListeners(key); - } - this.removeAllListeners('removeListener'); - this._events = Object.create(null); - this._eventsCount = 0; - return this; - } - listeners = events[type]; - if ('function' == typeof listeners) this.removeListener(type, listeners); - else if (void 0 !== listeners) // LIFO order - for(i = listeners.length - 1; i >= 0; i--)this.removeListener(type, listeners[i]); - return this; - }; - function _listeners(target, type, unwrap) { - var events = target._events; - if (void 0 === events) return []; - var evlistener = events[type]; - if (void 0 === evlistener) return []; - if ('function' == typeof evlistener) return unwrap ? [ - evlistener.listener || evlistener - ] : [ - evlistener - ]; - return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); - } - EventEmitter.prototype.listeners = function(type) { - return _listeners(this, type, true); - }; - EventEmitter.prototype.rawListeners = function(type) { - return _listeners(this, type, false); - }; - EventEmitter.listenerCount = function(emitter, type) { - if ('function' == typeof emitter.listenerCount) return emitter.listenerCount(type); - return listenerCount.call(emitter, type); - }; - EventEmitter.prototype.listenerCount = listenerCount; - function listenerCount(type) { - var events = this._events; - if (void 0 !== events) { - var evlistener = events[type]; - if ('function' == typeof evlistener) return 1; - if (void 0 !== evlistener) return evlistener.length; - } - return 0; - } - EventEmitter.prototype.eventNames = function() { - return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; - }; - function arrayClone(arr, n) { - var copy = new Array(n); - for(var i = 0; i < n; ++i)copy[i] = arr[i]; - return copy; - } - function spliceOne(list, index) { - for(; index + 1 < list.length; index++)list[index] = list[index + 1]; - list.pop(); - } - function unwrapListeners(arr) { - var ret = new Array(arr.length); - for(var i = 0; i < ret.length; ++i)ret[i] = arr[i].listener || arr[i]; - return ret; - } - function once(emitter, name) { - return new Promise(function(resolve, reject) { - function errorListener(err) { - emitter.removeListener(name, resolver); - reject(err); - } - function resolver() { - if ('function' == typeof emitter.removeListener) emitter.removeListener('error', errorListener); - resolve([].slice.call(arguments)); - } - eventTargetAgnosticAddListener(emitter, name, resolver, { - once: true - }); - if ('error' !== name) addErrorHandlerIfEventEmitter(emitter, errorListener, { - once: true - }); - }); - } - function addErrorHandlerIfEventEmitter(emitter, handler, flags) { - if ('function' == typeof emitter.on) eventTargetAgnosticAddListener(emitter, 'error', handler, flags); - } - function eventTargetAgnosticAddListener(emitter, name, listener, flags) { - if ('function' == typeof emitter.on) { - if (flags.once) emitter.once(name, listener); - else emitter.on(name, listener); - } else if ('function' == typeof emitter.addEventListener) // EventTarget does not have `error` event semantics like Node - // EventEmitters, we do not listen for `error` events here. - emitter.addEventListener(name, function wrapListener(arg) { - // IE does not have builtin `{ once: true }` support so we - // have to do it manually. - if (flags.once) emitter.removeEventListener(name, wrapListener); - listener(arg); - }); - else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); - } - }, - "./node_modules/fast-safe-stringify/index.js": function(module) { - module.exports = stringify; - stringify.default = stringify; - stringify.stable = deterministicStringify; - stringify.stableStringify = deterministicStringify; - var LIMIT_REPLACE_NODE = '[...]'; - var CIRCULAR_REPLACE_NODE = '[Circular]'; - var arr = []; - var replacerStack = []; - function defaultOptions() { - return { - depthLimit: Number.MAX_SAFE_INTEGER, - edgesLimit: Number.MAX_SAFE_INTEGER - }; - } - // Regular stringify - function stringify(obj, replacer, spacer, options) { - if (void 0 === options) options = defaultOptions(); - decirc(obj, '', 0, [], void 0, 0, options); - var res; - try { - res = 0 === replacerStack.length ? JSON.stringify(obj, replacer, spacer) : JSON.stringify(obj, replaceGetterValues(replacer), spacer); - } catch (_) { - return JSON.stringify('[unable to serialize, circular reference is too complex to analyze]'); - } finally{ - while(0 !== arr.length){ - var part = arr.pop(); - if (4 === part.length) Object.defineProperty(part[0], part[1], part[3]); - else part[0][part[1]] = part[2]; - } - } - return res; - } - function setReplace(replace, val, k, parent) { - var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k); - if (void 0 !== propertyDescriptor.get) { - if (propertyDescriptor.configurable) { - Object.defineProperty(parent, k, { - value: replace - }); - arr.push([ - parent, - k, - val, - propertyDescriptor - ]); - } else replacerStack.push([ - val, - k, - replace - ]); - } else { - parent[k] = replace; - arr.push([ - parent, - k, - val - ]); - } - } - function decirc(val, k, edgeIndex, stack, parent, depth, options) { - depth += 1; - var i; - if ('object' == typeof val && null !== val) { - for(i = 0; i < stack.length; i++)if (stack[i] === val) { - setReplace(CIRCULAR_REPLACE_NODE, val, k, parent); - return; - } - if (void 0 !== options.depthLimit && depth > options.depthLimit) { - setReplace(LIMIT_REPLACE_NODE, val, k, parent); - return; - } - if (void 0 !== options.edgesLimit && edgeIndex + 1 > options.edgesLimit) { - setReplace(LIMIT_REPLACE_NODE, val, k, parent); - return; - } - stack.push(val); - // Optimize for Arrays. Big arrays could kill the performance otherwise! - if (Array.isArray(val)) for(i = 0; i < val.length; i++)decirc(val[i], i, i, stack, val, depth, options); - else { - var keys = Object.keys(val); - for(i = 0; i < keys.length; i++){ - var key = keys[i]; - decirc(val[key], key, i, stack, val, depth, options); - } - } - stack.pop(); - } - } - // Stable-stringify - function compareFunction(a, b) { - if (a < b) return -1; - if (a > b) return 1; - return 0; - } - function deterministicStringify(obj, replacer, spacer, options) { - if (void 0 === options) options = defaultOptions(); - var tmp = deterministicDecirc(obj, '', 0, [], void 0, 0, options) || obj; - var res; - try { - res = 0 === replacerStack.length ? JSON.stringify(tmp, replacer, spacer) : JSON.stringify(tmp, replaceGetterValues(replacer), spacer); - } catch (_) { - return JSON.stringify('[unable to serialize, circular reference is too complex to analyze]'); - } finally{ - // Ensure that we restore the object as it was. - while(0 !== arr.length){ - var part = arr.pop(); - if (4 === part.length) Object.defineProperty(part[0], part[1], part[3]); - else part[0][part[1]] = part[2]; - } - } - return res; - } - function deterministicDecirc(val, k, edgeIndex, stack, parent, depth, options) { - depth += 1; - var i; - if ('object' == typeof val && null !== val) { - for(i = 0; i < stack.length; i++)if (stack[i] === val) { - setReplace(CIRCULAR_REPLACE_NODE, val, k, parent); - return; - } - try { - if ('function' == typeof val.toJSON) return; - } catch (_) { - return; - } - if (void 0 !== options.depthLimit && depth > options.depthLimit) { - setReplace(LIMIT_REPLACE_NODE, val, k, parent); - return; - } - if (void 0 !== options.edgesLimit && edgeIndex + 1 > options.edgesLimit) { - setReplace(LIMIT_REPLACE_NODE, val, k, parent); - return; - } - stack.push(val); - // Optimize for Arrays. Big arrays could kill the performance otherwise! - if (Array.isArray(val)) for(i = 0; i < val.length; i++)deterministicDecirc(val[i], i, i, stack, val, depth, options); - else { - // Create a temporary object in the required way - var tmp = {}; - var keys = Object.keys(val).sort(compareFunction); - for(i = 0; i < keys.length; i++){ - var key = keys[i]; - deterministicDecirc(val[key], key, i, stack, val, depth, options); - tmp[key] = val[key]; - } - if (void 0 === parent) return tmp; - arr.push([ - parent, - k, - val - ]); - parent[k] = tmp; - } - stack.pop(); - } - } - // wraps replacer function to handle values we couldn't replace - // and mark them as replaced value - function replaceGetterValues(replacer) { - replacer = void 0 !== replacer ? replacer : function(k, v) { - return v; - }; - return function(key, val) { - if (replacerStack.length > 0) for(var i = 0; i < replacerStack.length; i++){ - var part = replacerStack[i]; - if (part[1] === key && part[0] === val) { - val = part[2]; - replacerStack.splice(i, 1); - break; - } - } - return replacer.call(this, key, val); - }; - } - }, - "./node_modules/for-each/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var isCallable = __webpack_require__("./node_modules/is-callable/index.js"); - var toStr = Object.prototype.toString; - var hasOwnProperty = Object.prototype.hasOwnProperty; - var forEachArray = function(array, iterator, receiver) { - for(var i = 0, len = array.length; i < len; i++)if (hasOwnProperty.call(array, i)) { - if (null == receiver) iterator(array[i], i, array); - else iterator.call(receiver, array[i], i, array); - } - }; - var forEachString = function(string, iterator, receiver) { - for(var i = 0, len = string.length; i < len; i++)// no such thing as a sparse string. - if (null == receiver) iterator(string.charAt(i), i, string); - else iterator.call(receiver, string.charAt(i), i, string); - }; - var forEachObject = function(object, iterator, receiver) { - for(var k in object)if (hasOwnProperty.call(object, k)) { - if (null == receiver) iterator(object[k], k, object); - else iterator.call(receiver, object[k], k, object); - } - }; - var forEach = function(list, iterator, thisArg) { - if (!isCallable(iterator)) throw new TypeError('iterator must be a function'); - var receiver; - if (arguments.length >= 3) receiver = thisArg; - if ('[object Array]' === toStr.call(list)) forEachArray(list, iterator, receiver); - else if ('string' == typeof list) forEachString(list, iterator, receiver); - else forEachObject(list, iterator, receiver); - }; - module.exports = forEach; - }, - "./node_modules/function-bind/implementation.js": function(module) { - "use strict"; - /* eslint no-invalid-this: 1 */ var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; - var toStr = Object.prototype.toString; - var max = Math.max; - var funcType = '[object Function]'; - var concatty = function(a, b) { - var arr = []; - for(var i = 0; i < a.length; i += 1)arr[i] = a[i]; - for(var j = 0; j < b.length; j += 1)arr[j + a.length] = b[j]; - return arr; - }; - var slicy = function(arrLike, offset) { - var arr = []; - for(var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1)arr[j] = arrLike[i]; - return arr; - }; - var joiny = function(arr, joiner) { - var str = ''; - for(var i = 0; i < arr.length; i += 1){ - str += arr[i]; - if (i + 1 < arr.length) str += joiner; - } - return str; - }; - module.exports = function(that) { - var target = this; - if ('function' != typeof target || toStr.apply(target) !== funcType) throw new TypeError(ERROR_MESSAGE + target); - var args = slicy(arguments, 1); - var bound; - var binder = function() { - if (this instanceof bound) { - var result = target.apply(this, concatty(args, arguments)); - if (Object(result) === result) return result; - return this; - } - return target.apply(that, concatty(args, arguments)); - }; - var boundLength = max(0, target.length - args.length); - var boundArgs = []; - for(var i = 0; i < boundLength; i++)boundArgs[i] = '$' + i; - bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder); - if (target.prototype) { - var Empty = function() {}; - Empty.prototype = target.prototype; - bound.prototype = new Empty(); - Empty.prototype = null; - } - return bound; - }; - }, - "./node_modules/function-bind/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var implementation = __webpack_require__("./node_modules/function-bind/implementation.js"); - module.exports = Function.prototype.bind || implementation; - }, - "./node_modules/get-intrinsic/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var undefined; - var $Error = __webpack_require__("./node_modules/es-errors/index.js"); - var $EvalError = __webpack_require__("./node_modules/es-errors/eval.js"); - var $RangeError = __webpack_require__("./node_modules/es-errors/range.js"); - var $ReferenceError = __webpack_require__("./node_modules/es-errors/ref.js"); - var $SyntaxError = __webpack_require__("./node_modules/es-errors/syntax.js"); - var $TypeError = __webpack_require__("./node_modules/es-errors/type.js"); - var $URIError = __webpack_require__("./node_modules/es-errors/uri.js"); - var $Function = Function; - // eslint-disable-next-line consistent-return - var getEvalledConstructor = function(expressionSyntax) { - try { - return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')(); - } catch (e) {} - }; - var $gOPD = Object.getOwnPropertyDescriptor; - if ($gOPD) try { - $gOPD({}, ''); - } catch (e) { - $gOPD = null; // this is IE 8, which has a broken gOPD - } - var throwTypeError = function() { - throw new $TypeError(); - }; - var ThrowTypeError = $gOPD ? function() { - try { - // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties - arguments.callee; // IE 8 does not throw here - return throwTypeError; - } catch (calleeThrows) { - try { - // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '') - return $gOPD(arguments, 'callee').get; - } catch (gOPDthrows) { - return throwTypeError; - } - } - }() : throwTypeError; - var hasSymbols = __webpack_require__("./node_modules/has-symbols/index.js")(); - var hasProto = __webpack_require__("./node_modules/has-proto/index.js")(); - var getProto = Object.getPrototypeOf || (hasProto ? function(x) { - return x.__proto__; - } // eslint-disable-line no-proto - : null); - var needsEval = {}; - var TypedArray = 'undefined' != typeof Uint8Array && getProto ? getProto(Uint8Array) : undefined; - var INTRINSICS = { - __proto__: null, - '%AggregateError%': 'undefined' == typeof AggregateError ? undefined : AggregateError, - '%Array%': Array, - '%ArrayBuffer%': 'undefined' == typeof ArrayBuffer ? undefined : ArrayBuffer, - '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined, - '%AsyncFromSyncIteratorPrototype%': undefined, - '%AsyncFunction%': needsEval, - '%AsyncGenerator%': needsEval, - '%AsyncGeneratorFunction%': needsEval, - '%AsyncIteratorPrototype%': needsEval, - '%Atomics%': 'undefined' == typeof Atomics ? undefined : Atomics, - '%BigInt%': 'undefined' == typeof BigInt ? undefined : BigInt, - '%BigInt64Array%': 'undefined' == typeof BigInt64Array ? undefined : BigInt64Array, - '%BigUint64Array%': 'undefined' == typeof BigUint64Array ? undefined : BigUint64Array, - '%Boolean%': Boolean, - '%DataView%': 'undefined' == typeof DataView ? undefined : DataView, - '%Date%': Date, - '%decodeURI%': decodeURI, - '%decodeURIComponent%': decodeURIComponent, - '%encodeURI%': encodeURI, - '%encodeURIComponent%': encodeURIComponent, - '%Error%': $Error, - '%eval%': eval, - '%EvalError%': $EvalError, - '%Float32Array%': 'undefined' == typeof Float32Array ? undefined : Float32Array, - '%Float64Array%': 'undefined' == typeof Float64Array ? undefined : Float64Array, - '%FinalizationRegistry%': 'undefined' == typeof FinalizationRegistry ? undefined : FinalizationRegistry, - '%Function%': $Function, - '%GeneratorFunction%': needsEval, - '%Int8Array%': 'undefined' == typeof Int8Array ? undefined : Int8Array, - '%Int16Array%': 'undefined' == typeof Int16Array ? undefined : Int16Array, - '%Int32Array%': 'undefined' == typeof Int32Array ? undefined : Int32Array, - '%isFinite%': isFinite, - '%isNaN%': isNaN, - '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined, - '%JSON%': 'object' == typeof JSON ? JSON : undefined, - '%Map%': 'undefined' == typeof Map ? undefined : Map, - '%MapIteratorPrototype%': 'undefined' != typeof Map && hasSymbols && getProto ? getProto(new Map()[Symbol.iterator]()) : undefined, - '%Math%': Math, - '%Number%': Number, - '%Object%': Object, - '%parseFloat%': parseFloat, - '%parseInt%': parseInt, - '%Promise%': 'undefined' == typeof Promise ? undefined : Promise, - '%Proxy%': 'undefined' == typeof Proxy ? undefined : Proxy, - '%RangeError%': $RangeError, - '%ReferenceError%': $ReferenceError, - '%Reflect%': 'undefined' == typeof Reflect ? undefined : Reflect, - '%RegExp%': RegExp, - '%Set%': 'undefined' == typeof Set ? undefined : Set, - '%SetIteratorPrototype%': 'undefined' != typeof Set && hasSymbols && getProto ? getProto(new Set()[Symbol.iterator]()) : undefined, - '%SharedArrayBuffer%': 'undefined' == typeof SharedArrayBuffer ? undefined : SharedArrayBuffer, - '%String%': String, - '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined, - '%Symbol%': hasSymbols ? Symbol : undefined, - '%SyntaxError%': $SyntaxError, - '%ThrowTypeError%': ThrowTypeError, - '%TypedArray%': TypedArray, - '%TypeError%': $TypeError, - '%Uint8Array%': 'undefined' == typeof Uint8Array ? undefined : Uint8Array, - '%Uint8ClampedArray%': 'undefined' == typeof Uint8ClampedArray ? undefined : Uint8ClampedArray, - '%Uint16Array%': 'undefined' == typeof Uint16Array ? undefined : Uint16Array, - '%Uint32Array%': 'undefined' == typeof Uint32Array ? undefined : Uint32Array, - '%URIError%': $URIError, - '%WeakMap%': 'undefined' == typeof WeakMap ? undefined : WeakMap, - '%WeakRef%': 'undefined' == typeof WeakRef ? undefined : WeakRef, - '%WeakSet%': 'undefined' == typeof WeakSet ? undefined : WeakSet - }; - if (getProto) try { - null.error; // eslint-disable-line no-unused-expressions - } catch (e) { - // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229 - var errorProto = getProto(getProto(e)); - INTRINSICS['%Error.prototype%'] = errorProto; - } - var doEval = function doEval(name) { - var value; - if ('%AsyncFunction%' === name) value = getEvalledConstructor('async function () {}'); - else if ('%GeneratorFunction%' === name) value = getEvalledConstructor('function* () {}'); - else if ('%AsyncGeneratorFunction%' === name) value = getEvalledConstructor('async function* () {}'); - else if ('%AsyncGenerator%' === name) { - var fn = doEval('%AsyncGeneratorFunction%'); - if (fn) value = fn.prototype; - } else if ('%AsyncIteratorPrototype%' === name) { - var gen = doEval('%AsyncGenerator%'); - if (gen && getProto) value = getProto(gen.prototype); - } - INTRINSICS[name] = value; - return value; - }; - var LEGACY_ALIASES = { - __proto__: null, - '%ArrayBufferPrototype%': [ - 'ArrayBuffer', - 'prototype' - ], - '%ArrayPrototype%': [ - 'Array', - 'prototype' - ], - '%ArrayProto_entries%': [ - 'Array', - 'prototype', - 'entries' - ], - '%ArrayProto_forEach%': [ - 'Array', - 'prototype', - 'forEach' - ], - '%ArrayProto_keys%': [ - 'Array', - 'prototype', - 'keys' - ], - '%ArrayProto_values%': [ - 'Array', - 'prototype', - 'values' - ], - '%AsyncFunctionPrototype%': [ - 'AsyncFunction', - 'prototype' - ], - '%AsyncGenerator%': [ - 'AsyncGeneratorFunction', - 'prototype' - ], - '%AsyncGeneratorPrototype%': [ - 'AsyncGeneratorFunction', - 'prototype', - 'prototype' - ], - '%BooleanPrototype%': [ - 'Boolean', - 'prototype' - ], - '%DataViewPrototype%': [ - 'DataView', - 'prototype' - ], - '%DatePrototype%': [ - 'Date', - 'prototype' - ], - '%ErrorPrototype%': [ - 'Error', - 'prototype' - ], - '%EvalErrorPrototype%': [ - 'EvalError', - 'prototype' - ], - '%Float32ArrayPrototype%': [ - 'Float32Array', - 'prototype' - ], - '%Float64ArrayPrototype%': [ - 'Float64Array', - 'prototype' - ], - '%FunctionPrototype%': [ - 'Function', - 'prototype' - ], - '%Generator%': [ - 'GeneratorFunction', - 'prototype' - ], - '%GeneratorPrototype%': [ - 'GeneratorFunction', - 'prototype', - 'prototype' - ], - '%Int8ArrayPrototype%': [ - 'Int8Array', - 'prototype' - ], - '%Int16ArrayPrototype%': [ - 'Int16Array', - 'prototype' - ], - '%Int32ArrayPrototype%': [ - 'Int32Array', - 'prototype' - ], - '%JSONParse%': [ - 'JSON', - 'parse' - ], - '%JSONStringify%': [ - 'JSON', - 'stringify' - ], - '%MapPrototype%': [ - 'Map', - 'prototype' - ], - '%NumberPrototype%': [ - 'Number', - 'prototype' - ], - '%ObjectPrototype%': [ - 'Object', - 'prototype' - ], - '%ObjProto_toString%': [ - 'Object', - 'prototype', - 'toString' - ], - '%ObjProto_valueOf%': [ - 'Object', - 'prototype', - 'valueOf' - ], - '%PromisePrototype%': [ - 'Promise', - 'prototype' - ], - '%PromiseProto_then%': [ - 'Promise', - 'prototype', - 'then' - ], - '%Promise_all%': [ - 'Promise', - 'all' - ], - '%Promise_reject%': [ - 'Promise', - 'reject' - ], - '%Promise_resolve%': [ - 'Promise', - 'resolve' - ], - '%RangeErrorPrototype%': [ - 'RangeError', - 'prototype' - ], - '%ReferenceErrorPrototype%': [ - 'ReferenceError', - 'prototype' - ], - '%RegExpPrototype%': [ - 'RegExp', - 'prototype' - ], - '%SetPrototype%': [ - 'Set', - 'prototype' - ], - '%SharedArrayBufferPrototype%': [ - 'SharedArrayBuffer', - 'prototype' - ], - '%StringPrototype%': [ - 'String', - 'prototype' - ], - '%SymbolPrototype%': [ - 'Symbol', - 'prototype' - ], - '%SyntaxErrorPrototype%': [ - 'SyntaxError', - 'prototype' - ], - '%TypedArrayPrototype%': [ - 'TypedArray', - 'prototype' - ], - '%TypeErrorPrototype%': [ - 'TypeError', - 'prototype' - ], - '%Uint8ArrayPrototype%': [ - 'Uint8Array', - 'prototype' - ], - '%Uint8ClampedArrayPrototype%': [ - 'Uint8ClampedArray', - 'prototype' - ], - '%Uint16ArrayPrototype%': [ - 'Uint16Array', - 'prototype' - ], - '%Uint32ArrayPrototype%': [ - 'Uint32Array', - 'prototype' - ], - '%URIErrorPrototype%': [ - 'URIError', - 'prototype' - ], - '%WeakMapPrototype%': [ - 'WeakMap', - 'prototype' - ], - '%WeakSetPrototype%': [ - 'WeakSet', - 'prototype' - ] - }; - var bind = __webpack_require__("./node_modules/function-bind/index.js"); - var hasOwn = __webpack_require__("./node_modules/hasown/index.js"); - var $concat = bind.call(Function.call, Array.prototype.concat); - var $spliceApply = bind.call(Function.apply, Array.prototype.splice); - var $replace = bind.call(Function.call, String.prototype.replace); - var $strSlice = bind.call(Function.call, String.prototype.slice); - var $exec = bind.call(Function.call, RegExp.prototype.exec); - /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; - var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */ - var stringToPath = function(string) { - var first = $strSlice(string, 0, 1); - var last = $strSlice(string, -1); - if ('%' === first && '%' !== last) throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`'); - if ('%' === last && '%' !== first) throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`'); - var result = []; - $replace(string, rePropName, function(match, number, quote, subString) { - result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match; - }); - return result; - }; - /* end adaptation */ var getBaseIntrinsic = function(name, allowMissing) { - var intrinsicName = name; - var alias; - if (hasOwn(LEGACY_ALIASES, intrinsicName)) { - alias = LEGACY_ALIASES[intrinsicName]; - intrinsicName = '%' + alias[0] + '%'; - } - if (hasOwn(INTRINSICS, intrinsicName)) { - var value = INTRINSICS[intrinsicName]; - if (value === needsEval) value = doEval(intrinsicName); - if (void 0 === value && !allowMissing) throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); - return { - alias: alias, - name: intrinsicName, - value: value - }; - } - throw new $SyntaxError('intrinsic ' + name + ' does not exist!'); - }; - module.exports = function(name, allowMissing) { - if ('string' != typeof name || 0 === name.length) throw new $TypeError('intrinsic name must be a non-empty string'); - if (arguments.length > 1 && 'boolean' != typeof allowMissing) throw new $TypeError('"allowMissing" argument must be a boolean'); - if (null === $exec(/^%?[^%]*%?$/, name)) throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name'); - var parts = stringToPath(name); - var intrinsicBaseName = parts.length > 0 ? parts[0] : ''; - var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing); - var intrinsicRealName = intrinsic.name; - var value = intrinsic.value; - var skipFurtherCaching = false; - var alias = intrinsic.alias; - if (alias) { - intrinsicBaseName = alias[0]; - $spliceApply(parts, $concat([ - 0, - 1 - ], alias)); - } - for(var i = 1, isOwn = true; i < parts.length; i += 1){ - var part = parts[i]; - var first = $strSlice(part, 0, 1); - var last = $strSlice(part, -1); - if (('"' === first || "'" === first || '`' === first || '"' === last || "'" === last || '`' === last) && first !== last) throw new $SyntaxError('property names with quotes must have matching quotes'); - if ('constructor' === part || !isOwn) skipFurtherCaching = true; - intrinsicBaseName += '.' + part; - intrinsicRealName = '%' + intrinsicBaseName + '%'; - if (hasOwn(INTRINSICS, intrinsicRealName)) value = INTRINSICS[intrinsicRealName]; - else if (null != value) { - if (!(part in value)) { - if (!allowMissing) throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.'); - return; - } - if ($gOPD && i + 1 >= parts.length) { - var desc = $gOPD(value, part); - isOwn = !!desc; - // By convention, when a data property is converted to an accessor - // property to emulate a data property that does not suffer from - // the override mistake, that accessor's getter is marked with - // an `originalValue` property. Here, when we detect this, we - // uphold the illusion by pretending to see that original data - // property, i.e., returning the value rather than the getter - // itself. - value = isOwn && 'get' in desc && !('originalValue' in desc.get) ? desc.get : value[part]; - } else { - isOwn = hasOwn(value, part); - value = value[part]; - } - if (isOwn && !skipFurtherCaching) INTRINSICS[intrinsicRealName] = value; - } - } - return value; - }; - }, - "./node_modules/geval/event.js": function(module) { - module.exports = Event1; - function Event1() { - var listeners = []; - return { - broadcast: broadcast, - listen: event - }; - function broadcast(value) { - for(var i = 0; i < listeners.length; i++)listeners[i](value); - } - function event(listener) { - listeners.push(listener); - return removeListener; - function removeListener() { - var index = listeners.indexOf(listener); - if (-1 !== index) listeners.splice(index, 1); - } - } - } - }, - "./node_modules/geval/source.js": function(module, __unused_webpack_exports, __webpack_require__) { - var Event1 = __webpack_require__("./node_modules/geval/event.js"); - module.exports = Source; - function Source(broadcaster) { - var tuple = Event1(); - broadcaster(tuple.broadcast); - return tuple.listen; - } - }, - "./node_modules/global/document.js": function(module, __unused_webpack_exports, __webpack_require__) { - var topLevel = void 0 !== __webpack_require__.g ? __webpack_require__.g : 'undefined' != typeof window ? window : {}; - var minDoc = __webpack_require__("?ff23"); - var doccy; - if ('undefined' != typeof document) doccy = document; - else { - doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4']; - if (!doccy) doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc; - } - module.exports = doccy; - }, - "./node_modules/gopd/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var GetIntrinsic = __webpack_require__("./node_modules/get-intrinsic/index.js"); - var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true); - if ($gOPD) try { - $gOPD([], 'length'); - } catch (e) { - // IE 8 has a broken gOPD - $gOPD = null; - } - module.exports = $gOPD; - }, - "./node_modules/has-property-descriptors/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var $defineProperty = __webpack_require__("./node_modules/es-define-property/index.js"); - var hasPropertyDescriptors = function() { - return !!$defineProperty; - }; - hasPropertyDescriptors.hasArrayLengthDefineBug = function() { - // node v0.6 has a bug where array lengths can be Set but not Defined - if (!$defineProperty) return null; - try { - return 1 !== $defineProperty([], 'length', { - value: 1 - }).length; - } catch (e) { - // In Firefox 4-22, defining length on an array throws an exception. - return true; - } - }; - module.exports = hasPropertyDescriptors; - }, - "./node_modules/has-proto/index.js": function(module) { - "use strict"; - var test = { - __proto__: null, - foo: {} - }; - var $Object = Object; - /** @type {import('.')} */ module.exports = function() { - // @ts-expect-error: TS errors on an inherited property for some reason - return ({ - __proto__: test - }).foo === test.foo && !(test instanceof $Object); - }; - }, - "./node_modules/has-symbols/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var origSymbol = 'undefined' != typeof Symbol && Symbol; - var hasSymbolSham = __webpack_require__("./node_modules/has-symbols/shams.js"); - module.exports = function() { - if ('function' != typeof origSymbol) return false; - if ('function' != typeof Symbol) return false; - if ('symbol' != typeof origSymbol('foo')) return false; - if ('symbol' != typeof Symbol('bar')) return false; - return hasSymbolSham(); - }; - }, - "./node_modules/has-symbols/shams.js": function(module) { - "use strict"; - /* eslint complexity: [2, 18], max-statements: [2, 33] */ module.exports = function() { - if ('function' != typeof Symbol || 'function' != typeof Object.getOwnPropertySymbols) return false; - if ('symbol' == typeof Symbol.iterator) return true; - var obj = {}; - var sym = Symbol('test'); - var symObj = Object(sym); - if ('string' == typeof sym) return false; - if ('[object Symbol]' !== Object.prototype.toString.call(sym)) return false; - if ('[object Symbol]' !== Object.prototype.toString.call(symObj)) return false; - // temp disabled per https://github.com/ljharb/object.assign/issues/17 - // if (sym instanceof Symbol) { return false; } - // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 - // if (!(symObj instanceof Symbol)) { return false; } - // if (typeof Symbol.prototype.toString !== 'function') { return false; } - // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } - var symVal = 42; - obj[sym] = symVal; - for(sym in obj)return false; - // eslint-disable-line no-restricted-syntax, no-unreachable-loop - if ('function' == typeof Object.keys && 0 !== Object.keys(obj).length) return false; - if ('function' == typeof Object.getOwnPropertyNames && 0 !== Object.getOwnPropertyNames(obj).length) return false; - var syms = Object.getOwnPropertySymbols(obj); - if (1 !== syms.length || syms[0] !== sym) return false; - if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) return false; - if ('function' == typeof Object.getOwnPropertyDescriptor) { - var descriptor = Object.getOwnPropertyDescriptor(obj, sym); - if (descriptor.value !== symVal || true !== descriptor.enumerable) return false; - } - return true; - }; - }, - "./node_modules/has-tostringtag/shams.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var hasSymbols = __webpack_require__("./node_modules/has-symbols/shams.js"); - /** @type {import('.')} */ module.exports = function() { - return hasSymbols() && !!Symbol.toStringTag; - }; - }, - "./node_modules/hasown/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var call = Function.prototype.call; - var $hasOwn = Object.prototype.hasOwnProperty; - var bind = __webpack_require__("./node_modules/function-bind/index.js"); - /** @type {import('.')} */ module.exports = bind.call(call, $hasOwn); - }, - "./node_modules/hidden/index.js": function(module) { - module.exports = shim; - function shim(element, value) { - if (void 0 === value) return 'none' === element.style.display; - element.style.display = value ? 'none' : ''; - } - }, - "./node_modules/ieee754/index.js": function(__unused_webpack_module, exports1) { - /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ exports1.read = function(buffer, offset, isLE, mLen, nBytes) { - var e, m; - var eLen = 8 * nBytes - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var nBits = -7; - var i = isLE ? nBytes - 1 : 0; - var d = isLE ? -1 : 1; - var s = buffer[offset + i]; - i += d; - e = s & (1 << -nBits) - 1; - s >>= -nBits; - nBits += eLen; - for(; nBits > 0; e = 256 * e + buffer[offset + i], i += d, nBits -= 8); - m = e & (1 << -nBits) - 1; - e >>= -nBits; - nBits += mLen; - for(; nBits > 0; m = 256 * m + buffer[offset + i], i += d, nBits -= 8); - if (0 === e) e = 1 - eBias; - else { - if (e === eMax) return m ? NaN : 1 / 0 * (s ? -1 : 1); - m += Math.pow(2, mLen); - e -= eBias; - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen); - }; - exports1.write = function(buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c; - var eLen = 8 * nBytes - mLen - 1; - var eMax = (1 << eLen) - 1; - var eBias = eMax >> 1; - var rt = 23 === mLen ? Math.pow(2, -24) - Math.pow(2, -77) : 0; - var i = isLE ? 0 : nBytes - 1; - var d = isLE ? 1 : -1; - var s = value < 0 || 0 === value && 1 / value < 0 ? 1 : 0; - value = Math.abs(value); - if (isNaN(value) || value === 1 / 0) { - m = isNaN(value) ? 1 : 0; - e = eMax; - } else { - e = Math.floor(Math.log(value) / Math.LN2); - if (value * (c = Math.pow(2, -e)) < 1) { - e--; - c *= 2; - } - if (e + eBias >= 1) value += rt / c; - else value += rt * Math.pow(2, 1 - eBias); - if (value * c >= 2) { - e++; - c /= 2; - } - if (e + eBias >= eMax) { - m = 0; - e = eMax; - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen); - e += eBias; - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); - e = 0; - } - } - for(; mLen >= 8; buffer[offset + i] = 0xff & m, i += d, m /= 256, mLen -= 8); - e = e << mLen | m; - eLen += mLen; - for(; eLen > 0; buffer[offset + i] = 0xff & e, i += d, e /= 256, eLen -= 8); - buffer[offset + i - d] |= 128 * s; - }; - }, - "./node_modules/inherits/inherits_browser.js": function(module) { - if ('function' == typeof Object.create) // implementation from standard node.js 'util' module - module.exports = function(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor; - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - } - }; - else // old school shim for old browsers - module.exports = function(ctor, superCtor) { - if (superCtor) { - ctor.super_ = superCtor; - var TempCtor = function() {}; - TempCtor.prototype = superCtor.prototype; - ctor.prototype = new TempCtor(); - ctor.prototype.constructor = ctor; - } - }; - }, - "./node_modules/is-arguments/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var hasToStringTag = __webpack_require__("./node_modules/has-tostringtag/shams.js")(); - var callBound = __webpack_require__("./node_modules/call-bind/callBound.js"); - var $toString = callBound('Object.prototype.toString'); - var isStandardArguments = function(value) { - if (hasToStringTag && value && 'object' == typeof value && Symbol.toStringTag in value) return false; - return '[object Arguments]' === $toString(value); - }; - var isLegacyArguments = function(value) { - if (isStandardArguments(value)) return true; - return null !== value && 'object' == typeof value && 'number' == typeof value.length && value.length >= 0 && '[object Array]' !== $toString(value) && '[object Function]' === $toString(value.callee); - }; - var supportsStandardArguments = function() { - return isStandardArguments(arguments); - }(); - isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests - module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments; - }, - "./node_modules/is-callable/index.js": function(module) { - "use strict"; - var fnToStr = Function.prototype.toString; - var reflectApply = 'object' == typeof Reflect && null !== Reflect && Reflect.apply; - var badArrayLike; - var isCallableMarker; - if ('function' == typeof reflectApply && 'function' == typeof Object.defineProperty) try { - badArrayLike = Object.defineProperty({}, 'length', { - get: function() { - throw isCallableMarker; - } - }); - isCallableMarker = {}; - // eslint-disable-next-line no-throw-literal - reflectApply(function() { - throw 42; - }, null, badArrayLike); - } catch (_) { - if (_ !== isCallableMarker) reflectApply = null; - } - else reflectApply = null; - var constructorRegex = /^\s*class\b/; - var isES6ClassFn = function(value) { - try { - var fnStr = fnToStr.call(value); - return constructorRegex.test(fnStr); - } catch (e) { - return false; // not a function - } - }; - var tryFunctionObject = function(value) { - try { - if (isES6ClassFn(value)) return false; - fnToStr.call(value); - return true; - } catch (e) { - return false; - } - }; - var toStr = Object.prototype.toString; - var objectClass = '[object Object]'; - var fnClass = '[object Function]'; - var genClass = '[object GeneratorFunction]'; - var ddaClass = '[object HTMLAllCollection]'; // IE 11 - var ddaClass2 = '[object HTML document.all class]'; - var ddaClass3 = '[object HTMLCollection]'; // IE 9-10 - var hasToStringTag = 'function' == typeof Symbol && !!Symbol.toStringTag; // better: use `has-tostringtag` - var isIE68 = !(0 in [ - , - ]); // eslint-disable-line no-sparse-arrays, comma-spacing - var isDDA = function() { - return false; - }; - if ('object' == typeof document) { - // Firefox 3 canonicalizes DDA to undefined when it's not accessed directly - var all = document.all; - if (toStr.call(all) === toStr.call(document.all)) isDDA = function(value) { - /* globals document: false */ // in IE 6-8, typeof document.all is "object" and it's truthy - if ((isIE68 || !value) && (void 0 === value || 'object' == typeof value)) try { - var str = toStr.call(value); - return (str === ddaClass || str === ddaClass2 || str === ddaClass3 // opera 12.16 - || str === objectClass // IE 6-8 - ) && null == value(''); // eslint-disable-line eqeqeq - } catch (e) {} - return false; - }; - } - module.exports = reflectApply ? function(value) { - if (isDDA(value)) return true; - if (!value) return false; - if ('function' != typeof value && 'object' != typeof value) return false; - try { - reflectApply(value, null, badArrayLike); - } catch (e) { - if (e !== isCallableMarker) return false; - } - return !isES6ClassFn(value) && tryFunctionObject(value); - } : function(value) { - if (isDDA(value)) return true; - if (!value) return false; - if ('function' != typeof value && 'object' != typeof value) return false; - if (hasToStringTag) return tryFunctionObject(value); - if (isES6ClassFn(value)) return false; - var strClass = toStr.call(value); - if (strClass !== fnClass && strClass !== genClass && !/^\[object HTML/.test(strClass)) return false; - return tryFunctionObject(value); - }; - }, - "./node_modules/is-generator-function/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var toStr = Object.prototype.toString; - var fnToStr = Function.prototype.toString; - var isFnRegex = /^\s*(?:function)?\*/; - var hasToStringTag = __webpack_require__("./node_modules/has-tostringtag/shams.js")(); - var getProto = Object.getPrototypeOf; - var getGeneratorFunc = function() { - if (!hasToStringTag) return false; - try { - return Function('return function*() {}')(); - } catch (e) {} - }; - var GeneratorFunction; - module.exports = function(fn) { - if ('function' != typeof fn) return false; - if (isFnRegex.test(fnToStr.call(fn))) return true; - if (!hasToStringTag) { - var str = toStr.call(fn); - return '[object GeneratorFunction]' === str; - } - if (!getProto) return false; - if (void 0 === GeneratorFunction) { - var generatorFunc = getGeneratorFunc(); - GeneratorFunction = !!generatorFunc && getProto(generatorFunc); - } - return getProto(fn) === GeneratorFunction; - }; - }, - "./node_modules/is-power-of-two/index.js": function(module) { - module.exports = isPowerOfTwo; - function isPowerOfTwo(n) { - return 0 !== n && (n & n - 1) === 0; - } - }, - "./node_modules/is-typed-array/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var whichTypedArray = __webpack_require__("./node_modules/which-typed-array/index.js"); - /** @type {import('.')} */ module.exports = function(value) { - return !!whichTypedArray(value); - }; - }, - "./node_modules/isarray/index.js": function(module) { - var toString = {}.toString; - module.exports = Array.isArray || function(arr) { - return '[object Array]' == toString.call(arr); - }; - }, - "./node_modules/object-inspect/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - var hasMap = 'function' == typeof Map && Map.prototype; - var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null; - var mapSize = hasMap && mapSizeDescriptor && 'function' == typeof mapSizeDescriptor.get ? mapSizeDescriptor.get : null; - var mapForEach = hasMap && Map.prototype.forEach; - var hasSet = 'function' == typeof Set && Set.prototype; - var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null; - var setSize = hasSet && setSizeDescriptor && 'function' == typeof setSizeDescriptor.get ? setSizeDescriptor.get : null; - var setForEach = hasSet && Set.prototype.forEach; - var hasWeakMap = 'function' == typeof WeakMap && WeakMap.prototype; - var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null; - var hasWeakSet = 'function' == typeof WeakSet && WeakSet.prototype; - var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null; - var hasWeakRef = 'function' == typeof WeakRef && WeakRef.prototype; - var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null; - var booleanValueOf = Boolean.prototype.valueOf; - var objectToString = Object.prototype.toString; - var functionToString = Function.prototype.toString; - var $match = String.prototype.match; - var $slice = String.prototype.slice; - var $replace = String.prototype.replace; - var $toUpperCase = String.prototype.toUpperCase; - var $toLowerCase = String.prototype.toLowerCase; - var $test = RegExp.prototype.test; - var $concat = Array.prototype.concat; - var $join = Array.prototype.join; - var $arrSlice = Array.prototype.slice; - var $floor = Math.floor; - var bigIntValueOf = 'function' == typeof BigInt ? BigInt.prototype.valueOf : null; - var gOPS = Object.getOwnPropertySymbols; - var symToString = 'function' == typeof Symbol && 'symbol' == typeof Symbol.iterator ? Symbol.prototype.toString : null; - var hasShammedSymbols = 'function' == typeof Symbol && 'object' == typeof Symbol.iterator; - // ie, `has-tostringtag/shams - var toStringTag = 'function' == typeof Symbol && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol') ? Symbol.toStringTag : null; - var isEnumerable = Object.prototype.propertyIsEnumerable; - var gPO = ('function' == typeof Reflect ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype // eslint-disable-line no-proto - ? function(O) { - return O.__proto__; // eslint-disable-line no-proto - } : null); - function addNumericSeparator(num, str) { - if (num === 1 / 0 || num === -1 / 0 || num !== num || num && num > -1000 && num < 1000 || $test.call(/e/, str)) return str; - var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g; - if ('number' == typeof num) { - var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num) - if (int !== num) { - var intStr = String(int); - var dec = $slice.call(str, intStr.length + 1); - return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, ''); - } - } - return $replace.call(str, sepRegex, '$&_'); - } - var utilInspect = __webpack_require__("?64eb"); - var inspectCustom = utilInspect.custom; - var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null; - var quotes = { - __proto__: null, - double: '"', - single: "'" - }; - var quoteREs = { - __proto__: null, - double: /(["\\])/g, - single: /(['\\])/g - }; - module.exports = function inspect_(obj, options, depth, seen) { - var opts = options || {}; - if (has(opts, 'quoteStyle') && !has(quotes, opts.quoteStyle)) throw new TypeError('option "quoteStyle" must be "single" or "double"'); - if (has(opts, 'maxStringLength') && ('number' == typeof opts.maxStringLength ? opts.maxStringLength < 0 && opts.maxStringLength !== 1 / 0 : null !== opts.maxStringLength)) throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`'); - var customInspect = !has(opts, 'customInspect') || opts.customInspect; - if ('boolean' != typeof customInspect && 'symbol' !== customInspect) throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`'); - if (has(opts, 'indent') && null !== opts.indent && '\t' !== opts.indent && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)) throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`'); - if (has(opts, 'numericSeparator') && 'boolean' != typeof opts.numericSeparator) throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`'); - var numericSeparator = opts.numericSeparator; - if (void 0 === obj) return 'undefined'; - if (null === obj) return 'null'; - if ('boolean' == typeof obj) return obj ? 'true' : 'false'; - if ('string' == typeof obj) return inspectString(obj, opts); - if ('number' == typeof obj) { - if (0 === obj) return 1 / 0 / obj > 0 ? '0' : '-0'; - var str = String(obj); - return numericSeparator ? addNumericSeparator(obj, str) : str; - } - if ('bigint' == typeof obj) { - var bigIntStr = String(obj) + 'n'; - return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr; - } - var maxDepth = void 0 === opts.depth ? 5 : opts.depth; - if (void 0 === depth) depth = 0; - if (depth >= maxDepth && maxDepth > 0 && 'object' == typeof obj) return isArray(obj) ? '[Array]' : '[Object]'; - var indent = getIndent(opts, depth); - if (void 0 === seen) seen = []; - else if (indexOf(seen, obj) >= 0) return '[Circular]'; - function inspect(value, from, noIndent) { - if (from) { - seen = $arrSlice.call(seen); - seen.push(from); - } - if (noIndent) { - var newOpts = { - depth: opts.depth - }; - if (has(opts, 'quoteStyle')) newOpts.quoteStyle = opts.quoteStyle; - return inspect_(value, newOpts, depth + 1, seen); - } - return inspect_(value, opts, depth + 1, seen); - } - if ('function' == typeof obj && !isRegExp(obj)) { - var name = nameOf(obj); - var keys = arrObjKeys(obj, inspect); - return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : ''); - } - if (isSymbol(obj)) { - var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj); - return 'object' != typeof obj || hasShammedSymbols ? symString : markBoxed(symString); - } - if (isElement(obj)) { - var s = '<' + $toLowerCase.call(String(obj.nodeName)); - var attrs = obj.attributes || []; - for(var i = 0; i < attrs.length; i++)s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts); - s += '>'; - if (obj.childNodes && obj.childNodes.length) s += '...'; - s += ''; - return s; - } - if (isArray(obj)) { - if (0 === obj.length) return '[]'; - var xs = arrObjKeys(obj, inspect); - if (indent && !singleLineValues(xs)) return '[' + indentedJoin(xs, indent) + ']'; - return '[ ' + $join.call(xs, ', ') + ' ]'; - } - if (isError(obj)) { - var parts = arrObjKeys(obj, inspect); - if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }'; - if (0 === parts.length) return '[' + String(obj) + ']'; - return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }'; - } - if ('object' == typeof obj && customInspect) { - if (inspectSymbol && 'function' == typeof obj[inspectSymbol] && utilInspect) return utilInspect(obj, { - depth: maxDepth - depth - }); - if ('symbol' !== customInspect && 'function' == typeof obj.inspect) return obj.inspect(); - } - if (isMap(obj)) { - var mapParts = []; - if (mapForEach) mapForEach.call(obj, function(value, key) { - mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj)); - }); - return collectionOf('Map', mapSize.call(obj), mapParts, indent); - } - if (isSet(obj)) { - var setParts = []; - if (setForEach) setForEach.call(obj, function(value) { - setParts.push(inspect(value, obj)); - }); - return collectionOf('Set', setSize.call(obj), setParts, indent); - } - if (isWeakMap(obj)) return weakCollectionOf('WeakMap'); - if (isWeakSet(obj)) return weakCollectionOf('WeakSet'); - if (isWeakRef(obj)) return weakCollectionOf('WeakRef'); - if (isNumber(obj)) return markBoxed(inspect(Number(obj))); - if (isBigInt(obj)) return markBoxed(inspect(bigIntValueOf.call(obj))); - if (isBoolean(obj)) return markBoxed(booleanValueOf.call(obj)); - if (isString(obj)) return markBoxed(inspect(String(obj))); - // note: in IE 8, sometimes `global !== window` but both are the prototypes of each other - /* eslint-env browser */ if ('undefined' != typeof window && obj === window) return '{ [object Window] }'; - if ('undefined' != typeof globalThis && obj === globalThis || void 0 !== __webpack_require__.g && obj === __webpack_require__.g) return '{ [object globalThis] }'; - if (!isDate(obj) && !isRegExp(obj)) { - var ys = arrObjKeys(obj, inspect); - var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object; - var protoTag = obj instanceof Object ? '' : 'null prototype'; - var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : ''; - var constructorTag = isPlainObject || 'function' != typeof obj.constructor ? '' : obj.constructor.name ? obj.constructor.name + ' ' : ''; - var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : ''); - if (0 === ys.length) return tag + '{}'; - if (indent) return tag + '{' + indentedJoin(ys, indent) + '}'; - return tag + '{ ' + $join.call(ys, ', ') + ' }'; - } - return String(obj); - }; - function wrapQuotes(s, defaultStyle, opts) { - var style = opts.quoteStyle || defaultStyle; - var quoteChar = quotes[style]; - return quoteChar + s + quoteChar; - } - function quote(s) { - return $replace.call(String(s), /"/g, '"'); - } - function isArray(obj) { - return '[object Array]' === toStr(obj) && (!toStringTag || !('object' == typeof obj && toStringTag in obj)); - } - function isDate(obj) { - return '[object Date]' === toStr(obj) && (!toStringTag || !('object' == typeof obj && toStringTag in obj)); - } - function isRegExp(obj) { - return '[object RegExp]' === toStr(obj) && (!toStringTag || !('object' == typeof obj && toStringTag in obj)); - } - function isError(obj) { - return '[object Error]' === toStr(obj) && (!toStringTag || !('object' == typeof obj && toStringTag in obj)); - } - function isString(obj) { - return '[object String]' === toStr(obj) && (!toStringTag || !('object' == typeof obj && toStringTag in obj)); - } - function isNumber(obj) { - return '[object Number]' === toStr(obj) && (!toStringTag || !('object' == typeof obj && toStringTag in obj)); - } - function isBoolean(obj) { - return '[object Boolean]' === toStr(obj) && (!toStringTag || !('object' == typeof obj && toStringTag in obj)); - } - // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives - function isSymbol(obj) { - if (hasShammedSymbols) return obj && 'object' == typeof obj && obj instanceof Symbol; - if ('symbol' == typeof obj) return true; - if (!obj || 'object' != typeof obj || !symToString) return false; - try { - symToString.call(obj); - return true; - } catch (e) {} - return false; - } - function isBigInt(obj) { - if (!obj || 'object' != typeof obj || !bigIntValueOf) return false; - try { - bigIntValueOf.call(obj); - return true; - } catch (e) {} - return false; - } - var hasOwn = Object.prototype.hasOwnProperty || function(key) { - return key in this; - }; - function has(obj, key) { - return hasOwn.call(obj, key); - } - function toStr(obj) { - return objectToString.call(obj); - } - function nameOf(f) { - if (f.name) return f.name; - var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/); - if (m) return m[1]; - return null; - } - function indexOf(xs, x) { - if (xs.indexOf) return xs.indexOf(x); - for(var i = 0, l = xs.length; i < l; i++)if (xs[i] === x) return i; - return -1; - } - function isMap(x) { - if (!mapSize || !x || 'object' != typeof x) return false; - try { - mapSize.call(x); - try { - setSize.call(x); - } catch (s) { - return true; - } - return x instanceof Map; // core-js workaround, pre-v2.5.0 - } catch (e) {} - return false; - } - function isWeakMap(x) { - if (!weakMapHas || !x || 'object' != typeof x) return false; - try { - weakMapHas.call(x, weakMapHas); - try { - weakSetHas.call(x, weakSetHas); - } catch (s) { - return true; - } - return x instanceof WeakMap; // core-js workaround, pre-v2.5.0 - } catch (e) {} - return false; - } - function isWeakRef(x) { - if (!weakRefDeref || !x || 'object' != typeof x) return false; - try { - weakRefDeref.call(x); - return true; - } catch (e) {} - return false; - } - function isSet(x) { - if (!setSize || !x || 'object' != typeof x) return false; - try { - setSize.call(x); - try { - mapSize.call(x); - } catch (m) { - return true; - } - return x instanceof Set; // core-js workaround, pre-v2.5.0 - } catch (e) {} - return false; - } - function isWeakSet(x) { - if (!weakSetHas || !x || 'object' != typeof x) return false; - try { - weakSetHas.call(x, weakSetHas); - try { - weakMapHas.call(x, weakMapHas); - } catch (s) { - return true; - } - return x instanceof WeakSet; // core-js workaround, pre-v2.5.0 - } catch (e) {} - return false; - } - function isElement(x) { - if (!x || 'object' != typeof x) return false; - if ('undefined' != typeof HTMLElement && x instanceof HTMLElement) return true; - return 'string' == typeof x.nodeName && 'function' == typeof x.getAttribute; - } - function inspectString(str, opts) { - if (str.length > opts.maxStringLength) { - var remaining = str.length - opts.maxStringLength; - var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : ''); - return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer; - } - var quoteRE = quoteREs[opts.quoteStyle || 'single']; - quoteRE.lastIndex = 0; - // eslint-disable-next-line no-control-regex - var s = $replace.call($replace.call(str, quoteRE, '\\$1'), /[\x00-\x1f]/g, lowbyte); - return wrapQuotes(s, 'single', opts); - } - function lowbyte(c) { - var n = c.charCodeAt(0); - var x = { - 8: 'b', - 9: 't', - 10: 'n', - 12: 'f', - 13: 'r' - }[n]; - if (x) return '\\' + x; - return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16)); - } - function markBoxed(str) { - return 'Object(' + str + ')'; - } - function weakCollectionOf(type) { - return type + ' { ? }'; - } - function collectionOf(type, size, entries, indent) { - var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', '); - return type + ' (' + size + ') {' + joinedEntries + '}'; - } - function singleLineValues(xs) { - for(var i = 0; i < xs.length; i++)if (indexOf(xs[i], '\n') >= 0) return false; - return true; - } - function getIndent(opts, depth) { - var baseIndent; - if ('\t' === opts.indent) baseIndent = '\t'; - else { - if ('number' != typeof opts.indent || !(opts.indent > 0)) return null; - baseIndent = $join.call(Array(opts.indent + 1), ' '); - } - return { - base: baseIndent, - prev: $join.call(Array(depth + 1), baseIndent) - }; - } - function indentedJoin(xs, indent) { - if (0 === xs.length) return ''; - var lineJoiner = '\n' + indent.prev + indent.base; - return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev; - } - function arrObjKeys(obj, inspect) { - var isArr = isArray(obj); - var xs = []; - if (isArr) { - xs.length = obj.length; - for(var i = 0; i < obj.length; i++)xs[i] = has(obj, i) ? inspect(obj[i], obj) : ''; - } - var syms = 'function' == typeof gOPS ? gOPS(obj) : []; - var symMap; - if (hasShammedSymbols) { - symMap = {}; - for(var k = 0; k < syms.length; k++)symMap['$' + syms[k]] = syms[k]; - } - for(var key in obj){ - if (!has(obj, key)) continue; - // eslint-disable-line no-restricted-syntax, no-continue - if (isArr && String(Number(key)) === key && key < obj.length) continue; - // eslint-disable-line no-restricted-syntax, no-continue - if (!(hasShammedSymbols && symMap['$' + key] instanceof Symbol)) if ($test.call(/[^\w$]/, key)) xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj)); - else xs.push(key + ': ' + inspect(obj[key], obj)); - } - if ('function' == typeof gOPS) { - for(var j = 0; j < syms.length; j++)if (isEnumerable.call(obj, syms[j])) xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj)); - } - return xs; - } - }, - "./node_modules/once/once.js": function(module, __unused_webpack_exports, __webpack_require__) { - var wrappy = __webpack_require__("./node_modules/wrappy/wrappy.js"); - module.exports = wrappy(once); - module.exports.strict = wrappy(onceStrict); - once.proto = once(function() { - Object.defineProperty(Function.prototype, 'once', { - value: function() { - return once(this); - }, - configurable: true - }); - Object.defineProperty(Function.prototype, 'onceStrict', { - value: function() { - return onceStrict(this); - }, - configurable: true - }); - }); - function once(fn) { - var f = function() { - if (f.called) return f.value; - f.called = true; - return f.value = fn.apply(this, arguments); - }; - f.called = false; - return f; - } - function onceStrict(fn) { - var f = function() { - if (f.called) throw new Error(f.onceError); - f.called = true; - return f.value = fn.apply(this, arguments); - }; - var name = fn.name || 'Function wrapped with `once`'; - f.onceError = name + " shouldn't be called more than once"; - f.called = false; - return f; - } - }, - "./node_modules/performance-now/lib/performance-now.js": function(module, __unused_webpack_exports, __webpack_require__) { - /* provided dependency */ var process = __webpack_require__("./node_modules/process/browser.js"); - // Generated by CoffeeScript 1.12.2 - (function() { - var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime; - if ("undefined" != typeof performance && null !== performance && performance.now) module.exports = function() { - return performance.now(); - }; - else if (null != process && process.hrtime) { - module.exports = function() { - return (getNanoSeconds() - nodeLoadTime) / 1e6; - }; - hrtime = process.hrtime; - getNanoSeconds = function() { - var hr; - hr = hrtime(); - return 1e9 * hr[0] + hr[1]; - }; - moduleLoadTime = getNanoSeconds(); - upTime = 1e9 * process.uptime(); - nodeLoadTime = moduleLoadTime - upTime; - } else if (Date.now) { - module.exports = function() { - return Date.now() - loadTime; - }; - loadTime = Date.now(); - } else { - module.exports = function() { - return new Date().getTime() - loadTime; - }; - loadTime = new Date().getTime(); - } - }).call(this); - //# sourceMappingURL=performance-now.js.map - }, - "./node_modules/possible-typed-array-names/index.js": function(module) { - "use strict"; - /** @type {import('.')} */ module.exports = [ - 'Float32Array', - 'Float64Array', - 'Int8Array', - 'Int16Array', - 'Int32Array', - 'Uint8Array', - 'Uint8ClampedArray', - 'Uint16Array', - 'Uint32Array', - 'BigInt64Array', - 'BigUint64Array' - ]; - }, - "./node_modules/process-nextick-args/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - /* provided dependency */ var process = __webpack_require__("./node_modules/process/browser.js"); - if (void 0 !== process && process.version && 0 !== process.version.indexOf('v0.') && (0 !== process.version.indexOf('v1.') || 0 === process.version.indexOf('v1.8.'))) module.exports = process; - else module.exports = { - nextTick: nextTick - }; - function nextTick(fn, arg1, arg2, arg3) { - if ('function' != typeof fn) throw new TypeError('"callback" argument must be a function'); - var len = arguments.length; - var args, i; - switch(len){ - case 0: - case 1: - return process.nextTick(fn); - case 2: - return process.nextTick(function() { - fn.call(null, arg1); - }); - case 3: - return process.nextTick(function() { - fn.call(null, arg1, arg2); - }); - case 4: - return process.nextTick(function() { - fn.call(null, arg1, arg2, arg3); - }); - default: - args = new Array(len - 1); - i = 0; - while(i < args.length)args[i++] = arguments[i]; - return process.nextTick(function() { - fn.apply(null, args); - }); - } - } - }, - "./node_modules/process/browser.js": function(module) { - // shim for using process in browser - var process = module.exports = {}; - // cached from whatever global is present so that test runners that stub it - // don't break things. But we need to wrap it in a try catch in case it is - // wrapped in strict mode code which doesn't define any globals. It's inside a - // function because try/catches deoptimize in certain engines. - var cachedSetTimeout; - var cachedClearTimeout; - function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); - } - function defaultClearTimeout() { - throw new Error('clearTimeout has not been defined'); - } - (function() { - try { - cachedSetTimeout = 'function' == typeof setTimeout ? setTimeout : defaultSetTimout; - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - cachedClearTimeout = 'function' == typeof clearTimeout ? clearTimeout : defaultClearTimeout; - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } - })(); - function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) //normal enviroments in sane situations - return setTimeout(fun, 0); - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch (e) { - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - } - function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) //normal enviroments in sane situations - return clearTimeout(marker); - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e) { - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - } - var queue = []; - var draining = false; - var currentQueue; - var queueIndex = -1; - function cleanUpNextTick() { - if (!draining || !currentQueue) return; - draining = false; - if (currentQueue.length) queue = currentQueue.concat(queue); - else queueIndex = -1; - if (queue.length) drainQueue(); - } - function drainQueue() { - if (draining) return; - var timeout = runTimeout(cleanUpNextTick); - draining = true; - var len = queue.length; - while(len){ - currentQueue = queue; - queue = []; - while(++queueIndex < len)if (currentQueue) currentQueue[queueIndex].run(); - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); - } - process.nextTick = function(fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) for(var i = 1; i < arguments.length; i++)args[i - 1] = arguments[i]; - queue.push(new Item(fun, args)); - if (1 === queue.length && !draining) runTimeout(drainQueue); - }; - // v8 likes predictible objects - function Item(fun, array) { - this.fun = fun; - this.array = array; - } - Item.prototype.run = function() { - this.fun.apply(null, this.array); - }; - process.title = 'browser'; - process.browser = true; - process.env = {}; - process.argv = []; - process.version = ''; // empty string to avoid regexp issues - process.versions = {}; - function noop() {} - process.on = noop; - process.addListener = noop; - process.once = noop; - process.off = noop; - process.removeListener = noop; - process.removeAllListeners = noop; - process.emit = noop; - process.prependListener = noop; - process.prependOnceListener = noop; - process.listeners = function(name) { - return []; - }; - process.binding = function(name) { - throw new Error('process.binding is not supported'); - }; - process.cwd = function() { - return '/'; - }; - process.chdir = function(dir) { - throw new Error('process.chdir is not supported'); - }; - process.umask = function() { - return 0; - }; - }, - "./node_modules/qs/lib/formats.js": function(module) { - "use strict"; - var replace = String.prototype.replace; - var percentTwenties = /%20/g; - var Format = { - RFC1738: 'RFC1738', - RFC3986: 'RFC3986' - }; - module.exports = { - default: Format.RFC3986, - formatters: { - RFC1738: function(value) { - return replace.call(value, percentTwenties, '+'); - }, - RFC3986: function(value) { - return String(value); - } - }, - RFC1738: Format.RFC1738, - RFC3986: Format.RFC3986 - }; - }, - "./node_modules/qs/lib/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var stringify = __webpack_require__("./node_modules/qs/lib/stringify.js"); - var parse = __webpack_require__("./node_modules/qs/lib/parse.js"); - var formats = __webpack_require__("./node_modules/qs/lib/formats.js"); - module.exports = { - formats: formats, - parse: parse, - stringify: stringify - }; - }, - "./node_modules/qs/lib/parse.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var utils = __webpack_require__("./node_modules/qs/lib/utils.js"); - var has = Object.prototype.hasOwnProperty; - var isArray = Array.isArray; - var defaults = { - allowDots: false, - allowEmptyArrays: false, - allowPrototypes: false, - allowSparse: false, - arrayLimit: 20, - charset: 'utf-8', - charsetSentinel: false, - comma: false, - decodeDotInKeys: false, - decoder: utils.decode, - delimiter: '&', - depth: 5, - duplicates: 'combine', - ignoreQueryPrefix: false, - interpretNumericEntities: false, - parameterLimit: 1000, - parseArrays: true, - plainObjects: false, - strictDepth: false, - strictNullHandling: false - }; - var interpretNumericEntities = function(str) { - return str.replace(/&#(\d+);/g, function($0, numberStr) { - return String.fromCharCode(parseInt(numberStr, 10)); - }); - }; - var parseArrayValue = function(val, options) { - if (val && 'string' == typeof val && options.comma && val.indexOf(',') > -1) return val.split(','); - return val; - }; - // This is what browsers will submit when the ✓ character occurs in an - // application/x-www-form-urlencoded body and the encoding of the page containing - // the form is iso-8859-1, or when the submitted form has an accept-charset - // attribute of iso-8859-1. Presumably also with other charsets that do not contain - // the ✓ character, such as us-ascii. - var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('✓') - // These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded. - var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓') - var parseValues = function(str, options) { - var obj = { - __proto__: null - }; - var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str; - cleanStr = cleanStr.replace(/%5B/gi, '[').replace(/%5D/gi, ']'); - var limit = options.parameterLimit === 1 / 0 ? void 0 : options.parameterLimit; - var parts = cleanStr.split(options.delimiter, limit); - var skipIndex = -1; // Keep track of where the utf8 sentinel was found - var i; - var charset = options.charset; - if (options.charsetSentinel) { - for(i = 0; i < parts.length; ++i)if (0 === parts[i].indexOf('utf8=')) { - if (parts[i] === charsetSentinel) charset = 'utf-8'; - else if (parts[i] === isoSentinel) charset = 'iso-8859-1'; - skipIndex = i; - i = parts.length; // The eslint settings do not allow break; - } - } - for(i = 0; i < parts.length; ++i){ - if (i !== skipIndex) { - var part = parts[i]; - var bracketEqualsPos = part.indexOf(']='); - var pos = -1 === bracketEqualsPos ? part.indexOf('=') : bracketEqualsPos + 1; - var key, val; - if (-1 === pos) { - key = options.decoder(part, defaults.decoder, charset, 'key'); - val = options.strictNullHandling ? null : ''; - } else { - key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key'); - val = utils.maybeMap(parseArrayValue(part.slice(pos + 1), options), function(encodedVal) { - return options.decoder(encodedVal, defaults.decoder, charset, 'value'); - }); - } - if (val && options.interpretNumericEntities && 'iso-8859-1' === charset) val = interpretNumericEntities(val); - if (part.indexOf('[]=') > -1) val = isArray(val) ? [ - val - ] : val; - var existing = has.call(obj, key); - if (existing && 'combine' === options.duplicates) obj[key] = utils.combine(obj[key], val); - else if (!existing || 'last' === options.duplicates) obj[key] = val; - } - } - return obj; - }; - var parseObject = function(chain, val, options, valuesParsed) { - var leaf = valuesParsed ? val : parseArrayValue(val, options); - for(var i = chain.length - 1; i >= 0; --i){ - var obj; - var root = chain[i]; - if ('[]' === root && options.parseArrays) obj = options.allowEmptyArrays && ('' === leaf || options.strictNullHandling && null === leaf) ? [] : [].concat(leaf); - else { - obj = options.plainObjects ? Object.create(null) : {}; - var cleanRoot = '[' === root.charAt(0) && ']' === root.charAt(root.length - 1) ? root.slice(1, -1) : root; - var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, '.') : cleanRoot; - var index = parseInt(decodedRoot, 10); - if (options.parseArrays || '' !== decodedRoot) { - if (!isNaN(index) && root !== decodedRoot && String(index) === decodedRoot && index >= 0 && options.parseArrays && index <= options.arrayLimit) { - obj = []; - obj[index] = leaf; - } else if ('__proto__' !== decodedRoot) obj[decodedRoot] = leaf; - } else obj = { - 0: leaf - }; - } - leaf = obj; - } - return leaf; - }; - var parseKeys = function(givenKey, val, options, valuesParsed) { - if (!givenKey) return; - // Transform dot notation to bracket notation - var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey; - // The regex chunks - var brackets = /(\[[^[\]]*])/; - var child = /(\[[^[\]]*])/g; - // Get the parent - var segment = options.depth > 0 && brackets.exec(key); - var parent = segment ? key.slice(0, segment.index) : key; - // Stash the parent if it exists - var keys = []; - if (parent) { - // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties - if (!options.plainObjects && has.call(Object.prototype, parent)) { - if (!options.allowPrototypes) return; - } - keys.push(parent); - } - // Loop through children appending to the array until we hit depth - var i = 0; - while(options.depth > 0 && null !== (segment = child.exec(key)) && i < options.depth){ - i += 1; - if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) { - if (!options.allowPrototypes) return; - } - keys.push(segment[1]); - } - // If there's a remainder, check strictDepth option for throw, else just add whatever is left - if (segment) { - if (true === options.strictDepth) throw new RangeError('Input depth exceeded depth option of ' + options.depth + ' and strictDepth is true'); - keys.push('[' + key.slice(segment.index) + ']'); - } - return parseObject(keys, val, options, valuesParsed); - }; - var normalizeParseOptions = function(opts) { - if (!opts) return defaults; - if (void 0 !== opts.allowEmptyArrays && 'boolean' != typeof opts.allowEmptyArrays) throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided'); - if (void 0 !== opts.decodeDotInKeys && 'boolean' != typeof opts.decodeDotInKeys) throw new TypeError('`decodeDotInKeys` option can only be `true` or `false`, when provided'); - if (null !== opts.decoder && void 0 !== opts.decoder && 'function' != typeof opts.decoder) throw new TypeError('Decoder has to be a function.'); - if (void 0 !== opts.charset && 'utf-8' !== opts.charset && 'iso-8859-1' !== opts.charset) throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined'); - var charset = void 0 === opts.charset ? defaults.charset : opts.charset; - var duplicates = void 0 === opts.duplicates ? defaults.duplicates : opts.duplicates; - if ('combine' !== duplicates && 'first' !== duplicates && 'last' !== duplicates) throw new TypeError('The duplicates option must be either combine, first, or last'); - var allowDots = void 0 === opts.allowDots ? true === opts.decodeDotInKeys || defaults.allowDots : !!opts.allowDots; - return { - allowDots: allowDots, - allowEmptyArrays: 'boolean' == typeof opts.allowEmptyArrays ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays, - allowPrototypes: 'boolean' == typeof opts.allowPrototypes ? opts.allowPrototypes : defaults.allowPrototypes, - allowSparse: 'boolean' == typeof opts.allowSparse ? opts.allowSparse : defaults.allowSparse, - arrayLimit: 'number' == typeof opts.arrayLimit ? opts.arrayLimit : defaults.arrayLimit, - charset: charset, - charsetSentinel: 'boolean' == typeof opts.charsetSentinel ? opts.charsetSentinel : defaults.charsetSentinel, - comma: 'boolean' == typeof opts.comma ? opts.comma : defaults.comma, - decodeDotInKeys: 'boolean' == typeof opts.decodeDotInKeys ? opts.decodeDotInKeys : defaults.decodeDotInKeys, - decoder: 'function' == typeof opts.decoder ? opts.decoder : defaults.decoder, - delimiter: 'string' == typeof opts.delimiter || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter, - // eslint-disable-next-line no-implicit-coercion, no-extra-parens - depth: 'number' == typeof opts.depth || false === opts.depth ? +opts.depth : defaults.depth, - duplicates: duplicates, - ignoreQueryPrefix: true === opts.ignoreQueryPrefix, - interpretNumericEntities: 'boolean' == typeof opts.interpretNumericEntities ? opts.interpretNumericEntities : defaults.interpretNumericEntities, - parameterLimit: 'number' == typeof opts.parameterLimit ? opts.parameterLimit : defaults.parameterLimit, - parseArrays: false !== opts.parseArrays, - plainObjects: 'boolean' == typeof opts.plainObjects ? opts.plainObjects : defaults.plainObjects, - strictDepth: 'boolean' == typeof opts.strictDepth ? !!opts.strictDepth : defaults.strictDepth, - strictNullHandling: 'boolean' == typeof opts.strictNullHandling ? opts.strictNullHandling : defaults.strictNullHandling - }; - }; - module.exports = function(str, opts) { - var options = normalizeParseOptions(opts); - if ('' === str || null == str) return options.plainObjects ? Object.create(null) : {}; - var tempObj = 'string' == typeof str ? parseValues(str, options) : str; - var obj = options.plainObjects ? Object.create(null) : {}; - // Iterate over the keys and setup the new object - var keys = Object.keys(tempObj); - for(var i = 0; i < keys.length; ++i){ - var key = keys[i]; - var newObj = parseKeys(key, tempObj[key], options, 'string' == typeof str); - obj = utils.merge(obj, newObj, options); - } - if (true === options.allowSparse) return obj; - return utils.compact(obj); - }; - }, - "./node_modules/qs/lib/stringify.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var getSideChannel = __webpack_require__("./node_modules/side-channel/index.js"); - var utils = __webpack_require__("./node_modules/qs/lib/utils.js"); - var formats = __webpack_require__("./node_modules/qs/lib/formats.js"); - var has = Object.prototype.hasOwnProperty; - var arrayPrefixGenerators = { - brackets: function(prefix) { - return prefix + '[]'; - }, - comma: 'comma', - indices: function(prefix, key) { - return prefix + '[' + key + ']'; - }, - repeat: function(prefix) { - return prefix; - } - }; - var isArray = Array.isArray; - var push = Array.prototype.push; - var pushToArray = function(arr, valueOrArray) { - push.apply(arr, isArray(valueOrArray) ? valueOrArray : [ - valueOrArray - ]); - }; - var toISO = Date.prototype.toISOString; - var defaultFormat = formats['default']; - var defaults = { - addQueryPrefix: false, - allowDots: false, - allowEmptyArrays: false, - arrayFormat: 'indices', - charset: 'utf-8', - charsetSentinel: false, - delimiter: '&', - encode: true, - encodeDotInKeys: false, - encoder: utils.encode, - encodeValuesOnly: false, - format: defaultFormat, - formatter: formats.formatters[defaultFormat], - // deprecated - indices: false, - serializeDate: function(date) { - return toISO.call(date); - }, - skipNulls: false, - strictNullHandling: false - }; - var isNonNullishPrimitive = function(v) { - return 'string' == typeof v || 'number' == typeof v || 'boolean' == typeof v || 'symbol' == typeof v || 'bigint' == typeof v; - }; - var sentinel = {}; - var stringify = function stringify(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) { - var obj = object; - var tmpSc = sideChannel; - var step = 0; - var findFlag = false; - while(void 0 !== (tmpSc = tmpSc.get(sentinel)) && !findFlag){ - // Where object last appeared in the ref tree - var pos = tmpSc.get(object); - step += 1; - if (void 0 !== pos) { - if (pos === step) throw new RangeError('Cyclic object value'); - findFlag = true; // Break while - } - if (void 0 === tmpSc.get(sentinel)) step = 0; - } - if ('function' == typeof filter) obj = filter(prefix, obj); - else if (obj instanceof Date) obj = serializeDate(obj); - else if ('comma' === generateArrayPrefix && isArray(obj)) obj = utils.maybeMap(obj, function(value) { - if (value instanceof Date) return serializeDate(value); - return value; - }); - if (null === obj) { - if (strictNullHandling) return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix; - obj = ''; - } - if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) { - if (encoder) { - var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format); - return [ - formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format)) - ]; - } - return [ - formatter(prefix) + '=' + formatter(String(obj)) - ]; - } - var values = []; - if (void 0 === obj) return values; - var objKeys; - if ('comma' === generateArrayPrefix && isArray(obj)) { - // we need to join elements in - if (encodeValuesOnly && encoder) obj = utils.maybeMap(obj, encoder); - objKeys = [ - { - value: obj.length > 0 ? obj.join(',') || null : void 0 - } - ]; - } else if (isArray(filter)) objKeys = filter; - else { - var keys = Object.keys(obj); - objKeys = sort ? keys.sort(sort) : keys; - } - var encodedPrefix = encodeDotInKeys ? prefix.replace(/\./g, '%2E') : prefix; - var adjustedPrefix = commaRoundTrip && isArray(obj) && 1 === obj.length ? encodedPrefix + '[]' : encodedPrefix; - if (allowEmptyArrays && isArray(obj) && 0 === obj.length) return adjustedPrefix + '[]'; - for(var j = 0; j < objKeys.length; ++j){ - var key = objKeys[j]; - var value = 'object' == typeof key && void 0 !== key.value ? key.value : obj[key]; - if (!skipNulls || null !== value) { - var encodedKey = allowDots && encodeDotInKeys ? key.replace(/\./g, '%2E') : key; - var keyPrefix = isArray(obj) ? 'function' == typeof generateArrayPrefix ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix : adjustedPrefix + (allowDots ? '.' + encodedKey : '[' + encodedKey + ']'); - sideChannel.set(object, step); - var valueSideChannel = getSideChannel(); - valueSideChannel.set(sentinel, sideChannel); - pushToArray(values, stringify(value, keyPrefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, 'comma' === generateArrayPrefix && encodeValuesOnly && isArray(obj) ? null : encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, valueSideChannel)); - } - } - return values; - }; - var normalizeStringifyOptions = function(opts) { - if (!opts) return defaults; - if (void 0 !== opts.allowEmptyArrays && 'boolean' != typeof opts.allowEmptyArrays) throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided'); - if (void 0 !== opts.encodeDotInKeys && 'boolean' != typeof opts.encodeDotInKeys) throw new TypeError('`encodeDotInKeys` option can only be `true` or `false`, when provided'); - if (null !== opts.encoder && void 0 !== opts.encoder && 'function' != typeof opts.encoder) throw new TypeError('Encoder has to be a function.'); - var charset = opts.charset || defaults.charset; - if (void 0 !== opts.charset && 'utf-8' !== opts.charset && 'iso-8859-1' !== opts.charset) throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined'); - var format = formats['default']; - if (void 0 !== opts.format) { - if (!has.call(formats.formatters, opts.format)) throw new TypeError('Unknown format option provided.'); - format = opts.format; - } - var formatter = formats.formatters[format]; - var filter = defaults.filter; - if ('function' == typeof opts.filter || isArray(opts.filter)) filter = opts.filter; - var arrayFormat; - arrayFormat = opts.arrayFormat in arrayPrefixGenerators ? opts.arrayFormat : 'indices' in opts ? opts.indices ? 'indices' : 'repeat' : defaults.arrayFormat; - if ('commaRoundTrip' in opts && 'boolean' != typeof opts.commaRoundTrip) throw new TypeError('`commaRoundTrip` must be a boolean, or absent'); - var allowDots = void 0 === opts.allowDots ? true === opts.encodeDotInKeys || defaults.allowDots : !!opts.allowDots; - return { - addQueryPrefix: 'boolean' == typeof opts.addQueryPrefix ? opts.addQueryPrefix : defaults.addQueryPrefix, - allowDots: allowDots, - allowEmptyArrays: 'boolean' == typeof opts.allowEmptyArrays ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays, - arrayFormat: arrayFormat, - charset: charset, - charsetSentinel: 'boolean' == typeof opts.charsetSentinel ? opts.charsetSentinel : defaults.charsetSentinel, - commaRoundTrip: opts.commaRoundTrip, - delimiter: void 0 === opts.delimiter ? defaults.delimiter : opts.delimiter, - encode: 'boolean' == typeof opts.encode ? opts.encode : defaults.encode, - encodeDotInKeys: 'boolean' == typeof opts.encodeDotInKeys ? opts.encodeDotInKeys : defaults.encodeDotInKeys, - encoder: 'function' == typeof opts.encoder ? opts.encoder : defaults.encoder, - encodeValuesOnly: 'boolean' == typeof opts.encodeValuesOnly ? opts.encodeValuesOnly : defaults.encodeValuesOnly, - filter: filter, - format: format, - formatter: formatter, - serializeDate: 'function' == typeof opts.serializeDate ? opts.serializeDate : defaults.serializeDate, - skipNulls: 'boolean' == typeof opts.skipNulls ? opts.skipNulls : defaults.skipNulls, - sort: 'function' == typeof opts.sort ? opts.sort : null, - strictNullHandling: 'boolean' == typeof opts.strictNullHandling ? opts.strictNullHandling : defaults.strictNullHandling - }; - }; - module.exports = function(object, opts) { - var obj = object; - var options = normalizeStringifyOptions(opts); - var objKeys; - var filter; - if ('function' == typeof options.filter) { - filter = options.filter; - obj = filter('', obj); - } else if (isArray(options.filter)) { - filter = options.filter; - objKeys = filter; - } - var keys = []; - if ('object' != typeof obj || null === obj) return ''; - var generateArrayPrefix = arrayPrefixGenerators[options.arrayFormat]; - var commaRoundTrip = 'comma' === generateArrayPrefix && options.commaRoundTrip; - if (!objKeys) objKeys = Object.keys(obj); - if (options.sort) objKeys.sort(options.sort); - var sideChannel = getSideChannel(); - for(var i = 0; i < objKeys.length; ++i){ - var key = objKeys[i]; - if (!options.skipNulls || null !== obj[key]) pushToArray(keys, stringify(obj[key], key, generateArrayPrefix, commaRoundTrip, options.allowEmptyArrays, options.strictNullHandling, options.skipNulls, options.encodeDotInKeys, options.encode ? options.encoder : null, options.filter, options.sort, options.allowDots, options.serializeDate, options.format, options.formatter, options.encodeValuesOnly, options.charset, sideChannel)); - } - var joined = keys.join(options.delimiter); - var prefix = true === options.addQueryPrefix ? '?' : ''; - if (options.charsetSentinel) { - if ('iso-8859-1' === options.charset) // encodeURIComponent('✓'), the "numeric entity" representation of a checkmark - prefix += 'utf8=%26%2310003%3B&'; - else // encodeURIComponent('✓') - prefix += 'utf8=%E2%9C%93&'; - } - return joined.length > 0 ? prefix + joined : ''; - }; - }, - "./node_modules/qs/lib/utils.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var formats = __webpack_require__("./node_modules/qs/lib/formats.js"); - var has = Object.prototype.hasOwnProperty; - var isArray = Array.isArray; - var hexTable = function() { - var array = []; - for(var i = 0; i < 256; ++i)array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); - return array; - }(); - var compactQueue = function(queue) { - while(queue.length > 1){ - var item = queue.pop(); - var obj = item.obj[item.prop]; - if (isArray(obj)) { - var compacted = []; - for(var j = 0; j < obj.length; ++j)if (void 0 !== obj[j]) compacted.push(obj[j]); - item.obj[item.prop] = compacted; - } - } - }; - var arrayToObject = function(source, options) { - var obj = options && options.plainObjects ? Object.create(null) : {}; - for(var i = 0; i < source.length; ++i)if (void 0 !== source[i]) obj[i] = source[i]; - return obj; - }; - var merge = function merge(target, source, options) { - /* eslint no-param-reassign: 0 */ if (!source) return target; - if ('object' != typeof source) { - if (isArray(target)) target.push(source); - else if (!target || 'object' != typeof target) return [ - target, - source - ]; - else if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) target[source] = true; - return target; - } - if (!target || 'object' != typeof target) return [ - target - ].concat(source); - var mergeTarget = target; - if (isArray(target) && !isArray(source)) mergeTarget = arrayToObject(target, options); - if (isArray(target) && isArray(source)) { - source.forEach(function(item, i) { - if (has.call(target, i)) { - var targetItem = target[i]; - if (targetItem && 'object' == typeof targetItem && item && 'object' == typeof item) target[i] = merge(targetItem, item, options); - else target.push(item); - } else target[i] = item; - }); - return target; - } - return Object.keys(source).reduce(function(acc, key) { - var value = source[key]; - if (has.call(acc, key)) acc[key] = merge(acc[key], value, options); - else acc[key] = value; - return acc; - }, mergeTarget); - }; - var assign = function(target, source) { - return Object.keys(source).reduce(function(acc, key) { - acc[key] = source[key]; - return acc; - }, target); - }; - var decode = function(str, decoder, charset) { - var strWithoutPlus = str.replace(/\+/g, ' '); - if ('iso-8859-1' === charset) // unescape never throws, no try...catch needed: - return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape); - // utf-8 - try { - return decodeURIComponent(strWithoutPlus); - } catch (e) { - return strWithoutPlus; - } - }; - var limit = 1024; - /* eslint operator-linebreak: [2, "before"] */ var encode = function(str, defaultEncoder, charset, kind, format) { - // This code was originally written by Brian White (mscdex) for the io.js core querystring library. - // It has been adapted here for stricter adherence to RFC 3986 - if (0 === str.length) return str; - var string = str; - if ('symbol' == typeof str) string = Symbol.prototype.toString.call(str); - else if ('string' != typeof str) string = String(str); - if ('iso-8859-1' === charset) return escape(string).replace(/%u[0-9a-f]{4}/gi, function($0) { - return '%26%23' + parseInt($0.slice(2), 16) + '%3B'; - }); - var out = ''; - for(var j = 0; j < string.length; j += limit){ - var segment = string.length >= limit ? string.slice(j, j + limit) : string; - var arr = []; - for(var i = 0; i < segment.length; ++i){ - var c = segment.charCodeAt(i); - if (0x2D // - - === c || 0x2E // . - === c || 0x5F // _ - === c || 0x7E // ~ - === c || c >= 0x30 && c <= 0x39 // 0-9 - || c >= 0x41 && c <= 0x5A // a-z - || c >= 0x61 && c <= 0x7A // A-Z - || format === formats.RFC1738 && (0x28 === c || 0x29 === c) // ( ) - ) { - arr[arr.length] = segment.charAt(i); - continue; - } - if (c < 0x80) { - arr[arr.length] = hexTable[c]; - continue; - } - if (c < 0x800) { - arr[arr.length] = hexTable[0xC0 | c >> 6] + hexTable[0x80 | 0x3F & c]; - continue; - } - if (c < 0xD800 || c >= 0xE000) { - arr[arr.length] = hexTable[0xE0 | c >> 12] + hexTable[0x80 | c >> 6 & 0x3F] + hexTable[0x80 | 0x3F & c]; - continue; - } - i += 1; - c = 0x10000 + ((0x3FF & c) << 10 | 0x3FF & segment.charCodeAt(i)); - arr[arr.length] = hexTable[0xF0 | c >> 18] + hexTable[0x80 | c >> 12 & 0x3F] + hexTable[0x80 | c >> 6 & 0x3F] + hexTable[0x80 | 0x3F & c]; - } - out += arr.join(''); - } - return out; - }; - var compact = function(value) { - var queue = [ - { - obj: { - o: value - }, - prop: 'o' - } - ]; - var refs = []; - for(var i = 0; i < queue.length; ++i){ - var item = queue[i]; - var obj = item.obj[item.prop]; - var keys = Object.keys(obj); - for(var j = 0; j < keys.length; ++j){ - var key = keys[j]; - var val = obj[key]; - if ('object' == typeof val && null !== val && -1 === refs.indexOf(val)) { - queue.push({ - obj: obj, - prop: key - }); - refs.push(val); - } - } - } - compactQueue(queue); - return value; - }; - var isRegExp = function(obj) { - return '[object RegExp]' === Object.prototype.toString.call(obj); - }; - var isBuffer = function(obj) { - if (!obj || 'object' != typeof obj) return false; - return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); - }; - var combine = function(a, b) { - return [].concat(a, b); - }; - var maybeMap = function(val, fn) { - if (isArray(val)) { - var mapped = []; - for(var i = 0; i < val.length; i += 1)mapped.push(fn(val[i])); - return mapped; - } - return fn(val); - }; - module.exports = { - arrayToObject: arrayToObject, - assign: assign, - combine: combine, - compact: compact, - decode: decode, - encode: encode, - isBuffer: isBuffer, - isRegExp: isRegExp, - maybeMap: maybeMap, - merge: merge - }; - }, - "./node_modules/raf/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - var now = __webpack_require__("./node_modules/performance-now/lib/performance-now.js"), root = 'undefined' == typeof window ? __webpack_require__.g : window, vendors = [ - 'moz', - 'webkit' - ], suffix = 'AnimationFrame', raf = root['request' + suffix], caf = root['cancel' + suffix] || root['cancelRequest' + suffix]; - for(var i = 0; !raf && i < vendors.length; i++){ - raf = root[vendors[i] + 'Request' + suffix]; - caf = root[vendors[i] + 'Cancel' + suffix] || root[vendors[i] + 'CancelRequest' + suffix]; - } - // Some versions of FF have rAF but not cAF - if (!raf || !caf) { - var last = 0, id = 0, queue = [], frameDuration = 1000 / 60; - raf = function(callback) { - if (0 === queue.length) { - var _now = now(), next = Math.max(0, frameDuration - (_now - last)); - last = next + _now; - setTimeout(function() { - var cp = queue.slice(0); - // Clear queue here to prevent - // callbacks from appending listeners - // to the current frame's queue - queue.length = 0; - for(var i = 0; i < cp.length; i++)if (!cp[i].cancelled) try { - cp[i].callback(last); - } catch (e) { - setTimeout(function() { - throw e; - }, 0); - } - }, Math.round(next)); - } - queue.push({ - handle: ++id, - callback: callback, - cancelled: false - }); - return id; - }; - caf = function(handle) { - for(var i = 0; i < queue.length; i++)if (queue[i].handle === handle) queue[i].cancelled = true; - }; - } - module.exports = function(fn) { - // Wrap in a new function to prevent - // `cancel` potentially being assigned - // to the native rAF function - return raf.call(root, fn); - }; - module.exports.cancel = function() { - caf.apply(root, arguments); - }; - module.exports.polyfill = function(object) { - if (!object) object = root; - object.requestAnimationFrame = raf; - object.cancelAnimationFrame = caf; - }; - }, - "./node_modules/set-function-length/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var GetIntrinsic = __webpack_require__("./node_modules/get-intrinsic/index.js"); - var define = __webpack_require__("./node_modules/define-data-property/index.js"); - var hasDescriptors = __webpack_require__("./node_modules/has-property-descriptors/index.js")(); - var gOPD = __webpack_require__("./node_modules/gopd/index.js"); - var $TypeError = __webpack_require__("./node_modules/es-errors/type.js"); - var $floor = GetIntrinsic('%Math.floor%'); - /** @type {import('.')} */ module.exports = function(fn, length) { - if ('function' != typeof fn) throw new $TypeError('`fn` is not a function'); - if ('number' != typeof length || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) throw new $TypeError('`length` must be a positive 32-bit integer'); - var loose = arguments.length > 2 && !!arguments[2]; - var functionLengthIsConfigurable = true; - var functionLengthIsWritable = true; - if ('length' in fn && gOPD) { - var desc = gOPD(fn, 'length'); - if (desc && !desc.configurable) functionLengthIsConfigurable = false; - if (desc && !desc.writable) functionLengthIsWritable = false; - } - if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) hasDescriptors ? define(/** @type {Parameters[0]} */ fn, 'length', length, true, true) : define(/** @type {Parameters[0]} */ fn, 'length', length); - return fn; - }; - }, - "./node_modules/side-channel/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var GetIntrinsic = __webpack_require__("./node_modules/get-intrinsic/index.js"); - var callBound = __webpack_require__("./node_modules/call-bind/callBound.js"); - var inspect = __webpack_require__("./node_modules/object-inspect/index.js"); - var $TypeError = __webpack_require__("./node_modules/es-errors/type.js"); - var $WeakMap = GetIntrinsic('%WeakMap%', true); - var $Map = GetIntrinsic('%Map%', true); - var $weakMapGet = callBound('WeakMap.prototype.get', true); - var $weakMapSet = callBound('WeakMap.prototype.set', true); - var $weakMapHas = callBound('WeakMap.prototype.has', true); - var $mapGet = callBound('Map.prototype.get', true); - var $mapSet = callBound('Map.prototype.set', true); - var $mapHas = callBound('Map.prototype.has', true); - /* -* This function traverses the list returning the node corresponding to the given key. -* -* That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list. By doing so, all the recently used nodes can be accessed relatively quickly. -*/ /** @type {import('.').listGetNode} */ var listGetNode = function(list, key) { - /** @type {typeof list | NonNullable<(typeof list)['next']>} */ var prev = list; - /** @type {(typeof list)['next']} */ var curr; - for(; null !== (curr = prev.next); prev = curr)if (curr.key === key) { - prev.next = curr.next; - // eslint-disable-next-line no-extra-parens - curr.next = /** @type {NonNullable} */ list.next; - list.next = curr; // eslint-disable-line no-param-reassign - return curr; - } - }; - /** @type {import('.').listGet} */ var listGet = function(objects, key) { - var node = listGetNode(objects, key); - return node && node.value; - }; - /** @type {import('.').listSet} */ var listSet = function(objects, key, value) { - var node = listGetNode(objects, key); - if (node) node.value = value; - else // Prepend the new node to the beginning of the list - objects.next = /** @type {import('.').ListNode} */ { - key: key, - next: objects.next, - value: value - }; - }; - /** @type {import('.').listHas} */ var listHas = function(objects, key) { - return !!listGetNode(objects, key); - }; - /** @type {import('.')} */ module.exports = function() { - /** @type {WeakMap} */ var $wm; - /** @type {Map} */ var $m; - /** @type {import('.').RootNode} */ var $o; - /** @type {import('.').Channel} */ var channel = { - assert: function(key) { - if (!channel.has(key)) throw new $TypeError('Side channel does not contain ' + inspect(key)); - }, - get: function(key) { - if ($WeakMap && key && ('object' == typeof key || 'function' == typeof key)) { - if ($wm) return $weakMapGet($wm, key); - } else if ($Map) { - if ($m) return $mapGet($m, key); - } else if ($o) return listGet($o, key); - }, - has: function(key) { - if ($WeakMap && key && ('object' == typeof key || 'function' == typeof key)) { - if ($wm) return $weakMapHas($wm, key); - } else if ($Map) { - if ($m) return $mapHas($m, key); - } else if ($o) return listHas($o, key); - return false; - }, - set: function(key, value) { - if ($WeakMap && key && ('object' == typeof key || 'function' == typeof key)) { - if (!$wm) $wm = new $WeakMap(); - $weakMapSet($wm, key, value); - } else if ($Map) { - if (!$m) $m = new $Map(); - $mapSet($m, key, value); - } else { - if (!$o) // Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head - $o = { - key: {}, - next: null - }; - listSet($o, key, value); - } - } - }; - return channel; - }; - }, - "./node_modules/stream-shift/index.js": function(module) { - module.exports = shift; - function shift(stream) { - var rs = stream._readableState; - if (!rs) return null; - return rs.objectMode || 'number' == typeof stream._duplexState ? stream.read() : stream.read(getStateLength(rs)); - } - function getStateLength(state) { - if (state.buffer.length) { - var idx = state.bufferIndex || 0; - // Since node 6.3.0 state.buffer is a BufferList not an array - if (state.buffer.head) return state.buffer.head.data.length; - if (state.buffer.length - idx > 0 && state.buffer[idx]) return state.buffer[idx].length; - } - return state.length; - } - }, - "./node_modules/superagent/lib/agent-base.js": function(module) { - "use strict"; - const defaults = [ - 'use', - 'on', - 'once', - 'set', - 'query', - 'type', - 'accept', - 'auth', - 'withCredentials', - 'sortQuery', - 'retry', - 'ok', - 'redirects', - 'timeout', - 'buffer', - 'serialize', - 'parse', - 'ca', - 'key', - 'pfx', - 'cert', - 'disableTLSCerts' - ]; - class Agent { - constructor(){ - this._defaults = []; - } - _setDefaults(request) { - for (const def of this._defaults)request[def.fn](...def.args); - } - } - for (const fn of defaults)// Default setting for all requests from this agent - Agent.prototype[fn] = function() { - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; - this._defaults.push({ - fn, - args - }); - return this; - }; - module.exports = Agent; - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJkZWZhdWx0cyIsIkFnZW50IiwiY29uc3RydWN0b3IiLCJfZGVmYXVsdHMiLCJfc2V0RGVmYXVsdHMiLCJyZXF1ZXN0IiwiZGVmIiwiZm4iLCJhcmdzIiwicHJvdG90eXBlIiwiX2xlbiIsImFyZ3VtZW50cyIsImxlbmd0aCIsIkFycmF5IiwiX2tleSIsInB1c2giLCJtb2R1bGUiLC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UFJLENBQUM7TUFBRVIsRUFBRTtNQUFFQztJQUFLLENBQUMsQ0FBQztJQUNqQyxPQUFPLElBQUk7RUFDYixDQUFDO0FBQ0g7QUFHQVEsTUFBTSxDQUFDQyxPQUFPLEdBQUdoQixLQUFLIiwiaWdub3JlTGlzdCI6W119 - }, - "./node_modules/superagent/lib/client.js": function(module, exports1, __webpack_require__) { - "use strict"; - /** - * Root reference for iframes. - */ let root; - if ('undefined' != typeof window) // Browser window - root = window; - else if ('undefined' == typeof self) { - // Other environments - console.warn('Using browser-only version of superagent in non-browser environment'); - root = void 0; - } else // Web Worker - root = self; - const Emitter = __webpack_require__("./node_modules/component-emitter/index.js"); - const safeStringify = __webpack_require__("./node_modules/fast-safe-stringify/index.js"); - const qs = __webpack_require__("./node_modules/qs/lib/index.js"); - const RequestBase = __webpack_require__("./node_modules/superagent/lib/request-base.js"); - const { isObject, mixin, hasOwn } = __webpack_require__("./node_modules/superagent/lib/utils.js"); - const ResponseBase = __webpack_require__("./node_modules/superagent/lib/response-base.js"); - const Agent = __webpack_require__("./node_modules/superagent/lib/agent-base.js"); - /** - * Noop. - */ function noop() {} - /** - * Expose `request`. - */ module.exports = function(method, url) { - // callback - if ('function' == typeof url) return new exports1.Request('GET', method).end(url); - // url first - if (1 === arguments.length) return new exports1.Request('GET', method); - return new exports1.Request(method, url); - }; - exports1 = module.exports; - const request = exports1; - exports1.Request = Request; - /** - * Determine XHR. - */ request.getXHR = ()=>{ - if (root.XMLHttpRequest) return new root.XMLHttpRequest(); - throw new Error('Browser-only version of superagent could not find XHR'); - }; - /** - * Removes leading and trailing whitespace, added to support IE. - * - * @param {String} s - * @return {String} - * @api private - */ const trim = ''.trim ? (s)=>s.trim() : (s)=>s.replace(/(^\s*|\s*$)/g, ''); - /** - * Serialize the given `obj`. - * - * @param {Object} obj - * @return {String} - * @api private - */ function serialize(object) { - if (!isObject(object)) return object; - const pairs = []; - for(const key in object)if (hasOwn(object, key)) pushEncodedKeyValuePair(pairs, key, object[key]); - return pairs.join('&'); - } - /** - * Helps 'serialize' with serializing arrays. - * Mutates the pairs array. - * - * @param {Array} pairs - * @param {String} key - * @param {Mixed} val - */ function pushEncodedKeyValuePair(pairs, key, value) { - if (void 0 === value) return; - if (null === value) { - pairs.push(encodeURI(key)); - return; - } - if (Array.isArray(value)) for (const v of value)pushEncodedKeyValuePair(pairs, key, v); - else if (isObject(value)) { - for(const subkey in value)if (hasOwn(value, subkey)) pushEncodedKeyValuePair(pairs, `${key}[${subkey}]`, value[subkey]); - } else pairs.push(encodeURI(key) + '=' + encodeURIComponent(value)); - } - /** - * Expose serialization method. - */ request.serializeObject = serialize; - /** - * Parse the given x-www-form-urlencoded `str`. - * - * @param {String} str - * @return {Object} - * @api private - */ function parseString(string_) { - const object = {}; - const pairs = string_.split('&'); - let pair; - let pos; - for(let i = 0, length_ = pairs.length; i < length_; ++i){ - pair = pairs[i]; - pos = pair.indexOf('='); - if (-1 === pos) object[decodeURIComponent(pair)] = ''; - else object[decodeURIComponent(pair.slice(0, pos))] = decodeURIComponent(pair.slice(pos + 1)); - } - return object; - } - /** - * Expose parser. - */ request.parseString = parseString; - /** - * Default MIME type map. - * - * superagent.types.xml = 'application/xml'; - * - */ request.types = { - html: 'text/html', - json: 'application/json', - xml: 'text/xml', - urlencoded: 'application/x-www-form-urlencoded', - form: 'application/x-www-form-urlencoded', - 'form-data': 'application/x-www-form-urlencoded' - }; - /** - * Default serialization map. - * - * superagent.serialize['application/xml'] = function(obj){ - * return 'generated xml here'; - * }; - * - */ request.serialize = { - 'application/x-www-form-urlencoded': (obj)=>qs.stringify(obj, { - indices: false, - strictNullHandling: true - }), - 'application/json': safeStringify - }; - /** - * Default parsers. - * - * superagent.parse['application/xml'] = function(str){ - * return { object parsed from str }; - * }; - * - */ request.parse = { - 'application/x-www-form-urlencoded': parseString, - 'application/json': JSON.parse - }; - /** - * Parse the given header `str` into - * an object containing the mapped fields. - * - * @param {String} str - * @return {Object} - * @api private - */ function parseHeader(string_) { - const lines = string_.split(/\r?\n/); - const fields = {}; - let index; - let line; - let field; - let value; - for(let i = 0, length_ = lines.length; i < length_; ++i){ - line = lines[i]; - index = line.indexOf(':'); - if (-1 !== index) { - field = line.slice(0, index).toLowerCase(); - value = trim(line.slice(index + 1)); - fields[field] = value; - } - } - return fields; - } - /** - * Check if `mime` is json or has +json structured syntax suffix. - * - * @param {String} mime - * @return {Boolean} - * @api private - */ function isJSON(mime) { - // should match /json or +json - // but not /json-seq - return /[/+]json($|[^-\w])/i.test(mime); - } - /** - * Initialize a new `Response` with the given `xhr`. - * - * - set flags (.ok, .error, etc) - * - parse header - * - * Examples: - * - * Aliasing `superagent` as `request` is nice: - * - * request = superagent; - * - * We can use the promise-like API, or pass callbacks: - * - * request.get('/').end(function(res){}); - * request.get('/', function(res){}); - * - * Sending data can be chained: - * - * request - * .post('/user') - * .send({ name: 'tj' }) - * .end(function(res){}); - * - * Or passed to `.send()`: - * - * request - * .post('/user') - * .send({ name: 'tj' }, function(res){}); - * - * Or passed to `.post()`: - * - * request - * .post('/user', { name: 'tj' }) - * .end(function(res){}); - * - * Or further reduced to a single call for simple cases: - * - * request - * .post('/user', { name: 'tj' }, function(res){}); - * - * @param {XMLHTTPRequest} xhr - * @param {Object} options - * @api private - */ function Response(request_) { - this.req = request_; - this.xhr = this.req.xhr; - // responseText is accessible only if responseType is '' or 'text' and on older browsers - this.text = 'HEAD' !== this.req.method && ('' === this.xhr.responseType || 'text' === this.xhr.responseType) || void 0 === this.xhr.responseType ? this.xhr.responseText : null; - this.statusText = this.req.xhr.statusText; - let { status } = this.xhr; - // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request - if (1223 === status) status = 204; - this._setStatusProperties(status); - this.headers = parseHeader(this.xhr.getAllResponseHeaders()); - this.header = this.headers; - // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but - // getResponseHeader still works. so we get content-type even if getting - // other headers fails. - this.header['content-type'] = this.xhr.getResponseHeader('content-type'); - this._setHeaderProperties(this.header); - if (null === this.text && request_._responseType) this.body = this.xhr.response; - else this.body = 'HEAD' === this.req.method ? null : this._parseBody(this.text ? this.text : this.xhr.response); - } - mixin(Response.prototype, ResponseBase.prototype); - /** - * Parse the given body `str`. - * - * Used for auto-parsing of bodies. Parsers - * are defined on the `superagent.parse` object. - * - * @param {String} str - * @return {Mixed} - * @api private - */ Response.prototype._parseBody = function(string_) { - let parse = request.parse[this.type]; - if (this.req._parser) return this.req._parser(this, string_); - if (!parse && isJSON(this.type)) parse = request.parse['application/json']; - return parse && string_ && (string_.length > 0 || string_ instanceof Object) ? parse(string_) : null; - }; - /** - * Return an `Error` representative of this response. - * - * @return {Error} - * @api public - */ Response.prototype.toError = function() { - const { req } = this; - const { method } = req; - const { url } = req; - const message = `cannot ${method} ${url} (${this.status})`; - const error = new Error(message); - error.status = this.status; - error.method = method; - error.url = url; - return error; - }; - /** - * Expose `Response`. - */ request.Response = Response; - /** - * Initialize a new `Request` with the given `method` and `url`. - * - * @param {String} method - * @param {String} url - * @api public - */ function Request(method, url) { - const self1 = this; - this._query = this._query || []; - this.method = method; - this.url = url; - this.header = {}; // preserves header name case - this._header = {}; // coerces header names to lowercase - this.on('end', ()=>{ - let error = null; - let res = null; - try { - res = new Response(self1); - } catch (err) { - error = new Error('Parser is unable to parse the response'); - error.parse = true; - error.original = err; - // issue #675: return the raw response if the response parsing fails - if (self1.xhr) { - // ie9 doesn't have 'response' property - error.rawResponse = void 0 === self1.xhr.responseType ? self1.xhr.responseText : self1.xhr.response; - // issue #876: return the http status code if the response parsing fails - error.status = self1.xhr.status ? self1.xhr.status : null; - error.statusCode = error.status; // backwards-compat only - } else { - error.rawResponse = null; - error.status = null; - } - return self1.callback(error); - } - self1.emit('response', res); - let new_error; - try { - if (!self1._isResponseOK(res)) new_error = new Error(res.statusText || res.text || 'Unsuccessful HTTP response'); - } catch (err) { - new_error = err; // ok() callback can throw - } - // #1000 don't catch errors from the callback to avoid double calling it - if (new_error) { - new_error.original = error; - new_error.response = res; - new_error.status = new_error.status || res.status; - self1.callback(new_error, res); - } else self1.callback(null, res); - }); - } - /** - * Mixin `Emitter` and `RequestBase`. - */ // eslint-disable-next-line new-cap - Emitter(Request.prototype); - mixin(Request.prototype, RequestBase.prototype); - /** - * Set Content-Type to `type`, mapping values from `request.types`. - * - * Examples: - * - * superagent.types.xml = 'application/xml'; - * - * request.post('/') - * .type('xml') - * .send(xmlstring) - * .end(callback); - * - * request.post('/') - * .type('application/xml') - * .send(xmlstring) - * .end(callback); - * - * @param {String} type - * @return {Request} for chaining - * @api public - */ Request.prototype.type = function(type) { - this.set('Content-Type', request.types[type] || type); - return this; - }; - /** - * Set Accept to `type`, mapping values from `request.types`. - * - * Examples: - * - * superagent.types.json = 'application/json'; - * - * request.get('/agent') - * .accept('json') - * .end(callback); - * - * request.get('/agent') - * .accept('application/json') - * .end(callback); - * - * @param {String} accept - * @return {Request} for chaining - * @api public - */ Request.prototype.accept = function(type) { - this.set('Accept', request.types[type] || type); - return this; - }; - /** - * Set Authorization field value with `user` and `pass`. - * - * @param {String} user - * @param {String} [pass] optional in case of using 'bearer' as type - * @param {Object} options with 'type' property 'auto', 'basic' or 'bearer' (default 'basic') - * @return {Request} for chaining - * @api public - */ Request.prototype.auth = function(user, pass, options) { - if (1 === arguments.length) pass = ''; - if ('object' == typeof pass && null !== pass) { - // pass is optional and can be replaced with options - options = pass; - pass = ''; - } - if (!options) options = { - type: 'function' == typeof btoa ? 'basic' : 'auto' - }; - const encoder = options.encoder ? options.encoder : (string)=>{ - if ('function' == typeof btoa) return btoa(string); - throw new Error('Cannot use basic auth, btoa is not a function'); - }; - return this._auth(user, pass, options, encoder); - }; - /** - * Add query-string `val`. - * - * Examples: - * - * request.get('/shoes') - * .query('size=10') - * .query({ color: 'blue' }) - * - * @param {Object|String} val - * @return {Request} for chaining - * @api public - */ Request.prototype.query = function(value) { - if ('string' != typeof value) value = serialize(value); - if (value) this._query.push(value); - return this; - }; - /** - * Queue the given `file` as an attachment to the specified `field`, - * with optional `options` (or filename). - * - * ``` js - * request.post('/upload') - * .attach('content', new Blob(['hey!'], { type: "text/html"})) - * .end(callback); - * ``` - * - * @param {String} field - * @param {Blob|File} file - * @param {String|Object} options - * @return {Request} for chaining - * @api public - */ Request.prototype.attach = function(field, file, options) { - if (file) { - if (this._data) throw new Error("superagent can't mix .send() and .attach()"); - this._getFormData().append(field, file, options || file.name); - } - return this; - }; - Request.prototype._getFormData = function() { - if (!this._formData) this._formData = new root.FormData(); - return this._formData; - }; - /** - * Invoke the callback with `err` and `res` - * and handle arity check. - * - * @param {Error} err - * @param {Response} res - * @api private - */ Request.prototype.callback = function(error, res) { - if (this._shouldRetry(error, res)) return this._retry(); - const fn = this._callback; - this.clearTimeout(); - if (error) { - if (this._maxRetries) error.retries = this._retries - 1; - this.emit('error', error); - } - fn(error, res); - }; - /** - * Invoke callback with x-domain error. - * - * @api private - */ Request.prototype.crossDomainError = function() { - const error = new Error('Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.'); - error.crossDomain = true; - error.status = this.status; - error.method = this.method; - error.url = this.url; - this.callback(error); - }; - // This only warns, because the request is still likely to work - Request.prototype.agent = function() { - console.warn('This is not supported in browser version of superagent'); - return this; - }; - Request.prototype.ca = Request.prototype.agent; - Request.prototype.buffer = Request.prototype.ca; - // This throws, because it can't send/receive data as expected - Request.prototype.write = ()=>{ - throw new Error('Streaming is not supported in browser version of superagent'); - }; - Request.prototype.pipe = Request.prototype.write; - /** - * Check if `obj` is a host object, - * we don't want to serialize these :) - * - * @param {Object} obj host object - * @return {Boolean} is a host object - * @api private - */ Request.prototype._isHost = function(object) { - // Native objects stringify to [object File], [object Blob], [object FormData], etc. - return object && 'object' == typeof object && !Array.isArray(object) && '[object Object]' !== Object.prototype.toString.call(object); - }; - /** - * Initiate request, invoking callback `fn(res)` - * with an instanceof `Response`. - * - * @param {Function} fn - * @return {Request} for chaining - * @api public - */ Request.prototype.end = function(fn) { - if (this._endCalled) console.warn('Warning: .end() was called twice. This is not supported in superagent'); - this._endCalled = true; - // store callback - this._callback = fn || noop; - // querystring - this._finalizeQueryString(); - this._end(); - }; - Request.prototype._setUploadTimeout = function() { - const self1 = this; - // upload timeout it's wokrs only if deadline timeout is off - if (this._uploadTimeout && !this._uploadTimeoutTimer) this._uploadTimeoutTimer = setTimeout(()=>{ - self1._timeoutError('Upload timeout of ', self1._uploadTimeout, 'ETIMEDOUT'); - }, this._uploadTimeout); - }; - // eslint-disable-next-line complexity - Request.prototype._end = function() { - if (this._aborted) return this.callback(new Error('The request has been aborted even before .end() was called')); - const self1 = this; - this.xhr = request.getXHR(); - const { xhr } = this; - let data = this._formData || this._data; - this._setTimeouts(); - // state change - xhr.addEventListener('readystatechange', ()=>{ - const { readyState } = xhr; - if (readyState >= 2 && self1._responseTimeoutTimer) clearTimeout(self1._responseTimeoutTimer); - if (4 !== readyState) return; - // In IE9, reads to any property (e.g. status) off of an aborted XHR will - // result in the error "Could not complete the operation due to error c00c023f" - let status; - try { - status = xhr.status; - } catch (err) { - status = 0; - } - if (!status) { - if (self1.timedout || self1._aborted) return; - return self1.crossDomainError(); - } - self1.emit('end'); - }); - // progress - const handleProgress = (direction, e)=>{ - if (e.total > 0) { - e.percent = e.loaded / e.total * 100; - if (100 === e.percent) clearTimeout(self1._uploadTimeoutTimer); - } - e.direction = direction; - self1.emit('progress', e); - }; - if (this.hasListeners('progress')) try { - xhr.addEventListener('progress', handleProgress.bind(null, 'download')); - if (xhr.upload) xhr.upload.addEventListener('progress', handleProgress.bind(null, 'upload')); - } catch (err) { - // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist. - // Reported here: - // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context - } - if (xhr.upload) this._setUploadTimeout(); - // initiate request - try { - if (this.username && this.password) xhr.open(this.method, this.url, true, this.username, this.password); - else xhr.open(this.method, this.url, true); - } catch (err) { - // see #1149 - return this.callback(err); - } - // CORS - if (this._withCredentials) xhr.withCredentials = true; - // body - if (!this._formData && 'GET' !== this.method && 'HEAD' !== this.method && 'string' != typeof data && !this._isHost(data)) { - // serialize stuff - const contentType = this._header['content-type']; - let serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : '']; - if (!serialize && isJSON(contentType)) serialize = request.serialize['application/json']; - if (serialize) data = serialize(data); - } - // set header fields - for(const field in this.header)if (null !== this.header[field]) { - if (hasOwn(this.header, field)) xhr.setRequestHeader(field, this.header[field]); - } - if (this._responseType) xhr.responseType = this._responseType; - // send stuff - this.emit('request', this); - // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing) - // We need null here if data is undefined - xhr.send(void 0 === data ? null : data); - }; - request.agent = ()=>new Agent(); - for (const method of [ - 'GET', - 'POST', - 'OPTIONS', - 'PATCH', - 'PUT', - 'DELETE' - ])Agent.prototype[method.toLowerCase()] = function(url, fn) { - const request_ = new request.Request(method, url); - this._setDefaults(request_); - if (fn) request_.end(fn); - return request_; - }; - Agent.prototype.del = Agent.prototype.delete; - /** - * GET `url` with optional callback `fn(res)`. - * - * @param {String} url - * @param {Mixed|Function} [data] or fn - * @param {Function} [fn] - * @return {Request} - * @api public - */ request.get = (url, data, fn)=>{ - const request_ = request('GET', url); - if ('function' == typeof data) { - fn = data; - data = null; - } - if (data) request_.query(data); - if (fn) request_.end(fn); - return request_; - }; - /** - * HEAD `url` with optional callback `fn(res)`. - * - * @param {String} url - * @param {Mixed|Function} [data] or fn - * @param {Function} [fn] - * @return {Request} - * @api public - */ request.head = (url, data, fn)=>{ - const request_ = request('HEAD', url); - if ('function' == typeof data) { - fn = data; - data = null; - } - if (data) request_.query(data); - if (fn) request_.end(fn); - return request_; - }; - /** - * OPTIONS query to `url` with optional callback `fn(res)`. - * - * @param {String} url - * @param {Mixed|Function} [data] or fn - * @param {Function} [fn] - * @return {Request} - * @api public - */ request.options = (url, data, fn)=>{ - const request_ = request('OPTIONS', url); - if ('function' == typeof data) { - fn = data; - data = null; - } - if (data) request_.send(data); - if (fn) request_.end(fn); - return request_; - }; - /** - * DELETE `url` with optional `data` and callback `fn(res)`. - * - * @param {String} url - * @param {Mixed} [data] - * @param {Function} [fn] - * @return {Request} - * @api public - */ function del(url, data, fn) { - const request_ = request('DELETE', url); - if ('function' == typeof data) { - fn = data; - data = null; - } - if (data) request_.send(data); - if (fn) request_.end(fn); - return request_; - } - request.del = del; - request.delete = del; - /** - * PATCH `url` with optional `data` and callback `fn(res)`. - * - * @param {String} url - * @param {Mixed} [data] - * @param {Function} [fn] - * @return {Request} - * @api public - */ request.patch = (url, data, fn)=>{ - const request_ = request('PATCH', url); - if ('function' == typeof data) { - fn = data; - data = null; - } - if (data) request_.send(data); - if (fn) request_.end(fn); - return request_; - }; - /** - * POST `url` with optional `data` and callback `fn(res)`. - * - * @param {String} url - * @param {Mixed} [data] - * @param {Function} [fn] - * @return {Request} - * @api public - */ request.post = (url, data, fn)=>{ - const request_ = request('POST', url); - if ('function' == typeof data) { - fn = data; - data = null; - } - if (data) request_.send(data); - if (fn) request_.end(fn); - return request_; - }; - /** - * PUT `url` with optional `data` and callback `fn(res)`. - * - * @param {String} url - * @param {Mixed|Function} [data] or fn - * @param {Function} [fn] - * @return {Request} - * @api public - */ request.put = (url, data, fn)=>{ - const request_ = request('PUT', url); - if ('function' == typeof data) { - fn = data; - data = null; - } - if (data) request_.send(data); - if (fn) request_.end(fn); - return request_; - }; - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJyb290Iiwid2luZG93Iiwic2VsZiIsImNvbnNvbGUiLCJ3YXJuIiwiRW1pdHRlciIsInJlcXVpcmUiLCJzYWZlU3RyaW5naWZ5IiwicXMiLCJSZXF1ZXN0QmFzZSIsImlzT2JqZWN0IiwibWl4aW4iLCJoYXNPd24iLCJSZXNwb25zZUJhc2UiLCJBZ2VudCIsIm5vb3AiLCJtb2R1bG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IsSUFBSTtJQUNUQSxJQUFJLEdBQUcsSUFBSTtFQUNiO0VBRUEsSUFBSUEsSUFBSSxFQUFFbkYsUUFBUSxDQUFDMEcsSUFBSSxDQUFDdkIsSUFBSSxDQUFDO0VBQzdCLElBQUl6QixFQUFFLEVBQUUxRCxRQUFRLENBQUMzRCxHQUFHLENBQUNxSCxFQUFFLENBQUM7RUFDeEIsT0FBTzFELFFBQVE7QUFDakIsQ0FBQyIsImlnbm9yZUxpc3QiOltdfQ== - }, - "./node_modules/superagent/lib/request-base.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - /** - * Module of mixed-in functions shared between node and client code - */ const { isObject, hasOwn } = __webpack_require__("./node_modules/superagent/lib/utils.js"); - /** - * Expose `RequestBase`. - */ module.exports = RequestBase; - /** - * Initialize a new `RequestBase`. - * - * @api public - */ function RequestBase() {} - /** - * Clear previous timeout. - * - * @return {Request} for chaining - * @api public - */ RequestBase.prototype.clearTimeout = function() { - clearTimeout(this._timer); - clearTimeout(this._responseTimeoutTimer); - clearTimeout(this._uploadTimeoutTimer); - delete this._timer; - delete this._responseTimeoutTimer; - delete this._uploadTimeoutTimer; - return this; - }; - /** - * Override default response body parser - * - * This function will be called to convert incoming data into request.body - * - * @param {Function} - * @api public - */ RequestBase.prototype.parse = function(fn) { - this._parser = fn; - return this; - }; - /** - * Set format of binary response body. - * In browser valid formats are 'blob' and 'arraybuffer', - * which return Blob and ArrayBuffer, respectively. - * - * In Node all values result in Buffer. - * - * Examples: - * - * req.get('/') - * .responseType('blob') - * .end(callback); - * - * @param {String} val - * @return {Request} for chaining - * @api public - */ RequestBase.prototype.responseType = function(value) { - this._responseType = value; - return this; - }; - /** - * Override default request body serializer - * - * This function will be called to convert data set via .send or .attach into payload to send - * - * @param {Function} - * @api public - */ RequestBase.prototype.serialize = function(fn) { - this._serializer = fn; - return this; - }; - /** - * Set timeouts. - * - * - response timeout is time between sending request and receiving the first byte of the response. Includes DNS and connection time. - * - deadline is the time from start of the request to receiving response body in full. If the deadline is too short large files may not load at all on slow connections. - * - upload is the time since last bit of data was sent or received. This timeout works only if deadline timeout is off - * - * Value of 0 or false means no timeout. - * - * @param {Number|Object} ms or {response, deadline} - * @return {Request} for chaining - * @api public - */ RequestBase.prototype.timeout = function(options) { - if (!options || 'object' != typeof options) { - this._timeout = options; - this._responseTimeout = 0; - this._uploadTimeout = 0; - return this; - } - for(const option in options)if (hasOwn(options, option)) switch(option){ - case 'deadline': - this._timeout = options.deadline; - break; - case 'response': - this._responseTimeout = options.response; - break; - case 'upload': - this._uploadTimeout = options.upload; - break; - default: - console.warn('Unknown timeout option', option); - } - return this; - }; - /** - * Set number of retry attempts on error. - * - * Failed requests will be retried 'count' times if timeout or err.code >= 500. - * - * @param {Number} count - * @param {Function} [fn] - * @return {Request} for chaining - * @api public - */ RequestBase.prototype.retry = function(count, fn) { - // Default to 1 if no count passed or true - if (0 === arguments.length || true === count) count = 1; - if (count <= 0) count = 0; - this._maxRetries = count; - this._retries = 0; - this._retryCallback = fn; - return this; - }; - // - // NOTE: we do not include ESOCKETTIMEDOUT because that is from `request` package - // - // - // NOTE: we do not include EADDRINFO because it was removed from libuv in 2014 - // - // - // - // - // TODO: expose these as configurable defaults - // - const ERROR_CODES = new Set([ - 'ETIMEDOUT', - 'ECONNRESET', - 'EADDRINUSE', - 'ECONNREFUSED', - 'EPIPE', - 'ENOTFOUND', - 'ENETUNREACH', - 'EAI_AGAIN' - ]); - const STATUS_CODES = new Set([ - 408, - 413, - 429, - 500, - 502, - 503, - 504, - 521, - 522, - 524 - ]); - // TODO: we would need to make this easily configurable before adding it in (e.g. some might want to add POST) - // const METHODS = new Set(['GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE']); - /** - * Determine if a request should be retried. - * (Inspired by https://github.com/sindresorhus/got#retry) - * - * @param {Error} err an error - * @param {Response} [res] response - * @returns {Boolean} if segment should be retried - */ RequestBase.prototype._shouldRetry = function(error, res) { - if (!this._maxRetries || this._retries++ >= this._maxRetries) return false; - if (this._retryCallback) try { - const override = this._retryCallback(error, res); - if (true === override) return true; - if (false === override) return false; - // undefined falls back to defaults - } catch (err) { - console.error(err); - } - // TODO: we would need to make this easily configurable before adding it in (e.g. some might want to add POST) - /* - if ( - this.req && - this.req.method && - !METHODS.has(this.req.method.toUpperCase()) - ) - return false; - */ if (res && res.status && STATUS_CODES.has(res.status)) return true; - if (error) { - if (error.code && ERROR_CODES.has(error.code)) return true; - // Superagent timeout - if (error.timeout && 'ECONNABORTED' === error.code) return true; - if (error.crossDomain) return true; - } - return false; - }; - /** - * Retry request - * - * @return {Request} for chaining - * @api private - */ RequestBase.prototype._retry = function() { - this.clearTimeout(); - // node - if (this.req) { - this.req = null; - this.req = this.request(); - } - this._aborted = false; - this.timedout = false; - this.timedoutError = null; - return this._end(); - }; - /** - * Promise support - * - * @param {Function} resolve - * @param {Function} [reject] - * @return {Request} - */ RequestBase.prototype.then = function(resolve, reject) { - if (!this._fullfilledPromise) { - const self1 = this; - if (this._endCalled) console.warn('Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises'); - this._fullfilledPromise = new Promise((resolve, reject)=>{ - self1.on('abort', ()=>{ - if (this._maxRetries && this._maxRetries > this._retries) return; - if (this.timedout && this.timedoutError) { - reject(this.timedoutError); - return; - } - const error = new Error('Aborted'); - error.code = 'ABORTED'; - error.status = this.status; - error.method = this.method; - error.url = this.url; - reject(error); - }); - self1.end((error, res)=>{ - if (error) reject(error); - else resolve(res); - }); - }); - } - return this._fullfilledPromise.then(resolve, reject); - }; - RequestBase.prototype.catch = function(callback) { - return this.then(void 0, callback); - }; - /** - * Allow for extension - */ RequestBase.prototype.use = function(fn) { - fn(this); - return this; - }; - RequestBase.prototype.ok = function(callback) { - if ('function' != typeof callback) throw new Error('Callback required'); - this._okCallback = callback; - return this; - }; - RequestBase.prototype._isResponseOK = function(res) { - if (!res) return false; - if (this._okCallback) return this._okCallback(res); - return res.status >= 200 && res.status < 300; - }; - /** - * Get request header `field`. - * Case-insensitive. - * - * @param {String} field - * @return {String} - * @api public - */ RequestBase.prototype.get = function(field) { - return this._header[field.toLowerCase()]; - }; - /** - * Get case-insensitive header `field` value. - * This is a deprecated internal API. Use `.get(field)` instead. - * - * (getHeader is no longer used internally by the superagent code base) - * - * @param {String} field - * @return {String} - * @api private - * @deprecated - */ RequestBase.prototype.getHeader = RequestBase.prototype.get; - /** - * Set header `field` to `val`, or multiple fields with one object. - * Case-insensitive. - * - * Examples: - * - * req.get('/') - * .set('Accept', 'application/json') - * .set('X-API-Key', 'foobar') - * .end(callback); - * - * req.get('/') - * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' }) - * .end(callback); - * - * @param {String|Object} field - * @param {String} val - * @return {Request} for chaining - * @api public - */ RequestBase.prototype.set = function(field, value) { - if (isObject(field)) { - for(const key in field)if (hasOwn(field, key)) this.set(key, field[key]); - return this; - } - this._header[field.toLowerCase()] = value; - this.header[field] = value; - return this; - }; - /** - * Remove header `field`. - * Case-insensitive. - * - * Example: - * - * req.get('/') - * .unset('User-Agent') - * .end(callback); - * - * @param {String} field field name - */ RequestBase.prototype.unset = function(field) { - delete this._header[field.toLowerCase()]; - delete this.header[field]; - return this; - }; - /** - * Write the field `name` and `val`, or multiple fields with one object - * for "multipart/form-data" request bodies. - * - * ``` js - * request.post('/upload') - * .field('foo', 'bar') - * .end(callback); - * - * request.post('/upload') - * .field({ foo: 'bar', baz: 'qux' }) - * .end(callback); - * ``` - * - * @param {String|Object} name name of field - * @param {String|Blob|File|Buffer|fs.ReadStream} val value of field - * @param {String} options extra options, e.g. 'blob' - * @return {Request} for chaining - * @api public - */ RequestBase.prototype.field = function(name, value, options) { - // name should be either a string or an object. - if (null == name) throw new Error('.field(name, val) name can not be empty'); - if (this._data) throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"); - if (isObject(name)) { - for(const key in name)if (hasOwn(name, key)) this.field(key, name[key]); - return this; - } - if (Array.isArray(value)) { - for(const i in value)if (hasOwn(value, i)) this.field(name, value[i]); - return this; - } - // val should be defined now - if (null == value) throw new Error('.field(name, val) val can not be empty'); - if ('boolean' == typeof value) value = String(value); - // fix https://github.com/ladjs/superagent/issues/1680 - if (options) this._getFormData().append(name, value, options); - else this._getFormData().append(name, value); - return this; - }; - /** - * Abort the request, and clear potential timeout. - * - * @return {Request} request - * @api public - */ RequestBase.prototype.abort = function() { - if (this._aborted) return this; - this._aborted = true; - if (this.xhr) this.xhr.abort(); // browser - if (this.req) this.req.abort(); // node - this.clearTimeout(); - this.emit('abort'); - return this; - }; - RequestBase.prototype._auth = function(user, pass, options, base64Encoder) { - switch(options.type){ - case 'basic': - this.set('Authorization', `Basic ${base64Encoder(`${user}:${pass}`)}`); - break; - case 'auto': - this.username = user; - this.password = pass; - break; - case 'bearer': - // usage would be .auth(accessToken, { type: 'bearer' }) - this.set('Authorization', `Bearer ${user}`); - break; - default: - break; - } - return this; - }; - /** - * Enable transmission of cookies with x-domain requests. - * - * Note that for this to work the origin must not be - * using "Access-Control-Allow-Origin" with a wildcard, - * and also must set "Access-Control-Allow-Credentials" - * to "true". - * @param {Boolean} [on=true] - Set 'withCredentials' state - * @return {Request} for chaining - * @api public - */ RequestBase.prototype.withCredentials = function(on) { - // This is browser-only functionality. Node side is no-op. - if (void 0 === on) on = true; - this._withCredentials = on; - return this; - }; - /** - * Set the max redirects to `n`. Does nothing in browser XHR implementation. - * - * @param {Number} n - * @return {Request} for chaining - * @api public - */ RequestBase.prototype.redirects = function(n) { - this._maxRedirects = n; - return this; - }; - /** - * Maximum size of buffered response body, in bytes. Counts uncompressed size. - * Default 200MB. - * - * @param {Number} n number of bytes - * @return {Request} for chaining - */ RequestBase.prototype.maxResponseSize = function(n) { - if ('number' != typeof n) throw new TypeError('Invalid argument'); - this._maxResponseSize = n; - return this; - }; - /** - * Convert to a plain javascript object (not JSON string) of scalar properties. - * Note as this method is designed to return a useful non-this value, - * it cannot be chained. - * - * @return {Object} describing method, url, and data of this request - * @api public - */ RequestBase.prototype.toJSON = function() { - return { - method: this.method, - url: this.url, - data: this._data, - headers: this._header - }; - }; - /** - * Send `data` as the request body, defaulting the `.type()` to "json" when - * an object is given. - * - * Examples: - * - * // manual json - * request.post('/user') - * .type('json') - * .send('{"name":"tj"}') - * .end(callback) - * - * // auto json - * request.post('/user') - * .send({ name: 'tj' }) - * .end(callback) - * - * // manual x-www-form-urlencoded - * request.post('/user') - * .type('form') - * .send('name=tj') - * .end(callback) - * - * // auto x-www-form-urlencoded - * request.post('/user') - * .type('form') - * .send({ name: 'tj' }) - * .end(callback) - * - * // defaults to x-www-form-urlencoded - * request.post('/user') - * .send('name=tobi') - * .send('species=ferret') - * .end(callback) - * - * @param {String|Object} data - * @return {Request} for chaining - * @api public - */ // eslint-disable-next-line complexity - RequestBase.prototype.send = function(data) { - const isObject_ = isObject(data); - let type = this._header['content-type']; - if (this._formData) throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"); - if (isObject_ && !this._data) { - if (Array.isArray(data)) this._data = []; - else if (!this._isHost(data)) this._data = {}; - } else if (data && this._data && this._isHost(this._data)) throw new Error("Can't merge these send calls"); - // merge - if (isObject_ && isObject(this._data)) for(const key in data){ - if ('bigint' == typeof data[key] && !data[key].toJSON) throw new Error('Cannot serialize BigInt value to json'); - if (hasOwn(data, key)) this._data[key] = data[key]; - } - else if ('bigint' == typeof data) throw new Error("Cannot send value of type BigInt"); - else if ('string' == typeof data) { - // default to x-www-form-urlencoded - if (!type) this.type('form'); - type = this._header['content-type']; - if (type) type = type.toLowerCase().trim(); - if ('application/x-www-form-urlencoded' === type) this._data = this._data ? `${this._data}&${data}` : data; - else this._data = (this._data || '') + data; - } else this._data = data; - if (!isObject_ || this._isHost(data)) return this; - // default to json - if (!type) this.type('json'); - return this; - }; - /** - * Sort `querystring` by the sort function - * - * - * Examples: - * - * // default order - * request.get('/user') - * .query('name=Nick') - * .query('search=Manny') - * .sortQuery() - * .end(callback) - * - * // customized sort function - * request.get('/user') - * .query('name=Nick') - * .query('search=Manny') - * .sortQuery(function(a, b){ - * return a.length - b.length; - * }) - * .end(callback) - * - * - * @param {Function} sort - * @return {Request} for chaining - * @api public - */ RequestBase.prototype.sortQuery = function(sort) { - // _sort default to true but otherwise can be a function or boolean - this._sort = void 0 === sort || sort; - return this; - }; - /** - * Compose querystring to append to req.url - * - * @api private - */ RequestBase.prototype._finalizeQueryString = function() { - const query = this._query.join('&'); - if (query) this.url += (this.url.includes('?') ? '&' : '?') + query; - this._query.length = 0; // Makes the call idempotent - if (this._sort) { - const index = this.url.indexOf('?'); - if (index >= 0) { - const queryArray = this.url.slice(index + 1).split('&'); - if ('function' == typeof this._sort) queryArray.sort(this._sort); - else queryArray.sort(); - this.url = this.url.slice(0, index) + '?' + queryArray.join('&'); - } - } - }; - // For backwards compat only - RequestBase.prototype._appendQueryString = ()=>{ - console.warn('Unsupported'); - }; - /** - * Invoke callback with timeout error. - * - * @api private - */ RequestBase.prototype._timeoutError = function(reason, timeout, errno) { - if (this._aborted) return; - const error = new Error(`${reason + timeout}ms exceeded`); - error.timeout = timeout; - error.code = 'ECONNABORTED'; - error.errno = errno; - this.timedout = true; - this.timedoutError = error; - this.abort(); - this.callback(error); - }; - RequestBase.prototype._setTimeouts = function() { - const self1 = this; - // deadline - if (this._timeout && !this._timer) this._timer = setTimeout(()=>{ - self1._timeoutError('Timeout of ', self1._timeout, 'ETIME'); - }, this._timeout); - // response timeout - if (this._responseTimeout && !this._responseTimeoutTimer) this._responseTimeoutTimer = setTimeout(()=>{ - self1._timeoutError('Response timeout of ', self1._responseTimeout, 'ETIMEDOUT'); - }, this._responseTimeout); - }; - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJpc09iamVjdCIsImhhc093biIsInJlcXVpcmUiLCJtb2R1bGUiLCJleHBvcnRzIiwiUmVxdWVzdEJhc2UiLCJwcm90b3R5cGUiLCJjbGVhclRpbWVvdXQiLCJfdGltZX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Lm9uKCdhYm9ydCcsICgpID0+IHtcbiAgICAgICAgaWYgKHRoaXMuX21heFJldHJpZXMgJiYgdGhpcy5fbWF4UmV0cmllcyA+IHRoaXMuX3JldHJpZXMpIHtcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBpZiAodGhpcy50aW1lZG91dCAmJiB0aGlzLnRpbWVkb3V0RXJyb3IpIHtcbiAgICAgICAgICByZWplY3QodGhpcy50aW1lZG91dEVycm9yKTtcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cblxuICAgICAgICBjb25zdCBlcnJvciA9IG5ldyBFcnJvcignQWJvcnRlZCcpO1xuICAgICAgICBlcnJvci5jb2RlID0gJ0FCT1JURUQnO1xuICAgICAgICBlcnJvci5zdGF0dXMgPSB0aGlzLnN0YXR1cztcbiAgICAgICAgZXJyb3IubWV0aG9kID0gdGhpcy5tZXRob2Q7XG4gICAgICAgIGVycm9yLnVybCA9IHRoaXMudXJsO1xuICAgICAgICByZWplY3QoZXJyb3IpO1xuICAgICAgfSk7XG4gICAgICBzZWxmLmVuZCgoZXJyb3IsIHJlcykgPT4ge1xuICAgICAgICBpZiAoZXJyb3IpIHJlamVjdChlcnJvcik7XG4gICAgICAgIGVsc2UgcmVzb2x2ZShyZXMpO1xuICAgICAgfSk7XG4gICAgfSk7XG4gIH1cblxuICByZXR1cm4gdGhpcy5fZnVsbGZpbGxlZFByb21pc2UudGhlbihyZXNvbHZlLCByZWplY3QpO1xufTtcblxuUmVxdWVzdEJhc2UucHJvdG90eXBlLmNhdGNoID0gZnVuY3Rpb24gKGNhbGxiYWNrKSB7XG4gIHJldHVybiB0aGlzLnRoZW4odW5kZWZpbmVkLCBjYWxsYmFjayk7XG59O1xuXG4vKipcbiAqIEFsbG93IGZvciBleHRlbnNpb25cbiAqL1xuXG5SZXF1ZXN0QmFzZS5wcm90b3R5cGUudXNlID0gZnVuY3Rpb24gKGZuKSB7XG4gIGZuKHRoaXMpO1xuICByZXR1cm4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GFuIG9iamVjdCBpcyBnaXZlbi5cbiAqXG4gKiBFeGFtcGxlczpcbiAqXG4gKiAgICAgICAvLyBtYW51YWwganNvblxuICogICAgICAgcmVxdWVzdC5wb3N0KCcvdXNlcicpXG4gKiAgICAgICAgIC50eXBlKCdqc29uJylcbiAqICAgICAgICAgLnNlbmQoJ3tcIm5hbWVcIjpcInRqXCJ9JylcbiAqICAgICAgICAgLmVuZChjYWxsYmFjaylcbiAqXG4gKiAgICAgICAvLyBhdXRvIGpzb25cbiAqICAgICAgIHJlcXVlc3QucG9zdCgnL3VzZXInKVxuICogICAgICAgICAuc2VuZCh7IG5hbWU6ICd0aicgfSlcbiAqICAgICAgICAgLmVuZChjYWxsYmFjaylcbiAqXG4gKiAgICAgICAvLyBtYW51YWwgeC13d3ctZm9ybS11cmxlbmNvZGVkXG4gKiAgICAgICByZXF1ZXN0LnBvc3QoJy91c2VyJylcbiAqICAgICAgICAgLnR5cGUoJ2Zvcm0nKVxuICogICAgICAgICAuc2VuZCgnbmFtZT10aicpXG4gKiAgICAgICAgIC5lbmQoY2FsbGJhY2spXG4gKlxuICogICAgICAgLy8gYXV0byB4LXd3dy1mb3JtLXVybGVuY29kZWRcbiAqICAgICAgIHJlcXVlc3QucG9zdCgnL3VzZXInKVxuICogICAgICAgICAudHlwZSgnZm9ybScpXG4gKiAgICAgICAgIC5zZW5kKHsgbmFtZTogJ3RqJyB9KVxuICogICAgICAgICAuZW5kKGNhbGxiYWNrKVxuICpcbiAqICAgICAgIC8vIGRlZmF1bHRzIHRvIHgtd3d3LWZvcm0tdXJsZW5jb2RlZFxuICogICAgICByZXF1ZXN0LnBvc3QoJy91c2VyJylcbiAqICAgICAgICAuc2VuZCgnbmFtZT10b2JpJylcbiAqICAgICAgICAuc2VuZCgnc3BlY2llcz1mZXJyZXQnKVxuICogICAgICAgIC5lbmQoY2FsbGJhY2spXG4gKlxuICogQHBhcmFtIHtTdHJpbmd8T2JqZWN0fSBkYXRhXG4gKiBAcmV0dXJ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TGlzdCI6W119 - }, - "./node_modules/superagent/lib/response-base.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - /** - * Module dependencies. - */ const utils = __webpack_require__("./node_modules/superagent/lib/utils.js"); - /** - * Expose `ResponseBase`. - */ module.exports = ResponseBase; - /** - * Initialize a new `ResponseBase`. - * - * @api public - */ function ResponseBase() {} - /** - * Get case-insensitive `field` value. - * - * @param {String} field - * @return {String} - * @api public - */ ResponseBase.prototype.get = function(field) { - return this.header[field.toLowerCase()]; - }; - /** - * Set header related properties: - * - * - `.type` the content type without params - * - * A response of "Content-Type: text/plain; charset=utf-8" - * will provide you with a `.type` of "text/plain". - * - * @param {Object} header - * @api private - */ ResponseBase.prototype._setHeaderProperties = function(header) { - // TODO: moar! - // TODO: make this a util - // content-type - const ct = header['content-type'] || ''; - this.type = utils.type(ct); - // params - const parameters = utils.params(ct); - for(const key in parameters)if (Object.prototype.hasOwnProperty.call(parameters, key)) this[key] = parameters[key]; - this.links = {}; - // links - try { - if (header.link) this.links = utils.parseLinks(header.link); - } catch (err) { - // ignore - } - }; - /** - * Set flags such as `.ok` based on `status`. - * - * For example a 2xx response will give you a `.ok` of __true__ - * whereas 5xx will be __false__ and `.error` will be __true__. The - * `.clientError` and `.serverError` are also available to be more - * specific, and `.statusType` is the class of error ranging from 1..5 - * sometimes useful for mapping respond colors etc. - * - * "sugar" properties are also defined for common cases. Currently providing: - * - * - .noContent - * - .badRequest - * - .unauthorized - * - .notAcceptable - * - .notFound - * - * @param {Number} status - * @api private - */ ResponseBase.prototype._setStatusProperties = function(status) { - const type = Math.trunc(status / 100); - // status / class - this.statusCode = status; - this.status = this.statusCode; - this.statusType = type; - // basics - this.info = 1 === type; - this.ok = 2 === type; - this.redirect = 3 === type; - this.clientError = 4 === type; - this.serverError = 5 === type; - this.error = (4 === type || 5 === type) && this.toError(); - // sugar - this.created = 201 === status; - this.accepted = 202 === status; - this.noContent = 204 === status; - this.badRequest = 400 === status; - this.unauthorized = 401 === status; - this.notAcceptable = 406 === status; - this.forbidden = 403 === status; - this.notFound = 404 === status; - this.unprocessableEntity = 422 === status; - }; - //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJ1dGlscyIsInJlcXVpcmUiLCJtb2R1bGUiLCJleHBvcnRzIiwiUmVzcG9uc2VCYXNlIiwicHJvdG90eXBlIiwiZ2V0IiwiZmllbGQiLCJoZWFkZXIiLCJ0b0xvd2VyQ2FzZSIsIl9zZXRIZWFkZXJQcm9wZXJ0aWVzIiwiY3QiLCJ0eXBlIiwicGFyYW1ldGVycyIsInBhcmFtcyIsImtleSIsIk9iamVjdCIsImhhc093blByb3BlcnR5IiwiY2FsbCIsImxpbmtzIiwibGluayIsInBhcnNlTGlua3MiLCJlcnIiLCJfc2V0U3RhdHVzUHJvcGVydGllcyIsInN0YXR1cyIsIk1hdGgiLCJ0cnVuYyIsInN0YXR1c0NvZGUiLCJzdGF0dXNUeXBlIiwiaW5mbyIsIm9rIiwicmVkaXJlY3QiLCJjbGllbnRFcnJvciIsInNlcnZlckVycm9yIiwiZXJyb3IiLCJ0b0Vycm9yIiwiY3JlYXRlZCIsImFjY2VwdGVkIiwibm9Db250ZW50IiwiYmFkUmVxdWVzdCIsInVuYXV0aG9yaXplZCIsIm5vdEFjY2VwdGFibGUiLCJmb3JiaWRkZW4iLCJub3RGb3VuZCIsInVucHJvY2Vzc2FibGVFbnRpdHkiXSwic291cmNlcyI6WyIuLi9zcmMvcmVzcG9uc2UtYmFzZS5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIE1vZHVsZSBkZXBlbmRlbmNpZXMuXG4gKi9cblxuY29uc3QgdXRpbHMgPSByZXF1aXJlKCcuL3V0aWxzJyk7XG5cbi8qKlxuICogRXhwb3NlIGBSZXNwb25zZUJhc2VgLlxuICovXG5cbm1vZHVsZS5leHBvcnRzID0gUmVzcG9uc2VCYXNlO1xuXG4vKipcbiAqIEluaXRpYWxpem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JQUFJLENBQUNpQixJQUFJLEdBQUdqQixJQUFJLEtBQUssQ0FBQztFQUN0QixJQUFJLENBQUNrQixFQUFFLEdBQUdsQixJQUFJLEtBQUssQ0FBQztFQUNwQixJQUFJLENBQUNtQixRQUFRLEdBQUduQixJQUFJLEtBQUssQ0FBQztFQUMxQixJQUFJLENBQUNvQixXQUFXLEdBQUdwQixJQUFJLEtBQUssQ0FBQztFQUM3QixJQUFJLENBQUNxQixXQUFXLEdBQUdyQixJQUFJLEtBQUssQ0FBQztFQUM3QixJQUFJLENBQUNzQixLQUFLLEdBQUd0QixJQUFJLEtBQUssQ0FBQyxJQUFJQSxJQUFJLEtBQUssQ0FBQyxHQUFHLElBQUksQ0FBQ3VCLE9BQU8sQ0FBQyxDQUFDLEdBQUcsS0FBSzs7RUFFOUQ7RUFDQSxJQUFJLENBQUNDLE9BQU8sR0FBR1osTUFBTSxLQUFLLEdBQUc7RUFDN0IsSUFBSSxDQUFDYSxRQUFRLEdBQUdiLE1BQU0sS0FBSyxHQUFHO0VBQzlCLElBQUksQ0FBQ2MsU0FBUyxHQUFHZCxNQUFNLEtBQUssR0FBRztFQUMvQixJQUFJLENBQUNlLFVBQVUsR0FBR2YsTUFBTSxLQUFLLEdBQUc7RUFDaEMsSUFBSSxDQUFDZ0IsWUFBWSxHQUFHaEIsTUFBTSxLQUFLLEdBQUc7RUFDbEMsSUFBSSxDQUFDaUIsYUFBYSxHQUFHakIsTUFBTSxLQUFLLEdBQUc7RUFDbkMsSUFBSSxDQUFDa0IsU0FBUyxHQUFHbEIsTUFBTSxLQUFLLEdBQUc7RUFDL0IsSUFBSSxDQUFDbUIsUUFBUSxHQUFHbkIsTUFBTSxLQUFLLEdBQUc7RUFDOUIsSUFBSSxDQUFDb0IsbUJBQW1CLEdBQUdwQixNQUFNLEtBQUssR0FBRztBQUMzQyxDQUFDIiwiaWdub3JlTGlzdCI6W119 - }, - "./node_modules/superagent/lib/utils.js": function(__unused_webpack_module, exports1) { - "use strict"; - /** - * Return the mime type for the given `str`. - * - * @param {String} str - * @return {String} - * @api private - */ exports1.type = (string_)=>string_.split(/ *; */).shift(); - /** - * Return header field parameters. - * - * @param {String} str - * @return {Object} - * @api private - */ exports1.params = (value)=>{ - const object = {}; - for (const string_ of value.split(/ *; */)){ - const parts = string_.split(/ *= */); - const key = parts.shift(); - const value = parts.shift(); - if (key && value) object[key] = value; - } - return object; - }; - /** - * Parse Link header fields. - * - * @param {String} str - * @return {Object} - * @api private - */ exports1.parseLinks = (value)=>{ - const object = {}; - for (const string_ of value.split(/ *, */)){ - const parts = string_.split(/ *; */); - const url = parts[0].slice(1, -1); - const rel = parts[1].split(/ *= */)[1].slice(1, -1); - object[rel] = url; - } - return object; - }; - /** - * Strip content related fields from `header`. - * - * @param {Object} header - * @return {Object} header - * @api private - */ exports1.cleanHeader = (header, changesOrigin)=>{ - delete header['content-type']; - delete header['content-length']; - delete header['transfer-encoding']; - delete header.host; - // secuirty - if (changesOrigin) { - delete header.authorization; - delete header.cookie; - } - return header; - }; - /** - * Check if `obj` is an object. - * - * @param {Object} object - * @return {Boolean} - * @api private - */ exports1.isObject = (object)=>null !== object && 'object' == typeof object; - /** - * Object.hasOwn fallback/polyfill. - * - * @type {(object: object, property: string) => boolean} object - * @api private - */ exports1.hasOwn = Object.hasOwn || function(object, property) { - if (null == object) throw new TypeError('Cannot convert undefined or null to object'); - return Object.prototype.hasOwnProperty.call(new Object(object), property); - }; - exports1.mixin = (target, source)=>{ - for(const key in source)if (exports1.hasOwn(source, key)) target[key] = source[key]; - }; - /** - * Check if the response is compressed using Gzip or Deflate. - * @param {Object} res - * @return {Boolean} - */ exports1.isGzipOrDeflateEncoding = (res)=>new RegExp(/^\s*(?:deflate|gzip)\s*$/).test(res.headers['content-encoding']); - /** - * Check if the response is compressed using Brotli. - * @param {Object} res - * @return {Boolean} - */ exports1.isBrotliEncoding = (res)=>new RegExp(/^\s*(?:br)\s*$/).test(res.headers['content-encoding']); - //# sourceMappingURL=data:application/json;char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Q0FBQyxDQUFDO0FBQzNFLENBQUMiLCJpZ25vcmVMaXN0IjpbXX0= - }, - "./node_modules/typedarray-to-buffer/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - /* provided dependency */ var Buffer = __webpack_require__("./node_modules/buffer/index.js")["Buffer"]; - /*! typedarray-to-buffer. MIT License. Feross Aboukhadijeh */ /** - * Convert a typed array to a Buffer without a copy - * - * Author: Feross Aboukhadijeh - * License: MIT - * - * `npm install typedarray-to-buffer` - */ module.exports = function(arr) { - return ArrayBuffer.isView(arr) ? Buffer.from(arr.buffer, arr.byteOffset, arr.byteLength) : Buffer.from(arr); - }; - }, - "./node_modules/util-deprecate/browser.js": function(module, __unused_webpack_exports, __webpack_require__) { - /** - * Module exports. - */ module.exports = deprecate; - /** - * Mark that a method should not be used. - * Returns a modified function which warns once by default. - * - * If `localStorage.noDeprecation = true` is set, then it is a no-op. - * - * If `localStorage.throwDeprecation = true` is set, then deprecated functions - * will throw an Error when invoked. - * - * If `localStorage.traceDeprecation = true` is set, then deprecated functions - * will invoke `console.trace()` instead of `console.error()`. - * - * @param {Function} fn - the function to deprecate - * @param {String} msg - the string to print to the console when `fn` is invoked - * @returns {Function} a new "deprecated" version of `fn` - * @api public - */ function deprecate(fn, msg) { - if (config('noDeprecation')) return fn; - var warned = false; - function deprecated() { - if (!warned) { - if (config('throwDeprecation')) throw new Error(msg); - if (config('traceDeprecation')) console.trace(msg); - else console.warn(msg); - warned = true; - } - return fn.apply(this, arguments); - } - return deprecated; - } - /** - * Checks `localStorage` for boolean values for the given `name`. - * - * @param {String} name - * @returns {Boolean} - * @api private - */ function config(name) { - // accessing global.localStorage can trigger a DOMException in sandboxed iframes - try { - if (!__webpack_require__.g.localStorage) return false; - } catch (_) { - return false; - } - var val = __webpack_require__.g.localStorage[name]; - if (null == val) return false; - return 'true' === String(val).toLowerCase(); - } - }, - "./node_modules/util/support/isBufferBrowser.js": function(module) { - module.exports = function(arg) { - return arg && 'object' == typeof arg && 'function' == typeof arg.copy && 'function' == typeof arg.fill && 'function' == typeof arg.readUInt8; - }; - }, - "./node_modules/util/support/types.js": function(__unused_webpack_module, exports1, __webpack_require__) { - "use strict"; - // Currently in sync with Node.js lib/internal/util/types.js - // https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9 - var isArgumentsObject = __webpack_require__("./node_modules/is-arguments/index.js"); - var isGeneratorFunction = __webpack_require__("./node_modules/is-generator-function/index.js"); - var whichTypedArray = __webpack_require__("./node_modules/which-typed-array/index.js"); - var isTypedArray = __webpack_require__("./node_modules/is-typed-array/index.js"); - function uncurryThis(f) { - return f.call.bind(f); - } - var BigIntSupported = 'undefined' != typeof BigInt; - var SymbolSupported = 'undefined' != typeof Symbol; - var ObjectToString = uncurryThis(Object.prototype.toString); - var numberValue = uncurryThis(Number.prototype.valueOf); - var stringValue = uncurryThis(String.prototype.valueOf); - var booleanValue = uncurryThis(Boolean.prototype.valueOf); - if (BigIntSupported) var bigIntValue = uncurryThis(BigInt.prototype.valueOf); - if (SymbolSupported) var symbolValue = uncurryThis(Symbol.prototype.valueOf); - function checkBoxedPrimitive(value, prototypeValueOf) { - if ('object' != typeof value) return false; - try { - prototypeValueOf(value); - return true; - } catch (e) { - return false; - } - } - exports1.isArgumentsObject = isArgumentsObject; - exports1.isGeneratorFunction = isGeneratorFunction; - exports1.isTypedArray = isTypedArray; - // Taken from here and modified for better browser support - // https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js - function isPromise(input) { - return 'undefined' != typeof Promise && input instanceof Promise || null !== input && 'object' == typeof input && 'function' == typeof input.then && 'function' == typeof input.catch; - } - exports1.isPromise = isPromise; - function isArrayBufferView(value) { - if ('undefined' != typeof ArrayBuffer && ArrayBuffer.isView) return ArrayBuffer.isView(value); - return isTypedArray(value) || isDataView(value); - } - exports1.isArrayBufferView = isArrayBufferView; - function isUint8Array(value) { - return 'Uint8Array' === whichTypedArray(value); - } - exports1.isUint8Array = isUint8Array; - function isUint8ClampedArray(value) { - return 'Uint8ClampedArray' === whichTypedArray(value); - } - exports1.isUint8ClampedArray = isUint8ClampedArray; - function isUint16Array(value) { - return 'Uint16Array' === whichTypedArray(value); - } - exports1.isUint16Array = isUint16Array; - function isUint32Array(value) { - return 'Uint32Array' === whichTypedArray(value); - } - exports1.isUint32Array = isUint32Array; - function isInt8Array(value) { - return 'Int8Array' === whichTypedArray(value); - } - exports1.isInt8Array = isInt8Array; - function isInt16Array(value) { - return 'Int16Array' === whichTypedArray(value); - } - exports1.isInt16Array = isInt16Array; - function isInt32Array(value) { - return 'Int32Array' === whichTypedArray(value); - } - exports1.isInt32Array = isInt32Array; - function isFloat32Array(value) { - return 'Float32Array' === whichTypedArray(value); - } - exports1.isFloat32Array = isFloat32Array; - function isFloat64Array(value) { - return 'Float64Array' === whichTypedArray(value); - } - exports1.isFloat64Array = isFloat64Array; - function isBigInt64Array(value) { - return 'BigInt64Array' === whichTypedArray(value); - } - exports1.isBigInt64Array = isBigInt64Array; - function isBigUint64Array(value) { - return 'BigUint64Array' === whichTypedArray(value); - } - exports1.isBigUint64Array = isBigUint64Array; - function isMapToString(value) { - return '[object Map]' === ObjectToString(value); - } - isMapToString.working = 'undefined' != typeof Map && isMapToString(new Map()); - function isMap(value) { - if ('undefined' == typeof Map) return false; - return isMapToString.working ? isMapToString(value) : value instanceof Map; - } - exports1.isMap = isMap; - function isSetToString(value) { - return '[object Set]' === ObjectToString(value); - } - isSetToString.working = 'undefined' != typeof Set && isSetToString(new Set()); - function isSet(value) { - if ('undefined' == typeof Set) return false; - return isSetToString.working ? isSetToString(value) : value instanceof Set; - } - exports1.isSet = isSet; - function isWeakMapToString(value) { - return '[object WeakMap]' === ObjectToString(value); - } - isWeakMapToString.working = 'undefined' != typeof WeakMap && isWeakMapToString(new WeakMap()); - function isWeakMap(value) { - if ('undefined' == typeof WeakMap) return false; - return isWeakMapToString.working ? isWeakMapToString(value) : value instanceof WeakMap; - } - exports1.isWeakMap = isWeakMap; - function isWeakSetToString(value) { - return '[object WeakSet]' === ObjectToString(value); - } - isWeakSetToString.working = 'undefined' != typeof WeakSet && isWeakSetToString(new WeakSet()); - function isWeakSet(value) { - return isWeakSetToString(value); - } - exports1.isWeakSet = isWeakSet; - function isArrayBufferToString(value) { - return '[object ArrayBuffer]' === ObjectToString(value); - } - isArrayBufferToString.working = 'undefined' != typeof ArrayBuffer && isArrayBufferToString(new ArrayBuffer()); - function isArrayBuffer(value) { - if ('undefined' == typeof ArrayBuffer) return false; - return isArrayBufferToString.working ? isArrayBufferToString(value) : value instanceof ArrayBuffer; - } - exports1.isArrayBuffer = isArrayBuffer; - function isDataViewToString(value) { - return '[object DataView]' === ObjectToString(value); - } - isDataViewToString.working = 'undefined' != typeof ArrayBuffer && 'undefined' != typeof DataView && isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1)); - function isDataView(value) { - if ('undefined' == typeof DataView) return false; - return isDataViewToString.working ? isDataViewToString(value) : value instanceof DataView; - } - exports1.isDataView = isDataView; - // Store a copy of SharedArrayBuffer in case it's deleted elsewhere - var SharedArrayBufferCopy = 'undefined' != typeof SharedArrayBuffer ? SharedArrayBuffer : void 0; - function isSharedArrayBufferToString(value) { - return '[object SharedArrayBuffer]' === ObjectToString(value); - } - function isSharedArrayBuffer(value) { - if (void 0 === SharedArrayBufferCopy) return false; - if (void 0 === isSharedArrayBufferToString.working) isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy()); - return isSharedArrayBufferToString.working ? isSharedArrayBufferToString(value) : value instanceof SharedArrayBufferCopy; - } - exports1.isSharedArrayBuffer = isSharedArrayBuffer; - function isAsyncFunction(value) { - return '[object AsyncFunction]' === ObjectToString(value); - } - exports1.isAsyncFunction = isAsyncFunction; - function isMapIterator(value) { - return '[object Map Iterator]' === ObjectToString(value); - } - exports1.isMapIterator = isMapIterator; - function isSetIterator(value) { - return '[object Set Iterator]' === ObjectToString(value); - } - exports1.isSetIterator = isSetIterator; - function isGeneratorObject(value) { - return '[object Generator]' === ObjectToString(value); - } - exports1.isGeneratorObject = isGeneratorObject; - function isWebAssemblyCompiledModule(value) { - return '[object WebAssembly.Module]' === ObjectToString(value); - } - exports1.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule; - function isNumberObject(value) { - return checkBoxedPrimitive(value, numberValue); - } - exports1.isNumberObject = isNumberObject; - function isStringObject(value) { - return checkBoxedPrimitive(value, stringValue); - } - exports1.isStringObject = isStringObject; - function isBooleanObject(value) { - return checkBoxedPrimitive(value, booleanValue); - } - exports1.isBooleanObject = isBooleanObject; - function isBigIntObject(value) { - return BigIntSupported && checkBoxedPrimitive(value, bigIntValue); - } - exports1.isBigIntObject = isBigIntObject; - function isSymbolObject(value) { - return SymbolSupported && checkBoxedPrimitive(value, symbolValue); - } - exports1.isSymbolObject = isSymbolObject; - function isBoxedPrimitive(value) { - return isNumberObject(value) || isStringObject(value) || isBooleanObject(value) || isBigIntObject(value) || isSymbolObject(value); - } - exports1.isBoxedPrimitive = isBoxedPrimitive; - function isAnyArrayBuffer(value) { - return 'undefined' != typeof Uint8Array && (isArrayBuffer(value) || isSharedArrayBuffer(value)); - } - exports1.isAnyArrayBuffer = isAnyArrayBuffer; - [ - 'isProxy', - 'isExternal', - 'isModuleNamespaceObject' - ].forEach(function(method) { - Object.defineProperty(exports1, method, { - enumerable: false, - value: function() { - throw new Error(method + ' is not supported in userland'); - } - }); - }); - }, - "./node_modules/util/util.js": function(__unused_webpack_module, exports1, __webpack_require__) { - /* provided dependency */ var process = __webpack_require__("./node_modules/process/browser.js"); - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function(obj) { - var keys = Object.keys(obj); - var descriptors = {}; - for(var i = 0; i < keys.length; i++)descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]); - return descriptors; - }; - var formatRegExp = /%[sdj%]/g; - exports1.format = function(f) { - if (!isString(f)) { - var objects = []; - for(var i = 0; i < arguments.length; i++)objects.push(inspect(arguments[i])); - return objects.join(' '); - } - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if ('%%' === x) return '%'; - if (i >= len) return x; - switch(x){ - case '%s': - return String(args[i++]); - case '%d': - return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for(var x = args[i]; i < len; x = args[++i])if (isNull(x) || !isObject(x)) str += ' ' + x; - else str += ' ' + inspect(x); - return str; - }; - // Mark that a method should not be used. - // Returns a modified function which warns once by default. - // If --no-deprecation is set, then it is a no-op. - exports1.deprecate = function(fn, msg) { - if (void 0 !== process && true === process.noDeprecation) return fn; - // Allow for deprecating things in the process of starting up. - if (void 0 === process) return function() { - return exports1.deprecate(fn, msg).apply(this, arguments); - }; - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) throw new Error(msg); - if (process.traceDeprecation) console.trace(msg); - else console.error(msg); - warned = true; - } - return fn.apply(this, arguments); - } - return deprecated; - }; - var debugs = {}; - var debugEnvRegex = /^$/; - if (process.env.NODE_DEBUG) { - var debugEnv = process.env.NODE_DEBUG; - debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&').replace(/\*/g, '.*').replace(/,/g, '$|^').toUpperCase(); - debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i'); - } - exports1.debuglog = function(set) { - set = set.toUpperCase(); - if (!debugs[set]) { - if (debugEnvRegex.test(set)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports1.format.apply(exports1, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else debugs[set] = function() {}; - } - return debugs[set]; - }; - /** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ /* legacy: obj, showHidden, depth, colors*/ function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) // legacy... - ctx.showHidden = opts; - else if (opts) // got an "options" object - exports1._extend(ctx, opts); - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); - } - exports1.inspect = inspect; - // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics - inspect.colors = { - bold: [ - 1, - 22 - ], - italic: [ - 3, - 23 - ], - underline: [ - 4, - 24 - ], - inverse: [ - 7, - 27 - ], - white: [ - 37, - 39 - ], - grey: [ - 90, - 39 - ], - black: [ - 30, - 39 - ], - blue: [ - 34, - 39 - ], - cyan: [ - 36, - 39 - ], - green: [ - 32, - 39 - ], - magenta: [ - 35, - 39 - ], - red: [ - 31, - 39 - ], - yellow: [ - 33, - 39 - ] - }; - // Don't use 'blue' not visible on cmd.exe - inspect.styles = { - special: 'cyan', - number: 'yellow', - boolean: 'yellow', - undefined: 'grey', - null: 'bold', - string: 'green', - date: 'magenta', - // "name": intentionally not styling - regexp: 'red' - }; - function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - if (style) return '\u001b[' + inspect.colors[style][0] + 'm' + str + '\u001b[' + inspect.colors[style][1] + 'm'; - return str; - } - function stylizeNoColor(str, styleType) { - return str; - } - function arrayToHash(array) { - var hash = {}; - array.forEach(function(val, idx) { - hash[val] = true; - }); - return hash; - } - function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special - value.inspect !== exports1.inspect && // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) ret = formatValue(ctx, ret, recurseTimes); - return ret; - } - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) return primitive; - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - if (ctx.showHidden) keys = Object.getOwnPropertyNames(value); - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) return formatError(value); - // Some type of object without properties can be shortcutted. - if (0 === keys.length) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - if (isDate(value)) return ctx.stylize(Date.prototype.toString.call(value), 'date'); - if (isError(value)) return formatError(value); - } - var base = '', array = false, braces = [ - '{', - '}' - ]; - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = [ - '[', - ']' - ]; - } - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } - // Make RegExps say that they are RegExps - if (isRegExp(value)) base = ' ' + RegExp.prototype.toString.call(value); - // Make dates with properties first say the date - if (isDate(value)) base = ' ' + Date.prototype.toUTCString.call(value); - // Make error with message first say the error - if (isError(value)) base = ' ' + formatError(value); - if (0 === keys.length && (!array || 0 == value.length)) return braces[0] + base + braces[1]; - if (recurseTimes < 0) { - if (isRegExp(value)) return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - return ctx.stylize('[Object]', 'special'); - } - ctx.seen.push(value); - var output; - output = array ? formatArray(ctx, value, recurseTimes, visibleKeys, keys) : keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - ctx.seen.pop(); - return reduceToSingleString(output, base, braces); - } - function formatPrimitive(ctx, value) { - if (isUndefined(value)) return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '').replace(/'/g, "\\'").replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) return ctx.stylize('null', 'null'); - } - function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; - } - function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for(var i = 0, l = value.length; i < l; ++i)if (hasOwnProperty(value, String(i))) output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true)); - else output.push(''); - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true)); - }); - return output; - } - function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { - value: value[key] - }; - if (desc.get) str = desc.set ? ctx.stylize('[Getter/Setter]', 'special') : ctx.stylize('[Getter]', 'special'); - else if (desc.set) str = ctx.stylize('[Setter]', 'special'); - if (!hasOwnProperty(visibleKeys, key)) name = '[' + key + ']'; - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - str = isNull(recurseTimes) ? formatValue(ctx, desc.value, null) : formatValue(ctx, desc.value, recurseTimes - 1); - if (str.indexOf('\n') > -1) str = array ? str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').slice(2) : '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } else str = ctx.stylize('[Circular]', 'special'); - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) return str; - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.slice(1, -1); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - return name + ': ' + str; - } - function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - if (length > 60) return braces[0] + ('' === base ? '' : base + '\n ') + ' ' + output.join(',\n ') + ' ' + braces[1]; - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; - } - // NOTE: These type checking functions intentionally don't use `instanceof` - // because it is fragile and can be easily faked with `Object.create()`. - exports1.types = __webpack_require__("./node_modules/util/support/types.js"); - function isArray(ar) { - return Array.isArray(ar); - } - exports1.isArray = isArray; - function isBoolean(arg) { - return 'boolean' == typeof arg; - } - exports1.isBoolean = isBoolean; - function isNull(arg) { - return null === arg; - } - exports1.isNull = isNull; - function isNullOrUndefined(arg) { - return null == arg; - } - exports1.isNullOrUndefined = isNullOrUndefined; - function isNumber(arg) { - return 'number' == typeof arg; - } - exports1.isNumber = isNumber; - function isString(arg) { - return 'string' == typeof arg; - } - exports1.isString = isString; - function isSymbol(arg) { - return 'symbol' == typeof arg; - } - exports1.isSymbol = isSymbol; - function isUndefined(arg) { - return void 0 === arg; - } - exports1.isUndefined = isUndefined; - function isRegExp(re) { - return isObject(re) && '[object RegExp]' === objectToString(re); - } - exports1.isRegExp = isRegExp; - exports1.types.isRegExp = isRegExp; - function isObject(arg) { - return 'object' == typeof arg && null !== arg; - } - exports1.isObject = isObject; - function isDate(d) { - return isObject(d) && '[object Date]' === objectToString(d); - } - exports1.isDate = isDate; - exports1.types.isDate = isDate; - function isError(e) { - return isObject(e) && ('[object Error]' === objectToString(e) || e instanceof Error); - } - exports1.isError = isError; - exports1.types.isNativeError = isError; - function isFunction(arg) { - return 'function' == typeof arg; - } - exports1.isFunction = isFunction; - function isPrimitive(arg) { - return null === arg || 'boolean' == typeof arg || 'number' == typeof arg || 'string' == typeof arg || 'symbol' == typeof arg || // ES6 symbol - void 0 === arg; - } - exports1.isPrimitive = isPrimitive; - exports1.isBuffer = __webpack_require__("./node_modules/util/support/isBufferBrowser.js"); - function objectToString(o) { - return Object.prototype.toString.call(o); - } - function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); - } - var months = [ - 'Jan', - 'Feb', - 'Mar', - 'Apr', - 'May', - 'Jun', - 'Jul', - 'Aug', - 'Sep', - 'Oct', - 'Nov', - 'Dec' - ]; - // 26 Feb 16:19:34 - function timestamp() { - var d = new Date(); - var time = [ - pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds()) - ].join(':'); - return [ - d.getDate(), - months[d.getMonth()], - time - ].join(' '); - } - // log is just a thin wrapper to console.log that prepends a timestamp - exports1.log = function() { - console.log('%s - %s', timestamp(), exports1.format.apply(exports1, arguments)); - }; - /** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ exports1.inherits = __webpack_require__("./node_modules/inherits/inherits_browser.js"); - exports1._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - var keys = Object.keys(add); - var i = keys.length; - while(i--)origin[keys[i]] = add[keys[i]]; - return origin; - }; - function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); - } - var kCustomPromisifiedSymbol = 'undefined' != typeof Symbol ? Symbol('util.promisify.custom') : void 0; - exports1.promisify = function(original) { - if ('function' != typeof original) throw new TypeError('The "original" argument must be of type Function'); - if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) { - var fn = original[kCustomPromisifiedSymbol]; - if ('function' != typeof fn) throw new TypeError('The "util.promisify.custom" argument must be of type Function'); - Object.defineProperty(fn, kCustomPromisifiedSymbol, { - value: fn, - enumerable: false, - writable: false, - configurable: true - }); - return fn; - } - function fn() { - var promiseResolve, promiseReject; - var promise = new Promise(function(resolve, reject) { - promiseResolve = resolve; - promiseReject = reject; - }); - var args = []; - for(var i = 0; i < arguments.length; i++)args.push(arguments[i]); - args.push(function(err, value) { - if (err) promiseReject(err); - else promiseResolve(value); - }); - try { - original.apply(this, args); - } catch (err) { - promiseReject(err); - } - return promise; - } - Object.setPrototypeOf(fn, Object.getPrototypeOf(original)); - if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, { - value: fn, - enumerable: false, - writable: false, - configurable: true - }); - return Object.defineProperties(fn, getOwnPropertyDescriptors(original)); - }; - exports1.promisify.custom = kCustomPromisifiedSymbol; - function callbackifyOnRejected(reason, cb) { - // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M). - // Because `null` is a special error value in callbacks which means "no error - // occurred", we error-wrap so the callback consumer can distinguish between - // "the promise rejected with null" or "the promise fulfilled with undefined". - if (!reason) { - var newReason = new Error('Promise was rejected with a falsy value'); - newReason.reason = reason; - reason = newReason; - } - return cb(reason); - } - function callbackify(original) { - if ('function' != typeof original) throw new TypeError('The "original" argument must be of type Function'); - // We DO NOT return the promise as it gives the user a false sense that - // the promise is actually somehow related to the callback's execution - // and that the callback throwing will reject the promise. - function callbackified() { - var args = []; - for(var i = 0; i < arguments.length; i++)args.push(arguments[i]); - var maybeCb = args.pop(); - if ('function' != typeof maybeCb) throw new TypeError('The last argument must be of type Function'); - var self1 = this; - var cb = function() { - return maybeCb.apply(self1, arguments); - }; - // In true node style we process the callback on `nextTick` with all the - // implications (stack, `uncaughtException`, `async_hooks`) - original.apply(this, args).then(function(ret) { - process.nextTick(cb.bind(null, null, ret)); - }, function(rej) { - process.nextTick(callbackifyOnRejected.bind(null, rej, cb)); - }); - } - Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original)); - Object.defineProperties(callbackified, getOwnPropertyDescriptors(original)); - return callbackified; - } - exports1.callbackify = callbackify; - }, - "./node_modules/websocket-stream/node_modules/readable-stream/lib/_stream_duplex.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - // a duplex stream is just a stream that is both readable and writable. - // Since JS doesn't have multiple prototypal inheritance, this class - // prototypally inherits from Readable, and then parasitically from - // Writable. - /**/ var pna = __webpack_require__("./node_modules/process-nextick-args/index.js"); - /**/ /**/ var objectKeys = Object.keys || function(obj) { - var keys = []; - for(var key in obj)keys.push(key); - return keys; - }; - /**/ module.exports = Duplex; - /**/ var util = Object.create(__webpack_require__("./node_modules/core-util-is/lib/util.js")); - util.inherits = __webpack_require__("./node_modules/inherits/inherits_browser.js"); - /**/ var Readable = __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/lib/_stream_readable.js"); - var Writable = __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/lib/_stream_writable.js"); - util.inherits(Duplex, Readable); - // avoid scope creep, the keys array can then be collected - var keys = objectKeys(Writable.prototype); - for(var v = 0; v < keys.length; v++){ - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; - } - function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options); - Readable.call(this, options); - Writable.call(this, options); - if (options && false === options.readable) this.readable = false; - if (options && false === options.writable) this.writable = false; - this.allowHalfOpen = true; - if (options && false === options.allowHalfOpen) this.allowHalfOpen = false; - this.once('end', onend); - } - Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function() { - return this._writableState.highWaterMark; - } - }); - // the no-half-open enforcer - function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) return; - // no more data can be written. - // But allow more writes to happen in this tick. - pna.nextTick(onEndNT, this); - } - function onEndNT(self1) { - self1.end(); - } - Object.defineProperty(Duplex.prototype, 'destroyed', { - get: function() { - if (void 0 === this._readableState || void 0 === this._writableState) return false; - return this._readableState.destroyed && this._writableState.destroyed; - }, - set: function(value) { - // we ignore the value if the stream - // has not been initialized yet - if (void 0 === this._readableState || void 0 === this._writableState) return; - // backward compatibility, the user is explicitly - // managing destroyed - this._readableState.destroyed = value; - this._writableState.destroyed = value; - } - }); - Duplex.prototype._destroy = function(err, cb) { - this.push(null); - this.end(); - pna.nextTick(cb, err); - }; - }, - "./node_modules/websocket-stream/node_modules/readable-stream/lib/_stream_passthrough.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - // a passthrough stream. - // basically just the most minimal sort of Transform stream. - // Every written chunk gets output as-is. - module.exports = PassThrough; - var Transform = __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/lib/_stream_transform.js"); - /**/ var util = Object.create(__webpack_require__("./node_modules/core-util-is/lib/util.js")); - util.inherits = __webpack_require__("./node_modules/inherits/inherits_browser.js"); - /**/ util.inherits(PassThrough, Transform); - function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options); - Transform.call(this, options); - } - PassThrough.prototype._transform = function(chunk, encoding, cb) { - cb(null, chunk); - }; - }, - "./node_modules/websocket-stream/node_modules/readable-stream/lib/_stream_readable.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - /* provided dependency */ var process = __webpack_require__("./node_modules/process/browser.js"); - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - /**/ var pna = __webpack_require__("./node_modules/process-nextick-args/index.js"); - /**/ module.exports = Readable; - /**/ var isArray = __webpack_require__("./node_modules/isarray/index.js"); - /**/ /**/ var Duplex; - /**/ Readable.ReadableState = ReadableState; - /**/ __webpack_require__("./node_modules/events/events.js")/* .EventEmitter */ .EventEmitter; - var EElistenerCount = function(emitter, type) { - return emitter.listeners(type).length; - }; - /**/ /**/ var Stream = __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/lib/internal/streams/stream-browser.js"); - /**/ /**/ var Buffer = __webpack_require__("./node_modules/websocket-stream/node_modules/safe-buffer/index.js")/* .Buffer */ .Buffer; - var OurUint8Array = (void 0 !== __webpack_require__.g ? __webpack_require__.g : 'undefined' != typeof window ? window : 'undefined' != typeof self ? self : {}).Uint8Array || function() {}; - function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); - } - function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; - } - /**/ /**/ var util = Object.create(__webpack_require__("./node_modules/core-util-is/lib/util.js")); - util.inherits = __webpack_require__("./node_modules/inherits/inherits_browser.js"); - /**/ /**/ var debugUtil = __webpack_require__("?5eec"); - var debug = void 0; - debug = debugUtil && debugUtil.debuglog ? debugUtil.debuglog('stream') : function() {}; - /**/ var BufferList = __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/lib/internal/streams/BufferList.js"); - var destroyImpl = __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/lib/internal/streams/destroy.js"); - var StringDecoder; - util.inherits(Readable, Stream); - var kProxyEvents = [ - 'error', - 'close', - 'destroy', - 'pause', - 'resume' - ]; - function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if ('function' == typeof emitter.prependListener) return emitter.prependListener(event, fn); - // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - if (emitter._events && emitter._events[event]) { - if (isArray(emitter._events[event])) emitter._events[event].unshift(fn); - else emitter._events[event] = [ - fn, - emitter._events[event] - ]; - } else emitter.on(event, fn); - } - function ReadableState(options, stream) { - Duplex = Duplex || __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/lib/_stream_duplex.js"); - options = options || {}; - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - var isDuplex = stream instanceof Duplex; - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; - if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - var readableHwm = options.readableHighWaterMark; - var defaultHwm = this.objectMode ? 16 : 16384; - if (hwm || 0 === hwm) this.highWaterMark = hwm; - else if (isDuplex && (readableHwm || 0 === readableHwm)) this.highWaterMark = readableHwm; - else this.highWaterMark = defaultHwm; - // cast to ints. - this.highWaterMark = Math.floor(this.highWaterMark); - // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift() - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; - // a flag to be able to tell if the event 'readable'/'data' is emitted - // immediately, or on a later tick. We set this to true at first, because - // any actions that shouldn't happen until "later" should generally also - // not happen before the first read call. - this.sync = true; - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - // has it been destroyed - this.destroyed = false; - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; - // if true, a maybeReadMore has been scheduled - this.readingMore = false; - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) StringDecoder = __webpack_require__("./node_modules/websocket-stream/node_modules/string_decoder/lib/string_decoder.js")/* .StringDecoder */ .StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } - } - function Readable(options) { - Duplex = Duplex || __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/lib/_stream_duplex.js"); - if (!(this instanceof Readable)) return new Readable(options); - this._readableState = new ReadableState(options, this); - // legacy - this.readable = true; - if (options) { - if ('function' == typeof options.read) this._read = options.read; - if ('function' == typeof options.destroy) this._destroy = options.destroy; - } - Stream.call(this); - } - Object.defineProperty(Readable.prototype, 'destroyed', { - get: function() { - if (void 0 === this._readableState) return false; - return this._readableState.destroyed; - }, - set: function(value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._readableState) return; - // backward compatibility, the user is explicitly - // managing destroyed - this._readableState.destroyed = value; - } - }); - Readable.prototype.destroy = destroyImpl.destroy; - Readable.prototype._undestroy = destroyImpl.undestroy; - Readable.prototype._destroy = function(err, cb) { - this.push(null); - cb(err); - }; - // Manually shove something into the read() buffer. - // This returns true if the highWaterMark has not been hit yet, - // similar to how Writable.write() returns true if you should - // write() some more. - Readable.prototype.push = function(chunk, encoding) { - var state = this._readableState; - var skipChunkCheck; - if (state.objectMode) skipChunkCheck = true; - else if ('string' == typeof chunk) { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = Buffer.from(chunk, encoding); - encoding = ''; - } - skipChunkCheck = true; - } - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); - }; - // Unshift should *always* be something directly out of read() - Readable.prototype.unshift = function(chunk) { - return readableAddChunk(this, chunk, null, true, false); - }; - function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { - var state = stream._readableState; - if (null === chunk) { - state.reading = false; - onEofChunk(stream, state); - } else { - var er; - if (!skipChunkCheck) er = chunkInvalid(state, chunk); - if (er) stream.emit('error', er); - else if (state.objectMode || chunk && chunk.length > 0) { - if ('string' != typeof chunk && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) chunk = _uint8ArrayToBuffer(chunk); - if (addToFront) { - if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event')); - else addChunk(stream, state, chunk, true); - } else if (state.ended) stream.emit('error', new Error('stream.push() after EOF')); - else { - state.reading = false; - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk); - if (state.objectMode || 0 !== chunk.length) addChunk(stream, state, chunk, false); - else maybeReadMore(stream, state); - } else addChunk(stream, state, chunk, false); - } - } else if (!addToFront) state.reading = false; - } - return needMoreData(state); - } - function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && 0 === state.length && !state.sync) { - stream.emit('data', chunk); - stream.read(0); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk); - else state.buffer.push(chunk); - if (state.needReadable) emitReadable(stream); - } - maybeReadMore(stream, state); - } - function chunkInvalid(state, chunk) { - var er; - if (!_isUint8Array(chunk) && 'string' != typeof chunk && void 0 !== chunk && !state.objectMode) er = new TypeError('Invalid non-string/buffer chunk'); - return er; - } - // if it's past the high water mark, we can push in some more. - // Also, if we have no data yet, we can stand some - // more bytes. This is to work around cases where hwm=0, - // such as the repl. Also, if the push() triggered a - // readable event, and the user called read(largeNumber) such that - // needReadable was set, then we ought to push more, so that another - // 'readable' event will be triggered. - function needMoreData(state) { - return !state.ended && (state.needReadable || state.length < state.highWaterMark || 0 === state.length); - } - Readable.prototype.isPaused = function() { - return false === this._readableState.flowing; - }; - // backwards compatibility. - Readable.prototype.setEncoding = function(enc) { - if (!StringDecoder) StringDecoder = __webpack_require__("./node_modules/websocket-stream/node_modules/string_decoder/lib/string_decoder.js")/* .StringDecoder */ .StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; - return this; - }; - // Don't raise the hwm > 8MB - var MAX_HWM = 0x800000; - function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) n = MAX_HWM; - else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - return n; - } - // This function is designed to be inlinable, so please take care when making - // changes to the function body. - function howMuchToRead(n, state) { - if (n <= 0 || 0 === state.length && state.ended) return 0; - if (state.objectMode) return 1; - if (n !== n) { - // Only flow one buffer at a time - if (state.flowing && state.length) return state.buffer.head.data.length; - return state.length; - } - // If we're asking for more than the current hwm, then raise the hwm. - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) return n; - // Don't have enough - if (!state.ended) { - state.needReadable = true; - return 0; - } - return state.length; - } - // you can override either this method, or the async _read(n) below. - Readable.prototype.read = function(n) { - debug('read', n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; - if (0 !== n) state.emittedReadable = false; - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (0 === n && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (0 === state.length && state.ended) endReadable(this); - else emitReadable(this); - return null; - } - n = howMuchToRead(n, state); - // if we've ended, and we're now clear, then finish it up. - if (0 === n && state.ended) { - if (0 === state.length) endReadable(this); - return null; - } - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - debug('need readable', doRead); - // if we currently have less than the highWaterMark, then also read some - if (0 === state.length || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } else if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (0 === state.length) state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (!state.reading) n = howMuchToRead(nOrig, state); - } - var ret; - ret = n > 0 ? fromList(n, state) : null; - if (null === ret) { - state.needReadable = true; - n = 0; - } else state.length -= n; - if (0 === state.length) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true; - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended) endReadable(this); - } - if (null !== ret) this.emit('data', ret); - return ret; - }; - function onEofChunk(stream, state) { - if (state.ended) return; - if (state.decoder) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - // emit 'readable' now to make sure it gets picked up. - emitReadable(stream); - } - // Don't emit readable right away in sync mode, because this can trigger - // another read() call => stack overflow. This way, it might trigger - // a nextTick recursion warning, but that's not so bad. - function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - if (state.sync) pna.nextTick(emitReadable_, stream); - else emitReadable_(stream); - } - } - function emitReadable_(stream) { - debug('emit readable'); - stream.emit('readable'); - flow(stream); - } - // at this point, the user has presumably seen the 'readable' event, - // and called read() to consume some data. that may have triggered - // in turn another _read(n) call, in which case reading = true if - // it's in progress. - // However, if we're not ended, or reading, and the length < hwm, - // then go ahead and try to read some more preemptively. - function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - pna.nextTick(maybeReadMore_, stream, state); - } - } - function maybeReadMore_(stream, state) { - var len = state.length; - while(!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark){ - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) break; - len = state.length; - } - state.readingMore = false; - } - // abstract method. to be overridden in specific implementation classes. - // call cb(er, data) where data is <= n in length. - // for virtual (non-string, non-buffer) streams, "length" is somewhat - // arbitrary, and perhaps not very meaningful. - Readable.prototype._read = function(n) { - this.emit('error', new Error('_read() is not implemented')); - }; - Readable.prototype.pipe = function(dest, pipeOpts) { - var src = this; - var state = this._readableState; - switch(state.pipesCount){ - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [ - state.pipes, - dest - ]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - var doEnd = (!pipeOpts || false !== pipeOpts.end) && dest !== process.stdout && dest !== process.stderr; - var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) pna.nextTick(endFn); - else src.once('end', endFn); - dest.on('unpipe', onunpipe); - function onunpipe(readable, unpipeInfo) { - debug('onunpipe'); - if (readable === src) { - if (unpipeInfo && false === unpipeInfo.hasUnpiped) { - unpipeInfo.hasUnpiped = true; - cleanup(); - } - } - } - function onend() { - debug('onend'); - dest.end(); - } - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - var cleanedUp = false; - function cleanup() { - debug('cleanup'); - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', unpipe); - src.removeListener('data', ondata); - cleanedUp = true; - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); - } - // If the user pushes more data while we're writing to dest then we'll end up - // in ondata again. However, we only want to increase awaitDrain once because - // dest will only emit one 'drain' event for the multiple writes. - // => Introduce a guard on increasing awaitDrain. - var increasedAwaitDrain = false; - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - increasedAwaitDrain = false; - var ret = dest.write(chunk); - if (false === ret && !increasedAwaitDrain) { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if ((1 === state.pipesCount && state.pipes === dest || state.pipesCount > 1 && -1 !== indexOf(state.pipes, dest)) && !cleanedUp) { - debug('false write response, pause', state.awaitDrain); - state.awaitDrain++; - increasedAwaitDrain = true; - } - src.pause(); - } - } - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (0 === EElistenerCount(dest, 'error')) dest.emit('error', er); - } - // Make sure our error handler is attached before userland ones. - prependListener(dest, 'error', onerror); - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } - // tell the dest that it's being piped to - dest.emit('pipe', src); - // start the flow if it hasn't been started already. - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } - return dest; - }; - function pipeOnDrain(src) { - return function() { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) state.awaitDrain--; - if (0 === state.awaitDrain && EElistenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; - } - Readable.prototype.unpipe = function(dest) { - var state = this._readableState; - var unpipeInfo = { - hasUnpiped: false - }; - // if we're not piping anywhere, then do nothing. - if (0 === state.pipesCount) return this; - // just one destination. most common case. - if (1 === state.pipesCount) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) return this; - if (!dest) dest = state.pipes; - // got a match. - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) dest.emit('unpipe', this, unpipeInfo); - return this; - } - // slow case. multiple pipe destinations. - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - for(var i = 0; i < len; i++)dests[i].emit('unpipe', this, { - hasUnpiped: false - }); - return this; - } - // try to find the right one. - var index = indexOf(state.pipes, dest); - if (-1 === index) return this; - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (1 === state.pipesCount) state.pipes = state.pipes[0]; - dest.emit('unpipe', this, unpipeInfo); - return this; - }; - // set up data events if they are asked for - // Ensure readable listeners eventually get something - Readable.prototype.on = function(ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - if ('data' === ev) // Start flowing on next tick if stream isn't explicitly paused - { - if (false !== this._readableState.flowing) this.resume(); - } else if ('readable' === ev) { - var state = this._readableState; - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.emittedReadable = false; - if (state.reading) { - if (state.length) emitReadable(this); - } else pna.nextTick(nReadingNextTick, this); - } - } - return res; - }; - Readable.prototype.addListener = Readable.prototype.on; - function nReadingNextTick(self1) { - debug('readable nexttick read 0'); - self1.read(0); - } - // pause() and resume() are remnants of the legacy readable stream API - // If the user uses them, then switch into old mode. - Readable.prototype.resume = function() { - var state = this._readableState; - if (!state.flowing) { - debug('resume'); - state.flowing = true; - resume(this, state); - } - return this; - }; - function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - pna.nextTick(resume_, stream, state); - } - } - function resume_(stream, state) { - if (!state.reading) { - debug('resume read 0'); - stream.read(0); - } - state.resumeScheduled = false; - state.awaitDrain = 0; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) stream.read(0); - } - Readable.prototype.pause = function() { - debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - return this; - }; - function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - while(state.flowing && null !== stream.read()); - } - // wrap an old-style stream as the async data source. - // This is *not* part of the readable stream interface. - // It is an ugly unfortunate mess of history. - Readable.prototype.wrap = function(stream) { - var _this = this; - var state = this._readableState; - var paused = false; - stream.on('end', function() { - debug('wrapped end'); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) _this.push(chunk); - } - _this.push(null); - }); - stream.on('data', function(chunk) { - debug('wrapped data'); - if (state.decoder) chunk = state.decoder.write(chunk); - // don't skip over falsy values in objectMode - if (state.objectMode && null == chunk) return; - if (!state.objectMode && (!chunk || !chunk.length)) return; - var ret = _this.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - // proxy all the other methods. - // important when wrapping filters and duplexes. - for(var i in stream)if (void 0 === this[i] && 'function' == typeof stream[i]) this[i] = function(method) { - return function() { - return stream[method].apply(stream, arguments); - }; - }(i); - // proxy certain important events. - for(var n = 0; n < kProxyEvents.length; n++)stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - // when we try to consume some more bytes, simply unpause the - // underlying stream. - this._read = function(n) { - debug('wrapped _read', n); - if (paused) { - paused = false; - stream.resume(); - } - }; - return this; - }; - Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function() { - return this._readableState.highWaterMark; - } - }); - // exposed for testing purposes only. - Readable._fromList = fromList; - // Pluck off n bytes from an array of buffers. - // Length is the combined lengths of all the buffers in the list. - // This function is designed to be inlinable, so please take care when making - // changes to the function body. - function fromList(n, state) { - // nothing buffered - if (0 === state.length) return null; - var ret; - if (state.objectMode) ret = state.buffer.shift(); - else if (!n || n >= state.length) { - // read it all, truncate the list - ret = state.decoder ? state.buffer.join('') : 1 === state.buffer.length ? state.buffer.head.data : state.buffer.concat(state.length); - state.buffer.clear(); - } else // read part of list - ret = fromListPartial(n, state.buffer, state.decoder); - return ret; - } - // Extracts only enough buffered data to satisfy the amount requested. - // This function is designed to be inlinable, so please take care when making - // changes to the function body. - function fromListPartial(n, list, hasStrings) { - var ret; - if (n < list.head.data.length) { - // slice is the same for buffers and strings - ret = list.head.data.slice(0, n); - list.head.data = list.head.data.slice(n); - } else // first chunk is a perfect match - ret = n === list.head.data.length ? list.shift() : hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); - return ret; - } - // Copies a specified amount of characters from the list of buffered data - // chunks. - // This function is designed to be inlinable, so please take care when making - // changes to the function body. - function copyFromBufferString(n, list) { - var p = list.head; - var c = 1; - var ret = p.data; - n -= ret.length; - while(p = p.next){ - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) ret += str; - else ret += str.slice(0, n); - n -= nb; - if (0 === n) { - if (nb === str.length) { - ++c; - if (p.next) list.head = p.next; - else list.head = list.tail = null; - } else { - list.head = p; - p.data = str.slice(nb); - } - break; - } - ++c; - } - list.length -= c; - return ret; - } - // Copies a specified amount of bytes from the list of buffered data chunks. - // This function is designed to be inlinable, so please take care when making - // changes to the function body. - function copyFromBuffer(n, list) { - var ret = Buffer.allocUnsafe(n); - var p = list.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; - while(p = p.next){ - var buf = p.data; - var nb = n > buf.length ? buf.length : n; - buf.copy(ret, ret.length - n, 0, nb); - n -= nb; - if (0 === n) { - if (nb === buf.length) { - ++c; - if (p.next) list.head = p.next; - else list.head = list.tail = null; - } else { - list.head = p; - p.data = buf.slice(nb); - } - break; - } - ++c; - } - list.length -= c; - return ret; - } - function endReadable(stream) { - var state = stream._readableState; - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); - if (!state.endEmitted) { - state.ended = true; - pna.nextTick(endReadableNT, state, stream); - } - } - function endReadableNT(state, stream) { - // Check that we didn't get one last unshift. - if (!state.endEmitted && 0 === state.length) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } - } - function indexOf(xs, x) { - for(var i = 0, l = xs.length; i < l; i++)if (xs[i] === x) return i; - return -1; - } - }, - "./node_modules/websocket-stream/node_modules/readable-stream/lib/_stream_transform.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - // a transform stream is a readable/writable stream where you do - // something with the data. Sometimes it's called a "filter", - // but that's not a great name for it, since that implies a thing where - // some bits pass through, and others are simply ignored. (That would - // be a valid example of a transform, of course.) - // - // While the output is causally related to the input, it's not a - // necessarily symmetric or synchronous transformation. For example, - // a zlib stream might take multiple plain-text writes(), and then - // emit a single compressed chunk some time in the future. - // - // Here's how this works: - // - // The Transform stream has all the aspects of the readable and writable - // stream classes. When you write(chunk), that calls _write(chunk,cb) - // internally, and returns false if there's a lot of pending writes - // buffered up. When you call read(), that calls _read(n) until - // there's enough pending readable data buffered up. - // - // In a transform stream, the written data is placed in a buffer. When - // _read(n) is called, it transforms the queued up data, calling the - // buffered _write cb's as it consumes chunks. If consuming a single - // written chunk would result in multiple output chunks, then the first - // outputted bit calls the readcb, and subsequent chunks just go into - // the read buffer, and will cause it to emit 'readable' if necessary. - // - // This way, back-pressure is actually determined by the reading side, - // since _read has to be called to start processing a new chunk. However, - // a pathological inflate type of transform can cause excessive buffering - // here. For example, imagine a stream where every byte of input is - // interpreted as an integer from 0-255, and then results in that many - // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in - // 1kb of data being output. In this case, you could write a very small - // amount of input, and end up with a very large amount of output. In - // such a pathological inflating mechanism, there'd be no way to tell - // the system to stop doing the transform. A single 4MB write could - // cause the system to run out of memory. - // - // However, even in such a pathological case, only a single written chunk - // would be consumed, and then the rest would wait (un-transformed) until - // the results of the previous transformed chunk were consumed. - module.exports = Transform; - var Duplex = __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/lib/_stream_duplex.js"); - /**/ var util = Object.create(__webpack_require__("./node_modules/core-util-is/lib/util.js")); - util.inherits = __webpack_require__("./node_modules/inherits/inherits_browser.js"); - /**/ util.inherits(Transform, Duplex); - function afterTransform(er, data) { - var ts = this._transformState; - ts.transforming = false; - var cb = ts.writecb; - if (!cb) return this.emit('error', new Error('write callback called multiple times')); - ts.writechunk = null; - ts.writecb = null; - if (null != data) this.push(data); - cb(er); - var rs = this._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); - } - function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options); - Duplex.call(this, options); - this._transformState = { - afterTransform: afterTransform.bind(this), - needTransform: false, - transforming: false, - writecb: null, - writechunk: null, - writeencoding: null - }; - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; - if (options) { - if ('function' == typeof options.transform) this._transform = options.transform; - if ('function' == typeof options.flush) this._flush = options.flush; - } - // When the writable side finishes, then flush out anything remaining. - this.on('prefinish', prefinish); - } - function prefinish() { - var _this = this; - if ('function' == typeof this._flush) this._flush(function(er, data) { - done(_this, er, data); - }); - else done(this, null, null); - } - Transform.prototype.push = function(chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); - }; - // This is the part where you do stuff! - // override this function in implementation classes. - // 'chunk' is an input chunk. - // - // Call `push(newChunk)` to pass along transformed output - // to the readable side. You may call 'push' zero or more times. - // - // Call `cb(err)` when you are done with this chunk. If you pass - // an error, then that'll put the hurt on the whole operation. If you - // never call cb(), then you'll never get another chunk. - Transform.prototype._transform = function(chunk, encoding, cb) { - throw new Error('_transform() is not implemented'); - }; - Transform.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); - } - }; - // Doesn't matter what the args are here. - // _transform does all the work. - // That we got here means that the readable side wants more data. - Transform.prototype._read = function(n) { - var ts = this._transformState; - if (null !== ts.writechunk && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - }; - Transform.prototype._destroy = function(err, cb) { - var _this2 = this; - Duplex.prototype._destroy.call(this, err, function(err2) { - cb(err2); - _this2.emit('close'); - }); - }; - function done(stream, er, data) { - if (er) return stream.emit('error', er); - if (null != data) stream.push(data); - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0'); - if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming'); - return stream.push(null); - } - }, - "./node_modules/websocket-stream/node_modules/readable-stream/lib/_stream_writable.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - /* provided dependency */ var process = __webpack_require__("./node_modules/process/browser.js"); - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - // A bit simpler than readable streams. - // Implement an async ._write(chunk, encoding, cb), and it'll handle all - // the drain event emission and buffering. - /**/ var pna = __webpack_require__("./node_modules/process-nextick-args/index.js"); - /**/ module.exports = Writable; - // It seems a linked list but it is not - // there will be only 2 of these for each stream - function CorkedRequest(state) { - var _this = this; - this.next = null; - this.entry = null; - this.finish = function() { - onCorkedFinish(_this, state); - }; - } - /* */ /**/ var asyncWrite = !process.browser && [ - 'v0.10', - 'v0.9.' - ].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; - /**/ /**/ var Duplex; - /**/ Writable.WritableState = WritableState; - /**/ var util = Object.create(__webpack_require__("./node_modules/core-util-is/lib/util.js")); - util.inherits = __webpack_require__("./node_modules/inherits/inherits_browser.js"); - /**/ /**/ var internalUtil = { - deprecate: __webpack_require__("./node_modules/util-deprecate/browser.js") - }; - /**/ /**/ var Stream = __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/lib/internal/streams/stream-browser.js"); - /**/ /**/ var Buffer = __webpack_require__("./node_modules/websocket-stream/node_modules/safe-buffer/index.js")/* .Buffer */ .Buffer; - var OurUint8Array = (void 0 !== __webpack_require__.g ? __webpack_require__.g : 'undefined' != typeof window ? window : 'undefined' != typeof self ? self : {}).Uint8Array || function() {}; - function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); - } - function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; - } - /**/ var destroyImpl = __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/lib/internal/streams/destroy.js"); - util.inherits(Writable, Stream); - function nop() {} - function WritableState(options, stream) { - Duplex = Duplex || __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/lib/_stream_duplex.js"); - options = options || {}; - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - var isDuplex = stream instanceof Duplex; - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; - if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - var writableHwm = options.writableHighWaterMark; - var defaultHwm = this.objectMode ? 16 : 16384; - if (hwm || 0 === hwm) this.highWaterMark = hwm; - else if (isDuplex && (writableHwm || 0 === writableHwm)) this.highWaterMark = writableHwm; - else this.highWaterMark = defaultHwm; - // cast to ints. - this.highWaterMark = Math.floor(this.highWaterMark); - // if _final has been called - this.finalCalled = false; - // drain event flag. - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; - // has it been destroyed - this.destroyed = false; - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = false === options.decodeStrings; - this.decodeStrings = !noDecode; - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; - // a flag to see when we're in the middle of a write. - this.writing = false; - // when true all writes will be buffered until .uncork() call - this.corked = 0; - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; - // the callback that's passed to _write(chunk,cb) - this.onwrite = function(er) { - onwrite(stream, er); - }; - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; - // the amount that is being written when _write is called. - this.writelen = 0; - this.bufferedRequest = null; - this.lastBufferedRequest = null; - // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - this.pendingcb = 0; - // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - this.prefinished = false; - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; - // count buffered requests - this.bufferedRequestCount = 0; - // allocate the first CorkedRequest, there is always - // one allocated and free to use, and we maintain at most two - this.corkedRequestsFree = new CorkedRequest(this); - } - WritableState.prototype.getBuffer = function() { - var current = this.bufferedRequest; - var out = []; - while(current){ - out.push(current); - current = current.next; - } - return out; - }; - (function() { - try { - Object.defineProperty(WritableState.prototype, 'buffer', { - get: internalUtil.deprecate(function() { - return this.getBuffer(); - }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", 'DEP0003') - }); - } catch (_) {} - })(); - // Test _writableState for inheritance to account for Duplex streams, - // whose prototype chain only points to Readable. - var realHasInstance; - if ('function' == typeof Symbol && Symbol.hasInstance && 'function' == typeof Function.prototype[Symbol.hasInstance]) { - realHasInstance = Function.prototype[Symbol.hasInstance]; - Object.defineProperty(Writable, Symbol.hasInstance, { - value: function(object) { - if (realHasInstance.call(this, object)) return true; - if (this !== Writable) return false; - return object && object._writableState instanceof WritableState; - } - }); - } else realHasInstance = function(object) { - return object instanceof this; - }; - function Writable(options) { - Duplex = Duplex || __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/lib/_stream_duplex.js"); - // Writable ctor is applied to Duplexes, too. - // `realHasInstance` is necessary because using plain `instanceof` - // would return false, as no `_writableState` property is attached. - // Trying to use the custom `instanceof` for Writable here will also break the - // Node.js LazyTransform implementation, which has a non-trivial getter for - // `_writableState` that would lead to infinite recursion. - if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) return new Writable(options); - this._writableState = new WritableState(options, this); - // legacy. - this.writable = true; - if (options) { - if ('function' == typeof options.write) this._write = options.write; - if ('function' == typeof options.writev) this._writev = options.writev; - if ('function' == typeof options.destroy) this._destroy = options.destroy; - if ('function' == typeof options.final) this._final = options.final; - } - Stream.call(this); - } - // Otherwise people can pipe Writable streams, which is just wrong. - Writable.prototype.pipe = function() { - this.emit('error', new Error('Cannot pipe, not readable')); - }; - function writeAfterEnd(stream, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - pna.nextTick(cb, er); - } - // Checks that a user-supplied chunk is valid, especially for the particular - // mode the stream is in. Currently this means that `null` is never accepted - // and undefined/non-string values are only allowed in object mode. - function validChunk(stream, state, chunk, cb) { - var valid = true; - var er = false; - if (null === chunk) er = new TypeError('May not write null values to stream'); - else if ('string' != typeof chunk && void 0 !== chunk && !state.objectMode) er = new TypeError('Invalid non-string/buffer chunk'); - if (er) { - stream.emit('error', er); - pna.nextTick(cb, er); - valid = false; - } - return valid; - } - Writable.prototype.write = function(chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - var isBuf = !state.objectMode && _isUint8Array(chunk); - if (isBuf && !Buffer.isBuffer(chunk)) chunk = _uint8ArrayToBuffer(chunk); - if ('function' == typeof encoding) { - cb = encoding; - encoding = null; - } - if (isBuf) encoding = 'buffer'; - else if (!encoding) encoding = state.defaultEncoding; - if ('function' != typeof cb) cb = nop; - if (state.ended) writeAfterEnd(this, cb); - else if (isBuf || validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); - } - return ret; - }; - Writable.prototype.cork = function() { - var state = this._writableState; - state.corked++; - }; - Writable.prototype.uncork = function() { - var state = this._writableState; - if (state.corked) { - state.corked--; - if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); - } - }; - Writable.prototype.setDefaultEncoding = function(encoding) { - // node::ParseEncoding() requires lower case. - if ('string' == typeof encoding) encoding = encoding.toLowerCase(); - if (!([ - 'hex', - 'utf8', - 'utf-8', - 'ascii', - 'binary', - 'base64', - 'ucs2', - 'ucs-2', - 'utf16le', - 'utf-16le', - 'raw' - ].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); - this._writableState.defaultEncoding = encoding; - return this; - }; - function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && false !== state.decodeStrings && 'string' == typeof chunk) chunk = Buffer.from(chunk, encoding); - return chunk; - } - Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function() { - return this._writableState.highWaterMark; - } - }); - // if we're already writing something, then just put this - // in the queue, and wait our turn. Otherwise, call _write - // If we return false, then we need a drain event, so set that flag. - function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { - if (!isBuf) { - var newChunk = decodeChunk(state, chunk, encoding); - if (chunk !== newChunk) { - isBuf = true; - encoding = 'buffer'; - chunk = newChunk; - } - } - var len = state.objectMode ? 1 : chunk.length; - state.length += len; - var ret = state.length < state.highWaterMark; - // we must ensure that previous needDrain will not be reset to false. - if (!ret) state.needDrain = true; - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = { - chunk: chunk, - encoding: encoding, - isBuf: isBuf, - callback: cb, - next: null - }; - if (last) last.next = state.lastBufferedRequest; - else state.bufferedRequest = state.lastBufferedRequest; - state.bufferedRequestCount += 1; - } else doWrite(stream, state, false, len, chunk, encoding, cb); - return ret; - } - function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (writev) stream._writev(chunk, state.onwrite); - else stream._write(chunk, encoding, state.onwrite); - state.sync = false; - } - function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - if (sync) { - // defer the callback if we are being called synchronously - // to avoid piling up things on the stack - pna.nextTick(cb, er); - // this can emit finish, and it will always happen - // after error - pna.nextTick(finishMaybe, stream, state); - stream._writableState.errorEmitted = true; - stream.emit('error', er); - } else { - // the caller expect this to happen before if - // it is async - cb(er); - stream._writableState.errorEmitted = true; - stream.emit('error', er); - // this can emit finish, but finish must - // always follow error - finishMaybe(stream, state); - } - } - function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; - } - function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - onwriteStateUpdate(state); - if (er) onwriteError(stream, state, sync, er, cb); - else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(state); - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(stream, state); - if (sync) /**/ asyncWrite(afterWrite, stream, state, finished, cb); - else afterWrite(stream, state, finished, cb); - } - } - function afterWrite(stream, state, finished, cb) { - if (!finished) onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); - } - // Must force callback to be called on nextTick, so that we don't - // emit 'drain' before the write() consumer gets the 'false' return - // value, and has a chance to attach a 'drain' listener. - function onwriteDrain(stream, state) { - if (0 === state.length && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } - } - // if there's something in the buffer waiting, then process it - function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; - if (stream._writev && entry && entry.next) { - // Fast case, write everything using _writev() - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; - var count = 0; - var allBuffers = true; - while(entry){ - buffer[count] = entry; - if (!entry.isBuf) allBuffers = false; - entry = entry.next; - count += 1; - } - buffer.allBuffers = allBuffers; - doWrite(stream, state, true, state.length, buffer, '', holder.finish); - // doWrite is almost always async, defer these to save a bit of time - // as the hot path ends with doWrite - state.pendingcb++; - state.lastBufferedRequest = null; - if (holder.next) { - state.corkedRequestsFree = holder.next; - holder.next = null; - } else state.corkedRequestsFree = new CorkedRequest(state); - state.bufferedRequestCount = 0; - } else { - // Slow case, write chunks one-by-one - while(entry){ - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - state.bufferedRequestCount--; - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) break; - } - if (null === entry) state.lastBufferedRequest = null; - } - state.bufferedRequest = entry; - state.bufferProcessing = false; - } - Writable.prototype._write = function(chunk, encoding, cb) { - cb(new Error('_write() is not implemented')); - }; - Writable.prototype._writev = null; - Writable.prototype.end = function(chunk, encoding, cb) { - var state = this._writableState; - if ('function' == typeof chunk) { - cb = chunk; - chunk = null; - encoding = null; - } else if ('function' == typeof encoding) { - cb = encoding; - encoding = null; - } - if (null != chunk) this.write(chunk, encoding); - // .end() fully uncorks - if (state.corked) { - state.corked = 1; - this.uncork(); - } - // ignore unnecessary end() calls. - if (!state.ending) endWritable(this, state, cb); - }; - function needFinish(state) { - return state.ending && 0 === state.length && null === state.bufferedRequest && !state.finished && !state.writing; - } - function callFinal(stream, state) { - stream._final(function(err) { - state.pendingcb--; - if (err) stream.emit('error', err); - state.prefinished = true; - stream.emit('prefinish'); - finishMaybe(stream, state); - }); - } - function prefinish(stream, state) { - if (!state.prefinished && !state.finalCalled) { - if ('function' == typeof stream._final) { - state.pendingcb++; - state.finalCalled = true; - pna.nextTick(callFinal, stream, state); - } else { - state.prefinished = true; - stream.emit('prefinish'); - } - } - } - function finishMaybe(stream, state) { - var need = needFinish(state); - if (need) { - prefinish(stream, state); - if (0 === state.pendingcb) { - state.finished = true; - stream.emit('finish'); - } - } - return need; - } - function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) pna.nextTick(cb); - else stream.once('finish', cb); - } - state.ended = true; - stream.writable = false; - } - function onCorkedFinish(corkReq, state, err) { - var entry = corkReq.entry; - corkReq.entry = null; - while(entry){ - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } - // reuse the free corkReq. - state.corkedRequestsFree.next = corkReq; - } - Object.defineProperty(Writable.prototype, 'destroyed', { - get: function() { - if (void 0 === this._writableState) return false; - return this._writableState.destroyed; - }, - set: function(value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._writableState) return; - // backward compatibility, the user is explicitly - // managing destroyed - this._writableState.destroyed = value; - } - }); - Writable.prototype.destroy = destroyImpl.destroy; - Writable.prototype._undestroy = destroyImpl.undestroy; - Writable.prototype._destroy = function(err, cb) { - this.end(); - cb(err); - }; - }, - "./node_modules/websocket-stream/node_modules/readable-stream/lib/internal/streams/BufferList.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); - } - var Buffer = __webpack_require__("./node_modules/websocket-stream/node_modules/safe-buffer/index.js")/* .Buffer */ .Buffer; - var util = __webpack_require__("?1aff"); - function copyBuffer(src, target, offset) { - src.copy(target, offset); - } - module.exports = function() { - function BufferList() { - _classCallCheck(this, BufferList); - this.head = null; - this.tail = null; - this.length = 0; - } - BufferList.prototype.push = function(v) { - var entry = { - data: v, - next: null - }; - if (this.length > 0) this.tail.next = entry; - else this.head = entry; - this.tail = entry; - ++this.length; - }; - BufferList.prototype.unshift = function(v) { - var entry = { - data: v, - next: this.head - }; - if (0 === this.length) this.tail = entry; - this.head = entry; - ++this.length; - }; - BufferList.prototype.shift = function() { - if (0 === this.length) return; - var ret = this.head.data; - if (1 === this.length) this.head = this.tail = null; - else this.head = this.head.next; - --this.length; - return ret; - }; - BufferList.prototype.clear = function() { - this.head = this.tail = null; - this.length = 0; - }; - BufferList.prototype.join = function(s) { - if (0 === this.length) return ''; - var p = this.head; - var ret = '' + p.data; - while(p = p.next)ret += s + p.data; - return ret; - }; - BufferList.prototype.concat = function(n) { - if (0 === this.length) return Buffer.alloc(0); - var ret = Buffer.allocUnsafe(n >>> 0); - var p = this.head; - var i = 0; - while(p){ - copyBuffer(p.data, ret, i); - i += p.data.length; - p = p.next; - } - return ret; - }; - return BufferList; - }(); - if (util && util.inspect && util.inspect.custom) module.exports.prototype[util.inspect.custom] = function() { - var obj = util.inspect({ - length: this.length - }); - return this.constructor.name + ' ' + obj; - }; - }, - "./node_modules/websocket-stream/node_modules/readable-stream/lib/internal/streams/destroy.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - /**/ var pna = __webpack_require__("./node_modules/process-nextick-args/index.js"); - /**/ // undocumented cb() API, needed for core, not for public API - function destroy(err, cb) { - var _this = this; - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; - if (readableDestroyed || writableDestroyed) { - if (cb) cb(err); - else if (err) { - if (this._writableState) { - if (!this._writableState.errorEmitted) { - this._writableState.errorEmitted = true; - pna.nextTick(emitErrorNT, this, err); - } - } else pna.nextTick(emitErrorNT, this, err); - } - return this; - } - // we set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks - if (this._readableState) this._readableState.destroyed = true; - // if this is a duplex stream mark the writable part as destroyed as well - if (this._writableState) this._writableState.destroyed = true; - this._destroy(err || null, function(err) { - if (!cb && err) { - if (_this._writableState) { - if (!_this._writableState.errorEmitted) { - _this._writableState.errorEmitted = true; - pna.nextTick(emitErrorNT, _this, err); - } - } else pna.nextTick(emitErrorNT, _this, err); - } else if (cb) cb(err); - }); - return this; - } - function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; - } - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finalCalled = false; - this._writableState.prefinished = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; - } - } - function emitErrorNT(self1, err) { - self1.emit('error', err); - } - module.exports = { - destroy: destroy, - undestroy: undestroy - }; - }, - "./node_modules/websocket-stream/node_modules/readable-stream/lib/internal/streams/stream-browser.js": function(module, __unused_webpack_exports, __webpack_require__) { - module.exports = __webpack_require__("./node_modules/events/events.js")/* .EventEmitter */ .EventEmitter; - }, - "./node_modules/websocket-stream/node_modules/readable-stream/readable-browser.js": function(module, exports1, __webpack_require__) { - exports1 = module.exports = __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/lib/_stream_readable.js"); - exports1.Stream = exports1; - exports1.Readable = exports1; - exports1.Writable = __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/lib/_stream_writable.js"); - exports1.Duplex = __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/lib/_stream_duplex.js"); - exports1.Transform = __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/lib/_stream_transform.js"); - exports1.PassThrough = __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/lib/_stream_passthrough.js"); - }, - "./node_modules/websocket-stream/node_modules/safe-buffer/index.js": function(module, exports1, __webpack_require__) { - /* eslint-disable node/no-deprecated-api */ var buffer = __webpack_require__("./node_modules/buffer/index.js"); - var Buffer = buffer.Buffer; - // alternative to using Object.keys for old browsers - function copyProps(src, dst) { - for(var key in src)dst[key] = src[key]; - } - if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) module.exports = buffer; - else { - // Copy properties from require('buffer') - copyProps(buffer, exports1); - exports1.Buffer = SafeBuffer; - } - function SafeBuffer(arg, encodingOrOffset, length) { - return Buffer(arg, encodingOrOffset, length); - } - // Copy static methods from Buffer - copyProps(Buffer, SafeBuffer); - SafeBuffer.from = function(arg, encodingOrOffset, length) { - if ('number' == typeof arg) throw new TypeError('Argument must not be a number'); - return Buffer(arg, encodingOrOffset, length); - }; - SafeBuffer.alloc = function(size, fill, encoding) { - if ('number' != typeof size) throw new TypeError('Argument must be a number'); - var buf = Buffer(size); - if (void 0 !== fill) { - if ('string' == typeof encoding) buf.fill(fill, encoding); - else buf.fill(fill); - } else buf.fill(0); - return buf; - }; - SafeBuffer.allocUnsafe = function(size) { - if ('number' != typeof size) throw new TypeError('Argument must be a number'); - return Buffer(size); - }; - SafeBuffer.allocUnsafeSlow = function(size) { - if ('number' != typeof size) throw new TypeError('Argument must be a number'); - return buffer.SlowBuffer(size); - }; - }, - "./node_modules/websocket-stream/node_modules/string_decoder/lib/string_decoder.js": function(__unused_webpack_module, exports1, __webpack_require__) { - "use strict"; - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - /**/ var Buffer = __webpack_require__("./node_modules/websocket-stream/node_modules/safe-buffer/index.js")/* .Buffer */ .Buffer; - /**/ var isEncoding = Buffer.isEncoding || function(encoding) { - encoding = '' + encoding; - switch(encoding && encoding.toLowerCase()){ - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - case 'raw': - return true; - default: - return false; - } - }; - function _normalizeEncoding(enc) { - if (!enc) return 'utf8'; - var retried; - while(true)switch(enc){ - case 'utf8': - case 'utf-8': - return 'utf8'; - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return 'utf16le'; - case 'latin1': - case 'binary': - return 'latin1'; - case 'base64': - case 'ascii': - case 'hex': - return enc; - default: - if (retried) return; // undefined - enc = ('' + enc).toLowerCase(); - retried = true; - } - } - // Do not cache `Buffer.isEncoding` when checking encoding names as some - // modules monkey-patch it to support additional encodings - function normalizeEncoding(enc) { - var nenc = _normalizeEncoding(enc); - if ('string' != typeof nenc && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); - return nenc || enc; - } - // StringDecoder provides an interface for efficiently splitting a series of - // buffers into a series of JS strings without breaking apart multi-byte - // characters. - exports1.StringDecoder = StringDecoder; - function StringDecoder(encoding) { - this.encoding = normalizeEncoding(encoding); - var nb; - switch(this.encoding){ - case 'utf16le': - this.text = utf16Text; - this.end = utf16End; - nb = 4; - break; - case 'utf8': - this.fillLast = utf8FillLast; - nb = 4; - break; - case 'base64': - this.text = base64Text; - this.end = base64End; - nb = 3; - break; - default: - this.write = simpleWrite; - this.end = simpleEnd; - return; - } - this.lastNeed = 0; - this.lastTotal = 0; - this.lastChar = Buffer.allocUnsafe(nb); - } - StringDecoder.prototype.write = function(buf) { - if (0 === buf.length) return ''; - var r; - var i; - if (this.lastNeed) { - r = this.fillLast(buf); - if (void 0 === r) return ''; - i = this.lastNeed; - this.lastNeed = 0; - } else i = 0; - if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); - return r || ''; - }; - StringDecoder.prototype.end = utf8End; - // Returns only complete characters in a Buffer - StringDecoder.prototype.text = utf8Text; - // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer - StringDecoder.prototype.fillLast = function(buf) { - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); - this.lastNeed -= buf.length; - }; - // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a - // continuation byte. If an invalid byte is detected, -2 is returned. - function utf8CheckByte(byte) { - if (byte <= 0x7F) return 0; - if (byte >> 5 === 0x06) return 2; - if (byte >> 4 === 0x0E) return 3; - else if (byte >> 3 === 0x1E) return 4; - return byte >> 6 === 0x02 ? -1 : -2; - } - // Checks at most 3 bytes at the end of a Buffer in order to detect an - // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) - // needed to complete the UTF-8 character (if applicable) are returned. - function utf8CheckIncomplete(self1, buf, i) { - var j = buf.length - 1; - if (j < i) return 0; - var nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self1.lastNeed = nb - 1; - return nb; - } - if (--j < i || -2 === nb) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) self1.lastNeed = nb - 2; - return nb; - } - if (--j < i || -2 === nb) return 0; - nb = utf8CheckByte(buf[j]); - if (nb >= 0) { - if (nb > 0) { - if (2 === nb) nb = 0; - else self1.lastNeed = nb - 3; - } - return nb; - } - return 0; - } - // Validates as many continuation bytes for a multi-byte UTF-8 character as - // needed or are available. If we see a non-continuation byte where we expect - // one, we "replace" the validated continuation bytes we've seen so far with - // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding - // behavior. The continuation byte check is included three times in the case - // where all of the continuation bytes for a character exist in the same buffer. - // It is also done this way as a slight performance increase instead of using a - // loop. - function utf8CheckExtraBytes(self1, buf, p) { - if ((0xC0 & buf[0]) !== 0x80) { - self1.lastNeed = 0; - return '\ufffd'; - } - if (self1.lastNeed > 1 && buf.length > 1) { - if ((0xC0 & buf[1]) !== 0x80) { - self1.lastNeed = 1; - return '\ufffd'; - } - if (self1.lastNeed > 2 && buf.length > 2) { - if ((0xC0 & buf[2]) !== 0x80) { - self1.lastNeed = 2; - return '\ufffd'; - } - } - } - } - // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. - function utf8FillLast(buf) { - var p = this.lastTotal - this.lastNeed; - var r = utf8CheckExtraBytes(this, buf, p); - if (void 0 !== r) return r; - if (this.lastNeed <= buf.length) { - buf.copy(this.lastChar, p, 0, this.lastNeed); - return this.lastChar.toString(this.encoding, 0, this.lastTotal); - } - buf.copy(this.lastChar, p, 0, buf.length); - this.lastNeed -= buf.length; - } - // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a - // partial character, the character's bytes are buffered until the required - // number of bytes are available. - function utf8Text(buf, i) { - var total = utf8CheckIncomplete(this, buf, i); - if (!this.lastNeed) return buf.toString('utf8', i); - this.lastTotal = total; - var end = buf.length - (total - this.lastNeed); - buf.copy(this.lastChar, 0, end); - return buf.toString('utf8', i, end); - } - // For UTF-8, a replacement character is added when ending on a partial - // character. - function utf8End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + '\ufffd'; - return r; - } - // UTF-16LE typically needs two bytes per character, but even if we have an even - // number of bytes available, we need to check if we end on a leading/high - // surrogate. In that case, we need to wait for the next two bytes in order to - // decode the last character properly. - function utf16Text(buf, i) { - if ((buf.length - i) % 2 === 0) { - var r = buf.toString('utf16le', i); - if (r) { - var c = r.charCodeAt(r.length - 1); - if (c >= 0xD800 && c <= 0xDBFF) { - this.lastNeed = 2; - this.lastTotal = 4; - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - return r.slice(0, -1); - } - } - return r; - } - this.lastNeed = 1; - this.lastTotal = 2; - this.lastChar[0] = buf[buf.length - 1]; - return buf.toString('utf16le', i, buf.length - 1); - } - // For UTF-16LE we do not explicitly append special replacement characters if we - // end on a partial character, we simply let v8 handle that. - function utf16End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) { - var end = this.lastTotal - this.lastNeed; - return r + this.lastChar.toString('utf16le', 0, end); - } - return r; - } - function base64Text(buf, i) { - var n = (buf.length - i) % 3; - if (0 === n) return buf.toString('base64', i); - this.lastNeed = 3 - n; - this.lastTotal = 3; - if (1 === n) this.lastChar[0] = buf[buf.length - 1]; - else { - this.lastChar[0] = buf[buf.length - 2]; - this.lastChar[1] = buf[buf.length - 1]; - } - return buf.toString('base64', i, buf.length - n); - } - function base64End(buf) { - var r = buf && buf.length ? this.write(buf) : ''; - if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); - return r; - } - // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) - function simpleWrite(buf) { - return buf.toString(this.encoding); - } - function simpleEnd(buf) { - return buf && buf.length ? this.write(buf) : ''; - } - }, - "./node_modules/websocket-stream/stream.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - /* provided dependency */ var process = __webpack_require__("./node_modules/process/browser.js"); - var Transform = __webpack_require__("./node_modules/websocket-stream/node_modules/readable-stream/readable-browser.js")/* .Transform */ .Transform; - var duplexify = __webpack_require__("./node_modules/duplexify/index.js"); - var WS = __webpack_require__("./node_modules/websocket-stream/ws-fallback.js"); - var Buffer = __webpack_require__("./node_modules/websocket-stream/node_modules/safe-buffer/index.js")/* .Buffer */ .Buffer; - module.exports = WebSocketStream; - function buildProxy(options, socketWrite, socketEnd) { - var proxy = new Transform({ - objectMode: options.objectMode - }); - proxy._write = socketWrite; - proxy._flush = socketEnd; - return proxy; - } - function WebSocketStream(target, protocols, options) { - var stream, socket; - var isBrowser = 'browser' === process.title; - var isNative = !!__webpack_require__.g.WebSocket; - var socketWrite = isBrowser ? socketWriteBrowser : socketWriteNode; - if (protocols && !Array.isArray(protocols) && 'object' == typeof protocols) { - // accept the "options" Object as the 2nd argument - options = protocols; - protocols = null; - if ('string' == typeof options.protocol || Array.isArray(options.protocol)) protocols = options.protocol; - } - if (!options) options = {}; - if (void 0 === options.objectMode) options.objectMode = !(true === options.binary || void 0 === options.binary); - var proxy = buildProxy(options, socketWrite, socketEnd); - if (!options.objectMode) proxy._writev = writev; - // browser only: sets the maximum socket buffer size before throttling - var bufferSize = options.browserBufferSize || 524288; - // browser only: how long to wait when throttling - var bufferTimeout = options.browserBufferTimeout || 1000; - // use existing WebSocket object that was passed in - if ('object' == typeof target) socket = target; - else { - // special constructor treatment for native websockets in browsers, see - // https://github.com/maxogden/websocket-stream/issues/82 - socket = isNative && isBrowser ? new WS(target, protocols) : new WS(target, protocols, options); - socket.binaryType = 'arraybuffer'; - } - // according to https://github.com/baygeldin/ws-streamify/issues/1 - // Nodejs WebSocketServer cause memory leak - // Handlers like onerror, onclose, onmessage and onopen are accessible via setter/getter - // And setter first of all fires removeAllListeners, that doesnt make inner array of clients on WebSocketServer cleared ever - var eventListenerSupport = void 0 === socket.addEventListener; - // was already open when passed in - if (socket.readyState === socket.OPEN) stream = proxy; - else { - stream = stream = duplexify(void 0, void 0, options); - if (!options.objectMode) stream._writev = writev; - if (eventListenerSupport) socket.addEventListener('open', onopen); - else socket.onopen = onopen; - } - stream.socket = socket; - if (eventListenerSupport) { - socket.addEventListener('close', onclose); - socket.addEventListener('error', onerror); - socket.addEventListener('message', onmessage); - } else { - socket.onclose = onclose; - socket.onerror = onerror; - socket.onmessage = onmessage; - } - proxy.on('close', destroy); - var coerceToBuffer = !options.objectMode; - function socketWriteNode(chunk, enc, next) { - // avoid errors, this never happens unless - // destroy() is called - if (socket.readyState !== socket.OPEN) { - next(); - return; - } - if (coerceToBuffer && 'string' == typeof chunk) chunk = Buffer.from(chunk, 'utf8'); - socket.send(chunk, next); - } - function socketWriteBrowser(chunk, enc, next) { - if (socket.bufferedAmount > bufferSize) { - setTimeout(socketWriteBrowser, bufferTimeout, chunk, enc, next); - return; - } - if (coerceToBuffer && 'string' == typeof chunk) chunk = Buffer.from(chunk, 'utf8'); - try { - socket.send(chunk); - } catch (err) { - return next(err); - } - next(); - } - function socketEnd(done) { - socket.close(); - done(); - } - function onopen() { - stream.setReadable(proxy); - stream.setWritable(proxy); - stream.emit('connect'); - } - function onclose() { - stream.end(); - stream.destroy(); - } - function onerror(err) { - stream.destroy(err); - } - function onmessage(event) { - var data = event.data; - data = data instanceof ArrayBuffer ? Buffer.from(data) : Buffer.from(data, 'utf8'); - proxy.push(data); - } - function destroy() { - socket.close(); - } - // this is to be enabled only if objectMode is false - function writev(chunks, cb) { - var buffers = new Array(chunks.length); - for(var i = 0; i < chunks.length; i++)if ('string' == typeof chunks[i].chunk) buffers[i] = Buffer.from(chunks[i], 'utf8'); - else buffers[i] = chunks[i].chunk; - this._write(Buffer.concat(buffers), 'binary', cb); - } - return stream; - } - }, - "./node_modules/websocket-stream/ws-fallback.js": function(module) { - var ws = null; - if ('undefined' != typeof WebSocket) ws = WebSocket; - else if ('undefined' != typeof MozWebSocket) ws = MozWebSocket; - else if ('undefined' != typeof window) ws = window.WebSocket || window.MozWebSocket; - module.exports = ws; - }, - "./node_modules/which-typed-array/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var forEach = __webpack_require__("./node_modules/for-each/index.js"); - var availableTypedArrays = __webpack_require__("./node_modules/available-typed-arrays/index.js"); - var callBind = __webpack_require__("./node_modules/call-bind/index.js"); - var callBound = __webpack_require__("./node_modules/call-bind/callBound.js"); - var gOPD = __webpack_require__("./node_modules/gopd/index.js"); - /** @type {(O: object) => string} */ var $toString = callBound('Object.prototype.toString'); - var hasToStringTag = __webpack_require__("./node_modules/has-tostringtag/shams.js")(); - var g = 'undefined' == typeof globalThis ? __webpack_require__.g : globalThis; - var typedArrays = availableTypedArrays(); - var $slice = callBound('String.prototype.slice'); - var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof'); - /** @type {(array: readonly T[], value: unknown) => number} */ var $indexOf = callBound('Array.prototype.indexOf', true) || function(array, value) { - for(var i = 0; i < array.length; i += 1)if (array[i] === value) return i; - return -1; - }; - /** @typedef {(receiver: import('.').TypedArray) => string | typeof Uint8Array.prototype.slice.call | typeof Uint8Array.prototype.set.call} Getter */ /** @type {{ [k in `\$${import('.').TypedArrayName}`]?: Getter } & { __proto__: null }} */ var cache = { - __proto__: null - }; - hasToStringTag && gOPD && getPrototypeOf ? forEach(typedArrays, function(typedArray) { - var arr = new g[typedArray](); - if (Symbol.toStringTag in arr) { - var proto = getPrototypeOf(arr); - // @ts-expect-error TS won't narrow inside a closure - var descriptor = gOPD(proto, Symbol.toStringTag); - if (!descriptor) { - var superProto = getPrototypeOf(proto); - // @ts-expect-error TS won't narrow inside a closure - descriptor = gOPD(superProto, Symbol.toStringTag); - } - // @ts-expect-error TODO: fix - cache['$' + typedArray] = callBind(descriptor.get); - } - }) : forEach(typedArrays, function(typedArray) { - var arr = new g[typedArray](); - var fn = arr.slice || arr.set; - if (fn) // @ts-expect-error TODO: fix - cache['$' + typedArray] = callBind(fn); - }); - /** @type {(value: object) => false | import('.').TypedArrayName} */ var tryTypedArrays = function(value) { - /** @type {ReturnType} */ var found = false; - forEach(// eslint-disable-next-line no-extra-parens - /** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ cache, /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */ function(getter, typedArray) { - if (!found) try { - // @ts-expect-error TODO: fix - if ('$' + getter(value) === typedArray) found = $slice(typedArray, 1); - } catch (e) {} - }); - return found; - }; - /** @type {(value: object) => false | import('.').TypedArrayName} */ var trySlices = function(value) { - /** @type {ReturnType} */ var found = false; - forEach(// eslint-disable-next-line no-extra-parens - /** @type {Record<`\$${TypedArrayName}`, Getter>} */ /** @type {any} */ cache, /** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */ function(getter, name) { - if (!found) try { - // @ts-expect-error TODO: fix - getter(value); - found = $slice(name, 1); - } catch (e) {} - }); - return found; - }; - /** @type {import('.')} */ module.exports = function(value) { - if (!value || 'object' != typeof value) return false; - if (!hasToStringTag) { - /** @type {string} */ var tag = $slice($toString(value), 8, -1); - if ($indexOf(typedArrays, tag) > -1) return tag; - if ('Object' !== tag) return false; - // node < 0.6 hits here on real Typed Arrays - return trySlices(value); - } - if (!gOPD) return null; - // unknown engine - return tryTypedArrays(value); - }; - }, - "./node_modules/wrappy/wrappy.js": function(module) { - // Returns a wrapper function that returns a wrapped callback - // The wrapper function should do some stuff, and return a - // presumably different callback function. - // This makes sure that own properties are retained, so that - // decorations and such are not lost along the way. - module.exports = wrappy; - function wrappy(fn, cb) { - if (fn && cb) return wrappy(fn)(cb); - if ('function' != typeof fn) throw new TypeError('need wrapper function'); - Object.keys(fn).forEach(function(k) { - wrapper[k] = fn[k]; - }); - return wrapper; - function wrapper() { - var args = new Array(arguments.length); - for(var i = 0; i < args.length; i++)args[i] = arguments[i]; - var ret = fn.apply(this, args); - var cb = args[args.length - 1]; - if ('function' == typeof ret && ret !== cb) Object.keys(cb).forEach(function(k) { - ret[k] = cb[k]; - }); - return ret; - } - } - }, - "../../node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[9].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[9].use[2]!../../node_modules/stylus-loader/dist/cjs.js??ruleSet[1].rules[9].use[3]!./src/styles/main.styl": function(module, __webpack_exports__, __webpack_require__) { - "use strict"; - __webpack_require__.d(__webpack_exports__, { - Z: function() { - return __WEBPACK_DEFAULT_EXPORT__; - } - }); - /* ESM import */ var _node_modules_rsbuild_core_compiled_css_loader_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./node_modules/@rsbuild/core/compiled/css-loader/noSourceMaps.js"); - /* ESM import */ var _node_modules_rsbuild_core_compiled_css_loader_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/ __webpack_require__.n(_node_modules_rsbuild_core_compiled_css_loader_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__); - /* ESM import */ var _node_modules_rsbuild_core_compiled_css_loader_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./node_modules/@rsbuild/core/compiled/css-loader/api.js"); - /* ESM import */ var _node_modules_rsbuild_core_compiled_css_loader_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/ __webpack_require__.n(_node_modules_rsbuild_core_compiled_css_loader_api_js__WEBPACK_IMPORTED_MODULE_1__); - // Imports - var ___CSS_LOADER_EXPORT___ = _node_modules_rsbuild_core_compiled_css_loader_api_js__WEBPACK_IMPORTED_MODULE_1___default()(_node_modules_rsbuild_core_compiled_css_loader_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()); - // Module - ___CSS_LOADER_EXPORT___.push([ - module.id, - '@keyframes blink{0%{opacity:.9}35%{opacity:.9}50%{opacity:.1}85%{opacity:.1}to{opacity:.9}}.videomail .visuals{position:relative}.videomail .visuals video.replay{width:100%;height:100%}.videomail .countdown,.videomail .recordTimer,.videomail .recordNote,.videomail .pausedHeader,.videomail .pausedHint{height:auto;margin:0}.videomail .countdown,.videomail .recordTimer,.videomail .recordNote,.videomail .paused,.videomail .facingMode,.videomail noscript{z-index:100;position:absolute}.videomail .countdown,.videomail .recordTimer,.videomail .recordNote,.videomail .pausedHeader,.videomail .pausedHint,.videomail noscript{font-weight:700}.videomail .countdown,.videomail .paused,.videomail noscript{width:100%;top:50%;transform:translateY(-50%)}.videomail .pausedHeader,.videomail .pausedHint,.videomail .countdown{text-align:center;letter-spacing:4px;text-shadow:-2px 0 #fff,0 2px #fff,2px 0 #fff,0 -2px #fff}.videomail .pausedHeader,.videomail .countdown{opacity:.9;font-size:460%}.videomail .pausedHint{font-size:150%}.videomail .facingMode{color:rgba(245,245,245,.9);z-index:10;background:rgba(30,30,30,.5);border:none;outline:none;padding:.1em .3em;font-family:monospace;font-size:1.2em;transition:all .2s;bottom:.6em;right:.7em}.videomail .facingMode:hover{cursor:pointer;background:rgba(50,50,50,.7)}.videomail .recordTimer,.videomail .recordNote{color:#00d814;opacity:.9;background:rgba(10,10,10,.8);padding:.3em .4em;font-family:monospace;transition:all 1s;right:.7em}.videomail .recordTimer.near,.videomail .recordNote.near{color:#eb9369}.videomail .recordTimer.nigh,.videomail .recordNote.nigh{color:#ea4b2a}.videomail .recordTimer{top:.7em}.videomail .recordNote{top:3.6em}.videomail .recordNote:before{content:"REC";animation:1s infinite blink}.videomail .notifier{box-sizing:border-box;overflow:hidden}.videomail .radioGroup{display:block}.videomail .radioGroup label{cursor:pointer}.videomail video{margin-bottom:0}.videomail video.userMedia{background-color:rgba(50,50,50,.1)}', - "" - ]); - // Exports - /* ESM default export */ const __WEBPACK_DEFAULT_EXPORT__ = ___CSS_LOADER_EXPORT___; - }, - "?f049": function() { - /* (ignored) */ }, - "?d57a": function() { - /* (ignored) */ }, - "?ff23": function() { - /* (ignored) */ }, - "?64eb": function() { - /* (ignored) */ }, - "?1aff": function() { - /* (ignored) */ }, - "?5eec": function() { - /* (ignored) */ }, - "./node_modules/@rsbuild/core/compiled/css-loader/api.js": function(module) { - "use strict"; - /* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ module.exports = function(cssWithMappingToString) { - var list = []; - // return the list of modules as css string - list.toString = function() { - return this.map(function(item) { - var content = ""; - var needLayer = void 0 !== item[5]; - if (item[4]) content += "@supports (".concat(item[4], ") {"); - if (item[2]) content += "@media ".concat(item[2], " {"); - if (needLayer) content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {"); - content += cssWithMappingToString(item); - if (needLayer) content += "}"; - if (item[2]) content += "}"; - if (item[4]) content += "}"; - return content; - }).join(""); - }; - // import a list of modules into the list - list.i = function(modules, media, dedupe, supports, layer) { - if ("string" == typeof modules) modules = [ - [ - null, - modules, - void 0 - ] - ]; - var alreadyImportedModules = {}; - if (dedupe) for(var k = 0; k < this.length; k++){ - var id = this[k][0]; - if (null != id) alreadyImportedModules[id] = true; - } - for(var _k = 0; _k < modules.length; _k++){ - var item = [].concat(modules[_k]); - if (!dedupe || !alreadyImportedModules[item[0]]) { - if (void 0 !== layer) { - if (void 0 === item[5]) item[5] = layer; - else { - item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}"); - item[5] = layer; - } - } - if (media) { - if (item[2]) { - item[1] = "@media ".concat(item[2], " {").concat(item[1], "}"); - item[2] = media; - } else item[2] = media; - } - if (supports) { - if (item[4]) { - item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}"); - item[4] = supports; - } else item[4] = "".concat(supports); - } - list.push(item); - } - } - }; - return list; - }; - }, - "./node_modules/@rsbuild/core/compiled/css-loader/noSourceMaps.js": function(module) { - "use strict"; - module.exports = function(i) { - return i[1]; - }; - }, - "./node_modules/@rsbuild/core/compiled/style-loader/runtime/injectStylesIntoStyleTag.js": function(module) { - "use strict"; - var stylesInDOM = []; - function getIndexByIdentifier(identifier) { - var result = -1; - for(var i = 0; i < stylesInDOM.length; i++)if (stylesInDOM[i].identifier === identifier) { - result = i; - break; - } - return result; - } - function modulesToDom(list, options) { - var idCountMap = {}; - var identifiers = []; - for(var i = 0; i < list.length; i++){ - var item = list[i]; - var id = options.base ? item[0] + options.base : item[0]; - var count = idCountMap[id] || 0; - var identifier = "".concat(id, " ").concat(count); - idCountMap[id] = count + 1; - var indexByIdentifier = getIndexByIdentifier(identifier); - var obj = { - css: item[1], - media: item[2], - sourceMap: item[3], - supports: item[4], - layer: item[5] - }; - if (-1 !== indexByIdentifier) { - stylesInDOM[indexByIdentifier].references++; - stylesInDOM[indexByIdentifier].updater(obj); - } else { - var updater = addElementStyle(obj, options); - options.byIndex = i; - stylesInDOM.splice(i, 0, { - identifier: identifier, - updater: updater, - references: 1 - }); - } - identifiers.push(identifier); - } - return identifiers; - } - function addElementStyle(obj, options) { - var api = options.domAPI(options); - api.update(obj); - var updater = function(newObj) { - if (newObj) { - if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) return; - api.update(obj = newObj); - } else api.remove(); - }; - return updater; - } - module.exports = function(list, options) { - options = options || {}; - list = list || []; - var lastIdentifiers = modulesToDom(list, options); - return function(newList) { - newList = newList || []; - for(var i = 0; i < lastIdentifiers.length; i++){ - var identifier = lastIdentifiers[i]; - var index = getIndexByIdentifier(identifier); - stylesInDOM[index].references--; - } - var newLastIdentifiers = modulesToDom(newList, options); - for(var _i = 0; _i < lastIdentifiers.length; _i++){ - var _identifier = lastIdentifiers[_i]; - var _index = getIndexByIdentifier(_identifier); - if (0 === stylesInDOM[_index].references) { - stylesInDOM[_index].updater(); - stylesInDOM.splice(_index, 1); - } - } - lastIdentifiers = newLastIdentifiers; - }; - }; - }, - "./node_modules/@rsbuild/core/compiled/style-loader/runtime/insertBySelector.js": function(module) { - "use strict"; - var memo = {}; - /* istanbul ignore next */ function getTarget(target) { - if (void 0 === memo[target]) { - var styleTarget = document.querySelector(target); - // Special case to return head of iframe instead of iframe itself - if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) try { - // This will throw an exception if access to iframe is blocked - // due to cross-origin restrictions - styleTarget = styleTarget.contentDocument.head; - } catch (e) { - // istanbul ignore next - styleTarget = null; - } - memo[target] = styleTarget; - } - return memo[target]; - } - /* istanbul ignore next */ function insertBySelector(insert, style) { - var target = getTarget(insert); - if (!target) throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid."); - target.appendChild(style); - } - module.exports = insertBySelector; - }, - "./node_modules/@rsbuild/core/compiled/style-loader/runtime/insertStyleElement.js": function(module) { - "use strict"; - /* istanbul ignore next */ function insertStyleElement(options) { - var element = document.createElement("style"); - options.setAttributes(element, options.attributes); - options.insert(element, options.options); - return element; - } - module.exports = insertStyleElement; - }, - "./node_modules/@rsbuild/core/compiled/style-loader/runtime/setAttributesWithoutAttributes.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - /* istanbul ignore next */ function setAttributesWithoutAttributes(styleElement) { - var nonce = __webpack_require__.nc; - if (nonce) styleElement.setAttribute("nonce", nonce); - } - module.exports = setAttributesWithoutAttributes; - }, - "./node_modules/@rsbuild/core/compiled/style-loader/runtime/styleDomAPI.js": function(module) { - "use strict"; - /* istanbul ignore next */ function apply(styleElement, options, obj) { - var css = ""; - if (obj.supports) css += "@supports (".concat(obj.supports, ") {"); - if (obj.media) css += "@media ".concat(obj.media, " {"); - var needLayer = void 0 !== obj.layer; - if (needLayer) css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {"); - css += obj.css; - if (needLayer) css += "}"; - if (obj.media) css += "}"; - if (obj.supports) css += "}"; - var sourceMap = obj.sourceMap; - if (sourceMap && "undefined" != typeof btoa) css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */"); - // For old IE - /* istanbul ignore if */ options.styleTagTransform(css, styleElement, options.options); - } - function removeStyleElement(styleElement) { - // istanbul ignore if - if (null === styleElement.parentNode) return false; - styleElement.parentNode.removeChild(styleElement); - } - /* istanbul ignore next */ function domAPI(options) { - if ("undefined" == typeof document) return { - update: function() {}, - remove: function() {} - }; - var styleElement = options.insertStyleElement(options); - return { - update: function(obj) { - apply(styleElement, options, obj); - }, - remove: function() { - removeStyleElement(styleElement); - } - }; - } - module.exports = domAPI; - }, - "./node_modules/@rsbuild/core/compiled/style-loader/runtime/styleTagTransform.js": function(module) { - "use strict"; - /* istanbul ignore next */ function styleTagTransform(css, styleElement) { - if (styleElement.styleSheet) styleElement.styleSheet.cssText = css; - else { - while(styleElement.firstChild)styleElement.removeChild(styleElement.firstChild); - styleElement.appendChild(document.createTextNode(css)); - } - } - module.exports = styleTagTransform; - }, - "./node_modules/available-typed-arrays/index.js": function(module, __unused_webpack_exports, __webpack_require__) { - "use strict"; - var possibleNames = __webpack_require__("./node_modules/possible-typed-array-names/index.js"); - var g = 'undefined' == typeof globalThis ? __webpack_require__.g : globalThis; - /** @type {import('.')} */ module.exports = function() { - var /** @type {ReturnType} */ out = []; - for(var i = 0; i < possibleNames.length; i++)if ('function' == typeof g[possibleNames[i]]) // @ts-expect-error - out[out.length] = possibleNames[i]; - return out; - }; - } -}; -/************************************************************************/ // The module cache -var __webpack_module_cache__ = {}; -// The require function -function __webpack_require__(moduleId) { - // Check if module is in cache - var cachedModule = __webpack_module_cache__[moduleId]; - if (void 0 !== cachedModule) return cachedModule.exports; - // Create a new module (and put it into the cache) - var module = __webpack_module_cache__[moduleId] = { - id: moduleId, - exports: {} - }; - // Execute the module function - __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); - // Return the exports of the module - return module.exports; -} -/************************************************************************/ // webpack/runtime/compat_get_default_export -(()=>{ - // getDefaultExport function for compatibility with non-ESM modules - __webpack_require__.n = function(module) { - var getter = module && module.__esModule ? function() { - return module['default']; - } : function() { - return module; - }; - __webpack_require__.d(getter, { - a: getter - }); - return getter; - }; -})(); -// webpack/runtime/define_property_getters -(()=>{ - __webpack_require__.d = function(exports1, definition) { - for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, { - enumerable: true, - get: definition[key] - }); - }; -})(); -// webpack/runtime/global -(()=>{ - __webpack_require__.g = function() { - if ('object' == typeof globalThis) return globalThis; - try { - return this || new Function('return this')(); - } catch (e) { - if ('object' == typeof window) return window; - } - }(); -})(); -// webpack/runtime/has_own_property -(()=>{ - __webpack_require__.o = function(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); - }; -})(); -// webpack/runtime/make_namespace_object -(()=>{ - // define __esModule on exports - __webpack_require__.r = function(exports1) { - if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, { - value: 'Module' - }); - Object.defineProperty(exports1, '__esModule', { - value: true - }); - }; -})(); -// webpack/runtime/nonce -(()=>{ - __webpack_require__.nc = void 0; -})(); -/************************************************************************/ var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be in strict mode. -(()=>{ - "use strict"; - // ESM COMPAT FLAG - __webpack_require__.r(__webpack_exports__); - // EXPORTS - __webpack_require__.d(__webpack_exports__, { - VideoType: ()=>/* reexport */ VideoType_VideoType, - VideomailClient: ()=>/* reexport */ src_client - }); - // constants (changing these only break down functionality, so be careful) - /* ESM default export */ const constants = { - SITE_NAME_LABEL: "x-videomail-site-name", - VERSION_LABEL: "videomailClientVersion", - public: { - ENC_TYPE_APP_JSON: "application/json", - ENC_TYPE_FORM: "application/x-www-form-urlencoded" - } - }; - // EXTERNAL MODULE: ./node_modules/superagent/lib/client.js - var client = __webpack_require__("./node_modules/superagent/lib/client.js"); - var client_default = /*#__PURE__*/ __webpack_require__.n(client); - // EXTERNAL MODULE: ./node_modules/util/util.js - var util = __webpack_require__("./node_modules/util/util.js"); - var util_default = /*#__PURE__*/ __webpack_require__.n(util); - function inspect(element) { - return util_default().inspect(element, { - colors: true, - compact: true, - depth: 4, - breakLength: 1 / 0 - }).replace(/\s+/gu, " ").replace(/\r?\n/gu, ""); - } - function pretty_pretty(anything) { - if (anything instanceof HTMLElement) { - if (anything.id) return `#${anything.id}`; - if (anything.className) return `.${anything.className}`; - return "(No HTML identifier available)"; - } - return inspect(anything); - } - /* ESM default export */ const pretty = pretty_pretty; - function isAudioEnabled(options) { - return options.audio.enabled; - } - // TODO Change to state - function setAudioEnabled(enabled, options) { - options.audio.enabled = enabled; - return options; - } - function isAutoPauseEnabled(options) { - return options.enableAutoPause && options.enablePause; - } - // EXTERNAL MODULE: ./node_modules/defined/index.js - var defined = __webpack_require__("./node_modules/defined/index.js"); - var defined_default = /*#__PURE__*/ __webpack_require__.n(defined); - // Generated ESM version of ua-parser-js - // DO NOT EDIT THIS FILE! - // Source: /src/main/ua-parser.js - ///////////////////////////////////////////////////////////////////////////////// - /* UAParser.js v2.0.0 - Copyright © 2012-2024 Faisal Salman - AGPLv3 License */ /* - Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data. - Supports browser & node.js environment. - Demo : https://uaparser.dev - Source : https://github.com/faisalman/ua-parser-js */ ///////////////////////////////////////////////////////////////////////////////// - /* jshint esversion: 6 */ /* globals window */ ////////////// - // Constants - ///////////// - var LIBVERSION = '2.0.0', EMPTY = '', UNKNOWN = '?', FUNC_TYPE = 'function', UNDEF_TYPE = 'undefined', OBJ_TYPE = 'object', STR_TYPE = 'string', MAJOR = 'major', MODEL = 'model', NAME = 'name', TYPE = 'type', VENDOR = 'vendor', VERSION = 'version', ARCHITECTURE = 'architecture', CONSOLE = 'console', MOBILE = 'mobile', TABLET = 'tablet', SMARTTV = 'smarttv', WEARABLE = 'wearable', XR = 'xr', EMBEDDED = 'embedded', INAPP = 'inapp', USER_AGENT = 'user-agent', UA_MAX_LENGTH = 500, BRANDS = 'brands', FORMFACTORS = 'formFactors', FULLVERLIST = 'fullVersionList', PLATFORM = 'platform', PLATFORMVER = 'platformVersion', BITNESS = 'bitness', CH_HEADER = 'sec-ch-ua', CH_HEADER_FULL_VER_LIST = CH_HEADER + '-full-version-list', CH_HEADER_ARCH = CH_HEADER + '-arch', CH_HEADER_BITNESS = CH_HEADER + '-' + BITNESS, CH_HEADER_FORM_FACTORS = CH_HEADER + '-form-factors', CH_HEADER_MOBILE = CH_HEADER + '-' + MOBILE, CH_HEADER_MODEL = CH_HEADER + '-' + MODEL, CH_HEADER_PLATFORM = CH_HEADER + '-' + PLATFORM, CH_HEADER_PLATFORM_VER = CH_HEADER_PLATFORM + '-version', CH_ALL_VALUES = [ - BRANDS, - FULLVERLIST, - MOBILE, - MODEL, - PLATFORM, - PLATFORMVER, - ARCHITECTURE, - FORMFACTORS, - BITNESS - ], UA_BROWSER = 'browser', UA_CPU = 'cpu', UA_DEVICE = 'device', UA_ENGINE = 'engine', UA_OS = 'os', UA_RESULT = 'result', AMAZON = 'Amazon', APPLE = 'Apple', ASUS = 'ASUS', BLACKBERRY = 'BlackBerry', GOOGLE = 'Google', HUAWEI = 'Huawei', LENOVO = 'Lenovo', HONOR = 'Honor', LG = 'LG', MICROSOFT = 'Microsoft', MOTOROLA = 'Motorola', SAMSUNG = 'Samsung', SHARP = 'Sharp', SONY = 'Sony', XIAOMI = 'Xiaomi', ZEBRA = 'Zebra', PREFIX_MOBILE = 'Mobile ', SUFFIX_BROWSER = ' Browser', CHROME = 'Chrome', CHROMECAST = 'Chromecast', EDGE = 'Edge', FIREFOX = 'Firefox', OPERA = 'Opera', FACEBOOK = 'Facebook', SOGOU = 'Sogou', WINDOWS = 'Windows'; - var isWindow = typeof window !== UNDEF_TYPE, NAVIGATOR = isWindow && window.navigator ? window.navigator : void 0, NAVIGATOR_UADATA = NAVIGATOR && NAVIGATOR.userAgentData ? NAVIGATOR.userAgentData : void 0; - /////////// - // Helper - ////////// - var extend = function(defaultRgx, extensions) { - var mergedRgx = {}; - var extraRgx = extensions; - if (!isExtensions(extensions)) { - extraRgx = {}; - for(var i in extensions)for(var j in extensions[i])extraRgx[j] = extensions[i][j].concat(extraRgx[j] ? extraRgx[j] : []); - } - for(var k in defaultRgx)mergedRgx[k] = extraRgx[k] && extraRgx[k].length % 2 === 0 ? extraRgx[k].concat(defaultRgx[k]) : defaultRgx[k]; - return mergedRgx; - }, enumerize = function(arr) { - var enums = {}; - for(var i = 0; i < arr.length; i++)enums[arr[i].toUpperCase()] = arr[i]; - return enums; - }, has = function(str1, str2) { - if (typeof str1 === OBJ_TYPE && str1.length > 0) { - for(var i in str1)if (lowerize(str1[i]) == lowerize(str2)) return true; - return false; - } - return !!isString(str1) && -1 !== lowerize(str2).indexOf(lowerize(str1)); - }, isExtensions = function(obj, deep) { - for(var prop in obj)return /^(browser|cpu|device|engine|os)$/.test(prop) || !!deep && isExtensions(obj[prop]); - }, isString = function(val) { - return typeof val === STR_TYPE; - }, itemListToArray = function(header) { - if (!header) return; - var arr = []; - var tokens = strip(/\\?\"/g, header).split(','); - for(var i = 0; i < tokens.length; i++)if (tokens[i].indexOf(';') > -1) { - var token = ua_parser_trim(tokens[i]).split(';v='); - arr[i] = { - brand: token[0], - version: token[1] - }; - } else arr[i] = ua_parser_trim(tokens[i]); - return arr; - }, lowerize = function(str) { - return isString(str) ? str.toLowerCase() : str; - }, majorize = function(version) { - return isString(version) ? strip(/[^\d\.]/g, version).split('.')[0] : void 0; - }, setProps = function(arr) { - for(var i in arr){ - var propName = arr[i]; - if (typeof propName == OBJ_TYPE && 2 == propName.length) this[propName[0]] = propName[1]; - else this[propName] = void 0; - } - return this; - }, strip = function(pattern, str) { - return isString(str) ? str.replace(pattern, EMPTY) : str; - }, stripQuotes = function(str) { - return strip(/\\?\"/g, str); - }, ua_parser_trim = function(str, len) { - if (isString(str)) { - str = strip(/^\s\s*/, str); - return typeof len === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH); - } - }; - /////////////// - // Map helper - ////////////// - var rgxMapper = function(ua, arrays) { - if (!ua || !arrays) return; - var i = 0, j, k, p, q, matches, match; - // loop through all regexes maps - while(i < arrays.length && !matches){ - var regex = arrays[i], props = arrays[i + 1]; // odd sequence (1,3,5,..) - j = k = 0; - // try matching uastring with regexes - while(j < regex.length && !matches){ - if (!regex[j]) break; - matches = regex[j++].exec(ua); - if (!!matches) for(p = 0; p < props.length; p++){ - match = matches[++k]; - q = props[p]; - // check if given property is actually array - if (typeof q === OBJ_TYPE && q.length > 0) { - if (2 === q.length) { - if (typeof q[1] == FUNC_TYPE) // assign modified match - this[q[0]] = q[1].call(this, match); - else // assign given value, ignore regex match - this[q[0]] = q[1]; - } else if (3 === q.length) { - // check whether function or regex - if (typeof q[1] !== FUNC_TYPE || q[1].exec && q[1].test) // sanitize match using given regex - this[q[0]] = match ? match.replace(q[1], q[2]) : void 0; - else // call function (usually string mapper) - this[q[0]] = match ? q[1].call(this, match, q[2]) : void 0; - } else if (4 === q.length) this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : void 0; - } else this[q] = match ? match : void 0; - } - } - i += 2; - } - }, strMapper = function(str, map) { - for(var i in map)// check if current value is array - if (typeof map[i] === OBJ_TYPE && map[i].length > 0) { - for(var j = 0; j < map[i].length; j++)if (has(map[i][j], str)) return i === UNKNOWN ? void 0 : i; - } else if (has(map[i], str)) return i === UNKNOWN ? void 0 : i; - return map.hasOwnProperty('*') ? map['*'] : str; - }; - /////////////// - // String map - ////////////// - var windowsVersionMap = { - ME: '4.90', - 'NT 3.11': 'NT3.51', - 'NT 4.0': 'NT4.0', - 2000: 'NT 5.0', - XP: [ - 'NT 5.1', - 'NT 5.2' - ], - Vista: 'NT 6.0', - 7: 'NT 6.1', - 8: 'NT 6.2', - '8.1': 'NT 6.3', - 10: [ - 'NT 6.4', - 'NT 10.0' - ], - RT: 'ARM' - }, formFactorsMap = { - embedded: 'Automotive', - mobile: 'Mobile', - tablet: [ - 'Tablet', - 'EInk' - ], - smarttv: 'TV', - wearable: 'Watch', - xr: [ - 'VR', - 'XR' - ], - '?': [ - 'Desktop', - 'Unknown' - ], - '*': void 0 - }; - ////////////// - // Regex map - ///////////// - var defaultRegexes = { - browser: [ - [ - // Most common regardless engine - /\b(?:crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS - ], - [ - VERSION, - [ - NAME, - PREFIX_MOBILE + 'Chrome' - ] - ], - [ - /edg(?:e|ios|a)?\/([\w\.]+)/i // Microsoft Edge - ], - [ - VERSION, - [ - NAME, - 'Edge' - ] - ], - [ - // Presto based - /(opera mini)\/([-\w\.]+)/i, - /(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i, - /(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i // Opera - ], - [ - NAME, - VERSION - ], - [ - /opios[\/ ]+([\w\.]+)/i // Opera mini on iphone >= 8.0 - ], - [ - VERSION, - [ - NAME, - OPERA + ' Mini' - ] - ], - [ - /\bop(?:rg)?x\/([\w\.]+)/i // Opera GX - ], - [ - VERSION, - [ - NAME, - OPERA + ' GX' - ] - ], - [ - /\bopr\/([\w\.]+)/i // Opera Webkit - ], - [ - VERSION, - [ - NAME, - OPERA - ] - ], - [ - // Mixed - /\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i // Baidu - ], - [ - VERSION, - [ - NAME, - 'Baidu' - ] - ], - [ - /\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i // Maxthon - ], - [ - VERSION, - [ - NAME, - 'Maxthon' - ] - ], - [ - /(kindle)\/([\w\.]+)/i, - /(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i, - // Lunascape/Maxthon/Netfront/Jasmine/Blazer/Sleipnir - // Trident based - /(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i, - /(?:ms|\()(ie) ([\w\.]+)/i, - // Blink/Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon - /(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i, - // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ//Vivaldi/DuckDuckGo/Klar/Helio/Dragon - /(heytap|ovi|115)browser\/([\d\.]+)/i, - /(weibo)__([\d\.]+)/i // Weibo - ], - [ - NAME, - VERSION - ], - [ - /quark(?:pc)?\/([-\w\.]+)/i // Quark - ], - [ - VERSION, - [ - NAME, - 'Quark' - ] - ], - [ - /\bddg\/([\w\.]+)/i // DuckDuckGo - ], - [ - VERSION, - [ - NAME, - 'DuckDuckGo' - ] - ], - [ - /(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i // UCBrowser - ], - [ - VERSION, - [ - NAME, - 'UCBrowser' - ] - ], - [ - /microm.+\bqbcore\/([\w\.]+)/i, - /\bqbcore\/([\w\.]+).+microm/i, - /micromessenger\/([\w\.]+)/i // WeChat - ], - [ - VERSION, - [ - NAME, - 'WeChat' - ] - ], - [ - /konqueror\/([\w\.]+)/i // Konqueror - ], - [ - VERSION, - [ - NAME, - 'Konqueror' - ] - ], - [ - /trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i // IE11 - ], - [ - VERSION, - [ - NAME, - 'IE' - ] - ], - [ - /ya(?:search)?browser\/([\w\.]+)/i // Yandex - ], - [ - VERSION, - [ - NAME, - 'Yandex' - ] - ], - [ - /slbrowser\/([\w\.]+)/i // Smart Lenovo Browser - ], - [ - VERSION, - [ - NAME, - 'Smart ' + LENOVO + SUFFIX_BROWSER - ] - ], - [ - /(avast|avg)\/([\w\.]+)/i // Avast/AVG Secure Browser - ], - [ - [ - NAME, - /(.+)/, - '$1 Secure' + SUFFIX_BROWSER - ], - VERSION - ], - [ - /\bfocus\/([\w\.]+)/i // Firefox Focus - ], - [ - VERSION, - [ - NAME, - FIREFOX + ' Focus' - ] - ], - [ - /\bopt\/([\w\.]+)/i // Opera Touch - ], - [ - VERSION, - [ - NAME, - OPERA + ' Touch' - ] - ], - [ - /coc_coc\w+\/([\w\.]+)/i // Coc Coc Browser - ], - [ - VERSION, - [ - NAME, - 'Coc Coc' - ] - ], - [ - /dolfin\/([\w\.]+)/i // Dolphin - ], - [ - VERSION, - [ - NAME, - 'Dolphin' - ] - ], - [ - /coast\/([\w\.]+)/i // Opera Coast - ], - [ - VERSION, - [ - NAME, - OPERA + ' Coast' - ] - ], - [ - /miuibrowser\/([\w\.]+)/i // MIUI Browser - ], - [ - VERSION, - [ - NAME, - 'MIUI' + SUFFIX_BROWSER - ] - ], - [ - /fxios\/([\w\.-]+)/i // Firefox for iOS - ], - [ - VERSION, - [ - NAME, - PREFIX_MOBILE + FIREFOX - ] - ], - [ - /\bqihoobrowser\/?([\w\.]*)/i // 360 - ], - [ - VERSION, - [ - NAME, - '360' - ] - ], - [ - /\b(qq)\/([\w\.]+)/i // QQ - ], - [ - [ - NAME, - /(.+)/, - '$1Browser' - ], - VERSION - ], - [ - /(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i - ], - [ - [ - NAME, - /(.+)/, - '$1' + SUFFIX_BROWSER - ], - VERSION - ], - [ - /samsungbrowser\/([\w\.]+)/i // Samsung Internet - ], - [ - VERSION, - [ - NAME, - SAMSUNG + ' Internet' - ] - ], - [ - /metasr[\/ ]?([\d\.]+)/i // Sogou Explorer - ], - [ - VERSION, - [ - NAME, - SOGOU + ' Explorer' - ] - ], - [ - /(sogou)mo\w+\/([\d\.]+)/i // Sogou Mobile - ], - [ - [ - NAME, - SOGOU + ' Mobile' - ], - VERSION - ], - [ - /(electron)\/([\w\.]+) safari/i, - /(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i, - /m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i // QQ/2345 - ], - [ - NAME, - VERSION - ], - [ - /(lbbrowser|rekonq)/i // LieBao Browser/Rekonq - ], - [ - NAME - ], - [ - /ome\/([\w\.]+) \w* ?(iron) saf/i, - /ome\/([\w\.]+).+qihu (360)[es]e/i // 360 - ], - [ - VERSION, - NAME - ], - [ - // WebView - /((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i // Facebook App for iOS & Android - ], - [ - [ - NAME, - FACEBOOK - ], - VERSION, - [ - TYPE, - INAPP - ] - ], - [ - /(Klarna)\/([\w\.]+)/i, - /(kakao(?:talk|story))[\/ ]([\w\.]+)/i, - /(naver)\(.*?(\d+\.[\w\.]+).*\)/i, - /safari (line)\/([\w\.]+)/i, - /\b(line)\/([\w\.]+)\/iab/i, - /(alipay)client\/([\w\.]+)/i, - /(twitter)(?:and| f.+e\/([\w\.]+))/i, - /(instagram|snapchat)[\/ ]([-\w\.]+)/i // Instagram/Snapchat - ], - [ - NAME, - VERSION, - [ - TYPE, - INAPP - ] - ], - [ - /\bgsa\/([\w\.]+) .*safari\//i // Google Search Appliance on iOS - ], - [ - VERSION, - [ - NAME, - 'GSA' - ], - [ - TYPE, - INAPP - ] - ], - [ - /musical_ly(?:.+app_?version\/|_)([\w\.]+)/i // TikTok - ], - [ - VERSION, - [ - NAME, - 'TikTok' - ], - [ - TYPE, - INAPP - ] - ], - [ - /\[(linkedin)app\]/i // LinkedIn App for iOS & Android - ], - [ - NAME, - [ - TYPE, - INAPP - ] - ], - [ - /(chromium)[\/ ]([-\w\.]+)/i // Chromium - ], - [ - NAME, - VERSION - ], - [ - /headlesschrome(?:\/([\w\.]+)| )/i // Chrome Headless - ], - [ - VERSION, - [ - NAME, - CHROME + ' Headless' - ] - ], - [ - / wv\).+(chrome)\/([\w\.]+)/i // Chrome WebView - ], - [ - [ - NAME, - CHROME + ' WebView' - ], - VERSION - ], - [ - /droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i // Android Browser - ], - [ - VERSION, - [ - NAME, - 'Android' + SUFFIX_BROWSER - ] - ], - [ - /chrome\/([\w\.]+) mobile/i // Chrome Mobile - ], - [ - VERSION, - [ - NAME, - PREFIX_MOBILE + 'Chrome' - ] - ], - [ - /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia - ], - [ - NAME, - VERSION - ], - [ - /version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i // Safari Mobile - ], - [ - VERSION, - [ - NAME, - PREFIX_MOBILE + 'Safari' - ] - ], - [ - /iphone .*mobile(?:\/\w+ | ?)safari/i - ], - [ - [ - NAME, - PREFIX_MOBILE + 'Safari' - ] - ], - [ - /version\/([\w\.\,]+) .*(safari)/i // Safari - ], - [ - VERSION, - NAME - ], - [ - /webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i // Safari < 3.0 - ], - [ - NAME, - [ - VERSION, - '1' - ] - ], - [ - /(webkit|khtml)\/([\w\.]+)/i - ], - [ - NAME, - VERSION - ], - [ - // Gecko based - /(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i // Firefox Mobile - ], - [ - [ - NAME, - PREFIX_MOBILE + FIREFOX - ], - VERSION - ], - [ - /(navigator|netscape\d?)\/([-\w\.]+)/i // Netscape - ], - [ - [ - NAME, - 'Netscape' - ], - VERSION - ], - [ - /(wolvic|librewolf)\/([\w\.]+)/i // Wolvic/LibreWolf - ], - [ - NAME, - VERSION - ], - [ - /mobile vr; rv:([\w\.]+)\).+firefox/i // Firefox Reality - ], - [ - VERSION, - [ - NAME, - FIREFOX + ' Reality' - ] - ], - [ - /ekiohf.+(flow)\/([\w\.]+)/i, - /(swiftfox)/i, - /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i, - // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror - /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i, - // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix - /(firefox)\/([\w\.]+)/i, - /(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i, - // Other - /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i, - // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Obigo/Mosaic/Go/ICE/UP.Browser - /\b(links) \(([\w\.]+)/i // Links - ], - [ - NAME, - [ - VERSION, - /_/g, - '.' - ] - ], - [ - /(cobalt)\/([\w\.]+)/i // Cobalt - ], - [ - NAME, - [ - VERSION, - /[^\d\.]+./, - EMPTY - ] - ] - ], - cpu: [ - [ - /\b(?:(amd|x|x86[-_]?|wow|win)64)\b/i // AMD64 (x64) - ], - [ - [ - ARCHITECTURE, - 'amd64' - ] - ], - [ - /(ia32(?=;))/i, - /((?:i[346]|x)86)[;\)]/i // IA32 (x86) - ], - [ - [ - ARCHITECTURE, - 'ia32' - ] - ], - [ - /\b(aarch64|arm(v?8e?l?|_?64))\b/i // ARM64 - ], - [ - [ - ARCHITECTURE, - 'arm64' - ] - ], - [ - /\b(arm(?:v[67])?ht?n?[fl]p?)\b/i // ARMHF - ], - [ - [ - ARCHITECTURE, - 'armhf' - ] - ], - [ - // PocketPC mistakenly identified as PowerPC - /windows (ce|mobile); ppc;/i - ], - [ - [ - ARCHITECTURE, - 'arm' - ] - ], - [ - /((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i // PowerPC - ], - [ - [ - ARCHITECTURE, - /ower/, - EMPTY, - lowerize - ] - ], - [ - /(sun4\w)[;\)]/i // SPARC - ], - [ - [ - ARCHITECTURE, - 'sparc' - ] - ], - [ - /((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i - ], - [ - [ - ARCHITECTURE, - lowerize - ] - ] - ], - device: [ - [ - ////////////////////////// - // MOBILES & TABLETS - ///////////////////////// - // Samsung - /\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i - ], - [ - MODEL, - [ - VENDOR, - SAMSUNG - ], - [ - TYPE, - TABLET - ] - ], - [ - /\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i, - /samsung[- ]((?!sm-[lr])[-\w]+)/i, - /sec-(sgh\w+)/i - ], - [ - MODEL, - [ - VENDOR, - SAMSUNG - ], - [ - TYPE, - MOBILE - ] - ], - [ - // Apple - /(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i // iPod/iPhone - ], - [ - MODEL, - [ - VENDOR, - APPLE - ], - [ - TYPE, - MOBILE - ] - ], - [ - /\((ipad);[-\w\),; ]+apple/i, - /applecoremedia\/[\w\.]+ \((ipad)/i, - /\b(ipad)\d\d?,\d\d?[;\]].+ios/i - ], - [ - MODEL, - [ - VENDOR, - APPLE - ], - [ - TYPE, - TABLET - ] - ], - [ - /(macintosh);/i - ], - [ - MODEL, - [ - VENDOR, - APPLE - ] - ], - [ - // Sharp - /\b(sh-?[altvz]?\d\d[a-ekm]?)/i - ], - [ - MODEL, - [ - VENDOR, - SHARP - ], - [ - TYPE, - MOBILE - ] - ], - [ - // Honor - /(?:honor)([-\w ]+)[;\)]/i - ], - [ - MODEL, - [ - VENDOR, - HONOR - ], - [ - TYPE, - MOBILE - ] - ], - [ - // Huawei - /\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i - ], - [ - MODEL, - [ - VENDOR, - HUAWEI - ], - [ - TYPE, - TABLET - ] - ], - [ - /(?:huawei)([-\w ]+)[;\)]/i, - /\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i - ], - [ - MODEL, - [ - VENDOR, - HUAWEI - ], - [ - TYPE, - MOBILE - ] - ], - [ - // Xiaomi - /\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i, - /\b; (\w+) build\/hm\1/i, - /\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i, - /\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i, - /oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i, - /\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i // Xiaomi Mi - ], - [ - [ - MODEL, - /_/g, - ' ' - ], - [ - VENDOR, - XIAOMI - ], - [ - TYPE, - MOBILE - ] - ], - [ - /oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i, - /\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i // Mi Pad tablets - ], - [ - [ - MODEL, - /_/g, - ' ' - ], - [ - VENDOR, - XIAOMI - ], - [ - TYPE, - TABLET - ] - ], - [ - // OPPO - /; (\w+) bui.+ oppo/i, - /\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i - ], - [ - MODEL, - [ - VENDOR, - 'OPPO' - ], - [ - TYPE, - MOBILE - ] - ], - [ - /\b(opd2\d{3}a?) bui/i - ], - [ - MODEL, - [ - VENDOR, - 'OPPO' - ], - [ - TYPE, - TABLET - ] - ], - [ - // Vivo - /vivo (\w+)(?: bui|\))/i, - /\b(v[12]\d{3}\w?[at])(?: bui|;)/i - ], - [ - MODEL, - [ - VENDOR, - 'Vivo' - ], - [ - TYPE, - MOBILE - ] - ], - [ - // Realme - /\b(rmx[1-3]\d{3})(?: bui|;|\))/i - ], - [ - MODEL, - [ - VENDOR, - 'Realme' - ], - [ - TYPE, - MOBILE - ] - ], - [ - // Motorola - /\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i, - /\bmot(?:orola)?[- ](\w*)/i, - /((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i - ], - [ - MODEL, - [ - VENDOR, - MOTOROLA - ], - [ - TYPE, - MOBILE - ] - ], - [ - /\b(mz60\d|xoom[2 ]{0,2}) build\//i - ], - [ - MODEL, - [ - VENDOR, - MOTOROLA - ], - [ - TYPE, - TABLET - ] - ], - [ - // LG - /((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i - ], - [ - MODEL, - [ - VENDOR, - LG - ], - [ - TYPE, - TABLET - ] - ], - [ - /(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i, - /\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i, - /\blg-?([\d\w]+) bui/i - ], - [ - MODEL, - [ - VENDOR, - LG - ], - [ - TYPE, - MOBILE - ] - ], - [ - // Lenovo - /(ideatab[-\w ]+)/i, - /lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i - ], - [ - MODEL, - [ - VENDOR, - LENOVO - ], - [ - TYPE, - TABLET - ] - ], - [ - // Nokia - /(?:maemo|nokia).*(n900|lumia \d+)/i, - /nokia[-_ ]?([-\w\.]*)/i - ], - [ - [ - MODEL, - /_/g, - ' ' - ], - [ - VENDOR, - 'Nokia' - ], - [ - TYPE, - MOBILE - ] - ], - [ - // Google - /(pixel c)\b/i // Google Pixel C - ], - [ - MODEL, - [ - VENDOR, - GOOGLE - ], - [ - TYPE, - TABLET - ] - ], - [ - /droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i // Google Pixel - ], - [ - MODEL, - [ - VENDOR, - GOOGLE - ], - [ - TYPE, - MOBILE - ] - ], - [ - // Sony - /droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i - ], - [ - MODEL, - [ - VENDOR, - SONY - ], - [ - TYPE, - MOBILE - ] - ], - [ - /sony tablet [ps]/i, - /\b(?:sony)?sgp\w+(?: bui|\))/i - ], - [ - [ - MODEL, - 'Xperia Tablet' - ], - [ - VENDOR, - SONY - ], - [ - TYPE, - TABLET - ] - ], - [ - // OnePlus - / (kb2005|in20[12]5|be20[12][59])\b/i, - /(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i - ], - [ - MODEL, - [ - VENDOR, - 'OnePlus' - ], - [ - TYPE, - MOBILE - ] - ], - [ - // Amazon - /(alexa)webm/i, - /(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i, - /(kf[a-z]+)( bui|\)).+silk\//i // Kindle Fire HD - ], - [ - MODEL, - [ - VENDOR, - AMAZON - ], - [ - TYPE, - TABLET - ] - ], - [ - /((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i // Fire Phone - ], - [ - [ - MODEL, - /(.+)/g, - 'Fire Phone $1' - ], - [ - VENDOR, - AMAZON - ], - [ - TYPE, - MOBILE - ] - ], - [ - // BlackBerry - /(playbook);[-\w\),; ]+(rim)/i // BlackBerry PlayBook - ], - [ - MODEL, - VENDOR, - [ - TYPE, - TABLET - ] - ], - [ - /\b((?:bb[a-f]|st[hv])100-\d)/i, - /\(bb10; (\w+)/i // BlackBerry 10 - ], - [ - MODEL, - [ - VENDOR, - BLACKBERRY - ], - [ - TYPE, - MOBILE - ] - ], - [ - // Asus - /(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i - ], - [ - MODEL, - [ - VENDOR, - ASUS - ], - [ - TYPE, - TABLET - ] - ], - [ - / (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i - ], - [ - MODEL, - [ - VENDOR, - ASUS - ], - [ - TYPE, - MOBILE - ] - ], - [ - // HTC - /(nexus 9)/i // HTC Nexus 9 - ], - [ - MODEL, - [ - VENDOR, - 'HTC' - ], - [ - TYPE, - TABLET - ] - ], - [ - /(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i, - // ZTE - /(zte)[- ]([\w ]+?)(?: bui|\/|\))/i, - /(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i // Alcatel/GeeksPhone/Nexian/Panasonic/Sony - ], - [ - VENDOR, - [ - MODEL, - /_/g, - ' ' - ], - [ - TYPE, - MOBILE - ] - ], - [ - // TCL - /tcl (xess p17aa)/i, - /droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i - ], - [ - MODEL, - [ - VENDOR, - 'TCL' - ], - [ - TYPE, - TABLET - ] - ], - [ - /droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i - ], - [ - MODEL, - [ - VENDOR, - 'TCL' - ], - [ - TYPE, - MOBILE - ] - ], - [ - // itel - /(itel) ((\w+))/i - ], - [ - [ - VENDOR, - lowerize - ], - MODEL, - [ - TYPE, - strMapper, - { - tablet: [ - 'p10001l', - 'w7001' - ], - '*': 'mobile' - } - ] - ], - [ - // Acer - /droid.+; ([ab][1-7]-?[0178a]\d\d?)/i - ], - [ - MODEL, - [ - VENDOR, - 'Acer' - ], - [ - TYPE, - TABLET - ] - ], - [ - // Meizu - /droid.+; (m[1-5] note) bui/i, - /\bmz-([-\w]{2,})/i - ], - [ - MODEL, - [ - VENDOR, - 'Meizu' - ], - [ - TYPE, - MOBILE - ] - ], - [ - // Ulefone - /; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i - ], - [ - MODEL, - [ - VENDOR, - 'Ulefone' - ], - [ - TYPE, - MOBILE - ] - ], - [ - // Energizer - /; (energy ?\w+)(?: bui|\))/i, - /; energizer ([\w ]+)(?: bui|\))/i - ], - [ - MODEL, - [ - VENDOR, - 'Energizer' - ], - [ - TYPE, - MOBILE - ] - ], - [ - // Cat - /; cat (b35);/i, - /; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i - ], - [ - MODEL, - [ - VENDOR, - 'Cat' - ], - [ - TYPE, - MOBILE - ] - ], - [ - // Smartfren - /((?:new )?andromax[\w- ]+)(?: bui|\))/i - ], - [ - MODEL, - [ - VENDOR, - 'Smartfren' - ], - [ - TYPE, - MOBILE - ] - ], - [ - // Nothing - /droid.+; (a(?:015|06[35]|142p?))/i - ], - [ - MODEL, - [ - VENDOR, - 'Nothing' - ], - [ - TYPE, - MOBILE - ] - ], - [ - // MIXED - /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i, - // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron/Infinix/Tecno/Micromax/Advan - /; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i, - /(hp) ([\w ]+\w)/i, - /(asus)-?(\w+)/i, - /(microsoft); (lumia[\w ]+)/i, - /(lenovo)[-_ ]?([-\w]+)/i, - /(jolla)/i, - /(oppo) ?([\w ]+) bui/i // OPPO - ], - [ - VENDOR, - MODEL, - [ - TYPE, - MOBILE - ] - ], - [ - /(imo) (tab \w+)/i, - /(kobo)\s(ereader|touch)/i, - /(archos) (gamepad2?)/i, - /(hp).+(touchpad(?!.+tablet)|tablet)/i, - /(kindle)\/([\w\.]+)/i // Kindle - ], - [ - VENDOR, - MODEL, - [ - TYPE, - TABLET - ] - ], - [ - /(surface duo)/i // Surface Duo - ], - [ - MODEL, - [ - VENDOR, - MICROSOFT - ], - [ - TYPE, - TABLET - ] - ], - [ - /droid [\d\.]+; (fp\du?)(?: b|\))/i // Fairphone - ], - [ - MODEL, - [ - VENDOR, - 'Fairphone' - ], - [ - TYPE, - MOBILE - ] - ], - [ - /(shield[\w ]+) b/i // Nvidia Shield Tablets - ], - [ - MODEL, - [ - VENDOR, - 'Nvidia' - ], - [ - TYPE, - TABLET - ] - ], - [ - /(sprint) (\w+)/i // Sprint Phones - ], - [ - VENDOR, - MODEL, - [ - TYPE, - MOBILE - ] - ], - [ - /(kin\.[onetw]{3})/i // Microsoft Kin - ], - [ - [ - MODEL, - /\./g, - ' ' - ], - [ - VENDOR, - MICROSOFT - ], - [ - TYPE, - MOBILE - ] - ], - [ - /droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i // Zebra - ], - [ - MODEL, - [ - VENDOR, - ZEBRA - ], - [ - TYPE, - TABLET - ] - ], - [ - /droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i - ], - [ - MODEL, - [ - VENDOR, - ZEBRA - ], - [ - TYPE, - MOBILE - ] - ], - [ - /////////////////// - // SMARTTVS - /////////////////// - /smart-tv.+(samsung)/i // Samsung - ], - [ - VENDOR, - [ - TYPE, - SMARTTV - ] - ], - [ - /hbbtv.+maple;(\d+)/i - ], - [ - [ - MODEL, - /^/, - 'SmartTV' - ], - [ - VENDOR, - SAMSUNG - ], - [ - TYPE, - SMARTTV - ] - ], - [ - /(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i // LG SmartTV - ], - [ - [ - VENDOR, - LG - ], - [ - TYPE, - SMARTTV - ] - ], - [ - /(apple) ?tv/i // Apple TV - ], - [ - VENDOR, - [ - MODEL, - APPLE + ' TV' - ], - [ - TYPE, - SMARTTV - ] - ], - [ - /crkey.*devicetype\/chromecast/i // Google Chromecast Third Generation - ], - [ - [ - MODEL, - CHROMECAST + ' Third Generation' - ], - [ - VENDOR, - GOOGLE - ], - [ - TYPE, - SMARTTV - ] - ], - [ - /crkey.*devicetype\/([^/]*)/i // Google Chromecast with specific device type - ], - [ - [ - MODEL, - /^/, - 'Chromecast ' - ], - [ - VENDOR, - GOOGLE - ], - [ - TYPE, - SMARTTV - ] - ], - [ - /fuchsia.*crkey/i // Google Chromecast Nest Hub - ], - [ - [ - MODEL, - CHROMECAST + ' Nest Hub' - ], - [ - VENDOR, - GOOGLE - ], - [ - TYPE, - SMARTTV - ] - ], - [ - /crkey/i // Google Chromecast, Linux-based or unknown - ], - [ - [ - MODEL, - CHROMECAST - ], - [ - VENDOR, - GOOGLE - ], - [ - TYPE, - SMARTTV - ] - ], - [ - /droid.+aft(\w+)( bui|\))/i // Fire TV - ], - [ - MODEL, - [ - VENDOR, - AMAZON - ], - [ - TYPE, - SMARTTV - ] - ], - [ - /\(dtv[\);].+(aquos)/i, - /(aquos-tv[\w ]+)\)/i // Sharp - ], - [ - MODEL, - [ - VENDOR, - SHARP - ], - [ - TYPE, - SMARTTV - ] - ], - [ - /(bravia[\w ]+)( bui|\))/i // Sony - ], - [ - MODEL, - [ - VENDOR, - SONY - ], - [ - TYPE, - SMARTTV - ] - ], - [ - /(mitv-\w{5}) bui/i // Xiaomi - ], - [ - MODEL, - [ - VENDOR, - XIAOMI - ], - [ - TYPE, - SMARTTV - ] - ], - [ - /Hbbtv.*(technisat) (.*);/i // TechniSAT - ], - [ - VENDOR, - MODEL, - [ - TYPE, - SMARTTV - ] - ], - [ - /\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i, - /hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i // HbbTV devices - ], - [ - [ - VENDOR, - ua_parser_trim - ], - [ - MODEL, - ua_parser_trim - ], - [ - TYPE, - SMARTTV - ] - ], - [ - /\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i // SmartTV from Unidentified Vendors - ], - [ - [ - TYPE, - SMARTTV - ] - ], - [ - /////////////////// - // CONSOLES - /////////////////// - /(ouya)/i, - /(nintendo) (\w+)/i // Nintendo - ], - [ - VENDOR, - MODEL, - [ - TYPE, - CONSOLE - ] - ], - [ - /droid.+; (shield) bui/i // Nvidia - ], - [ - MODEL, - [ - VENDOR, - 'Nvidia' - ], - [ - TYPE, - CONSOLE - ] - ], - [ - /(playstation \w+)/i // Playstation - ], - [ - MODEL, - [ - VENDOR, - SONY - ], - [ - TYPE, - CONSOLE - ] - ], - [ - /\b(xbox(?: one)?(?!; xbox))[\); ]/i // Microsoft Xbox - ], - [ - MODEL, - [ - VENDOR, - MICROSOFT - ], - [ - TYPE, - CONSOLE - ] - ], - [ - /////////////////// - // WEARABLES - /////////////////// - /\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i // Samsung Galaxy Watch - ], - [ - MODEL, - [ - VENDOR, - SAMSUNG - ], - [ - TYPE, - WEARABLE - ] - ], - [ - /((pebble))app/i // Pebble - ], - [ - VENDOR, - MODEL, - [ - TYPE, - WEARABLE - ] - ], - [ - /(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i // Apple Watch - ], - [ - MODEL, - [ - VENDOR, - APPLE - ], - [ - TYPE, - WEARABLE - ] - ], - [ - /droid.+; (wt63?0{2,3})\)/i - ], - [ - MODEL, - [ - VENDOR, - ZEBRA - ], - [ - TYPE, - WEARABLE - ] - ], - [ - /////////////////// - // XR - /////////////////// - /droid.+; (glass) \d/i // Google Glass - ], - [ - MODEL, - [ - VENDOR, - GOOGLE - ], - [ - TYPE, - XR - ] - ], - [ - /(pico) (4|neo3(?: link|pro)?)/i // Pico - ], - [ - VENDOR, - MODEL, - [ - TYPE, - XR - ] - ], - [ - /; (quest( \d| pro)?)/i // Oculus Quest - ], - [ - MODEL, - [ - VENDOR, - FACEBOOK - ], - [ - TYPE, - XR - ] - ], - [ - /////////////////// - // EMBEDDED - /////////////////// - /(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i // Tesla - ], - [ - VENDOR, - [ - TYPE, - EMBEDDED - ] - ], - [ - /(aeobc)\b/i // Echo Dot - ], - [ - MODEL, - [ - VENDOR, - AMAZON - ], - [ - TYPE, - EMBEDDED - ] - ], - [ - //////////////////// - // MIXED (GENERIC) - /////////////////// - /droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i // Android Phones from Unidentified Vendors - ], - [ - MODEL, - [ - TYPE, - MOBILE - ] - ], - [ - /droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i // Android Tablets from Unidentified Vendors - ], - [ - MODEL, - [ - TYPE, - TABLET - ] - ], - [ - /\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i // Unidentifiable Tablet - ], - [ - [ - TYPE, - TABLET - ] - ], - [ - /(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile - ], - [ - [ - TYPE, - MOBILE - ] - ], - [ - /(android[-\w\. ]{0,9});.+buil/i // Generic Android Device - ], - [ - MODEL, - [ - VENDOR, - 'Generic' - ] - ] - ], - engine: [ - [ - /windows.+ edge\/([\w\.]+)/i // EdgeHTML - ], - [ - VERSION, - [ - NAME, - EDGE + 'HTML' - ] - ], - [ - /(arkweb)\/([\w\.]+)/i // ArkWeb - ], - [ - NAME, - VERSION - ], - [ - /webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i // Blink - ], - [ - VERSION, - [ - NAME, - 'Blink' - ] - ], - [ - /(presto)\/([\w\.]+)/i, - /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i, - /ekioh(flow)\/([\w\.]+)/i, - /(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i, - /(icab)[\/ ]([23]\.[\d\.]+)/i, - /\b(libweb)/i - ], - [ - NAME, - VERSION - ], - [ - /rv\:([\w\.]{1,9})\b.+(gecko)/i // Gecko - ], - [ - VERSION, - NAME - ] - ], - os: [ - [ - // Windows - /microsoft (windows) (vista|xp)/i // Windows (iTunes) - ], - [ - NAME, - VERSION - ], - [ - /(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i // Windows Phone - ], - [ - NAME, - [ - VERSION, - strMapper, - windowsVersionMap - ] - ], - [ - /windows nt 6\.2; (arm)/i, - /windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i, - /(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i - ], - [ - [ - VERSION, - strMapper, - windowsVersionMap - ], - [ - NAME, - WINDOWS - ] - ], - [ - // iOS/macOS - /ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i, - /(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i, - /cfnetwork\/.+darwin/i - ], - [ - [ - VERSION, - /_/g, - '.' - ], - [ - NAME, - 'iOS' - ] - ], - [ - /(mac os x) ?([\w\. ]*)/i, - /(macintosh|mac_powerpc\b)(?!.+haiku)/i // Mac OS - ], - [ - [ - NAME, - 'macOS' - ], - [ - VERSION, - /_/g, - '.' - ] - ], - [ - // Google Chromecast - /android ([\d\.]+).*crkey/i // Google Chromecast, Android-based - ], - [ - VERSION, - [ - NAME, - CHROMECAST + ' Android' - ] - ], - [ - /fuchsia.*crkey\/([\d\.]+)/i // Google Chromecast, Fuchsia-based - ], - [ - VERSION, - [ - NAME, - CHROMECAST + ' Fuchsia' - ] - ], - [ - /crkey\/([\d\.]+).*devicetype\/smartspeaker/i // Google Chromecast, Linux-based Smart Speaker - ], - [ - VERSION, - [ - NAME, - CHROMECAST + ' SmartSpeaker' - ] - ], - [ - /linux.*crkey\/([\d\.]+)/i // Google Chromecast, Legacy Linux-based - ], - [ - VERSION, - [ - NAME, - CHROMECAST + ' Linux' - ] - ], - [ - /crkey\/([\d\.]+)/i // Google Chromecast, unknown - ], - [ - VERSION, - [ - NAME, - CHROMECAST - ] - ], - [ - // Mobile OSes - /droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS - ], - [ - VERSION, - NAME - ], - [ - /(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i, - /(blackberry)\w*\/([\w\.]*)/i, - /(tizen|kaios)[\/ ]([\w\.]+)/i, - /\((series40);/i // Series 40 - ], - [ - NAME, - VERSION - ], - [ - /\(bb(10);/i // BlackBerry 10 - ], - [ - VERSION, - [ - NAME, - BLACKBERRY - ] - ], - [ - /(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i // Symbian - ], - [ - VERSION, - [ - NAME, - 'Symbian' - ] - ], - [ - /mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i // Firefox OS - ], - [ - VERSION, - [ - NAME, - FIREFOX + ' OS' - ] - ], - [ - /web0s;.+rt(tv)/i, - /\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i // WebOS - ], - [ - VERSION, - [ - NAME, - 'webOS' - ] - ], - [ - /watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i // watchOS - ], - [ - VERSION, - [ - NAME, - 'watchOS' - ] - ], - [ - // Google ChromeOS - /(cros) [\w]+(?:\)| ([\w\.]+)\b)/i // Chromium OS - ], - [ - [ - NAME, - "Chrome OS" - ], - VERSION - ], - [ - // Smart TVs - /panasonic;(viera)/i, - /(netrange)mmh/i, - /(nettv)\/(\d+\.[\w\.]+)/i, - // Console - /(nintendo|playstation) (\w+)/i, - /(xbox); +xbox ([^\);]+)/i, - /(pico) .+os([\w\.]+)/i, - // Other - /\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i, - /(mint)[\/\(\) ]?(\w*)/i, - /(mageia|vectorlinux)[; ]/i, - /([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i, - // Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire - /(hurd|linux) ?([\w\.]*)/i, - /(gnu) ?([\w\.]*)/i, - /\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i, - /(haiku) (\w+)/i // Haiku - ], - [ - NAME, - VERSION - ], - [ - /(sunos) ?([\w\.\d]*)/i // Solaris - ], - [ - [ - NAME, - 'Solaris' - ], - VERSION - ], - [ - /((?:open)?solaris)[-\/ ]?([\w\.]*)/i, - /(aix) ((\d)(?=\.|\)| )[\w\.])*/i, - /\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i, - /(unix) ?([\w\.]*)/i // UNIX - ], - [ - NAME, - VERSION - ] - ] - }; - ///////////////// - // Factories - //////////////// - var defaultProps = function() { - var props = { - init: {}, - isIgnore: {}, - isIgnoreRgx: {}, - toString: {} - }; - setProps.call(props.init, [ - [ - UA_BROWSER, - [ - NAME, - VERSION, - MAJOR, - TYPE - ] - ], - [ - UA_CPU, - [ - ARCHITECTURE - ] - ], - [ - UA_DEVICE, - [ - TYPE, - MODEL, - VENDOR - ] - ], - [ - UA_ENGINE, - [ - NAME, - VERSION - ] - ], - [ - UA_OS, - [ - NAME, - VERSION - ] - ] - ]); - setProps.call(props.isIgnore, [ - [ - UA_BROWSER, - [ - VERSION, - MAJOR - ] - ], - [ - UA_ENGINE, - [ - VERSION - ] - ], - [ - UA_OS, - [ - VERSION - ] - ] - ]); - setProps.call(props.isIgnoreRgx, [ - [ - UA_BROWSER, - / ?browser$/i - ], - [ - UA_OS, - / ?os$/i - ] - ]); - setProps.call(props.toString, [ - [ - UA_BROWSER, - [ - NAME, - VERSION - ] - ], - [ - UA_CPU, - [ - ARCHITECTURE - ] - ], - [ - UA_DEVICE, - [ - VENDOR, - MODEL - ] - ], - [ - UA_ENGINE, - [ - NAME, - VERSION - ] - ], - [ - UA_OS, - [ - NAME, - VERSION - ] - ] - ]); - return props; - }(); - var createIData = function(item, itemType) { - var init_props = defaultProps.init[itemType], is_ignoreProps = defaultProps.isIgnore[itemType] || 0, is_ignoreRgx = defaultProps.isIgnoreRgx[itemType] || 0, toString_props = defaultProps.toString[itemType] || 0; - function IData() { - setProps.call(this, init_props); - } - IData.prototype.getItem = function() { - return item; - }; - IData.prototype.withClientHints = function() { - // nodejs / non-client-hints browsers - if (!NAVIGATOR_UADATA) return item.parseCH().get(); - // browsers based on chromium 85+ - return NAVIGATOR_UADATA.getHighEntropyValues(CH_ALL_VALUES).then(function(res) { - return item.setCH(new UACHData(res, false)).parseCH().get(); - }); - }; - IData.prototype.withFeatureCheck = function() { - return item.detectFeature().get(); - }; - if (itemType != UA_RESULT) { - IData.prototype.is = function(strToCheck) { - var is = false; - for(var i in this)if (this.hasOwnProperty(i) && !has(is_ignoreProps, i) && lowerize(is_ignoreRgx ? strip(is_ignoreRgx, this[i]) : this[i]) == lowerize(is_ignoreRgx ? strip(is_ignoreRgx, strToCheck) : strToCheck)) { - is = true; - if (strToCheck != UNDEF_TYPE) break; - } else if (strToCheck == UNDEF_TYPE && is) { - is = !is; - break; - } - return is; - }; - IData.prototype.toString = function() { - var str = EMPTY; - for(var i in toString_props)if (typeof this[toString_props[i]] !== UNDEF_TYPE) str += (str ? ' ' : EMPTY) + this[toString_props[i]]; - return str || UNDEF_TYPE; - }; - } - if (!NAVIGATOR_UADATA) IData.prototype.then = function(cb) { - var that = this; - var IDataResolve = function() { - for(var prop in that)if (that.hasOwnProperty(prop)) this[prop] = that[prop]; - }; - IDataResolve.prototype = { - is: IData.prototype.is, - toString: IData.prototype.toString - }; - var resolveData = new IDataResolve(); - cb(resolveData); - return resolveData; - }; - return new IData(); - }; - ///////////////// - // Constructor - //////////////// - function UACHData(uach, isHttpUACH) { - uach = uach || {}; - setProps.call(this, CH_ALL_VALUES); - if (isHttpUACH) setProps.call(this, [ - [ - BRANDS, - itemListToArray(uach[CH_HEADER]) - ], - [ - FULLVERLIST, - itemListToArray(uach[CH_HEADER_FULL_VER_LIST]) - ], - [ - MOBILE, - /\?1/.test(uach[CH_HEADER_MOBILE]) - ], - [ - MODEL, - stripQuotes(uach[CH_HEADER_MODEL]) - ], - [ - PLATFORM, - stripQuotes(uach[CH_HEADER_PLATFORM]) - ], - [ - PLATFORMVER, - stripQuotes(uach[CH_HEADER_PLATFORM_VER]) - ], - [ - ARCHITECTURE, - stripQuotes(uach[CH_HEADER_ARCH]) - ], - [ - FORMFACTORS, - itemListToArray(uach[CH_HEADER_FORM_FACTORS]) - ], - [ - BITNESS, - stripQuotes(uach[CH_HEADER_BITNESS]) - ] - ]); - else for(var prop in uach)if (this.hasOwnProperty(prop) && typeof uach[prop] !== UNDEF_TYPE) this[prop] = uach[prop]; - } - function UAItem(itemType, ua, rgxMap, uaCH) { - this.get = function(prop) { - if (!prop) return this.data; - return this.data.hasOwnProperty(prop) ? this.data[prop] : void 0; - }; - this.set = function(prop, val) { - this.data[prop] = val; - return this; - }; - this.setCH = function(ch) { - this.uaCH = ch; - return this; - }; - this.detectFeature = function() { - if (NAVIGATOR && NAVIGATOR.userAgent == this.ua) switch(this.itemType){ - case UA_BROWSER: - // Brave-specific detection - if (NAVIGATOR.brave && typeof NAVIGATOR.brave.isBrave == FUNC_TYPE) this.set(NAME, 'Brave'); - break; - case UA_DEVICE: - // Chrome-specific detection: check for 'mobile' value of navigator.userAgentData - if (!this.get(TYPE) && NAVIGATOR_UADATA && NAVIGATOR_UADATA[MOBILE]) this.set(TYPE, MOBILE); - // iPadOS-specific detection: identified as Mac, but has some iOS-only properties - if ('Macintosh' == this.get(MODEL) && NAVIGATOR && typeof NAVIGATOR.standalone !== UNDEF_TYPE && NAVIGATOR.maxTouchPoints && NAVIGATOR.maxTouchPoints > 2) this.set(MODEL, 'iPad').set(TYPE, TABLET); - break; - case UA_OS: - // Chrome-specific detection: check for 'platform' value of navigator.userAgentData - if (!this.get(NAME) && NAVIGATOR_UADATA && NAVIGATOR_UADATA[PLATFORM]) this.set(NAME, NAVIGATOR_UADATA[PLATFORM]); - break; - case UA_RESULT: - var data = this.data; - var detect = function(itemType) { - return data[itemType].getItem().detectFeature().get(); - }; - this.set(UA_BROWSER, detect(UA_BROWSER)).set(UA_CPU, detect(UA_CPU)).set(UA_DEVICE, detect(UA_DEVICE)).set(UA_ENGINE, detect(UA_ENGINE)).set(UA_OS, detect(UA_OS)); - } - return this; - }; - this.parseUA = function() { - if (this.itemType != UA_RESULT) rgxMapper.call(this.data, this.ua, this.rgxMap); - if (this.itemType == UA_BROWSER) this.set(MAJOR, majorize(this.get(VERSION))); - return this; - }; - this.parseCH = function() { - var uaCH = this.uaCH, rgxMap = this.rgxMap; - switch(this.itemType){ - case UA_BROWSER: - var brands = uaCH[FULLVERLIST] || uaCH[BRANDS], prevName; - if (brands) for(var i in brands){ - var brandName = strip(/(Google|Microsoft) /, brands[i].brand || brands[i]), brandVersion = brands[i].version; - if (!/not.a.brand/i.test(brandName) && (!prevName || /chrom/i.test(prevName) && !/chromi/i.test(brandName))) { - this.set(NAME, brandName).set(VERSION, brandVersion).set(MAJOR, majorize(brandVersion)); - prevName = brandName; - } - } - break; - case UA_CPU: - var archName = uaCH[ARCHITECTURE]; - if (archName) { - if (archName && '64' == uaCH[BITNESS]) archName += '64'; - rgxMapper.call(this.data, archName + ';', rgxMap); - } - break; - case UA_DEVICE: - if (uaCH[MOBILE]) this.set(TYPE, MOBILE); - if (uaCH[MODEL]) this.set(MODEL, uaCH[MODEL]); - // Xbox-Specific Detection - if ('Xbox' == uaCH[MODEL]) this.set(TYPE, CONSOLE).set(VENDOR, MICROSOFT); - if (uaCH[FORMFACTORS]) { - var ff; - if ('string' != typeof uaCH[FORMFACTORS]) { - var idx = 0; - while(!ff && idx < uaCH[FORMFACTORS].length)ff = strMapper(uaCH[FORMFACTORS][idx++], formFactorsMap); - } else ff = strMapper(uaCH[FORMFACTORS], formFactorsMap); - this.set(TYPE, ff); - } - break; - case UA_OS: - var osName = uaCH[PLATFORM]; - if (osName) { - var osVersion = uaCH[PLATFORMVER]; - if (osName == WINDOWS) osVersion = parseInt(majorize(osVersion), 10) >= 13 ? '11' : '10'; - this.set(NAME, osName).set(VERSION, osVersion); - } - // Xbox-Specific Detection - if (this.get(NAME) == WINDOWS && 'Xbox' == uaCH[MODEL]) this.set(NAME, 'Xbox').set(VERSION, void 0); - break; - case UA_RESULT: - var data = this.data; - var parse = function(itemType) { - return data[itemType].getItem().setCH(uaCH).parseCH().get(); - }; - this.set(UA_BROWSER, parse(UA_BROWSER)).set(UA_CPU, parse(UA_CPU)).set(UA_DEVICE, parse(UA_DEVICE)).set(UA_ENGINE, parse(UA_ENGINE)).set(UA_OS, parse(UA_OS)); - } - return this; - }; - setProps.call(this, [ - [ - 'itemType', - itemType - ], - [ - 'ua', - ua - ], - [ - 'uaCH', - uaCH - ], - [ - 'rgxMap', - rgxMap - ], - [ - 'data', - createIData(this, itemType) - ] - ]); - return this; - } - function UAParser(ua, extensions, headers) { - if (typeof ua === OBJ_TYPE) { - if (isExtensions(ua, true)) { - if (typeof extensions === OBJ_TYPE) headers = extensions; // case UAParser(extensions, headers) - extensions = ua; // case UAParser(extensions) - } else { - headers = ua; // case UAParser(headers) - extensions = void 0; - } - ua = void 0; - } else if (typeof ua === STR_TYPE && !isExtensions(extensions, true)) { - headers = extensions; // case UAParser(ua, headers) - extensions = void 0; - } - // Convert Headers object into a plain object - if (headers && typeof headers.append === FUNC_TYPE) { - var kv = {}; - headers.forEach(function(v, k) { - kv[k] = v; - }); - headers = kv; - } - if (!(this instanceof UAParser)) return new UAParser(ua, extensions, headers).getResult(); - var userAgent = typeof ua === STR_TYPE ? ua : headers && headers[USER_AGENT] ? headers[USER_AGENT] : NAVIGATOR && NAVIGATOR.userAgent ? NAVIGATOR.userAgent : EMPTY, httpUACH = new UACHData(headers, true), regexMap = extensions ? extend(defaultRegexes, extensions) : defaultRegexes, createItemFunc = function(itemType) { - if (itemType == UA_RESULT) return function() { - return new UAItem(itemType, userAgent, regexMap, httpUACH).set('ua', userAgent).set(UA_BROWSER, this.getBrowser()).set(UA_CPU, this.getCPU()).set(UA_DEVICE, this.getDevice()).set(UA_ENGINE, this.getEngine()).set(UA_OS, this.getOS()).get(); - }; - return function() { - return new UAItem(itemType, userAgent, regexMap[itemType], httpUACH).parseUA().get(); - }; - }; - // public methods - setProps.call(this, [ - [ - 'getBrowser', - createItemFunc(UA_BROWSER) - ], - [ - 'getCPU', - createItemFunc(UA_CPU) - ], - [ - 'getDevice', - createItemFunc(UA_DEVICE) - ], - [ - 'getEngine', - createItemFunc(UA_ENGINE) - ], - [ - 'getOS', - createItemFunc(UA_OS) - ], - [ - 'getResult', - createItemFunc(UA_RESULT) - ], - [ - 'getUA', - function() { - return userAgent; - } - ], - [ - 'setUA', - function(ua) { - if (isString(ua)) userAgent = ua.length > UA_MAX_LENGTH ? ua_parser_trim(ua, UA_MAX_LENGTH) : ua; - return this; - } - ] - ]).setUA(userAgent); - return this; - } - UAParser.VERSION = LIBVERSION; - UAParser.BROWSER = enumerize([ - NAME, - VERSION, - MAJOR, - TYPE - ]); - UAParser.CPU = enumerize([ - ARCHITECTURE - ]); - UAParser.DEVICE = enumerize([ - MODEL, - VENDOR, - TYPE, - CONSOLE, - MOBILE, - SMARTTV, - TABLET, - WEARABLE, - EMBEDDED - ]); - UAParser.ENGINE = UAParser.OS = enumerize([ - NAME, - VERSION - ]); - function canPlayType_canPlayType(video, type) { - const canPlayType = video.canPlayType(`video/${type}`); - // definitely cannot be played here - if ("" === canPlayType) return false; - return canPlayType; - } - /* ESM default export */ const media_canPlayType = canPlayType_canPlayType; - var VideoType_VideoType = /*#__PURE__*/ function(VideoType) { - VideoType["WebM"] = "webm"; - VideoType["MP4"] = "mp4"; - return VideoType; - }({}); - function _define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - const FALLBACK_VIDEO_TYPE = VideoType_VideoType.MP4; - class Browser_Browser { - isIOS() { - return "iOS" === this.result.os.name; - } - getBrowserVersion() { - return this.result.browser.version; - } - isChrome() { - return "Chrome" === this.result.browser.name; - } - isChromium() { - return "Chromium" === this.result.browser.name; - } - isFirefox() { - return "Firefox" === this.result.browser.name; - } - isSafari() { - if (!this.result.browser.name) return false; - return this.result.browser.name.includes("Safari"); - } - isAndroid() { - if (!this.result.os.name) return false; - return this.result.os.name.includes("Android"); - } - isChromeBased() { - return this.isChrome() || this.isChromium(); - } - // TODO What if there are any other mobile OS out there? - isMobile() { - return this.isIOS() || this.isAndroid(); - } - isOkSafari() { - const version = this.getBrowserVersion(); - if (!version) return false; - return this.isSafari() && parseFloat(version) >= 11; - } - getVideoType(video) { - if (!this.videoType) { - if (media_canPlayType(video, VideoType_VideoType.MP4)) this.videoType = VideoType_VideoType.MP4; - else if (media_canPlayType(video, VideoType_VideoType.WebM)) this.videoType = VideoType_VideoType.WebM; - } - if (this.videoType !== VideoType_VideoType.WebM && this.videoType !== VideoType_VideoType.MP4) // We only support these two. Anything else defaults to the fallback - this.videoType = FALLBACK_VIDEO_TYPE; - if ("" === this.videoType.trim()) // Just as a fallback - this.videoType = FALLBACK_VIDEO_TYPE; - return this.videoType; - } - getNoAccessIssue() { - const message = "Unable to access webcam"; - let explanation; - explanation = this.isChromeBased() ? "Click on the allow button to grant access to your webcam" : this.isFirefox() ? "Please grant Firefox access to your webcam" : "Your system does not let your browser access your webcam"; - return error_createError({ - message, - explanation, - options: this.options - }); - } - getUsefulData() { - return { - ua: this.result.ua, - browser: this.result.browser, - cpu: this.result.cpu, - device: this.result.device, - engine: this.result.engine, - os: this.result.os - }; - } - constructor(options){ - _define_property(this, "options", void 0); - _define_property(this, "result", void 0); - _define_property(this, "videoType", void 0); - this.options = options; - const ua = defined_default()(options.fakeUaString, window.navigator.userAgent, ""); - const userAgentParser = new UAParser(ua); - this.result = userAgentParser.getResult(); - } - } - /* ESM default export */ const Browser = Browser_Browser; - let getBrowser_browser; - function getBrowser_getBrowser(localOptions) { - if (!getBrowser_browser) getBrowser_browser = new Browser(localOptions); - return getBrowser_browser; - } - /* ESM default export */ const getBrowser = getBrowser_getBrowser; - function HTTPError_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - class HTTPError_HTTPError extends Error { - constructor(...args){ - super(...args), HTTPError_define_property(this, "code", void 0), HTTPError_define_property(this, "status", void 0); - } - } - /* ESM default export */ const HTTPError = HTTPError_HTTPError; - function VideomailError_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - class VideomailError extends HTTPError { - hasClass(name) { - var _this_classList; - return null === (_this_classList = this.classList) || void 0 === _this_classList ? void 0 : _this_classList.includes(name); - } - isBrowserProblem() { - return this.hasClass(VideomailError.BROWSER_PROBLEM); - } - // this one is useful so that the notifier can have different css classes - getClassList() { - return this.classList; - } - constructor(message, options, classList, errData){ - super(message, errData), VideomailError_define_property(this, "title", "videomail-client error"), VideomailError_define_property(this, "location", window.location.href), VideomailError_define_property(this, "explanation", void 0), VideomailError_define_property(this, "logLines", void 0), VideomailError_define_property(this, "siteName", void 0), VideomailError_define_property(this, "cookie", void 0), VideomailError_define_property(this, "err", void 0), VideomailError_define_property(this, "promise", void 0), VideomailError_define_property(this, "reason", void 0), VideomailError_define_property(this, "browser", void 0), VideomailError_define_property(this, "cpu", void 0), VideomailError_define_property(this, "device", void 0), VideomailError_define_property(this, "engine", void 0), VideomailError_define_property(this, "os", void 0), VideomailError_define_property(this, "screen", void 0), VideomailError_define_property(this, "orientation", void 0), VideomailError_define_property(this, "classList", void 0); - this.explanation = null == errData ? void 0 : errData.explanation; - this.logLines = null == errData ? void 0 : errData.logLines; - this.siteName = options.siteName; - this.classList = classList; - const browser = getBrowser(options); - const usefulClientData = browser.getUsefulData(); - this.browser = usefulClientData.browser; - // Only when architecture is set, pass it over - if (usefulClientData.cpu.architecture) this.cpu = usefulClientData.cpu; - this.device = usefulClientData.device.type ? usefulClientData.device : void 0; - this.engine = usefulClientData.engine; - this.os = usefulClientData.os; - const cookie = __webpack_require__.g.document.cookie.split("; "); - this.cookie = cookie.length > 0 ? cookie.join(",\n") : void 0; - this.screen = [ - screen.width, - screen.height, - screen.colorDepth - ].join("×"); - // Needed for unit tests - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (screen.orientation) this.orientation = screen.orientation.type.toString(); - this.err = null == errData ? void 0 : errData.err; - const stackTarget = (null == errData ? void 0 : errData.cause) || (null == errData ? void 0 : errData.err); - if (stackTarget) // Maintains proper stack trace for where our error was thrown (only available on V8) - Error.captureStackTrace(stackTarget, VideomailError); - } - } - VideomailError_define_property(VideomailError, "PERMISSION_DENIED", "PERMISSION_DENIED"); - VideomailError_define_property(VideomailError, "NOT_ALLOWED_ERROR", "NotAllowedError"); - VideomailError_define_property(VideomailError, "DOM_EXCEPTION", "DOMException"); - VideomailError_define_property(VideomailError, "STARTING_FAILED", "Starting video failed"); - VideomailError_define_property(VideomailError, "MEDIA_DEVICE_NOT_SUPPORTED", "MediaDeviceNotSupported"); - VideomailError_define_property(VideomailError, "BROWSER_PROBLEM", "browser-problem"); - VideomailError_define_property(VideomailError, "WEBCAM_PROBLEM", "webcam-problem"); - VideomailError_define_property(VideomailError, "OVERCONSTRAINED", "OverconstrainedError"); - VideomailError_define_property(VideomailError, "NOT_READABLE_ERROR", "NotReadableError"); - VideomailError_define_property(VideomailError, "SECURITY_ERROR", "SecurityError"); - VideomailError_define_property(VideomailError, "TRACK_START_ERROR", "TrackStartError"); - VideomailError_define_property(VideomailError, "INVALID_STATE_ERROR", "InvalidStateError"); - /* ESM default export */ const error_VideomailError = VideomailError; - function createError(errorParams) { - const { exc, options } = errorParams; - let err = errorParams.err; - if (!err && exc instanceof Error) err = exc; - if (err instanceof error_VideomailError) return err; - let message = errorParams.message; - let explanation = errorParams.explanation; - var _errorParams_classList; - const classList = null !== (_errorParams_classList = errorParams.classList) && void 0 !== _errorParams_classList ? _errorParams_classList : []; - const audioEnabled = isAudioEnabled(options); - const browser = getBrowser(options); - var _err_name; - const errName = null !== (_err_name = null == err ? void 0 : err.name) && void 0 !== _err_name ? _err_name : null == err ? void 0 : err.constructor.name; - switch(errName){ - case error_VideomailError.SECURITY_ERROR: - message = "The operation was insecure"; - explanation = "Probably you have disallowed Cookies for this page?"; - classList.push(error_VideomailError.BROWSER_PROBLEM); - break; - case error_VideomailError.OVERCONSTRAINED: - message = "Invalid webcam constraints"; - explanation = err && "constraint" in err ? "width" === err.constraint ? "Your webcam does not meet the width requirement." : `Unmet constraint: ${err.constraint}` : null == err ? void 0 : err.toString(); - break; - case "MediaDeviceFailedDueToShutdown": - message = "Webcam is shutting down"; - explanation = "This happens your webcam is already switching off and not giving you permission to use it."; - break; - case "SourceUnavailableError": - message = "Source of your webcam cannot be accessed"; - explanation = "Probably it is locked from another process or has a hardware error."; - break; - case "NO_DEVICES_FOUND": - if (audioEnabled) { - message = "No webcam nor microphone found"; - explanation = "Your browser cannot find a webcam with microphone attached to your machine."; - } else { - message = "No webcam found"; - explanation = "Your browser cannot find a webcam attached to your machine."; - } - classList.push(error_VideomailError.WEBCAM_PROBLEM); - break; - case "PermissionDismissedError": - message = "Ooops, you didn't give me any permissions?"; - explanation = "Looks like you skipped the webcam permission dialogue.
Please grant access next time the dialogue appears."; - classList.push(error_VideomailError.WEBCAM_PROBLEM); - break; - case error_VideomailError.NOT_ALLOWED_ERROR: - case error_VideomailError.PERMISSION_DENIED: - case "PermissionDeniedError": - message = "Permission denied"; - explanation = "Cannot access your webcam. This can have two reasons:
a) you blocked access to webcam; or
b) your webcam is already in use."; - classList.push(error_VideomailError.WEBCAM_PROBLEM); - break; - case "HARDWARE_UNAVAILABLE": - message = "Webcam is unavailable"; - explanation = "Maybe it is already busy in another window?"; - if (browser.isChromeBased() || browser.isFirefox()) explanation += " Or you have to allow access above?"; - classList.push(error_VideomailError.WEBCAM_PROBLEM); - break; - case "NO_VIDEO_FEED": - message = "No video feed found!"; - explanation = "Your webcam is already used in another browser."; - classList.push(error_VideomailError.WEBCAM_PROBLEM); - break; - case error_VideomailError.STARTING_FAILED: - message = "Starting video failed"; - explanation = "Most likely this happens when the webcam is already active in another browser"; - classList.push(error_VideomailError.WEBCAM_PROBLEM); - break; - case "DevicesNotFoundError": - message = "No available webcam could be found"; - explanation = "Looks like you do not have any webcam attached to your machine; or the one you plugged in is already used."; - classList.push(error_VideomailError.WEBCAM_PROBLEM); - break; - case error_VideomailError.NOT_READABLE_ERROR: - case error_VideomailError.TRACK_START_ERROR: - message = "No access to webcam"; - explanation = "A hardware error occurred which prevented access to your webcam"; - classList.push(error_VideomailError.WEBCAM_PROBLEM); - break; - case error_VideomailError.INVALID_STATE_ERROR: - message = "Invalid state"; - explanation = "Video recording stream from your webcam already has finished"; - classList.push(error_VideomailError.WEBCAM_PROBLEM); - break; - case error_VideomailError.DOM_EXCEPTION: - message = "DOM Exception"; - explanation = pretty(err); - break; - /* - * Chrome has a weird problem where if you try to do a getUserMedia request too early, it - * can return a MediaDeviceNotSupported error (even though nothing is wrong and permission - * has been granted). Look at userMediaErrorCallback() in recorder, there we do not - * emit those kind of errors further and just retry. - * - * but for whatever reasons, if it happens to reach this code, then investigate this further. - */ case error_VideomailError.MEDIA_DEVICE_NOT_SUPPORTED: - message = "Media device not supported"; - explanation = pretty(err); - break; - default: - { - const originalExplanation = explanation; - if (explanation && "object" == typeof explanation) explanation = pretty(explanation); - /* - * it can be that explanation itself is an error object - * error objects can be prettified to undefined sometimes - */ if (!explanation && originalExplanation) explanation = `Inspected: ${originalExplanation}`; - if (!message && (null == err ? void 0 : err.message)) message = err.message; - // for weird, undefined cases - if (!message) { - if (errName) message = `${errName} (weird)`; - if (!explanation) explanation = pretty(err); - // avoid dupes - if (pretty(message) === explanation) explanation = void 0; - } - break; - } - } - let logLines; - if (options.logger.getLines) logLines = options.logger.getLines(); - const args = [ - message, - explanation - ].filter(Boolean).join(", "); - options.logger.debug(`VideomailError: create(${args})`); - const errData = { - explanation, - logLines, - err - }; - const videomailError = new error_VideomailError(null != message ? message : "(undefined message)", options, classList, errData); - if (err) { - videomailError.status = err.status; - videomailError.code = err.code; - } - if (options.reportErrors) { - const resource = new src_resource(options); - resource.reportError(videomailError).catch((reason)=>{ - console.error(reason); - }); - } - return videomailError; - } - /* ESM default export */ const error_createError = createError; - function _extends() { - _extends = Object.assign || function(target) { - for(var i = 1; i < arguments.length; i++){ - var source = arguments[i]; - for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; - } - return target; - }; - return _extends.apply(this, arguments); - } - var NODE_LIST_CLASSES = { - '[object HTMLCollection]': true, - '[object NodeList]': true, - '[object RadioNodeList]': true - }; // .type values for elements which can appear in .elements and should be ignored - var IGNORED_ELEMENT_TYPES = { - button: true, - fieldset: true, - reset: true, - submit: true - }; - var CHECKED_INPUT_TYPES = { - checkbox: true, - radio: true - }; - var TRIM_RE = /^\s+|\s+$/g; - var slice = Array.prototype.slice; - var es_toString = Object.prototype.toString; - /** - * @param {HTMLFormElement} form - * @param {Object} [options] - * @return {Object.} an object containing - * submittable value(s) held in the form's .elements collection, with - * properties named as per element names or ids. - */ function getFormData(form, options) { - if (!form) throw new Error("A form is required by getFormData, was given form=" + form); - options = _extends({ - includeDisabled: false, - trim: false - }, options); - var data = {}; - var elementName; - var elementNames = []; - var elementNameLookup = {}; // Get unique submittable element names for the form - for(var i = 0, l = form.elements.length; i < l; i++){ - var element = form.elements[i]; - if (!IGNORED_ELEMENT_TYPES[element.type] && (!element.disabled || !!options.includeDisabled)) { - elementName = element.name || element.id; - if (elementName && !elementNameLookup[elementName]) { - elementNames.push(elementName); - elementNameLookup[elementName] = true; - } - } - } // Extract element data name-by-name for consistent handling of special cases - // around elements which contain multiple inputs. - for(var _i = 0, _l = elementNames.length; _i < _l; _i++){ - elementName = elementNames[_i]; - var value = getFieldData(form, elementName, options); - if (null != value) data[elementName] = value; - } - return data; - } - /** - * @param {HTMLFormElement} form - * @param {string} fieldName - * @param {Object} [options] - * @return {?(boolean|string|string[]|File|File[])} submittable value(s) in the - * form for a named element from its .elements collection, or null if there - * was no element with that name, or the element had no submittable value(s). - */ function getFieldData(form, fieldName, options) { - if (!form) throw new Error("A form is required by getFieldData, was given form=" + form); - if (!fieldName && '[object String]' !== es_toString.call(fieldName)) throw new Error("A field name is required by getFieldData, was given fieldName=" + fieldName); - options = _extends({ - includeDisabled: false, - trim: false - }, options); - var element = form.elements[fieldName]; - if (!element || element.disabled && !options.includeDisabled) return null; - if (!NODE_LIST_CLASSES[es_toString.call(element)]) return getFormElementValue(element, options.trim); - // Deal with multiple form controls which have the same name - var data = []; - var allRadios = true; - for(var i = 0, l = element.length; i < l; i++){ - if (!element[i].disabled || !!options.includeDisabled) { - if (allRadios && 'radio' !== element[i].type) allRadios = false; - var value = getFormElementValue(element[i], options.trim); - if (null != value) data = data.concat(value); - } - } // Special case for an element with multiple same-named inputs which were all - // radio buttons: if there was a selected value, only return the value. - if (allRadios && 1 === data.length) return data[0]; - return data.length > 0 ? data : null; - } - /** - * @param {HTMLElement} element a form element. - * @param {boolean} [trim] should values for text entry inputs be trimmed? - * @return {?(boolean|string|string[]|File|File[])} the element's submittable - * value(s), or null if it had none. - */ function getFormElementValue(element, trim) { - var value = null; - var type = element.type; - if ('select-one' === type) { - if (element.options.length) value = element.options[element.selectedIndex].value; - return value; - } - if ('select-multiple' === type) { - value = []; - for(var i = 0, l = element.options.length; i < l; i++)if (element.options[i].selected) value.push(element.options[i].value); - if (0 === value.length) value = null; - return value; - } // If a file input doesn't have a files attribute, fall through to using its - // value attribute. - if ('file' === type && 'files' in element) { - if (element.multiple) { - value = slice.call(element.files); - if (0 === value.length) value = null; - } else // Should be null if not present, according to the spec - value = element.files[0]; - return value; - } - if (CHECKED_INPUT_TYPES[type]) { - if (element.checked) value = !('checkbox' !== type || element.hasAttribute('value')) || element.value; - } else value = trim ? element.value.replace(TRIM_RE, '') : element.value; - return value; - } // For UMD build access to getFieldData - getFormData.getFieldData = getFieldData; - // EXTERNAL MODULE: ./node_modules/hidden/index.js - var node_modules_hidden = __webpack_require__("./node_modules/hidden/index.js"); - var hidden_default = /*#__PURE__*/ __webpack_require__.n(node_modules_hidden); - let createNanoEvents = ()=>({ - emit (event, ...args) { - for(let callbacks = this.events[event] || [], i = 0, length = callbacks.length; i < length; i++)callbacks[i](...args); - }, - events: {}, - on (event, cb) { - (this.events[event] ||= []).push(cb); - return ()=>{ - this.events[event] = this.events[event]?.filter((i)=>cb !== i); - }; - } - }); // CONCATENATED MODULE: ./src/util/Despot.ts - function Despot_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - class Despot { - emit(eventName) { - for(var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++)params[_key - 1] = arguments[_key]; - const firstParam = params[0]; - const showParams = firstParam && ("object" != typeof firstParam || "object" == typeof firstParam && Object.keys(firstParam).filter(Boolean).length > 0); - if (showParams) this.options.logger.debug(`${this.name} emits ${eventName} with ${pretty(params)}`); - else this.options.logger.debug(`${this.name} emits ${eventName}`); - try { - Despot.EMITTER.emit(eventName, ...params); - } catch (exc) { - if (exc instanceof error_VideomailError) Despot.EMITTER.emit("ERROR", { - err: exc - }); - else Despot.EMITTER.emit("ERROR", { - exc - }); - } - } - // eslint-disable-next-line class-methods-use-this - on(eventName, callback) { - return Despot.EMITTER.on(eventName, callback); - } - once(eventName, listener) { - const callback = function() { - for(var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++)params[_key] = arguments[_key]; - unbind(); - params.length > 0 ? // Safely call listener with params - listener(...params) : // Safely call listener with no params - listener(); - }; - // TODO Fix force typing later - const unbind = this.on(eventName, callback); - return unbind; - } - static getListeners(eventName) { - return Despot.EMITTER.events[eventName]; - } - static removeListener(eventName) { - delete Despot.EMITTER.events[eventName]; - } - static removeAllListeners() { - Despot.EMITTER.events = {}; - } - constructor(name, options){ - Despot_define_property(this, "name", void 0); - Despot_define_property(this, "options", void 0); - this.name = name; - this.options = options; - } - } - // The one and only, instantiate it only once and keep it global. - // https://github.com/ai/nanoevents - Despot_define_property(Despot, "EMITTER", createNanoEvents()); - /* ESM default export */ const util_Despot = Despot; - const REGEX = /^[\s,]+|[\s,]+$/gu; - // fixes https://github.com/binarykitchen/videomail-client/issues/71 - function trimEmail(email) { - return email.replace(REGEX, ""); - } - function trimEmails(emails) { - return emails.split(REGEX).map((email)=>trimEmail(email)); - } - function isNotButton_isNotButton(element) { - return "BUTTON" !== element.tagName && "submit" !== element.getAttribute("type"); - } - /* ESM default export */ const isNotButton = isNotButton_isNotButton; - function form_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - var form_FormMethod = /*#__PURE__*/ function(FormMethod) { - FormMethod["POST"] = "post"; - FormMethod["PUT"] = "put"; - FormMethod["GET"] = "get"; - return FormMethod; - }({}); - class Form extends util_Despot { - getData() { - return getFormData(this.formElement, { - includeDisabled: true - }); - } - transformFormData(formInputs) { - const transformedVideomail = {}; - Object.keys(this.FORM_FIELDS).forEach((key)=>{ - const formFieldValue = this.FORM_FIELDS[key]; - if (formFieldValue in formInputs) { - const value = formInputs[formFieldValue]; - if (void 0 !== value) switch(key){ - case "from": - transformedVideomail[key] = trimEmail(value); - break; - case "to": - case "cc": - case "bcc": - transformedVideomail[key] = trimEmails(value); - break; - default: - transformedVideomail[key] = value; - } - } - }); - return transformedVideomail; - } - getRecipients() { - const partialVideomail = this.getData(); - const videomail = this.transformFormData(partialVideomail); - const recipients = {}; - if (videomail.to) recipients.to = videomail.to; - if (videomail.cc) recipients.cc = videomail.cc; - if (videomail.bcc) recipients.bcc = videomail.bcc; - return recipients; - } - loadVideomail(videomail) { - this.options.logger.debug("Form: loadVideomail()"); - for (const formControl of this.formElement.elements){ - const name = formControl.getAttribute("name"); - if (name) { - const value = videomail[name]; - const tagName = formControl.tagName; - switch(tagName){ - case "INPUT": - { - const inputControl = formControl; - if (Array.isArray(value)) inputControl.value = value.join(", "); - else inputControl.value = value; - break; - } - case "TEXTAREA": - { - const textArea = formControl; - textArea.value = value; - break; - } - default: - throw error_createError({ - message: `Unsupported form control tag name $${tagName} found`, - options: this.options - }); - } - // Always disable them, they can't be changed - if (name === this.options.selectors.toInputName || name === this.options.selectors.subjectInputName || name === this.options.selectors.bodyInputName) formControl.setAttribute("disabled", "disabled"); - } - } - this.formElement.setAttribute("method", "put"); - } - setDisabled(disabled, buttonsToo) { - for (const formControl of this.formElement.elements)if (buttonsToo || isNotButton(formControl)) { - if (disabled) formControl.setAttribute("disabled", "disabled"); - else formControl.removeAttribute("disabled"); - } - } - hideAll() { - for (const formElement of this.formElement.elements)hidden_default()(formElement, true); - // Just do not hide the form itself when it act as a container - if (!this.formElement.classList.contains(this.options.selectors.containerClass)) hidden_default()(this.formElement, true); - } - isRegisteredFormField(formElement) { - const formElementName = formElement.getAttribute("name"); - const registeredFormFieldNames = Object.values(this.FORM_FIELDS); - const isRegistered = registeredFormFieldNames.includes(formElementName); - return isRegistered; - } - getRegisteredFormElements() { - const elements = this.formElement.querySelectorAll("input, textarea, select"); - const registeredElements = []; - for (const element of elements)if (this.isRegisteredFormField(element)) registeredElements.push(element); - return registeredElements; - } - disable(buttonsToo) { - this.setDisabled(true, buttonsToo); - } - enable(buttonsToo) { - this.setDisabled(false, buttonsToo); - } - build() { - this.options.logger.debug("Form: build()"); - this.keyInput = this.formElement.querySelector(`input[name="${this.options.selectors.keyInputName}"]`); - if (!this.keyInput) { - this.keyInput = document.createElement("input"); - this.keyInput.type = "hidden"; - this.keyInput.name = this.options.selectors.keyInputName; - this.formElement.appendChild(this.keyInput); - } - if (this.options.enableAutoValidation) { - const inputElements = this.getRegisteredFormElements(); - for(let i = 0, len = inputElements.length; i < len; i++){ - const inputElement = inputElements[i]; - const type = null == inputElement ? void 0 : inputElement.getAttribute("type"); - if ("radio" === type || "select" === type) null == inputElement || inputElement.addEventListener("change", this.container.validate.bind(this.container)); - else null == inputElement || inputElement.addEventListener("input", this.container.validate.bind(this.container)); - } - } - this.on("PREVIEW", (params)=>{ - var _this_keyInput; - /* - * beware that preview doesn't always come with a key, i.E. - * container.show() can emit PREVIEW without a key when a replay already exists - * (can happen when showing - hiding - showing videomail over again) - */ // only emit error if key is missing AND the input has no key (value) yet - if ((null == params ? void 0 : params.key) || (null === (_this_keyInput = this.keyInput) || void 0 === _this_keyInput ? void 0 : _this_keyInput.value)) { - if ((null == params ? void 0 : params.key) && this.keyInput) { - this.keyInput.value = params.key; - // Important so that any other JS framework can detect changes - this.keyInput.dispatchEvent(new Event("input", { - bubbles: true - })); - } - } else { - const err = error_createError({ - message: "Videomail key for preview is missing!", - options: this.options - }); - this.emit("ERROR", { - err - }); - } - /* - * else leave as it and use existing keyInput.value - */ }); - this.on("STARTING_OVER", ()=>{ - this.resetForm(); - }); - this.on("INVALID", ()=>{ - this.formElement.classList.add("invalid"); - }); - this.on("VALID", ()=>{ - this.formElement.classList.remove("invalid"); - }); - this.on("ERROR", (params)=>{ - var _params_err; - /* - * since https://github.com/binarykitchen/videomail-client/issues/60 - * we hide areas to make it easier for the user to process an error - * (= less distractions) - */ if (this.options.adjustFormOnBrowserError) this.hideAll(); - else if (null === (_params_err = params.err) || void 0 === _params_err ? void 0 : _params_err.isBrowserProblem()) this.hideSubmitButton(); - }); - this.on("BUILT", ()=>{ - this.startListeningToSubmitEvents(); - }); - } - removeAllInputListeners() { - const inputElements = this.getRegisteredFormElements(); - for (const inputElement of inputElements){ - const type = inputElement.getAttribute("type"); - if ("radio" === type || "select" === type) inputElement.removeEventListener("change", this.container.validate.bind(this.container)); - else inputElement.removeEventListener("input", this.container.validate.bind(this.container)); - } - } - hideSubmitButton() { - const submitButton = this.findSubmitButton(); - hidden_default()(submitButton, true); - } - unload() { - this.options.logger.debug("Form: unload()"); - this.removeAllInputListeners(); - util_Despot.removeAllListeners(); - this.stopListeningToSubmitEvents(); - this.resetForm(); - } - resetForm() { - // It can be set to put before when e.g. correcting, so revert to default - this.formElement.setAttribute("method", ""); - // This resets all except hidden inputs - this.formElement.reset(); - const inputElements = this.getRegisteredFormElements(); - for (const inputElement of inputElements){ - const type = inputElement.getAttribute("type"); - if ((null == type ? void 0 : type.toLowerCase()) === "hidden") inputElement.setAttribute("value", ""); - } - } - startListeningToSubmitEvents() { - const submitButton = this.container.getSubmitButton(); - if (submitButton) submitButton.onclick = this.doTheSubmit.bind(this); - } - stopListeningToSubmitEvents() { - const submitButton = this.container.getSubmitButton(); - if (submitButton) submitButton.onclick = null; - } - async doTheSubmit(e) { - if (e) { - this.options.logger.debug(`Form: doTheSubmit(${pretty(e)})`); - e.preventDefault(); - } else this.options.logger.debug("Form: doTheSubmit()"); - var _this_formElement_getAttribute; - const url = null !== (_this_formElement_getAttribute = this.formElement.getAttribute("action")) && void 0 !== _this_formElement_getAttribute ? _this_formElement_getAttribute : this.options.baseUrl; - const method = this.formElement.getAttribute("method"); - let chosenMethod; - switch(method){ - case "post": - chosenMethod = "post"; - break; - case "put": - chosenMethod = "put"; - break; - default: - chosenMethod = "post"; - } - if (this.container.hasElement()) await this.container.submitAll(this.getData(), chosenMethod, url); - // important to stop submission - return false; - } - getInvalidElement() { - const elements = this.getRegisteredFormElements(); - for (const element of elements){ - const validity = "validity" in element ? element.validity : void 0; - if (!(null == validity ? void 0 : validity.valid)) return element; - } - return null; - } - findSubmitButton() { - return this.formElement.querySelector("[type='submit']"); - } - hide() { - hidden_default()(this.formElement, true); - } - show() { - hidden_default()(this.formElement, false); - } - constructor(container, formElement, options){ - super("Form", options), form_define_property(this, "container", void 0), form_define_property(this, "formElement", void 0), form_define_property(this, "keyInput", void 0), form_define_property(this, "FORM_FIELDS", {}); - this.container = container; - this.formElement = formElement; - this.FORM_FIELDS = { - subject: options.selectors.subjectInputName, - from: options.selectors.fromInputName, - to: options.selectors.toInputName, - cc: options.selectors.ccInputName, - bcc: options.selectors.bccInputName, - body: options.selectors.bodyInputName, - key: options.selectors.keyInputName, - parentKey: options.selectors.parentKeyInputName, - sendCopy: options.selectors.sendCopyInputName - }; - } - } - /* ESM default export */ const wrappers_form = Form; - function resource_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - function findOriginalExc(exc) { - if (exc instanceof Error && "response" in exc) { - const response = exc.response; - const body = response.body; - if ("error" in body) { - const message = body.error.message; - const cause = body.error.cause; - const error = new HTTPError(message, { - cause - }); - if (body.error.name) error.name = body.error.name; - if (body.error.stack) error.stack = body.error.stack; - if (body.error.status) error.status = body.error.status; - if (body.error.code) error.code = body.error.code; - return error; - } - } - return exc; - } - class Resource { - applyDefaultValue(videomail, name) { - if (this.options.defaults[name] && !videomail[name]) videomail[name] = this.options.defaults[name]; - return videomail; - } - applyDefaultValues(videomail) { - let newVideomail = { - ...videomail - }; - newVideomail = this.applyDefaultValue(newVideomail, "from"); - newVideomail = this.applyDefaultValue(newVideomail, "to"); - newVideomail = this.applyDefaultValue(newVideomail, "cc"); - newVideomail = this.applyDefaultValue(newVideomail, "bcc"); - newVideomail = this.applyDefaultValue(newVideomail, "subject"); - newVideomail = this.applyDefaultValue(newVideomail, "body"); - return newVideomail; - } - async get(identifierName, identifierValue) { - const url = `${this.options.baseUrl}/videomail/${identifierName}/${identifierValue}/snapshot`; - try { - const request = await client_default()("get", url).type("json").set("Accept", "application/json").set("Timezone-Id", this.timezoneId).set(constants.SITE_NAME_LABEL, this.options.siteName).timeout(this.options.timeouts.connection); - const videomail = request.body; - return videomail; - } catch (exc) { - throw error_createError({ - exc: findOriginalExc(exc), - options: this.options - }); - } - } - async write(method, videomail) { - const queryParams = { - [constants.SITE_NAME_LABEL]: this.options.siteName - }; - let url = `${this.options.baseUrl}/videomail/`; - if (method === form_FormMethod.PUT && videomail.key) url += videomail.key; - try { - const request = await client_default()(method, url).query(queryParams).set("Timezone-Id", this.timezoneId).send(videomail).timeout(this.options.timeouts.connection); - return request; - } catch (exc) { - throw error_createError({ - exc: findOriginalExc(exc), - options: this.options - }); - } - } - async getByAlias(alias) { - return await this.get("alias", alias); - } - async getByKey(key) { - return await this.get("key", key); - } - async reportError(err) { - const queryParams = { - [constants.SITE_NAME_LABEL]: this.options.siteName - }; - const url = `${this.options.baseUrl}/client-error/`; - try { - const fullVideomailErrorData = { - browser: err.browser, - code: err.code, - cookie: err.cookie, - cpu: err.cpu, - device: err.device, - engine: err.engine, - err: err.err, - explanation: err.explanation, - location: err.location, - logLines: err.logLines, - orientation: err.orientation, - os: err.os, - promise: err.promise, - reason: err.reason, - screen: err.screen, - siteName: err.siteName, - status: err.status, - title: err.title, - message: err.message, - stack: err.stack - }; - await client_default()(form_FormMethod.POST, url).query(queryParams).set("Timezone-Id", this.timezoneId) // Note you cant send the Error instance itself, it has to be a plain JSON - .send(fullVideomailErrorData).timeout(this.options.timeouts.connection); - } catch (exc) { - // Can't throw it again, so just print and do nothing else further. - console.error(exc); - } - } - async post(videomail) { - const newVideomail = this.applyDefaultValues(videomail); - /* - * always good to know the version of the client - * the videomail was submitted with - */ newVideomail[constants.VERSION_LABEL] = this.options.version; - try { - let res; - if (this.options.callbacks.adjustFormDataBeforePosting) { - const adjustedVideomail = this.options.callbacks.adjustFormDataBeforePosting(newVideomail); - res = await this.write(form_FormMethod.POST, adjustedVideomail); - } else res = await this.write(form_FormMethod.POST, newVideomail); - return res; - } catch (exc) { - throw error_createError({ - exc: findOriginalExc(exc), - options: this.options - }); - } - } - async put(videomail) { - return await this.write(form_FormMethod.PUT, videomail); - } - async form(formData, url) { - let formType; - switch(this.options.enctype){ - case constants.public.ENC_TYPE_APP_JSON: - formType = "json"; - break; - case constants.public.ENC_TYPE_FORM: - formType = "form"; - break; - default: - throw error_createError({ - err: new Error(`Invalid enctype given: ${this.options.enctype}`), - options: this.options - }); - } - try { - const res = await client_default().post(url).type(formType).set("Timezone-Id", this.timezoneId).send(formData).timeout(this.options.timeouts.connection); - return res; - } catch (exc) { - throw error_createError({ - exc: findOriginalExc(exc), - options: this.options - }); - } - } - constructor(options){ - resource_define_property(this, "options", void 0); - resource_define_property(this, "timezoneId", void 0); - this.options = options; - this.timezoneId = window.Intl.DateTimeFormat().resolvedOptions().timeZone; - } - } - /* ESM default export */ const src_resource = Resource; - // EXTERNAL MODULE: ./node_modules/document-visibility/index.js - var document_visibility = __webpack_require__("./node_modules/document-visibility/index.js"); - var document_visibility_default = /*#__PURE__*/ __webpack_require__.n(document_visibility); - // EXTERNAL MODULE: ./node_modules/contains/index.js - var contains = __webpack_require__("./node_modules/contains/index.js"); - var contains_default = /*#__PURE__*/ __webpack_require__.n(contains); - function disableElement_disableElement(element) { - if (!element) return; - if ("INPUT" === element.tagName || "BUTTON" === element.tagName) element.setAttribute("disabled", "true"); - else element.classList.add("disabled"); - } - /* ESM default export */ const disableElement = disableElement_disableElement; - function enableElement(element) { - if (!element) return; - if ("INPUT" === element.tagName || "BUTTON" === element.tagName) element.removeAttribute("disabled"); - else element.classList.remove("disabled"); - } - /* ESM default export */ const html_enableElement = enableElement; - function hideElement_hideElement(element) { - if (!element) return; - hidden_default()(element, true); - } - /* ESM default export */ const hideElement = hideElement_hideElement; - function showElement_showElement(element) { - if (!element) return; - hidden_default()(element, false); - } - /* ESM default export */ const showElement = showElement_showElement; - function isShown(element) { - if (!element) return false; - return !hidden_default()(element); - } - /* ESM default export */ const html_isShown = isShown; - function adjustButton_adjustButton(buttonElement, show, type, disabled) { - if (disabled) disableElement(buttonElement); - if (type) buttonElement.type = type; - if (!show) hideElement(buttonElement); - return buttonElement; - } - /* ESM default export */ const adjustButton = adjustButton_adjustButton; - function buttons_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - class Buttons extends util_Despot { - replaceClickHandler(element, clickHandler) { - const wrappedClickHandler = (ev)=>{ - ev.preventDefault(); - try { - clickHandler({ - event: ev - }); - } catch (exc) { - this.emit("ERROR", { - exc - }); - } - }; - element.onclick = wrappedClickHandler; - } - makeRadioButtonPair(options) { - let radioButtonElement; - let radioButtonGroup; - if (options.id) radioButtonElement = document.querySelector(`#${options.id}`); - if (!radioButtonElement) { - radioButtonElement = document.createElement("input"); - radioButtonElement.id = options.id; - radioButtonElement.type = "radio"; - radioButtonElement.name = options.name; - radioButtonElement.value = options.value; - radioButtonElement.checked = options.checked; - radioButtonGroup = document.createElement("span"); - radioButtonGroup.classList.add("radioGroup"); - radioButtonGroup.appendChild(radioButtonElement); - const radioLabel = document.createElement("label"); - radioLabel.htmlFor = options.id; - radioLabel.textContent = options.label; - radioButtonGroup.appendChild(radioLabel); - // double check that submit button is already in the buttonsElement container as a child? - if (this.submitButton && contains_default()(this.buttonsElement, this.submitButton)) { - var _this_buttonsElement; - null === (_this_buttonsElement = this.buttonsElement) || void 0 === _this_buttonsElement || _this_buttonsElement.insertBefore(radioButtonGroup, this.submitButton); - } else { - var _this_buttonsElement1; - null === (_this_buttonsElement1 = this.buttonsElement) || void 0 === _this_buttonsElement1 || _this_buttonsElement1.appendChild(radioButtonGroup); - } - } - radioButtonElement.onchange = options.changeHandler; - disableElement(radioButtonElement); - return radioButtonElement; - } - makeButton(buttonClass, text, clickHandler, show, id, type, selector) { - let disabled = !(arguments.length > 7) || void 0 === arguments[7] || arguments[7]; - let buttonElement; - if (id) buttonElement = document.querySelector(`#${id}`); - else if (selector) buttonElement = document.querySelector(selector); - else { - var _this_buttonsElement; - buttonElement = null === (_this_buttonsElement = this.buttonsElement) || void 0 === _this_buttonsElement ? void 0 : _this_buttonsElement.querySelector(`.${buttonClass}`); - } - if (buttonElement) buttonElement = adjustButton(buttonElement, show, type, disabled); - else { - buttonElement = document.createElement("button"); - buttonElement.classList.add(buttonClass); - if (this.options.selectors.buttonClass) buttonElement.classList.add(this.options.selectors.buttonClass); - buttonElement = adjustButton(buttonElement, show, type, disabled); - buttonElement.innerHTML = text; - // double check that submit button is already in the buttonsElement container - if (this.submitButton && contains_default()(this.buttonsElement, this.submitButton)) { - var _this_buttonsElement1; - null === (_this_buttonsElement1 = this.buttonsElement) || void 0 === _this_buttonsElement1 || _this_buttonsElement1.insertBefore(buttonElement, this.submitButton); - } else { - var _this_buttonsElement2; - null === (_this_buttonsElement2 = this.buttonsElement) || void 0 === _this_buttonsElement2 || _this_buttonsElement2.appendChild(buttonElement); - } - } - if (clickHandler) this.replaceClickHandler(buttonElement, clickHandler); - return buttonElement; - } - buildButtons() { - if (!this.options.disableSubmit) { - if (this.submitButton) disableElement(this.submitButton); - else this.submitButton = this.makeButton(this.options.selectors.submitButtonClass, "Submit", void 0, true, this.options.selectors.submitButtonId, "submit", this.options.selectors.submitButtonSelector, this.options.enableAutoValidation); - /* - * no need to listen to the submit event when it's already listened - * within the form element class - */ if (!this.container.hasForm()) this.replaceClickHandler(this.submitButton, this.submit.bind(this)); - } - this.recordButton = this.makeButton(this.options.selectors.recordButtonClass, this.options.text.buttons.record, this.record.bind(this), false); - if (this.options.enablePause) this.pauseButton = this.makeButton(this.options.selectors.pauseButtonClass, this.options.text.buttons.pause, this.container.pause.bind(this.container), false); - if (this.options.enablePause) this.resumeButton = this.makeButton(this.options.selectors.resumeButtonClass, this.options.text.buttons.resume, this.container.resume.bind(this.container), false); - /* - * show stop only when pause is enabled - looks better that way otherwise button - * move left and right between record and stop (preview) - */ this.previewButton = this.makeButton(this.options.selectors.previewButtonClass, this.options.text.buttons.preview, this.container.stop.bind(this.container), false); - this.recordAgainButton = this.makeButton(this.options.selectors.recordAgainButtonClass, this.options.text.buttons.recordAgain, this.recordAgain.bind(this), false); - if (this.options.audio.switch) { - this.audioOffRadioPair = this.makeRadioButtonPair({ - id: "audioOffOption", - name: "audio", - value: "off", - label: this.options.text.audioOff, - checked: !isAudioEnabled(this.options), - changeHandler: ()=>{ - this.container.disableAudio(); - } - }); - this.audioOnRadioPair = this.makeRadioButtonPair({ - id: "audioOnOption", - name: "audio", - value: "on", - label: this.options.text.audioOn, - checked: isAudioEnabled(this.options), - changeHandler: ()=>{ - this.container.enableAudio(); - } - }); - } - } - onFormReady(params) { - // no need to show record button when doing a record again - if (!html_isShown(this.recordAgainButton)) { - if (!(null == params ? void 0 : params.paused)) showElement(this.recordButton); - } - if (!(null == params ? void 0 : params.paused)) { - disableElement(this.previewButton); - hideElement(this.previewButton); - } - if (!this.options.enableAutoValidation) html_enableElement(this.submitButton); - } - onGoingBack() { - hideElement(this.recordAgainButton); - showElement(this.recordButton); - showElement(this.submitButton); - } - onReplayShown() { - this.hide(); - } - onUserMediaReady(params) { - this.onFormReady(); - if (html_isShown(this.recordButton) && !params.recordWhenReady) html_enableElement(this.recordButton); - else if (html_isShown(this.recordAgainButton) && !params.recordWhenReady) html_enableElement(this.recordAgainButton); - if (this.options.enableAutoValidation) disableElement(this.submitButton); - if (!params.recordWhenReady) { - if (html_isShown(this.audioOnRadioPair)) html_enableElement(this.audioOnRadioPair); - if (html_isShown(this.audioOffRadioPair)) html_enableElement(this.audioOffRadioPair); - } - } - onResetting() { - disableElement(this.submitButton); - this.reset(); - } - onPreview() { - hideElement(this.recordButton); - hideElement(this.previewButton); - disableElement(this.audioOnRadioPair); - disableElement(this.audioOffRadioPair); - showElement(this.recordAgainButton); - html_enableElement(this.recordAgainButton); - if (!this.options.enableAutoValidation) html_enableElement(this.submitButton); - } - enableSubmit() { - html_enableElement(this.submitButton); - } - adjustButtonsForPause() { - if (!this.isCountingDown()) { - if (this.pauseButton) hideElement(this.pauseButton); - showElement(this.resumeButton); - html_enableElement(this.resumeButton); - hideElement(this.recordButton); - showElement(this.previewButton); - html_enableElement(this.previewButton); - } - } - onFirstFrameSent() { - hideElement(this.recordButton); - hideElement(this.recordAgainButton); - if (this.pauseButton) { - showElement(this.pauseButton); - html_enableElement(this.pauseButton); - } - html_enableElement(this.previewButton); - showElement(this.previewButton); - } - onRecording(params) { - /* - * it is possible to hide while recording, hence - * check framesCount first (coming from recorder) - */ if (params.framesCount > 1) this.onFirstFrameSent(); - else { - disableElement(this.audioOffRadioPair); - disableElement(this.audioOnRadioPair); - disableElement(this.recordAgainButton); - disableElement(this.recordButton); - } - } - onResuming() { - hideElement(this.resumeButton); - hideElement(this.recordButton); - if (this.pauseButton) { - html_enableElement(this.pauseButton); - showElement(this.pauseButton); - } - } - onStopping() { - disableElement(this.previewButton); - disableElement(this.recordButton); - hideElement(this.pauseButton); - hideElement(this.resumeButton); - } - onCountdown() { - disableElement(this.recordButton); - disableElement(this.audioOffRadioPair); - disableElement(this.audioOnRadioPair); - } - onSubmitting() { - this.options.logger.debug("Buttons: onSubmitting()"); - disableElement(this.submitButton); - disableElement(this.recordAgainButton); - } - onSubmitted() { - disableElement(this.previewButton); - disableElement(this.recordAgainButton); - disableElement(this.recordButton); - disableElement(this.submitButton); - } - onInvalid() { - if (this.options.enableAutoValidation) disableElement(this.submitButton); - } - onValid() { - if (this.options.enableAutoValidation) html_enableElement(this.submitButton); - } - onHidden() { - hideElement(this.recordButton); - hideElement(this.previewButton); - hideElement(this.recordAgainButton); - hideElement(this.resumeButton); - hideElement(this.audioOnRadioPair); - hideElement(this.audioOffRadioPair); - } - onEnablingAudio() { - this.options.logger.debug("Buttons: onEnablingAudio()"); - disableElement(this.recordButton); - disableElement(this.audioOnRadioPair); - disableElement(this.audioOffRadioPair); - } - onDisablingAudio() { - this.options.logger.debug("Buttons: onDisablingAudio()"); - disableElement(this.recordButton); - disableElement(this.audioOnRadioPair); - disableElement(this.audioOffRadioPair); - } - recordAgain() { - disableElement(this.recordAgainButton); - this.container.beginWaiting(); - this.container.recordAgain(); - } - onStartingOver() { - showElement(this.submitButton); - } - submit() { - this.container.submit(); - } - record() { - disableElement(this.recordButton); - this.container.record(); - } - initEvents() { - this.options.logger.debug("Buttons: initEvents()"); - this.on("USER_MEDIA_READY", (params)=>{ - if (!params.switchingFacingMode) this.onUserMediaReady(params); - }); - this.on("PREVIEW", ()=>{ - this.onPreview(); - }); - this.on("PAUSED", ()=>{ - this.adjustButtonsForPause(); - }); - this.on("RECORDING", (params)=>{ - this.onRecording(params); - }); - this.on("FIRST_FRAME_SENT", ()=>{ - this.onFirstFrameSent(); - }); - this.on("RESUMING", ()=>{ - this.onResuming(); - }); - this.on("STOPPING", ()=>{ - this.onStopping(); - }); - this.on("COUNTDOWN", ()=>{ - this.onCountdown(); - }); - this.on("SUBMITTING", ()=>{ - this.onSubmitting(); - }); - this.on("RESETTING", ()=>{ - this.onResetting(); - }); - this.on("INVALID", ()=>{ - this.onInvalid(); - }); - this.on("VALID", ()=>{ - this.onValid(); - }); - this.on("SUBMITTED", ()=>{ - this.onSubmitted(); - }); - this.on("HIDE", ()=>{ - this.onHidden(); - }); - this.on("FORM_READY", (params)=>{ - this.onFormReady(params); - }); - this.on("REPLAY_SHOWN", ()=>{ - this.onReplayShown(); - }); - this.on("GOING_BACK", ()=>{ - this.onGoingBack(); - }); - this.on("ENABLING_AUDIO", ()=>{ - this.onEnablingAudio(); - }); - this.on("DISABLING_AUDIO", ()=>{ - this.onDisablingAudio(); - }); - this.on("STARTING_OVER", ()=>{ - this.onStartingOver(); - }); - this.on("CONNECTED", ()=>{ - if (this.options.loadUserMediaOnRecord) { - if (html_isShown(this.recordButton)) html_enableElement(this.recordButton); - } - }); - this.on("DISCONNECTED", ()=>{ - disableElement(this.recordButton); - disableElement(this.audioOnRadioPair); - disableElement(this.audioOffRadioPair); - }); - this.on("ERROR", (params)=>{ - var _params_err; - /* - * since https://github.com/binarykitchen/videomail-client/issues/60 - * we hide areas to make it easier for the user - */ if ((null === (_params_err = params.err) || void 0 === _params_err ? void 0 : _params_err.isBrowserProblem()) && this.options.adjustFormOnBrowserError) this.hide(); - }); - } - reset() { - this.options.logger.debug("Buttons: reset()"); - disableElement(this.pauseButton); - disableElement(this.resumeButton); - disableElement(this.recordButton); - disableElement(this.previewButton); - disableElement(this.recordAgainButton); - disableElement(this.audioOnRadioPair); - disableElement(this.audioOffRadioPair); - } - isRecordAgainButtonEnabled() { - var _this_recordAgainButton; - return !(null === (_this_recordAgainButton = this.recordAgainButton) || void 0 === _this_recordAgainButton ? void 0 : _this_recordAgainButton.disabled); - } - isReady() { - if (!this.recordButton) // No recordButton? Ok, must be in playerOnly mode. So, not ready for recording - return false; - return this.isRecordButtonEnabled(); - } - isRecordButtonEnabled() { - var _this_recordButton; - return !(null === (_this_recordButton = this.recordButton) || void 0 === _this_recordButton ? void 0 : _this_recordButton.disabled); - } - setSubmitButton(newSubmitButton) { - this.submitButton = newSubmitButton; - } - getSubmitButton() { - return this.submitButton; - } - build() { - this.buttonsElement = this.container.querySelector(`.${this.options.selectors.buttonsClass}`); - if (!this.buttonsElement) { - this.buttonsElement = document.createElement("div"); - this.buttonsElement.classList.add(this.options.selectors.buttonsClass); - this.container.appendChild(this.buttonsElement); - } - this.buildButtons(); - if (!this.built) this.initEvents(); - this.built = true; - } - unload() { - if (this.built) { - // Disables all buttons - this.reset(); - this.options.logger.debug("Buttons: unload()"); - util_Despot.removeAllListeners(); - this.hide(); - this.built = false; - } - } - hide() { - let deep = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; - hideElement(this.buttonsElement); - if (deep) { - hideElement(this.recordButton); - hideElement(this.pauseButton); - hideElement(this.resumeButton); - hideElement(this.previewButton); - hideElement(this.recordAgainButton); - hideElement(this.submitButton); - hideElement(this.audioOnRadioPair); - hideElement(this.audioOffRadioPair); - } - } - show() { - showElement(this.buttonsElement); - } - isCountingDown() { - return this.container.isCountingDown(); - } - constructor(container, options){ - super("Buttons", options), buttons_define_property(this, "container", void 0), buttons_define_property(this, "buttonsElement", void 0), buttons_define_property(this, "recordButton", void 0), buttons_define_property(this, "pauseButton", void 0), buttons_define_property(this, "resumeButton", void 0), buttons_define_property(this, "previewButton", void 0), buttons_define_property(this, "recordAgainButton", void 0), buttons_define_property(this, "submitButton", void 0), buttons_define_property(this, "audioOnRadioPair", void 0), buttons_define_property(this, "audioOffRadioPair", void 0), buttons_define_property(this, "built", false); - this.container = container; - } - } - /* ESM default export */ const buttons = Buttons; - function countdown_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - class Countdown { - fire(cb) { - this.unload(); - this.hide(); - // keep all callbacks async - setTimeout(function() { - cb(); - }, 0); - } - countBackward(cb) { - if (!this.paused) { - this.options.logger.debug(`Countdown ${this.countdown}`); - if (void 0 !== this.countdown) { - this.countdown--; - if (this.countdown < 1) this.fire(cb); - else if (this.countdownElement) this.countdownElement.innerHTML = this.countdown.toString(); - } - } - } - start(cb) { - if (!this.countdownElement) throw new Error("Unable to start countdown without an element"); - if ("number" != typeof this.options.video.countdown) throw new Error(`The defined countdown is not a valid number: ${this.options.video.countdown}`); - this.countdown = this.options.video.countdown; - this.countdownElement.innerHTML = this.countdown.toString(); - this.show(); - this.intervalId = window.setInterval(this.countBackward.bind(this, cb), 950); - } - pause() { - this.paused = true; - } - resume() { - this.paused = false; - } - build() { - var _this_visuals_getElement; - this.countdownElement = null === (_this_visuals_getElement = this.visuals.getElement()) || void 0 === _this_visuals_getElement ? void 0 : _this_visuals_getElement.querySelector(".countdown"); - if (this.countdownElement) this.hide(); - else { - this.countdownElement = document.createElement("p"); - this.countdownElement.className = "countdown"; - this.hide(); - this.visuals.appendChild(this.countdownElement); - } - } - show() { - hidden_default()(this.countdownElement, false); - } - isCountingDown() { - return Boolean(this.intervalId); - } - unload() { - clearInterval(this.intervalId); - this.paused = false; - this.intervalId = void 0; - } - hide() { - hidden_default()(this.countdownElement, true); - this.unload(); - } - constructor(visuals, options){ - countdown_define_property(this, "visuals", void 0); - countdown_define_property(this, "options", void 0); - countdown_define_property(this, "countdownElement", void 0); - countdown_define_property(this, "intervalId", void 0); - countdown_define_property(this, "countdown", void 0); - countdown_define_property(this, "paused", false); - this.visuals = visuals; - this.options = options; - } - } - /* ESM default export */ const countdown = Countdown; - function facingMode_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - class FacingMode extends util_Despot { - initEvents() { - this.on("ERROR", ()=>{ - this.hide(); - }); - } - build() { - var _this_visuals_getElement; - this.facingModeElement = null === (_this_visuals_getElement = this.visuals.getElement()) || void 0 === _this_visuals_getElement ? void 0 : _this_visuals_getElement.querySelector(".facingMode"); - if (this.facingModeElement) this.hide(); - else { - this.facingModeElement = document.createElement("button"); - this.facingModeElement.classList.add("facingMode"); - this.facingModeElement.innerHTML = "⤾"; - this.facingModeElement.onclick = (e)=>{ - null == e || e.preventDefault(); - try { - this.emit("SWITCH_FACING_MODE"); - } catch (exc) { - this.emit("ERROR", { - exc - }); - } - }; - this.hide(); - this.visuals.appendChild(this.facingModeElement); - } - this.initEvents(); - } - hide() { - hidden_default()(this.facingModeElement, true); - } - show() { - hidden_default()(this.facingModeElement, false); - } - constructor(visuals, options){ - super("Facing Mode", options), facingMode_define_property(this, "visuals", void 0), facingMode_define_property(this, "facingModeElement", void 0); - this.visuals = visuals; - } - } - /* ESM default export */ const facingMode = FacingMode; - function pausedNote_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - class PausedNote { - hasPausedHintText() { - return this.options.text.pausedHint; - } - build() { - var _this_visuals_getElement, _this_visuals_getElement1; - this.pausedBlockElement = null === (_this_visuals_getElement = this.visuals.getElement()) || void 0 === _this_visuals_getElement ? void 0 : _this_visuals_getElement.querySelector(".paused"); - this.pausedHeaderElement = null === (_this_visuals_getElement1 = this.visuals.getElement()) || void 0 === _this_visuals_getElement1 ? void 0 : _this_visuals_getElement1.querySelector(".pausedHeader"); - if (this.pausedHeaderElement) { - this.hide(); - this.pausedHeaderElement.innerHTML = this.options.text.pausedHeader; - if (this.options.text.pausedHint && this.pausedHintElement) this.pausedHintElement.innerHTML = this.options.text.pausedHint; - } else { - this.pausedBlockElement = document.createElement("div"); - this.pausedBlockElement.classList.add("paused"); - this.pausedHeaderElement = document.createElement("p"); - this.pausedHeaderElement.classList.add("pausedHeader"); - this.hide(); - this.pausedHeaderElement.innerHTML = this.options.text.pausedHeader; - this.pausedBlockElement.appendChild(this.pausedHeaderElement); - if (this.hasPausedHintText()) { - var _this_visuals_getElement2; - this.pausedHintElement = null === (_this_visuals_getElement2 = this.visuals.getElement()) || void 0 === _this_visuals_getElement2 ? void 0 : _this_visuals_getElement2.querySelector(".pausedHint"); - if (!this.pausedHintElement) { - this.pausedHintElement = document.createElement("p"); - this.pausedHintElement.classList.add("pausedHint"); - this.pausedBlockElement.appendChild(this.pausedHintElement); - } - if (this.options.text.pausedHint) this.pausedHintElement.innerHTML = this.options.text.pausedHint; - } - this.visuals.appendChild(this.pausedBlockElement); - } - } - hide() { - hidden_default()(this.pausedBlockElement, true); - } - show() { - hidden_default()(this.pausedBlockElement, false); - } - constructor(visuals, options){ - pausedNote_define_property(this, "visuals", void 0); - pausedNote_define_property(this, "options", void 0); - pausedNote_define_property(this, "pausedBlockElement", void 0); - pausedNote_define_property(this, "pausedHeaderElement", void 0); - pausedNote_define_property(this, "pausedHintElement", void 0); - this.visuals = visuals; - this.options = options; - } - } - /* ESM default export */ const pausedNote = PausedNote; - function recordNote_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - class RecordNote { - build() { - var _this_visuals_getElement; - this.recordNoteElement = null === (_this_visuals_getElement = this.visuals.getElement()) || void 0 === _this_visuals_getElement ? void 0 : _this_visuals_getElement.querySelector(".recordNote"); - if (this.recordNoteElement) this.hide(); - else { - this.recordNoteElement = document.createElement("p"); - this.recordNoteElement.classList.add("recordNote"); - this.hide(); - this.visuals.appendChild(this.recordNoteElement); - } - } - stop() { - var _this_recordNoteElement, _this_recordNoteElement1; - this.hide(); - null === (_this_recordNoteElement = this.recordNoteElement) || void 0 === _this_recordNoteElement || _this_recordNoteElement.classList.remove("near"); - null === (_this_recordNoteElement1 = this.recordNoteElement) || void 0 === _this_recordNoteElement1 || _this_recordNoteElement1.classList.remove("nigh"); - } - setNear() { - var _this_recordNoteElement; - null === (_this_recordNoteElement = this.recordNoteElement) || void 0 === _this_recordNoteElement || _this_recordNoteElement.classList.add("near"); - } - setNigh() { - var _this_recordNoteElement; - null === (_this_recordNoteElement = this.recordNoteElement) || void 0 === _this_recordNoteElement || _this_recordNoteElement.classList.add("nigh"); - } - hide() { - hidden_default()(this.recordNoteElement, true); - } - show() { - hidden_default()(this.recordNoteElement, false); - } - constructor(visuals){ - recordNote_define_property(this, "visuals", void 0); - recordNote_define_property(this, "recordNoteElement", void 0); - this.visuals = visuals; - } - } - /* ESM default export */ const recorder_recordNote = RecordNote; - function pad(n) { - return n < 10 ? `0${n}` : n; - } - /* ESM default export */ const util_pad = pad; - function recordTimer_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - class RecordTimer { - thresholdReached(secs, threshold) { - return secs >= this.options.video.limitSeconds * threshold; - } - isNear(secs) { - if (!this.nearComputed && this.thresholdReached(secs, 0.6)) { - this.nearComputed = true; - return true; - } - return false; - } - endIsNigh(secs) { - if (!this.endNighComputed && this.thresholdReached(secs, 0.8)) { - this.endNighComputed = true; - return true; - } - return false; - } - setNear() { - var _this_recordTimerElement; - null === (_this_recordTimerElement = this.recordTimerElement) || void 0 === _this_recordTimerElement || _this_recordTimerElement.classList.add("near"); - } - setNigh() { - var _this_recordTimerElement; - null === (_this_recordTimerElement = this.recordTimerElement) || void 0 === _this_recordTimerElement || _this_recordTimerElement.classList.add("nigh"); - } - check(elapsedTime) { - const newCountdown = this.getStartSeconds() - Math.floor(elapsedTime / 1e3); - // performance optimization (another reason we need react here!) - if (newCountdown !== this.countdown) { - this.countdown = newCountdown; - this.update(); - if (this.countdown < 1) this.visuals.stop(true); - } - } - update() { - if (void 0 === this.countdown) throw new Error("Countdown is set to undefined, unable to update timer"); - const mins = Math.floor(this.countdown / 60); - const secs = this.countdown - 60 * mins; - if (!this.nearComputed || !this.endNighComputed) { - const remainingSeconds = this.options.video.limitSeconds - this.countdown; - if (this.isNear(remainingSeconds)) { - this.recordNote.setNear(); - this.setNear(); - this.options.logger.debug(`End is near, ${this.countdown} seconds to go`); - } else if (this.endIsNigh(remainingSeconds)) { - this.recordNote.setNigh(); - this.setNigh(); - this.options.logger.debug(`End is nigh, ${this.countdown} seconds to go`); - } - } - if (this.recordTimerElement) this.recordTimerElement.innerHTML = `${mins}:${util_pad(secs)}`; - } - hide() { - hidden_default()(this.recordTimerElement, true); - } - show() { - var _this_recordTimerElement, _this_recordTimerElement1; - null === (_this_recordTimerElement = this.recordTimerElement) || void 0 === _this_recordTimerElement || _this_recordTimerElement.classList.remove("near"); - null === (_this_recordTimerElement1 = this.recordTimerElement) || void 0 === _this_recordTimerElement1 || _this_recordTimerElement1.classList.remove("nigh"); - hidden_default()(this.recordTimerElement, false); - } - getSecondsRecorded() { - if (void 0 === this.countdown) return this.getSecondsRecorded(); - return this.getStartSeconds() - this.countdown; - } - getStartSeconds() { - return this.options.video.limitSeconds; - } - start() { - this.countdown = this.getStartSeconds(); - this.nearComputed = this.endNighComputed = false; - this.started = true; - this.update(); - this.show(); - } - pause() { - this.recordNote.hide(); - } - resume() { - this.recordNote.show(); - } - isStopped() { - return void 0 === this.countdown; - } - stop() { - if (!this.isStopped() && this.started) { - this.options.logger.debug(`Stopping record timer. Was recording for about ~${this.getSecondsRecorded()} seconds.`); - this.hide(); - this.recordNote.stop(); - this.countdown = void 0; - this.started = false; - } - } - build() { - var _this_visuals_getElement; - this.recordTimerElement = null === (_this_visuals_getElement = this.visuals.getElement()) || void 0 === _this_visuals_getElement ? void 0 : _this_visuals_getElement.querySelector(".recordTimer"); - if (this.recordTimerElement) this.hide(); - else { - this.recordTimerElement = document.createElement("p"); - this.recordTimerElement.classList.add("recordTimer"); - this.hide(); - this.visuals.appendChild(this.recordTimerElement); - } - } - constructor(visuals, recordNote, options){ - recordTimer_define_property(this, "visuals", void 0); - recordTimer_define_property(this, "recordNote", void 0); - recordTimer_define_property(this, "options", void 0); - recordTimer_define_property(this, "recordTimerElement", void 0); - recordTimer_define_property(this, "nearComputed", false); - recordTimer_define_property(this, "endNighComputed", false); - recordTimer_define_property(this, "started", false); - recordTimer_define_property(this, "countdown", void 0); - this.visuals = visuals; - this.recordNote = recordNote; - this.options = options; - } - } - /* ESM default export */ const recordTimer = RecordTimer; - function recorderInsides_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - class RecorderInsides extends util_Despot { - startRecording() { - this.recordTimer.start(); - } - resumeRecording() { - this.recordTimer.resume(); - } - stopRecording() { - this.recordTimer.stop(); - } - pauseRecording() { - if (this.isCountingDown()) { - var _this_countdown; - null === (_this_countdown = this.countdown) || void 0 === _this_countdown || _this_countdown.pause(); - } else this.recordTimer.pause(); - } - onResetting() { - var _this_facingMode; - this.hidePause(); - this.hideCountdown(); - this.recordTimer.stop(); - null === (_this_facingMode = this.facingMode) || void 0 === _this_facingMode || _this_facingMode.hide(); - } - initEvents() { - this.options.logger.debug("RecorderInsides: initEvents()"); - this.on("USER_MEDIA_READY", ()=>{ - var _this_facingMode; - null === (_this_facingMode = this.facingMode) || void 0 === _this_facingMode || _this_facingMode.show(); - }); - this.on("RECORDING", ()=>{ - this.startRecording(); - }); - this.on("RESUMING", ()=>{ - this.resumeRecording(); - }); - this.on("STOPPING", ()=>{ - this.stopRecording(); - }); - this.on("PAUSED", ()=>{ - this.pauseRecording(); - }); - this.on("ERROR", this.onResetting.bind(this)); - this.on("RESETTING", this.onResetting.bind(this)); - this.on("HIDE", ()=>{ - this.hideCountdown(); - }); - } - build() { - var _this_countdown, _this_pausedNote, _this_facingMode; - this.options.logger.debug("RecorderInsides: build()"); - null === (_this_countdown = this.countdown) || void 0 === _this_countdown || _this_countdown.build(); - null === (_this_pausedNote = this.pausedNote) || void 0 === _this_pausedNote || _this_pausedNote.build(); - null === (_this_facingMode = this.facingMode) || void 0 === _this_facingMode || _this_facingMode.build(); - this.recordNote.build(); - this.recordTimer.build(); - if (!this.built) this.initEvents(); - this.built = true; - } - unload() { - var _this_countdown; - null === (_this_countdown = this.countdown) || void 0 === _this_countdown || _this_countdown.unload(); - this.built = false; - } - showPause() { - var _this_pausedNote; - null === (_this_pausedNote = this.pausedNote) || void 0 === _this_pausedNote || _this_pausedNote.show(); - } - hidePause() { - var _this_pausedNote; - null === (_this_pausedNote = this.pausedNote) || void 0 === _this_pausedNote || _this_pausedNote.hide(); - } - hideCountdown() { - var _this_countdown; - null === (_this_countdown = this.countdown) || void 0 === _this_countdown || _this_countdown.hide(); - } - startCountdown(cb) { - var _this_countdown; - null === (_this_countdown = this.countdown) || void 0 === _this_countdown || _this_countdown.start(cb); - } - resumeCountdown() { - var _this_countdown; - null === (_this_countdown = this.countdown) || void 0 === _this_countdown || _this_countdown.resume(); - } - isCountingDown() { - var _this_countdown; - return null === (_this_countdown = this.countdown) || void 0 === _this_countdown ? void 0 : _this_countdown.isCountingDown(); - } - checkTimer(elapsedTime) { - this.recordTimer.check(elapsedTime); - } - constructor(visuals, options){ - super("RecorderInsides", options), recorderInsides_define_property(this, "recordNote", void 0), recorderInsides_define_property(this, "recordTimer", void 0), recorderInsides_define_property(this, "countdown", void 0), recorderInsides_define_property(this, "facingMode", void 0), recorderInsides_define_property(this, "pausedNote", void 0), recorderInsides_define_property(this, "built", false); - this.recordNote = new recorder_recordNote(visuals); - this.recordTimer = new recordTimer(visuals, this.recordNote, options); - const browser = getBrowser(options); - if (options.video.countdown) this.countdown = new countdown(visuals, options); - if (options.video.facingModeButton && browser.isMobile()) this.facingMode = new facingMode(visuals, options); - if (options.enablePause) this.pausedNote = new pausedNote(visuals, options); - } - } - /* ESM default export */ const recorderInsides = RecorderInsides; - function notifier_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - const NOTIFIER_MESSAGE_ID = "notifierMessage"; - class Notifier extends util_Despot { - onStopping() { - let limitReached = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; - let lead = ""; - this.visuals.beginWaiting(); - if (limitReached) { - this.options.logger.debug("Limit reached"); - lead += `${this.options.text.limitReached}.
`; - } - lead += `${this.options.text.sending} …`; - this.notify(lead, void 0, { - stillWait: true, - entertain: this.options.notifier.entertain - }); - } - onConnecting() { - this.notify("Connecting …"); - } - onLoadingUserMedia() { - this.notify("Loading webcam …"); - } - onProgress(frameProgress, sampleProgress) { - let overallProgress; - if (isAudioEnabled(this.options)) { - overallProgress = `Video: ${frameProgress}`; - if (sampleProgress) overallProgress += `, Audio: ${sampleProgress}`; - } else overallProgress = frameProgress; - this.setExplanation(overallProgress); - } - onBeginVideoEncoding() { - this.visuals.beginWaiting(); - const lead = `${this.options.text.encoding} …`; - this.notify(lead, void 0, { - stillWait: true, - entertain: this.options.notifier.entertain - }); - this.hideExplanation(); - } - initEvents() { - this.options.logger.debug("Notifier: initEvents()"); - this.on("CONNECTING", ()=>{ - this.onConnecting(); - }); - this.on("LOADING_USER_MEDIA", ()=>{ - this.onLoadingUserMedia(); - }); - this.on("USER_MEDIA_READY", ()=>{ - // Ensure notifier has correct dimensions, especially when stretched - this.correctNotifierDimensions(); - this.hide(); - }); - this.on("PREVIEW", ()=>{ - this.hide(); - }); - this.on("STOPPING", (params)=>{ - this.onStopping(params.limitReached); - }); - this.on("PROGRESS", (params)=>{ - this.onProgress(params.frameProgress, params.sampleProgress); - }); - this.on("BEGIN_VIDEO_ENCODING", ()=>{ - this.onBeginVideoEncoding(); - }); - this.on("UNLOADING", ()=>{ - this.notify("Unloading …"); - }); - this.on("DISCONNECTED", ()=>{ - this.notify("Disconnected"); - }); - this.on("CONNECTED", ()=>{ - this.notify("Connected"); - if (this.options.loadUserMediaOnRecord) this.hide(); - }); - } - correctNotifierDimensions() { - if (!this.notifyElement) return; - if (this.options.video.stretch) { - this.notifyElement.style.width = "auto"; - this.notifyElement.style.height = `${this.visuals.getRecorderHeight(true, true)}px`; - } else { - this.notifyElement.style.width = `${this.visuals.getRecorderWidth(true)}px`; - this.notifyElement.style.height = `${this.visuals.getRecorderHeight(true)}px`; - } - } - show() { - if (this.notifyElement) hidden_default()(this.notifyElement, false); - } - runEntertainment() { - if (this.options.notifier.entertain) { - if (!this.entertaining) { - const randomBackgroundClass = Math.floor(Math.random() * this.options.notifier.entertainLimit + 1); - if (this.notifyElement) this.notifyElement.className = `notifier entertain ${this.options.notifier.entertainClass}${randomBackgroundClass}`; - this.entertainTimeoutId = window.setTimeout(this.runEntertainment.bind(this), this.options.notifier.entertainInterval); - this.entertaining = true; - } - } else this.cancelEntertainment(); - } - cancelEntertainment() { - if (this.notifyElement) this.notifyElement.classList.remove("entertain"); - clearTimeout(this.entertainTimeoutId); - this.entertainTimeoutId = void 0; - this.entertaining = false; - } - error(err) { - const message = err.message; - const explanation = err.explanation ? err.explanation.toString() : void 0; - if (!message) this.options.logger.debug(`Weird empty error message generated for error ${pretty(err)}`); - this.notify(message, explanation, { - blocking: true, - problem: true, - classList: err.getClassList(), - removeDimensions: getBrowser(this.options).isMobile() - }); - } - // Special treatment to deal with race conditions - getMessageElement() { - if (this.messageElement) return this.messageElement; - this.messageElement = document.querySelector(`#${NOTIFIER_MESSAGE_ID}`); - return this.messageElement; - } - setMessage(message, messageOptions) { - this.options.logger.debug(`Notifier: setMessage(${message})`); - if (!this.getMessageElement()) { - this.messageElement = document.createElement("h2"); - this.messageElement.id = NOTIFIER_MESSAGE_ID; - if (this.notifyElement) { - if (this.explanationElement) // For rare cases, shouldn't happen to set an explanation without a message - this.notifyElement.insertBefore(this.messageElement, this.explanationElement); - else this.notifyElement.appendChild(this.messageElement); - } else this.options.logger.warn(`Unable to show message ${message} because notifyElement is empty`); - } - if (message.length > 0) { - if (this.messageElement) { - const problem = null == messageOptions ? void 0 : messageOptions.problem; - this.messageElement.innerHTML = (problem ? "☹ " : "") + message; - } else this.options.logger.warn("There is no message element for displaying a message"); - } else this.options.logger.warn("Not going to update notifierMessage element because message is empty"); - hidden_default()(this.messageElement, false); - } - setExplanation(explanation) { - this.options.logger.debug(`Notifier: setExplanation(${explanation})`); - if (!this.explanationElement) { - this.explanationElement = document.createElement("p"); - this.explanationElement.classList.add("explanation"); - if (this.notifyElement) this.notifyElement.appendChild(this.explanationElement); - else this.options.logger.warn(`Unable to show explanation because notifyElement is empty: ${explanation}`); - } - this.explanationElement.innerHTML = explanation; - hidden_default()(this.explanationElement, false); - } - build() { - var _this_visuals_getElement; - this.options.logger.debug("Notifier: build()"); - this.notifyElement = null === (_this_visuals_getElement = this.visuals.getElement()) || void 0 === _this_visuals_getElement ? void 0 : _this_visuals_getElement.querySelector(".notifier"); - if (this.notifyElement) this.hide(); - else { - this.notifyElement = document.createElement("div"); - this.hide(); - this.visuals.appendChild(this.notifyElement); - } - if (!this.built) this.initEvents(); - this.built = true; - } - hideMessage() { - if (this.getMessageElement()) hidden_default()(this.messageElement, true); - } - hideExplanation() { - if (this.explanationElement) hidden_default()(this.explanationElement, true); - } - hide() { - this.cancelEntertainment(); - if (this.notifyElement) { - hidden_default()(this.notifyElement, true); - this.notifyElement.classList.remove("blocking"); - } - this.hideMessage(); - this.hideExplanation(); - } - isVisible() { - if (!this.built) return false; - return this.notifyElement && !hidden_default()(this.notifyElement); - } - isBuilt() { - return this.built; - } - notify(message, explanation) { - let notifyOptions = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {}; - const params = [ - message, - explanation - ].filter(Boolean); - this.options.logger.debug(`Notifier: notify(${params.join(", ")})`); - const stillWait = !!notifyOptions.stillWait && notifyOptions.stillWait; - const entertain = !!notifyOptions.entertain && notifyOptions.entertain; - const blocking = !!notifyOptions.blocking && notifyOptions.blocking; - const classList = !!notifyOptions.classList && notifyOptions.classList; - const removeDimensions = !!notifyOptions.removeDimensions && notifyOptions.removeDimensions; - if (this.notifyElement) { - // reset - if (!entertain) this.notifyElement.className = "notifier"; - if (classList) classList.forEach((className)=>{ - var _this_notifyElement; - null === (_this_notifyElement = this.notifyElement) || void 0 === _this_notifyElement || _this_notifyElement.classList.add(className); - }); - if (removeDimensions) { - this.notifyElement.style.width = "auto"; - this.notifyElement.style.height = "auto"; - } - } - if (blocking) { - var _this_notifyElement; - null === (_this_notifyElement = this.notifyElement) || void 0 === _this_notifyElement || _this_notifyElement.classList.add("blocking"); - this.emit("BLOCKING"); - } else this.emit("NOTIFYING"); - this.visuals.hideReplay(); - this.visuals.hideRecorder(); - this.setMessage(message, notifyOptions); - if (explanation && explanation.length > 0) this.setExplanation(explanation); - if (entertain) this.runEntertainment(); - else this.cancelEntertainment(); - /* - * just as a safety in case if an error is thrown in the middle of the build process - * and visuals aren't built/shown yet. - */ this.visuals.showVisuals(); - this.show(); - if (!stillWait) this.visuals.endWaiting(); - } - constructor(visuals, options){ - super("Notifier", options), notifier_define_property(this, "visuals", void 0), notifier_define_property(this, "notifyElement", void 0), notifier_define_property(this, "messageElement", void 0), notifier_define_property(this, "explanationElement", void 0), notifier_define_property(this, "entertainTimeoutId", void 0), notifier_define_property(this, "entertaining", false), notifier_define_property(this, "built", false); - this.visuals = visuals; - } - } - /* ESM default export */ const notifier = Notifier; - // EXTERNAL MODULE: ./node_modules/animitter/index.js - var animitter = __webpack_require__("./node_modules/animitter/index.js"); - var animitter_default = /*#__PURE__*/ __webpack_require__.n(animitter); - // EXTERNAL MODULE: ./node_modules/typedarray-to-buffer/index.js - var typedarray_to_buffer = __webpack_require__("./node_modules/typedarray-to-buffer/index.js"); - const canvas_to_buffer_modern_e = "undefined" != typeof document && "function" == typeof document.createElement, canvas_to_buffer_modern_i = canvas_to_buffer_modern_e ? [ - "webp", - "jpeg" - ] : [ - "png" - ]; - let canvas_to_buffer_modern_s; - class canvas_to_buffer_modern_r { - constructor(t, e = canvas_to_buffer_modern_i, s = .5){ - if (this.quality = void 0, this.types = void 0, this.canvas = void 0, e.length > 2) throw new Error("Too many image types are specified!"); - this.canvas = t, this.quality = s, this.types = e; - } - composeMimeType(t) { - let e; - return this.types[t] && (e = "image/" + this.types[t]), e; - } - isMatch(t, e) { - return t.match(e); - } - getTestCanvas() { - let t; - return canvas_to_buffer_modern_e ? (t = document.createElement("canvas"), t.width = t.height = 1) : t = this.canvas, t; - } - canvasSupportsMimeType(t) { - try { - const e = this.getTestCanvas(), i = e.toDataURL && e.toDataURL(t); - return this.isMatch(i, t); - } catch (t) { - return !1; - } - } - figureMimeType() { - let t = this.composeMimeType(0); - return t && this.canvasSupportsMimeType(t) || (this.types[1] ? (t = this.composeMimeType(1), t && !this.canvasSupportsMimeType(t) && (t = void 0)) : t = void 0), t; - } - uriToBuffer(i) { - const s = i.split(",")[1]; - let o; - if (!s) throw new Error("Empty uri string given!"); - if (o = canvas_to_buffer_modern_e ? window.atob(s) : null == canvas_to_buffer_modern_r.atob ? void 0 : canvas_to_buffer_modern_r.atob(s), !o) throw new Error("Byte are empty, something within atob went wrong."); - const n = new Uint8Array(o.length); - for(let t = 0, e = o.length; t < e; t++)n[t] = o.charCodeAt(t); - return typedarray_to_buffer(n); - } - toBuffer() { - const t = this.getMimeType(); - let e; - if (t) { - const i = this.canvas.toDataURL(t, this.quality); - e = this.uriToBuffer(i); - } - return e; - } - getMimeType() { - return canvas_to_buffer_modern_s && canvas_to_buffer_modern_e || (canvas_to_buffer_modern_s = this.figureMimeType()), canvas_to_buffer_modern_s; - } - } - canvas_to_buffer_modern_r.atob = void 0; - //# sourceMappingURL=canvas-to-buffer.modern.js.map - // EXTERNAL MODULE: ./node_modules/websocket-stream/stream.js - var websocket_stream_stream = __webpack_require__("./node_modules/websocket-stream/stream.js"); - var stream_default = /*#__PURE__*/ __webpack_require__.n(websocket_stream_stream); - function isPromise_isPromise(anything) { - return anything && "undefined" != typeof Promise && anything instanceof Promise; - } - /* ESM default export */ const isPromise = isPromise_isPromise; - class audio_sample_modern_t { - constructor(r){ - this.float32Array = void 0, this.float32Array = r; - } - toBuffer() { - const t = new Int16Array(this.float32Array.length); - return this.float32Array.forEach((r, a)=>{ - t[a] = 32767 * Math.min(1, r); - }), typedarray_to_buffer(t); - } - } - //# sourceMappingURL=audio-sample.modern.js.map - // EXTERNAL MODULE: ./node_modules/is-power-of-two/index.js - var is_power_of_two = __webpack_require__("./node_modules/is-power-of-two/index.js"); - var is_power_of_two_default = /*#__PURE__*/ __webpack_require__.n(is_power_of_two); - var package_namespaceObject = { - i8: "10.0.14" - }; // CONCATENATED MODULE: ./src/types/env.ts - // ... and these actually define the runtime mode of Node.js and are - // set either in package.json, via Jest or in the Dockerfile - const NodeEnvType = { - DEVELOPMENT: "development", - PRODUCTION: "production" - }; - /* provided dependency */ var process = __webpack_require__("./node_modules/process/browser.js"); - function getNodeEnv() { - if (!process.env.NODE_ENV) return NodeEnvType.DEVELOPMENT; - return process.env.NODE_ENV; - } - /* ESM default export */ const util_getNodeEnv = getNodeEnv; - function isProductionMode_isProductionMode() { - return util_getNodeEnv() === NodeEnvType.PRODUCTION; - } - /* ESM default export */ const isProductionMode = isProductionMode_isProductionMode; - const PRODUCTION = isProductionMode(); - const options_options = { - logger: console, - logStackSize: 30, - verbose: !PRODUCTION, - baseUrl: "https://videomail.io", - socketUrl: "wss://videomail.io", - siteName: "videomail-client-demo", - enablePause: true, - enableAutoPause: true, - enableSpace: true, - submitWithVideomail: false, - // under the `videomail` key inside the form data body. - disableSubmit: false, - // but just want to record and replay these temporarily - enableAutoValidation: true, - enableAutoUnload: true, - /* - * does not /enable disable submit button after recording - * when something else seems invalid. - */ enableAutoSubmission: true, - /* - * appears upon press of submit button. disable it when - * you want a framework to deal with the form submission itself. - */ enctype: "application/json", - // 'application/json' and 'application/x-www-form-urlencoded' - // default CSS selectors you can alter, see examples - selectors: { - containerId: void 0, - containerClass: "videomail", - replayClass: "replay", - userMediaClass: "userMedia", - visualsClass: "visuals", - buttonClass: void 0, - buttonsClass: "buttons", - recordButtonClass: "record", - pauseButtonClass: "pause", - resumeButtonClass: "resume", - previewButtonClass: "preview", - recordAgainButtonClass: "recordAgain", - submitButtonClass: "submit", - subjectInputName: "subject", - fromInputName: "from", - toInputName: "to", - ccInputName: "cc", - bccInputName: "bcc", - bodyInputName: "body", - sendCopyInputName: "sendCopy", - keyInputName: "videomail_key", - parentKeyInputName: "videomail_parent_key", - formId: void 0, - submitButtonId: void 0, - // but if that does not work, try using the - submitButtonSelector: void 0 - }, - audio: { - enabled: false, - switch: false, - volume: 0.2, - // distorting at the higher volume peaks - bufferSize: "auto" - }, - video: { - fps: 15, - limitSeconds: 30, - countdown: 3, - /* - * it is recommended to set one dimension only and leave the other one to auto - * because each webcam has a different aspect ratio - */ width: void 0, - height: void 0, - facingMode: "user", - facingModeButton: false, - stretch: false - }, - image: { - quality: 0.42, - types: [ - "webp", - "jpeg" - ] - }, - // alter these text for internationalization - text: { - pausedHeader: "Paused", - pausedHint: void 0, - sending: "Teleporting", - encoding: "Encoding", - limitReached: "Limit reached", - audioOff: "Audio off", - audioOn: "Audio on", - buttons: { - record: "Record video", - recordAgain: "Record again", - resume: "Resume", - pause: "Pause", - preview: "Preview" - } - }, - notifier: { - entertain: false, - entertainClass: "bg", - entertainLimit: 6, - entertainInterval: 9000 - }, - timeouts: { - userMedia: 20e3, - connection: 1e4, - pingInterval: 30e3 - }, - loadUserMediaOnRecord: false, - callbacks: { - /* - * a custom callback to tweak form data before posting to server - * this is for advanced use only and shouldn't be used if possible - */ adjustFormDataBeforePosting: void 0 - }, - defaults: { - from: void 0, - to: void 0, - cc: void 0, - bcc: void 0, - subject: void 0, - body: void 0 - }, - // show errors inside the container? - displayErrors: true, - // true = all form inputs get disabled and disappear when browser can't record - adjustFormOnBrowserError: true, - // when true, any errors will be sent to the videomail server for analysis - reportErrors: true, - // just for testing purposes to simulate browser agent handling - fakeUaString: void 0, - version: package_namespaceObject.i8 - }; - /* ESM default export */ const src_options = options_options; - function AudioRecorder_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - const CHANNELS = 1; - /* - * for inspiration see - * https://github.com/saebekassebil/microphone-stream - */ function getAudioContextClass() { - return window.AudioContext; - } - class AudioRecorder { - hasAudioContext() { - return Boolean(getAudioContextClass()) && Boolean(this.getAudioContext()); - } - getAudioContext() { - // instantiate only once - if (!this.vcAudioContext) { - const AudioContext = getAudioContextClass(); - this.vcAudioContext = new AudioContext(); - } - return this.vcAudioContext; - } - onAudioProcess(e, cb) { - if (!this.userMedia.isRecording() || this.userMedia.isPaused()) return; - /* - * Returns a Float32Array containing the PCM data associated with the channel, - * defined by the channel parameter (with 0 representing the first channel) - */ const float32Array = e.inputBuffer.getChannelData(0); - cb(new audio_sample_modern_t(float32Array)); - } - init(localMediaStream) { - this.options.logger.debug("AudioRecorder: init()"); - // creates an audio node from the microphone incoming stream - const volume = this.getAudioContext().createGain(); - try { - this.audioInput = this.getAudioContext().createMediaStreamSource(localMediaStream); - } catch (exc) { - throw error_createError({ - message: "Webcam has no audio", - exc, - options: this.options - }); - } - let { bufferSize } = this.options.audio; - // see https://github.com/binarykitchen/videomail-client/issues/184 - if ("auto" === bufferSize) bufferSize = getBrowser(this.options).isFirefox() ? 512 : 2048; - if (!is_power_of_two_default()(bufferSize)) throw error_createError({ - message: "Audio buffer size must be a power of two.", - options: this.options - }); - if (!this.options.audio.volume || src_options.audio.volume > 1) throw error_createError({ - message: "Audio volume must be between zero and one.", - options: this.options - }); - volume.gain.value = this.options.audio.volume; - /* - * Create a ScriptProcessorNode with the given bufferSize and - * a single input and output channel - */ // eslint-disable-next-line @typescript-eslint/no-deprecated - this.scriptProcessor = this.getAudioContext().createScriptProcessor(bufferSize, CHANNELS, CHANNELS); - // connect stream to our scriptProcessor - this.audioInput.connect(this.scriptProcessor); - // connect our scriptProcessor to the previous destination - this.scriptProcessor.connect(this.getAudioContext().destination); - // connect volume - this.audioInput.connect(volume); - volume.connect(this.scriptProcessor); - } - record(cb) { - this.options.logger.debug("AudioRecorder: record()"); - if (this.scriptProcessor) // eslint-disable-next-line @typescript-eslint/no-deprecated - this.scriptProcessor.onaudioprocess = (e)=>{ - this.onAudioProcess(e, cb); - }; - } - stop() { - this.options.logger.debug("AudioRecorder: stop()"); - if (this.scriptProcessor) // eslint-disable-next-line @typescript-eslint/no-deprecated - this.scriptProcessor.onaudioprocess = null; - if (this.audioInput) this.audioInput.disconnect(); - // https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/close - if (this.hasAudioContext()) this.getAudioContext().close().then(()=>{ - this.options.logger.debug("AudioRecorder: audio context is closed"); - this.vcAudioContext = void 0; - }).catch(function(err) { - if (err instanceof Error) throw error_createError({ - err, - options: src_options - }); - throw err; - }); - } - getSampleRate() { - if (this.hasAudioContext()) return this.getAudioContext().sampleRate; - return -1; - } - constructor(userMedia, options){ - // eslint-disable-next-line @typescript-eslint/no-deprecated - AudioRecorder_define_property(this, "scriptProcessor", void 0); - AudioRecorder_define_property(this, "audioInput", void 0); - AudioRecorder_define_property(this, "vcAudioContext", void 0); - AudioRecorder_define_property(this, "userMedia", void 0); - AudioRecorder_define_property(this, "options", void 0); - this.options = options; - this.userMedia = userMedia; - } - } - /* ESM default export */ const media_AudioRecorder = AudioRecorder; - /* - * taken from - * https://bbc.github.io/tal/jsdoc/events_mediaevent.js.html - */ const MEDIA_EVENTS = [ - /* - * The user agent begins looking for media data, as part of - * the resource selection algorithm. - */ "loadstart", - /* - * The user agent is intentionally not currently fetching media data, - * but does not have the entire media resource downloaded. networkState equals NETWORK_IDLE - */ "suspend", - /* - * Playback has begun. Fired after the play() method has returned, - * or when the autoplay attribute has caused playback to begin. - * paused is newly false. - * 'play', commented out since it has special treatment - */ /* - * The user agent has just determined the duration and dimensions of the - * media resource and the timed tracks are ready. - * readyState is newly equal to HAVE_METADATA or greater for the first time. - * 'loadedmetadata', commented out since it has special treatment - */ // The user agent is fetching media data. - "progress", - /* - * The user agent is intentionally not currently fetching media data, - * but does not have the entire media resource downloaded. - * 'suspend', // commented out, we are already listening to it in code - */ /* - * Event The user agent stops fetching the media data before it is completely downloaded, - * but not due to an error. error is an object with the code MEDIA_ERR_ABORTED. - */ "abort", - /* - * A media element whose networkState was previously not in the NETWORK_EMPTY - * state has just switched to that state (either because of a fatal error - * during load that's about to be reported, or because the load() method was - * invoked while the resource selection algorithm was already running). - */ "emptied", - /* - * The user agent is trying to fetch media data, but data is - * unexpectedly not forthcoming - */ "stalled", - /* - * Playback has been paused. Fired after the pause() method has returned. - * paused is newly true. - */ "pause", - /* - * The user agent can render the media data at the current playback position - * for the first time. - * readyState newly increased to HAVE_CURRENT_DATA or greater for the first time. - */ "loadeddata", - /* - * Playback has stopped because the next frame is not available, but the user - * agent expects that frame to become available in due course. - * readyState is newly equal to or less than HAVE_CURRENT_DATA, - * and paused is false. Either seeking is true, or the current playback - * position is not contained in any of the ranges in buffered. - * It is possible for playback to stop for two other reasons without - * paused being false, but those two reasons do not fire this event: - * maybe playback ended, or playback stopped due to errors. - */ "waiting", - /* - * Playback has started. readyState is newly equal to or greater than - * HAVE_FUTURE_DATA, paused is false, seeking is false, - * or the current playback position is contained in one of the ranges in buffered. - */ "playing", - /* - * The user agent can resume playback of the media data, - * but estimates that if playback were to be started now, the media resource - * could not be rendered at the current playback rate up to its end without - * having to stop for further buffering of content. - * readyState newly increased to HAVE_FUTURE_DATA or greater. - */ "canplay", - /* - * The user agent estimates that if playback were to be started now, - * the media resource could be rendered at the current playback rate - * all the way to its end without having to stop for further buffering. - * readyState is newly equal to HAVE_ENOUGH_DATA. - */ "canplaythrough", - /* - * The seeking IDL attribute changed to true and the seek operation is - * taking long enough that the user agent has time to fire the event. - */ "seeking", - // The seeking IDL attribute changed to false. - "seeked", - /* - * Playback has stopped because the end of the media resource was reached. - * currentTime equals the end of the media resource; ended is true. - */ "ended", - /* - * Either the defaultPlaybackRate or the playbackRate attribute - * has just been updated. - */ "ratechange", - // The duration attribute has just been updated. - "durationchange", - /* - * Either the volume attribute or the muted attribute has changed. - * Fired after the relevant attribute's setter has returned. - */ "volumechange" - ]; - /* ESM default export */ const mediaEvents = MEDIA_EVENTS; - function getFirstVideoTrack(localMediaStream) { - const videoTracks = localMediaStream.getVideoTracks(); - let videoTrack; - if (videoTracks[0]) videoTrack = videoTracks[0]; - return videoTrack; - } - /* ESM default export */ const media_getFirstVideoTrack = getFirstVideoTrack; - function userMedia_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - const EVENT_ASCII = "|—O—|"; - class UserMedia extends util_Despot { - attachMediaStream(stream) { - this.currentVisualStream = stream; - if (this.rawVisualUserMedia) this.rawVisualUserMedia.srcObject = stream; - else throw error_createError({ - message: "Error attaching stream to element.", - explanation: "Contact the developer about this", - options: this.options - }); - } - setVisualStream(localMediaStream) { - if (localMediaStream) this.attachMediaStream(localMediaStream); - else { - var _this_rawVisualUserMedia, _this_rawVisualUserMedia1; - null === (_this_rawVisualUserMedia = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia || _this_rawVisualUserMedia.removeAttribute("srcObject"); - null === (_this_rawVisualUserMedia1 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia1 || _this_rawVisualUserMedia1.removeAttribute("src"); - this.currentVisualStream = void 0; - } - } - hasEnded() { - var _this_rawVisualUserMedia, _this_currentVisualStream; - if (null === (_this_rawVisualUserMedia = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia ? void 0 : _this_rawVisualUserMedia.ended) return this.rawVisualUserMedia.ended; - return !(null === (_this_currentVisualStream = this.currentVisualStream) || void 0 === _this_currentVisualStream ? void 0 : _this_currentVisualStream.active); - } - hasInvalidDimensions() { - var _this_rawVisualUserMedia, _this_rawVisualUserMedia1; - if ((null === (_this_rawVisualUserMedia = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia ? void 0 : _this_rawVisualUserMedia.videoWidth) && this.rawVisualUserMedia.videoWidth < 3 || (null === (_this_rawVisualUserMedia1 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia1 ? void 0 : _this_rawVisualUserMedia1.height) && this.rawVisualUserMedia.height < 3) return true; - return false; - } - logEvent(eventType, params) { - this.options.logger.debug(`UserMedia: ... ${EVENT_ASCII} event ${eventType}: ${pretty(params)}`); - } - outputEvent(e) { - var _this_rawVisualUserMedia, _this_rawVisualUserMedia1; - this.logEvent(e.type, { - readyState: null === (_this_rawVisualUserMedia = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia ? void 0 : _this_rawVisualUserMedia.readyState - }); - null === (_this_rawVisualUserMedia1 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia1 || _this_rawVisualUserMedia1.removeEventListener(e.type, this.outputEvent.bind(this)); - } - unloadRemainingEventListeners() { - this.options.logger.debug("UserMedia: unloadRemainingEventListeners()"); - mediaEvents.forEach((eventName)=>{ - var _this_rawVisualUserMedia; - null === (_this_rawVisualUserMedia = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia || _this_rawVisualUserMedia.removeEventListener(eventName, this.outputEvent.bind(this)); - }); - } - audioRecord(audioCallback) { - var _this_audioRecorder; - util_Despot.removeListener("SENDING_FIRST_FRAME"); - null === (_this_audioRecorder = this.audioRecorder) || void 0 === _this_audioRecorder || _this_audioRecorder.record(audioCallback); - } - init(localMediaStream, videoCallback, audioCallback, endedEarlyCallback, switchingFacingMode) { - this.stop(localMediaStream, { - aboutToInitialize: true, - switchingFacingMode - }); - // Reset states - this.onPlayReached = false; - this.onLoadedMetaDataReached = false; - this.playingPromiseReached = false; - if (isAudioEnabled(this.options)) { - var _this_audioRecorder; - null !== (_this_audioRecorder = this.audioRecorder) && void 0 !== _this_audioRecorder || (this.audioRecorder = new media_AudioRecorder(this, this.options)); - } - const unloadAllEventListeners = ()=>{ - var _this_rawVisualUserMedia, _this_rawVisualUserMedia1; - this.options.logger.debug("UserMedia: unloadAllEventListeners()"); - this.unloadRemainingEventListeners(); - util_Despot.removeListener("SENDING_FIRST_FRAME"); - null === (_this_rawVisualUserMedia = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia || _this_rawVisualUserMedia.removeEventListener("play", onPlay); - null === (_this_rawVisualUserMedia1 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia1 || _this_rawVisualUserMedia1.removeEventListener("loadedmetadata", onLoadedMetaData); - }; - const play = ()=>{ - // Resets the media element and restarts the media resource. Any pending events are discarded. - try { - var _this_rawVisualUserMedia, _this_rawVisualUserMedia1; - null === (_this_rawVisualUserMedia = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia || _this_rawVisualUserMedia.load(); - /* - * fixes https://github.com/binarykitchen/videomail.io/issues/401 - * see https://github.com/MicrosoftEdge/Demos/blob/master/photocapture/scripts/demo.js#L27 - */ if (null === (_this_rawVisualUserMedia1 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia1 ? void 0 : _this_rawVisualUserMedia1.paused) { - this.options.logger.debug(`UserMedia: play(): media.readyState=${this.rawVisualUserMedia.readyState}, media.paused=${this.rawVisualUserMedia.paused}, media.ended=${this.rawVisualUserMedia.ended}, media.played=${pretty(this.rawVisualUserMedia.played)}`); - let p; - try { - p = this.rawVisualUserMedia.play(); - } catch (exc) { - /* - * this in the hope to catch InvalidStateError, see - * https://github.com/binarykitchen/videomail-client/issues/149 - */ this.options.logger.warn(`Caught raw user media play exception: ${exc}`); - } - /* - * using the promise here just experimental for now - * and this to catch any weird errors early if possible - */ if (isPromise(p)) p.then(()=>{ - if (!this.playingPromiseReached) { - this.options.logger.debug("UserMedia: play promise successful. Playing now."); - this.playingPromiseReached = true; - } - }).catch((reason)=>{ - /* - * promise can be interrupted, i.E. when switching tabs - * and promise can get resumed when switching back to tab, hence - * do not treat this like an error - */ this.options.logger.warn(`Caught pending user media promise exception: ${reason.toString()}`); - }); - } - } catch (exc) { - unloadAllEventListeners(); - endedEarlyCallback(exc); - } - }; - const fireCallbacks = ()=>{ - var _this_rawVisualUserMedia; - const readyState = null === (_this_rawVisualUserMedia = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia ? void 0 : _this_rawVisualUserMedia.readyState; - // ready state, see https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/readyState - this.options.logger.debug(`UserMedia: fireCallbacks(readyState=${readyState}, onPlayReached=${this.onPlayReached}, onLoadedMetaDataReached=${this.onLoadedMetaDataReached})`); - if (this.onPlayReached && this.onLoadedMetaDataReached) { - videoCallback(); - if (this.audioRecorder) try { - this.audioRecorder.init(localMediaStream); - this.on("SENDING_FIRST_FRAME", ()=>{ - this.audioRecord(audioCallback); - }); - } catch (exc) { - unloadAllEventListeners(); - endedEarlyCallback(exc); - } - } - }; - const onPlay = ()=>{ - try { - var _this_rawVisualUserMedia, _this_rawVisualUserMedia1, _this_rawVisualUserMedia2, _this_rawVisualUserMedia3, _this_rawVisualUserMedia4, _this_rawVisualUserMedia5; - this.logEvent("play", { - readyState: null === (_this_rawVisualUserMedia = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia ? void 0 : _this_rawVisualUserMedia.readyState, - audio: isAudioEnabled(this.options), - width: null === (_this_rawVisualUserMedia1 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia1 ? void 0 : _this_rawVisualUserMedia1.width, - height: null === (_this_rawVisualUserMedia2 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia2 ? void 0 : _this_rawVisualUserMedia2.height, - videoWidth: null === (_this_rawVisualUserMedia3 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia3 ? void 0 : _this_rawVisualUserMedia3.videoWidth, - videoHeight: null === (_this_rawVisualUserMedia4 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia4 ? void 0 : _this_rawVisualUserMedia4.videoHeight - }); - null === (_this_rawVisualUserMedia5 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia5 || _this_rawVisualUserMedia5.removeEventListener("play", onPlay); - if (this.hasEnded() || this.hasInvalidDimensions()) endedEarlyCallback(error_createError({ - message: "Already busy", - explanation: "Probably another browser window is using your webcam?", - options: this.options - })); - else { - this.onPlayReached = true; - fireCallbacks(); - } - } catch (exc) { - unloadAllEventListeners(); - endedEarlyCallback(exc); - } - }; - // player modifications to perform that must wait until `loadedmetadata` has been triggered - const onLoadedMetaData = ()=>{ - var _this_rawVisualUserMedia, _this_rawVisualUserMedia1, _this_rawVisualUserMedia2, _this_rawVisualUserMedia3, _this_rawVisualUserMedia4, _this_rawVisualUserMedia5, _this_rawVisualUserMedia6; - this.logEvent("loadedmetadata", { - readyState: null === (_this_rawVisualUserMedia = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia ? void 0 : _this_rawVisualUserMedia.readyState, - paused: null === (_this_rawVisualUserMedia1 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia1 ? void 0 : _this_rawVisualUserMedia1.paused, - width: null === (_this_rawVisualUserMedia2 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia2 ? void 0 : _this_rawVisualUserMedia2.width, - height: null === (_this_rawVisualUserMedia3 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia3 ? void 0 : _this_rawVisualUserMedia3.height, - videoWidth: null === (_this_rawVisualUserMedia4 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia4 ? void 0 : _this_rawVisualUserMedia4.videoWidth, - videoHeight: null === (_this_rawVisualUserMedia5 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia5 ? void 0 : _this_rawVisualUserMedia5.videoHeight - }); - null === (_this_rawVisualUserMedia6 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia6 || _this_rawVisualUserMedia6.removeEventListener("loadedmetadata", onLoadedMetaData); - if (!this.hasEnded() && !this.hasInvalidDimensions()) { - this.emit("LOADED_META_DATA"); - this.onLoadedMetaDataReached = true; - fireCallbacks(); - } - }; - try { - var _this_rawVisualUserMedia, _this_rawVisualUserMedia1, /* - * experimental, not sure if this is ever needed/called? since 2 apr 2017 - * An error occurs while fetching the media data. - * Error can be an object with the code MEDIA_ERR_NETWORK or higher. - * networkState equals either NETWORK_EMPTY or NETWORK_IDLE, depending on when the download was aborted. - */ _this_rawVisualUserMedia2; - const videoTrack = media_getFirstVideoTrack(localMediaStream); - if (videoTrack) { - if (videoTrack.enabled) { - let description = ""; - if (videoTrack.label && videoTrack.label.length > 0) description = description.concat(videoTrack.label); - description = description.concat(` with enabled=${videoTrack.enabled}, muted=${videoTrack.muted}, readyState=${videoTrack.readyState}`); - this.options.logger.debug(`UserMedia: ${videoTrack.kind} detected. ${description}`); - } else throw error_createError({ - message: "Webcam is disabled", - explanation: "The video track seems to be disabled. Enable it in your system.", - options: this.options - }); - } else this.options.logger.debug("UserMedia: detected (but no video tracks exist"); - null === (_this_rawVisualUserMedia = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia || _this_rawVisualUserMedia.addEventListener("loadedmetadata", onLoadedMetaData); - null === (_this_rawVisualUserMedia1 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia1 || _this_rawVisualUserMedia1.addEventListener("play", onPlay); - null === (_this_rawVisualUserMedia2 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia2 || _this_rawVisualUserMedia2.addEventListener("error", (err)=>{ - this.options.logger.warn(`Caught video element error event: ${pretty(err)}`); - }); - this.setVisualStream(localMediaStream); - play(); - } catch (exc) { - this.emit("ERROR", { - exc - }); - } - } - isReady() { - var _this_rawVisualUserMedia; - return Boolean(null === (_this_rawVisualUserMedia = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia ? void 0 : _this_rawVisualUserMedia.src); - } - stop(visualStream, params) { - try { - let chosenStream = visualStream; - // do not stop "too much" when going to initialize anyway - if (!(null == params ? void 0 : params.aboutToInitialize)) { - var _this_audioRecorder; - if (!chosenStream) chosenStream = this.currentVisualStream; - const tracks = null == chosenStream ? void 0 : chosenStream.getTracks(); - if (tracks) tracks.forEach((track)=>{ - track.stop(); - }); - this.setVisualStream(void 0); - null === (_this_audioRecorder = this.audioRecorder) || void 0 === _this_audioRecorder || _this_audioRecorder.stop(); - this.audioRecorder = void 0; - } - /* - * don't have to reset these states when just switching camera - * while still recording or pausing - */ if (!(null == params ? void 0 : params.switchingFacingMode)) this.paused = this.recording = false; - } catch (exc) { - this.emit("ERROR", { - exc - }); - } - } - createCanvas() { - const canvas = document.createElement("canvas"); - const rawWidth = this.getRawWidth(true); - if (rawWidth) canvas.width = rawWidth; - const rawHeight = this.getRawHeight(true); - if (rawHeight) canvas.height = rawHeight; - return canvas; - } - getVideoHeight() { - if (!this.rawVisualUserMedia) return; - return this.rawVisualUserMedia.videoHeight || this.rawVisualUserMedia.height; - } - getVideoWidth() { - if (!this.rawVisualUserMedia) return; - return this.rawVisualUserMedia.videoWidth || this.rawVisualUserMedia.width; - } - hasVideoWidth() { - const videoWidth = this.getVideoWidth(); - return videoWidth && videoWidth > 0; - } - getRawWidth(responsive) { - let rawWidth = this.getVideoWidth(); - if (this.options.video.width || this.options.video.height) rawWidth = responsive ? this.recorder.calculateWidth(responsive) : this.options.video.width; - if (responsive) rawWidth = this.recorder.limitWidth(rawWidth); - return rawWidth; - } - getRawHeight(responsive) { - let rawHeight; - if (this.options.video.width || this.options.video.height) { - rawHeight = this.recorder.calculateHeight(responsive); - if (!rawHeight || rawHeight < 1) throw error_createError({ - message: "Bad dimensions", - explanation: "Calculated raw height cannot be less than 1!", - options: this.options - }); - } else { - rawHeight = this.getVideoHeight(); - if (!rawHeight || rawHeight < 1) throw error_createError({ - message: "Bad dimensions", - explanation: "Raw video height from DOM element cannot be less than 1!", - options: this.options - }); - } - if (responsive) rawHeight = this.recorder.limitHeight(rawHeight); - return rawHeight; - } - getRawVisuals() { - return this.rawVisualUserMedia; - } - pause() { - this.paused = true; - } - isPaused() { - return this.paused; - } - resume() { - this.paused = false; - } - record() { - this.recording = true; - } - isRecording() { - return this.recording; - } - getAudioSampleRate() { - if (this.audioRecorder) return this.audioRecorder.getSampleRate(); - return -1; - } - getCharacteristics() { - var _this_rawVisualUserMedia, _this_rawVisualUserMedia1, _this_rawVisualUserMedia2, _this_rawVisualUserMedia3, _this_rawVisualUserMedia4; - return { - audioSampleRate: this.getAudioSampleRate(), - muted: null === (_this_rawVisualUserMedia = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia ? void 0 : _this_rawVisualUserMedia.muted, - width: null === (_this_rawVisualUserMedia1 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia1 ? void 0 : _this_rawVisualUserMedia1.width, - height: null === (_this_rawVisualUserMedia2 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia2 ? void 0 : _this_rawVisualUserMedia2.height, - videoWidth: null === (_this_rawVisualUserMedia3 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia3 ? void 0 : _this_rawVisualUserMedia3.videoWidth, - videoHeight: null === (_this_rawVisualUserMedia4 = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia4 ? void 0 : _this_rawVisualUserMedia4.videoHeight - }; - } - constructor(recorder, options){ - super("UserMedia", options), userMedia_define_property(this, "recorder", void 0), userMedia_define_property(this, "rawVisualUserMedia", void 0), userMedia_define_property(this, "paused", false), userMedia_define_property(this, "recording", false), userMedia_define_property(this, "audioRecorder", void 0), userMedia_define_property(this, "currentVisualStream", void 0), userMedia_define_property(this, "onPlayReached", false), userMedia_define_property(this, "onLoadedMetaDataReached", false), userMedia_define_property(this, "playingPromiseReached", false); - this.recorder = recorder; - this.rawVisualUserMedia = recorder.getRawVisualUserMedia(); - mediaEvents.forEach((eventName)=>{ - var _this_rawVisualUserMedia; - null === (_this_rawVisualUserMedia = this.rawVisualUserMedia) || void 0 === _this_rawVisualUserMedia || _this_rawVisualUserMedia.addEventListener(eventName, this.outputEvent.bind(this), false); - }); - } - } - /* ESM default export */ const visuals_userMedia = UserMedia; - function figureMinHeight_figureMinHeight(height, options) { - let minHeight; - if (options.video.height) { - minHeight = Math.min(options.video.height, height); - if (minHeight < 1) throw error_createError({ - message: `Got a min height less than 1 (${minHeight})!`, - options - }); - } else minHeight = height; - return minHeight; - } - /* ESM default export */ const figureMinHeight = figureMinHeight_figureMinHeight; - function getRatio_getRatio(options, videoHeight, videoWidth) { - // just a default one when no computations are possible - let ratio = 1; - const hasVideoDimensions = videoHeight && videoWidth; - const desiredHeight = options.video.height; - const desiredWidth = options.video.width; - const hasDesiredDimensions = desiredHeight && desiredWidth; - if (hasDesiredDimensions) ratio = hasVideoDimensions ? videoHeight < desiredHeight || videoWidth < desiredWidth ? videoHeight / videoWidth : desiredHeight / desiredWidth : desiredHeight / desiredWidth; - else if (hasVideoDimensions) ratio = videoHeight / videoWidth; - return ratio; - } - /* ESM default export */ const getRatio = getRatio_getRatio; - /* - * this is difficult to compute and is not entirely correct. - * but good enough for now to ensure some stability. - */ function limitHeight_limitHeight(height, options) { - if (!height || height < 1) throw error_createError({ - message: "Passed limit-height argument cannot be less than 1!", - options - }); - const limitedHeight = Math.min(height, document.documentElement.clientHeight); - if (limitedHeight < 1) throw error_createError({ - message: "Limited height cannot be less than 1!", - options - }); - return limitedHeight; - } - /* ESM default export */ const limitHeight = limitHeight_limitHeight; - function calculateWidth_calculateWidth(responsive, videoHeight, options, ratio) { - let height = figureMinHeight(videoHeight, options); - if (responsive) height = limitHeight(height, options); - if (!height || height < 1) throw error_createError({ - message: "Height cannot be smaller than 1 when calculating width.", - options - }); - const chosenRatio = null != ratio ? ratio : getRatio(options, videoHeight); - const calculatedWidth = Math.round(height / chosenRatio); - if (calculatedWidth < 1) throw error_createError({ - message: "Calculated width cannot be smaller than 1!", - options - }); - return calculatedWidth; - } - /* ESM default export */ const calculateWidth = calculateWidth_calculateWidth; - function getOuterWidth_getOuterWidth(element) { - let rect = element.getBoundingClientRect(); - let outerWidth = rect.right - rect.left; - if (outerWidth < 1) { - // last effort, can happen when replaying only - rect = document.body.getBoundingClientRect(); - outerWidth = rect.right - rect.left; - } - return outerWidth; - } - /* ESM default export */ const getOuterWidth = getOuterWidth_getOuterWidth; - function limitWidth_limitWidth(element, options, width) { - let limitedWidth; - const outerWidth = getOuterWidth(element); - // only when that element has a defined width, apply this logic - limitedWidth = width && "number" == typeof width ? outerWidth > 0 && outerWidth < width ? outerWidth : width : outerWidth; - if (Number.isInteger(limitedWidth) && limitedWidth < 1) throw error_createError({ - message: "Limited width cannot be less than 1!", - options - }); - return limitedWidth; - } - /* ESM default export */ const limitWidth = limitWidth_limitWidth; - function calculateHeight_calculateHeight(responsive, videoWidth, options, target, ratio, element) { - let width = videoWidth; - if (width < 1) throw error_createError({ - message: `Unable to calculate height for target ${target} when width is less than 1 (= ${width}) and responsive mode is set to ${responsive}`, - options - }); - if (responsive && element) width = limitWidth(element, options, width); - const chosenRatio = null != ratio ? ratio : getRatio(options, void 0, videoWidth); - const height = Math.round(width * chosenRatio); - if (Number.isInteger(height) && height < 1) throw error_createError({ - message: "Just calculated a height less than 1 which is wrong.", - options - }); - return figureMinHeight(height, options); - } - /* ESM default export */ const calculateHeight = calculateHeight_calculateHeight; - /* provided dependency */ var Buffer = __webpack_require__("./node_modules/buffer/index.js")["Buffer"]; - function recorder_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - // credits http://1lineart.kulaone.com/#/ - const PIPE_SYMBOL = "°º¤ø,¸¸,ø¤º°`°º¤ø,¸,ø¤°º¤ø,¸¸,ø¤º°`°º¤ø,¸ "; - class Recorder extends util_Despot { - writeStream(buffer, opts) { - if (this.stream) { - if (this.stream.destroyed) { - // prevents https://github.com/binarykitchen/videomail.io/issues/393 - this.stopPings(); - const err = error_createError({ - message: "Already disconnected", - explanation: "Sorry, connection to the server has been destroyed. Please reload.", - options: this.options - }); - this.emit("ERROR", { - err - }); - } else { - const onFlushedCallback = null == opts ? void 0 : opts.onFlushedCallback; - try { - this.stream.write(buffer, ()=>{ - if (!onFlushedCallback) return; - try { - onFlushedCallback(opts); - } catch (exc) { - const err = error_createError({ - message: "Failed to write stream buffer", - explanation: `stream.write() failed because of ${pretty(exc)}`, - options: this.options, - exc - }); - this.emit("ERROR", { - err - }); - } - }); - } catch (exc) { - const err = error_createError({ - message: "Failed writing to server", - explanation: `stream.write() failed because of ${pretty(exc)}`, - options: this.options, - exc - }); - this.emit("ERROR", { - err - }); - } - } - } - } - sendPings() { - this.pingInterval = window.setInterval(()=>{ - this.options.logger.debug("Recorder: pinging..."); - this.writeStream(Buffer.from("")); - }, this.options.timeouts.pingInterval); - } - stopPings() { - clearInterval(this.pingInterval); - } - onAudioSample(audioSample) { - this.samplesCount++; - const audioBuffer = audioSample.toBuffer(); - /* - * if (this.options.verbose) { - * this.options.logger.debug( - * 'Sample #' + samplesCount + ' (' + audioBuffer.length + ' bytes):' - * ) - * } - */ this.writeStream(audioBuffer); - } - show() { - if (this.recorderElement) hidden_default()(this.recorderElement, false); - } - onUserMediaReady(params) { - try { - this.options.logger.debug(`Recorder: onUserMediaReady(${params ? pretty(params) : ""})`); - const switchingFacingMode = null == params ? void 0 : params.switchingFacingMode; - this.userMediaLoading = this.blocking = this.unloaded = this.submitting = false; - this.userMediaLoaded = true; - if (!switchingFacingMode) this.loop = this.createLoop(); - this.show(); - if (null == params ? void 0 : params.recordWhenReady) this.record(); - this.emit("USER_MEDIA_READY", { - switchingFacingMode: null == params ? void 0 : params.switchingFacingMode, - paused: this.isPaused(), - recordWhenReady: null == params ? void 0 : params.recordWhenReady - }); - } catch (exc) { - this.emit("ERROR", { - exc - }); - } - } - clearRetryTimeout() { - if (!this.retryTimeout) return; - this.options.logger.debug("Recorder: clearRetryTimeout()"); - window.clearTimeout(this.retryTimeout); - this.retryTimeout = void 0; - } - calculateFrameProgress() { - return `${(this.confirmedFrameNumber / (this.framesCount || 1) * 100).toFixed(2)}%`; - } - calculateSampleProgress() { - return `${(this.confirmedSampleNumber / (this.samplesCount || 1) * 100).toFixed(2)}%`; - } - updateOverallProgress() { - /* - * when progresses aren't initialized, - * then do a first calculation to avoid `infinite` or `null` displays - */ this.frameProgress = this.calculateFrameProgress(); - if (isAudioEnabled(this.options)) this.sampleProgress = this.calculateSampleProgress(); - this.emit("PROGRESS", { - frameProgress: this.frameProgress, - sampleProgress: this.sampleProgress - }); - } - updateFrameProgress(args) { - this.confirmedFrameNumber = args.frame; - this.frameProgress = this.calculateFrameProgress(); - this.updateOverallProgress(); - } - updateSampleProgress(args) { - this.confirmedSampleNumber = args.sample; - this.sampleProgress = this.calculateSampleProgress(); - this.updateOverallProgress(); - } - preview(args) { - const hasAudio = this.samplesCount > 0; - this.confirmedFrameNumber = this.confirmedSampleNumber = this.samplesCount = this.framesCount = 0; - this.sampleProgress = this.frameProgress = void 0; - this.key = args.key; - /* - * We are not serving MP4 videos anymore due to licensing but are keeping code - * for compatibility and documentation - */ if (args.mp4) this.replay.setMp4Source(`${args.mp4 + constants.SITE_NAME_LABEL}/${this.options.siteName}/videomail.mp4`, true); - if (args.webm) this.replay.setWebMSource(`${args.webm + constants.SITE_NAME_LABEL}/${this.options.siteName}/videomail.webm`, true); - this.hide(); - const width = this.getRecorderWidth(true); - const height = this.getRecorderHeight(true); - this.emit("PREVIEW", { - key: this.key, - width, - height, - hasAudio - }); - // keep it for recording stats - if (this.stopTime) this.waitingTime = Date.now() - this.stopTime; - if (!this.recordingStats) this.recordingStats = {}; - this.recordingStats.waitingTime = this.waitingTime; - } - initSocket(cb) { - if (!this.connected) { - this.connecting = true; - this.options.logger.debug(`Recorder: initializing web socket to ${this.options.socketUrl}`); - this.emit("CONNECTING"); - // https://github.com/maxogden/websocket-stream#binary-sockets - /* - * we use query parameters here because we cannot set custom headers in web sockets, - * see https://github.com/websockets/ws/issues/467 - */ const url2Connect = `${this.options.socketUrl}?${encodeURIComponent(constants.SITE_NAME_LABEL)}=${encodeURIComponent(this.options.siteName)}`; - try { - /* - * websocket options cannot be set on client side, only on server, see - * https://github.com/maxogden/websocket-stream/issues/116#issuecomment-296421077 - */ this.stream = stream_default()(url2Connect, { - perMessageDeflate: false, - // see https://github.com/maxogden/websocket-stream/issues/117#issuecomment-298826011 - objectMode: true - }); - } catch (exc) { - this.connecting = this.connected = false; - const err = error_createError({ - message: "Failed to connect to server", - explanation: "Please upgrade your browser. Your current version does not seem to support websockets.", - options: this.options, - exc - }); - this.emit("ERROR", { - err - }); - } - if (this.stream) { - // useful for debugging streams - /* - * if (!stream.originalEmit) { - * stream.originalEmit = stream.emit - * } - */ /* - * stream.emit = function (type) { - * if (stream) { - * this.options.logger.debug(PIPE_SYMBOL + 'Debugging stream event:', type) - * var args = Array.prototype.slice.call(arguments, 0) - * return stream.originalEmit.apply(stream, args) - * } - * } - */ this.stream.on("close", (err)=>{ - this.options.logger.debug(`${PIPE_SYMBOL}Stream has closed`); - this.connecting = this.connected = false; - if (err) this.emit("ERROR", { - err - }); - else if (this.userMediaLoaded) this.initSocket(); - }); - this.stream.on("connect", ()=>{ - var _this_stream; - this.options.logger.debug(`${PIPE_SYMBOL}Stream *connect* event emitted`); - const isClosing = (null === (_this_stream = this.stream) || void 0 === _this_stream ? void 0 : _this_stream.socket.readyState) === WebSocket.CLOSING; - if (!this.connected && !isClosing && !this.unloaded) { - this.connected = true; - this.connecting = this.unloaded = false; - this.emit("CONNECTED"); - null == cb || cb(); - } - }); - this.stream.on("data", (data)=>{ - this.options.logger.debug(`${PIPE_SYMBOL}Stream *data* event emitted`); - let command; - try { - command = JSON.parse(data.toString()); - } catch (exc) { - this.options.logger.debug(`Failed to parse command: ${exc}`); - const err = error_createError({ - message: "Invalid server command", - // toString() since https://github.com/binarykitchen/videomail.io/issues/288 - explanation: `Contact us asap. Bad command was ${data.toString()}. `, - options: this.options, - exc - }); - this.emit("ERROR", { - err - }); - } finally{ - this.executeCommand(command); - } - }); - this.stream.on("error", (err)=>{ - this.options.logger.debug(`${PIPE_SYMBOL}Stream *error* event emitted: ${pretty(err)}`); - }); - // just experimental - this.stream.on("drain", ()=>{ - this.options.logger.debug(`${PIPE_SYMBOL}Stream *drain* event emitted (should not happen!)`); - }); - this.stream.on("preend", ()=>{ - this.options.logger.debug(`${PIPE_SYMBOL}Stream *preend* event emitted`); - }); - this.stream.on("end", ()=>{ - this.options.logger.debug(`${PIPE_SYMBOL}Stream *end* event emitted`); - }); - this.stream.on("drain", ()=>{ - this.options.logger.debug(`${PIPE_SYMBOL}Stream *drain* event emitted`); - }); - this.stream.on("pipe", ()=>{ - this.options.logger.debug(`${PIPE_SYMBOL}Stream *pipe* event emitted`); - }); - this.stream.on("unpipe", ()=>{ - this.options.logger.debug(`${PIPE_SYMBOL}Stream *unpipe* event emitted`); - }); - this.stream.on("resume", ()=>{ - this.options.logger.debug(`${PIPE_SYMBOL}Stream *resume* event emitted`); - }); - this.stream.on("uncork", ()=>{ - this.options.logger.debug(`${PIPE_SYMBOL}Stream *uncork* event emitted`); - }); - this.stream.on("readable", ()=>{ - this.options.logger.debug(`${PIPE_SYMBOL}Stream *preend* event emitted`); - }); - this.stream.on("prefinish", ()=>{ - this.options.logger.debug(`${PIPE_SYMBOL}Stream *preend* event emitted`); - }); - this.stream.on("finish", ()=>{ - this.options.logger.debug(`${PIPE_SYMBOL}Stream *preend* event emitted`); - }); - } - } - } - showUserMedia() { - /* - * use connected flag to prevent this from happening - * https://github.com/binarykitchen/videomail.io/issues/323 - */ if (!this.connected) return false; - const hidden = this.isHidden(); - if (!hidden) return true; - const notifying = this.isNotifying(); - if (notifying) return true; - return this.blocking; - } - userMediaErrorCallback(err) { - var _this_userMedia; - this.userMediaLoading = false; - this.clearUserMediaTimeout(); - const characteristics = null === (_this_userMedia = this.userMedia) || void 0 === _this_userMedia ? void 0 : _this_userMedia.getCharacteristics(); - this.options.logger.debug(`Recorder: userMediaErrorCallback(), name: ${err.name}, message: ${err.message} and Webcam characteristics: ${characteristics ? pretty(characteristics) : "none"}`); - const errorListeners = util_Despot.getListeners("ERROR"); - if (null == errorListeners ? void 0 : errorListeners.length) { - if (err.name !== error_VideomailError.MEDIA_DEVICE_NOT_SUPPORTED) { - const videomailError = error_createError({ - err, - options: this.options - }); - this.emit("ERROR", { - err: videomailError - }); - } else // do not emit but retry since MEDIA_DEVICE_NOT_SUPPORTED can be a race condition - this.options.logger.debug(`Recorder: ignore user media error ${pretty(err)}`); - // retry after a while - this.retryTimeout = window.setTimeout(this.initSocket.bind(this), this.options.timeouts.userMedia); - } else if (this.unloaded) /* - * This can happen when a container is unloaded but some user media related callbacks - * are still in process. In that case ignore error. - */ this.options.logger.debug(`Recorder: already unloaded. Not going to throw error ${pretty(err)}`); - else { - this.options.logger.debug(`Recorder: no error listeners attached but throwing error ${pretty(err)}`); - // weird situation, throw it instead of emitting since there are no error listeners - throw error_createError({ - err, - message: "Unable to process this error since there are no error listeners anymore.", - options: this.options - }); - } - } - getUserMediaCallback(localStream, params) { - if (!this.userMedia) throw new Error("No user media is defined"); - this.options.logger.debug(`Recorder: getUserMediaCallback(${params ? pretty(params) : ""})`); - if (this.showUserMedia()) try { - this.clearUserMediaTimeout(); - this.userMedia.init(localStream, ()=>{ - this.onUserMediaReady(params); - }, this.onAudioSample.bind(this), (err)=>{ - this.emit("ERROR", { - err - }); - }, null == params ? void 0 : params.switchingFacingMode); - } catch (exc) { - this.emit("ERROR", { - exc - }); - } - } - loadGenuineUserMedia(params) { - this.options.logger.debug(`Recorder: loadGenuineUserMedia(${params ? pretty(params) : ""})`); - this.emit("ASKING_WEBCAM_PERMISSION"); - const constraints = { - video: { - frameRate: { - ideal: this.options.video.fps - } - }, - audio: isAudioEnabled(this.options) - }; - // TODO Improve typings or add an external library for that - if ((null == params ? void 0 : params.switchingFacingMode) && constraints.video && true !== constraints.video) constraints.video.facingMode = params.switchingFacingMode; - if (this.options.video.width && constraints.video && true !== constraints.video) { - const idealWidth = this.options.video.width; - if (idealWidth) constraints.video.width = { - ideal: idealWidth - }; - } else if (constraints.video && true !== constraints.video) { - /* - * otherwise try to apply the same width as the element is having - * but there is no 100% guarantee that this will happen. not - * all webcam drivers behave the same way - */ const limitedWidth = this.limitWidth(); - if (limitedWidth) constraints.video.width = { - ideal: limitedWidth - }; - } - if (this.options.video.height && constraints.video && true !== constraints.video) { - const idealHeight = this.options.video.height; - if (idealHeight) constraints.video.height = { - ideal: idealHeight - }; - } - this.options.logger.debug(`Recorder: navigator.mediaDevices.getUserMedia() ${pretty(constraints)}`); - this.options.logger.debug(`Recorder: navigator.mediaDevices.getSupportedConstraints() ${pretty(navigator.mediaDevices.getSupportedConstraints())}`); - const genuineUserMediaRequest = navigator.mediaDevices.getUserMedia(constraints); - genuineUserMediaRequest.then((localStream)=>{ - this.getUserMediaCallback(localStream, params); - }).catch((reason)=>{ - this.userMediaErrorCallback(reason); - }); - } - loadUserMedia(params) { - if (this.userMediaLoaded) { - this.options.logger.debug("Recorder: skipping loadUserMedia() because it is already loaded"); - this.onUserMediaReady(params); - return; - } - if (this.userMediaLoading) { - this.options.logger.debug("Recorder: skipping loadUserMedia() because it is already asking for permission"); - return; - } - this.options.logger.debug(`Recorder: loadUserMedia(${params ? pretty(params) : ""})`); - this.emit("LOADING_USER_MEDIA"); - try { - this.userMediaTimeout = window.setTimeout(()=>{ - if (!this.isReady()) { - const err = getBrowser(this.options).getNoAccessIssue(); - this.emit("ERROR", { - err - }); - } - }, this.options.timeouts.userMedia); - this.userMediaLoading = true; - this.loadGenuineUserMedia(params); - } catch (exc) { - this.options.logger.debug("Recorder: failed to load genuine user media"); - this.userMediaLoading = false; - const errorListeners = util_Despot.getListeners("ERROR"); - if (null == errorListeners ? void 0 : errorListeners.length) this.emit("ERROR", { - exc - }); - else { - this.options.logger.debug("Recorder: no error listeners attached but throwing exception further"); - throw exc; // throw it further - } - } - } - executeCommand(command) { - if (this.unloaded) // Skip - return; - try { - if (command.args) this.options.logger.debug(`Server commanded: ${command.command} with ${pretty(command.args)}`); - else this.options.logger.debug(`Server commanded: ${command.command}`); - switch(command.command){ - case "ready": - this.emit("SERVER_READY"); - if (!this.userMediaTimeout) { - if (this.options.loadUserMediaOnRecord) // Still show it but have it blank - this.show(); - else this.loadUserMedia(); - } - break; - case "preview": - this.preview(command.args); - break; - case "error": - { - const err = error_createError({ - message: "Oh no, server error!", - explanation: command.args.err.toString() || "(No message given)", - options: this.options - }); - this.emit("ERROR", { - err - }); - break; - } - case "confirmFrame": - this.updateFrameProgress(command.args); - break; - case "confirmSample": - this.updateSampleProgress(command.args); - break; - case "beginAudioEncoding": - this.emit("BEGIN_AUDIO_ENCODING"); - break; - case "beginVideoEncoding": - this.emit("BEGIN_VIDEO_ENCODING"); - break; - default: - { - const err = error_createError({ - message: `Unknown server command: ${command.command}`, - options: this.options - }); - this.emit("ERROR", { - err - }); - break; - } - } - } catch (exc) { - this.emit("ERROR", { - exc - }); - } - } - isNotifying() { - return this.visuals.isNotifying(); - } - isHidden() { - return !this.recorderElement || hidden_default()(this.recorderElement); - } - writeCommand(command, args, cb) { - if (this.connected) { - if (this.stream) { - if (args) this.options.logger.debug(`$ ${command} with ${pretty(args)}`); - else this.options.logger.debug(`$ ${command}`); - const commandObj = { - command, - args - }; - /* - * todo commented out because for some reasons server does - * not accept such a long array of many log lines. to examine later. - * - * add some useful debug info to examine weird stuff like this one - * UnprocessableError: Unable to encode a video with FPS near zero. - * todo consider removing this later or have it for debug=1 only? - * - * if (this.options.logger && options.logger.getLines) { - * commandObj.logLines = options.logger.getLines() - * } - */ this.writeStream(Buffer.from(JSON.stringify(commandObj))); - if (cb) // keep all callbacks async - setTimeout(function() { - cb(); - }, 0); - } - } else { - this.options.logger.debug(`Reconnecting for the command ${command} …`); - this.initSocket(()=>{ - this.writeCommand(command, args); - null == cb || cb(); - }); - } - } - cancelAnimationFrame() { - var _this_loop; - null === (_this_loop = this.loop) || void 0 === _this_loop || _this_loop.dispose(); - } - getIntervalSum() { - return this.loop.getElapsedTime(); - } - getAvgInterval() { - return this.getIntervalSum() / this.framesCount; - } - getAvgFps() { - const intervalSum = this.getIntervalSum(); - if (0 === intervalSum) return; - return this.framesCount / this.getIntervalSum() * 1000; - } - getRecordingStats() { - return this.recordingStats; - } - getAudioSampleRate() { - var _this_userMedia; - return null === (_this_userMedia = this.userMedia) || void 0 === _this_userMedia ? void 0 : _this_userMedia.getAudioSampleRate(); - } - stop(params) { - var _this_loop; - if (!this.userMedia) throw new Error("No user media defined, unable to stop"); - this.options.logger.debug(`Recorder: stop(${params ? pretty(params) : ""})`); - const limitReached = null == params ? void 0 : params.limitReached; - this.emit("STOPPING", { - limitReached - }); - null === (_this_loop = this.loop) || void 0 === _this_loop || _this_loop.complete(); - /* - * needed to give dom enough time to prepare the replay element - * to show up upon the STOPPING event so that we can evaluate - * the right video type - */ setTimeout(()=>{ - this.stopTime = Date.now(); - const videoType = this.replay.getVideoType(); - if (!videoType) throw new Error("Unable to video record when no video type is defined."); - this.recordingStats = { - /* - * do not use loop.getFPS() as this will only return the fps from the last delta, - * not the average. see https://github.com/hapticdata/animitter/issues/3 - */ avgFps: this.getAvgFps(), - wantedFps: this.options.video.fps, - avgInterval: this.getAvgInterval(), - wantedInterval: 1e3 / this.options.video.fps, - intervalSum: this.getIntervalSum(), - framesCount: this.framesCount, - videoType - }; - if (isAudioEnabled(this.options) && this.userMedia) { - this.recordingStats.samplesCount = this.samplesCount; - this.recordingStats.sampleRate = this.userMedia.getAudioSampleRate(); - } - this.writeCommand("stop", this.recordingStats, ()=>{ - this.emit("STOPPED", { - recordingStats: this.recordingStats - }); - }); - // beware, resetting will set framesCount to zero, so leave this here - this.reset(); - }, 60); - } - back(cb) { - this.emit("GOING_BACK"); - this.unloaded = false; - this.show(); - this.writeCommand("back", void 0, cb); - } - reInitializeAudio() { - var _this_userMedia; - this.options.logger.debug("Recorder: reInitializeAudio()"); - this.clearUserMediaTimeout(); - null === (_this_userMedia = this.userMedia) || void 0 === _this_userMedia || _this_userMedia.stop(); - this.userMediaLoaded = this.key = this.canvas = this.ctx = void 0; - this.loadUserMedia(); - } - unload(params) { - if (this.unloaded || !this.built) return; // already unloaded - const e = null == params ? void 0 : params.e; - let cause; - if (e) cause = e.type; - this.options.logger.debug(`Recorder: unload()${cause ? `, cause: ${cause}` : ""}`); - this.reset(); - this.clearUserMediaTimeout(); - if (this.userMedia) // prevents https://github.com/binarykitchen/videomail-client/issues/114 - this.userMedia.unloadRemainingEventListeners(); - if (this.submitting) ; - else if (this.stream) { - /* - * force to disconnect socket right now to clean temp files on server - * event listeners will do the rest - */ this.options.logger.debug("Recorder: ending stream ..."); - this.stream.destroy(); - this.stream = void 0; - } - this.unloaded = true; - this.built = this.connecting = this.connected = false; - } - reset() { - // no need to reset when already unloaded - if (!this.unloaded) { - var _this_userMedia; - this.options.logger.debug("Recorder: reset()"); - this.emit("RESETTING"); - this.cancelAnimationFrame(); - null === (_this_userMedia = this.userMedia) || void 0 === _this_userMedia || _this_userMedia.stop(); - this.replay.reset(); - this.userMediaLoaded = this.key = this.canvas = this.ctx = this.recordingBuffer = void 0; - } - } - clearUserMediaTimeout() { - if (this.userMediaTimeout) { - this.options.logger.debug("Recorder: clearUserMediaTimeout()"); - window.clearTimeout(this.userMediaTimeout); - this.userMediaTimeout = void 0; - } - } - validate() { - return this.connected && void 0 === this.canvas; - } - isReady() { - var _this_userMedia; - return null === (_this_userMedia = this.userMedia) || void 0 === _this_userMedia ? void 0 : _this_userMedia.isReady(); - } - pause(params) { - var _this_userMedia; - if (params) this.options.logger.debug(`pause() at frame ${this.framesCount} with ${pretty(params)}`); - else this.options.logger.debug(`pause() at frame ${this.framesCount}`); - null === (_this_userMedia = this.userMedia) || void 0 === _this_userMedia || _this_userMedia.pause(); - this.loop.stop(); - this.emit("PAUSED"); - this.sendPings(); - } - resume() { - var _this_userMedia; - this.options.logger.debug(`Recorder: resume() with frame ${this.framesCount}`); - this.stopPings(); - this.emit("RESUMING"); - null === (_this_userMedia = this.userMedia) || void 0 === _this_userMedia || _this_userMedia.resume(); - this.loop.start(); - } - onFlushed(opts) { - const frameNumber = opts.frameNumber; - if (1 === frameNumber) this.emit("FIRST_FRAME_SENT"); - } - draw(_deltaTime, elapsedTime) { - if (!this.userMedia) throw new Error("No user media defined, unable to draw on canvas"); - try { - // ctx and stream might become null while unloading - if (!this.isPaused() && this.stream && this.ctx) { - var _this_frame, _this_recordingBuffer; - if (0 === this.framesCount) this.emit("SENDING_FIRST_FRAME"); - this.framesCount++; - const imageSource = this.userMedia.getRawVisuals(); - if (this.canvas && imageSource) this.ctx.drawImage(imageSource, 0, 0, this.canvas.width, this.canvas.height); - else throw new Error("Unable to draw an image without a defined canvas"); - this.recordingBuffer = null === (_this_frame = this.frame) || void 0 === _this_frame ? void 0 : _this_frame.toBuffer(); - const recordingBufferLength = null === (_this_recordingBuffer = this.recordingBuffer) || void 0 === _this_recordingBuffer ? void 0 : _this_recordingBuffer.length; - if (recordingBufferLength) { - if (this.recordingBuffer) { - const frameControlBuffer = Buffer.from(JSON.stringify({ - frameNumber: this.framesCount - })); - const frameBuffer = Buffer.concat([ - this.recordingBuffer, - frameControlBuffer - ]); - this.writeStream(frameBuffer, { - frameNumber: this.framesCount, - onFlushedCallback: this.onFlushed.bind(this) - }); - this.visuals.checkTimer(elapsedTime); - } - } else throw error_createError({ - message: "Failed to extract webcam data.", - options: this.options - }); - } - } catch (exc) { - this.emit("ERROR", { - exc - }); - } - } - createLoop() { - const newLoop = animitter_default()({ - fps: this.options.video.fps - }, this.draw.bind(this)); - // remember it first - this.originalAnimationFrameObject = newLoop.getRequestAnimationFrameObject(); - return newLoop; - } - record() { - if (this.unloaded) return; - // reconnect when needed - if (!this.connected) { - this.options.logger.debug("Recorder: reconnecting before recording ..."); - this.initSocket(()=>{ - this.once("USER_MEDIA_READY", this.record.bind(this)); - }); - return; - } - if (!this.userMediaLoaded) { - if (this.options.loadUserMediaOnRecord) this.loadUserMedia({ - recordWhenReady: true - }); - else { - const err = error_createError({ - message: "Load and enable your camera first", - options: this.options - }); - this.emit("ERROR", { - err - }); - } - // do nothing further - return; - } - try { - if (!this.userMedia) throw new Error("No user media defined, unable to create canvas"); - this.canvas = this.userMedia.createCanvas(); - } catch (exc) { - const err = error_createError({ - exc, - options: this.options - }); - this.emit("ERROR", { - err - }); - return; - } - this.ctx = this.canvas.getContext("2d"); - if (!this.canvas.width) { - const err = error_createError({ - message: "Canvas has an invalid width.", - options: this.options - }); - this.emit("ERROR", { - err - }); - return; - } - if (!this.canvas.height) { - const err = error_createError({ - message: "Canvas has an invalid height.", - options: this.options - }); - this.emit("ERROR", { - err - }); - return; - } - this.frame = new canvas_to_buffer_modern_r(this.canvas, this.options.image.types, this.options.image.quality); - this.options.logger.debug("Recorder: record()"); - this.userMedia.record(); - this.emit("RECORDING", { - framesCount: this.framesCount - }); - // see https://github.com/hapticdata/animitter/issues/3 - this.loop.on("update", (_deltaTime, elapsedTime)=>{ - let avgFPS; - // x1000 because of milliseconds - avgFPS = 0 !== elapsedTime ? Math.round(this.framesCount / elapsedTime * 1000) : void 0; - this.options.logger.debug(`Recorder: avgFps = ${avgFPS}, framesCount = ${this.framesCount}`); - }); - this.loop.start(); - } - setAnimationFrameObject(newObj) { - /* - * must stop and then start to make it become effective, see - * https://github.com/hapticdata/animitter/issues/5#issuecomment-292019168 - */ if (this.loop) { - const isRecording = this.isRecording(); - this.loop.stop(); - this.loop.setRequestAnimationFrameObject(newObj); - if (isRecording) this.loop.start(); - } - } - restoreAnimationFrameObject() { - this.options.logger.debug("Recorder: restoreAnimationFrameObject()"); - this.setAnimationFrameObject(this.originalAnimationFrameObject); - } - loopWithTimeouts() { - this.options.logger.debug("Recorder: loopWithTimeouts()"); - const wantedInterval = 1e3 / this.options.video.fps; - let processingTime = 0; - let start; - const raf = (fn)=>setTimeout(()=>{ - start = Date.now(); - fn(); - processingTime = Date.now() - start; - }, /* - * reducing wanted interval by respecting the time it takes to - * compute internally since this is not multi-threaded like - * requestAnimationFrame - */ wantedInterval - processingTime); - const cancel = (id)=>{ - window.clearTimeout(id); - }; - this.setAnimationFrameObject({ - requestAnimationFrame: raf, - cancelAnimationFrame: cancel - }); - } - correctDimensions() { - if (!this.recorderElement) return; - if (this.options.video.width) { - const recorderWidth = this.getRecorderWidth(true); - if (recorderWidth) this.recorderElement.width = recorderWidth; - } - if (this.options.video.height) { - const recorderHeight = this.getRecorderHeight(true); - if (recorderHeight) this.recorderElement.height = recorderHeight; - } - } - switchFacingMode() { - if (!getBrowser(this.options).isMobile()) return; - if ("user" === this.facingMode) this.facingMode = "environment"; - else if ("environment" === this.facingMode) this.facingMode = "user"; - else this.options.logger.warn(`Recorder: unsupported facing mode ${pretty(this.facingMode)}`); - this.loadGenuineUserMedia({ - switchingFacingMode: this.facingMode - }); - } - initEvents() { - this.options.logger.debug("Recorder: initEvents()"); - this.on("SUBMITTING", ()=>{ - this.submitting = true; - }); - this.on("SUBMITTED", ()=>{ - this.submitting = false; - }); - this.on("BLOCKING", ()=>{ - this.blocking = true; - this.clearUserMediaTimeout(); - }); - this.on("PREVIEW", ()=>{ - this.hide(); - }); - this.on("HIDE", ()=>{ - this.hide(); - }); - this.on("LOADED_META_DATA", ()=>{ - this.correctDimensions(); - }); - this.on("DISABLING_AUDIO", ()=>{ - this.reInitializeAudio(); - }); - this.on("ENABLING_AUDIO", ()=>{ - this.reInitializeAudio(); - }); - this.on("INVISIBLE", ()=>{ - this.loopWithTimeouts(); - }); - this.on("VISIBLE", ()=>{ - this.restoreAnimationFrameObject(); - }); - this.on("SWITCH_FACING_MODE", ()=>{ - this.switchFacingMode(); - }); - } - buildElement() { - this.recorderElement = document.createElement("video"); - this.recorderElement.classList.add(this.options.selectors.userMediaClass); - this.visuals.appendChild(this.recorderElement); - } - build() { - var _this_visuals_getElement; - this.recorderElement = null === (_this_visuals_getElement = this.visuals.getElement()) || void 0 === _this_visuals_getElement ? void 0 : _this_visuals_getElement.querySelector(`video.${this.options.selectors.userMediaClass}`); - if (!this.recorderElement) this.buildElement(); - if (!this.recorderElement) throw new Error(`There is still no video element with class ${this.options.selectors.userMediaClass}`); - this.correctDimensions(); - /* - * prevent audio feedback, see - * https://github.com/binarykitchen/videomail-client/issues/35 - */ this.recorderElement.muted = true; - // for iPhones, see https://github.com/webrtc/samples/issues/929 - this.recorderElement.setAttribute("playsinline", "true"); - this.recorderElement.setAttribute("webkit-playsinline", "webkit-playsinline"); - /* - * add these here, not in CSS because users can configure custom - * class names - */ this.recorderElement.style.transform = "rotateY(180deg)"; - this.recorderElement.style["-webkit-transform"] = "rotateY(180deg)"; - this.recorderElement.style["-moz-transform"] = "rotateY(180deg)"; - if (this.options.video.stretch) this.recorderElement.style.width = "100%"; - if (!this.userMedia) this.userMedia = new visuals_userMedia(this, this.options); - this.show(); - if (this.built) { - if (this.options.loadUserMediaOnRecord) this.loadUserMedia(); - } else { - this.initEvents(); - if (this.connected) { - if (!this.options.loadUserMediaOnRecord) this.loadUserMedia(); - } else this.initSocket(); - } - this.built = true; - } - isPaused() { - var _this_userMedia; - return (null === (_this_userMedia = this.userMedia) || void 0 === _this_userMedia ? void 0 : _this_userMedia.isPaused()) && !this.loop.isRunning(); - } - isRecording() { - var _this_loop; - /* - * checking for stream.destroyed needed since - * https://github.com/binarykitchen/videomail.io/issues/296 - */ return (null === (_this_loop = this.loop) || void 0 === _this_loop ? void 0 : _this_loop.isRunning()) && !this.isPaused() && !this.isNotifying() && this.stream && !this.stream.destroyed; - } - hide() { - if (!this.isHidden()) { - if (this.recorderElement) hidden_default()(this.recorderElement, true); - this.clearUserMediaTimeout(); - this.clearRetryTimeout(); - } - } - isUnloaded() { - return this.unloaded; - } - /* - * these two return the true dimensions of the webcam area. - * needed because on mobiles they might be different. - */ getRecorderWidth(responsive) { - var _this_userMedia; - if (null === (_this_userMedia = this.userMedia) || void 0 === _this_userMedia ? void 0 : _this_userMedia.hasVideoWidth()) return this.userMedia.getRawWidth(responsive); - if (responsive && this.options.video.width) return this.limitWidth(this.options.video.width); - return this.options.video.width; - } - getRecorderHeight(responsive, useBoundingClientRect) { - if (this.recorderElement && useBoundingClientRect) return this.recorderElement.getBoundingClientRect().height; - if (this.userMedia) return this.userMedia.getRawHeight(responsive); - if (responsive && this.options.video.height) return this.calculateHeight(responsive); - return this.options.video.height; - } - getRatio() { - let ratio; - if (this.userMedia) { - const userMediaVideoWidth = this.userMedia.getVideoWidth(); - const userMediaVideoHeight = this.userMedia.getVideoHeight(); - // avoid division by zero - if (!userMediaVideoWidth || userMediaVideoWidth < 1) // use as a last resort fallback computation (needed for safari 11) - ratio = this.visuals.getRatio(); - else if (userMediaVideoHeight) ratio = userMediaVideoHeight / userMediaVideoWidth; - } else ratio = getRatio(this.options); - return ratio; - } - calculateWidth(responsive) { - let videoHeight; - if (this.userMedia) videoHeight = this.userMedia.getVideoHeight(); - else if (this.recorderElement) videoHeight = this.recorderElement.videoHeight || this.recorderElement.height; - return calculateWidth(responsive, videoHeight, this.options, this.getRatio()); - } - calculateHeight(responsive) { - let videoWidth; - let target; - if (this.userMedia) { - target = "userMedia"; - videoWidth = this.userMedia.getVideoWidth(); - } else if (this.recorderElement) { - target = "recorderElement"; - videoWidth = this.recorderElement.videoWidth || this.recorderElement.width; - } - return calculateHeight(responsive, videoWidth, this.options, target, this.getRatio(), this.recorderElement); - } - getRawVisualUserMedia() { - return this.recorderElement; - } - isConnected() { - return this.connected; - } - isConnecting() { - return this.connecting; - } - limitWidth(width) { - return this.visuals.limitWidth(width); - } - limitHeight(height) { - return this.visuals.limitHeight(height); - } - isUserMediaLoaded() { - return this.userMediaLoaded; - } - constructor(visuals, replay, options){ - super("Recorder", options), recorder_define_property(this, "visuals", void 0), recorder_define_property(this, "replay", void 0), recorder_define_property(this, "loop", void 0), recorder_define_property(this, "originalAnimationFrameObject", void 0), recorder_define_property(this, "samplesCount", 0), recorder_define_property(this, "framesCount", 0), recorder_define_property(this, "recordingStats", void 0), recorder_define_property(this, "confirmedFrameNumber", 0), recorder_define_property(this, "confirmedSampleNumber", 0), recorder_define_property(this, "recorderElement", void 0), recorder_define_property(this, "userMedia", void 0), recorder_define_property(this, "userMediaTimeout", void 0), recorder_define_property(this, "retryTimeout", void 0), recorder_define_property(this, "frameProgress", void 0), recorder_define_property(this, "sampleProgress", void 0), recorder_define_property(this, "canvas", void 0), recorder_define_property(this, "ctx", void 0), recorder_define_property(this, "userMediaLoaded", void 0), recorder_define_property(this, "userMediaLoading", false), recorder_define_property(this, "submitting", false), recorder_define_property(this, "unloaded", void 0), recorder_define_property(this, "stopTime", void 0), recorder_define_property(this, "stream", void 0), recorder_define_property(this, "connecting", false), recorder_define_property(this, "connected", false), recorder_define_property(this, "blocking", false), recorder_define_property(this, "built", false), recorder_define_property(this, "key", void 0), recorder_define_property(this, "waitingTime", void 0), recorder_define_property(this, "pingInterval", void 0), recorder_define_property(this, "frame", void 0), recorder_define_property(this, "recordingBuffer", void 0), recorder_define_property(this, "facingMode", void 0); - this.visuals = visuals; - this.replay = replay; - this.facingMode = options.video.facingMode; - } - } - /* ESM default export */ const visuals_recorder = Recorder; - function replay_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - class Replay extends util_Despot { - buildElement(replayParentElement) { - const videoSelector = `video.${this.options.selectors.replayClass}`; - this.replayElement = replayParentElement.querySelector(videoSelector); - // If none exists, create one then - if (!this.replayElement) { - this.replayElement = document.createElement("video"); - this.replayElement.classList.add(this.options.selectors.replayClass); - replayParentElement.appendChild(this.replayElement); - } - } - // Questionable, does not make sense - isStandalone() { - return "HTMLDivElement" === this.visuals.constructor.name; - } - copyAttributes(newVideomail) { - let attributeContainer; - Object.keys(newVideomail).forEach((attribute)=>{ - var _this_replayElement_parentNode, _this_replayElement; - attributeContainer = null === (_this_replayElement = this.replayElement) || void 0 === _this_replayElement ? void 0 : null === (_this_replayElement_parentNode = _this_replayElement.parentNode) || void 0 === _this_replayElement_parentNode ? void 0 : _this_replayElement_parentNode.querySelector(`.${attribute}`); - if (attributeContainer) { - const empty = !attributeContainer.innerHTML || attributeContainer.innerHTML.length < 1; - // Do not overwrite when already set before, e - // e.g. with a React component adding links to the body - if (empty) attributeContainer.innerHTML = newVideomail[attribute]; - } - }); - } - correctDimensions(responsive, videoWidth, videoHeight) { - if (!this.replayElement) throw new Error("There is no replay element to correct dimensions for."); - let height; - let width; - let ratio; - if (this.videomail) { - width = this.videomail.width; - height = this.videomail.height; - if (width) ratio = height / width; - } - if (!width) width = calculateWidth(responsive, videoHeight, this.options, ratio); - if (!height) { - let element = this.visuals.getElement(); - let target; - if (element) target = "visualsElement"; - else { - element = document.body; - target = "document body"; - } - height = calculateHeight(responsive, videoWidth, this.options, target, ratio, element); - } - if (width > 0) this.replayElement.style.width = `${width}px`; - else this.replayElement.style.width = "auto"; - if (height > 0) this.replayElement.style.height = `${height}px`; - else this.replayElement.style.height = "auto"; - } - setVideomail(newVideomail) { - let playerOnly = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; - var _this_videomail_recordingStats; - this.videomail = newVideomail; - if (this.videomail.mp4) this.setMp4Source(this.videomail.mp4); - if (this.videomail.webm) this.setWebMSource(this.videomail.webm); - if (this.videomail.vtt) this.setTrackSource(this.videomail.vtt); - if (this.videomail.poster) { - var _this_replayElement; - null === (_this_replayElement = this.replayElement) || void 0 === _this_replayElement || _this_replayElement.setAttribute("poster", this.videomail.poster); - } - this.copyAttributes(this.videomail); - const sampleRate = null === (_this_videomail_recordingStats = this.videomail.recordingStats) || void 0 === _this_videomail_recordingStats ? void 0 : _this_videomail_recordingStats.sampleRate; - const width = this.videomail.width; - const height = this.videomail.height; - const hasAudio = void 0 !== sampleRate && sampleRate > 0; - this.show(width, height, hasAudio, playerOnly); - } - show(videomailWidth, videomailHeight, hasAudio) { - let playerOnly = arguments.length > 3 && void 0 !== arguments[3] && arguments[3]; - var _this_videomail, _this_videomail1, _this_videomail2; - if (!this.replayElement) return; - if (this.isShown()) // Skip, already shown - return; - this.options.logger.debug(`Replay: show(playerOnly=${playerOnly})`); - const hasMedia = Boolean(null === (_this_videomail = this.videomail) || void 0 === _this_videomail ? void 0 : _this_videomail.webm) || Boolean(null === (_this_videomail1 = this.videomail) || void 0 === _this_videomail1 ? void 0 : _this_videomail1.mp4) || Boolean(null === (_this_videomail2 = this.videomail) || void 0 === _this_videomail2 ? void 0 : _this_videomail2.poster); - if (hasMedia) this.correctDimensions(true, videomailWidth ? videomailWidth : this.replayElement.videoWidth, videomailHeight ? videomailHeight : this.replayElement.videoHeight); - if (playerOnly) { - if (hasMedia) hidden_default()(this.replayElement, false); - } else hidden_default()(this.replayElement, false); - if (playerOnly) hidden_default()(this.replayElement.parentNode, false); - else this.visuals.show(); - if (hasAudio) /* - * https://github.com/binarykitchen/videomail-client/issues/115 - * do not set mute to false as this will mess up. just do not mention this attribute at all - */ this.replayElement.setAttribute("volume", "1"); - else if (!isAudioEnabled(this.options)) this.replayElement.setAttribute("muted", "true"); - // this forces to actually fetch the videos from the server - this.replayElement.load(); - if (this.videomail) this.replayElement.addEventListener("canplaythrough", ()=>{ - this.emit("REPLAY_SHOWN"); - }, { - once: true - }); - else this.replayElement.addEventListener("canplaythrough", ()=>{ - this.emit("PREVIEW_SHOWN"); - }, { - once: true - }); - } - build(replayParentElement) { - var _this_visuals_getElement; - this.options.logger.debug(`Replay: build (replayParentElement="${pretty(replayParentElement)}")`); - this.replayElement = null === (_this_visuals_getElement = this.visuals.getElement()) || void 0 === _this_visuals_getElement ? void 0 : _this_visuals_getElement.querySelector(`video.${this.options.selectors.replayClass}`); - if (!this.replayElement) this.buildElement(replayParentElement); - if (!this.replayElement) throw new Error("There is no replayElement to build on"); - this.hide(); - this.replayElement.setAttribute("autoplay", "true"); - this.replayElement.setAttribute("autostart", "true"); - this.replayElement.setAttribute("autobuffer", "true"); - this.replayElement.setAttribute("playsinline", "true"); - this.replayElement.setAttribute("webkit-playsinline", "webkit-playsinline"); - this.replayElement.setAttribute("controls", "controls"); - this.replayElement.setAttribute("preload", "auto"); - if (!this.built) { - if (!this.isStandalone()) this.on("PREVIEW", (params)=>{ - this.show(null == params ? void 0 : params.width, null == params ? void 0 : params.height, null == params ? void 0 : params.hasAudio); - }); - this.replayElement.addEventListener("touchstart", (e)=>{ - var _this_replayElement; - e.preventDefault(); - if (null === (_this_replayElement = this.replayElement) || void 0 === _this_replayElement ? void 0 : _this_replayElement.paused) this.replayElement.play().catch((err)=>{ - throw err; - }); - else { - var _this_replayElement1; - null === (_this_replayElement1 = this.replayElement) || void 0 === _this_replayElement1 || _this_replayElement1.pause(); - } - }); - this.replayElement.addEventListener("click", (e)=>{ - var _this_replayElement; - e.preventDefault(); - if (null === (_this_replayElement = this.replayElement) || void 0 === _this_replayElement ? void 0 : _this_replayElement.paused) this.replayElement.play().catch((err)=>{ - throw err; - }); - else { - var _this_replayElement1; - null === (_this_replayElement1 = this.replayElement) || void 0 === _this_replayElement1 || _this_replayElement1.pause(); - } - }); - } - this.built = true; - this.options.logger.debug("Replay: built."); - } - unload(params) { - this.options.logger.debug("Replay: unload()"); - util_Despot.removeAllListeners(); - if (null == params ? void 0 : params.startingOver) this.hide(); - else { - var _this_replayElement; - null === (_this_replayElement = this.replayElement) || void 0 === _this_replayElement || _this_replayElement.remove(); - this.replayElement = void 0; - } - this.videomail = void 0; - this.built = false; - } - getVideoSource(type) { - if (!this.replayElement) return; - const sources = this.replayElement.getElementsByTagName("source"); - const l = sources.length; - const videoType = `video/${type}`; - let source; - if (l) { - let i; - for(i = 0; i < l && !source; i++){ - var _sources_i; - if ((null === (_sources_i = sources[i]) || void 0 === _sources_i ? void 0 : _sources_i.getAttribute("type")) === videoType) source = sources[i]; - } - } - return source; - } - setTrackSource(src) { - if (!this.replayElement) return; - const tracks = this.replayElement.getElementsByTagName("track"); - const firstTrack = tracks[0]; - if (firstTrack) { - if (src) firstTrack.setAttribute("src", src); - else // Remove when no captions available - this.replayElement.removeChild(firstTrack); - } else { - // Insert one then - const track = document.createElement("track"); - track.setAttribute("src", src); - track.src = src; - // It's captions, not subtitles. Because for subtitles you must define the language, see - // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track - track.kind = "captions"; - track.default = true; - this.replayElement.appendChild(track); - // Because the local videomail server for development uses a different port, see - // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track - this.replayElement.setAttribute("crossorigin", "anonymous"); - } - } - setVideoSource(type, src, bustCache) { - if (!this.replayElement) throw new Error("There is no replay element for appending a video source"); - let source = this.getVideoSource(type); - let url = src; - if (url && bustCache) url += `?${Date.now()}`; - if (source) { - if (src) source.setAttribute("src", src); - else this.replayElement.removeChild(source); - } else if (src) { - const { fps } = this.options.video; - // Ensure it's greater than the frame duration itself - const t = 1 / fps * 2; - source = document.createElement("source"); - /* - * Ensures HTML video thumbnail turns up on iOS, see - * https://muffinman.io/blog/hack-for-ios-safari-to-display-html-video-thumbnail/ - */ source.src = `${url}#t=${t}`; - source.type = `video/${type}`; - this.replayElement.appendChild(source); - } - } - setMp4Source(src, bustCache) { - this.setVideoSource(VideoType_VideoType.MP4, src, bustCache); - } - setWebMSource(src, bustCache) { - this.setVideoSource(VideoType_VideoType.WebM, src, bustCache); - } - getVideoType() { - if (!this.replayElement) return; - return getBrowser(this.options).getVideoType(this.replayElement); - } - pause(cb) { - /* - * avoids race condition, inspired by - * http://stackoverflow.com/questions/36803176/how-to-prevent-the-play-request-was-interrupted-by-a-call-to-pause-error - */ window.setTimeout(()=>{ - try { - if (this.replayElement) this.replayElement.pause(); - } catch (exc) { - // just ignore, see https://github.com/binarykitchen/videomail.io/issues/386 - this.options.logger.warn(exc); - } - cb(); - }, 15); - } - reset(cb) { - // pause video to make sure it won't consume any memory - this.pause(()=>{ - if (this.replayElement) { - this.setMp4Source(void 0); - this.setWebMSource(void 0); - } - this.videomail = void 0; - null == cb || cb(); - }); - } - hide() { - if (this.isStandalone()) hidden_default()(this.visuals, true); - else if (this.replayElement) { - hidden_default()(this.replayElement, true); - hidden_default()(this.replayElement.parentNode, true); - } - } - isShown() { - if (!this.replayElement) return false; - return !hidden_default()(this.replayElement) && !this.visuals.isHidden(); - } - getVisuals() { - return this.visuals; - } - getElement() { - return this.replayElement; - } - constructor(visuals, options){ - super("Replay", options), replay_define_property(this, "visuals", void 0), replay_define_property(this, "built", false), replay_define_property(this, "replayElement", void 0), replay_define_property(this, "videomail", void 0); - this.visuals = visuals; - } - } - /* ESM default export */ const visuals_replay = Replay; - function visuals_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - class Visuals extends util_Despot { - buildNoScriptTag() { - let noScriptElement = this.container.querySelector("noscript"); - if (noScriptElement) { - var _this_visualsElement; - noScriptElement = document.createElement("noscript"); - noScriptElement.innerHTML = "Please enable Javascript"; - null === (_this_visualsElement = this.visualsElement) || void 0 === _this_visualsElement || _this_visualsElement.appendChild(noScriptElement); - } - } - buildChildren() { - let playerOnly = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], visualsElement = arguments.length > 1 ? arguments[1] : void 0; - if (!visualsElement) throw new Error("Unable to build children without a visuals element"); - this.options.logger.debug(`Visuals: buildChildren (playerOnly = ${playerOnly}, visualsElement="${pretty(visualsElement)}"})`); - this.buildNoScriptTag(); - if (!playerOnly) { - this.notifier.build(); - this.recorderInsides.build(); - } - this.replay.build(visualsElement); - } - initEvents() { - let playerOnly = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; - if (!playerOnly) { - this.options.logger.debug(`Visuals: initEvents (playerOnly = ${playerOnly})`); - this.on("USER_MEDIA_READY", ()=>{ - this.built = true; - this.endWaiting(); - this.container.enableForm(false); - }); - this.on("PREVIEW", ()=>{ - this.endWaiting(); - }); - this.on("BLOCKING", ()=>{ - if (this.options.adjustFormOnBrowserError) this.container.disableForm(true); - }); - this.on("PREVIEW_SHOWN", ()=>{ - this.container.validate(void 0, true); - }); - this.on("LOADED_META_DATA", ()=>{ - this.correctDimensions(); - }); - this.on("ERROR", ()=>{ - if (getBrowser(this.options).isMobile()) this.removeDimensions(); - }); - } - } - correctDimensions() { - if (this.options.video.stretch) this.removeDimensions(); - else if (this.visualsElement) { - this.visualsElement.style.width = `${this.getRecorderWidth(true)}px`; - this.visualsElement.style.height = `${this.getRecorderHeight(true)}px`; - } - } - removeDimensions() { - if (!this.visualsElement) return; - this.visualsElement.style.width = "auto"; - this.visualsElement.style.height = "auto"; - } - getRatio() { - var _this_visualsElement; - if (null === (_this_visualsElement = this.visualsElement) || void 0 === _this_visualsElement ? void 0 : _this_visualsElement.clientWidth) // special case for safari, see getRatio() in recorder - return this.visualsElement.clientHeight / this.visualsElement.clientWidth; - return 0; - } - isRecordable() { - return !this.isNotifying() && !this.replay.isShown() && !this.isCountingDown(); - } - isCountingDown() { - return this.recorderInsides.isCountingDown(); - } - build() { - let playerOnly = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], parentElement = arguments.length > 1 ? arguments[1] : void 0; - this.options.logger.debug(`Visuals: build (playerOnly = ${playerOnly}${parentElement ? `, parentElement="${pretty(parentElement)}"` : ""})`); - if (parentElement) this.visualsElement = parentElement.querySelector(`.${this.options.selectors.visualsClass}`); - else this.visualsElement = this.container.querySelector(`.${this.options.selectors.visualsClass}`); - if (!this.visualsElement) { - if (playerOnly && parentElement) this.visualsElement = parentElement; - else { - this.visualsElement = document.createElement("div"); - this.visualsElement.classList.add(this.options.selectors.visualsClass); - const buttonsElement = this.container.querySelector(`.${this.options.selectors.buttonsClass}`); - /* - * Make sure it's placed before the buttons, but only if it's a child - * element of the container = inside the container - */ if (buttonsElement && !this.container.isOutsideElementOf(buttonsElement)) this.container.insertBefore(this.visualsElement, buttonsElement); - else this.container.appendChild(this.visualsElement); - } - } - this.visualsElement.classList.add("visuals"); - this.correctDimensions(); - if (!this.built) this.initEvents(playerOnly); - this.buildChildren(playerOnly, this.visualsElement); - this.built = true; - } - appendChild(child) { - var _this_visualsElement; - null === (_this_visualsElement = this.visualsElement) || void 0 === _this_visualsElement || _this_visualsElement.appendChild(child); - } - removeChild(child) { - var _this_visualsElement; - null === (_this_visualsElement = this.visualsElement) || void 0 === _this_visualsElement || _this_visualsElement.removeChild(child); - } - reset() { - this.endWaiting(); - this.recorder.reset(); - } - beginWaiting() { - this.container.beginWaiting(); - } - endWaiting() { - this.container.endWaiting(); - } - stop(params) { - this.recorder.stop(params); - this.recorderInsides.hidePause(); - } - back() { - let keepHidden = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], cb = arguments.length > 1 ? arguments[1] : void 0; - this.options.logger.debug(`Visuals: back(keepHidden = ${keepHidden})`); - this.replay.hide(); - this.notifier.hide(); - if (keepHidden) { - this.recorder.hide(); - null == cb || cb(); - } else this.recorder.back(cb); - } - recordAgain() { - this.back(false, ()=>{ - if (this.options.loadUserMediaOnRecord) this.once("SERVER_READY", ()=>{ - this.recorder.record(); - }); - else this.once("USER_MEDIA_READY", ()=>{ - this.recorder.record(); - }); - }); - } - unload(params) { - try { - if (!this.built) return; - const e = null == params ? void 0 : params.e; - this.options.logger.debug(`Visuals: unload(${e ? pretty(e) : ""})`); - util_Despot.removeAllListeners(); - this.recorder.unload(params); - this.recorderInsides.unload(); - this.replay.unload(params); - e instanceof Error || this.hide(); - this.built = false; - } catch (exc) { - this.emit("ERROR", { - exc - }); - } - } - isNotifying() { - return this.notifier.isVisible(); - } - pause(params) { - this.recorder.pause(params); - this.recorderInsides.showPause(); - } - resume() { - if (this.recorderInsides.isCountingDown()) this.recorderInsides.resumeCountdown(); - else this.recorder.resume(); - this.recorderInsides.hidePause(); - } - pauseOrResume() { - if (this.isRecordable()) { - if (this.isRecording()) this.pause(); - else if (this.recorder.isPaused()) this.resume(); - else if (this.recorder.isReady()) this.recorder.record(); - } - } - recordOrStop() { - if (this.isRecordable()) { - if (this.isRecording()) this.stop(); - else if (this.recorder.isReady()) this.recorder.record(); - } - } - getRecorder() { - return this.recorder; - } - validate() { - return this.recorder.validate() && this.isReplayShown(); - } - getRecordingStats() { - return this.recorder.getRecordingStats(); - } - getAudioSampleRate() { - return this.recorder.getAudioSampleRate(); - } - isPaused() { - return this.recorder.isPaused(); - } - error(err) { - this.notifier.error(err); - } - hide() { - if (this.visualsElement) { - hidden_default()(this.visualsElement, true); - this.emit("HIDE"); - } - } - isHidden() { - if (!this.built) return true; - if (this.visualsElement) return hidden_default()(this.visualsElement); - } - showVisuals() { - hidden_default()(this.visualsElement, false); - } - show(params) { - if (!(null == params ? void 0 : params.playerOnly)) { - if (this.isReplayShown()) { - if (null == params ? void 0 : params.goBack) this.recorder.show(); - } else this.recorder.build(); - } - this.showVisuals(); - } - showReplayOnly() { - this.show({ - playerOnly: true - }); - this.recorder.hide(); - this.notifier.hide(); - } - isRecorderUnloaded() { - return this.recorder.isUnloaded(); - } - isConnecting() { - return this.recorder.isConnecting(); - } - getRecorderWidth(responsive) { - return this.recorder.getRecorderWidth(responsive); - } - getRecorderHeight(responsive) { - let useBoundingClientRect = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; - return this.recorder.getRecorderHeight(responsive, useBoundingClientRect); - } - limitWidth(width) { - return this.container.limitWidth(width); - } - limitHeight(height) { - return this.container.limitHeight(height); - } - getReplay() { - return this.replay; - } - getBoundingClientRect() { - var _this_visualsElement; - // fixes https://github.com/binarykitchen/videomail-client/issues/126 - return null === (_this_visualsElement = this.visualsElement) || void 0 === _this_visualsElement ? void 0 : _this_visualsElement.getBoundingClientRect(); - } - checkTimer(elapsedTime) { - this.recorderInsides.checkTimer(elapsedTime); - } - isNotifierBuilt() { - return this.notifier.isBuilt(); - } - isReplayShown() { - return this.replay.isShown(); - } - hideReplay() { - this.replay.hide(); - } - hideRecorder() { - this.recorder.hide(); - } - isRecording() { - return this.recorder.isRecording(); - } - isUserMediaLoaded() { - return this.recorder.isUserMediaLoaded(); - } - isConnected() { - return this.recorder.isConnected(); - } - record() { - if (this.options.video.countdown) { - this.emit("COUNTDOWN"); - this.recorderInsides.startCountdown(this.recorder.record.bind(this.recorder)); - } else this.recorder.record(); - } - getElement() { - return this.visualsElement; - } - constructor(container, options){ - super("Visuals", options), visuals_define_property(this, "container", void 0), visuals_define_property(this, "replay", void 0), visuals_define_property(this, "recorder", void 0), visuals_define_property(this, "recorderInsides", void 0), visuals_define_property(this, "notifier", void 0), visuals_define_property(this, "visualsElement", void 0), visuals_define_property(this, "built", false); - this.container = container; - // can be overwritten with setter fn - this.replay = new visuals_replay(this, options); - this.recorder = new visuals_recorder(this, this.replay, options); - this.recorderInsides = new recorderInsides(this, options); - this.notifier = new notifier(this, options); - } - } - /* ESM default export */ const wrappers_visuals = Visuals; - // EXTERNAL MODULE: ./node_modules/@rsbuild/core/compiled/style-loader/runtime/injectStylesIntoStyleTag.js - var injectStylesIntoStyleTag = __webpack_require__("./node_modules/@rsbuild/core/compiled/style-loader/runtime/injectStylesIntoStyleTag.js"); - var injectStylesIntoStyleTag_default = /*#__PURE__*/ __webpack_require__.n(injectStylesIntoStyleTag); - // EXTERNAL MODULE: ./node_modules/@rsbuild/core/compiled/style-loader/runtime/styleDomAPI.js - var styleDomAPI = __webpack_require__("./node_modules/@rsbuild/core/compiled/style-loader/runtime/styleDomAPI.js"); - var styleDomAPI_default = /*#__PURE__*/ __webpack_require__.n(styleDomAPI); - // EXTERNAL MODULE: ./node_modules/@rsbuild/core/compiled/style-loader/runtime/insertBySelector.js - var insertBySelector = __webpack_require__("./node_modules/@rsbuild/core/compiled/style-loader/runtime/insertBySelector.js"); - var insertBySelector_default = /*#__PURE__*/ __webpack_require__.n(insertBySelector); - // EXTERNAL MODULE: ./node_modules/@rsbuild/core/compiled/style-loader/runtime/setAttributesWithoutAttributes.js - var setAttributesWithoutAttributes = __webpack_require__("./node_modules/@rsbuild/core/compiled/style-loader/runtime/setAttributesWithoutAttributes.js"); - var setAttributesWithoutAttributes_default = /*#__PURE__*/ __webpack_require__.n(setAttributesWithoutAttributes); - // EXTERNAL MODULE: ./node_modules/@rsbuild/core/compiled/style-loader/runtime/insertStyleElement.js - var insertStyleElement = __webpack_require__("./node_modules/@rsbuild/core/compiled/style-loader/runtime/insertStyleElement.js"); - var insertStyleElement_default = /*#__PURE__*/ __webpack_require__.n(insertStyleElement); - // EXTERNAL MODULE: ./node_modules/@rsbuild/core/compiled/style-loader/runtime/styleTagTransform.js - var styleTagTransform = __webpack_require__("./node_modules/@rsbuild/core/compiled/style-loader/runtime/styleTagTransform.js"); - var styleTagTransform_default = /*#__PURE__*/ __webpack_require__.n(styleTagTransform); - // EXTERNAL MODULE: ../../node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[9].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[9].use[2]!../../node_modules/stylus-loader/dist/cjs.js??ruleSet[1].rules[9].use[3]!./src/styles/main.styl - var main = __webpack_require__("../../node_modules/@rsbuild/core/compiled/css-loader/index.js??ruleSet[1].rules[9].use[1]!builtin:lightningcss-loader??ruleSet[1].rules[9].use[2]!../../node_modules/stylus-loader/dist/cjs.js??ruleSet[1].rules[9].use[3]!./src/styles/main.styl"); - var main_options = {}; - main_options.styleTagTransform = styleTagTransform_default(); - main_options.setAttributes = setAttributesWithoutAttributes_default(); - main_options.insert = insertBySelector_default().bind(null, "head"); - main_options.domAPI = styleDomAPI_default(); - main_options.insertStyleElement = insertStyleElement_default(); - injectStylesIntoStyleTag_default()(main /* default */ .Z, main_options); - /* ESM default export */ main /* default */ .Z && main /* default,locals */ .Z.locals && main /* default,locals */ .Z.locals; - function container_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - class Container extends util_Despot { - buildChildren() { - let playerOnly = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], parentElement = arguments.length > 1 ? arguments[1] : void 0; - this.options.logger.debug(`Container: buildChildren (playerOnly = ${playerOnly}${parentElement ? `, parentElement="${pretty(parentElement)}"` : ""})`); - if (this.containerElement) this.containerElement.classList.add(this.options.selectors.containerClass); - if (!playerOnly) this.buttons.build(); - this.visuals.build(playerOnly, parentElement); - } - build(buildOptions) { - this.options.logger.debug(`Container: build (${buildOptions ? pretty(buildOptions) : ""})`); - try { - var _this_containerElement; - const containerId = this.options.selectors.containerId; - if (containerId) // Note, it can be undefined when e.g. just replaying a videomail or for storybooks - this.containerElement = document.getElementById(containerId); - else this.containerElement = document.createElement("div"); - null === (_this_containerElement = this.containerElement) || void 0 === _this_containerElement || _this_containerElement.classList.add(this.options.selectors.containerClass); - let replayParentElement = null; - if (null == buildOptions ? void 0 : buildOptions.replayParentElement) replayParentElement = buildOptions.replayParentElement; - else if (null == buildOptions ? void 0 : buildOptions.replayParentElementId) replayParentElement = document.getElementById(buildOptions.replayParentElementId); - // Check if the replayParentElement could act as the container element perhaps? - if (!this.containerElement && replayParentElement) { - if (replayParentElement.classList.contains(this.options.selectors.containerClass)) this.containerElement = replayParentElement; - } - if (!this.built) this.initEvents(null == buildOptions ? void 0 : buildOptions.playerOnly); - if (!(null == buildOptions ? void 0 : buildOptions.playerOnly)) this.correctDimensions(); - // Building form also applies for when `playerOnly` because of - // correcting mode on Videomail. This function will skip if there is no form. Easy. - this.buildForm(); - let parentElement; - parentElement = (null == buildOptions ? void 0 : buildOptions.playerOnly) ? null != replayParentElement ? replayParentElement : this.containerElement : this.containerElement; - this.buildChildren(null == buildOptions ? void 0 : buildOptions.playerOnly, parentElement); - if (this.hasError) this.options.logger.debug("Container: building failed due to an error."); - else { - this.options.logger.debug("Container: built."); - this.built = true; - this.emit("BUILT"); - } - } catch (exc) { - this.emit("ERROR", { - exc - }); - } - return this.containerElement; - } - // since https://github.com/binarykitchen/videomail-client/issues/87 - findParentFormElement() { - if (!this.containerElement) // Must be in player only mode - return; - return this.containerElement.closest("form"); - } - getFormElement() { - // It's ok to return no form, especially when in replay mode - let formElement; - if (this.containerElement && "FORM" === this.containerElement.tagName) formElement = this.containerElement; - else if (this.options.selectors.formId) { - formElement = document.querySelector(`#${this.options.selectors.formId}`); - if (formElement && "FORM" !== formElement.tagName) throw new Error(`HTML element with ID ${this.options.selectors.formId} is not a form.`); - } else formElement = this.findParentFormElement(); - return formElement; - } - buildForm() { - if (this.form) // already built - return; - const formElement = this.getFormElement(); - if (formElement) { - this.form = new wrappers_form(this, formElement, this.options); - const submitButton = this.form.findSubmitButton(); - if (submitButton) this.buttons.setSubmitButton(submitButton); - this.form.build(); - } - } - processError(params) { - var _params_err, _params_err1; - this.hasError = true; - if (null === (_params_err = params.err) || void 0 === _params_err ? void 0 : _params_err.stack) this.options.logger.error(params.err.stack); - else if (null === (_params_err1 = params.err) || void 0 === _params_err1 ? void 0 : _params_err1.message) this.options.logger.error(params.err.message); - else if (params.exc) { - if (params.exc instanceof Error) { - if (params.exc.stack) this.options.logger.error(params.exc.stack); - else if (params.exc.message) this.options.logger.error(params.exc.message); - } else this.options.logger.error(params.exc); - } - if (this.options.displayErrors && params.err) this.visuals.error(params.err); - else this.visuals.reset(); - } - initEvents() { - let playerOnly = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; - this.options.logger.debug(`Container: initEvents (playerOnly = ${playerOnly})`); - if (this.options.enableAutoUnload) window.addEventListener("beforeunload", (e)=>{ - this.unload({ - e - }); - }, { - once: true - }); - if (!playerOnly) this.visibility.onChange((visible)=>{ - // built? see https://github.com/binarykitchen/videomail.io/issues/326 - if (this.built) { - if (visible) { - if (isAutoPauseEnabled(this.options) && this.isCountingDown()) this.resume(); - this.emit("VISIBLE"); - } else { - if (isAutoPauseEnabled(this.options) && (this.isCountingDown() || this.isRecording())) this.pause(); - this.emit("INVISIBLE"); - } - } - }); - if (this.options.enableSpace) { - if (!playerOnly) window.addEventListener("keydown", (e)=>{ - const element = e.target; - const tagName = element.tagName; - const isEditable = element.isContentEditable || "true" === element.contentEditable; - // beware of rich text editors, hence the isEditable check (wordpress plugin issue) - if (!isEditable && "INPUT" !== tagName.toUpperCase() && "TEXTAREA" !== tagName.toUpperCase()) { - const code = e.code; - if ("Space" === code) { - e.preventDefault(); - if (this.options.enablePause) this.visuals.pauseOrResume(); - else this.visuals.recordOrStop(); - } - } - }); - } - /* - * better to keep the one and only error listeners - * at one spot, here, because unload() will do a removeAllListeners() - */ this.on("ERROR", (params)=>{ - this.processError(params); - this.endWaiting(); - const browser = getBrowser(this.options); - if (browser.isMobile()) this.removeDimensions(); - }); - if (!playerOnly) this.on("LOADED_META_DATA", ()=>{ - this.correctDimensions(); - }); - } - /* - * This will just set the width but not the height because - * it can be a form with more inputs elements - */ correctDimensions() { - if (this.options.video.stretch) this.removeDimensions(); - else if (this.containerElement) { - const width = this.visuals.getRecorderWidth(true); - if (width) this.containerElement.style.width = `${width}px`; - } - } - removeDimensions() { - if (!this.containerElement) return; - this.containerElement.style.width = "auto"; - } - unloadChildren(params) { - this.visuals.unload(params); - this.buttons.unload(); - if (this.form) { - this.form.unload(); - this.form = void 0; - } - this.endWaiting(); - } - hideMySelf() { - hidden_default()(this.containerElement, true); - } - async submitVideomail(formInputs, method) { - var _this_form; - const videomailFormData = null === (_this_form = this.form) || void 0 === _this_form ? void 0 : _this_form.transformFormData(formInputs); - if (!videomailFormData) throw new Error("No videomail form data defined"); - if (method === form_FormMethod.POST) { - videomailFormData.recordingStats = this.visuals.getRecordingStats(); - videomailFormData.width = this.visuals.getRecorderWidth(true); - videomailFormData.height = this.visuals.getRecorderHeight(true); - return await this.resource.post(videomailFormData); - } - if (method === form_FormMethod.PUT) return await this.resource.put(videomailFormData); - throw error_createError({ - message: `Unsupported form method ${method}, unable to submit videomail.`, - options: this.options - }); - } - limitWidth(width) { - if (!this.containerElement) return; - return limitWidth(this.containerElement, this.options, width); - } - limitHeight(height) { - return limitHeight(height, this.options); - } - areVisualsHidden() { - return this.visuals.isHidden(); - } - hasElement() { - return Boolean(this.containerElement); - } - getSubmitButton() { - return this.buttons.getSubmitButton(); - } - querySelector(selector) { - if (!this.containerElement) // Must be in player only mode - return; - return this.containerElement.querySelector(selector); - } - beginWaiting() { - var _this_htmlElement; - null === (_this_htmlElement = this.htmlElement) || void 0 === _this_htmlElement || _this_htmlElement.classList.add("wait"); - } - endWaiting() { - var _this_htmlElement; - null === (_this_htmlElement = this.htmlElement) || void 0 === _this_htmlElement || _this_htmlElement.classList.remove("wait"); - } - appendChild(child) { - if (!this.containerElement || this.containerElement === child) // Must be in player only mode - return; - this.containerElement.appendChild(child); - } - insertBefore(child, reference) { - if (!this.containerElement) // Must be in player only mode - return; - this.containerElement.insertBefore(child, reference); - } - unload(params) { - try { - if (!this.built) return; - const e = null == params ? void 0 : params.e; - this.options.logger.debug(`Container: unload(${e ? pretty(e) : ""})`); - this.emit("UNLOADING"); - this.unloadChildren(params); - this.hide(); - util_Despot.removeAllListeners(); - this.built = this.submitted = false; - } catch (exc) { - this.emit("ERROR", { - exc - }); - } - } - show(params) { - if (!this.containerElement) throw error_createError({ - message: "No container element exists.", - options: this.options - }); - hidden_default()(this.containerElement, false); - this.visuals.show(params); - if (!this.hasError) { - const paused = this.isPaused(); - if (paused) this.buttons.adjustButtonsForPause(); - /* - * since https://github.com/binarykitchen/videomail-client/issues/60 - * we hide areas to make it easier for the user - */ this.buttons.show(); - if (this.isReplayShown()) this.emit("PREVIEW"); - else this.emit("FORM_READY", { - paused - }); - } - return this.containerElement; - } - hide() { - this.options.logger.debug("Container: hide()"); - this.hasError = false; - if (this.isRecording()) this.pause(); - this.visuals.hide(); - if (this.submitted) { - this.buttons.hide(); - this.hideMySelf(); - } - } - startOver(params) { - try { - const keepHidden = null == params ? void 0 : params.keepHidden; - this.options.logger.debug(`Container: startOver(keepHidden = ${keepHidden})`); - this.submitted = false; - const replay = this.getReplay(); - replay.hide(); - replay.reset(); - // Rebuild all again and initialise events again - this.build(); - this.emit("STARTING_OVER"); - this.visuals.back(keepHidden, ()=>{ - this.enableForm(true); - keepHidden || this.show(); - }); - } catch (exc) { - this.emit("ERROR", { - exc - }); - } - } - showReplayOnly() { - this.hasError = false; - if (this.isRecording()) this.pause(); - this.visuals.showReplayOnly(); - if (this.submitted) this.buttons.hide(); - } - isNotifying() { - return this.visuals.isNotifying(); - } - isPaused() { - return this.visuals.isPaused(); - } - pause(params) { - this.visuals.pause(params); - } - // this code needs a good rewrite :( - validate(event) { - let force = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; - let runValidation = true; - let valid = true; - if (this.options.enableAutoValidation) { - if (force) runValidation = force; - else if (this.isNotifying()) runValidation = false; - else if (this.visuals.isConnected()) { - var _this_visuals_isUserMediaLoaded; - runValidation = null !== (_this_visuals_isUserMediaLoaded = this.visuals.isUserMediaLoaded()) && void 0 !== _this_visuals_isUserMediaLoaded ? _this_visuals_isUserMediaLoaded : this.visuals.isReplayShown(); - } else if (this.visuals.isConnecting()) runValidation = false; - } else { - runValidation = false; - this.lastValidation = true; // needed so that it can be submitted anyway, see submit() - } - if (runValidation) { - var _event_target; - const targetName = null == event ? void 0 : null === (_event_target = event.target) || void 0 === _event_target ? void 0 : _event_target.name; - if (targetName) this.emit("VALIDATING", { - targetName - }); - else if (event) this.emit("VALIDATING", { - event - }); - else this.emit("VALIDATING"); - const visualsValid = this.visuals.validate() && this.buttons.isRecordAgainButtonEnabled(); - let whyInvalid; - let invalidData; - if (this.form) { - const invalidInput = this.form.getInvalidElement(); - if (invalidInput) { - const name = invalidInput.getAttribute("name"); - valid = false; - if (name) { - whyInvalid = `Input "${name}" seems wrong 🤔`; - invalidData = { - [name]: invalidInput.getAttribute("value") - }; - } - } else if (!this.areVisualsHidden() && !visualsValid) // TODO Improve this check to have this based on `key` - { - if (this.buttonsAreReady() || this.isRecording() || this.isPaused() || this.isCountingDown()) { - valid = false; - whyInvalid = "Don't forget to record a video 😉"; - invalidData = { - key: void 0 - }; - } - } - if (valid) { - /* - * If CC and/or BCC exist, validate one more time to ensure at least - * one recipient is given - */ const recipients = this.form.getRecipients(); - const toIsConfigured = "to" in recipients; - const ccIsConfigured = "cc" in recipients; - const bccIsConfigured = "bcc" in recipients; - const hasTo = recipients.to && recipients.to.length > 0; - const hasCc = recipients.cc && recipients.cc.length > 0; - const hasBcc = recipients.bcc && recipients.bcc.length > 0; - if (toIsConfigured) { - if (!hasTo) { - if (ccIsConfigured && bccIsConfigured) { - if (!hasCc && !hasBcc) valid = false; - } else if (ccIsConfigured) { - if (!hasCc) valid = false; - } else if (bccIsConfigured) { - if (!hasBcc) valid = false; - } else valid = false; - } - } else if (ccIsConfigured) { - if (!hasCc) { - if (bccIsConfigured && !hasBcc) valid = false; - } - } else ; - if (!valid) whyInvalid = "At least one recipient is required"; - } - } else valid = visualsValid; - if (valid) this.emit("VALID"); - else if (invalidData) this.emit("INVALID", { - whyInvalid, - invalidData - }); - else this.emit("INVALID", { - whyInvalid - }); - this.lastValidation = valid; - } - return valid; - } - disableForm(buttonsToo) { - var _this_form; - null === (_this_form = this.form) || void 0 === _this_form || _this_form.disable(buttonsToo); - } - enableForm(buttonsToo) { - var _this_form; - null === (_this_form = this.form) || void 0 === _this_form || _this_form.enable(buttonsToo); - } - hasForm() { - return Boolean(this.form); - } - buttonsAreReady() { - return this.buttons.isReady(); - } - async submitAll(formData, method, url) { - let response; - try { - const hasVideomailKey = Boolean(formData[this.options.selectors.keyInputName]); - /* - * !hasVideomailKey makes it possible to submit form when videomail itself - * is not optional - */ if (!hasVideomailKey && !this.options.enableAutoSubmission) return; - const output = [ - method, - url - ].filter(Boolean).join(": "); - this.options.logger.debug(`Container: submitAll(${output})`); - this.beginWaiting(); - this.disableForm(true); - this.emit("SUBMITTING"); - if (hasVideomailKey) { - response = await this.submitVideomail(formData, method); - this.submitted = true; - this.emit("SUBMITTED", { - videomail: response.body.videomail, - response - }); - } else { - response = await this.resource.form(formData, url); - this.submitted = true; - this.emit("SUBMITTED", { - videomail: response.body, - response - }); - /* - * ... and when the enableAutoSubmission option is false, - * then that can mean, leave it to the framework to process with the form - * validation/handling/submission itself. for example the ninja form - * will want to highlight which one input are wrong. - */ } - } catch (exc) { - const err = error_createError({ - exc, - options: this.options - }); - this.emit("ERROR", { - err - }); - } finally{ - if ((null == response ? void 0 : response.text) && "text/html" === response.type) // server replied with HTML contents - display these - document.body.innerHTML = response.text; - this.endWaiting(); - } - } - isBuilt() { - return this.built; - } - isReplayShown() { - return this.visuals.isReplayShown(); - } - isDirty() { - let isDirty = false; - if (this.form) { - if (this.visuals.isRecorderUnloaded()) isDirty = false; - else if (this.submitted) isDirty = false; - else if (this.isReplayShown() || this.isPaused()) isDirty = true; - } - return isDirty; - } - getReplay() { - return this.visuals.getReplay(); - } - isOutsideElementOf(element) { - return element.parentNode !== this.containerElement && element !== this.containerElement; - } - // Only used for replays - loadForm(videomail) { - if (this.form) { - this.form.loadVideomail(videomail); - this.validate(); - } - } - enableAudio() { - this.options = setAudioEnabled(true, this.options); - this.emit("ENABLING_AUDIO"); - } - disableAudio() { - this.options = setAudioEnabled(false, this.options); - this.emit("DISABLING_AUDIO"); - } - async submit() { - this.options.logger.debug("Container: submit()"); - if (this.lastValidation) { - var _this_form; - return await (null === (_this_form = this.form) || void 0 === _this_form ? void 0 : _this_form.doTheSubmit()); - } - return false; - } - isCountingDown() { - return this.visuals.isCountingDown(); - } - isRecording() { - return this.visuals.isRecording(); - } - record() { - this.visuals.record(); - } - resume() { - this.visuals.resume(); - } - stop() { - this.visuals.stop(); - } - recordAgain() { - this.visuals.recordAgain(); - } - constructor(options){ - super("Container", options), container_define_property(this, "visibility", document_visibility_default()()), container_define_property(this, "htmlElement", document.querySelector("html")), container_define_property(this, "visuals", void 0), container_define_property(this, "buttons", void 0), container_define_property(this, "resource", void 0), container_define_property(this, "form", void 0), container_define_property(this, "hasError", false), container_define_property(this, "submitted", false), container_define_property(this, "lastValidation", false), container_define_property(this, "containerElement", void 0), container_define_property(this, "built", false); - this.visuals = new wrappers_visuals(this, options); - this.buttons = new buttons(this, options); - this.resource = new src_resource(options); - } - } - /* ESM default export */ const wrappers_container = Container; - // EXTERNAL MODULE: ./node_modules/deepmerge/dist/cjs.js - var cjs = __webpack_require__("./node_modules/deepmerge/dist/cjs.js"); - var cjs_default = /*#__PURE__*/ __webpack_require__.n(cjs); - function CollectLogger_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - class CollectLogger { - lifo(level, parameters) { - const line = parameters.join(); - if (this.stack.length > this.options.logStackSize) this.stack.pop(); - this.stack.push(`[${level}] ${line}`); - return line; - } - /* - * workaround: since we cannot overwrite console.log without having the correct file and line number - * we'll use groupCollapsed() and trace() instead to get these. - */ debug() { - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; - const output = this.lifo("debug", args); - if (this.options.verbose) { - if (this.browser.isFirefox()) this.logger.debug(output); - else if (this.logger.groupCollapsed) { - this.logger.groupCollapsed(output); - this.logger.trace("Trace"); - this.logger.groupEnd(); - } else if (this.logger.debug) this.logger.debug(output); - else // last resort if everything else fails for any weird reasons - console.log(output); - } - } - error() { - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; - this.logger.error(this.lifo("error", args)); - } - warn() { - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; - this.logger.warn(this.lifo("warn", args)); - } - info() { - for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; - this.logger.info(this.lifo("info", args)); - } - getLines() { - return this.stack; - } - constructor(options){ - CollectLogger_define_property(this, "browser", void 0); - CollectLogger_define_property(this, "logger", void 0); - CollectLogger_define_property(this, "stack", []); - CollectLogger_define_property(this, "options", void 0); - this.options = options; - this.browser = getBrowser(options); - this.logger = options.logger; - } - } - /* ESM default export */ const util_CollectLogger = CollectLogger; - /* provided dependency */ var isTest_process = __webpack_require__("./node_modules/process/browser.js"); - function isTest_isTest() { - return "test" === isTest_process.env.ENVIRON; - } - /* ESM default export */ const isTest = isTest_isTest; - function mergeWithDefaultOptions_mergeWithDefaultOptions() { - let options = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; - const newOptions = cjs_default()(src_options, options, { - arrayMerge (_destination, source) { - return source; - } - }); - // Repack logger instance - const collectLogger = new util_CollectLogger(newOptions); - newOptions.logger = collectLogger; - if (isTest()) newOptions.verbose = false; - return newOptions; - } - /* ESM default export */ const mergeWithDefaultOptions = mergeWithDefaultOptions_mergeWithDefaultOptions; - function client_define_property(obj, key, value) { - if (key in obj) Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - else obj[key] = value; - return obj; - } - class VideomailClient extends util_Despot { - validateOptions() { - const width = this.options.video.width; - if (void 0 !== width && width % 2 !== 0) throw error_createError({ - message: "Width must be divisible by two.", - options: this.options - }); - const height = this.options.video.height; - if (void 0 !== height && height % 2 !== 0) throw error_createError({ - message: "Height must be divisible by two.", - options: this.options - }); - } - build() { - /* - * it can happen that it gets called twice, i.E. when an error is thrown - * in the middle of the build() fn - */ if (!this.container.isBuilt()) { - this.options.logger.debug("Client: build()"); - return this.container.build(); - } - } - show(params) { - this.build(); - return this.container.show(params); - } - startOver(params) { - this.unload(true); - this.container.startOver(params); - } - unload() { - let startingOver = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; - this.container.unload({ - startingOver - }); - } - /* - * Automatically adds a