From 39a9d63c10e25ec0fea81fb47e77c2cabbb2b5db Mon Sep 17 00:00:00 2001 From: Pranav K Date: Mon, 3 Jun 2019 15:49:55 -0700 Subject: [PATCH 1/6] =?UTF-8?q?Revert=20"Add=20an=20option=20to=20SignalR?= =?UTF-8?q?=20to=20guarantee=20ordering=20of=20send=20events=E2=80=A6=20(#?= =?UTF-8?q?10807)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 4646c4a5e4412dbff6e40ade887792241f5a2c94. --- eng/targets/Npm.Common.targets | 15 - ...t.AspNetCore.Components.Browser.JS.npmproj | 16 +- src/Components/Browser.JS/dist/.gitattributes | 2 - .../Browser.JS/dist/Debug/blazor.server.js | 12944 +++++----------- .../Browser.JS/dist/Release/blazor.server.js | 6 +- .../dist/Release/blazor.webassembly.js | 2 +- src/Components/Browser.JS/package.json | 6 +- src/Components/Browser.JS/utils/package.json | 9 - src/Components/Browser.JS/utils/yarn.lock | 82 - src/Components/Browser.JS/yarn.lock | 12 +- .../ComponentsApp.App/Shared/NavMenu.razor | 5 + .../ts/signalr-protocol-msgpack/package.json | 4 +- .../signalr-protocol-msgpack.npmproj | 9 +- .../ts/signalr-protocol-msgpack/yarn.lock | 371 +- .../clients/ts/signalr/signalr.npmproj | 5 +- .../clients/ts/signalr/src/HttpConnection.ts | 105 +- .../clients/ts/signalr/src/HubConnection.ts | 2 +- .../ts/signalr/tests/HttpConnection.test.ts | 212 +- .../ts/signalr/tests/HubConnection.test.ts | 29 - .../clients/ts/signalr/tests/TestTransport.ts | 21 - 20 files changed, 4293 insertions(+), 9564 deletions(-) delete mode 100644 src/Components/Browser.JS/dist/.gitattributes delete mode 100644 src/Components/Browser.JS/utils/package.json delete mode 100644 src/Components/Browser.JS/utils/yarn.lock delete mode 100644 src/SignalR/clients/ts/signalr/tests/TestTransport.ts diff --git a/eng/targets/Npm.Common.targets b/eng/targets/Npm.Common.targets index a0eb3e3fa5..b8dadce6c5 100644 --- a/eng/targets/Npm.Common.targets +++ b/eng/targets/Npm.Common.targets @@ -53,21 +53,6 @@ - - - - - - <_PackageJsonContent>@(PackageJsonContent->'%(Identity)', '%0a') - <_PackageJsonContent>$(_PackageJsonContent.Replace('%(ReplacePackageContent.Identity)', '%(ReplacePackageContent.ReplaceWith)')) - - - - diff --git a/src/Components/Browser.JS/Microsoft.AspNetCore.Components.Browser.JS.npmproj b/src/Components/Browser.JS/Microsoft.AspNetCore.Components.Browser.JS.npmproj index e201a0d04b..a2b3a46cbe 100644 --- a/src/Components/Browser.JS/Microsoft.AspNetCore.Components.Browser.JS.npmproj +++ b/src/Components/Browser.JS/Microsoft.AspNetCore.Components.Browser.JS.npmproj @@ -7,11 +7,23 @@ - + + + + + - + + + + + + + diff --git a/src/Components/Browser.JS/dist/.gitattributes b/src/Components/Browser.JS/dist/.gitattributes deleted file mode 100644 index f88096f735..0000000000 --- a/src/Components/Browser.JS/dist/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -*.js -diff -merge -*.js linguist-generated=true diff --git a/src/Components/Browser.JS/dist/Debug/blazor.server.js b/src/Components/Browser.JS/dist/Debug/blazor.server.js index 199f92764c..24ca26079a 100644 --- a/src/Components/Browser.JS/dist/Debug/blazor.server.js +++ b/src/Components/Browser.JS/dist/Debug/blazor.server.js @@ -177,9 +177,9 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MessagePackHubProtocol", function() { return MessagePackHubProtocol; }); /* harmony import */ var buffer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! buffer */ "../node_modules/buffer/index.js"); /* harmony import */ var buffer__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(buffer__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var msgpack5__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! msgpack5 */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/msgpack5/index.js"); +/* harmony import */ var msgpack5__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! msgpack5 */ "../node_modules/msgpack5/index.js"); /* harmony import */ var msgpack5__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(msgpack5__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _aspnet_signalr__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @aspnet/signalr */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/index.js"); +/* harmony import */ var _aspnet_signalr__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @aspnet/signalr */ "../node_modules/@aspnet/signalr/dist/esm/index.js"); /* harmony import */ var _BinaryMessageFormat__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./BinaryMessageFormat */ "../node_modules/@aspnet/signalr-protocol-msgpack/dist/esm/BinaryMessageFormat.js"); /* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Utils */ "../node_modules/@aspnet/signalr-protocol-msgpack/dist/esm/Utils.js"); // Copyright (c) .NET Foundation. All rights reserved. @@ -203,13 +203,10 @@ var MessagePackHubProtocol = /** @class */ (function () { this.version = 1; /** The TransferFormat of the protocol. */ this.transferFormat = _aspnet_signalr__WEBPACK_IMPORTED_MODULE_2__["TransferFormat"].Binary; - this.errorResult = 1; - this.voidResult = 2; - this.nonVoidResult = 3; } /** Creates an array of HubMessage objects from the specified serialized representation. * - * @param {ArrayBuffer | Buffer} input An ArrayBuffer or Buffer containing the serialized representation. + * @param {ArrayBuffer | Buffer} input An ArrayBuffer containing the serialized representation. * @param {ILogger} logger A logger that will be used to log messages that occur during parsing. */ MessagePackHubProtocol.prototype.parseMessages = function (input, logger) { @@ -244,13 +241,10 @@ var MessagePackHubProtocol = /** @class */ (function () { case _aspnet_signalr__WEBPACK_IMPORTED_MODULE_2__["MessageType"].StreamInvocation: return this.writeStreamInvocation(message); case _aspnet_signalr__WEBPACK_IMPORTED_MODULE_2__["MessageType"].StreamItem: - return this.writeStreamItem(message); case _aspnet_signalr__WEBPACK_IMPORTED_MODULE_2__["MessageType"].Completion: - return this.writeCompletion(message); + throw new Error("Writing messages of type '" + message.type + "' is not supported."); case _aspnet_signalr__WEBPACK_IMPORTED_MODULE_2__["MessageType"].Ping: return _BinaryMessageFormat__WEBPACK_IMPORTED_MODULE_3__["BinaryMessageFormat"].write(SERIALIZED_PING_MESSAGE); - case _aspnet_signalr__WEBPACK_IMPORTED_MODULE_2__["MessageType"].CancelInvocation: - return this.writeCancelInvocation(message); default: throw new Error("Invalid message type."); } @@ -314,7 +308,6 @@ var MessagePackHubProtocol = /** @class */ (function () { arguments: properties[4], headers: headers, invocationId: invocationId, - streamIds: [], target: properties[3], type: _aspnet_signalr__WEBPACK_IMPORTED_MODULE_2__["MessageType"].Invocation, }; @@ -323,7 +316,6 @@ var MessagePackHubProtocol = /** @class */ (function () { return { arguments: properties[4], headers: headers, - streamIds: [], target: properties[3], type: _aspnet_signalr__WEBPACK_IMPORTED_MODULE_2__["MessageType"].Invocation, }; @@ -346,17 +338,20 @@ var MessagePackHubProtocol = /** @class */ (function () { if (properties.length < 4) { throw new Error("Invalid payload for Completion message."); } + var errorResult = 1; + var voidResult = 2; + var nonVoidResult = 3; var resultKind = properties[3]; - if (resultKind !== this.voidResult && properties.length < 5) { + if (resultKind !== voidResult && properties.length < 5) { throw new Error("Invalid payload for Completion message."); } var error; var result; switch (resultKind) { - case this.errorResult: + case errorResult: error = properties[4]; break; - case this.nonVoidResult: + case nonVoidResult: result = properties[4]; break; } @@ -372,41 +367,13 @@ var MessagePackHubProtocol = /** @class */ (function () { MessagePackHubProtocol.prototype.writeInvocation = function (invocationMessage) { var msgpack = msgpack5__WEBPACK_IMPORTED_MODULE_1__(); var payload = msgpack.encode([_aspnet_signalr__WEBPACK_IMPORTED_MODULE_2__["MessageType"].Invocation, invocationMessage.headers || {}, invocationMessage.invocationId || null, - invocationMessage.target, invocationMessage.arguments, invocationMessage.streamIds]); + invocationMessage.target, invocationMessage.arguments]); return _BinaryMessageFormat__WEBPACK_IMPORTED_MODULE_3__["BinaryMessageFormat"].write(payload.slice()); }; MessagePackHubProtocol.prototype.writeStreamInvocation = function (streamInvocationMessage) { var msgpack = msgpack5__WEBPACK_IMPORTED_MODULE_1__(); var payload = msgpack.encode([_aspnet_signalr__WEBPACK_IMPORTED_MODULE_2__["MessageType"].StreamInvocation, streamInvocationMessage.headers || {}, streamInvocationMessage.invocationId, - streamInvocationMessage.target, streamInvocationMessage.arguments, streamInvocationMessage.streamIds]); - return _BinaryMessageFormat__WEBPACK_IMPORTED_MODULE_3__["BinaryMessageFormat"].write(payload.slice()); - }; - MessagePackHubProtocol.prototype.writeStreamItem = function (streamItemMessage) { - var msgpack = msgpack5__WEBPACK_IMPORTED_MODULE_1__(); - var payload = msgpack.encode([_aspnet_signalr__WEBPACK_IMPORTED_MODULE_2__["MessageType"].StreamItem, streamItemMessage.headers || {}, streamItemMessage.invocationId, - streamItemMessage.item]); - return _BinaryMessageFormat__WEBPACK_IMPORTED_MODULE_3__["BinaryMessageFormat"].write(payload.slice()); - }; - MessagePackHubProtocol.prototype.writeCompletion = function (completionMessage) { - var msgpack = msgpack5__WEBPACK_IMPORTED_MODULE_1__(); - var resultKind = completionMessage.error ? this.errorResult : completionMessage.result ? this.nonVoidResult : this.voidResult; - var payload; - switch (resultKind) { - case this.errorResult: - payload = msgpack.encode([_aspnet_signalr__WEBPACK_IMPORTED_MODULE_2__["MessageType"].Completion, completionMessage.headers || {}, completionMessage.invocationId, resultKind, completionMessage.error]); - break; - case this.voidResult: - payload = msgpack.encode([_aspnet_signalr__WEBPACK_IMPORTED_MODULE_2__["MessageType"].Completion, completionMessage.headers || {}, completionMessage.invocationId, resultKind]); - break; - case this.nonVoidResult: - payload = msgpack.encode([_aspnet_signalr__WEBPACK_IMPORTED_MODULE_2__["MessageType"].Completion, completionMessage.headers || {}, completionMessage.invocationId, resultKind, completionMessage.result]); - break; - } - return _BinaryMessageFormat__WEBPACK_IMPORTED_MODULE_3__["BinaryMessageFormat"].write(payload.slice()); - }; - MessagePackHubProtocol.prototype.writeCancelInvocation = function (cancelInvocationMessage) { - var msgpack = msgpack5__WEBPACK_IMPORTED_MODULE_1__(); - var payload = msgpack.encode([_aspnet_signalr__WEBPACK_IMPORTED_MODULE_2__["MessageType"].CancelInvocation, cancelInvocationMessage.headers || {}, cancelInvocationMessage.invocationId]); + streamInvocationMessage.target, streamInvocationMessage.arguments]); return _BinaryMessageFormat__WEBPACK_IMPORTED_MODULE_3__["BinaryMessageFormat"].write(payload.slice()); }; MessagePackHubProtocol.prototype.readHeaders = function (properties) { @@ -464,7627 +431,12 @@ __webpack_require__.r(__webpack_exports__); // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Version token that will be replaced by the prepack command /** The version of the SignalR Message Pack protocol library. */ -var VERSION = "0.0.0-DEV_BUILD"; +var VERSION = "1.1.0"; //# sourceMappingURL=index.js.map /***/ }), -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/AbortController.js": -/*!*****************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/AbortController.js ***! - \*****************************************************************************************************************/ -/*! exports provided: AbortController */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbortController", function() { return AbortController; }); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -// Rough polyfill of https://developer.mozilla.org/en-US/docs/Web/API/AbortController -// We don't actually ever use the API being polyfilled, we always use the polyfill because -// it's a very new API right now. -// Not exported from index. -/** @private */ -var AbortController = /** @class */ (function () { - function AbortController() { - this.isAborted = false; - this.onabort = null; - } - AbortController.prototype.abort = function () { - if (!this.isAborted) { - this.isAborted = true; - if (this.onabort) { - this.onabort(); - } - } - }; - Object.defineProperty(AbortController.prototype, "signal", { - get: function () { - return this; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(AbortController.prototype, "aborted", { - get: function () { - return this.isAborted; - }, - enumerable: true, - configurable: true - }); - return AbortController; -}()); - -//# sourceMappingURL=AbortController.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/DefaultHttpClient.js": -/*!*******************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/DefaultHttpClient.js ***! - \*******************************************************************************************************************/ -/*! exports provided: DefaultHttpClient */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DefaultHttpClient", function() { return DefaultHttpClient; }); -/* harmony import */ var _Errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Errors */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Errors.js"); -/* harmony import */ var _HttpClient__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./HttpClient */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HttpClient.js"); -/* harmony import */ var _NodeHttpClient__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./NodeHttpClient */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/NodeHttpClient.js"); -/* harmony import */ var _XhrHttpClient__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./XhrHttpClient */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/XhrHttpClient.js"); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); - - - - -/** Default implementation of {@link @aspnet/signalr.HttpClient}. */ -var DefaultHttpClient = /** @class */ (function (_super) { - __extends(DefaultHttpClient, _super); - /** Creates a new instance of the {@link @aspnet/signalr.DefaultHttpClient}, using the provided {@link @aspnet/signalr.ILogger} to log messages. */ - function DefaultHttpClient(logger) { - var _this = _super.call(this) || this; - if (typeof XMLHttpRequest !== "undefined") { - _this.httpClient = new _XhrHttpClient__WEBPACK_IMPORTED_MODULE_3__["XhrHttpClient"](logger); - } - else { - _this.httpClient = new _NodeHttpClient__WEBPACK_IMPORTED_MODULE_2__["NodeHttpClient"](logger); - } - return _this; - } - /** @inheritDoc */ - DefaultHttpClient.prototype.send = function (request) { - // Check that abort was not signaled before calling send - if (request.abortSignal && request.abortSignal.aborted) { - return Promise.reject(new _Errors__WEBPACK_IMPORTED_MODULE_0__["AbortError"]()); - } - if (!request.method) { - return Promise.reject(new Error("No method defined.")); - } - if (!request.url) { - return Promise.reject(new Error("No url defined.")); - } - return this.httpClient.send(request); - }; - DefaultHttpClient.prototype.getCookieString = function (url) { - return this.httpClient.getCookieString(url); - }; - return DefaultHttpClient; -}(_HttpClient__WEBPACK_IMPORTED_MODULE_1__["HttpClient"])); - -//# sourceMappingURL=DefaultHttpClient.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/DefaultReconnectPolicy.js": -/*!************************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/DefaultReconnectPolicy.js ***! - \************************************************************************************************************************/ -/*! exports provided: DefaultReconnectPolicy */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DefaultReconnectPolicy", function() { return DefaultReconnectPolicy; }); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -// 0, 2, 10, 30 second delays before reconnect attempts. -var DEFAULT_RETRY_DELAYS_IN_MILLISECONDS = [0, 2000, 10000, 30000, null]; -/** @private */ -var DefaultReconnectPolicy = /** @class */ (function () { - function DefaultReconnectPolicy(retryDelays) { - this.retryDelays = retryDelays !== undefined ? retryDelays.concat([null]) : DEFAULT_RETRY_DELAYS_IN_MILLISECONDS; - } - DefaultReconnectPolicy.prototype.nextRetryDelayInMilliseconds = function (previousRetryCount) { - return this.retryDelays[previousRetryCount]; - }; - return DefaultReconnectPolicy; -}()); - -//# sourceMappingURL=DefaultReconnectPolicy.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Errors.js": -/*!********************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Errors.js ***! - \********************************************************************************************************/ -/*! exports provided: HttpError, TimeoutError, AbortError */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpError", function() { return HttpError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TimeoutError", function() { return TimeoutError; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbortError", function() { return AbortError; }); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -/** Error thrown when an HTTP request fails. */ -var HttpError = /** @class */ (function (_super) { - __extends(HttpError, _super); - /** Constructs a new instance of {@link @aspnet/signalr.HttpError}. - * - * @param {string} errorMessage A descriptive error message. - * @param {number} statusCode The HTTP status code represented by this error. - */ - function HttpError(errorMessage, statusCode) { - var _newTarget = this.constructor; - var _this = this; - var trueProto = _newTarget.prototype; - _this = _super.call(this, errorMessage) || this; - _this.statusCode = statusCode; - // Workaround issue in Typescript compiler - // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200 - _this.__proto__ = trueProto; - return _this; - } - return HttpError; -}(Error)); - -/** Error thrown when a timeout elapses. */ -var TimeoutError = /** @class */ (function (_super) { - __extends(TimeoutError, _super); - /** Constructs a new instance of {@link @aspnet/signalr.TimeoutError}. - * - * @param {string} errorMessage A descriptive error message. - */ - function TimeoutError(errorMessage) { - var _newTarget = this.constructor; - if (errorMessage === void 0) { errorMessage = "A timeout occurred."; } - var _this = this; - var trueProto = _newTarget.prototype; - _this = _super.call(this, errorMessage) || this; - // Workaround issue in Typescript compiler - // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200 - _this.__proto__ = trueProto; - return _this; - } - return TimeoutError; -}(Error)); - -/** Error thrown when an action is aborted. */ -var AbortError = /** @class */ (function (_super) { - __extends(AbortError, _super); - /** Constructs a new instance of {@link AbortError}. - * - * @param {string} errorMessage A descriptive error message. - */ - function AbortError(errorMessage) { - var _newTarget = this.constructor; - if (errorMessage === void 0) { errorMessage = "An abort occurred."; } - var _this = this; - var trueProto = _newTarget.prototype; - _this = _super.call(this, errorMessage) || this; - // Workaround issue in Typescript compiler - // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200 - _this.__proto__ = trueProto; - return _this; - } - return AbortError; -}(Error)); - -//# sourceMappingURL=Errors.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HandshakeProtocol.js": -/*!*******************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HandshakeProtocol.js ***! - \*******************************************************************************************************************/ -/*! exports provided: HandshakeProtocol */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* WEBPACK VAR INJECTION */(function(Buffer) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HandshakeProtocol", function() { return HandshakeProtocol; }); -/* harmony import */ var _TextMessageFormat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TextMessageFormat */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/TextMessageFormat.js"); -/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Utils */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Utils.js"); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - - -/** @private */ -var HandshakeProtocol = /** @class */ (function () { - function HandshakeProtocol() { - } - // Handshake request is always JSON - HandshakeProtocol.prototype.writeHandshakeRequest = function (handshakeRequest) { - return _TextMessageFormat__WEBPACK_IMPORTED_MODULE_0__["TextMessageFormat"].write(JSON.stringify(handshakeRequest)); - }; - HandshakeProtocol.prototype.parseHandshakeResponse = function (data) { - var responseMessage; - var messageData; - var remainingData; - if (Object(_Utils__WEBPACK_IMPORTED_MODULE_1__["isArrayBuffer"])(data) || (typeof Buffer !== "undefined" && data instanceof Buffer)) { - // Format is binary but still need to read JSON text from handshake response - var binaryData = new Uint8Array(data); - var separatorIndex = binaryData.indexOf(_TextMessageFormat__WEBPACK_IMPORTED_MODULE_0__["TextMessageFormat"].RecordSeparatorCode); - if (separatorIndex === -1) { - throw new Error("Message is incomplete."); - } - // content before separator is handshake response - // optional content after is additional messages - var responseLength = separatorIndex + 1; - messageData = String.fromCharCode.apply(null, binaryData.slice(0, responseLength)); - remainingData = (binaryData.byteLength > responseLength) ? binaryData.slice(responseLength).buffer : null; - } - else { - var textData = data; - var separatorIndex = textData.indexOf(_TextMessageFormat__WEBPACK_IMPORTED_MODULE_0__["TextMessageFormat"].RecordSeparator); - if (separatorIndex === -1) { - throw new Error("Message is incomplete."); - } - // content before separator is handshake response - // optional content after is additional messages - var responseLength = separatorIndex + 1; - messageData = textData.substring(0, responseLength); - remainingData = (textData.length > responseLength) ? textData.substring(responseLength) : null; - } - // At this point we should have just the single handshake message - var messages = _TextMessageFormat__WEBPACK_IMPORTED_MODULE_0__["TextMessageFormat"].parse(messageData); - var response = JSON.parse(messages[0]); - if (response.type) { - throw new Error("Expected a handshake response from the server."); - } - responseMessage = response; - // multiple messages could have arrived with handshake - // return additional data to be parsed as usual, or null if all parsed - return [remainingData, responseMessage]; - }; - return HandshakeProtocol; -}()); - -//# sourceMappingURL=HandshakeProtocol.js.map -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../../../buffer/index.js */ "../node_modules/buffer/index.js").Buffer)) - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HttpClient.js": -/*!************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HttpClient.js ***! - \************************************************************************************************************/ -/*! exports provided: HttpResponse, HttpClient */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpResponse", function() { return HttpResponse; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpClient", function() { return HttpClient; }); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -var __assign = (undefined && undefined.__assign) || Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; -}; -/** Represents an HTTP response. */ -var HttpResponse = /** @class */ (function () { - function HttpResponse(statusCode, statusText, content) { - this.statusCode = statusCode; - this.statusText = statusText; - this.content = content; - } - return HttpResponse; -}()); - -/** Abstraction over an HTTP client. - * - * This class provides an abstraction over an HTTP client so that a different implementation can be provided on different platforms. - */ -var HttpClient = /** @class */ (function () { - function HttpClient() { - } - HttpClient.prototype.get = function (url, options) { - return this.send(__assign({}, options, { method: "GET", url: url })); - }; - HttpClient.prototype.post = function (url, options) { - return this.send(__assign({}, options, { method: "POST", url: url })); - }; - HttpClient.prototype.delete = function (url, options) { - return this.send(__assign({}, options, { method: "DELETE", url: url })); - }; - /** Gets all cookies that apply to the specified URL. - * - * @param url The URL that the cookies are valid for. - * @returns {string} A string containing all the key-value cookie pairs for the specified URL. - */ - // @ts-ignore - HttpClient.prototype.getCookieString = function (url) { - return ""; - }; - return HttpClient; -}()); - -//# sourceMappingURL=HttpClient.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HttpConnection.js": -/*!****************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HttpConnection.js ***! - \****************************************************************************************************************/ -/*! exports provided: HttpConnection, TransportSendQueue */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpConnection", function() { return HttpConnection; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TransportSendQueue", function() { return TransportSendQueue; }); -/* harmony import */ var _DefaultHttpClient__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DefaultHttpClient */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/DefaultHttpClient.js"); -/* harmony import */ var _ILogger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ILogger */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ILogger.js"); -/* harmony import */ var _ITransport__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ITransport */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ITransport.js"); -/* harmony import */ var _LongPollingTransport__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./LongPollingTransport */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/LongPollingTransport.js"); -/* harmony import */ var _ServerSentEventsTransport__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ServerSentEventsTransport */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ServerSentEventsTransport.js"); -/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Utils */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Utils.js"); -/* harmony import */ var _WebSocketTransport__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./WebSocketTransport */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/WebSocketTransport.js"); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (undefined && undefined.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; - - - - - - - -var MAX_REDIRECTS = 100; -var WebSocketModule = null; -var EventSourceModule = null; -if (_Utils__WEBPACK_IMPORTED_MODULE_5__["Platform"].isNode && "function" !== "undefined") { - // In order to ignore the dynamic require in webpack builds we need to do this magic - // @ts-ignore: TS doesn't know about these names - var requireFunc = true ? require : undefined; - WebSocketModule = requireFunc("ws"); - EventSourceModule = requireFunc("eventsource"); -} -/** @private */ -var HttpConnection = /** @class */ (function () { - function HttpConnection(url, options) { - if (options === void 0) { options = {}; } - this.features = {}; - _Utils__WEBPACK_IMPORTED_MODULE_5__["Arg"].isRequired(url, "url"); - this.logger = Object(_Utils__WEBPACK_IMPORTED_MODULE_5__["createLogger"])(options.logger); - this.baseUrl = this.resolveUrl(url); - options = options || {}; - options.logMessageContent = options.logMessageContent || false; - if (!_Utils__WEBPACK_IMPORTED_MODULE_5__["Platform"].isNode && typeof WebSocket !== "undefined" && !options.WebSocket) { - options.WebSocket = WebSocket; - } - else if (_Utils__WEBPACK_IMPORTED_MODULE_5__["Platform"].isNode && !options.WebSocket) { - if (WebSocketModule) { - options.WebSocket = WebSocketModule; - } - } - if (!_Utils__WEBPACK_IMPORTED_MODULE_5__["Platform"].isNode && typeof EventSource !== "undefined" && !options.EventSource) { - options.EventSource = EventSource; - } - else if (_Utils__WEBPACK_IMPORTED_MODULE_5__["Platform"].isNode && !options.EventSource) { - if (typeof EventSourceModule !== "undefined") { - options.EventSource = EventSourceModule; - } - } - this.httpClient = options.httpClient || new _DefaultHttpClient__WEBPACK_IMPORTED_MODULE_0__["DefaultHttpClient"](this.logger); - this.connectionState = "Disconnected" /* Disconnected */; - this.connectionStarted = false; - this.options = options; - this.onreceive = null; - this.onclose = null; - } - HttpConnection.prototype.start = function (transferFormat) { - return __awaiter(this, void 0, void 0, function () { - var message, message; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - transferFormat = transferFormat || _ITransport__WEBPACK_IMPORTED_MODULE_2__["TransferFormat"].Binary; - _Utils__WEBPACK_IMPORTED_MODULE_5__["Arg"].isIn(transferFormat, _ITransport__WEBPACK_IMPORTED_MODULE_2__["TransferFormat"], "transferFormat"); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Starting connection with transfer format '" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["TransferFormat"][transferFormat] + "'."); - if (this.connectionState !== "Disconnected" /* Disconnected */) { - return [2 /*return*/, Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."))]; - } - this.connectionState = "Connecting " /* Connecting */; - this.startInternalPromise = this.startInternal(transferFormat); - return [4 /*yield*/, this.startInternalPromise]; - case 1: - _a.sent(); - if (!(this.connectionState === "Disconnecting" /* Disconnecting */)) return [3 /*break*/, 3]; - message = "Failed to start the HttpConnection before stop() was called."; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, message); - // We cannot await stopPromise inside startInternal since stopInternal awaits the startInternalPromise. - return [4 /*yield*/, this.stopPromise]; - case 2: - // We cannot await stopPromise inside startInternal since stopInternal awaits the startInternalPromise. - _a.sent(); - return [2 /*return*/, Promise.reject(new Error(message))]; - case 3: - if (this.connectionState !== "Connected" /* Connected */) { - message = "HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!"; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, message); - return [2 /*return*/, Promise.reject(new Error(message))]; - } - _a.label = 4; - case 4: - this.connectionStarted = true; - return [2 /*return*/]; - } - }); - }); - }; - HttpConnection.prototype.send = function (data) { - if (this.connectionState !== "Connected" /* Connected */) { - return Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")); - } - if (!this.sendQueue) { - this.sendQueue = new TransportSendQueue(this.transport); - } - // Transport will not be null if state is connected - return this.sendQueue.send(data); - }; - HttpConnection.prototype.stop = function (error) { - return __awaiter(this, void 0, void 0, function () { - var _this = this; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (this.connectionState === "Disconnected" /* Disconnected */) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Call to HttpConnection.stop(" + error + ") ignored because the connection is already in the disconnected state."); - return [2 /*return*/, Promise.resolve()]; - } - if (this.connectionState === "Disconnecting" /* Disconnecting */) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Call to HttpConnection.stop(" + error + ") ignored because the connection is already in the disconnecting state."); - return [2 /*return*/, this.stopPromise]; - } - this.connectionState = "Disconnecting" /* Disconnecting */; - this.stopPromise = new Promise(function (resolve) { - // Don't complete stop() until stopConnection() completes. - _this.stopPromiseResolver = resolve; - }); - // stopInternal should never throw so just observe it. - return [4 /*yield*/, this.stopInternal(error)]; - case 1: - // stopInternal should never throw so just observe it. - _a.sent(); - return [4 /*yield*/, this.stopPromise]; - case 2: - _a.sent(); - return [2 /*return*/]; - } - }); - }); - }; - HttpConnection.prototype.stopInternal = function (error) { - return __awaiter(this, void 0, void 0, function () { - var e_1, e_2; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - // Set error as soon as possible otherwise there is a race between - // the transport closing and providing an error and the error from a close message - // We would prefer the close message error. - this.stopError = error; - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.startInternalPromise]; - case 2: - _a.sent(); - return [3 /*break*/, 4]; - case 3: - e_1 = _a.sent(); - return [3 /*break*/, 4]; - case 4: - if (!this.transport) return [3 /*break*/, 9]; - if (this.sendQueue) { - this.sendQueue.stop(); - this.sendQueue = undefined; - } - _a.label = 5; - case 5: - _a.trys.push([5, 7, , 8]); - return [4 /*yield*/, this.transport.stop()]; - case 6: - _a.sent(); - return [3 /*break*/, 8]; - case 7: - e_2 = _a.sent(); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, "HttpConnection.transport.stop() threw error '" + e_2 + "'."); - this.stopConnection(); - return [3 /*break*/, 8]; - case 8: - this.transport = undefined; - return [3 /*break*/, 10]; - case 9: - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "HttpConnection.transport is undefined in HttpConnection.stop() because start() failed."); - this.stopConnection(); - _a.label = 10; - case 10: return [2 /*return*/]; - } - }); - }); - }; - HttpConnection.prototype.startInternal = function (transferFormat) { - return __awaiter(this, void 0, void 0, function () { - var url, negotiateResponse, redirects, _loop_1, this_1, e_3; - var _this = this; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - url = this.baseUrl; - this.accessTokenFactory = this.options.accessTokenFactory; - _a.label = 1; - case 1: - _a.trys.push([1, 12, , 13]); - if (!this.options.skipNegotiation) return [3 /*break*/, 5]; - if (!(this.options.transport === _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"].WebSockets)) return [3 /*break*/, 3]; - // No need to add a connection ID in this case - this.transport = this.constructTransport(_ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"].WebSockets); - // We should just call connect directly in this case. - // No fallback or negotiate in this case. - return [4 /*yield*/, this.transport.connect(url, transferFormat)]; - case 2: - // We should just call connect directly in this case. - // No fallback or negotiate in this case. - _a.sent(); - return [3 /*break*/, 4]; - case 3: throw new Error("Negotiation can only be skipped when using the WebSocket transport directly."); - case 4: return [3 /*break*/, 11]; - case 5: - negotiateResponse = null; - redirects = 0; - _loop_1 = function () { - var accessToken_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this_1.getNegotiationResponse(url)]; - case 1: - negotiateResponse = _a.sent(); - // the user tries to stop the connection when it is being started - if (this_1.connectionState === "Disconnecting" /* Disconnecting */ || this_1.connectionState === "Disconnected" /* Disconnected */) { - throw new Error("The connection was stopped during negotiation."); - } - if (negotiateResponse.error) { - throw new Error(negotiateResponse.error); - } - if (negotiateResponse.ProtocolVersion) { - throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details."); - } - if (negotiateResponse.url) { - url = negotiateResponse.url; - } - if (negotiateResponse.accessToken) { - accessToken_1 = negotiateResponse.accessToken; - this_1.accessTokenFactory = function () { return accessToken_1; }; - } - redirects++; - return [2 /*return*/]; - } - }); - }; - this_1 = this; - _a.label = 6; - case 6: return [5 /*yield**/, _loop_1()]; - case 7: - _a.sent(); - _a.label = 8; - case 8: - if (negotiateResponse.url && redirects < MAX_REDIRECTS) return [3 /*break*/, 6]; - _a.label = 9; - case 9: - if (redirects === MAX_REDIRECTS && negotiateResponse.url) { - throw new Error("Negotiate redirection limit exceeded."); - } - this.connectionId = negotiateResponse.connectionId; - return [4 /*yield*/, this.createTransport(url, this.options.transport, negotiateResponse, transferFormat)]; - case 10: - _a.sent(); - _a.label = 11; - case 11: - if (this.transport instanceof _LongPollingTransport__WEBPACK_IMPORTED_MODULE_3__["LongPollingTransport"]) { - this.features.inherentKeepAlive = true; - } - this.transport.onreceive = this.onreceive; - this.transport.onclose = function (e) { return _this.stopConnection(e); }; - if (this.connectionState === "Connecting " /* Connecting */) { - // Ensure the connection transitions to the connected state prior to completing this.startInternalPromise. - // start() will handle the case when stop was called and startInternal exits still in the disconnecting state. - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "The HttpConnection connected successfully."); - this.connectionState = "Connected" /* Connected */; - } - return [3 /*break*/, 13]; - case 12: - e_3 = _a.sent(); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, "Failed to start the connection: " + e_3); - this.connectionState = "Disconnected" /* Disconnected */; - this.transport = undefined; - return [2 /*return*/, Promise.reject(e_3)]; - case 13: return [2 /*return*/]; - } - }); - }); - }; - HttpConnection.prototype.getNegotiationResponse = function (url) { - return __awaiter(this, void 0, void 0, function () { - var _a, headers, token, negotiateUrl, response, e_4; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - if (!this.accessTokenFactory) return [3 /*break*/, 2]; - return [4 /*yield*/, this.accessTokenFactory()]; - case 1: - token = _b.sent(); - if (token) { - headers = (_a = {}, - _a["Authorization"] = "Bearer " + token, - _a); - } - _b.label = 2; - case 2: - negotiateUrl = this.resolveNegotiateUrl(url); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Sending negotiation request: " + negotiateUrl + "."); - _b.label = 3; - case 3: - _b.trys.push([3, 5, , 6]); - return [4 /*yield*/, this.httpClient.post(negotiateUrl, { - content: "", - headers: headers, - })]; - case 4: - response = _b.sent(); - if (response.statusCode !== 200) { - return [2 /*return*/, Promise.reject(new Error("Unexpected status code returned from negotiate " + response.statusCode))]; - } - return [2 /*return*/, JSON.parse(response.content)]; - case 5: - e_4 = _b.sent(); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, "Failed to complete negotiation with the server: " + e_4); - return [2 /*return*/, Promise.reject(e_4)]; - case 6: return [2 /*return*/]; - } - }); - }); - }; - HttpConnection.prototype.createConnectUrl = function (url, connectionId) { - if (!connectionId) { - return url; - } - return url + (url.indexOf("?") === -1 ? "?" : "&") + ("id=" + connectionId); - }; - HttpConnection.prototype.createTransport = function (url, requestedTransport, negotiateResponse, requestedTransferFormat) { - return __awaiter(this, void 0, void 0, function () { - var connectUrl, transportExceptions, transports, _i, transports_1, endpoint, transport, ex_1, message; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - connectUrl = this.createConnectUrl(url, negotiateResponse.connectionId); - if (!this.isITransport(requestedTransport)) return [3 /*break*/, 2]; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Connection was provided an instance of ITransport, using that directly."); - this.transport = requestedTransport; - return [4 /*yield*/, this.transport.connect(connectUrl, requestedTransferFormat)]; - case 1: - _a.sent(); - return [2 /*return*/]; - case 2: - transportExceptions = []; - transports = negotiateResponse.availableTransports || []; - _i = 0, transports_1 = transports; - _a.label = 3; - case 3: - if (!(_i < transports_1.length)) return [3 /*break*/, 11]; - endpoint = transports_1[_i]; - _a.label = 4; - case 4: - _a.trys.push([4, 9, , 10]); - transport = this.resolveTransport(endpoint, requestedTransport, requestedTransferFormat); - if (!(typeof transport === "number")) return [3 /*break*/, 8]; - this.transport = this.constructTransport(transport); - if (!!negotiateResponse.connectionId) return [3 /*break*/, 6]; - return [4 /*yield*/, this.getNegotiationResponse(url)]; - case 5: - negotiateResponse = _a.sent(); - connectUrl = this.createConnectUrl(url, negotiateResponse.connectionId); - _a.label = 6; - case 6: return [4 /*yield*/, this.transport.connect(connectUrl, requestedTransferFormat)]; - case 7: - _a.sent(); - return [2 /*return*/]; - case 8: return [3 /*break*/, 10]; - case 9: - ex_1 = _a.sent(); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, "Failed to start the transport '" + endpoint.transport + "': " + ex_1); - negotiateResponse.connectionId = undefined; - transportExceptions.push(endpoint.transport + " failed: " + ex_1); - if (this.connectionState !== "Connecting " /* Connecting */) { - message = "Failed to select transport before stop() was called."; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, message); - return [2 /*return*/, Promise.reject(new Error(message))]; - } - return [3 /*break*/, 10]; - case 10: - _i++; - return [3 /*break*/, 3]; - case 11: - if (transportExceptions.length > 0) { - return [2 /*return*/, Promise.reject(new Error("Unable to connect to the server with any of the available transports. " + transportExceptions.join(" ")))]; - } - return [2 /*return*/, Promise.reject(new Error("None of the transports supported by the client are supported by the server."))]; - } - }); - }); - }; - HttpConnection.prototype.constructTransport = function (transport) { - switch (transport) { - case _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"].WebSockets: - if (!this.options.WebSocket) { - throw new Error("'WebSocket' is not supported in your environment."); - } - return new _WebSocketTransport__WEBPACK_IMPORTED_MODULE_6__["WebSocketTransport"](this.httpClient, this.accessTokenFactory, this.logger, this.options.logMessageContent || false, this.options.WebSocket); - case _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"].ServerSentEvents: - if (!this.options.EventSource) { - throw new Error("'EventSource' is not supported in your environment."); - } - return new _ServerSentEventsTransport__WEBPACK_IMPORTED_MODULE_4__["ServerSentEventsTransport"](this.httpClient, this.accessTokenFactory, this.logger, this.options.logMessageContent || false, this.options.EventSource); - case _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"].LongPolling: - return new _LongPollingTransport__WEBPACK_IMPORTED_MODULE_3__["LongPollingTransport"](this.httpClient, this.accessTokenFactory, this.logger, this.options.logMessageContent || false); - default: - throw new Error("Unknown transport: " + transport + "."); - } - }; - HttpConnection.prototype.resolveTransport = function (endpoint, requestedTransport, requestedTransferFormat) { - var transport = _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"][endpoint.transport]; - if (transport === null || transport === undefined) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Skipping transport '" + endpoint.transport + "' because it is not supported by this client."); - } - else { - var transferFormats = endpoint.transferFormats.map(function (s) { return _ITransport__WEBPACK_IMPORTED_MODULE_2__["TransferFormat"][s]; }); - if (transportMatches(requestedTransport, transport)) { - if (transferFormats.indexOf(requestedTransferFormat) >= 0) { - if ((transport === _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"].WebSockets && !this.options.WebSocket) || - (transport === _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"].ServerSentEvents && !this.options.EventSource)) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Skipping transport '" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"][transport] + "' because it is not supported in your environment.'"); - throw new Error("'" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"][transport] + "' is not supported in your environment."); - } - else { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Selecting transport '" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"][transport] + "'."); - return transport; - } - } - else { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Skipping transport '" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"][transport] + "' because it does not support the requested transfer format '" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["TransferFormat"][requestedTransferFormat] + "'."); - throw new Error("'" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"][transport] + "' does not support " + _ITransport__WEBPACK_IMPORTED_MODULE_2__["TransferFormat"][requestedTransferFormat] + "."); - } - } - else { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Skipping transport '" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"][transport] + "' because it was disabled by the client."); - throw new Error("'" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"][transport] + "' is disabled by the client."); - } - } - return null; - }; - HttpConnection.prototype.isITransport = function (transport) { - return transport && typeof (transport) === "object" && "connect" in transport; - }; - HttpConnection.prototype.stopConnection = function (error) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "HttpConnection.stopConnection(" + error + ") called while in state " + this.connectionState + "."); - this.transport = undefined; - // If we have a stopError, it takes precedence over the error from the transport - error = this.stopError || error; - this.stopError = undefined; - if (this.connectionState === "Disconnected" /* Disconnected */) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Call to HttpConnection.stopConnection(" + error + ") was ignored because the connection is already in the disconnected state."); - return; - } - if (this.connectionState === "Connecting " /* Connecting */) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Warning, "Call to HttpConnection.stopConnection(" + error + ") was ignored because the connection hasn't yet left the in the connecting state."); - return; - } - if (this.connectionState === "Disconnecting" /* Disconnecting */) { - // A call to stop() induced this call to stopConnection and needs to be completed. - // Any stop() awaiters will be scheduled to continue after the onclose callback fires. - this.stopPromiseResolver(); - } - if (error) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, "Connection disconnected with error '" + error + "'."); - } - else { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Information, "Connection disconnected."); - } - this.connectionId = undefined; - this.connectionState = "Disconnected" /* Disconnected */; - if (this.onclose && this.connectionStarted) { - this.connectionStarted = false; - try { - this.onclose(error); - } - catch (e) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, "HttpConnection.onclose(" + error + ") threw error '" + e + "'."); - } - } - }; - HttpConnection.prototype.resolveUrl = function (url) { - // startsWith is not supported in IE - if (url.lastIndexOf("https://", 0) === 0 || url.lastIndexOf("http://", 0) === 0) { - return url; - } - if (!_Utils__WEBPACK_IMPORTED_MODULE_5__["Platform"].isBrowser || !window.document) { - throw new Error("Cannot resolve '" + url + "'."); - } - // Setting the url to the href propery of an anchor tag handles normalization - // for us. There are 3 main cases. - // 1. Relative path normalization e.g "b" -> "http://localhost:5000/a/b" - // 2. Absolute path normalization e.g "/a/b" -> "http://localhost:5000/a/b" - // 3. Networkpath reference normalization e.g "//localhost:5000/a/b" -> "http://localhost:5000/a/b" - var aTag = window.document.createElement("a"); - aTag.href = url; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Information, "Normalizing '" + url + "' to '" + aTag.href + "'."); - return aTag.href; - }; - HttpConnection.prototype.resolveNegotiateUrl = function (url) { - var index = url.indexOf("?"); - var negotiateUrl = url.substring(0, index === -1 ? url.length : index); - if (negotiateUrl[negotiateUrl.length - 1] !== "/") { - negotiateUrl += "/"; - } - negotiateUrl += "negotiate"; - negotiateUrl += index === -1 ? "" : url.substring(index); - return negotiateUrl; - }; - return HttpConnection; -}()); - -function transportMatches(requestedTransport, actualTransport) { - return !requestedTransport || ((actualTransport & requestedTransport) !== 0); -} -var TransportSendQueue = /** @class */ (function () { - function TransportSendQueue(transport) { - this.transport = transport; - this.buffer = []; - this.executing = true; - this.sendBufferedData = new PromiseSource(); - this.transportResult = new PromiseSource(); - // Suppress typescript error about handling Promises. The sendLoop doesn't need to be observed - this.sendLoop().then(function () { }, function (_) { }); - } - TransportSendQueue.prototype.send = function (data) { - this.bufferData(data); - return this.transportResult.promise; - }; - TransportSendQueue.prototype.stop = function () { - this.executing = false; - this.sendBufferedData.resolve(); - }; - TransportSendQueue.prototype.bufferData = function (data) { - if (this.buffer.length && typeof (this.buffer[0]) !== typeof (data)) { - throw new Error("Expected data to be of type " + typeof (this.buffer) + " but was of type " + typeof (data)); - } - this.buffer.push(data); - this.sendBufferedData.resolve(); - }; - TransportSendQueue.prototype.sendLoop = function () { - return __awaiter(this, void 0, void 0, function () { - var transportResult, data, error_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (false) {} - return [4 /*yield*/, this.sendBufferedData.promise]; - case 1: - _a.sent(); - if (!this.executing) { - // Did we stop? - return [3 /*break*/, 6]; - } - this.sendBufferedData = new PromiseSource(); - transportResult = this.transportResult; - this.transportResult = new PromiseSource(); - data = typeof (this.buffer[0]) === "string" ? - this.buffer.join("") : - TransportSendQueue.concatBuffers(this.buffer); - this.buffer.length = 0; - _a.label = 2; - case 2: - _a.trys.push([2, 4, , 5]); - return [4 /*yield*/, this.transport.send(data)]; - case 3: - _a.sent(); - transportResult.resolve(); - return [3 /*break*/, 5]; - case 4: - error_1 = _a.sent(); - transportResult.reject(error_1); - return [3 /*break*/, 5]; - case 5: return [3 /*break*/, 0]; - case 6: return [2 /*return*/]; - } - }); - }); - }; - TransportSendQueue.concatBuffers = function (arrayBuffers) { - var totalLength = arrayBuffers.map(function (b) { return b.byteLength; }).reduce(function (a, b) { return a + b; }); - var result = new Uint8Array(totalLength); - var offset = 0; - for (var _i = 0, arrayBuffers_1 = arrayBuffers; _i < arrayBuffers_1.length; _i++) { - var item = arrayBuffers_1[_i]; - result.set(new Uint8Array(item), offset); - offset += item.byteLength; - } - return result; - }; - return TransportSendQueue; -}()); - -var PromiseSource = /** @class */ (function () { - function PromiseSource() { - var _this = this; - this.promise = new Promise(function (resolve, reject) { - var _a; - return _a = [resolve, reject], _this.resolver = _a[0], _this.rejecter = _a[1], _a; - }); - } - PromiseSource.prototype.resolve = function () { - this.resolver(); - }; - PromiseSource.prototype.reject = function (reason) { - this.rejecter(reason); - }; - return PromiseSource; -}()); -//# sourceMappingURL=HttpConnection.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HubConnection.js": -/*!***************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HubConnection.js ***! - \***************************************************************************************************************/ -/*! exports provided: HubConnectionState, HubConnection */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HubConnectionState", function() { return HubConnectionState; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HubConnection", function() { return HubConnection; }); -/* harmony import */ var _HandshakeProtocol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./HandshakeProtocol */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HandshakeProtocol.js"); -/* harmony import */ var _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./IHubProtocol */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/IHubProtocol.js"); -/* harmony import */ var _ILogger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ILogger */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ILogger.js"); -/* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Subject */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Subject.js"); -/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Utils */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Utils.js"); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (undefined && undefined.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; - - - - - -var DEFAULT_TIMEOUT_IN_MS = 30 * 1000; -var DEFAULT_PING_INTERVAL_IN_MS = 15 * 1000; -/** Describes the current state of the {@link HubConnection} to the server. */ -var HubConnectionState; -(function (HubConnectionState) { - /** The hub connection is disconnected. */ - HubConnectionState["Disconnected"] = "Disconnected"; - /** The hub connection is connecting. */ - HubConnectionState["Connecting"] = "Connecting"; - /** The hub connection is connected. */ - HubConnectionState["Connected"] = "Connected"; - /** The hub connection is disconnecting. */ - HubConnectionState["Disconnecting"] = "Disconnecting"; - /** The hub connection is reconnecting. */ - HubConnectionState["Reconnecting"] = "Reconnecting"; -})(HubConnectionState || (HubConnectionState = {})); -/** Represents a connection to a SignalR Hub. */ -var HubConnection = /** @class */ (function () { - function HubConnection(connection, logger, protocol, reconnectPolicy) { - var _this = this; - _Utils__WEBPACK_IMPORTED_MODULE_4__["Arg"].isRequired(connection, "connection"); - _Utils__WEBPACK_IMPORTED_MODULE_4__["Arg"].isRequired(logger, "logger"); - _Utils__WEBPACK_IMPORTED_MODULE_4__["Arg"].isRequired(protocol, "protocol"); - this.serverTimeoutInMilliseconds = DEFAULT_TIMEOUT_IN_MS; - this.keepAliveIntervalInMilliseconds = DEFAULT_PING_INTERVAL_IN_MS; - this.logger = logger; - this.protocol = protocol; - this.connection = connection; - this.reconnectPolicy = reconnectPolicy; - this.handshakeProtocol = new _HandshakeProtocol__WEBPACK_IMPORTED_MODULE_0__["HandshakeProtocol"](); - this.connection.onreceive = function (data) { return _this.processIncomingData(data); }; - this.connection.onclose = function (error) { return _this.connectionClosed(error); }; - this.callbacks = {}; - this.methods = {}; - this.closedCallbacks = []; - this.reconnectingCallbacks = []; - this.reconnectedCallbacks = []; - this.invocationId = 0; - this.receivedHandshakeResponse = false; - this.connectionState = HubConnectionState.Disconnected; - this.connectionStarted = false; - this.cachedPingMessage = this.protocol.writeMessage({ type: _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Ping }); - } - /** @internal */ - // Using a public static factory method means we can have a private constructor and an _internal_ - // create method that can be used by HubConnectionBuilder. An "internal" constructor would just - // be stripped away and the '.d.ts' file would have no constructor, which is interpreted as a - // public parameter-less constructor. - HubConnection.create = function (connection, logger, protocol, reconnectPolicy) { - return new HubConnection(connection, logger, protocol, reconnectPolicy); - }; - Object.defineProperty(HubConnection.prototype, "state", { - /** Indicates the state of the {@link HubConnection} to the server. */ - get: function () { - return this.connectionState; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(HubConnection.prototype, "connectionId", { - /** Represents the connection id of the {@link HubConnection} on the server. The connection id will be null when the connection is either - * in the disconnected state or if the negotiation step was skipped. - */ - get: function () { - return this.connection ? (this.connection.connectionId || null) : null; - }, - enumerable: true, - configurable: true - }); - /** Starts the connection. - * - * @returns {Promise} A Promise that resolves when the connection has been successfully established, or rejects with an error. - */ - HubConnection.prototype.start = function () { - this.startPromise = this.startWithStateTransitions(); - return this.startPromise; - }; - HubConnection.prototype.startWithStateTransitions = function () { - return __awaiter(this, void 0, void 0, function () { - var e_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (this.connectionState !== HubConnectionState.Disconnected) { - return [2 /*return*/, Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."))]; - } - this.connectionState = HubConnectionState.Connecting; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Starting HubConnection."); - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.startInternal()]; - case 2: - _a.sent(); - this.connectionState = HubConnectionState.Connected; - this.connectionStarted = true; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "HubConnection connected successfully."); - return [3 /*break*/, 4]; - case 3: - e_1 = _a.sent(); - this.connectionState = HubConnectionState.Disconnected; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "HubConnection failed to start successfully because of error '" + e_1 + "'."); - return [2 /*return*/, Promise.reject(e_1)]; - case 4: return [2 /*return*/]; - } - }); - }); - }; - HubConnection.prototype.startInternal = function () { - return __awaiter(this, void 0, void 0, function () { - var handshakePromise, handshakeRequest, e_2; - var _this = this; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - this.stopDuringStartError = undefined; - this.receivedHandshakeResponse = false; - handshakePromise = new Promise(function (resolve, reject) { - _this.handshakeResolver = resolve; - _this.handshakeRejecter = reject; - }); - return [4 /*yield*/, this.connection.start(this.protocol.transferFormat)]; - case 1: - _a.sent(); - _a.label = 2; - case 2: - _a.trys.push([2, 5, , 7]); - handshakeRequest = { - protocol: this.protocol.name, - version: this.protocol.version, - }; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Sending handshake request."); - return [4 /*yield*/, this.sendMessage(this.handshakeProtocol.writeHandshakeRequest(handshakeRequest))]; - case 3: - _a.sent(); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Information, "Using HubProtocol '" + this.protocol.name + "'."); - // defensively cleanup timeout in case we receive a message from the server before we finish start - this.cleanupTimeout(); - this.resetTimeoutPeriod(); - this.resetKeepAliveInterval(); - return [4 /*yield*/, handshakePromise]; - case 4: - _a.sent(); - // It's important to check the stopDuringStartError instead of just relying on the handshakePromise - // being rejected on close, because this continuation can run after both the handshake completed successfully - // and the connection was closed. - if (this.stopDuringStartError) { - // It's important to throw instead of returning a rejected promise, because we don't want to allow any state - // transitions to occur between now and the calling code observing the exceptions. Returning a rejected promise - // will cause the calling continuation to get scheduled to run later. - throw this.stopDuringStartError; - } - return [3 /*break*/, 7]; - case 5: - e_2 = _a.sent(); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Hub handshake failed with error '" + e_2 + "' during start(). Stopping HubConnection."); - this.cleanupTimeout(); - this.cleanupPingTimer(); - // HttpConnection.stop() should not complete until after the onclose callback is invoked. - // This will transition the HubConnection to the disconnected state before HttpConnection.stop() completes. - return [4 /*yield*/, this.connection.stop(e_2)]; - case 6: - // HttpConnection.stop() should not complete until after the onclose callback is invoked. - // This will transition the HubConnection to the disconnected state before HttpConnection.stop() completes. - _a.sent(); - throw e_2; - case 7: return [2 /*return*/]; - } - }); - }); - }; - /** Stops the connection. - * - * @returns {Promise} A Promise that resolves when the connection has been successfully terminated, or rejects with an error. - */ - HubConnection.prototype.stop = function () { - return __awaiter(this, void 0, void 0, function () { - var startPromise, e_3; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - startPromise = this.startPromise; - this.stopPromise = this.stopInternal(); - return [4 /*yield*/, this.stopPromise]; - case 1: - _a.sent(); - _a.label = 2; - case 2: - _a.trys.push([2, 4, , 5]); - // Awaiting undefined continues immediately - return [4 /*yield*/, startPromise]; - case 3: - // Awaiting undefined continues immediately - _a.sent(); - return [3 /*break*/, 5]; - case 4: - e_3 = _a.sent(); - return [3 /*break*/, 5]; - case 5: return [2 /*return*/]; - } - }); - }); - }; - HubConnection.prototype.stopInternal = function (error) { - if (this.connectionState === HubConnectionState.Disconnected) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Call to HubConnection.stop(" + error + ") ignored because it is already in the disconnected state."); - return Promise.resolve(); - } - if (this.connectionState === HubConnectionState.Disconnecting) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Call to HttpConnection.stop(" + error + ") ignored because the connection is already in the disconnecting state."); - return this.stopPromise; - } - this.connectionState = HubConnectionState.Disconnecting; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Stopping HubConnection."); - if (this.reconnectDelayHandle) { - // We're in a reconnect delay which means the underlying connection is currently already stopped. - // Just clear the handle to stop the reconnect loop (which no one is waiting on thankfully) and - // fire the onclose callbacks. - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Connection stopped during reconnect delay. Done reconnecting."); - clearTimeout(this.reconnectDelayHandle); - this.reconnectDelayHandle = undefined; - this.completeClose(); - return Promise.resolve(); - } - this.cleanupTimeout(); - this.cleanupPingTimer(); - this.stopDuringStartError = error || new Error("The connection was stopped before the hub handshake could complete."); - // HttpConnection.stop() should not complete until after either HttpConnection.start() fails - // or the onclose callback is invoked. The onclose callback will transition the HubConnection - // to the disconnected state if need be before HttpConnection.stop() completes. - return this.connection.stop(error); - }; - /** Invokes a streaming hub method on the server using the specified name and arguments. - * - * @typeparam T The type of the items returned by the server. - * @param {string} methodName The name of the server method to invoke. - * @param {any[]} args The arguments used to invoke the server method. - * @returns {IStreamResult} An object that yields results from the server as they are received. - */ - HubConnection.prototype.stream = function (methodName) { - var _this = this; - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - var _a = this.replaceStreamingParams(args), streams = _a[0], streamIds = _a[1]; - var invocationDescriptor = this.createStreamInvocation(methodName, args, streamIds); - var promiseQueue; - var subject = new _Subject__WEBPACK_IMPORTED_MODULE_3__["Subject"](); - subject.cancelCallback = function () { - var cancelInvocation = _this.createCancelInvocation(invocationDescriptor.invocationId); - delete _this.callbacks[invocationDescriptor.invocationId]; - return promiseQueue.then(function () { - return _this.sendWithProtocol(cancelInvocation); - }); - }; - this.callbacks[invocationDescriptor.invocationId] = function (invocationEvent, error) { - if (error) { - subject.error(error); - return; - } - else if (invocationEvent) { - // invocationEvent will not be null when an error is not passed to the callback - if (invocationEvent.type === _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Completion) { - if (invocationEvent.error) { - subject.error(new Error(invocationEvent.error)); - } - else { - subject.complete(); - } - } - else { - subject.next((invocationEvent.item)); - } - } - }; - promiseQueue = this.sendWithProtocol(invocationDescriptor) - .catch(function (e) { - subject.error(e); - delete _this.callbacks[invocationDescriptor.invocationId]; - }); - this.launchStreams(streams, promiseQueue); - return subject; - }; - HubConnection.prototype.sendMessage = function (message) { - this.resetKeepAliveInterval(); - return this.connection.send(message); - }; - /** - * Sends a js object to the server. - * @param message The js object to serialize and send. - */ - HubConnection.prototype.sendWithProtocol = function (message) { - return this.sendMessage(this.protocol.writeMessage(message)); - }; - /** Invokes a hub method on the server using the specified name and arguments. Does not wait for a response from the receiver. - * - * The Promise returned by this method resolves when the client has sent the invocation to the server. The server may still - * be processing the invocation. - * - * @param {string} methodName The name of the server method to invoke. - * @param {any[]} args The arguments used to invoke the server method. - * @returns {Promise} A Promise that resolves when the invocation has been successfully sent, or rejects with an error. - */ - HubConnection.prototype.send = function (methodName) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - var _a = this.replaceStreamingParams(args), streams = _a[0], streamIds = _a[1]; - var sendPromise = this.sendWithProtocol(this.createInvocation(methodName, args, true, streamIds)); - this.launchStreams(streams, sendPromise); - return sendPromise; - }; - /** Invokes a hub method on the server using the specified name and arguments. - * - * The Promise returned by this method resolves when the server indicates it has finished invoking the method. When the promise - * resolves, the server has finished invoking the method. If the server method returns a result, it is produced as the result of - * resolving the Promise. - * - * @typeparam T The expected return type. - * @param {string} methodName The name of the server method to invoke. - * @param {any[]} args The arguments used to invoke the server method. - * @returns {Promise} A Promise that resolves with the result of the server method (if any), or rejects with an error. - */ - HubConnection.prototype.invoke = function (methodName) { - var _this = this; - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - var _a = this.replaceStreamingParams(args), streams = _a[0], streamIds = _a[1]; - var invocationDescriptor = this.createInvocation(methodName, args, false, streamIds); - var p = new Promise(function (resolve, reject) { - // invocationId will always have a value for a non-blocking invocation - _this.callbacks[invocationDescriptor.invocationId] = function (invocationEvent, error) { - if (error) { - reject(error); - return; - } - else if (invocationEvent) { - // invocationEvent will not be null when an error is not passed to the callback - if (invocationEvent.type === _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Completion) { - if (invocationEvent.error) { - reject(new Error(invocationEvent.error)); - } - else { - resolve(invocationEvent.result); - } - } - else { - reject(new Error("Unexpected message type: " + invocationEvent.type)); - } - } - }; - var promiseQueue = _this.sendWithProtocol(invocationDescriptor) - .catch(function (e) { - reject(e); - // invocationId will always have a value for a non-blocking invocation - delete _this.callbacks[invocationDescriptor.invocationId]; - }); - _this.launchStreams(streams, promiseQueue); - }); - return p; - }; - /** Registers a handler that will be invoked when the hub method with the specified method name is invoked. - * - * @param {string} methodName The name of the hub method to define. - * @param {Function} newMethod The handler that will be raised when the hub method is invoked. - */ - HubConnection.prototype.on = function (methodName, newMethod) { - if (!methodName || !newMethod) { - return; - } - methodName = methodName.toLowerCase(); - if (!this.methods[methodName]) { - this.methods[methodName] = []; - } - // Preventing adding the same handler multiple times. - if (this.methods[methodName].indexOf(newMethod) !== -1) { - return; - } - this.methods[methodName].push(newMethod); - }; - HubConnection.prototype.off = function (methodName, method) { - if (!methodName) { - return; - } - methodName = methodName.toLowerCase(); - var handlers = this.methods[methodName]; - if (!handlers) { - return; - } - if (method) { - var removeIdx = handlers.indexOf(method); - if (removeIdx !== -1) { - handlers.splice(removeIdx, 1); - if (handlers.length === 0) { - delete this.methods[methodName]; - } - } - } - else { - delete this.methods[methodName]; - } - }; - /** Registers a handler that will be invoked when the connection is closed. - * - * @param {Function} callback The handler that will be invoked when the connection is closed. Optionally receives a single argument containing the error that caused the connection to close (if any). - */ - HubConnection.prototype.onclose = function (callback) { - if (callback) { - this.closedCallbacks.push(callback); - } - }; - /** Registers a handler that will be invoked when the connection starts reconnecting. - * - * @param {Function} callback The handler that will be invoked when the connection starts reconnecting. Optionally receives a single argument containing the error that caused the connection to start reconnecting (if any). - */ - HubConnection.prototype.onreconnecting = function (callback) { - if (callback) { - this.reconnectingCallbacks.push(callback); - } - }; - /** Registers a handler that will be invoked when the connection successfully reconnects. - * - * @param {Function} callback The handler that will be invoked when the connection successfully reconnects. - */ - HubConnection.prototype.onreconnected = function (callback) { - if (callback) { - this.reconnectedCallbacks.push(callback); - } - }; - HubConnection.prototype.processIncomingData = function (data) { - this.cleanupTimeout(); - if (!this.receivedHandshakeResponse) { - data = this.processHandshakeResponse(data); - this.receivedHandshakeResponse = true; - } - // Data may have all been read when processing handshake response - if (data) { - // Parse the messages - var messages = this.protocol.parseMessages(data, this.logger); - for (var _i = 0, messages_1 = messages; _i < messages_1.length; _i++) { - var message = messages_1[_i]; - switch (message.type) { - case _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Invocation: - this.invokeClientMethod(message); - break; - case _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].StreamItem: - case _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Completion: - var callback = this.callbacks[message.invocationId]; - if (callback) { - if (message.type === _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Completion) { - delete this.callbacks[message.invocationId]; - } - callback(message); - } - break; - case _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Ping: - // Don't care about pings - break; - case _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Close: - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Information, "Close message received from server."); - // We don't want to wait on the stop itself. - this.stopPromise = this.stopInternal(message.error ? new Error("Server returned an error on close: " + message.error) : undefined); - break; - default: - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Warning, "Invalid message type: " + message.type + "."); - break; - } - } - } - this.resetTimeoutPeriod(); - }; - HubConnection.prototype.processHandshakeResponse = function (data) { - var _a; - var responseMessage; - var remainingData; - try { - _a = this.handshakeProtocol.parseHandshakeResponse(data), remainingData = _a[0], responseMessage = _a[1]; - } - catch (e) { - var message = "Error parsing handshake response: " + e; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Error, message); - var error = new Error(message); - this.handshakeRejecter(error); - throw error; - } - if (responseMessage.error) { - var message = "Server returned handshake error: " + responseMessage.error; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Error, message); - var error = new Error(message); - this.handshakeRejecter(error); - throw error; - } - else { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Server handshake complete."); - } - this.handshakeResolver(); - return remainingData; - }; - HubConnection.prototype.resetKeepAliveInterval = function () { - var _this = this; - this.cleanupPingTimer(); - this.pingServerHandle = setTimeout(function () { return __awaiter(_this, void 0, void 0, function () { - var _a; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - if (!(this.connectionState === HubConnectionState.Connected)) return [3 /*break*/, 4]; - _b.label = 1; - case 1: - _b.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.sendMessage(this.cachedPingMessage)]; - case 2: - _b.sent(); - return [3 /*break*/, 4]; - case 3: - _a = _b.sent(); - // We don't care about the error. It should be seen elsewhere in the client. - // The connection is probably in a bad or closed state now, cleanup the timer so it stops triggering - this.cleanupPingTimer(); - return [3 /*break*/, 4]; - case 4: return [2 /*return*/]; - } - }); - }); }, this.keepAliveIntervalInMilliseconds); - }; - HubConnection.prototype.resetTimeoutPeriod = function () { - var _this = this; - if (!this.connection.features || !this.connection.features.inherentKeepAlive) { - // Set the timeout timer - this.timeoutHandle = setTimeout(function () { return _this.serverTimeout(); }, this.serverTimeoutInMilliseconds); - } - }; - HubConnection.prototype.serverTimeout = function () { - // The server hasn't talked to us in a while. It doesn't like us anymore ... :( - // Terminate the connection, but we don't need to wait on the promise. This could trigger reconnecting. - // tslint:disable-next-line:no-floating-promises - this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server.")); - }; - HubConnection.prototype.invokeClientMethod = function (invocationMessage) { - var _this = this; - var methods = this.methods[invocationMessage.target.toLowerCase()]; - if (methods) { - try { - methods.forEach(function (m) { return m.apply(_this, invocationMessage.arguments); }); - } - catch (e) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Error, "A callback for the method " + invocationMessage.target.toLowerCase() + " threw error '" + e + "'."); - } - if (invocationMessage.invocationId) { - // This is not supported in v1. So we return an error to avoid blocking the server waiting for the response. - var message = "Server requested a response, which is not supported in this version of the client."; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Error, message); - // We don't want to wait on the stop itself. - this.stopPromise = this.stopInternal(new Error(message)); - } - } - else { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Warning, "No client method with the name '" + invocationMessage.target + "' found."); - } - }; - HubConnection.prototype.connectionClosed = function (error) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "HubConnection.connectionClosed(" + error + ") called while in state " + this.connectionState + "."); - // Triggering this.handshakeRejecter is insufficient because it could already be resolved without the continuation having run yet. - this.stopDuringStartError = this.stopDuringStartError || error || new Error("The underlying connection was closed before the hub handshake could complete."); - // If the handshake is in progress, start will be waiting for the handshake promise, so we complete it. - // If it has already completed, this should just noop. - if (this.handshakeResolver) { - this.handshakeResolver(); - } - this.cancelCallbacksWithError(error || new Error("Invocation canceled due to the underlying connection being closed.")); - this.cleanupTimeout(); - this.cleanupPingTimer(); - if (this.connectionState === HubConnectionState.Disconnecting) { - this.completeClose(error); - } - else if (this.connectionState === HubConnectionState.Connected && this.reconnectPolicy) { - // tslint:disable-next-line:no-floating-promises - this.reconnect(error); - } - else if (this.connectionState === HubConnectionState.Connected) { - this.completeClose(error); - } - // If none of the above if conditions were true were called the HubConnection must be in either: - // 1. The Connecting state in which case the handshakeResolver will complete it and stopDuringStartError will fail it. - // 2. The Reconnecting state in which case the handshakeResolver will complete it and stopDuringStartError will fail the current reconnect attempt - // and potentially continue the reconnect() loop. - // 3. The Disconnected state in which case we're already done. - }; - HubConnection.prototype.completeClose = function (error) { - var _this = this; - if (this.connectionStarted) { - this.connectionState = HubConnectionState.Disconnected; - this.connectionStarted = false; - try { - this.closedCallbacks.forEach(function (c) { return c.apply(_this, [error]); }); - } - catch (e) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Error, "An onclose callback called with error '" + error + "' threw error '" + e + "'."); - } - } - }; - HubConnection.prototype.reconnect = function (error) { - return __awaiter(this, void 0, void 0, function () { - var reconnectStartTime, previousReconnectAttempts, nextRetryDelay, e_4; - var _this = this; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - reconnectStartTime = Date.now(); - previousReconnectAttempts = 0; - nextRetryDelay = this.getNextRetryDelay(previousReconnectAttempts++, 0); - if (nextRetryDelay === null) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Connection not reconnecting because the IReconnectPolicy returned null on the first reconnect attempt."); - this.completeClose(error); - return [2 /*return*/]; - } - this.connectionState = HubConnectionState.Reconnecting; - if (error) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Information, "Connection reconnecting because of error '" + error + "'."); - } - else { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Information, "Connection reconnecting."); - } - if (this.onreconnecting) { - try { - this.reconnectingCallbacks.forEach(function (c) { return c.apply(_this, [error]); }); - } - catch (e) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Error, "An onreconnecting callback called with error '" + error + "' threw error '" + e + "'."); - } - // Exit early if an onreconnecting callback called connection.stop(). - if (this.connectionState !== HubConnectionState.Reconnecting) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Connection left the reconnecting state in onreconnecting callback. Done reconnecting."); - return [2 /*return*/]; - } - } - _a.label = 1; - case 1: - if (!(nextRetryDelay !== null)) return [3 /*break*/, 7]; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Information, "Reconnect attempt number " + previousReconnectAttempts + " will start in " + nextRetryDelay + " ms."); - return [4 /*yield*/, new Promise(function (resolve) { - _this.reconnectDelayHandle = setTimeout(resolve, nextRetryDelay); - })]; - case 2: - _a.sent(); - this.reconnectDelayHandle = undefined; - if (this.connectionState !== HubConnectionState.Reconnecting) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Connection left the reconnecting state during reconnect delay. Done reconnecting."); - return [2 /*return*/]; - } - _a.label = 3; - case 3: - _a.trys.push([3, 5, , 6]); - return [4 /*yield*/, this.startInternal()]; - case 4: - _a.sent(); - this.connectionState = HubConnectionState.Connected; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Information, "HubConnection reconnected successfully."); - if (this.onreconnected) { - try { - this.reconnectedCallbacks.forEach(function (c) { return c.apply(_this, [_this.connection.connectionId]); }); - } - catch (e) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Error, "An onreconnected callback called with connectionId '" + this.connection.connectionId + "; threw error '" + e + "'."); - } - } - return [2 /*return*/]; - case 5: - e_4 = _a.sent(); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Information, "Reconnect attempt failed because of error '" + e_4 + "'."); - if (this.connectionState !== HubConnectionState.Reconnecting) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Connection left the reconnecting state during reconnect attempt. Done reconnecting."); - return [2 /*return*/]; - } - return [3 /*break*/, 6]; - case 6: - nextRetryDelay = this.getNextRetryDelay(previousReconnectAttempts++, Date.now() - reconnectStartTime); - return [3 /*break*/, 1]; - case 7: - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Information, "Reconnect retries have been exhausted after " + (Date.now() - reconnectStartTime) + " ms and " + previousReconnectAttempts + " failed attempts. Connection disconnecting."); - this.completeClose(); - return [2 /*return*/]; - } - }); - }); - }; - HubConnection.prototype.getNextRetryDelay = function (previousRetryCount, elapsedMilliseconds) { - try { - return this.reconnectPolicy.nextRetryDelayInMilliseconds(previousRetryCount, elapsedMilliseconds); - } - catch (e) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Error, "IReconnectPolicy.nextRetryDelayInMilliseconds(" + previousRetryCount + ", " + elapsedMilliseconds + ") threw error '" + e + "'."); - return null; - } - }; - HubConnection.prototype.cancelCallbacksWithError = function (error) { - var callbacks = this.callbacks; - this.callbacks = {}; - Object.keys(callbacks) - .forEach(function (key) { - var callback = callbacks[key]; - callback(null, error); - }); - }; - HubConnection.prototype.cleanupPingTimer = function () { - if (this.pingServerHandle) { - clearTimeout(this.pingServerHandle); - } - }; - HubConnection.prototype.cleanupTimeout = function () { - if (this.timeoutHandle) { - clearTimeout(this.timeoutHandle); - } - }; - HubConnection.prototype.createInvocation = function (methodName, args, nonblocking, streamIds) { - if (nonblocking) { - return { - arguments: args, - streamIds: streamIds, - target: methodName, - type: _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Invocation, - }; - } - else { - var invocationId = this.invocationId; - this.invocationId++; - return { - arguments: args, - invocationId: invocationId.toString(), - streamIds: streamIds, - target: methodName, - type: _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Invocation, - }; - } - }; - HubConnection.prototype.launchStreams = function (streams, promiseQueue) { - var _this = this; - if (streams.length === 0) { - return; - } - // Synchronize stream data so they arrive in-order on the server - if (!promiseQueue) { - promiseQueue = Promise.resolve(); - } - var _loop_1 = function (streamId) { - streams[streamId].subscribe({ - complete: function () { - promiseQueue = promiseQueue.then(function () { return _this.sendWithProtocol(_this.createCompletionMessage(streamId)); }); - }, - error: function (err) { - var message; - if (err instanceof Error) { - message = err.message; - } - else if (err && err.toString) { - message = err.toString(); - } - else { - message = "Unknown error"; - } - promiseQueue = promiseQueue.then(function () { return _this.sendWithProtocol(_this.createCompletionMessage(streamId, message)); }); - }, - next: function (item) { - promiseQueue = promiseQueue.then(function () { return _this.sendWithProtocol(_this.createStreamItemMessage(streamId, item)); }); - }, - }); - }; - // We want to iterate over the keys, since the keys are the stream ids - // tslint:disable-next-line:forin - for (var streamId in streams) { - _loop_1(streamId); - } - }; - HubConnection.prototype.replaceStreamingParams = function (args) { - var streams = []; - var streamIds = []; - for (var i = 0; i < args.length; i++) { - var argument = args[i]; - if (this.isObservable(argument)) { - var streamId = this.invocationId; - this.invocationId++; - // Store the stream for later use - streams[streamId] = argument; - streamIds.push(streamId.toString()); - // remove stream from args - args.splice(i, 1); - } - } - return [streams, streamIds]; - }; - HubConnection.prototype.isObservable = function (arg) { - // This allows other stream implementations to just work (like rxjs) - return arg && arg.subscribe && typeof arg.subscribe === "function"; - }; - HubConnection.prototype.createStreamInvocation = function (methodName, args, streamIds) { - var invocationId = this.invocationId; - this.invocationId++; - return { - arguments: args, - invocationId: invocationId.toString(), - streamIds: streamIds, - target: methodName, - type: _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].StreamInvocation, - }; - }; - HubConnection.prototype.createCancelInvocation = function (id) { - return { - invocationId: id, - type: _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].CancelInvocation, - }; - }; - HubConnection.prototype.createStreamItemMessage = function (id, item) { - return { - invocationId: id, - item: item, - type: _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].StreamItem, - }; - }; - HubConnection.prototype.createCompletionMessage = function (id, error, result) { - if (error) { - return { - error: error, - invocationId: id, - type: _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Completion, - }; - } - return { - invocationId: id, - result: result, - type: _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Completion, - }; - }; - return HubConnection; -}()); - -//# sourceMappingURL=HubConnection.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HubConnectionBuilder.js": -/*!**********************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HubConnectionBuilder.js ***! - \**********************************************************************************************************************/ -/*! exports provided: HubConnectionBuilder */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HubConnectionBuilder", function() { return HubConnectionBuilder; }); -/* harmony import */ var _DefaultReconnectPolicy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DefaultReconnectPolicy */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/DefaultReconnectPolicy.js"); -/* harmony import */ var _HttpConnection__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./HttpConnection */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HttpConnection.js"); -/* harmony import */ var _HubConnection__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./HubConnection */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HubConnection.js"); -/* harmony import */ var _ILogger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ILogger */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ILogger.js"); -/* harmony import */ var _JsonHubProtocol__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./JsonHubProtocol */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/JsonHubProtocol.js"); -/* harmony import */ var _Loggers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Loggers */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Loggers.js"); -/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Utils */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Utils.js"); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -var __assign = (undefined && undefined.__assign) || Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; -}; - - - - - - - -// tslint:disable:object-literal-sort-keys -var LogLevelNameMapping = { - trace: _ILogger__WEBPACK_IMPORTED_MODULE_3__["LogLevel"].Trace, - debug: _ILogger__WEBPACK_IMPORTED_MODULE_3__["LogLevel"].Debug, - info: _ILogger__WEBPACK_IMPORTED_MODULE_3__["LogLevel"].Information, - information: _ILogger__WEBPACK_IMPORTED_MODULE_3__["LogLevel"].Information, - warn: _ILogger__WEBPACK_IMPORTED_MODULE_3__["LogLevel"].Warning, - warning: _ILogger__WEBPACK_IMPORTED_MODULE_3__["LogLevel"].Warning, - error: _ILogger__WEBPACK_IMPORTED_MODULE_3__["LogLevel"].Error, - critical: _ILogger__WEBPACK_IMPORTED_MODULE_3__["LogLevel"].Critical, - none: _ILogger__WEBPACK_IMPORTED_MODULE_3__["LogLevel"].None, -}; -function parseLogLevel(name) { - // Case-insensitive matching via lower-casing - // Yes, I know case-folding is a complicated problem in Unicode, but we only support - // the ASCII strings defined in LogLevelNameMapping anyway, so it's fine -anurse. - var mapping = LogLevelNameMapping[name.toLowerCase()]; - if (typeof mapping !== "undefined") { - return mapping; - } - else { - throw new Error("Unknown log level: " + name); - } -} -/** A builder for configuring {@link @aspnet/signalr.HubConnection} instances. */ -var HubConnectionBuilder = /** @class */ (function () { - function HubConnectionBuilder() { - } - HubConnectionBuilder.prototype.configureLogging = function (logging) { - _Utils__WEBPACK_IMPORTED_MODULE_6__["Arg"].isRequired(logging, "logging"); - if (isLogger(logging)) { - this.logger = logging; - } - else if (typeof logging === "string") { - var logLevel = parseLogLevel(logging); - this.logger = new _Utils__WEBPACK_IMPORTED_MODULE_6__["ConsoleLogger"](logLevel); - } - else { - this.logger = new _Utils__WEBPACK_IMPORTED_MODULE_6__["ConsoleLogger"](logging); - } - return this; - }; - HubConnectionBuilder.prototype.withUrl = function (url, transportTypeOrOptions) { - _Utils__WEBPACK_IMPORTED_MODULE_6__["Arg"].isRequired(url, "url"); - this.url = url; - // Flow-typing knows where it's at. Since HttpTransportType is a number and IHttpConnectionOptions is guaranteed - // to be an object, we know (as does TypeScript) this comparison is all we need to figure out which overload was called. - if (typeof transportTypeOrOptions === "object") { - this.httpConnectionOptions = __assign({}, this.httpConnectionOptions, transportTypeOrOptions); - } - else { - this.httpConnectionOptions = __assign({}, this.httpConnectionOptions, { transport: transportTypeOrOptions }); - } - return this; - }; - /** Configures the {@link @aspnet/signalr.HubConnection} to use the specified Hub Protocol. - * - * @param {IHubProtocol} protocol The {@link @aspnet/signalr.IHubProtocol} implementation to use. - */ - HubConnectionBuilder.prototype.withHubProtocol = function (protocol) { - _Utils__WEBPACK_IMPORTED_MODULE_6__["Arg"].isRequired(protocol, "protocol"); - this.protocol = protocol; - return this; - }; - HubConnectionBuilder.prototype.withAutomaticReconnect = function (retryDelaysOrReconnectPolicy) { - if (this.reconnectPolicy) { - throw new Error("A reconnectPolicy has already been set."); - } - if (!retryDelaysOrReconnectPolicy) { - this.reconnectPolicy = new _DefaultReconnectPolicy__WEBPACK_IMPORTED_MODULE_0__["DefaultReconnectPolicy"](); - } - else if (Array.isArray(retryDelaysOrReconnectPolicy)) { - this.reconnectPolicy = new _DefaultReconnectPolicy__WEBPACK_IMPORTED_MODULE_0__["DefaultReconnectPolicy"](retryDelaysOrReconnectPolicy); - } - else { - this.reconnectPolicy = retryDelaysOrReconnectPolicy; - } - return this; - }; - /** Creates a {@link @aspnet/signalr.HubConnection} from the configuration options specified in this builder. - * - * @returns {HubConnection} The configured {@link @aspnet/signalr.HubConnection}. - */ - HubConnectionBuilder.prototype.build = function () { - // If httpConnectionOptions has a logger, use it. Otherwise, override it with the one - // provided to configureLogger - var httpConnectionOptions = this.httpConnectionOptions || {}; - // If it's 'null', the user **explicitly** asked for null, don't mess with it. - if (httpConnectionOptions.logger === undefined) { - // If our logger is undefined or null, that's OK, the HttpConnection constructor will handle it. - httpConnectionOptions.logger = this.logger; - } - // Now create the connection - if (!this.url) { - throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection."); - } - var connection = new _HttpConnection__WEBPACK_IMPORTED_MODULE_1__["HttpConnection"](this.url, httpConnectionOptions); - return _HubConnection__WEBPACK_IMPORTED_MODULE_2__["HubConnection"].create(connection, this.logger || _Loggers__WEBPACK_IMPORTED_MODULE_5__["NullLogger"].instance, this.protocol || new _JsonHubProtocol__WEBPACK_IMPORTED_MODULE_4__["JsonHubProtocol"](), this.reconnectPolicy); - }; - return HubConnectionBuilder; -}()); - -function isLogger(logger) { - return logger.log !== undefined; -} -//# sourceMappingURL=HubConnectionBuilder.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/IHubProtocol.js": -/*!**************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/IHubProtocol.js ***! - \**************************************************************************************************************/ -/*! exports provided: MessageType */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MessageType", function() { return MessageType; }); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -/** Defines the type of a Hub Message. */ -var MessageType; -(function (MessageType) { - /** Indicates the message is an Invocation message and implements the {@link @aspnet/signalr.InvocationMessage} interface. */ - MessageType[MessageType["Invocation"] = 1] = "Invocation"; - /** Indicates the message is a StreamItem message and implements the {@link @aspnet/signalr.StreamItemMessage} interface. */ - MessageType[MessageType["StreamItem"] = 2] = "StreamItem"; - /** Indicates the message is a Completion message and implements the {@link @aspnet/signalr.CompletionMessage} interface. */ - MessageType[MessageType["Completion"] = 3] = "Completion"; - /** Indicates the message is a Stream Invocation message and implements the {@link @aspnet/signalr.StreamInvocationMessage} interface. */ - MessageType[MessageType["StreamInvocation"] = 4] = "StreamInvocation"; - /** Indicates the message is a Cancel Invocation message and implements the {@link @aspnet/signalr.CancelInvocationMessage} interface. */ - MessageType[MessageType["CancelInvocation"] = 5] = "CancelInvocation"; - /** Indicates the message is a Ping message and implements the {@link @aspnet/signalr.PingMessage} interface. */ - MessageType[MessageType["Ping"] = 6] = "Ping"; - /** Indicates the message is a Close message and implements the {@link @aspnet/signalr.CloseMessage} interface. */ - MessageType[MessageType["Close"] = 7] = "Close"; -})(MessageType || (MessageType = {})); -//# sourceMappingURL=IHubProtocol.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ILogger.js": -/*!*********************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ILogger.js ***! - \*********************************************************************************************************/ -/*! exports provided: LogLevel */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LogLevel", function() { return LogLevel; }); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -// These values are designed to match the ASP.NET Log Levels since that's the pattern we're emulating here. -/** Indicates the severity of a log message. - * - * Log Levels are ordered in increasing severity. So `Debug` is more severe than `Trace`, etc. - */ -var LogLevel; -(function (LogLevel) { - /** Log level for very low severity diagnostic messages. */ - LogLevel[LogLevel["Trace"] = 0] = "Trace"; - /** Log level for low severity diagnostic messages. */ - LogLevel[LogLevel["Debug"] = 1] = "Debug"; - /** Log level for informational diagnostic messages. */ - LogLevel[LogLevel["Information"] = 2] = "Information"; - /** Log level for diagnostic messages that indicate a non-fatal problem. */ - LogLevel[LogLevel["Warning"] = 3] = "Warning"; - /** Log level for diagnostic messages that indicate a failure in the current operation. */ - LogLevel[LogLevel["Error"] = 4] = "Error"; - /** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */ - LogLevel[LogLevel["Critical"] = 5] = "Critical"; - /** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */ - LogLevel[LogLevel["None"] = 6] = "None"; -})(LogLevel || (LogLevel = {})); -//# sourceMappingURL=ILogger.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ITransport.js": -/*!************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ITransport.js ***! - \************************************************************************************************************/ -/*! exports provided: HttpTransportType, TransferFormat */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpTransportType", function() { return HttpTransportType; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TransferFormat", function() { return TransferFormat; }); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -// This will be treated as a bit flag in the future, so we keep it using power-of-two values. -/** Specifies a specific HTTP transport type. */ -var HttpTransportType; -(function (HttpTransportType) { - /** Specifies no transport preference. */ - HttpTransportType[HttpTransportType["None"] = 0] = "None"; - /** Specifies the WebSockets transport. */ - HttpTransportType[HttpTransportType["WebSockets"] = 1] = "WebSockets"; - /** Specifies the Server-Sent Events transport. */ - HttpTransportType[HttpTransportType["ServerSentEvents"] = 2] = "ServerSentEvents"; - /** Specifies the Long Polling transport. */ - HttpTransportType[HttpTransportType["LongPolling"] = 4] = "LongPolling"; -})(HttpTransportType || (HttpTransportType = {})); -/** Specifies the transfer format for a connection. */ -var TransferFormat; -(function (TransferFormat) { - /** Specifies that only text data will be transmitted over the connection. */ - TransferFormat[TransferFormat["Text"] = 1] = "Text"; - /** Specifies that binary data will be transmitted over the connection. */ - TransferFormat[TransferFormat["Binary"] = 2] = "Binary"; -})(TransferFormat || (TransferFormat = {})); -//# sourceMappingURL=ITransport.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/JsonHubProtocol.js": -/*!*****************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/JsonHubProtocol.js ***! - \*****************************************************************************************************************/ -/*! exports provided: JsonHubProtocol */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonHubProtocol", function() { return JsonHubProtocol; }); -/* harmony import */ var _IHubProtocol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./IHubProtocol */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/IHubProtocol.js"); -/* harmony import */ var _ILogger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ILogger */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ILogger.js"); -/* harmony import */ var _ITransport__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ITransport */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ITransport.js"); -/* harmony import */ var _Loggers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Loggers */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Loggers.js"); -/* harmony import */ var _TextMessageFormat__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./TextMessageFormat */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/TextMessageFormat.js"); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - - - - - -var JSON_HUB_PROTOCOL_NAME = "json"; -/** Implements the JSON Hub Protocol. */ -var JsonHubProtocol = /** @class */ (function () { - function JsonHubProtocol() { - /** @inheritDoc */ - this.name = JSON_HUB_PROTOCOL_NAME; - /** @inheritDoc */ - this.version = 1; - /** @inheritDoc */ - this.transferFormat = _ITransport__WEBPACK_IMPORTED_MODULE_2__["TransferFormat"].Text; - } - /** Creates an array of {@link @aspnet/signalr.HubMessage} objects from the specified serialized representation. - * - * @param {string} input A string containing the serialized representation. - * @param {ILogger} logger A logger that will be used to log messages that occur during parsing. - */ - JsonHubProtocol.prototype.parseMessages = function (input, logger) { - // The interface does allow "ArrayBuffer" to be passed in, but this implementation does not. So let's throw a useful error. - if (typeof input !== "string") { - throw new Error("Invalid input for JSON hub protocol. Expected a string."); - } - if (!input) { - return []; - } - if (logger === null) { - logger = _Loggers__WEBPACK_IMPORTED_MODULE_3__["NullLogger"].instance; - } - // Parse the messages - var messages = _TextMessageFormat__WEBPACK_IMPORTED_MODULE_4__["TextMessageFormat"].parse(input); - var hubMessages = []; - for (var _i = 0, messages_1 = messages; _i < messages_1.length; _i++) { - var message = messages_1[_i]; - var parsedMessage = JSON.parse(message); - if (typeof parsedMessage.type !== "number") { - throw new Error("Invalid payload."); - } - switch (parsedMessage.type) { - case _IHubProtocol__WEBPACK_IMPORTED_MODULE_0__["MessageType"].Invocation: - this.isInvocationMessage(parsedMessage); - break; - case _IHubProtocol__WEBPACK_IMPORTED_MODULE_0__["MessageType"].StreamItem: - this.isStreamItemMessage(parsedMessage); - break; - case _IHubProtocol__WEBPACK_IMPORTED_MODULE_0__["MessageType"].Completion: - this.isCompletionMessage(parsedMessage); - break; - case _IHubProtocol__WEBPACK_IMPORTED_MODULE_0__["MessageType"].Ping: - // Single value, no need to validate - break; - case _IHubProtocol__WEBPACK_IMPORTED_MODULE_0__["MessageType"].Close: - // All optional values, no need to validate - break; - default: - // Future protocol changes can add message types, old clients can ignore them - logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Information, "Unknown message type '" + parsedMessage.type + "' ignored."); - continue; - } - hubMessages.push(parsedMessage); - } - return hubMessages; - }; - /** Writes the specified {@link @aspnet/signalr.HubMessage} to a string and returns it. - * - * @param {HubMessage} message The message to write. - * @returns {string} A string containing the serialized representation of the message. - */ - JsonHubProtocol.prototype.writeMessage = function (message) { - return _TextMessageFormat__WEBPACK_IMPORTED_MODULE_4__["TextMessageFormat"].write(JSON.stringify(message)); - }; - JsonHubProtocol.prototype.isInvocationMessage = function (message) { - this.assertNotEmptyString(message.target, "Invalid payload for Invocation message."); - if (message.invocationId !== undefined) { - this.assertNotEmptyString(message.invocationId, "Invalid payload for Invocation message."); - } - }; - JsonHubProtocol.prototype.isStreamItemMessage = function (message) { - this.assertNotEmptyString(message.invocationId, "Invalid payload for StreamItem message."); - if (message.item === undefined) { - throw new Error("Invalid payload for StreamItem message."); - } - }; - JsonHubProtocol.prototype.isCompletionMessage = function (message) { - if (message.result && message.error) { - throw new Error("Invalid payload for Completion message."); - } - if (!message.result && message.error) { - this.assertNotEmptyString(message.error, "Invalid payload for Completion message."); - } - this.assertNotEmptyString(message.invocationId, "Invalid payload for Completion message."); - }; - JsonHubProtocol.prototype.assertNotEmptyString = function (value, errorMessage) { - if (typeof value !== "string" || value === "") { - throw new Error(errorMessage); - } - }; - return JsonHubProtocol; -}()); - -//# sourceMappingURL=JsonHubProtocol.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Loggers.js": -/*!*********************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Loggers.js ***! - \*********************************************************************************************************/ -/*! exports provided: NullLogger */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NullLogger", function() { return NullLogger; }); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -/** A logger that does nothing when log messages are sent to it. */ -var NullLogger = /** @class */ (function () { - function NullLogger() { - } - /** @inheritDoc */ - // tslint:disable-next-line - NullLogger.prototype.log = function (_logLevel, _message) { - }; - /** The singleton instance of the {@link @aspnet/signalr.NullLogger}. */ - NullLogger.instance = new NullLogger(); - return NullLogger; -}()); - -//# sourceMappingURL=Loggers.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/LongPollingTransport.js": -/*!**********************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/LongPollingTransport.js ***! - \**********************************************************************************************************************/ -/*! exports provided: LongPollingTransport */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LongPollingTransport", function() { return LongPollingTransport; }); -/* harmony import */ var _AbortController__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AbortController */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/AbortController.js"); -/* harmony import */ var _Errors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Errors */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Errors.js"); -/* harmony import */ var _ILogger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ILogger */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ILogger.js"); -/* harmony import */ var _ITransport__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ITransport */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ITransport.js"); -/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Utils */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Utils.js"); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (undefined && undefined.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; - - - - - -// Not exported from 'index', this type is internal. -/** @private */ -var LongPollingTransport = /** @class */ (function () { - function LongPollingTransport(httpClient, accessTokenFactory, logger, logMessageContent) { - this.httpClient = httpClient; - this.accessTokenFactory = accessTokenFactory; - this.logger = logger; - this.pollAbort = new _AbortController__WEBPACK_IMPORTED_MODULE_0__["AbortController"](); - this.logMessageContent = logMessageContent; - this.running = false; - this.onreceive = null; - this.onclose = null; - } - Object.defineProperty(LongPollingTransport.prototype, "pollAborted", { - // This is an internal type, not exported from 'index' so this is really just internal. - get: function () { - return this.pollAbort.aborted; - }, - enumerable: true, - configurable: true - }); - LongPollingTransport.prototype.connect = function (url, transferFormat) { - return __awaiter(this, void 0, void 0, function () { - var pollOptions, token, pollUrl, response; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _Utils__WEBPACK_IMPORTED_MODULE_4__["Arg"].isRequired(url, "url"); - _Utils__WEBPACK_IMPORTED_MODULE_4__["Arg"].isRequired(transferFormat, "transferFormat"); - _Utils__WEBPACK_IMPORTED_MODULE_4__["Arg"].isIn(transferFormat, _ITransport__WEBPACK_IMPORTED_MODULE_3__["TransferFormat"], "transferFormat"); - this.url = url; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Trace, "(LongPolling transport) Connecting."); - // Allow binary format on Node and Browsers that support binary content (indicated by the presence of responseType property) - if (transferFormat === _ITransport__WEBPACK_IMPORTED_MODULE_3__["TransferFormat"].Binary && - (typeof XMLHttpRequest !== "undefined" && typeof new XMLHttpRequest().responseType !== "string")) { - throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported."); - } - pollOptions = { - abortSignal: this.pollAbort.signal, - headers: {}, - timeout: 100000, - }; - if (transferFormat === _ITransport__WEBPACK_IMPORTED_MODULE_3__["TransferFormat"].Binary) { - pollOptions.responseType = "arraybuffer"; - } - return [4 /*yield*/, this.getAccessToken()]; - case 1: - token = _a.sent(); - this.updateHeaderToken(pollOptions, token); - pollUrl = url + "&_=" + Date.now(); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Trace, "(LongPolling transport) polling: " + pollUrl + "."); - return [4 /*yield*/, this.httpClient.get(pollUrl, pollOptions)]; - case 2: - response = _a.sent(); - if (response.statusCode !== 200) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Error, "(LongPolling transport) Unexpected response code: " + response.statusCode + "."); - // Mark running as false so that the poll immediately ends and runs the close logic - this.closeError = new _Errors__WEBPACK_IMPORTED_MODULE_1__["HttpError"](response.statusText || "", response.statusCode); - this.running = false; - } - else { - this.running = true; - } - this.receiving = this.poll(this.url, pollOptions); - return [2 /*return*/]; - } - }); - }); - }; - LongPollingTransport.prototype.getAccessToken = function () { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!this.accessTokenFactory) return [3 /*break*/, 2]; - return [4 /*yield*/, this.accessTokenFactory()]; - case 1: return [2 /*return*/, _a.sent()]; - case 2: return [2 /*return*/, null]; - } - }); - }); - }; - LongPollingTransport.prototype.updateHeaderToken = function (request, token) { - if (!request.headers) { - request.headers = {}; - } - if (token) { - // tslint:disable-next-line:no-string-literal - request.headers["Authorization"] = "Bearer " + token; - return; - } - // tslint:disable-next-line:no-string-literal - if (request.headers["Authorization"]) { - // tslint:disable-next-line:no-string-literal - delete request.headers["Authorization"]; - } - }; - LongPollingTransport.prototype.poll = function (url, pollOptions) { - return __awaiter(this, void 0, void 0, function () { - var token, pollUrl, response, e_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, , 8, 9]); - _a.label = 1; - case 1: - if (!this.running) return [3 /*break*/, 7]; - return [4 /*yield*/, this.getAccessToken()]; - case 2: - token = _a.sent(); - this.updateHeaderToken(pollOptions, token); - _a.label = 3; - case 3: - _a.trys.push([3, 5, , 6]); - pollUrl = url + "&_=" + Date.now(); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Trace, "(LongPolling transport) polling: " + pollUrl + "."); - return [4 /*yield*/, this.httpClient.get(pollUrl, pollOptions)]; - case 4: - response = _a.sent(); - if (response.statusCode === 204) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Information, "(LongPolling transport) Poll terminated by server."); - this.running = false; - } - else if (response.statusCode !== 200) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Error, "(LongPolling transport) Unexpected response code: " + response.statusCode + "."); - // Unexpected status code - this.closeError = new _Errors__WEBPACK_IMPORTED_MODULE_1__["HttpError"](response.statusText || "", response.statusCode); - this.running = false; - } - else { - // Process the response - if (response.content) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Trace, "(LongPolling transport) data received. " + Object(_Utils__WEBPACK_IMPORTED_MODULE_4__["getDataDetail"])(response.content, this.logMessageContent) + "."); - if (this.onreceive) { - this.onreceive(response.content); - } - } - else { - // This is another way timeout manifest. - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Trace, "(LongPolling transport) Poll timed out, reissuing."); - } - } - return [3 /*break*/, 6]; - case 5: - e_1 = _a.sent(); - if (!this.running) { - // Log but disregard errors that occur after stopping - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Trace, "(LongPolling transport) Poll errored after shutdown: " + e_1.message); - } - else { - if (e_1 instanceof _Errors__WEBPACK_IMPORTED_MODULE_1__["TimeoutError"]) { - // Ignore timeouts and reissue the poll. - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Trace, "(LongPolling transport) Poll timed out, reissuing."); - } - else { - // Close the connection with the error as the result. - this.closeError = e_1; - this.running = false; - } - } - return [3 /*break*/, 6]; - case 6: return [3 /*break*/, 1]; - case 7: return [3 /*break*/, 9]; - case 8: - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Trace, "(LongPolling transport) Polling complete."); - // We will reach here with pollAborted==false when the server returned a response causing the transport to stop. - // If pollAborted==true then client initiated the stop and the stop method will raise the close event after DELETE is sent. - if (!this.pollAborted) { - this.raiseOnClose(); - } - return [7 /*endfinally*/]; - case 9: return [2 /*return*/]; - } - }); - }); - }; - LongPollingTransport.prototype.send = function (data) { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - if (!this.running) { - return [2 /*return*/, Promise.reject(new Error("Cannot send until the transport is connected"))]; - } - return [2 /*return*/, Object(_Utils__WEBPACK_IMPORTED_MODULE_4__["sendMessage"])(this.logger, "LongPolling", this.httpClient, this.url, this.accessTokenFactory, data, this.logMessageContent)]; - }); - }); - }; - LongPollingTransport.prototype.stop = function () { - return __awaiter(this, void 0, void 0, function () { - var deleteOptions, token; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Trace, "(LongPolling transport) Stopping polling."); - // Tell receiving loop to stop, abort any current request, and then wait for it to finish - this.running = false; - this.pollAbort.abort(); - _a.label = 1; - case 1: - _a.trys.push([1, , 5, 6]); - return [4 /*yield*/, this.receiving]; - case 2: - _a.sent(); - // Send DELETE to clean up long polling on the server - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Trace, "(LongPolling transport) sending DELETE request to " + this.url + "."); - deleteOptions = { - headers: {}, - }; - return [4 /*yield*/, this.getAccessToken()]; - case 3: - token = _a.sent(); - this.updateHeaderToken(deleteOptions, token); - return [4 /*yield*/, this.httpClient.delete(this.url, deleteOptions)]; - case 4: - _a.sent(); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Trace, "(LongPolling transport) DELETE request sent."); - return [3 /*break*/, 6]; - case 5: - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Trace, "(LongPolling transport) Stop finished."); - // Raise close event here instead of in polling - // It needs to happen after the DELETE request is sent - this.raiseOnClose(); - return [7 /*endfinally*/]; - case 6: return [2 /*return*/]; - } - }); - }); - }; - LongPollingTransport.prototype.raiseOnClose = function () { - if (this.onclose) { - var logMessage = "(LongPolling transport) Firing onclose event."; - if (this.closeError) { - logMessage += " Error: " + this.closeError; - } - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Trace, logMessage); - this.onclose(this.closeError); - } - }; - return LongPollingTransport; -}()); - -//# sourceMappingURL=LongPollingTransport.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/NodeHttpClient.js": -/*!****************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/NodeHttpClient.js ***! - \****************************************************************************************************************/ -/*! exports provided: NodeHttpClient */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* WEBPACK VAR INJECTION */(function(Buffer) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NodeHttpClient", function() { return NodeHttpClient; }); -/* harmony import */ var _Errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Errors */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Errors.js"); -/* harmony import */ var _HttpClient__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./HttpClient */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HttpClient.js"); -/* harmony import */ var _ILogger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ILogger */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ILogger.js"); -/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Utils */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Utils.js"); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __assign = (undefined && undefined.__assign) || Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; -}; - - - - -var requestModule; -if (typeof XMLHttpRequest === "undefined") { - // In order to ignore the dynamic require in webpack builds we need to do this magic - // @ts-ignore: TS doesn't know about these names - var requireFunc = true ? require : undefined; - requestModule = requireFunc("request"); -} -var NodeHttpClient = /** @class */ (function (_super) { - __extends(NodeHttpClient, _super); - function NodeHttpClient(logger) { - var _this = _super.call(this) || this; - if (typeof requestModule === "undefined") { - throw new Error("The 'request' module could not be loaded."); - } - _this.logger = logger; - _this.cookieJar = requestModule.jar(); - _this.request = requestModule.defaults({ jar: _this.cookieJar }); - return _this; - } - NodeHttpClient.prototype.send = function (httpRequest) { - var _this = this; - return new Promise(function (resolve, reject) { - var requestBody; - if (Object(_Utils__WEBPACK_IMPORTED_MODULE_3__["isArrayBuffer"])(httpRequest.content)) { - requestBody = Buffer.from(httpRequest.content); - } - else { - requestBody = httpRequest.content || ""; - } - var currentRequest = _this.request(httpRequest.url, { - body: requestBody, - // If binary is expected 'null' should be used, otherwise for text 'utf8' - encoding: httpRequest.responseType === "arraybuffer" ? null : "utf8", - headers: __assign({ - // Tell auth middleware to 401 instead of redirecting - "X-Requested-With": "XMLHttpRequest" }, httpRequest.headers), - method: httpRequest.method, - timeout: httpRequest.timeout, - }, function (error, response, body) { - if (httpRequest.abortSignal) { - httpRequest.abortSignal.onabort = null; - } - if (error) { - if (error.code === "ETIMEDOUT") { - _this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Warning, "Timeout from HTTP request."); - reject(new _Errors__WEBPACK_IMPORTED_MODULE_0__["TimeoutError"]()); - } - _this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Warning, "Error from HTTP request. " + error); - reject(error); - return; - } - if (response.statusCode >= 200 && response.statusCode < 300) { - resolve(new _HttpClient__WEBPACK_IMPORTED_MODULE_1__["HttpResponse"](response.statusCode, response.statusMessage || "", body)); - } - else { - reject(new _Errors__WEBPACK_IMPORTED_MODULE_0__["HttpError"](response.statusMessage || "", response.statusCode || 0)); - } - }); - if (httpRequest.abortSignal) { - httpRequest.abortSignal.onabort = function () { - currentRequest.abort(); - reject(new _Errors__WEBPACK_IMPORTED_MODULE_0__["AbortError"]()); - }; - } - }); - }; - NodeHttpClient.prototype.getCookieString = function (url) { - return this.cookieJar.getCookieString(url); - }; - return NodeHttpClient; -}(_HttpClient__WEBPACK_IMPORTED_MODULE_1__["HttpClient"])); - -//# sourceMappingURL=NodeHttpClient.js.map -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../../../buffer/index.js */ "../node_modules/buffer/index.js").Buffer)) - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ServerSentEventsTransport.js": -/*!***************************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ServerSentEventsTransport.js ***! - \***************************************************************************************************************************/ -/*! exports provided: ServerSentEventsTransport */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ServerSentEventsTransport", function() { return ServerSentEventsTransport; }); -/* harmony import */ var _ILogger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ILogger */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ILogger.js"); -/* harmony import */ var _ITransport__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ITransport */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ITransport.js"); -/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Utils */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Utils.js"); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (undefined && undefined.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; - - - -/** @private */ -var ServerSentEventsTransport = /** @class */ (function () { - function ServerSentEventsTransport(httpClient, accessTokenFactory, logger, logMessageContent, eventSourceConstructor) { - this.httpClient = httpClient; - this.accessTokenFactory = accessTokenFactory; - this.logger = logger; - this.logMessageContent = logMessageContent; - this.eventSourceConstructor = eventSourceConstructor; - this.onreceive = null; - this.onclose = null; - } - ServerSentEventsTransport.prototype.connect = function (url, transferFormat) { - return __awaiter(this, void 0, void 0, function () { - var token; - var _this = this; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _Utils__WEBPACK_IMPORTED_MODULE_2__["Arg"].isRequired(url, "url"); - _Utils__WEBPACK_IMPORTED_MODULE_2__["Arg"].isRequired(transferFormat, "transferFormat"); - _Utils__WEBPACK_IMPORTED_MODULE_2__["Arg"].isIn(transferFormat, _ITransport__WEBPACK_IMPORTED_MODULE_1__["TransferFormat"], "transferFormat"); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Trace, "(SSE transport) Connecting."); - // set url before accessTokenFactory because this.url is only for send and we set the auth header instead of the query string for send - this.url = url; - if (!this.accessTokenFactory) return [3 /*break*/, 2]; - return [4 /*yield*/, this.accessTokenFactory()]; - case 1: - token = _a.sent(); - if (token) { - url += (url.indexOf("?") < 0 ? "?" : "&") + ("access_token=" + encodeURIComponent(token)); - } - _a.label = 2; - case 2: return [2 /*return*/, new Promise(function (resolve, reject) { - var opened = false; - if (transferFormat !== _ITransport__WEBPACK_IMPORTED_MODULE_1__["TransferFormat"].Text) { - reject(new Error("The Server-Sent Events transport only supports the 'Text' transfer format")); - return; - } - var eventSource; - if (_Utils__WEBPACK_IMPORTED_MODULE_2__["Platform"].isBrowser || _Utils__WEBPACK_IMPORTED_MODULE_2__["Platform"].isWebWorker) { - eventSource = new _this.eventSourceConstructor(url, { withCredentials: true }); - } - else { - // Non-browser passes cookies via the dictionary - var cookies = _this.httpClient.getCookieString(url); - eventSource = new _this.eventSourceConstructor(url, { withCredentials: true, headers: { Cookie: cookies } }); - } - try { - eventSource.onmessage = function (e) { - if (_this.onreceive) { - try { - _this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Trace, "(SSE transport) data received. " + Object(_Utils__WEBPACK_IMPORTED_MODULE_2__["getDataDetail"])(e.data, _this.logMessageContent) + "."); - _this.onreceive(e.data); - } - catch (error) { - _this.close(error); - return; - } - } - }; - eventSource.onerror = function (e) { - var error = new Error(e.data || "Error occurred"); - if (opened) { - _this.close(error); - } - else { - reject(error); - } - }; - eventSource.onopen = function () { - _this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Information, "SSE connected to " + _this.url); - _this.eventSource = eventSource; - opened = true; - resolve(); - }; - } - catch (e) { - reject(e); - return; - } - })]; - } - }); - }); - }; - ServerSentEventsTransport.prototype.send = function (data) { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - if (!this.eventSource) { - return [2 /*return*/, Promise.reject(new Error("Cannot send until the transport is connected"))]; - } - return [2 /*return*/, Object(_Utils__WEBPACK_IMPORTED_MODULE_2__["sendMessage"])(this.logger, "SSE", this.httpClient, this.url, this.accessTokenFactory, data, this.logMessageContent)]; - }); - }); - }; - ServerSentEventsTransport.prototype.stop = function () { - this.close(); - return Promise.resolve(); - }; - ServerSentEventsTransport.prototype.close = function (e) { - if (this.eventSource) { - this.eventSource.close(); - this.eventSource = undefined; - if (this.onclose) { - this.onclose(e); - } - } - }; - return ServerSentEventsTransport; -}()); - -//# sourceMappingURL=ServerSentEventsTransport.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Subject.js": -/*!*********************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Subject.js ***! - \*********************************************************************************************************/ -/*! exports provided: Subject */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Subject", function() { return Subject; }); -/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Utils */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Utils.js"); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -/** Stream implementation to stream items to the server. */ -var Subject = /** @class */ (function () { - function Subject() { - this.observers = []; - } - Subject.prototype.next = function (item) { - for (var _i = 0, _a = this.observers; _i < _a.length; _i++) { - var observer = _a[_i]; - observer.next(item); - } - }; - Subject.prototype.error = function (err) { - for (var _i = 0, _a = this.observers; _i < _a.length; _i++) { - var observer = _a[_i]; - if (observer.error) { - observer.error(err); - } - } - }; - Subject.prototype.complete = function () { - for (var _i = 0, _a = this.observers; _i < _a.length; _i++) { - var observer = _a[_i]; - if (observer.complete) { - observer.complete(); - } - } - }; - Subject.prototype.subscribe = function (observer) { - this.observers.push(observer); - return new _Utils__WEBPACK_IMPORTED_MODULE_0__["SubjectSubscription"](this, observer); - }; - return Subject; -}()); - -//# sourceMappingURL=Subject.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/TextMessageFormat.js": -/*!*******************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/TextMessageFormat.js ***! - \*******************************************************************************************************************/ -/*! exports provided: TextMessageFormat */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextMessageFormat", function() { return TextMessageFormat; }); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -// Not exported from index -/** @private */ -var TextMessageFormat = /** @class */ (function () { - function TextMessageFormat() { - } - TextMessageFormat.write = function (output) { - return "" + output + TextMessageFormat.RecordSeparator; - }; - TextMessageFormat.parse = function (input) { - if (input[input.length - 1] !== TextMessageFormat.RecordSeparator) { - throw new Error("Message is incomplete."); - } - var messages = input.split(TextMessageFormat.RecordSeparator); - messages.pop(); - return messages; - }; - TextMessageFormat.RecordSeparatorCode = 0x1e; - TextMessageFormat.RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode); - return TextMessageFormat; -}()); - -//# sourceMappingURL=TextMessageFormat.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Utils.js": -/*!*******************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Utils.js ***! - \*******************************************************************************************************/ -/*! exports provided: Arg, Platform, getDataDetail, formatArrayBuffer, isArrayBuffer, sendMessage, createLogger, SubjectSubscription, ConsoleLogger */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Arg", function() { return Arg; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Platform", function() { return Platform; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDataDetail", function() { return getDataDetail; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatArrayBuffer", function() { return formatArrayBuffer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return isArrayBuffer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sendMessage", function() { return sendMessage; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLogger", function() { return createLogger; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SubjectSubscription", function() { return SubjectSubscription; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConsoleLogger", function() { return ConsoleLogger; }); -/* harmony import */ var _ILogger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ILogger */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ILogger.js"); -/* harmony import */ var _Loggers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Loggers */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Loggers.js"); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (undefined && undefined.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; - - -/** @private */ -var Arg = /** @class */ (function () { - function Arg() { - } - Arg.isRequired = function (val, name) { - if (val === null || val === undefined) { - throw new Error("The '" + name + "' argument is required."); - } - }; - Arg.isIn = function (val, values, name) { - // TypeScript enums have keys for **both** the name and the value of each enum member on the type itself. - if (!(val in values)) { - throw new Error("Unknown " + name + " value: " + val + "."); - } - }; - return Arg; -}()); - -/** @private */ -var Platform = /** @class */ (function () { - function Platform() { - } - Object.defineProperty(Platform, "isBrowser", { - get: function () { - return typeof window === "object"; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Platform, "isWebWorker", { - get: function () { - return typeof self === "object" && "importScripts" in self; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Platform, "isNode", { - get: function () { - return !this.isBrowser && !this.isWebWorker; - }, - enumerable: true, - configurable: true - }); - return Platform; -}()); - -/** @private */ -function getDataDetail(data, includeContent) { - var detail = ""; - if (isArrayBuffer(data)) { - detail = "Binary data of length " + data.byteLength; - if (includeContent) { - detail += ". Content: '" + formatArrayBuffer(data) + "'"; - } - } - else if (typeof data === "string") { - detail = "String data of length " + data.length; - if (includeContent) { - detail += ". Content: '" + data + "'"; - } - } - return detail; -} -/** @private */ -function formatArrayBuffer(data) { - var view = new Uint8Array(data); - // Uint8Array.map only supports returning another Uint8Array? - var str = ""; - view.forEach(function (num) { - var pad = num < 16 ? "0" : ""; - str += "0x" + pad + num.toString(16) + " "; - }); - // Trim of trailing space. - return str.substr(0, str.length - 1); -} -// Also in signalr-protocol-msgpack/Utils.ts -/** @private */ -function isArrayBuffer(val) { - return val && typeof ArrayBuffer !== "undefined" && - (val instanceof ArrayBuffer || - // Sometimes we get an ArrayBuffer that doesn't satisfy instanceof - (val.constructor && val.constructor.name === "ArrayBuffer")); -} -/** @private */ -function sendMessage(logger, transportName, httpClient, url, accessTokenFactory, content, logMessageContent) { - return __awaiter(this, void 0, void 0, function () { - var _a, headers, token, responseType, response; - return __generator(this, function (_b) { - switch (_b.label) { - case 0: - if (!accessTokenFactory) return [3 /*break*/, 2]; - return [4 /*yield*/, accessTokenFactory()]; - case 1: - token = _b.sent(); - if (token) { - headers = (_a = {}, - _a["Authorization"] = "Bearer " + token, - _a); - } - _b.label = 2; - case 2: - logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Trace, "(" + transportName + " transport) sending data. " + getDataDetail(content, logMessageContent) + "."); - responseType = isArrayBuffer(content) ? "arraybuffer" : "text"; - return [4 /*yield*/, httpClient.post(url, { - content: content, - headers: headers, - responseType: responseType, - })]; - case 3: - response = _b.sent(); - logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Trace, "(" + transportName + " transport) request complete. Response status: " + response.statusCode + "."); - return [2 /*return*/]; - } - }); - }); -} -/** @private */ -function createLogger(logger) { - if (logger === undefined) { - return new ConsoleLogger(_ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Information); - } - if (logger === null) { - return _Loggers__WEBPACK_IMPORTED_MODULE_1__["NullLogger"].instance; - } - if (logger.log) { - return logger; - } - return new ConsoleLogger(logger); -} -/** @private */ -var SubjectSubscription = /** @class */ (function () { - function SubjectSubscription(subject, observer) { - this.subject = subject; - this.observer = observer; - } - SubjectSubscription.prototype.dispose = function () { - var index = this.subject.observers.indexOf(this.observer); - if (index > -1) { - this.subject.observers.splice(index, 1); - } - if (this.subject.observers.length === 0 && this.subject.cancelCallback) { - this.subject.cancelCallback().catch(function (_) { }); - } - }; - return SubjectSubscription; -}()); - -/** @private */ -var ConsoleLogger = /** @class */ (function () { - function ConsoleLogger(minimumLogLevel) { - this.minimumLogLevel = minimumLogLevel; - this.outputConsole = console; - } - ConsoleLogger.prototype.log = function (logLevel, message) { - if (logLevel >= this.minimumLogLevel) { - switch (logLevel) { - case _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Critical: - case _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Error: - this.outputConsole.error("[" + new Date().toISOString() + "] " + _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"][logLevel] + ": " + message); - break; - case _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Warning: - this.outputConsole.warn("[" + new Date().toISOString() + "] " + _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"][logLevel] + ": " + message); - break; - case _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Information: - this.outputConsole.info("[" + new Date().toISOString() + "] " + _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"][logLevel] + ": " + message); - break; - default: - // console.debug only goes to attached debuggers in Node, so we use console.log for Trace and Debug - this.outputConsole.log("[" + new Date().toISOString() + "] " + _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"][logLevel] + ": " + message); - break; - } - } - }; - return ConsoleLogger; -}()); - -//# sourceMappingURL=Utils.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/WebSocketTransport.js": -/*!********************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/WebSocketTransport.js ***! - \********************************************************************************************************************/ -/*! exports provided: WebSocketTransport */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WebSocketTransport", function() { return WebSocketTransport; }); -/* harmony import */ var _ILogger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ILogger */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ILogger.js"); -/* harmony import */ var _ITransport__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ITransport */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ITransport.js"); -/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Utils */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Utils.js"); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (undefined && undefined.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; - - - -/** @private */ -var WebSocketTransport = /** @class */ (function () { - function WebSocketTransport(httpClient, accessTokenFactory, logger, logMessageContent, webSocketConstructor) { - this.logger = logger; - this.accessTokenFactory = accessTokenFactory; - this.logMessageContent = logMessageContent; - this.webSocketConstructor = webSocketConstructor; - this.httpClient = httpClient; - this.onreceive = null; - this.onclose = null; - } - WebSocketTransport.prototype.connect = function (url, transferFormat) { - return __awaiter(this, void 0, void 0, function () { - var token; - var _this = this; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _Utils__WEBPACK_IMPORTED_MODULE_2__["Arg"].isRequired(url, "url"); - _Utils__WEBPACK_IMPORTED_MODULE_2__["Arg"].isRequired(transferFormat, "transferFormat"); - _Utils__WEBPACK_IMPORTED_MODULE_2__["Arg"].isIn(transferFormat, _ITransport__WEBPACK_IMPORTED_MODULE_1__["TransferFormat"], "transferFormat"); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Trace, "(WebSockets transport) Connecting."); - if (!this.accessTokenFactory) return [3 /*break*/, 2]; - return [4 /*yield*/, this.accessTokenFactory()]; - case 1: - token = _a.sent(); - if (token) { - url += (url.indexOf("?") < 0 ? "?" : "&") + ("access_token=" + encodeURIComponent(token)); - } - _a.label = 2; - case 2: return [2 /*return*/, new Promise(function (resolve, reject) { - url = url.replace(/^http/, "ws"); - var webSocket; - var cookies = _this.httpClient.getCookieString(url); - if (_Utils__WEBPACK_IMPORTED_MODULE_2__["Platform"].isNode && cookies) { - // Only pass cookies when in non-browser environments - webSocket = new _this.webSocketConstructor(url, undefined, { - headers: { - Cookie: "" + cookies, - }, - }); - } - if (!webSocket) { - // Chrome is not happy with passing 'undefined' as protocol - webSocket = new _this.webSocketConstructor(url); - } - if (transferFormat === _ITransport__WEBPACK_IMPORTED_MODULE_1__["TransferFormat"].Binary) { - webSocket.binaryType = "arraybuffer"; - } - // tslint:disable-next-line:variable-name - webSocket.onopen = function (_event) { - _this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Information, "WebSocket connected to " + url + "."); - _this.webSocket = webSocket; - resolve(); - }; - webSocket.onerror = function (event) { - var error = null; - // ErrorEvent is a browser only type we need to check if the type exists before using it - if (typeof ErrorEvent !== "undefined" && event instanceof ErrorEvent) { - error = event.error; - } - reject(error); - }; - webSocket.onmessage = function (message) { - _this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Trace, "(WebSockets transport) data received. " + Object(_Utils__WEBPACK_IMPORTED_MODULE_2__["getDataDetail"])(message.data, _this.logMessageContent) + "."); - if (_this.onreceive) { - _this.onreceive(message.data); - } - }; - webSocket.onclose = function (event) { return _this.close(event); }; - })]; - } - }); - }); - }; - WebSocketTransport.prototype.send = function (data) { - if (this.webSocket && this.webSocket.readyState === this.webSocketConstructor.OPEN) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Trace, "(WebSockets transport) sending data. " + Object(_Utils__WEBPACK_IMPORTED_MODULE_2__["getDataDetail"])(data, this.logMessageContent) + "."); - this.webSocket.send(data); - return Promise.resolve(); - } - return Promise.reject("WebSocket is not in the OPEN state"); - }; - WebSocketTransport.prototype.stop = function () { - if (this.webSocket) { - // Clear websocket handlers because we are considering the socket closed now - this.webSocket.onclose = function () { }; - this.webSocket.onmessage = function () { }; - this.webSocket.onerror = function () { }; - this.webSocket.close(); - this.webSocket = undefined; - // Manually invoke onclose callback inline so we know the HttpConnection was closed properly before returning - // This also solves an issue where websocket.onclose could take 18+ seconds to trigger during network disconnects - this.close(undefined); - } - return Promise.resolve(); - }; - WebSocketTransport.prototype.close = function (event) { - // webSocket will be null if the transport did not start successfully - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Trace, "(WebSockets transport) socket closed."); - if (this.onclose) { - if (event && (event.wasClean === false || event.code !== 1000)) { - this.onclose(new Error("WebSocket closed with status code: " + event.code + " (" + event.reason + ").")); - } - else { - this.onclose(); - } - } - }; - return WebSocketTransport; -}()); - -//# sourceMappingURL=WebSocketTransport.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/XhrHttpClient.js": -/*!***************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/XhrHttpClient.js ***! - \***************************************************************************************************************/ -/*! exports provided: XhrHttpClient */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "XhrHttpClient", function() { return XhrHttpClient; }); -/* harmony import */ var _Errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Errors */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Errors.js"); -/* harmony import */ var _HttpClient__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./HttpClient */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HttpClient.js"); -/* harmony import */ var _ILogger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ILogger */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ILogger.js"); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); - - - -var XhrHttpClient = /** @class */ (function (_super) { - __extends(XhrHttpClient, _super); - function XhrHttpClient(logger) { - var _this = _super.call(this) || this; - _this.logger = logger; - return _this; - } - /** @inheritDoc */ - XhrHttpClient.prototype.send = function (request) { - var _this = this; - // Check that abort was not signaled before calling send - if (request.abortSignal && request.abortSignal.aborted) { - return Promise.reject(new _Errors__WEBPACK_IMPORTED_MODULE_0__["AbortError"]()); - } - if (!request.method) { - return Promise.reject(new Error("No method defined.")); - } - if (!request.url) { - return Promise.reject(new Error("No url defined.")); - } - return new Promise(function (resolve, reject) { - var xhr = new XMLHttpRequest(); - xhr.open(request.method, request.url, true); - xhr.withCredentials = true; - xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); - // Explicitly setting the Content-Type header for React Native on Android platform. - xhr.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"); - var headers = request.headers; - if (headers) { - Object.keys(headers) - .forEach(function (header) { - xhr.setRequestHeader(header, headers[header]); - }); - } - if (request.responseType) { - xhr.responseType = request.responseType; - } - if (request.abortSignal) { - request.abortSignal.onabort = function () { - xhr.abort(); - reject(new _Errors__WEBPACK_IMPORTED_MODULE_0__["AbortError"]()); - }; - } - if (request.timeout) { - xhr.timeout = request.timeout; - } - xhr.onload = function () { - if (request.abortSignal) { - request.abortSignal.onabort = null; - } - if (xhr.status >= 200 && xhr.status < 300) { - resolve(new _HttpClient__WEBPACK_IMPORTED_MODULE_1__["HttpResponse"](xhr.status, xhr.statusText, xhr.response || xhr.responseText)); - } - else { - reject(new _Errors__WEBPACK_IMPORTED_MODULE_0__["HttpError"](xhr.statusText, xhr.status)); - } - }; - xhr.onerror = function () { - _this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Warning, "Error from HTTP request. " + xhr.status + ": " + xhr.statusText + "."); - reject(new _Errors__WEBPACK_IMPORTED_MODULE_0__["HttpError"](xhr.statusText, xhr.status)); - }; - xhr.ontimeout = function () { - _this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Warning, "Timeout from HTTP request."); - reject(new _Errors__WEBPACK_IMPORTED_MODULE_0__["TimeoutError"]()); - }; - xhr.send(request.content || ""); - }); - }; - return XhrHttpClient; -}(_HttpClient__WEBPACK_IMPORTED_MODULE_1__["HttpClient"])); - -//# sourceMappingURL=XhrHttpClient.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/index.js": -/*!*******************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/index.js ***! - \*******************************************************************************************************/ -/*! exports provided: VERSION, AbortError, HttpError, TimeoutError, HttpClient, HttpResponse, DefaultHttpClient, HubConnection, HubConnectionState, HubConnectionBuilder, MessageType, LogLevel, HttpTransportType, TransferFormat, NullLogger, JsonHubProtocol, Subject */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; }); -/* harmony import */ var _Errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Errors */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Errors.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AbortError", function() { return _Errors__WEBPACK_IMPORTED_MODULE_0__["AbortError"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HttpError", function() { return _Errors__WEBPACK_IMPORTED_MODULE_0__["HttpError"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TimeoutError", function() { return _Errors__WEBPACK_IMPORTED_MODULE_0__["TimeoutError"]; }); - -/* harmony import */ var _HttpClient__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./HttpClient */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HttpClient.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HttpClient", function() { return _HttpClient__WEBPACK_IMPORTED_MODULE_1__["HttpClient"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HttpResponse", function() { return _HttpClient__WEBPACK_IMPORTED_MODULE_1__["HttpResponse"]; }); - -/* harmony import */ var _DefaultHttpClient__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./DefaultHttpClient */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/DefaultHttpClient.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DefaultHttpClient", function() { return _DefaultHttpClient__WEBPACK_IMPORTED_MODULE_2__["DefaultHttpClient"]; }); - -/* harmony import */ var _HubConnection__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./HubConnection */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HubConnection.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HubConnection", function() { return _HubConnection__WEBPACK_IMPORTED_MODULE_3__["HubConnection"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HubConnectionState", function() { return _HubConnection__WEBPACK_IMPORTED_MODULE_3__["HubConnectionState"]; }); - -/* harmony import */ var _HubConnectionBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./HubConnectionBuilder */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/HubConnectionBuilder.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HubConnectionBuilder", function() { return _HubConnectionBuilder__WEBPACK_IMPORTED_MODULE_4__["HubConnectionBuilder"]; }); - -/* harmony import */ var _IHubProtocol__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./IHubProtocol */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/IHubProtocol.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MessageType", function() { return _IHubProtocol__WEBPACK_IMPORTED_MODULE_5__["MessageType"]; }); - -/* harmony import */ var _ILogger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ILogger */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ILogger.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LogLevel", function() { return _ILogger__WEBPACK_IMPORTED_MODULE_6__["LogLevel"]; }); - -/* harmony import */ var _ITransport__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ITransport */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/ITransport.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HttpTransportType", function() { return _ITransport__WEBPACK_IMPORTED_MODULE_7__["HttpTransportType"]; }); - -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TransferFormat", function() { return _ITransport__WEBPACK_IMPORTED_MODULE_7__["TransferFormat"]; }); - -/* harmony import */ var _Loggers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Loggers */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Loggers.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NullLogger", function() { return _Loggers__WEBPACK_IMPORTED_MODULE_8__["NullLogger"]; }); - -/* harmony import */ var _JsonHubProtocol__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./JsonHubProtocol */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/JsonHubProtocol.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "JsonHubProtocol", function() { return _JsonHubProtocol__WEBPACK_IMPORTED_MODULE_9__["JsonHubProtocol"]; }); - -/* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Subject */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/@aspnet/signalr/dist/esm/Subject.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Subject", function() { return _Subject__WEBPACK_IMPORTED_MODULE_10__["Subject"]; }); - -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -// Version token that will be replaced by the prepack command -/** The version of the SignalR client. */ -var VERSION = "0.0.0-DEV_BUILD"; - - - - - - - - - - - -//# sourceMappingURL=index.js.map - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/bl/bl.js": -/*!******************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/bl/bl.js ***! - \******************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var DuplexStream = __webpack_require__(/*! readable-stream/duplex */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/duplex-browser.js") - , util = __webpack_require__(/*! util */ "../node_modules/util/util.js") - , Buffer = __webpack_require__(/*! safe-buffer */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/safe-buffer/index.js").Buffer - - -function BufferList (callback) { - if (!(this instanceof BufferList)) - return new BufferList(callback) - - this._bufs = [] - this.length = 0 - - if (typeof callback == 'function') { - this._callback = callback - - var piper = function piper (err) { - if (this._callback) { - this._callback(err) - this._callback = null - } - }.bind(this) - - this.on('pipe', function onPipe (src) { - src.on('error', piper) - }) - this.on('unpipe', function onUnpipe (src) { - src.removeListener('error', piper) - }) - } else { - this.append(callback) - } - - DuplexStream.call(this) -} - - -util.inherits(BufferList, DuplexStream) - - -BufferList.prototype._offset = function _offset (offset) { - var tot = 0, i = 0, _t - if (offset === 0) return [ 0, 0 ] - for (; i < this._bufs.length; i++) { - _t = tot + this._bufs[i].length - if (offset < _t || i == this._bufs.length - 1) - return [ i, offset - tot ] - tot = _t - } -} - - -BufferList.prototype.append = function append (buf) { - var i = 0 - - if (Buffer.isBuffer(buf)) { - this._appendBuffer(buf); - } else if (Array.isArray(buf)) { - for (; i < buf.length; i++) - this.append(buf[i]) - } else if (buf instanceof BufferList) { - // unwrap argument into individual BufferLists - for (; i < buf._bufs.length; i++) - this.append(buf._bufs[i]) - } else if (buf != null) { - // coerce number arguments to strings, since Buffer(number) does - // uninitialized memory allocation - if (typeof buf == 'number') - buf = buf.toString() - - this._appendBuffer(Buffer.from(buf)); - } - - return this -} - - -BufferList.prototype._appendBuffer = function appendBuffer (buf) { - this._bufs.push(buf) - this.length += buf.length -} - - -BufferList.prototype._write = function _write (buf, encoding, callback) { - this._appendBuffer(buf) - - if (typeof callback == 'function') - callback() -} - - -BufferList.prototype._read = function _read (size) { - if (!this.length) - return this.push(null) - - size = Math.min(size, this.length) - this.push(this.slice(0, size)) - this.consume(size) -} - - -BufferList.prototype.end = function end (chunk) { - DuplexStream.prototype.end.call(this, chunk) - - if (this._callback) { - this._callback(null, this.slice()) - this._callback = null - } -} - - -BufferList.prototype.get = function get (index) { - return this.slice(index, index + 1)[0] -} - - -BufferList.prototype.slice = function slice (start, end) { - if (typeof start == 'number' && start < 0) - start += this.length - if (typeof end == 'number' && end < 0) - end += this.length - return this.copy(null, 0, start, end) -} - - -BufferList.prototype.copy = function copy (dst, dstStart, srcStart, srcEnd) { - if (typeof srcStart != 'number' || srcStart < 0) - srcStart = 0 - if (typeof srcEnd != 'number' || srcEnd > this.length) - srcEnd = this.length - if (srcStart >= this.length) - return dst || Buffer.alloc(0) - if (srcEnd <= 0) - return dst || Buffer.alloc(0) - - var copy = !!dst - , off = this._offset(srcStart) - , len = srcEnd - srcStart - , bytes = len - , bufoff = (copy && dstStart) || 0 - , start = off[1] - , l - , i - - // copy/slice everything - if (srcStart === 0 && srcEnd == this.length) { - if (!copy) { // slice, but full concat if multiple buffers - return this._bufs.length === 1 - ? this._bufs[0] - : Buffer.concat(this._bufs, this.length) - } - - // copy, need to copy individual buffers - for (i = 0; i < this._bufs.length; i++) { - this._bufs[i].copy(dst, bufoff) - bufoff += this._bufs[i].length - } - - return dst - } - - // easy, cheap case where it's a subset of one of the buffers - if (bytes <= this._bufs[off[0]].length - start) { - return copy - ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) - : this._bufs[off[0]].slice(start, start + bytes) - } - - if (!copy) // a slice, we need something to copy in to - dst = Buffer.allocUnsafe(len) - - for (i = off[0]; i < this._bufs.length; i++) { - l = this._bufs[i].length - start - - if (bytes > l) { - this._bufs[i].copy(dst, bufoff, start) - } else { - this._bufs[i].copy(dst, bufoff, start, start + bytes) - break - } - - bufoff += l - bytes -= l - - if (start) - start = 0 - } - - return dst -} - -BufferList.prototype.shallowSlice = function shallowSlice (start, end) { - start = start || 0 - end = end || this.length - - if (start < 0) - start += this.length - if (end < 0) - end += this.length - - var startOffset = this._offset(start) - , endOffset = this._offset(end) - , buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1) - - if (endOffset[1] == 0) - buffers.pop() - else - buffers[buffers.length-1] = buffers[buffers.length-1].slice(0, endOffset[1]) - - if (startOffset[1] != 0) - buffers[0] = buffers[0].slice(startOffset[1]) - - return new BufferList(buffers) -} - -BufferList.prototype.toString = function toString (encoding, start, end) { - return this.slice(start, end).toString(encoding) -} - -BufferList.prototype.consume = function consume (bytes) { - while (this._bufs.length) { - if (bytes >= this._bufs[0].length) { - bytes -= this._bufs[0].length - this.length -= this._bufs[0].length - this._bufs.shift() - } else { - this._bufs[0] = this._bufs[0].slice(bytes) - this.length -= bytes - break - } - } - return this -} - - -BufferList.prototype.duplicate = function duplicate () { - var i = 0 - , copy = new BufferList() - - for (; i < this._bufs.length; i++) - copy.append(this._bufs[i]) - - return copy -} - - -BufferList.prototype.destroy = function destroy () { - this._bufs.length = 0 - this.length = 0 - this.push(null) -} - - -;(function () { - var methods = { - 'readDoubleBE' : 8 - , 'readDoubleLE' : 8 - , 'readFloatBE' : 4 - , 'readFloatLE' : 4 - , 'readInt32BE' : 4 - , 'readInt32LE' : 4 - , 'readUInt32BE' : 4 - , 'readUInt32LE' : 4 - , 'readInt16BE' : 2 - , 'readInt16LE' : 2 - , 'readUInt16BE' : 2 - , 'readUInt16LE' : 2 - , 'readInt8' : 1 - , 'readUInt8' : 1 - } - - for (var m in methods) { - (function (m) { - BufferList.prototype[m] = function (offset) { - return this.slice(offset, offset + methods[m])[m](0) - } - }(m)) - } -}()) - - -module.exports = BufferList - - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/core-util-is/lib/util.js": -/*!**********************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/core-util-is/lib/util.js ***! - \**********************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(Buffer) {// 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 objectToString(arg) === '[object Array]'; -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = Buffer.isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../buffer/index.js */ "../node_modules/buffer/index.js").Buffer)) - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/inherits/inherits_browser.js": -/*!**************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/inherits/inherits_browser.js ***! - \**************************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, 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 inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } -} - - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/isarray/index.js": -/*!**************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/isarray/index.js ***! - \**************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -var toString = {}.toString; - -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; - - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/msgpack5/index.js": -/*!***************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/msgpack5/index.js ***! - \***************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var Buffer = __webpack_require__(/*! safe-buffer */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/safe-buffer/index.js").Buffer -var assert = __webpack_require__(/*! assert */ "../node_modules/assert/assert.js") -var bl = __webpack_require__(/*! bl */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/bl/bl.js") -var streams = __webpack_require__(/*! ./lib/streams */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/msgpack5/lib/streams.js") -var buildDecode = __webpack_require__(/*! ./lib/decoder */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/msgpack5/lib/decoder.js") -var buildEncode = __webpack_require__(/*! ./lib/encoder */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/msgpack5/lib/encoder.js") - -function msgpack (options) { - var encodingTypes = [] - var decodingTypes = [] - - options = options || { - forceFloat64: false, - compatibilityMode: false, - disableTimestampEncoding: false // if true, skips encoding Dates using the msgpack timestamp ext format (-1) - } - - function registerEncoder (check, encode) { - assert(check, 'must have an encode function') - assert(encode, 'must have an encode function') - - encodingTypes.push({ - check: check, encode: encode - }) - - return this - } - - function registerDecoder (type, decode) { - assert(type >= 0, 'must have a non-negative type') - assert(decode, 'must have a decode function') - - decodingTypes.push({ - type: type, decode: decode - }) - - return this - } - - function register (type, constructor, encode, decode) { - assert(constructor, 'must have a constructor') - assert(encode, 'must have an encode function') - assert(type >= 0, 'must have a non-negative type') - assert(decode, 'must have a decode function') - - function check (obj) { - return (obj instanceof constructor) - } - - function reEncode (obj) { - var buf = bl() - var header = Buffer.allocUnsafe(1) - - header.writeInt8(type, 0) - - buf.append(header) - buf.append(encode(obj)) - - return buf - } - - this.registerEncoder(check, reEncode) - this.registerDecoder(type, decode) - - return this - } - - return { - encode: buildEncode(encodingTypes, options.forceFloat64, options.compatibilityMode, options.disableTimestampEncoding), - decode: buildDecode(decodingTypes), - register: register, - registerEncoder: registerEncoder, - registerDecoder: registerDecoder, - encoder: streams.encoder, - decoder: streams.decoder, - // needed for levelup support - buffer: true, - type: 'msgpack5', - IncompleteBufferError: buildDecode.IncompleteBufferError - } -} - -module.exports = msgpack - - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/msgpack5/lib/decoder.js": -/*!*********************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/msgpack5/lib/decoder.js ***! - \*********************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var bl = __webpack_require__(/*! bl */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/bl/bl.js") -var util = __webpack_require__(/*! util */ "../node_modules/util/util.js") - -function IncompleteBufferError (message) { - Error.call(this) // super constructor - if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor) // super helper method to include stack trace in error object - } - this.name = this.constructor.name - this.message = message || 'unable to decode' -} - -util.inherits(IncompleteBufferError, Error) - -module.exports = function buildDecode (decodingTypes) { - return decode - - function getSize (first) { - switch (first) { - case 0xc4: - return 2 - case 0xc5: - return 3 - case 0xc6: - return 5 - case 0xc7: - return 3 - case 0xc8: - return 4 - case 0xc9: - return 6 - case 0xca: - return 5 - case 0xcb: - return 9 - case 0xcc: - return 2 - case 0xcd: - return 3 - case 0xce: - return 5 - case 0xcf: - return 9 - case 0xd0: - return 2 - case 0xd1: - return 3 - case 0xd2: - return 5 - case 0xd3: - return 9 - case 0xd4: - return 3 - case 0xd5: - return 4 - case 0xd6: - return 6 - case 0xd7: - return 10 - case 0xd8: - return 18 - case 0xd9: - return 2 - case 0xda: - return 3 - case 0xdb: - return 5 - case 0xde: - return 3 - default: - return -1 - } - } - - function hasMinBufferSize (first, length) { - var size = getSize(first) - - if (size !== -1 && length < size) { - return false - } else { - return true - } - } - - function isValidDataSize (dataLength, bufLength, headerLength) { - return bufLength >= headerLength + dataLength - } - - function buildDecodeResult (value, bytesConsumed) { - return { - value: value, - bytesConsumed: bytesConsumed - } - } - - function decode (buf) { - if (!(buf instanceof bl)) { - buf = bl().append(buf) - } - - var result = tryDecode(buf) - if (result) { - buf.consume(result.bytesConsumed) - return result.value - } else { - throw new IncompleteBufferError() - } - } - - function tryDecode (buf, offset) { - offset = offset === undefined ? 0 : offset - var bufLength = buf.length - offset - if (bufLength <= 0) { - return null - } - - var first = buf.readUInt8(offset) - var length - var result = 0 - var type - var bytePos - - if (!hasMinBufferSize(first, bufLength)) { - return null - } - - switch (first) { - case 0xc0: - return buildDecodeResult(null, 1) - case 0xc2: - return buildDecodeResult(false, 1) - case 0xc3: - return buildDecodeResult(true, 1) - case 0xcc: - // 1-byte unsigned int - result = buf.readUInt8(offset + 1) - return buildDecodeResult(result, 2) - case 0xcd: - // 2-bytes BE unsigned int - result = buf.readUInt16BE(offset + 1) - return buildDecodeResult(result, 3) - case 0xce: - // 4-bytes BE unsigned int - result = buf.readUInt32BE(offset + 1) - return buildDecodeResult(result, 5) - case 0xcf: - // 8-bytes BE unsigned int - // Read long byte by byte, big-endian - for (bytePos = 7; bytePos >= 0; bytePos--) { - result += (buf.readUInt8(offset + bytePos + 1) * Math.pow(2, (8 * (7 - bytePos)))) - } - return buildDecodeResult(result, 9) - case 0xd0: - // 1-byte signed int - result = buf.readInt8(offset + 1) - return buildDecodeResult(result, 2) - case 0xd1: - // 2-bytes signed int - result = buf.readInt16BE(offset + 1) - return buildDecodeResult(result, 3) - case 0xd2: - // 4-bytes signed int - result = buf.readInt32BE(offset + 1) - return buildDecodeResult(result, 5) - case 0xd3: - result = readInt64BE(buf.slice(offset + 1, offset + 9), 0) - return buildDecodeResult(result, 9) - case 0xca: - // 4-bytes float - result = buf.readFloatBE(offset + 1) - return buildDecodeResult(result, 5) - case 0xcb: - // 8-bytes double - result = buf.readDoubleBE(offset + 1) - return buildDecodeResult(result, 9) - case 0xd9: - // strings up to 2^8 - 1 bytes - length = buf.readUInt8(offset + 1) - if (!isValidDataSize(length, bufLength, 2)) { - return null - } - result = buf.toString('utf8', offset + 2, offset + 2 + length) - return buildDecodeResult(result, 2 + length) - case 0xda: - // strings up to 2^16 - 2 bytes - length = buf.readUInt16BE(offset + 1) - if (!isValidDataSize(length, bufLength, 3)) { - return null - } - result = buf.toString('utf8', offset + 3, offset + 3 + length) - return buildDecodeResult(result, 3 + length) - case 0xdb: - // strings up to 2^32 - 4 bytes - length = buf.readUInt32BE(offset + 1) - if (!isValidDataSize(length, bufLength, 5)) { - return null - } - result = buf.toString('utf8', offset + 5, offset + 5 + length) - return buildDecodeResult(result, 5 + length) - case 0xc4: - // buffers up to 2^8 - 1 bytes - length = buf.readUInt8(offset + 1) - if (!isValidDataSize(length, bufLength, 2)) { - return null - } - result = buf.slice(offset + 2, offset + 2 + length) - return buildDecodeResult(result, 2 + length) - case 0xc5: - // buffers up to 2^16 - 1 bytes - length = buf.readUInt16BE(offset + 1) - if (!isValidDataSize(length, bufLength, 3)) { - return null - } - result = buf.slice(offset + 3, offset + 3 + length) - return buildDecodeResult(result, 3 + length) - case 0xc6: - // buffers up to 2^32 - 1 bytes - length = buf.readUInt32BE(offset + 1) - if (!isValidDataSize(length, bufLength, 5)) { - return null - } - result = buf.slice(offset + 5, offset + 5 + length) - return buildDecodeResult(result, 5 + length) - case 0xdc: - // array up to 2^16 elements - 2 bytes - if (bufLength < 3) { - return null - } - - length = buf.readUInt16BE(offset + 1) - return decodeArray(buf, offset, length, 3) - case 0xdd: - // array up to 2^32 elements - 4 bytes - if (bufLength < 5) { - return null - } - - length = buf.readUInt32BE(offset + 1) - return decodeArray(buf, offset, length, 5) - case 0xde: - // maps up to 2^16 elements - 2 bytes - length = buf.readUInt16BE(offset + 1) - return decodeMap(buf, offset, length, 3) - case 0xdf: - throw new Error('map too big to decode in JS') - case 0xd4: - return decodeFixExt(buf, offset, 1) - case 0xd5: - return decodeFixExt(buf, offset, 2) - case 0xd6: - return decodeFixExt(buf, offset, 4) - case 0xd7: - return decodeFixExt(buf, offset, 8) - case 0xd8: - return decodeFixExt(buf, offset, 16) - case 0xc7: - // ext up to 2^8 - 1 bytes - length = buf.readUInt8(offset + 1) - type = buf.readUInt8(offset + 2) - if (!isValidDataSize(length, bufLength, 3)) { - return null - } - return decodeExt(buf, offset, type, length, 3) - case 0xc8: - // ext up to 2^16 - 1 bytes - length = buf.readUInt16BE(offset + 1) - type = buf.readUInt8(offset + 3) - if (!isValidDataSize(length, bufLength, 4)) { - return null - } - return decodeExt(buf, offset, type, length, 4) - case 0xc9: - // ext up to 2^32 - 1 bytes - length = buf.readUInt32BE(offset + 1) - type = buf.readUInt8(offset + 5) - if (!isValidDataSize(length, bufLength, 6)) { - return null - } - return decodeExt(buf, offset, type, length, 6) - } - - if ((first & 0xf0) === 0x90) { - // we have an array with less than 15 elements - length = first & 0x0f - return decodeArray(buf, offset, length, 1) - } else if ((first & 0xf0) === 0x80) { - // we have a map with less than 15 elements - length = first & 0x0f - return decodeMap(buf, offset, length, 1) - } else if ((first & 0xe0) === 0xa0) { - // fixstr up to 31 bytes - length = first & 0x1f - if (isValidDataSize(length, bufLength, 1)) { - result = buf.toString('utf8', offset + 1, offset + length + 1) - return buildDecodeResult(result, length + 1) - } else { - return null - } - } else if (first >= 0xe0) { - // 5 bits negative ints - result = first - 0x100 - return buildDecodeResult(result, 1) - } else if (first < 0x80) { - // 7-bits positive ints - return buildDecodeResult(first, 1) - } else { - throw new Error('not implemented yet') - } - } - - function readInt64BE (buf, offset) { - var negate = (buf[offset] & 0x80) == 0x80 // eslint-disable-line - - if (negate) { - var carry = 1 - for (var i = offset + 7; i >= offset; i--) { - var v = (buf[i] ^ 0xff) + carry - buf[i] = v & 0xff - carry = v >> 8 - } - } - - var hi = buf.readUInt32BE(offset + 0) - var lo = buf.readUInt32BE(offset + 4) - return (hi * 4294967296 + lo) * (negate ? -1 : +1) - } - - function decodeArray (buf, offset, length, headerLength) { - var result = [] - var i - var totalBytesConsumed = 0 - - offset += headerLength - for (i = 0; i < length; i++) { - var decodeResult = tryDecode(buf, offset) - if (decodeResult) { - result.push(decodeResult.value) - offset += decodeResult.bytesConsumed - totalBytesConsumed += decodeResult.bytesConsumed - } else { - return null - } - } - return buildDecodeResult(result, headerLength + totalBytesConsumed) - } - - function decodeMap (buf, offset, length, headerLength) { - var result = {} - var key - var i - var totalBytesConsumed = 0 - - offset += headerLength - for (i = 0; i < length; i++) { - var keyResult = tryDecode(buf, offset) - if (keyResult) { - offset += keyResult.bytesConsumed - var valueResult = tryDecode(buf, offset) - if (valueResult) { - key = keyResult.value - result[key] = valueResult.value - offset += valueResult.bytesConsumed - totalBytesConsumed += (keyResult.bytesConsumed + valueResult.bytesConsumed) - } else { - return null - } - } else { - return null - } - } - return buildDecodeResult(result, headerLength + totalBytesConsumed) - } - - function decodeFixExt (buf, offset, size) { - var type = buf.readInt8(offset + 1) // Signed - return decodeExt(buf, offset, type, size, 2) - } - function decodeTimestamp (buf, size, headerSize) { - var seconds, nanoseconds - nanoseconds = 0 - - switch (size) { - case 4: - // timestamp 32 stores the number of seconds that have elapsed since 1970-01-01 00:00:00 UTC in an 32-bit unsigned integer - seconds = buf.readUInt32BE(0) - break - - case 8: // Timestamp 64 stores the number of seconds and nanoseconds that have elapsed - // since 1970-01-01 00:00:00 UTC in 32-bit unsigned integers, split 30/34 bits - var upper = buf.readUInt32BE(0) - var lower = buf.readUInt32BE(4) - nanoseconds = upper / 4 - seconds = ((upper & 0x03) * Math.pow(2, 32)) + lower // If we use bitwise operators, we get truncated to 32bits - break - - case 12: - throw new Error('timestamp 96 is not yet implemented') - } - - var millis = (seconds * 1000) + Math.round(nanoseconds / 1E6) - return buildDecodeResult(new Date(millis), size + headerSize) - } - - function decodeExt (buf, offset, type, size, headerSize) { - var i, - toDecode - - offset += headerSize - - // Pre-defined - if (type < 0) { // Reserved for future extensions - switch (type) { - case -1: // Tiemstamp https://github.com/msgpack/msgpack/blob/master/spec.md#timestamp-extension-type - toDecode = buf.slice(offset, offset + size) - return decodeTimestamp(toDecode, size, headerSize) - } - } - - for (i = 0; i < decodingTypes.length; i++) { - if (type === decodingTypes[i].type) { - toDecode = buf.slice(offset, offset + size) - var value = decodingTypes[i].decode(toDecode) - return buildDecodeResult(value, headerSize + size) - } - } - - throw new Error('unable to find ext type ' + type) - } -} - -module.exports.IncompleteBufferError = IncompleteBufferError - - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/msgpack5/lib/encoder.js": -/*!*********************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/msgpack5/lib/encoder.js ***! - \*********************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var Buffer = __webpack_require__(/*! safe-buffer */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/safe-buffer/index.js").Buffer -var bl = __webpack_require__(/*! bl */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/bl/bl.js") -var TOLERANCE = 0.1 - -module.exports = function buildEncode (encodingTypes, forceFloat64, compatibilityMode, disableTimestampEncoding) { - function encode (obj, avoidSlice) { - var buf, - len - - if (obj === undefined) { - throw new Error('undefined is not encodable in msgpack!') - } else if (obj === null) { - buf = Buffer.allocUnsafe(1) - buf[0] = 0xc0 - } else if (obj === true) { - buf = Buffer.allocUnsafe(1) - buf[0] = 0xc3 - } else if (obj === false) { - buf = Buffer.allocUnsafe(1) - buf[0] = 0xc2 - } else if (typeof obj === 'string') { - len = Buffer.byteLength(obj) - if (len < 32) { - buf = Buffer.allocUnsafe(1 + len) - buf[0] = 0xa0 | len - if (len > 0) { - buf.write(obj, 1) - } - } else if (len <= 0xff && !compatibilityMode) { - // str8, but only when not in compatibility mode - buf = Buffer.allocUnsafe(2 + len) - buf[0] = 0xd9 - buf[1] = len - buf.write(obj, 2) - } else if (len <= 0xffff) { - buf = Buffer.allocUnsafe(3 + len) - buf[0] = 0xda - buf.writeUInt16BE(len, 1) - buf.write(obj, 3) - } else { - buf = Buffer.allocUnsafe(5 + len) - buf[0] = 0xdb - buf.writeUInt32BE(len, 1) - buf.write(obj, 5) - } - } else if (obj && (obj.readUInt32LE || obj instanceof Uint8Array)) { - if (obj instanceof Uint8Array) { - obj = Buffer.from(obj) - } - // weird hack to support Buffer - // and Buffer-like objects - if (obj.length <= 0xff) { - buf = Buffer.allocUnsafe(2) - buf[0] = 0xc4 - buf[1] = obj.length - } else if (obj.length <= 0xffff) { - buf = Buffer.allocUnsafe(3) - buf[0] = 0xc5 - buf.writeUInt16BE(obj.length, 1) - } else { - buf = Buffer.allocUnsafe(5) - buf[0] = 0xc6 - buf.writeUInt32BE(obj.length, 1) - } - - buf = bl([buf, obj]) - } else if (Array.isArray(obj)) { - if (obj.length < 16) { - buf = Buffer.allocUnsafe(1) - buf[0] = 0x90 | obj.length - } else if (obj.length < 65536) { - buf = Buffer.allocUnsafe(3) - buf[0] = 0xdc - buf.writeUInt16BE(obj.length, 1) - } else { - buf = Buffer.allocUnsafe(5) - buf[0] = 0xdd - buf.writeUInt32BE(obj.length, 1) - } - - buf = obj.reduce(function (acc, obj) { - acc.append(encode(obj, true)) - return acc - }, bl().append(buf)) - } else if (!disableTimestampEncoding && typeof obj.getDate === 'function') { - return encodeDate(obj) - } else if (typeof obj === 'object') { - buf = encodeExt(obj) || encodeObject(obj) - } else if (typeof obj === 'number') { - if (isFloat(obj)) { - return encodeFloat(obj, forceFloat64) - } else if (obj >= 0) { - if (obj < 128) { - buf = Buffer.allocUnsafe(1) - buf[0] = obj - } else if (obj < 256) { - buf = Buffer.allocUnsafe(2) - buf[0] = 0xcc - buf[1] = obj - } else if (obj < 65536) { - buf = Buffer.allocUnsafe(3) - buf[0] = 0xcd - buf.writeUInt16BE(obj, 1) - } else if (obj <= 0xffffffff) { - buf = Buffer.allocUnsafe(5) - buf[0] = 0xce - buf.writeUInt32BE(obj, 1) - } else if (obj <= 9007199254740991) { - buf = Buffer.allocUnsafe(9) - buf[0] = 0xcf - write64BitUint(buf, obj) - } else { - return encodeFloat(obj, true) - } - } else { - if (obj >= -32) { - buf = Buffer.allocUnsafe(1) - buf[0] = 0x100 + obj - } else if (obj >= -128) { - buf = Buffer.allocUnsafe(2) - buf[0] = 0xd0 - buf.writeInt8(obj, 1) - } else if (obj >= -32768) { - buf = Buffer.allocUnsafe(3) - buf[0] = 0xd1 - buf.writeInt16BE(obj, 1) - } else if (obj > -214748365) { - buf = Buffer.allocUnsafe(5) - buf[0] = 0xd2 - buf.writeInt32BE(obj, 1) - } else if (obj >= -9007199254740991) { - buf = Buffer.allocUnsafe(9) - buf[0] = 0xd3 - write64BitInt(buf, 1, obj) - } else { - return encodeFloat(obj, true) - } - } - } - - if (!buf) { - throw new Error('not implemented yet') - } - - if (avoidSlice) { - return buf - } else { - return buf.slice() - } - } - - function encodeDate (dt) { - var encoded - var millis = dt * 1 - var seconds = Math.floor(millis / 1000) - var nanos = (millis - (seconds * 1000)) * 1E6 - - if (nanos || seconds > 0xFFFFFFFF) { - // Timestamp64 - encoded = new Buffer(10) - encoded[0] = 0xd7 - encoded[1] = -1 - - var upperNanos = ((nanos * 4)) - var upperSeconds = seconds / Math.pow(2, 32) - var upper = (upperNanos + upperSeconds) & 0xFFFFFFFF - var lower = seconds & 0xFFFFFFFF - - encoded.writeInt32BE(upper, 2) - encoded.writeInt32BE(lower, 6) - } else { - // Timestamp32 - encoded = new Buffer(6) - encoded[0] = 0xd6 - encoded[1] = -1 - encoded.writeUInt32BE(Math.floor(millis / 1000), 2) - } - return bl().append(encoded) - } - - function encodeExt (obj) { - var i - var encoded - var length = -1 - var headers = [] - - for (i = 0; i < encodingTypes.length; i++) { - if (encodingTypes[i].check(obj)) { - encoded = encodingTypes[i].encode(obj) - break - } - } - - if (!encoded) { - return null - } - - // we subtract 1 because the length does not - // include the type - length = encoded.length - 1 - - if (length === 1) { - headers.push(0xd4) - } else if (length === 2) { - headers.push(0xd5) - } else if (length === 4) { - headers.push(0xd6) - } else if (length === 8) { - headers.push(0xd7) - } else if (length === 16) { - headers.push(0xd8) - } else if (length < 256) { - headers.push(0xc7) - headers.push(length) - } else if (length < 0x10000) { - headers.push(0xc8) - headers.push(length >> 8) - headers.push(length & 0x00ff) - } else { - headers.push(0xc9) - headers.push(length >> 24) - headers.push((length >> 16) & 0x000000ff) - headers.push((length >> 8) & 0x000000ff) - headers.push(length & 0x000000ff) - } - - return bl().append(Buffer.from(headers)).append(encoded) - } - - function encodeObject (obj) { - var acc = [] - var length = 0 - var key - var header - - for (key in obj) { - if (obj.hasOwnProperty(key) && - obj[key] !== undefined && - typeof obj[key] !== 'function') { - ++length - acc.push(encode(key, true)) - acc.push(encode(obj[key], true)) - } - } - - if (length < 16) { - header = Buffer.allocUnsafe(1) - header[0] = 0x80 | length - } else { - header = Buffer.allocUnsafe(3) - header[0] = 0xde - header.writeUInt16BE(length, 1) - } - - acc.unshift(header) - - var result = acc.reduce(function (list, buf) { - return list.append(buf) - }, bl()) - - return result - } - - return encode -} - -function write64BitUint (buf, obj) { - // Write long byte by byte, in big-endian order - for (var currByte = 7; currByte >= 0; currByte--) { - buf[currByte + 1] = (obj & 0xff) - obj = obj / 256 - } -} - -function write64BitInt (buf, offset, num) { - var negate = num < 0 - - if (negate) { - num = Math.abs(num) - } - - var lo = num % 4294967296 - var hi = num / 4294967296 - buf.writeUInt32BE(Math.floor(hi), offset + 0) - buf.writeUInt32BE(lo, offset + 4) - - if (negate) { - var carry = 1 - for (var i = offset + 7; i >= offset; i--) { - var v = (buf[i] ^ 0xff) + carry - buf[i] = v & 0xff - carry = v >> 8 - } - } -} - -function isFloat (n) { - return n !== Math.floor(n) -} - -function encodeFloat (obj, forceFloat64) { - var buf - - buf = Buffer.allocUnsafe(5) - buf[0] = 0xca - buf.writeFloatBE(obj, 1) - - // FIXME is there a way to check if a - // value fits in a float? - if (forceFloat64 || Math.abs(obj - buf.readFloatBE(1)) > TOLERANCE) { - buf = Buffer.allocUnsafe(9) - buf[0] = 0xcb - buf.writeDoubleBE(obj, 1) - } - - return buf -} - - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/msgpack5/lib/streams.js": -/*!*********************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/msgpack5/lib/streams.js ***! - \*********************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var Transform = __webpack_require__(/*! readable-stream */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/readable-browser.js").Transform -var inherits = __webpack_require__(/*! inherits */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/inherits/inherits_browser.js") -var bl = __webpack_require__(/*! bl */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/bl/bl.js") - -function Base (opts) { - opts = opts || {} - - opts.objectMode = true - opts.highWaterMark = 16 - - Transform.call(this, opts) - - this._msgpack = opts.msgpack -} - -inherits(Base, Transform) - -function Encoder (opts) { - if (!(this instanceof Encoder)) { - opts = opts || {} - opts.msgpack = this - return new Encoder(opts) - } - - Base.call(this, opts) -} - -inherits(Encoder, Base) - -Encoder.prototype._transform = function (obj, enc, done) { - var buf = null - - try { - buf = this._msgpack.encode(obj).slice(0) - } catch (err) { - this.emit('error', err) - return done() - } - - this.push(buf) - done() -} - -function Decoder (opts) { - if (!(this instanceof Decoder)) { - opts = opts || {} - opts.msgpack = this - return new Decoder(opts) - } - - Base.call(this, opts) - - this._chunks = bl() -} - -inherits(Decoder, Base) - -Decoder.prototype._transform = function (buf, enc, done) { - if (buf) { - this._chunks.append(buf) - } - - try { - var result = this._msgpack.decode(this._chunks) - this.push(result) - } catch (err) { - if (err instanceof this._msgpack.IncompleteBufferError) { - done() - } else { - this.emit('error', err) - } - return - } - - if (this._chunks.length > 0) { - this._transform(null, enc, done) - } else { - done() - } -} - -module.exports.decoder = Decoder -module.exports.encoder = Encoder - - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/process-nextick-args/index.js": -/*!***************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/process-nextick-args/index.js ***! - \***************************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(process) { - -if (!process.version || - process.version.indexOf('v0.') === 0 || - process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { - module.exports = { nextTick: nextTick }; -} else { - module.exports = process -} - -function nextTick(fn, arg1, arg2, arg3) { - if (typeof fn !== 'function') { - 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 afterTickOne() { - fn.call(null, arg1); - }); - case 3: - return process.nextTick(function afterTickTwo() { - fn.call(null, arg1, arg2); - }); - case 4: - return process.nextTick(function afterTickThree() { - 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 afterTick() { - fn.apply(null, args); - }); - } -} - - -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../process/browser.js */ "../node_modules/process/browser.js"))) - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/duplex-browser.js": -/*!*******************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/duplex-browser.js ***! - \*******************************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = __webpack_require__(/*! ./lib/_stream_duplex.js */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_duplex.js"); - - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_duplex.js": -/*!***********************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_duplex.js ***! - \***********************************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, 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__(/*! process-nextick-args */ "../node_modules/@aspnet/signalr-protocol-msgpack/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 = __webpack_require__(/*! core-util-is */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/core-util-is/lib/util.js"); -util.inherits = __webpack_require__(/*! inherits */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/inherits/inherits_browser.js"); -/**/ - -var Readable = __webpack_require__(/*! ./_stream_readable */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_readable.js"); -var Writable = __webpack_require__(/*! ./_stream_writable */ "../node_modules/@aspnet/signalr-protocol-msgpack/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 && options.readable === false) this.readable = false; - - if (options && options.writable === false) this.writable = false; - - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) 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(self) { - self.end(); -} - -Object.defineProperty(Duplex.prototype, 'destroyed', { - get: function () { - if (this._readableState === undefined || this._writableState === undefined) { - 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 (this._readableState === undefined || this._writableState === undefined) { - 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/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_passthrough.js": -/*!****************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_passthrough.js ***! - \****************************************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, 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__(/*! ./_stream_transform */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_transform.js"); - -/**/ -var util = __webpack_require__(/*! core-util-is */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/core-util-is/lib/util.js"); -util.inherits = __webpack_require__(/*! inherits */ "../node_modules/@aspnet/signalr-protocol-msgpack/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/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_readable.js": -/*!*************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_readable.js ***! - \*************************************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(global, process) {// 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__(/*! process-nextick-args */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/process-nextick-args/index.js"); -/**/ - -module.exports = Readable; - -/**/ -var isArray = __webpack_require__(/*! isarray */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/isarray/index.js"); -/**/ - -/**/ -var Duplex; -/**/ - -Readable.ReadableState = ReadableState; - -/**/ -var EE = __webpack_require__(/*! events */ "../node_modules/events/events.js").EventEmitter; - -var EElistenerCount = function (emitter, type) { - return emitter.listeners(type).length; -}; -/**/ - -/**/ -var Stream = __webpack_require__(/*! ./internal/streams/stream */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/internal/streams/stream-browser.js"); -/**/ - -/**/ - -var Buffer = __webpack_require__(/*! safe-buffer */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/safe-buffer/index.js").Buffer; -var OurUint8Array = global.Uint8Array || function () {}; -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} - -/**/ - -/**/ -var util = __webpack_require__(/*! core-util-is */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/core-util-is/lib/util.js"); -util.inherits = __webpack_require__(/*! inherits */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/inherits/inherits_browser.js"); -/**/ - -/**/ -var debugUtil = __webpack_require__(/*! util */ 0); -var debug = void 0; -if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog('stream'); -} else { - debug = function () {}; -} -/**/ - -var BufferList = __webpack_require__(/*! ./internal/streams/BufferList */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/internal/streams/BufferList.js"); -var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ "../node_modules/@aspnet/signalr-protocol-msgpack/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 (typeof emitter.prependListener === 'function') 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]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; -} - -function ReadableState(options, stream) { - Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "../node_modules/@aspnet/signalr-protocol-msgpack/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 : 16 * 1024; - - if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) 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__(/*! string_decoder/ */ "../node_modules/string_decoder/lib/string_decoder.js").StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} - -function Readable(options) { - Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "../node_modules/@aspnet/signalr-protocol-msgpack/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 (typeof options.read === 'function') this._read = options.read; - - if (typeof options.destroy === 'function') this._destroy = options.destroy; - } - - Stream.call(this); -} - -Object.defineProperty(Readable.prototype, 'destroyed', { - get: function () { - if (this._readableState === undefined) { - 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) { - if (typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = Buffer.from(chunk, encoding); - encoding = ''; - } - skipChunkCheck = true; - } - } else { - 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 (chunk === null) { - 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 (typeof chunk !== 'string' && !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 || chunk.length !== 0) 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 && state.length === 0 && !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) && typeof chunk !== 'string' && chunk !== undefined && !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 || state.length === 0); -} - -Readable.prototype.isPaused = function () { - return this._readableState.flowing === false; -}; - -// backwards compatibility. -Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = __webpack_require__(/*! string_decoder/ */ "../node_modules/string_decoder/lib/string_decoder.js").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 || state.length === 0 && 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;else 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 (n !== 0) 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 (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && 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 (n === 0 && state.ended) { - if (state.length === 0) 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 (state.length === 0 || 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 (state.length === 0) 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; - if (n > 0) ret = fromList(n, state);else ret = null; - - if (ret === null) { - state.needReadable = true; - n = 0; - } else { - state.length -= n; - } - - if (state.length === 0) { - // 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 (ret !== null) 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) - // didn't get any data, stop spinning. - break;else 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 || pipeOpts.end !== false) && 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 && unpipeInfo.hasUnpiped === false) { - 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 ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug('false write response, pause', src._readableState.awaitDrain); - src._readableState.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 (EElistenerCount(dest, 'error') === 0) 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 (state.awaitDrain === 0 && 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 (state.pipesCount === 0) return this; - - // just one destination. most common case. - if (state.pipesCount === 1) { - // 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, unpipeInfo); - }return this; - } - - // try to find the right one. - var index = indexOf(state.pipes, dest); - if (index === -1) return this; - - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) 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 (ev === 'data') { - // Start flowing on next tick if stream isn't explicitly paused - if (this._readableState.flowing !== false) this.resume(); - } else if (ev === 'readable') { - var state = this._readableState; - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.emittedReadable = false; - if (!state.reading) { - pna.nextTick(nReadingNextTick, this); - } else if (state.length) { - emitReadable(this); - } - } - } - - return res; -}; -Readable.prototype.addListener = Readable.prototype.on; - -function nReadingNextTick(self) { - debug('readable nexttick read 0'); - self.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 && stream.read() !== null) {} -} - -// 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 && (chunk === null || chunk === undefined)) return;else 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 (this[i] === undefined && typeof stream[i] === 'function') { - 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 (state.length === 0) return null; - - var ret; - if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { - // read it all, truncate the list - if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = 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 if (n === list.head.data.length) { - // first chunk is a perfect match - ret = list.shift(); - } else { - // result spans more than one buffer - ret = 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 (n === 0) { - 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 (n === 0) { - 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 && state.length === 0) { - 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; -} -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ "../node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../../../../../process/browser.js */ "../node_modules/process/browser.js"))) - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_transform.js": -/*!**************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_transform.js ***! - \**************************************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, 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__(/*! ./_stream_duplex */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_duplex.js"); - -/**/ -var util = __webpack_require__(/*! core-util-is */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/core-util-is/lib/util.js"); -util.inherits = __webpack_require__(/*! inherits */ "../node_modules/@aspnet/signalr-protocol-msgpack/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 (data != null) // single equals check for both `null` and `undefined` - 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 (typeof options.transform === 'function') this._transform = options.transform; - - if (typeof options.flush === 'function') this._flush = options.flush; - } - - // When the writable side finishes, then flush out anything remaining. - this.on('prefinish', prefinish); -} - -function prefinish() { - var _this = this; - - if (typeof this._flush === 'function') { - 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 (ts.writechunk !== null && 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 (data != null) // single equals check for both `null` and `undefined` - 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/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_writable.js": -/*!*************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_writable.js ***! - \*************************************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(process, setImmediate, global) {// 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__(/*! process-nextick-args */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/process-nextick-args/index.js"); -/**/ - -module.exports = Writable; - -/* */ -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; - this.next = null; -} - -// 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 = __webpack_require__(/*! core-util-is */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/core-util-is/lib/util.js"); -util.inherits = __webpack_require__(/*! inherits */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/inherits/inherits_browser.js"); -/**/ - -/**/ -var internalUtil = { - deprecate: __webpack_require__(/*! util-deprecate */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/util-deprecate/browser.js") -}; -/**/ - -/**/ -var Stream = __webpack_require__(/*! ./internal/streams/stream */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/internal/streams/stream-browser.js"); -/**/ - -/**/ - -var Buffer = __webpack_require__(/*! safe-buffer */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/safe-buffer/index.js").Buffer; -var OurUint8Array = global.Uint8Array || function () {}; -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; -} - -/**/ - -var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/internal/streams/destroy.js"); - -util.inherits(Writable, Stream); - -function nop() {} - -function WritableState(options, stream) { - Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "../node_modules/@aspnet/signalr-protocol-msgpack/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 : 16 * 1024; - - if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) 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 = options.decodeStrings === false; - 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 getBuffer() { - 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 (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { - 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__(/*! ./_stream_duplex */ "../node_modules/@aspnet/signalr-protocol-msgpack/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 (typeof options.write === 'function') this._write = options.write; - - if (typeof options.writev === 'function') this._writev = options.writev; - - if (typeof options.destroy === 'function') this._destroy = options.destroy; - - if (typeof options.final === 'function') 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 (chunk === null) { - er = new TypeError('May not write null values to stream'); - } else if (typeof chunk !== 'string' && chunk !== undefined && !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 (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - - if (typeof cb !== 'function') 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.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); - } -}; - -Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') 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 && state.decodeStrings !== false && typeof chunk === 'string') { - 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 (state.length === 0 && 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 (entry === null) 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 (typeof chunk === 'function') { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); - - // .end() fully uncorks - if (state.corked) { - state.corked = 1; - this.uncork(); - } - - // ignore unnecessary end() calls. - if (!state.ending && !state.finished) endWritable(this, state, cb); -}; - -function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !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 (typeof stream._final === 'function') { - 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 (state.pendingcb === 0) { - 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; - } - if (state.corkedRequestsFree) { - state.corkedRequestsFree.next = corkReq; - } else { - state.corkedRequestsFree = corkReq; - } -} - -Object.defineProperty(Writable.prototype, 'destroyed', { - get: function () { - if (this._writableState === undefined) { - 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); -}; -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../process/browser.js */ "../node_modules/process/browser.js"), __webpack_require__(/*! ./../../../../../timers-browserify/main.js */ "../node_modules/timers-browserify/main.js").setImmediate, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ "../node_modules/webpack/buildin/global.js"))) - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/internal/streams/BufferList.js": -/*!************************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/internal/streams/BufferList.js ***! - \************************************************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, 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__(/*! safe-buffer */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/safe-buffer/index.js").Buffer; -var util = __webpack_require__(/*! util */ 1); - -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 push(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 unshift(v) { - var entry = { data: v, next: this.head }; - if (this.length === 0) this.tail = entry; - this.head = entry; - ++this.length; - }; - - BufferList.prototype.shift = function shift() { - if (this.length === 0) return; - var ret = this.head.data; - if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; - --this.length; - return ret; - }; - - BufferList.prototype.clear = function clear() { - this.head = this.tail = null; - this.length = 0; - }; - - BufferList.prototype.join = function join(s) { - if (this.length === 0) return ''; - var p = this.head; - var ret = '' + p.data; - while (p = p.next) { - ret += s + p.data; - }return ret; - }; - - BufferList.prototype.concat = function concat(n) { - if (this.length === 0) return Buffer.alloc(0); - if (this.length === 1) return this.head.data; - 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/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/internal/streams/destroy.js": -/*!*********************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/internal/streams/destroy.js ***! - \*********************************************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/**/ - -var pna = __webpack_require__(/*! process-nextick-args */ "../node_modules/@aspnet/signalr-protocol-msgpack/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 && (!this._writableState || !this._writableState.errorEmitted)) { - 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) { - pna.nextTick(emitErrorNT, _this, err); - if (_this._writableState) { - _this._writableState.errorEmitted = true; - } - } 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.finished = false; - this._writableState.errorEmitted = false; - } -} - -function emitErrorNT(self, err) { - self.emit('error', err); -} - -module.exports = { - destroy: destroy, - undestroy: undestroy -}; - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/internal/streams/stream-browser.js": -/*!****************************************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/internal/streams/stream-browser.js ***! - \****************************************************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = __webpack_require__(/*! events */ "../node_modules/events/events.js").EventEmitter; - - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/readable-browser.js": -/*!*********************************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/readable-browser.js ***! - \*********************************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -exports = module.exports = __webpack_require__(/*! ./lib/_stream_readable.js */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_readable.js"); -exports.Stream = exports; -exports.Readable = exports; -exports.Writable = __webpack_require__(/*! ./lib/_stream_writable.js */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_writable.js"); -exports.Duplex = __webpack_require__(/*! ./lib/_stream_duplex.js */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_duplex.js"); -exports.Transform = __webpack_require__(/*! ./lib/_stream_transform.js */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_transform.js"); -exports.PassThrough = __webpack_require__(/*! ./lib/_stream_passthrough.js */ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/readable-stream/lib/_stream_passthrough.js"); - - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/safe-buffer/index.js": -/*!******************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/safe-buffer/index.js ***! - \******************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -/* eslint-disable node/no-deprecated-api */ -var buffer = __webpack_require__(/*! buffer */ "../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, exports) - exports.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 (typeof arg === 'number') { - throw new TypeError('Argument must not be a number') - } - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - var buf = Buffer(size) - if (fill !== undefined) { - if (typeof encoding === 'string') { - buf.fill(fill, encoding) - } else { - buf.fill(fill) - } - } else { - buf.fill(0) - } - return buf -} - -SafeBuffer.allocUnsafe = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return Buffer(size) -} - -SafeBuffer.allocUnsafeSlow = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return buffer.SlowBuffer(size) -} - - -/***/ }), - -/***/ "../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/util-deprecate/browser.js": -/*!***********************************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr-protocol-msgpack/node_modules/util-deprecate/browser.js ***! - \***********************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(global) { -/** - * 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); - } else 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 (!global.localStorage) return false; - } catch (_) { - return false; - } - var val = global.localStorage[name]; - if (null == val) return false; - return String(val).toLowerCase() === 'true'; -} - -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../webpack/buildin/global.js */ "../node_modules/webpack/buildin/global.js"))) - -/***/ }), - /***/ "../node_modules/@aspnet/signalr/dist/esm/AbortController.js": /*!*******************************************************************!*\ !*** ../node_modules/@aspnet/signalr/dist/esm/AbortController.js ***! @@ -8148,8 +500,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DefaultHttpClient", function() { return DefaultHttpClient; }); /* harmony import */ var _Errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Errors */ "../node_modules/@aspnet/signalr/dist/esm/Errors.js"); /* harmony import */ var _HttpClient__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./HttpClient */ "../node_modules/@aspnet/signalr/dist/esm/HttpClient.js"); -/* harmony import */ var _NodeHttpClient__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./NodeHttpClient */ "../node_modules/@aspnet/signalr/dist/esm/NodeHttpClient.js"); -/* harmony import */ var _XhrHttpClient__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./XhrHttpClient */ "../node_modules/@aspnet/signalr/dist/esm/XhrHttpClient.js"); +/* harmony import */ var _XhrHttpClient__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./XhrHttpClient */ "../node_modules/@aspnet/signalr/dist/esm/XhrHttpClient.js"); // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. var __extends = (undefined && undefined.__extends) || (function () { @@ -8165,7 +516,13 @@ var __extends = (undefined && undefined.__extends) || (function () { - +var nodeHttpClientModule; +if (typeof XMLHttpRequest === "undefined") { + // In order to ignore the dynamic require in webpack builds we need to do this magic + // @ts-ignore: TS doesn't know about these names + var requireFunc = true ? require : undefined; + nodeHttpClientModule = requireFunc("./NodeHttpClient"); +} /** Default implementation of {@link @aspnet/signalr.HttpClient}. */ var DefaultHttpClient = /** @class */ (function (_super) { __extends(DefaultHttpClient, _super); @@ -8173,10 +530,13 @@ var DefaultHttpClient = /** @class */ (function (_super) { function DefaultHttpClient(logger) { var _this = _super.call(this) || this; if (typeof XMLHttpRequest !== "undefined") { - _this.httpClient = new _XhrHttpClient__WEBPACK_IMPORTED_MODULE_3__["XhrHttpClient"](logger); + _this.httpClient = new _XhrHttpClient__WEBPACK_IMPORTED_MODULE_2__["XhrHttpClient"](logger); + } + else if (typeof nodeHttpClientModule !== "undefined") { + _this.httpClient = new nodeHttpClientModule.NodeHttpClient(logger); } else { - _this.httpClient = new _NodeHttpClient__WEBPACK_IMPORTED_MODULE_2__["NodeHttpClient"](logger); + throw new Error("No HttpClient could be created."); } return _this; } @@ -8204,35 +564,6 @@ var DefaultHttpClient = /** @class */ (function (_super) { /***/ }), -/***/ "../node_modules/@aspnet/signalr/dist/esm/DefaultReconnectPolicy.js": -/*!**************************************************************************!*\ - !*** ../node_modules/@aspnet/signalr/dist/esm/DefaultReconnectPolicy.js ***! - \**************************************************************************/ -/*! exports provided: DefaultReconnectPolicy */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DefaultReconnectPolicy", function() { return DefaultReconnectPolicy; }); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -// 0, 2, 10, 30 second delays before reconnect attempts. -var DEFAULT_RETRY_DELAYS_IN_MILLISECONDS = [0, 2000, 10000, 30000, null]; -/** @private */ -var DefaultReconnectPolicy = /** @class */ (function () { - function DefaultReconnectPolicy(retryDelays) { - this.retryDelays = retryDelays !== undefined ? retryDelays.concat([null]) : DEFAULT_RETRY_DELAYS_IN_MILLISECONDS; - } - DefaultReconnectPolicy.prototype.nextRetryDelayInMilliseconds = function (previousRetryCount) { - return this.retryDelays[previousRetryCount]; - }; - return DefaultReconnectPolicy; -}()); - -//# sourceMappingURL=DefaultReconnectPolicy.js.map - -/***/ }), - /***/ "../node_modules/@aspnet/signalr/dist/esm/Errors.js": /*!**********************************************************!*\ !*** ../node_modules/@aspnet/signalr/dist/esm/Errors.js ***! @@ -8464,13 +795,12 @@ var HttpClient = /** @class */ (function () { /*!******************************************************************!*\ !*** ../node_modules/@aspnet/signalr/dist/esm/HttpConnection.js ***! \******************************************************************/ -/*! exports provided: HttpConnection, TransportSendQueue */ +/*! exports provided: HttpConnection */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpConnection", function() { return HttpConnection; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TransportSendQueue", function() { return TransportSendQueue; }); /* harmony import */ var _DefaultHttpClient__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DefaultHttpClient */ "../node_modules/@aspnet/signalr/dist/esm/DefaultHttpClient.js"); /* harmony import */ var _ILogger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ILogger */ "../node_modules/@aspnet/signalr/dist/esm/ILogger.js"); /* harmony import */ var _ITransport__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ITransport */ "../node_modules/@aspnet/signalr/dist/esm/ITransport.js"); @@ -8525,7 +855,7 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod var MAX_REDIRECTS = 100; var WebSocketModule = null; var EventSourceModule = null; -if (_Utils__WEBPACK_IMPORTED_MODULE_5__["Platform"].isNode && "function" !== "undefined") { +if (typeof window === "undefined" && "function" !== "undefined") { // In order to ignore the dynamic require in webpack builds we need to do this magic // @ts-ignore: TS doesn't know about these names var requireFunc = true ? require : undefined; @@ -8542,117 +872,54 @@ var HttpConnection = /** @class */ (function () { this.baseUrl = this.resolveUrl(url); options = options || {}; options.logMessageContent = options.logMessageContent || false; - if (!_Utils__WEBPACK_IMPORTED_MODULE_5__["Platform"].isNode && typeof WebSocket !== "undefined" && !options.WebSocket) { + var isNode = typeof window === "undefined"; + if (!isNode && typeof WebSocket !== "undefined" && !options.WebSocket) { options.WebSocket = WebSocket; } - else if (_Utils__WEBPACK_IMPORTED_MODULE_5__["Platform"].isNode && !options.WebSocket) { + else if (isNode && !options.WebSocket) { if (WebSocketModule) { options.WebSocket = WebSocketModule; } } - if (!_Utils__WEBPACK_IMPORTED_MODULE_5__["Platform"].isNode && typeof EventSource !== "undefined" && !options.EventSource) { + if (!isNode && typeof EventSource !== "undefined" && !options.EventSource) { options.EventSource = EventSource; } - else if (_Utils__WEBPACK_IMPORTED_MODULE_5__["Platform"].isNode && !options.EventSource) { + else if (isNode && !options.EventSource) { if (typeof EventSourceModule !== "undefined") { options.EventSource = EventSourceModule; } } this.httpClient = options.httpClient || new _DefaultHttpClient__WEBPACK_IMPORTED_MODULE_0__["DefaultHttpClient"](this.logger); - this.connectionState = "Disconnected" /* Disconnected */; - this.connectionStarted = false; + this.connectionState = 2 /* Disconnected */; this.options = options; this.onreceive = null; this.onclose = null; } HttpConnection.prototype.start = function (transferFormat) { - return __awaiter(this, void 0, void 0, function () { - var message, message; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - transferFormat = transferFormat || _ITransport__WEBPACK_IMPORTED_MODULE_2__["TransferFormat"].Binary; - _Utils__WEBPACK_IMPORTED_MODULE_5__["Arg"].isIn(transferFormat, _ITransport__WEBPACK_IMPORTED_MODULE_2__["TransferFormat"], "transferFormat"); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Starting connection with transfer format '" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["TransferFormat"][transferFormat] + "'."); - if (this.connectionState !== "Disconnected" /* Disconnected */) { - return [2 /*return*/, Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."))]; - } - this.connectionState = "Connecting " /* Connecting */; - this.startInternalPromise = this.startInternal(transferFormat); - return [4 /*yield*/, this.startInternalPromise]; - case 1: - _a.sent(); - if (!(this.connectionState === "Disconnecting" /* Disconnecting */)) return [3 /*break*/, 3]; - message = "Failed to start the HttpConnection before stop() was called."; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, message); - // We cannot await stopPromise inside startInternal since stopInternal awaits the startInternalPromise. - return [4 /*yield*/, this.stopPromise]; - case 2: - // We cannot await stopPromise inside startInternal since stopInternal awaits the startInternalPromise. - _a.sent(); - return [2 /*return*/, Promise.reject(new Error(message))]; - case 3: - if (this.connectionState !== "Connected" /* Connected */) { - message = "HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!"; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, message); - return [2 /*return*/, Promise.reject(new Error(message))]; - } - _a.label = 4; - case 4: - this.connectionStarted = true; - return [2 /*return*/]; - } - }); - }); + transferFormat = transferFormat || _ITransport__WEBPACK_IMPORTED_MODULE_2__["TransferFormat"].Binary; + _Utils__WEBPACK_IMPORTED_MODULE_5__["Arg"].isIn(transferFormat, _ITransport__WEBPACK_IMPORTED_MODULE_2__["TransferFormat"], "transferFormat"); + this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Starting connection with transfer format '" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["TransferFormat"][transferFormat] + "'."); + if (this.connectionState !== 2 /* Disconnected */) { + return Promise.reject(new Error("Cannot start a connection that is not in the 'Disconnected' state.")); + } + this.connectionState = 0 /* Connecting */; + this.startPromise = this.startInternal(transferFormat); + return this.startPromise; }; HttpConnection.prototype.send = function (data) { - if (this.connectionState !== "Connected" /* Connected */) { - return Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")); - } - if (!this.sendQueue) { - this.sendQueue = new TransportSendQueue(this.transport); + if (this.connectionState !== 1 /* Connected */) { + throw new Error("Cannot send data if the connection is not in the 'Connected' State."); } // Transport will not be null if state is connected - return this.sendQueue.send(data); + return this.transport.send(data); }; HttpConnection.prototype.stop = function (error) { return __awaiter(this, void 0, void 0, function () { - var _this = this; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (this.connectionState === "Disconnected" /* Disconnected */) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Call to HttpConnection.stop(" + error + ") ignored because the connection is already in the disconnected state."); - return [2 /*return*/, Promise.resolve()]; - } - if (this.connectionState === "Disconnecting" /* Disconnecting */) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Call to HttpConnection.stop(" + error + ") ignored because the connection is already in the disconnecting state."); - return [2 /*return*/, this.stopPromise]; - } - this.connectionState = "Disconnecting" /* Disconnecting */; - this.stopPromise = new Promise(function (resolve) { - // Don't complete stop() until stopConnection() completes. - _this.stopPromiseResolver = resolve; - }); - // stopInternal should never throw so just observe it. - return [4 /*yield*/, this.stopInternal(error)]; - case 1: - // stopInternal should never throw so just observe it. - _a.sent(); - return [4 /*yield*/, this.stopPromise]; - case 2: - _a.sent(); - return [2 /*return*/]; - } - }); - }); - }; - HttpConnection.prototype.stopInternal = function (error) { - return __awaiter(this, void 0, void 0, function () { - var e_1, e_2; + var e_1; return __generator(this, function (_a) { switch (_a.label) { case 0: + this.connectionState = 2 /* Disconnected */; // Set error as soon as possible otherwise there is a race between // the transport closing and providing an error and the error from a close message // We would prefer the close message error. @@ -8660,7 +927,7 @@ var HttpConnection = /** @class */ (function () { _a.label = 1; case 1: _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.startInternalPromise]; + return [4 /*yield*/, this.startPromise]; case 2: _a.sent(); return [3 /*break*/, 4]; @@ -8668,38 +935,20 @@ var HttpConnection = /** @class */ (function () { e_1 = _a.sent(); return [3 /*break*/, 4]; case 4: - if (!this.transport) return [3 /*break*/, 9]; - if (this.sendQueue) { - this.sendQueue.stop(); - this.sendQueue = undefined; - } - _a.label = 5; - case 5: - _a.trys.push([5, 7, , 8]); + if (!this.transport) return [3 /*break*/, 6]; return [4 /*yield*/, this.transport.stop()]; - case 6: + case 5: _a.sent(); - return [3 /*break*/, 8]; - case 7: - e_2 = _a.sent(); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, "HttpConnection.transport.stop() threw error '" + e_2 + "'."); - this.stopConnection(); - return [3 /*break*/, 8]; - case 8: this.transport = undefined; - return [3 /*break*/, 10]; - case 9: - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "HttpConnection.transport is undefined in HttpConnection.stop() because start() failed."); - this.stopConnection(); - _a.label = 10; - case 10: return [2 /*return*/]; + _a.label = 6; + case 6: return [2 /*return*/]; } }); }); }; HttpConnection.prototype.startInternal = function (transferFormat) { return __awaiter(this, void 0, void 0, function () { - var url, negotiateResponse, redirects, _loop_1, this_1, e_3; + var url, negotiateResponse, redirects, _loop_1, this_1, state_1, e_2; var _this = this; return __generator(this, function (_a) { switch (_a.label) { @@ -8721,7 +970,7 @@ var HttpConnection = /** @class */ (function () { // No fallback or negotiate in this case. _a.sent(); return [3 /*break*/, 4]; - case 3: throw new Error("Negotiation can only be skipped when using the WebSocket transport directly."); + case 3: throw Error("Negotiation can only be skipped when using the WebSocket transport directly."); case 4: return [3 /*break*/, 11]; case 5: negotiateResponse = null; @@ -8734,14 +983,14 @@ var HttpConnection = /** @class */ (function () { case 1: negotiateResponse = _a.sent(); // the user tries to stop the connection when it is being started - if (this_1.connectionState === "Disconnecting" /* Disconnecting */ || this_1.connectionState === "Disconnected" /* Disconnected */) { - throw new Error("The connection was stopped during negotiation."); + if (this_1.connectionState === 2 /* Disconnected */) { + return [2 /*return*/, { value: void 0 }]; } if (negotiateResponse.error) { - throw new Error(negotiateResponse.error); + throw Error(negotiateResponse.error); } if (negotiateResponse.ProtocolVersion) { - throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details."); + throw Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details."); } if (negotiateResponse.url) { url = negotiateResponse.url; @@ -8759,16 +1008,17 @@ var HttpConnection = /** @class */ (function () { _a.label = 6; case 6: return [5 /*yield**/, _loop_1()]; case 7: - _a.sent(); + state_1 = _a.sent(); + if (typeof state_1 === "object") + return [2 /*return*/, state_1.value]; _a.label = 8; case 8: if (negotiateResponse.url && redirects < MAX_REDIRECTS) return [3 /*break*/, 6]; _a.label = 9; case 9: if (redirects === MAX_REDIRECTS && negotiateResponse.url) { - throw new Error("Negotiate redirection limit exceeded."); + throw Error("Negotiate redirection limit exceeded."); } - this.connectionId = negotiateResponse.connectionId; return [4 /*yield*/, this.createTransport(url, this.options.transport, negotiateResponse, transferFormat)]; case 10: _a.sent(); @@ -8779,19 +1029,16 @@ var HttpConnection = /** @class */ (function () { } this.transport.onreceive = this.onreceive; this.transport.onclose = function (e) { return _this.stopConnection(e); }; - if (this.connectionState === "Connecting " /* Connecting */) { - // Ensure the connection transitions to the connected state prior to completing this.startInternalPromise. - // start() will handle the case when stop was called and startInternal exits still in the disconnecting state. - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "The HttpConnection connected successfully."); - this.connectionState = "Connected" /* Connected */; - } + // only change the state if we were connecting to not overwrite + // the state if the connection is already marked as Disconnected + this.changeState(0 /* Connecting */, 1 /* Connected */); return [3 /*break*/, 13]; case 12: - e_3 = _a.sent(); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, "Failed to start the connection: " + e_3); - this.connectionState = "Disconnected" /* Disconnected */; + e_2 = _a.sent(); + this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, "Failed to start the connection: " + e_2); + this.connectionState = 2 /* Disconnected */; this.transport = undefined; - return [2 /*return*/, Promise.reject(e_3)]; + throw e_2; case 13: return [2 /*return*/]; } }); @@ -8799,7 +1046,7 @@ var HttpConnection = /** @class */ (function () { }; HttpConnection.prototype.getNegotiationResponse = function (url) { return __awaiter(this, void 0, void 0, function () { - var _a, headers, token, negotiateUrl, response, e_4; + var _a, headers, token, negotiateUrl, response, e_3; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -8826,13 +1073,13 @@ var HttpConnection = /** @class */ (function () { case 4: response = _b.sent(); if (response.statusCode !== 200) { - return [2 /*return*/, Promise.reject(new Error("Unexpected status code returned from negotiate " + response.statusCode))]; + throw Error("Unexpected status code returned from negotiate " + response.statusCode); } return [2 /*return*/, JSON.parse(response.content)]; case 5: - e_4 = _b.sent(); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, "Failed to complete negotiation with the server: " + e_4); - return [2 /*return*/, Promise.reject(e_4)]; + e_3 = _b.sent(); + this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, "Failed to complete negotiation with the server: " + e_3); + throw e_3; case 6: return [2 /*return*/]; } }); @@ -8846,7 +1093,7 @@ var HttpConnection = /** @class */ (function () { }; HttpConnection.prototype.createTransport = function (url, requestedTransport, negotiateResponse, requestedTransferFormat) { return __awaiter(this, void 0, void 0, function () { - var connectUrl, transportExceptions, transports, _i, transports_1, endpoint, transport, ex_1, message; + var connectUrl, transports, _i, transports_1, endpoint, transport, ex_1; return __generator(this, function (_a) { switch (_a.label) { case 0: @@ -8857,51 +1104,44 @@ var HttpConnection = /** @class */ (function () { return [4 /*yield*/, this.transport.connect(connectUrl, requestedTransferFormat)]; case 1: _a.sent(); + // only change the state if we were connecting to not overwrite + // the state if the connection is already marked as Disconnected + this.changeState(0 /* Connecting */, 1 /* Connected */); return [2 /*return*/]; case 2: - transportExceptions = []; transports = negotiateResponse.availableTransports || []; _i = 0, transports_1 = transports; _a.label = 3; case 3: - if (!(_i < transports_1.length)) return [3 /*break*/, 11]; + if (!(_i < transports_1.length)) return [3 /*break*/, 9]; endpoint = transports_1[_i]; - _a.label = 4; - case 4: - _a.trys.push([4, 9, , 10]); + this.connectionState = 0 /* Connecting */; transport = this.resolveTransport(endpoint, requestedTransport, requestedTransferFormat); if (!(typeof transport === "number")) return [3 /*break*/, 8]; this.transport = this.constructTransport(transport); - if (!!negotiateResponse.connectionId) return [3 /*break*/, 6]; + if (!!negotiateResponse.connectionId) return [3 /*break*/, 5]; return [4 /*yield*/, this.getNegotiationResponse(url)]; - case 5: + case 4: negotiateResponse = _a.sent(); connectUrl = this.createConnectUrl(url, negotiateResponse.connectionId); - _a.label = 6; - case 6: return [4 /*yield*/, this.transport.connect(connectUrl, requestedTransferFormat)]; - case 7: + _a.label = 5; + case 5: + _a.trys.push([5, 7, , 8]); + return [4 /*yield*/, this.transport.connect(connectUrl, requestedTransferFormat)]; + case 6: _a.sent(); + this.changeState(0 /* Connecting */, 1 /* Connected */); return [2 /*return*/]; - case 8: return [3 /*break*/, 10]; - case 9: + case 7: ex_1 = _a.sent(); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, "Failed to start the transport '" + endpoint.transport + "': " + ex_1); + this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, "Failed to start the transport '" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"][transport] + "': " + ex_1); + this.connectionState = 2 /* Disconnected */; negotiateResponse.connectionId = undefined; - transportExceptions.push(endpoint.transport + " failed: " + ex_1); - if (this.connectionState !== "Connecting " /* Connecting */) { - message = "Failed to select transport before stop() was called."; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, message); - return [2 /*return*/, Promise.reject(new Error(message))]; - } - return [3 /*break*/, 10]; - case 10: + return [3 /*break*/, 8]; + case 8: _i++; return [3 /*break*/, 3]; - case 11: - if (transportExceptions.length > 0) { - return [2 /*return*/, Promise.reject(new Error("Unable to connect to the server with any of the available transports. " + transportExceptions.join(" ")))]; - } - return [2 /*return*/, Promise.reject(new Error("None of the transports supported by the client are supported by the server."))]; + case 9: throw new Error("Unable to initialize any of the available transports."); } }); }); @@ -8936,7 +1176,6 @@ var HttpConnection = /** @class */ (function () { if ((transport === _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"].WebSockets && !this.options.WebSocket) || (transport === _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"].ServerSentEvents && !this.options.EventSource)) { this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Skipping transport '" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"][transport] + "' because it is not supported in your environment.'"); - throw new Error("'" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"][transport] + "' is not supported in your environment."); } else { this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Selecting transport '" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"][transport] + "'."); @@ -8945,12 +1184,10 @@ var HttpConnection = /** @class */ (function () { } else { this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Skipping transport '" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"][transport] + "' because it does not support the requested transfer format '" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["TransferFormat"][requestedTransferFormat] + "'."); - throw new Error("'" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"][transport] + "' does not support " + _ITransport__WEBPACK_IMPORTED_MODULE_2__["TransferFormat"][requestedTransferFormat] + "."); } } else { this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Skipping transport '" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"][transport] + "' because it was disabled by the client."); - throw new Error("'" + _ITransport__WEBPACK_IMPORTED_MODULE_2__["HttpTransportType"][transport] + "' is disabled by the client."); } } return null; @@ -8958,41 +1195,26 @@ var HttpConnection = /** @class */ (function () { HttpConnection.prototype.isITransport = function (transport) { return transport && typeof (transport) === "object" && "connect" in transport; }; + HttpConnection.prototype.changeState = function (from, to) { + if (this.connectionState === from) { + this.connectionState = to; + return true; + } + return false; + }; HttpConnection.prototype.stopConnection = function (error) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "HttpConnection.stopConnection(" + error + ") called while in state " + this.connectionState + "."); this.transport = undefined; // If we have a stopError, it takes precedence over the error from the transport error = this.stopError || error; - this.stopError = undefined; - if (this.connectionState === "Disconnected" /* Disconnected */) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Debug, "Call to HttpConnection.stopConnection(" + error + ") was ignored because the connection is already in the disconnected state."); - return; - } - if (this.connectionState === "Connecting " /* Connecting */) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Warning, "Call to HttpConnection.stopConnection(" + error + ") was ignored because the connection hasn't yet left the in the connecting state."); - return; - } - if (this.connectionState === "Disconnecting" /* Disconnecting */) { - // A call to stop() induced this call to stopConnection and needs to be completed. - // Any stop() awaiters will be scheduled to continue after the onclose callback fires. - this.stopPromiseResolver(); - } if (error) { this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, "Connection disconnected with error '" + error + "'."); } else { this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Information, "Connection disconnected."); } - this.connectionId = undefined; - this.connectionState = "Disconnected" /* Disconnected */; - if (this.onclose && this.connectionStarted) { - this.connectionStarted = false; - try { - this.onclose(error); - } - catch (e) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_1__["LogLevel"].Error, "HttpConnection.onclose(" + error + ") threw error '" + e + "'."); - } + this.connectionState = 2 /* Disconnected */; + if (this.onclose) { + this.onclose(error); } }; HttpConnection.prototype.resolveUrl = function (url) { @@ -9000,7 +1222,7 @@ var HttpConnection = /** @class */ (function () { if (url.lastIndexOf("https://", 0) === 0 || url.lastIndexOf("http://", 0) === 0) { return url; } - if (!_Utils__WEBPACK_IMPORTED_MODULE_5__["Platform"].isBrowser || !window.document) { + if (typeof window === "undefined" || !window || !window.document) { throw new Error("Cannot resolve '" + url + "'."); } // Setting the url to the href propery of an anchor tag handles normalization @@ -9029,100 +1251,6 @@ var HttpConnection = /** @class */ (function () { function transportMatches(requestedTransport, actualTransport) { return !requestedTransport || ((actualTransport & requestedTransport) !== 0); } -var TransportSendQueue = /** @class */ (function () { - function TransportSendQueue(transport) { - this.transport = transport; - this.buffer = []; - this.executing = true; - this.sendBufferedData = new PromiseSource(); - this.transportResult = new PromiseSource(); - // Suppress typescript error about handling Promises. The sendLoop doesn't need to be observed - this.sendLoop().then(function () { }, function (_) { }); - } - TransportSendQueue.prototype.send = function (data) { - this.bufferData(data); - return this.transportResult.promise; - }; - TransportSendQueue.prototype.stop = function () { - this.executing = false; - this.sendBufferedData.resolve(); - }; - TransportSendQueue.prototype.bufferData = function (data) { - if (this.buffer.length && typeof (this.buffer[0]) !== typeof (data)) { - throw new Error("Expected data to be of type " + typeof (this.buffer) + " but was of type " + typeof (data)); - } - this.buffer.push(data); - this.sendBufferedData.resolve(); - }; - TransportSendQueue.prototype.sendLoop = function () { - return __awaiter(this, void 0, void 0, function () { - var transportResult, data, error_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (false) {} - return [4 /*yield*/, this.sendBufferedData.promise]; - case 1: - _a.sent(); - if (!this.executing) { - // Did we stop? - return [3 /*break*/, 6]; - } - this.sendBufferedData = new PromiseSource(); - transportResult = this.transportResult; - this.transportResult = new PromiseSource(); - data = typeof (this.buffer[0]) === "string" ? - this.buffer.join("") : - TransportSendQueue.concatBuffers(this.buffer); - this.buffer.length = 0; - _a.label = 2; - case 2: - _a.trys.push([2, 4, , 5]); - return [4 /*yield*/, this.transport.send(data)]; - case 3: - _a.sent(); - transportResult.resolve(); - return [3 /*break*/, 5]; - case 4: - error_1 = _a.sent(); - transportResult.reject(error_1); - return [3 /*break*/, 5]; - case 5: return [3 /*break*/, 0]; - case 6: return [2 /*return*/]; - } - }); - }); - }; - TransportSendQueue.concatBuffers = function (arrayBuffers) { - var totalLength = arrayBuffers.map(function (b) { return b.byteLength; }).reduce(function (a, b) { return a + b; }); - var result = new Uint8Array(totalLength); - var offset = 0; - for (var _i = 0, arrayBuffers_1 = arrayBuffers; _i < arrayBuffers_1.length; _i++) { - var item = arrayBuffers_1[_i]; - result.set(new Uint8Array(item), offset); - offset += item.byteLength; - } - return result; - }; - return TransportSendQueue; -}()); - -var PromiseSource = /** @class */ (function () { - function PromiseSource() { - var _this = this; - this.promise = new Promise(function (resolve, reject) { - var _a; - return _a = [resolve, reject], _this.resolver = _a[0], _this.rejecter = _a[1], _a; - }); - } - PromiseSource.prototype.resolve = function () { - this.resolver(); - }; - PromiseSource.prototype.reject = function (reason) { - this.rejecter(reason); - }; - return PromiseSource; -}()); //# sourceMappingURL=HttpConnection.js.map /***/ }), @@ -9141,8 +1269,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _HandshakeProtocol__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./HandshakeProtocol */ "../node_modules/@aspnet/signalr/dist/esm/HandshakeProtocol.js"); /* harmony import */ var _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./IHubProtocol */ "../node_modules/@aspnet/signalr/dist/esm/IHubProtocol.js"); /* harmony import */ var _ILogger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ILogger */ "../node_modules/@aspnet/signalr/dist/esm/ILogger.js"); -/* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Subject */ "../node_modules/@aspnet/signalr/dist/esm/Subject.js"); -/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Utils */ "../node_modules/@aspnet/signalr/dist/esm/Utils.js"); +/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Utils */ "../node_modules/@aspnet/signalr/dist/esm/Utils.js"); // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { @@ -9184,48 +1311,37 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod - var DEFAULT_TIMEOUT_IN_MS = 30 * 1000; var DEFAULT_PING_INTERVAL_IN_MS = 15 * 1000; /** Describes the current state of the {@link HubConnection} to the server. */ var HubConnectionState; (function (HubConnectionState) { /** The hub connection is disconnected. */ - HubConnectionState["Disconnected"] = "Disconnected"; - /** The hub connection is connecting. */ - HubConnectionState["Connecting"] = "Connecting"; + HubConnectionState[HubConnectionState["Disconnected"] = 0] = "Disconnected"; /** The hub connection is connected. */ - HubConnectionState["Connected"] = "Connected"; - /** The hub connection is disconnecting. */ - HubConnectionState["Disconnecting"] = "Disconnecting"; - /** The hub connection is reconnecting. */ - HubConnectionState["Reconnecting"] = "Reconnecting"; + HubConnectionState[HubConnectionState["Connected"] = 1] = "Connected"; })(HubConnectionState || (HubConnectionState = {})); /** Represents a connection to a SignalR Hub. */ var HubConnection = /** @class */ (function () { - function HubConnection(connection, logger, protocol, reconnectPolicy) { + function HubConnection(connection, logger, protocol) { var _this = this; - _Utils__WEBPACK_IMPORTED_MODULE_4__["Arg"].isRequired(connection, "connection"); - _Utils__WEBPACK_IMPORTED_MODULE_4__["Arg"].isRequired(logger, "logger"); - _Utils__WEBPACK_IMPORTED_MODULE_4__["Arg"].isRequired(protocol, "protocol"); + _Utils__WEBPACK_IMPORTED_MODULE_3__["Arg"].isRequired(connection, "connection"); + _Utils__WEBPACK_IMPORTED_MODULE_3__["Arg"].isRequired(logger, "logger"); + _Utils__WEBPACK_IMPORTED_MODULE_3__["Arg"].isRequired(protocol, "protocol"); this.serverTimeoutInMilliseconds = DEFAULT_TIMEOUT_IN_MS; this.keepAliveIntervalInMilliseconds = DEFAULT_PING_INTERVAL_IN_MS; this.logger = logger; this.protocol = protocol; this.connection = connection; - this.reconnectPolicy = reconnectPolicy; this.handshakeProtocol = new _HandshakeProtocol__WEBPACK_IMPORTED_MODULE_0__["HandshakeProtocol"](); this.connection.onreceive = function (data) { return _this.processIncomingData(data); }; this.connection.onclose = function (error) { return _this.connectionClosed(error); }; this.callbacks = {}; this.methods = {}; this.closedCallbacks = []; - this.reconnectingCallbacks = []; - this.reconnectedCallbacks = []; - this.invocationId = 0; + this.id = 0; this.receivedHandshakeResponse = false; this.connectionState = HubConnectionState.Disconnected; - this.connectionStarted = false; this.cachedPingMessage = this.protocol.writeMessage({ type: _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Ping }); } /** @internal */ @@ -9233,8 +1349,8 @@ var HubConnection = /** @class */ (function () { // create method that can be used by HubConnectionBuilder. An "internal" constructor would just // be stripped away and the '.d.ts' file would have no constructor, which is interpreted as a // public parameter-less constructor. - HubConnection.create = function (connection, logger, protocol, reconnectPolicy) { - return new HubConnection(connection, logger, protocol, reconnectPolicy); + HubConnection.create = function (connection, logger, protocol) { + return new HubConnection(connection, logger, protocol); }; Object.defineProperty(HubConnection.prototype, "state", { /** Indicates the state of the {@link HubConnection} to the server. */ @@ -9244,63 +1360,22 @@ var HubConnection = /** @class */ (function () { enumerable: true, configurable: true }); - Object.defineProperty(HubConnection.prototype, "connectionId", { - /** Represents the connection id of the {@link HubConnection} on the server. The connection id will be null when the connection is either - * in the disconnected state or if the negotiation step was skipped. - */ - get: function () { - return this.connection ? (this.connection.connectionId || null) : null; - }, - enumerable: true, - configurable: true - }); /** Starts the connection. * * @returns {Promise} A Promise that resolves when the connection has been successfully established, or rejects with an error. */ HubConnection.prototype.start = function () { - this.startPromise = this.startWithStateTransitions(); - return this.startPromise; - }; - HubConnection.prototype.startWithStateTransitions = function () { return __awaiter(this, void 0, void 0, function () { - var e_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (this.connectionState !== HubConnectionState.Disconnected) { - return [2 /*return*/, Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."))]; - } - this.connectionState = HubConnectionState.Connecting; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Starting HubConnection."); - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, this.startInternal()]; - case 2: - _a.sent(); - this.connectionState = HubConnectionState.Connected; - this.connectionStarted = true; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "HubConnection connected successfully."); - return [3 /*break*/, 4]; - case 3: - e_1 = _a.sent(); - this.connectionState = HubConnectionState.Disconnected; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "HubConnection failed to start successfully because of error '" + e_1 + "'."); - return [2 /*return*/, Promise.reject(e_1)]; - case 4: return [2 /*return*/]; - } - }); - }); - }; - HubConnection.prototype.startInternal = function () { - return __awaiter(this, void 0, void 0, function () { - var handshakePromise, handshakeRequest, e_2; + var handshakeRequest, handshakePromise; var _this = this; return __generator(this, function (_a) { switch (_a.label) { case 0: - this.stopDuringStartError = undefined; + handshakeRequest = { + protocol: this.protocol.name, + version: this.protocol.version, + }; + this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Starting HubConnection."); this.receivedHandshakeResponse = false; handshakePromise = new Promise(function (resolve, reject) { _this.handshakeResolver = resolve; @@ -9309,49 +1384,22 @@ var HubConnection = /** @class */ (function () { return [4 /*yield*/, this.connection.start(this.protocol.transferFormat)]; case 1: _a.sent(); - _a.label = 2; - case 2: - _a.trys.push([2, 5, , 7]); - handshakeRequest = { - protocol: this.protocol.name, - version: this.protocol.version, - }; this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Sending handshake request."); return [4 /*yield*/, this.sendMessage(this.handshakeProtocol.writeHandshakeRequest(handshakeRequest))]; - case 3: + case 2: _a.sent(); this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Information, "Using HubProtocol '" + this.protocol.name + "'."); // defensively cleanup timeout in case we receive a message from the server before we finish start this.cleanupTimeout(); this.resetTimeoutPeriod(); this.resetKeepAliveInterval(); + // Wait for the handshake to complete before marking connection as connected return [4 /*yield*/, handshakePromise]; - case 4: + case 3: + // Wait for the handshake to complete before marking connection as connected _a.sent(); - // It's important to check the stopDuringStartError instead of just relying on the handshakePromise - // being rejected on close, because this continuation can run after both the handshake completed successfully - // and the connection was closed. - if (this.stopDuringStartError) { - // It's important to throw instead of returning a rejected promise, because we don't want to allow any state - // transitions to occur between now and the calling code observing the exceptions. Returning a rejected promise - // will cause the calling continuation to get scheduled to run later. - throw this.stopDuringStartError; - } - return [3 /*break*/, 7]; - case 5: - e_2 = _a.sent(); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Hub handshake failed with error '" + e_2 + "' during start(). Stopping HubConnection."); - this.cleanupTimeout(); - this.cleanupPingTimer(); - // HttpConnection.stop() should not complete until after the onclose callback is invoked. - // This will transition the HubConnection to the disconnected state before HttpConnection.stop() completes. - return [4 /*yield*/, this.connection.stop(e_2)]; - case 6: - // HttpConnection.stop() should not complete until after the onclose callback is invoked. - // This will transition the HubConnection to the disconnected state before HttpConnection.stop() completes. - _a.sent(); - throw e_2; - case 7: return [2 /*return*/]; + this.connectionState = HubConnectionState.Connected; + return [2 /*return*/]; } }); }); @@ -9361,61 +1409,10 @@ var HubConnection = /** @class */ (function () { * @returns {Promise} A Promise that resolves when the connection has been successfully terminated, or rejects with an error. */ HubConnection.prototype.stop = function () { - return __awaiter(this, void 0, void 0, function () { - var startPromise, e_3; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - startPromise = this.startPromise; - this.stopPromise = this.stopInternal(); - return [4 /*yield*/, this.stopPromise]; - case 1: - _a.sent(); - _a.label = 2; - case 2: - _a.trys.push([2, 4, , 5]); - // Awaiting undefined continues immediately - return [4 /*yield*/, startPromise]; - case 3: - // Awaiting undefined continues immediately - _a.sent(); - return [3 /*break*/, 5]; - case 4: - e_3 = _a.sent(); - return [3 /*break*/, 5]; - case 5: return [2 /*return*/]; - } - }); - }); - }; - HubConnection.prototype.stopInternal = function (error) { - if (this.connectionState === HubConnectionState.Disconnected) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Call to HubConnection.stop(" + error + ") ignored because it is already in the disconnected state."); - return Promise.resolve(); - } - if (this.connectionState === HubConnectionState.Disconnecting) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Call to HttpConnection.stop(" + error + ") ignored because the connection is already in the disconnecting state."); - return this.stopPromise; - } - this.connectionState = HubConnectionState.Disconnecting; this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Stopping HubConnection."); - if (this.reconnectDelayHandle) { - // We're in a reconnect delay which means the underlying connection is currently already stopped. - // Just clear the handle to stop the reconnect loop (which no one is waiting on thankfully) and - // fire the onclose callbacks. - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Connection stopped during reconnect delay. Done reconnecting."); - clearTimeout(this.reconnectDelayHandle); - this.reconnectDelayHandle = undefined; - this.completeClose(); - return Promise.resolve(); - } this.cleanupTimeout(); this.cleanupPingTimer(); - this.stopDuringStartError = error || new Error("The connection was stopped before the hub handshake could complete."); - // HttpConnection.stop() should not complete until after either HttpConnection.start() fails - // or the onclose callback is invoked. The onclose callback will transition the HubConnection - // to the disconnected state if need be before HttpConnection.stop() completes. - return this.connection.stop(error); + return this.connection.stop(); }; /** Invokes a streaming hub method on the server using the specified name and arguments. * @@ -9430,17 +1427,13 @@ var HubConnection = /** @class */ (function () { for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } - var _a = this.replaceStreamingParams(args), streams = _a[0], streamIds = _a[1]; - var invocationDescriptor = this.createStreamInvocation(methodName, args, streamIds); - var promiseQueue; - var subject = new _Subject__WEBPACK_IMPORTED_MODULE_3__["Subject"](); - subject.cancelCallback = function () { + var invocationDescriptor = this.createStreamInvocation(methodName, args); + var subject = new _Utils__WEBPACK_IMPORTED_MODULE_3__["Subject"](function () { var cancelInvocation = _this.createCancelInvocation(invocationDescriptor.invocationId); + var cancelMessage = _this.protocol.writeMessage(cancelInvocation); delete _this.callbacks[invocationDescriptor.invocationId]; - return promiseQueue.then(function () { - return _this.sendWithProtocol(cancelInvocation); - }); - }; + return _this.sendMessage(cancelMessage); + }); this.callbacks[invocationDescriptor.invocationId] = function (invocationEvent, error) { if (error) { subject.error(error); @@ -9461,25 +1454,18 @@ var HubConnection = /** @class */ (function () { } } }; - promiseQueue = this.sendWithProtocol(invocationDescriptor) + var message = this.protocol.writeMessage(invocationDescriptor); + this.sendMessage(message) .catch(function (e) { subject.error(e); delete _this.callbacks[invocationDescriptor.invocationId]; }); - this.launchStreams(streams, promiseQueue); return subject; }; HubConnection.prototype.sendMessage = function (message) { this.resetKeepAliveInterval(); return this.connection.send(message); }; - /** - * Sends a js object to the server. - * @param message The js object to serialize and send. - */ - HubConnection.prototype.sendWithProtocol = function (message) { - return this.sendMessage(this.protocol.writeMessage(message)); - }; /** Invokes a hub method on the server using the specified name and arguments. Does not wait for a response from the receiver. * * The Promise returned by this method resolves when the client has sent the invocation to the server. The server may still @@ -9494,10 +1480,9 @@ var HubConnection = /** @class */ (function () { for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } - var _a = this.replaceStreamingParams(args), streams = _a[0], streamIds = _a[1]; - var sendPromise = this.sendWithProtocol(this.createInvocation(methodName, args, true, streamIds)); - this.launchStreams(streams, sendPromise); - return sendPromise; + var invocationDescriptor = this.createInvocation(methodName, args, true); + var message = this.protocol.writeMessage(invocationDescriptor); + return this.sendMessage(message); }; /** Invokes a hub method on the server using the specified name and arguments. * @@ -9516,8 +1501,7 @@ var HubConnection = /** @class */ (function () { for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } - var _a = this.replaceStreamingParams(args), streams = _a[0], streamIds = _a[1]; - var invocationDescriptor = this.createInvocation(methodName, args, false, streamIds); + var invocationDescriptor = this.createInvocation(methodName, args, false); var p = new Promise(function (resolve, reject) { // invocationId will always have a value for a non-blocking invocation _this.callbacks[invocationDescriptor.invocationId] = function (invocationEvent, error) { @@ -9540,13 +1524,13 @@ var HubConnection = /** @class */ (function () { } } }; - var promiseQueue = _this.sendWithProtocol(invocationDescriptor) + var message = _this.protocol.writeMessage(invocationDescriptor); + _this.sendMessage(message) .catch(function (e) { reject(e); // invocationId will always have a value for a non-blocking invocation delete _this.callbacks[invocationDescriptor.invocationId]; }); - _this.launchStreams(streams, promiseQueue); }); return p; }; @@ -9600,24 +1584,6 @@ var HubConnection = /** @class */ (function () { this.closedCallbacks.push(callback); } }; - /** Registers a handler that will be invoked when the connection starts reconnecting. - * - * @param {Function} callback The handler that will be invoked when the connection starts reconnecting. Optionally receives a single argument containing the error that caused the connection to start reconnecting (if any). - */ - HubConnection.prototype.onreconnecting = function (callback) { - if (callback) { - this.reconnectingCallbacks.push(callback); - } - }; - /** Registers a handler that will be invoked when the connection successfully reconnects. - * - * @param {Function} callback The handler that will be invoked when the connection successfully reconnects. - */ - HubConnection.prototype.onreconnected = function (callback) { - if (callback) { - this.reconnectedCallbacks.push(callback); - } - }; HubConnection.prototype.processIncomingData = function (data) { this.cleanupTimeout(); if (!this.receivedHandshakeResponse) { @@ -9637,7 +1603,7 @@ var HubConnection = /** @class */ (function () { case _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].StreamItem: case _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Completion: var callback = this.callbacks[message.invocationId]; - if (callback) { + if (callback != null) { if (message.type === _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Completion) { delete this.callbacks[message.invocationId]; } @@ -9650,7 +1616,8 @@ var HubConnection = /** @class */ (function () { case _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Close: this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Information, "Close message received from server."); // We don't want to wait on the stop itself. - this.stopPromise = this.stopInternal(message.error ? new Error("Server returned an error on close: " + message.error) : undefined); + // tslint:disable-next-line:no-floating-promises + this.connection.stop(message.error ? new Error("Server returned an error on close: " + message.error) : undefined); break; default: this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Warning, "Invalid message type: " + message.type + "."); @@ -9671,15 +1638,20 @@ var HubConnection = /** @class */ (function () { var message = "Error parsing handshake response: " + e; this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Error, message); var error = new Error(message); + // We don't want to wait on the stop itself. + // tslint:disable-next-line:no-floating-promises + this.connection.stop(error); this.handshakeRejecter(error); throw error; } if (responseMessage.error) { var message = "Server returned handshake error: " + responseMessage.error; this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Error, message); - var error = new Error(message); - this.handshakeRejecter(error); - throw error; + this.handshakeRejecter(message); + // We don't want to wait on the stop itself. + // tslint:disable-next-line:no-floating-promises + this.connection.stop(new Error(message)); + throw new Error(message); } else { this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Server handshake complete."); @@ -9723,7 +1695,7 @@ var HubConnection = /** @class */ (function () { }; HubConnection.prototype.serverTimeout = function () { // The server hasn't talked to us in a while. It doesn't like us anymore ... :( - // Terminate the connection, but we don't need to wait on the promise. This could trigger reconnecting. + // Terminate the connection, but we don't need to wait on the promise. // tslint:disable-next-line:no-floating-promises this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server.")); }; @@ -9731,18 +1703,14 @@ var HubConnection = /** @class */ (function () { var _this = this; var methods = this.methods[invocationMessage.target.toLowerCase()]; if (methods) { - try { - methods.forEach(function (m) { return m.apply(_this, invocationMessage.arguments); }); - } - catch (e) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Error, "A callback for the method " + invocationMessage.target.toLowerCase() + " threw error '" + e + "'."); - } + methods.forEach(function (m) { return m.apply(_this, invocationMessage.arguments); }); if (invocationMessage.invocationId) { // This is not supported in v1. So we return an error to avoid blocking the server waiting for the response. var message = "Server requested a response, which is not supported in this version of the client."; this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Error, message); - // We don't want to wait on the stop itself. - this.stopPromise = this.stopInternal(new Error(message)); + // We don't need to wait on this Promise. + // tslint:disable-next-line:no-floating-promises + this.connection.stop(new Error(message)); } } else { @@ -9750,148 +1718,23 @@ var HubConnection = /** @class */ (function () { } }; HubConnection.prototype.connectionClosed = function (error) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "HubConnection.connectionClosed(" + error + ") called while in state " + this.connectionState + "."); - // Triggering this.handshakeRejecter is insufficient because it could already be resolved without the continuation having run yet. - this.stopDuringStartError = this.stopDuringStartError || error || new Error("The underlying connection was closed before the hub handshake could complete."); - // If the handshake is in progress, start will be waiting for the handshake promise, so we complete it. - // If it has already completed, this should just noop. - if (this.handshakeResolver) { - this.handshakeResolver(); - } - this.cancelCallbacksWithError(error || new Error("Invocation canceled due to the underlying connection being closed.")); - this.cleanupTimeout(); - this.cleanupPingTimer(); - if (this.connectionState === HubConnectionState.Disconnecting) { - this.completeClose(error); - } - else if (this.connectionState === HubConnectionState.Connected && this.reconnectPolicy) { - // tslint:disable-next-line:no-floating-promises - this.reconnect(error); - } - else if (this.connectionState === HubConnectionState.Connected) { - this.completeClose(error); - } - // If none of the above if conditions were true were called the HubConnection must be in either: - // 1. The Connecting state in which case the handshakeResolver will complete it and stopDuringStartError will fail it. - // 2. The Reconnecting state in which case the handshakeResolver will complete it and stopDuringStartError will fail the current reconnect attempt - // and potentially continue the reconnect() loop. - // 3. The Disconnected state in which case we're already done. - }; - HubConnection.prototype.completeClose = function (error) { var _this = this; - if (this.connectionStarted) { - this.connectionState = HubConnectionState.Disconnected; - this.connectionStarted = false; - try { - this.closedCallbacks.forEach(function (c) { return c.apply(_this, [error]); }); - } - catch (e) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Error, "An onclose callback called with error '" + error + "' threw error '" + e + "'."); - } - } - }; - HubConnection.prototype.reconnect = function (error) { - return __awaiter(this, void 0, void 0, function () { - var reconnectStartTime, previousReconnectAttempts, nextRetryDelay, e_4; - var _this = this; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - reconnectStartTime = Date.now(); - previousReconnectAttempts = 0; - nextRetryDelay = this.getNextRetryDelay(previousReconnectAttempts++, 0); - if (nextRetryDelay === null) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Connection not reconnecting because the IReconnectPolicy returned null on the first reconnect attempt."); - this.completeClose(error); - return [2 /*return*/]; - } - this.connectionState = HubConnectionState.Reconnecting; - if (error) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Information, "Connection reconnecting because of error '" + error + "'."); - } - else { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Information, "Connection reconnecting."); - } - if (this.onreconnecting) { - try { - this.reconnectingCallbacks.forEach(function (c) { return c.apply(_this, [error]); }); - } - catch (e) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Error, "An onreconnecting callback called with error '" + error + "' threw error '" + e + "'."); - } - // Exit early if an onreconnecting callback called connection.stop(). - if (this.connectionState !== HubConnectionState.Reconnecting) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Connection left the reconnecting state in onreconnecting callback. Done reconnecting."); - return [2 /*return*/]; - } - } - _a.label = 1; - case 1: - if (!(nextRetryDelay !== null)) return [3 /*break*/, 7]; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Information, "Reconnect attempt number " + previousReconnectAttempts + " will start in " + nextRetryDelay + " ms."); - return [4 /*yield*/, new Promise(function (resolve) { - _this.reconnectDelayHandle = setTimeout(resolve, nextRetryDelay); - })]; - case 2: - _a.sent(); - this.reconnectDelayHandle = undefined; - if (this.connectionState !== HubConnectionState.Reconnecting) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Connection left the reconnecting state during reconnect delay. Done reconnecting."); - return [2 /*return*/]; - } - _a.label = 3; - case 3: - _a.trys.push([3, 5, , 6]); - return [4 /*yield*/, this.startInternal()]; - case 4: - _a.sent(); - this.connectionState = HubConnectionState.Connected; - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Information, "HubConnection reconnected successfully."); - if (this.onreconnected) { - try { - this.reconnectedCallbacks.forEach(function (c) { return c.apply(_this, [_this.connection.connectionId]); }); - } - catch (e) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Error, "An onreconnected callback called with connectionId '" + this.connection.connectionId + "; threw error '" + e + "'."); - } - } - return [2 /*return*/]; - case 5: - e_4 = _a.sent(); - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Information, "Reconnect attempt failed because of error '" + e_4 + "'."); - if (this.connectionState !== HubConnectionState.Reconnecting) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Debug, "Connection left the reconnecting state during reconnect attempt. Done reconnecting."); - return [2 /*return*/]; - } - return [3 /*break*/, 6]; - case 6: - nextRetryDelay = this.getNextRetryDelay(previousReconnectAttempts++, Date.now() - reconnectStartTime); - return [3 /*break*/, 1]; - case 7: - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Information, "Reconnect retries have been exhausted after " + (Date.now() - reconnectStartTime) + " ms and " + previousReconnectAttempts + " failed attempts. Connection disconnecting."); - this.completeClose(); - return [2 /*return*/]; - } - }); - }); - }; - HubConnection.prototype.getNextRetryDelay = function (previousRetryCount, elapsedMilliseconds) { - try { - return this.reconnectPolicy.nextRetryDelayInMilliseconds(previousRetryCount, elapsedMilliseconds); - } - catch (e) { - this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Error, "IReconnectPolicy.nextRetryDelayInMilliseconds(" + previousRetryCount + ", " + elapsedMilliseconds + ") threw error '" + e + "'."); - return null; - } - }; - HubConnection.prototype.cancelCallbacksWithError = function (error) { var callbacks = this.callbacks; this.callbacks = {}; + this.connectionState = HubConnectionState.Disconnected; + // if handshake is in progress start will be waiting for the handshake promise, so we complete it + // if it has already completed this should just noop + if (this.handshakeRejecter) { + this.handshakeRejecter(error); + } Object.keys(callbacks) .forEach(function (key) { var callback = callbacks[key]; - callback(null, error); + callback(null, error ? error : new Error("Invocation canceled due to connection being closed.")); }); + this.cleanupTimeout(); + this.cleanupPingTimer(); + this.closedCallbacks.forEach(function (c) { return c.apply(_this, [error]); }); }; HubConnection.prototype.cleanupPingTimer = function () { if (this.pingServerHandle) { @@ -9903,93 +1746,31 @@ var HubConnection = /** @class */ (function () { clearTimeout(this.timeoutHandle); } }; - HubConnection.prototype.createInvocation = function (methodName, args, nonblocking, streamIds) { + HubConnection.prototype.createInvocation = function (methodName, args, nonblocking) { if (nonblocking) { return { arguments: args, - streamIds: streamIds, target: methodName, type: _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Invocation, }; } else { - var invocationId = this.invocationId; - this.invocationId++; + var id = this.id; + this.id++; return { arguments: args, - invocationId: invocationId.toString(), - streamIds: streamIds, + invocationId: id.toString(), target: methodName, type: _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Invocation, }; } }; - HubConnection.prototype.launchStreams = function (streams, promiseQueue) { - var _this = this; - if (streams.length === 0) { - return; - } - // Synchronize stream data so they arrive in-order on the server - if (!promiseQueue) { - promiseQueue = Promise.resolve(); - } - var _loop_1 = function (streamId) { - streams[streamId].subscribe({ - complete: function () { - promiseQueue = promiseQueue.then(function () { return _this.sendWithProtocol(_this.createCompletionMessage(streamId)); }); - }, - error: function (err) { - var message; - if (err instanceof Error) { - message = err.message; - } - else if (err && err.toString) { - message = err.toString(); - } - else { - message = "Unknown error"; - } - promiseQueue = promiseQueue.then(function () { return _this.sendWithProtocol(_this.createCompletionMessage(streamId, message)); }); - }, - next: function (item) { - promiseQueue = promiseQueue.then(function () { return _this.sendWithProtocol(_this.createStreamItemMessage(streamId, item)); }); - }, - }); - }; - // We want to iterate over the keys, since the keys are the stream ids - // tslint:disable-next-line:forin - for (var streamId in streams) { - _loop_1(streamId); - } - }; - HubConnection.prototype.replaceStreamingParams = function (args) { - var streams = []; - var streamIds = []; - for (var i = 0; i < args.length; i++) { - var argument = args[i]; - if (this.isObservable(argument)) { - var streamId = this.invocationId; - this.invocationId++; - // Store the stream for later use - streams[streamId] = argument; - streamIds.push(streamId.toString()); - // remove stream from args - args.splice(i, 1); - } - } - return [streams, streamIds]; - }; - HubConnection.prototype.isObservable = function (arg) { - // This allows other stream implementations to just work (like rxjs) - return arg && arg.subscribe && typeof arg.subscribe === "function"; - }; - HubConnection.prototype.createStreamInvocation = function (methodName, args, streamIds) { - var invocationId = this.invocationId; - this.invocationId++; + HubConnection.prototype.createStreamInvocation = function (methodName, args) { + var id = this.id; + this.id++; return { arguments: args, - invocationId: invocationId.toString(), - streamIds: streamIds, + invocationId: id.toString(), target: methodName, type: _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].StreamInvocation, }; @@ -10000,27 +1781,6 @@ var HubConnection = /** @class */ (function () { type: _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].CancelInvocation, }; }; - HubConnection.prototype.createStreamItemMessage = function (id, item) { - return { - invocationId: id, - item: item, - type: _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].StreamItem, - }; - }; - HubConnection.prototype.createCompletionMessage = function (id, error, result) { - if (error) { - return { - error: error, - invocationId: id, - type: _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Completion, - }; - } - return { - invocationId: id, - result: result, - type: _IHubProtocol__WEBPACK_IMPORTED_MODULE_1__["MessageType"].Completion, - }; - }; return HubConnection; }()); @@ -10038,82 +1798,44 @@ var HubConnection = /** @class */ (function () { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HubConnectionBuilder", function() { return HubConnectionBuilder; }); -/* harmony import */ var _DefaultReconnectPolicy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DefaultReconnectPolicy */ "../node_modules/@aspnet/signalr/dist/esm/DefaultReconnectPolicy.js"); -/* harmony import */ var _HttpConnection__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./HttpConnection */ "../node_modules/@aspnet/signalr/dist/esm/HttpConnection.js"); -/* harmony import */ var _HubConnection__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./HubConnection */ "../node_modules/@aspnet/signalr/dist/esm/HubConnection.js"); -/* harmony import */ var _ILogger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ILogger */ "../node_modules/@aspnet/signalr/dist/esm/ILogger.js"); -/* harmony import */ var _JsonHubProtocol__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./JsonHubProtocol */ "../node_modules/@aspnet/signalr/dist/esm/JsonHubProtocol.js"); -/* harmony import */ var _Loggers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Loggers */ "../node_modules/@aspnet/signalr/dist/esm/Loggers.js"); -/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Utils */ "../node_modules/@aspnet/signalr/dist/esm/Utils.js"); +/* harmony import */ var _HttpConnection__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./HttpConnection */ "../node_modules/@aspnet/signalr/dist/esm/HttpConnection.js"); +/* harmony import */ var _HubConnection__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./HubConnection */ "../node_modules/@aspnet/signalr/dist/esm/HubConnection.js"); +/* harmony import */ var _JsonHubProtocol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./JsonHubProtocol */ "../node_modules/@aspnet/signalr/dist/esm/JsonHubProtocol.js"); +/* harmony import */ var _Loggers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Loggers */ "../node_modules/@aspnet/signalr/dist/esm/Loggers.js"); +/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Utils */ "../node_modules/@aspnet/signalr/dist/esm/Utils.js"); // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -var __assign = (undefined && undefined.__assign) || Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; -}; - - -// tslint:disable:object-literal-sort-keys -var LogLevelNameMapping = { - trace: _ILogger__WEBPACK_IMPORTED_MODULE_3__["LogLevel"].Trace, - debug: _ILogger__WEBPACK_IMPORTED_MODULE_3__["LogLevel"].Debug, - info: _ILogger__WEBPACK_IMPORTED_MODULE_3__["LogLevel"].Information, - information: _ILogger__WEBPACK_IMPORTED_MODULE_3__["LogLevel"].Information, - warn: _ILogger__WEBPACK_IMPORTED_MODULE_3__["LogLevel"].Warning, - warning: _ILogger__WEBPACK_IMPORTED_MODULE_3__["LogLevel"].Warning, - error: _ILogger__WEBPACK_IMPORTED_MODULE_3__["LogLevel"].Error, - critical: _ILogger__WEBPACK_IMPORTED_MODULE_3__["LogLevel"].Critical, - none: _ILogger__WEBPACK_IMPORTED_MODULE_3__["LogLevel"].None, -}; -function parseLogLevel(name) { - // Case-insensitive matching via lower-casing - // Yes, I know case-folding is a complicated problem in Unicode, but we only support - // the ASCII strings defined in LogLevelNameMapping anyway, so it's fine -anurse. - var mapping = LogLevelNameMapping[name.toLowerCase()]; - if (typeof mapping !== "undefined") { - return mapping; - } - else { - throw new Error("Unknown log level: " + name); - } -} /** A builder for configuring {@link @aspnet/signalr.HubConnection} instances. */ var HubConnectionBuilder = /** @class */ (function () { function HubConnectionBuilder() { } HubConnectionBuilder.prototype.configureLogging = function (logging) { - _Utils__WEBPACK_IMPORTED_MODULE_6__["Arg"].isRequired(logging, "logging"); + _Utils__WEBPACK_IMPORTED_MODULE_4__["Arg"].isRequired(logging, "logging"); if (isLogger(logging)) { this.logger = logging; } - else if (typeof logging === "string") { - var logLevel = parseLogLevel(logging); - this.logger = new _Utils__WEBPACK_IMPORTED_MODULE_6__["ConsoleLogger"](logLevel); - } else { - this.logger = new _Utils__WEBPACK_IMPORTED_MODULE_6__["ConsoleLogger"](logging); + this.logger = new _Utils__WEBPACK_IMPORTED_MODULE_4__["ConsoleLogger"](logging); } return this; }; HubConnectionBuilder.prototype.withUrl = function (url, transportTypeOrOptions) { - _Utils__WEBPACK_IMPORTED_MODULE_6__["Arg"].isRequired(url, "url"); + _Utils__WEBPACK_IMPORTED_MODULE_4__["Arg"].isRequired(url, "url"); this.url = url; // Flow-typing knows where it's at. Since HttpTransportType is a number and IHttpConnectionOptions is guaranteed // to be an object, we know (as does TypeScript) this comparison is all we need to figure out which overload was called. if (typeof transportTypeOrOptions === "object") { - this.httpConnectionOptions = __assign({}, this.httpConnectionOptions, transportTypeOrOptions); + this.httpConnectionOptions = transportTypeOrOptions; } else { - this.httpConnectionOptions = __assign({}, this.httpConnectionOptions, { transport: transportTypeOrOptions }); + this.httpConnectionOptions = { + transport: transportTypeOrOptions, + }; } return this; }; @@ -10122,25 +1844,10 @@ var HubConnectionBuilder = /** @class */ (function () { * @param {IHubProtocol} protocol The {@link @aspnet/signalr.IHubProtocol} implementation to use. */ HubConnectionBuilder.prototype.withHubProtocol = function (protocol) { - _Utils__WEBPACK_IMPORTED_MODULE_6__["Arg"].isRequired(protocol, "protocol"); + _Utils__WEBPACK_IMPORTED_MODULE_4__["Arg"].isRequired(protocol, "protocol"); this.protocol = protocol; return this; }; - HubConnectionBuilder.prototype.withAutomaticReconnect = function (retryDelaysOrReconnectPolicy) { - if (this.reconnectPolicy) { - throw new Error("A reconnectPolicy has already been set."); - } - if (!retryDelaysOrReconnectPolicy) { - this.reconnectPolicy = new _DefaultReconnectPolicy__WEBPACK_IMPORTED_MODULE_0__["DefaultReconnectPolicy"](); - } - else if (Array.isArray(retryDelaysOrReconnectPolicy)) { - this.reconnectPolicy = new _DefaultReconnectPolicy__WEBPACK_IMPORTED_MODULE_0__["DefaultReconnectPolicy"](retryDelaysOrReconnectPolicy); - } - else { - this.reconnectPolicy = retryDelaysOrReconnectPolicy; - } - return this; - }; /** Creates a {@link @aspnet/signalr.HubConnection} from the configuration options specified in this builder. * * @returns {HubConnection} The configured {@link @aspnet/signalr.HubConnection}. @@ -10158,8 +1865,8 @@ var HubConnectionBuilder = /** @class */ (function () { if (!this.url) { throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection."); } - var connection = new _HttpConnection__WEBPACK_IMPORTED_MODULE_1__["HttpConnection"](this.url, httpConnectionOptions); - return _HubConnection__WEBPACK_IMPORTED_MODULE_2__["HubConnection"].create(connection, this.logger || _Loggers__WEBPACK_IMPORTED_MODULE_5__["NullLogger"].instance, this.protocol || new _JsonHubProtocol__WEBPACK_IMPORTED_MODULE_4__["JsonHubProtocol"](), this.reconnectPolicy); + var connection = new _HttpConnection__WEBPACK_IMPORTED_MODULE_0__["HttpConnection"](this.url, httpConnectionOptions); + return _HubConnection__WEBPACK_IMPORTED_MODULE_1__["HubConnection"].create(connection, this.logger || _Loggers__WEBPACK_IMPORTED_MODULE_3__["NullLogger"].instance, this.protocol || new _JsonHubProtocol__WEBPACK_IMPORTED_MODULE_2__["JsonHubProtocol"]()); }; return HubConnectionBuilder; }()); @@ -10735,121 +2442,6 @@ var LongPollingTransport = /** @class */ (function () { /***/ }), -/***/ "../node_modules/@aspnet/signalr/dist/esm/NodeHttpClient.js": -/*!******************************************************************!*\ - !*** ../node_modules/@aspnet/signalr/dist/esm/NodeHttpClient.js ***! - \******************************************************************/ -/*! exports provided: NodeHttpClient */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* WEBPACK VAR INJECTION */(function(Buffer) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NodeHttpClient", function() { return NodeHttpClient; }); -/* harmony import */ var _Errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Errors */ "../node_modules/@aspnet/signalr/dist/esm/Errors.js"); -/* harmony import */ var _HttpClient__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./HttpClient */ "../node_modules/@aspnet/signalr/dist/esm/HttpClient.js"); -/* harmony import */ var _ILogger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ILogger */ "../node_modules/@aspnet/signalr/dist/esm/ILogger.js"); -/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Utils */ "../node_modules/@aspnet/signalr/dist/esm/Utils.js"); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -var __extends = (undefined && undefined.__extends) || (function () { - var extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __assign = (undefined && undefined.__assign) || Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; -}; - - - - -var requestModule; -if (typeof XMLHttpRequest === "undefined") { - // In order to ignore the dynamic require in webpack builds we need to do this magic - // @ts-ignore: TS doesn't know about these names - var requireFunc = true ? require : undefined; - requestModule = requireFunc("request"); -} -var NodeHttpClient = /** @class */ (function (_super) { - __extends(NodeHttpClient, _super); - function NodeHttpClient(logger) { - var _this = _super.call(this) || this; - if (typeof requestModule === "undefined") { - throw new Error("The 'request' module could not be loaded."); - } - _this.logger = logger; - _this.cookieJar = requestModule.jar(); - _this.request = requestModule.defaults({ jar: _this.cookieJar }); - return _this; - } - NodeHttpClient.prototype.send = function (httpRequest) { - var _this = this; - return new Promise(function (resolve, reject) { - var requestBody; - if (Object(_Utils__WEBPACK_IMPORTED_MODULE_3__["isArrayBuffer"])(httpRequest.content)) { - requestBody = Buffer.from(httpRequest.content); - } - else { - requestBody = httpRequest.content || ""; - } - var currentRequest = _this.request(httpRequest.url, { - body: requestBody, - // If binary is expected 'null' should be used, otherwise for text 'utf8' - encoding: httpRequest.responseType === "arraybuffer" ? null : "utf8", - headers: __assign({ - // Tell auth middleware to 401 instead of redirecting - "X-Requested-With": "XMLHttpRequest" }, httpRequest.headers), - method: httpRequest.method, - timeout: httpRequest.timeout, - }, function (error, response, body) { - if (httpRequest.abortSignal) { - httpRequest.abortSignal.onabort = null; - } - if (error) { - if (error.code === "ETIMEDOUT") { - _this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Warning, "Timeout from HTTP request."); - reject(new _Errors__WEBPACK_IMPORTED_MODULE_0__["TimeoutError"]()); - } - _this.logger.log(_ILogger__WEBPACK_IMPORTED_MODULE_2__["LogLevel"].Warning, "Error from HTTP request. " + error); - reject(error); - return; - } - if (response.statusCode >= 200 && response.statusCode < 300) { - resolve(new _HttpClient__WEBPACK_IMPORTED_MODULE_1__["HttpResponse"](response.statusCode, response.statusMessage || "", body)); - } - else { - reject(new _Errors__WEBPACK_IMPORTED_MODULE_0__["HttpError"](response.statusMessage || "", response.statusCode || 0)); - } - }); - if (httpRequest.abortSignal) { - httpRequest.abortSignal.onabort = function () { - currentRequest.abort(); - reject(new _Errors__WEBPACK_IMPORTED_MODULE_0__["AbortError"]()); - }; - } - }); - }; - NodeHttpClient.prototype.getCookieString = function (url) { - return this.cookieJar.getCookieString(url); - }; - return NodeHttpClient; -}(_HttpClient__WEBPACK_IMPORTED_MODULE_1__["HttpClient"])); - -//# sourceMappingURL=NodeHttpClient.js.map -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../buffer/index.js */ "../node_modules/buffer/index.js").Buffer)) - -/***/ }), - /***/ "../node_modules/@aspnet/signalr/dist/esm/ServerSentEventsTransport.js": /*!*****************************************************************************!*\ !*** ../node_modules/@aspnet/signalr/dist/esm/ServerSentEventsTransport.js ***! @@ -10942,7 +2534,7 @@ var ServerSentEventsTransport = /** @class */ (function () { return; } var eventSource; - if (_Utils__WEBPACK_IMPORTED_MODULE_2__["Platform"].isBrowser || _Utils__WEBPACK_IMPORTED_MODULE_2__["Platform"].isWebWorker) { + if (typeof window !== "undefined") { eventSource = new _this.eventSourceConstructor(url, { withCredentials: true }); } else { @@ -11018,58 +2610,6 @@ var ServerSentEventsTransport = /** @class */ (function () { /***/ }), -/***/ "../node_modules/@aspnet/signalr/dist/esm/Subject.js": -/*!***********************************************************!*\ - !*** ../node_modules/@aspnet/signalr/dist/esm/Subject.js ***! - \***********************************************************/ -/*! exports provided: Subject */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Subject", function() { return Subject; }); -/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Utils */ "../node_modules/@aspnet/signalr/dist/esm/Utils.js"); -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -/** Stream implementation to stream items to the server. */ -var Subject = /** @class */ (function () { - function Subject() { - this.observers = []; - } - Subject.prototype.next = function (item) { - for (var _i = 0, _a = this.observers; _i < _a.length; _i++) { - var observer = _a[_i]; - observer.next(item); - } - }; - Subject.prototype.error = function (err) { - for (var _i = 0, _a = this.observers; _i < _a.length; _i++) { - var observer = _a[_i]; - if (observer.error) { - observer.error(err); - } - } - }; - Subject.prototype.complete = function () { - for (var _i = 0, _a = this.observers; _i < _a.length; _i++) { - var observer = _a[_i]; - if (observer.complete) { - observer.complete(); - } - } - }; - Subject.prototype.subscribe = function (observer) { - this.observers.push(observer); - return new _Utils__WEBPACK_IMPORTED_MODULE_0__["SubjectSubscription"](this, observer); - }; - return Subject; -}()); - -//# sourceMappingURL=Subject.js.map - -/***/ }), - /***/ "../node_modules/@aspnet/signalr/dist/esm/TextMessageFormat.js": /*!*********************************************************************!*\ !*** ../node_modules/@aspnet/signalr/dist/esm/TextMessageFormat.js ***! @@ -11111,18 +2651,18 @@ var TextMessageFormat = /** @class */ (function () { /*!*********************************************************!*\ !*** ../node_modules/@aspnet/signalr/dist/esm/Utils.js ***! \*********************************************************/ -/*! exports provided: Arg, Platform, getDataDetail, formatArrayBuffer, isArrayBuffer, sendMessage, createLogger, SubjectSubscription, ConsoleLogger */ +/*! exports provided: Arg, getDataDetail, formatArrayBuffer, isArrayBuffer, sendMessage, createLogger, Subject, SubjectSubscription, ConsoleLogger */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Arg", function() { return Arg; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Platform", function() { return Platform; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDataDetail", function() { return getDataDetail; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatArrayBuffer", function() { return formatArrayBuffer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return isArrayBuffer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sendMessage", function() { return sendMessage; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLogger", function() { return createLogger; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Subject", function() { return Subject; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SubjectSubscription", function() { return SubjectSubscription; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConsoleLogger", function() { return ConsoleLogger; }); /* harmony import */ var _ILogger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ILogger */ "../node_modules/@aspnet/signalr/dist/esm/ILogger.js"); @@ -11184,34 +2724,6 @@ var Arg = /** @class */ (function () { return Arg; }()); -/** @private */ -var Platform = /** @class */ (function () { - function Platform() { - } - Object.defineProperty(Platform, "isBrowser", { - get: function () { - return typeof window === "object"; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Platform, "isWebWorker", { - get: function () { - return typeof self === "object" && "importScripts" in self; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Platform, "isNode", { - get: function () { - return !this.isBrowser && !this.isWebWorker; - }, - enumerable: true, - configurable: true - }); - return Platform; -}()); - /** @private */ function getDataDetail(data, includeContent) { var detail = ""; @@ -11295,6 +2807,41 @@ function createLogger(logger) { } return new ConsoleLogger(logger); } +/** @private */ +var Subject = /** @class */ (function () { + function Subject(cancelCallback) { + this.observers = []; + this.cancelCallback = cancelCallback; + } + Subject.prototype.next = function (item) { + for (var _i = 0, _a = this.observers; _i < _a.length; _i++) { + var observer = _a[_i]; + observer.next(item); + } + }; + Subject.prototype.error = function (err) { + for (var _i = 0, _a = this.observers; _i < _a.length; _i++) { + var observer = _a[_i]; + if (observer.error) { + observer.error(err); + } + } + }; + Subject.prototype.complete = function () { + for (var _i = 0, _a = this.observers; _i < _a.length; _i++) { + var observer = _a[_i]; + if (observer.complete) { + observer.complete(); + } + } + }; + Subject.prototype.subscribe = function (observer) { + this.observers.push(observer); + return new SubjectSubscription(this, observer); + }; + return Subject; +}()); + /** @private */ var SubjectSubscription = /** @class */ (function () { function SubjectSubscription(subject, observer) { @@ -11306,7 +2853,7 @@ var SubjectSubscription = /** @class */ (function () { if (index > -1) { this.subject.observers.splice(index, 1); } - if (this.subject.observers.length === 0 && this.subject.cancelCallback) { + if (this.subject.observers.length === 0) { this.subject.cancelCallback().catch(function (_) { }); } }; @@ -11317,24 +2864,23 @@ var SubjectSubscription = /** @class */ (function () { var ConsoleLogger = /** @class */ (function () { function ConsoleLogger(minimumLogLevel) { this.minimumLogLevel = minimumLogLevel; - this.outputConsole = console; } ConsoleLogger.prototype.log = function (logLevel, message) { if (logLevel >= this.minimumLogLevel) { switch (logLevel) { case _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Critical: case _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Error: - this.outputConsole.error("[" + new Date().toISOString() + "] " + _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"][logLevel] + ": " + message); + console.error("[" + new Date().toISOString() + "] " + _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"][logLevel] + ": " + message); break; case _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Warning: - this.outputConsole.warn("[" + new Date().toISOString() + "] " + _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"][logLevel] + ": " + message); + console.warn("[" + new Date().toISOString() + "] " + _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"][logLevel] + ": " + message); break; case _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"].Information: - this.outputConsole.info("[" + new Date().toISOString() + "] " + _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"][logLevel] + ": " + message); + console.info("[" + new Date().toISOString() + "] " + _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"][logLevel] + ": " + message); break; default: // console.debug only goes to attached debuggers in Node, so we use console.log for Trace and Debug - this.outputConsole.log("[" + new Date().toISOString() + "] " + _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"][logLevel] + ": " + message); + console.log("[" + new Date().toISOString() + "] " + _ILogger__WEBPACK_IMPORTED_MODULE_0__["LogLevel"][logLevel] + ": " + message); break; } } @@ -11433,7 +2979,7 @@ var WebSocketTransport = /** @class */ (function () { url = url.replace(/^http/, "ws"); var webSocket; var cookies = _this.httpClient.getCookieString(url); - if (_Utils__WEBPACK_IMPORTED_MODULE_2__["Platform"].isNode && cookies) { + if (typeof window === "undefined" && cookies) { // Only pass cookies when in non-browser environments webSocket = new _this.webSocketConstructor(url, undefined, { headers: { @@ -11622,7 +3168,7 @@ var XhrHttpClient = /** @class */ (function (_super) { /*!*********************************************************!*\ !*** ../node_modules/@aspnet/signalr/dist/esm/index.js ***! \*********************************************************/ -/*! exports provided: VERSION, AbortError, HttpError, TimeoutError, HttpClient, HttpResponse, DefaultHttpClient, HubConnection, HubConnectionState, HubConnectionBuilder, MessageType, LogLevel, HttpTransportType, TransferFormat, NullLogger, JsonHubProtocol, Subject */ +/*! exports provided: VERSION, AbortError, HttpError, TimeoutError, HttpClient, HttpResponse, DefaultHttpClient, HubConnection, HubConnectionState, HubConnectionBuilder, MessageType, LogLevel, HttpTransportType, TransferFormat, NullLogger, JsonHubProtocol */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -11668,15 +3214,11 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _JsonHubProtocol__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./JsonHubProtocol */ "../node_modules/@aspnet/signalr/dist/esm/JsonHubProtocol.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "JsonHubProtocol", function() { return _JsonHubProtocol__WEBPACK_IMPORTED_MODULE_9__["JsonHubProtocol"]; }); -/* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Subject */ "../node_modules/@aspnet/signalr/dist/esm/Subject.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Subject", function() { return _Subject__WEBPACK_IMPORTED_MODULE_10__["Subject"]; }); - // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Version token that will be replaced by the prepack command /** The version of the SignalR client. */ -var VERSION = "0.0.0-DEV_BUILD"; - +var VERSION = "1.1.2"; @@ -12605,6 +4147,401 @@ function fromByteArray (uint8) { } +/***/ }), + +/***/ "../node_modules/bl/bl.js": +/*!********************************!*\ + !*** ../node_modules/bl/bl.js ***! + \********************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var DuplexStream = __webpack_require__(/*! readable-stream */ "../node_modules/readable-stream/readable-browser.js").Duplex + , util = __webpack_require__(/*! util */ "../node_modules/util/util.js") + , Buffer = __webpack_require__(/*! safe-buffer */ "../node_modules/safe-buffer/index.js").Buffer + +function BufferList (callback) { + if (!(this instanceof BufferList)) + return new BufferList(callback) + + this._bufs = [] + this.length = 0 + + if (typeof callback == 'function') { + this._callback = callback + + var piper = function piper (err) { + if (this._callback) { + this._callback(err) + this._callback = null + } + }.bind(this) + + this.on('pipe', function onPipe (src) { + src.on('error', piper) + }) + this.on('unpipe', function onUnpipe (src) { + src.removeListener('error', piper) + }) + } else { + this.append(callback) + } + + DuplexStream.call(this) +} + + +util.inherits(BufferList, DuplexStream) + + +BufferList.prototype._offset = function _offset (offset) { + var tot = 0, i = 0, _t + if (offset === 0) return [ 0, 0 ] + for (; i < this._bufs.length; i++) { + _t = tot + this._bufs[i].length + if (offset < _t || i == this._bufs.length - 1) { + return [ i, offset - tot ] + } + tot = _t + } +} + +BufferList.prototype._reverseOffset = function (blOffset) { + var bufferId = blOffset[0] + var offset = blOffset[1] + for (var i = 0; i < bufferId; i++) { + offset += this._bufs[i].length + } + return offset +} + +BufferList.prototype.append = function append (buf) { + var i = 0 + + if (Buffer.isBuffer(buf)) { + this._appendBuffer(buf) + } else if (Array.isArray(buf)) { + for (; i < buf.length; i++) + this.append(buf[i]) + } else if (buf instanceof BufferList) { + // unwrap argument into individual BufferLists + for (; i < buf._bufs.length; i++) + this.append(buf._bufs[i]) + } else if (buf != null) { + // coerce number arguments to strings, since Buffer(number) does + // uninitialized memory allocation + if (typeof buf == 'number') + buf = buf.toString() + + this._appendBuffer(Buffer.from(buf)) + } + + return this +} + + +BufferList.prototype._appendBuffer = function appendBuffer (buf) { + this._bufs.push(buf) + this.length += buf.length +} + + +BufferList.prototype._write = function _write (buf, encoding, callback) { + this._appendBuffer(buf) + + if (typeof callback == 'function') + callback() +} + + +BufferList.prototype._read = function _read (size) { + if (!this.length) + return this.push(null) + + size = Math.min(size, this.length) + this.push(this.slice(0, size)) + this.consume(size) +} + + +BufferList.prototype.end = function end (chunk) { + DuplexStream.prototype.end.call(this, chunk) + + if (this._callback) { + this._callback(null, this.slice()) + this._callback = null + } +} + + +BufferList.prototype.get = function get (index) { + if (index > this.length || index < 0) { + return undefined + } + var offset = this._offset(index) + return this._bufs[offset[0]][offset[1]] +} + + +BufferList.prototype.slice = function slice (start, end) { + if (typeof start == 'number' && start < 0) + start += this.length + if (typeof end == 'number' && end < 0) + end += this.length + return this.copy(null, 0, start, end) +} + + +BufferList.prototype.copy = function copy (dst, dstStart, srcStart, srcEnd) { + if (typeof srcStart != 'number' || srcStart < 0) + srcStart = 0 + if (typeof srcEnd != 'number' || srcEnd > this.length) + srcEnd = this.length + if (srcStart >= this.length) + return dst || Buffer.alloc(0) + if (srcEnd <= 0) + return dst || Buffer.alloc(0) + + var copy = !!dst + , off = this._offset(srcStart) + , len = srcEnd - srcStart + , bytes = len + , bufoff = (copy && dstStart) || 0 + , start = off[1] + , l + , i + + // copy/slice everything + if (srcStart === 0 && srcEnd == this.length) { + if (!copy) { // slice, but full concat if multiple buffers + return this._bufs.length === 1 + ? this._bufs[0] + : Buffer.concat(this._bufs, this.length) + } + + // copy, need to copy individual buffers + for (i = 0; i < this._bufs.length; i++) { + this._bufs[i].copy(dst, bufoff) + bufoff += this._bufs[i].length + } + + return dst + } + + // easy, cheap case where it's a subset of one of the buffers + if (bytes <= this._bufs[off[0]].length - start) { + return copy + ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) + : this._bufs[off[0]].slice(start, start + bytes) + } + + if (!copy) // a slice, we need something to copy in to + dst = Buffer.allocUnsafe(len) + + for (i = off[0]; i < this._bufs.length; i++) { + l = this._bufs[i].length - start + + if (bytes > l) { + this._bufs[i].copy(dst, bufoff, start) + } else { + this._bufs[i].copy(dst, bufoff, start, start + bytes) + break + } + + bufoff += l + bytes -= l + + if (start) + start = 0 + } + + return dst +} + +BufferList.prototype.shallowSlice = function shallowSlice (start, end) { + start = start || 0 + end = typeof end !== 'number' ? this.length : end + + if (start < 0) + start += this.length + if (end < 0) + end += this.length + + if (start === end) { + return new BufferList() + } + var startOffset = this._offset(start) + , endOffset = this._offset(end) + , buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1) + + if (endOffset[1] == 0) + buffers.pop() + else + buffers[buffers.length-1] = buffers[buffers.length-1].slice(0, endOffset[1]) + + if (startOffset[1] != 0) + buffers[0] = buffers[0].slice(startOffset[1]) + + return new BufferList(buffers) +} + +BufferList.prototype.toString = function toString (encoding, start, end) { + return this.slice(start, end).toString(encoding) +} + +BufferList.prototype.consume = function consume (bytes) { + while (this._bufs.length) { + if (bytes >= this._bufs[0].length) { + bytes -= this._bufs[0].length + this.length -= this._bufs[0].length + this._bufs.shift() + } else { + this._bufs[0] = this._bufs[0].slice(bytes) + this.length -= bytes + break + } + } + return this +} + + +BufferList.prototype.duplicate = function duplicate () { + var i = 0 + , copy = new BufferList() + + for (; i < this._bufs.length; i++) + copy.append(this._bufs[i]) + + return copy +} + + +BufferList.prototype.destroy = function destroy () { + this._bufs.length = 0 + this.length = 0 + this.push(null) +} + + +BufferList.prototype.indexOf = function (search, offset, encoding) { + if (encoding === undefined && typeof offset === 'string') { + encoding = offset + offset = undefined + } + if (typeof search === 'function' || Array.isArray(search)) { + throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.') + } else if (typeof search === 'number') { + search = Buffer.from([search]) + } else if (typeof search === 'string') { + search = Buffer.from(search, encoding) + } else if (search instanceof BufferList) { + search = search.slice() + } else if (!Buffer.isBuffer(search)) { + search = Buffer.from(search) + } + + offset = Number(offset || 0) + if (isNaN(offset)) { + offset = 0 + } + + if (offset < 0) { + offset = this.length + offset + } + + if (offset < 0) { + offset = 0 + } + + if (search.length === 0) { + return offset > this.length ? this.length : offset + } + + var blOffset = this._offset(offset) + var blIndex = blOffset[0] // index of which internal buffer we're working on + var buffOffset = blOffset[1] // offset of the internal buffer we're working on + + // scan over each buffer + for (blIndex; blIndex < this._bufs.length; blIndex++) { + var buff = this._bufs[blIndex] + while(buffOffset < buff.length) { + var availableWindow = buff.length - buffOffset + if (availableWindow >= search.length) { + var nativeSearchResult = buff.indexOf(search, buffOffset) + if (nativeSearchResult !== -1) { + return this._reverseOffset([blIndex, nativeSearchResult]) + } + buffOffset = buff.length - search.length + 1 // end of native search window + } else { + var revOffset = this._reverseOffset([blIndex, buffOffset]) + if (this._match(revOffset, search)) { + return revOffset + } + buffOffset++ + } + } + buffOffset = 0 + } + return -1 +} + +BufferList.prototype._match = function(offset, search) { + if (this.length - offset < search.length) { + return false + } + for (var searchOffset = 0; searchOffset < search.length ; searchOffset++) { + if(this.get(offset + searchOffset) !== search[searchOffset]){ + return false + } + } + return true +} + + +;(function () { + var methods = { + 'readDoubleBE' : 8 + , 'readDoubleLE' : 8 + , 'readFloatBE' : 4 + , 'readFloatLE' : 4 + , 'readInt32BE' : 4 + , 'readInt32LE' : 4 + , 'readUInt32BE' : 4 + , 'readUInt32LE' : 4 + , 'readInt16BE' : 2 + , 'readInt16LE' : 2 + , 'readUInt16BE' : 2 + , 'readUInt16LE' : 2 + , 'readInt8' : 1 + , 'readUInt8' : 1 + , 'readIntBE' : null + , 'readIntLE' : null + , 'readUIntBE' : null + , 'readUIntLE' : null + } + + for (var m in methods) { + (function (m) { + if (methods[m] === null) { + BufferList.prototype[m] = function (offset, byteLength) { + return this.slice(offset, offset + byteLength)[m](0, byteLength) + } + } + else { + BufferList.prototype[m] = function (offset) { + return this.slice(offset, offset + methods[m])[m](0) + } + } + }(m)) + } +}()) + + +module.exports = BufferList + + /***/ }), /***/ "../node_modules/buffer/index.js": @@ -14409,6 +6346,125 @@ function isnan (val) { /***/ }), +/***/ "../node_modules/core-util-is/lib/util.js": +/*!************************************************!*\ + !*** ../node_modules/core-util-is/lib/util.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(Buffer) {// 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 objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = Buffer.isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../buffer/index.js */ "../node_modules/buffer/index.js").Buffer)) + +/***/ }), + /***/ "../node_modules/events/events.js": /*!****************************************!*\ !*** ../node_modules/events/events.js ***! @@ -15012,6 +7068,1065 @@ module.exports = Array.isArray || function (arr) { }; +/***/ }), + +/***/ "../node_modules/msgpack5/index.js": +/*!*****************************************!*\ + !*** ../node_modules/msgpack5/index.js ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Buffer = __webpack_require__(/*! safe-buffer */ "../node_modules/safe-buffer/index.js").Buffer +var assert = __webpack_require__(/*! assert */ "../node_modules/assert/assert.js") +var bl = __webpack_require__(/*! bl */ "../node_modules/bl/bl.js") +var streams = __webpack_require__(/*! ./lib/streams */ "../node_modules/msgpack5/lib/streams.js") +var buildDecode = __webpack_require__(/*! ./lib/decoder */ "../node_modules/msgpack5/lib/decoder.js") +var buildEncode = __webpack_require__(/*! ./lib/encoder */ "../node_modules/msgpack5/lib/encoder.js") + +function msgpack (options) { + var encodingTypes = [] + var decodingTypes = [] + + options = options || { + forceFloat64: false, + compatibilityMode: false, + disableTimestampEncoding: false // if true, skips encoding Dates using the msgpack timestamp ext format (-1) + } + + function registerEncoder (check, encode) { + assert(check, 'must have an encode function') + assert(encode, 'must have an encode function') + + encodingTypes.push({ + check: check, encode: encode + }) + + return this + } + + function registerDecoder (type, decode) { + assert(type >= 0, 'must have a non-negative type') + assert(decode, 'must have a decode function') + + decodingTypes.push({ + type: type, decode: decode + }) + + return this + } + + function register (type, constructor, encode, decode) { + assert(constructor, 'must have a constructor') + assert(encode, 'must have an encode function') + assert(type >= 0, 'must have a non-negative type') + assert(decode, 'must have a decode function') + + function check (obj) { + return (obj instanceof constructor) + } + + function reEncode (obj) { + var buf = bl() + var header = Buffer.allocUnsafe(1) + + header.writeInt8(type, 0) + + buf.append(header) + buf.append(encode(obj)) + + return buf + } + + this.registerEncoder(check, reEncode) + this.registerDecoder(type, decode) + + return this + } + + return { + encode: buildEncode(encodingTypes, options.forceFloat64, options.compatibilityMode, options.disableTimestampEncoding), + decode: buildDecode(decodingTypes), + register: register, + registerEncoder: registerEncoder, + registerDecoder: registerDecoder, + encoder: streams.encoder, + decoder: streams.decoder, + // needed for levelup support + buffer: true, + type: 'msgpack5', + IncompleteBufferError: buildDecode.IncompleteBufferError + } +} + +module.exports = msgpack + + +/***/ }), + +/***/ "../node_modules/msgpack5/lib/decoder.js": +/*!***********************************************!*\ + !*** ../node_modules/msgpack5/lib/decoder.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var bl = __webpack_require__(/*! bl */ "../node_modules/bl/bl.js") +var util = __webpack_require__(/*! util */ "../node_modules/util/util.js") + +function IncompleteBufferError (message) { + Error.call(this) // super constructor + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor) // super helper method to include stack trace in error object + } + this.name = this.constructor.name + this.message = message || 'unable to decode' +} + +util.inherits(IncompleteBufferError, Error) + +module.exports = function buildDecode (decodingTypes) { + return decode + + function getSize (first) { + switch (first) { + case 0xc4: + return 2 + case 0xc5: + return 3 + case 0xc6: + return 5 + case 0xc7: + return 3 + case 0xc8: + return 4 + case 0xc9: + return 6 + case 0xca: + return 5 + case 0xcb: + return 9 + case 0xcc: + return 2 + case 0xcd: + return 3 + case 0xce: + return 5 + case 0xcf: + return 9 + case 0xd0: + return 2 + case 0xd1: + return 3 + case 0xd2: + return 5 + case 0xd3: + return 9 + case 0xd4: + return 3 + case 0xd5: + return 4 + case 0xd6: + return 6 + case 0xd7: + return 10 + case 0xd8: + return 18 + case 0xd9: + return 2 + case 0xda: + return 3 + case 0xdb: + return 5 + case 0xde: + return 3 + default: + return -1 + } + } + + function hasMinBufferSize (first, length) { + var size = getSize(first) + + if (size !== -1 && length < size) { + return false + } else { + return true + } + } + + function isValidDataSize (dataLength, bufLength, headerLength) { + return bufLength >= headerLength + dataLength + } + + function buildDecodeResult (value, bytesConsumed) { + return { + value: value, + bytesConsumed: bytesConsumed + } + } + + function decode (buf) { + if (!(buf instanceof bl)) { + buf = bl().append(buf) + } + + var result = tryDecode(buf) + if (result) { + buf.consume(result.bytesConsumed) + return result.value + } else { + throw new IncompleteBufferError() + } + } + + function tryDecode (buf, offset) { + offset = offset === undefined ? 0 : offset + var bufLength = buf.length - offset + if (bufLength <= 0) { + return null + } + + var first = buf.readUInt8(offset) + var length + var result = 0 + var type + var bytePos + + if (!hasMinBufferSize(first, bufLength)) { + return null + } + + switch (first) { + case 0xc0: + return buildDecodeResult(null, 1) + case 0xc2: + return buildDecodeResult(false, 1) + case 0xc3: + return buildDecodeResult(true, 1) + case 0xcc: + // 1-byte unsigned int + result = buf.readUInt8(offset + 1) + return buildDecodeResult(result, 2) + case 0xcd: + // 2-bytes BE unsigned int + result = buf.readUInt16BE(offset + 1) + return buildDecodeResult(result, 3) + case 0xce: + // 4-bytes BE unsigned int + result = buf.readUInt32BE(offset + 1) + return buildDecodeResult(result, 5) + case 0xcf: + // 8-bytes BE unsigned int + // Read long byte by byte, big-endian + for (bytePos = 7; bytePos >= 0; bytePos--) { + result += (buf.readUInt8(offset + bytePos + 1) * Math.pow(2, (8 * (7 - bytePos)))) + } + return buildDecodeResult(result, 9) + case 0xd0: + // 1-byte signed int + result = buf.readInt8(offset + 1) + return buildDecodeResult(result, 2) + case 0xd1: + // 2-bytes signed int + result = buf.readInt16BE(offset + 1) + return buildDecodeResult(result, 3) + case 0xd2: + // 4-bytes signed int + result = buf.readInt32BE(offset + 1) + return buildDecodeResult(result, 5) + case 0xd3: + result = readInt64BE(buf.slice(offset + 1, offset + 9), 0) + return buildDecodeResult(result, 9) + case 0xca: + // 4-bytes float + result = buf.readFloatBE(offset + 1) + return buildDecodeResult(result, 5) + case 0xcb: + // 8-bytes double + result = buf.readDoubleBE(offset + 1) + return buildDecodeResult(result, 9) + case 0xd9: + // strings up to 2^8 - 1 bytes + length = buf.readUInt8(offset + 1) + if (!isValidDataSize(length, bufLength, 2)) { + return null + } + result = buf.toString('utf8', offset + 2, offset + 2 + length) + return buildDecodeResult(result, 2 + length) + case 0xda: + // strings up to 2^16 - 2 bytes + length = buf.readUInt16BE(offset + 1) + if (!isValidDataSize(length, bufLength, 3)) { + return null + } + result = buf.toString('utf8', offset + 3, offset + 3 + length) + return buildDecodeResult(result, 3 + length) + case 0xdb: + // strings up to 2^32 - 4 bytes + length = buf.readUInt32BE(offset + 1) + if (!isValidDataSize(length, bufLength, 5)) { + return null + } + result = buf.toString('utf8', offset + 5, offset + 5 + length) + return buildDecodeResult(result, 5 + length) + case 0xc4: + // buffers up to 2^8 - 1 bytes + length = buf.readUInt8(offset + 1) + if (!isValidDataSize(length, bufLength, 2)) { + return null + } + result = buf.slice(offset + 2, offset + 2 + length) + return buildDecodeResult(result, 2 + length) + case 0xc5: + // buffers up to 2^16 - 1 bytes + length = buf.readUInt16BE(offset + 1) + if (!isValidDataSize(length, bufLength, 3)) { + return null + } + result = buf.slice(offset + 3, offset + 3 + length) + return buildDecodeResult(result, 3 + length) + case 0xc6: + // buffers up to 2^32 - 1 bytes + length = buf.readUInt32BE(offset + 1) + if (!isValidDataSize(length, bufLength, 5)) { + return null + } + result = buf.slice(offset + 5, offset + 5 + length) + return buildDecodeResult(result, 5 + length) + case 0xdc: + // array up to 2^16 elements - 2 bytes + if (bufLength < 3) { + return null + } + + length = buf.readUInt16BE(offset + 1) + return decodeArray(buf, offset, length, 3) + case 0xdd: + // array up to 2^32 elements - 4 bytes + if (bufLength < 5) { + return null + } + + length = buf.readUInt32BE(offset + 1) + return decodeArray(buf, offset, length, 5) + case 0xde: + // maps up to 2^16 elements - 2 bytes + length = buf.readUInt16BE(offset + 1) + return decodeMap(buf, offset, length, 3) + case 0xdf: + length = buf.readUInt32BE(offset + 1) + return decodeMap(buf, offset, length, 5) + case 0xd4: + return decodeFixExt(buf, offset, 1) + case 0xd5: + return decodeFixExt(buf, offset, 2) + case 0xd6: + return decodeFixExt(buf, offset, 4) + case 0xd7: + return decodeFixExt(buf, offset, 8) + case 0xd8: + return decodeFixExt(buf, offset, 16) + case 0xc7: + // ext up to 2^8 - 1 bytes + length = buf.readUInt8(offset + 1) + type = buf.readUInt8(offset + 2) + if (!isValidDataSize(length, bufLength, 3)) { + return null + } + return decodeExt(buf, offset, type, length, 3) + case 0xc8: + // ext up to 2^16 - 1 bytes + length = buf.readUInt16BE(offset + 1) + type = buf.readUInt8(offset + 3) + if (!isValidDataSize(length, bufLength, 4)) { + return null + } + return decodeExt(buf, offset, type, length, 4) + case 0xc9: + // ext up to 2^32 - 1 bytes + length = buf.readUInt32BE(offset + 1) + type = buf.readUInt8(offset + 5) + if (!isValidDataSize(length, bufLength, 6)) { + return null + } + return decodeExt(buf, offset, type, length, 6) + } + + if ((first & 0xf0) === 0x90) { + // we have an array with less than 15 elements + length = first & 0x0f + return decodeArray(buf, offset, length, 1) + } else if ((first & 0xf0) === 0x80) { + // we have a map with less than 15 elements + length = first & 0x0f + return decodeMap(buf, offset, length, 1) + } else if ((first & 0xe0) === 0xa0) { + // fixstr up to 31 bytes + length = first & 0x1f + if (isValidDataSize(length, bufLength, 1)) { + result = buf.toString('utf8', offset + 1, offset + length + 1) + return buildDecodeResult(result, length + 1) + } else { + return null + } + } else if (first >= 0xe0) { + // 5 bits negative ints + result = first - 0x100 + return buildDecodeResult(result, 1) + } else if (first < 0x80) { + // 7-bits positive ints + return buildDecodeResult(first, 1) + } else { + throw new Error('not implemented yet') + } + } + + function readInt64BE (buf, offset) { + var negate = (buf[offset] & 0x80) == 0x80 // eslint-disable-line + + if (negate) { + var carry = 1 + for (var i = offset + 7; i >= offset; i--) { + var v = (buf[i] ^ 0xff) + carry + buf[i] = v & 0xff + carry = v >> 8 + } + } + + var hi = buf.readUInt32BE(offset + 0) + var lo = buf.readUInt32BE(offset + 4) + return (hi * 4294967296 + lo) * (negate ? -1 : +1) + } + + function decodeArray (buf, offset, length, headerLength) { + var result = [] + var i + var totalBytesConsumed = 0 + + offset += headerLength + for (i = 0; i < length; i++) { + var decodeResult = tryDecode(buf, offset) + if (decodeResult) { + result.push(decodeResult.value) + offset += decodeResult.bytesConsumed + totalBytesConsumed += decodeResult.bytesConsumed + } else { + return null + } + } + return buildDecodeResult(result, headerLength + totalBytesConsumed) + } + + function decodeMap (buf, offset, length, headerLength) { + var result = {} + var key + var i + var totalBytesConsumed = 0 + + offset += headerLength + for (i = 0; i < length; i++) { + var keyResult = tryDecode(buf, offset) + if (keyResult) { + offset += keyResult.bytesConsumed + var valueResult = tryDecode(buf, offset) + if (valueResult) { + key = keyResult.value + result[key] = valueResult.value + offset += valueResult.bytesConsumed + totalBytesConsumed += (keyResult.bytesConsumed + valueResult.bytesConsumed) + } else { + return null + } + } else { + return null + } + } + return buildDecodeResult(result, headerLength + totalBytesConsumed) + } + + function decodeFixExt (buf, offset, size) { + var type = buf.readInt8(offset + 1) // Signed + return decodeExt(buf, offset, type, size, 2) + } + + function decodeTimestamp (buf, size, headerSize) { + var seconds + var nanoseconds = 0 + + switch (size) { + case 4: + // timestamp 32 stores the number of seconds that have elapsed since 1970-01-01 00:00:00 UTC in an 32-bit unsigned integer + seconds = buf.readUInt32BE(0) + break + + case 8: + // Timestamp 64 stores the number of seconds and nanoseconds that have elapsed + // since 1970-01-01 00:00:00 UTC in 32-bit unsigned integers, split 30/34 bits + var upper = buf.readUInt32BE(0) + var lower = buf.readUInt32BE(4) + nanoseconds = upper / 4 + seconds = ((upper & 0x03) * Math.pow(2, 32)) + lower // If we use bitwise operators, we get truncated to 32bits + break + + case 12: + throw new Error('timestamp 96 is not yet implemented') + } + + var millis = (seconds * 1000) + Math.round(nanoseconds / 1E6) + return buildDecodeResult(new Date(millis), size + headerSize) + } + + function decodeExt (buf, offset, type, size, headerSize) { + var i, + toDecode + + offset += headerSize + + // Pre-defined + if (type < 0) { // Reserved for future extensions + switch (type) { + case -1: // Tiemstamp https://github.com/msgpack/msgpack/blob/master/spec.md#timestamp-extension-type + toDecode = buf.slice(offset, offset + size) + return decodeTimestamp(toDecode, size, headerSize) + } + } + + for (i = 0; i < decodingTypes.length; i++) { + if (type === decodingTypes[i].type) { + toDecode = buf.slice(offset, offset + size) + var value = decodingTypes[i].decode(toDecode) + return buildDecodeResult(value, headerSize + size) + } + } + + throw new Error('unable to find ext type ' + type) + } +} + +module.exports.IncompleteBufferError = IncompleteBufferError + + +/***/ }), + +/***/ "../node_modules/msgpack5/lib/encoder.js": +/*!***********************************************!*\ + !*** ../node_modules/msgpack5/lib/encoder.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Buffer = __webpack_require__(/*! safe-buffer */ "../node_modules/safe-buffer/index.js").Buffer +var bl = __webpack_require__(/*! bl */ "../node_modules/bl/bl.js") + +module.exports = function buildEncode (encodingTypes, forceFloat64, compatibilityMode, disableTimestampEncoding) { + function encode (obj, avoidSlice) { + var buf + var len + + if (obj === undefined) { + throw new Error('undefined is not encodable in msgpack!') + } else if (isNaN(obj)) { + throw new Error('NaN is not encodable in msgpack!') + } else if (obj === null) { + buf = Buffer.allocUnsafe(1) + buf[0] = 0xc0 + } else if (obj === true) { + buf = Buffer.allocUnsafe(1) + buf[0] = 0xc3 + } else if (obj === false) { + buf = Buffer.allocUnsafe(1) + buf[0] = 0xc2 + } else if (typeof obj === 'string') { + len = Buffer.byteLength(obj) + if (len < 32) { + buf = Buffer.allocUnsafe(1 + len) + buf[0] = 0xa0 | len + if (len > 0) { + buf.write(obj, 1) + } + } else if (len <= 0xff && !compatibilityMode) { + // str8, but only when not in compatibility mode + buf = Buffer.allocUnsafe(2 + len) + buf[0] = 0xd9 + buf[1] = len + buf.write(obj, 2) + } else if (len <= 0xffff) { + buf = Buffer.allocUnsafe(3 + len) + buf[0] = 0xda + buf.writeUInt16BE(len, 1) + buf.write(obj, 3) + } else { + buf = Buffer.allocUnsafe(5 + len) + buf[0] = 0xdb + buf.writeUInt32BE(len, 1) + buf.write(obj, 5) + } + } else if (obj && (obj.readUInt32LE || obj instanceof Uint8Array)) { + if (obj instanceof Uint8Array) { + obj = Buffer.from(obj) + } + // weird hack to support Buffer + // and Buffer-like objects + if (obj.length <= 0xff) { + buf = Buffer.allocUnsafe(2) + buf[0] = 0xc4 + buf[1] = obj.length + } else if (obj.length <= 0xffff) { + buf = Buffer.allocUnsafe(3) + buf[0] = 0xc5 + buf.writeUInt16BE(obj.length, 1) + } else { + buf = Buffer.allocUnsafe(5) + buf[0] = 0xc6 + buf.writeUInt32BE(obj.length, 1) + } + + buf = bl([buf, obj]) + } else if (Array.isArray(obj)) { + if (obj.length < 16) { + buf = Buffer.allocUnsafe(1) + buf[0] = 0x90 | obj.length + } else if (obj.length < 65536) { + buf = Buffer.allocUnsafe(3) + buf[0] = 0xdc + buf.writeUInt16BE(obj.length, 1) + } else { + buf = Buffer.allocUnsafe(5) + buf[0] = 0xdd + buf.writeUInt32BE(obj.length, 1) + } + + buf = obj.reduce(function (acc, obj) { + acc.append(encode(obj, true)) + return acc + }, bl().append(buf)) + } else if (!disableTimestampEncoding && typeof obj.getDate === 'function') { + return encodeDate(obj) + } else if (typeof obj === 'object') { + buf = encodeExt(obj) || encodeObject(obj) + } else if (typeof obj === 'number') { + if (isFloat(obj)) { + return encodeFloat(obj, forceFloat64) + } else if (obj >= 0) { + if (obj < 128) { + buf = Buffer.allocUnsafe(1) + buf[0] = obj + } else if (obj < 256) { + buf = Buffer.allocUnsafe(2) + buf[0] = 0xcc + buf[1] = obj + } else if (obj < 65536) { + buf = Buffer.allocUnsafe(3) + buf[0] = 0xcd + buf.writeUInt16BE(obj, 1) + } else if (obj <= 0xffffffff) { + buf = Buffer.allocUnsafe(5) + buf[0] = 0xce + buf.writeUInt32BE(obj, 1) + } else if (obj <= 9007199254740991) { + buf = Buffer.allocUnsafe(9) + buf[0] = 0xcf + write64BitUint(buf, obj) + } else { + return encodeFloat(obj, true) + } + } else { + if (obj >= -32) { + buf = Buffer.allocUnsafe(1) + buf[0] = 0x100 + obj + } else if (obj >= -128) { + buf = Buffer.allocUnsafe(2) + buf[0] = 0xd0 + buf.writeInt8(obj, 1) + } else if (obj >= -32768) { + buf = Buffer.allocUnsafe(3) + buf[0] = 0xd1 + buf.writeInt16BE(obj, 1) + } else if (obj > -214748365) { + buf = Buffer.allocUnsafe(5) + buf[0] = 0xd2 + buf.writeInt32BE(obj, 1) + } else if (obj >= -9007199254740991) { + buf = Buffer.allocUnsafe(9) + buf[0] = 0xd3 + write64BitInt(buf, 1, obj) + } else { + return encodeFloat(obj, true) + } + } + } + + if (!buf) { + throw new Error('not implemented yet') + } + + if (avoidSlice) { + return buf + } else { + return buf.slice() + } + } + + function encodeDate (dt) { + var encoded + var millis = dt * 1 + var seconds = Math.floor(millis / 1000) + var nanos = (millis - (seconds * 1000)) * 1E6 + + if (nanos || seconds > 0xFFFFFFFF) { + // Timestamp64 + encoded = Buffer.allocUnsafe(10) + encoded[0] = 0xd7 + encoded[1] = -1 + + var upperNanos = ((nanos * 4)) + var upperSeconds = seconds / Math.pow(2, 32) + var upper = (upperNanos + upperSeconds) & 0xFFFFFFFF + var lower = seconds & 0xFFFFFFFF + + encoded.writeInt32BE(upper, 2) + encoded.writeInt32BE(lower, 6) + } else { + // Timestamp32 + encoded = Buffer.allocUnsafe(6) + encoded[0] = 0xd6 + encoded[1] = -1 + encoded.writeUInt32BE(Math.floor(millis / 1000), 2) + } + return bl().append(encoded) + } + + function encodeExt (obj) { + var i + var encoded + var length = -1 + var headers = [] + + for (i = 0; i < encodingTypes.length; i++) { + if (encodingTypes[i].check(obj)) { + encoded = encodingTypes[i].encode(obj) + break + } + } + + if (!encoded) { + return null + } + + // we subtract 1 because the length does not + // include the type + length = encoded.length - 1 + + if (length === 1) { + headers.push(0xd4) + } else if (length === 2) { + headers.push(0xd5) + } else if (length === 4) { + headers.push(0xd6) + } else if (length === 8) { + headers.push(0xd7) + } else if (length === 16) { + headers.push(0xd8) + } else if (length < 256) { + headers.push(0xc7) + headers.push(length) + } else if (length < 0x10000) { + headers.push(0xc8) + headers.push(length >> 8) + headers.push(length & 0x00ff) + } else { + headers.push(0xc9) + headers.push(length >> 24) + headers.push((length >> 16) & 0x000000ff) + headers.push((length >> 8) & 0x000000ff) + headers.push(length & 0x000000ff) + } + + return bl().append(Buffer.from(headers)).append(encoded) + } + + function encodeObject (obj) { + var acc = [] + var length = 0 + var key + var header + + for (key in obj) { + if (obj.hasOwnProperty(key) && + obj[key] !== undefined && + typeof obj[key] !== 'function') { + ++length + acc.push(encode(key, true)) + acc.push(encode(obj[key], true)) + } + } + + if (length < 16) { + header = Buffer.allocUnsafe(1) + header[0] = 0x80 | length + } else if (length < 0xFFFF) { + header = Buffer.allocUnsafe(3) + header[0] = 0xde + header.writeUInt16BE(length, 1) + } else { + header = Buffer.allocUnsafe(5) + header[0] = 0xdf + header.writeUInt32BE(length, 1) + } + + acc.unshift(header) + + var result = acc.reduce(function (list, buf) { + return list.append(buf) + }, bl()) + + return result + } + + return encode +} + +function write64BitUint (buf, obj) { + // Write long byte by byte, in big-endian order + for (var currByte = 7; currByte >= 0; currByte--) { + buf[currByte + 1] = (obj & 0xff) + obj = obj / 256 + } +} + +function write64BitInt (buf, offset, num) { + var negate = num < 0 + + if (negate) { + num = Math.abs(num) + } + + var lo = num % 4294967296 + var hi = num / 4294967296 + buf.writeUInt32BE(Math.floor(hi), offset + 0) + buf.writeUInt32BE(lo, offset + 4) + + if (negate) { + var carry = 1 + for (var i = offset + 7; i >= offset; i--) { + var v = (buf[i] ^ 0xff) + carry + buf[i] = v & 0xff + carry = v >> 8 + } + } +} + +function isFloat (n) { + return n % 1 !== 0 +} + +function isNaN (n) { + /* eslint-disable no-self-compare */ + return n !== n && typeof n === 'number' + /* eslint-enable no-self-compare */ +} + +function encodeFloat (obj, forceFloat64) { + var useDoublePrecision = true + + // If `fround` is supported, we can check if a float + // is double or single precision by rounding the object + // to single precision and comparing the difference. + // If it's not supported, it's safer to use a 64 bit + // float so we don't lose precision without meaning to. + if (Math.fround) { + useDoublePrecision = Math.fround(obj) !== obj + } + + if (forceFloat64) { + useDoublePrecision = true + } + + var buf + + if (useDoublePrecision) { + buf = Buffer.allocUnsafe(9) + buf[0] = 0xcb + buf.writeDoubleBE(obj, 1) + } else { + buf = Buffer.allocUnsafe(5) + buf[0] = 0xca + buf.writeFloatBE(obj, 1) + } + + return buf +} + + +/***/ }), + +/***/ "../node_modules/msgpack5/lib/streams.js": +/*!***********************************************!*\ + !*** ../node_modules/msgpack5/lib/streams.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Transform = __webpack_require__(/*! readable-stream */ "../node_modules/readable-stream/readable-browser.js").Transform +var inherits = __webpack_require__(/*! inherits */ "../node_modules/inherits/inherits_browser.js") +var bl = __webpack_require__(/*! bl */ "../node_modules/bl/bl.js") + +function Base (opts) { + opts = opts || {} + + opts.objectMode = true + opts.highWaterMark = 16 + + Transform.call(this, opts) + + this._msgpack = opts.msgpack +} + +inherits(Base, Transform) + +function Encoder (opts) { + if (!(this instanceof Encoder)) { + opts = opts || {} + opts.msgpack = this + return new Encoder(opts) + } + + Base.call(this, opts) + this._wrap = ('wrap' in opts) && opts.wrap +} + +inherits(Encoder, Base) + +Encoder.prototype._transform = function (obj, enc, done) { + var buf = null + + try { + buf = this._msgpack.encode(this._wrap ? obj.value : obj).slice(0) + } catch (err) { + this.emit('error', err) + return done() + } + + this.push(buf) + done() +} + +function Decoder (opts) { + if (!(this instanceof Decoder)) { + opts = opts || {} + opts.msgpack = this + return new Decoder(opts) + } + + Base.call(this, opts) + + this._chunks = bl() + this._wrap = ('wrap' in opts) && opts.wrap +} + +inherits(Decoder, Base) + +Decoder.prototype._transform = function (buf, enc, done) { + if (buf) { + this._chunks.append(buf) + } + + try { + var result = this._msgpack.decode(this._chunks) + if (this._wrap) { + result = {value: result} + } + this.push(result) + } catch (err) { + if (err instanceof this._msgpack.IncompleteBufferError) { + done() + } else { + this.emit('error', err) + } + return + } + + if (this._chunks.length > 0) { + this._transform(null, enc, done) + } else { + done() + } +} + +module.exports.decoder = Decoder +module.exports.encoder = Encoder + + +/***/ }), + +/***/ "../node_modules/process-nextick-args/index.js": +/*!*****************************************************!*\ + !*** ../node_modules/process-nextick-args/index.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) { + +if (!process.version || + process.version.indexOf('v0.') === 0 || + process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { + module.exports = { nextTick: nextTick }; +} else { + module.exports = process +} + +function nextTick(fn, arg1, arg2, arg3) { + if (typeof fn !== 'function') { + 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 afterTickOne() { + fn.call(null, arg1); + }); + case 3: + return process.nextTick(function afterTickTwo() { + fn.call(null, arg1, arg2); + }); + case 4: + return process.nextTick(function afterTickThree() { + 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 afterTick() { + fn.apply(null, args); + }); + } +} + + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../process/browser.js */ "../node_modules/process/browser.js"))) + /***/ }), /***/ "../node_modules/process/browser.js": @@ -15207,6 +8322,2366 @@ process.chdir = function (dir) { process.umask = function() { return 0; }; +/***/ }), + +/***/ "../node_modules/readable-stream/lib/_stream_duplex.js": +/*!*************************************************************!*\ + !*** ../node_modules/readable-stream/lib/_stream_duplex.js ***! + \*************************************************************/ +/*! no static exports found */ +/***/ (function(module, 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__(/*! process-nextick-args */ "../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 = __webpack_require__(/*! core-util-is */ "../node_modules/core-util-is/lib/util.js"); +util.inherits = __webpack_require__(/*! inherits */ "../node_modules/inherits/inherits_browser.js"); +/**/ + +var Readable = __webpack_require__(/*! ./_stream_readable */ "../node_modules/readable-stream/lib/_stream_readable.js"); +var Writable = __webpack_require__(/*! ./_stream_writable */ "../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 && options.readable === false) this.readable = false; + + if (options && options.writable === false) this.writable = false; + + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) 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(self) { + self.end(); +} + +Object.defineProperty(Duplex.prototype, 'destroyed', { + get: function () { + if (this._readableState === undefined || this._writableState === undefined) { + 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 (this._readableState === undefined || this._writableState === undefined) { + 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/readable-stream/lib/_stream_passthrough.js": +/*!******************************************************************!*\ + !*** ../node_modules/readable-stream/lib/_stream_passthrough.js ***! + \******************************************************************/ +/*! no static exports found */ +/***/ (function(module, 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__(/*! ./_stream_transform */ "../node_modules/readable-stream/lib/_stream_transform.js"); + +/**/ +var util = __webpack_require__(/*! core-util-is */ "../node_modules/core-util-is/lib/util.js"); +util.inherits = __webpack_require__(/*! inherits */ "../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/readable-stream/lib/_stream_readable.js": +/*!***************************************************************!*\ + !*** ../node_modules/readable-stream/lib/_stream_readable.js ***! + \***************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(global, process) {// 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__(/*! process-nextick-args */ "../node_modules/process-nextick-args/index.js"); +/**/ + +module.exports = Readable; + +/**/ +var isArray = __webpack_require__(/*! isarray */ "../node_modules/isarray/index.js"); +/**/ + +/**/ +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; + +/**/ +var EE = __webpack_require__(/*! events */ "../node_modules/events/events.js").EventEmitter; + +var EElistenerCount = function (emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ +var Stream = __webpack_require__(/*! ./internal/streams/stream */ "../node_modules/readable-stream/lib/internal/streams/stream-browser.js"); +/**/ + +/**/ + +var Buffer = __webpack_require__(/*! safe-buffer */ "../node_modules/safe-buffer/index.js").Buffer; +var OurUint8Array = global.Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ + +/**/ +var util = __webpack_require__(/*! core-util-is */ "../node_modules/core-util-is/lib/util.js"); +util.inherits = __webpack_require__(/*! inherits */ "../node_modules/inherits/inherits_browser.js"); +/**/ + +/**/ +var debugUtil = __webpack_require__(/*! util */ 0); +var debug = void 0; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function () {}; +} +/**/ + +var BufferList = __webpack_require__(/*! ./internal/streams/BufferList */ "../node_modules/readable-stream/lib/internal/streams/BufferList.js"); +var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ "../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 (typeof emitter.prependListener === 'function') 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]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} + +function ReadableState(options, stream) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "../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 : 16 * 1024; + + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) 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__(/*! string_decoder/ */ "../node_modules/string_decoder/lib/string_decoder.js").StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +function Readable(options) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "../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 (typeof options.read === 'function') this._read = options.read; + + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } + + Stream.call(this); +} + +Object.defineProperty(Readable.prototype, 'destroyed', { + get: function () { + if (this._readableState === undefined) { + 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) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + skipChunkCheck = true; + } + } else { + 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 (chunk === null) { + 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 (typeof chunk !== 'string' && !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 || chunk.length !== 0) 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 && state.length === 0 && !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) && typeof chunk !== 'string' && chunk !== undefined && !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 || state.length === 0); +} + +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = __webpack_require__(/*! string_decoder/ */ "../node_modules/string_decoder/lib/string_decoder.js").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 || state.length === 0 && 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;else 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 (n !== 0) 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 (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && 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 (n === 0 && state.ended) { + if (state.length === 0) 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 (state.length === 0 || 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 (state.length === 0) 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; + if (n > 0) ret = fromList(n, state);else ret = null; + + if (ret === null) { + state.needReadable = true; + n = 0; + } else { + state.length -= n; + } + + if (state.length === 0) { + // 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 (ret !== null) 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) + // didn't get any data, stop spinning. + break;else 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 || pipeOpts.end !== false) && 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 && unpipeInfo.hasUnpiped === false) { + 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 ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', src._readableState.awaitDrain); + src._readableState.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 (EElistenerCount(dest, 'error') === 0) 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 (state.awaitDrain === 0 && 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 (state.pipesCount === 0) return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // 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, unpipeInfo); + }return this; + } + + // try to find the right one. + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) 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 (ev === 'data') { + // Start flowing on next tick if stream isn't explicitly paused + if (this._readableState.flowing !== false) this.resume(); + } else if (ev === 'readable') { + var state = this._readableState; + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.emittedReadable = false; + if (!state.reading) { + pna.nextTick(nReadingNextTick, this); + } else if (state.length) { + emitReadable(this); + } + } + } + + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; + +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.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 && stream.read() !== null) {} +} + +// 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 && (chunk === null || chunk === undefined)) return;else 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 (this[i] === undefined && typeof stream[i] === 'function') { + 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 (state.length === 0) return null; + + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = 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 if (n === list.head.data.length) { + // first chunk is a perfect match + ret = list.shift(); + } else { + // result spans more than one buffer + ret = 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 (n === 0) { + 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 (n === 0) { + 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 && state.length === 0) { + 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; +} +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "../node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../../process/browser.js */ "../node_modules/process/browser.js"))) + +/***/ }), + +/***/ "../node_modules/readable-stream/lib/_stream_transform.js": +/*!****************************************************************!*\ + !*** ../node_modules/readable-stream/lib/_stream_transform.js ***! + \****************************************************************/ +/*! no static exports found */ +/***/ (function(module, 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__(/*! ./_stream_duplex */ "../node_modules/readable-stream/lib/_stream_duplex.js"); + +/**/ +var util = __webpack_require__(/*! core-util-is */ "../node_modules/core-util-is/lib/util.js"); +util.inherits = __webpack_require__(/*! inherits */ "../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 (data != null) // single equals check for both `null` and `undefined` + 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 (typeof options.transform === 'function') this._transform = options.transform; + + if (typeof options.flush === 'function') this._flush = options.flush; + } + + // When the writable side finishes, then flush out anything remaining. + this.on('prefinish', prefinish); +} + +function prefinish() { + var _this = this; + + if (typeof this._flush === 'function') { + 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 (ts.writechunk !== null && 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 (data != null) // single equals check for both `null` and `undefined` + 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/readable-stream/lib/_stream_writable.js": +/*!***************************************************************!*\ + !*** ../node_modules/readable-stream/lib/_stream_writable.js ***! + \***************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process, setImmediate, global) {// 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__(/*! process-nextick-args */ "../node_modules/process-nextick-args/index.js"); +/**/ + +module.exports = Writable; + +/* */ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +// 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 = __webpack_require__(/*! core-util-is */ "../node_modules/core-util-is/lib/util.js"); +util.inherits = __webpack_require__(/*! inherits */ "../node_modules/inherits/inherits_browser.js"); +/**/ + +/**/ +var internalUtil = { + deprecate: __webpack_require__(/*! util-deprecate */ "../node_modules/util-deprecate/browser.js") +}; +/**/ + +/**/ +var Stream = __webpack_require__(/*! ./internal/streams/stream */ "../node_modules/readable-stream/lib/internal/streams/stream-browser.js"); +/**/ + +/**/ + +var Buffer = __webpack_require__(/*! safe-buffer */ "../node_modules/safe-buffer/index.js").Buffer; +var OurUint8Array = global.Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ + +var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ "../node_modules/readable-stream/lib/internal/streams/destroy.js"); + +util.inherits(Writable, Stream); + +function nop() {} + +function WritableState(options, stream) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ "../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 : 16 * 1024; + + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) 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 = options.decodeStrings === false; + 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 getBuffer() { + 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 (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + 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__(/*! ./_stream_duplex */ "../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 (typeof options.write === 'function') this._write = options.write; + + if (typeof options.writev === 'function') this._writev = options.writev; + + if (typeof options.destroy === 'function') this._destroy = options.destroy; + + if (typeof options.final === 'function') 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 (chunk === null) { + er = new TypeError('May not write null values to stream'); + } else if (typeof chunk !== 'string' && chunk !== undefined && !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 (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + + if (typeof cb !== 'function') 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.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; + +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') 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 && state.decodeStrings !== false && typeof chunk === 'string') { + 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 (state.length === 0 && 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 (entry === null) 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 (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending && !state.finished) endWritable(this, state, cb); +}; + +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !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 (typeof stream._final === 'function') { + 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 (state.pendingcb === 0) { + 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; + } + if (state.corkedRequestsFree) { + state.corkedRequestsFree.next = corkReq; + } else { + state.corkedRequestsFree = corkReq; + } +} + +Object.defineProperty(Writable.prototype, 'destroyed', { + get: function () { + if (this._writableState === undefined) { + 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); +}; +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "../node_modules/process/browser.js"), __webpack_require__(/*! ./../../timers-browserify/main.js */ "../node_modules/timers-browserify/main.js").setImmediate, __webpack_require__(/*! ./../../webpack/buildin/global.js */ "../node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ "../node_modules/readable-stream/lib/internal/streams/BufferList.js": +/*!**************************************************************************!*\ + !*** ../node_modules/readable-stream/lib/internal/streams/BufferList.js ***! + \**************************************************************************/ +/*! no static exports found */ +/***/ (function(module, 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__(/*! safe-buffer */ "../node_modules/safe-buffer/index.js").Buffer; +var util = __webpack_require__(/*! util */ 1); + +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 push(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 unshift(v) { + var entry = { data: v, next: this.head }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + }; + + BufferList.prototype.shift = function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + }; + + BufferList.prototype.clear = function clear() { + this.head = this.tail = null; + this.length = 0; + }; + + BufferList.prototype.join = function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) { + ret += s + p.data; + }return ret; + }; + + BufferList.prototype.concat = function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + if (this.length === 1) return this.head.data; + 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/readable-stream/lib/internal/streams/destroy.js": +/*!***********************************************************************!*\ + !*** ../node_modules/readable-stream/lib/internal/streams/destroy.js ***! + \***********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +/**/ + +var pna = __webpack_require__(/*! process-nextick-args */ "../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 && (!this._writableState || !this._writableState.errorEmitted)) { + 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) { + pna.nextTick(emitErrorNT, _this, err); + if (_this._writableState) { + _this._writableState.errorEmitted = true; + } + } 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.finished = false; + this._writableState.errorEmitted = false; + } +} + +function emitErrorNT(self, err) { + self.emit('error', err); +} + +module.exports = { + destroy: destroy, + undestroy: undestroy +}; + +/***/ }), + +/***/ "../node_modules/readable-stream/lib/internal/streams/stream-browser.js": +/*!******************************************************************************!*\ + !*** ../node_modules/readable-stream/lib/internal/streams/stream-browser.js ***! + \******************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! events */ "../node_modules/events/events.js").EventEmitter; + + +/***/ }), + +/***/ "../node_modules/readable-stream/readable-browser.js": +/*!***********************************************************!*\ + !*** ../node_modules/readable-stream/readable-browser.js ***! + \***********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +exports = module.exports = __webpack_require__(/*! ./lib/_stream_readable.js */ "../node_modules/readable-stream/lib/_stream_readable.js"); +exports.Stream = exports; +exports.Readable = exports; +exports.Writable = __webpack_require__(/*! ./lib/_stream_writable.js */ "../node_modules/readable-stream/lib/_stream_writable.js"); +exports.Duplex = __webpack_require__(/*! ./lib/_stream_duplex.js */ "../node_modules/readable-stream/lib/_stream_duplex.js"); +exports.Transform = __webpack_require__(/*! ./lib/_stream_transform.js */ "../node_modules/readable-stream/lib/_stream_transform.js"); +exports.PassThrough = __webpack_require__(/*! ./lib/_stream_passthrough.js */ "../node_modules/readable-stream/lib/_stream_passthrough.js"); + + /***/ }), /***/ "../node_modules/safe-buffer/index.js": @@ -15862,6 +11337,85 @@ exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) || /***/ }), +/***/ "../node_modules/util-deprecate/browser.js": +/*!*************************************************!*\ + !*** ../node_modules/util-deprecate/browser.js ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(global) { +/** + * 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); + } else 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 (!global.localStorage) return false; + } catch (_) { + return false; + } + var val = global.localStorage[name]; + if (null == val) return false; + return String(val).toLowerCase() === 'true'; +} + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "../node_modules/webpack/buildin/global.js"))) + +/***/ }), + /***/ "../node_modules/util/support/isBufferBrowser.js": /*!*******************************************************!*\ !*** ../node_modules/util/support/isBufferBrowser.js ***! diff --git a/src/Components/Browser.JS/dist/Release/blazor.server.js b/src/Components/Browser.JS/dist/Release/blazor.server.js index cf70e47bf1..4beb03c01d 100644 --- a/src/Components/Browser.JS/dist/Release/blazor.server.js +++ b/src/Components/Browser.JS/dist/Release/blazor.server.js @@ -1,15 +1,15 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=54)}([function(e,t,n){"use strict";var r;n.d(t,"a",function(){return r}),function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"}(r||(r={}))},function(e,t,n){"use strict";var r;n.d(t,"a",function(){return r}),function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"}(r||(r={}))},function(e,t,n){"use strict";n.d(t,"a",function(){return a}),n.d(t,"c",function(){return c}),n.d(t,"f",function(){return u}),n.d(t,"g",function(){return l}),n.d(t,"h",function(){return h}),n.d(t,"e",function(){return f}),n.d(t,"d",function(){return p}),n.d(t,"b",function(){return d});var r=n(0),o=n(9),i=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})},s=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]-1&&this.subject.observers.splice(e,1),0===this.subject.observers.length&&this.subject.cancelCallback&&this.subject.cancelCallback().catch(function(e){})},e}(),d=function(){function e(e){this.minimumLogLevel=e,this.outputConsole=console}return e.prototype.log=function(e,t){if(e>=this.minimumLogLevel)switch(e){case r.a.Critical:case r.a.Error:this.outputConsole.error("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;case r.a.Warning:this.outputConsole.warn("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;case r.a.Information:this.outputConsole.info("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;default:this.outputConsole.log("["+(new Date).toISOString()+"] "+r.a[e]+": "+t)}},e}()},function(e,t,n){"use strict";n.d(t,"a",function(){return a}),n.d(t,"c",function(){return c}),n.d(t,"f",function(){return u}),n.d(t,"g",function(){return l}),n.d(t,"h",function(){return h}),n.d(t,"e",function(){return f}),n.d(t,"d",function(){return p}),n.d(t,"b",function(){return d});var r=n(1),o=n(10),i=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})},s=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]-1&&this.subject.observers.splice(e,1),0===this.subject.observers.length&&this.subject.cancelCallback&&this.subject.cancelCallback().catch(function(e){})},e}(),d=function(){function e(e){this.minimumLogLevel=e,this.outputConsole=console}return e.prototype.log=function(e,t){if(e>=this.minimumLogLevel)switch(e){case r.a.Critical:case r.a.Error:this.outputConsole.error("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;case r.a.Warning:this.outputConsole.warn("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;case r.a.Information:this.outputConsole.info("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;default:this.outputConsole.log("["+(new Date).toISOString()+"] "+r.a[e]+": "+t)}},e}()},function(e,t,n){"use strict";n.d(t,"b",function(){return i}),n.d(t,"c",function(){return s}),n.d(t,"a",function(){return a});var r,o=(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e){function t(t,n){var r=this,o=this.constructor.prototype;return(r=e.call(this,t)||this).statusCode=n,r.__proto__=o,r}return o(t,e),t}(Error),s=function(e){function t(t){void 0===t&&(t="A timeout occurred.");var n=this,r=this.constructor.prototype;return(n=e.call(this,t)||this).__proto__=r,n}return o(t,e),t}(Error),a=function(e){function t(t){void 0===t&&(t="An abort occurred.");var n=this,r=this.constructor.prototype;return(n=e.call(this,t)||this).__proto__=r,n}return o(t,e),t}(Error)},function(e,t,n){"use strict";n.d(t,"b",function(){return i}),n.d(t,"c",function(){return s}),n.d(t,"a",function(){return a});var r,o=(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e){function t(t,n){var r=this,o=this.constructor.prototype;return(r=e.call(this,t)||this).statusCode=n,r.__proto__=o,r}return o(t,e),t}(Error),s=function(e){function t(t){void 0===t&&(t="A timeout occurred.");var n=this,r=this.constructor.prototype;return(n=e.call(this,t)||this).__proto__=r,n}return o(t,e),t}(Error),a=function(e){function t(t){void 0===t&&(t="An abort occurred.");var n=this,r=this.constructor.prototype;return(n=e.call(this,t)||this).__proto__=r,n}return o(t,e),t}(Error)},function(e,t,n){"use strict";n.d(t,"b",function(){return o}),n.d(t,"a",function(){return i});var r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]-1&&this.subject.observers.splice(e,1),0===this.subject.observers.length&&this.subject.cancelCallback().catch(function(e){})},e}(),d=function(){function e(e){this.minimumLogLevel=e}return e.prototype.log=function(e,t){if(e>=this.minimumLogLevel)switch(e){case r.a.Critical:case r.a.Error:console.error("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;case r.a.Warning:console.warn("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;case r.a.Information:console.info("["+(new Date).toISOString()+"] "+r.a[e]+": "+t);break;default:console.log("["+(new Date).toISOString()+"] "+r.a[e]+": "+t)}},e}()},function(e,t,n){"use strict";n.r(t);var r,o,i=(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=function(e){function t(t,n){var r=this,o=this.constructor.prototype;return(r=e.call(this,t)||this).statusCode=n,r.__proto__=o,r}return i(t,e),t}(Error),s=function(e){function t(t){void 0===t&&(t="A timeout occurred.");var n=this,r=this.constructor.prototype;return(n=e.call(this,t)||this).__proto__=r,n}return i(t,e),t}(Error),u=function(e){function t(t){void 0===t&&(t="An abort occurred.");var n=this,r=this.constructor.prototype;return(n=e.call(this,t)||this).__proto__=r,n}return i(t,e),t}(Error),c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=200&&o.status<300?n(new l(o.status,o.statusText,o.response||o.responseText)):r(new a(o.statusText,o.status))},o.onerror=function(){t.logger.log(h.a.Warning,"Error from HTTP request. "+o.status+": "+o.statusText+"."),r(new a(o.statusText,o.status))},o.ontimeout=function(){t.logger.log(h.a.Warning,"Timeout from HTTP request."),r(new s)},o.send(e.content||"")}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))},t}(f),g=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();if("undefined"==typeof XMLHttpRequest){var y=require;o=y("./NodeHttpClient")}var v,m=function(e){function t(t){var n=e.call(this)||this;if("undefined"!=typeof XMLHttpRequest)n.httpClient=new d(t);else{if(void 0===o)throw new Error("No HttpClient could be created.");n.httpClient=new o.NodeHttpClient(t)}return n}return g(t,e),t.prototype.send=function(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new u):e.method?e.url?this.httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))},t.prototype.getCookieString=function(e){return this.httpClient.getCookieString(e)},t}(f),b=n(41);!function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close"}(v||(v={}));var w,E=n(1),S=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}u((r=r.apply(e,t||[])).next())})},_=function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=0){if((r!==C.WebSockets||this.options.WebSocket)&&(r!==C.ServerSentEvents||this.options.EventSource))return this.logger.log(h.a.Debug,"Selecting transport '"+C[r]+"'."),r;this.logger.log(h.a.Debug,"Skipping transport '"+C[r]+"' because it is not supported in your environment.'")}else this.logger.log(h.a.Debug,"Skipping transport '"+C[r]+"' because it does not support the requested transfer format '"+I[n]+"'.");else this.logger.log(h.a.Debug,"Skipping transport '"+C[r]+"' because it was disabled by the client.")}return null},e.prototype.isITransport=function(e){return e&&"object"==typeof e&&"connect"in e},e.prototype.changeState=function(e,t){return this.connectionState===e&&(this.connectionState=t,!0)},e.prototype.stopConnection=function(e){this.transport=void 0,(e=this.stopError||e)?this.logger.log(h.a.Error,"Connection disconnected with error '"+e+"'."):this.logger.log(h.a.Information,"Connection disconnected."),this.connectionState=2,this.onclose&&this.onclose(e)},e.prototype.resolveUrl=function(e){if(0===e.lastIndexOf("https://",0)||0===e.lastIndexOf("http://",0))return e;if("undefined"==typeof window||!window||!window.document)throw new Error("Cannot resolve '"+e+"'.");var t=window.document.createElement("a");return t.href=e,this.logger.log(h.a.Information,"Normalizing '"+e+"' to '"+t.href+"'."),t.href},e.prototype.resolveNegotiateUrl=function(e){var t=e.indexOf("?"),n=e.substring(0,-1===t?e.length:t);return"/"!==n[n.length-1]&&(n+="/"),n+="negotiate",n+=-1===t?"":e.substring(t)},e}();var Y=n(3),K=n(4),J="json",X=function(){function e(){this.name=J,this.version=1,this.transferFormat=I.Text}return e.prototype.parseMessages=function(e,t){if("string"!=typeof e)throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];null===t&&(t=Y.a.instance);for(var n=[],r=0,o=K.a.parse(e);r0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return e[r]=[],e}function s(e,t,n){var i=e;if(e instanceof Comment&&(c(i)&&c(i).length>0))throw new Error("Not implemented: inserting non-empty logical container");if(u(i))throw new Error("Not implemented: moving existing logical children");var a=c(t);if(n0;)e(r,0);var i=r;i.parentNode.removeChild(i)},t.getLogicalParent=u,t.getLogicalSiblingEnd=function(e){return e[i]||null},t.getLogicalChild=function(e,t){return c(e)[t]},t.isSvgElement=function(e){return"http://www.w3.org/2000/svg"===l(e).namespaceURI},t.getLogicalChildrenArray=c,t.permuteLogicalChildren=function(e,t){var n=c(e);t.forEach(function(e){e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=function e(t){if(t instanceof Element)return t;var n=f(t);if(n)return n.previousSibling;var r=u(t);return r instanceof Element?r.lastChild:e(r)}(e.moveRangeStart)}),t.forEach(function(t){var r=t.moveToBeforeMarker=document.createComment("marker"),o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):h(r,e)}),t.forEach(function(e){for(var t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd,i=r;i;){var a=i.nextSibling;if(n.insertBefore(i,t),i===o)break;i=a}n.removeChild(t)}),t.forEach(function(e){n[e.toSiblingIndex]=e.moveRangeStart})},t.getClosestDomElement=l},function(e,t,n){"use strict";var r=n(18),o=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=f;var i=n(15);i.inherits=n(7);var a=n(33),s=n(37);i.inherits(f,a);for(var u=o(s.prototype),c=0;c * @license MIT */ -var r=n(55),o=n(56),i=n(57);function s(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function d(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(e).length;default:if(r)return H(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,o);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,o){var i,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var l=-1;for(i=n;ia&&(n=a-c),i=n;i>=0;i--){for(var h=!0,f=0;fo&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var s=0;s>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function k(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function I(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:u>223?3:u>191?2:1;if(o+h<=n)switch(h){case 1:u<128&&(l=u);break;case 2:128==(192&(i=e[o+1]))&&(c=(31&u)<<6|63&i)>127&&(l=c);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&(c=(15&u)<<12|(63&i)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),o+=h}return function(e){var t=e.length;if(t<=T)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rthis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return _(this,t,n);case"latin1":case"binary":return P(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},c.prototype.compare=function(e,t,n,r,o){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(i,s),u=this.slice(r,o),l=e.slice(t,n),h=0;ho)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return m(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return S(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var T=4096;function _(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;or)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function O(e,t,n,r,o,i){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function L(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function A(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function M(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(e,t,n,r,i){return i||M(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,i){return i||M(e,0,n,8),o.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},c.prototype.readUInt8=function(e,t){return t||D(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||D(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||D(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||D(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||D(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},c.prototype.readInt8=function(e,t){return t||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||D(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||D(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||D(e,4,this.length),o.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||D(e,4,this.length),o.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||D(e,8,this.length),o.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||D(e,8,this.length),o.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||O(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):A(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):A(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);O(this,e,t,n,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i>0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);O(this,e,t,n,o-1,-o)}var i=n-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):A(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||O(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):A(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return j(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return j(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!c.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function F(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(N,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function W(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(13))},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=function(){function e(){}return e.prototype.log=function(e,t){},e.instance=new e,e}()},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=function(){function e(){}return e.prototype.log=function(e,t){},e.instance=new e,e}()},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=function(){function e(){}return e.write=function(t){return""+t+e.RecordSeparator},e.parse=function(t){if(t[t.length-1]!==e.RecordSeparator)throw new Error("Message is incomplete.");var n=t.split(e.RecordSeparator);return n.pop(),n},e.RecordSeparatorCode=30,e.RecordSeparator=String.fromCharCode(e.RecordSeparatorCode),e}()},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=function(){function e(){}return e.write=function(t){return""+t+e.RecordSeparator},e.parse=function(t){if(t[t.length-1]!==e.RecordSeparator)throw new Error("Message is incomplete.");var n=t.split(e.RecordSeparator);return n.pop(),n},e.RecordSeparatorCode=30,e.RecordSeparator=String.fromCharCode(e.RecordSeparatorCode),e}()},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r=n(26),o=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=h;var i=n(23);i.inherits=n(19);var s=n(38),a=n(43);i.inherits(h,s);for(var c=o(a.prototype),u=0;u=0,"must have a non-negative type"),o(s,"must have a decode function"),this.registerEncoder(function(e){return e instanceof t},function(t){var o=i(),s=r.allocUnsafe(1);return s.writeInt8(e,0),o.append(s),o.append(n(t)),o}),this.registerDecoder(e,s),this},registerEncoder:function(e,n){return o(e,"must have an encode function"),o(n,"must have an encode function"),t.push({check:e,encode:n}),this},registerDecoder:function(e,t){return o(e>=0,"must have a non-negative type"),o(t,"must have a decode function"),n.push({type:e,decode:t}),this},encoder:s.encoder,decoder:s.decoder,buffer:!0,type:"msgpack5",IncompleteBufferError:a.IncompleteBufferError}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(30),o=n(17),i={};function s(e,t,n){var o=i[e];o||(o=i[e]=new r.BrowserRenderer(e)),o.attachRootComponentToLogicalElement(n,t)}t.attachRootComponentToLogicalElement=s,t.attachRootComponentToElement=function(e,t,n){var r=document.querySelector(t);if(!r)throw new Error("Could not find any element matching selector '"+t+"'.");s(e,o.toLogicalElement(r,!0),n)},t.renderBatch=function(e,t){var n=i[e];if(!n)throw new Error("There is no browser renderer with ID "+e+".");for(var r=t.arrayRangeReader,o=t.updatedComponents(),s=r.values(o),a=r.count(o),c=t.referenceFrames(),u=r.values(c),l=t.diffReader,h=0;h0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return e[r]=[],e}function a(e,t,n){var i=e;if(e instanceof Comment&&(u(i)&&u(i).length>0))throw new Error("Not implemented: inserting non-empty logical container");if(c(i))throw new Error("Not implemented: moving existing logical children");var s=u(t);if(n0;)e(r,0);var i=r;i.parentNode.removeChild(i)},t.getLogicalParent=c,t.getLogicalSiblingEnd=function(e){return e[i]||null},t.getLogicalChild=function(e,t){return u(e)[t]},t.isSvgElement=function(e){return"http://www.w3.org/2000/svg"===l(e).namespaceURI},t.getLogicalChildrenArray=u,t.permuteLogicalChildren=function(e,t){var n=u(e);t.forEach(function(e){e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=function e(t){if(t instanceof Element)return t;var n=h(t);if(n)return n.previousSibling;var r=c(t);return r instanceof Element?r.lastChild:e(r)}(e.moveRangeStart)}),t.forEach(function(t){var r=t.moveToBeforeMarker=document.createComment("marker"),o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):f(r,e)}),t.forEach(function(e){for(var t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd,i=r;i;){var s=i.nextSibling;if(n.insertBefore(i,t),i===o)break;i=s}n.removeChild(t)}),t.forEach(function(e){n[e.toSiblingIndex]=e.moveRangeStart})},t.getClosestDomElement=l},function(e,t,n){var r=n(8),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s),i(o,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=o(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){"use strict";var r;!function(e){window.DotNet=e;var t=[],n={},r={},o=1,i=null;function s(e){t.push(e)}function a(e,t){for(var n=[],r=2;r1)for(var n=1;n0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]this.length)&&(r=this.length),n>=this.length)return e||i.alloc(0);if(r<=0)return e||i.alloc(0);var o,s,a=!!e,c=this._offset(n),u=r-n,l=u,h=a&&t||0,f=c[1];if(0===n&&r==this.length){if(!a)return 1===this._bufs.length?this._bufs[0]:i.concat(this._bufs,this.length);for(s=0;s(o=this._bufs[s].length-f))){this._bufs[s].copy(e,h,f,f+l);break}this._bufs[s].copy(e,h,f),h+=o,l-=o,f&&(f=0)}return e},s.prototype.shallowSlice=function(e,t){e=e||0,t=t||this.length,e<0&&(e+=this.length),t<0&&(t+=this.length);var n=this._offset(e),r=this._offset(t),o=this._bufs.slice(n[0],r[0]+1);return 0==r[1]?o.pop():o[o.length-1]=o[o.length-1].slice(0,r[1]),0!=n[1]&&(o[0]=o[0].slice(n[1])),new s(o)},s.prototype.toString=function(e,t,n){return this.slice(t,n).toString(e)},s.prototype.consume=function(e){for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},s.prototype.duplicate=function(){for(var e=0,t=new s;e0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),c=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(n)?r.showHidden=n:n&&t._extend(r,n),b(r.showHidden)&&(r.showHidden=!1),b(r.depth)&&(r.depth=2),b(r.colors)&&(r.colors=!1),b(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=c),l(r,e,r.depth)}function c(e,t){var n=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.colors[n][1]+"m":e}function u(e,t){return e}function l(e,n,r){if(e.customInspect&&n&&C(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var o=n.inspect(r,e);return v(o)||(o=l(e,o,r)),o}var i=function(e,t){if(b(t))return e.stylize("undefined","undefined");if(v(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(y(t))return e.stylize(""+t,"number");if(d(t))return e.stylize(""+t,"boolean");if(g(t))return e.stylize("null","null")}(e,n);if(i)return i;var s=Object.keys(n),a=function(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(n)),E(n)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return h(n);if(0===s.length){if(C(n)){var c=n.name?": "+n.name:"";return e.stylize("[Function"+c+"]","special")}if(m(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(S(n))return e.stylize(Date.prototype.toString.call(n),"date");if(E(n))return h(n)}var u,w="",k=!1,I=["{","}"];(p(n)&&(k=!0,I=["[","]"]),C(n))&&(w=" [Function"+(n.name?": "+n.name:"")+"]");return m(n)&&(w=" "+RegExp.prototype.toString.call(n)),S(n)&&(w=" "+Date.prototype.toUTCString.call(n)),E(n)&&(w=" "+h(n)),0!==s.length||k&&0!=n.length?r<0?m(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),u=k?function(e,t,n,r,o){for(var i=[],s=0,a=t.length;s=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(u,w,I)):I[0]+w+I[1]}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,n,r,o,i){var s,a,c;if((c=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?a=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(a=e.stylize("[Setter]","special")),_(r,o)||(s="["+o+"]"),a||(e.seen.indexOf(c.value)<0?(a=g(n)?l(e,c.value,null):l(e,c.value,n-1)).indexOf("\n")>-1&&(a=i?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),b(s)){if(i&&o.match(/^\d+$/))return a;(s=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+a}function p(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function g(e){return null===e}function y(e){return"number"==typeof e}function v(e){return"string"==typeof e}function b(e){return void 0===e}function m(e){return w(e)&&"[object RegExp]"===k(e)}function w(e){return"object"==typeof e&&null!==e}function S(e){return w(e)&&"[object Date]"===k(e)}function E(e){return w(e)&&("[object Error]"===k(e)||e instanceof Error)}function C(e){return"function"==typeof e}function k(e){return Object.prototype.toString.call(e)}function I(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(b(i)&&(i=e.env.NODE_DEBUG||""),n=n.toUpperCase(),!s[n])if(new RegExp("\\b"+n+"\\b","i").test(i)){var r=e.pid;s[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else s[n]=function(){};return s[n]},t.inspect=a,a.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]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=p,t.isBoolean=d,t.isNull=g,t.isNullOrUndefined=function(e){return null==e},t.isNumber=y,t.isString=v,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=b,t.isRegExp=m,t.isObject=w,t.isDate=S,t.isError=E,t.isFunction=C,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(59);var T=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function _(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,n;console.log("%s - %s",(e=new Date,n=[I(e.getHours()),I(e.getMinutes()),I(e.getSeconds())].join(":"),[e.getDate(),T[e.getMonth()],n].join(" ")),t.format.apply(t,arguments))},t.inherits=n(60),t._extend=function(e,t){if(!t||!w(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var P="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function x(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(P&&e[P]){var t;if("function"!=typeof(t=e[P]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,P,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise(function(e,r){t=e,n=r}),o=[],i=0;i0?("string"==typeof t||s.objectMode||Object.getPrototypeOf(t)===u.prototype||(t=function(e){return u.from(e)}(t)),r?s.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):S(e,s,t,!0):s.ended?e.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!n?(t=s.decoder.write(t),s.objectMode||0!==t.length?S(e,s,t,!1):T(e,s)):S(e,s,t,!1))):r||(s.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=E?e=E:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function k(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?o.nextTick(I,e):I(e))}function I(e){p("emit readable"),e.emit("readable"),R(e)}function T(e,t){t.readingMore||(t.readingMore=!0,o.nextTick(_,e,t))}function _(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;ei.length?i.length:e;if(s===i.length?o+=i:o+=i.slice(0,e),0===(e-=s)){s===i.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=i.slice(s));break}++r}return t.length-=r,o}(e,t):function(e,t){var n=u.allocUnsafe(e),r=t.head,o=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var i=r.data,s=e>i.length?i.length:e;if(i.copy(n,n.length-e,0,s),0===(e-=s)){s===i.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=i.slice(s));break}++o}return t.length-=o,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function O(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,o.nextTick(L,t,e))}function L(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function A(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?O(this):k(this),null;if(0===(e=C(e,t))&&t.ended)return 0===t.length&&O(this),null;var r,o=t.needReadable;return p("need readable",o),(0===t.length||t.length-e0?D(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&O(this)),null!==r&&this.emit("data",r),r},m.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},m.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,p("pipe count=%d opts=%j",i.pipesCount,t);var c=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?l:m;function u(t,r){p("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,p("cleanup"),e.removeListener("close",v),e.removeListener("finish",b),e.removeListener("drain",h),e.removeListener("error",y),e.removeListener("unpipe",u),n.removeListener("end",l),n.removeListener("end",m),n.removeListener("data",g),f=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||h())}function l(){p("onend"),e.end()}i.endEmitted?o.nextTick(c):n.once("end",c),e.on("unpipe",u);var h=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,R(e))}}(n);e.on("drain",h);var f=!1;var d=!1;function g(t){p("ondata"),d=!1,!1!==e.write(t)||d||((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==A(i.pipes,e))&&!f&&(p("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){p("onerror",t),m(),e.removeListener("error",y),0===a(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",b),m()}function b(){p("onfinish"),e.removeListener("close",v),m()}function m(){p("unpipe"),n.unpipe(e)}return n.on("data",g),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?s(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",y),e.once("close",v),e.once("finish",b),e.emit("pipe",n),i.flowing||(p("pipe resume"),n.resume()),e},m.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,o=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i0&&s.length>o&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function h(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=function(){for(var e=[],t=0;t0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=o[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else{var u=c.length,l=d(c,u);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){s=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return f(this,e,!0)},a.prototype.rawListeners=function(e){return f(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},a.prototype.listenerCount=p,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){e.exports=n(39).EventEmitter},function(e,t,n){"use strict";var r=n(26);function o(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var n=this,i=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return i||s?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||r.nextTick(o,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(r.nextTick(o,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,n){"use strict";var r=n(66).Buffer,o=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function i(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===o||!o(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=c,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=l,this.end=h,t=3;break;default:return this.write=f,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function l(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.StringDecoder=i,i.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return o>0&&(e.lastNeed=o-1),o;if(--r=0)return o>0&&(e.lastNeed=o-2),o;if(--r=0)return o>0&&(2===o?o=0:e.lastNeed=o-3),o;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},i.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){"use strict";(function(t,r,o){var i=n(26);function s(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var o=r.callback;t.pendingcb--,o(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=b;var a,c=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?r:i.nextTick;b.WritableState=v;var u=n(23);u.inherits=n(19);var l={deprecate:n(69)},h=n(40),f=n(18).Buffer,p=o.Uint8Array||function(){};var d,g=n(41);function y(){}function v(e,t){a=a||n(14),e=e||{};var r=t instanceof a;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var o=e.highWaterMark,u=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:r&&(u||0===u)?u:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===e.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,o=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,o){--t.pendingcb,n?(i.nextTick(o,r),i.nextTick(k,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(o(r),e._writableState.errorEmitted=!0,e.emit("error",r),k(e,t))}(e,n,r,t,o);else{var s=E(n);s||n.corked||n.bufferProcessing||!n.bufferedRequest||S(e,n),r?c(w,e,n,s,o):w(e,n,s,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function b(e){if(a=a||n(14),!(d.call(b,this)||this instanceof a))return new b(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function m(e,t,n,r,o,i,s){t.writelen=r,t.writecb=s,t.writing=!0,t.sync=!0,n?e._writev(o,t.onwrite):e._write(o,i,t.onwrite),t.sync=!1}function w(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),k(e,t)}function S(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,o=new Array(r),i=t.corkedRequestsFree;i.entry=n;for(var a=0,c=!0;n;)o[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;o.allBuffers=c,m(e,t,!0,t.length,o,"",i.finish),t.pendingcb++,t.lastBufferedRequest=null,i.next?(t.corkedRequestsFree=i.next,i.next=null):t.corkedRequestsFree=new s(t),t.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,l=n.encoding,h=n.callback;if(m(e,t,!1,t.objectMode?1:u.length,u,l,h),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function E(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function C(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),k(e,t)})}function k(e,t){var n=E(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,i.nextTick(C,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}u.inherits(b,h),v.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(v.prototype,"buffer",{get:l.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(b,Symbol.hasInstance,{value:function(e){return!!d.call(this,e)||this===b&&(e&&e._writableState instanceof v)}})):d=function(e){return e instanceof this},b.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},b.prototype.write=function(e,t,n){var r,o=this._writableState,s=!1,a=!o.objectMode&&(r=e,f.isBuffer(r)||r instanceof p);return a&&!f.isBuffer(e)&&(e=function(e){return f.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof n&&(n=y),o.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}(this,n):(a||function(e,t,n,r){var o=!0,s=!1;return null===n?s=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(s=new TypeError("Invalid non-string/buffer chunk")),s&&(e.emit("error",s),i.nextTick(r,s),o=!1),o}(this,o,e,n))&&(o.pendingcb++,s=function(e,t,n,r,o,i){if(!n){var s=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=f.from(t,n));return t}(t,r,o);r!==s&&(n=!0,o="buffer",r=s)}var a=t.objectMode?1:r.length;t.length+=a;var c=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(b.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),b.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},b.prototype._writev=null,b.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,k(e,t),n&&(t.finished?i.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(b.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),b.prototype.destroy=g.destroy,b.prototype._undestroy=g.undestroy,b.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(22),n(67).setImmediate,n(13))},function(e,t,n){"use strict";e.exports=s;var r=n(14),o=n(23);function i(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.length0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=200&&c.statusCode<300?r(new s.b(c.statusCode,c.statusMessage||"",u)):o(new i.b(c.statusMessage||"",c.statusCode||0))});t.abortSignal&&(t.abortSignal.onabort=function(){h.abort(),o(new i.a)})})},n.prototype.getCookieString=function(e){return this.cookieJar.getCookieString(e)},n}(s.a)}).call(this,n(8).Buffer)},function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return i});var r=n(11),o=n(2),i=function(){function t(){}return t.prototype.writeHandshakeRequest=function(e){return r.a.write(JSON.stringify(e))},t.prototype.parseHandshakeResponse=function(t){var n,i;if(Object(o.g)(t)||void 0!==e&&t instanceof e){var s=new Uint8Array(t);if(-1===(c=s.indexOf(r.a.RecordSeparatorCode)))throw new Error("Message is incomplete.");var a=c+1;n=String.fromCharCode.apply(null,s.slice(0,a)),i=s.byteLength>a?s.slice(a).buffer:null}else{var c,u=t;if(-1===(c=u.indexOf(r.a.RecordSeparator)))throw new Error("Message is incomplete.");a=c+1;n=u.substring(0,a),i=u.length>a?u.substring(a):null}var l=r.a.parse(n),h=JSON.parse(l[0]);if(h.type)throw new Error("Expected a handshake response from the server.");return[i,h]},t}()}).call(this,n(8).Buffer)},function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return f});var r,o,i=n(5),s=n(7),a=n(1),c=n(3),u=(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),l=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=200&&c.statusCode<300?r(new s.b(c.statusCode,c.statusMessage||"",u)):o(new i.b(c.statusMessage||"",c.statusCode||0))});t.abortSignal&&(t.abortSignal.onabort=function(){h.abort(),o(new i.a)})})},n.prototype.getCookieString=function(e){return this.cookieJar.getCookieString(e)},n}(s.a)}).call(this,n(8).Buffer)},function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return i});var r=n(12),o=n(3),i=function(){function t(){}return t.prototype.writeHandshakeRequest=function(e){return r.a.write(JSON.stringify(e))},t.prototype.parseHandshakeResponse=function(t){var n,i;if(Object(o.g)(t)||void 0!==e&&t instanceof e){var s=new Uint8Array(t);if(-1===(c=s.indexOf(r.a.RecordSeparatorCode)))throw new Error("Message is incomplete.");var a=c+1;n=String.fromCharCode.apply(null,s.slice(0,a)),i=s.byteLength>a?s.slice(a).buffer:null}else{var c,u=t;if(-1===(c=u.indexOf(r.a.RecordSeparator)))throw new Error("Message is incomplete.");a=c+1;n=u.substring(0,a),i=u.length>a?u.substring(a):null}var l=r.a.parse(n),h=JSON.parse(l[0]);if(h.type)throw new Error("Expected a handshake response from the server.");return[i,h]},t}()}).call(this,n(8).Buffer)},,,,,function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0?r-4:r,h=0;h>16&255,a[c++]=t>>8&255,a[c++]=255&t;2===s&&(t=o[e.charCodeAt(h)]<<2|o[e.charCodeAt(h+1)]>>4,a[c++]=255&t);1===s&&(t=o[e.charCodeAt(h)]<<10|o[e.charCodeAt(h+1)]<<4|o[e.charCodeAt(h+2)]>>2,a[c++]=t>>8&255,a[c++]=255&t);return a},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],s=0,a=n-o;sa?a:s+16383));1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,c=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var o,i,s=[],a=t;a>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,o){var i,s,a=8*o-r-1,c=(1<>1,l=-7,h=n?o-1:0,f=n?-1:1,p=e[t+h];for(h+=f,i=p&(1<<-l)-1,p>>=-l,l+=a;l>0;i=256*i+e[t+h],h+=f,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=r;l>0;s=256*s+e[t+h],h+=f,l-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),i-=u}return(p?-1:1)*s*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var s,a,c,u=8*i-o-1,l=(1<>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,d=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+h>=1?f/c:f*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*c-1)*Math.pow(2,o),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;e[n+p]=255&a,p+=d,a/=256,o-=8);for(s=s<0;e[n+p]=255&s,p+=d,s/=256,u-=8);e[n+p-d]|=128*g}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";(function(t){ +var r=n(47),o=n(48),i=n(31);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function d(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(e).length;default:if(r)return F(e).length;t=(""+t).toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,o);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,o){var i,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var l=-1;for(i=n;is&&(n=s-u),i=n;i>=0;i--){for(var f=!0,h=0;ho&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function T(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function k(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:c>223?3:c>191?2:1;if(o+f<=n)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(i=e[o+1]))&&(u=(31&c)<<6|63&i)>127&&(l=u);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(u=(15&c)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),o+=f}return function(e){var t=e.length;if(t<=C)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rthis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return R(this,t,n);case"utf8":case"utf-8":return k(this,t,n);case"ascii":return I(this,t,n);case"latin1":case"binary":return x(this,t,n);case"base64":return T(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},u.prototype.compare=function(e,t,n,r,o){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(i,a),c=this.slice(r,o),l=e.slice(t,n),f=0;fo)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return m(this,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return E(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function I(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;or)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,n,r,o,i){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function L(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function A(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function B(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,i){return i||B(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,i){return i||B(e,0,n,8),o.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},u.prototype.readUInt8=function(e,t){return t||P(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||P(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||P(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||P(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||P(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||P(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},u.prototype.readInt8=function(e,t){return t||P(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||P(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){t||P(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return t||P(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||P(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||P(e,4,this.length),o.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||P(e,8,this.length),o.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||M(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):A(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):A(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);M(this,e,t,n,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);M(this,e,t,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):L(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):L(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):A(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):A(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!u.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function H(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(N,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function q(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,n(5))},function(e,t,n){"use strict";var r;!function(e){window.DotNet=e;var t=[],n={},r={},o=1,i=null;function a(e){t.push(e)}function s(e,t){for(var n=[],r=2;r1)for(var n=1;n0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]this.length||e<0)){var t=this._offset(e);return this._bufs[t[0]][t[1]]}},a.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},a.prototype.copy=function(e,t,n,r){if(("number"!=typeof n||n<0)&&(n=0),("number"!=typeof r||r>this.length)&&(r=this.length),n>=this.length)return e||i.alloc(0);if(r<=0)return e||i.alloc(0);var o,a,s=!!e,u=this._offset(n),c=r-n,l=c,f=s&&t||0,h=u[1];if(0===n&&r==this.length){if(!s)return 1===this._bufs.length?this._bufs[0]:i.concat(this._bufs,this.length);for(a=0;a(o=this._bufs[a].length-h))){this._bufs[a].copy(e,f,h,h+l);break}this._bufs[a].copy(e,f,h),f+=o,l-=o,h&&(h=0)}return e},a.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return new a;var n=this._offset(e),r=this._offset(t),o=this._bufs.slice(n[0],r[0]+1);return 0==r[1]?o.pop():o[o.length-1]=o[o.length-1].slice(0,r[1]),0!=n[1]&&(o[0]=o[0].slice(n[1])),new a(o)},a.prototype.toString=function(e,t,n){return this.slice(t,n).toString(e)},a.prototype.consume=function(e){for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},a.prototype.duplicate=function(){for(var e=0,t=new a;ethis.length?this.length:t;for(var r=this._offset(t),o=r[0],s=r[1];o=e.length){var c=u.indexOf(e,s);if(-1!==c)return this._reverseOffset([o,c]);s=u.length-e.length+1}else{var l=this._reverseOffset([o,s]);if(this._match(l,e))return l;s++}}s=0}return-1},a.prototype._match=function(e,t){if(this.length-e=0,"must have a non-negative type"),o(a,"must have a decode function"),this.registerEncoder(function(e){return e instanceof t},function(t){var o=i(),a=r.allocUnsafe(1);return a.writeInt8(e,0),o.append(a),o.append(n(t)),o}),this.registerDecoder(e,a),this},registerEncoder:function(e,n){return o(e,"must have an encode function"),o(n,"must have an encode function"),t.push({check:e,encode:n}),this},registerDecoder:function(e,t){return o(e>=0,"must have a non-negative type"),o(t,"must have a decode function"),n.push({type:e,decode:t}),this},encoder:a.encoder,decoder:a.decoder,buffer:!0,type:"msgpack5",IncompleteBufferError:s.IncompleteBufferError}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(16),o=n(22),i=n(8);window.Blazor={navigateTo:r.navigateTo,_internal:{attachRootComponentToElement:i.attachRootComponentToElement,http:o.internalFunctions,uriHelper:r.internalFunctions}}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=i)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}}),u=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(n)?r.showHidden=n:n&&t._extend(r,n),m(r.showHidden)&&(r.showHidden=!1),m(r.depth)&&(r.depth=2),m(r.colors)&&(r.colors=!1),m(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),l(r,e,r.depth)}function u(e,t){var n=s.styles[t];return n?"["+s.colors[n][0]+"m"+e+"["+s.colors[n][1]+"m":e}function c(e,t){return e}function l(e,n,r){if(e.customInspect&&n&&_(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var o=n.inspect(r,e);return v(o)||(o=l(e,o,r)),o}var i=function(e,t){if(m(t))return e.stylize("undefined","undefined");if(v(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(y(t))return e.stylize(""+t,"number");if(d(t))return e.stylize(""+t,"boolean");if(g(t))return e.stylize("null","null")}(e,n);if(i)return i;var a=Object.keys(n),s=function(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(n)),S(n)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return f(n);if(0===a.length){if(_(n)){var u=n.name?": "+n.name:"";return e.stylize("[Function"+u+"]","special")}if(b(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(E(n))return e.stylize(Date.prototype.toString.call(n),"date");if(S(n))return f(n)}var c,w="",T=!1,k=["{","}"];(p(n)&&(T=!0,k=["[","]"]),_(n))&&(w=" [Function"+(n.name?": "+n.name:"")+"]");return b(n)&&(w=" "+RegExp.prototype.toString.call(n)),E(n)&&(w=" "+Date.prototype.toUTCString.call(n)),S(n)&&(w=" "+f(n)),0!==a.length||T&&0!=n.length?r<0?b(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),c=T?function(e,t,n,r,o){for(var i=[],a=0,s=t.length;a=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(c,w,k)):k[0]+w+k[1]}function f(e){return"["+Error.prototype.toString.call(e)+"]"}function h(e,t,n,r,o,i){var a,s,u;if((u=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),I(r,o)||(a="["+o+"]"),s||(e.seen.indexOf(u.value)<0?(s=g(n)?l(e,u.value,null):l(e,u.value,n-1)).indexOf("\n")>-1&&(s=i?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n")):s=e.stylize("[Circular]","special")),m(a)){if(i&&o.match(/^\d+$/))return s;(a=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function p(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function g(e){return null===e}function y(e){return"number"==typeof e}function v(e){return"string"==typeof e}function m(e){return void 0===e}function b(e){return w(e)&&"[object RegExp]"===T(e)}function w(e){return"object"==typeof e&&null!==e}function E(e){return w(e)&&"[object Date]"===T(e)}function S(e){return w(e)&&("[object Error]"===T(e)||e instanceof Error)}function _(e){return"function"==typeof e}function T(e){return Object.prototype.toString.call(e)}function k(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(m(i)&&(i=e.env.NODE_DEBUG||""),n=n.toUpperCase(),!a[n])if(new RegExp("\\b"+n+"\\b","i").test(i)){var r=e.pid;a[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else a[n]=function(){};return a[n]},t.inspect=s,s.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]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=p,t.isBoolean=d,t.isNull=g,t.isNullOrUndefined=function(e){return null==e},t.isNumber=y,t.isString=v,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=m,t.isRegExp=b,t.isObject=w,t.isDate=E,t.isError=S,t.isFunction=_,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(50);var C=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function I(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,n;console.log("%s - %s",(e=new Date,n=[k(e.getHours()),k(e.getMinutes()),k(e.getSeconds())].join(":"),[e.getDate(),C[e.getMonth()],n].join(" ")),t.format.apply(t,arguments))},t.inherits=n(7),t._extend=function(e,t){if(!t||!w(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var x="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function R(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(x&&e[x]){var t;if("function"!=typeof(t=e[x]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,x,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise(function(e,r){t=e,n=r}),o=[],i=0;i0?("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===c.prototype||(t=function(e){return c.from(e)}(t)),r?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):E(e,a,t,!0):a.ended?e.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||0!==t.length?E(e,a,t,!1):C(e,a)):E(e,a,t,!1))):r||(a.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=S?e=S:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function T(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?o.nextTick(k,e):k(e))}function k(e){p("emit readable"),e.emit("readable"),O(e)}function C(e,t){t.readingMore||(t.readingMore=!0,o.nextTick(I,e,t))}function I(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;ei.length?i.length:e;if(a===i.length?o+=i:o+=i.slice(0,e),0===(e-=a)){a===i.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=i.slice(a));break}++r}return t.length-=r,o}(e,t):function(e,t){var n=c.allocUnsafe(e),r=t.head,o=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var i=r.data,a=e>i.length?i.length:e;if(i.copy(n,n.length-e,0,a),0===(e-=a)){a===i.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=i.slice(a));break}++o}return t.length-=o,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function M(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,o.nextTick(L,t,e))}function L(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function A(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?M(this):T(this),null;if(0===(e=_(e,t))&&t.ended)return 0===t.length&&M(this),null;var r,o=t.needReadable;return p("need readable",o),(0===t.length||t.length-e0?P(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&M(this)),null!==r&&this.emit("data",r),r},b.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,p("pipe count=%d opts=%j",i.pipesCount,t);var u=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?l:b;function c(t,r){p("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,p("cleanup"),e.removeListener("close",v),e.removeListener("finish",m),e.removeListener("drain",f),e.removeListener("error",y),e.removeListener("unpipe",c),n.removeListener("end",l),n.removeListener("end",b),n.removeListener("data",g),h=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function l(){p("onend"),e.end()}i.endEmitted?o.nextTick(u):n.once("end",u),e.on("unpipe",c);var f=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(e,"data")&&(t.flowing=!0,O(e))}}(n);e.on("drain",f);var h=!1;var d=!1;function g(t){p("ondata"),d=!1,!1!==e.write(t)||d||((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==A(i.pipes,e))&&!h&&(p("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,d=!0),n.pause())}function y(t){p("onerror",t),b(),e.removeListener("error",y),0===s(e,"error")&&e.emit("error",t)}function v(){e.removeListener("finish",m),b()}function m(){p("onfinish"),e.removeListener("close",v),b()}function b(){p("unpipe"),n.unpipe(e)}return n.on("data",g),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?a(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",y),e.once("close",v),e.once("finish",m),e.emit("pipe",n),i.flowing||(p("pipe resume"),n.resume()),e},b.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,o=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i0&&a.length>o&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return e}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=function(){for(var e=[],t=0;t0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=o[e];if(void 0===u)return!1;if("function"==typeof u)i(u,this,t);else{var c=u.length,l=d(u,c);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){a=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return h(this,e,!0)},s.prototype.rawListeners=function(e){return h(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){e.exports=n(34).EventEmitter},function(e,t,n){"use strict";var r=n(18);function o(e,t){e.emit("error",t)}e.exports={destroy:function(e,t){var n=this,i=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return i||a?(t?t(e):!e||this._writableState&&this._writableState.errorEmitted||r.nextTick(o,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(r.nextTick(o,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,n){"use strict";(function(t,r,o){var i=n(18);function a(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var o=r.callback;t.pendingcb--,o(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=m;var s,u=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?r:i.nextTick;m.WritableState=v;var c=n(15);c.inherits=n(7);var l={deprecate:n(56)},f=n(35),h=n(6).Buffer,p=o.Uint8Array||function(){};var d,g=n(36);function y(){}function v(e,t){s=s||n(10),e=e||{};var r=t instanceof s;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var o=e.highWaterMark,c=e.writableHighWaterMark,l=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:r&&(c||0===c)?c:l,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,o=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,o){--t.pendingcb,n?(i.nextTick(o,r),i.nextTick(T,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(o(r),e._writableState.errorEmitted=!0,e.emit("error",r),T(e,t))}(e,n,r,t,o);else{var a=S(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||E(e,n),r?u(w,e,n,a,o):w(e,n,a,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function m(e){if(s=s||n(10),!(d.call(m,this)||this instanceof s))return new m(e);this._writableState=new v(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function b(e,t,n,r,o,i,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,n?e._writev(o,t.onwrite):e._write(o,i,t.onwrite),t.sync=!1}function w(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),T(e,t)}function E(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,o=new Array(r),i=t.corkedRequestsFree;i.entry=n;for(var s=0,u=!0;n;)o[s]=n,n.isBuf||(u=!1),n=n.next,s+=1;o.allBuffers=u,b(e,t,!0,t.length,o,"",i.finish),t.pendingcb++,t.lastBufferedRequest=null,i.next?(t.corkedRequestsFree=i.next,i.next=null):t.corkedRequestsFree=new a(t),t.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,l=n.encoding,f=n.callback;if(b(e,t,!1,t.objectMode?1:c.length,c,l,f),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function S(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function _(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),T(e,t)})}function T(e,t){var n=S(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,i.nextTick(_,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}c.inherits(m,f),v.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(v.prototype,"buffer",{get:l.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(m,Symbol.hasInstance,{value:function(e){return!!d.call(this,e)||this===m&&(e&&e._writableState instanceof v)}})):d=function(e){return e instanceof this},m.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},m.prototype.write=function(e,t,n){var r,o=this._writableState,a=!1,s=!o.objectMode&&(r=e,h.isBuffer(r)||r instanceof p);return s&&!h.isBuffer(e)&&(e=function(e){return h.from(e)}(e)),"function"==typeof t&&(n=t,t=null),s?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof n&&(n=y),o.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}(this,n):(s||function(e,t,n,r){var o=!0,a=!1;return null===n?a=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),i.nextTick(r,a),o=!1),o}(this,o,e,n))&&(o.pendingcb++,a=function(e,t,n,r,o,i){if(!n){var a=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=h.from(t,n));return t}(t,r,o);r!==a&&(n=!0,o="buffer",r=a)}var s=t.objectMode?1:r.length;t.length+=s;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(m.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),m.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},m.prototype._writev=null,m.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,T(e,t),n&&(t.finished?i.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(m.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),m.prototype.destroy=g.destroy,m.prototype._undestroy=g.undestroy,m.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(14),n(54).setImmediate,n(5))},function(e,t,n){"use strict";var r=n(6).Buffer,o=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function i(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===o||!o(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=c,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=l,this.end=f,t=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function l(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function h(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.StringDecoder=i,i.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return o>0&&(e.lastNeed=o-1),o;if(--r=0)return o>0&&(e.lastNeed=o-2),o;if(--r=0)return o>0&&(2===o?o=0:e.lastNeed=o-3),o;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},i.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){"use strict";e.exports=a;var r=n(10),o=n(15);function i(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.length0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]s?a.slice(s).buffer:null}else{var u,c=t;if(-1===(u=c.indexOf(r.a.RecordSeparator)))throw new Error("Message is incomplete.");s=u+1;n=c.substring(0,s),i=c.length>s?c.substring(s):null}var l=r.a.parse(n),f=JSON.parse(l[0]);if(f.type)throw new Error("Expected a handshake response from the server.");return[i,f]},t}()}).call(this,n(11).Buffer)},,,,,function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0?r-4:r,f=0;f>16&255,s[u++]=t>>8&255,s[u++]=255&t;2===a&&(t=o[e.charCodeAt(f)]<<2|o[e.charCodeAt(f+1)]>>4,s[u++]=255&t);1===a&&(t=o[e.charCodeAt(f)]<<10|o[e.charCodeAt(f+1)]<<4|o[e.charCodeAt(f+2)]>>2,s[u++]=t>>8&255,s[u++]=255&t);return s},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],a=0,s=n-o;as?s:a+16383));1===o?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var o,i,a=[],s=t;s>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,o){var i,a,s=8*o-r-1,u=(1<>1,l=-7,f=n?o-1:0,h=n?-1:1,p=e[t+f];for(f+=h,i=p&(1<<-l)-1,p>>=-l,l+=s;l>0;i=256*i+e[t+f],f+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+e[t+f],f+=h,l-=8);if(0===i)i=1-c;else{if(i===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),i-=c}return(p?-1:1)*a*Math.pow(2,i-r)},t.write=function(e,t,n,r,o,i){var a,s,u,c=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,d=r?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(t*u-1)*Math.pow(2,o),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,o),a=0));o>=8;e[n+p]=255&s,p+=d,s/=256,o-=8);for(a=a<0;e[n+p]=255&a,p+=d,a/=256,c-=8);e[n+p-d]|=128*g}},function(e,t,n){"use strict";(function(t){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -function r(e,t){if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=Math.min(n,r);o=0;u--)if(l[u]!==h[u])return!1;for(u=l.length-1;u>=0;u--)if(c=l[u],!b(e[c],t[c],n,r))return!1;return!0}(e,t,n,s))}return n?e===t:e==t}function m(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function w(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function S(e,t,n,r){var o;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),o=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!o&&y(o,n,"Missing expected exception"+r);var s="string"==typeof r,a=!e&&o&&!n;if((!e&&i.isError(o)&&s&&w(o,n)||a)&&y(o,n,"Got unwanted exception"+r),e&&o&&n&&!w(o,n)||!e&&o)throw o}h.AssertionError=function(e){var t;this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=d(g((t=this).actual),128)+" "+t.operator+" "+d(g(t.expected),128),this.generatedMessage=!0);var n=e.stackStartFunction||y;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var o=r.stack,i=p(n),s=o.indexOf("\n"+i);if(s>=0){var a=o.indexOf("\n",s+1);o=o.substring(a+1)}this.stack=o}}},i.inherits(h.AssertionError,Error),h.fail=y,h.ok=v,h.equal=function(e,t,n){e!=t&&y(e,t,n,"==",h.equal)},h.notEqual=function(e,t,n){e==t&&y(e,t,n,"!=",h.notEqual)},h.deepEqual=function(e,t,n){b(e,t,!1)||y(e,t,n,"deepEqual",h.deepEqual)},h.deepStrictEqual=function(e,t,n){b(e,t,!0)||y(e,t,n,"deepStrictEqual",h.deepStrictEqual)},h.notDeepEqual=function(e,t,n){b(e,t,!1)&&y(e,t,n,"notDeepEqual",h.notDeepEqual)},h.notDeepStrictEqual=function e(t,n,r){b(t,n,!0)&&y(t,n,r,"notDeepStrictEqual",e)},h.strictEqual=function(e,t,n){e!==t&&y(e,t,n,"===",h.strictEqual)},h.notStrictEqual=function(e,t,n){e===t&&y(e,t,n,"!==",h.notStrictEqual)},h.throws=function(e,t,n){S(!0,e,t,n)},h.doesNotThrow=function(e,t,n){S(!1,e,t,n)},h.ifError=function(e){if(e)throw e};var E=Object.keys||function(e){var t=[];for(var n in e)s.call(e,n)&&t.push(n);return t}}).call(this,n(13))},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){e.exports=n(14)},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){},function(e,t,n){"use strict";var r=n(18).Buffer,o=n(65);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t,n,o,i=r.allocUnsafe(e>>>0),s=this.head,a=0;s;)t=s.data,n=i,o=a,t.copy(n,o),a+=s.data.length,s=s.next;return i},e}(),o&&o.inspect&&o.inspect.custom&&(e.exports.prototype[o.inspect.custom]=function(){var e=o.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,n){var r=n(8),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s),i(o,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=o(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new i(o.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new i(o.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(68),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(13))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,o,i,s,a,c=1,u={},l=!1,h=e.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(e);f=f&&f.setTimeout?f:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick(function(){d(e)})}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){d(e.data)},r=function(e){i.port2.postMessage(e)}):h&&"onreadystatechange"in h.createElement("script")?(o=h.documentElement,r=function(e){var t=h.createElement("script");t.onreadystatechange=function(){d(e),t.onreadystatechange=null,o.removeChild(t),t=null},o.appendChild(t)}):r=function(e){setTimeout(d,0,e)}:(s="setImmediate$"+Math.random()+"$",a=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(s)&&d(+t.data.slice(s.length))},e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),r=function(t){e.postMessage(s+t,"*")}),f.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n0?this._transform(null,t,n):n()},e.exports.decoder=c,e.exports.encoder=a},function(e,t,n){(t=e.exports=n(38)).Stream=t,t.Readable=t,t.Writable=n(43),t.Duplex=n(14),t.Transform=n(44),t.PassThrough=n(72)},function(e,t,n){"use strict";e.exports=i;var r=n(44),o=n(23);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}o.inherits=n(19),o.inherits(i,r),i.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){var r=n(25);function o(e){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=e||"unable to decode"}n(37).inherits(o,Error),e.exports=function(e){return function(e){e instanceof r||(e=r().append(e));var t=i(e);if(t)return e.consume(t.bytesConsumed),t.value;throw new o};function t(e,t,n){return t>=n+e}function n(e,t){return{value:e,bytesConsumed:t}}function i(e,r){r=void 0===r?0:r;var o=e.length-r;if(o<=0)return null;var i,l,h,f=e.readUInt8(r),p=0;if(!function(e,t){var n=function(e){switch(e){case 196:return 2;case 197:return 3;case 198:return 5;case 199:return 3;case 200:return 4;case 201:return 6;case 202:return 5;case 203:return 9;case 204:return 2;case 205:return 3;case 206:return 5;case 207:return 9;case 208:return 2;case 209:return 3;case 210:return 5;case 211:return 9;case 212:return 3;case 213:return 4;case 214:return 6;case 215:return 10;case 216:return 18;case 217:return 2;case 218:return 3;case 219:return 5;case 222:return 3;default:return-1}}(e);return!(-1!==n&&t=0;h--)p+=e.readUInt8(r+h+1)*Math.pow(2,8*(7-h));return n(p,9);case 208:return n(p=e.readInt8(r+1),2);case 209:return n(p=e.readInt16BE(r+1),3);case 210:return n(p=e.readInt32BE(r+1),5);case 211:return n(p=function(e,t){var n=128==(128&e[t]);if(n)for(var r=1,o=t+7;o>=t;o--){var i=(255^e[o])+r;e[o]=255&i,r=i>>8}var s=e.readUInt32BE(t+0),a=e.readUInt32BE(t+4);return(4294967296*s+a)*(n?-1:1)}(e.slice(r+1,r+9),0),9);case 202:return n(p=e.readFloatBE(r+1),5);case 203:return n(p=e.readDoubleBE(r+1),9);case 217:return t(i=e.readUInt8(r+1),o,2)?n(p=e.toString("utf8",r+2,r+2+i),2+i):null;case 218:return t(i=e.readUInt16BE(r+1),o,3)?n(p=e.toString("utf8",r+3,r+3+i),3+i):null;case 219:return t(i=e.readUInt32BE(r+1),o,5)?n(p=e.toString("utf8",r+5,r+5+i),5+i):null;case 196:return t(i=e.readUInt8(r+1),o,2)?n(p=e.slice(r+2,r+2+i),2+i):null;case 197:return t(i=e.readUInt16BE(r+1),o,3)?n(p=e.slice(r+3,r+3+i),3+i):null;case 198:return t(i=e.readUInt32BE(r+1),o,5)?n(p=e.slice(r+5,r+5+i),5+i):null;case 220:return o<3?null:(i=e.readUInt16BE(r+1),s(e,r,i,3));case 221:return o<5?null:(i=e.readUInt32BE(r+1),s(e,r,i,5));case 222:return i=e.readUInt16BE(r+1),a(e,r,i,3);case 223:throw new Error("map too big to decode in JS");case 212:return c(e,r,1);case 213:return c(e,r,2);case 214:return c(e,r,4);case 215:return c(e,r,8);case 216:return c(e,r,16);case 199:return i=e.readUInt8(r+1),l=e.readUInt8(r+2),t(i,o,3)?u(e,r,l,i,3):null;case 200:return i=e.readUInt16BE(r+1),l=e.readUInt8(r+3),t(i,o,4)?u(e,r,l,i,4):null;case 201:return i=e.readUInt32BE(r+1),l=e.readUInt8(r+5),t(i,o,6)?u(e,r,l,i,6):null}if(144==(240&f))return s(e,r,i=15&f,1);if(128==(240&f))return a(e,r,i=15&f,1);if(160==(224&f))return t(i=31&f,o,1)?n(p=e.toString("utf8",r+1,r+i+1),i+1):null;if(f>=224)return n(p=f-256,1);if(f<128)return n(f,1);throw new Error("not implemented yet")}function s(e,t,r,o){var s,a=[],c=0;for(t+=o,s=0;si)&&((n=r.allocUnsafe(9))[0]=203,n.writeDoubleBE(e,1)),n}e.exports=function(e,t,n,i){function a(c,u){var l,h,f;if(void 0===c)throw new Error("undefined is not encodable in msgpack!");if(null===c)(l=r.allocUnsafe(1))[0]=192;else if(!0===c)(l=r.allocUnsafe(1))[0]=195;else if(!1===c)(l=r.allocUnsafe(1))[0]=194;else if("string"==typeof c)(h=r.byteLength(c))<32?((l=r.allocUnsafe(1+h))[0]=160|h,h>0&&l.write(c,1)):h<=255&&!n?((l=r.allocUnsafe(2+h))[0]=217,l[1]=h,l.write(c,2)):h<=65535?((l=r.allocUnsafe(3+h))[0]=218,l.writeUInt16BE(h,1),l.write(c,3)):((l=r.allocUnsafe(5+h))[0]=219,l.writeUInt32BE(h,1),l.write(c,5));else if(c&&(c.readUInt32LE||c instanceof Uint8Array))c instanceof Uint8Array&&(c=r.from(c)),c.length<=255?((l=r.allocUnsafe(2))[0]=196,l[1]=c.length):c.length<=65535?((l=r.allocUnsafe(3))[0]=197,l.writeUInt16BE(c.length,1)):((l=r.allocUnsafe(5))[0]=198,l.writeUInt32BE(c.length,1)),l=o([l,c]);else if(Array.isArray(c))c.length<16?(l=r.allocUnsafe(1))[0]=144|c.length:c.length<65536?((l=r.allocUnsafe(3))[0]=220,l.writeUInt16BE(c.length,1)):((l=r.allocUnsafe(5))[0]=221,l.writeUInt32BE(c.length,1)),l=c.reduce(function(e,t){return e.append(a(t,!0)),e},o().append(l));else{if(!i&&"function"==typeof c.getDate)return function(e){var t,n=1*e,i=Math.floor(n/1e3),s=1e6*(n-1e3*i);if(s||i>4294967295){(t=new r(10))[0]=215,t[1]=-1;var a=4*s,c=i/Math.pow(2,32),u=a+c&4294967295,l=4294967295&i;t.writeInt32BE(u,2),t.writeInt32BE(l,6)}else(t=new r(6))[0]=214,t[1]=-1,t.writeUInt32BE(Math.floor(n/1e3),2);return o().append(t)}(c);if("object"==typeof c)l=function(t){var n,i,s=-1,a=[];for(n=0;n>8),a.push(255&s)):(a.push(201),a.push(s>>24),a.push(s>>16&255),a.push(s>>8&255),a.push(255&s));return o().append(r.from(a)).append(i)}(c)||function(e){var t,n,i=[],s=0;for(t in e)e.hasOwnProperty(t)&&void 0!==e[t]&&"function"!=typeof e[t]&&(++s,i.push(a(t,!0)),i.push(a(e[t],!0)));s<16?(n=r.allocUnsafe(1))[0]=128|s:((n=r.allocUnsafe(3))[0]=222,n.writeUInt16BE(s,1));return i.unshift(n),i.reduce(function(e,t){return e.append(t)},o())}(c);else if("number"==typeof c){if((f=c)!==Math.floor(f))return s(c,t);if(c>=0)if(c<128)(l=r.allocUnsafe(1))[0]=c;else if(c<256)(l=r.allocUnsafe(2))[0]=204,l[1]=c;else if(c<65536)(l=r.allocUnsafe(3))[0]=205,l.writeUInt16BE(c,1);else if(c<=4294967295)(l=r.allocUnsafe(5))[0]=206,l.writeUInt32BE(c,1);else{if(!(c<=9007199254740991))return s(c,!0);(l=r.allocUnsafe(9))[0]=207,function(e,t){for(var n=7;n>=0;n--)e[n+1]=255&t,t/=256}(l,c)}else if(c>=-32)(l=r.allocUnsafe(1))[0]=256+c;else if(c>=-128)(l=r.allocUnsafe(2))[0]=208,l.writeInt8(c,1);else if(c>=-32768)(l=r.allocUnsafe(3))[0]=209,l.writeInt16BE(c,1);else if(c>-214748365)(l=r.allocUnsafe(5))[0]=210,l.writeInt32BE(c,1);else{if(!(c>=-9007199254740991))return s(c,!0);(l=r.allocUnsafe(9))[0]=211,function(e,t,n){var r=n<0;r&&(n=Math.abs(n));var o=n%4294967296,i=n/4294967296;if(e.writeUInt32BE(Math.floor(i),t+0),e.writeUInt32BE(o,t+4),r)for(var s=1,a=t+7;a>=t;a--){var c=(255^e[a])+s;e[a]=255&c,s=c>>8}}(l,1,c)}}}if(!l)throw new Error("not implemented yet");return u?l:l.slice()}return a}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this.dialog=e}return e.prototype.show=function(){this.removeClasses(),this.dialog.classList.add(e.ShowClassName)},e.prototype.hide=function(){this.removeClasses(),this.dialog.classList.add(e.HideClassName)},e.prototype.failed=function(){this.removeClasses(),this.dialog.classList.add(e.FailedClassName)},e.prototype.removeClasses=function(){this.dialog.classList.remove(e.ShowClassName,e.HideClassName,e.FailedClassName)},e.ShowClassName="components-reconnect-show",e.HideClassName="components-reconnect-hide",e.FailedClassName="components-reconnect-failed",e}();t.UserSpecifiedDisplay=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(45),o=function(){function e(e){this.document=e,this.addedToDom=!1,this.modal=this.document.createElement("div"),this.modal.id=r.AutoReconnectCircuitHandler.DialogId;this.modal.style.cssText=["position: fixed","top: 0","right: 0","bottom: 0","left: 0","z-index: 1000","display: none","overflow: hidden","background-color: #fff","opacity: 0.8","text-align: center","font-weight: bold"].join(";"),this.modal.innerHTML='
',this.message=this.modal.querySelector("h5"),this.button=this.modal.querySelector("button"),this.button.addEventListener("click",function(){return window.Blazor.reconnect()})}return e.prototype.show=function(){this.addedToDom||(this.addedToDom=!0,this.document.body.appendChild(this.modal)),this.modal.style.display="block",this.button.style.display="none",this.message.textContent="Attempting to reconnect to the server..."},e.prototype.hide=function(){this.modal.style.display="none"},e.prototype.failed=function(){this.button.style.display="block",this.message.textContent="Failed to reconnect to the server."},e}();t.DefaultReconnectDisplay=o},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]this.nextBatchId)this.logger.log(a.LogLevel.Debug,"Waiting for batch "+this.nextBatchId+". Batch "+e+" not processed.");else try{this.nextBatchId++,this.logger.log(a.LogLevel.Debug,"Applying batch "+e+"."),i.renderBatch(this.browserRendererId,new s.OutOfProcessRenderBatch(t)),this.completeBatch(n,e)}catch(t){throw this.logger.log(a.LogLevel.Error,"There was an error applying batch "+e+"."),n.send("OnRenderCompleted",e,t.toString()),t}},e.prototype.getLastBatchid=function(){return this.nextBatchId-1},e.prototype.completeBatch=function(e,t){return r(this,void 0,void 0,function(){return o(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,e.send("OnRenderCompleted",t,null)];case 1:return n.sent(),[3,3];case 2:return n.sent(),this.logger.log(a.LogLevel.Warning,"Failed to deliver completion notification for render '"+t+"'."),[3,3];case 3:return[2]}})})},e.renderQueues=new Map,e}();t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(79),o=function(){function e(e){this.batchData=e;var t=new c(e);this.arrayRangeReader=new u(e),this.arraySegmentReader=new l(e),this.diffReader=new i(e),this.editReader=new s(e,t),this.frameReader=new a(e,t)}return e.prototype.updatedComponents=function(){return h(this.batchData,this.batchData.length-20)},e.prototype.referenceFrames=function(){return h(this.batchData,this.batchData.length-16)},e.prototype.disposedComponentIds=function(){return h(this.batchData,this.batchData.length-12)},e.prototype.disposedEventHandlerIds=function(){return h(this.batchData,this.batchData.length-8)},e.prototype.updatedComponentsEntry=function(e,t){var n=e+4*t;return h(this.batchData,n)},e.prototype.referenceFramesEntry=function(e,t){return e+16*t},e.prototype.disposedComponentIdsEntry=function(e,t){var n=e+4*t;return h(this.batchData,n)},e.prototype.disposedEventHandlerIdsEntry=function(e,t){var n=e+4*t;return h(this.batchData,n)},e}();t.OutOfProcessRenderBatch=o;var i=function(){function e(e){this.batchDataUint8=e}return e.prototype.componentId=function(e){return h(this.batchDataUint8,e)},e.prototype.edits=function(e){return e+4},e.prototype.editsEntry=function(e,t){return e+16*t},e}(),s=function(){function e(e,t){this.batchDataUint8=e,this.stringReader=t}return e.prototype.editType=function(e){return h(this.batchDataUint8,e)},e.prototype.siblingIndex=function(e){return h(this.batchDataUint8,e+4)},e.prototype.newTreeIndex=function(e){return h(this.batchDataUint8,e+8)},e.prototype.moveToSiblingIndex=function(e){return h(this.batchDataUint8,e+8)},e.prototype.removedAttributeName=function(e){var t=h(this.batchDataUint8,e+12);return this.stringReader.readString(t)},e}(),a=function(){function e(e,t){this.batchDataUint8=e,this.stringReader=t}return e.prototype.frameType=function(e){return h(this.batchDataUint8,e)},e.prototype.subtreeLength=function(e){return h(this.batchDataUint8,e+4)},e.prototype.elementReferenceCaptureId=function(e){var t=h(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.componentId=function(e){return h(this.batchDataUint8,e+8)},e.prototype.elementName=function(e){var t=h(this.batchDataUint8,e+8);return this.stringReader.readString(t)},e.prototype.textContent=function(e){var t=h(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.markupContent=function(e){var t=h(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.attributeName=function(e){var t=h(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.attributeValue=function(e){var t=h(this.batchDataUint8,e+8);return this.stringReader.readString(t)},e.prototype.attributeEventHandlerId=function(e){return h(this.batchDataUint8,e+12)},e}(),c=function(){function e(e){this.batchDataUint8=e,this.stringTableStartIndex=h(e,e.length-4)}return e.prototype.readString=function(e){if(-1===e)return null;var t,n=h(this.batchDataUint8,this.stringTableStartIndex+4*e),o=function(e,t){for(var n=0,r=0,o=0;o<4;o++){var i=e[t+o];if(n|=(127&i)<65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u)}r.length>1024&&(o.push(String.fromCharCode.apply(null,r)),r.length=0)}return o.push(String.fromCharCode.apply(null,r)),o.join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(27),o=function(){function e(){}return e.prototype.log=function(e,t){},e.instance=new e,e}();t.NullLogger=o;var i=function(){function e(e){this.minimumLogLevel=e}return e.prototype.log=function(e,t){if(e>=this.minimumLogLevel)switch(e){case r.LogLevel.Critical:case r.LogLevel.Error:console.error("["+(new Date).toISOString()+"] "+r.LogLevel[e]+": "+t);break;case r.LogLevel.Warning:console.warn("["+(new Date).toISOString()+"] "+r.LogLevel[e]+": "+t);break;case r.LogLevel.Information:console.info("["+(new Date).toISOString()+"] "+r.LogLevel[e]+": "+t);break;default:console.log("["+(new Date).toISOString()+"] "+r.LogLevel[e]+": "+t)}},e}();t.ConsoleLogger=i},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(s,a)}c((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}},s=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};Object.defineProperty(t,"__esModule",{value:!0});var a=n(24),c=n(82),u=function(){function e(e,t){this.circuitId=e,this.components=t}return e.prototype.reconnect=function(e){return e.invoke("ConnectCircuit",this.circuitId)},e}();function l(e){if(e.nodeType===Node.COMMENT_NODE&&e.textContent){var t=/\W+M.A.C.Component:[^{]*(.*)$/.exec(e.textContent),n=t&&t[1];if(n)try{var r=JSON.parse(n),o=r.componentId,i=r.circuitId,s=r.rendererId;if(!!o&&!!i&&!!s)return{node:e,circuitId:i,rendererId:Number.parseInt(s),componentId:Number.parseInt(o)};throw new Error("Found malformed start component comment at "+e.textContent)}catch(t){throw new Error("Found malformed start component comment at "+e.textContent)}}}function h(e,t,n,r){for(var o=n;o=200&&o.status<300?n(new c.b(o.status,o.statusText,o.response||o.responseText)):r(new a.b(o.statusText,o.status))},o.onerror=function(){t.logger.log(l.a.Warning,"Error from HTTP request. "+o.status+": "+o.statusText+"."),r(new a.b(o.statusText,o.status))},o.ontimeout=function(){t.logger.log(l.a.Warning,"Timeout from HTTP request."),r(new a.c)},o.send(e.content||"")}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))},t}(c.a),p=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),d=function(e){function t(t){var n=e.call(this)||this;return"undefined"!=typeof XMLHttpRequest?n.httpClient=new f(t):n.httpClient=new u.a(t),n}return p(t,e),t.prototype.send=function(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new a.a):e.method?e.url?this.httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))},t.prototype.getCookieString=function(e){return this.httpClient.getCookieString(e)},t}(c.a),g=n(49);!function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close"}(o||(o={}));var y,v=n(3),b=function(){function e(){this.observers=[]}return e.prototype.next=function(e){for(var t=0,n=this.observers;t0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0?[2,Promise.reject(new Error("Unable to connect to the server with any of the available transports. "+i.join(" ")))]:[2,Promise.reject(new Error("None of the transports supported by the client are supported by the server."))]}})})},e.prototype.constructTransport=function(e){switch(e){case C.WebSockets:if(!this.options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new B(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.WebSocket);case C.ServerSentEvents:if(!this.options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new A(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.EventSource);case C.LongPolling:return new D(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1);default:throw new Error("Unknown transport: "+e+".")}},e.prototype.resolveTransport=function(e,t,n){var r=C[e.transport];if(null!=r){var o=e.transferFormats.map(function(e){return k[e]});if(function(e,t){return!e||0!=(t&e)}(t,r)){if(o.indexOf(n)>=0){if(r===C.WebSockets&&!this.options.WebSocket||r===C.ServerSentEvents&&!this.options.EventSource)throw this.logger.log(l.a.Debug,"Skipping transport '"+C[r]+"' because it is not supported in your environment.'"),new Error("'"+C[r]+"' is not supported in your environment.");return this.logger.log(l.a.Debug,"Selecting transport '"+C[r]+"'."),r}throw this.logger.log(l.a.Debug,"Skipping transport '"+C[r]+"' because it does not support the requested transfer format '"+k[n]+"'."),new Error("'"+C[r]+"' does not support "+k[n]+".")}throw this.logger.log(l.a.Debug,"Skipping transport '"+C[r]+"' because it was disabled by the client."),new Error("'"+C[r]+"' is disabled by the client.")}return this.logger.log(l.a.Debug,"Skipping transport '"+e.transport+"' because it is not supported by this client."),null},e.prototype.isITransport=function(e){return e&&"object"==typeof e&&"connect"in e},e.prototype.stopConnection=function(e){if(this.logger.log(l.a.Debug,"HttpConnection.stopConnection("+e+") called while in state "+this.connectionState+"."),this.transport=void 0,e=this.stopError||e,this.stopError=void 0,"Disconnected"!==this.connectionState)if("Connecting "!==this.connectionState){if("Disconnecting"===this.connectionState&&this.stopPromiseResolver(),e?this.logger.log(l.a.Error,"Connection disconnected with error '"+e+"'."):this.logger.log(l.a.Information,"Connection disconnected."),this.connectionId=void 0,this.connectionState="Disconnected",this.onclose&&this.connectionStarted){this.connectionStarted=!1;try{this.onclose(e)}catch(t){this.logger.log(l.a.Error,"HttpConnection.onclose("+e+") threw error '"+t+"'.")}}}else this.logger.log(l.a.Warning,"Call to HttpConnection.stopConnection("+e+") was ignored because the connection hasn't yet left the in the connecting state.");else this.logger.log(l.a.Debug,"Call to HttpConnection.stopConnection("+e+") was ignored because the connection is already in the disconnected state.")},e.prototype.resolveUrl=function(e){if(0===e.lastIndexOf("https://",0)||0===e.lastIndexOf("http://",0))return e;if(!v.c.isBrowser||!window.document)throw new Error("Cannot resolve '"+e+"'.");var t=window.document.createElement("a");return t.href=e,this.logger.log(l.a.Information,"Normalizing '"+e+"' to '"+t.href+"'."),t.href},e.prototype.resolveNegotiateUrl=function(e){var t=e.indexOf("?"),n=e.substring(0,-1===t?e.length:t);return"/"!==n[n.length-1]&&(n+="/"),n+="negotiate",n+=-1===t?"":e.substring(t)},e}();var z=function(){function e(e){this.transport=e,this.buffer=[],this.executing=!0,this.sendBufferedData=new Y,this.transportResult=new Y,this.sendLoop().then(function(){},function(e){})}return e.prototype.send=function(e){return this.bufferData(e),this.transportResult.promise},e.prototype.stop=function(){this.executing=!1,this.sendBufferedData.resolve()},e.prototype.bufferData=function(e){if(this.buffer.length&&typeof this.buffer[0]!=typeof e)throw new Error("Expected data to be of type "+typeof this.buffer+" but was of type "+typeof e);this.buffer.push(e),this.sendBufferedData.resolve()},e.prototype.sendLoop=function(){return N(this,void 0,void 0,function(){var t,n,r;return U(this,function(o){switch(o.label){case 0:return[4,this.sendBufferedData.promise];case 1:if(o.sent(),!this.executing)return[3,6];this.sendBufferedData=new Y,t=this.transportResult,this.transportResult=new Y,n="string"==typeof this.buffer[0]?this.buffer.join(""):e.concatBuffers(this.buffer),this.buffer.length=0,o.label=2;case 2:return o.trys.push([2,4,,5]),[4,this.transport.send(n)];case 3:return o.sent(),t.resolve(),[3,5];case 4:return r=o.sent(),t.reject(r),[3,5];case 5:return[3,0];case 6:return[2]}})})},e.concatBuffers=function(e){for(var t=e.map(function(e){return e.byteLength}).reduce(function(e,t){return e+t}),n=new Uint8Array(t),r=0,o=0,i=e;o>=7)>0&&(r|=128),n.push(r)}while(t>0);t=e.byteLength||e.length;var o=new Uint8Array(n.length+t);return o.set(n,0),o.set(e,n.length),o.buffer},e.parse=function(e){for(var t=[],n=new Uint8Array(e),r=[0,7,14,21,28],o=0;o7)throw new Error("Messages bigger than 2GB are not supported.");if(!(n.byteLength>=o+i+s))throw new Error("Incomplete message.");t.push(n.slice?n.slice(o+i,o+i+s):n.subarray(o+i,o+i+s)),o=o+i+s}return t},e}();var Z=new Uint8Array([145,o.Ping]),ee=function(){function e(){this.name="messagepack",this.version=1,this.transferFormat=k.Binary,this.errorResult=1,this.voidResult=2,this.nonVoidResult=3}return e.prototype.parseMessages=function(e,t){if(!(e instanceof i.Buffer||(n=e,n&&"undefined"!=typeof ArrayBuffer&&(n instanceof ArrayBuffer||n.constructor&&"ArrayBuffer"===n.constructor.name))))throw new Error("Invalid input for MessagePack hub protocol. Expected an ArrayBuffer or Buffer.");var n;null===t&&(t=J.a.instance);for(var r=[],o=0,s=$.parse(e);o=200&&o.status<300?n(new s.b(o.status,o.statusText,o.response||o.responseText)):r(new i.b(o.statusText,o.status))},o.onerror=function(){t.logger.log(c.a.Warning,"Error from HTTP request. "+o.status+": "+o.statusText+"."),r(new i.b(o.statusText,o.status))},o.ontimeout=function(){t.logger.log(c.a.Warning,"Timeout from HTTP request."),r(new i.c)},o.send(e.content||"")}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))},t}(s.a),h=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),f=function(e){function t(t){var n=e.call(this)||this;return"undefined"!=typeof XMLHttpRequest?n.httpClient=new l(t):n.httpClient=new a.a(t),n}return h(t,e),t.prototype.send=function(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new i.a):e.method?e.url?this.httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))},t.prototype.getCookieString=function(e){return this.httpClient.getCookieString(e)},t}(s.a),p=n(47);!function(e){e[e.Invocation=1]="Invocation",e[e.StreamItem=2]="StreamItem",e[e.Completion=3]="Completion",e[e.StreamInvocation=4]="StreamInvocation",e[e.CancelInvocation=5]="CancelInvocation",e[e.Ping=6]="Ping",e[e.Close=7]="Close"}(o||(o={}));var d,g=n(2),y=function(){function e(){this.observers=[]}return e.prototype.next=function(e){for(var t=0,n=this.observers;t0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0?[2,Promise.reject(new Error("Unable to connect to the server with any of the available transports. "+i.join(" ")))]:[2,Promise.reject(new Error("None of the transports supported by the client are supported by the server."))]}})})},e.prototype.constructTransport=function(e){switch(e){case S.WebSockets:if(!this.options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new M(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.WebSocket);case S.ServerSentEvents:if(!this.options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new O(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.EventSource);case S.LongPolling:return new x(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1);default:throw new Error("Unknown transport: "+e+".")}},e.prototype.resolveTransport=function(e,t,n){var r=S[e.transport];if(null!=r){var o=e.transferFormats.map(function(e){return E[e]});if(function(e,t){return!e||0!=(t&e)}(t,r)){if(o.indexOf(n)>=0){if(r===S.WebSockets&&!this.options.WebSocket||r===S.ServerSentEvents&&!this.options.EventSource)throw this.logger.log(c.a.Debug,"Skipping transport '"+S[r]+"' because it is not supported in your environment.'"),new Error("'"+S[r]+"' is not supported in your environment.");return this.logger.log(c.a.Debug,"Selecting transport '"+S[r]+"'."),r}throw this.logger.log(c.a.Debug,"Skipping transport '"+S[r]+"' because it does not support the requested transfer format '"+E[n]+"'."),new Error("'"+S[r]+"' does not support "+E[n]+".")}throw this.logger.log(c.a.Debug,"Skipping transport '"+S[r]+"' because it was disabled by the client."),new Error("'"+S[r]+"' is disabled by the client.")}return this.logger.log(c.a.Debug,"Skipping transport '"+e.transport+"' because it is not supported by this client."),null},e.prototype.isITransport=function(e){return e&&"object"==typeof e&&"connect"in e},e.prototype.stopConnection=function(e){if(this.logger.log(c.a.Debug,"HttpConnection.stopConnection("+e+") called while in state "+this.connectionState+"."),this.transport=void 0,e=this.stopError||e,this.stopError=void 0,"Disconnected"!==this.connectionState)if("Connecting "!==this.connectionState){if("Disconnecting"===this.connectionState&&this.stopPromiseResolver(),e?this.logger.log(c.a.Error,"Connection disconnected with error '"+e+"'."):this.logger.log(c.a.Information,"Connection disconnected."),this.connectionId=void 0,this.connectionState="Disconnected",this.onclose&&this.connectionStarted){this.connectionStarted=!1;try{this.onclose(e)}catch(t){this.logger.log(c.a.Error,"HttpConnection.onclose("+e+") threw error '"+t+"'.")}}}else this.logger.log(c.a.Warning,"Call to HttpConnection.stopConnection("+e+") was ignored because the connection hasn't yet left the in the connecting state.");else this.logger.log(c.a.Debug,"Call to HttpConnection.stopConnection("+e+") was ignored because the connection is already in the disconnected state.")},e.prototype.resolveUrl=function(e){if(0===e.lastIndexOf("https://",0)||0===e.lastIndexOf("http://",0))return e;if(!g.c.isBrowser||!window.document)throw new Error("Cannot resolve '"+e+"'.");var t=window.document.createElement("a");return t.href=e,this.logger.log(c.a.Information,"Normalizing '"+e+"' to '"+t.href+"'."),t.href},e.prototype.resolveNegotiateUrl=function(e){var t=e.indexOf("?"),n=e.substring(0,-1===t?e.length:t);return"/"!==n[n.length-1]&&(n+="/"),n+="negotiate",n+=-1===t?"":e.substring(t)},e}();var W=function(){function e(e){this.transport=e,this.buffer=[],this.executing=!0,this.sendBufferedData=new q,this.transportResult=new q,this.sendLoop().then(function(){},function(e){})}return e.prototype.send=function(e){return this.bufferData(e),this.transportResult.promise},e.prototype.stop=function(){this.executing=!1,this.sendBufferedData.resolve()},e.prototype.bufferData=function(e){if(this.buffer.length&&typeof this.buffer[0]!=typeof e)throw new Error("Expected data to be of type "+typeof this.buffer+" but was of type "+typeof e);this.buffer.push(e),this.sendBufferedData.resolve()},e.prototype.sendLoop=function(){return j(this,void 0,void 0,function(){var t,n,r;return B(this,function(o){switch(o.label){case 0:return[4,this.sendBufferedData.promise];case 1:if(o.sent(),!this.executing)return[3,6];this.sendBufferedData=new q,t=this.transportResult,this.transportResult=new q,n="string"==typeof this.buffer[0]?this.buffer.join(""):e.concatBuffers(this.buffer),this.buffer.length=0,o.label=2;case 2:return o.trys.push([2,4,,5]),[4,this.transport.send(n)];case 3:return o.sent(),t.resolve(),[3,5];case 4:return r=o.sent(),t.reject(r),[3,5];case 5:return[3,0];case 6:return[2]}})})},e.concatBuffers=function(e){for(var t=e.map(function(e){return e.byteLength}).reduce(function(e,t){return e+t}),n=new Uint8Array(t),r=0,o=0,i=e;o=0;c--)if(l[c]!==f[c])return!1;for(c=l.length-1;c>=0;c--)if(u=l[c],!m(e[u],t[u],n,r))return!1;return!0}(e,t,n,a))}return n?e===t:e==t}function b(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function w(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function E(e,t,n,r){var o;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof n&&(r=n,n=null),o=function(e){var t;try{e()}catch(e){t=e}return t}(t),r=(n&&n.name?" ("+n.name+").":".")+(r?" "+r:"."),e&&!o&&y(o,n,"Missing expected exception"+r);var a="string"==typeof r,s=!e&&o&&!n;if((!e&&i.isError(o)&&a&&w(o,n)||s)&&y(o,n,"Got unwanted exception"+r),e&&o&&n&&!w(o,n)||!e&&o)throw o}f.AssertionError=function(e){var t;this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=d(g((t=this).actual),128)+" "+t.operator+" "+d(g(t.expected),128),this.generatedMessage=!0);var n=e.stackStartFunction||y;if(Error.captureStackTrace)Error.captureStackTrace(this,n);else{var r=new Error;if(r.stack){var o=r.stack,i=p(n),a=o.indexOf("\n"+i);if(a>=0){var s=o.indexOf("\n",a+1);o=o.substring(s+1)}this.stack=o}}},i.inherits(f.AssertionError,Error),f.fail=y,f.ok=v,f.equal=function(e,t,n){e!=t&&y(e,t,n,"==",f.equal)},f.notEqual=function(e,t,n){e==t&&y(e,t,n,"!=",f.notEqual)},f.deepEqual=function(e,t,n){m(e,t,!1)||y(e,t,n,"deepEqual",f.deepEqual)},f.deepStrictEqual=function(e,t,n){m(e,t,!0)||y(e,t,n,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function(e,t,n){m(e,t,!1)&&y(e,t,n,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=function e(t,n,r){m(t,n,!0)&&y(t,n,r,"notDeepStrictEqual",e)},f.strictEqual=function(e,t,n){e!==t&&y(e,t,n,"===",f.strictEqual)},f.notStrictEqual=function(e,t,n){e===t&&y(e,t,n,"!==",f.notStrictEqual)},f.throws=function(e,t,n){E(!0,e,t,n)},f.doesNotThrow=function(e,t,n){E(!1,e,t,n)},f.ifError=function(e){if(e)throw e};var S=Object.keys||function(e){var t=[];for(var n in e)a.call(e,n)&&t.push(n);return t}}).call(this,n(5))},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e,t){},function(e,t,n){"use strict";var r=n(6).Buffer,o=n(53);e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t,n,o,i=r.allocUnsafe(e>>>0),a=this.head,s=0;a;)t=a.data,n=i,o=s,t.copy(n,o),s+=a.data.length,a=a.next;return i},e}(),o&&o.inspect&&o.inspect.custom&&(e.exports.prototype[o.inspect.custom]=function(){var e=o.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new i(o.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new i(o.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(55),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(5))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,o,i,a,s,u=1,c={},l=!1,f=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick(function(){d(e)})}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){d(e.data)},r=function(e){i.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(o=f.documentElement,r=function(e){var t=f.createElement("script");t.onreadystatechange=function(){d(e),t.onreadystatechange=null,o.removeChild(t),t=null},o.appendChild(t)}):r=function(e){setTimeout(d,0,e)}:(a="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&d(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),r=function(t){e.postMessage(a+t,"*")}),h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n0?this._transform(null,t,n):n()},e.exports.decoder=u,e.exports.encoder=s},function(e,t,n){"use strict";var r=n(17);function o(e){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=e||"unable to decode"}n(30).inherits(o,Error),e.exports=function(e){return function(e){e instanceof r||(e=r().append(e));var t=i(e);if(t)return e.consume(t.bytesConsumed),t.value;throw new o};function t(e,t,n){return t>=n+e}function n(e,t){return{value:e,bytesConsumed:t}}function i(e,r){r=void 0===r?0:r;var o=e.length-r;if(o<=0)return null;var i,l,f,h=e.readUInt8(r),p=0;if(!function(e,t){var n=function(e){switch(e){case 196:return 2;case 197:return 3;case 198:return 5;case 199:return 3;case 200:return 4;case 201:return 6;case 202:return 5;case 203:return 9;case 204:return 2;case 205:return 3;case 206:return 5;case 207:return 9;case 208:return 2;case 209:return 3;case 210:return 5;case 211:return 9;case 212:return 3;case 213:return 4;case 214:return 6;case 215:return 10;case 216:return 18;case 217:return 2;case 218:return 3;case 219:return 5;case 222:return 3;default:return-1}}(e);return!(-1!==n&&t=0;f--)p+=e.readUInt8(r+f+1)*Math.pow(2,8*(7-f));return n(p,9);case 208:return n(p=e.readInt8(r+1),2);case 209:return n(p=e.readInt16BE(r+1),3);case 210:return n(p=e.readInt32BE(r+1),5);case 211:return n(p=function(e,t){var n=128==(128&e[t]);if(n)for(var r=1,o=t+7;o>=t;o--){var i=(255^e[o])+r;e[o]=255&i,r=i>>8}var a=e.readUInt32BE(t+0),s=e.readUInt32BE(t+4);return(4294967296*a+s)*(n?-1:1)}(e.slice(r+1,r+9),0),9);case 202:return n(p=e.readFloatBE(r+1),5);case 203:return n(p=e.readDoubleBE(r+1),9);case 217:return t(i=e.readUInt8(r+1),o,2)?n(p=e.toString("utf8",r+2,r+2+i),2+i):null;case 218:return t(i=e.readUInt16BE(r+1),o,3)?n(p=e.toString("utf8",r+3,r+3+i),3+i):null;case 219:return t(i=e.readUInt32BE(r+1),o,5)?n(p=e.toString("utf8",r+5,r+5+i),5+i):null;case 196:return t(i=e.readUInt8(r+1),o,2)?n(p=e.slice(r+2,r+2+i),2+i):null;case 197:return t(i=e.readUInt16BE(r+1),o,3)?n(p=e.slice(r+3,r+3+i),3+i):null;case 198:return t(i=e.readUInt32BE(r+1),o,5)?n(p=e.slice(r+5,r+5+i),5+i):null;case 220:return o<3?null:(i=e.readUInt16BE(r+1),a(e,r,i,3));case 221:return o<5?null:(i=e.readUInt32BE(r+1),a(e,r,i,5));case 222:return i=e.readUInt16BE(r+1),s(e,r,i,3);case 223:return i=e.readUInt32BE(r+1),s(e,r,i,5);case 212:return u(e,r,1);case 213:return u(e,r,2);case 214:return u(e,r,4);case 215:return u(e,r,8);case 216:return u(e,r,16);case 199:return i=e.readUInt8(r+1),l=e.readUInt8(r+2),t(i,o,3)?c(e,r,l,i,3):null;case 200:return i=e.readUInt16BE(r+1),l=e.readUInt8(r+3),t(i,o,4)?c(e,r,l,i,4):null;case 201:return i=e.readUInt32BE(r+1),l=e.readUInt8(r+5),t(i,o,6)?c(e,r,l,i,6):null}if(144==(240&h))return a(e,r,i=15&h,1);if(128==(240&h))return s(e,r,i=15&h,1);if(160==(224&h))return t(i=31&h,o,1)?n(p=e.toString("utf8",r+1,r+i+1),i+1):null;if(h>=224)return n(p=h-256,1);if(h<128)return n(h,1);throw new Error("not implemented yet")}function a(e,t,r,o){var a,s=[],u=0;for(t+=o,a=0;a0&&l.write(u,1)):f<=255&&!n?((l=r.allocUnsafe(2+f))[0]=217,l[1]=f,l.write(u,2)):f<=65535?((l=r.allocUnsafe(3+f))[0]=218,l.writeUInt16BE(f,1),l.write(u,3)):((l=r.allocUnsafe(5+f))[0]=219,l.writeUInt32BE(f,1),l.write(u,5));else if(u&&(u.readUInt32LE||u instanceof Uint8Array))u instanceof Uint8Array&&(u=r.from(u)),u.length<=255?((l=r.allocUnsafe(2))[0]=196,l[1]=u.length):u.length<=65535?((l=r.allocUnsafe(3))[0]=197,l.writeUInt16BE(u.length,1)):((l=r.allocUnsafe(5))[0]=198,l.writeUInt32BE(u.length,1)),l=o([l,u]);else if(Array.isArray(u))u.length<16?(l=r.allocUnsafe(1))[0]=144|u.length:u.length<65536?((l=r.allocUnsafe(3))[0]=220,l.writeUInt16BE(u.length,1)):((l=r.allocUnsafe(5))[0]=221,l.writeUInt32BE(u.length,1)),l=u.reduce(function(e,t){return e.append(s(t,!0)),e},o().append(l));else{if(!a&&"function"==typeof u.getDate)return function(e){var t,n=1*e,i=Math.floor(n/1e3),a=1e6*(n-1e3*i);if(a||i>4294967295){(t=r.allocUnsafe(10))[0]=215,t[1]=-1;var s=4*a,u=i/Math.pow(2,32),c=s+u&4294967295,l=4294967295&i;t.writeInt32BE(c,2),t.writeInt32BE(l,6)}else(t=r.allocUnsafe(6))[0]=214,t[1]=-1,t.writeUInt32BE(Math.floor(n/1e3),2);return o().append(t)}(u);if("object"==typeof u)l=function(t){var n,i,a=-1,s=[];for(n=0;n>8),s.push(255&a)):(s.push(201),s.push(a>>24),s.push(a>>16&255),s.push(a>>8&255),s.push(255&a));return o().append(r.from(s)).append(i)}(u)||function(e){var t,n,i=[],a=0;for(t in e)e.hasOwnProperty(t)&&void 0!==e[t]&&"function"!=typeof e[t]&&(++a,i.push(s(t,!0)),i.push(s(e[t],!0)));a<16?(n=r.allocUnsafe(1))[0]=128|a:a<65535?((n=r.allocUnsafe(3))[0]=222,n.writeUInt16BE(a,1)):((n=r.allocUnsafe(5))[0]=223,n.writeUInt32BE(a,1));return i.unshift(n),i.reduce(function(e,t){return e.append(t)},o())}(u);else if("number"==typeof u){if(function(e){return e%1!=0}(u))return i(u,t);if(u>=0)if(u<128)(l=r.allocUnsafe(1))[0]=u;else if(u<256)(l=r.allocUnsafe(2))[0]=204,l[1]=u;else if(u<65536)(l=r.allocUnsafe(3))[0]=205,l.writeUInt16BE(u,1);else if(u<=4294967295)(l=r.allocUnsafe(5))[0]=206,l.writeUInt32BE(u,1);else{if(!(u<=9007199254740991))return i(u,!0);(l=r.allocUnsafe(9))[0]=207,function(e,t){for(var n=7;n>=0;n--)e[n+1]=255&t,t/=256}(l,u)}else if(u>=-32)(l=r.allocUnsafe(1))[0]=256+u;else if(u>=-128)(l=r.allocUnsafe(2))[0]=208,l.writeInt8(u,1);else if(u>=-32768)(l=r.allocUnsafe(3))[0]=209,l.writeInt16BE(u,1);else if(u>-214748365)(l=r.allocUnsafe(5))[0]=210,l.writeInt32BE(u,1);else{if(!(u>=-9007199254740991))return i(u,!0);(l=r.allocUnsafe(9))[0]=211,function(e,t,n){var r=n<0;r&&(n=Math.abs(n));var o=n%4294967296,i=n/4294967296;if(e.writeUInt32BE(Math.floor(i),t+0),e.writeUInt32BE(o,t+4),r)for(var a=1,s=t+7;s>=t;s--){var u=(255^e[s])+a;e[s]=255&u,a=u>>8}}(l,1,u)}}}if(!l)throw new Error("not implemented yet");return c?l:l.slice()}return s}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this.dialog=e}return e.prototype.show=function(){this.removeClasses(),this.dialog.classList.add(e.ShowClassName)},e.prototype.hide=function(){this.removeClasses(),this.dialog.classList.add(e.HideClassName)},e.prototype.failed=function(){this.removeClasses(),this.dialog.classList.add(e.FailedClassName)},e.prototype.removeClasses=function(){this.dialog.classList.remove(e.ShowClassName,e.HideClassName,e.FailedClassName)},e.ShowClassName="components-reconnect-show",e.HideClassName="components-reconnect-hide",e.FailedClassName="components-reconnect-failed",e}();t.UserSpecifiedDisplay=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(40),o=function(){function e(e){this.document=e,this.addedToDom=!1,this.modal=this.document.createElement("div"),this.modal.id=r.AutoReconnectCircuitHandler.DialogId;this.modal.style.cssText=["position: fixed","top: 0","right: 0","bottom: 0","left: 0","z-index: 1000","display: none","overflow: hidden","background-color: #fff","opacity: 0.8","text-align: center","font-weight: bold"].join(";"),this.modal.innerHTML='
',this.message=this.modal.querySelector("h5"),this.button=this.modal.querySelector("button"),this.button.addEventListener("click",function(){return window.Blazor.reconnect()})}return e.prototype.show=function(){this.addedToDom||(this.addedToDom=!0,this.document.body.appendChild(this.modal)),this.modal.style.display="block",this.button.style.display="none",this.message.textContent="Attempting to reconnect to the server..."},e.prototype.hide=function(){this.modal.style.display="none"},e.prototype.failed=function(){this.button.style.display="block",this.message.textContent="Failed to reconnect to the server."},e}();t.DefaultReconnectDisplay=o},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]this.nextBatchId)this.logger.log(s.LogLevel.Debug,"Waiting for batch "+this.nextBatchId+". Batch "+e+" not processed.");else try{this.nextBatchId++,this.logger.log(s.LogLevel.Debug,"Applying batch "+e+"."),i.renderBatch(this.browserRendererId,new a.OutOfProcessRenderBatch(t)),this.completeBatch(n,e)}catch(t){throw this.logger.log(s.LogLevel.Error,"There was an error applying batch "+e+"."),n.send("OnRenderCompleted",e,t.toString()),t}},e.prototype.getLastBatchid=function(){return this.nextBatchId-1},e.prototype.completeBatch=function(e,t){return r(this,void 0,void 0,function(){return o(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,e.send("OnRenderCompleted",t,null)];case 1:return n.sent(),[3,3];case 2:return n.sent(),this.logger.log(s.LogLevel.Warning,"Failed to deliver completion notification for render '"+t+"'."),[3,3];case 3:return[2]}})})},e.renderQueues=new Map,e}();t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(65),o=function(){function e(e){this.batchData=e;var t=new u(e);this.arrayRangeReader=new c(e),this.arraySegmentReader=new l(e),this.diffReader=new i(e),this.editReader=new a(e,t),this.frameReader=new s(e,t)}return e.prototype.updatedComponents=function(){return f(this.batchData,this.batchData.length-20)},e.prototype.referenceFrames=function(){return f(this.batchData,this.batchData.length-16)},e.prototype.disposedComponentIds=function(){return f(this.batchData,this.batchData.length-12)},e.prototype.disposedEventHandlerIds=function(){return f(this.batchData,this.batchData.length-8)},e.prototype.updatedComponentsEntry=function(e,t){var n=e+4*t;return f(this.batchData,n)},e.prototype.referenceFramesEntry=function(e,t){return e+16*t},e.prototype.disposedComponentIdsEntry=function(e,t){var n=e+4*t;return f(this.batchData,n)},e.prototype.disposedEventHandlerIdsEntry=function(e,t){var n=e+4*t;return f(this.batchData,n)},e}();t.OutOfProcessRenderBatch=o;var i=function(){function e(e){this.batchDataUint8=e}return e.prototype.componentId=function(e){return f(this.batchDataUint8,e)},e.prototype.edits=function(e){return e+4},e.prototype.editsEntry=function(e,t){return e+16*t},e}(),a=function(){function e(e,t){this.batchDataUint8=e,this.stringReader=t}return e.prototype.editType=function(e){return f(this.batchDataUint8,e)},e.prototype.siblingIndex=function(e){return f(this.batchDataUint8,e+4)},e.prototype.newTreeIndex=function(e){return f(this.batchDataUint8,e+8)},e.prototype.moveToSiblingIndex=function(e){return f(this.batchDataUint8,e+8)},e.prototype.removedAttributeName=function(e){var t=f(this.batchDataUint8,e+12);return this.stringReader.readString(t)},e}(),s=function(){function e(e,t){this.batchDataUint8=e,this.stringReader=t}return e.prototype.frameType=function(e){return f(this.batchDataUint8,e)},e.prototype.subtreeLength=function(e){return f(this.batchDataUint8,e+4)},e.prototype.elementReferenceCaptureId=function(e){var t=f(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.componentId=function(e){return f(this.batchDataUint8,e+8)},e.prototype.elementName=function(e){var t=f(this.batchDataUint8,e+8);return this.stringReader.readString(t)},e.prototype.textContent=function(e){var t=f(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.markupContent=function(e){var t=f(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.attributeName=function(e){var t=f(this.batchDataUint8,e+4);return this.stringReader.readString(t)},e.prototype.attributeValue=function(e){var t=f(this.batchDataUint8,e+8);return this.stringReader.readString(t)},e.prototype.attributeEventHandlerId=function(e){return f(this.batchDataUint8,e+12)},e}(),u=function(){function e(e){this.batchDataUint8=e,this.stringTableStartIndex=f(e,e.length-4)}return e.prototype.readString=function(e){if(-1===e)return null;var t,n=f(this.batchDataUint8,this.stringTableStartIndex+4*e),o=function(e,t){for(var n=0,r=0,o=0;o<4;o++){var i=e[t+o];if(n|=(127&i)<65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c)}r.length>1024&&(o.push(String.fromCharCode.apply(null,r)),r.length=0)}return o.push(String.fromCharCode.apply(null,r)),o.join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(19),o=function(){function e(){}return e.prototype.log=function(e,t){},e.instance=new e,e}();t.NullLogger=o;var i=function(){function e(e){this.minimumLogLevel=e}return e.prototype.log=function(e,t){if(e>=this.minimumLogLevel)switch(e){case r.LogLevel.Critical:case r.LogLevel.Error:console.error("["+(new Date).toISOString()+"] "+r.LogLevel[e]+": "+t);break;case r.LogLevel.Warning:console.warn("["+(new Date).toISOString()+"] "+r.LogLevel[e]+": "+t);break;case r.LogLevel.Information:console.info("["+(new Date).toISOString()+"] "+r.LogLevel[e]+": "+t);break;default:console.log("["+(new Date).toISOString()+"] "+r.LogLevel[e]+": "+t)}},e}();t.ConsoleLogger=i},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{u(r.next(e))}catch(e){i(e)}}function s(e){try{u(r.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}u((r=r.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}},a=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(t,"__esModule",{value:!0});var s=n(16),u=n(68),c=function(){function e(e,t){this.circuitId=e,this.components=t}return e.prototype.reconnect=function(e){return e.invoke("ConnectCircuit",this.circuitId)},e}();function l(e){if(e.nodeType===Node.COMMENT_NODE&&e.textContent){var t=/\W+M.A.C.Component:[^{]*(.*)$/.exec(e.textContent),n=t&&t[1];if(n)try{var r=JSON.parse(n),o=r.componentId,i=r.circuitId,a=r.rendererId;if(!!o&&!!i&&!!a)return{node:e,circuitId:i,rendererId:Number.parseInt(a),componentId:Number.parseInt(o)};throw new Error("Found malformed start component comment at "+e.textContent)}catch(t){throw new Error("Found malformed start component comment at "+e.textContent)}}}function f(e,t,n,r){for(var o=n;o>=7)>0&&(r|=128),n.push(r)}while(t>0);t=e.byteLength||e.length;var o=new Uint8Array(n.length+t);return o.set(n,0),o.set(e,n.length),o.buffer},e.parse=function(e){for(var t=[],n=new Uint8Array(e),r=[0,7,14,21,28],o=0;o7)throw new Error("Messages bigger than 2GB are not supported.");if(!(n.byteLength>=o+i+a))throw new Error("Incomplete message.");t.push(n.slice?n.slice(o+i,o+i+a):n.subarray(o+i,o+i+a)),o=o+i+a}return t},e}();var s=new Uint8Array([145,i.MessageType.Ping]),u=function(){function e(){this.name="messagepack",this.version=1,this.transferFormat=i.TransferFormat.Binary}return e.prototype.parseMessages=function(e,t){if(!(e instanceof r.Buffer||(n=e,n&&"undefined"!=typeof ArrayBuffer&&(n instanceof ArrayBuffer||n.constructor&&"ArrayBuffer"===n.constructor.name))))throw new Error("Invalid input for MessagePack hub protocol. Expected an ArrayBuffer or Buffer.");var n;null===t&&(t=i.NullLogger.instance);for(var o=[],s=0,u=a.parse(e);s0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return e[r]=[],e}function u(e,t,n){var a=e;if(e instanceof Comment&&(s(a)&&s(a).length>0))throw new Error("Not implemented: inserting non-empty logical container");if(l(a))throw new Error("Not implemented: moving existing logical children");var i=s(t);if(n0;)e(r,0);var a=r;a.parentNode.removeChild(a)},t.getLogicalParent=l,t.getLogicalSiblingEnd=function(e){return e[a]||null},t.getLogicalChild=function(e,t){return s(e)[t]},t.isSvgElement=function(e){return"http://www.w3.org/2000/svg"===c(e).namespaceURI},t.getLogicalChildrenArray=s,t.permuteLogicalChildren=function(e,t){var n=s(e);t.forEach(function(e){e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=function e(t){if(t instanceof Element)return t;var n=f(t);if(n)return n.previousSibling;var r=l(t);return r instanceof Element?r.lastChild:e(r)}(e.moveRangeStart)}),t.forEach(function(t){var r=t.moveToBeforeMarker=document.createComment("marker"),o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):d(r,e)}),t.forEach(function(e){for(var t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd,a=r;a;){var i=a.nextSibling;if(n.insertBefore(a,t),a===o)break;a=i}n.removeChild(t)}),t.forEach(function(e){n[e.toSiblingIndex]=e.moveRangeStart})},t.getClosestDomElement=c},,,function(e,t,n){"use strict";var r;!function(e){window.DotNet=e;var t=[],n={},r={},o=1,a=null;function i(e){t.push(e)}function u(e,t){for(var n=[],r=2;r0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]-1?a.substring(0,u):"",s=u>-1?a.substring(u+1):a,c=t.monoPlatform.findMethod(e,l,s,i);t.monoPlatform.callMethod(c,null,r)},callMethod:function(e,n,r){if(r.length>4)throw new Error("Currently, MonoPlatform supports passing a maximum of 4 arguments from JS to .NET. You tried to pass "+r.length+".");var o=Module.stackSave();try{for(var a=Module.stackAlloc(r.length),u=Module.stackAlloc(4),l=0;l0&&!t)throw new Error("New logical elements must start empty, or allowExistingContents must be true");return e[r]=[],e}function u(e,t,n){var a=e;if(e instanceof Comment&&(s(a)&&s(a).length>0))throw new Error("Not implemented: inserting non-empty logical container");if(l(a))throw new Error("Not implemented: moving existing logical children");var i=s(t);if(n0;)e(r,0);var a=r;a.parentNode.removeChild(a)},t.getLogicalParent=l,t.getLogicalSiblingEnd=function(e){return e[a]||null},t.getLogicalChild=function(e,t){return s(e)[t]},t.isSvgElement=function(e){return"http://www.w3.org/2000/svg"===c(e).namespaceURI},t.getLogicalChildrenArray=s,t.permuteLogicalChildren=function(e,t){var n=s(e);t.forEach(function(e){e.moveRangeStart=n[e.fromSiblingIndex],e.moveRangeEnd=function e(t){if(t instanceof Element)return t;var n=f(t);if(n)return n.previousSibling;var r=l(t);return r instanceof Element?r.lastChild:e(r)}(e.moveRangeStart)}),t.forEach(function(t){var r=t.moveToBeforeMarker=document.createComment("marker"),o=n[t.toSiblingIndex+1];o?o.parentNode.insertBefore(r,o):d(r,e)}),t.forEach(function(e){for(var t=e.moveToBeforeMarker,n=t.parentNode,r=e.moveRangeStart,o=e.moveRangeEnd,a=r;a;){var i=a.nextSibling;if(n.insertBefore(a,t),a===o)break;a=i}n.removeChild(t)}),t.forEach(function(e){n[e.toSiblingIndex]=e.moveRangeStart})},t.getClosestDomElement=c},,,function(e,t,n){"use strict";var r;!function(e){window.DotNet=e;var t=[],n={},r={},o=1,a=null;function i(e){t.push(e)}function u(e,t){for(var n=[],r=2;r0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]0&&o[o.length-1])&&(6===a[0]||2===a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]-1?a.substring(0,u):"",s=u>-1?a.substring(u+1):a,c=t.monoPlatform.findMethod(e,l,s,i);t.monoPlatform.callMethod(c,null,r)},callMethod:function(e,n,r){if(r.length>4)throw new Error("Currently, MonoPlatform supports passing a maximum of 4 arguments from JS to .NET. You tried to pass "+r.length+".");var o=Module.stackSave();try{for(var a=Module.stackAlloc(r.length),u=Module.stackAlloc(4),l=0;l