UNPKG

rx-postmessenger

Version:

Minimal RxJS adapter for the window.postMessage API for request-response streams and notification streams across frame windows.

1,329 lines (1,220 loc) 77.4 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["RxPostmessenger"] = factory(); else root["RxPostmessenger"] = factory(); })(self, function() { return /******/ (function() { // webpackBootstrap /******/ "use strict"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ !function() { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = function(exports, definition) { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ }(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ !function() { /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } /******/ }(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // EXPORTS __webpack_require__.d(__webpack_exports__, { "default": function() { return /* binding */ src; } }); ;// CONCATENATED MODULE: ./src/MessageFactory.ts var MessageFactory = /** @class */ (function () { function MessageFactory(IDGenerator) { this.IDGenerator = IDGenerator; } MessageFactory.prototype.makeNotification = function (channel, payload) { return { channel: channel, id: this.IDGenerator.generateID(), payload: payload, type: 'notification', }; }; MessageFactory.prototype.makeRequest = function (channel, payload) { return { channel: channel, id: this.IDGenerator.generateID(), payload: payload, type: 'request', }; }; MessageFactory.prototype.makeResponse = function (requestId, channel, payload) { return { channel: channel, id: this.IDGenerator.generateID(), payload: payload, requestId: requestId, type: 'response', }; }; MessageFactory.prototype.invalidateID = function (id) { this.IDGenerator.invalidateID(id); }; return MessageFactory; }()); ;// CONCATENATED MODULE: ./src/functions/GUIDGenerator.ts 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 }; } }; function GUIDGenerator() { var s4, IDSegment, guid; return __generator(this, function (_a) { switch (_a.label) { case 0: s4 = function () { return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); }; IDSegment = function (size) { if (size === void 0) { size = 1; } return Array(size).fill(null).map(s4).join(''); }; guid = function () { return [ IDSegment(2), IDSegment(), IDSegment(), IDSegment(), IDSegment(3), ].join('-'); }; _a.label = 1; case 1: if (false) {} return [4 /*yield*/, guid()]; case 2: _a.sent(); return [3 /*break*/, 1]; case 3: return [2 /*return*/]; } }); } ;// CONCATENATED MODULE: ./src/MessageIDGenerator.ts var MessageIDGenerator = /** @class */ (function () { function MessageIDGenerator(gen) { if (gen === void 0) { gen = GUIDGenerator(); } this.gen = gen; this.usedIDValues = []; } MessageIDGenerator.prototype.generateID = function () { var newID; do { newID = this.gen.next().value; } while (this.usedIDValues.indexOf(newID) >= 0); this.invalidateID(newID); return newID; }; MessageIDGenerator.prototype.invalidateID = function (id) { this.usedIDValues.push(id); }; return MessageIDGenerator; }()); ;// CONCATENATED MODULE: ./src/MessageValidator.ts var MessageValidator = /** @class */ (function () { function MessageValidator(acceptedSource, acceptedOrigin) { this.acceptedSource = acceptedSource; this.acceptedOrigin = acceptedOrigin; } /** * Validates the identity of the message's sender and the format of the message's data. * * Checks whether the remoteOrigin location matches any allowed origins. * Separate assertion of the remoteOrigin allows for cross-domain navigation * within this.frame, and still treating inbound messages from the * frame as being equal. * * Checks whether the source Window object equals the remoteWindow object. * This check allows for implementation of multiple i-frames that share the * same remoteOrigin, and still being able to distinguish between messages from * such frames. */ MessageValidator.prototype.validate = function (message) { return message instanceof MessageEvent && message.origin === this.acceptedOrigin && message.source === this.acceptedSource && this.isWellFormedMessage(message.data); }; /** * Tests whether the data sent through postMessage is a well-formed message * object. This serves as runtime data format validation. If messages do not * comply to the AnyMessage compound interface, the entire event is ignored. * * @param {*} message * @return {boolean} */ MessageValidator.prototype.isWellFormedMessage = function (message) { return (typeof message.id === 'string') && (['request', 'response', 'notification'].indexOf(message.type) >= 0) && (typeof message.channel === 'string') && (message.type !== 'response' || (typeof message.requestId === 'string')); }; return MessageValidator; }()); ;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.js /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(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 __()); } var __assign = function() { __assign = Object.assign || function __assign(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; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 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) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function tslib_es6_generator(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 __createBinding = Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(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."); } function __read(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: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from) { for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) to[j] = from[i]; return to; } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __setModuleDefault = Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; } function __importDefault(mod) { return (mod && mod.__esModule) ? mod : { default: mod }; } function __classPrivateFieldGet(receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); } function __classPrivateFieldSet(receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; } ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/util/isFunction.js function isFunction(value) { return typeof value === 'function'; } //# sourceMappingURL=isFunction.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/util/createErrorClass.js 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; } //# sourceMappingURL=createErrorClass.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/util/UnsubscriptionError.js var UnsubscriptionError = 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; }; }); //# sourceMappingURL=UnsubscriptionError.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/util/arrRemove.js function arrRemove(arr, item) { if (arr) { var index = arr.indexOf(item); 0 <= index && arr.splice(index, 1); } } //# sourceMappingURL=arrRemove.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/Subscription.js var Subscription = (function () { function Subscription(initialTeardown) { this.initialTeardown = initialTeardown; this.closed = false; this._parentage = null; this._teardowns = null; } Subscription.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 initialTeardown = this.initialTeardown; if (isFunction(initialTeardown)) { try { initialTeardown(); } catch (e) { errors = e instanceof UnsubscriptionError ? e.errors : [e]; } } var _teardowns = this._teardowns; if (_teardowns) { this._teardowns = null; try { for (var _teardowns_1 = __values(_teardowns), _teardowns_1_1 = _teardowns_1.next(); !_teardowns_1_1.done; _teardowns_1_1 = _teardowns_1.next()) { var teardown_1 = _teardowns_1_1.value; try { execTeardown(teardown_1); } catch (err) { errors = errors !== null && errors !== void 0 ? errors : []; if (err instanceof 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 (_teardowns_1_1 && !_teardowns_1_1.done && (_b = _teardowns_1.return)) _b.call(_teardowns_1); } finally { if (e_2) throw e_2.error; } } } if (errors) { throw new UnsubscriptionError(errors); } } }; Subscription.prototype.add = function (teardown) { var _a; if (teardown && teardown !== this) { if (this.closed) { execTeardown(teardown); } else { if (teardown instanceof Subscription) { if (teardown.closed || teardown._hasParent(this)) { return; } teardown._addParent(this); } (this._teardowns = (_a = this._teardowns) !== null && _a !== void 0 ? _a : []).push(teardown); } } }; Subscription.prototype._hasParent = function (parent) { var _parentage = this._parentage; return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent)); }; Subscription.prototype._addParent = function (parent) { var _parentage = this._parentage; this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent; }; Subscription.prototype._removeParent = function (parent) { var _parentage = this._parentage; if (_parentage === parent) { this._parentage = null; } else if (Array.isArray(_parentage)) { arrRemove(_parentage, parent); } }; Subscription.prototype.remove = function (teardown) { var _teardowns = this._teardowns; _teardowns && arrRemove(_teardowns, teardown); if (teardown instanceof Subscription) { teardown._removeParent(this); } }; Subscription.EMPTY = (function () { var empty = new Subscription(); empty.closed = true; return empty; })(); return Subscription; }()); var EMPTY_SUBSCRIPTION = Subscription.EMPTY; function isSubscription(value) { return (value instanceof Subscription || (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe))); } function execTeardown(teardown) { if (isFunction(teardown)) { teardown(); } else { teardown.unsubscribe(); } } //# sourceMappingURL=Subscription.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/config.js var config = { onUnhandledError: null, onStoppedNotification: null, Promise: undefined, useDeprecatedSynchronousErrorHandling: false, useDeprecatedNextContext: false, }; //# sourceMappingURL=config.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/scheduler/timeoutProvider.js var timeoutProvider = { setTimeout: function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var delegate = timeoutProvider.delegate; return ((delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) || setTimeout).apply(void 0, __spreadArray([], __read(args))); }, clearTimeout: function (handle) { var delegate = timeoutProvider.delegate; return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle); }, delegate: undefined, }; //# sourceMappingURL=timeoutProvider.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/util/reportUnhandledError.js function reportUnhandledError(err) { timeoutProvider.setTimeout(function () { var onUnhandledError = config.onUnhandledError; if (onUnhandledError) { onUnhandledError(err); } else { throw err; } }); } //# sourceMappingURL=reportUnhandledError.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/util/noop.js function noop() { } //# sourceMappingURL=noop.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/NotificationFactories.js var COMPLETE_NOTIFICATION = (function () { return createNotification('C', undefined, undefined); })(); function errorNotification(error) { return createNotification('E', undefined, error); } function nextNotification(value) { return createNotification('N', value, undefined); } function createNotification(kind, value, error) { return { kind: kind, value: value, error: error, }; } //# sourceMappingURL=NotificationFactories.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/util/errorContext.js var context = null; function errorContext(cb) { if (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(); } } function captureError(err) { if (config.useDeprecatedSynchronousErrorHandling && context) { context.errorThrown = true; context.error = err; } } //# sourceMappingURL=errorContext.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/Subscriber.js var Subscriber = (function (_super) { __extends(Subscriber, _super); function Subscriber(destination) { var _this = _super.call(this) || this; _this.isStopped = false; if (destination) { _this.destination = destination; if (isSubscription(destination)) { destination.add(_this); } } else { _this.destination = EMPTY_OBSERVER; } return _this; } Subscriber.create = function (next, error, complete) { return new SafeSubscriber(next, error, complete); }; Subscriber.prototype.next = function (value) { if (this.isStopped) { handleStoppedNotification(nextNotification(value), this); } else { this._next(value); } }; Subscriber.prototype.error = function (err) { if (this.isStopped) { handleStoppedNotification(errorNotification(err), this); } else { this.isStopped = true; this._error(err); } }; Subscriber.prototype.complete = function () { if (this.isStopped) { handleStoppedNotification(COMPLETE_NOTIFICATION, this); } else { this.isStopped = true; this._complete(); } }; Subscriber.prototype.unsubscribe = function () { if (!this.closed) { this.isStopped = true; _super.prototype.unsubscribe.call(this); this.destination = null; } }; Subscriber.prototype._next = function (value) { this.destination.next(value); }; Subscriber.prototype._error = function (err) { try { this.destination.error(err); } finally { this.unsubscribe(); } }; Subscriber.prototype._complete = function () { try { this.destination.complete(); } finally { this.unsubscribe(); } }; return Subscriber; }(Subscription)); var SafeSubscriber = (function (_super) { __extends(SafeSubscriber, _super); function SafeSubscriber(observerOrNext, error, complete) { var _this = _super.call(this) || this; var next; if (isFunction(observerOrNext)) { next = observerOrNext; } else if (observerOrNext) { (next = observerOrNext.next, error = observerOrNext.error, complete = observerOrNext.complete); var context_1; if (_this && config.useDeprecatedNextContext) { context_1 = Object.create(observerOrNext); context_1.unsubscribe = function () { return _this.unsubscribe(); }; } else { context_1 = observerOrNext; } next = next === null || next === void 0 ? void 0 : next.bind(context_1); error = error === null || error === void 0 ? void 0 : error.bind(context_1); complete = complete === null || complete === void 0 ? void 0 : complete.bind(context_1); } _this.destination = { next: next ? wrapForErrorHandling(next, _this) : noop, error: wrapForErrorHandling(error !== null && error !== void 0 ? error : defaultErrorHandler, _this), complete: complete ? wrapForErrorHandling(complete, _this) : noop, }; return _this; } return SafeSubscriber; }(Subscriber)); function wrapForErrorHandling(handler, instance) { return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } try { handler.apply(void 0, __spreadArray([], __read(args))); } catch (err) { if (config.useDeprecatedSynchronousErrorHandling) { captureError(err); } else { reportUnhandledError(err); } } }; } function defaultErrorHandler(err) { throw err; } function handleStoppedNotification(notification, subscriber) { var onStoppedNotification = config.onStoppedNotification; onStoppedNotification && timeoutProvider.setTimeout(function () { return onStoppedNotification(notification, subscriber); }); } var EMPTY_OBSERVER = { closed: true, next: noop, error: defaultErrorHandler, complete: noop, }; //# sourceMappingURL=Subscriber.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/symbol/observable.js var observable_observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })(); //# sourceMappingURL=observable.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/util/identity.js function identity(x) { return x; } //# sourceMappingURL=identity.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/util/pipe.js function pipe() { var fns = []; for (var _i = 0; _i < arguments.length; _i++) { fns[_i] = arguments[_i]; } return pipeFromArray(fns); } function pipeFromArray(fns) { if (fns.length === 0) { return identity; } if (fns.length === 1) { return fns[0]; } return function piped(input) { return fns.reduce(function (prev, fn) { return fn(prev); }, input); }; } //# sourceMappingURL=pipe.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/Observable.js var Observable_Observable = (function () { function Observable(subscribe) { if (subscribe) { this._subscribe = subscribe; } } Observable.prototype.lift = function (operator) { var observable = new Observable(); observable.source = this; observable.operator = operator; return observable; }; Observable.prototype.subscribe = function (observerOrNext, error, complete) { var _this = this; var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete); 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; }; Observable.prototype._trySubscribe = function (sink) { try { return this._subscribe(sink); } catch (err) { sink.error(err); } }; Observable.prototype.forEach = function (next, promiseCtor) { var _this = this; promiseCtor = getPromiseCtor(promiseCtor); return new promiseCtor(function (resolve, reject) { var subscription; subscription = _this.subscribe(function (value) { try { next(value); } catch (err) { reject(err); subscription === null || subscription === void 0 ? void 0 : subscription.unsubscribe(); } }, reject, resolve); }); }; Observable.prototype._subscribe = function (subscriber) { var _a; return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber); }; Observable.prototype[observable_observable] = function () { return this; }; Observable.prototype.pipe = function () { var operations = []; for (var _i = 0; _i < arguments.length; _i++) { operations[_i] = arguments[_i]; } return pipeFromArray(operations)(this); }; Observable.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); }); }); }; Observable.create = function (subscribe) { return new Observable(subscribe); }; return Observable; }()); function getPromiseCtor(promiseCtor) { var _a; return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise; } function isObserver(value) { return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete); } function isSubscriber(value) { return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value)); } //# sourceMappingURL=Observable.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/util/lift.js function hasLift(source) { return isFunction(source === null || source === void 0 ? void 0 : source.lift); } 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'); }; } //# sourceMappingURL=lift.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/operators/OperatorSubscriber.js var OperatorSubscriber = (function (_super) { __extends(OperatorSubscriber, _super); function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) { var _this = _super.call(this, destination) || this; _this.onFinalize = onFinalize; _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 (err) { destination.error(err); } 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; } OperatorSubscriber.prototype.unsubscribe = function () { var _a; var closed = this.closed; _super.prototype.unsubscribe.call(this); !closed && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this)); }; return OperatorSubscriber; }(Subscriber)); //# sourceMappingURL=OperatorSubscriber.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/operators/map.js function map(project, thisArg) { return operate(function (source, subscriber) { var index = 0; source.subscribe(new OperatorSubscriber(subscriber, function (value) { subscriber.next(project.call(thisArg, value, index++)); })); }); } //# sourceMappingURL=map.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/util/isArrayLike.js var isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; }); //# sourceMappingURL=isArrayLike.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/util/isPromise.js function isPromise(value) { return isFunction(value === null || value === void 0 ? void 0 : value.then); } //# sourceMappingURL=isPromise.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/scheduled/scheduleObservable.js function scheduleObservable(input, scheduler) { return new Observable_Observable(function (subscriber) { var sub = new Subscription(); sub.add(scheduler.schedule(function () { var observable = input[observable_observable](); sub.add(observable.subscribe({ next: function (value) { sub.add(scheduler.schedule(function () { return subscriber.next(value); })); }, error: function (err) { sub.add(scheduler.schedule(function () { return subscriber.error(err); })); }, complete: function () { sub.add(scheduler.schedule(function () { return subscriber.complete(); })); }, })); })); return sub; }); } //# sourceMappingURL=scheduleObservable.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/scheduled/schedulePromise.js function schedulePromise(input, scheduler) { return new Observable_Observable(function (subscriber) { return scheduler.schedule(function () { return input.then(function (value) { subscriber.add(scheduler.schedule(function () { subscriber.next(value); subscriber.add(scheduler.schedule(function () { return subscriber.complete(); })); })); }, function (err) { subscriber.add(scheduler.schedule(function () { return subscriber.error(err); })); }); }); }); } //# sourceMappingURL=schedulePromise.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/scheduled/scheduleArray.js function scheduleArray(input, scheduler) { return new Observable_Observable(function (subscriber) { var i = 0; return scheduler.schedule(function () { if (i === input.length) { subscriber.complete(); } else { subscriber.next(input[i++]); if (!subscriber.closed) { this.schedule(); } } }); }); } //# sourceMappingURL=scheduleArray.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/symbol/iterator.js function getSymbolIterator() { if (typeof Symbol !== 'function' || !Symbol.iterator) { return '@@iterator'; } return Symbol.iterator; } var iterator_iterator = getSymbolIterator(); //# sourceMappingURL=iterator.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/util/caughtSchedule.js function caughtSchedule(subscriber, scheduler, execute, delay) { if (delay === void 0) { delay = 0; } var subscription = scheduler.schedule(function () { try { execute.call(this); } catch (err) { subscriber.error(err); } }, delay); subscriber.add(subscription); return subscription; } //# sourceMappingURL=caughtSchedule.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/scheduled/scheduleIterable.js function scheduleIterable(input, scheduler) { return new Observable_Observable(function (subscriber) { var iterator; subscriber.add(scheduler.schedule(function () { iterator = input[iterator_iterator](); caughtSchedule(subscriber, scheduler, function () { var _a = iterator.next(), value = _a.value, done = _a.done; if (done) { subscriber.complete(); } else { subscriber.next(value); this.schedule(); } }); })); return function () { return isFunction(iterator === null || iterator === void 0 ? void 0 : iterator.return) && iterator.return(); }; }); } //# sourceMappingURL=scheduleIterable.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/scheduled/scheduleAsyncIterable.js function scheduleAsyncIterable(input, scheduler) { if (!input) { throw new Error('Iterable cannot be null'); } return new Observable_Observable(function (subscriber) { var sub = new Subscription(); sub.add(scheduler.schedule(function () { var iterator = input[Symbol.asyncIterator](); sub.add(scheduler.schedule(function () { var _this = this; iterator.next().then(function (result) { if (result.done) { subscriber.complete(); } else { subscriber.next(result.value); _this.schedule(); } }); })); })); return sub; }); } //# sourceMappingURL=scheduleAsyncIterable.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/util/isInteropObservable.js function isInteropObservable(input) { return isFunction(input[observable_observable]); } //# sourceMappingURL=isInteropObservable.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/util/isIterable.js function isIterable(input) { return isFunction(input === null || input === void 0 ? void 0 : input[iterator_iterator]); } //# sourceMappingURL=isIterable.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/util/isAsyncIterable.js function isAsyncIterable(obj) { return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]); } //# sourceMappingURL=isAsyncIterable.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/util/throwUnobservableError.js function createInvalidObservableTypeError(input) { return new TypeError("You provided " + (input !== null && typeof input === 'object' ? 'an invalid object' : "'" + input + "'") + " where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable."); } //# sourceMappingURL=throwUnobservableError.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/util/isReadableStreamLike.js function readableStreamLikeToAsyncGenerator(readableStream) { return __asyncGenerator(this, arguments, function readableStreamLikeToAsyncGenerator_1() { var reader, _a, value, done; return tslib_es6_generator(this, function (_b) { switch (_b.label) { case 0: reader = readableStream.getReader(); _b.label = 1; case 1: _b.trys.push([1, , 9, 10]); _b.label = 2; case 2: if (false) {} return [4, __await(reader.read())]; case 3: _a = _b.sent(), value = _a.value, done = _a.done; if (!done) return [3, 5]; return [4, __await(void 0)]; case 4: return [2, _b.sent()]; case 5: return [4, __await(value)]; case 6: return [4, _b.sent()]; case 7: _b.sent(); return [3, 2]; case 8: return [3, 10]; case 9: reader.releaseLock(); return [7]; case 10: return [2]; } }); }); } function isReadableStreamLike(obj) { return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader); } //# sourceMappingURL=isReadableStreamLike.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/scheduled/scheduleReadableStreamLike.js function scheduleReadableStreamLike(input, scheduler) { return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler); } //# sourceMappingURL=scheduleReadableStreamLike.js.map ;// CONCATENATED MODULE: ./node_modules/rxjs/dist/esm5/internal/scheduled/scheduled.js function scheduled(input, scheduler) { if (input != null) { if (isInteropObservable(input)) { return scheduleObservable(input, scheduler); } if (isArrayLike(input)) { return scheduleArray(input, scheduler); } if (isPromise(input)) { return schedulePromise(input, scheduler); } if (isAsyncIterable(input)) { return scheduleAsyncIterable(input, scheduler); } if (isIterable(input)) { return scheduleIterable(input, scheduler); } if (isReadableStreamLike(input)) { return scheduleReadableStreamLike(input, scheduler); } } throw createInvalidObservableTypeError(input); } //#