UNPKG

ng-realmark

Version:

Real-time Markdown W/ Markdown three way merge

1 lines 580 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e.ng=e.ng||{},e.ng.realmark={}))}(this,function(e){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function c(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s=function(){return(s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function a(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;0<=a;a--)(o=e[a])&&(s=(i<3?o(s):3<i?o(t,n,s):o(t,n))||s);return 3<i&&s&&Object.defineProperty(t,n,s),s}function u(n,r){return function(e,t){r(e,t,n)}}function l(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function p(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function g(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||0<t--)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function A(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(g(arguments[t]));return e}function h(e){return"function"==typeof e}var t=!1,i={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){e&&(new Error).stack;t=e},get useDeprecatedSynchronousErrorHandling(){return t}};function o(e){setTimeout(function(){throw e})}var f={closed:!0,next:function(e){},error:function(e){if(i.useDeprecatedSynchronousErrorHandling)throw e;o(e)},complete:function(){}},d=Array.isArray||function(e){return e&&"number"==typeof e.length};function C(e){return null!=e&&"object"==typeof e}var n,I={e:{}};function y(){try{return n.apply(this,arguments)}catch(e){return I.e=e,I}}function v(e){return n=e,y}function m(e){return Error.call(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=e,this}m.prototype=Object.create(Error.prototype);var b=m,_=function(){function r(e){this.closed=!1,this._parent=null,this._parents=null,this._subscriptions=null,e&&(this._unsubscribe=e)}var e;return r.prototype.unsubscribe=function(){var e,t=!1;if(!this.closed){var n=this._parent,r=this._parents,o=this._unsubscribe,i=this._subscriptions;this.closed=!0,this._parent=null,this._parents=null,this._subscriptions=null;for(var s=-1,a=r?r.length:0;n;)n.remove(this),n=++s<a&&r[s]||null;if(h(o))v(o).call(this)===I&&(t=!0,e=e||(I.e instanceof b?w(I.e.errors):[I.e]));if(d(i))for(s=-1,a=i.length;++s<a;){var u=i[s];if(C(u))if(v(u.unsubscribe).call(u)===I){t=!0,e=e||[];var c=I.e;c instanceof b?e=e.concat(w(c.errors)):e.push(c)}}if(t)throw new b(e)}},r.prototype.add=function(e){if(!e||e===r.EMPTY)return r.EMPTY;if(e===this)return this;var t=e;switch(typeof e){case"function":t=new r(e);case"object":if(t.closed||"function"!=typeof t.unsubscribe)return t;if(this.closed)return t.unsubscribe(),t;if("function"!=typeof t._addParent){var n=t;(t=new r)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}return(this._subscriptions||(this._subscriptions=[])).push(t),t._addParent(this),t},r.prototype.remove=function(e){var t=this._subscriptions;if(t){var n=t.indexOf(e);-1!==n&&t.splice(n,1)}},r.prototype._addParent=function(e){var t=this._parent,n=this._parents;t&&t!==e?n?-1===n.indexOf(e)&&n.push(e):this._parents=[e]:this._parent=e},r.EMPTY=((e=new r).closed=!0,e),r}();function w(e){return e.reduce(function(e,t){return e.concat(t instanceof b?t.errors:t)},[])}var x="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("rxSubscriber"):"@@rxSubscriber",E=function(s){function o(e,t,n){var r,o=s.call(this)||this;switch(o.syncErrorValue=null,o.syncErrorThrown=!1,o.syncErrorThrowable=!1,o.isStopped=!1,o._parentSubscription=null,arguments.length){case 0:o.destination=f;break;case 1:if(!e){o.destination=f;break}if("object"==typeof e){if((r=e)instanceof E||"_addParentTeardownLogic"in r&&r[x]){var i=e[x]();o.syncErrorThrowable=i.syncErrorThrowable,(o.destination=i)._addParentTeardownLogic(o)}else o.syncErrorThrowable=!0,o.destination=new D(o,e);break}default:o.syncErrorThrowable=!0,o.destination=new D(o,e,t,n)}return o}return c(o,s),o.prototype[x]=function(){return this},o.create=function(e,t,n){var r=new o(e,t,n);return r.syncErrorThrowable=!1,r},o.prototype.next=function(e){this.isStopped||this._next(e)},o.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e),this._unsubscribeParentSubscription())},o.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete(),this._unsubscribeParentSubscription())},o.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,s.prototype.unsubscribe.call(this))},o.prototype._next=function(e){this.destination.next(e)},o.prototype._error=function(e){this.destination.error(e),this.unsubscribe()},o.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},o.prototype._addParentTeardownLogic=function(e){e!==this&&(this._parentSubscription=this.add(e))},o.prototype._unsubscribeParentSubscription=function(){null!==this._parentSubscription&&this._parentSubscription.unsubscribe()},o.prototype._unsubscribeAndRecycle=function(){var e=this._parent,t=this._parents;return this._parent=null,this._parents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parent=e,this._parents=t,this._parentSubscription=null,this},o}(_),D=function(a){function e(e,t,n,r){var o,i=a.call(this)||this;i._parentSubscriber=e;var s=i;return h(t)?o=t:t&&(o=t.next,n=t.error,r=t.complete,t!==f&&(h((s=Object.create(t)).unsubscribe)&&i.add(s.unsubscribe.bind(s)),s.unsubscribe=i.unsubscribe.bind(i))),i._context=s,i._next=o,i._error=n,i._complete=r,i}return c(e,a),e.prototype.next=function(e){if(!this.isStopped&&this._next){var t=this._parentSubscriber;i.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,e)&&this.unsubscribe():this.__tryOrUnsub(this._next,e)}},e.prototype.error=function(e){if(!this.isStopped){var t=this._parentSubscriber,n=i.useDeprecatedSynchronousErrorHandling;if(this._error)n&&t.syncErrorThrowable?this.__tryOrSetError(t,this._error,e):this.__tryOrUnsub(this._error,e),this.unsubscribe();else if(t.syncErrorThrowable)n?(t.syncErrorValue=e,t.syncErrorThrown=!0):o(e),this.unsubscribe();else{if(this.unsubscribe(),n)throw e;o(e)}}},e.prototype.complete=function(){var e=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var n=function(){return e._complete.call(e._context)};i.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,n):this.__tryOrUnsub(n),this.unsubscribe()}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(e,t){try{e.call(this._context,t)}catch(e){if(this.unsubscribe(),i.useDeprecatedSynchronousErrorHandling)throw e;o(e)}},e.prototype.__tryOrSetError=function(t,e,n){if(!i.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,n)}catch(e){return i.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0):(o(e),!0)}return!1},e.prototype._unsubscribe=function(){var e=this._parentSubscriber;this._context=null,this._parentSubscriber=null,e.unsubscribe()},e}(E);function k(e,t,n){if(e){if(e instanceof E)return e;if(e[x])return e[x]()}return e||t||n?new E(e,t,n):new E(f)}var S="function"==typeof Symbol&&Symbol.observable||"@@observable";function O(){}function T(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return j(e)}function j(t){return t?1===t.length?t[0]:function(e){return t.reduce(function(e,t){return t(e)},e)}:O}var N=function(){function n(e){this._isScalar=!1,e&&(this._subscribe=e)}return n.prototype.lift=function(e){var t=new n;return t.source=this,t.operator=e,t},n.prototype.subscribe=function(e,t,n){var r=this.operator,o=k(e,t,n);if(r?r.call(o,this.source):o._addParentTeardownLogic(this.source||i.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),i.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},n.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){i.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),t.error(e)}},n.prototype.forEach=function(r,e){var o=this;return new(e=P(e))(function(e,t){var n;n=o.subscribe(function(e){try{r(e)}catch(e){t(e),n&&n.unsubscribe()}},t,e)})},n.prototype._subscribe=function(e){var t=this.source;return t&&t.subscribe(e)},n.prototype[S]=function(){return this},n.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 0===e.length?this:j(e)(this)},n.prototype.toPromise=function(e){var r=this;return new(e=P(e))(function(e,t){var n;r.subscribe(function(e){return n=e},function(e){return t(e)},function(){return e(n)})})},n.create=function(e){return new n(e)},n}();function P(e){if(e||(e=i.Promise||Promise),!e)throw new Error("no Promise impl found");return e}function M(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}M.prototype=Object.create(Error.prototype);var F=M,V=function(r){function e(e,t){var n=r.call(this)||this;return n.subject=e,n.subscriber=t,n.closed=!1,n}return c(e,r),e.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e=this.subject,t=e.observers;if(this.subject=null,t&&0!==t.length&&!e.isStopped&&!e.closed){var n=t.indexOf(this.subscriber);-1!==n&&t.splice(n,1)}}},e}(_),R=function(n){function e(e){var t=n.call(this,e)||this;return t.destination=e,t}return c(e,n),e}(E),B=function(t){function e(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return c(e,t),e.prototype[x]=function(){return new R(this)},e.prototype.lift=function(e){var t=new L(this,this);return t.operator=e,t},e.prototype.next=function(e){if(this.closed)throw new F;if(!this.isStopped)for(var t=this.observers,n=t.length,r=t.slice(),o=0;o<n;o++)r[o].next(e)},e.prototype.error=function(e){if(this.closed)throw new F;this.hasError=!0,this.thrownError=e,this.isStopped=!0;for(var t=this.observers,n=t.length,r=t.slice(),o=0;o<n;o++)r[o].error(e);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new F;this.isStopped=!0;for(var e=this.observers,t=e.length,n=e.slice(),r=0;r<t;r++)n[r].complete();this.observers.length=0},e.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},e.prototype._trySubscribe=function(e){if(this.closed)throw new F;return t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(e){if(this.closed)throw new F;return this.hasError?(e.error(this.thrownError),_.EMPTY):this.isStopped?(e.complete(),_.EMPTY):(this.observers.push(e),new V(this,e))},e.prototype.asObservable=function(){var e=new N;return e.source=this,e},e.create=function(e,t){return new L(e,t)},e}(N),L=function(r){function e(e,t){var n=r.call(this)||this;return n.destination=e,n.source=t,n}return c(e,r),e.prototype.next=function(e){var t=this.destination;t&&t.next&&t.next(e)},e.prototype.error=function(e){var t=this.destination;t&&t.error&&this.destination.error(e)},e.prototype.complete=function(){var e=this.destination;e&&e.complete&&this.destination.complete()},e.prototype._subscribe=function(e){return this.source?this.source.subscribe(e):_.EMPTY},e}(B);function z(){return function(e){return e.lift(new H(e))}}var H=function(){function e(e){this.connectable=e}return e.prototype.call=function(e,t){var n=this.connectable;n._refCount++;var r=new G(e,n),o=t.subscribe(r);return r.closed||(r.connection=n.connect()),o},e}(),G=function(r){function e(e,t){var n=r.call(this,e)||this;return n.connectable=t,n}return c(e,r),e.prototype._unsubscribe=function(){var e=this.connectable;if(e){this.connectable=null;var t=e._refCount;if(t<=0)this.connection=null;else if(e._refCount=t-1,1<t)this.connection=null;else{var n=this.connection,r=e._connection;this.connection=null,!r||n&&r!==n||r.unsubscribe()}}else this.connection=null},e}(E),Z=function(r){function e(e,t){var n=r.call(this)||this;return n.source=e,n.subjectFactory=t,n._refCount=0,n._isComplete=!1,n}return c(e,r),e.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},e.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},e.prototype.connect=function(){var e=this._connection;return e||(this._isComplete=!1,(e=this._connection=new _).add(this.source.subscribe(new Y(this.getSubject(),this))),e.closed?(this._connection=null,e=_.EMPTY):this._connection=e),e},e.prototype.refCount=function(){return z()(this)},e}(N),U=Z.prototype,W={operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:U._subscribe},_isComplete:{value:U._isComplete,writable:!0},getSubject:{value:U.getSubject},connect:{value:U.connect},refCount:{value:U.refCount}},Y=function(r){function e(e,t){var n=r.call(this,e)||this;return n.connectable=t,n}return c(e,r),e.prototype._error=function(e){this._unsubscribe(),r.prototype._error.call(this,e)},e.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),r.prototype._complete.call(this)},e.prototype._unsubscribe=function(){var e=this.connectable;if(e){this.connectable=null;var t=e._connection;e._refCount=0,e._subject=null,e._connection=null,t&&t.unsubscribe()}},e}(R);var K=function(){function e(e,t,n,r){this.keySelector=e,this.elementSelector=t,this.durationSelector=n,this.subjectSelector=r}return e.prototype.call=function(e,t){return t.subscribe(new q(e,this.keySelector,this.elementSelector,this.durationSelector,this.subjectSelector))},e}(),q=function(s){function e(e,t,n,r,o){var i=s.call(this,e)||this;return i.keySelector=t,i.elementSelector=n,i.durationSelector=r,i.subjectSelector=o,i.groups=null,i.attemptedToUnsubscribe=!1,i.count=0,i}return c(e,s),e.prototype._next=function(e){var t;try{t=this.keySelector(e)}catch(e){return void this.error(e)}this._group(e,t)},e.prototype._group=function(e,t){var n=this.groups;n||(n=this.groups=new Map);var r,o=n.get(t);if(this.elementSelector)try{r=this.elementSelector(e)}catch(e){this.error(e)}else r=e;if(!o){o=this.subjectSelector?this.subjectSelector():new B,n.set(t,o);var i=new Q(t,o,this);if(this.destination.next(i),this.durationSelector){var s=void 0;try{s=this.durationSelector(new Q(t,o))}catch(e){return void this.error(e)}this.add(s.subscribe(new X(t,o,this)))}}o.closed||o.next(r)},e.prototype._error=function(n){var e=this.groups;e&&(e.forEach(function(e,t){e.error(n)}),e.clear()),this.destination.error(n)},e.prototype._complete=function(){var e=this.groups;e&&(e.forEach(function(e,t){e.complete()}),e.clear()),this.destination.complete()},e.prototype.removeGroup=function(e){this.groups.delete(e)},e.prototype.unsubscribe=function(){this.closed||(this.attemptedToUnsubscribe=!0,0===this.count&&s.prototype.unsubscribe.call(this))},e}(E),X=function(o){function e(e,t,n){var r=o.call(this,t)||this;return r.key=e,r.group=t,r.parent=n,r}return c(e,o),e.prototype._next=function(e){this.complete()},e.prototype._unsubscribe=function(){var e=this.parent,t=this.key;this.key=this.parent=null,e&&e.removeGroup(t)},e}(E),Q=function(o){function e(e,t,n){var r=o.call(this)||this;return r.key=e,r.groupSubject=t,r.refCountSubscription=n,r}return c(e,o),e.prototype._subscribe=function(e){var t=new _,n=this.refCountSubscription,r=this.groupSubject;return n&&!n.closed&&t.add(new J(n)),t.add(r.subscribe(e)),t},e}(N),J=function(n){function e(e){var t=n.call(this)||this;return(t.parent=e).count++,t}return c(e,n),e.prototype.unsubscribe=function(){var e=this.parent;e.closed||this.closed||(n.prototype.unsubscribe.call(this),e.count-=1,0===e.count&&e.attemptedToUnsubscribe&&e.unsubscribe())},e}(_),$=function(n){function e(e){var t=n.call(this)||this;return t._value=e,t}return c(e,n),Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),e.prototype._subscribe=function(e){var t=n.prototype._subscribe.call(this,e);return t&&!t.closed&&e.next(this._value),t},e.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new F;return this._value},e.prototype.next=function(e){n.prototype.next.call(this,this._value=e)},e}(B),ee=function(r){function e(e,t){var n=r.call(this,e,t)||this;return n.scheduler=e,n.work=t,n.pending=!1,n}return c(e,r),e.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n=this.id,r=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(r,n,t)),this.pending=!0,this.delay=t,this.id=this.id||this.requestAsyncId(r,this.id,t),this},e.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),setInterval(e.flush.bind(e,this),n)},e.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!==n&&this.delay===n&&!1===this.pending)return t;clearInterval(t)},e.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(e,t){var n=!1,r=void 0;try{this.work(e)}catch(e){n=!0,r=!!e&&e||new Error(e)}if(n)return this.unsubscribe(),r},e.prototype._unsubscribe=function(){var e=this.id,t=this.scheduler,n=t.actions,r=n.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==r&&n.splice(r,1),null!=e&&(this.id=this.recycleAsyncId(t,e,null)),this.delay=null},e}(function(n){function e(e,t){return n.call(this)||this}return c(e,n),e.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},e}(_)),te=function(r){function e(e,t){var n=r.call(this,e,t)||this;return n.scheduler=e,n.work=t,n}return c(e,r),e.prototype.schedule=function(e,t){return void 0===t&&(t=0),0<t?r.prototype.schedule.call(this,e,t):(this.delay=t,this.state=e,this.scheduler.flush(this),this)},e.prototype.execute=function(e,t){return 0<t||this.closed?r.prototype.execute.call(this,e,t):this._execute(e,t)},e.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),null!==n&&0<n||null===n&&0<this.delay?r.prototype.requestAsyncId.call(this,e,t,n):e.flush(this)},e}(ee),ne=function(){function n(e,t){void 0===t&&(t=n.now),this.SchedulerAction=e,this.now=t}return n.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.SchedulerAction(this,e).schedule(n,t)},n.now=function(){return Date.now()},n}(),re=function(r){function o(e,t){void 0===t&&(t=ne.now);var n=r.call(this,e,function(){return o.delegate&&o.delegate!==n?o.delegate.now():t()})||this;return n.actions=[],n.active=!1,n.scheduled=void 0,n}return c(o,r),o.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),o.delegate&&o.delegate!==this?o.delegate.schedule(e,t,n):r.prototype.schedule.call(this,e,t,n)},o.prototype.flush=function(e){var t=this.actions;if(this.active)t.push(e);else{var n;this.active=!0;do{if(n=e.execute(e.state,e.delay))break}while(e=t.shift());if(this.active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}},o}(ne),oe=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t}(re))(te),ie=new N(function(e){return e.complete()});function se(e){return e?(t=e,new N(function(e){return t.schedule(function(){return e.complete()})})):ie;var t}function ae(e){return e&&"function"==typeof e.schedule}var ue=function(r){return function(e){for(var t=0,n=r.length;t<n&&!e.closed;t++)e.next(r[t]);e.closed||e.complete()}};function ce(r,o){return new N(o?function(e){var t=new _,n=0;return t.add(o.schedule(function(){n!==r.length?(e.next(r[n++]),e.closed||t.add(this.schedule())):e.complete()})),t}:ue(r))}function le(t){var e=new N(function(e){e.next(t),e.complete()});return e._isScalar=!0,e.value=t,e}function pe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e[e.length-1];switch(ae(n)?e.pop():n=void 0,e.length){case 0:return se(n);case 1:return n?ce(e,n):le(e[0]);default:return ce(e,n)}}function he(t,n){return new N(n?function(e){return n.schedule(ge,0,{error:t,subscriber:e})}:function(e){return e.error(t)})}function ge(e){var t=e.error;e.subscriber.error(t)}var fe=function(){function t(e,t,n){this.kind=e,this.value=t,this.error=n,this.hasValue="N"===e}return t.prototype.observe=function(e){switch(this.kind){case"N":return e.next&&e.next(this.value);case"E":return e.error&&e.error(this.error);case"C":return e.complete&&e.complete()}},t.prototype.do=function(e,t,n){switch(this.kind){case"N":return e&&e(this.value);case"E":return t&&t(this.error);case"C":return n&&n()}},t.prototype.accept=function(e,t,n){return e&&"function"==typeof e.next?this.observe(e):this.do(e,t,n)},t.prototype.toObservable=function(){switch(this.kind){case"N":return pe(this.value);case"E":return he(this.error);case"C":return se()}throw new Error("unexpected notification kind value")},t.createNext=function(e){return void 0!==e?new t("N",e):t.undefinedValueNotification},t.createError=function(e){return new t("E",void 0,e)},t.createComplete=function(){return t.completeNotification},t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t}();var de=function(){function e(e,t){void 0===t&&(t=0),this.scheduler=e,this.delay=t}return e.prototype.call=function(e,t){return t.subscribe(new Ce(e,this.scheduler,this.delay))},e}(),Ce=function(o){function t(e,t,n){void 0===n&&(n=0);var r=o.call(this,e)||this;return r.scheduler=t,r.delay=n,r}return c(t,o),t.dispatch=function(e){var t=e.notification,n=e.destination;t.observe(n),this.unsubscribe()},t.prototype.scheduleMessage=function(e){this.add(this.scheduler.schedule(t.dispatch,this.delay,new Ae(e,this.destination)))},t.prototype._next=function(e){this.scheduleMessage(fe.createNext(e))},t.prototype._error=function(e){this.scheduleMessage(fe.createError(e))},t.prototype._complete=function(){this.scheduleMessage(fe.createComplete())},t}(E),Ae=function(){return function(e,t){this.notification=e,this.destination=t}}(),Ie=function(o){function e(e,t,n){void 0===e&&(e=Number.POSITIVE_INFINITY),void 0===t&&(t=Number.POSITIVE_INFINITY);var r=o.call(this)||this;return r.scheduler=n,r._events=[],r._infiniteTimeWindow=!1,r._bufferSize=e<1?1:e,r._windowTime=t<1?1:t,t===Number.POSITIVE_INFINITY?(r._infiniteTimeWindow=!0,r.next=r.nextInfiniteTimeWindow):r.next=r.nextTimeWindow,r}return c(e,o),e.prototype.nextInfiniteTimeWindow=function(e){var t=this._events;t.push(e),t.length>this._bufferSize&&t.shift(),o.prototype.next.call(this,e)},e.prototype.nextTimeWindow=function(e){this._events.push(new ye(this._getNow(),e)),this._trimBufferThenGetEvents(),o.prototype.next.call(this,e)},e.prototype._subscribe=function(e){var t,n=this._infiniteTimeWindow,r=n?this._events:this._trimBufferThenGetEvents(),o=this.scheduler,i=r.length;if(this.closed)throw new F;if(t=this.isStopped||this.hasError?_.EMPTY:(this.observers.push(e),new V(this,e)),o&&e.add(e=new Ce(e,o)),n)for(var s=0;s<i&&!e.closed;s++)e.next(r[s]);else for(s=0;s<i&&!e.closed;s++)e.next(r[s].value);return this.hasError?e.error(this.thrownError):this.isStopped&&e.complete(),t},e.prototype._getNow=function(){return(this.scheduler||oe).now()},e.prototype._trimBufferThenGetEvents=function(){for(var e=this._getNow(),t=this._bufferSize,n=this._windowTime,r=this._events,o=r.length,i=0;i<o&&!(e-r[i].time<n);)i++;return t<o&&(i=Math.max(i,o-t)),0<i&&r.splice(0,i),r},e}(B),ye=function(){return function(e,t){this.time=e,this.value=t}}(),ve=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.value=null,e.hasNext=!1,e.hasCompleted=!1,e}return c(e,t),e.prototype._subscribe=function(e){return this.hasError?(e.error(this.thrownError),_.EMPTY):this.hasCompleted&&this.hasNext?(e.next(this.value),e.complete(),_.EMPTY):t.prototype._subscribe.call(this,e)},e.prototype.next=function(e){this.hasCompleted||(this.value=e,this.hasNext=!0)},e.prototype.error=function(e){this.hasCompleted||t.prototype.error.call(this,e)},e.prototype.complete=function(){this.hasCompleted=!0,this.hasNext&&t.prototype.next.call(this,this.value),t.prototype.complete.call(this)},e}(B),me=1,be={};var _e={setImmediate:function(e){var t=me++;return be[t]=e,Promise.resolve().then(function(){var e;(e=be[t])&&e()}),t},clearImmediate:function(e){delete be[e]}},we=function(r){function e(e,t){var n=r.call(this,e,t)||this;return n.scheduler=e,n.work=t,n}return c(e,r),e.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),null!==n&&0<n?r.prototype.requestAsyncId.call(this,e,t,n):(e.actions.push(this),e.scheduled||(e.scheduled=_e.setImmediate(e.flush.bind(e,null))))},e.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!==n&&0<n||null===n&&0<this.delay)return r.prototype.recycleAsyncId.call(this,e,t,n);0===e.actions.length&&(_e.clearImmediate(t),e.scheduled=void 0)},e}(ee),xe=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t.prototype.flush=function(e){this.active=!0,this.scheduled=void 0;var t,n=this.actions,r=-1,o=n.length;e=e||n.shift();do{if(t=e.execute(e.state,e.delay))break}while(++r<o&&(e=n.shift()));if(this.active=!1,t){for(;++r<o&&(e=n.shift());)e.unsubscribe();throw t}},t}(re))(we),Ee=new re(ee),De=function(r){function e(e,t){var n=r.call(this,e,t)||this;return n.scheduler=e,n.work=t,n}return c(e,r),e.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),null!==n&&0<n?r.prototype.requestAsyncId.call(this,e,t,n):(e.actions.push(this),e.scheduled||(e.scheduled=requestAnimationFrame(function(){return e.flush(null)})))},e.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!==n&&0<n||null===n&&0<this.delay)return r.prototype.recycleAsyncId.call(this,e,t,n);0===e.actions.length&&(cancelAnimationFrame(t),e.scheduled=void 0)},e}(ee),ke=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t.prototype.flush=function(e){this.active=!0,this.scheduled=void 0;var t,n=this.actions,r=-1,o=n.length;e=e||n.shift();do{if(t=e.execute(e.state,e.delay))break}while(++r<o&&(e=n.shift()));if(this.active=!1,t){for(;++r<o&&(e=n.shift());)e.unsubscribe();throw t}},t}(re))(De),Se=function(r){function e(e,t){void 0===e&&(e=Oe),void 0===t&&(t=Number.POSITIVE_INFINITY);var n=r.call(this,e,function(){return n.frame})||this;return n.maxFrames=t,n.frame=0,n.index=-1,n}return c(e,r),e.prototype.flush=function(){for(var e,t,n=this.actions,r=this.maxFrames;(t=n.shift())&&(this.frame=t.delay)<=r&&!(e=t.execute(t.state,t.delay)););if(e){for(;t=n.shift();)t.unsubscribe();throw e}},e.frameTimeFactor=10,e}(re),Oe=function(o){function i(e,t,n){void 0===n&&(n=e.index+=1);var r=o.call(this,e,t)||this;return r.scheduler=e,r.work=t,r.index=n,r.active=!0,r.index=e.index=n,r}return c(i,o),i.prototype.schedule=function(e,t){if(void 0===t&&(t=0),!this.id)return o.prototype.schedule.call(this,e,t);this.active=!1;var n=new i(this.scheduler,this.work);return this.add(n),n.schedule(e,t)},i.prototype.requestAsyncId=function(e,t,n){void 0===n&&(n=0),this.delay=e.frame+n;var r=e.actions;return r.push(this),r.sort(i.sortActions),!0},i.prototype.recycleAsyncId=function(e,t,n){void 0===n&&(n=0)},i.prototype._execute=function(e,t){if(!0===this.active)return o.prototype._execute.call(this,e,t)},i.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},i}(ee);function Te(e){return e}function je(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}je.prototype=Object.create(Error.prototype);var Ne=je;function Pe(){return Error.call(this),this.message="no elements in sequence",this.name="EmptyError",this}Pe.prototype=Object.create(Error.prototype);var Me=Pe;function Fe(){return Error.call(this),this.message="Timeout has occurred",this.name="TimeoutError",this}Fe.prototype=Object.create(Error.prototype);var Ve=Fe;function Re(t,n){return function(e){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return e.lift(new Be(t,n))}}var Be=function(){function e(e,t){this.project=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new Le(e,this.project,this.thisArg))},e}(),Le=function(o){function e(e,t,n){var r=o.call(this,e)||this;return r.project=t,r.count=0,r.thisArg=n||r,r}return c(e,o),e.prototype._next=function(e){var t;try{t=this.project.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}this.destination.next(t)},e}(E);function ze(e){var r=this,t=e.args,n=e.subscriber,o=e.params,i=o.callbackFunc,s=o.context,a=o.scheduler,u=o.subject;if(!u){u=o.subject=new ve;try{i.apply(s,t.concat([function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.length<=1?e[0]:e;r.add(a.schedule(He,0,{value:n,subject:u}))}]))}catch(e){u.error(e)}}this.add(u.subscribe(n))}function He(e){var t=e.value,n=e.subject;n.next(t),n.complete()}function Ge(e){var o=this,t=e.params,n=e.subscriber,r=e.context,i=t.callbackFunc,s=t.args,a=t.scheduler,u=t.subject;if(!u){u=t.subject=new ve;try{i.apply(r,s.concat([function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.shift();if(n)o.add(a.schedule(Ue,0,{err:n,subject:u}));else{var r=e.length<=1?e[0]:e;o.add(a.schedule(Ze,0,{value:r,subject:u}))}}]))}catch(e){this.add(a.schedule(Ue,0,{err:e,subject:u}))}}this.add(u.subscribe(n))}function Ze(e){var t=e.value,n=e.subject;n.next(t),n.complete()}function Ue(e){var t=e.err;e.subject.error(t)}var We=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return c(t,e),t.prototype.notifyNext=function(e,t,n,r,o){this.destination.next(t)},t.prototype.notifyError=function(e,t){this.destination.error(e)},t.prototype.notifyComplete=function(e){this.destination.complete()},t}(E),Ye=function(o){function e(e,t,n){var r=o.call(this)||this;return r.parent=e,r.outerValue=t,r.outerIndex=n,r.index=0,r}return c(e,o),e.prototype._next=function(e){this.parent.notifyNext(this.outerValue,e,this.outerIndex,this.index++,this)},e.prototype._error=function(e){this.parent.notifyError(e,this),this.unsubscribe()},e.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},e}(E),Ke=function(e){return function(t){return e.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,o),t}};function qe(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}var Xe=qe(),Qe=function(r){return function(e){for(var t=r[Xe]();;){var n=t.next();if(n.done){e.complete();break}if(e.next(n.value),e.closed)break}return"function"==typeof t.return&&e.add(function(){t.return&&t.return()}),e}},Je=function(n){return function(e){var t=n[S]();if("function"!=typeof t.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return t.subscribe(e)}},$e=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function et(e){return e&&"function"!=typeof e.subscribe&&"function"==typeof e.then}var tt=function(t){if(t instanceof N)return function(e){return t._isScalar?(e.next(t.value),void e.complete()):t.subscribe(e)};if(t&&"function"==typeof t[S])return Je(t);if($e(t))return ue(t);if(et(t))return Ke(t);if(t&&"function"==typeof t[Xe])return Qe(t);var e=C(t)?"an invalid object":"'"+t+"'";throw new TypeError("You provided "+e+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")};function nt(e,t,n,r,o){if(void 0===o&&(o=new Ye(e,n,r)),!o.closed)return tt(t)(o)}var rt={};var ot=function(){function e(e){this.resultSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new it(e,this.resultSelector))},e}(),it=function(r){function e(e,t){var n=r.call(this,e)||this;return n.resultSelector=t,n.active=0,n.values=[],n.observables=[],n}return c(e,r),e.prototype._next=function(e){this.values.push(rt),this.observables.push(e)},e.prototype._complete=function(){var e=this.observables,t=e.length;if(0===t)this.destination.complete();else{this.active=t,this.toRespond=t;for(var n=0;n<t;n++){var r=e[n];this.add(nt(this,r,r,n))}}},e.prototype.notifyComplete=function(e){0==(this.active-=1)&&this.destination.complete()},e.prototype.notifyNext=function(e,t,n,r,o){var i=this.values,s=i[n],a=this.toRespond?s===rt?--this.toRespond:this.toRespond:0;i[n]=t,0===a&&(this.resultSelector?this._tryResultSelector(i):this.destination.next(i.slice()))},e.prototype._tryResultSelector=function(e){var t;try{t=this.resultSelector.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},e}(We);function st(e){return e&&"function"==typeof e[S]}function at(e){return e&&"function"==typeof e[Xe]}function ut(e,r){return new N(r?function(t){var n=new _;return n.add(r.schedule(function(){return e.then(function(e){n.add(r.schedule(function(){t.next(e),n.add(r.schedule(function(){return t.complete()}))}))},function(e){n.add(r.schedule(function(){return t.error(e)}))})})),n}:Ke(e))}function ct(t,n){if(!t)throw new Error("Iterable cannot be null");return new N(n?function(r){var o,e=new _;return e.add(function(){o&&"function"==typeof o.return&&o.return()}),e.add(n.schedule(function(){o=t[Xe](),e.add(n.schedule(function(){if(!r.closed){var e,t;try{var n=o.next();e=n.value,t=n.done}catch(e){return void r.error(e)}t?r.complete():(r.next(e),this.schedule())}}))})),e}:Qe(t))}function lt(e,t){if(!t)return e instanceof N?e:new N(tt(e));if(null!=e){if(st(e))return r=e,new N((o=t)?function(t){var n=new _;return n.add(o.schedule(function(){var e=r[S]();n.add(e.subscribe({next:function(e){n.add(o.schedule(function(){return t.next(e)}))},error:function(e){n.add(o.schedule(function(){return t.error(e)}))},complete:function(){n.add(o.schedule(function(){return t.complete()}))}}))})),n}:Je(r));if(et(e))return ut(e,t);if($e(e))return ce(e,t);if(at(e)||"string"==typeof e)return ct(e,t)}var r,o;throw new TypeError((null!==e&&typeof e||e)+" is not observable")}function pt(t,o,n){return void 0===n&&(n=Number.POSITIVE_INFINITY),"function"==typeof o?function(e){return e.pipe(pt(function(n,r){return lt(t(n,r)).pipe(Re(function(e,t){return o(n,e,r,t)}))},n))}:("number"==typeof o&&(n=o),function(e){return e.lift(new ht(t,n))})}var ht=function(){function e(e,t){void 0===t&&(t=Number.POSITIVE_INFINITY),this.project=e,this.concurrent=t}return e.prototype.call=function(e,t){return t.subscribe(new gt(e,this.project,this.concurrent))},e}(),gt=function(o){function e(e,t,n){void 0===n&&(n=Number.POSITIVE_INFINITY);var r=o.call(this,e)||this;return r.project=t,r.concurrent=n,r.hasCompleted=!1,r.buffer=[],r.active=0,r.index=0,r}return c(e,o),e.prototype._next=function(e){this.active<this.concurrent?this._tryNext(e):this.buffer.push(e)},e.prototype._tryNext=function(e){var t,n=this.index++;try{t=this.project(e,n)}catch(e){return void this.destination.error(e)}this.active++,this._innerSub(t,e,n)},e.prototype._innerSub=function(e,t,n){var r=new Ye(this,void 0,void 0);this.add(r),nt(this,e,t,n,r)},e.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete()},e.prototype.notifyNext=function(e,t,n,r,o){this.destination.next(t)},e.prototype.notifyComplete=function(e){var t=this.buffer;this.remove(e),this.active--,0<t.length?this._next(t.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},e}(We);function ft(e){return void 0===e&&(e=Number.POSITIVE_INFINITY),pt(Te,e)}function dt(){return ft(1)}function Ct(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 1===e.length||2===e.length&&ae(e[1])?lt(e[0]):dt()(pe.apply(void 0,e))}function At(n){return new N(function(t){var e;try{e=n()}catch(e){return void t.error(e)}return(e?lt(e):se()).subscribe(t)})}function It(){for(var t,n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return"function"==typeof n[n.length-1]&&(t=n.pop()),1===n.length&&d(n[0])&&(n=n[0]),0===n.length?ie:t?It(n).pipe(Re(function(e){return t.apply(void 0,e)})):new N(function(e){return new yt(e,n)})}var yt=function(s){function e(e,t){var n=s.call(this,e)||this;n.sources=t,n.completed=0,n.haveValues=0;var r=t.length;n.values=new Array(r);for(var o=0;o<r;o++){var i=nt(n,t[o],null,o);i&&n.add(i)}return n}return c(e,s),e.prototype.notifyNext=function(e,t,n,r,o){this.values[n]=t,o._hasValue||(o._hasValue=!0,this.haveValues++)},e.prototype.notifyComplete=function(e){var t=this.destination,n=this.haveValues,r=this.values,o=r.length;e._hasValue?(this.completed++,this.completed===o&&(n===o&&t.next(r),t.complete())):t.complete()},e}(We);function vt(e){var t=e.subscriber,n=e.condition;if(!t.closed){if(e.needIterate)try{e.state=e.iterate(e.state)}catch(e){return void t.error(e)}else e.needIterate=!0;if(n){var r=void 0;try{r=n(e.state)}catch(e){return void t.error(e)}if(!r)return void t.complete();if(t.closed)return}var o;try{o=e.resultSelector(e.state)}catch(e){return void t.error(e)}if(!t.closed&&(t.next(o),!t.closed))return this.schedule(e)}}function mt(e){return!d(e)&&0<=e-parseFloat(e)+1}function bt(e){var t=e.subscriber,n=e.counter,r=e.period;t.next(n),this.schedule({subscriber:t,counter:n+1,period:r},r)}function _t(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Number.POSITIVE_INFINITY,r=null,o=e[e.length-1];return ae(o)?(r=e.pop(),1<e.length&&"number"==typeof e[e.length-1]&&(n=e.pop())):"number"==typeof o&&(n=e.pop()),null===r&&1===e.length&&e[0]instanceof N?e[0]:ft(n)(ce(e,r))}var wt=new N(O);function xt(e){var t=e.keys,n=e.index,r=e.subscriber,o=e.subscription,i=e.obj;if(!r.closed)if(n<t.length){var s=t[n];r.next([s,i[s]]),o.add(this.schedule({keys:t,index:n+1,subscriber:r,subscription:o,obj:i}))}else r.complete()}function Et(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(1===e.length){if(!d(e[0]))return e[0];e=e[0]}return ce(e,void 0).lift(new Dt)}var Dt=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new kt(e))},e}(),kt=function(n){function e(e){var t=n.call(this,e)||this;return t.hasFirst=!1,t.observables=[],t.subscriptions=[],t}return c(e,n),e.prototype._next=function(e){this.observables.push(e)},e.prototype._complete=function(){var e=this.observables,t=e.length;if(0===t)this.destination.complete();else{for(var n=0;n<t&&!this.hasFirst;n++){var r=e[n],o=nt(this,r,r,n);this.subscriptions&&this.subscriptions.push(o),this.add(o)}this.observables=null}},e.prototype.notifyNext=function(e,t,n,r,o){if(!this.hasFirst){this.hasFirst=!0;for(var i=0;i<this.subscriptions.length;i++)if(i!==n){var s=this.subscriptions[i];s.unsubscribe(),this.remove(s)}this.subscriptions=null}this.destination.next(t)},e}(We);function St(e){var t=e.start,n=e.index,r=e.count,o=e.subscriber;r<=n?o.complete():(o.next(t),o.closed||(e.index=n+1,e.start=t+1,this.schedule(e)))}function Ot(n,e,r){void 0===n&&(n=0);var o=-1;return mt(e)?o=Number(e)<1?1:Number(e):ae(e)&&(r=e),ae(r)||(r=Ee),new N(function(e){var t=mt(n)?n:+n-r.now();return r.schedule(Tt,t,{index:0,period:o,subscriber:e})})}function Tt(e){var t=e.index,n=e.period,r=e.subscriber;if(r.next(t),!r.closed){if(-1===n)return r.complete();e.index=t+1,this.schedule(e,n)}}function jt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e[e.length-1];return"function"==typeof n&&e.pop(),ce(e,void 0).lift(new Nt(n))}var Nt=function(){function e(e){this.resultSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new Pt(e,this.resultSelector))},e}(),Pt=function(o){function e(e,t,n){void 0===n&&(n=Object.create(null));var r=o.call(this,e)||this;return r.iterators=[],r.active=0,r.resultSelector="function"==typeof t?t:null,r.values=n,r}return c(e,o),e.prototype._next=function(e){var t=this.iterators;d(e)?t.push(new Ft(e)):"function"==typeof e[Xe]?t.push(new Mt(e[Xe]())):t.push(new Vt(this.destination,this,e))},e.prototype._complete=function(){var e=this.iterators,t=e.length;if(0!==t){this.active=t;for(var n=0;n<t;n++){var r=e[n];r.stillUnsubscribed?this.add(r.subscribe(r,n)):this.active--}}else this.destination.complete()},e.prototype.notifyInactive=function(){this.active--,0===this.active&&this.destination.complete()},e.prototype.checkIterators=function(){for(var e=this.iterators,t=e.length,n=this.destination,r=0;r<t;r++){if("function"==typeof(s=e[r]).hasValue&&!s.hasValue())return}var o=!1,i=[];for(r=0;r<t;r++){var s,a=(s=e[r]).next();if(s.hasCompleted()&&(o=!0),a.done)return void n.complete();i.push(a.value)}this.resultSelector?this._tryresultSelector(i):n.next(i),o&&n.complete()},e.prototype._tryresultSelector=function(e){var t;try{t=this.resultSelector.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},e}(E),Mt=function(){function e(e){this.iterator=e,this.nextResult=e.next()}return e.prototype.hasValue=function(){return!0},e.prototype.next=function(){var e=this.nextResult;return this.nextResult=this.iterator.next(),e},e.prototype.hasCompleted=function(){var e=this.nextResult;return e&&e.done},e}(),Ft=function(){function e(e){this.array=e,this.index=0,this.length=0,this.length=e.length}return e.prototype[Xe]=function(){return this},e.prototype.next=function(e){var t=this.index++,n=this.array;return t<this.length?{value:n[t],done:!1}:{value:null,done:!0}},e.prototype.hasValue=function(){return this.array.length>this.index},e.prototype.hasCompleted=function(){return this.array.length===this.index},e}(),Vt=function(o){function e(e,t,n){var r=o.call(this,e)||this;return r.parent=t,r.observable=n,r.stillUnsubscribed=!0,r.buffer=[],r.isComplete=!1,r}return c(e,o),e.prototype[Xe]=function(){return this},e.prototype.next=function(){var e=this.buffer;return 0===e.length&&this.isComplete?{value:null,done:!0}:{value:e.shift(),done:!1}},e.prototype.hasValue=function(){return 0<this.buffer.length},e.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},e.prototype.notifyComplete=function(){0<this.buffer.length?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},e.prototype.notifyNext=function(e,t,n,r,o){this.buffer.push(t),this.parent.checkIterators()},e.prototype.subscribe=function(e,t){return nt(this,this.observable,this,t)},e}(We),Rt=Object.freeze({Observable:N,ConnectableObservable:Z,GroupedObservable:Q,observable:S,Subject:B,BehaviorSubject:$,ReplaySubject:Ie,AsyncSubject:ve,asapScheduler:xe,asyncScheduler:Ee,queueScheduler:oe,animationFrameScheduler:ke,VirtualTimeScheduler:Se,VirtualAction:Oe,Scheduler:ne,Subscription:_,Subscriber:E,Notification:fe,pipe:T,noop:O,identity:Te,isObservable:function(e){return!!e&&(e instanceof N||"function"==typeof e.lift&&"function"==typeof e.subscribe)},ArgumentOutOfRangeError:Ne,EmptyError:Me,ObjectUnsubscribedError:F,UnsubscriptionError:b,TimeoutError:Ve,bindCallback:function n(s,r,a){if(r){if(!ae(r))return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(s,a).apply(void 0,e).pipe(Re(function(e){return d(e)?r.apply(void 0,e):r(e)}))};a=r}return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var r,o=this,i={context:o,subject:r,callbackFunc:s,scheduler:a};return new N(function(e){if(a){var t={args:n,subscriber:e,params:i};return a.schedule(ze,0,t)}if(!r){r=new ve;try{s.apply(o,n.concat([function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r.next(e.length<=1?e[0]:e),r.complete()}]))}catch(e){r.error(e)}}return r.subscribe(e)})}},bindNodeCallback:function n(i,r,s){if(r){if(!ae(r))return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(i,s).apply(void 0,e).pipe(Re(function(e){return d(e)?r.apply(void 0,e):r(e)}))};s=r}return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var o={subject:void 0,args:n,callbackFunc:i,scheduler:s,context:this};return new N(function(e){var t=o.context,r=o.subject;if(s)return s.schedule(Ge,0,{params:o,subscriber:e,context:t});if(!r){r=o.subject=new ve;try{i.apply(t,n.concat([function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.shift();n?r.error(n):(r.next(e.length<=1?e[0]:e),r.complete())}]))}catch(e){r.error(e)}}return r.subscribe(e)})}},combineLatest:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=null,r=null;return ae(e[e.length-1])&&(r=e.pop()),"function"==typeof e[e.length-1]&&(n=e.pop()),1===e.length&&d(e[0])&&(e=e[0]),ce(e,r).lift(new ot(n))},concat:Ct,defer:At,empty:se,forkJoin:It,from:lt,fromEvent:function e(n,r,o,t){return h(o)&&(t=o,o=void 0),t?e(n,r,o).pipe(Re(function(e){return d(e)?t.apply(void 0,e):t(e)})):new N(function(t){!function e(t,n,r,o,i){var s,a,u,c;if((c=t)&&"function"==typeof c.addEventListener&&"function"==typeof c.removeEventListener){var l=t;t.addEventListener(n,r,i),s=function(){return l.removeEventListener(n,r,i)}}else if((u=t)&&"function"==typeof u.on&&"function"==typeof u.off){var p=t;t.on(n,r),s=function(){return p.off(n,r)}}else if((a=t)&&"function"==typeof a.addListener&&"function"==typeof a.removeListener){var h=t;t.addListener(n,r),s=function(){return h.removeListener(n,r)}}else{if(!t||!t.length)throw new TypeError("Invalid event target");for(var g=0,f=t.length;g<f;g++)e(t[g],n,r,o,i)}o.add(s)}(n,r,function(e){1<arguments.length?t.next(Array.prototype.slice.call(arguments)):t.next(e)},t,o)})},fromEventPattern:function e(r,o,t){return t?e(r,o).pipe(Re(function(e){return d(e)?t.apply(void 0,e):t(e)})):new N(function(n){var e,t=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.next(1===e.length?e[0]:e)};try{e=r(t)}catch(e){return void n.error(e)}if(h(o))return function(){return o(t,e)}})},generate:function(e,o,i,t,s){var a,u;if(1==arguments.length){var n=e;u=n.initialState,o=n.condition,i=n.iterate,a=n.resultSelector||Te,s=n.scheduler}else void 0===t||ae(t)?(u=e,a=Te,s=t):(u=e,a=t);return new N(function(t){var e=u;if(s)return s.schedule(vt,0,{subscriber:t,iterate:i,condition:o,resultSelector:a,state:e});for(;;){if(o){var n=void 0;try{n=o(e)}catch(e){return void t.error(e)}if(!n){t.complete();break}}var r=void 0;try{r=a(e)}catch(e){return void t.error(e)}if(t.next(r),t.closed)break;try{e=i(e)}catch(e){return void t.error(e)}}})},iif:function(e,t,n){return void 0===t&&(t=ie),void 0===n&&(n=ie),At(function(){return e()?t:n})},interval:function(t,n){return void 0===t&&(t=0),void 0===n&&(n=Ee),(!mt(t)||t<0)&&(t=0),n&&"function"==typeof n.schedule||(n=Ee),new N(function(e){return e.add(n.schedule(bt,t,{subscriber:e,counter:0,period:t})),e})},merge:_t,never:function(){return wt},of:pe,onErrorResumeNext:function n(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(0===e.length)return ie;var r=e[0],o=e.slice(1);return 1===e.length&&d(r)?n.apply(void 0,r):new N(function(t){var e=function(){return t.add(n.apply(void 0,o).subscribe(t))};return lt(r).subscribe({next:function(e){t.next(e)},error:e,complete:e})})},pairs:function(o,r){return new N(r?function(e){var t=Object.keys(o),n=new _;return n.add(r.schedule(xt,0,{keys:t,index:0,subscriber:e,subscription:n,obj:o})),n}:function(e){for(var t=Object.keys(o),n=0;n<t.length&&!e.closed;n++){var r=t[n];o.hasOwnProperty(r)&&e.next([r,o[r]])}e.complete()})},race:Et,range:function(r,o,i){return void 0===r&&(r=0),void 0===o&&(o=0),new N(function(e){var t=0,n=r;if(i)return i.schedule(St,0,{index:t,count:o,start:r,subscriber:e});for(;;){if(t++>=o){e.complete();break}if(e.next(n++),e.closed)break}})},throwError:he,timer:Ot,using:function(o,i){return new N(function(t){var e,n;try{e=o()}catch(e){return void t.error(e)}try{n=i(e)}catch(e){return void t.error(e)}var r=(n?lt(n):ie).subscribe(t);return function(){r.unsubscribe(),e&&e.unsubscribe()}})},zip:jt,EMPTY:ie,NEVER:wt,config:i});function Bt(t){return function(e){return e.lift(new Lt(t))}}var Lt=function(){function e(e){this.durationSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new zt(e,this.durationSelector))},e}(),zt=function(r){function e(e,t){var n=r.call(this,e)||this;return n.durationSelector=t,n.hasValue=!1,n}return c(e,r),e.prototype._next=function(e){if(this.value=e,this.hasValue=!0,!this.throttled){var t=v(this.durationSelector)(e);if(t===I)this.destination.error(I.e);else{var n=nt(this,t);!n||n.closed?this.clearThrottle():this.add(this.throttled=n)}}},e.prototype.clearThrottle=function(){var e=this.value,t=this.hasValue,n=this.throttled;n&&(this.remove(n),this.throttled=null,n.unsubscribe()),t&&(this.value=null,this.hasValue=!1,this.destination.next(e))},e.prototype.notifyNext=function(e,t,n,r){this.clearThrottle()},e.prototype.notifyComplete=function(){this.clearThrottle()},e}(We);var Ht=function(){function e(e){this.closingNotifier=e}return e.prototype.call=function(e,t){return t.subscribe(new Gt(e,this.closingNotifier))},e}(),Gt=function(r){function e(e,t){var n=r.call(this,e)||this;return n.buffer=[],n.add(nt(n,t)),n}return c(e,r),e.prototype._next=function(e){this.buffer.push(e)},e.prototype.notifyNext=function(e,t,n,r,o){var i=this.buffer;this.buffer=[],this.destination.next(i)},e}(We);var Zt=function(){function e(e,t){this.bufferSize=e,this.startBufferEvery=t,this.subscriberClass=t&&e!==t?Wt:Ut}return e.prototype.call=function(e,t){return t.subscribe(new this.subscriberClass(e,thi