@reactivex/rxjs
Version:
Reactive Extensions for modern JavaScript
102 lines • 138 kB
JavaScript
/**
@license
Apache License 2.0 https://github.com/ReactiveX/RxJS/blob/master/LICENSE.txt
**/
(function(t,h){"object"===typeof exports&&"undefined"!==typeof module?h(exports):"function"===typeof define&&define.amd?define(["exports"],h):h(t.Rx=t.Rx||{})})(this,function(t){function h(b,a){function c(){this.constructor=b}lb(b,a);b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}function M(b){return"function"===typeof b}function mb(){try{return ka.apply(this,arguments)}catch(b){return m.e=b,m}}function r(b){ka=b;return mb}function la(b){return b.reduce(function(a,c){return a.concat(c instanceof
N?c.errors:c)},[])}function ma(b){var a=b.subject;a.next(b.value);a.complete()}function nb(b){b.subject.error(b.err)}function ob(b){var a=this,c=b.source,e=b.subscriber;b=b.context;var d=c.callbackFunc,f=c.args,k=c.scheduler,g=c.subject;if(!g){var g=c.subject=new J,h=function pb(){for(var c=[],b=0;b<arguments.length;b++)c[b-0]=arguments[b];var e=pb.source,b=e.selector,e=e.subject,d=c.shift();d?e.error(d):b?(c=r(b).apply(this,c),c===m?a.add(k.schedule(rb,0,{err:m.e,subject:e})):a.add(k.schedule(na,
0,{value:c,subject:e}))):a.add(k.schedule(na,0,{value:1===c.length?c[0]:c,subject:e}))};h.source=c;r(d).apply(b,f.concat(h))===m&&g.error(m.e)}a.add(g.subscribe(e))}function na(b){var a=b.subject;a.next(b.value);a.complete()}function rb(b){b.subject.error(b.err)}function D(b){return b&&"function"===typeof b.schedule}function oa(b){return b&&"function"!==typeof b.subscribe&&"function"===typeof b.then}function p(b,a,c,e){var d=new pa(b,c,e);if(d.closed)return null;if(a instanceof g)if(a._isScalar)d.next(a.value),
d.complete();else return a.subscribe(d);else if(z(a)){b=0;for(c=a.length;b<c&&!d.closed;b++)d.next(a[b]);d.closed||d.complete()}else{if(oa(a))return a.then(function(c){d.closed||(d.next(c),d.complete())},function(c){return d.error(c)}).then(null,function(c){n.setTimeout(function(){throw c;})}),d;if(a&&"function"===typeof a[A]){a=a[A]();do{b=a.next();if(b.done){d.complete();break}d.next(b.value);if(d.closed)break}while(1)}else if(a&&"function"===typeof a[H])if(a=a[H](),"function"!==typeof a.subscribe)d.error(new TypeError("Provided object does not correctly implement Symbol.observable"));
else return a.subscribe(new pa(b,c,e));else d.error(new TypeError("You provided "+(null!=a&&"object"===typeof a?"an invalid object":"'"+a+"'")+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable."))}return null}function O(){for(var b=[],a=0;a<arguments.length;a++)b[a-0]=arguments[a];a=null;D(b[b.length-1])&&(a=b.pop());return null===a&&1===b.length?b[0]:(new E(b,a)).lift(new V(1))}function qa(b){var a=b.value;b=b.subscriber;b.closed||(b.next(a),b.complete())}
function sb(b){var a=b.err;b=b.subscriber;b.closed||b.error(a)}function ba(b){return!z(b)&&0<=b-parseFloat(b)+1}function ra(){for(var b=[],a=0;a<arguments.length;a++)b[a-0]=arguments[a];var a=Number.POSITIVE_INFINITY,c=null,e=b[b.length-1];D(e)?(c=b.pop(),1<b.length&&"number"===typeof b[b.length-1]&&(a=b.pop())):"number"===typeof e&&(a=b.pop());return null===c&&1===b.length?b[0]:(new E(b,c)).lift(new V(a))}function sa(){for(var b=[],a=0;a<arguments.length;a++)b[a-0]=arguments[a];if(1===b.length)if(z(b[0]))b=
b[0];else return b[0];return(new E(b)).lift(new tb)}function ub(b){var a=b.obj,c=b.keys,e=b.index,d=b.subscriber;e===b.length?d.complete():(c=c[e],d.next([c,a[c]]),b.index=e+1,this.schedule(b))}function W(b){return b instanceof Date&&!isNaN(+b)}function ta(){for(var b=[],a=0;a<arguments.length;a++)b[a-0]=arguments[a];a=b[b.length-1];"function"===typeof a&&b.pop();return(new E(b)).lift(new ua(a))}function va(b,a){if("function"!==typeof b)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");
return this.lift(new wa(b,a))}function vb(b,a){void 0===a&&(a=null);return new K({method:"GET",url:b,headers:a})}function wb(b,a,c){return new K({method:"POST",url:b,body:a,headers:c})}function xb(b,a){return new K({method:"DELETE",url:b,headers:a})}function yb(b,a,c){return new K({method:"PUT",url:b,body:a,headers:c})}function zb(b,a){return(new K({method:"GET",url:b,responseType:"json",headers:a})).lift(new wa(function(c,a){return c.response},null))}function Ab(b){for(var a=[],c=1;c<arguments.length;c++)a[c-
1]=arguments[c];for(var c=a.length,e=0;e<c;e++){var d=a[e],f;for(f in d)d.hasOwnProperty(f)&&(b[f]=d[f])}return b}function xa(b){var a=b.subscriber,c=b.context;c&&a.closeContext(c);a.closed||(b.context=a.openContext(),b.context.closeAction=this.schedule(b,b.bufferTimeSpan))}function Bb(b){var a=b.bufferCreationInterval,c=b.bufferTimeSpan,e=b.subscriber,d=b.scheduler,f=e.openContext();e.closed||(e.add(f.closeAction=d.schedule(ya,c,{subscriber:e,context:f})),this.schedule(b,a))}function ya(b){b.subscriber.closeContext(b.context)}
function za(b){b=new Cb(b);var a=this.lift(b);return b.caught=a}function Aa(b,a,c){void 0===c&&(c=Number.POSITIVE_INFINITY);"number"===typeof a&&(c=a,a=null);return this.lift(new Ba(b,a,c))}function Ca(b,a,c){void 0===c&&(c=Number.POSITIVE_INFINITY);"number"===typeof a&&(c=a,a=null);return this.lift(new Da(b,a,c))}function Db(b){b.debouncedNext()}function Eb(){return function(){function b(){this._values=[]}b.prototype.add=function(a){this.has(a)||this._values.push(a)};b.prototype.has=function(a){return-1!==
this._values.indexOf(a)};Object.defineProperty(b.prototype,"size",{get:function(){return this._values.length},enumerable:!0,configurable:!0});b.prototype.clear=function(){this._values.length=0};return b}()}function Ea(b,a){return this.lift(new Fb(b,a))}function Fa(b,a,c){return this.lift(new Gb(b,a,c))}function ca(b,a){return this.lift(new Hb(b,a))}function Ga(b){return this.lift(new Ib(b))}function Jb(b){b.clearThrottle()}function Ha(b){return b(this)}function I(b,a){var c;c="function"===typeof b?
b:function(){return b};if("function"===typeof a)return this.lift(new Kb(c,a));a=Object.create(this,Lb);a.source=this;a.subjectFactory=c;return a}function Mb(b,a){function c(){return!c.pred.apply(c.thisArg,arguments)}c.pred=b;c.thisArg=a;return c}function Nb(b,a){return function(c){var e=c;for(c=0;c<a;c++)if(e=e[b[c]],"undefined"===typeof e)return;return e}}function Ob(b){var a=b.period;b.subscriber.notifyNext();this.schedule(b,a)}function Pb(){return new v}function Ia(){return this.lift(new Qb)}function Rb(b){b.subscriber.clearThrottle()}
function Sb(b){var a=b.subscriber,c=b.windowTimeSpan,e=b.window;e&&a.closeWindow(e);b.window=a.openWindow();this.schedule(b,c)}function Tb(b){var a=b.windowTimeSpan,c=b.subscriber,e=b.scheduler,d=b.windowCreationInterval,f=c.openWindow(),k={action:this,subscription:null};k.subscription=e.schedule(Ja,a,{subscriber:c,window:f,context:k});this.add(k.subscription);this.schedule(b,d)}function Ja(b){var a=b.subscriber,c=b.window;(b=b.context)&&b.action&&b.subscription&&b.action.remove(b.subscription);a.closeWindow(c)}
function Ka(b,a){for(var c=0,e=a.length;c<e;c++)for(var d=a[c],f=Object.getOwnPropertyNames(d.prototype),k=0,g=f.length;k<g;k++){var h=f[k];b.prototype[h]=d.prototype[h]}}var lb=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,a){b.__proto__=a}||function(b,a){for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c])},n="object"==typeof window&&window.window===window&&window||"object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global;if(!n)throw Error("RxJS could not find any global context (window, self, global)");
var z=Array.isArray||function(b){return b&&"number"===typeof b.length},m={e:{}},ka,N=function(b){function a(c){b.call(this);this.errors=c;c=Error.call(this,c?c.length+" errors occurred during unsubscription:\n "+c.map(function(c,a){return a+1+") "+c.toString()}).join("\n "):"");this.name=c.name="UnsubscriptionError";this.stack=c.stack;this.message=c.message}h(a,b);return a}(Error),u=function(){function b(a){this.closed=!1;this._subscriptions=this._parents=this._parent=null;a&&(this._unsubscribe=
a)}b.prototype.unsubscribe=function(){var a=!1,c;if(!this.closed){var b=this._parent,d=this._parents,f=this._unsubscribe,k=this._subscriptions;this.closed=!0;this._subscriptions=this._parents=this._parent=null;for(var g=-1,h=d?d.length:0;b;)b.remove(this),b=++g<h&&d[g]||null;M(f)&&(b=r(f).call(this),b===m&&(a=!0,c=c||(m.e instanceof N?la(m.e.errors):[m.e])));if(z(k))for(g=-1,h=k.length;++g<h;)b=k[g],null!=b&&"object"===typeof b&&(b=r(b.unsubscribe).call(b),b===m&&(a=!0,c=c||[],b=m.e,b instanceof N?
c=c.concat(la(b.errors)):c.push(b)));if(a)throw new N(c);}};b.prototype.add=function(a){if(!a||a===b.EMPTY)return b.EMPTY;if(a===this)return this;var c=a;switch(typeof a){case "function":c=new b(a);case "object":if(c.closed||"function"!==typeof c.unsubscribe)return c;if(this.closed)return c.unsubscribe(),c;"function"!==typeof c._addParent&&(a=c,c=new b,c._subscriptions=[a]);break;default:throw Error("unrecognized teardown "+a+" added to Subscription.");}(this._subscriptions||(this._subscriptions=
[])).push(c);c._addParent(this);return c};b.prototype.remove=function(a){var c=this._subscriptions;c&&(a=c.indexOf(a),-1!==a&&c.splice(a,1))};b.prototype._addParent=function(a){var c=this._parent,b=this._parents;c&&c!==a?b?-1===b.indexOf(a)&&b.push(a):this._parents=[a]:this._parent=a};b.EMPTY=function(a){a.closed=!0;return a}(new b);return b}(),da={closed:!0,next:function(b){},error:function(b){throw b;},complete:function(){}},ea=n.Symbol,P="function"===typeof ea&&"function"===typeof ea.for?ea.for("rxSubscriber"):
"@@rxSubscriber",l=function(b){function a(c,e,d){b.call(this);this.syncErrorValue=null;this.isStopped=this.syncErrorThrowable=this.syncErrorThrown=!1;switch(arguments.length){case 0:this.destination=da;break;case 1:if(!c){this.destination=da;break}if("object"===typeof c){c instanceof a?(this.destination=c,this.destination.add(this)):(this.syncErrorThrowable=!0,this.destination=new La(this,c));break}default:this.syncErrorThrowable=!0,this.destination=new La(this,c,e,d)}}h(a,b);a.prototype[P]=function(){return this};
a.create=function(c,b,d){c=new a(c,b,d);c.syncErrorThrowable=!1;return c};a.prototype.next=function(c){this.isStopped||this._next(c)};a.prototype.error=function(c){this.isStopped||(this.isStopped=!0,this._error(c))};a.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())};a.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,b.prototype.unsubscribe.call(this))};a.prototype._next=function(c){this.destination.next(c)};a.prototype._error=function(c){this.destination.error(c);
this.unsubscribe()};a.prototype._complete=function(){this.destination.complete();this.unsubscribe()};a.prototype._unsubscribeAndRecycle=function(){var c=this._parent,a=this._parents;this._parents=this._parent=null;this.unsubscribe();this.isStopped=this.closed=!1;this._parent=c;this._parents=a;return this};return a}(u),La=function(b){function a(c,a,d,f){b.call(this);this._parentSubscriber=c;var e;c=this;M(a)?e=a:a&&(c=a,e=a.next,d=a.error,f=a.complete,M(c.unsubscribe)&&this.add(c.unsubscribe.bind(c)),
c.unsubscribe=this.unsubscribe.bind(this));this._context=c;this._next=e;this._error=d;this._complete=f}h(a,b);a.prototype.next=function(c){if(!this.isStopped&&this._next){var a=this._parentSubscriber;a.syncErrorThrowable?this.__tryOrSetError(a,this._next,c)&&this.unsubscribe():this.__tryOrUnsub(this._next,c)}};a.prototype.error=function(c){if(!this.isStopped){var a=this._parentSubscriber;if(this._error)a.syncErrorThrowable?this.__tryOrSetError(a,this._error,c):this.__tryOrUnsub(this._error,c),this.unsubscribe();
else if(a.syncErrorThrowable)a.syncErrorValue=c,a.syncErrorThrown=!0,this.unsubscribe();else throw this.unsubscribe(),c;}};a.prototype.complete=function(){if(!this.isStopped){var c=this._parentSubscriber;this._complete&&(c.syncErrorThrowable?this.__tryOrSetError(c,this._complete):this.__tryOrUnsub(this._complete));this.unsubscribe()}};a.prototype.__tryOrUnsub=function(c,a){try{c.call(this._context,a)}catch(d){throw this.unsubscribe(),d;}};a.prototype.__tryOrSetError=function(c,a,b){try{a.call(this._context,
b)}catch(f){return c.syncErrorValue=f,c.syncErrorThrown=!0}return!1};a.prototype._unsubscribe=function(){var c=this._parentSubscriber;this._parentSubscriber=this._context=null;c.unsubscribe()};return a}(l),H=function(b){var a=b.Symbol;"function"===typeof a?a.observable?b=a.observable:(b=a("observable"),a.observable=b):b="@@observable";return b}(n),g=function(){function b(a){this._isScalar=!1;a&&(this._subscribe=a)}b.prototype.lift=function(a){var c=new b;c.source=this;c.operator=a;return c};b.prototype.subscribe=
function(a,c,b){var e=this.operator;a:{if(a){if(a instanceof l)break a;if(a[P]){a=a[P]();break a}}a=a||c||b?new l(a,c,b):new l(da)}e?e.call(a,this.source):a.add(this._trySubscribe(a));if(a.syncErrorThrowable&&(a.syncErrorThrowable=!1,a.syncErrorThrown))throw a.syncErrorValue;return a};b.prototype._trySubscribe=function(a){try{return this._subscribe(a)}catch(c){a.syncErrorThrown=!0,a.syncErrorValue=c,a.error(c)}};b.prototype.forEach=function(a,c){var b=this;c||(n.Rx&&n.Rx.config&&n.Rx.config.Promise?
c=n.Rx.config.Promise:n.Promise&&(c=n.Promise));if(!c)throw Error("no Promise impl found");return new c(function(c,e){var d=b.subscribe(function(c){if(d)try{a(c)}catch(C){e(C),d.unsubscribe()}else a(c)},e,c)})};b.prototype._subscribe=function(a){return this.source.subscribe(a)};b.prototype[H]=function(){return this};b.create=function(a){return new b(a)};return b}(),G=function(b){function a(){var c=b.call(this,"object unsubscribed");this.name=c.name="ObjectUnsubscribedError";this.stack=c.stack;this.message=
c.message}h(a,b);return a}(Error),Ma=function(b){function a(c,a){b.call(this);this.subject=c;this.subscriber=a;this.closed=!1}h(a,b);a.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var c=this.subject,a=c.observers;this.subject=null;!a||0===a.length||c.isStopped||c.closed||(c=a.indexOf(this.subscriber),-1!==c&&a.splice(c,1))}};return a}(u),Na=function(b){function a(c){b.call(this,c);this.destination=c}h(a,b);return a}(l),v=function(b){function a(){b.call(this);this.observers=[];
this.hasError=this.isStopped=this.closed=!1;this.thrownError=null}h(a,b);a.prototype[P]=function(){return new Na(this)};a.prototype.lift=function(c){var a=new X(this,this);a.operator=c;return a};a.prototype.next=function(c){if(this.closed)throw new G;if(!this.isStopped)for(var a=this.observers,b=a.length,a=a.slice(),f=0;f<b;f++)a[f].next(c)};a.prototype.error=function(c){if(this.closed)throw new G;this.hasError=!0;this.thrownError=c;this.isStopped=!0;for(var a=this.observers,b=a.length,a=a.slice(),
f=0;f<b;f++)a[f].error(c);this.observers.length=0};a.prototype.complete=function(){if(this.closed)throw new G;this.isStopped=!0;for(var c=this.observers,a=c.length,c=c.slice(),b=0;b<a;b++)c[b].complete();this.observers.length=0};a.prototype.unsubscribe=function(){this.closed=this.isStopped=!0;this.observers=null};a.prototype._trySubscribe=function(c){if(this.closed)throw new G;return b.prototype._trySubscribe.call(this,c)};a.prototype._subscribe=function(c){if(this.closed)throw new G;if(this.hasError)return c.error(this.thrownError),
u.EMPTY;if(this.isStopped)return c.complete(),u.EMPTY;this.observers.push(c);return new Ma(this,c)};a.prototype.asObservable=function(){var c=new g;c.source=this;return c};a.create=function(c,a){return new X(c,a)};return a}(g),X=function(b){function a(c,a){b.call(this);this.destination=c;this.source=a}h(a,b);a.prototype.next=function(c){var a=this.destination;a&&a.next&&a.next(c)};a.prototype.error=function(c){var a=this.destination;a&&a.error&&this.destination.error(c)};a.prototype.complete=function(){var c=
this.destination;c&&c.complete&&this.destination.complete()};a.prototype._subscribe=function(c){return this.source?this.source.subscribe(c):u.EMPTY};return a}(v),J=function(b){function a(){b.apply(this,arguments);this.value=null;this.hasCompleted=this.hasNext=!1}h(a,b);a.prototype._subscribe=function(c){return this.hasError?(c.error(this.thrownError),u.EMPTY):this.hasCompleted&&this.hasNext?(c.next(this.value),c.complete(),u.EMPTY):b.prototype._subscribe.call(this,c)};a.prototype.next=function(c){this.hasCompleted||
(this.value=c,this.hasNext=!0)};a.prototype.error=function(c){this.hasCompleted||b.prototype.error.call(this,c)};a.prototype.complete=function(){this.hasCompleted=!0;this.hasNext&&b.prototype.next.call(this,this.value);b.prototype.complete.call(this)};return a}(v),Ub=function(b){function a(c,a,d,f,k){b.call(this);this.callbackFunc=c;this.selector=a;this.args=d;this.context=f;this.scheduler=k}h(a,b);a.create=function(c,b,d){void 0===b&&(b=void 0);return function(){for(var e=[],k=0;k<arguments.length;k++)e[k-
0]=arguments[k];return new a(c,b,e,this,d)}};a.prototype._subscribe=function(c){var b=this.callbackFunc,d=this.args,f=this.scheduler,k=this.subject;if(f)return f.schedule(a.dispatch,0,{source:this,subscriber:c,context:this.context});k||(k=this.subject=new J,f=function C(){for(var c=[],a=0;a<arguments.length;a++)c[a-0]=arguments[a];var b=C.source,a=b.selector,b=b.subject;a?(c=r(a).apply(this,c),c===m?b.error(m.e):(b.next(c),b.complete())):(b.next(1===c.length?c[0]:c),b.complete())},f.source=this,r(b).apply(this.context,
d.concat(f))===m&&k.error(m.e));return k.subscribe(c)};a.dispatch=function(c){var a=this,b=c.source,f=c.subscriber;c=c.context;var k=b.callbackFunc,g=b.args,h=b.scheduler,B=b.subject;if(!B){var B=b.subject=new J,l=function qb(){for(var c=[],b=0;b<arguments.length;b++)c[b-0]=arguments[b];var e=qb.source,b=e.selector,e=e.subject;b?(c=r(b).apply(this,c),c===m?a.add(h.schedule(nb,0,{err:m.e,subject:e})):a.add(h.schedule(ma,0,{value:c,subject:e}))):a.add(h.schedule(ma,0,{value:1===c.length?c[0]:c,subject:e}))};
l.source=b;r(k).apply(c,g.concat(l))===m&&B.error(m.e)}a.add(B.subscribe(f))};return a}(g).create;g.bindCallback=Ub;var Vb=function(b){function a(c,a,d,f,k){b.call(this);this.callbackFunc=c;this.selector=a;this.args=d;this.context=f;this.scheduler=k}h(a,b);a.create=function(c,b,d){void 0===b&&(b=void 0);return function(){for(var e=[],k=0;k<arguments.length;k++)e[k-0]=arguments[k];return new a(c,b,e,this,d)}};a.prototype._subscribe=function(c){var a=this.callbackFunc,b=this.args,f=this.scheduler,k=
this.subject;if(f)return f.schedule(ob,0,{source:this,subscriber:c,context:this.context});k||(k=this.subject=new J,f=function C(){for(var c=[],a=0;a<arguments.length;a++)c[a-0]=arguments[a];var b=C.source,a=b.selector,b=b.subject,e=c.shift();e?b.error(e):a?(c=r(a).apply(this,c),c===m?b.error(m.e):(b.next(c),b.complete())):(b.next(1===c.length?c[0]:c),b.complete())},f.source=this,r(a).apply(this.context,b.concat(f))===m&&k.error(m.e));return k.subscribe(c)};return a}(g).create;g.bindNodeCallback=Vb;
var fa=function(b){function a(c,a){b.call(this);this.value=c;this.scheduler=a;this._isScalar=!0;a&&(this._isScalar=!1)}h(a,b);a.create=function(c,b){return new a(c,b)};a.dispatch=function(c){var a=c.value,b=c.subscriber;c.done?b.complete():(b.next(a),b.closed||(c.done=!0,this.schedule(c)))};a.prototype._subscribe=function(c){var b=this.value,d=this.scheduler;if(d)return d.schedule(a.dispatch,0,{done:!1,value:b,subscriber:c});c.next(b);c.closed||c.complete()};return a}(g),F=function(b){function a(c){b.call(this);
this.scheduler=c}h(a,b);a.create=function(c){return new a(c)};a.dispatch=function(c){c.subscriber.complete()};a.prototype._subscribe=function(c){var b=this.scheduler;if(b)return b.schedule(a.dispatch,0,{subscriber:c});c.complete()};return a}(g),E=function(b){function a(c,a){b.call(this);this.array=c;this.scheduler=a;a||1!==c.length||(this._isScalar=!0,this.value=c[0])}h(a,b);a.create=function(c,b){return new a(c,b)};a.of=function(){for(var c=[],b=0;b<arguments.length;b++)c[b-0]=arguments[b];b=c[c.length-
1];D(b)?c.pop():b=null;var d=c.length;return 1<d?new a(c,b):1===d?new fa(c[0],b):new F(b)};a.dispatch=function(c){var a=c.array,b=c.index,f=c.subscriber;b>=c.count?f.complete():(f.next(a[b]),f.closed||(c.index=b+1,this.schedule(c)))};a.prototype._subscribe=function(c){var b=this.array,d=b.length,f=this.scheduler;if(f)return f.schedule(a.dispatch,0,{array:b,index:0,count:d,subscriber:c});for(f=0;f<d&&!c.closed;f++)c.next(b[f]);c.complete()};return a}(g),q=function(b){function a(){b.apply(this,arguments)}
h(a,b);a.prototype.notifyNext=function(c,a,b,f,k){this.destination.next(a)};a.prototype.notifyError=function(c,a){this.destination.error(c)};a.prototype.notifyComplete=function(c){this.destination.complete()};return a}(l),A=function(b){var a=b.Symbol;if("function"===typeof a)return a.iterator||(a.iterator=a("iterator polyfill")),a.iterator;if((a=b.Set)&&"function"===typeof(new a)["@@iterator"])return"@@iterator";if(b=b.Map)for(var a=Object.getOwnPropertyNames(b.prototype),c=0;c<a.length;++c){var e=
a[c];if("entries"!==e&&"size"!==e&&b.prototype[e]===b.prototype.entries)return e}return"@@iterator"}(n),pa=function(b){function a(c,a,d){b.call(this);this.parent=c;this.outerValue=a;this.outerIndex=d;this.index=0}h(a,b);a.prototype._next=function(c){this.parent.notifyNext(this.outerValue,c,this.outerIndex,this.index++,this)};a.prototype._error=function(c){this.parent.notifyError(c,this);this.unsubscribe()};a.prototype._complete=function(){this.parent.notifyComplete(this);this.unsubscribe()};return a}(l),
Oa={},ga=function(){function b(a){this.project=a}b.prototype.call=function(a,c){return c.subscribe(new Wb(a,this.project))};return b}(),Wb=function(b){function a(c,a){b.call(this,c);this.project=a;this.active=0;this.values=[];this.observables=[]}h(a,b);a.prototype._next=function(c){this.values.push(Oa);this.observables.push(c)};a.prototype._complete=function(){var c=this.observables,a=c.length;if(0===a)this.destination.complete();else{this.toRespond=this.active=a;for(var b=0;b<a;b++){var f=c[b];this.add(p(this,
f,f,b))}}};a.prototype.notifyComplete=function(c){0===--this.active&&this.destination.complete()};a.prototype.notifyNext=function(c,a,b,f,k){c=this.values;f=c[b];f=this.toRespond?f===Oa?--this.toRespond:this.toRespond:0;c[b]=a;0===f&&(this.project?this._tryProject(c):this.destination.next(c.slice()))};a.prototype._tryProject=function(c){var a;try{a=this.project.apply(this,c)}catch(d){this.destination.error(d);return}this.destination.next(a)};return a}(q);g.combineLatest=function(){for(var b=[],a=
0;a<arguments.length;a++)b[a-0]=arguments[a];var c=a=null;D(b[b.length-1])&&(c=b.pop());"function"===typeof b[b.length-1]&&(a=b.pop());1===b.length&&z(b[0])&&(b=b[0]);return(new E(b,c)).lift(new ga(a))};var V=function(){function b(a){this.concurrent=a}b.prototype.call=function(a,c){return c.subscribe(new Xb(a,this.concurrent))};return b}(),Xb=function(b){function a(c,a){b.call(this,c);this.concurrent=a;this.hasCompleted=!1;this.buffer=[];this.active=0}h(a,b);a.prototype._next=function(c){this.active<
this.concurrent?(this.active++,this.add(p(this,c))):this.buffer.push(c)};a.prototype._complete=function(){this.hasCompleted=!0;0===this.active&&0===this.buffer.length&&this.destination.complete()};a.prototype.notifyComplete=function(c){var a=this.buffer;this.remove(c);this.active--;0<a.length?this._next(a.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()};return a}(q);g.concat=O;var Zb=function(b){function a(c){b.call(this);this.observableFactory=c}h(a,b);a.create=function(c){return new a(c)};
a.prototype._subscribe=function(c){return new Yb(c,this.observableFactory)};return a}(g),Yb=function(b){function a(c,a){b.call(this,c);this.factory=a;this.tryDefer()}h(a,b);a.prototype.tryDefer=function(){try{this._callFactory()}catch(c){this._error(c)}};a.prototype._callFactory=function(){var c=this.factory();c&&this.add(p(this,c))};return a}(q);g.defer=Zb.create;g.empty=F.create;var ac=function(b){function a(c,a){b.call(this);this.sources=c;this.resultSelector=a}h(a,b);a.create=function(){for(var c=
[],b=0;b<arguments.length;b++)c[b-0]=arguments[b];if(null===c||0===arguments.length)return new F;b=null;"function"===typeof c[c.length-1]&&(b=c.pop());1===c.length&&z(c[0])&&(c=c[0]);return 0===c.length?new F:new a(c,b)};a.prototype._subscribe=function(c){return new $b(c,this.sources,this.resultSelector)};return a}(g),$b=function(b){function a(c,a,d){b.call(this,c);this.sources=a;this.resultSelector=d;this.haveValues=this.completed=0;this.total=c=a.length;this.values=Array(c);for(d=0;d<c;d++){var e=
p(this,a[d],null,d);e&&(e.outerIndex=d,this.add(e))}}h(a,b);a.prototype.notifyNext=function(c,a,b,f,k){this.values[b]=a;k._hasValue||(k._hasValue=!0,this.haveValues++)};a.prototype.notifyComplete=function(c){var a=this.destination,b=this.haveValues,f=this.resultSelector,k=this.values,g=k.length;c._hasValue?(this.completed++,this.completed===g&&(b===g&&(c=f?f.apply(this,k):k,a.next(c)),a.complete())):a.complete()};return a}(q);g.forkJoin=ac.create;var Pa=function(b){function a(c,a){b.call(this);this.promise=
c;this.scheduler=a}h(a,b);a.create=function(c,b){return new a(c,b)};a.prototype._subscribe=function(c){var a=this,b=this.promise,f=this.scheduler;if(null==f)this._isScalar?c.closed||(c.next(this.value),c.complete()):b.then(function(b){a.value=b;a._isScalar=!0;c.closed||(c.next(b),c.complete())},function(a){c.closed||c.error(a)}).then(null,function(c){n.setTimeout(function(){throw c;})});else if(this._isScalar){if(!c.closed)return f.schedule(qa,0,{value:this.value,subscriber:c})}else b.then(function(b){a.value=
b;a._isScalar=!0;c.closed||c.add(f.schedule(qa,0,{value:b,subscriber:c}))},function(a){c.closed||c.add(f.schedule(sb,0,{err:a,subscriber:c}))}).then(null,function(c){n.setTimeout(function(){throw c;})})};return a}(g),dc=function(b){function a(c,a){b.call(this);this.scheduler=a;if(null==c)throw Error("iterator cannot be null.");if((a=c[A])||"string"!==typeof c)if(a||void 0===c.length){if(!a)throw new TypeError("object is not iterable");c=c[A]()}else c=new bc(c);else c=new cc(c);this.iterator=c}h(a,
b);a.create=function(c,b){return new a(c,b)};a.dispatch=function(c){var a=c.index,b=c.iterator,f=c.subscriber;if(c.hasError)f.error(c.error);else{var k=b.next();k.done?f.complete():(f.next(k.value),c.index=a+1,f.closed?"function"===typeof b.return&&b.return():this.schedule(c))}};a.prototype._subscribe=function(c){var b=this.iterator,d=this.scheduler;if(d)return d.schedule(a.dispatch,0,{index:0,iterator:b,subscriber:c});do{d=b.next();if(d.done){c.complete();break}else c.next(d.value);if(c.closed){"function"===
typeof b.return&&b.return();break}}while(1)};return a}(g),cc=function(){function b(a,c,b){void 0===c&&(c=0);void 0===b&&(b=a.length);this.str=a;this.idx=c;this.len=b}b.prototype[A]=function(){return this};b.prototype.next=function(){return this.idx<this.len?{done:!1,value:this.str.charAt(this.idx++)}:{done:!0,value:void 0}};return b}(),bc=function(){function b(a,c,b){void 0===c&&(c=0);if(void 0===b)if(b=+a.length,isNaN(b))b=0;else if(0!==b&&"number"===typeof b&&n.isFinite(b)){var e;e=+b;e=0===e?e:
isNaN(e)?e:0>e?-1:1;b=e*Math.floor(Math.abs(b));b=0>=b?0:b>Qa?Qa:b}this.arr=a;this.idx=c;this.len=b}b.prototype[A]=function(){return this};b.prototype.next=function(){return this.idx<this.len?{done:!1,value:this.arr[this.idx++]}:{done:!0,value:void 0}};return b}(),Qa=Math.pow(2,53)-1,ec=function(b){function a(c,a){b.call(this);this.arrayLike=c;this.scheduler=a;a||1!==c.length||(this._isScalar=!0,this.value=c[0])}h(a,b);a.create=function(c,b){var e=c.length;return 0===e?new F:1===e?new fa(c[0],b):
new a(c,b)};a.dispatch=function(c){var a=c.arrayLike,b=c.index,f=c.subscriber;f.closed||(b>=c.length?f.complete():(f.next(a[b]),c.index=b+1,this.schedule(c)))};a.prototype._subscribe=function(c){var b=this.arrayLike,d=this.scheduler,f=b.length;if(d)return d.schedule(a.dispatch,0,{arrayLike:b,index:0,length:f,subscriber:c});for(d=0;d<f&&!c.closed;d++)c.next(b[d]);c.complete()};return a}(g),w=function(){function b(a,c,b){this.kind=a;this.value=c;this.error=b;this.hasValue="N"===a}b.prototype.observe=
function(a){switch(this.kind){case "N":return a.next&&a.next(this.value);case "E":return a.error&&a.error(this.error);case "C":return a.complete&&a.complete()}};b.prototype.do=function(a,c,b){switch(this.kind){case "N":return a&&a(this.value);case "E":return c&&c(this.error);case "C":return b&&b()}};b.prototype.accept=function(a,c,b){return a&&"function"===typeof a.next?this.observe(a):this.do(a,c,b)};b.prototype.toObservable=function(){switch(this.kind){case "N":return g.of(this.value);case "E":return g.throw(this.error);
case "C":return g.empty()}throw Error("unexpected notification kind value");};b.createNext=function(a){return"undefined"!==typeof a?new b("N",a):this.undefinedValueNotification};b.createError=function(a){return new b("E",void 0,a)};b.createComplete=function(){return this.completeNotification};b.completeNotification=new b("C");b.undefinedValueNotification=new b("N",void 0);return b}(),fc=function(){function b(a,c){void 0===c&&(c=0);this.scheduler=a;this.delay=c}b.prototype.call=function(a,c){return c.subscribe(new ha(a,
this.scheduler,this.delay))};return b}(),ha=function(b){function a(c,a,d){void 0===d&&(d=0);b.call(this,c);this.scheduler=a;this.delay=d}h(a,b);a.dispatch=function(c){c.notification.observe(c.destination);this.unsubscribe()};a.prototype.scheduleMessage=function(c){this.add(this.scheduler.schedule(a.dispatch,this.delay,new gc(c,this.destination)))};a.prototype._next=function(c){this.scheduleMessage(w.createNext(c))};a.prototype._error=function(c){this.scheduleMessage(w.createError(c))};a.prototype._complete=
function(){this.scheduleMessage(w.createComplete())};return a}(l),gc=function(){return function(b,a){this.notification=b;this.destination=a}}(),Ra=function(b){function a(c,a){b.call(this,null);this.ish=c;this.scheduler=a}h(a,b);a.create=function(c,b){if(null!=c){if("function"===typeof c[H])return c instanceof g&&!b?c:new a(c,b);if(z(c))return new E(c,b);if(oa(c))return new Pa(c,b);if("function"===typeof c[A]||"string"===typeof c)return new dc(c,b);if(c&&"number"===typeof c.length)return new ec(c,
b)}throw new TypeError((null!==c&&typeof c||c)+" is not observable");};a.prototype._subscribe=function(c){var a=this.ish,b=this.scheduler;return null==b?a[H]().subscribe(c):a[H]().subscribe(new ha(c,b,0))};return a}(g);g.from=Ra.create;var Sa=Object.prototype.toString,hc=function(b){function a(c,a,d,f){b.call(this);this.sourceObj=c;this.eventName=a;this.selector=d;this.options=f}h(a,b);a.create=function(c,b,d,f){M(d)&&(f=d,d=void 0);return new a(c,b,f,d)};a.setupSubscription=function(c,b,d,f,k){var e;
if(c&&"[object NodeList]"===Sa.call(c)||c&&"[object HTMLCollection]"===Sa.call(c))for(var g=0,h=c.length;g<h;g++)a.setupSubscription(c[g],b,d,f,k);else if(c&&"function"===typeof c.addEventListener&&"function"===typeof c.removeEventListener)c.addEventListener(b,d,k),e=function(){return c.removeEventListener(b,d)};else if(c&&"function"===typeof c.on&&"function"===typeof c.off)c.on(b,d),e=function(){return c.off(b,d)};else if(c&&"function"===typeof c.addListener&&"function"===typeof c.removeListener)c.addListener(b,
d),e=function(){return c.removeListener(b,d)};else throw new TypeError("Invalid event target");f.add(new u(e))};a.prototype._subscribe=function(c){var b=this.selector;a.setupSubscription(this.sourceObj,this.eventName,b?function(){for(var a=[],e=0;e<arguments.length;e++)a[e-0]=arguments[e];a=r(b).apply(void 0,a);a===m?c.error(m.e):c.next(a)}:function(a){return c.next(a)},c,this.options)};return a}(g).create;g.fromEvent=hc;var ic=function(b){function a(c,a,d){b.call(this);this.addHandler=c;this.removeHandler=
a;this.selector=d}h(a,b);a.create=function(c,b,d){return new a(c,b,d)};a.prototype._subscribe=function(c){var a=this,b=this.removeHandler,f=this.selector?function(){for(var b=[],e=0;e<arguments.length;e++)b[e-0]=arguments[e];a._callSelector(c,b)}:function(a){c.next(a)},k=this._callAddHandler(f,c);M(b)&&c.add(new u(function(){b(f,k)}))};a.prototype._callSelector=function(c,a){try{var b=this.selector.apply(this,a);c.next(b)}catch(f){c.error(f)}};a.prototype._callAddHandler=function(c,a){try{return this.addHandler(c)||
null}catch(d){a.error(d)}};return a}(g).create;g.fromEventPattern=ic;g.fromPromise=Pa.create;var Ta=function(b){return b},jc=function(b){function a(c,a,d,f,k){b.call(this);this.initialState=c;this.condition=a;this.iterate=d;this.resultSelector=f;this.scheduler=k}h(a,b);a.create=function(c,b,d,f,k){return 1==arguments.length?new a(c.initialState,c.condition,c.iterate,c.resultSelector||Ta,c.scheduler):void 0===f||D(f)?new a(c,b,d,Ta,f):new a(c,b,d,f,k)};a.prototype._subscribe=function(c){var b=this.initialState;
if(this.scheduler)return this.scheduler.schedule(a.dispatch,0,{subscriber:c,iterate:this.iterate,condition:this.condition,resultSelector:this.resultSelector,state:b});var d=this.condition,f=this.resultSelector,k=this.iterate;do{if(d){var g=void 0;try{g=d(b)}catch(C){c.error(C);break}if(!g){c.complete();break}}g=void 0;try{g=f(b)}catch(C){c.error(C);break}c.next(g);if(c.closed)break;try{b=k(b)}catch(C){c.error(C);break}}while(1)};a.dispatch=function(c){var a=c.subscriber,b=c.condition;if(!a.closed){if(c.needIterate)try{c.state=
c.iterate(c.state)}catch(y){a.error(y);return}else c.needIterate=!0;if(b){var f=void 0;try{f=b(c.state)}catch(y){a.error(y);return}if(!f){a.complete();return}if(a.closed)return}var k;try{k=c.resultSelector(c.state)}catch(y){a.error(y);return}if(!a.closed&&(a.next(k),!a.closed))return this.schedule(c)}};return a}(g);g.generate=jc.create;var lc=function(b){function a(c,a,d){b.call(this);this.condition=c;this.thenSource=a;this.elseSource=d}h(a,b);a.create=function(c,b,d){return new a(c,b,d)};a.prototype._subscribe=
function(c){return new kc(c,this.condition,this.thenSource,this.elseSource)};return a}(g),kc=function(b){function a(c,a,d,f){b.call(this,c);this.condition=a;this.thenSource=d;this.elseSource=f;this.tryIf()}h(a,b);a.prototype.tryIf=function(){var c=this.condition,a=this.thenSource,b=this.elseSource,f;try{(c=(f=c())?a:b)?this.add(p(this,c)):this._complete()}catch(k){this._error(k)}};return a}(q);g.if=lc.create;var Q=function(b){function a(c,a){b.call(this,c,a);this.scheduler=c;this.work=a;this.pending=
!1}h(a,b);a.prototype.schedule=function(c,a){void 0===a&&(a=0);if(this.closed)return this;this.state=c;this.pending=!0;c=this.id;var b=this.scheduler;null!=c&&(this.id=this.recycleAsyncId(b,c,a));this.delay=a;this.id=this.id||this.requestAsyncId(b,this.id,a);return this};a.prototype.requestAsyncId=function(c,a,b){void 0===b&&(b=0);return n.setInterval(c.flush.bind(c,this),b)};a.prototype.recycleAsyncId=function(c,a,b){void 0===b&&(b=0);return null!==b&&this.delay===b?a:(n.clearInterval(a),void 0)};
a.prototype.execute=function(c,a){if(this.closed)return Error("executing a cancelled action");this.pending=!1;if(c=this._execute(c,a))return c;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))};a.prototype._execute=function(c,a){a=!1;var b=void 0;try{this.work(c)}catch(f){a=!0,b=!!f&&f||Error(f)}if(a)return this.unsubscribe(),b};a.prototype._unsubscribe=function(){var c=this.id,a=this.scheduler,b=a.actions,f=b.indexOf(this);this.state=this.delay=this.work=
null;this.pending=!1;this.scheduler=null;-1!==f&&b.splice(f,1);null!=c&&(this.id=this.recycleAsyncId(a,c,null))};return a}(function(b){function a(c,a){b.call(this)}h(a,b);a.prototype.schedule=function(c,a){return this};return a}(u)),R=function(b){function a(){b.apply(this,arguments);this.actions=[];this.active=!1;this.scheduled=void 0}h(a,b);a.prototype.flush=function(c){var a=this.actions;if(this.active)a.push(c);else{var b;this.active=!0;do if(b=c.execute(c.state,c.delay))break;while(c=a.shift());
this.active=!1;if(b){for(;c=a.shift();)c.unsubscribe();throw b;}}};return a}(function(){function b(a,c){void 0===c&&(c=b.now);this.SchedulerAction=a;this.now=c}b.prototype.schedule=function(a,c,b){void 0===c&&(c=0);return(new this.SchedulerAction(this,a)).schedule(b,c)};b.now=Date.now?Date.now:function(){return+new Date};return b}()),x=new R(Q),mc=function(b){function a(c,a){void 0===c&&(c=0);void 0===a&&(a=x);b.call(this);this.period=c;this.scheduler=a;if(!ba(c)||0>c)this.period=0;a&&"function"===
typeof a.schedule||(this.scheduler=x)}h(a,b);a.create=function(c,b){void 0===c&&(c=0);void 0===b&&(b=x);return new a(c,b)};a.dispatch=function(c){var a=c.subscriber,b=c.period;a.next(c.index);a.closed||(c.index+=1,this.schedule(c,b))};a.prototype._subscribe=function(c){var b=this.period;c.add(this.scheduler.schedule(a.dispatch,b,{index:0,subscriber:c,period:b}))};return a}(g).create;g.interval=mc;g.merge=ra;var tb=function(){function b(){}b.prototype.call=function(a,c){return c.subscribe(new nc(a))};
return b}(),nc=function(b){function a(c){b.call(this,c);this.hasFirst=!1;this.observables=[];this.subscriptions=[]}h(a,b);a.prototype._next=function(c){this.observables.push(c)};a.prototype._complete=function(){var c=this.observables,a=c.length;if(0===a)this.destination.complete();else{for(var b=0;b<a&&!this.hasFirst;b++){var f=c[b],f=p(this,f,f,b);this.subscriptions&&this.subscriptions.push(f);this.add(f)}this.observables=null}};a.prototype.notifyNext=function(c,a,b,f,k){if(!this.hasFirst){this.hasFirst=
!0;for(c=0;c<this.subscriptions.length;c++)c!==b&&(f=this.subscriptions[c],f.unsubscribe(),this.remove(f));this.subscriptions=null}this.destination.next(a)};return a}(q);g.race=sa;var oc=function(b){function a(){b.call(this)}h(a,b);a.create=function(){return new a};a.prototype._subscribe=function(c){};return a}(g).create;g.never=oc;g.of=E.of;var Ua=function(){function b(a){this.nextSources=a}b.prototype.call=function(a,c){return c.subscribe(new pc(a,this.nextSources))};return b}(),pc=function(b){function a(c,
a){b.call(this,c);this.destination=c;this.nextSources=a}h(a,b);a.prototype.notifyError=function(c,a){this.subscribeToNextSource()};a.prototype.notifyComplete=function(c){this.subscribeToNextSource()};a.prototype._error=function(c){this.subscribeToNextSource()};a.prototype._complete=function(){this.subscribeToNextSource()};a.prototype.subscribeToNextSource=function(){var c=this.nextSources.shift();c?this.add(p(this,c)):this.destination.complete()};return a}(q);g.onErrorResumeNext=function(){for(var b=
[],a=0;a<arguments.length;a++)b[a-0]=arguments[a];1===b.length&&z(b[0])&&(b=b[0]);a=b.shift();return(new Ra(a,null)).lift(new Ua(b))};var qc=function(b){function a(c,a){b.call(this);this.obj=c;this.scheduler=a;this.keys=Object.keys(c)}h(a,b);a.create=function(c,b){return new a(c,b)};a.prototype._subscribe=function(c){var a=this.keys,b=this.scheduler,f=a.length;if(b)return b.schedule(ub,0,{obj:this.obj,keys:a,length:f,index:0,subscriber:c});for(b=0;b<f;b++){var k=a[b];c.next([k,this.obj[k]])}c.complete()};
return a}(g).create;g.pairs=qc;var rc=function(b){function a(c,a,d){b.call(this);this.start=c;this._count=a;this.scheduler=d}h(a,b);a.create=function(c,b,d){void 0===c&&(c=0);void 0===b&&(b=0);return new a(c,b,d)};a.dispatch=function(c){var a=c.start,b=c.index,f=c.subscriber;b>=c.count?f.complete():(f.next(a),f.closed||(c.index=b+1,c.start=a+1,this.schedule(c)))};a.prototype._subscribe=function(c){var b=0,d=this.start,f=this._count,k=this.scheduler;if(k)return k.schedule(a.dispatch,0,{index:b,count:f,
start:d,subscriber:c});do{if(b++>=f){c.complete();break}c.next(d++);if(c.closed)break}while(1)};return a}(g).create;g.range=rc;var tc=function(b){function a(c,a){b.call(this);this.resourceFactory=c;this.observableFactory=a}h(a,b);a.create=function(c,b){return new a(c,b)};a.prototype._subscribe=function(c){var a=this.resourceFactory,b=this.observableFactory,f;try{return f=a(),new sc(c,f,b)}catch(k){c.error(k)}};return a}(g),sc=function(b){function a(c,a,d){b.call(this,c);this.resource=a;this.observableFactory=
d;c.add(a);this.tryUse()}h(a,b);a.prototype.tryUse=function(){try{var c=this.observableFactory.call(this,this.resource);c&&this.add(p(this,c))}catch(e){this._error(e)}};return a}(q);g.using=tc.create;var uc=function(b){function a(c,a){b.call(this);this.error=c;this.scheduler=a}h(a,b);a.create=function(c,b){return new a(c,b)};a.dispatch=function(c){c.subscriber.error(c.error)};a.prototype._subscribe=function(c){var b=this.error,d=this.scheduler;if(d)return d.schedule(a.dispatch,0,{error:b,subscriber:c});
c.error(b)};return a}(g).create;g.throw=uc;var vc=function(b){function a(c,a,d){void 0===c&&(c=0);b.call(this);this.period=-1;this.dueTime=0;ba(a)?this.period=1>Number(a)&&1||Number(a):D(a)&&(d=a);D(d)||(d=x);this.scheduler=d;this.dueTime=W(c)?+c-this.scheduler.now():c}h(a,b);a.create=function(c,b,d){void 0===c&&(c=0);return new a(c,b,d)};a.dispatch=function(c){var a=c.index,b=c.period,f=c.subscriber;f.next(a);if(!f.closed){if(-1===b)return f.complete();c.index=a+1;this.schedule(c,b)}};a.prototype._subscribe=
function(c){return this.scheduler.schedule(a.dispatch,this.dueTime,{index:0,period:this.period,subscriber:c})};return a}(g).create;g.timer=vc;var ua=function(){function b(a){this.project=a}b.prototype.call=function(a,c){return c.subscribe(new wc(a,this.project))};return b}(),wc=function(b){function a(c,a,d){void 0===d&&(d=Object.create(null));b.call(this,c);this.iterators=[];this.active=0;this.project="function"===typeof a?a:null;this.values=d}h(a,b);a.prototype._next=function(c){var a=this.iterators;
z(c)?a.push(new xc(c)):"function"===typeof c[A]?a.push(new yc(c[A]())):a.push(new zc(this.destination,this,c))};a.prototype._complete=function(){var c=this.iterators,a=c.length;this.active=a;for(var b=0;b<a;b++){var f=c[b];f.stillUnsubscribed?this.add(f.subscribe(f,b)):this.active--}};a.prototype.notifyInactive=function(){this.active--;0===this.active&&this.destination.complete()};a.prototype.checkIterators=function(){for(var c=this.iterators,a=c.length,b=this.destination,f=0;f<a;f++){var k=c[f];
if("function"===typeof k.hasValue&&!k.hasValue())return}for(var g=!1,h=[],f=0;f<a;f++){var k=c[f],l=k.next();k.hasCompleted()&&(g=!0);if(l.done){b.complete();return}h.push(l.value)}this.project?this._tryProject(h):b.next(h);g&&b.complete()};a.prototype._tryProject=function(c){var a;try{a=this.project.apply(this,c)}catch(d){this.destination.error(d);return}this.destination.next(a)};return a}(l),yc=function(){function b(a){this.iterator=a;this.nextResult=a.next()}b.prototype.hasValue=function(){return!0};
b.prototype.next=function(){var a=this.nextResult;this.nextResult=this.iterator.next();return a};b.prototype.hasCompleted=function(){var a=this.nextResult;return a&&a.done};return b}(),xc=function(){function b(a){this.array=a;this.length=this.index=0;this.length=a.length}b.prototype[A]=function(){return this};b.prototype.next=function(a){a=this.index++;var c=this.array;return a<this.length?{value:c[a],done:!1}:{value:null,done:!0}};b.prototype.hasValue=function(){return this.array.length>this.index};
b.prototype.hasCompleted=function(){return this.array.length===this.index};return b}(),zc=function(b){function a(c,a,d){b.call(this,c);this.parent=a;this.observable=d;this.stillUnsubscribed=!0;this.buffer=[];this.isComplete=!1}h(a,b);a.prototype[A]=function(){return this};a.prototype.next=function(){var c=this.buffer;return 0===c.length&&this.isComplete?{value:null,done:!0}:{value:c.shift(),done:!1}};a.prototype.hasValue=function(){return 0<this.buffer.length};a.prototype.hasCompleted=function(){return 0===
this.buffer.length&&this.isComplete};a.prototype.notifyComplete=function(){0<this.buffer.length?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()};a.prototype.notifyNext=function(c,a,b,f,k){this.buffer.push(a);this.parent.checkIterators()};a.prototype.subscribe=function(c,a){return p(this,this.observable,this,a)};return a}(q);g.zip=ta;var wa=function(){function b(a,c){this.project=a;this.thisArg=c}b.prototype.call=function(a,c){return c.subscribe(new Ac(a,this.project,
this.thisArg))};return b}(),Ac=function(b){function a(c,a,d){b.call(this,c);this.project=a;this.count=0;this.thisArg=d||this}h(a,b);a.prototype._next=function(c){var a;try{a=this.project.call(this.thisArg,c,this.count++)}catch(d){this.destination.error(d);return}this.destination.next(a)};return a}(l),K=function(b){function a(c){b.call(this);var a={async:!0,createXHR:function(){var c;if(this.crossDomain)if(n.XMLHttpRequest)c=new n.XMLHttpRequest,"withCredentials"in c&&(c.withCredentials=!!this.withCredentials);
else if(n.XDomainRequest)c=new n.XDomainRequest;else throw Error("CORS is not supported by your browser");else if(n.XMLHttpRequest)c=new n.XMLHttpRequest;else{var a=void 0;try{for(var b=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],e=0;3>e;e++)try{a=b[e];new n.ActiveXObject(a);break}catch(B){}c=new n.ActiveXObject(a)}catch(B){throw Error("XMLHttpRequest is not supported by your browser");}}return c},crossDomain:!1,withCredentials:!1,headers:{},method:"GET",responseType:"json",timeout:0};
if("string"===typeof c)a.url=c;else for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d]);this.request=a}h(a,b);a.prototype._subscribe=function(c){return new Bc(c,this.request)};a.create=function(){var c=function(c){return new a(c)};c.get=vb;c.post=wb;c.delete=xb;c.put=yb;c.getJSON=zb;return c}();return a}(g),Bc=function(b){function a(c,a){b.call(this,c);this.request=a;this.done=!1;c=a.headers=a.headers||{};a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");"Content-Type"in c||
n.FormData&&a.body instanceof n.FormData||"undefined"===typeof a.body||(c["Content-Type"]="application/x-www-form-urlencoded; charset\x3dUTF-8");a.body=this.serializeBody(a.body,a.headers["Content-Type"]);this.send()}h(a,b);a.prototype.next=function(c){this.done=!0;var a=this.destination;c=new Va(c,this.xhr,this.request);a.next(c)};a.prototype.send=function(){var c=this.request,a=this.request,b=a.user,f=a.method,k=a.url,g=a.async,h=a.password,l=a.headers,a=a.body,n=r(c.createXHR).call(c);if(n===m)this.error(m.e);
else{this.xhr=n;this.setupEvents(n,c);b=b?r(n.open).call(n,f,k,g,b,h):r(n.open).call(n,f,k,g);if(b===m)return this.error(m.e),null;n.timeout=c.timeout;n.responseType=c.responseType;this.setHeaders(n,l);b=a?r(n.send).call(n,a):r(n.send).call(n);if(b===m)return this.error(m.e),null}return n};a.prototype.serializeBody=function(c,a){if(!c||"string"===typeof c||n.FormData&&c instanceof n.FormData)return c;if(a){var b=a.indexOf(";");-1!==b&&(a=a.substring(0,b))}switch(a){case "application/x-www-form-urlencoded":return Object.keys(c).map(function(a){return encodeURI(a)+
"\x3d"+encodeURI(c[a])}).join("\x26");case "application/json":return JSON.stringify(c);default:return c}};a.prototype.setHeaders=function(c,a){for(var b in a)a.hasOwnProperty(b)&&c.setRequestHeader(b,a[b])};a.prototype.setupEvents=function(c,a){function b(c){var a=b.subscriber,e=b.progressSubscriber,d=b.request;e&&e.error(c);a.error(new Wa(this,d))}function e(c){var a=e.subscriber,b=e.progressSubscriber,d=e.request;if(4===this.readyState){var f=1223===this.status?204:this.status,k="text"===this.responseType?
this.response||this.responseText:this.response;0===f&&(f=k?200:0);200<=f&&300>f?(b&&b.complete(),a.next(c),a.complete()):(b&&b.error(c),a.error(new Y("ajax error "+f,this,d)))}}var k=a.progressSubscriber;c.ontimeout=b;b.request=a;b.subscriber=this;b.progressSubscriber=k;if(c.upload&&"withCredentials"in c){if(k){var g;g=function(c){g.progressSubscriber.next(c)};n.XDomainRequest?c.onprogress=g:c.upload.onprogress=g;g.progressSubscriber=k}var h;h=function(c){var a=h.progressSubscriber,b=h.subscriber,
e=h.request;a&&a.error(c);b.error(new Y("ajax error",this,e))};c.onerror=h;h.request=a;h.subscriber=this;h.progressSubscriber=k}c.onreadystatechange=e;e.subscriber=this;e.progressSubscriber=k;e.request=a};a.prototype.unsubscribe=function(){var c=this.xhr;!this.done&&c&&4!==c.readyState&&"function"===typeof c.abort&&c.abort();b.prototype.unsubscribe.call(this)};return a}(l),Va=function(){return function(b,a,c){this.originalEvent=b;this.xhr=a;this.request=c;this.status=a.status;this.responseType=a.responseType||
c.responseType;switch(this.responseType){case "json":this.response="response"in a?a.responseType?a.response:JSON.parse(a.response||a.responseText||"null"):JSON.parse(a.responseText||"null");break;case "xml":this.response=a.responseXML;break;default:this.response="response"in a?a.response:a.responseText}}}(),Y=function(b){function a(c,a,d){b.call(this,c);this.message=c;this.xhr=a;this.request=d;this.status=a.status}h(a,b);return a}(Error),Wa=function(b){function a(c,a){b.call(this,"ajax timeout",c,
a)}h(a,b);return a}(Y);g.ajax=K.create;var Cc=function(b){function a(c,a){b.call(this,c,a);this.scheduler=c;this.work=a}h(a,b);a.prototype.schedule=function(c,a){void 0===a&&(a=0);if(0<a)return b.prototype.schedule.call(this,c,a);this.delay=a;this.state=c;this.scheduler.flush(this);return this};a.prototype.execute=function(c,a){return 0<a||this.closed?b.prototype.execute.call(this,c,a):this._execute(c,a)};a.prototype.requestAsyncId=function(c,a,d){void 0===d&&(d=0);return null!==d&&0<d||null===d&&
0<this.delay?b.prototype.requestAsyncId.call(this,c,a,d):c.flush(this)};return a}(Q),Xa=new (function(b){function a(){b.apply(this,arguments)}h(a,b);return a}(R))(Cc),L=function(b){function a(c,a,d){void 0===c&&(c=Number.POSITIVE_INFINITY);void 0===a&&(a=Number.POSITIVE_INFINITY);b.call(this);this.scheduler=d;this._events=[];this._bufferSize=1>c?1:c;this._windowTime=1>a?1:a}h(a,b);a.prototype.next=function(c){var a=this._getNow();this._events.push(new Dc(a,c));this._trimBufferThenGetEvents();b.prototype.next.call(this,
c)};a.prototype._subscribe=function(c){var a=this._trimBufferThenGetEvents(),b=this.scheduler,f;if(this.closed)throw new G;this.hasError?f=u.EMPTY:this.isStopped?f=u.EMPTY:(this.observers.push(c),f=new Ma(this,c));b&&c.add(c=new ha(c,b));for(var b=a.length,k=0;k<b&&!c.closed;k++)c.next(a[k].value);this.hasError?c.error(this.thrownError):this.isStopped&&c.complete();return f};a.prototype._getNow=function(){return(this.scheduler||Xa).now()};a.prototype._trimBufferThenGetEvents=function(){for(var c=
this._getNow(),a=this._bufferSize,