UNPKG

puppeteer-core

Version:

A high-level API to control headless Chrome over the DevTools Protocol

1,261 lines (1,205 loc) 379 kB
/** Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright (c) 2015-2018 Google, Inc., Netflix, Inc., Microsoft Corp. and contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ "use strict"; var __getOwnPropNames = Object.getOwnPropertyNames; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; // ../../node_modules/rxjs/dist/cjs/internal/util/isFunction.js var require_isFunction = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/util/isFunction.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.isFunction = void 0; function isFunction(value) { return typeof value === "function"; } exports2.isFunction = isFunction; } }); // ../../node_modules/rxjs/dist/cjs/internal/util/createErrorClass.js var require_createErrorClass = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/util/createErrorClass.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.createErrorClass = void 0; function createErrorClass(createImpl) { var _super = function(instance) { Error.call(instance); instance.stack = new Error().stack; }; var ctorFunc = createImpl(_super); ctorFunc.prototype = Object.create(Error.prototype); ctorFunc.prototype.constructor = ctorFunc; return ctorFunc; } exports2.createErrorClass = createErrorClass; } }); // ../../node_modules/rxjs/dist/cjs/internal/util/UnsubscriptionError.js var require_UnsubscriptionError = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/util/UnsubscriptionError.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.UnsubscriptionError = void 0; var createErrorClass_1 = require_createErrorClass(); exports2.UnsubscriptionError = createErrorClass_1.createErrorClass(function(_super) { return function UnsubscriptionErrorImpl(errors) { _super(this); this.message = errors ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function(err, i) { return i + 1 + ") " + err.toString(); }).join("\n ") : ""; this.name = "UnsubscriptionError"; this.errors = errors; }; }); } }); // ../../node_modules/rxjs/dist/cjs/internal/util/arrRemove.js var require_arrRemove = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/util/arrRemove.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.arrRemove = void 0; function arrRemove(arr, item) { if (arr) { var index = arr.indexOf(item); 0 <= index && arr.splice(index, 1); } } exports2.arrRemove = arrRemove; } }); // ../../node_modules/rxjs/dist/cjs/internal/Subscription.js var require_Subscription = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/Subscription.js"(exports2) { "use strict"; var __values = exports2 && exports2.__values || function(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function() { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; var __read = exports2 && exports2.__read || function(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; var __spreadArray = exports2 && exports2.__spreadArray || function(to, from) { for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) to[j] = from[i]; return to; }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.isSubscription = exports2.EMPTY_SUBSCRIPTION = exports2.Subscription = void 0; var isFunction_1 = require_isFunction(); var UnsubscriptionError_1 = require_UnsubscriptionError(); var arrRemove_1 = require_arrRemove(); var Subscription = function() { function Subscription2(initialTeardown) { this.initialTeardown = initialTeardown; this.closed = false; this._parentage = null; this._finalizers = null; } Subscription2.prototype.unsubscribe = function() { var e_1, _a, e_2, _b; var errors; if (!this.closed) { this.closed = true; var _parentage = this._parentage; if (_parentage) { this._parentage = null; if (Array.isArray(_parentage)) { try { for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) { var parent_1 = _parentage_1_1.value; parent_1.remove(this); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1); } finally { if (e_1) throw e_1.error; } } } else { _parentage.remove(this); } } var initialFinalizer = this.initialTeardown; if (isFunction_1.isFunction(initialFinalizer)) { try { initialFinalizer(); } catch (e) { errors = e instanceof UnsubscriptionError_1.UnsubscriptionError ? e.errors : [e]; } } var _finalizers = this._finalizers; if (_finalizers) { this._finalizers = null; try { for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) { var finalizer = _finalizers_1_1.value; try { execFinalizer(finalizer); } catch (err) { errors = errors !== null && errors !== void 0 ? errors : []; if (err instanceof UnsubscriptionError_1.UnsubscriptionError) { errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors)); } else { errors.push(err); } } } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1); } finally { if (e_2) throw e_2.error; } } } if (errors) { throw new UnsubscriptionError_1.UnsubscriptionError(errors); } } }; Subscription2.prototype.add = function(teardown) { var _a; if (teardown && teardown !== this) { if (this.closed) { execFinalizer(teardown); } else { if (teardown instanceof Subscription2) { if (teardown.closed || teardown._hasParent(this)) { return; } teardown._addParent(this); } (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown); } } }; Subscription2.prototype._hasParent = function(parent) { var _parentage = this._parentage; return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent); }; Subscription2.prototype._addParent = function(parent) { var _parentage = this._parentage; this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent; }; Subscription2.prototype._removeParent = function(parent) { var _parentage = this._parentage; if (_parentage === parent) { this._parentage = null; } else if (Array.isArray(_parentage)) { arrRemove_1.arrRemove(_parentage, parent); } }; Subscription2.prototype.remove = function(teardown) { var _finalizers = this._finalizers; _finalizers && arrRemove_1.arrRemove(_finalizers, teardown); if (teardown instanceof Subscription2) { teardown._removeParent(this); } }; Subscription2.EMPTY = function() { var empty = new Subscription2(); empty.closed = true; return empty; }(); return Subscription2; }(); exports2.Subscription = Subscription; exports2.EMPTY_SUBSCRIPTION = Subscription.EMPTY; function isSubscription(value) { return value instanceof Subscription || value && "closed" in value && isFunction_1.isFunction(value.remove) && isFunction_1.isFunction(value.add) && isFunction_1.isFunction(value.unsubscribe); } exports2.isSubscription = isSubscription; function execFinalizer(finalizer) { if (isFunction_1.isFunction(finalizer)) { finalizer(); } else { finalizer.unsubscribe(); } } } }); // ../../node_modules/rxjs/dist/cjs/internal/config.js var require_config = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/config.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.config = void 0; exports2.config = { onUnhandledError: null, onStoppedNotification: null, Promise: void 0, useDeprecatedSynchronousErrorHandling: false, useDeprecatedNextContext: false }; } }); // ../../node_modules/rxjs/dist/cjs/internal/scheduler/timeoutProvider.js var require_timeoutProvider = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/scheduler/timeoutProvider.js"(exports2) { "use strict"; var __read = exports2 && exports2.__read || function(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; var __spreadArray = exports2 && exports2.__spreadArray || function(to, from) { for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) to[j] = from[i]; return to; }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.timeoutProvider = void 0; exports2.timeoutProvider = { setTimeout: function(handler, timeout) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } var delegate = exports2.timeoutProvider.delegate; if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) { return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args))); } return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args))); }, clearTimeout: function(handle) { var delegate = exports2.timeoutProvider.delegate; return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle); }, delegate: void 0 }; } }); // ../../node_modules/rxjs/dist/cjs/internal/util/reportUnhandledError.js var require_reportUnhandledError = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/util/reportUnhandledError.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.reportUnhandledError = void 0; var config_1 = require_config(); var timeoutProvider_1 = require_timeoutProvider(); function reportUnhandledError(err) { timeoutProvider_1.timeoutProvider.setTimeout(function() { var onUnhandledError = config_1.config.onUnhandledError; if (onUnhandledError) { onUnhandledError(err); } else { throw err; } }); } exports2.reportUnhandledError = reportUnhandledError; } }); // ../../node_modules/rxjs/dist/cjs/internal/util/noop.js var require_noop = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/util/noop.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.noop = void 0; function noop() { } exports2.noop = noop; } }); // ../../node_modules/rxjs/dist/cjs/internal/NotificationFactories.js var require_NotificationFactories = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/NotificationFactories.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.createNotification = exports2.nextNotification = exports2.errorNotification = exports2.COMPLETE_NOTIFICATION = void 0; exports2.COMPLETE_NOTIFICATION = function() { return createNotification("C", void 0, void 0); }(); function errorNotification(error) { return createNotification("E", void 0, error); } exports2.errorNotification = errorNotification; function nextNotification(value) { return createNotification("N", value, void 0); } exports2.nextNotification = nextNotification; function createNotification(kind, value, error) { return { kind, value, error }; } exports2.createNotification = createNotification; } }); // ../../node_modules/rxjs/dist/cjs/internal/util/errorContext.js var require_errorContext = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/util/errorContext.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.captureError = exports2.errorContext = void 0; var config_1 = require_config(); var context = null; function errorContext(cb) { if (config_1.config.useDeprecatedSynchronousErrorHandling) { var isRoot = !context; if (isRoot) { context = { errorThrown: false, error: null }; } cb(); if (isRoot) { var _a = context, errorThrown = _a.errorThrown, error = _a.error; context = null; if (errorThrown) { throw error; } } } else { cb(); } } exports2.errorContext = errorContext; function captureError(err) { if (config_1.config.useDeprecatedSynchronousErrorHandling && context) { context.errorThrown = true; context.error = err; } } exports2.captureError = captureError; } }); // ../../node_modules/rxjs/dist/cjs/internal/Subscriber.js var require_Subscriber = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/Subscriber.js"(exports2) { "use strict"; var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { d2.__proto__ = b2; } || function(d2, b2) { for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; }; return extendStatics(d, b); }; return function(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); Object.defineProperty(exports2, "__esModule", { value: true }); exports2.EMPTY_OBSERVER = exports2.SafeSubscriber = exports2.Subscriber = void 0; var isFunction_1 = require_isFunction(); var Subscription_1 = require_Subscription(); var config_1 = require_config(); var reportUnhandledError_1 = require_reportUnhandledError(); var noop_1 = require_noop(); var NotificationFactories_1 = require_NotificationFactories(); var timeoutProvider_1 = require_timeoutProvider(); var errorContext_1 = require_errorContext(); var Subscriber = function(_super) { __extends(Subscriber2, _super); function Subscriber2(destination) { var _this = _super.call(this) || this; _this.isStopped = false; if (destination) { _this.destination = destination; if (Subscription_1.isSubscription(destination)) { destination.add(_this); } } else { _this.destination = exports2.EMPTY_OBSERVER; } return _this; } Subscriber2.create = function(next, error, complete) { return new SafeSubscriber(next, error, complete); }; Subscriber2.prototype.next = function(value) { if (this.isStopped) { handleStoppedNotification(NotificationFactories_1.nextNotification(value), this); } else { this._next(value); } }; Subscriber2.prototype.error = function(err) { if (this.isStopped) { handleStoppedNotification(NotificationFactories_1.errorNotification(err), this); } else { this.isStopped = true; this._error(err); } }; Subscriber2.prototype.complete = function() { if (this.isStopped) { handleStoppedNotification(NotificationFactories_1.COMPLETE_NOTIFICATION, this); } else { this.isStopped = true; this._complete(); } }; Subscriber2.prototype.unsubscribe = function() { if (!this.closed) { this.isStopped = true; _super.prototype.unsubscribe.call(this); this.destination = null; } }; Subscriber2.prototype._next = function(value) { this.destination.next(value); }; Subscriber2.prototype._error = function(err) { try { this.destination.error(err); } finally { this.unsubscribe(); } }; Subscriber2.prototype._complete = function() { try { this.destination.complete(); } finally { this.unsubscribe(); } }; return Subscriber2; }(Subscription_1.Subscription); exports2.Subscriber = Subscriber; var _bind = Function.prototype.bind; function bind(fn, thisArg) { return _bind.call(fn, thisArg); } var ConsumerObserver = function() { function ConsumerObserver2(partialObserver) { this.partialObserver = partialObserver; } ConsumerObserver2.prototype.next = function(value) { var partialObserver = this.partialObserver; if (partialObserver.next) { try { partialObserver.next(value); } catch (error) { handleUnhandledError(error); } } }; ConsumerObserver2.prototype.error = function(err) { var partialObserver = this.partialObserver; if (partialObserver.error) { try { partialObserver.error(err); } catch (error) { handleUnhandledError(error); } } else { handleUnhandledError(err); } }; ConsumerObserver2.prototype.complete = function() { var partialObserver = this.partialObserver; if (partialObserver.complete) { try { partialObserver.complete(); } catch (error) { handleUnhandledError(error); } } }; return ConsumerObserver2; }(); var SafeSubscriber = function(_super) { __extends(SafeSubscriber2, _super); function SafeSubscriber2(observerOrNext, error, complete) { var _this = _super.call(this) || this; var partialObserver; if (isFunction_1.isFunction(observerOrNext) || !observerOrNext) { partialObserver = { next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : void 0, error: error !== null && error !== void 0 ? error : void 0, complete: complete !== null && complete !== void 0 ? complete : void 0 }; } else { var context_1; if (_this && config_1.config.useDeprecatedNextContext) { context_1 = Object.create(observerOrNext); context_1.unsubscribe = function() { return _this.unsubscribe(); }; partialObserver = { next: observerOrNext.next && bind(observerOrNext.next, context_1), error: observerOrNext.error && bind(observerOrNext.error, context_1), complete: observerOrNext.complete && bind(observerOrNext.complete, context_1) }; } else { partialObserver = observerOrNext; } } _this.destination = new ConsumerObserver(partialObserver); return _this; } return SafeSubscriber2; }(Subscriber); exports2.SafeSubscriber = SafeSubscriber; function handleUnhandledError(error) { if (config_1.config.useDeprecatedSynchronousErrorHandling) { errorContext_1.captureError(error); } else { reportUnhandledError_1.reportUnhandledError(error); } } function defaultErrorHandler(err) { throw err; } function handleStoppedNotification(notification, subscriber) { var onStoppedNotification = config_1.config.onStoppedNotification; onStoppedNotification && timeoutProvider_1.timeoutProvider.setTimeout(function() { return onStoppedNotification(notification, subscriber); }); } exports2.EMPTY_OBSERVER = { closed: true, next: noop_1.noop, error: defaultErrorHandler, complete: noop_1.noop }; } }); // ../../node_modules/rxjs/dist/cjs/internal/symbol/observable.js var require_observable = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/symbol/observable.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.observable = void 0; exports2.observable = function() { return typeof Symbol === "function" && Symbol.observable || "@@observable"; }(); } }); // ../../node_modules/rxjs/dist/cjs/internal/util/identity.js var require_identity = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/util/identity.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.identity = void 0; function identity(x) { return x; } exports2.identity = identity; } }); // ../../node_modules/rxjs/dist/cjs/internal/util/pipe.js var require_pipe = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/util/pipe.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.pipeFromArray = exports2.pipe = void 0; var identity_1 = require_identity(); function pipe() { var fns = []; for (var _i = 0; _i < arguments.length; _i++) { fns[_i] = arguments[_i]; } return pipeFromArray(fns); } exports2.pipe = pipe; function pipeFromArray(fns) { if (fns.length === 0) { return identity_1.identity; } if (fns.length === 1) { return fns[0]; } return function piped(input) { return fns.reduce(function(prev, fn) { return fn(prev); }, input); }; } exports2.pipeFromArray = pipeFromArray; } }); // ../../node_modules/rxjs/dist/cjs/internal/Observable.js var require_Observable = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/Observable.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.Observable = void 0; var Subscriber_1 = require_Subscriber(); var Subscription_1 = require_Subscription(); var observable_1 = require_observable(); var pipe_1 = require_pipe(); var config_1 = require_config(); var isFunction_1 = require_isFunction(); var errorContext_1 = require_errorContext(); var Observable = function() { function Observable2(subscribe) { if (subscribe) { this._subscribe = subscribe; } } Observable2.prototype.lift = function(operator) { var observable = new Observable2(); observable.source = this; observable.operator = operator; return observable; }; Observable2.prototype.subscribe = function(observerOrNext, error, complete) { var _this = this; var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new Subscriber_1.SafeSubscriber(observerOrNext, error, complete); errorContext_1.errorContext(function() { var _a = _this, operator = _a.operator, source = _a.source; subscriber.add(operator ? operator.call(subscriber, source) : source ? _this._subscribe(subscriber) : _this._trySubscribe(subscriber)); }); return subscriber; }; Observable2.prototype._trySubscribe = function(sink) { try { return this._subscribe(sink); } catch (err) { sink.error(err); } }; Observable2.prototype.forEach = function(next, promiseCtor) { var _this = this; promiseCtor = getPromiseCtor(promiseCtor); return new promiseCtor(function(resolve, reject) { var subscriber = new Subscriber_1.SafeSubscriber({ next: function(value) { try { next(value); } catch (err) { reject(err); subscriber.unsubscribe(); } }, error: reject, complete: resolve }); _this.subscribe(subscriber); }); }; Observable2.prototype._subscribe = function(subscriber) { var _a; return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber); }; Observable2.prototype[observable_1.observable] = function() { return this; }; Observable2.prototype.pipe = function() { var operations = []; for (var _i = 0; _i < arguments.length; _i++) { operations[_i] = arguments[_i]; } return pipe_1.pipeFromArray(operations)(this); }; Observable2.prototype.toPromise = function(promiseCtor) { var _this = this; promiseCtor = getPromiseCtor(promiseCtor); return new promiseCtor(function(resolve, reject) { var value; _this.subscribe(function(x) { return value = x; }, function(err) { return reject(err); }, function() { return resolve(value); }); }); }; Observable2.create = function(subscribe) { return new Observable2(subscribe); }; return Observable2; }(); exports2.Observable = Observable; function getPromiseCtor(promiseCtor) { var _a; return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config_1.config.Promise) !== null && _a !== void 0 ? _a : Promise; } function isObserver(value) { return value && isFunction_1.isFunction(value.next) && isFunction_1.isFunction(value.error) && isFunction_1.isFunction(value.complete); } function isSubscriber(value) { return value && value instanceof Subscriber_1.Subscriber || isObserver(value) && Subscription_1.isSubscription(value); } } }); // ../../node_modules/rxjs/dist/cjs/internal/util/lift.js var require_lift = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/util/lift.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.operate = exports2.hasLift = void 0; var isFunction_1 = require_isFunction(); function hasLift(source) { return isFunction_1.isFunction(source === null || source === void 0 ? void 0 : source.lift); } exports2.hasLift = hasLift; function operate(init) { return function(source) { if (hasLift(source)) { return source.lift(function(liftedSource) { try { return init(liftedSource, this); } catch (err) { this.error(err); } }); } throw new TypeError("Unable to lift unknown Observable type"); }; } exports2.operate = operate; } }); // ../../node_modules/rxjs/dist/cjs/internal/operators/OperatorSubscriber.js var require_OperatorSubscriber = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/operators/OperatorSubscriber.js"(exports2) { "use strict"; var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { d2.__proto__ = b2; } || function(d2, b2) { for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; }; return extendStatics(d, b); }; return function(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); Object.defineProperty(exports2, "__esModule", { value: true }); exports2.OperatorSubscriber = exports2.createOperatorSubscriber = void 0; var Subscriber_1 = require_Subscriber(); function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) { return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize); } exports2.createOperatorSubscriber = createOperatorSubscriber; var OperatorSubscriber = function(_super) { __extends(OperatorSubscriber2, _super); function OperatorSubscriber2(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) { var _this = _super.call(this, destination) || this; _this.onFinalize = onFinalize; _this.shouldUnsubscribe = shouldUnsubscribe; _this._next = onNext ? function(value) { try { onNext(value); } catch (err) { destination.error(err); } } : _super.prototype._next; _this._error = onError ? function(err) { try { onError(err); } catch (err2) { destination.error(err2); } finally { this.unsubscribe(); } } : _super.prototype._error; _this._complete = onComplete ? function() { try { onComplete(); } catch (err) { destination.error(err); } finally { this.unsubscribe(); } } : _super.prototype._complete; return _this; } OperatorSubscriber2.prototype.unsubscribe = function() { var _a; if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) { var closed_1 = this.closed; _super.prototype.unsubscribe.call(this); !closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this)); } }; return OperatorSubscriber2; }(Subscriber_1.Subscriber); exports2.OperatorSubscriber = OperatorSubscriber; } }); // ../../node_modules/rxjs/dist/cjs/internal/operators/refCount.js var require_refCount = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/operators/refCount.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.refCount = void 0; var lift_1 = require_lift(); var OperatorSubscriber_1 = require_OperatorSubscriber(); function refCount() { return lift_1.operate(function(source, subscriber) { var connection = null; source._refCount++; var refCounter = OperatorSubscriber_1.createOperatorSubscriber(subscriber, void 0, void 0, void 0, function() { if (!source || source._refCount <= 0 || 0 < --source._refCount) { connection = null; return; } var sharedConnection = source._connection; var conn = connection; connection = null; if (sharedConnection && (!conn || sharedConnection === conn)) { sharedConnection.unsubscribe(); } subscriber.unsubscribe(); }); source.subscribe(refCounter); if (!refCounter.closed) { connection = source.connect(); } }); } exports2.refCount = refCount; } }); // ../../node_modules/rxjs/dist/cjs/internal/observable/ConnectableObservable.js var require_ConnectableObservable = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/observable/ConnectableObservable.js"(exports2) { "use strict"; var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { d2.__proto__ = b2; } || function(d2, b2) { for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; }; return extendStatics(d, b); }; return function(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); Object.defineProperty(exports2, "__esModule", { value: true }); exports2.ConnectableObservable = void 0; var Observable_1 = require_Observable(); var Subscription_1 = require_Subscription(); var refCount_1 = require_refCount(); var OperatorSubscriber_1 = require_OperatorSubscriber(); var lift_1 = require_lift(); var ConnectableObservable = function(_super) { __extends(ConnectableObservable2, _super); function ConnectableObservable2(source, subjectFactory) { var _this = _super.call(this) || this; _this.source = source; _this.subjectFactory = subjectFactory; _this._subject = null; _this._refCount = 0; _this._connection = null; if (lift_1.hasLift(source)) { _this.lift = source.lift; } return _this; } ConnectableObservable2.prototype._subscribe = function(subscriber) { return this.getSubject().subscribe(subscriber); }; ConnectableObservable2.prototype.getSubject = function() { var subject = this._subject; if (!subject || subject.isStopped) { this._subject = this.subjectFactory(); } return this._subject; }; ConnectableObservable2.prototype._teardown = function() { this._refCount = 0; var _connection = this._connection; this._subject = this._connection = null; _connection === null || _connection === void 0 ? void 0 : _connection.unsubscribe(); }; ConnectableObservable2.prototype.connect = function() { var _this = this; var connection = this._connection; if (!connection) { connection = this._connection = new Subscription_1.Subscription(); var subject_1 = this.getSubject(); connection.add(this.source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subject_1, void 0, function() { _this._teardown(); subject_1.complete(); }, function(err) { _this._teardown(); subject_1.error(err); }, function() { return _this._teardown(); }))); if (connection.closed) { this._connection = null; connection = Subscription_1.Subscription.EMPTY; } } return connection; }; ConnectableObservable2.prototype.refCount = function() { return refCount_1.refCount()(this); }; return ConnectableObservable2; }(Observable_1.Observable); exports2.ConnectableObservable = ConnectableObservable; } }); // ../../node_modules/rxjs/dist/cjs/internal/scheduler/performanceTimestampProvider.js var require_performanceTimestampProvider = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/scheduler/performanceTimestampProvider.js"(exports2) { "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.performanceTimestampProvider = void 0; exports2.performanceTimestampProvider = { now: function() { return (exports2.performanceTimestampProvider.delegate || performance).now(); }, delegate: void 0 }; } }); // ../../node_modules/rxjs/dist/cjs/internal/scheduler/animationFrameProvider.js var require_animationFrameProvider = __commonJS({ "../../node_modules/rxjs/dist/cjs/internal/scheduler/animationFrameProvider.js"(exports2) { "use strict"; var __read = exports2 && exports2.__read || function(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; var __spreadArray = exports2 && exports2.__spreadArray || function(to, from) { for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) to[j] = from[i]; return to; }; Object.def