UNPKG

step-to-json

Version:

A simple command line tool that extracts the system structure of a STEP (ISO 10303-44) file and outputs it as .json

1,578 lines (1,512 loc) 329 kB
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function getAugmentedNamespace(n) { if (n.__esModule) return n; var f = n.default; if (typeof f == "function") { var a = function a () { if (this instanceof a) { return Reflect.construct(f, arguments, this.constructor); } return f.apply(this, arguments); }; a.prototype = f.prototype; } else a = {}; Object.defineProperty(a, '__esModule', {value: true}); Object.keys(n).forEach(function (k) { var d = Object.getOwnPropertyDescriptor(n, k); Object.defineProperty(a, k, d.get ? d : { enumerable: true, get: function () { return n[k]; } }); }); return a; } var parser = {}; var cjs = {}; var Observable$1 = {}; var Subscriber = {}; var isFunction$1 = {}; Object.defineProperty(isFunction$1, "__esModule", { value: true }); isFunction$1.isFunction = void 0; function isFunction(value) { return typeof value === 'function'; } isFunction$1.isFunction = isFunction; var Subscription$1 = {}; var UnsubscriptionError = {}; var createErrorClass$1 = {}; Object.defineProperty(createErrorClass$1, "__esModule", { value: true }); createErrorClass$1.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; } createErrorClass$1.createErrorClass = createErrorClass; Object.defineProperty(UnsubscriptionError, "__esModule", { value: true }); UnsubscriptionError.UnsubscriptionError = void 0; var createErrorClass_1$5 = createErrorClass$1; UnsubscriptionError.UnsubscriptionError = createErrorClass_1$5.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; }; }); var arrRemove$1 = {}; Object.defineProperty(arrRemove$1, "__esModule", { value: true }); arrRemove$1.arrRemove = void 0; function arrRemove(arr, item) { if (arr) { var index = arr.indexOf(item); 0 <= index && arr.splice(index, 1); } } arrRemove$1.arrRemove = arrRemove; var __values$8 = commonjsGlobal && commonjsGlobal.__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$h = commonjsGlobal && commonjsGlobal.__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: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; var __spreadArray$g = commonjsGlobal && commonjsGlobal.__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(Subscription$1, "__esModule", { value: true }); Subscription$1.isSubscription = Subscription$1.EMPTY_SUBSCRIPTION = Subscription$1.Subscription = void 0; var isFunction_1$p = isFunction$1; var UnsubscriptionError_1 = UnsubscriptionError; var arrRemove_1$7 = arrRemove$1; var Subscription = function () { function Subscription(initialTeardown) { this.initialTeardown = initialTeardown; this.closed = false; this._parentage = null; this._finalizers = 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$8(_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$p.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$8(_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$g(__spreadArray$g([], __read$h(errors)), __read$h(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); } } }; Subscription.prototype.add = function (teardown) { var _a; if (teardown && teardown !== this) { if (this.closed) { execFinalizer(teardown); } else { if (teardown instanceof Subscription) { if (teardown.closed || teardown._hasParent(this)) { return; } teardown._addParent(this); } (this._finalizers = (_a = this._finalizers) !== 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_1$7.arrRemove(_parentage, parent); } }; Subscription.prototype.remove = function (teardown) { var _finalizers = this._finalizers; _finalizers && arrRemove_1$7.arrRemove(_finalizers, teardown); if (teardown instanceof Subscription) { teardown._removeParent(this); } }; Subscription.EMPTY = function () { var empty = new Subscription(); empty.closed = true; return empty; }(); return Subscription; }(); Subscription$1.Subscription = Subscription; Subscription$1.EMPTY_SUBSCRIPTION = Subscription.EMPTY; function isSubscription(value) { return value instanceof Subscription || value && 'closed' in value && isFunction_1$p.isFunction(value.remove) && isFunction_1$p.isFunction(value.add) && isFunction_1$p.isFunction(value.unsubscribe); } Subscription$1.isSubscription = isSubscription; function execFinalizer(finalizer) { if (isFunction_1$p.isFunction(finalizer)) { finalizer(); } else { finalizer.unsubscribe(); } } var config = {}; Object.defineProperty(config, "__esModule", { value: true }); config.config = void 0; config.config = { onUnhandledError: null, onStoppedNotification: null, Promise: undefined, useDeprecatedSynchronousErrorHandling: false, useDeprecatedNextContext: false }; var reportUnhandledError$1 = {}; var timeoutProvider = {}; (function (exports) { var __read = commonjsGlobal && commonjsGlobal.__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: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; var __spreadArray = commonjsGlobal && commonjsGlobal.__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(exports, "__esModule", { value: true }); exports.timeoutProvider = void 0; exports.timeoutProvider = { setTimeout: function (handler, timeout) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } var delegate = exports.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 = exports.timeoutProvider.delegate; return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle); }, delegate: undefined }; })(timeoutProvider); Object.defineProperty(reportUnhandledError$1, "__esModule", { value: true }); reportUnhandledError$1.reportUnhandledError = void 0; var config_1$2 = config; var timeoutProvider_1 = timeoutProvider; function reportUnhandledError(err) { timeoutProvider_1.timeoutProvider.setTimeout(function () { var onUnhandledError = config_1$2.config.onUnhandledError; if (onUnhandledError) { onUnhandledError(err); } else { throw err; } }); } reportUnhandledError$1.reportUnhandledError = reportUnhandledError; var noop$1 = {}; Object.defineProperty(noop$1, "__esModule", { value: true }); noop$1.noop = void 0; function noop() {} noop$1.noop = noop; var NotificationFactories = {}; Object.defineProperty(NotificationFactories, "__esModule", { value: true }); NotificationFactories.createNotification = NotificationFactories.nextNotification = NotificationFactories.errorNotification = NotificationFactories.COMPLETE_NOTIFICATION = void 0; NotificationFactories.COMPLETE_NOTIFICATION = function () { return createNotification('C', undefined, undefined); }(); function errorNotification(error) { return createNotification('E', undefined, error); } NotificationFactories.errorNotification = errorNotification; function nextNotification(value) { return createNotification('N', value, undefined); } NotificationFactories.nextNotification = nextNotification; function createNotification(kind, value, error) { return { kind: kind, value: value, error: error }; } NotificationFactories.createNotification = createNotification; var errorContext$1 = {}; Object.defineProperty(errorContext$1, "__esModule", { value: true }); errorContext$1.captureError = errorContext$1.errorContext = void 0; var config_1$1 = config; var context = null; function errorContext(cb) { if (config_1$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(); } } errorContext$1.errorContext = errorContext; function captureError(err) { if (config_1$1.config.useDeprecatedSynchronousErrorHandling && context) { context.errorThrown = true; context.error = err; } } errorContext$1.captureError = captureError; (function (exports) { var __extends = commonjsGlobal && commonjsGlobal.__extends || function () { 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); }; 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(exports, "__esModule", { value: true }); exports.EMPTY_OBSERVER = exports.SafeSubscriber = exports.Subscriber = void 0; var isFunction_1 = isFunction$1; var Subscription_1 = Subscription$1; var config_1 = config; var reportUnhandledError_1 = reportUnhandledError$1; var noop_1 = noop$1; var NotificationFactories_1 = NotificationFactories; var timeoutProvider_1 = timeoutProvider; var errorContext_1 = errorContext$1; 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 (Subscription_1.isSubscription(destination)) { destination.add(_this); } } else { _this.destination = exports.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(NotificationFactories_1.nextNotification(value), this); } else { this._next(value); } }; Subscriber.prototype.error = function (err) { if (this.isStopped) { handleStoppedNotification(NotificationFactories_1.errorNotification(err), this); } else { this.isStopped = true; this._error(err); } }; Subscriber.prototype.complete = function () { if (this.isStopped) { handleStoppedNotification(NotificationFactories_1.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_1.Subscription); exports.Subscriber = Subscriber; var _bind = Function.prototype.bind; function bind(fn, thisArg) { return _bind.call(fn, thisArg); } var ConsumerObserver = function () { function ConsumerObserver(partialObserver) { this.partialObserver = partialObserver; } ConsumerObserver.prototype.next = function (value) { var partialObserver = this.partialObserver; if (partialObserver.next) { try { partialObserver.next(value); } catch (error) { handleUnhandledError(error); } } }; ConsumerObserver.prototype.error = function (err) { var partialObserver = this.partialObserver; if (partialObserver.error) { try { partialObserver.error(err); } catch (error) { handleUnhandledError(error); } } else { handleUnhandledError(err); } }; ConsumerObserver.prototype.complete = function () { var partialObserver = this.partialObserver; if (partialObserver.complete) { try { partialObserver.complete(); } catch (error) { handleUnhandledError(error); } } }; return ConsumerObserver; }(); var SafeSubscriber = function (_super) { __extends(SafeSubscriber, _super); function SafeSubscriber(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 : undefined, error: error !== null && error !== void 0 ? error : undefined, complete: complete !== null && complete !== void 0 ? complete : undefined }; } 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 SafeSubscriber; }(Subscriber); exports.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); }); } exports.EMPTY_OBSERVER = { closed: true, next: noop_1.noop, error: defaultErrorHandler, complete: noop_1.noop }; })(Subscriber); var observable = {}; Object.defineProperty(observable, "__esModule", { value: true }); observable.observable = void 0; observable.observable = function () { return typeof Symbol === 'function' && Symbol.observable || '@@observable'; }(); var pipe$1 = {}; var identity$1 = {}; Object.defineProperty(identity$1, "__esModule", { value: true }); identity$1.identity = void 0; function identity(x) { return x; } identity$1.identity = identity; Object.defineProperty(pipe$1, "__esModule", { value: true }); pipe$1.pipeFromArray = pipe$1.pipe = void 0; var identity_1$e = identity$1; function pipe() { var fns = []; for (var _i = 0; _i < arguments.length; _i++) { fns[_i] = arguments[_i]; } return pipeFromArray(fns); } pipe$1.pipe = pipe; function pipeFromArray(fns) { if (fns.length === 0) { return identity_1$e.identity; } if (fns.length === 1) { return fns[0]; } return function piped(input) { return fns.reduce(function (prev, fn) { return fn(prev); }, input); }; } pipe$1.pipeFromArray = pipeFromArray; Object.defineProperty(Observable$1, "__esModule", { value: true }); Observable$1.Observable = void 0; var Subscriber_1$3 = Subscriber; var Subscription_1$8 = Subscription$1; var observable_1$2 = observable; var pipe_1$2 = pipe$1; var config_1 = config; var isFunction_1$o = isFunction$1; var errorContext_1$1 = errorContext$1; var 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 Subscriber_1$3.SafeSubscriber(observerOrNext, error, complete); errorContext_1$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; }; 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 subscriber = new Subscriber_1$3.SafeSubscriber({ next: function (value) { try { next(value); } catch (err) { reject(err); subscriber.unsubscribe(); } }, error: reject, complete: resolve }); _this.subscribe(subscriber); }); }; Observable.prototype._subscribe = function (subscriber) { var _a; return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber); }; Observable.prototype[observable_1$2.observable] = function () { return this; }; Observable.prototype.pipe = function () { var operations = []; for (var _i = 0; _i < arguments.length; _i++) { operations[_i] = arguments[_i]; } return pipe_1$2.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; }(); Observable$1.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$o.isFunction(value.next) && isFunction_1$o.isFunction(value.error) && isFunction_1$o.isFunction(value.complete); } function isSubscriber(value) { return value && value instanceof Subscriber_1$3.Subscriber || isObserver(value) && Subscription_1$8.isSubscription(value); } var ConnectableObservable$1 = {}; var refCount$1 = {}; var lift = {}; Object.defineProperty(lift, "__esModule", { value: true }); lift.operate = lift.hasLift = void 0; var isFunction_1$n = isFunction$1; function hasLift(source) { return isFunction_1$n.isFunction(source === null || source === void 0 ? void 0 : source.lift); } lift.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'); }; } lift.operate = operate; var OperatorSubscriber$1 = {}; var __extends$f = commonjsGlobal && commonjsGlobal.__extends || function () { 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); }; 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(OperatorSubscriber$1, "__esModule", { value: true }); OperatorSubscriber$1.OperatorSubscriber = OperatorSubscriber$1.createOperatorSubscriber = void 0; var Subscriber_1$2 = Subscriber; function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) { return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize); } OperatorSubscriber$1.createOperatorSubscriber = createOperatorSubscriber; var OperatorSubscriber = function (_super) { __extends$f(OperatorSubscriber, _super); function OperatorSubscriber(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 (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; 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 OperatorSubscriber; }(Subscriber_1$2.Subscriber); OperatorSubscriber$1.OperatorSubscriber = OperatorSubscriber; Object.defineProperty(refCount$1, "__esModule", { value: true }); refCount$1.refCount = void 0; var lift_1$14 = lift; var OperatorSubscriber_1$V = OperatorSubscriber$1; function refCount() { return lift_1$14.operate(function (source, subscriber) { var connection = null; source._refCount++; var refCounter = OperatorSubscriber_1$V.createOperatorSubscriber(subscriber, undefined, undefined, undefined, 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(); } }); } refCount$1.refCount = refCount; var __extends$e = commonjsGlobal && commonjsGlobal.__extends || function () { 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); }; 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(ConnectableObservable$1, "__esModule", { value: true }); ConnectableObservable$1.ConnectableObservable = void 0; var Observable_1$n = Observable$1; var Subscription_1$7 = Subscription$1; var refCount_1 = refCount$1; var OperatorSubscriber_1$U = OperatorSubscriber$1; var lift_1$13 = lift; var ConnectableObservable = function (_super) { __extends$e(ConnectableObservable, _super); function ConnectableObservable(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$13.hasLift(source)) { _this.lift = source.lift; } return _this; } ConnectableObservable.prototype._subscribe = function (subscriber) { return this.getSubject().subscribe(subscriber); }; ConnectableObservable.prototype.getSubject = function () { var subject = this._subject; if (!subject || subject.isStopped) { this._subject = this.subjectFactory(); } return this._subject; }; ConnectableObservable.prototype._teardown = function () { this._refCount = 0; var _connection = this._connection; this._subject = this._connection = null; _connection === null || _connection === void 0 ? void 0 : _connection.unsubscribe(); }; ConnectableObservable.prototype.connect = function () { var _this = this; var connection = this._connection; if (!connection) { connection = this._connection = new Subscription_1$7.Subscription(); var subject_1 = this.getSubject(); connection.add(this.source.subscribe(OperatorSubscriber_1$U.createOperatorSubscriber(subject_1, undefined, 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$7.Subscription.EMPTY; } } return connection; }; ConnectableObservable.prototype.refCount = function () { return refCount_1.refCount()(this); }; return ConnectableObservable; }(Observable_1$n.Observable); ConnectableObservable$1.ConnectableObservable = ConnectableObservable; var animationFrames$1 = {}; var performanceTimestampProvider = {}; (function (exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.performanceTimestampProvider = void 0; exports.performanceTimestampProvider = { now: function () { return (exports.performanceTimestampProvider.delegate || performance).now(); }, delegate: undefined }; })(performanceTimestampProvider); var animationFrameProvider = {}; (function (exports) { var __read = commonjsGlobal && commonjsGlobal.__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: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; var __spreadArray = commonjsGlobal && commonjsGlobal.__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(exports, "__esModule", { value: true }); exports.animationFrameProvider = void 0; var Subscription_1 = Subscription$1; exports.animationFrameProvider = { schedule: function (callback) { var request = requestAnimationFrame; var cancel = cancelAnimationFrame; var delegate = exports.animationFrameProvider.delegate; if (delegate) { request = delegate.requestAnimationFrame; cancel = delegate.cancelAnimationFrame; } var handle = request(function (timestamp) { cancel = undefined; callback(timestamp); }); return new Subscription_1.Subscription(function () { return cancel === null || cancel === void 0 ? void 0 : cancel(handle); }); }, requestAnimationFrame: function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var delegate = exports.animationFrameProvider.delegate; return ((delegate === null || delegate === void 0 ? void 0 : delegate.requestAnimationFrame) || requestAnimationFrame).apply(void 0, __spreadArray([], __read(args))); }, cancelAnimationFrame: function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var delegate = exports.animationFrameProvider.delegate; return ((delegate === null || delegate === void 0 ? void 0 : delegate.cancelAnimationFrame) || cancelAnimationFrame).apply(void 0, __spreadArray([], __read(args))); }, delegate: undefined }; })(animationFrameProvider); Object.defineProperty(animationFrames$1, "__esModule", { value: true }); animationFrames$1.animationFrames = void 0; var Observable_1$m = Observable$1; var performanceTimestampProvider_1 = performanceTimestampProvider; var animationFrameProvider_1$1 = animationFrameProvider; function animationFrames(timestampProvider) { return timestampProvider ? animationFramesFactory(timestampProvider) : DEFAULT_ANIMATION_FRAMES; } animationFrames$1.animationFrames = animationFrames; function animationFramesFactory(timestampProvider) { return new Observable_1$m.Observable(function (subscriber) { var provider = timestampProvider || performanceTimestampProvider_1.performanceTimestampProvider; var start = provider.now(); var id = 0; var run = function () { if (!subscriber.closed) { id = animationFrameProvider_1$1.animationFrameProvider.requestAnimationFrame(function (timestamp) { id = 0; var now = provider.now(); subscriber.next({ timestamp: timestampProvider ? now : timestamp, elapsed: now - start }); run(); }); } }; run(); return function () { if (id) { animationFrameProvider_1$1.animationFrameProvider.cancelAnimationFrame(id); } }; }); } var DEFAULT_ANIMATION_FRAMES = animationFramesFactory(); var Subject$2 = {}; var ObjectUnsubscribedError = {}; Object.defineProperty(ObjectUnsubscribedError, "__esModule", { value: true }); ObjectUnsubscribedError.ObjectUnsubscribedError = void 0; var createErrorClass_1$4 = createErrorClass$1; ObjectUnsubscribedError.ObjectUnsubscribedError = createErrorClass_1$4.createErrorClass(function (_super) { return function ObjectUnsubscribedErrorImpl() { _super(this); this.name = 'ObjectUnsubscribedError'; this.message = 'object unsubscribed'; }; }); var __extends$d = commonjsGlobal && commonjsGlobal.__extends || function () { 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); }; 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 __()); }; }(); var __values$7 = commonjsGlobal && commonjsGlobal.__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."); }; Object.defineProperty(Subject$2, "__esModule", { value: true }); Subject$2.AnonymousSubject = Subject$2.Subject = void 0; var Observable_1$l = Observable$1; var Subscription_1$6 = Subscription$1; var ObjectUnsubscribedError_1 = ObjectUnsubscribedError; var arrRemove_1$6 = arrRemove$1; var errorContext_1 = errorContext$1; var Subject$1 = function (_super) { __extends$d(Subject, _super); function Subject() { var _this = _super.call(this) || this; _this.closed = false; _this.currentObservers = null; _this.observers = []; _this.isStopped = false; _this.hasError = false; _this.thrownError = null; return _this; } Subject.prototype.lift = function (operator) { var subject = new AnonymousSubject(this, this); subject.operator = operator; return subject; }; Subject.prototype._throwIfClosed = function () { if (this.closed) { throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError(); } }; Subject.prototype.next = function (value) { var _this = this; errorContext_1.errorContext(function () { var e_1, _a; _this._throwIfClosed(); if (!_this.isStopped) { if (!_this.currentObservers) { _this.currentObservers = Array.from(_this.observers); } try { for (var _b = __values$7(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) { var observer = _c.value; observer.next(value); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } } }); }; Subject.prototype.error = function (err) { var _this = this; errorContext_1.errorContext(function () { _this._throwIfClosed(); if (!_this.isStopped) { _this.hasError = _this.isStopped = true; _this.thrownError = err; var observers = _this.observers; while (observers.length) { observers.shift().error(err); } } }); }; Subject.prototype.complete = function () { var _this = this; errorContext_1.errorContext(function () { _this._throwIfClosed(); if (!_this.isStopped) { _this.isStopped = true; var observers = _this.observers; while (observers.length) { observers.shift().complete(); } } }); }; Subject.prototype.unsubscribe = function () { this.isStopped = this.closed = true; this.observers = this.currentObservers = null; }; Object.defineProperty(Subject.prototype, "observed", { get: function () { var _a; return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0; }, enumerable: false, configurable: true }); Subject.prototype._trySubscribe = function (subscriber) { this._throwIfClosed(); return _super.prototype._trySubscribe.call(this, subscriber); }; Subject.prototype._subscribe = function (subscriber) { this._throwIfClosed(); this._checkFinalizedStatuses(subscriber); return this._innerSubscribe(subscriber); }; Subject.prototype._innerSubscribe = function (subscriber) { var _this = this; var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers; if (hasError || isStopped) { return Subscription_1$6.EMPTY_SUBSCRIPTION; } this.currentObservers = null; observers.push(subscriber); return new Subscription_1$6.Subscription(function () { _this.currentObservers = null; arrRemove_1$6.arrRemove(observers, subscriber); }); }; Subject.prototype._checkFinalizedStatuses = function (subscriber) { var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped; if (hasError) { subscriber.error(thrownError); } else if (isStopped) { subscriber.complete(); } }; Subject.prototype.asObservable = function () { var observable = new Observable_1$l.Observable(); observable.source = this; return observable; }; Subject.create = function (destination, source) { return new AnonymousSubject(destination, source); }; return Subject; }(Observable_1$l.Observable); Subject$2.Subject = Subject$1; var AnonymousSubject = function (_super) { __extends$d(AnonymousSubject, _super); function AnonymousSubject(destination, source) { var _this = _super.call(this) || this; _this.destination = destination; _this.source = source; return _this; } AnonymousSubject.prototype.next = function (value) { var _a, _b; (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value); }; AnonymousSubject.prototype.error = function (err) { var _a, _b; (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err); }; AnonymousSubject.prototype.complete = function () { var _a, _b; (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a); }; AnonymousSubject.prototype._subscribe = function (subscriber) { var _a, _b; return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : Subscription_1$6.EMPTY_SUBSCRIPTION; }; return AnonymousSubject; }(Subject$1); Subject$2.AnonymousSubject = AnonymousSubject; var BehaviorSubject$1 = {}; var __extends$c = commonjsGlobal && commonjsGlobal.__extends || function () { 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); }; 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(BehaviorSubject$1, "__esModule", { value: true }); BehaviorSubject$1.BehaviorSubject = void 0; var Subject_1$e = Subject$2; var BehaviorSubject = function (_super) { __extends$c(BehaviorSubject, _super); function BehaviorSubject(_value) { var _this = _super.call(this) || this; _this._value = _value; return _this; } Object.defineProperty(BehaviorSubject.prototype, "value", { get: function () { return this.getValue(); }, enumerable: false, configurable: true }); BehaviorSubject.prototype._subscribe = function (subscriber) { var subscription = _super.prototype._subscribe.call(this, subscriber); !subscription.closed && subscriber.next(this._value); return subscription; }; BehaviorSubject.prototype.getValue = function () { var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, _value = _a._value; if (hasError) { throw thrownError; } this._throwIfClosed(); return _value; }; BehaviorSubject.prototype.next = function (value) { _super.prototype.next.call(this, this._value = value); }; return BehaviorSubject; }(Subject_1$e.Subject); BehaviorSubject$1.BehaviorSubject = BehaviorSubject; var ReplaySubject$1 = {}; var dateTimestampProvider = {}; (function (exports) { Object.defineProperty(exports, "__esModule", { value: true }); exports.dateTimestampProvider = void 0; exports.dateTimestampProvider = { now: function () { return (exports.dateTimestampProvider.delegate || Date).now(); }, delegate: undefined }; })(dateTimestampProvider); var __extends$b = commonjsGlobal && commonjsGlobal.__extends || function () { 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); }; 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(ReplaySubject$1, "__esModule", { value: true }); ReplaySubject$1.ReplaySubject = void 0; var Subject_1$d = Subject$2; var dateTimestampProvider_1$2 = dateTimestampProvider; var ReplaySubject = function (_super) { __extends$b(ReplaySubject, _super); function ReplaySubject(_bufferSize, _windowTime, _timestampProvider) { if (_bufferSize === void 0) { _bufferSize = Infinity; } if (_windowTime === void 0) { _windowTime = Infinity; } if (_timestampProvider === void 0) { _timestampProvider = dateTimestampProvider_1$2.dateTimestampProvider; } var _this = _super.call(this) || this; _this._bufferSize = _bufferSize; _this._windowTime = _windowTime; _this._timestampProvider = _timestampProvider; _this._buffer = []; _this._infiniteTimeWindow = true; _this._infiniteTimeWindow = _windowTime === Infinity; _this._bufferSize = Math.max(1, _bufferSize); _this._windowTime = Math.max(1, _windowTime); return _this; } ReplaySubject.prototype.next = function (value) { var _a = this, isStopped = _a.isStopped, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow, _timestampProvider = _a._timestampProvider, _windowTime = _a._windowTime; if (!isStopped) { _buffer.push(value); !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime); } this._trimBuffer(); _super.prototype.next.call(this, value); }; ReplaySubject.prototype._subscribe = function (subscriber) { this._throwIfClosed(); this._trimBuffer(); var subscription = this._innerSubscribe(subscriber); var _a = this, _infiniteTimeWindow = _a._infiniteTimeWindow, _buffer = _a._buffer; var copy = _buffer.slice(); for (var i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {