From 4bfe44ce6315eafc467d420951662fafc61a62f7 Mon Sep 17 00:00:00 2001 From: Matthew Podwysocki Date: Tue, 18 Mar 2014 18:23:59 -0400 Subject: [PATCH] Fixing issue #123 and issue #124 --- Gruntfile.js | 7 + bower.json | 3 +- package.json | 2 +- rx.binding.min.js | 2 +- rx.coincidence.min.js | 2 +- rx.compat.js | 315 ++++++++++++++---------------- rx.compat.min.js | 4 +- rx.experimental.js | 92 +++++---- rx.experimental.min.js | 2 +- rx.joinpatterns.min.js | 2 +- rx.js | 315 ++++++++++++++---------------- rx.lite.compat.js | 315 ++++++++++++++---------------- rx.lite.compat.min.js | 4 +- rx.lite.js | 315 ++++++++++++++---------------- rx.lite.min.js | 4 +- rx.min.js | 4 +- rx.testing.min.js | 2 +- rx.time.min.js | 2 +- rx.virtualtime.min.js | 2 +- src/core/basicheader-modern.js | 44 ++--- src/core/basicheader.js | 43 ++-- src/core/enumeratorheader.js | 10 + src/core/experimentalheader.js | 56 +++--- src/core/internal/enumerable.js | 222 +++++++++++---------- src/core/internal/enumerator.js | 35 +--- src/core/linq/enumerable/while.js | 21 +- src/core/liteheader-compat.js | 44 ++--- src/core/liteheader.js | 42 ++-- 28 files changed, 902 insertions(+), 1009 deletions(-) create mode 100644 src/core/enumeratorheader.js diff --git a/Gruntfile.js b/Gruntfile.js index b182fe350..e3b8c643e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -49,6 +49,8 @@ var browsers = [{ 'src/core/license.js', 'src/core/intro.js', 'src/core/basicheader.js', + 'src/core/enumeratorheader.js', + 'src/core/internal/isequal.js', 'src/core/internal/util.js', 'src/core/internal/polyfills.js', @@ -170,6 +172,8 @@ var browsers = [{ 'src/core/license.js', 'src/core/intro.js', 'src/core/basicheader-modern.js', + 'src/core/enumeratorheader.js', + 'src/core/internal/isequal.js', 'src/core/internal/util.js', 'src/core/internal/priorityqueue.js', @@ -292,6 +296,7 @@ var browsers = [{ 'src/core/license.js', 'src/core/intro.js', 'src/core/liteheader.js', + 'src/core/enumeratorheader.js', 'src/core/internal/isequal.js', 'src/core/internal/util.js', @@ -448,6 +453,7 @@ var browsers = [{ 'src/core/license.js', 'src/core/intro.js', 'src/core/liteheader-compat.js', + 'src/core/enumeratorheader.js', 'src/core/internal/isequal.js', 'src/core/internal/util.js', @@ -732,6 +738,7 @@ var browsers = [{ 'src/core/license.js', 'src/core/subintro.js', 'src/core/experimentalheader.js', + 'src/core/enumeratorheader.js', 'src/core/linq/enumerable/while.js', // Enumerable 'src/core/linq/observable/let.js', 'src/core/linq/observable/if.js', // defer, empty diff --git a/bower.json b/bower.json index 17782af7f..431500acf 100644 --- a/bower.json +++ b/bower.json @@ -1,12 +1,13 @@ { "name": "rxjs", - "version": "2.2.15", + "version": "2.2.16", "main": [ "rx.js", "rx.compat.js", "rx.aggregates.js", "rx.async.js", "rx.async.compat.js", + "rx.backpressure.js", "rx.binding.js", "rx.coincidence.js", "rx.experimental.js", diff --git a/package.json b/package.json index 0c60f419c..83f8690d4 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "rx", "title": "Reactive Extensions for JavaScript (RxJS)", "description": "Library for composing asynchronous and event-based operations in JavaScript", - "version": "2.2.15", + "version": "2.2.16", "homepage": "https://github.com/Reactive-Extensions/RxJS", "author": { "name": "Cloud Programmability Team", diff --git a/rx.binding.min.js b/rx.binding.min.js index f3032b92a..d1ab23c9b 100644 --- a/rx.binding.min.js +++ b/rx.binding.min.js @@ -1 +1 @@ -(function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,i=e[typeof module]&&module&&!module.nodeType&&module,o=(i&&i.exports===r&&r,e[typeof global]&&global);!o||o.global!==o&&o.window!==o||(n=o),"function"==typeof define&&define.amd?define(["rx","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n){function r(){if(this.isDisposed)throw Error(m)}var i=n.Observable,o=i.prototype,s=n.AnonymousObservable,u=n.Subject,c=n.AsyncSubject,a=n.Observer,l=n.internals.ScheduledObserver,h=n.Disposable.create,f=n.Disposable.empty,p=n.CompositeDisposable,d=n.Scheduler.currentThread,b=n.internals.inherits,v=n.internals.addProperties,m="Object has been disposed";o.multicast=function(t,e){var n=this;return"function"==typeof t?new s(function(r){var i=n.multicast(t());return new p(e(i).subscribe(r),i.connect())}):new E(n,t)},o.publish=function(t){return t?this.multicast(function(){return new u},t):this.multicast(new u)},o.share=function(){return this.publish(null).refCount()},o.publishLast=function(t){return t?this.multicast(function(){return new c},t):this.multicast(new c)},o.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new w(e)},t):this.multicast(new w(t))},o.shareValue=function(t){return this.publishValue(t).refCount()},o.replay=function(t,e,n,r){return t?this.multicast(function(){return new g(e,n,r)},t):this.multicast(new g(e,n,r))},o.replayWhileObserved=function(t,e,n){return this.replay(null,t,e,n).refCount()};var y=function(t,e){this.subject=t,this.observer=e};y.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var w=n.BehaviorSubject=function(t){function e(t){if(r.call(this),!this.isStopped)return this.observers.push(t),t.onNext(this.value),new y(this,t);var e=this.exception;return e?t.onError(e):t.onCompleted(),f}function n(n){t.call(this,e),this.value=n,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return b(n,t),v(n.prototype,a,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(r.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(r.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,i=e.length;i>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(r.call(this),!this.isStopped){this.value=t;for(var e=this.observers.slice(0),n=0,i=e.length;i>n;n++)e[n].onNext(t)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),n}(i),g=n.ReplaySubject=function(t){function e(t,e){this.subject=t,this.observer=e}function n(t){var n=new l(this.scheduler,t),i=new e(this,n);r.call(this),this._trim(this.scheduler.now()),this.observers.push(n);for(var o=this.q.length,s=0,u=this.q.length;u>s;s++)n.onNext(this.q[s].value);return this.hasError?(o++,n.onError(this.error)):this.isStopped&&(o++,n.onCompleted()),n.ensureActive(o),i}function i(e,r,i){this.bufferSize=null==e?Number.MAX_VALUE:e,this.windowSize=null==r?Number.MAX_VALUE:r,this.scheduler=i||d,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,t.call(this,n)}return e.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1)}},b(i,t),v(i.prototype,a,{hasObservers:function(){return this.observers.length>0},_trim:function(t){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&t-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(t){var e;if(r.call(this),!this.isStopped){var n=this.scheduler.now();this.q.push({interval:n,value:t}),this._trim(n);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)e=i[o],e.onNext(t),e.ensureActive()}},onError:function(t){var e;if(r.call(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;var n=this.scheduler.now();this._trim(n);for(var i=this.observers.slice(0),o=0,s=i.length;s>o;o++)e=i[o],e.onError(t),e.ensureActive();this.observers=[]}},onCompleted:function(){var t;if(r.call(this),!this.isStopped){this.isStopped=!0;var e=this.scheduler.now();this._trim(e);for(var n=this.observers.slice(0),i=0,o=n.length;o>i;i++)t=n[i],t.onCompleted(),t.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),i}(i),E=n.ConnectableObservable=function(t){function e(e,n){function r(t){return i.subject.subscribe(t)}var i={subject:n,source:e.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return i.hasSubscription||(i.hasSubscription=!0,i.subscription=new p(i.source.subscribe(i.subject),h(function(){i.hasSubscription=!1}))),i.subscription},t.call(this,r)}return b(e,t),e.prototype.connect=function(){return this.connect()},e.prototype.refCount=function(){var t=null,e=0,n=this;return new s(function(r){var i,o;return e++,i=1===e,o=n.subscribe(r),i&&(t=n.connect()),h(function(){o.dispose(),e--,0===e&&t.dispose()})})},e}(i);return n}); \ No newline at end of file +(function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,o=e[typeof module]&&module&&!module.nodeType&&module,i=(o&&o.exports===r&&r,e[typeof global]&&global);!i||i.global!==i&&i.window!==i||(n=i),"function"==typeof define&&define.amd?define(["rx","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n){function r(){if(this.isDisposed)throw Error(m)}var o=n.Observable,i=o.prototype,s=n.AnonymousObservable,u=n.Subject,c=n.AsyncSubject,a=n.Observer,l=n.internals.ScheduledObserver,h=n.Disposable.create,f=n.Disposable.empty,p=n.CompositeDisposable,d=n.Scheduler.currentThread,b=n.internals.inherits,v=n.internals.addProperties,m="Object has been disposed";i.multicast=function(t,e){var n=this;return"function"==typeof t?new s(function(r){var o=n.multicast(t());return new p(e(o).subscribe(r),o.connect())}):new E(n,t)},i.publish=function(t){return t?this.multicast(function(){return new u},t):this.multicast(new u)},i.share=function(){return this.publish(null).refCount()},i.publishLast=function(t){return t?this.multicast(function(){return new c},t):this.multicast(new c)},i.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new w(e)},t):this.multicast(new w(t))},i.shareValue=function(t){return this.publishValue(t).refCount()},i.replay=function(t,e,n,r){return t?this.multicast(function(){return new g(e,n,r)},t):this.multicast(new g(e,n,r))},i.replayWhileObserved=function(t,e,n){return this.replay(null,t,e,n).refCount()};var y=function(t,e){this.subject=t,this.observer=e};y.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var w=n.BehaviorSubject=function(t){function e(t){if(r.call(this),!this.isStopped)return this.observers.push(t),t.onNext(this.value),new y(this,t);var e=this.exception;return e?t.onError(e):t.onCompleted(),f}function n(n){t.call(this,e),this.value=n,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return b(n,t),v(n.prototype,a,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(r.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(r.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,o=e.length;o>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(r.call(this),!this.isStopped){this.value=t;for(var e=this.observers.slice(0),n=0,o=e.length;o>n;n++)e[n].onNext(t)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),n}(o),g=n.ReplaySubject=function(t){function e(t,e){this.subject=t,this.observer=e}function n(t){var n=new l(this.scheduler,t),o=new e(this,n);r.call(this),this._trim(this.scheduler.now()),this.observers.push(n);for(var i=this.q.length,s=0,u=this.q.length;u>s;s++)n.onNext(this.q[s].value);return this.hasError?(i++,n.onError(this.error)):this.isStopped&&(i++,n.onCompleted()),n.ensureActive(i),o}function o(e,r,o){this.bufferSize=null==e?Number.MAX_VALUE:e,this.windowSize=null==r?Number.MAX_VALUE:r,this.scheduler=o||d,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,t.call(this,n)}return e.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1)}},b(o,t),v(o.prototype,a,{hasObservers:function(){return this.observers.length>0},_trim:function(t){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&t-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(t){var e;if(r.call(this),!this.isStopped){var n=this.scheduler.now();this.q.push({interval:n,value:t}),this._trim(n);for(var o=this.observers.slice(0),i=0,s=o.length;s>i;i++)e=o[i],e.onNext(t),e.ensureActive()}},onError:function(t){var e;if(r.call(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;var n=this.scheduler.now();this._trim(n);for(var o=this.observers.slice(0),i=0,s=o.length;s>i;i++)e=o[i],e.onError(t),e.ensureActive();this.observers=[]}},onCompleted:function(){var t;if(r.call(this),!this.isStopped){this.isStopped=!0;var e=this.scheduler.now();this._trim(e);for(var n=this.observers.slice(0),o=0,i=n.length;i>o;o++)t=n[o],t.onCompleted(),t.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),o}(o),E=n.ConnectableObservable=function(t){function e(e,n){function r(t){return o.subject.subscribe(t)}var o={subject:n,source:e.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return o.hasSubscription||(o.hasSubscription=!0,o.subscription=new p(o.source.subscribe(o.subject),h(function(){o.hasSubscription=!1}))),o.subscription},t.call(this,r)}return b(e,t),e.prototype.connect=function(){return this.connect()},e.prototype.refCount=function(){var t=null,e=0,n=this;return new s(function(r){var o,i;return e++,o=1===e,i=n.subscribe(r),o&&(t=n.connect()),h(function(){i.dispose(),e--,0===e&&t.dispose()})})},e}(o);return n}); \ No newline at end of file diff --git a/rx.coincidence.min.js b/rx.coincidence.min.js index 6d09819b9..6bddfcbd2 100644 --- a/rx.coincidence.min.js +++ b/rx.coincidence.min.js @@ -1 +1 @@ -(function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,o=e[typeof module]&&module&&!module.nodeType&&module,i=(o&&o.exports===r&&r,e[typeof global]&&global);!i||i.global!==i&&i.window!==i||(n=i),"function"==typeof define&&define.amd?define(["rx","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n,r){function o(){}function i(t){if(false&t)return 2===t;for(var e=Math.sqrt(t),n=3;e>=n;){if(0===t%n)return!1;n+=2}return!0}function s(t){var e,n,r;for(e=0;D.length>e;++e)if(n=D[e],n>=t)return n;for(r=1|t;D[D.length-1]>r;){if(i(r))return r;r+=2}return t}function u(t){var e=757602046;if(!t.length)return e;for(var n=0,r=t.length;r>n;n++){var o=t.charCodeAt(n);e=(e<<5)-e+o,e&=e}return e}function c(t){var e=668265261;return t=61^t^t>>>16,t+=t<<3,t^=t>>>4,t*=e,t^=t>>>15}function a(){return{key:null,value:null,next:0,hashCode:0}}function l(t,e){return t.groupJoin(this,e,function(){return w()},function(t,e){return e})}function h(t){var e=this;return new E(function(n){var r=new y,o=new d,i=new b(o);return n.onNext(x(r,i)),o.add(e.subscribe(function(t){r.onNext(t)},function(t){r.onError(t),n.onError(t)},function(){r.onCompleted(),n.onCompleted()})),o.add(t.subscribe(function(){r.onCompleted(),r=new y,n.onNext(x(r,i))},function(t){r.onError(t),n.onError(t)},function(){r.onCompleted(),n.onCompleted()})),i})}function f(t){var e=this;return new E(function(n){var i,s=new m,u=new d(s),c=new b(u),a=new y;return n.onNext(x(a,c)),u.add(e.subscribe(function(t){a.onNext(t)},function(t){a.onError(t),n.onError(t)},function(){a.onCompleted(),n.onCompleted()})),i=function(){var e,u;try{u=t()}catch(l){return n.onError(l),r}e=new v,s.setDisposable(e),e.setDisposable(u.take(1).subscribe(o,function(t){a.onError(t),n.onError(t)},function(){a.onCompleted(),a=new y,n.onNext(x(a,c)),i()}))},i(),c})}var p=n.Observable,d=n.CompositeDisposable,b=n.RefCountDisposable,v=n.SingleAssignmentDisposable,m=n.SerialDisposable,y=n.Subject,g=p.prototype,w=p.empty,E=n.AnonymousObservable,x=(n.Observer.create,n.internals.addRef),C=n.internals.isEqual,D=[1,3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143,4194301,8388593,16777213,33554393,67108859,134217689,268435399,536870909,1073741789,2147483647],S="no such key",N="duplicate key",A=function(){var t=0;return function(e){if(null==e)throw Error(S);if("string"==typeof e)return u(e);if("number"==typeof e)return c(e);if("boolean"==typeof e)return e===!0?1:0;if(e instanceof Date)return e.getTime();if(e.getHashCode)return e.getHashCode();var n=17*t++;return e.getHashCode=function(){return n},n}}(),_=function(t,e){if(0>t)throw Error("out of range");t>0&&this._initialize(t),this.comparer=e||C,this.freeCount=0,this.size=0,this.freeList=-1};return _.prototype._initialize=function(t){var e,n=s(t);for(this.buckets=Array(n),this.entries=Array(n),e=0;n>e;e++)this.buckets[e]=-1,this.entries[e]=a();this.freeList=-1},_.prototype.count=function(){return this.size},_.prototype.add=function(t,e){return this._insert(t,e,!0)},_.prototype._insert=function(t,e,n){this.buckets||this._initialize(0);for(var o,i=2147483647&A(t),s=i%this.buckets.length,u=this.buckets[s];u>=0;u=this.entries[u].next)if(this.entries[u].hashCode===i&&this.comparer(this.entries[u].key,t)){if(n)throw Error(N);return this.entries[u].value=e,r}this.freeCount>0?(o=this.freeList,this.freeList=this.entries[o].next,--this.freeCount):(this.size===this.entries.length&&(this._resize(),s=i%this.buckets.length),o=this.size,++this.size),this.entries[o].hashCode=i,this.entries[o].next=this.buckets[s],this.entries[o].key=t,this.entries[o].value=e,this.buckets[s]=o},_.prototype._resize=function(){var t=s(2*this.size),e=Array(t);for(r=0;e.length>r;++r)e[r]=-1;var n=Array(t);for(r=0;this.size>r;++r)n[r]=this.entries[r];for(var r=this.size;t>r;++r)n[r]=a();for(var o=0;this.size>o;++o){var i=n[o].hashCode%t;n[o].next=e[i],e[i]=o}this.buckets=e,this.entries=n},_.prototype.remove=function(t){if(this.buckets)for(var e=2147483647&A(t),n=e%this.buckets.length,r=-1,o=this.buckets[n];o>=0;o=this.entries[o].next){if(this.entries[o].hashCode===e&&this.comparer(this.entries[o].key,t))return 0>r?this.buckets[n]=this.entries[o].next:this.entries[r].next=this.entries[o].next,this.entries[o].hashCode=-1,this.entries[o].next=this.freeList,this.entries[o].key=null,this.entries[o].value=null,this.freeList=o,++this.freeCount,!0;r=o}return!1},_.prototype.clear=function(){var t,e;if(!(0>=this.size)){for(t=0,e=this.buckets.length;e>t;++t)this.buckets[t]=-1;for(t=0;this.size>t;++t)this.entries[t]=a();this.freeList=-1,this.size=0}},_.prototype._findEntry=function(t){if(this.buckets)for(var e=2147483647&A(t),n=this.buckets[e%this.buckets.length];n>=0;n=this.entries[n].next)if(this.entries[n].hashCode===e&&this.comparer(this.entries[n].key,t))return n;return-1},_.prototype.count=function(){return this.size-this.freeCount},_.prototype.tryGetValue=function(t){var e=this._findEntry(t);return e>=0?this.entries[e].value:r},_.prototype.getValues=function(){var t=0,e=[];if(this.entries)for(var n=0;this.size>n;n++)this.entries[n].hashCode>=0&&(e[t++]=this.entries[n].value);return e},_.prototype.get=function(t){var e=this._findEntry(t);if(e>=0)return this.entries[e].value;throw Error(S)},_.prototype.set=function(t,e){this._insert(t,e,!1)},_.prototype.containskey=function(t){return this._findEntry(t)>=0},g.join=function(t,e,n,i){var s=this;return new E(function(u){var c=new d,a=!1,l=0,h=new _,f=!1,p=0,b=new _;return c.add(s.subscribe(function(t){var n,s,f,p,d=l++,m=new v;h.add(d,t),c.add(m),s=function(){return h.remove(d)&&0===h.count()&&a&&u.onCompleted(),c.remove(m)};try{n=e(t)}catch(y){return u.onError(y),r}m.setDisposable(n.take(1).subscribe(o,u.onError.bind(u),function(){s()})),p=b.getValues();for(var g=0;p.length>g;g++){try{f=i(t,p[g])}catch(w){return u.onError(w),r}u.onNext(f)}},u.onError.bind(u),function(){a=!0,(f||0===h.count())&&u.onCompleted()})),c.add(t.subscribe(function(t){var e,s,a,l,d=p++,m=new v;b.add(d,t),c.add(m),s=function(){return b.remove(d)&&0===b.count()&&f&&u.onCompleted(),c.remove(m)};try{e=n(t)}catch(y){return u.onError(y),r}m.setDisposable(e.take(1).subscribe(o,u.onError.bind(u),function(){s()})),l=h.getValues();for(var g=0;l.length>g;g++){try{a=i(l[g],t)}catch(y){return u.onError(y),r}u.onNext(a)}},u.onError.bind(u),function(){f=!0,(a||0===b.count())&&u.onCompleted()})),c})},g.groupJoin=function(t,e,n,o){var i=this;return new E(function(s){var u=function(){},c=new d,a=new b(c),l=new _,h=new _,f=0,p=0;return c.add(i.subscribe(function(t){var n=new y,i=f++;l.add(i,n);var p,d,b,m,g;try{g=o(t,x(n,a))}catch(w){for(b=l.getValues(),p=0,d=b.length;d>p;p++)b[p].onError(w);return s.onError(w),r}for(s.onNext(g),m=h.getValues(),p=0,d=m.length;d>p;p++)n.onNext(m[p]);var E=new v;c.add(E);var C,D=function(){l.remove(i)&&n.onCompleted(),c.remove(E)};try{C=e(t)}catch(w){for(b=l.getValues(),p=0,d=l.length;d>p;p++)b[p].onError(w);return s.onError(w),r}E.setDisposable(C.take(1).subscribe(u,function(t){for(b=l.getValues(),p=0,d=b.length;d>p;p++)b[p].onError(t);s.onError(t)},D))},function(t){for(var e=l.getValues(),n=0,r=e.length;r>n;n++)e[n].onError(t);s.onError(t)},s.onCompleted.bind(s))),c.add(t.subscribe(function(t){var e,o,i,a=p++;h.add(a,t);var f=new v;c.add(f);var d,b=function(){h.remove(a),c.remove(f)};try{d=n(t)}catch(m){for(e=l.getValues(),o=0,i=l.length;i>o;o++)e[o].onError(m);return s.onError(m),r}for(f.setDisposable(d.take(1).subscribe(u,function(t){for(e=l.getValues(),o=0,i=l.length;i>o;o++)e[o].onError(t);s.onError(t)},b)),e=l.getValues(),o=0,i=e.length;i>o;o++)e[o].onNext(t)},function(t){for(var e=l.getValues(),n=0,r=e.length;r>n;n++)e[n].onError(t);s.onError(t)})),a})},g.buffer=function(){return this.window.apply(this,arguments).selectMany(function(t){return t.toArray()})},g.window=function(t,e){return 1===arguments.length&&"function"!=typeof arguments[0]?h.call(this,t):"function"==typeof t?f.call(this,t):l.call(this,t,e)},n}); \ No newline at end of file +(function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,o=e[typeof module]&&module&&!module.nodeType&&module,i=(o&&o.exports===r&&r,e[typeof global]&&global);!i||i.global!==i&&i.window!==i||(n=i),"function"==typeof define&&define.amd?define(["rx","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n,r){function o(){}function i(t){if(false&t)return 2===t;for(var e=Math.sqrt(t),n=3;e>=n;){if(0===t%n)return!1;n+=2}return!0}function s(t){var e,n,r;for(e=0;D.length>e;++e)if(n=D[e],n>=t)return n;for(r=1|t;D[D.length-1]>r;){if(i(r))return r;r+=2}return t}function u(t){var e=757602046;if(!t.length)return e;for(var n=0,r=t.length;r>n;n++){var o=t.charCodeAt(n);e=(e<<5)-e+o,e&=e}return e}function c(t){var e=668265261;return t=61^t^t>>>16,t+=t<<3,t^=t>>>4,t*=e,t^=t>>>15}function a(){return{key:null,value:null,next:0,hashCode:0}}function l(t,e){return t.groupJoin(this,e,function(){return g()},function(t,e){return e})}function h(t){var e=this;return new E(function(n){var r=new y,o=new d,i=new b(o);return n.onNext(x(r,i)),o.add(e.subscribe(function(t){r.onNext(t)},function(t){r.onError(t),n.onError(t)},function(){r.onCompleted(),n.onCompleted()})),o.add(t.subscribe(function(){r.onCompleted(),r=new y,n.onNext(x(r,i))},function(t){r.onError(t),n.onError(t)},function(){r.onCompleted(),n.onCompleted()})),i})}function f(t){var e=this;return new E(function(n){var i,s=new m,u=new d(s),c=new b(u),a=new y;return n.onNext(x(a,c)),u.add(e.subscribe(function(t){a.onNext(t)},function(t){a.onError(t),n.onError(t)},function(){a.onCompleted(),n.onCompleted()})),i=function(){var e,u;try{u=t()}catch(l){return n.onError(l),r}e=new v,s.setDisposable(e),e.setDisposable(u.take(1).subscribe(o,function(t){a.onError(t),n.onError(t)},function(){a.onCompleted(),a=new y,n.onNext(x(a,c)),i()}))},i(),c})}var p=n.Observable,d=n.CompositeDisposable,b=n.RefCountDisposable,v=n.SingleAssignmentDisposable,m=n.SerialDisposable,y=n.Subject,w=p.prototype,g=p.empty,E=n.AnonymousObservable,x=(n.Observer.create,n.internals.addRef),C=n.internals.isEqual,D=[1,3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143,4194301,8388593,16777213,33554393,67108859,134217689,268435399,536870909,1073741789,2147483647],S="no such key",A="duplicate key",N=function(){var t=0;return function(e){if(null==e)throw Error(S);if("string"==typeof e)return u(e);if("number"==typeof e)return c(e);if("boolean"==typeof e)return e===!0?1:0;if(e instanceof Date)return e.getTime();if(e.getHashCode)return e.getHashCode();var n=17*t++;return e.getHashCode=function(){return n},n}}(),_=function(t,e){if(0>t)throw Error("out of range");t>0&&this._initialize(t),this.comparer=e||C,this.freeCount=0,this.size=0,this.freeList=-1};return _.prototype._initialize=function(t){var e,n=s(t);for(this.buckets=Array(n),this.entries=Array(n),e=0;n>e;e++)this.buckets[e]=-1,this.entries[e]=a();this.freeList=-1},_.prototype.count=function(){return this.size},_.prototype.add=function(t,e){return this._insert(t,e,!0)},_.prototype._insert=function(t,e,n){this.buckets||this._initialize(0);for(var o,i=2147483647&N(t),s=i%this.buckets.length,u=this.buckets[s];u>=0;u=this.entries[u].next)if(this.entries[u].hashCode===i&&this.comparer(this.entries[u].key,t)){if(n)throw Error(A);return this.entries[u].value=e,r}this.freeCount>0?(o=this.freeList,this.freeList=this.entries[o].next,--this.freeCount):(this.size===this.entries.length&&(this._resize(),s=i%this.buckets.length),o=this.size,++this.size),this.entries[o].hashCode=i,this.entries[o].next=this.buckets[s],this.entries[o].key=t,this.entries[o].value=e,this.buckets[s]=o},_.prototype._resize=function(){var t=s(2*this.size),e=Array(t);for(r=0;e.length>r;++r)e[r]=-1;var n=Array(t);for(r=0;this.size>r;++r)n[r]=this.entries[r];for(var r=this.size;t>r;++r)n[r]=a();for(var o=0;this.size>o;++o){var i=n[o].hashCode%t;n[o].next=e[i],e[i]=o}this.buckets=e,this.entries=n},_.prototype.remove=function(t){if(this.buckets)for(var e=2147483647&N(t),n=e%this.buckets.length,r=-1,o=this.buckets[n];o>=0;o=this.entries[o].next){if(this.entries[o].hashCode===e&&this.comparer(this.entries[o].key,t))return 0>r?this.buckets[n]=this.entries[o].next:this.entries[r].next=this.entries[o].next,this.entries[o].hashCode=-1,this.entries[o].next=this.freeList,this.entries[o].key=null,this.entries[o].value=null,this.freeList=o,++this.freeCount,!0;r=o}return!1},_.prototype.clear=function(){var t,e;if(!(0>=this.size)){for(t=0,e=this.buckets.length;e>t;++t)this.buckets[t]=-1;for(t=0;this.size>t;++t)this.entries[t]=a();this.freeList=-1,this.size=0}},_.prototype._findEntry=function(t){if(this.buckets)for(var e=2147483647&N(t),n=this.buckets[e%this.buckets.length];n>=0;n=this.entries[n].next)if(this.entries[n].hashCode===e&&this.comparer(this.entries[n].key,t))return n;return-1},_.prototype.count=function(){return this.size-this.freeCount},_.prototype.tryGetValue=function(t){var e=this._findEntry(t);return e>=0?this.entries[e].value:r},_.prototype.getValues=function(){var t=0,e=[];if(this.entries)for(var n=0;this.size>n;n++)this.entries[n].hashCode>=0&&(e[t++]=this.entries[n].value);return e},_.prototype.get=function(t){var e=this._findEntry(t);if(e>=0)return this.entries[e].value;throw Error(S)},_.prototype.set=function(t,e){this._insert(t,e,!1)},_.prototype.containskey=function(t){return this._findEntry(t)>=0},w.join=function(t,e,n,i){var s=this;return new E(function(u){var c=new d,a=!1,l=0,h=new _,f=!1,p=0,b=new _;return c.add(s.subscribe(function(t){var n,s,f,p,d=l++,m=new v;h.add(d,t),c.add(m),s=function(){return h.remove(d)&&0===h.count()&&a&&u.onCompleted(),c.remove(m)};try{n=e(t)}catch(y){return u.onError(y),r}m.setDisposable(n.take(1).subscribe(o,u.onError.bind(u),function(){s()})),p=b.getValues();for(var w=0;p.length>w;w++){try{f=i(t,p[w])}catch(g){return u.onError(g),r}u.onNext(f)}},u.onError.bind(u),function(){a=!0,(f||0===h.count())&&u.onCompleted()})),c.add(t.subscribe(function(t){var e,s,a,l,d=p++,m=new v;b.add(d,t),c.add(m),s=function(){return b.remove(d)&&0===b.count()&&f&&u.onCompleted(),c.remove(m)};try{e=n(t)}catch(y){return u.onError(y),r}m.setDisposable(e.take(1).subscribe(o,u.onError.bind(u),function(){s()})),l=h.getValues();for(var w=0;l.length>w;w++){try{a=i(l[w],t)}catch(y){return u.onError(y),r}u.onNext(a)}},u.onError.bind(u),function(){f=!0,(a||0===b.count())&&u.onCompleted()})),c})},w.groupJoin=function(t,e,n,o){var i=this;return new E(function(s){var u=function(){},c=new d,a=new b(c),l=new _,h=new _,f=0,p=0;return c.add(i.subscribe(function(t){var n=new y,i=f++;l.add(i,n);var p,d,b,m,w;try{w=o(t,x(n,a))}catch(g){for(b=l.getValues(),p=0,d=b.length;d>p;p++)b[p].onError(g);return s.onError(g),r}for(s.onNext(w),m=h.getValues(),p=0,d=m.length;d>p;p++)n.onNext(m[p]);var E=new v;c.add(E);var C,D=function(){l.remove(i)&&n.onCompleted(),c.remove(E)};try{C=e(t)}catch(g){for(b=l.getValues(),p=0,d=l.length;d>p;p++)b[p].onError(g);return s.onError(g),r}E.setDisposable(C.take(1).subscribe(u,function(t){for(b=l.getValues(),p=0,d=b.length;d>p;p++)b[p].onError(t);s.onError(t)},D))},function(t){for(var e=l.getValues(),n=0,r=e.length;r>n;n++)e[n].onError(t);s.onError(t)},s.onCompleted.bind(s))),c.add(t.subscribe(function(t){var e,o,i,a=p++;h.add(a,t);var f=new v;c.add(f);var d,b=function(){h.remove(a),c.remove(f)};try{d=n(t)}catch(m){for(e=l.getValues(),o=0,i=l.length;i>o;o++)e[o].onError(m);return s.onError(m),r}for(f.setDisposable(d.take(1).subscribe(u,function(t){for(e=l.getValues(),o=0,i=l.length;i>o;o++)e[o].onError(t);s.onError(t)},b)),e=l.getValues(),o=0,i=e.length;i>o;o++)e[o].onNext(t)},function(t){for(var e=l.getValues(),n=0,r=e.length;r>n;n++)e[n].onError(t);s.onError(t)})),a})},w.buffer=function(){return this.window.apply(this,arguments).selectMany(function(t){return t.toArray()})},w.window=function(t,e){return 1===arguments.length&&"function"!=typeof arguments[0]?h.call(this,t):"function"==typeof t?f.call(this,t):l.call(this,t,e)},n}); \ No newline at end of file diff --git a/rx.compat.js b/rx.compat.js index 43aa21a71..e986f7ad6 100644 --- a/rx.compat.js +++ b/rx.compat.js @@ -23,36 +23,33 @@ var Rx = { internals: {}, config: {} }; - // Defaults - function noop() { } - function identity(x) { return x; } - var defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()); - function defaultComparer(x, y) { return isEqual(x, y); } - function defaultSubComparer(x, y) { return x - y; } - function defaultKeySerializer(x) { return x.toString(); } - function defaultError(err) { throw err; } - function isPromise(p) { return typeof p.then === 'function'; } - - // Errors - var sequenceContainsNoElements = 'Sequence contains no elements.'; - var argumentOutOfRange = 'Argument out of range'; - var objectDisposed = 'Object has been disposed'; - function checkDisposed() { - if (this.isDisposed) { - throw new Error(objectDisposed); - } - } + // Defaults + function noop() { } + function identity(x) { return x; } + var defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()); + function defaultComparer(x, y) { return isEqual(x, y); } + function defaultSubComparer(x, y) { return x - y; } + function defaultKeySerializer(x) { return x.toString(); } + function defaultError(err) { throw err; } + function isPromise(p) { return typeof p.then === 'function' && typeof p.subscribe === 'undefined'; } + + // Errors + var sequenceContainsNoElements = 'Sequence contains no elements.'; + var argumentOutOfRange = 'Argument out of range'; + var objectDisposed = 'Object has been disposed'; + function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } } + + // Shim in iterator support + var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) || + '_es6shim_iterator_'; + // Firefox ships a partial implementation using the name @@iterator. + // https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14 + // So use that name if we detect it. + if (root.Set && typeof new root.Set()['@@iterator'] === 'function') { + $iterator$ = '@@iterator'; + } + var doneEnumerator = { done: true, value: undefined }; - // Shim in iterator support - var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) || - '_es6shim_iterator_'; - // Firefox ships a partial implementation using the name @@iterator. - // https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14 - // So use that name if we detect it. - if (window.Set && typeof new window.Set()['@@iterator'] === 'function') { - $iterator$ = '@@iterator'; - } - /** `Object#toString` result shortcuts */ var argsClass = '[object Arguments]', arrayClass = '[object Array]', @@ -1640,155 +1637,143 @@ }; }()); - /** - * @constructor - * @private - */ - var Enumerator = Rx.internals.Enumerator = function (moveNext, getCurrent) { - this.moveNext = moveNext; - this.getCurrent = getCurrent; - }; + var Enumerator = Rx.internals.Enumerator = function (next) { + this._next = next; + }; - /** - * @static - * @memberOf Enumerator - * @private - */ - var enumeratorCreate = Enumerator.create = function (moveNext, getCurrent) { - var done = false; - return new Enumerator(function () { - if (done) { - return false; - } - var result = moveNext(); - if (!result) { - done = true; - } - return result; - }, function () { return getCurrent(); }); - }; - - var Enumerable = Rx.internals.Enumerable = function (getEnumerator) { - this.getEnumerator = getEnumerator; - }; + Enumerator.prototype.next = function () { + return this._next(); + }; - Enumerable.prototype.concat = function () { - var sources = this; - return new AnonymousObservable(function (observer) { - var e = sources.getEnumerator(), isDisposed, subscription = new SerialDisposable(); - var cancelable = immediateScheduler.scheduleRecursive(function (self) { - var current, hasNext; - if (isDisposed) { return; } + Enumerator.prototype[$iterator$] = function () { return this; } - try { - hasNext = e.moveNext(); - if (hasNext) { - current = e.getCurrent(); - } - } catch (ex) { - observer.onError(ex); - return; - } + var Enumerable = Rx.internals.Enumerable = function (iterator) { + this._iterator = iterator; + }; - if (!hasNext) { - observer.onCompleted(); - return; - } + Enumerable.prototype[$iterator$] = function () { + return this._iterator(); + }; - var d = new SingleAssignmentDisposable(); - subscription.setDisposable(d); - d.setDisposable(current.subscribe( - observer.onNext.bind(observer), - observer.onError.bind(observer), - function () { self(); }) - ); - }); - return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { - isDisposed = true; - })); - }); - }; + Enumerable.prototype.concat = function () { + var sources = this; + return new AnonymousObservable(function (observer) { + var e; + try { + e = sources[$iterator$](); + } catch(err) { + observer.onError(); + return; + } - Enumerable.prototype.catchException = function () { - var sources = this; - return new AnonymousObservable(function (observer) { - var e = sources.getEnumerator(), isDisposed, lastException; - var subscription = new SerialDisposable(); - var cancelable = immediateScheduler.scheduleRecursive(function (self) { - var current, hasNext; - if (isDisposed) { return; } + var isDisposed, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursive(function (self) { + var currentItem; + if (isDisposed) { return; } - try { - hasNext = e.moveNext(); - if (hasNext) { - current = e.getCurrent(); - } - } catch (ex) { - observer.onError(ex); - return; - } + try { + currentItem = e.next(); + } catch (ex) { + observer.onError(ex); + return; + } - if (!hasNext) { - if (lastException) { - observer.onError(lastException); - } else { - observer.onCompleted(); - } - return; - } + if (currentItem.done) { + observer.onCompleted(); + return; + } - var d = new SingleAssignmentDisposable(); - subscription.setDisposable(d); - d.setDisposable(current.subscribe( - observer.onNext.bind(observer), - function (exn) { - lastException = exn; - self(); - }, - observer.onCompleted.bind(observer))); - }); - return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { - isDisposed = true; - })); + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(currentItem.value.subscribe( + observer.onNext.bind(observer), + observer.onError.bind(observer), + function () { self(); }) + ); }); - }; + return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { + isDisposed = true; + })); + }); + }; + + Enumerable.prototype.catchException = function () { + var sources = this; + return new AnonymousObservable(function (observer) { + var e; + try { + e = sources[$iterator$](); + } catch(err) { + observer.onError(); + return; + } - var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) { - if (arguments.length === 1) { - repeatCount = -1; + var isDisposed, + lastException, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursive(function (self) { + if (isDisposed) { return; } + + var currentItem; + try { + currentItem = e.next(); + } catch (ex) { + observer.onError(ex); + return; } - return new Enumerable(function () { - var current, left = repeatCount; - return enumeratorCreate(function () { - if (left === 0) { - return false; - } - if (left > 0) { - left--; - } - current = value; - return true; - }, function () { return current; }); - }); - }; - var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) { - selector || (selector = identity); - return new Enumerable(function () { - var current, index = -1; - return enumeratorCreate( - function () { - if (++index < source.length) { - current = selector.call(thisArg, source[index], index, source); - return true; - } - return false; - }, - function () { return current; } - ); + if (currentItem.done) { + if (lastException) { + observer.onError(lastException); + } else { + observer.onCompleted(); + } + return; + } + + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(currentItem.value.subscribe( + observer.onNext.bind(observer), + function (exn) { + lastException = exn; + self(); + }, + observer.onCompleted.bind(observer))); + }); + return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { + isDisposed = true; + })); + }); + }; + + + var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) { + if (repeatCount == null) { repeatCount = -1; } + return new Enumerable(function () { + var left = repeatCount; + return new Enumerator(function () { + if (left === 0) { return doneEnumerator; } + if (left > 0) { left--; } + return { done: false, value: value }; + }); + }); + }; + + var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) { + selector || (selector = identity); + return new Enumerable(function () { + var index = -1; + return new Enumerator( + function () { + return ++index < source.length ? + { done: false, value: selector.call(thisArg, source[index], index, source) } : + doneEnumerator; }); - }; + }); + }; /** * Supports push-style iteration over an observable sequence. @@ -2384,8 +2369,8 @@ * Converts an iterable into an Observable sequence * * @example - * var res = Rx.Observable.fromGenerator(new Map()); - * var res = Rx.Observable.fromArray(new Set(), Rx.Scheduler.timeout); + * var res = Rx.Observable.fromIterable(new Map()); + * var res = Rx.Observable.fromIterable(new Set(), Rx.Scheduler.timeout); * @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on. * @returns {Observable} The observable sequence whose elements are pulled from the given generator sequence. */ diff --git a/rx.compat.min.js b/rx.compat.min.js index dac2c1517..b0b91d97b 100644 --- a/rx.compat.min.js +++ b/rx.compat.min.js @@ -1,2 +1,2 @@ -(function(t){function e(){}function n(t){return t}function r(t,e){return ne(t,e)}function i(t,e){return t-e}function o(t){return""+t}function s(t){throw t}function u(t){return"function"==typeof t.then}function c(){if(this.isDisposed)throw Error(k)}function a(t){var e=typeof t;return t&&("function"==e||"object"==e)||!1}function h(t){var e=[];if(!a(t))return e;ee.nonEnumArgs&&t.length&&d(t)&&(t=re.call(t));var n=ee.enumPrototypes&&"function"==typeof t,r=ee.enumErrorProps&&(t===J||t instanceof Error);for(var i in t)n&&"prototype"==i||r&&("message"==i||"name"==i)||e.push(i);if(ee.nonEnumShadows&&t!==K){var o=t.constructor,s=-1,u=Z.length;if(t===(o&&o.prototype))var c=t===stringProto?H:t===J?z:$.call(t),h=te[c];for(;u>++s;)i=Z[s],h&&h[i]||!Q.call(t,i)||e.push(i)}return e}function f(t,e,n){for(var r=-1,i=n(t),o=i.length;o>++r;){var s=i[r];if(e(t[s],s,t)===!1)break}return t}function l(t,e){return f(t,e,h)}function p(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function d(t){return t&&"object"==typeof t?$.call(t)==T:!1}function b(t){return"function"==typeof t}function v(e,n,r,i){if(e===n)return 0!==e||1/e==1/n;var o=typeof e,s=typeof n;if(e===e&&(null==e||null==n||"function"!=o&&"object"!=o&&"function"!=s&&"object"!=s))return!1;var u=$.call(e),c=$.call(n);if(u==T&&(u=F),c==T&&(c=F),u!=c)return!1;switch(u){case L:case I:return+e==+n;case B:return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case U:case H:return e==n+""}var a=u==M;if(!a){if(u!=F||!ee.nodeClass&&(p(e)||p(n)))return!1;var h=!ee.argsObject&&d(e)?Object:e.constructor,f=!ee.argsObject&&d(n)?Object:n.constructor;if(!(h==f||Q.call(e,"constructor")&&Q.call(n,"constructor")||b(h)&&h instanceof h&&b(f)&&f instanceof f||!("constructor"in e&&"constructor"in n)))return!1}r||(r=[]),i||(i=[]);for(var m=r.length;m--;)if(r[m]==e)return i[m]==n;var y=0;if(result=!0,r.push(e),i.push(n),a){if(m=e.length,y=n.length,result=y==m)for(;y--;){var g=n[y];if(!(result=v(e[y],g,r,i)))break}}else l(n,function(n,o,s){return Q.call(s,o)?(y++,result=Q.call(e,o)&&v(e[o],n,r,i)):t}),result&&l(e,function(e,n,r){return Q.call(r,n)?result=--y>-1:t});return r.pop(),i.pop(),result}function m(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:re.call(t)}function y(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function g(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function w(e,n){return new on(function(r){var i=new ye,o=new ge;return o.setDisposable(i),i.setDisposable(e.subscribe(r.onNext.bind(r),function(e){var i,s;try{s=n(e)}catch(u){return r.onError(u),t}i=new ye,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function E(e,n){var r=this;return new on(function(i){var o=0,s=e.length;return r.subscribe(function(r){if(s>o){var u,c=e[o++];try{u=n(r,c)}catch(a){return i.onError(a),t}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function x(t){return this.select(function(e,n){var r=t(e,n);return u(r)?Qe(r):r}).mergeObservable()}var C={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},D=C[typeof window]&&window||this,A=C[typeof exports]&&exports&&!exports.nodeType&&exports,S=C[typeof module]&&module&&!module.nodeType&&module,_=S&&S.exports===A&&A,N=C[typeof global]&&global;!N||N.global!==N&&N.window!==N||(D=N);var O={internals:{},config:{}},R=function(){return Date.now?Date.now:function(){return+new Date}}(),W="Sequence contains no elements.",j="Argument out of range",k="Object has been disposed",P="object"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";window.Set&&"function"==typeof(new window.Set)["@@iterator"]&&(P="@@iterator");var q,T="[object Arguments]",M="[object Array]",L="[object Boolean]",I="[object Date]",z="[object Error]",V="[object Function]",B="[object Number]",F="[object Object]",U="[object RegExp]",H="[object String]",$=Object.prototype.toString,Q=Object.prototype.hasOwnProperty,G=$.call(arguments)==T,J=Error.prototype,K=Object.prototype,X=K.propertyIsEnumerable;try{q=!($.call(document)==F&&!({toString:0}+""))}catch(Y){q=!0}var Z=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],te={};te[M]=te[I]=te[B]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},te[L]=te[H]={constructor:!0,toString:!0,valueOf:!0},te[z]=te[V]=te[U]={constructor:!0,toString:!0},te[F]={constructor:!0};var ee={};(function(){var t=function(){this.x=1},e=[];t.prototype={valueOf:1,y:1};for(var n in new t)e.push(n);for(n in arguments);ee.enumErrorProps=X.call(J,"message")||X.call(J,"name"),ee.enumPrototypes=X.call(t,"prototype"),ee.nonEnumArgs=0!=n,ee.nonEnumShadows=!/valueOf/.test(e)})(1),G||(d=function(t){return t&&"object"==typeof t?Q.call(t,"callee"):!1}),b(/x/)&&(b=function(t){return"function"==typeof t&&$.call(t)==V});var ne=O.internals.isEqual=function(t,e){return v(t,e,[],[])},re=Array.prototype.slice;({}).hasOwnProperty;var ie=this.inherits=O.internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},oe=O.internals.addProperties=function(t){for(var e=re.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},se=O.internals.addRef=function(t,e){return new on(function(n){return new le(e.getDisposable(),t.subscribe(n))})};Function.prototype.bind||(Function.prototype.bind=function(t){var e=this,n=re.call(arguments,1),r=function(){function i(){}if(this instanceof r){i.prototype=e.prototype;var o=new i,s=e.apply(o,n.concat(re.call(arguments)));return Object(s)===s?s:o}return e.apply(t,n.concat(re.call(arguments)))};return r});var ue=Object("a"),ce="a"!=ue[0]||!(0 in ue);Array.prototype.every||(Array.prototype.every=function(t){var e=Object(this),n=ce&&{}.toString.call(this)==H?this.split(""):e,r=n.length>>>0,i=arguments[1];if({}.toString.call(t)!=V)throw new TypeError(t+" is not a function");for(var o=0;r>o;o++)if(o in n&&!t.call(i,n[o],o,e))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(t){var e=Object(this),n=ce&&{}.toString.call(this)==H?this.split(""):e,r=n.length>>>0,i=Array(r),o=arguments[1];if({}.toString.call(t)!=V)throw new TypeError(t+" is not a function");for(var s=0;r>s;s++)s in n&&(i[s]=t.call(o,n[s],s,e));return i}),Array.prototype.filter||(Array.prototype.filter=function(t){for(var e,n=[],r=Object(this),i=0,o=r.length>>>0;o>i;i++)e=r[i],i in r&&t.call(arguments[1],e,i,r)&&n.push(e);return n}),Array.isArray||(Array.isArray=function(t){return Object.prototype.toString.call(t)==M}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=Object(this),n=e.length>>>0;if(0===n)return-1;var r=0;if(arguments.length>1&&(r=Number(arguments[1]),r!==r?r=0:0!==r&&1/0!=r&&r!==-1/0&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=n)return-1;for(var i=r>=0?r:Math.max(n-Math.abs(r),0);n>i;i++)if(i in e&&e[i]===t)return i;return-1});var ae=function(t,e){this.id=t,this.value=e};ae.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var he=O.internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},fe=he.prototype;fe.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},fe.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},fe.heapify=function(e){if(e===t&&(e=0),!(e>=this.length||0>e)){var n=2*e+1,r=2*e+2,i=e;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==e){var o=this.items[e];this.items[e]=this.items[i],this.items[i]=o,this.heapify(i)}}},fe.peek=function(){return this.items[0].value},fe.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},fe.dequeue=function(){var t=this.peek();return this.removeAt(0),t},fe.enqueue=function(t){var e=this.length++;this.items[e]=new ae(he.count++,t),this.percolate(e)},fe.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},he.count=0;var le=O.CompositeDisposable=function(){this.disposables=m(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},pe=le.prototype;pe.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},pe.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},pe.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},pe.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},pe.contains=function(t){return-1!==this.disposables.indexOf(t)},pe.toArray=function(){return this.disposables.slice(0)};var de=O.Disposable=function(t){this.isDisposed=!1,this.action=t||e};de.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var be=de.create=function(t){return new de(t)},ve=de.empty={dispose:e},me=function(){function t(t){this.isSingle=t,this.isDisposed=!1,this.current=null}var e=t.prototype;return e.getDisposable=function(){return this.current},e.setDisposable=function(t){if(this.current&&this.isSingle)throw Error("Disposable has already been assigned");var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},e.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()},t}(),ye=O.SingleAssignmentDisposable=function(t){function e(){t.call(this,!0)}return ie(e,t),e}(me),ge=O.SerialDisposable=function(t){function e(){t.call(this,!1)}return ie(e,t),e}(me),we=O.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?ve:new t(this)},e}();g.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})};var Ee=O.internals.ScheduledItem=function(t,e,n,r,o){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=o||i,this.disposable=new ye};Ee.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Ee.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},Ee.prototype.isCancelled=function(){return this.disposable.isDisposed},Ee.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var xe=O.Scheduler=function(){function t(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function e(t,e){var n=e.first,r=e.second,i=new le,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),ve});r||(i.add(s),n=!0)})};return o(n),i}function n(t,e,n){var r=e.first,i=e.second,o=new le,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),ve});u||(o.add(c),i=!0)})};return s(r),o}function r(t,e){return e(),ve}var i=t.prototype;return i.catchException=i["catch"]=function(t){return new Ne(this,t)},i.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},i.schedulePeriodicWithState=function(t,e,n){var r=t,i=setInterval(function(){r=n(r)},e);return be(function(){clearInterval(i)})},i.schedule=function(t){return this._schedule(t,r)},i.scheduleWithState=function(t,e){return this._schedule(t,e)},i.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,r)},i.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},i.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,r)},i.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},i.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},i.scheduleRecursiveWithState=function(t,n){return this.scheduleWithState({first:t,second:n},function(t,n){return e(t,n)})},i.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithRelativeAndState=function(t,e,r){return this._scheduleRelative({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithRelativeAndState")})},i.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithAbsoluteAndState=function(t,e,r){return this._scheduleAbsolute({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithAbsoluteAndState")})},t.now=R,t.normalize=function(t){return 0>t&&(t=0),t},t}(),Ce=xe.normalize;O.internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new ye;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();var De,Ae=xe.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){for(var r=Ce(r);r-this.now()>0;);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new xe(R,t,e,n)}(),Se=xe.currentThread=function(){function t(t){for(var e;t.length>0;)if(e=t.dequeue(),!e.isCancelled()){for(;e.dueTime-xe.now()>0;);e.isCancelled()||e.invoke()}}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o=this.now()+xe.normalize(n),s=new Ee(this,e,r,o);if(i)i.enqueue(s);else{i=new he(4),i.enqueue(s);try{t(i)}catch(u){throw u}finally{i=null}}return s.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i,o=new xe(R,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}(),_e=e;(function(){function t(){if(!D.postMessage||D.importScripts)return!1;var t=!1,e=D.onmessage;return D.onmessage=function(){t=!0},D.postMessage("","*"),D.onmessage=e,t}function e(t){if("string"==typeof t.data&&t.data.substring(0,o.length)===o){var e=t.data.substring(o.length),n=s[e];n(),delete s[e]}}var n=RegExp("^"+($+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),r="function"==typeof(r=N&&_&&N.setImmediate)&&!n.test(r)&&r,i="function"==typeof(i=N&&_&&N.clearImmediate)&&!n.test(i)&&i;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))De=process.nextTick;else if("function"==typeof r)De=r,_e=i;else if(t()){var o="ms.rx.schedule"+Math.random(),s={},u=0;D.addEventListener?D.addEventListener("message",e,!1):D.attachEvent("onmessage",e,!1),De=function(t){var e=u++;s[e]=t,D.postMessage(o+e,"*")}}else if(D.MessageChannel){var c=new D.MessageChannel,a={},h=0;c.port1.onmessage=function(t){var e=t.data,n=a[e];n(),delete a[e]},De=function(t){var e=h++;a[e]=t,c.port2.postMessage(e)}}else"document"in D&&"onreadystatechange"in D.document.createElement("script")?De=function(t){var e=D.document.createElement("script");e.onreadystatechange=function(){t(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},D.document.documentElement.appendChild(e)}:(De=function(t){return setTimeout(t,0)},_e=clearTimeout)})(),xe.timeout=function(){function t(t,e){var n=this,r=new ye,i=De(function(){r.isDisposed||r.setDisposable(e(n,t))});return new le(r,be(function(){_e(i)}))}function e(t,e,n){var r=this,i=xe.normalize(e);if(0===i)return r.scheduleWithState(t,n);var o=new ye,s=setTimeout(function(){o.isDisposed||o.setDisposable(n(r,t))},i);return new le(o,be(function(){clearTimeout(s)}))}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new xe(R,t,e,n)}();var Ne=function(t){function e(){return this._scheduler.now()}function n(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,n){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(n))}function i(t,e,n){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(n))}function o(o,s){this._scheduler=o,this._handler=s,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,e,n,r,i)}return ie(o,t),o.prototype._clone=function(t){return new o(t,this._handler)},o.prototype._wrap=function(t){var e=this;return function(n,r){try{return t(e._getRecursiveWrapper(n),r)}catch(i){if(!e._handler(i))throw i;return ve}}},o.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},o.prototype.schedulePeriodicWithState=function(t,e,n){var r=this,i=!1,o=new ye;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return n(t)}catch(e){if(i=!0,!r._handler(e))throw e;return o.dispose(),null}})),o},o}(xe),Oe=O.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t||(t=Ae),new on(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),Re=Oe.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new Oe("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),We=Oe.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new Oe("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),je=Oe.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new Oe("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),ke=O.internals.Enumerator=function(t,e){this.moveNext=t,this.getCurrent=e},Pe=ke.create=function(t,e){var n=!1;return new ke(function(){if(n)return!1;var e=t();return e||(n=!0),e},function(){return e()})},qe=O.internals.Enumerable=function(t){this.getEnumerator=t};qe.prototype.concat=function(){var e=this;return new on(function(n){var r,i=e.getEnumerator(),o=new ge,s=Ae.scheduleRecursive(function(e){var s,u;if(!r){try{u=i.moveNext(),u&&(s=i.getCurrent())}catch(c){return n.onError(c),t}if(!u)return n.onCompleted(),t;var a=new ye;o.setDisposable(a),a.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){e()}))}});return new le(o,s,be(function(){r=!0}))})},qe.prototype.catchException=function(){var e=this;return new on(function(n){var r,i,o=e.getEnumerator(),s=new ge,u=Ae.scheduleRecursive(function(e){var u,c;if(!r){try{c=o.moveNext(),c&&(u=o.getCurrent())}catch(a){return n.onError(a),t}if(!c)return i?n.onError(i):n.onCompleted(),t;var h=new ye;s.setDisposable(h),h.setDisposable(u.subscribe(n.onNext.bind(n),function(t){i=t,e()},n.onCompleted.bind(n)))}});return new le(s,u,be(function(){r=!0}))})};var Te=qe.repeat=function(t,e){return 1===arguments.length&&(e=-1),new qe(function(){var n,r=e;return Pe(function(){return 0===r?!1:(r>0&&r--,n=t,!0)},function(){return n})})},Me=qe.forEach=function(t,e,r){return e||(e=n),new qe(function(){var n,i=-1;return Pe(function(){return++i0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var r;if(!(n.queue.length>0))return n.isAcquired=!1,t;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}e()}))},n.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},n}(Ve),He=function(t){function e(){t.apply(this,arguments)}return ie(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e}(Ue),$e=O.Observable=function(){function t(t){this._subscribe=t}return ze=t.prototype,ze.finalValue=function(){var t=this;return new on(function(e){var n,r=!1;return t.subscribe(function(t){r=!0,n=t},e.onError.bind(e),function(){r?(e.onNext(n),e.onCompleted()):e.onError(Error(W))})})},ze.subscribe=ze.forEach=function(t,e,n){var r;return r="object"==typeof t?t:Ie(t,e,n),this._subscribe(r)},ze.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();ze.observeOn=function(t){var e=this;return new on(function(n){return e.subscribe(new He(t,n))})},ze.subscribeOn=function(t){var e=this;return new on(function(n){var r=new ye,i=new ge;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new g(t,e.subscribe(n)))})),i})};var Qe=$e.fromPromise=function(t){return new on(function(e){t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)})})};ze.toPromise=function(t){if(t||(t=O.config.Promise),!t)throw Error("Promise type not provided nor in Rx.config.Promise");var e=this;return new t(function(t,n){var r,i=!1;e.subscribe(function(t){r=t,i=!0},function(t){n(t)},function(){i&&t(r)})})},$e.create=$e.createWithDisposable=function(t){return new on(t)},$e.defer=function(t){return new on(function(e){var n;try{n=t()}catch(r){return Ye(r).subscribe(e)}return n.subscribe(e)})};var Ge=$e.empty=function(t){return t||(t=Ae),new on(function(e){return t.schedule(function(){e.onCompleted()})})},Je=$e.fromArray=function(t,e){return e||(e=Se),new on(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};$e.fromIterable=function(e,n){return n||(n=Se),new on(function(r){var i;try{i=e[P]()}catch(o){return r.onError(o),t}return n.scheduleRecursive(function(e){var n;try{n=i.next()}catch(o){return r.onError(o),t}n.done?r.onCompleted():(r.onNext(n.value),e())})})},$e.generate=function(e,n,r,i,o){return o||(o=Se),new on(function(s){var u=!0,c=e;return o.scheduleRecursive(function(e){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(h){return s.onError(h),t}o?(s.onNext(a),e()):s.onCompleted()})})};var Ke=$e.never=function(){return new on(function(){return ve})};$e.range=function(t,e,n){return n||(n=Se),new on(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},$e.repeat=function(t,e,n){return n||(n=Se),null==e&&(e=-1),Xe(t,n).repeat(e)};var Xe=$e["return"]=$e.returnValue=function(t,e){return e||(e=Ae),new on(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Ye=$e["throw"]=$e.throwException=function(t,e){return e||(e=Ae),new on(function(n){return e.schedule(function(){n.onError(t)})})};$e.using=function(t,e){return new on(function(n){var r,i,o=ve;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new le(Ye(s).subscribe(n),o)}return new le(i.subscribe(n),o)})},ze.amb=function(t){var e=this;return new on(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new ye,a=new ye;return c.setDisposable(e.subscribe(function(t){r(),o===s&&n.onNext(t)},function(t){r(),o===s&&n.onError(t)},function(){r(),o===s&&n.onCompleted()})),a.setDisposable(t.subscribe(function(t){i(),o===u&&n.onNext(t)},function(t){i(),o===u&&n.onError(t)},function(){i(),o===u&&n.onCompleted()})),new le(c,a)})},$e.amb=function(){function t(t,e){return t.amb(e)}for(var e=Ke(),n=m(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},ze["catch"]=ze.catchException=function(t){return"function"==typeof t?w(this,t):Ze([this,t])};var Ze=$e.catchException=$e["catch"]=function(){var t=m(arguments,0);return Me(t).catchException()};ze.combineLatest=function(){var t=re.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),tn.apply(this,t)};var tn=$e.combineLatest=function(){var e=re.call(arguments),r=e.pop();return Array.isArray(e[0])&&(e=e[0]),new on(function(i){function o(e){var o;if(a[e]=!0,h||(h=a.every(n))){try{o=r.apply(null,l)}catch(s){return i.onError(s),t}i.onNext(o)}else f.filter(function(t,n){return n!==e}).every(n)&&i.onCompleted()}function s(t){f[t]=!0,f.every(n)&&i.onCompleted()}for(var u=function(){return!1},c=e.length,a=y(c,u),h=!1,f=y(c,u),l=Array(c),p=Array(c),d=0;c>d;d++)(function(t){p[t]=new ye,p[t].setDisposable(e[t].subscribe(function(e){l[t]=e,o(t)},i.onError.bind(i),function(){s(t)}))})(d);return new le(p)})};ze.concat=function(){var t=re.call(arguments,0);return t.unshift(this),en.apply(this,t)};var en=$e.concat=function(){var t=m(arguments,0);return Me(t).concat()};ze.concatObservable=ze.concatAll=function(){return this.merge(1)},ze.merge=function(t){if("number"!=typeof t)return nn(this,t);var e=this;return new on(function(n){var r=0,i=new le,o=!1,s=[],c=function(t){var e=new ye;i.add(e),u(t)&&(t=Qe(t)),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),c(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,c(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var nn=$e.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=re.call(arguments,1)):(t=Ae,e=re.call(arguments,0)):(t=Ae,e=re.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Je(e,t).mergeObservable()};ze.mergeObservable=ze.mergeAll=function(){var t=this;return new on(function(e){var n=new le,r=!1,i=new ye;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new ye;n.add(i),u(t)&&(t=Qe(t)),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},ze.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return rn([this,t])};var rn=$e.onErrorResumeNext=function(){var t=m(arguments,0);return new on(function(e){var n=0,r=new ge,i=Ae.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new ye,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new le(r,i)})};ze.skipUntil=function(t){var e=this;return new on(function(n){var r=!1,i=new le(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new ye;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},ze["switch"]=ze.switchLatest=function(){var t=this;return new on(function(e){var n=!1,r=new ge,i=!1,o=0,s=t.subscribe(function(t){var s=new ye,c=++o;n=!0,r.setDisposable(s),u(t)&&(t=Qe(t)),s.setDisposable(t.subscribe(function(t){o===c&&e.onNext(t)},function(t){o===c&&e.onError(t)},function(){o===c&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new le(s,r)})},ze.takeUntil=function(t){var n=this;return new on(function(r){return new le(n.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),e))})},ze.zip=function(){if(Array.isArray(arguments[0]))return E.apply(this,arguments);var e=this,r=re.call(arguments),i=r.pop();return r.unshift(e),new on(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=r.length,c=y(u,function(){return[]}),a=y(u,function(){return!1}),h=function(r){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(e,u)}catch(h){return o.onError(h),t}o.onNext(s)}else a.filter(function(t,e){return e!==r}).every(n)&&o.onCompleted()},f=Array(u),l=0;u>l;l++)(function(t){f[t]=new ye,f[t].setDisposable(r[t].subscribe(function(e){c[t].push(e),h(t)},o.onError.bind(o),function(){s(t)}))})(l);return new le(f)})},$e.zip=function(){var t=re.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},$e.zipArray=function(){var e=m(arguments,0);return new on(function(r){function i(e){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});r.onNext(i)}else if(c.filter(function(t,n){return n!==e}).every(n))return r.onCompleted(),t}function o(e){return c[e]=!0,c.every(n)?(r.onCompleted(),t):t}for(var s=e.length,u=y(s,function(){return[]}),c=y(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(t){a[t]=new ye,a[t].setDisposable(e[t].subscribe(function(e){u[t].push(e),i(t)},r.onError.bind(r),function(){o(t)}))})(h);var f=new le(a);return f.add(be(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[] -})),f})},ze.asObservable=function(){var t=this;return new on(function(e){return t.subscribe(e)})},ze.bufferWithCount=function(t,e){return 1===arguments.length&&(e=t),this.windowWithCount(t,e).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},ze.dematerialize=function(){var t=this;return new on(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},ze.distinctUntilChanged=function(e,i){var o=this;return e||(e=n),i||(i=r),new on(function(n){var r,s=!1;return o.subscribe(function(o){var u,c=!1;try{u=e(o)}catch(a){return n.onError(a),t}if(s)try{c=i(r,u)}catch(a){return n.onError(a),t}s&&c||(s=!0,r=u,n.onNext(o))},n.onError.bind(n),n.onCompleted.bind(n))})},ze["do"]=ze.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new on(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},ze["finally"]=ze.finallyAction=function(t){var e=this;return new on(function(n){var r=e.subscribe(n);return be(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},ze.ignoreElements=function(){var t=this;return new on(function(n){return t.subscribe(e,n.onError.bind(n),n.onCompleted.bind(n))})},ze.materialize=function(){var t=this;return new on(function(e){return t.subscribe(function(t){e.onNext(Re(t))},function(t){e.onNext(We(t)),e.onCompleted()},function(){e.onNext(je()),e.onCompleted()})})},ze.repeat=function(t){return Te(this,t).concat()},ze.retry=function(t){return Te(this,t).catchException()},ze.scan=function(){var e,n,r=!1,i=this;return 2===arguments.length?(r=!0,e=arguments[0],n=arguments[1]):n=arguments[0],new on(function(o){var s,u,c;return i.subscribe(function(i){try{c||(c=!0),s?u=n(u,i):(u=r?n(e,i):i,s=!0)}catch(a){return o.onError(a),t}o.onNext(u)},o.onError.bind(o),function(){!c&&r&&o.onNext(e),o.onCompleted()})})},ze.skipLast=function(t){var e=this;return new on(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},ze.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=Ae,t=re.call(arguments,n),Me([Je(t,e),this]).concat()},ze.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Je(t,e)})},ze.takeLastBuffer=function(t){var e=this;return new on(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},ze.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(j);if(1===arguments.length&&(e=t),0>=e)throw Error(j);return new on(function(r){var i=new ye,o=new we(i),s=0,u=[],c=function(){var t=new an;u.push(t),r.onNext(se(t,o))};return c(),i.setDisposable(n.subscribe(function(n){for(var r,i=0,o=u.length;o>i;i++)u[i].onNext(n);var a=s-t+1;a>=0&&0===a%e&&(r=u.shift(),r.onCompleted()),s++,0===s%e&&c()},function(t){for(;u.length>0;)u.shift().onError(t);r.onError(t)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),o})},ze.defaultIfEmpty=function(e){var n=this;return e===t&&(e=null),new on(function(t){var r=!1;return n.subscribe(function(e){r=!0,t.onNext(e)},t.onError.bind(t),function(){r||t.onNext(e),t.onCompleted()})})},ze.distinct=function(e,r){var i=this;return e||(e=n),r||(r=o),new on(function(n){var o={};return i.subscribe(function(i){var s,u,c,a=!1;try{s=e(i),u=r(s)}catch(h){return n.onError(h),t}for(c in o)if(u===c){a=!0;break}a||(o[u]=null,n.onNext(i))},n.onError.bind(n),n.onCompleted.bind(n))})},ze.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return Ke()},n)},ze.groupByUntil=function(r,i,s,u){var c=this;return i||(i=n),u||(u=o),new on(function(n){var o={},a=new le,h=new we(a);return a.add(c.subscribe(function(c){var f,l,p,d,b,v,m,y,g,w;try{v=r(c),m=u(v)}catch(E){for(w in o)o[w].onError(E);return n.onError(E),t}d=!1;try{g=o[m],g||(g=new an,o[m]=g,d=!0)}catch(E){for(w in o)o[w].onError(E);return n.onError(E),t}if(d){b=new un(v,g,h),l=new un(v,g);try{f=s(l)}catch(E){for(w in o)o[w].onError(E);return n.onError(E),t}n.onNext(b),y=new ye,a.add(y);var x=function(){m in o&&(delete o[m],g.onCompleted()),a.remove(y)};y.setDisposable(f.take(1).subscribe(e,function(t){for(w in o)o[w].onError(t);n.onError(t)},function(){x()}))}try{p=i(c)}catch(E){for(w in o)o[w].onError(E);return n.onError(E),t}g.onNext(p)},function(t){for(var e in o)o[e].onError(t);n.onError(t)},function(){for(var t in o)o[t].onCompleted();n.onCompleted()})),h})},ze.select=ze.map=function(e,n){var r=this;return new on(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},ze.pluck=function(t){return this.select(function(e){return e[t]})},ze.selectMany=ze.flatMap=function(t,e){return e?this.selectMany(function(n,r){var i=t(n,r),o=u(i)?Qe(i):i;return o.select(function(t){return e(n,t,r)})}):"function"==typeof t?x.call(this,t):x.call(this,function(){return t})},ze.selectSwitch=ze.flatMapLatest=function(t,e){return this.select(t,e).switchLatest()},ze.skip=function(t){if(0>t)throw Error(j);var e=this;return new on(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},ze.skipWhile=function(e,n){var r=this;return new on(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},ze.take=function(t,e){if(0>t)throw Error(j);if(0===t)return Ge(e);var n=this;return new on(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},ze.takeWhile=function(e,n){var r=this;return new on(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},ze.where=ze.filter=function(e,n){var r=this;return new on(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})};var on=O.AnonymousObservable=function(e){function n(e){return e===t?e=ve:"function"==typeof e&&(e=be(e)),e}function r(i){function o(t){var e=new sn(t);if(Se.scheduleRequired())Se.schedule(function(){try{e.setDisposable(n(i(e)))}catch(t){if(!e.fail(t))throw t}});else try{e.setDisposable(n(i(e)))}catch(r){if(!e.fail(r))throw r}return e}return this instanceof r?(e.call(this,o),t):new r(i)}return ie(r,e),r}($e),sn=function(t){function e(e){t.call(this),this.observer=e,this.m=new ye}ie(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.setDisposable=function(t){this.m.setDisposable(t)},n.getDisposable=function(){return this.m.getDisposable()},n.disposable=function(t){return arguments.length?this.getDisposable():setDisposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Ve),un=function(t){function e(t){return this.underlyingObservable.subscribe(t)}function n(n,r,i){t.call(this,e),this.key=n,this.underlyingObservable=i?new on(function(t){return new le(i.getDisposable(),r.subscribe(t))}):r}return ie(n,t),n}($e),cn=function(t,e){this.subject=t,this.observer=e};cn.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var an=O.Subject=function(t){function e(t){return c.call(this),this.isStopped?this.exception?(t.onError(this.exception),ve):(t.onCompleted(),ve):(this.observers.push(t),new cn(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return ie(n,t),oe(n.prototype,Le,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(c.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(c.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(c.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new hn(t,e)},n}($e);O.AsyncSubject=function(t){function e(t){if(c.call(this),!this.isStopped)return this.observers.push(t),new cn(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),ve}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return ie(n,t),oe(n.prototype,Le,{hasObservers:function(){return c.call(this),this.observers.length>0},onCompleted:function(){var t,e,n;if(c.call(this),!this.isStopped){this.isStopped=!0;var r=this.observers.slice(0),i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(c.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){c.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}($e);var hn=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return ie(n,t),oe(n.prototype,Le,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}($e);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(D.Rx=O,define(function(){return O})):A&&S?_?(S.exports=O).Rx=O:A.Rx=O:D.Rx=O}).call(this); \ No newline at end of file +(function(t){function e(){}function n(t){return t}function r(t,e){return re(t,e)}function i(t,e){return t-e}function o(t){return""+t}function s(t){throw t}function u(e){return"function"==typeof e.then&&e.subscribe===t}function c(){if(this.isDisposed)throw Error(k)}function a(t){var e=typeof t;return t&&("function"==e||"object"==e)||!1}function h(t){var e=[];if(!a(t))return e;ne.nonEnumArgs&&t.length&&d(t)&&(t=ie.call(t));var n=ne.enumPrototypes&&"function"==typeof t,r=ne.enumErrorProps&&(t===K||t instanceof Error);for(var i in t)n&&"prototype"==i||r&&("message"==i||"name"==i)||e.push(i);if(ne.nonEnumShadows&&t!==X){var o=t.constructor,s=-1,u=te.length;if(t===(o&&o.prototype))var c=t===stringProto?$:t===K?V:Q.call(t),h=ee[c];for(;u>++s;)i=te[s],h&&h[i]||!G.call(t,i)||e.push(i)}return e}function l(t,e,n){for(var r=-1,i=n(t),o=i.length;o>++r;){var s=i[r];if(e(t[s],s,t)===!1)break}return t}function f(t,e){return l(t,e,h)}function p(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function d(t){return t&&"object"==typeof t?Q.call(t)==M:!1}function b(t){return"function"==typeof t}function v(e,n,r,i){if(e===n)return 0!==e||1/e==1/n;var o=typeof e,s=typeof n;if(e===e&&(null==e||null==n||"function"!=o&&"object"!=o&&"function"!=s&&"object"!=s))return!1;var u=Q.call(e),c=Q.call(n);if(u==M&&(u=U),c==M&&(c=U),u!=c)return!1;switch(u){case I:case z:return+e==+n;case F:return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case H:case $:return e==n+""}var a=u==L;if(!a){if(u!=U||!ne.nodeClass&&(p(e)||p(n)))return!1;var h=!ne.argsObject&&d(e)?Object:e.constructor,l=!ne.argsObject&&d(n)?Object:n.constructor;if(!(h==l||G.call(e,"constructor")&&G.call(n,"constructor")||b(h)&&h instanceof h&&b(l)&&l instanceof l||!("constructor"in e&&"constructor"in n)))return!1}r||(r=[]),i||(i=[]);for(var m=r.length;m--;)if(r[m]==e)return i[m]==n;var y=0;if(result=!0,r.push(e),i.push(n),a){if(m=e.length,y=n.length,result=y==m)for(;y--;){var w=n[y];if(!(result=v(e[y],w,r,i)))break}}else f(n,function(n,o,s){return G.call(s,o)?(y++,result=G.call(e,o)&&v(e[o],n,r,i)):t}),result&&f(e,function(e,n,r){return G.call(r,n)?result=--y>-1:t});return r.pop(),i.pop(),result}function m(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:ie.call(t)}function y(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function w(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function g(e,n){return new on(function(r){var i=new we,o=new ge;return o.setDisposable(i),i.setDisposable(e.subscribe(r.onNext.bind(r),function(e){var i,s;try{s=n(e)}catch(u){return r.onError(u),t}i=new we,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function E(e,n){var r=this;return new on(function(i){var o=0,s=e.length;return r.subscribe(function(r){if(s>o){var u,c=e[o++];try{u=n(r,c)}catch(a){return i.onError(a),t}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function x(t){return this.select(function(e,n){var r=t(e,n);return u(r)?Qe(r):r}).mergeObservable()}var C={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},D=C[typeof window]&&window||this,A=C[typeof exports]&&exports&&!exports.nodeType&&exports,S=C[typeof module]&&module&&!module.nodeType&&module,_=S&&S.exports===A&&A,N=C[typeof global]&&global;!N||N.global!==N&&N.window!==N||(D=N);var O={internals:{},config:{}},R=function(){return Date.now?Date.now:function(){return+new Date}}(),W="Sequence contains no elements.",j="Argument out of range",k="Object has been disposed",P="object"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";D.Set&&"function"==typeof(new D.Set)["@@iterator"]&&(P="@@iterator");var q,T={done:!0,value:t},M="[object Arguments]",L="[object Array]",I="[object Boolean]",z="[object Date]",V="[object Error]",B="[object Function]",F="[object Number]",U="[object Object]",H="[object RegExp]",$="[object String]",Q=Object.prototype.toString,G=Object.prototype.hasOwnProperty,J=Q.call(arguments)==M,K=Error.prototype,X=Object.prototype,Y=X.propertyIsEnumerable;try{q=!(Q.call(document)==U&&!({toString:0}+""))}catch(Z){q=!0}var te=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ee={};ee[L]=ee[z]=ee[F]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},ee[I]=ee[$]={constructor:!0,toString:!0,valueOf:!0},ee[V]=ee[B]=ee[H]={constructor:!0,toString:!0},ee[U]={constructor:!0};var ne={};(function(){var t=function(){this.x=1},e=[];t.prototype={valueOf:1,y:1};for(var n in new t)e.push(n);for(n in arguments);ne.enumErrorProps=Y.call(K,"message")||Y.call(K,"name"),ne.enumPrototypes=Y.call(t,"prototype"),ne.nonEnumArgs=0!=n,ne.nonEnumShadows=!/valueOf/.test(e)})(1),J||(d=function(t){return t&&"object"==typeof t?G.call(t,"callee"):!1}),b(/x/)&&(b=function(t){return"function"==typeof t&&Q.call(t)==B});var re=O.internals.isEqual=function(t,e){return v(t,e,[],[])},ie=Array.prototype.slice;({}).hasOwnProperty;var oe=this.inherits=O.internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},se=O.internals.addProperties=function(t){for(var e=ie.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},ue=O.internals.addRef=function(t,e){return new on(function(n){return new pe(e.getDisposable(),t.subscribe(n))})};Function.prototype.bind||(Function.prototype.bind=function(t){var e=this,n=ie.call(arguments,1),r=function(){function i(){}if(this instanceof r){i.prototype=e.prototype;var o=new i,s=e.apply(o,n.concat(ie.call(arguments)));return Object(s)===s?s:o}return e.apply(t,n.concat(ie.call(arguments)))};return r});var ce=Object("a"),ae="a"!=ce[0]||!(0 in ce);Array.prototype.every||(Array.prototype.every=function(t){var e=Object(this),n=ae&&{}.toString.call(this)==$?this.split(""):e,r=n.length>>>0,i=arguments[1];if({}.toString.call(t)!=B)throw new TypeError(t+" is not a function");for(var o=0;r>o;o++)if(o in n&&!t.call(i,n[o],o,e))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(t){var e=Object(this),n=ae&&{}.toString.call(this)==$?this.split(""):e,r=n.length>>>0,i=Array(r),o=arguments[1];if({}.toString.call(t)!=B)throw new TypeError(t+" is not a function");for(var s=0;r>s;s++)s in n&&(i[s]=t.call(o,n[s],s,e));return i}),Array.prototype.filter||(Array.prototype.filter=function(t){for(var e,n=[],r=Object(this),i=0,o=r.length>>>0;o>i;i++)e=r[i],i in r&&t.call(arguments[1],e,i,r)&&n.push(e);return n}),Array.isArray||(Array.isArray=function(t){return Object.prototype.toString.call(t)==L}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=Object(this),n=e.length>>>0;if(0===n)return-1;var r=0;if(arguments.length>1&&(r=Number(arguments[1]),r!==r?r=0:0!==r&&1/0!=r&&r!==-1/0&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=n)return-1;for(var i=r>=0?r:Math.max(n-Math.abs(r),0);n>i;i++)if(i in e&&e[i]===t)return i;return-1});var he=function(t,e){this.id=t,this.value=e};he.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var le=O.internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},fe=le.prototype;fe.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},fe.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},fe.heapify=function(e){if(e===t&&(e=0),!(e>=this.length||0>e)){var n=2*e+1,r=2*e+2,i=e;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==e){var o=this.items[e];this.items[e]=this.items[i],this.items[i]=o,this.heapify(i)}}},fe.peek=function(){return this.items[0].value},fe.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},fe.dequeue=function(){var t=this.peek();return this.removeAt(0),t},fe.enqueue=function(t){var e=this.length++;this.items[e]=new he(le.count++,t),this.percolate(e)},fe.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},le.count=0;var pe=O.CompositeDisposable=function(){this.disposables=m(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},de=pe.prototype;de.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},de.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},de.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},de.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},de.contains=function(t){return-1!==this.disposables.indexOf(t)},de.toArray=function(){return this.disposables.slice(0)};var be=O.Disposable=function(t){this.isDisposed=!1,this.action=t||e};be.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ve=be.create=function(t){return new be(t)},me=be.empty={dispose:e},ye=function(){function t(t){this.isSingle=t,this.isDisposed=!1,this.current=null}var e=t.prototype;return e.getDisposable=function(){return this.current},e.setDisposable=function(t){if(this.current&&this.isSingle)throw Error("Disposable has already been assigned");var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},e.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()},t}(),we=O.SingleAssignmentDisposable=function(t){function e(){t.call(this,!0)}return oe(e,t),e}(ye),ge=O.SerialDisposable=function(t){function e(){t.call(this,!1)}return oe(e,t),e}(ye),Ee=O.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?me:new t(this)},e}();w.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})};var xe=O.internals.ScheduledItem=function(t,e,n,r,o){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=o||i,this.disposable=new we};xe.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},xe.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},xe.prototype.isCancelled=function(){return this.disposable.isDisposed},xe.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Ce=O.Scheduler=function(){function t(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function e(t,e){var n=e.first,r=e.second,i=new pe,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),me});r||(i.add(s),n=!0)})};return o(n),i}function n(t,e,n){var r=e.first,i=e.second,o=new pe,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),me});u||(o.add(c),i=!0)})};return s(r),o}function r(t,e){return e(),me}var i=t.prototype;return i.catchException=i["catch"]=function(t){return new Oe(this,t)},i.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},i.schedulePeriodicWithState=function(t,e,n){var r=t,i=setInterval(function(){r=n(r)},e);return ve(function(){clearInterval(i)})},i.schedule=function(t){return this._schedule(t,r)},i.scheduleWithState=function(t,e){return this._schedule(t,e)},i.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,r)},i.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},i.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,r)},i.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},i.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},i.scheduleRecursiveWithState=function(t,n){return this.scheduleWithState({first:t,second:n},function(t,n){return e(t,n)})},i.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithRelativeAndState=function(t,e,r){return this._scheduleRelative({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithRelativeAndState")})},i.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithAbsoluteAndState=function(t,e,r){return this._scheduleAbsolute({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithAbsoluteAndState")})},t.now=R,t.normalize=function(t){return 0>t&&(t=0),t},t}(),De=Ce.normalize;O.internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new we;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();var Ae,Se=Ce.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){for(var r=De(r);r-this.now()>0;);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Ce(R,t,e,n)}(),_e=Ce.currentThread=function(){function t(t){for(var e;t.length>0;)if(e=t.dequeue(),!e.isCancelled()){for(;e.dueTime-Ce.now()>0;);e.isCancelled()||e.invoke()}}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o=this.now()+Ce.normalize(n),s=new xe(this,e,r,o);if(i)i.enqueue(s);else{i=new le(4),i.enqueue(s);try{t(i)}catch(u){throw u}finally{i=null}}return s.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i,o=new Ce(R,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}(),Ne=e;(function(){function t(){if(!D.postMessage||D.importScripts)return!1;var t=!1,e=D.onmessage;return D.onmessage=function(){t=!0},D.postMessage("","*"),D.onmessage=e,t}function e(t){if("string"==typeof t.data&&t.data.substring(0,o.length)===o){var e=t.data.substring(o.length),n=s[e];n(),delete s[e]}}var n=RegExp("^"+(Q+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),r="function"==typeof(r=N&&_&&N.setImmediate)&&!n.test(r)&&r,i="function"==typeof(i=N&&_&&N.clearImmediate)&&!n.test(i)&&i;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Ae=process.nextTick;else if("function"==typeof r)Ae=r,Ne=i;else if(t()){var o="ms.rx.schedule"+Math.random(),s={},u=0;D.addEventListener?D.addEventListener("message",e,!1):D.attachEvent("onmessage",e,!1),Ae=function(t){var e=u++;s[e]=t,D.postMessage(o+e,"*")}}else if(D.MessageChannel){var c=new D.MessageChannel,a={},h=0;c.port1.onmessage=function(t){var e=t.data,n=a[e];n(),delete a[e]},Ae=function(t){var e=h++;a[e]=t,c.port2.postMessage(e)}}else"document"in D&&"onreadystatechange"in D.document.createElement("script")?Ae=function(t){var e=D.document.createElement("script");e.onreadystatechange=function(){t(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},D.document.documentElement.appendChild(e)}:(Ae=function(t){return setTimeout(t,0)},Ne=clearTimeout)})(),Ce.timeout=function(){function t(t,e){var n=this,r=new we,i=Ae(function(){r.isDisposed||r.setDisposable(e(n,t))});return new pe(r,ve(function(){Ne(i)}))}function e(t,e,n){var r=this,i=Ce.normalize(e);if(0===i)return r.scheduleWithState(t,n);var o=new we,s=setTimeout(function(){o.isDisposed||o.setDisposable(n(r,t))},i);return new pe(o,ve(function(){clearTimeout(s)}))}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Ce(R,t,e,n)}();var Oe=function(t){function e(){return this._scheduler.now()}function n(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,n){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(n))}function i(t,e,n){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(n))}function o(o,s){this._scheduler=o,this._handler=s,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,e,n,r,i)}return oe(o,t),o.prototype._clone=function(t){return new o(t,this._handler)},o.prototype._wrap=function(t){var e=this;return function(n,r){try{return t(e._getRecursiveWrapper(n),r)}catch(i){if(!e._handler(i))throw i;return me}}},o.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},o.prototype.schedulePeriodicWithState=function(t,e,n){var r=this,i=!1,o=new we;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return n(t)}catch(e){if(i=!0,!r._handler(e))throw e;return o.dispose(),null}})),o},o}(Ce),Re=O.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t||(t=Se),new on(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),We=Re.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new Re("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),je=Re.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new Re("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),ke=Re.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new Re("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),Pe=O.internals.Enumerator=function(t){this._next=t};Pe.prototype.next=function(){return this._next()},Pe.prototype[P]=function(){return this};var qe=O.internals.Enumerable=function(t){this._iterator=t};qe.prototype[P]=function(){return this._iterator()},qe.prototype.concat=function(){var e=this;return new on(function(n){var r;try{r=e[P]()}catch(i){return n.onError(),t}var o,s=new ge,u=Se.scheduleRecursive(function(e){var i;if(!o){try{i=r.next()}catch(u){return n.onError(u),t}if(i.done)return n.onCompleted(),t;var c=new we;s.setDisposable(c),c.setDisposable(i.value.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){e()}))}});return new pe(s,u,ve(function(){o=!0}))})},qe.prototype.catchException=function(){var e=this;return new on(function(n){var r;try{r=e[P]()}catch(i){return n.onError(),t}var o,s,u=new ge,c=Se.scheduleRecursive(function(e){if(!o){var i;try{i=r.next()}catch(c){return n.onError(c),t}if(i.done)return s?n.onError(s):n.onCompleted(),t;var a=new we;u.setDisposable(a),a.setDisposable(i.value.subscribe(n.onNext.bind(n),function(t){s=t,e()},n.onCompleted.bind(n)))}});return new pe(u,c,ve(function(){o=!0}))})};var Te=qe.repeat=function(t,e){return null==e&&(e=-1),new qe(function(){var n=e;return new Pe(function(){return 0===n?T:(n>0&&n--,{done:!1,value:t})})})},Me=qe.forEach=function(t,e,r){return e||(e=n),new qe(function(){var n=-1;return new Pe(function(){return++n0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var r;if(!(n.queue.length>0))return n.isAcquired=!1,t;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}e()}))},n.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},n}(Ve),He=function(t){function e(){t.apply(this,arguments)}return oe(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e}(Ue),$e=O.Observable=function(){function t(t){this._subscribe=t}return ze=t.prototype,ze.finalValue=function(){var t=this;return new on(function(e){var n,r=!1;return t.subscribe(function(t){r=!0,n=t},e.onError.bind(e),function(){r?(e.onNext(n),e.onCompleted()):e.onError(Error(W))})})},ze.subscribe=ze.forEach=function(t,e,n){var r;return r="object"==typeof t?t:Ie(t,e,n),this._subscribe(r)},ze.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();ze.observeOn=function(t){var e=this;return new on(function(n){return e.subscribe(new He(t,n))})},ze.subscribeOn=function(t){var e=this;return new on(function(n){var r=new we,i=new ge;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new w(t,e.subscribe(n)))})),i})};var Qe=$e.fromPromise=function(t){return new on(function(e){t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)})})};ze.toPromise=function(t){if(t||(t=O.config.Promise),!t)throw Error("Promise type not provided nor in Rx.config.Promise");var e=this;return new t(function(t,n){var r,i=!1;e.subscribe(function(t){r=t,i=!0},function(t){n(t)},function(){i&&t(r)})})},$e.create=$e.createWithDisposable=function(t){return new on(t)},$e.defer=function(t){return new on(function(e){var n;try{n=t()}catch(r){return Ye(r).subscribe(e)}return n.subscribe(e)})};var Ge=$e.empty=function(t){return t||(t=Se),new on(function(e){return t.schedule(function(){e.onCompleted()})})},Je=$e.fromArray=function(t,e){return e||(e=_e),new on(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};$e.fromIterable=function(e,n){return n||(n=_e),new on(function(r){var i;try{i=e[P]()}catch(o){return r.onError(o),t}return n.scheduleRecursive(function(e){var n;try{n=i.next()}catch(o){return r.onError(o),t}n.done?r.onCompleted():(r.onNext(n.value),e())})})},$e.generate=function(e,n,r,i,o){return o||(o=_e),new on(function(s){var u=!0,c=e;return o.scheduleRecursive(function(e){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(h){return s.onError(h),t}o?(s.onNext(a),e()):s.onCompleted()})})};var Ke=$e.never=function(){return new on(function(){return me})};$e.range=function(t,e,n){return n||(n=_e),new on(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},$e.repeat=function(t,e,n){return n||(n=_e),null==e&&(e=-1),Xe(t,n).repeat(e)};var Xe=$e["return"]=$e.returnValue=function(t,e){return e||(e=Se),new on(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Ye=$e["throw"]=$e.throwException=function(t,e){return e||(e=Se),new on(function(n){return e.schedule(function(){n.onError(t)})})};$e.using=function(t,e){return new on(function(n){var r,i,o=me;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new pe(Ye(s).subscribe(n),o)}return new pe(i.subscribe(n),o)})},ze.amb=function(t){var e=this;return new on(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new we,a=new we;return c.setDisposable(e.subscribe(function(t){r(),o===s&&n.onNext(t)},function(t){r(),o===s&&n.onError(t)},function(){r(),o===s&&n.onCompleted()})),a.setDisposable(t.subscribe(function(t){i(),o===u&&n.onNext(t)},function(t){i(),o===u&&n.onError(t)},function(){i(),o===u&&n.onCompleted()})),new pe(c,a)})},$e.amb=function(){function t(t,e){return t.amb(e)}for(var e=Ke(),n=m(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},ze["catch"]=ze.catchException=function(t){return"function"==typeof t?g(this,t):Ze([this,t])};var Ze=$e.catchException=$e["catch"]=function(){var t=m(arguments,0);return Me(t).catchException()};ze.combineLatest=function(){var t=ie.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),tn.apply(this,t)};var tn=$e.combineLatest=function(){var e=ie.call(arguments),r=e.pop();return Array.isArray(e[0])&&(e=e[0]),new on(function(i){function o(e){var o;if(a[e]=!0,h||(h=a.every(n))){try{o=r.apply(null,f)}catch(s){return i.onError(s),t}i.onNext(o)}else l.filter(function(t,n){return n!==e}).every(n)&&i.onCompleted()}function s(t){l[t]=!0,l.every(n)&&i.onCompleted()}for(var u=function(){return!1},c=e.length,a=y(c,u),h=!1,l=y(c,u),f=Array(c),p=Array(c),d=0;c>d;d++)(function(t){p[t]=new we,p[t].setDisposable(e[t].subscribe(function(e){f[t]=e,o(t)},i.onError.bind(i),function(){s(t)}))})(d);return new pe(p)})};ze.concat=function(){var t=ie.call(arguments,0);return t.unshift(this),en.apply(this,t)};var en=$e.concat=function(){var t=m(arguments,0);return Me(t).concat()};ze.concatObservable=ze.concatAll=function(){return this.merge(1)},ze.merge=function(t){if("number"!=typeof t)return nn(this,t);var e=this;return new on(function(n){var r=0,i=new pe,o=!1,s=[],c=function(t){var e=new we;i.add(e),u(t)&&(t=Qe(t)),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),c(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,c(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var nn=$e.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=ie.call(arguments,1)):(t=Se,e=ie.call(arguments,0)):(t=Se,e=ie.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Je(e,t).mergeObservable()};ze.mergeObservable=ze.mergeAll=function(){var t=this;return new on(function(e){var n=new pe,r=!1,i=new we;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new we;n.add(i),u(t)&&(t=Qe(t)),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},ze.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return rn([this,t])};var rn=$e.onErrorResumeNext=function(){var t=m(arguments,0);return new on(function(e){var n=0,r=new ge,i=Se.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new we,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new pe(r,i)})};ze.skipUntil=function(t){var e=this;return new on(function(n){var r=!1,i=new pe(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new we;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},ze["switch"]=ze.switchLatest=function(){var t=this;return new on(function(e){var n=!1,r=new ge,i=!1,o=0,s=t.subscribe(function(t){var s=new we,c=++o;n=!0,r.setDisposable(s),u(t)&&(t=Qe(t)),s.setDisposable(t.subscribe(function(t){o===c&&e.onNext(t)},function(t){o===c&&e.onError(t)},function(){o===c&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new pe(s,r)})},ze.takeUntil=function(t){var n=this;return new on(function(r){return new pe(n.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),e))})},ze.zip=function(){if(Array.isArray(arguments[0]))return E.apply(this,arguments);var e=this,r=ie.call(arguments),i=r.pop();return r.unshift(e),new on(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=r.length,c=y(u,function(){return[]}),a=y(u,function(){return!1}),h=function(r){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(e,u)}catch(h){return o.onError(h),t}o.onNext(s)}else a.filter(function(t,e){return e!==r}).every(n)&&o.onCompleted()},l=Array(u),f=0;u>f;f++)(function(t){l[t]=new we,l[t].setDisposable(r[t].subscribe(function(e){c[t].push(e),h(t)},o.onError.bind(o),function(){s(t)}))})(f);return new pe(l)})},$e.zip=function(){var t=ie.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},$e.zipArray=function(){var e=m(arguments,0);return new on(function(r){function i(e){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});r.onNext(i)}else if(c.filter(function(t,n){return n!==e}).every(n))return r.onCompleted(),t}function o(e){return c[e]=!0,c.every(n)?(r.onCompleted(),t):t}for(var s=e.length,u=y(s,function(){return[]}),c=y(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(t){a[t]=new we,a[t].setDisposable(e[t].subscribe(function(e){u[t].push(e),i(t)},r.onError.bind(r),function(){o(t)}))})(h);var l=new pe(a);return l.add(ve(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[] +})),l})},ze.asObservable=function(){var t=this;return new on(function(e){return t.subscribe(e)})},ze.bufferWithCount=function(t,e){return 1===arguments.length&&(e=t),this.windowWithCount(t,e).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},ze.dematerialize=function(){var t=this;return new on(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},ze.distinctUntilChanged=function(e,i){var o=this;return e||(e=n),i||(i=r),new on(function(n){var r,s=!1;return o.subscribe(function(o){var u,c=!1;try{u=e(o)}catch(a){return n.onError(a),t}if(s)try{c=i(r,u)}catch(a){return n.onError(a),t}s&&c||(s=!0,r=u,n.onNext(o))},n.onError.bind(n),n.onCompleted.bind(n))})},ze["do"]=ze.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new on(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},ze["finally"]=ze.finallyAction=function(t){var e=this;return new on(function(n){var r=e.subscribe(n);return ve(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},ze.ignoreElements=function(){var t=this;return new on(function(n){return t.subscribe(e,n.onError.bind(n),n.onCompleted.bind(n))})},ze.materialize=function(){var t=this;return new on(function(e){return t.subscribe(function(t){e.onNext(We(t))},function(t){e.onNext(je(t)),e.onCompleted()},function(){e.onNext(ke()),e.onCompleted()})})},ze.repeat=function(t){return Te(this,t).concat()},ze.retry=function(t){return Te(this,t).catchException()},ze.scan=function(){var e,n,r=!1,i=this;return 2===arguments.length?(r=!0,e=arguments[0],n=arguments[1]):n=arguments[0],new on(function(o){var s,u,c;return i.subscribe(function(i){try{c||(c=!0),s?u=n(u,i):(u=r?n(e,i):i,s=!0)}catch(a){return o.onError(a),t}o.onNext(u)},o.onError.bind(o),function(){!c&&r&&o.onNext(e),o.onCompleted()})})},ze.skipLast=function(t){var e=this;return new on(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},ze.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=Se,t=ie.call(arguments,n),Me([Je(t,e),this]).concat()},ze.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Je(t,e)})},ze.takeLastBuffer=function(t){var e=this;return new on(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},ze.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(j);if(1===arguments.length&&(e=t),0>=e)throw Error(j);return new on(function(r){var i=new we,o=new Ee(i),s=0,u=[],c=function(){var t=new an;u.push(t),r.onNext(ue(t,o))};return c(),i.setDisposable(n.subscribe(function(n){for(var r,i=0,o=u.length;o>i;i++)u[i].onNext(n);var a=s-t+1;a>=0&&0===a%e&&(r=u.shift(),r.onCompleted()),s++,0===s%e&&c()},function(t){for(;u.length>0;)u.shift().onError(t);r.onError(t)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),o})},ze.defaultIfEmpty=function(e){var n=this;return e===t&&(e=null),new on(function(t){var r=!1;return n.subscribe(function(e){r=!0,t.onNext(e)},t.onError.bind(t),function(){r||t.onNext(e),t.onCompleted()})})},ze.distinct=function(e,r){var i=this;return e||(e=n),r||(r=o),new on(function(n){var o={};return i.subscribe(function(i){var s,u,c,a=!1;try{s=e(i),u=r(s)}catch(h){return n.onError(h),t}for(c in o)if(u===c){a=!0;break}a||(o[u]=null,n.onNext(i))},n.onError.bind(n),n.onCompleted.bind(n))})},ze.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return Ke()},n)},ze.groupByUntil=function(r,i,s,u){var c=this;return i||(i=n),u||(u=o),new on(function(n){var o={},a=new pe,h=new Ee(a);return a.add(c.subscribe(function(c){var l,f,p,d,b,v,m,y,w,g;try{v=r(c),m=u(v)}catch(E){for(g in o)o[g].onError(E);return n.onError(E),t}d=!1;try{w=o[m],w||(w=new an,o[m]=w,d=!0)}catch(E){for(g in o)o[g].onError(E);return n.onError(E),t}if(d){b=new un(v,w,h),f=new un(v,w);try{l=s(f)}catch(E){for(g in o)o[g].onError(E);return n.onError(E),t}n.onNext(b),y=new we,a.add(y);var x=function(){m in o&&(delete o[m],w.onCompleted()),a.remove(y)};y.setDisposable(l.take(1).subscribe(e,function(t){for(g in o)o[g].onError(t);n.onError(t)},function(){x()}))}try{p=i(c)}catch(E){for(g in o)o[g].onError(E);return n.onError(E),t}w.onNext(p)},function(t){for(var e in o)o[e].onError(t);n.onError(t)},function(){for(var t in o)o[t].onCompleted();n.onCompleted()})),h})},ze.select=ze.map=function(e,n){var r=this;return new on(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},ze.pluck=function(t){return this.select(function(e){return e[t]})},ze.selectMany=ze.flatMap=function(t,e){return e?this.selectMany(function(n,r){var i=t(n,r),o=u(i)?Qe(i):i;return o.select(function(t){return e(n,t,r)})}):"function"==typeof t?x.call(this,t):x.call(this,function(){return t})},ze.selectSwitch=ze.flatMapLatest=function(t,e){return this.select(t,e).switchLatest()},ze.skip=function(t){if(0>t)throw Error(j);var e=this;return new on(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},ze.skipWhile=function(e,n){var r=this;return new on(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},ze.take=function(t,e){if(0>t)throw Error(j);if(0===t)return Ge(e);var n=this;return new on(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},ze.takeWhile=function(e,n){var r=this;return new on(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},ze.where=ze.filter=function(e,n){var r=this;return new on(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})};var on=O.AnonymousObservable=function(e){function n(e){return e===t?e=me:"function"==typeof e&&(e=ve(e)),e}function r(i){function o(t){var e=new sn(t);if(_e.scheduleRequired())_e.schedule(function(){try{e.setDisposable(n(i(e)))}catch(t){if(!e.fail(t))throw t}});else try{e.setDisposable(n(i(e)))}catch(r){if(!e.fail(r))throw r}return e}return this instanceof r?(e.call(this,o),t):new r(i)}return oe(r,e),r}($e),sn=function(t){function e(e){t.call(this),this.observer=e,this.m=new we}oe(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.setDisposable=function(t){this.m.setDisposable(t)},n.getDisposable=function(){return this.m.getDisposable()},n.disposable=function(t){return arguments.length?this.getDisposable():setDisposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Ve),un=function(t){function e(t){return this.underlyingObservable.subscribe(t)}function n(n,r,i){t.call(this,e),this.key=n,this.underlyingObservable=i?new on(function(t){return new pe(i.getDisposable(),r.subscribe(t))}):r}return oe(n,t),n}($e),cn=function(t,e){this.subject=t,this.observer=e};cn.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var an=O.Subject=function(t){function e(t){return c.call(this),this.isStopped?this.exception?(t.onError(this.exception),me):(t.onCompleted(),me):(this.observers.push(t),new cn(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return oe(n,t),se(n.prototype,Le,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(c.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(c.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(c.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new hn(t,e)},n}($e);O.AsyncSubject=function(t){function e(t){if(c.call(this),!this.isStopped)return this.observers.push(t),new cn(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),me}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return oe(n,t),se(n.prototype,Le,{hasObservers:function(){return c.call(this),this.observers.length>0},onCompleted:function(){var t,e,n;if(c.call(this),!this.isStopped){this.isStopped=!0;var r=this.observers.slice(0),i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(c.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){c.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}($e);var hn=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return oe(n,t),se(n.prototype,Le,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}($e);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(D.Rx=O,define(function(){return O})):A&&S?_?(S.exports=O).Rx=O:A.Rx=O:D.Rx=O}).call(this); \ No newline at end of file diff --git a/rx.experimental.js b/rx.experimental.js index ae7bacfed..e3d192a9f 100644 --- a/rx.experimental.js +++ b/rx.experimental.js @@ -33,48 +33,56 @@ } }.call(this, function (root, exp, Rx, undefined) { - // Aliases - var Observable = Rx.Observable, - observableProto = Observable.prototype, - AnonymousObservable = Rx.AnonymousObservable, - observableConcat = Observable.concat, - observableDefer = Observable.defer, - observableEmpty = Observable.empty, - disposableEmpty = Rx.Disposable.empty, - CompositeDisposable = Rx.CompositeDisposable, - SerialDisposable = Rx.SerialDisposable, - SingleAssignmentDisposable = Rx.SingleAssignmentDisposable, - enumeratorCreate = Rx.internals.Enumerator.create, - Enumerable = Rx.internals.Enumerable, - enumerableForEach = Enumerable.forEach, - immediateScheduler = Rx.Scheduler.immediate, - currentThreadScheduler = Rx.Scheduler.currentThread, - slice = Array.prototype.slice, - AsyncSubject = Rx.AsyncSubject, - Observer = Rx.Observer, - inherits = Rx.internals.inherits, - addProperties = Rx.internals.addProperties; - - // Utilities - function nothing () { } - function argsOrArray(args, idx) { - return args.length === 1 && Array.isArray(args[idx]) ? - args[idx] : - slice.call(args); - } - - function enumerableWhile(condition, source) { - return new Enumerable(function () { - var current; - return enumeratorCreate(function () { - if (condition()) { - current = source; - return true; - } - return false; - }, function () { return current; }); - }); - } + // Aliases + var Observable = Rx.Observable, + observableProto = Observable.prototype, + AnonymousObservable = Rx.AnonymousObservable, + observableConcat = Observable.concat, + observableDefer = Observable.defer, + observableEmpty = Observable.empty, + disposableEmpty = Rx.Disposable.empty, + CompositeDisposable = Rx.CompositeDisposable, + SerialDisposable = Rx.SerialDisposable, + SingleAssignmentDisposable = Rx.SingleAssignmentDisposable, + Enumerator = Rx.internals.Enumerator, + Enumerable = Rx.internals.Enumerable, + enumerableForEach = Enumerable.forEach, + immediateScheduler = Rx.Scheduler.immediate, + currentThreadScheduler = Rx.Scheduler.currentThread, + slice = Array.prototype.slice, + AsyncSubject = Rx.AsyncSubject, + Observer = Rx.Observer, + inherits = Rx.internals.inherits, + addProperties = Rx.internals.addProperties; + + // Utilities + function nothing () { } + function argsOrArray(args, idx) { + return args.length === 1 && Array.isArray(args[idx]) ? + args[idx] : + slice.call(args); + } + + // Shim in iterator support + var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) || + '_es6shim_iterator_'; + // Firefox ships a partial implementation using the name @@iterator. + // https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14 + // So use that name if we detect it. + if (root.Set && typeof new root.Set()['@@iterator'] === 'function') { + $iterator$ = '@@iterator'; + } + var doneEnumerator = { done: true, value: undefined }; + + function enumerableWhile(condition, source) { + return new Enumerable(function () { + return new Enumerator(function () { + return condition() ? + { done: false, value: source } : + { done: true, value: undefined }; + }); + }); + } /** * Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions. diff --git a/rx.experimental.min.js b/rx.experimental.min.js index 7de785dc4..c910de134 100644 --- a/rx.experimental.min.js +++ b/rx.experimental.min.js @@ -1 +1 @@ -(function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,o=e[typeof module]&&module&&!module.nodeType&&module,i=(o&&o.exports===r&&r,e[typeof global]&&global);!i||i.global!==i&&i.window!==i||(n=i),"function"==typeof define&&define.amd?define(["rx","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n,r){function o(){}function i(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:E.call(t)}function s(t,e){return new y(function(){var n;return m(function(){return t()?(n=e,!0):!1},function(){return n})})}var u=n.Observable,c=u.prototype,a=n.AnonymousObservable,l=u.concat,f=u.defer,h=u.empty,p=n.Disposable.empty,d=n.CompositeDisposable,b=n.SerialDisposable,v=n.SingleAssignmentDisposable,m=n.internals.Enumerator.create,y=n.internals.Enumerable,w=y.forEach,g=n.Scheduler.immediate,x=n.Scheduler.currentThread,E=Array.prototype.slice,C=n.AsyncSubject,D=n.Observer,S=n.internals.inherits,N=n.internals.addProperties;c.letBind=c.let=function(t){return t(this)},u["if"]=u.ifThen=function(t,e,n){return f(function(){if(n||(n=h()),n.now){var r=n;n=h(r)}return t()?e:n})},u["for"]=u.forIn=function(t,e){return w(t,e).concat()};var A=u["while"]=u.whileDo=function(t,e){return s(t,e).concat()};c.doWhile=function(t){return l([this,A(t,this)])},u["case"]=u.switchCase=function(t,e,n){return f(function(){if(n||(n=h()),n.now){var o=n;n=h(o)}var i=e[t()];return i!==r?i:n})},c.expand=function(t,e){e||(e=g);var n=this;return new a(function(o){var i=[],s=new b,u=new d(s),c=0,a=!1,l=function(){var n=!1;i.length>0&&(n=!a,a=!0),n&&s.setDisposable(e.scheduleRecursive(function(e){var n;if(!(i.length>0))return a=!1,r;n=i.shift();var s=new v;u.add(s),s.setDisposable(n.subscribe(function(e){o.onNext(e);var n=null;try{n=t(e)}catch(r){o.onError(r)}i.push(n),c++,l()},o.onError.bind(o),function(){u.remove(s),c--,0===c&&o.onCompleted()})),e()}))};return i.push(n),c++,l(),u})},u.forkJoin=function(){var t=i(arguments,0);return new a(function(e){var n=t.length;if(0===n)return e.onCompleted(),p;for(var o=new d,i=!1,s=Array(n),u=Array(n),c=Array(n),a=0;n>a;a++)(function(a){var l=t[a];o.add(l.subscribe(function(t){i||(s[a]=!0,c[a]=t)},function(t){i=!0,e.onError(t),o.dispose()},function(){if(!i){if(!s[a])return e.onCompleted(),r;u[a]=!0;for(var t=0;n>t;t++)if(!u[t])return;i=!0,e.onNext(c),e.onCompleted()}}))})(a);return o})},c.forkJoin=function(t,e){var n=this;return new a(function(o){var i,s,u=!1,c=!1,a=!1,l=!1,f=new v,h=new v;return f.setDisposable(n.subscribe(function(t){a=!0,i=t},function(t){h.dispose(),o.onError(t)},function(){if(u=!0,c)if(a)if(l){var t;try{t=e(i,s)}catch(n){return o.onError(n),r}o.onNext(t),o.onCompleted()}else o.onCompleted();else o.onCompleted()})),h.setDisposable(t.subscribe(function(t){l=!0,s=t},function(t){f.dispose(),o.onError(t)},function(){if(c=!0,u)if(a)if(l){var t;try{t=e(i,s)}catch(n){return o.onError(n),r}o.onNext(t),o.onCompleted()}else o.onCompleted();else o.onCompleted()})),new d(f,h)})},c.manySelect=function(t,e){e||(e=g);var n=this;return f(function(){var r;return n.select(function(t){var e=new _(t);return r&&r.onNext(t),r=e,e}).doAction(o,function(t){r&&r.onError(t)},function(){r&&r.onCompleted()}).observeOn(e).select(function(e,n,r){return t(e,n,r)})})};var _=function(t){function e(t){var e=this,n=new d;return n.add(x.schedule(function(){t.onNext(e.head),n.add(e.tail.mergeObservable().subscribe(t))})),n}function n(n){t.call(this,e),this.head=n,this.tail=new C}return S(n,t),N(n.prototype,D,{onCompleted:function(){this.onNext(u.empty())},onError:function(t){this.onNext(u.throwException(t))},onNext:function(t){this.tail.onNext(t),this.tail.onCompleted()}}),n}(u);return n}); \ No newline at end of file +(function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,o=e[typeof module]&&module&&!module.nodeType&&module,i=(o&&o.exports===r&&r,e[typeof global]&&global);!i||i.global!==i&&i.window!==i||(n=i),"function"==typeof define&&define.amd?define(["rx","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n,r){function o(){}function i(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:E.call(t)}function s(t,e){return new y(function(){return new m(function(){return t()?{done:!1,value:e}:{done:!0,value:r}})})}var u=n.Observable,c=u.prototype,a=n.AnonymousObservable,l=u.concat,f=u.defer,h=u.empty,p=n.Disposable.empty,d=n.CompositeDisposable,b=n.SerialDisposable,v=n.SingleAssignmentDisposable,m=n.internals.Enumerator,y=n.internals.Enumerable,w=y.forEach,g=n.Scheduler.immediate,x=n.Scheduler.currentThread,E=Array.prototype.slice,C=n.AsyncSubject,D=n.Observer,S=n.internals.inherits,A=n.internals.addProperties,N="object"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";t.Set&&"function"==typeof(new t.Set)["@@iterator"]&&(N="@@iterator"),c.letBind=c.let=function(t){return t(this)},u["if"]=u.ifThen=function(t,e,n){return f(function(){if(n||(n=h()),n.now){var r=n;n=h(r)}return t()?e:n})},u["for"]=u.forIn=function(t,e){return w(t,e).concat()};var _=u["while"]=u.whileDo=function(t,e){return s(t,e).concat()};c.doWhile=function(t){return l([this,_(t,this)])},u["case"]=u.switchCase=function(t,e,n){return f(function(){if(n||(n=h()),n.now){var o=n;n=h(o)}var i=e[t()];return i!==r?i:n})},c.expand=function(t,e){e||(e=g);var n=this;return new a(function(o){var i=[],s=new b,u=new d(s),c=0,a=!1,l=function(){var n=!1;i.length>0&&(n=!a,a=!0),n&&s.setDisposable(e.scheduleRecursive(function(e){var n;if(!(i.length>0))return a=!1,r;n=i.shift();var s=new v;u.add(s),s.setDisposable(n.subscribe(function(e){o.onNext(e);var n=null;try{n=t(e)}catch(r){o.onError(r)}i.push(n),c++,l()},o.onError.bind(o),function(){u.remove(s),c--,0===c&&o.onCompleted()})),e()}))};return i.push(n),c++,l(),u})},u.forkJoin=function(){var t=i(arguments,0);return new a(function(e){var n=t.length;if(0===n)return e.onCompleted(),p;for(var o=new d,i=!1,s=Array(n),u=Array(n),c=Array(n),a=0;n>a;a++)(function(a){var l=t[a];o.add(l.subscribe(function(t){i||(s[a]=!0,c[a]=t)},function(t){i=!0,e.onError(t),o.dispose()},function(){if(!i){if(!s[a])return e.onCompleted(),r;u[a]=!0;for(var t=0;n>t;t++)if(!u[t])return;i=!0,e.onNext(c),e.onCompleted()}}))})(a);return o})},c.forkJoin=function(t,e){var n=this;return new a(function(o){var i,s,u=!1,c=!1,a=!1,l=!1,f=new v,h=new v;return f.setDisposable(n.subscribe(function(t){a=!0,i=t},function(t){h.dispose(),o.onError(t)},function(){if(u=!0,c)if(a)if(l){var t;try{t=e(i,s)}catch(n){return o.onError(n),r}o.onNext(t),o.onCompleted()}else o.onCompleted();else o.onCompleted()})),h.setDisposable(t.subscribe(function(t){l=!0,s=t},function(t){f.dispose(),o.onError(t)},function(){if(c=!0,u)if(a)if(l){var t;try{t=e(i,s)}catch(n){return o.onError(n),r}o.onNext(t),o.onCompleted()}else o.onCompleted();else o.onCompleted()})),new d(f,h)})},c.manySelect=function(t,e){e||(e=g);var n=this;return f(function(){var r;return n.select(function(t){var e=new O(t);return r&&r.onNext(t),r=e,e}).doAction(o,function(t){r&&r.onError(t)},function(){r&&r.onCompleted()}).observeOn(e).select(function(e,n,r){return t(e,n,r)})})};var O=function(t){function e(t){var e=this,n=new d;return n.add(x.schedule(function(){t.onNext(e.head),n.add(e.tail.mergeObservable().subscribe(t))})),n}function n(n){t.call(this,e),this.head=n,this.tail=new C}return S(n,t),A(n.prototype,D,{onCompleted:function(){this.onNext(u.empty())},onError:function(t){this.onNext(u.throwException(t))},onNext:function(t){this.tail.onNext(t),this.tail.onCompleted()}}),n}(u);return n}); \ No newline at end of file diff --git a/rx.joinpatterns.min.js b/rx.joinpatterns.min.js index 4e4757a92..7387650e7 100644 --- a/rx.joinpatterns.min.js +++ b/rx.joinpatterns.min.js @@ -1 +1 @@ -(function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,o=e[typeof module]&&module&&!module.nodeType&&module,i=(o&&o.exports===r&&r,e[typeof global]&&global);!i||i.global!==i&&i.window!==i||(n=i),"function"==typeof define&&define.amd?define(["rx","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n){function r(){}function o(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:y.call(t)}function i(t){this.patterns=t}function s(t,e){this.expression=t,this.selector=e}function u(t,e,n){var r=t.get(e);if(!r){var o=new w(e,n);return t.set(e,o),o}return r}function c(t,e,n){var r,o;for(this.joinObserverArray=t,this.onNext=e,this.onCompleted=n,this.joinObservers=new g,r=0;this.joinObserverArray.length>r;r++)o=this.joinObserverArray[r],this.joinObservers.set(o,o)}var a=n.Observable,l=a.prototype,f=n.AnonymousObservable,h=a.throwException,p=n.Observer.create,d=n.SingleAssignmentDisposable,b=n.CompositeDisposable,v=n.internals.AbstractObserver;n.internals.isEqual;var m=n.internals.inherits,y=Array.prototype.slice,g=function(){function t(){this.keys=[],this.values=[]}return t.prototype["delete"]=function(t){var e=this.keys.indexOf(t);return-1!==e&&(this.keys.splice(e,1),this.values.splice(e,1)),-1!==e},t.prototype.get=function(t,e){var n=this.keys.indexOf(t);return-1!==n?this.values[n]:e},t.prototype.set=function(t,e){var n=this.keys.indexOf(t);-1!==n&&(this.values[n]=e),this.values[this.keys.push(t)-1]=e},t.prototype.size=function(){return this.keys.length},t.prototype.has=function(t){return-1!==this.keys.indexOf(t)},t.prototype.getKeys=function(){return this.keys.slice(0)},t.prototype.getValues=function(){return this.values.slice(0)},t}();i.prototype.and=function(t){var e=this.patterns.slice(0);return e.push(t),new i(e)},i.prototype.then=function(t){return new s(this,t)},s.prototype.activate=function(t,e,n){for(var r=this,o=[],i=0,s=this.expression.patterns.length;s>i;i++)o.push(u(t,this.expression.patterns[i],e.onError.bind(e)));var a=new c(o,function(){var t;try{t=r.selector.apply(r,arguments)}catch(n){return e.onError(n),undefined}e.onNext(t)},function(){for(var t=0,e=o.length;e>t;t++)o[t].removeActivePlan(a);n(a)});for(i=0,s=o.length;s>i;i++)o[i].addActivePlan(a);return a},c.prototype.dequeue=function(){for(var t=this.joinObservers.getValues(),e=0,n=t.length;n>e;e++)t[e].queue.shift()},c.prototype.match=function(){var t,e,n,r,o,i=!0;for(e=0,n=this.joinObserverArray.length;n>e;e++)if(0===this.joinObserverArray[e].queue.length){i=!1;break}if(i){for(t=[],r=!1,e=0,n=this.joinObserverArray.length;n>e;e++)t.push(this.joinObserverArray[e].queue[0]),"C"===this.joinObserverArray[e].queue[0].kind&&(r=!0);if(r)this.onCompleted();else{for(this.dequeue(),o=[],e=0;t.length>e;e++)o.push(t[e].value);this.onNext.apply(this,o)}}};var w=function(t){function e(e,n){t.call(this),this.source=e,this.onError=n,this.queue=[],this.activePlans=[],this.subscription=new d,this.isDisposed=!1}m(e,t);var n=e.prototype;return n.next=function(t){if(!this.isDisposed){if("E"===t.kind)return this.onError(t.exception),undefined;this.queue.push(t);for(var e=this.activePlans.slice(0),n=0,r=e.length;r>n;n++)e[n].match()}},n.error=r,n.completed=r,n.addActivePlan=function(t){this.activePlans.push(t)},n.subscribe=function(){this.subscription.setDisposable(this.source.materialize().subscribe(this))},n.removeActivePlan=function(t){var e=this.activePlans.indexOf(t);this.activePlans.splice(e,1),0===this.activePlans.length&&this.dispose()},n.dispose=function(){t.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},e}(v);return l.and=function(t){return new i([this,t])},l.then=function(t){return new i([this]).then(t)},a.when=function(){var t=o(arguments,0);return new f(function(e){var n,r,o,i,s,u,c=[],a=new g;u=p(e.onNext.bind(e),function(t){for(var n=a.getValues(),r=0,o=n.length;o>r;r++)n[r].onError(t);e.onError(t)},e.onCompleted.bind(e));try{for(r=0,o=t.length;o>r;r++)c.push(t[r].activate(a,u,function(t){var e=c.indexOf(t);c.splice(e,1),0===c.length&&u.onCompleted()}))}catch(l){h(l).subscribe(e)}for(n=new b,s=a.getValues(),r=0,o=s.length;o>r;r++)i=s[r],i.subscribe(),n.add(i);return n})},n}); \ No newline at end of file +(function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,o=e[typeof module]&&module&&!module.nodeType&&module,i=(o&&o.exports===r&&r,e[typeof global]&&global);!i||i.global!==i&&i.window!==i||(n=i),"function"==typeof define&&define.amd?define(["rx","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n){function r(){}function o(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:y.call(t)}function i(t){this.patterns=t}function s(t,e){this.expression=t,this.selector=e}function u(t,e,n){var r=t.get(e);if(!r){var o=new g(e,n);return t.set(e,o),o}return r}function c(t,e,n){var r,o;for(this.joinObserverArray=t,this.onNext=e,this.onCompleted=n,this.joinObservers=new w,r=0;this.joinObserverArray.length>r;r++)o=this.joinObserverArray[r],this.joinObservers.set(o,o)}var a=n.Observable,l=a.prototype,h=n.AnonymousObservable,f=a.throwException,p=n.Observer.create,d=n.SingleAssignmentDisposable,b=n.CompositeDisposable,v=n.internals.AbstractObserver;n.internals.isEqual;var m=n.internals.inherits,y=Array.prototype.slice,w=function(){function t(){this.keys=[],this.values=[]}return t.prototype["delete"]=function(t){var e=this.keys.indexOf(t);return-1!==e&&(this.keys.splice(e,1),this.values.splice(e,1)),-1!==e},t.prototype.get=function(t,e){var n=this.keys.indexOf(t);return-1!==n?this.values[n]:e},t.prototype.set=function(t,e){var n=this.keys.indexOf(t);-1!==n&&(this.values[n]=e),this.values[this.keys.push(t)-1]=e},t.prototype.size=function(){return this.keys.length},t.prototype.has=function(t){return-1!==this.keys.indexOf(t)},t.prototype.getKeys=function(){return this.keys.slice(0)},t.prototype.getValues=function(){return this.values.slice(0)},t}();i.prototype.and=function(t){var e=this.patterns.slice(0);return e.push(t),new i(e)},i.prototype.then=function(t){return new s(this,t)},s.prototype.activate=function(t,e,n){for(var r=this,o=[],i=0,s=this.expression.patterns.length;s>i;i++)o.push(u(t,this.expression.patterns[i],e.onError.bind(e)));var a=new c(o,function(){var t;try{t=r.selector.apply(r,arguments)}catch(n){return e.onError(n),undefined}e.onNext(t)},function(){for(var t=0,e=o.length;e>t;t++)o[t].removeActivePlan(a);n(a)});for(i=0,s=o.length;s>i;i++)o[i].addActivePlan(a);return a},c.prototype.dequeue=function(){for(var t=this.joinObservers.getValues(),e=0,n=t.length;n>e;e++)t[e].queue.shift()},c.prototype.match=function(){var t,e,n,r,o,i=!0;for(e=0,n=this.joinObserverArray.length;n>e;e++)if(0===this.joinObserverArray[e].queue.length){i=!1;break}if(i){for(t=[],r=!1,e=0,n=this.joinObserverArray.length;n>e;e++)t.push(this.joinObserverArray[e].queue[0]),"C"===this.joinObserverArray[e].queue[0].kind&&(r=!0);if(r)this.onCompleted();else{for(this.dequeue(),o=[],e=0;t.length>e;e++)o.push(t[e].value);this.onNext.apply(this,o)}}};var g=function(t){function e(e,n){t.call(this),this.source=e,this.onError=n,this.queue=[],this.activePlans=[],this.subscription=new d,this.isDisposed=!1}m(e,t);var n=e.prototype;return n.next=function(t){if(!this.isDisposed){if("E"===t.kind)return this.onError(t.exception),undefined;this.queue.push(t);for(var e=this.activePlans.slice(0),n=0,r=e.length;r>n;n++)e[n].match()}},n.error=r,n.completed=r,n.addActivePlan=function(t){this.activePlans.push(t)},n.subscribe=function(){this.subscription.setDisposable(this.source.materialize().subscribe(this))},n.removeActivePlan=function(t){var e=this.activePlans.indexOf(t);this.activePlans.splice(e,1),0===this.activePlans.length&&this.dispose()},n.dispose=function(){t.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},e}(v);return l.and=function(t){return new i([this,t])},l.then=function(t){return new i([this]).then(t)},a.when=function(){var t=o(arguments,0);return new h(function(e){var n,r,o,i,s,u,c=[],a=new w;u=p(e.onNext.bind(e),function(t){for(var n=a.getValues(),r=0,o=n.length;o>r;r++)n[r].onError(t);e.onError(t)},e.onCompleted.bind(e));try{for(r=0,o=t.length;o>r;r++)c.push(t[r].activate(a,u,function(t){var e=c.indexOf(t);c.splice(e,1),0===c.length&&u.onCompleted()}))}catch(l){f(l).subscribe(e)}for(n=new b,s=a.getValues(),r=0,o=s.length;o>r;r++)i=s[r],i.subscribe(),n.add(i);return n})},n}); \ No newline at end of file diff --git a/rx.js b/rx.js index c0ebb6874..f45c0c543 100644 --- a/rx.js +++ b/rx.js @@ -23,36 +23,33 @@ var Rx = { internals: {}, config: {} }; - // Defaults - function noop() { } - function identity(x) { return x; } - var defaultNow = Date.now; - function defaultComparer(x, y) { return isEqual(x, y); } - function defaultSubComparer(x, y) { return x - y; } - function defaultKeySerializer(x) { return x.toString(); } - function defaultError(err) { throw err; } - function isPromise(p) { return typeof p.then === 'function'; } - - // Errors - var sequenceContainsNoElements = 'Sequence contains no elements.'; - var argumentOutOfRange = 'Argument out of range'; - var objectDisposed = 'Object has been disposed'; - function checkDisposed() { - if (this.isDisposed) { - throw new Error(objectDisposed); - } - } + // Defaults + function noop() { } + function identity(x) { return x; } + var defaultNow = Date.now; + function defaultComparer(x, y) { return isEqual(x, y); } + function defaultSubComparer(x, y) { return x - y; } + function defaultKeySerializer(x) { return x.toString(); } + function defaultError(err) { throw err; } + function isPromise(p) { return typeof p.then === 'function' && typeof p.subscribe === 'undefined'; } + + // Errors + var sequenceContainsNoElements = 'Sequence contains no elements.'; + var argumentOutOfRange = 'Argument out of range'; + var objectDisposed = 'Object has been disposed'; + function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } } + + // Shim in iterator support + var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) || + '_es6shim_iterator_'; + // Firefox ships a partial implementation using the name @@iterator. + // https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14 + // So use that name if we detect it. + if (root.Set && typeof new root.Set()['@@iterator'] === 'function') { + $iterator$ = '@@iterator'; + } + var doneEnumerator = { done: true, value: undefined }; - // Shim in iterator support - var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) || - '_es6shim_iterator_'; - // Firefox ships a partial implementation using the name @@iterator. - // https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14 - // So use that name if we detect it. - if (window.Set && typeof new window.Set()['@@iterator'] === 'function') { - $iterator$ = '@@iterator'; - } - /** `Object#toString` result shortcuts */ var argsClass = '[object Arguments]', arrayClass = '[object Array]', @@ -1522,155 +1519,143 @@ }; }()); - /** - * @constructor - * @private - */ - var Enumerator = Rx.internals.Enumerator = function (moveNext, getCurrent) { - this.moveNext = moveNext; - this.getCurrent = getCurrent; - }; + var Enumerator = Rx.internals.Enumerator = function (next) { + this._next = next; + }; - /** - * @static - * @memberOf Enumerator - * @private - */ - var enumeratorCreate = Enumerator.create = function (moveNext, getCurrent) { - var done = false; - return new Enumerator(function () { - if (done) { - return false; - } - var result = moveNext(); - if (!result) { - done = true; - } - return result; - }, function () { return getCurrent(); }); - }; - - var Enumerable = Rx.internals.Enumerable = function (getEnumerator) { - this.getEnumerator = getEnumerator; - }; + Enumerator.prototype.next = function () { + return this._next(); + }; - Enumerable.prototype.concat = function () { - var sources = this; - return new AnonymousObservable(function (observer) { - var e = sources.getEnumerator(), isDisposed, subscription = new SerialDisposable(); - var cancelable = immediateScheduler.scheduleRecursive(function (self) { - var current, hasNext; - if (isDisposed) { return; } + Enumerator.prototype[$iterator$] = function () { return this; } - try { - hasNext = e.moveNext(); - if (hasNext) { - current = e.getCurrent(); - } - } catch (ex) { - observer.onError(ex); - return; - } + var Enumerable = Rx.internals.Enumerable = function (iterator) { + this._iterator = iterator; + }; - if (!hasNext) { - observer.onCompleted(); - return; - } + Enumerable.prototype[$iterator$] = function () { + return this._iterator(); + }; - var d = new SingleAssignmentDisposable(); - subscription.setDisposable(d); - d.setDisposable(current.subscribe( - observer.onNext.bind(observer), - observer.onError.bind(observer), - function () { self(); }) - ); - }); - return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { - isDisposed = true; - })); - }); - }; + Enumerable.prototype.concat = function () { + var sources = this; + return new AnonymousObservable(function (observer) { + var e; + try { + e = sources[$iterator$](); + } catch(err) { + observer.onError(); + return; + } - Enumerable.prototype.catchException = function () { - var sources = this; - return new AnonymousObservable(function (observer) { - var e = sources.getEnumerator(), isDisposed, lastException; - var subscription = new SerialDisposable(); - var cancelable = immediateScheduler.scheduleRecursive(function (self) { - var current, hasNext; - if (isDisposed) { return; } + var isDisposed, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursive(function (self) { + var currentItem; + if (isDisposed) { return; } - try { - hasNext = e.moveNext(); - if (hasNext) { - current = e.getCurrent(); - } - } catch (ex) { - observer.onError(ex); - return; - } + try { + currentItem = e.next(); + } catch (ex) { + observer.onError(ex); + return; + } - if (!hasNext) { - if (lastException) { - observer.onError(lastException); - } else { - observer.onCompleted(); - } - return; - } + if (currentItem.done) { + observer.onCompleted(); + return; + } - var d = new SingleAssignmentDisposable(); - subscription.setDisposable(d); - d.setDisposable(current.subscribe( - observer.onNext.bind(observer), - function (exn) { - lastException = exn; - self(); - }, - observer.onCompleted.bind(observer))); - }); - return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { - isDisposed = true; - })); + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(currentItem.value.subscribe( + observer.onNext.bind(observer), + observer.onError.bind(observer), + function () { self(); }) + ); }); - }; + return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { + isDisposed = true; + })); + }); + }; - var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) { - if (arguments.length === 1) { - repeatCount = -1; + Enumerable.prototype.catchException = function () { + var sources = this; + return new AnonymousObservable(function (observer) { + var e; + try { + e = sources[$iterator$](); + } catch(err) { + observer.onError(); + return; + } + + var isDisposed, + lastException, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursive(function (self) { + if (isDisposed) { return; } + + var currentItem; + try { + currentItem = e.next(); + } catch (ex) { + observer.onError(ex); + return; } - return new Enumerable(function () { - var current, left = repeatCount; - return enumeratorCreate(function () { - if (left === 0) { - return false; - } - if (left > 0) { - left--; - } - current = value; - return true; - }, function () { return current; }); - }); - }; - var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) { - selector || (selector = identity); - return new Enumerable(function () { - var current, index = -1; - return enumeratorCreate( - function () { - if (++index < source.length) { - current = selector.call(thisArg, source[index], index, source); - return true; - } - return false; - }, - function () { return current; } - ); + if (currentItem.done) { + if (lastException) { + observer.onError(lastException); + } else { + observer.onCompleted(); + } + return; + } + + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(currentItem.value.subscribe( + observer.onNext.bind(observer), + function (exn) { + lastException = exn; + self(); + }, + observer.onCompleted.bind(observer))); + }); + return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { + isDisposed = true; + })); + }); + }; + + + var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) { + if (repeatCount == null) { repeatCount = -1; } + return new Enumerable(function () { + var left = repeatCount; + return new Enumerator(function () { + if (left === 0) { return doneEnumerator; } + if (left > 0) { left--; } + return { done: false, value: value }; + }); + }); + }; + + var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) { + selector || (selector = identity); + return new Enumerable(function () { + var index = -1; + return new Enumerator( + function () { + return ++index < source.length ? + { done: false, value: selector.call(thisArg, source[index], index, source) } : + doneEnumerator; }); - }; + }); + }; /** * Supports push-style iteration over an observable sequence. @@ -2266,8 +2251,8 @@ * Converts an iterable into an Observable sequence * * @example - * var res = Rx.Observable.fromGenerator(new Map()); - * var res = Rx.Observable.fromArray(new Set(), Rx.Scheduler.timeout); + * var res = Rx.Observable.fromIterable(new Map()); + * var res = Rx.Observable.fromIterable(new Set(), Rx.Scheduler.timeout); * @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on. * @returns {Observable} The observable sequence whose elements are pulled from the given generator sequence. */ diff --git a/rx.lite.compat.js b/rx.lite.compat.js index c81acd4dc..f14d18a31 100644 --- a/rx.lite.compat.js +++ b/rx.lite.compat.js @@ -23,36 +23,33 @@ var Rx = { internals: {}, config: {} }; - // Defaults - function noop() { } - function identity(x) { return x; } - var defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()); - function defaultComparer(x, y) { return isEqual(x, y); } - function defaultSubComparer(x, y) { return x - y; } - function defaultKeySerializer(x) { return x.toString(); } - function defaultError(err) { throw err; } - function isPromise(p) { return typeof p.then === 'function'; } - - // Errors - var sequenceContainsNoElements = 'Sequence contains no elements.'; - var argumentOutOfRange = 'Argument out of range'; - var objectDisposed = 'Object has been disposed'; - function checkDisposed() { - if (this.isDisposed) { - throw new Error(objectDisposed); - } - } + // Defaults + function noop() { } + function identity(x) { return x; } + var defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()); + function defaultComparer(x, y) { return isEqual(x, y); } + function defaultSubComparer(x, y) { return x - y; } + function defaultKeySerializer(x) { return x.toString(); } + function defaultError(err) { throw err; } + function isPromise(p) { return typeof p.then === 'function' && typeof p.subscribe === 'undefined'; } + + // Errors + var sequenceContainsNoElements = 'Sequence contains no elements.'; + var argumentOutOfRange = 'Argument out of range'; + var objectDisposed = 'Object has been disposed'; + function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } } + + // Shim in iterator support + var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) || + '_es6shim_iterator_'; + // Firefox ships a partial implementation using the name @@iterator. + // https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14 + // So use that name if we detect it. + if (root.Set && typeof new root.Set()['@@iterator'] === 'function') { + $iterator$ = '@@iterator'; + } + var doneEnumerator = { done: true, value: undefined }; - // Shim in iterator support - var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) || - '_es6shim_iterator_'; - // Firefox ships a partial implementation using the name @@iterator. - // https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14 - // So use that name if we detect it. - if (window.Set && typeof new window.Set()['@@iterator'] === 'function') { - $iterator$ = '@@iterator'; - } - /** `Object#toString` result shortcuts */ var argsClass = '[object Arguments]', arrayClass = '[object Array]', @@ -1529,155 +1526,143 @@ }; }()); - /** - * @constructor - * @private - */ - var Enumerator = Rx.internals.Enumerator = function (moveNext, getCurrent) { - this.moveNext = moveNext; - this.getCurrent = getCurrent; - }; + var Enumerator = Rx.internals.Enumerator = function (next) { + this._next = next; + }; - /** - * @static - * @memberOf Enumerator - * @private - */ - var enumeratorCreate = Enumerator.create = function (moveNext, getCurrent) { - var done = false; - return new Enumerator(function () { - if (done) { - return false; - } - var result = moveNext(); - if (!result) { - done = true; - } - return result; - }, function () { return getCurrent(); }); - }; - - var Enumerable = Rx.internals.Enumerable = function (getEnumerator) { - this.getEnumerator = getEnumerator; - }; + Enumerator.prototype.next = function () { + return this._next(); + }; - Enumerable.prototype.concat = function () { - var sources = this; - return new AnonymousObservable(function (observer) { - var e = sources.getEnumerator(), isDisposed, subscription = new SerialDisposable(); - var cancelable = immediateScheduler.scheduleRecursive(function (self) { - var current, hasNext; - if (isDisposed) { return; } + Enumerator.prototype[$iterator$] = function () { return this; } - try { - hasNext = e.moveNext(); - if (hasNext) { - current = e.getCurrent(); - } - } catch (ex) { - observer.onError(ex); - return; - } + var Enumerable = Rx.internals.Enumerable = function (iterator) { + this._iterator = iterator; + }; - if (!hasNext) { - observer.onCompleted(); - return; - } + Enumerable.prototype[$iterator$] = function () { + return this._iterator(); + }; - var d = new SingleAssignmentDisposable(); - subscription.setDisposable(d); - d.setDisposable(current.subscribe( - observer.onNext.bind(observer), - observer.onError.bind(observer), - function () { self(); }) - ); - }); - return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { - isDisposed = true; - })); - }); - }; + Enumerable.prototype.concat = function () { + var sources = this; + return new AnonymousObservable(function (observer) { + var e; + try { + e = sources[$iterator$](); + } catch(err) { + observer.onError(); + return; + } - Enumerable.prototype.catchException = function () { - var sources = this; - return new AnonymousObservable(function (observer) { - var e = sources.getEnumerator(), isDisposed, lastException; - var subscription = new SerialDisposable(); - var cancelable = immediateScheduler.scheduleRecursive(function (self) { - var current, hasNext; - if (isDisposed) { return; } + var isDisposed, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursive(function (self) { + var currentItem; + if (isDisposed) { return; } - try { - hasNext = e.moveNext(); - if (hasNext) { - current = e.getCurrent(); - } - } catch (ex) { - observer.onError(ex); - return; - } + try { + currentItem = e.next(); + } catch (ex) { + observer.onError(ex); + return; + } - if (!hasNext) { - if (lastException) { - observer.onError(lastException); - } else { - observer.onCompleted(); - } - return; - } + if (currentItem.done) { + observer.onCompleted(); + return; + } - var d = new SingleAssignmentDisposable(); - subscription.setDisposable(d); - d.setDisposable(current.subscribe( - observer.onNext.bind(observer), - function (exn) { - lastException = exn; - self(); - }, - observer.onCompleted.bind(observer))); - }); - return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { - isDisposed = true; - })); + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(currentItem.value.subscribe( + observer.onNext.bind(observer), + observer.onError.bind(observer), + function () { self(); }) + ); }); - }; + return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { + isDisposed = true; + })); + }); + }; - var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) { - if (arguments.length === 1) { - repeatCount = -1; + Enumerable.prototype.catchException = function () { + var sources = this; + return new AnonymousObservable(function (observer) { + var e; + try { + e = sources[$iterator$](); + } catch(err) { + observer.onError(); + return; + } + + var isDisposed, + lastException, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursive(function (self) { + if (isDisposed) { return; } + + var currentItem; + try { + currentItem = e.next(); + } catch (ex) { + observer.onError(ex); + return; } - return new Enumerable(function () { - var current, left = repeatCount; - return enumeratorCreate(function () { - if (left === 0) { - return false; - } - if (left > 0) { - left--; - } - current = value; - return true; - }, function () { return current; }); - }); - }; - var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) { - selector || (selector = identity); - return new Enumerable(function () { - var current, index = -1; - return enumeratorCreate( - function () { - if (++index < source.length) { - current = selector.call(thisArg, source[index], index, source); - return true; - } - return false; - }, - function () { return current; } - ); + if (currentItem.done) { + if (lastException) { + observer.onError(lastException); + } else { + observer.onCompleted(); + } + return; + } + + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(currentItem.value.subscribe( + observer.onNext.bind(observer), + function (exn) { + lastException = exn; + self(); + }, + observer.onCompleted.bind(observer))); + }); + return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { + isDisposed = true; + })); + }); + }; + + + var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) { + if (repeatCount == null) { repeatCount = -1; } + return new Enumerable(function () { + var left = repeatCount; + return new Enumerator(function () { + if (left === 0) { return doneEnumerator; } + if (left > 0) { left--; } + return { done: false, value: value }; + }); + }); + }; + + var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) { + selector || (selector = identity); + return new Enumerable(function () { + var index = -1; + return new Enumerator( + function () { + return ++index < source.length ? + { done: false, value: selector.call(thisArg, source[index], index, source) } : + doneEnumerator; }); - }; + }); + }; /** * Supports push-style iteration over an observable sequence. @@ -2086,8 +2071,8 @@ * Converts an iterable into an Observable sequence * * @example - * var res = Rx.Observable.fromGenerator(new Map()); - * var res = Rx.Observable.fromArray(new Set(), Rx.Scheduler.timeout); + * var res = Rx.Observable.fromIterable(new Map()); + * var res = Rx.Observable.fromIterable(new Set(), Rx.Scheduler.timeout); * @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on. * @returns {Observable} The observable sequence whose elements are pulled from the given generator sequence. */ diff --git a/rx.lite.compat.min.js b/rx.lite.compat.min.js index f7156eff1..58b57284d 100644 --- a/rx.lite.compat.min.js +++ b/rx.lite.compat.min.js @@ -1,2 +1,2 @@ -(function(t){function e(){}function n(t){return t}function r(t,e){return ue(t,e)}function i(t,e){return t-e}function o(t){throw t}function s(t){return"function"==typeof t.then}function u(){if(this.isDisposed)throw Error(V)}function c(t){var e=typeof t;return t&&("function"==e||"object"==e)||!1}function a(t){var e=[];if(!c(t))return e;se.nonEnumArgs&&t.length&&p(t)&&(t=ce.call(t));var n=se.enumPrototypes&&"function"==typeof t,r=se.enumErrorProps&&(t===te||t instanceof Error);for(var i in t)n&&"prototype"==i||r&&("message"==i||"name"==i)||e.push(i);if(se.nonEnumShadows&&t!==ee){var o=t.constructor,s=-1,u=ie.length;if(t===(o&&o.prototype))var a=t===stringProto?J:t===te?H:G.call(t),l=oe[a];for(;u>++s;)i=ie[s],l&&l[i]||!Y.call(t,i)||e.push(i)}return e}function l(t,e,n){for(var r=-1,i=n(t),o=i.length;o>++r;){var s=i[r];if(e(t[s],s,t)===!1)break}return t}function h(t,e){return l(t,e,a)}function f(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function p(t){return t&&"object"==typeof t?G.call(t)==I:!1}function d(t){return"function"==typeof t}function b(e,n,r,i){if(e===n)return 0!==e||1/e==1/n;var o=typeof e,s=typeof n;if(e===e&&(null==e||null==n||"function"!=o&&"object"!=o&&"function"!=s&&"object"!=s))return!1;var u=G.call(e),c=G.call(n);if(u==I&&(u=X),c==I&&(c=X),u!=c)return!1;switch(u){case B:case U:return+e==+n;case $:return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case K:case J:return e==n+""}var a=u==F;if(!a){if(u!=X||!se.nodeClass&&(f(e)||f(n)))return!1;var l=!se.argsObject&&p(e)?Object:e.constructor,v=!se.argsObject&&p(n)?Object:n.constructor;if(!(l==v||Y.call(e,"constructor")&&Y.call(n,"constructor")||d(l)&&l instanceof l&&d(v)&&v instanceof v||!("constructor"in e&&"constructor"in n)))return!1}r||(r=[]),i||(i=[]);for(var m=r.length;m--;)if(r[m]==e)return i[m]==n;var y=0;if(result=!0,r.push(e),i.push(n),a){if(m=e.length,y=n.length,result=y==m)for(;y--;){var w=n[y];if(!(result=b(e[y],w,r,i)))break}}else h(n,function(n,o,s){return Y.call(s,o)?(y++,result=Y.call(e,o)&&b(e[o],n,r,i)):t}),result&&h(e,function(e,n,r){return Y.call(r,n)?result=--y>-1:t});return r.pop(),i.pop(),result}function v(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:ce.call(t)}function m(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function y(e,n){return new hn(function(r){var i=new xe,o=new Ce;return o.setDisposable(i),i.setDisposable(e.subscribe(r.onNext.bind(r),function(e){var i,s;try{s=n(e)}catch(u){return r.onError(u),t}i=new xe,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function w(e,n){var r=this;return new hn(function(i){var o=0,s=e.length;return r.subscribe(function(r){if(s>o){var u,c=e[o++];try{u=n(r,c)}catch(a){return i.onError(a),t}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function g(t){return this.select(function(e,n){var r=t(e,n);return s(r)?on(r):r}).mergeObservable()}function E(t){var e=function(){this.cancelBubble=!0},n=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(t){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(t||(t=window.event),!t.target)switch(t.target=t.target||t.srcElement,"mouseover"==t.type&&(t.relatedTarget=t.fromElement),"mouseout"==t.type&&(t.relatedTarget=t.toElement),t.stopPropagation||(t.stopPropagation=e,t.preventDefault=n),t.type){case"keypress":var r="charCode"in t?t.charCode:t.keyCode;10==r?(r=0,t.keyCode=13):13==r||27==r?r=0:3==r&&(r=99),t.charCode=r,t.keyChar=t.charCode?String.fromCharCode(t.charCode):""}return t}function x(t,e,n){if(t.addListener)return t.addListener(e,n),we(function(){t.removeListener(e,n)});if(t.addEventListener)return t.addEventListener(e,n,!1),we(function(){t.removeEventListener(e,n,!1)});if(t.attachEvent){var r=function(t){n(E(t))};return t.attachEvent("on"+e,r),we(function(){t.detachEvent("on"+e,r)})}return t["on"+e]=n,we(function(){t["on"+e]=null})}function C(t,e,n){var r=new ve;if(t&&t.length)for(var i=0,o=t.length;o>i;i++)r.add(C(t[i],e,n));else t&&r.add(x(t,e,n));return r}function D(t,e){var n=Ne(t);return new hn(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function S(t,e,n){return t===e?new hn(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):Xe(function(){return observableTimerDateAndPeriod(n.now()+t,e,n)})}function N(t,e){return new hn(function(n){function r(){s&&(s=!1,n.onNext(o)),i&&n.onCompleted()}var i,o,s;return new ve(t.subscribe(function(t){s=!0,o=t},n.onError.bind(n),function(){i=!0}),e.subscribe(r,n.onError.bind(n),r))})}function A(e,r,i){return new hn(function(o){function s(e,r){h[r]=e;var s;if(c[r]=!0,a||(a=c.every(n))){try{s=i.apply(null,h)}catch(u){return o.onError(u),t}o.onNext(s)}else l&&o.onCompleted()}var u=2,c=[!1,!1],a=!1,l=!1,h=Array(u);return new ve(e.subscribe(function(t){s(t,0)},o.onError.bind(o),function(){l=!0,o.onCompleted()}),r.subscribe(function(t){s(t,1)},o.onError.bind(o)))})}var O={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},R=O[typeof window]&&window||this,_=O[typeof exports]&&exports&&!exports.nodeType&&exports,j=O[typeof module]&&module&&!module.nodeType&&module,W=j&&j.exports===_&&_,q=O[typeof global]&&global;!q||q.global!==q&&q.window!==q||(R=q);var k={internals:{},config:{}},T=function(){return Date.now?Date.now:function(){return+new Date}}(),P="Sequence contains no elements.",L="Argument out of range",V="Object has been disposed",z="object"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";window.Set&&"function"==typeof(new window.Set)["@@iterator"]&&(z="@@iterator");var M,I="[object Arguments]",F="[object Array]",B="[object Boolean]",U="[object Date]",H="[object Error]",Q="[object Function]",$="[object Number]",X="[object Object]",K="[object RegExp]",J="[object String]",G=Object.prototype.toString,Y=Object.prototype.hasOwnProperty,Z=G.call(arguments)==I,te=Error.prototype,ee=Object.prototype,ne=ee.propertyIsEnumerable;try{M=!(G.call(document)==X&&!({toString:0}+""))}catch(re){M=!0}var ie=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],oe={};oe[F]=oe[U]=oe[$]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},oe[B]=oe[J]={constructor:!0,toString:!0,valueOf:!0},oe[H]=oe[Q]=oe[K]={constructor:!0,toString:!0},oe[X]={constructor:!0};var se={};(function(){var t=function(){this.x=1},e=[];t.prototype={valueOf:1,y:1};for(var n in new t)e.push(n);for(n in arguments);se.enumErrorProps=ne.call(te,"message")||ne.call(te,"name"),se.enumPrototypes=ne.call(t,"prototype"),se.nonEnumArgs=0!=n,se.nonEnumShadows=!/valueOf/.test(e)})(1),Z||(p=function(t){return t&&"object"==typeof t?Y.call(t,"callee"):!1}),d(/x/)&&(d=function(t){return"function"==typeof t&&G.call(t)==Q});var ue=k.internals.isEqual=function(t,e){return b(t,e,[],[])},ce=Array.prototype.slice;({}).hasOwnProperty;var ae=this.inherits=k.internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},le=k.internals.addProperties=function(t){for(var e=ce.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}};k.internals.addRef=function(t,e){return new hn(function(n){return new ve(e.getDisposable(),t.subscribe(n))})},Function.prototype.bind||(Function.prototype.bind=function(t){var e=this,n=ce.call(arguments,1),r=function(){function i(){}if(this instanceof r){i.prototype=e.prototype;var o=new i,s=e.apply(o,n.concat(ce.call(arguments)));return Object(s)===s?s:o}return e.apply(t,n.concat(ce.call(arguments)))};return r});var he=Object("a"),fe="a"!=he[0]||!(0 in he);Array.prototype.every||(Array.prototype.every=function(t){var e=Object(this),n=fe&&{}.toString.call(this)==J?this.split(""):e,r=n.length>>>0,i=arguments[1];if({}.toString.call(t)!=Q)throw new TypeError(t+" is not a function");for(var o=0;r>o;o++)if(o in n&&!t.call(i,n[o],o,e))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(t){var e=Object(this),n=fe&&{}.toString.call(this)==J?this.split(""):e,r=n.length>>>0,i=Array(r),o=arguments[1];if({}.toString.call(t)!=Q)throw new TypeError(t+" is not a function");for(var s=0;r>s;s++)s in n&&(i[s]=t.call(o,n[s],s,e));return i}),Array.prototype.filter||(Array.prototype.filter=function(t){for(var e,n=[],r=Object(this),i=0,o=r.length>>>0;o>i;i++)e=r[i],i in r&&t.call(arguments[1],e,i,r)&&n.push(e);return n}),Array.isArray||(Array.isArray=function(t){return Object.prototype.toString.call(t)==F}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=Object(this),n=e.length>>>0;if(0===n)return-1;var r=0;if(arguments.length>1&&(r=Number(arguments[1]),r!==r?r=0:0!==r&&1/0!=r&&r!==-1/0&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=n)return-1;for(var i=r>=0?r:Math.max(n-Math.abs(r),0);n>i;i++)if(i in e&&e[i]===t)return i;return-1});var pe=function(t,e){this.id=t,this.value=e};pe.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var de=k.internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},be=de.prototype;be.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},be.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},be.heapify=function(e){if(e===t&&(e=0),!(e>=this.length||0>e)){var n=2*e+1,r=2*e+2,i=e;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==e){var o=this.items[e];this.items[e]=this.items[i],this.items[i]=o,this.heapify(i)}}},be.peek=function(){return this.items[0].value},be.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},be.dequeue=function(){var t=this.peek();return this.removeAt(0),t},be.enqueue=function(t){var e=this.length++;this.items[e]=new pe(de.count++,t),this.percolate(e)},be.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},de.count=0;var ve=k.CompositeDisposable=function(){this.disposables=v(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},me=ve.prototype;me.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},me.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},me.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},me.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},me.contains=function(t){return-1!==this.disposables.indexOf(t)},me.toArray=function(){return this.disposables.slice(0)};var ye=k.Disposable=function(t){this.isDisposed=!1,this.action=t||e};ye.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var we=ye.create=function(t){return new ye(t)},ge=ye.empty={dispose:e},Ee=function(){function t(t){this.isSingle=t,this.isDisposed=!1,this.current=null}var e=t.prototype;return e.getDisposable=function(){return this.current},e.setDisposable=function(t){if(this.current&&this.isSingle)throw Error("Disposable has already been assigned");var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},e.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()},t}(),xe=k.SingleAssignmentDisposable=function(t){function e(){t.call(this,!0)}return ae(e,t),e}(Ee),Ce=k.SerialDisposable=function(t){function e(){t.call(this,!1)}return ae(e,t),e}(Ee);k.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?ge:new t(this)},e}();var De=k.internals.ScheduledItem=function(t,e,n,r,o){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=o||i,this.disposable=new xe};De.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},De.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},De.prototype.isCancelled=function(){return this.disposable.isDisposed},De.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Se=k.Scheduler=function(){function t(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function e(t,e){var n=e.first,r=e.second,i=new ve,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),ge});r||(i.add(s),n=!0)})};return o(n),i}function n(t,e,n){var r=e.first,i=e.second,o=new ve,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),ge});u||(o.add(c),i=!0)})};return s(r),o}function r(t,e){return e(),ge}var i=t.prototype;return i.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},i.schedulePeriodicWithState=function(t,e,n){var r=t,i=setInterval(function(){r=n(r)},e);return we(function(){clearInterval(i)})},i.schedule=function(t){return this._schedule(t,r)},i.scheduleWithState=function(t,e){return this._schedule(t,e)},i.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,r)},i.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},i.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,r)},i.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},i.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},i.scheduleRecursiveWithState=function(t,n){return this.scheduleWithState({first:t,second:n},function(t,n){return e(t,n)})},i.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithRelativeAndState=function(t,e,r){return this._scheduleRelative({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithRelativeAndState")})},i.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithAbsoluteAndState=function(t,e,r){return this._scheduleAbsolute({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithAbsoluteAndState")})},t.now=T,t.normalize=function(t){return 0>t&&(t=0),t},t}(),Ne=Se.normalize,Ae=Se.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){for(var r=Ne(r);r-this.now()>0;);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Se(T,t,e,n)}(),Oe=Se.currentThread=function(){function t(t){for(var e;t.length>0;)if(e=t.dequeue(),!e.isCancelled()){for(;e.dueTime-Se.now()>0;);e.isCancelled()||e.invoke()}}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o=this.now()+Se.normalize(n),s=new De(this,e,r,o);if(i)i.enqueue(s);else{i=new de(4),i.enqueue(s);try{t(i)}catch(u){throw u}finally{i=null}}return s.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i,o=new Se(T,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}();k.internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new xe;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();var Re,_e=e;(function(){function t(){if(!R.postMessage||R.importScripts)return!1;var t=!1,e=R.onmessage;return R.onmessage=function(){t=!0},R.postMessage("","*"),R.onmessage=e,t}function e(t){if("string"==typeof t.data&&t.data.substring(0,o.length)===o){var e=t.data.substring(o.length),n=s[e];n(),delete s[e]}}var n=RegExp("^"+(G+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),r="function"==typeof(r=q&&W&&q.setImmediate)&&!n.test(r)&&r,i="function"==typeof(i=q&&W&&q.clearImmediate)&&!n.test(i)&&i;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Re=process.nextTick;else if("function"==typeof r)Re=r,_e=i;else if(t()){var o="ms.rx.schedule"+Math.random(),s={},u=0;R.addEventListener?R.addEventListener("message",e,!1):R.attachEvent("onmessage",e,!1),Re=function(t){var e=u++;s[e]=t,R.postMessage(o+e,"*")}}else if(R.MessageChannel){var c=new R.MessageChannel,a={},l=0;c.port1.onmessage=function(t){var e=t.data,n=a[e];n(),delete a[e]},Re=function(t){var e=l++;a[e]=t,c.port2.postMessage(e)}}else"document"in R&&"onreadystatechange"in R.document.createElement("script")?Re=function(t){var e=R.document.createElement("script");e.onreadystatechange=function(){t(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},R.document.documentElement.appendChild(e)}:(Re=function(t){return setTimeout(t,0)},_e=clearTimeout)})();var je=Se.timeout=function(){function t(t,e){var n=this,r=new xe,i=Re(function(){r.isDisposed||r.setDisposable(e(n,t))});return new ve(r,we(function(){_e(i)}))}function e(t,e,n){var r=this,i=Se.normalize(e);if(0===i)return r.scheduleWithState(t,n);var o=new xe,s=setTimeout(function(){o.isDisposed||o.setDisposable(n(r,t))},i);return new ve(o,we(function(){clearTimeout(s)}))}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Se(T,t,e,n)}(),We=k.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t||(t=Ae),new hn(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),qe=We.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new We("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),ke=We.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new We("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),Te=We.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new We("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),Pe=k.internals.Enumerator=function(t,e){this.moveNext=t,this.getCurrent=e},Le=Pe.create=function(t,e){var n=!1;return new Pe(function(){if(n)return!1;var e=t();return e||(n=!0),e},function(){return e()})},Ve=k.internals.Enumerable=function(t){this.getEnumerator=t};Ve.prototype.concat=function(){var e=this;return new hn(function(n){var r,i=e.getEnumerator(),o=new Ce,s=Ae.scheduleRecursive(function(e){var s,u;if(!r){try{u=i.moveNext(),u&&(s=i.getCurrent())}catch(c){return n.onError(c),t}if(!u)return n.onCompleted(),t;var a=new xe;o.setDisposable(a),a.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){e()}))}});return new ve(o,s,we(function(){r=!0}))})},Ve.prototype.catchException=function(){var e=this;return new hn(function(n){var r,i,o=e.getEnumerator(),s=new Ce,u=Ae.scheduleRecursive(function(e){var u,c;if(!r){try{c=o.moveNext(),c&&(u=o.getCurrent())}catch(a){return n.onError(a),t}if(!c)return i?n.onError(i):n.onCompleted(),t;var l=new xe;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(t){i=t,e()},n.onCompleted.bind(n)))}});return new ve(s,u,we(function(){r=!0}))})};var ze=Ve.repeat=function(t,e){return 1===arguments.length&&(e=-1),new Ve(function(){var n,r=e;return Le(function(){return 0===r?!1:(r>0&&r--,n=t,!0)},function(){return n})})},Me=Ve.forEach=function(t,e,r){return e||(e=n),new Ve(function(){var n,i=-1;return Le(function(){return++i0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var r;if(!(n.queue.length>0))return n.isAcquired=!1,t;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}e()}))},n.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},n}(Ue);Qe.create=Qe.createWithDisposable=function(t){return new hn(t)};var Xe=Qe.defer=function(t){return new hn(function(e){var n;try{n=t()}catch(r){return Ze(r).subscribe(e)}return n.subscribe(e)})},Ke=Qe.empty=function(t){return t||(t=Ae),new hn(function(e){return t.schedule(function(){e.onCompleted()})})},Je=Qe.fromArray=function(t,e){return e||(e=Oe),new hn(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};Qe.fromIterable=function(e,n){return n||(n=Oe),new hn(function(r){var i;try{i=e[z]()}catch(o){return r.onError(o),t}return n.scheduleRecursive(function(e){var n;try{n=i.next()}catch(o){return r.onError(o),t}n.done?r.onCompleted():(r.onNext(n.value),e())})})},Qe.generate=function(e,n,r,i,o){return o||(o=Oe),new hn(function(s){var u=!0,c=e;return o.scheduleRecursive(function(e){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(l){return s.onError(l),t}o?(s.onNext(a),e()):s.onCompleted()})})};var Ge=Qe.never=function(){return new hn(function(){return ge})};Qe.range=function(t,e,n){return n||(n=Oe),new hn(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},Qe.repeat=function(t,e,n){return n||(n=Oe),null==e&&(e=-1),Ye(t,n).repeat(e)};var Ye=Qe["return"]=Qe.returnValue=function(t,e){return e||(e=Ae),new hn(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Ze=Qe["throw"]=Qe.throwException=function(t,e){return e||(e=Ae),new hn(function(n){return e.schedule(function(){n.onError(t)})})};Be["catch"]=Be.catchException=function(t){return"function"==typeof t?y(this,t):tn([this,t])};var tn=Qe.catchException=Qe["catch"]=function(){var t=v(arguments,0);return Me(t).catchException()};Be.combineLatest=function(){var t=ce.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),en.apply(this,t)};var en=Qe.combineLatest=function(){var e=ce.call(arguments),r=e.pop();return Array.isArray(e[0])&&(e=e[0]),new hn(function(i){function o(e){var o;if(a[e]=!0,l||(l=a.every(n))){try{o=r.apply(null,f)}catch(s){return i.onError(s),t}i.onNext(o)}else h.filter(function(t,n){return n!==e}).every(n)&&i.onCompleted()}function s(t){h[t]=!0,h.every(n)&&i.onCompleted()}for(var u=function(){return!1},c=e.length,a=m(c,u),l=!1,h=m(c,u),f=Array(c),p=Array(c),d=0;c>d;d++)(function(t){p[t]=new xe,p[t].setDisposable(e[t].subscribe(function(e){f[t]=e,o(t)},i.onError.bind(i),function(){s(t)}))})(d);return new ve(p)})};Be.concat=function(){var t=ce.call(arguments,0);return t.unshift(this),nn.apply(this,t)};var nn=Qe.concat=function(){var t=v(arguments,0);return Me(t).concat()};Be.concatObservable=Be.concatAll=function(){return this.merge(1)},Be.merge=function(t){if("number"!=typeof t)return rn(this,t);var e=this;return new hn(function(n){var r=0,i=new ve,o=!1,u=[],c=function(t){var e=new xe;i.add(e),s(t)&&(t=on(t)),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),u.length>0?(t=u.shift(),c(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,c(e)):u.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var rn=Qe.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=ce.call(arguments,1)):(t=Ae,e=ce.call(arguments,0)):(t=Ae,e=ce.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Je(e,t).mergeObservable()};Be.mergeObservable=Be.mergeAll=function(){var t=this;return new hn(function(e){var n=new ve,r=!1,i=new xe;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new xe;n.add(i),s(t)&&(t=on(t)),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},Be.skipUntil=function(t){var e=this;return new hn(function(n){var r=!1,i=new ve(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new xe;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Be["switch"]=Be.switchLatest=function(){var t=this;return new hn(function(e){var n=!1,r=new Ce,i=!1,o=0,u=t.subscribe(function(t){var u=new xe,c=++o;n=!0,r.setDisposable(u),s(t)&&(t=on(t)),u.setDisposable(t.subscribe(function(t){o===c&&e.onNext(t)},function(t){o===c&&e.onError(t)},function(){o===c&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new ve(u,r)})},Be.takeUntil=function(t){var n=this;return new hn(function(r){return new ve(n.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),e))})},Be.zip=function(){if(Array.isArray(arguments[0]))return w.apply(this,arguments);var e=this,r=ce.call(arguments),i=r.pop();return r.unshift(e),new hn(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=r.length,c=m(u,function(){return[]}),a=m(u,function(){return!1}),l=function(r){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(e,u)}catch(l){return o.onError(l),t}o.onNext(s)}else a.filter(function(t,e){return e!==r}).every(n)&&o.onCompleted()},h=Array(u),f=0;u>f;f++)(function(t){h[t]=new xe,h[t].setDisposable(r[t].subscribe(function(e){c[t].push(e),l(t)},o.onError.bind(o),function(){s(t)}))})(f);return new ve(h)})},Qe.zip=function(){var t=ce.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},Qe.zipArray=function(){var e=v(arguments,0);return new hn(function(r){function i(e){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});r.onNext(i)}else if(c.filter(function(t,n){return n!==e}).every(n))return r.onCompleted(),t}function o(e){return c[e]=!0,c.every(n)?(r.onCompleted(),t):t}for(var s=e.length,u=m(s,function(){return[]}),c=m(s,function(){return!1}),a=Array(s),l=0;s>l;l++)(function(t){a[t]=new xe,a[t].setDisposable(e[t].subscribe(function(e){u[t].push(e),i(t)},r.onError.bind(r),function(){o(t)}))})(l);var h=new ve(a);return h.add(we(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),h})},Be.asObservable=function(){var t=this;return new hn(function(e){return t.subscribe(e)})},Be.dematerialize=function(){var t=this;return new hn(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Be.distinctUntilChanged=function(e,i){var o=this;return e||(e=n),i||(i=r),new hn(function(n){var r,s=!1;return o.subscribe(function(o){var u,c=!1;try{u=e(o)}catch(a){return n.onError(a),t}if(s)try{c=i(r,u)}catch(a){return n.onError(a),t}s&&c||(s=!0,r=u,n.onNext(o))},n.onError.bind(n),n.onCompleted.bind(n))})},Be["do"]=Be.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new hn(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},Be["finally"]=Be.finallyAction=function(t){var e=this;return new hn(function(n){var r=e.subscribe(n);return we(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},Be.ignoreElements=function(){var t=this;return new hn(function(n){return t.subscribe(e,n.onError.bind(n),n.onCompleted.bind(n))})},Be.materialize=function(){var t=this;return new hn(function(e){return t.subscribe(function(t){e.onNext(qe(t))},function(t){e.onNext(ke(t)),e.onCompleted()},function(){e.onNext(Te()),e.onCompleted()})})},Be.repeat=function(t){return ze(this,t).concat()},Be.retry=function(t){return ze(this,t).catchException()},Be.scan=function(){var e,n,r=!1,i=this;return 2===arguments.length?(r=!0,e=arguments[0],n=arguments[1]):n=arguments[0],new hn(function(o){var s,u,c;return i.subscribe(function(i){try{c||(c=!0),s?u=n(u,i):(u=r?n(e,i):i,s=!0)}catch(a){return o.onError(a),t}o.onNext(u)},o.onError.bind(o),function(){!c&&r&&o.onNext(e),o.onCompleted()})})},Be.skipLast=function(t){var e=this;return new hn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},Be.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=Ae,t=ce.call(arguments,n),Me([Je(t,e),this]).concat() -},Be.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Je(t,e)})},Be.takeLastBuffer=function(t){var e=this;return new hn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},Be.select=Be.map=function(e,n){var r=this;return new hn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Be.selectMany=Be.flatMap=function(t,e){return e?this.selectMany(function(n,r){var i=t(n,r),o=s(i)?on(i):i;return o.select(function(t){return e(n,t,r)})}):"function"==typeof t?g.call(this,t):g.call(this,function(){return t})},Be.selectSwitch=Be.flatMapLatest=function(t,e){return this.select(t,e).switchLatest()},Be.skip=function(t){if(0>t)throw Error(L);var e=this;return new hn(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Be.skipWhile=function(e,n){var r=this;return new hn(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Be.take=function(t,e){if(0>t)throw Error(L);if(0===t)return Ke(e);var n=this;return new hn(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},Be.takeWhile=function(e,n){var r=this;return new hn(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},Be.where=Be.filter=function(e,n){var r=this;return new hn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})},Qe.fromCallback=function(e,n,r,i){return n||(n=Ae),function(){var o=ce.call(arguments,0);return new hn(function(s){return n.schedule(function(){function n(e){var n=e;if(i)try{n=i(arguments)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}},Qe.fromNodeCallback=function(e,n,r,i){return n||(n=Ae),function(){var o=ce.call(arguments,0);return new hn(function(s){return n.schedule(function(){function n(e){if(e)return s.onError(e),t;var n=ce.call(arguments,1);if(i)try{n=i(n)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}},Qe.fromEvent=function(e,n,r){return new hn(function(i){return C(e,n,function(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)})}).publish().refCount()},Qe.fromEventPattern=function(e,n,r){return new hn(function(i){function o(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)}var s=e(o);return we(function(){n&&n(o,s)})}).publish().refCount()};var on=Qe.fromPromise=function(t){return new hn(function(e){t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)})})};Be.toPromise=function(t){if(t||(t=k.config.Promise),!t)throw Error("Promise type not provided nor in Rx.config.Promise");var e=this;return new t(function(t,n){var r,i=!1;e.subscribe(function(t){r=t,i=!0},function(t){n(t)},function(){i&&t(r)})})},Qe.startAsync=function(t){var e;try{e=t()}catch(n){return Ze(n)}return on(e)},Be.multicast=function(t,e){var n=this;return"function"==typeof t?new hn(function(r){var i=n.multicast(t());return new ve(e(i).subscribe(r),i.connect())}):new sn(n,t)},Be.publish=function(t){return t?this.multicast(function(){return new dn},t):this.multicast(new dn)},Be.share=function(){return this.publish(null).refCount()},Be.publishLast=function(t){return t?this.multicast(function(){return new bn},t):this.multicast(new bn)},Be.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new mn(e)},t):this.multicast(new mn(t))},Be.shareValue=function(t){return this.publishValue(t).refCount()},Be.replay=function(t,e,n,r){return t?this.multicast(function(){return new yn(e,n,r)},t):this.multicast(new yn(e,n,r))},Be.shareReplay=function(t,e,n){return this.replay(null,t,e,n).refCount()};var sn=k.ConnectableObservable=function(t){function e(e,n){function r(t){return i.subject.subscribe(t)}var i={subject:n,source:e.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return i.hasSubscription||(i.hasSubscription=!0,i.subscription=new ve(i.source.subscribe(i.subject),we(function(){i.hasSubscription=!1}))),i.subscription},t.call(this,r)}return ae(e,t),e.prototype.connect=function(){return this.connect()},e.prototype.refCount=function(){var t=null,e=0,n=this;return new hn(function(r){var i,o;return e++,i=1===e,o=n.subscribe(r),i&&(t=n.connect()),we(function(){o.dispose(),e--,0===e&&t.dispose()})})},e}(Qe),un=Qe.interval=function(t,e){return e||(e=je),S(t,t,e)},cn=Qe.timer=function(e,n,r){var i;return r||(r=je),"number"==typeof n?i=n:"object"==typeof n&&"now"in n&&(r=n),i===t?D(e,r):S(e,i,r)};Be.delay=function(t,e){e||(e=je);var n=this;return new hn(function(r){var i,o=!1,s=new Ce,u=null,c=[],a=!1;return i=n.materialize().timestamp(e).subscribe(function(n){var i,l;"E"===n.value.kind?(c=[],c.push(n),u=n.value.exception,l=!a):(c.push({value:n.value,timestamp:n.timestamp+t}),l=!o,o=!0),l&&(null!==u?r.onError(u):(i=new xe,s.setDisposable(i),i.setDisposable(e.scheduleRecursiveWithRelative(t,function(t){var n,i,s,l;if(null===u){a=!0;do s=null,c.length>0&&0>=c[0].timestamp-e.now()&&(s=c.shift().value),null!==s&&s.accept(r);while(null!==s);l=!1,i=0,c.length>0?(l=!0,i=Math.max(0,c[0].timestamp-e.now())):o=!1,n=u,a=!1,null!==n?r.onError(n):l&&t(i)}}))))}),new ve(i,s)})},Be.throttle=function(t,e){return e||(e=je),this.throttleWithSelector(function(){return cn(t,e)})},Be.timeInterval=function(t){var e=this;return t||(t=je),Xe(function(){var n=t.now();return e.select(function(e){var r=t.now(),i=r-n;return n=r,{value:e,interval:i}})})},Be.timestamp=function(t){return t||(t=je),this.select(function(e){return{value:e,timestamp:t.now()}})},Be.sample=function(t,e){return e||(e=je),"number"==typeof t?N(this,un(t,e)):N(this,t)},Be.timeout=function(t,e,n){var r,i=this;return e||(e=Ze(Error("Timeout"))),n||(n=je),r=t instanceof Date?function(t,e){n.scheduleWithAbsolute(t,e)}:function(t,e){n.scheduleWithRelative(t,e)},new hn(function(n){var o,s=0,u=new xe,c=new Ce,a=!1,l=new Ce;return c.setDisposable(u),o=function(){var i=s;l.setDisposable(r(t,function(){a=s===i;var t=a;t&&c.setDisposable(e.subscribe(n))}))},o(),u.setDisposable(i.subscribe(function(t){var e=!a;e&&(s++,n.onNext(t),o())},function(t){var e=!a;e&&(s++,n.onError(t))},function(){var t=!a;t&&(s++,n.onCompleted())})),new ve(c,l)})},Qe.generateWithTime=function(e,n,r,i,o,s){return s||(s=je),new hn(function(u){var c,a,l=!0,h=!1,f=e;return s.scheduleRecursiveWithRelative(0,function(e){h&&u.onNext(c);try{l?l=!1:f=r(f),h=n(f),h&&(c=i(f),a=o(f))}catch(s){return u.onError(s),t}h?e(a):u.onCompleted()})})},Be.delaySubscription=function(t,e){return e||(e=je),this.delayWithSelector(cn(t,e),function(){return Ke()})},Be.delayWithSelector=function(e,n){var r,i,o=this;return"function"==typeof e?i=e:(r=e,i=n),new hn(function(e){var n=new ve,s=!1,u=function(){s&&0===n.length&&e.onCompleted()},c=new Ce,a=function(){c.setDisposable(o.subscribe(function(r){var o;try{o=i(r)}catch(s){return e.onError(s),t}var c=new xe;n.add(c),c.setDisposable(o.subscribe(function(){e.onNext(r),n.remove(c),u()},e.onError.bind(e),function(){e.onNext(r),n.remove(c),u()}))},e.onError.bind(e),function(){s=!0,c.dispose(),u()}))};return r?c.setDisposable(r.subscribe(function(){a()},e.onError.bind(e),function(){a()})):a(),new ve(c,n)})},Be.timeoutWithSelector=function(e,n,r){if(1===arguments.length){n=e;var e=Ge()}r||(r=Ze(Error("Timeout")));var i=this;return new hn(function(o){var s=new Ce,u=new Ce,c=new xe;s.setDisposable(c);var a=0,l=!1,h=function(t){var e=a,n=function(){return a===e},i=new xe;u.setDisposable(i),i.setDisposable(t.subscribe(function(){n()&&s.setDisposable(r.subscribe(o)),i.dispose()},function(t){n()&&o.onError(t)},function(){n()&&s.setDisposable(r.subscribe(o))}))};h(e);var f=function(){var t=!l;return t&&a++,t};return c.setDisposable(i.subscribe(function(e){if(f()){o.onNext(e);var r;try{r=n(e)}catch(i){return o.onError(i),t}h(r)}},function(t){f()&&o.onError(t)},function(){f()&&o.onCompleted()})),new ve(s,u)})},Be.throttleWithSelector=function(e){var n=this;return new hn(function(r){var i,o=!1,s=new Ce,u=0,c=n.subscribe(function(n){var c;try{c=e(n)}catch(a){return r.onError(a),t}o=!0,i=n,u++;var l=u,h=new xe;s.setDisposable(h),h.setDisposable(c.subscribe(function(){o&&u===l&&r.onNext(i),o=!1,h.dispose()},r.onError.bind(r),function(){o&&u===l&&r.onNext(i),o=!1,h.dispose()}))},function(t){s.dispose(),r.onError(t),o=!1,u++},function(){s.dispose(),o&&r.onNext(i),r.onCompleted(),o=!1,u++});return new ve(c,s)})},Be.skipLastWithTime=function(t,e){e||(e=je);var n=this;return new hn(function(r){var i=[];return n.subscribe(function(n){var o=e.now();for(i.push({interval:o,value:n});i.length>0&&o-i[0].interval>=t;)r.onNext(i.shift().value)},r.onError.bind(r),function(){for(var n=e.now();i.length>0&&n-i[0].interval>=t;)r.onNext(i.shift().value);r.onCompleted()})})},Be.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return Je(t,n)})},Be.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=je),new hn(function(r){var i=[];return n.subscribe(function(n){var r=e.now();for(i.push({interval:r,value:n});i.length>0&&r-i[0].interval>=t;)i.shift()},r.onError.bind(r),function(){for(var n=e.now(),o=[];i.length>0;){var s=i.shift();t>=n-s.interval&&o.push(s.value)}r.onNext(o),r.onCompleted()})})},Be.takeWithTime=function(t,e){var n=this;return e||(e=je),new hn(function(r){var i=e.scheduleWithRelative(t,function(){r.onCompleted()});return new ve(i,n.subscribe(r))})},Be.skipWithTime=function(t,e){var n=this;return e||(e=je),new hn(function(r){var i=!1,o=e.scheduleWithRelative(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new ve(o,s)})},Be.skipUntilWithTime=function(t,e){e||(e=je);var n=this;return new hn(function(r){var i=!1,o=e.scheduleWithAbsolute(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new ve(o,s)})},Be.takeUntilWithTime=function(t,e){e||(e=je);var n=this;return new hn(function(r){return new ve(e.scheduleWithAbsolute(t,function(){r.onCompleted()}),n.subscribe(r))})},Be.pausable=function(t){var e=this;return new hn(function(n){var r=e.publish(),i=r.subscribe(n),o=ge,s=t.distinctUntilChanged().subscribe(function(t){t?o=r.connect():(o.dispose(),o=ge)});return new ve(i,o,s)})},Be.pausableBuffered=function(t){var e=this;return new hn(function(n){var r=[],i=!0,o=A(e,t.distinctUntilChanged(),function(t,e){return{data:t,shouldFire:e}}).subscribe(function(t){if(t.shouldFire&&i&&n.onNext(t.data),t.shouldFire&&!i){for(;r.length>0;)n.onNext(r.shift());i=!0}else t.shouldFire||i?!t.shouldFire&&i&&(i=!1):r.push(t.data)},n.onError.bind(n),n.onCompleted.bind(n));return t.onNext(!1),o})},Be.controlled=function(t){return null==t&&(t=!0),new an(this,t)};var an=function(t){function e(t){return this.source.subscribe(t)}function n(n,r){t.call(this,e),this.subject=new ln(r),this.source=n.multicast(this.subject).refCount()}return ae(n,t),n.prototype.request=function(t){return null==t&&(t=-1),this.subject.request(t)},n}(Qe),ln=k.ControlledSubject=function(t){function e(t){return this.subject.subscribe(t)}function n(n){null==n&&(n=!0),t.call(this,e),this.subject=new dn,this.enableQueue=n,this.queue=n?[]:null,this.requestedCount=0,this.requestedDisposable=ge,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=ge}return ae(n,t),le(n.prototype,Ie,{onCompleted:function(){u.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(t){u.call(this),this.hasFailed=!0,this.error=t,this.enableQueue&&0!==this.queue.length||this.subject.onError(t)},onNext:function(t){u.call(this);var e=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(t):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),e=!0),e&&this.subject.onNext(t)},_processRequest:function(t){if(this.enableQueue){for(;this.queue.length>=t&&t>0;)this.subject.onNext(this.queue.shift()),t--;return 0!==this.queue.length?{numberOfItems:t,returnValue:!0}:{numberOfItems:t,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=ge):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=ge),{numberOfItems:t,returnValue:!1}},request:function(t){u.call(this),this.disposeCurrentRequest();var e=this,n=this._processRequest(t);return t=n.numberOfItems,n.returnValue?ge:(this.requestedCount=t,this.requestedDisposable=we(function(){e.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=ge},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),n}(Qe),hn=k.AnonymousObservable=function(e){function n(e){return e===t?e=ge:"function"==typeof e&&(e=we(e)),e}function r(i){function o(t){var e=new fn(t);if(Oe.scheduleRequired())Oe.schedule(function(){try{e.setDisposable(n(i(e)))}catch(t){if(!e.fail(t))throw t}});else try{e.setDisposable(n(i(e)))}catch(r){if(!e.fail(r))throw r}return e}return this instanceof r?(e.call(this,o),t):new r(i)}return ae(r,e),r}(Qe),fn=function(t){function e(e){t.call(this),this.observer=e,this.m=new xe}ae(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.setDisposable=function(t){this.m.setDisposable(t)},n.getDisposable=function(){return this.m.getDisposable()},n.disposable=function(t){return arguments.length?this.getDisposable():setDisposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Ue),pn=function(t,e){this.subject=t,this.observer=e};pn.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var dn=k.Subject=function(t){function e(t){return u.call(this),this.isStopped?this.exception?(t.onError(this.exception),ge):(t.onCompleted(),ge):(this.observers.push(t),new pn(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return ae(n,t),le(n.prototype,Ie,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(u.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(u.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(u.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new vn(t,e)},n}(Qe),bn=k.AsyncSubject=function(t){function e(t){if(u.call(this),!this.isStopped)return this.observers.push(t),new pn(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),ge}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return ae(n,t),le(n.prototype,Ie,{hasObservers:function(){return u.call(this),this.observers.length>0},onCompleted:function(){var t,e,n;if(u.call(this),!this.isStopped){this.isStopped=!0;var r=this.observers.slice(0),i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(u.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){u.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(Qe),vn=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return ae(n,t),le(n.prototype,Ie,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(Qe),mn=k.BehaviorSubject=function(t){function e(t){if(u.call(this),!this.isStopped)return this.observers.push(t),t.onNext(this.value),new pn(this,t);var e=this.exception;return e?t.onError(e):t.onCompleted(),ge}function n(n){t.call(this,e),this.value=n,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return ae(n,t),le(n.prototype,Ie,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(u.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(u.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(u.call(this),!this.isStopped){this.value=t;for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),n}(Qe),yn=k.ReplaySubject=function(t){function e(t,e){this.subject=t,this.observer=e}function n(t){var n=new $e(this.scheduler,t),r=new e(this,n);u.call(this),this._trim(this.scheduler.now()),this.observers.push(n);for(var i=this.q.length,o=0,s=this.q.length;s>o;o++)n.onNext(this.q[o].value);return this.hasError?(i++,n.onError(this.error)):this.isStopped&&(i++,n.onCompleted()),n.ensureActive(i),r}function r(e,r,i){this.bufferSize=null==e?Number.MAX_VALUE:e,this.windowSize=null==r?Number.MAX_VALUE:r,this.scheduler=i||Oe,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,t.call(this,n)}return e.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1)}},ae(r,t),le(r.prototype,Ie,{hasObservers:function(){return this.observers.length>0},_trim:function(t){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&t-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(t){var e;if(u.call(this),!this.isStopped){var n=this.scheduler.now();this.q.push({interval:n,value:t}),this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)e=r[i],e.onNext(t),e.ensureActive()}},onError:function(t){var e;if(u.call(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;var n=this.scheduler.now();this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)e=r[i],e.onError(t),e.ensureActive();this.observers=[]}},onCompleted:function(){var t;if(u.call(this),!this.isStopped){this.isStopped=!0;var e=this.scheduler.now();this._trim(e);for(var n=this.observers.slice(0),r=0,i=n.length;i>r;r++)t=n[r],t.onCompleted(),t.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),r}(Qe);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(R.Rx=k,define(function(){return k})):_&&j?W?(j.exports=k).Rx=k:_.Rx=k:R.Rx=k}).call(this); \ No newline at end of file +(function(t){function e(){}function n(t){return t}function r(t,e){return ce(t,e)}function i(t,e){return t-e}function o(t){throw t}function s(e){return"function"==typeof e.then&&e.subscribe===t}function u(){if(this.isDisposed)throw Error(V)}function c(t){var e=typeof t;return t&&("function"==e||"object"==e)||!1}function a(t){var e=[];if(!c(t))return e;ue.nonEnumArgs&&t.length&&p(t)&&(t=ae.call(t));var n=ue.enumPrototypes&&"function"==typeof t,r=ue.enumErrorProps&&(t===ee||t instanceof Error);for(var i in t)n&&"prototype"==i||r&&("message"==i||"name"==i)||e.push(i);if(ue.nonEnumShadows&&t!==ne){var o=t.constructor,s=-1,u=oe.length;if(t===(o&&o.prototype))var a=t===stringProto?G:t===ee?Q:Y.call(t),l=se[a];for(;u>++s;)i=oe[s],l&&l[i]||!Z.call(t,i)||e.push(i)}return e}function l(t,e,n){for(var r=-1,i=n(t),o=i.length;o>++r;){var s=i[r];if(e(t[s],s,t)===!1)break}return t}function h(t,e){return l(t,e,a)}function f(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function p(t){return t&&"object"==typeof t?Y.call(t)==F:!1}function d(t){return"function"==typeof t}function b(e,n,r,i){if(e===n)return 0!==e||1/e==1/n;var o=typeof e,s=typeof n;if(e===e&&(null==e||null==n||"function"!=o&&"object"!=o&&"function"!=s&&"object"!=s))return!1;var u=Y.call(e),c=Y.call(n);if(u==F&&(u=K),c==F&&(c=K),u!=c)return!1;switch(u){case U:case H:return+e==+n;case X:return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case J:case G:return e==n+""}var a=u==B;if(!a){if(u!=K||!ue.nodeClass&&(f(e)||f(n)))return!1;var l=!ue.argsObject&&p(e)?Object:e.constructor,v=!ue.argsObject&&p(n)?Object:n.constructor;if(!(l==v||Z.call(e,"constructor")&&Z.call(n,"constructor")||d(l)&&l instanceof l&&d(v)&&v instanceof v||!("constructor"in e&&"constructor"in n)))return!1}r||(r=[]),i||(i=[]);for(var m=r.length;m--;)if(r[m]==e)return i[m]==n;var y=0;if(result=!0,r.push(e),i.push(n),a){if(m=e.length,y=n.length,result=y==m)for(;y--;){var w=n[y];if(!(result=b(e[y],w,r,i)))break}}else h(n,function(n,o,s){return Z.call(s,o)?(y++,result=Z.call(e,o)&&b(e[o],n,r,i)):t}),result&&h(e,function(e,n,r){return Z.call(r,n)?result=--y>-1:t});return r.pop(),i.pop(),result}function v(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:ae.call(t)}function m(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function y(e,n){return new hn(function(r){var i=new Ce,o=new De;return o.setDisposable(i),i.setDisposable(e.subscribe(r.onNext.bind(r),function(e){var i,s;try{s=n(e)}catch(u){return r.onError(u),t}i=new Ce,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function w(e,n){var r=this;return new hn(function(i){var o=0,s=e.length;return r.subscribe(function(r){if(s>o){var u,c=e[o++];try{u=n(r,c)}catch(a){return i.onError(a),t}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function g(t){return this.select(function(e,n){var r=t(e,n);return s(r)?on(r):r}).mergeObservable()}function x(t){var e=function(){this.cancelBubble=!0},n=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(t){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(t||(t=window.event),!t.target)switch(t.target=t.target||t.srcElement,"mouseover"==t.type&&(t.relatedTarget=t.fromElement),"mouseout"==t.type&&(t.relatedTarget=t.toElement),t.stopPropagation||(t.stopPropagation=e,t.preventDefault=n),t.type){case"keypress":var r="charCode"in t?t.charCode:t.keyCode;10==r?(r=0,t.keyCode=13):13==r||27==r?r=0:3==r&&(r=99),t.charCode=r,t.keyChar=t.charCode?String.fromCharCode(t.charCode):""}return t}function E(t,e,n){if(t.addListener)return t.addListener(e,n),ge(function(){t.removeListener(e,n)});if(t.addEventListener)return t.addEventListener(e,n,!1),ge(function(){t.removeEventListener(e,n,!1)});if(t.attachEvent){var r=function(t){n(x(t))};return t.attachEvent("on"+e,r),ge(function(){t.detachEvent("on"+e,r)})}return t["on"+e]=n,ge(function(){t["on"+e]=null})}function C(t,e,n){var r=new me;if(t&&t.length)for(var i=0,o=t.length;o>i;i++)r.add(C(t[i],e,n));else t&&r.add(E(t,e,n));return r}function D(t,e){var n=Ae(t);return new hn(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function S(t,e,n){return t===e?new hn(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):Xe(function(){return observableTimerDateAndPeriod(n.now()+t,e,n)})}function N(t,e){return new hn(function(n){function r(){s&&(s=!1,n.onNext(o)),i&&n.onCompleted()}var i,o,s;return new me(t.subscribe(function(t){s=!0,o=t},n.onError.bind(n),function(){i=!0}),e.subscribe(r,n.onError.bind(n),r))})}function A(e,r,i){return new hn(function(o){function s(e,r){h[r]=e;var s;if(c[r]=!0,a||(a=c.every(n))){try{s=i.apply(null,h)}catch(u){return o.onError(u),t}o.onNext(s)}else l&&o.onCompleted()}var u=2,c=[!1,!1],a=!1,l=!1,h=Array(u);return new me(e.subscribe(function(t){s(t,0)},o.onError.bind(o),function(){l=!0,o.onCompleted()}),r.subscribe(function(t){s(t,1)},o.onError.bind(o)))})}var O={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},_=O[typeof window]&&window||this,R=O[typeof exports]&&exports&&!exports.nodeType&&exports,j=O[typeof module]&&module&&!module.nodeType&&module,W=j&&j.exports===R&&R,q=O[typeof global]&&global;!q||q.global!==q&&q.window!==q||(_=q);var k={internals:{},config:{}},T=function(){return Date.now?Date.now:function(){return+new Date}}(),P="Sequence contains no elements.",L="Argument out of range",V="Object has been disposed",z="object"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";_.Set&&"function"==typeof(new _.Set)["@@iterator"]&&(z="@@iterator");var M,I={done:!0,value:t},F="[object Arguments]",B="[object Array]",U="[object Boolean]",H="[object Date]",Q="[object Error]",$="[object Function]",X="[object Number]",K="[object Object]",J="[object RegExp]",G="[object String]",Y=Object.prototype.toString,Z=Object.prototype.hasOwnProperty,te=Y.call(arguments)==F,ee=Error.prototype,ne=Object.prototype,re=ne.propertyIsEnumerable;try{M=!(Y.call(document)==K&&!({toString:0}+""))}catch(ie){M=!0}var oe=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],se={};se[B]=se[H]=se[X]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},se[U]=se[G]={constructor:!0,toString:!0,valueOf:!0},se[Q]=se[$]=se[J]={constructor:!0,toString:!0},se[K]={constructor:!0};var ue={};(function(){var t=function(){this.x=1},e=[];t.prototype={valueOf:1,y:1};for(var n in new t)e.push(n);for(n in arguments);ue.enumErrorProps=re.call(ee,"message")||re.call(ee,"name"),ue.enumPrototypes=re.call(t,"prototype"),ue.nonEnumArgs=0!=n,ue.nonEnumShadows=!/valueOf/.test(e)})(1),te||(p=function(t){return t&&"object"==typeof t?Z.call(t,"callee"):!1}),d(/x/)&&(d=function(t){return"function"==typeof t&&Y.call(t)==$});var ce=k.internals.isEqual=function(t,e){return b(t,e,[],[])},ae=Array.prototype.slice;({}).hasOwnProperty;var le=this.inherits=k.internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},he=k.internals.addProperties=function(t){for(var e=ae.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}};k.internals.addRef=function(t,e){return new hn(function(n){return new me(e.getDisposable(),t.subscribe(n))})},Function.prototype.bind||(Function.prototype.bind=function(t){var e=this,n=ae.call(arguments,1),r=function(){function i(){}if(this instanceof r){i.prototype=e.prototype;var o=new i,s=e.apply(o,n.concat(ae.call(arguments)));return Object(s)===s?s:o}return e.apply(t,n.concat(ae.call(arguments)))};return r});var fe=Object("a"),pe="a"!=fe[0]||!(0 in fe);Array.prototype.every||(Array.prototype.every=function(t){var e=Object(this),n=pe&&{}.toString.call(this)==G?this.split(""):e,r=n.length>>>0,i=arguments[1];if({}.toString.call(t)!=$)throw new TypeError(t+" is not a function");for(var o=0;r>o;o++)if(o in n&&!t.call(i,n[o],o,e))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(t){var e=Object(this),n=pe&&{}.toString.call(this)==G?this.split(""):e,r=n.length>>>0,i=Array(r),o=arguments[1];if({}.toString.call(t)!=$)throw new TypeError(t+" is not a function");for(var s=0;r>s;s++)s in n&&(i[s]=t.call(o,n[s],s,e));return i}),Array.prototype.filter||(Array.prototype.filter=function(t){for(var e,n=[],r=Object(this),i=0,o=r.length>>>0;o>i;i++)e=r[i],i in r&&t.call(arguments[1],e,i,r)&&n.push(e);return n}),Array.isArray||(Array.isArray=function(t){return Object.prototype.toString.call(t)==B}),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){var e=Object(this),n=e.length>>>0;if(0===n)return-1;var r=0;if(arguments.length>1&&(r=Number(arguments[1]),r!==r?r=0:0!==r&&1/0!=r&&r!==-1/0&&(r=(r>0||-1)*Math.floor(Math.abs(r)))),r>=n)return-1;for(var i=r>=0?r:Math.max(n-Math.abs(r),0);n>i;i++)if(i in e&&e[i]===t)return i;return-1});var de=function(t,e){this.id=t,this.value=e};de.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var be=k.internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},ve=be.prototype;ve.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},ve.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},ve.heapify=function(e){if(e===t&&(e=0),!(e>=this.length||0>e)){var n=2*e+1,r=2*e+2,i=e;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==e){var o=this.items[e];this.items[e]=this.items[i],this.items[i]=o,this.heapify(i)}}},ve.peek=function(){return this.items[0].value},ve.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},ve.dequeue=function(){var t=this.peek();return this.removeAt(0),t},ve.enqueue=function(t){var e=this.length++;this.items[e]=new de(be.count++,t),this.percolate(e)},ve.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},be.count=0;var me=k.CompositeDisposable=function(){this.disposables=v(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},ye=me.prototype;ye.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},ye.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},ye.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},ye.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},ye.contains=function(t){return-1!==this.disposables.indexOf(t)},ye.toArray=function(){return this.disposables.slice(0)};var we=k.Disposable=function(t){this.isDisposed=!1,this.action=t||e};we.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ge=we.create=function(t){return new we(t)},xe=we.empty={dispose:e},Ee=function(){function t(t){this.isSingle=t,this.isDisposed=!1,this.current=null}var e=t.prototype;return e.getDisposable=function(){return this.current},e.setDisposable=function(t){if(this.current&&this.isSingle)throw Error("Disposable has already been assigned");var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},e.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()},t}(),Ce=k.SingleAssignmentDisposable=function(t){function e(){t.call(this,!0)}return le(e,t),e}(Ee),De=k.SerialDisposable=function(t){function e(){t.call(this,!1)}return le(e,t),e}(Ee);k.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?xe:new t(this)},e}();var Se=k.internals.ScheduledItem=function(t,e,n,r,o){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=o||i,this.disposable=new Ce};Se.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Se.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},Se.prototype.isCancelled=function(){return this.disposable.isDisposed},Se.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Ne=k.Scheduler=function(){function t(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function e(t,e){var n=e.first,r=e.second,i=new me,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),xe});r||(i.add(s),n=!0)})};return o(n),i}function n(t,e,n){var r=e.first,i=e.second,o=new me,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),xe});u||(o.add(c),i=!0)})};return s(r),o}function r(t,e){return e(),xe}var i=t.prototype;return i.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},i.schedulePeriodicWithState=function(t,e,n){var r=t,i=setInterval(function(){r=n(r)},e);return ge(function(){clearInterval(i)})},i.schedule=function(t){return this._schedule(t,r)},i.scheduleWithState=function(t,e){return this._schedule(t,e)},i.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,r)},i.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},i.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,r)},i.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},i.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},i.scheduleRecursiveWithState=function(t,n){return this.scheduleWithState({first:t,second:n},function(t,n){return e(t,n)})},i.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithRelativeAndState=function(t,e,r){return this._scheduleRelative({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithRelativeAndState")})},i.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithAbsoluteAndState=function(t,e,r){return this._scheduleAbsolute({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithAbsoluteAndState")})},t.now=T,t.normalize=function(t){return 0>t&&(t=0),t},t}(),Ae=Ne.normalize,Oe=Ne.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){for(var r=Ae(r);r-this.now()>0;);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Ne(T,t,e,n)}(),_e=Ne.currentThread=function(){function t(t){for(var e;t.length>0;)if(e=t.dequeue(),!e.isCancelled()){for(;e.dueTime-Ne.now()>0;);e.isCancelled()||e.invoke()}}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o=this.now()+Ne.normalize(n),s=new Se(this,e,r,o);if(i)i.enqueue(s);else{i=new be(4),i.enqueue(s);try{t(i)}catch(u){throw u}finally{i=null}}return s.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i,o=new Ne(T,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}();k.internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new Ce;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();var Re,je=e;(function(){function t(){if(!_.postMessage||_.importScripts)return!1;var t=!1,e=_.onmessage;return _.onmessage=function(){t=!0},_.postMessage("","*"),_.onmessage=e,t}function e(t){if("string"==typeof t.data&&t.data.substring(0,o.length)===o){var e=t.data.substring(o.length),n=s[e];n(),delete s[e]}}var n=RegExp("^"+(Y+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),r="function"==typeof(r=q&&W&&q.setImmediate)&&!n.test(r)&&r,i="function"==typeof(i=q&&W&&q.clearImmediate)&&!n.test(i)&&i;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Re=process.nextTick;else if("function"==typeof r)Re=r,je=i;else if(t()){var o="ms.rx.schedule"+Math.random(),s={},u=0;_.addEventListener?_.addEventListener("message",e,!1):_.attachEvent("onmessage",e,!1),Re=function(t){var e=u++;s[e]=t,_.postMessage(o+e,"*")}}else if(_.MessageChannel){var c=new _.MessageChannel,a={},l=0;c.port1.onmessage=function(t){var e=t.data,n=a[e];n(),delete a[e]},Re=function(t){var e=l++;a[e]=t,c.port2.postMessage(e)}}else"document"in _&&"onreadystatechange"in _.document.createElement("script")?Re=function(t){var e=_.document.createElement("script");e.onreadystatechange=function(){t(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},_.document.documentElement.appendChild(e)}:(Re=function(t){return setTimeout(t,0)},je=clearTimeout)})();var We=Ne.timeout=function(){function t(t,e){var n=this,r=new Ce,i=Re(function(){r.isDisposed||r.setDisposable(e(n,t))});return new me(r,ge(function(){je(i)}))}function e(t,e,n){var r=this,i=Ne.normalize(e);if(0===i)return r.scheduleWithState(t,n);var o=new Ce,s=setTimeout(function(){o.isDisposed||o.setDisposable(n(r,t))},i);return new me(o,ge(function(){clearTimeout(s)}))}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Ne(T,t,e,n)}(),qe=k.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t||(t=Oe),new hn(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),ke=qe.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new qe("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),Te=qe.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new qe("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),Pe=qe.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new qe("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),Le=k.internals.Enumerator=function(t){this._next=t};Le.prototype.next=function(){return this._next()},Le.prototype[z]=function(){return this};var Ve=k.internals.Enumerable=function(t){this._iterator=t};Ve.prototype[z]=function(){return this._iterator()},Ve.prototype.concat=function(){var e=this;return new hn(function(n){var r;try{r=e[z]()}catch(i){return n.onError(),t}var o,s=new De,u=Oe.scheduleRecursive(function(e){var i;if(!o){try{i=r.next()}catch(u){return n.onError(u),t}if(i.done)return n.onCompleted(),t;var c=new Ce;s.setDisposable(c),c.setDisposable(i.value.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){e()}))}});return new me(s,u,ge(function(){o=!0}))})},Ve.prototype.catchException=function(){var e=this;return new hn(function(n){var r;try{r=e[z]()}catch(i){return n.onError(),t}var o,s,u=new De,c=Oe.scheduleRecursive(function(e){if(!o){var i;try{i=r.next()}catch(c){return n.onError(c),t}if(i.done)return s?n.onError(s):n.onCompleted(),t;var a=new Ce;u.setDisposable(a),a.setDisposable(i.value.subscribe(n.onNext.bind(n),function(t){s=t,e()},n.onCompleted.bind(n)))}});return new me(u,c,ge(function(){o=!0}))})};var ze=Ve.repeat=function(t,e){return null==e&&(e=-1),new Ve(function(){var n=e;return new Le(function(){return 0===n?I:(n>0&&n--,{done:!1,value:t})})})},Me=Ve.forEach=function(t,e,r){return e||(e=n),new Ve(function(){var n=-1;return new Le(function(){return++n0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var r;if(!(n.queue.length>0))return n.isAcquired=!1,t;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}e()}))},n.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},n}(Ue);Qe.create=Qe.createWithDisposable=function(t){return new hn(t)};var Xe=Qe.defer=function(t){return new hn(function(e){var n;try{n=t()}catch(r){return Ze(r).subscribe(e)}return n.subscribe(e)})},Ke=Qe.empty=function(t){return t||(t=Oe),new hn(function(e){return t.schedule(function(){e.onCompleted()})})},Je=Qe.fromArray=function(t,e){return e||(e=_e),new hn(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};Qe.fromIterable=function(e,n){return n||(n=_e),new hn(function(r){var i;try{i=e[z]()}catch(o){return r.onError(o),t}return n.scheduleRecursive(function(e){var n;try{n=i.next()}catch(o){return r.onError(o),t}n.done?r.onCompleted():(r.onNext(n.value),e())})})},Qe.generate=function(e,n,r,i,o){return o||(o=_e),new hn(function(s){var u=!0,c=e;return o.scheduleRecursive(function(e){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(l){return s.onError(l),t}o?(s.onNext(a),e()):s.onCompleted()})})};var Ge=Qe.never=function(){return new hn(function(){return xe})};Qe.range=function(t,e,n){return n||(n=_e),new hn(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},Qe.repeat=function(t,e,n){return n||(n=_e),null==e&&(e=-1),Ye(t,n).repeat(e)};var Ye=Qe["return"]=Qe.returnValue=function(t,e){return e||(e=Oe),new hn(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Ze=Qe["throw"]=Qe.throwException=function(t,e){return e||(e=Oe),new hn(function(n){return e.schedule(function(){n.onError(t)})})};Be["catch"]=Be.catchException=function(t){return"function"==typeof t?y(this,t):tn([this,t])};var tn=Qe.catchException=Qe["catch"]=function(){var t=v(arguments,0);return Me(t).catchException()};Be.combineLatest=function(){var t=ae.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),en.apply(this,t)};var en=Qe.combineLatest=function(){var e=ae.call(arguments),r=e.pop();return Array.isArray(e[0])&&(e=e[0]),new hn(function(i){function o(e){var o;if(a[e]=!0,l||(l=a.every(n))){try{o=r.apply(null,f)}catch(s){return i.onError(s),t}i.onNext(o)}else h.filter(function(t,n){return n!==e}).every(n)&&i.onCompleted()}function s(t){h[t]=!0,h.every(n)&&i.onCompleted()}for(var u=function(){return!1},c=e.length,a=m(c,u),l=!1,h=m(c,u),f=Array(c),p=Array(c),d=0;c>d;d++)(function(t){p[t]=new Ce,p[t].setDisposable(e[t].subscribe(function(e){f[t]=e,o(t)},i.onError.bind(i),function(){s(t)}))})(d);return new me(p)})};Be.concat=function(){var t=ae.call(arguments,0);return t.unshift(this),nn.apply(this,t)};var nn=Qe.concat=function(){var t=v(arguments,0);return Me(t).concat()};Be.concatObservable=Be.concatAll=function(){return this.merge(1)},Be.merge=function(t){if("number"!=typeof t)return rn(this,t);var e=this;return new hn(function(n){var r=0,i=new me,o=!1,u=[],c=function(t){var e=new Ce;i.add(e),s(t)&&(t=on(t)),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),u.length>0?(t=u.shift(),c(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,c(e)):u.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var rn=Qe.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=ae.call(arguments,1)):(t=Oe,e=ae.call(arguments,0)):(t=Oe,e=ae.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Je(e,t).mergeObservable()};Be.mergeObservable=Be.mergeAll=function(){var t=this;return new hn(function(e){var n=new me,r=!1,i=new Ce;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new Ce;n.add(i),s(t)&&(t=on(t)),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},Be.skipUntil=function(t){var e=this;return new hn(function(n){var r=!1,i=new me(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new Ce;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Be["switch"]=Be.switchLatest=function(){var t=this;return new hn(function(e){var n=!1,r=new De,i=!1,o=0,u=t.subscribe(function(t){var u=new Ce,c=++o;n=!0,r.setDisposable(u),s(t)&&(t=on(t)),u.setDisposable(t.subscribe(function(t){o===c&&e.onNext(t)},function(t){o===c&&e.onError(t)},function(){o===c&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new me(u,r)})},Be.takeUntil=function(t){var n=this;return new hn(function(r){return new me(n.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),e))})},Be.zip=function(){if(Array.isArray(arguments[0]))return w.apply(this,arguments);var e=this,r=ae.call(arguments),i=r.pop();return r.unshift(e),new hn(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=r.length,c=m(u,function(){return[]}),a=m(u,function(){return!1}),l=function(r){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(e,u)}catch(l){return o.onError(l),t}o.onNext(s)}else a.filter(function(t,e){return e!==r}).every(n)&&o.onCompleted()},h=Array(u),f=0;u>f;f++)(function(t){h[t]=new Ce,h[t].setDisposable(r[t].subscribe(function(e){c[t].push(e),l(t)},o.onError.bind(o),function(){s(t)}))})(f);return new me(h)})},Qe.zip=function(){var t=ae.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},Qe.zipArray=function(){var e=v(arguments,0);return new hn(function(r){function i(e){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});r.onNext(i)}else if(c.filter(function(t,n){return n!==e}).every(n))return r.onCompleted(),t}function o(e){return c[e]=!0,c.every(n)?(r.onCompleted(),t):t}for(var s=e.length,u=m(s,function(){return[]}),c=m(s,function(){return!1}),a=Array(s),l=0;s>l;l++)(function(t){a[t]=new Ce,a[t].setDisposable(e[t].subscribe(function(e){u[t].push(e),i(t)},r.onError.bind(r),function(){o(t)}))})(l);var h=new me(a);return h.add(ge(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),h})},Be.asObservable=function(){var t=this;return new hn(function(e){return t.subscribe(e)})},Be.dematerialize=function(){var t=this;return new hn(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Be.distinctUntilChanged=function(e,i){var o=this;return e||(e=n),i||(i=r),new hn(function(n){var r,s=!1;return o.subscribe(function(o){var u,c=!1;try{u=e(o)}catch(a){return n.onError(a),t}if(s)try{c=i(r,u)}catch(a){return n.onError(a),t}s&&c||(s=!0,r=u,n.onNext(o))},n.onError.bind(n),n.onCompleted.bind(n))})},Be["do"]=Be.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new hn(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},Be["finally"]=Be.finallyAction=function(t){var e=this;return new hn(function(n){var r=e.subscribe(n);return ge(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},Be.ignoreElements=function(){var t=this;return new hn(function(n){return t.subscribe(e,n.onError.bind(n),n.onCompleted.bind(n))})},Be.materialize=function(){var t=this;return new hn(function(e){return t.subscribe(function(t){e.onNext(ke(t))},function(t){e.onNext(Te(t)),e.onCompleted()},function(){e.onNext(Pe()),e.onCompleted()})})},Be.repeat=function(t){return ze(this,t).concat()},Be.retry=function(t){return ze(this,t).catchException()},Be.scan=function(){var e,n,r=!1,i=this;return 2===arguments.length?(r=!0,e=arguments[0],n=arguments[1]):n=arguments[0],new hn(function(o){var s,u,c;return i.subscribe(function(i){try{c||(c=!0),s?u=n(u,i):(u=r?n(e,i):i,s=!0)}catch(a){return o.onError(a),t}o.onNext(u)},o.onError.bind(o),function(){!c&&r&&o.onNext(e),o.onCompleted()})})},Be.skipLast=function(t){var e=this;return new hn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},Be.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=Oe,t=ae.call(arguments,n),Me([Je(t,e),this]).concat() +},Be.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Je(t,e)})},Be.takeLastBuffer=function(t){var e=this;return new hn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},Be.select=Be.map=function(e,n){var r=this;return new hn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Be.selectMany=Be.flatMap=function(t,e){return e?this.selectMany(function(n,r){var i=t(n,r),o=s(i)?on(i):i;return o.select(function(t){return e(n,t,r)})}):"function"==typeof t?g.call(this,t):g.call(this,function(){return t})},Be.selectSwitch=Be.flatMapLatest=function(t,e){return this.select(t,e).switchLatest()},Be.skip=function(t){if(0>t)throw Error(L);var e=this;return new hn(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Be.skipWhile=function(e,n){var r=this;return new hn(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Be.take=function(t,e){if(0>t)throw Error(L);if(0===t)return Ke(e);var n=this;return new hn(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},Be.takeWhile=function(e,n){var r=this;return new hn(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},Be.where=Be.filter=function(e,n){var r=this;return new hn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})},Qe.fromCallback=function(e,n,r,i){return n||(n=Oe),function(){var o=ae.call(arguments,0);return new hn(function(s){return n.schedule(function(){function n(e){var n=e;if(i)try{n=i(arguments)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}},Qe.fromNodeCallback=function(e,n,r,i){return n||(n=Oe),function(){var o=ae.call(arguments,0);return new hn(function(s){return n.schedule(function(){function n(e){if(e)return s.onError(e),t;var n=ae.call(arguments,1);if(i)try{n=i(n)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}},Qe.fromEvent=function(e,n,r){return new hn(function(i){return C(e,n,function(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)})}).publish().refCount()},Qe.fromEventPattern=function(e,n,r){return new hn(function(i){function o(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)}var s=e(o);return ge(function(){n&&n(o,s)})}).publish().refCount()};var on=Qe.fromPromise=function(t){return new hn(function(e){t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)})})};Be.toPromise=function(t){if(t||(t=k.config.Promise),!t)throw Error("Promise type not provided nor in Rx.config.Promise");var e=this;return new t(function(t,n){var r,i=!1;e.subscribe(function(t){r=t,i=!0},function(t){n(t)},function(){i&&t(r)})})},Qe.startAsync=function(t){var e;try{e=t()}catch(n){return Ze(n)}return on(e)},Be.multicast=function(t,e){var n=this;return"function"==typeof t?new hn(function(r){var i=n.multicast(t());return new me(e(i).subscribe(r),i.connect())}):new sn(n,t)},Be.publish=function(t){return t?this.multicast(function(){return new dn},t):this.multicast(new dn)},Be.share=function(){return this.publish(null).refCount()},Be.publishLast=function(t){return t?this.multicast(function(){return new bn},t):this.multicast(new bn)},Be.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new mn(e)},t):this.multicast(new mn(t))},Be.shareValue=function(t){return this.publishValue(t).refCount()},Be.replay=function(t,e,n,r){return t?this.multicast(function(){return new yn(e,n,r)},t):this.multicast(new yn(e,n,r))},Be.shareReplay=function(t,e,n){return this.replay(null,t,e,n).refCount()};var sn=k.ConnectableObservable=function(t){function e(e,n){function r(t){return i.subject.subscribe(t)}var i={subject:n,source:e.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return i.hasSubscription||(i.hasSubscription=!0,i.subscription=new me(i.source.subscribe(i.subject),ge(function(){i.hasSubscription=!1}))),i.subscription},t.call(this,r)}return le(e,t),e.prototype.connect=function(){return this.connect()},e.prototype.refCount=function(){var t=null,e=0,n=this;return new hn(function(r){var i,o;return e++,i=1===e,o=n.subscribe(r),i&&(t=n.connect()),ge(function(){o.dispose(),e--,0===e&&t.dispose()})})},e}(Qe),un=Qe.interval=function(t,e){return e||(e=We),S(t,t,e)},cn=Qe.timer=function(e,n,r){var i;return r||(r=We),"number"==typeof n?i=n:"object"==typeof n&&"now"in n&&(r=n),i===t?D(e,r):S(e,i,r)};Be.delay=function(t,e){e||(e=We);var n=this;return new hn(function(r){var i,o=!1,s=new De,u=null,c=[],a=!1;return i=n.materialize().timestamp(e).subscribe(function(n){var i,l;"E"===n.value.kind?(c=[],c.push(n),u=n.value.exception,l=!a):(c.push({value:n.value,timestamp:n.timestamp+t}),l=!o,o=!0),l&&(null!==u?r.onError(u):(i=new Ce,s.setDisposable(i),i.setDisposable(e.scheduleRecursiveWithRelative(t,function(t){var n,i,s,l;if(null===u){a=!0;do s=null,c.length>0&&0>=c[0].timestamp-e.now()&&(s=c.shift().value),null!==s&&s.accept(r);while(null!==s);l=!1,i=0,c.length>0?(l=!0,i=Math.max(0,c[0].timestamp-e.now())):o=!1,n=u,a=!1,null!==n?r.onError(n):l&&t(i)}}))))}),new me(i,s)})},Be.throttle=function(t,e){return e||(e=We),this.throttleWithSelector(function(){return cn(t,e)})},Be.timeInterval=function(t){var e=this;return t||(t=We),Xe(function(){var n=t.now();return e.select(function(e){var r=t.now(),i=r-n;return n=r,{value:e,interval:i}})})},Be.timestamp=function(t){return t||(t=We),this.select(function(e){return{value:e,timestamp:t.now()}})},Be.sample=function(t,e){return e||(e=We),"number"==typeof t?N(this,un(t,e)):N(this,t)},Be.timeout=function(t,e,n){var r,i=this;return e||(e=Ze(Error("Timeout"))),n||(n=We),r=t instanceof Date?function(t,e){n.scheduleWithAbsolute(t,e)}:function(t,e){n.scheduleWithRelative(t,e)},new hn(function(n){var o,s=0,u=new Ce,c=new De,a=!1,l=new De;return c.setDisposable(u),o=function(){var i=s;l.setDisposable(r(t,function(){a=s===i;var t=a;t&&c.setDisposable(e.subscribe(n))}))},o(),u.setDisposable(i.subscribe(function(t){var e=!a;e&&(s++,n.onNext(t),o())},function(t){var e=!a;e&&(s++,n.onError(t))},function(){var t=!a;t&&(s++,n.onCompleted())})),new me(c,l)})},Qe.generateWithTime=function(e,n,r,i,o,s){return s||(s=We),new hn(function(u){var c,a,l=!0,h=!1,f=e;return s.scheduleRecursiveWithRelative(0,function(e){h&&u.onNext(c);try{l?l=!1:f=r(f),h=n(f),h&&(c=i(f),a=o(f))}catch(s){return u.onError(s),t}h?e(a):u.onCompleted()})})},Be.delaySubscription=function(t,e){return e||(e=We),this.delayWithSelector(cn(t,e),function(){return Ke()})},Be.delayWithSelector=function(e,n){var r,i,o=this;return"function"==typeof e?i=e:(r=e,i=n),new hn(function(e){var n=new me,s=!1,u=function(){s&&0===n.length&&e.onCompleted()},c=new De,a=function(){c.setDisposable(o.subscribe(function(r){var o;try{o=i(r)}catch(s){return e.onError(s),t}var c=new Ce;n.add(c),c.setDisposable(o.subscribe(function(){e.onNext(r),n.remove(c),u()},e.onError.bind(e),function(){e.onNext(r),n.remove(c),u()}))},e.onError.bind(e),function(){s=!0,c.dispose(),u()}))};return r?c.setDisposable(r.subscribe(function(){a()},e.onError.bind(e),function(){a()})):a(),new me(c,n)})},Be.timeoutWithSelector=function(e,n,r){if(1===arguments.length){n=e;var e=Ge()}r||(r=Ze(Error("Timeout")));var i=this;return new hn(function(o){var s=new De,u=new De,c=new Ce;s.setDisposable(c);var a=0,l=!1,h=function(t){var e=a,n=function(){return a===e},i=new Ce;u.setDisposable(i),i.setDisposable(t.subscribe(function(){n()&&s.setDisposable(r.subscribe(o)),i.dispose()},function(t){n()&&o.onError(t)},function(){n()&&s.setDisposable(r.subscribe(o))}))};h(e);var f=function(){var t=!l;return t&&a++,t};return c.setDisposable(i.subscribe(function(e){if(f()){o.onNext(e);var r;try{r=n(e)}catch(i){return o.onError(i),t}h(r)}},function(t){f()&&o.onError(t)},function(){f()&&o.onCompleted()})),new me(s,u)})},Be.throttleWithSelector=function(e){var n=this;return new hn(function(r){var i,o=!1,s=new De,u=0,c=n.subscribe(function(n){var c;try{c=e(n)}catch(a){return r.onError(a),t}o=!0,i=n,u++;var l=u,h=new Ce;s.setDisposable(h),h.setDisposable(c.subscribe(function(){o&&u===l&&r.onNext(i),o=!1,h.dispose()},r.onError.bind(r),function(){o&&u===l&&r.onNext(i),o=!1,h.dispose()}))},function(t){s.dispose(),r.onError(t),o=!1,u++},function(){s.dispose(),o&&r.onNext(i),r.onCompleted(),o=!1,u++});return new me(c,s)})},Be.skipLastWithTime=function(t,e){e||(e=We);var n=this;return new hn(function(r){var i=[];return n.subscribe(function(n){var o=e.now();for(i.push({interval:o,value:n});i.length>0&&o-i[0].interval>=t;)r.onNext(i.shift().value)},r.onError.bind(r),function(){for(var n=e.now();i.length>0&&n-i[0].interval>=t;)r.onNext(i.shift().value);r.onCompleted()})})},Be.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return Je(t,n)})},Be.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=We),new hn(function(r){var i=[];return n.subscribe(function(n){var r=e.now();for(i.push({interval:r,value:n});i.length>0&&r-i[0].interval>=t;)i.shift()},r.onError.bind(r),function(){for(var n=e.now(),o=[];i.length>0;){var s=i.shift();t>=n-s.interval&&o.push(s.value)}r.onNext(o),r.onCompleted()})})},Be.takeWithTime=function(t,e){var n=this;return e||(e=We),new hn(function(r){var i=e.scheduleWithRelative(t,function(){r.onCompleted()});return new me(i,n.subscribe(r))})},Be.skipWithTime=function(t,e){var n=this;return e||(e=We),new hn(function(r){var i=!1,o=e.scheduleWithRelative(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new me(o,s)})},Be.skipUntilWithTime=function(t,e){e||(e=We);var n=this;return new hn(function(r){var i=!1,o=e.scheduleWithAbsolute(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new me(o,s)})},Be.takeUntilWithTime=function(t,e){e||(e=We);var n=this;return new hn(function(r){return new me(e.scheduleWithAbsolute(t,function(){r.onCompleted()}),n.subscribe(r))})},Be.pausable=function(t){var e=this;return new hn(function(n){var r=e.publish(),i=r.subscribe(n),o=xe,s=t.distinctUntilChanged().subscribe(function(t){t?o=r.connect():(o.dispose(),o=xe)});return new me(i,o,s)})},Be.pausableBuffered=function(t){var e=this;return new hn(function(n){var r=[],i=!0,o=A(e,t.distinctUntilChanged(),function(t,e){return{data:t,shouldFire:e}}).subscribe(function(t){if(t.shouldFire&&i&&n.onNext(t.data),t.shouldFire&&!i){for(;r.length>0;)n.onNext(r.shift());i=!0}else t.shouldFire||i?!t.shouldFire&&i&&(i=!1):r.push(t.data)},n.onError.bind(n),n.onCompleted.bind(n));return t.onNext(!1),o})},Be.controlled=function(t){return null==t&&(t=!0),new an(this,t)};var an=function(t){function e(t){return this.source.subscribe(t)}function n(n,r){t.call(this,e),this.subject=new ln(r),this.source=n.multicast(this.subject).refCount()}return le(n,t),n.prototype.request=function(t){return null==t&&(t=-1),this.subject.request(t)},n}(Qe),ln=k.ControlledSubject=function(t){function e(t){return this.subject.subscribe(t)}function n(n){null==n&&(n=!0),t.call(this,e),this.subject=new dn,this.enableQueue=n,this.queue=n?[]:null,this.requestedCount=0,this.requestedDisposable=xe,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=xe}return le(n,t),he(n.prototype,Ie,{onCompleted:function(){u.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(t){u.call(this),this.hasFailed=!0,this.error=t,this.enableQueue&&0!==this.queue.length||this.subject.onError(t)},onNext:function(t){u.call(this);var e=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(t):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),e=!0),e&&this.subject.onNext(t)},_processRequest:function(t){if(this.enableQueue){for(;this.queue.length>=t&&t>0;)this.subject.onNext(this.queue.shift()),t--;return 0!==this.queue.length?{numberOfItems:t,returnValue:!0}:{numberOfItems:t,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=xe):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=xe),{numberOfItems:t,returnValue:!1}},request:function(t){u.call(this),this.disposeCurrentRequest();var e=this,n=this._processRequest(t);return t=n.numberOfItems,n.returnValue?xe:(this.requestedCount=t,this.requestedDisposable=ge(function(){e.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=xe},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),n}(Qe),hn=k.AnonymousObservable=function(e){function n(e){return e===t?e=xe:"function"==typeof e&&(e=ge(e)),e}function r(i){function o(t){var e=new fn(t);if(_e.scheduleRequired())_e.schedule(function(){try{e.setDisposable(n(i(e)))}catch(t){if(!e.fail(t))throw t}});else try{e.setDisposable(n(i(e)))}catch(r){if(!e.fail(r))throw r}return e}return this instanceof r?(e.call(this,o),t):new r(i)}return le(r,e),r}(Qe),fn=function(t){function e(e){t.call(this),this.observer=e,this.m=new Ce}le(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.setDisposable=function(t){this.m.setDisposable(t)},n.getDisposable=function(){return this.m.getDisposable()},n.disposable=function(t){return arguments.length?this.getDisposable():setDisposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Ue),pn=function(t,e){this.subject=t,this.observer=e};pn.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var dn=k.Subject=function(t){function e(t){return u.call(this),this.isStopped?this.exception?(t.onError(this.exception),xe):(t.onCompleted(),xe):(this.observers.push(t),new pn(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return le(n,t),he(n.prototype,Ie,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(u.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(u.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(u.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new vn(t,e)},n}(Qe),bn=k.AsyncSubject=function(t){function e(t){if(u.call(this),!this.isStopped)return this.observers.push(t),new pn(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),xe}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return le(n,t),he(n.prototype,Ie,{hasObservers:function(){return u.call(this),this.observers.length>0},onCompleted:function(){var t,e,n;if(u.call(this),!this.isStopped){this.isStopped=!0;var r=this.observers.slice(0),i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(u.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){u.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(Qe),vn=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return le(n,t),he(n.prototype,Ie,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(Qe),mn=k.BehaviorSubject=function(t){function e(t){if(u.call(this),!this.isStopped)return this.observers.push(t),t.onNext(this.value),new pn(this,t);var e=this.exception;return e?t.onError(e):t.onCompleted(),xe}function n(n){t.call(this,e),this.value=n,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return le(n,t),he(n.prototype,Ie,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(u.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(u.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(u.call(this),!this.isStopped){this.value=t;for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),n}(Qe),yn=k.ReplaySubject=function(t){function e(t,e){this.subject=t,this.observer=e}function n(t){var n=new $e(this.scheduler,t),r=new e(this,n);u.call(this),this._trim(this.scheduler.now()),this.observers.push(n);for(var i=this.q.length,o=0,s=this.q.length;s>o;o++)n.onNext(this.q[o].value);return this.hasError?(i++,n.onError(this.error)):this.isStopped&&(i++,n.onCompleted()),n.ensureActive(i),r}function r(e,r,i){this.bufferSize=null==e?Number.MAX_VALUE:e,this.windowSize=null==r?Number.MAX_VALUE:r,this.scheduler=i||_e,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,t.call(this,n)}return e.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1)}},le(r,t),he(r.prototype,Ie,{hasObservers:function(){return this.observers.length>0},_trim:function(t){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&t-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(t){var e;if(u.call(this),!this.isStopped){var n=this.scheduler.now();this.q.push({interval:n,value:t}),this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)e=r[i],e.onNext(t),e.ensureActive()}},onError:function(t){var e;if(u.call(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;var n=this.scheduler.now();this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)e=r[i],e.onError(t),e.ensureActive();this.observers=[]}},onCompleted:function(){var t;if(u.call(this),!this.isStopped){this.isStopped=!0;var e=this.scheduler.now();this._trim(e);for(var n=this.observers.slice(0),r=0,i=n.length;i>r;r++)t=n[r],t.onCompleted(),t.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),r}(Qe);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(_.Rx=k,define(function(){return k})):R&&j?W?(j.exports=k).Rx=k:R.Rx=k:_.Rx=k}).call(this); \ No newline at end of file diff --git a/rx.lite.js b/rx.lite.js index 19ef43e4e..032e4a609 100644 --- a/rx.lite.js +++ b/rx.lite.js @@ -23,35 +23,32 @@ var Rx = { internals: {}, config: {} }; - // Defaults - function noop() { } - function identity(x) { return x; } - var defaultNow = Date.now; - function defaultComparer(x, y) { return isEqual(x, y); } - function defaultSubComparer(x, y) { return x - y; } - function defaultKeySerializer(x) { return x.toString(); } - function defaultError(err) { throw err; } - function isPromise(p) { return typeof p.then === 'function'; } - - // Errors - var sequenceContainsNoElements = 'Sequence contains no elements.'; - var argumentOutOfRange = 'Argument out of range'; - var objectDisposed = 'Object has been disposed'; - function checkDisposed() { - if (this.isDisposed) { - throw new Error(objectDisposed); - } - } - - // Shim in iterator support - var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) || - '_es6shim_iterator_'; - // Firefox ships a partial implementation using the name @@iterator. - // https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14 - // So use that name if we detect it. - if (window.Set && typeof new window.Set()['@@iterator'] === 'function') { - $iterator$ = '@@iterator'; - } + // Defaults + function noop() { } + function identity(x) { return x; } + var defaultNow = Date.now; + function defaultComparer(x, y) { return isEqual(x, y); } + function defaultSubComparer(x, y) { return x - y; } + function defaultKeySerializer(x) { return x.toString(); } + function defaultError(err) { throw err; } + function isPromise(p) { return typeof p.then === 'function' && typeof p.subscribe === 'undefined'; } + + // Errors + var sequenceContainsNoElements = 'Sequence contains no elements.'; + var argumentOutOfRange = 'Argument out of range'; + var objectDisposed = 'Object has been disposed'; + function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } } + + // Shim in iterator support + var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) || + '_es6shim_iterator_'; + // Firefox ships a partial implementation using the name @@iterator. + // https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14 + // So use that name if we detect it. + if (root.Set && typeof new root.Set()['@@iterator'] === 'function') { + $iterator$ = '@@iterator'; + } + var doneEnumerator = { done: true, value: undefined }; /** `Object#toString` result shortcuts */ var argsClass = '[object Arguments]', @@ -1411,155 +1408,143 @@ }; }()); - /** - * @constructor - * @private - */ - var Enumerator = Rx.internals.Enumerator = function (moveNext, getCurrent) { - this.moveNext = moveNext; - this.getCurrent = getCurrent; - }; + var Enumerator = Rx.internals.Enumerator = function (next) { + this._next = next; + }; - /** - * @static - * @memberOf Enumerator - * @private - */ - var enumeratorCreate = Enumerator.create = function (moveNext, getCurrent) { - var done = false; - return new Enumerator(function () { - if (done) { - return false; - } - var result = moveNext(); - if (!result) { - done = true; - } - return result; - }, function () { return getCurrent(); }); - }; - - var Enumerable = Rx.internals.Enumerable = function (getEnumerator) { - this.getEnumerator = getEnumerator; - }; + Enumerator.prototype.next = function () { + return this._next(); + }; - Enumerable.prototype.concat = function () { - var sources = this; - return new AnonymousObservable(function (observer) { - var e = sources.getEnumerator(), isDisposed, subscription = new SerialDisposable(); - var cancelable = immediateScheduler.scheduleRecursive(function (self) { - var current, hasNext; - if (isDisposed) { return; } + Enumerator.prototype[$iterator$] = function () { return this; } - try { - hasNext = e.moveNext(); - if (hasNext) { - current = e.getCurrent(); - } - } catch (ex) { - observer.onError(ex); - return; - } + var Enumerable = Rx.internals.Enumerable = function (iterator) { + this._iterator = iterator; + }; - if (!hasNext) { - observer.onCompleted(); - return; - } + Enumerable.prototype[$iterator$] = function () { + return this._iterator(); + }; - var d = new SingleAssignmentDisposable(); - subscription.setDisposable(d); - d.setDisposable(current.subscribe( - observer.onNext.bind(observer), - observer.onError.bind(observer), - function () { self(); }) - ); - }); - return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { - isDisposed = true; - })); - }); - }; + Enumerable.prototype.concat = function () { + var sources = this; + return new AnonymousObservable(function (observer) { + var e; + try { + e = sources[$iterator$](); + } catch(err) { + observer.onError(); + return; + } - Enumerable.prototype.catchException = function () { - var sources = this; - return new AnonymousObservable(function (observer) { - var e = sources.getEnumerator(), isDisposed, lastException; - var subscription = new SerialDisposable(); - var cancelable = immediateScheduler.scheduleRecursive(function (self) { - var current, hasNext; - if (isDisposed) { return; } + var isDisposed, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursive(function (self) { + var currentItem; + if (isDisposed) { return; } - try { - hasNext = e.moveNext(); - if (hasNext) { - current = e.getCurrent(); - } - } catch (ex) { - observer.onError(ex); - return; - } + try { + currentItem = e.next(); + } catch (ex) { + observer.onError(ex); + return; + } - if (!hasNext) { - if (lastException) { - observer.onError(lastException); - } else { - observer.onCompleted(); - } - return; - } + if (currentItem.done) { + observer.onCompleted(); + return; + } - var d = new SingleAssignmentDisposable(); - subscription.setDisposable(d); - d.setDisposable(current.subscribe( - observer.onNext.bind(observer), - function (exn) { - lastException = exn; - self(); - }, - observer.onCompleted.bind(observer))); - }); - return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { - isDisposed = true; - })); + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(currentItem.value.subscribe( + observer.onNext.bind(observer), + observer.onError.bind(observer), + function () { self(); }) + ); }); - }; + return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { + isDisposed = true; + })); + }); + }; + + Enumerable.prototype.catchException = function () { + var sources = this; + return new AnonymousObservable(function (observer) { + var e; + try { + e = sources[$iterator$](); + } catch(err) { + observer.onError(); + return; + } + + var isDisposed, + lastException, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursive(function (self) { + if (isDisposed) { return; } - var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) { - if (arguments.length === 1) { - repeatCount = -1; + var currentItem; + try { + currentItem = e.next(); + } catch (ex) { + observer.onError(ex); + return; } - return new Enumerable(function () { - var current, left = repeatCount; - return enumeratorCreate(function () { - if (left === 0) { - return false; - } - if (left > 0) { - left--; - } - current = value; - return true; - }, function () { return current; }); - }); - }; - var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) { - selector || (selector = identity); - return new Enumerable(function () { - var current, index = -1; - return enumeratorCreate( - function () { - if (++index < source.length) { - current = selector.call(thisArg, source[index], index, source); - return true; - } - return false; - }, - function () { return current; } - ); + if (currentItem.done) { + if (lastException) { + observer.onError(lastException); + } else { + observer.onCompleted(); + } + return; + } + + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(currentItem.value.subscribe( + observer.onNext.bind(observer), + function (exn) { + lastException = exn; + self(); + }, + observer.onCompleted.bind(observer))); + }); + return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { + isDisposed = true; + })); + }); + }; + + + var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) { + if (repeatCount == null) { repeatCount = -1; } + return new Enumerable(function () { + var left = repeatCount; + return new Enumerator(function () { + if (left === 0) { return doneEnumerator; } + if (left > 0) { left--; } + return { done: false, value: value }; + }); + }); + }; + + var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) { + selector || (selector = identity); + return new Enumerable(function () { + var index = -1; + return new Enumerator( + function () { + return ++index < source.length ? + { done: false, value: selector.call(thisArg, source[index], index, source) } : + doneEnumerator; }); - }; + }); + }; /** * Supports push-style iteration over an observable sequence. @@ -1968,8 +1953,8 @@ * Converts an iterable into an Observable sequence * * @example - * var res = Rx.Observable.fromGenerator(new Map()); - * var res = Rx.Observable.fromArray(new Set(), Rx.Scheduler.timeout); + * var res = Rx.Observable.fromIterable(new Map()); + * var res = Rx.Observable.fromIterable(new Set(), Rx.Scheduler.timeout); * @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on. * @returns {Observable} The observable sequence whose elements are pulled from the given generator sequence. */ diff --git a/rx.lite.min.js b/rx.lite.min.js index 85c35b894..32c4cd675 100644 --- a/rx.lite.min.js +++ b/rx.lite.min.js @@ -1,2 +1,2 @@ -(function(t){function e(){}function n(t){return t}function r(t,e){return se(t,e)}function i(t,e){return t-e}function o(t){throw t}function s(t){return"function"==typeof t.then}function u(){if(this.isDisposed)throw Error(L)}function c(t){var e=typeof t;return t&&("function"==e||"object"==e)||!1}function a(t){var e=[];if(!c(t))return e;oe.nonEnumArgs&&t.length&&p(t)&&(t=ue.call(t));var n=oe.enumPrototypes&&"function"==typeof t,r=oe.enumErrorProps&&(t===Z||t instanceof Error);for(var i in t)n&&"prototype"==i||r&&("message"==i||"name"==i)||e.push(i);if(oe.nonEnumShadows&&t!==te){var o=t.constructor,s=-1,u=re.length;if(t===(o&&o.prototype))var a=t===stringProto?J:t===Z?U:K.call(t),l=ie[a];for(;u>++s;)i=re[s],l&&l[i]||!G.call(t,i)||e.push(i)}return e}function l(t,e,n){for(var r=-1,i=n(t),o=i.length;o>++r;){var s=i[r];if(e(t[s],s,t)===!1)break}return t}function h(t,e){return l(t,e,a)}function f(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function p(t){return t&&"object"==typeof t?K.call(t)==M:!1}function d(t){return"function"==typeof t}function b(e,n,r,i){if(e===n)return 0!==e||1/e==1/n;var o=typeof e,s=typeof n;if(e===e&&(null==e||null==n||"function"!=o&&"object"!=o&&"function"!=s&&"object"!=s))return!1;var u=K.call(e),c=K.call(n);if(u==M&&(u=$),c==M&&(c=$),u!=c)return!1;switch(u){case B:case F:return+e==+n;case Q:return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case X:case J:return e==n+""}var a=u==I;if(!a){if(u!=$||!oe.nodeClass&&(f(e)||f(n)))return!1;var l=!oe.argsObject&&p(e)?Object:e.constructor,v=!oe.argsObject&&p(n)?Object:n.constructor;if(!(l==v||G.call(e,"constructor")&&G.call(n,"constructor")||d(l)&&l instanceof l&&d(v)&&v instanceof v||!("constructor"in e&&"constructor"in n)))return!1}r||(r=[]),i||(i=[]);for(var m=r.length;m--;)if(r[m]==e)return i[m]==n;var y=0;if(result=!0,r.push(e),i.push(n),a){if(m=e.length,y=n.length,result=y==m)for(;y--;){var w=n[y];if(!(result=b(e[y],w,r,i)))break}}else h(n,function(n,o,s){return G.call(s,o)?(y++,result=G.call(e,o)&&b(e[o],n,r,i)):t}),result&&h(e,function(e,n,r){return G.call(r,n)?result=--y>-1:t});return r.pop(),i.pop(),result}function v(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:ue.call(t)}function m(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function y(e,n){return new cn(function(r){var i=new we,o=new ge;return o.setDisposable(i),i.setDisposable(e.subscribe(r.onNext.bind(r),function(e){var i,s;try{s=n(e)}catch(u){return r.onError(u),t}i=new we,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function w(e,n){var r=this;return new cn(function(i){var o=0,s=e.length;return r.subscribe(function(r){if(s>o){var u,c=e[o++];try{u=n(r,c)}catch(a){return i.onError(a),t}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function g(t){return this.select(function(e,n){var r=t(e,n);return s(r)?en(r):r}).mergeObservable()}function x(e,n,r){return e.addListener?(e.addListener(n,r),ve(function(){e.removeListener(n,r)})):e.addEventListener?(e.addEventListener(n,r,!1),ve(function(){e.removeEventListener(n,r,!1)})):t}function E(t,e,n){var r=new pe;if(t&&t.length)for(var i=0,o=t.length;o>i;i++)r.add(E(t[i],e,n));else t&&r.add(x(t,e,n));return r}function C(t,e){var n=Ce(t);return new cn(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function D(t,e,n){return t===e?new cn(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):He(function(){return observableTimerDateAndPeriod(n.now()+t,e,n)})}function S(t,e){return new cn(function(n){function r(){s&&(s=!1,n.onNext(o)),i&&n.onCompleted()}var i,o,s;return new pe(t.subscribe(function(t){s=!0,o=t},n.onError.bind(n),function(){i=!0}),e.subscribe(r,n.onError.bind(n),r))})}function N(e,r,i){return new cn(function(o){function s(e,r){h[r]=e;var s;if(c[r]=!0,a||(a=c.every(n))){try{s=i.apply(null,h)}catch(u){return o.onError(u),t}o.onNext(s)}else l&&o.onCompleted()}var u=2,c=[!1,!1],a=!1,l=!1,h=Array(u);return new pe(e.subscribe(function(t){s(t,0)},o.onError.bind(o),function(){l=!0,o.onCompleted()}),r.subscribe(function(t){s(t,1)},o.onError.bind(o)))})}var A={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},O=A[typeof window]&&window||this,R=A[typeof exports]&&exports&&!exports.nodeType&&exports,_=A[typeof module]&&module&&!module.nodeType&&module,j=_&&_.exports===R&&R,W=A[typeof global]&&global;!W||W.global!==W&&W.window!==W||(O=W);var k={internals:{},config:{}},q=Date.now,T="Sequence contains no elements.",P="Argument out of range",L="Object has been disposed",V="object"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";window.Set&&"function"==typeof(new window.Set)["@@iterator"]&&(V="@@iterator");var z,M="[object Arguments]",I="[object Array]",B="[object Boolean]",F="[object Date]",U="[object Error]",H="[object Function]",Q="[object Number]",$="[object Object]",X="[object RegExp]",J="[object String]",K=Object.prototype.toString,G=Object.prototype.hasOwnProperty,Y=K.call(arguments)==M,Z=Error.prototype,te=Object.prototype,ee=te.propertyIsEnumerable;try{z=!(K.call(document)==$&&!({toString:0}+""))}catch(ne){z=!0}var re=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ie={};ie[I]=ie[F]=ie[Q]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},ie[B]=ie[J]={constructor:!0,toString:!0,valueOf:!0},ie[U]=ie[H]=ie[X]={constructor:!0,toString:!0},ie[$]={constructor:!0};var oe={};(function(){var t=function(){this.x=1},e=[];t.prototype={valueOf:1,y:1};for(var n in new t)e.push(n);for(n in arguments);oe.enumErrorProps=ee.call(Z,"message")||ee.call(Z,"name"),oe.enumPrototypes=ee.call(t,"prototype"),oe.nonEnumArgs=0!=n,oe.nonEnumShadows=!/valueOf/.test(e)})(1),Y||(p=function(t){return t&&"object"==typeof t?G.call(t,"callee"):!1}),d(/x/)&&(d=function(t){return"function"==typeof t&&K.call(t)==H});var se=k.internals.isEqual=function(t,e){return b(t,e,[],[])},ue=Array.prototype.slice;({}).hasOwnProperty;var ce=this.inherits=k.internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},ae=k.internals.addProperties=function(t){for(var e=ue.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}};k.internals.addRef=function(t,e){return new cn(function(n){return new pe(e.getDisposable(),t.subscribe(n))})};var le=function(t,e){this.id=t,this.value=e};le.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var he=k.internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},fe=he.prototype;fe.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},fe.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},fe.heapify=function(e){if(e===t&&(e=0),!(e>=this.length||0>e)){var n=2*e+1,r=2*e+2,i=e;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==e){var o=this.items[e];this.items[e]=this.items[i],this.items[i]=o,this.heapify(i)}}},fe.peek=function(){return this.items[0].value},fe.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},fe.dequeue=function(){var t=this.peek();return this.removeAt(0),t},fe.enqueue=function(t){var e=this.length++;this.items[e]=new le(he.count++,t),this.percolate(e)},fe.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},he.count=0;var pe=k.CompositeDisposable=function(){this.disposables=v(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},de=pe.prototype;de.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},de.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},de.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},de.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},de.contains=function(t){return-1!==this.disposables.indexOf(t)},de.toArray=function(){return this.disposables.slice(0)};var be=k.Disposable=function(t){this.isDisposed=!1,this.action=t||e};be.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ve=be.create=function(t){return new be(t)},me=be.empty={dispose:e},ye=function(){function t(t){this.isSingle=t,this.isDisposed=!1,this.current=null}var e=t.prototype;return e.getDisposable=function(){return this.current},e.setDisposable=function(t){if(this.current&&this.isSingle)throw Error("Disposable has already been assigned");var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},e.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()},t}(),we=k.SingleAssignmentDisposable=function(t){function e(){t.call(this,!0)}return ce(e,t),e}(ye),ge=k.SerialDisposable=function(t){function e(){t.call(this,!1)}return ce(e,t),e}(ye);k.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?me:new t(this)},e}();var xe=k.internals.ScheduledItem=function(t,e,n,r,o){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=o||i,this.disposable=new we};xe.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},xe.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},xe.prototype.isCancelled=function(){return this.disposable.isDisposed},xe.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Ee=k.Scheduler=function(){function t(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function e(t,e){var n=e.first,r=e.second,i=new pe,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),me});r||(i.add(s),n=!0)})};return o(n),i}function n(t,e,n){var r=e.first,i=e.second,o=new pe,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),me});u||(o.add(c),i=!0)})};return s(r),o}function r(t,e){return e(),me}var i=t.prototype;return i.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},i.schedulePeriodicWithState=function(t,e,n){var r=t,i=setInterval(function(){r=n(r)},e);return ve(function(){clearInterval(i)})},i.schedule=function(t){return this._schedule(t,r)},i.scheduleWithState=function(t,e){return this._schedule(t,e)},i.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,r)},i.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},i.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,r)},i.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},i.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},i.scheduleRecursiveWithState=function(t,n){return this.scheduleWithState({first:t,second:n},function(t,n){return e(t,n)})},i.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithRelativeAndState=function(t,e,r){return this._scheduleRelative({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithRelativeAndState")})},i.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithAbsoluteAndState=function(t,e,r){return this._scheduleAbsolute({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithAbsoluteAndState")})},t.now=q,t.normalize=function(t){return 0>t&&(t=0),t},t}(),Ce=Ee.normalize,De=Ee.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){for(var r=Ce(r);r-this.now()>0;);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Ee(q,t,e,n)}(),Se=Ee.currentThread=function(){function t(t){for(var e;t.length>0;)if(e=t.dequeue(),!e.isCancelled()){for(;e.dueTime-Ee.now()>0;);e.isCancelled()||e.invoke()}}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o=this.now()+Ee.normalize(n),s=new xe(this,e,r,o);if(i)i.enqueue(s);else{i=new he(4),i.enqueue(s);try{t(i)}catch(u){throw u}finally{i=null}}return s.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i,o=new Ee(q,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}();k.internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new we;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();var Ne,Ae=e;(function(){function t(){if(!O.postMessage||O.importScripts)return!1;var t=!1,e=O.onmessage;return O.onmessage=function(){t=!0},O.postMessage("","*"),O.onmessage=e,t}function e(t){if("string"==typeof t.data&&t.data.substring(0,o.length)===o){var e=t.data.substring(o.length),n=s[e];n(),delete s[e]}}var n=RegExp("^"+(K+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),r="function"==typeof(r=W&&j&&W.setImmediate)&&!n.test(r)&&r,i="function"==typeof(i=W&&j&&W.clearImmediate)&&!n.test(i)&&i;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Ne=process.nextTick;else if("function"==typeof r)Ne=r,Ae=i;else if(t()){var o="ms.rx.schedule"+Math.random(),s={},u=0;O.addEventListener?O.addEventListener("message",e,!1):O.attachEvent("onmessage",e,!1),Ne=function(t){var e=u++;s[e]=t,O.postMessage(o+e,"*")}}else if(O.MessageChannel){var c=new O.MessageChannel,a={},l=0;c.port1.onmessage=function(t){var e=t.data,n=a[e];n(),delete a[e]},Ne=function(t){var e=l++;a[e]=t,c.port2.postMessage(e)}}else"document"in O&&"onreadystatechange"in O.document.createElement("script")?Ne=function(t){var e=O.document.createElement("script");e.onreadystatechange=function(){t(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},O.document.documentElement.appendChild(e)}:(Ne=function(t){return setTimeout(t,0)},Ae=clearTimeout)})();var Oe=Ee.timeout=function(){function t(t,e){var n=this,r=new we,i=Ne(function(){r.isDisposed||r.setDisposable(e(n,t))});return new pe(r,ve(function(){Ae(i)}))}function e(t,e,n){var r=this,i=Ee.normalize(e);if(0===i)return r.scheduleWithState(t,n);var o=new we,s=setTimeout(function(){o.isDisposed||o.setDisposable(n(r,t))},i);return new pe(o,ve(function(){clearTimeout(s)}))}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Ee(q,t,e,n)}(),Re=k.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t||(t=De),new cn(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),_e=Re.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new Re("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),je=Re.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new Re("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),We=Re.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new Re("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),ke=k.internals.Enumerator=function(t,e){this.moveNext=t,this.getCurrent=e},qe=ke.create=function(t,e){var n=!1;return new ke(function(){if(n)return!1;var e=t();return e||(n=!0),e},function(){return e()})},Te=k.internals.Enumerable=function(t){this.getEnumerator=t};Te.prototype.concat=function(){var e=this;return new cn(function(n){var r,i=e.getEnumerator(),o=new ge,s=De.scheduleRecursive(function(e){var s,u;if(!r){try{u=i.moveNext(),u&&(s=i.getCurrent())}catch(c){return n.onError(c),t}if(!u)return n.onCompleted(),t;var a=new we;o.setDisposable(a),a.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){e()}))}});return new pe(o,s,ve(function(){r=!0}))})},Te.prototype.catchException=function(){var e=this;return new cn(function(n){var r,i,o=e.getEnumerator(),s=new ge,u=De.scheduleRecursive(function(e){var u,c;if(!r){try{c=o.moveNext(),c&&(u=o.getCurrent())}catch(a){return n.onError(a),t}if(!c)return i?n.onError(i):n.onCompleted(),t;var l=new we;s.setDisposable(l),l.setDisposable(u.subscribe(n.onNext.bind(n),function(t){i=t,e()},n.onCompleted.bind(n)))}});return new pe(s,u,ve(function(){r=!0}))})};var Pe=Te.repeat=function(t,e){return 1===arguments.length&&(e=-1),new Te(function(){var n,r=e;return qe(function(){return 0===r?!1:(r>0&&r--,n=t,!0)},function(){return n})})},Le=Te.forEach=function(t,e,r){return e||(e=n),new Te(function(){var n,i=-1;return qe(function(){return++i0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var r;if(!(n.queue.length>0))return n.isAcquired=!1,t;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}e()}))},n.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},n}(Ie);Fe.create=Fe.createWithDisposable=function(t){return new cn(t)};var He=Fe.defer=function(t){return new cn(function(e){var n;try{n=t()}catch(r){return Ke(r).subscribe(e)}return n.subscribe(e)})},Qe=Fe.empty=function(t){return t||(t=De),new cn(function(e){return t.schedule(function(){e.onCompleted()})})},$e=Fe.fromArray=function(t,e){return e||(e=Se),new cn(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};Fe.fromIterable=function(e,n){return n||(n=Se),new cn(function(r){var i;try{i=e[V]()}catch(o){return r.onError(o),t}return n.scheduleRecursive(function(e){var n;try{n=i.next()}catch(o){return r.onError(o),t}n.done?r.onCompleted():(r.onNext(n.value),e())})})},Fe.generate=function(e,n,r,i,o){return o||(o=Se),new cn(function(s){var u=!0,c=e;return o.scheduleRecursive(function(e){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(l){return s.onError(l),t}o?(s.onNext(a),e()):s.onCompleted()})})};var Xe=Fe.never=function(){return new cn(function(){return me})};Fe.range=function(t,e,n){return n||(n=Se),new cn(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},Fe.repeat=function(t,e,n){return n||(n=Se),null==e&&(e=-1),Je(t,n).repeat(e)};var Je=Fe["return"]=Fe.returnValue=function(t,e){return e||(e=De),new cn(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Ke=Fe["throw"]=Fe.throwException=function(t,e){return e||(e=De),new cn(function(n){return e.schedule(function(){n.onError(t)})})};Me["catch"]=Me.catchException=function(t){return"function"==typeof t?y(this,t):Ge([this,t])};var Ge=Fe.catchException=Fe["catch"]=function(){var t=v(arguments,0);return Le(t).catchException()};Me.combineLatest=function(){var t=ue.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Ye.apply(this,t)};var Ye=Fe.combineLatest=function(){var e=ue.call(arguments),r=e.pop();return Array.isArray(e[0])&&(e=e[0]),new cn(function(i){function o(e){var o;if(a[e]=!0,l||(l=a.every(n))){try{o=r.apply(null,f)}catch(s){return i.onError(s),t}i.onNext(o)}else h.filter(function(t,n){return n!==e}).every(n)&&i.onCompleted()}function s(t){h[t]=!0,h.every(n)&&i.onCompleted()}for(var u=function(){return!1},c=e.length,a=m(c,u),l=!1,h=m(c,u),f=Array(c),p=Array(c),d=0;c>d;d++)(function(t){p[t]=new we,p[t].setDisposable(e[t].subscribe(function(e){f[t]=e,o(t)},i.onError.bind(i),function(){s(t)}))})(d);return new pe(p)})};Me.concat=function(){var t=ue.call(arguments,0);return t.unshift(this),Ze.apply(this,t)};var Ze=Fe.concat=function(){var t=v(arguments,0);return Le(t).concat()};Me.concatObservable=Me.concatAll=function(){return this.merge(1)},Me.merge=function(t){if("number"!=typeof t)return tn(this,t);var e=this;return new cn(function(n){var r=0,i=new pe,o=!1,u=[],c=function(t){var e=new we;i.add(e),s(t)&&(t=en(t)),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),u.length>0?(t=u.shift(),c(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,c(e)):u.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var tn=Fe.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=ue.call(arguments,1)):(t=De,e=ue.call(arguments,0)):(t=De,e=ue.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),$e(e,t).mergeObservable()};Me.mergeObservable=Me.mergeAll=function(){var t=this;return new cn(function(e){var n=new pe,r=!1,i=new we;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new we;n.add(i),s(t)&&(t=en(t)),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},Me.skipUntil=function(t){var e=this;return new cn(function(n){var r=!1,i=new pe(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new we;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Me["switch"]=Me.switchLatest=function(){var t=this;return new cn(function(e){var n=!1,r=new ge,i=!1,o=0,u=t.subscribe(function(t){var u=new we,c=++o;n=!0,r.setDisposable(u),s(t)&&(t=en(t)),u.setDisposable(t.subscribe(function(t){o===c&&e.onNext(t)},function(t){o===c&&e.onError(t)},function(){o===c&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new pe(u,r)})},Me.takeUntil=function(t){var n=this;return new cn(function(r){return new pe(n.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),e))})},Me.zip=function(){if(Array.isArray(arguments[0]))return w.apply(this,arguments);var e=this,r=ue.call(arguments),i=r.pop();return r.unshift(e),new cn(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=r.length,c=m(u,function(){return[]}),a=m(u,function(){return!1}),l=function(r){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(e,u)}catch(l){return o.onError(l),t}o.onNext(s)}else a.filter(function(t,e){return e!==r}).every(n)&&o.onCompleted()},h=Array(u),f=0;u>f;f++)(function(t){h[t]=new we,h[t].setDisposable(r[t].subscribe(function(e){c[t].push(e),l(t)},o.onError.bind(o),function(){s(t)}))})(f);return new pe(h)})},Fe.zip=function(){var t=ue.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},Fe.zipArray=function(){var e=v(arguments,0);return new cn(function(r){function i(e){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});r.onNext(i)}else if(c.filter(function(t,n){return n!==e}).every(n))return r.onCompleted(),t}function o(e){return c[e]=!0,c.every(n)?(r.onCompleted(),t):t}for(var s=e.length,u=m(s,function(){return[]}),c=m(s,function(){return!1}),a=Array(s),l=0;s>l;l++)(function(t){a[t]=new we,a[t].setDisposable(e[t].subscribe(function(e){u[t].push(e),i(t)},r.onError.bind(r),function(){o(t)}))})(l);var h=new pe(a);return h.add(ve(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),h})},Me.asObservable=function(){var t=this;return new cn(function(e){return t.subscribe(e)})},Me.dematerialize=function(){var t=this;return new cn(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Me.distinctUntilChanged=function(e,i){var o=this;return e||(e=n),i||(i=r),new cn(function(n){var r,s=!1;return o.subscribe(function(o){var u,c=!1;try{u=e(o)}catch(a){return n.onError(a),t}if(s)try{c=i(r,u)}catch(a){return n.onError(a),t}s&&c||(s=!0,r=u,n.onNext(o))},n.onError.bind(n),n.onCompleted.bind(n))})},Me["do"]=Me.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new cn(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},Me["finally"]=Me.finallyAction=function(t){var e=this;return new cn(function(n){var r=e.subscribe(n);return ve(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},Me.ignoreElements=function(){var t=this;return new cn(function(n){return t.subscribe(e,n.onError.bind(n),n.onCompleted.bind(n))})},Me.materialize=function(){var t=this;return new cn(function(e){return t.subscribe(function(t){e.onNext(_e(t))},function(t){e.onNext(je(t)),e.onCompleted()},function(){e.onNext(We()),e.onCompleted()})})},Me.repeat=function(t){return Pe(this,t).concat()},Me.retry=function(t){return Pe(this,t).catchException()},Me.scan=function(){var e,n,r=!1,i=this;return 2===arguments.length?(r=!0,e=arguments[0],n=arguments[1]):n=arguments[0],new cn(function(o){var s,u,c;return i.subscribe(function(i){try{c||(c=!0),s?u=n(u,i):(u=r?n(e,i):i,s=!0)}catch(a){return o.onError(a),t}o.onNext(u)},o.onError.bind(o),function(){!c&&r&&o.onNext(e),o.onCompleted()})})},Me.skipLast=function(t){var e=this;return new cn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},Me.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=De,t=ue.call(arguments,n),Le([$e(t,e),this]).concat()},Me.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return $e(t,e)})},Me.takeLastBuffer=function(t){var e=this;return new cn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},Me.select=Me.map=function(e,n){var r=this;return new cn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Me.selectMany=Me.flatMap=function(t,e){return e?this.selectMany(function(n,r){var i=t(n,r),o=s(i)?en(i):i;return o.select(function(t){return e(n,t,r)})}):"function"==typeof t?g.call(this,t):g.call(this,function(){return t})},Me.selectSwitch=Me.flatMapLatest=function(t,e){return this.select(t,e).switchLatest()},Me.skip=function(t){if(0>t)throw Error(P);var e=this;return new cn(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Me.skipWhile=function(e,n){var r=this;return new cn(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Me.take=function(t,e){if(0>t)throw Error(P);if(0===t)return Qe(e);var n=this;return new cn(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},Me.takeWhile=function(e,n){var r=this;return new cn(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},Me.where=Me.filter=function(e,n){var r=this;return new cn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})},Fe.fromCallback=function(e,n,r,i){return n||(n=De),function(){var o=ue.call(arguments,0);return new cn(function(s){return n.schedule(function(){function n(e){var n=e;if(i)try{n=i(arguments)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}},Fe.fromNodeCallback=function(e,n,r,i){return n||(n=De),function(){var o=ue.call(arguments,0);return new cn(function(s){return n.schedule(function(){function n(e){if(e)return s.onError(e),t; -var n=ue.call(arguments,1);if(i)try{n=i(n)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}},Fe.fromEvent=function(e,n,r){return new cn(function(i){return E(e,n,function(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)})}).publish().refCount()},Fe.fromEventPattern=function(e,n,r){return new cn(function(i){function o(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)}var s=e(o);return ve(function(){n&&n(o,s)})}).publish().refCount()};var en=Fe.fromPromise=function(t){return new cn(function(e){t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)})})};Me.toPromise=function(t){if(t||(t=k.config.Promise),!t)throw Error("Promise type not provided nor in Rx.config.Promise");var e=this;return new t(function(t,n){var r,i=!1;e.subscribe(function(t){r=t,i=!0},function(t){n(t)},function(){i&&t(r)})})},Fe.startAsync=function(t){var e;try{e=t()}catch(n){return Ke(n)}return en(e)},Me.multicast=function(t,e){var n=this;return"function"==typeof t?new cn(function(r){var i=n.multicast(t());return new pe(e(i).subscribe(r),i.connect())}):new nn(n,t)},Me.publish=function(t){return t?this.multicast(function(){return new hn},t):this.multicast(new hn)},Me.share=function(){return this.publish(null).refCount()},Me.publishLast=function(t){return t?this.multicast(function(){return new fn},t):this.multicast(new fn)},Me.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new dn(e)},t):this.multicast(new dn(t))},Me.shareValue=function(t){return this.publishValue(t).refCount()},Me.replay=function(t,e,n,r){return t?this.multicast(function(){return new bn(e,n,r)},t):this.multicast(new bn(e,n,r))},Me.shareReplay=function(t,e,n){return this.replay(null,t,e,n).refCount()};var nn=k.ConnectableObservable=function(t){function e(e,n){function r(t){return i.subject.subscribe(t)}var i={subject:n,source:e.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return i.hasSubscription||(i.hasSubscription=!0,i.subscription=new pe(i.source.subscribe(i.subject),ve(function(){i.hasSubscription=!1}))),i.subscription},t.call(this,r)}return ce(e,t),e.prototype.connect=function(){return this.connect()},e.prototype.refCount=function(){var t=null,e=0,n=this;return new cn(function(r){var i,o;return e++,i=1===e,o=n.subscribe(r),i&&(t=n.connect()),ve(function(){o.dispose(),e--,0===e&&t.dispose()})})},e}(Fe),rn=Fe.interval=function(t,e){return e||(e=Oe),D(t,t,e)},on=Fe.timer=function(e,n,r){var i;return r||(r=Oe),"number"==typeof n?i=n:"object"==typeof n&&"now"in n&&(r=n),i===t?C(e,r):D(e,i,r)};Me.delay=function(t,e){e||(e=Oe);var n=this;return new cn(function(r){var i,o=!1,s=new ge,u=null,c=[],a=!1;return i=n.materialize().timestamp(e).subscribe(function(n){var i,l;"E"===n.value.kind?(c=[],c.push(n),u=n.value.exception,l=!a):(c.push({value:n.value,timestamp:n.timestamp+t}),l=!o,o=!0),l&&(null!==u?r.onError(u):(i=new we,s.setDisposable(i),i.setDisposable(e.scheduleRecursiveWithRelative(t,function(t){var n,i,s,l;if(null===u){a=!0;do s=null,c.length>0&&0>=c[0].timestamp-e.now()&&(s=c.shift().value),null!==s&&s.accept(r);while(null!==s);l=!1,i=0,c.length>0?(l=!0,i=Math.max(0,c[0].timestamp-e.now())):o=!1,n=u,a=!1,null!==n?r.onError(n):l&&t(i)}}))))}),new pe(i,s)})},Me.throttle=function(t,e){return e||(e=Oe),this.throttleWithSelector(function(){return on(t,e)})},Me.timeInterval=function(t){var e=this;return t||(t=Oe),He(function(){var n=t.now();return e.select(function(e){var r=t.now(),i=r-n;return n=r,{value:e,interval:i}})})},Me.timestamp=function(t){return t||(t=Oe),this.select(function(e){return{value:e,timestamp:t.now()}})},Me.sample=function(t,e){return e||(e=Oe),"number"==typeof t?S(this,rn(t,e)):S(this,t)},Me.timeout=function(t,e,n){var r,i=this;return e||(e=Ke(Error("Timeout"))),n||(n=Oe),r=t instanceof Date?function(t,e){n.scheduleWithAbsolute(t,e)}:function(t,e){n.scheduleWithRelative(t,e)},new cn(function(n){var o,s=0,u=new we,c=new ge,a=!1,l=new ge;return c.setDisposable(u),o=function(){var i=s;l.setDisposable(r(t,function(){a=s===i;var t=a;t&&c.setDisposable(e.subscribe(n))}))},o(),u.setDisposable(i.subscribe(function(t){var e=!a;e&&(s++,n.onNext(t),o())},function(t){var e=!a;e&&(s++,n.onError(t))},function(){var t=!a;t&&(s++,n.onCompleted())})),new pe(c,l)})},Fe.generateWithTime=function(e,n,r,i,o,s){return s||(s=Oe),new cn(function(u){var c,a,l=!0,h=!1,f=e;return s.scheduleRecursiveWithRelative(0,function(e){h&&u.onNext(c);try{l?l=!1:f=r(f),h=n(f),h&&(c=i(f),a=o(f))}catch(s){return u.onError(s),t}h?e(a):u.onCompleted()})})},Me.delaySubscription=function(t,e){return e||(e=Oe),this.delayWithSelector(on(t,e),function(){return Qe()})},Me.delayWithSelector=function(e,n){var r,i,o=this;return"function"==typeof e?i=e:(r=e,i=n),new cn(function(e){var n=new pe,s=!1,u=function(){s&&0===n.length&&e.onCompleted()},c=new ge,a=function(){c.setDisposable(o.subscribe(function(r){var o;try{o=i(r)}catch(s){return e.onError(s),t}var c=new we;n.add(c),c.setDisposable(o.subscribe(function(){e.onNext(r),n.remove(c),u()},e.onError.bind(e),function(){e.onNext(r),n.remove(c),u()}))},e.onError.bind(e),function(){s=!0,c.dispose(),u()}))};return r?c.setDisposable(r.subscribe(function(){a()},e.onError.bind(e),function(){a()})):a(),new pe(c,n)})},Me.timeoutWithSelector=function(e,n,r){if(1===arguments.length){n=e;var e=Xe()}r||(r=Ke(Error("Timeout")));var i=this;return new cn(function(o){var s=new ge,u=new ge,c=new we;s.setDisposable(c);var a=0,l=!1,h=function(t){var e=a,n=function(){return a===e},i=new we;u.setDisposable(i),i.setDisposable(t.subscribe(function(){n()&&s.setDisposable(r.subscribe(o)),i.dispose()},function(t){n()&&o.onError(t)},function(){n()&&s.setDisposable(r.subscribe(o))}))};h(e);var f=function(){var t=!l;return t&&a++,t};return c.setDisposable(i.subscribe(function(e){if(f()){o.onNext(e);var r;try{r=n(e)}catch(i){return o.onError(i),t}h(r)}},function(t){f()&&o.onError(t)},function(){f()&&o.onCompleted()})),new pe(s,u)})},Me.throttleWithSelector=function(e){var n=this;return new cn(function(r){var i,o=!1,s=new ge,u=0,c=n.subscribe(function(n){var c;try{c=e(n)}catch(a){return r.onError(a),t}o=!0,i=n,u++;var l=u,h=new we;s.setDisposable(h),h.setDisposable(c.subscribe(function(){o&&u===l&&r.onNext(i),o=!1,h.dispose()},r.onError.bind(r),function(){o&&u===l&&r.onNext(i),o=!1,h.dispose()}))},function(t){s.dispose(),r.onError(t),o=!1,u++},function(){s.dispose(),o&&r.onNext(i),r.onCompleted(),o=!1,u++});return new pe(c,s)})},Me.skipLastWithTime=function(t,e){e||(e=Oe);var n=this;return new cn(function(r){var i=[];return n.subscribe(function(n){var o=e.now();for(i.push({interval:o,value:n});i.length>0&&o-i[0].interval>=t;)r.onNext(i.shift().value)},r.onError.bind(r),function(){for(var n=e.now();i.length>0&&n-i[0].interval>=t;)r.onNext(i.shift().value);r.onCompleted()})})},Me.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return $e(t,n)})},Me.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=Oe),new cn(function(r){var i=[];return n.subscribe(function(n){var r=e.now();for(i.push({interval:r,value:n});i.length>0&&r-i[0].interval>=t;)i.shift()},r.onError.bind(r),function(){for(var n=e.now(),o=[];i.length>0;){var s=i.shift();t>=n-s.interval&&o.push(s.value)}r.onNext(o),r.onCompleted()})})},Me.takeWithTime=function(t,e){var n=this;return e||(e=Oe),new cn(function(r){var i=e.scheduleWithRelative(t,function(){r.onCompleted()});return new pe(i,n.subscribe(r))})},Me.skipWithTime=function(t,e){var n=this;return e||(e=Oe),new cn(function(r){var i=!1,o=e.scheduleWithRelative(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new pe(o,s)})},Me.skipUntilWithTime=function(t,e){e||(e=Oe);var n=this;return new cn(function(r){var i=!1,o=e.scheduleWithAbsolute(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new pe(o,s)})},Me.takeUntilWithTime=function(t,e){e||(e=Oe);var n=this;return new cn(function(r){return new pe(e.scheduleWithAbsolute(t,function(){r.onCompleted()}),n.subscribe(r))})},Me.pausable=function(t){var e=this;return new cn(function(n){var r=e.publish(),i=r.subscribe(n),o=me,s=t.distinctUntilChanged().subscribe(function(t){t?o=r.connect():(o.dispose(),o=me)});return new pe(i,o,s)})},Me.pausableBuffered=function(t){var e=this;return new cn(function(n){var r=[],i=!0,o=N(e,t.distinctUntilChanged(),function(t,e){return{data:t,shouldFire:e}}).subscribe(function(t){if(t.shouldFire&&i&&n.onNext(t.data),t.shouldFire&&!i){for(;r.length>0;)n.onNext(r.shift());i=!0}else t.shouldFire||i?!t.shouldFire&&i&&(i=!1):r.push(t.data)},n.onError.bind(n),n.onCompleted.bind(n));return t.onNext(!1),o})},Me.controlled=function(t){return null==t&&(t=!0),new sn(this,t)};var sn=function(t){function e(t){return this.source.subscribe(t)}function n(n,r){t.call(this,e),this.subject=new un(r),this.source=n.multicast(this.subject).refCount()}return ce(n,t),n.prototype.request=function(t){return null==t&&(t=-1),this.subject.request(t)},n}(Fe),un=k.ControlledSubject=function(t){function e(t){return this.subject.subscribe(t)}function n(n){null==n&&(n=!0),t.call(this,e),this.subject=new hn,this.enableQueue=n,this.queue=n?[]:null,this.requestedCount=0,this.requestedDisposable=me,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=me}return ce(n,t),ae(n.prototype,Ve,{onCompleted:function(){u.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(t){u.call(this),this.hasFailed=!0,this.error=t,this.enableQueue&&0!==this.queue.length||this.subject.onError(t)},onNext:function(t){u.call(this);var e=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(t):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),e=!0),e&&this.subject.onNext(t)},_processRequest:function(t){if(this.enableQueue){for(;this.queue.length>=t&&t>0;)this.subject.onNext(this.queue.shift()),t--;return 0!==this.queue.length?{numberOfItems:t,returnValue:!0}:{numberOfItems:t,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=me):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=me),{numberOfItems:t,returnValue:!1}},request:function(t){u.call(this),this.disposeCurrentRequest();var e=this,n=this._processRequest(t);return t=n.numberOfItems,n.returnValue?me:(this.requestedCount=t,this.requestedDisposable=ve(function(){e.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=me},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),n}(Fe),cn=k.AnonymousObservable=function(e){function n(e){return e===t?e=me:"function"==typeof e&&(e=ve(e)),e}function r(i){function o(t){var e=new an(t);if(Se.scheduleRequired())Se.schedule(function(){try{e.setDisposable(n(i(e)))}catch(t){if(!e.fail(t))throw t}});else try{e.setDisposable(n(i(e)))}catch(r){if(!e.fail(r))throw r}return e}return this instanceof r?(e.call(this,o),t):new r(i)}return ce(r,e),r}(Fe),an=function(t){function e(e){t.call(this),this.observer=e,this.m=new we}ce(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.setDisposable=function(t){this.m.setDisposable(t)},n.getDisposable=function(){return this.m.getDisposable()},n.disposable=function(t){return arguments.length?this.getDisposable():setDisposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Ie),ln=function(t,e){this.subject=t,this.observer=e};ln.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var hn=k.Subject=function(t){function e(t){return u.call(this),this.isStopped?this.exception?(t.onError(this.exception),me):(t.onCompleted(),me):(this.observers.push(t),new ln(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return ce(n,t),ae(n.prototype,Ve,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(u.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(u.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(u.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new pn(t,e)},n}(Fe),fn=k.AsyncSubject=function(t){function e(t){if(u.call(this),!this.isStopped)return this.observers.push(t),new ln(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),me}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return ce(n,t),ae(n.prototype,Ve,{hasObservers:function(){return u.call(this),this.observers.length>0},onCompleted:function(){var t,e,n;if(u.call(this),!this.isStopped){this.isStopped=!0;var r=this.observers.slice(0),i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(u.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){u.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(Fe),pn=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return ce(n,t),ae(n.prototype,Ve,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(Fe),dn=k.BehaviorSubject=function(t){function e(t){if(u.call(this),!this.isStopped)return this.observers.push(t),t.onNext(this.value),new ln(this,t);var e=this.exception;return e?t.onError(e):t.onCompleted(),me}function n(n){t.call(this,e),this.value=n,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return ce(n,t),ae(n.prototype,Ve,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(u.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(u.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(u.call(this),!this.isStopped){this.value=t;for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),n}(Fe),bn=k.ReplaySubject=function(t){function e(t,e){this.subject=t,this.observer=e}function n(t){var n=new Ue(this.scheduler,t),r=new e(this,n);u.call(this),this._trim(this.scheduler.now()),this.observers.push(n);for(var i=this.q.length,o=0,s=this.q.length;s>o;o++)n.onNext(this.q[o].value);return this.hasError?(i++,n.onError(this.error)):this.isStopped&&(i++,n.onCompleted()),n.ensureActive(i),r}function r(e,r,i){this.bufferSize=null==e?Number.MAX_VALUE:e,this.windowSize=null==r?Number.MAX_VALUE:r,this.scheduler=i||Se,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,t.call(this,n)}return e.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1)}},ce(r,t),ae(r.prototype,Ve,{hasObservers:function(){return this.observers.length>0},_trim:function(t){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&t-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(t){var e;if(u.call(this),!this.isStopped){var n=this.scheduler.now();this.q.push({interval:n,value:t}),this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)e=r[i],e.onNext(t),e.ensureActive()}},onError:function(t){var e;if(u.call(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;var n=this.scheduler.now();this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)e=r[i],e.onError(t),e.ensureActive();this.observers=[]}},onCompleted:function(){var t;if(u.call(this),!this.isStopped){this.isStopped=!0;var e=this.scheduler.now();this._trim(e);for(var n=this.observers.slice(0),r=0,i=n.length;i>r;r++)t=n[r],t.onCompleted(),t.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),r}(Fe);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(O.Rx=k,define(function(){return k})):R&&_?j?(_.exports=k).Rx=k:R.Rx=k:O.Rx=k}).call(this); \ No newline at end of file +(function(t){function e(){}function n(t){return t}function r(t,e){return ue(t,e)}function i(t,e){return t-e}function o(t){throw t}function s(e){return"function"==typeof e.then&&e.subscribe===t}function u(){if(this.isDisposed)throw Error(L)}function c(t){var e=typeof t;return t&&("function"==e||"object"==e)||!1}function a(t){var e=[];if(!c(t))return e;se.nonEnumArgs&&t.length&&p(t)&&(t=ce.call(t));var n=se.enumPrototypes&&"function"==typeof t,r=se.enumErrorProps&&(t===te||t instanceof Error);for(var i in t)n&&"prototype"==i||r&&("message"==i||"name"==i)||e.push(i);if(se.nonEnumShadows&&t!==ee){var o=t.constructor,s=-1,u=ie.length;if(t===(o&&o.prototype))var a=t===stringProto?K:t===te?H:G.call(t),l=oe[a];for(;u>++s;)i=ie[s],l&&l[i]||!Y.call(t,i)||e.push(i)}return e}function l(t,e,n){for(var r=-1,i=n(t),o=i.length;o>++r;){var s=i[r];if(e(t[s],s,t)===!1)break}return t}function h(t,e){return l(t,e,a)}function f(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function p(t){return t&&"object"==typeof t?G.call(t)==I:!1}function d(t){return"function"==typeof t}function b(e,n,r,i){if(e===n)return 0!==e||1/e==1/n;var o=typeof e,s=typeof n;if(e===e&&(null==e||null==n||"function"!=o&&"object"!=o&&"function"!=s&&"object"!=s))return!1;var u=G.call(e),c=G.call(n);if(u==I&&(u=X),c==I&&(c=X),u!=c)return!1;switch(u){case F:case U:return+e==+n;case $:return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case J:case K:return e==n+""}var a=u==B;if(!a){if(u!=X||!se.nodeClass&&(f(e)||f(n)))return!1;var l=!se.argsObject&&p(e)?Object:e.constructor,v=!se.argsObject&&p(n)?Object:n.constructor;if(!(l==v||Y.call(e,"constructor")&&Y.call(n,"constructor")||d(l)&&l instanceof l&&d(v)&&v instanceof v||!("constructor"in e&&"constructor"in n)))return!1}r||(r=[]),i||(i=[]);for(var m=r.length;m--;)if(r[m]==e)return i[m]==n;var y=0;if(result=!0,r.push(e),i.push(n),a){if(m=e.length,y=n.length,result=y==m)for(;y--;){var w=n[y];if(!(result=b(e[y],w,r,i)))break}}else h(n,function(n,o,s){return Y.call(s,o)?(y++,result=Y.call(e,o)&&b(e[o],n,r,i)):t}),result&&h(e,function(e,n,r){return Y.call(r,n)?result=--y>-1:t});return r.pop(),i.pop(),result}function v(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:ce.call(t)}function m(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function y(e,n){return new cn(function(r){var i=new ge,o=new xe;return o.setDisposable(i),i.setDisposable(e.subscribe(r.onNext.bind(r),function(e){var i,s;try{s=n(e)}catch(u){return r.onError(u),t}i=new ge,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function w(e,n){var r=this;return new cn(function(i){var o=0,s=e.length;return r.subscribe(function(r){if(s>o){var u,c=e[o++];try{u=n(r,c)}catch(a){return i.onError(a),t}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function g(t){return this.select(function(e,n){var r=t(e,n);return s(r)?en(r):r}).mergeObservable()}function x(e,n,r){return e.addListener?(e.addListener(n,r),me(function(){e.removeListener(n,r)})):e.addEventListener?(e.addEventListener(n,r,!1),me(function(){e.removeEventListener(n,r,!1)})):t}function E(t,e,n){var r=new de;if(t&&t.length)for(var i=0,o=t.length;o>i;i++)r.add(E(t[i],e,n));else t&&r.add(x(t,e,n));return r}function C(t,e){var n=De(t);return new cn(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function D(t,e,n){return t===e?new cn(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):He(function(){return observableTimerDateAndPeriod(n.now()+t,e,n)})}function S(t,e){return new cn(function(n){function r(){s&&(s=!1,n.onNext(o)),i&&n.onCompleted()}var i,o,s;return new de(t.subscribe(function(t){s=!0,o=t},n.onError.bind(n),function(){i=!0}),e.subscribe(r,n.onError.bind(n),r))})}function N(e,r,i){return new cn(function(o){function s(e,r){h[r]=e;var s;if(c[r]=!0,a||(a=c.every(n))){try{s=i.apply(null,h)}catch(u){return o.onError(u),t}o.onNext(s)}else l&&o.onCompleted()}var u=2,c=[!1,!1],a=!1,l=!1,h=Array(u);return new de(e.subscribe(function(t){s(t,0)},o.onError.bind(o),function(){l=!0,o.onCompleted()}),r.subscribe(function(t){s(t,1)},o.onError.bind(o)))})}var A={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},O=A[typeof window]&&window||this,_=A[typeof exports]&&exports&&!exports.nodeType&&exports,R=A[typeof module]&&module&&!module.nodeType&&module,j=R&&R.exports===_&&_,W=A[typeof global]&&global;!W||W.global!==W&&W.window!==W||(O=W);var k={internals:{},config:{}},q=Date.now,T="Sequence contains no elements.",P="Argument out of range",L="Object has been disposed",V="object"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";O.Set&&"function"==typeof(new O.Set)["@@iterator"]&&(V="@@iterator");var z,M={done:!0,value:t},I="[object Arguments]",B="[object Array]",F="[object Boolean]",U="[object Date]",H="[object Error]",Q="[object Function]",$="[object Number]",X="[object Object]",J="[object RegExp]",K="[object String]",G=Object.prototype.toString,Y=Object.prototype.hasOwnProperty,Z=G.call(arguments)==I,te=Error.prototype,ee=Object.prototype,ne=ee.propertyIsEnumerable;try{z=!(G.call(document)==X&&!({toString:0}+""))}catch(re){z=!0}var ie=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],oe={};oe[B]=oe[U]=oe[$]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},oe[F]=oe[K]={constructor:!0,toString:!0,valueOf:!0},oe[H]=oe[Q]=oe[J]={constructor:!0,toString:!0},oe[X]={constructor:!0};var se={};(function(){var t=function(){this.x=1},e=[];t.prototype={valueOf:1,y:1};for(var n in new t)e.push(n);for(n in arguments);se.enumErrorProps=ne.call(te,"message")||ne.call(te,"name"),se.enumPrototypes=ne.call(t,"prototype"),se.nonEnumArgs=0!=n,se.nonEnumShadows=!/valueOf/.test(e)})(1),Z||(p=function(t){return t&&"object"==typeof t?Y.call(t,"callee"):!1}),d(/x/)&&(d=function(t){return"function"==typeof t&&G.call(t)==Q});var ue=k.internals.isEqual=function(t,e){return b(t,e,[],[])},ce=Array.prototype.slice;({}).hasOwnProperty;var ae=this.inherits=k.internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},le=k.internals.addProperties=function(t){for(var e=ce.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}};k.internals.addRef=function(t,e){return new cn(function(n){return new de(e.getDisposable(),t.subscribe(n))})};var he=function(t,e){this.id=t,this.value=e};he.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var fe=k.internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},pe=fe.prototype;pe.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},pe.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},pe.heapify=function(e){if(e===t&&(e=0),!(e>=this.length||0>e)){var n=2*e+1,r=2*e+2,i=e;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==e){var o=this.items[e];this.items[e]=this.items[i],this.items[i]=o,this.heapify(i)}}},pe.peek=function(){return this.items[0].value},pe.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},pe.dequeue=function(){var t=this.peek();return this.removeAt(0),t},pe.enqueue=function(t){var e=this.length++;this.items[e]=new he(fe.count++,t),this.percolate(e)},pe.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},fe.count=0;var de=k.CompositeDisposable=function(){this.disposables=v(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},be=de.prototype;be.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},be.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},be.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},be.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},be.contains=function(t){return-1!==this.disposables.indexOf(t)},be.toArray=function(){return this.disposables.slice(0)};var ve=k.Disposable=function(t){this.isDisposed=!1,this.action=t||e};ve.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var me=ve.create=function(t){return new ve(t)},ye=ve.empty={dispose:e},we=function(){function t(t){this.isSingle=t,this.isDisposed=!1,this.current=null}var e=t.prototype;return e.getDisposable=function(){return this.current},e.setDisposable=function(t){if(this.current&&this.isSingle)throw Error("Disposable has already been assigned");var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},e.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()},t}(),ge=k.SingleAssignmentDisposable=function(t){function e(){t.call(this,!0)}return ae(e,t),e}(we),xe=k.SerialDisposable=function(t){function e(){t.call(this,!1)}return ae(e,t),e}(we);k.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?ye:new t(this)},e}();var Ee=k.internals.ScheduledItem=function(t,e,n,r,o){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=o||i,this.disposable=new ge};Ee.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Ee.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},Ee.prototype.isCancelled=function(){return this.disposable.isDisposed},Ee.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Ce=k.Scheduler=function(){function t(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function e(t,e){var n=e.first,r=e.second,i=new de,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),ye});r||(i.add(s),n=!0)})};return o(n),i}function n(t,e,n){var r=e.first,i=e.second,o=new de,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),ye});u||(o.add(c),i=!0)})};return s(r),o}function r(t,e){return e(),ye}var i=t.prototype;return i.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},i.schedulePeriodicWithState=function(t,e,n){var r=t,i=setInterval(function(){r=n(r)},e);return me(function(){clearInterval(i)})},i.schedule=function(t){return this._schedule(t,r)},i.scheduleWithState=function(t,e){return this._schedule(t,e)},i.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,r)},i.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},i.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,r)},i.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},i.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},i.scheduleRecursiveWithState=function(t,n){return this.scheduleWithState({first:t,second:n},function(t,n){return e(t,n)})},i.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithRelativeAndState=function(t,e,r){return this._scheduleRelative({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithRelativeAndState")})},i.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithAbsoluteAndState=function(t,e,r){return this._scheduleAbsolute({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithAbsoluteAndState")})},t.now=q,t.normalize=function(t){return 0>t&&(t=0),t},t}(),De=Ce.normalize,Se=Ce.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){for(var r=De(r);r-this.now()>0;);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Ce(q,t,e,n)}(),Ne=Ce.currentThread=function(){function t(t){for(var e;t.length>0;)if(e=t.dequeue(),!e.isCancelled()){for(;e.dueTime-Ce.now()>0;);e.isCancelled()||e.invoke()}}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o=this.now()+Ce.normalize(n),s=new Ee(this,e,r,o);if(i)i.enqueue(s);else{i=new fe(4),i.enqueue(s);try{t(i)}catch(u){throw u}finally{i=null}}return s.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i,o=new Ce(q,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}();k.internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new ge;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();var Ae,Oe=e;(function(){function t(){if(!O.postMessage||O.importScripts)return!1;var t=!1,e=O.onmessage;return O.onmessage=function(){t=!0},O.postMessage("","*"),O.onmessage=e,t}function e(t){if("string"==typeof t.data&&t.data.substring(0,o.length)===o){var e=t.data.substring(o.length),n=s[e];n(),delete s[e]}}var n=RegExp("^"+(G+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),r="function"==typeof(r=W&&j&&W.setImmediate)&&!n.test(r)&&r,i="function"==typeof(i=W&&j&&W.clearImmediate)&&!n.test(i)&&i;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Ae=process.nextTick;else if("function"==typeof r)Ae=r,Oe=i;else if(t()){var o="ms.rx.schedule"+Math.random(),s={},u=0;O.addEventListener?O.addEventListener("message",e,!1):O.attachEvent("onmessage",e,!1),Ae=function(t){var e=u++;s[e]=t,O.postMessage(o+e,"*")}}else if(O.MessageChannel){var c=new O.MessageChannel,a={},l=0;c.port1.onmessage=function(t){var e=t.data,n=a[e];n(),delete a[e]},Ae=function(t){var e=l++;a[e]=t,c.port2.postMessage(e)}}else"document"in O&&"onreadystatechange"in O.document.createElement("script")?Ae=function(t){var e=O.document.createElement("script");e.onreadystatechange=function(){t(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},O.document.documentElement.appendChild(e)}:(Ae=function(t){return setTimeout(t,0)},Oe=clearTimeout)})();var _e=Ce.timeout=function(){function t(t,e){var n=this,r=new ge,i=Ae(function(){r.isDisposed||r.setDisposable(e(n,t))});return new de(r,me(function(){Oe(i)}))}function e(t,e,n){var r=this,i=Ce.normalize(e);if(0===i)return r.scheduleWithState(t,n);var o=new ge,s=setTimeout(function(){o.isDisposed||o.setDisposable(n(r,t))},i);return new de(o,me(function(){clearTimeout(s)}))}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Ce(q,t,e,n)}(),Re=k.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t||(t=Se),new cn(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),je=Re.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new Re("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),We=Re.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new Re("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),ke=Re.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new Re("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),qe=k.internals.Enumerator=function(t){this._next=t};qe.prototype.next=function(){return this._next()},qe.prototype[V]=function(){return this};var Te=k.internals.Enumerable=function(t){this._iterator=t};Te.prototype[V]=function(){return this._iterator()},Te.prototype.concat=function(){var e=this;return new cn(function(n){var r;try{r=e[V]()}catch(i){return n.onError(),t}var o,s=new xe,u=Se.scheduleRecursive(function(e){var i;if(!o){try{i=r.next()}catch(u){return n.onError(u),t}if(i.done)return n.onCompleted(),t;var c=new ge;s.setDisposable(c),c.setDisposable(i.value.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){e()}))}});return new de(s,u,me(function(){o=!0}))})},Te.prototype.catchException=function(){var e=this;return new cn(function(n){var r;try{r=e[V]()}catch(i){return n.onError(),t}var o,s,u=new xe,c=Se.scheduleRecursive(function(e){if(!o){var i;try{i=r.next()}catch(c){return n.onError(c),t}if(i.done)return s?n.onError(s):n.onCompleted(),t;var a=new ge;u.setDisposable(a),a.setDisposable(i.value.subscribe(n.onNext.bind(n),function(t){s=t,e()},n.onCompleted.bind(n)))}});return new de(u,c,me(function(){o=!0}))})};var Pe=Te.repeat=function(t,e){return null==e&&(e=-1),new Te(function(){var n=e;return new qe(function(){return 0===n?M:(n>0&&n--,{done:!1,value:t})})})},Le=Te.forEach=function(t,e,r){return e||(e=n),new Te(function(){var n=-1;return new qe(function(){return++n0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var r;if(!(n.queue.length>0))return n.isAcquired=!1,t;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}e()}))},n.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},n}(Ie);Fe.create=Fe.createWithDisposable=function(t){return new cn(t)};var He=Fe.defer=function(t){return new cn(function(e){var n;try{n=t()}catch(r){return Ke(r).subscribe(e)}return n.subscribe(e)})},Qe=Fe.empty=function(t){return t||(t=Se),new cn(function(e){return t.schedule(function(){e.onCompleted()})})},$e=Fe.fromArray=function(t,e){return e||(e=Ne),new cn(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};Fe.fromIterable=function(e,n){return n||(n=Ne),new cn(function(r){var i;try{i=e[V]()}catch(o){return r.onError(o),t}return n.scheduleRecursive(function(e){var n;try{n=i.next()}catch(o){return r.onError(o),t}n.done?r.onCompleted():(r.onNext(n.value),e())})})},Fe.generate=function(e,n,r,i,o){return o||(o=Ne),new cn(function(s){var u=!0,c=e;return o.scheduleRecursive(function(e){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(l){return s.onError(l),t}o?(s.onNext(a),e()):s.onCompleted()})})};var Xe=Fe.never=function(){return new cn(function(){return ye})};Fe.range=function(t,e,n){return n||(n=Ne),new cn(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},Fe.repeat=function(t,e,n){return n||(n=Ne),null==e&&(e=-1),Je(t,n).repeat(e)};var Je=Fe["return"]=Fe.returnValue=function(t,e){return e||(e=Se),new cn(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Ke=Fe["throw"]=Fe.throwException=function(t,e){return e||(e=Se),new cn(function(n){return e.schedule(function(){n.onError(t)})})};Me["catch"]=Me.catchException=function(t){return"function"==typeof t?y(this,t):Ge([this,t])};var Ge=Fe.catchException=Fe["catch"]=function(){var t=v(arguments,0);return Le(t).catchException()};Me.combineLatest=function(){var t=ce.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Ye.apply(this,t)};var Ye=Fe.combineLatest=function(){var e=ce.call(arguments),r=e.pop();return Array.isArray(e[0])&&(e=e[0]),new cn(function(i){function o(e){var o;if(a[e]=!0,l||(l=a.every(n))){try{o=r.apply(null,f)}catch(s){return i.onError(s),t}i.onNext(o)}else h.filter(function(t,n){return n!==e}).every(n)&&i.onCompleted()}function s(t){h[t]=!0,h.every(n)&&i.onCompleted()}for(var u=function(){return!1},c=e.length,a=m(c,u),l=!1,h=m(c,u),f=Array(c),p=Array(c),d=0;c>d;d++)(function(t){p[t]=new ge,p[t].setDisposable(e[t].subscribe(function(e){f[t]=e,o(t)},i.onError.bind(i),function(){s(t)}))})(d);return new de(p)})};Me.concat=function(){var t=ce.call(arguments,0);return t.unshift(this),Ze.apply(this,t)};var Ze=Fe.concat=function(){var t=v(arguments,0);return Le(t).concat()};Me.concatObservable=Me.concatAll=function(){return this.merge(1)},Me.merge=function(t){if("number"!=typeof t)return tn(this,t);var e=this;return new cn(function(n){var r=0,i=new de,o=!1,u=[],c=function(t){var e=new ge;i.add(e),s(t)&&(t=en(t)),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),u.length>0?(t=u.shift(),c(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,c(e)):u.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var tn=Fe.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=ce.call(arguments,1)):(t=Se,e=ce.call(arguments,0)):(t=Se,e=ce.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),$e(e,t).mergeObservable()};Me.mergeObservable=Me.mergeAll=function(){var t=this;return new cn(function(e){var n=new de,r=!1,i=new ge;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new ge;n.add(i),s(t)&&(t=en(t)),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},Me.skipUntil=function(t){var e=this;return new cn(function(n){var r=!1,i=new de(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new ge;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Me["switch"]=Me.switchLatest=function(){var t=this;return new cn(function(e){var n=!1,r=new xe,i=!1,o=0,u=t.subscribe(function(t){var u=new ge,c=++o;n=!0,r.setDisposable(u),s(t)&&(t=en(t)),u.setDisposable(t.subscribe(function(t){o===c&&e.onNext(t)},function(t){o===c&&e.onError(t)},function(){o===c&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new de(u,r)})},Me.takeUntil=function(t){var n=this;return new cn(function(r){return new de(n.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),e))})},Me.zip=function(){if(Array.isArray(arguments[0]))return w.apply(this,arguments);var e=this,r=ce.call(arguments),i=r.pop();return r.unshift(e),new cn(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=r.length,c=m(u,function(){return[]}),a=m(u,function(){return!1}),l=function(r){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(e,u)}catch(l){return o.onError(l),t}o.onNext(s)}else a.filter(function(t,e){return e!==r}).every(n)&&o.onCompleted()},h=Array(u),f=0;u>f;f++)(function(t){h[t]=new ge,h[t].setDisposable(r[t].subscribe(function(e){c[t].push(e),l(t)},o.onError.bind(o),function(){s(t)}))})(f);return new de(h)})},Fe.zip=function(){var t=ce.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},Fe.zipArray=function(){var e=v(arguments,0);return new cn(function(r){function i(e){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});r.onNext(i)}else if(c.filter(function(t,n){return n!==e}).every(n))return r.onCompleted(),t}function o(e){return c[e]=!0,c.every(n)?(r.onCompleted(),t):t}for(var s=e.length,u=m(s,function(){return[]}),c=m(s,function(){return!1}),a=Array(s),l=0;s>l;l++)(function(t){a[t]=new ge,a[t].setDisposable(e[t].subscribe(function(e){u[t].push(e),i(t)},r.onError.bind(r),function(){o(t)}))})(l);var h=new de(a);return h.add(me(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),h})},Me.asObservable=function(){var t=this;return new cn(function(e){return t.subscribe(e)})},Me.dematerialize=function(){var t=this;return new cn(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Me.distinctUntilChanged=function(e,i){var o=this;return e||(e=n),i||(i=r),new cn(function(n){var r,s=!1;return o.subscribe(function(o){var u,c=!1;try{u=e(o)}catch(a){return n.onError(a),t}if(s)try{c=i(r,u)}catch(a){return n.onError(a),t}s&&c||(s=!0,r=u,n.onNext(o))},n.onError.bind(n),n.onCompleted.bind(n))})},Me["do"]=Me.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new cn(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},Me["finally"]=Me.finallyAction=function(t){var e=this;return new cn(function(n){var r=e.subscribe(n);return me(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},Me.ignoreElements=function(){var t=this;return new cn(function(n){return t.subscribe(e,n.onError.bind(n),n.onCompleted.bind(n))})},Me.materialize=function(){var t=this;return new cn(function(e){return t.subscribe(function(t){e.onNext(je(t))},function(t){e.onNext(We(t)),e.onCompleted()},function(){e.onNext(ke()),e.onCompleted()})})},Me.repeat=function(t){return Pe(this,t).concat()},Me.retry=function(t){return Pe(this,t).catchException()},Me.scan=function(){var e,n,r=!1,i=this;return 2===arguments.length?(r=!0,e=arguments[0],n=arguments[1]):n=arguments[0],new cn(function(o){var s,u,c;return i.subscribe(function(i){try{c||(c=!0),s?u=n(u,i):(u=r?n(e,i):i,s=!0)}catch(a){return o.onError(a),t}o.onNext(u)},o.onError.bind(o),function(){!c&&r&&o.onNext(e),o.onCompleted()})})},Me.skipLast=function(t){var e=this;return new cn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},Me.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=Se,t=ce.call(arguments,n),Le([$e(t,e),this]).concat()},Me.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return $e(t,e)})},Me.takeLastBuffer=function(t){var e=this;return new cn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},Me.select=Me.map=function(e,n){var r=this;return new cn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Me.selectMany=Me.flatMap=function(t,e){return e?this.selectMany(function(n,r){var i=t(n,r),o=s(i)?en(i):i;return o.select(function(t){return e(n,t,r)})}):"function"==typeof t?g.call(this,t):g.call(this,function(){return t})},Me.selectSwitch=Me.flatMapLatest=function(t,e){return this.select(t,e).switchLatest()},Me.skip=function(t){if(0>t)throw Error(P);var e=this;return new cn(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Me.skipWhile=function(e,n){var r=this;return new cn(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Me.take=function(t,e){if(0>t)throw Error(P);if(0===t)return Qe(e);var n=this;return new cn(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},Me.takeWhile=function(e,n){var r=this;return new cn(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},Me.where=Me.filter=function(e,n){var r=this;return new cn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})},Fe.fromCallback=function(e,n,r,i){return n||(n=Se),function(){var o=ce.call(arguments,0);return new cn(function(s){return n.schedule(function(){function n(e){var n=e;if(i)try{n=i(arguments)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}},Fe.fromNodeCallback=function(e,n,r,i){return n||(n=Se),function(){var o=ce.call(arguments,0);return new cn(function(s){return n.schedule(function(){function n(e){if(e)return s.onError(e),t; +var n=ce.call(arguments,1);if(i)try{n=i(n)}catch(r){return s.onError(r),t}else 1===n.length&&(n=n[0]);s.onNext(n),s.onCompleted()}o.push(n),e.apply(r,o)})})}},Fe.fromEvent=function(e,n,r){return new cn(function(i){return E(e,n,function(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)})}).publish().refCount()},Fe.fromEventPattern=function(e,n,r){return new cn(function(i){function o(e){var n=e;if(r)try{n=r(arguments)}catch(o){return i.onError(o),t}i.onNext(n)}var s=e(o);return me(function(){n&&n(o,s)})}).publish().refCount()};var en=Fe.fromPromise=function(t){return new cn(function(e){t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)})})};Me.toPromise=function(t){if(t||(t=k.config.Promise),!t)throw Error("Promise type not provided nor in Rx.config.Promise");var e=this;return new t(function(t,n){var r,i=!1;e.subscribe(function(t){r=t,i=!0},function(t){n(t)},function(){i&&t(r)})})},Fe.startAsync=function(t){var e;try{e=t()}catch(n){return Ke(n)}return en(e)},Me.multicast=function(t,e){var n=this;return"function"==typeof t?new cn(function(r){var i=n.multicast(t());return new de(e(i).subscribe(r),i.connect())}):new nn(n,t)},Me.publish=function(t){return t?this.multicast(function(){return new hn},t):this.multicast(new hn)},Me.share=function(){return this.publish(null).refCount()},Me.publishLast=function(t){return t?this.multicast(function(){return new fn},t):this.multicast(new fn)},Me.publishValue=function(t,e){return 2===arguments.length?this.multicast(function(){return new dn(e)},t):this.multicast(new dn(t))},Me.shareValue=function(t){return this.publishValue(t).refCount()},Me.replay=function(t,e,n,r){return t?this.multicast(function(){return new bn(e,n,r)},t):this.multicast(new bn(e,n,r))},Me.shareReplay=function(t,e,n){return this.replay(null,t,e,n).refCount()};var nn=k.ConnectableObservable=function(t){function e(e,n){function r(t){return i.subject.subscribe(t)}var i={subject:n,source:e.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return i.hasSubscription||(i.hasSubscription=!0,i.subscription=new de(i.source.subscribe(i.subject),me(function(){i.hasSubscription=!1}))),i.subscription},t.call(this,r)}return ae(e,t),e.prototype.connect=function(){return this.connect()},e.prototype.refCount=function(){var t=null,e=0,n=this;return new cn(function(r){var i,o;return e++,i=1===e,o=n.subscribe(r),i&&(t=n.connect()),me(function(){o.dispose(),e--,0===e&&t.dispose()})})},e}(Fe),rn=Fe.interval=function(t,e){return e||(e=_e),D(t,t,e)},on=Fe.timer=function(e,n,r){var i;return r||(r=_e),"number"==typeof n?i=n:"object"==typeof n&&"now"in n&&(r=n),i===t?C(e,r):D(e,i,r)};Me.delay=function(t,e){e||(e=_e);var n=this;return new cn(function(r){var i,o=!1,s=new xe,u=null,c=[],a=!1;return i=n.materialize().timestamp(e).subscribe(function(n){var i,l;"E"===n.value.kind?(c=[],c.push(n),u=n.value.exception,l=!a):(c.push({value:n.value,timestamp:n.timestamp+t}),l=!o,o=!0),l&&(null!==u?r.onError(u):(i=new ge,s.setDisposable(i),i.setDisposable(e.scheduleRecursiveWithRelative(t,function(t){var n,i,s,l;if(null===u){a=!0;do s=null,c.length>0&&0>=c[0].timestamp-e.now()&&(s=c.shift().value),null!==s&&s.accept(r);while(null!==s);l=!1,i=0,c.length>0?(l=!0,i=Math.max(0,c[0].timestamp-e.now())):o=!1,n=u,a=!1,null!==n?r.onError(n):l&&t(i)}}))))}),new de(i,s)})},Me.throttle=function(t,e){return e||(e=_e),this.throttleWithSelector(function(){return on(t,e)})},Me.timeInterval=function(t){var e=this;return t||(t=_e),He(function(){var n=t.now();return e.select(function(e){var r=t.now(),i=r-n;return n=r,{value:e,interval:i}})})},Me.timestamp=function(t){return t||(t=_e),this.select(function(e){return{value:e,timestamp:t.now()}})},Me.sample=function(t,e){return e||(e=_e),"number"==typeof t?S(this,rn(t,e)):S(this,t)},Me.timeout=function(t,e,n){var r,i=this;return e||(e=Ke(Error("Timeout"))),n||(n=_e),r=t instanceof Date?function(t,e){n.scheduleWithAbsolute(t,e)}:function(t,e){n.scheduleWithRelative(t,e)},new cn(function(n){var o,s=0,u=new ge,c=new xe,a=!1,l=new xe;return c.setDisposable(u),o=function(){var i=s;l.setDisposable(r(t,function(){a=s===i;var t=a;t&&c.setDisposable(e.subscribe(n))}))},o(),u.setDisposable(i.subscribe(function(t){var e=!a;e&&(s++,n.onNext(t),o())},function(t){var e=!a;e&&(s++,n.onError(t))},function(){var t=!a;t&&(s++,n.onCompleted())})),new de(c,l)})},Fe.generateWithTime=function(e,n,r,i,o,s){return s||(s=_e),new cn(function(u){var c,a,l=!0,h=!1,f=e;return s.scheduleRecursiveWithRelative(0,function(e){h&&u.onNext(c);try{l?l=!1:f=r(f),h=n(f),h&&(c=i(f),a=o(f))}catch(s){return u.onError(s),t}h?e(a):u.onCompleted()})})},Me.delaySubscription=function(t,e){return e||(e=_e),this.delayWithSelector(on(t,e),function(){return Qe()})},Me.delayWithSelector=function(e,n){var r,i,o=this;return"function"==typeof e?i=e:(r=e,i=n),new cn(function(e){var n=new de,s=!1,u=function(){s&&0===n.length&&e.onCompleted()},c=new xe,a=function(){c.setDisposable(o.subscribe(function(r){var o;try{o=i(r)}catch(s){return e.onError(s),t}var c=new ge;n.add(c),c.setDisposable(o.subscribe(function(){e.onNext(r),n.remove(c),u()},e.onError.bind(e),function(){e.onNext(r),n.remove(c),u()}))},e.onError.bind(e),function(){s=!0,c.dispose(),u()}))};return r?c.setDisposable(r.subscribe(function(){a()},e.onError.bind(e),function(){a()})):a(),new de(c,n)})},Me.timeoutWithSelector=function(e,n,r){if(1===arguments.length){n=e;var e=Xe()}r||(r=Ke(Error("Timeout")));var i=this;return new cn(function(o){var s=new xe,u=new xe,c=new ge;s.setDisposable(c);var a=0,l=!1,h=function(t){var e=a,n=function(){return a===e},i=new ge;u.setDisposable(i),i.setDisposable(t.subscribe(function(){n()&&s.setDisposable(r.subscribe(o)),i.dispose()},function(t){n()&&o.onError(t)},function(){n()&&s.setDisposable(r.subscribe(o))}))};h(e);var f=function(){var t=!l;return t&&a++,t};return c.setDisposable(i.subscribe(function(e){if(f()){o.onNext(e);var r;try{r=n(e)}catch(i){return o.onError(i),t}h(r)}},function(t){f()&&o.onError(t)},function(){f()&&o.onCompleted()})),new de(s,u)})},Me.throttleWithSelector=function(e){var n=this;return new cn(function(r){var i,o=!1,s=new xe,u=0,c=n.subscribe(function(n){var c;try{c=e(n)}catch(a){return r.onError(a),t}o=!0,i=n,u++;var l=u,h=new ge;s.setDisposable(h),h.setDisposable(c.subscribe(function(){o&&u===l&&r.onNext(i),o=!1,h.dispose()},r.onError.bind(r),function(){o&&u===l&&r.onNext(i),o=!1,h.dispose()}))},function(t){s.dispose(),r.onError(t),o=!1,u++},function(){s.dispose(),o&&r.onNext(i),r.onCompleted(),o=!1,u++});return new de(c,s)})},Me.skipLastWithTime=function(t,e){e||(e=_e);var n=this;return new cn(function(r){var i=[];return n.subscribe(function(n){var o=e.now();for(i.push({interval:o,value:n});i.length>0&&o-i[0].interval>=t;)r.onNext(i.shift().value)},r.onError.bind(r),function(){for(var n=e.now();i.length>0&&n-i[0].interval>=t;)r.onNext(i.shift().value);r.onCompleted()})})},Me.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return $e(t,n)})},Me.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=_e),new cn(function(r){var i=[];return n.subscribe(function(n){var r=e.now();for(i.push({interval:r,value:n});i.length>0&&r-i[0].interval>=t;)i.shift()},r.onError.bind(r),function(){for(var n=e.now(),o=[];i.length>0;){var s=i.shift();t>=n-s.interval&&o.push(s.value)}r.onNext(o),r.onCompleted()})})},Me.takeWithTime=function(t,e){var n=this;return e||(e=_e),new cn(function(r){var i=e.scheduleWithRelative(t,function(){r.onCompleted()});return new de(i,n.subscribe(r))})},Me.skipWithTime=function(t,e){var n=this;return e||(e=_e),new cn(function(r){var i=!1,o=e.scheduleWithRelative(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new de(o,s)})},Me.skipUntilWithTime=function(t,e){e||(e=_e);var n=this;return new cn(function(r){var i=!1,o=e.scheduleWithAbsolute(t,function(){i=!0}),s=n.subscribe(function(t){i&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new de(o,s)})},Me.takeUntilWithTime=function(t,e){e||(e=_e);var n=this;return new cn(function(r){return new de(e.scheduleWithAbsolute(t,function(){r.onCompleted()}),n.subscribe(r))})},Me.pausable=function(t){var e=this;return new cn(function(n){var r=e.publish(),i=r.subscribe(n),o=ye,s=t.distinctUntilChanged().subscribe(function(t){t?o=r.connect():(o.dispose(),o=ye)});return new de(i,o,s)})},Me.pausableBuffered=function(t){var e=this;return new cn(function(n){var r=[],i=!0,o=N(e,t.distinctUntilChanged(),function(t,e){return{data:t,shouldFire:e}}).subscribe(function(t){if(t.shouldFire&&i&&n.onNext(t.data),t.shouldFire&&!i){for(;r.length>0;)n.onNext(r.shift());i=!0}else t.shouldFire||i?!t.shouldFire&&i&&(i=!1):r.push(t.data)},n.onError.bind(n),n.onCompleted.bind(n));return t.onNext(!1),o})},Me.controlled=function(t){return null==t&&(t=!0),new sn(this,t)};var sn=function(t){function e(t){return this.source.subscribe(t)}function n(n,r){t.call(this,e),this.subject=new un(r),this.source=n.multicast(this.subject).refCount()}return ae(n,t),n.prototype.request=function(t){return null==t&&(t=-1),this.subject.request(t)},n}(Fe),un=k.ControlledSubject=function(t){function e(t){return this.subject.subscribe(t)}function n(n){null==n&&(n=!0),t.call(this,e),this.subject=new hn,this.enableQueue=n,this.queue=n?[]:null,this.requestedCount=0,this.requestedDisposable=ye,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=ye}return ae(n,t),le(n.prototype,Ve,{onCompleted:function(){u.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(t){u.call(this),this.hasFailed=!0,this.error=t,this.enableQueue&&0!==this.queue.length||this.subject.onError(t)},onNext:function(t){u.call(this);var e=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(t):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),e=!0),e&&this.subject.onNext(t)},_processRequest:function(t){if(this.enableQueue){for(;this.queue.length>=t&&t>0;)this.subject.onNext(this.queue.shift()),t--;return 0!==this.queue.length?{numberOfItems:t,returnValue:!0}:{numberOfItems:t,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=ye):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=ye),{numberOfItems:t,returnValue:!1}},request:function(t){u.call(this),this.disposeCurrentRequest();var e=this,n=this._processRequest(t);return t=n.numberOfItems,n.returnValue?ye:(this.requestedCount=t,this.requestedDisposable=me(function(){e.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=ye},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),n}(Fe),cn=k.AnonymousObservable=function(e){function n(e){return e===t?e=ye:"function"==typeof e&&(e=me(e)),e}function r(i){function o(t){var e=new an(t);if(Ne.scheduleRequired())Ne.schedule(function(){try{e.setDisposable(n(i(e)))}catch(t){if(!e.fail(t))throw t}});else try{e.setDisposable(n(i(e)))}catch(r){if(!e.fail(r))throw r}return e}return this instanceof r?(e.call(this,o),t):new r(i)}return ae(r,e),r}(Fe),an=function(t){function e(e){t.call(this),this.observer=e,this.m=new ge}ae(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.setDisposable=function(t){this.m.setDisposable(t)},n.getDisposable=function(){return this.m.getDisposable()},n.disposable=function(t){return arguments.length?this.getDisposable():setDisposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Ie),ln=function(t,e){this.subject=t,this.observer=e};ln.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var hn=k.Subject=function(t){function e(t){return u.call(this),this.isStopped?this.exception?(t.onError(this.exception),ye):(t.onCompleted(),ye):(this.observers.push(t),new ln(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return ae(n,t),le(n.prototype,Ve,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(u.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(u.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(u.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new pn(t,e)},n}(Fe),fn=k.AsyncSubject=function(t){function e(t){if(u.call(this),!this.isStopped)return this.observers.push(t),new ln(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),ye}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return ae(n,t),le(n.prototype,Ve,{hasObservers:function(){return u.call(this),this.observers.length>0},onCompleted:function(){var t,e,n;if(u.call(this),!this.isStopped){this.isStopped=!0;var r=this.observers.slice(0),i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(u.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){u.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(Fe),pn=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return ae(n,t),le(n.prototype,Ve,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(Fe),dn=k.BehaviorSubject=function(t){function e(t){if(u.call(this),!this.isStopped)return this.observers.push(t),t.onNext(this.value),new ln(this,t);var e=this.exception;return e?t.onError(e):t.onCompleted(),ye}function n(n){t.call(this,e),this.value=n,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return ae(n,t),le(n.prototype,Ve,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(u.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(u.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(u.call(this),!this.isStopped){this.value=t;for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),n}(Fe),bn=k.ReplaySubject=function(t){function e(t,e){this.subject=t,this.observer=e}function n(t){var n=new Ue(this.scheduler,t),r=new e(this,n);u.call(this),this._trim(this.scheduler.now()),this.observers.push(n);for(var i=this.q.length,o=0,s=this.q.length;s>o;o++)n.onNext(this.q[o].value);return this.hasError?(i++,n.onError(this.error)):this.isStopped&&(i++,n.onCompleted()),n.ensureActive(i),r}function r(e,r,i){this.bufferSize=null==e?Number.MAX_VALUE:e,this.windowSize=null==r?Number.MAX_VALUE:r,this.scheduler=i||Ne,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,t.call(this,n)}return e.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1)}},ae(r,t),le(r.prototype,Ve,{hasObservers:function(){return this.observers.length>0},_trim:function(t){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&t-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(t){var e;if(u.call(this),!this.isStopped){var n=this.scheduler.now();this.q.push({interval:n,value:t}),this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)e=r[i],e.onNext(t),e.ensureActive()}},onError:function(t){var e;if(u.call(this),!this.isStopped){this.isStopped=!0,this.error=t,this.hasError=!0;var n=this.scheduler.now();this._trim(n);for(var r=this.observers.slice(0),i=0,o=r.length;o>i;i++)e=r[i],e.onError(t),e.ensureActive();this.observers=[]}},onCompleted:function(){var t;if(u.call(this),!this.isStopped){this.isStopped=!0;var e=this.scheduler.now();this._trim(e);for(var n=this.observers.slice(0),r=0,i=n.length;i>r;r++)t=n[r],t.onCompleted(),t.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),r}(Fe);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(O.Rx=k,define(function(){return k})):_&&R?j?(R.exports=k).Rx=k:_.Rx=k:O.Rx=k}).call(this); \ No newline at end of file diff --git a/rx.min.js b/rx.min.js index df094b158..b810aed8e 100644 --- a/rx.min.js +++ b/rx.min.js @@ -1,2 +1,2 @@ -(function(t){function e(){}function n(t){return t}function r(t,e){return ne(t,e)}function i(t,e){return t-e}function o(t){return""+t}function s(t){throw t}function u(t){return"function"==typeof t.then}function c(){if(this.isDisposed)throw Error(k)}function a(t){var e=typeof t;return t&&("function"==e||"object"==e)||!1}function h(t){var e=[];if(!a(t))return e;ee.nonEnumArgs&&t.length&&d(t)&&(t=re.call(t));var n=ee.enumPrototypes&&"function"==typeof t,r=ee.enumErrorProps&&(t===J||t instanceof Error);for(var i in t)n&&"prototype"==i||r&&("message"==i||"name"==i)||e.push(i);if(ee.nonEnumShadows&&t!==K){var o=t.constructor,s=-1,u=Z.length;if(t===(o&&o.prototype))var c=t===stringProto?H:t===J?z:$.call(t),h=te[c];for(;u>++s;)i=Z[s],h&&h[i]||!Q.call(t,i)||e.push(i)}return e}function f(t,e,n){for(var r=-1,i=n(t),o=i.length;o>++r;){var s=i[r];if(e(t[s],s,t)===!1)break}return t}function l(t,e){return f(t,e,h)}function p(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function d(t){return t&&"object"==typeof t?$.call(t)==T:!1}function b(t){return"function"==typeof t}function v(e,n,r,i){if(e===n)return 0!==e||1/e==1/n;var o=typeof e,s=typeof n;if(e===e&&(null==e||null==n||"function"!=o&&"object"!=o&&"function"!=s&&"object"!=s))return!1;var u=$.call(e),c=$.call(n);if(u==T&&(u=F),c==T&&(c=F),u!=c)return!1;switch(u){case L:case I:return+e==+n;case B:return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case U:case H:return e==n+""}var a=u==M;if(!a){if(u!=F||!ee.nodeClass&&(p(e)||p(n)))return!1;var h=!ee.argsObject&&d(e)?Object:e.constructor,f=!ee.argsObject&&d(n)?Object:n.constructor;if(!(h==f||Q.call(e,"constructor")&&Q.call(n,"constructor")||b(h)&&h instanceof h&&b(f)&&f instanceof f||!("constructor"in e&&"constructor"in n)))return!1}r||(r=[]),i||(i=[]);for(var m=r.length;m--;)if(r[m]==e)return i[m]==n;var y=0;if(result=!0,r.push(e),i.push(n),a){if(m=e.length,y=n.length,result=y==m)for(;y--;){var w=n[y];if(!(result=v(e[y],w,r,i)))break}}else l(n,function(n,o,s){return Q.call(s,o)?(y++,result=Q.call(e,o)&&v(e[o],n,r,i)):t}),result&&l(e,function(e,n,r){return Q.call(r,n)?result=--y>-1:t});return r.pop(),i.pop(),result}function m(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:re.call(t)}function y(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function w(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function g(e,n){return new nn(function(r){var i=new ve,o=new me;return o.setDisposable(i),i.setDisposable(e.subscribe(r.onNext.bind(r),function(e){var i,s;try{s=n(e)}catch(u){return r.onError(u),t}i=new ve,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function E(e,n){var r=this;return new nn(function(i){var o=0,s=e.length;return r.subscribe(function(r){if(s>o){var u,c=e[o++];try{u=n(r,c)}catch(a){return i.onError(a),t}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function x(t){return this.select(function(e,n){var r=t(e,n);return u(r)?He(r):r}).mergeObservable()}var C={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},D=C[typeof window]&&window||this,S=C[typeof exports]&&exports&&!exports.nodeType&&exports,A=C[typeof module]&&module&&!module.nodeType&&module,_=A&&A.exports===S&&S,N=C[typeof global]&&global;!N||N.global!==N&&N.window!==N||(D=N);var O={internals:{},config:{}},R=Date.now,W="Sequence contains no elements.",j="Argument out of range",k="Object has been disposed",P="object"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";window.Set&&"function"==typeof(new window.Set)["@@iterator"]&&(P="@@iterator");var q,T="[object Arguments]",M="[object Array]",L="[object Boolean]",I="[object Date]",z="[object Error]",V="[object Function]",B="[object Number]",F="[object Object]",U="[object RegExp]",H="[object String]",$=Object.prototype.toString,Q=Object.prototype.hasOwnProperty,G=$.call(arguments)==T,J=Error.prototype,K=Object.prototype,X=K.propertyIsEnumerable;try{q=!($.call(document)==F&&!({toString:0}+""))}catch(Y){q=!0}var Z=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],te={};te[M]=te[I]=te[B]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},te[L]=te[H]={constructor:!0,toString:!0,valueOf:!0},te[z]=te[V]=te[U]={constructor:!0,toString:!0},te[F]={constructor:!0};var ee={};(function(){var t=function(){this.x=1},e=[];t.prototype={valueOf:1,y:1};for(var n in new t)e.push(n);for(n in arguments);ee.enumErrorProps=X.call(J,"message")||X.call(J,"name"),ee.enumPrototypes=X.call(t,"prototype"),ee.nonEnumArgs=0!=n,ee.nonEnumShadows=!/valueOf/.test(e)})(1),G||(d=function(t){return t&&"object"==typeof t?Q.call(t,"callee"):!1}),b(/x/)&&(b=function(t){return"function"==typeof t&&$.call(t)==V});var ne=O.internals.isEqual=function(t,e){return v(t,e,[],[])},re=Array.prototype.slice;({}).hasOwnProperty;var ie=this.inherits=O.internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},oe=O.internals.addProperties=function(t){for(var e=re.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},se=O.internals.addRef=function(t,e){return new nn(function(n){return new he(e.getDisposable(),t.subscribe(n))})},ue=function(t,e){this.id=t,this.value=e};ue.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var ce=O.internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},ae=ce.prototype;ae.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},ae.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},ae.heapify=function(e){if(e===t&&(e=0),!(e>=this.length||0>e)){var n=2*e+1,r=2*e+2,i=e;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==e){var o=this.items[e];this.items[e]=this.items[i],this.items[i]=o,this.heapify(i)}}},ae.peek=function(){return this.items[0].value},ae.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},ae.dequeue=function(){var t=this.peek();return this.removeAt(0),t},ae.enqueue=function(t){var e=this.length++;this.items[e]=new ue(ce.count++,t),this.percolate(e)},ae.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},ce.count=0;var he=O.CompositeDisposable=function(){this.disposables=m(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},fe=he.prototype;fe.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},fe.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},fe.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},fe.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},fe.contains=function(t){return-1!==this.disposables.indexOf(t)},fe.toArray=function(){return this.disposables.slice(0)};var le=O.Disposable=function(t){this.isDisposed=!1,this.action=t||e};le.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var pe=le.create=function(t){return new le(t)},de=le.empty={dispose:e},be=function(){function t(t){this.isSingle=t,this.isDisposed=!1,this.current=null}var e=t.prototype;return e.getDisposable=function(){return this.current},e.setDisposable=function(t){if(this.current&&this.isSingle)throw Error("Disposable has already been assigned");var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},e.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()},t}(),ve=O.SingleAssignmentDisposable=function(t){function e(){t.call(this,!0)}return ie(e,t),e}(be),me=O.SerialDisposable=function(t){function e(){t.call(this,!1)}return ie(e,t),e}(be),ye=O.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?de:new t(this)},e}();w.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})};var we=O.internals.ScheduledItem=function(t,e,n,r,o){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=o||i,this.disposable=new ve};we.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},we.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},we.prototype.isCancelled=function(){return this.disposable.isDisposed},we.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var ge=O.Scheduler=function(){function t(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function e(t,e){var n=e.first,r=e.second,i=new he,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),de});r||(i.add(s),n=!0)})};return o(n),i}function n(t,e,n){var r=e.first,i=e.second,o=new he,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),de});u||(o.add(c),i=!0)})};return s(r),o}function r(t,e){return e(),de}var i=t.prototype;return i.catchException=i["catch"]=function(t){return new Ae(this,t)},i.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},i.schedulePeriodicWithState=function(t,e,n){var r=t,i=setInterval(function(){r=n(r)},e);return pe(function(){clearInterval(i)})},i.schedule=function(t){return this._schedule(t,r)},i.scheduleWithState=function(t,e){return this._schedule(t,e)},i.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,r)},i.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},i.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,r)},i.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},i.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},i.scheduleRecursiveWithState=function(t,n){return this.scheduleWithState({first:t,second:n},function(t,n){return e(t,n)})},i.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithRelativeAndState=function(t,e,r){return this._scheduleRelative({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithRelativeAndState")})},i.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithAbsoluteAndState=function(t,e,r){return this._scheduleAbsolute({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithAbsoluteAndState")})},t.now=R,t.normalize=function(t){return 0>t&&(t=0),t},t}(),Ee=ge.normalize;O.internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new ve;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();var xe,Ce=ge.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){for(var r=Ee(r);r-this.now()>0;);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new ge(R,t,e,n)}(),De=ge.currentThread=function(){function t(t){for(var e;t.length>0;)if(e=t.dequeue(),!e.isCancelled()){for(;e.dueTime-ge.now()>0;);e.isCancelled()||e.invoke()}}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o=this.now()+ge.normalize(n),s=new we(this,e,r,o);if(i)i.enqueue(s);else{i=new ce(4),i.enqueue(s);try{t(i)}catch(u){throw u}finally{i=null}}return s.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i,o=new ge(R,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}(),Se=e;(function(){function t(){if(!D.postMessage||D.importScripts)return!1;var t=!1,e=D.onmessage;return D.onmessage=function(){t=!0},D.postMessage("","*"),D.onmessage=e,t}function e(t){if("string"==typeof t.data&&t.data.substring(0,o.length)===o){var e=t.data.substring(o.length),n=s[e];n(),delete s[e]}}var n=RegExp("^"+($+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),r="function"==typeof(r=N&&_&&N.setImmediate)&&!n.test(r)&&r,i="function"==typeof(i=N&&_&&N.clearImmediate)&&!n.test(i)&&i;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))xe=process.nextTick;else if("function"==typeof r)xe=r,Se=i;else if(t()){var o="ms.rx.schedule"+Math.random(),s={},u=0;D.addEventListener?D.addEventListener("message",e,!1):D.attachEvent("onmessage",e,!1),xe=function(t){var e=u++;s[e]=t,D.postMessage(o+e,"*")}}else if(D.MessageChannel){var c=new D.MessageChannel,a={},h=0;c.port1.onmessage=function(t){var e=t.data,n=a[e];n(),delete a[e]},xe=function(t){var e=h++;a[e]=t,c.port2.postMessage(e)}}else"document"in D&&"onreadystatechange"in D.document.createElement("script")?xe=function(t){var e=D.document.createElement("script");e.onreadystatechange=function(){t(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},D.document.documentElement.appendChild(e)}:(xe=function(t){return setTimeout(t,0)},Se=clearTimeout)})(),ge.timeout=function(){function t(t,e){var n=this,r=new ve,i=xe(function(){r.isDisposed||r.setDisposable(e(n,t))});return new he(r,pe(function(){Se(i)}))}function e(t,e,n){var r=this,i=ge.normalize(e);if(0===i)return r.scheduleWithState(t,n);var o=new ve,s=setTimeout(function(){o.isDisposed||o.setDisposable(n(r,t))},i);return new he(o,pe(function(){clearTimeout(s)}))}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new ge(R,t,e,n)}();var Ae=function(t){function e(){return this._scheduler.now()}function n(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,n){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(n))}function i(t,e,n){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(n))}function o(o,s){this._scheduler=o,this._handler=s,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,e,n,r,i)}return ie(o,t),o.prototype._clone=function(t){return new o(t,this._handler)},o.prototype._wrap=function(t){var e=this;return function(n,r){try{return t(e._getRecursiveWrapper(n),r)}catch(i){if(!e._handler(i))throw i;return de}}},o.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},o.prototype.schedulePeriodicWithState=function(t,e,n){var r=this,i=!1,o=new ve;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return n(t)}catch(e){if(i=!0,!r._handler(e))throw e;return o.dispose(),null}})),o},o}(ge),_e=O.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t||(t=Ce),new nn(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),Ne=_e.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new _e("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),Oe=_e.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new _e("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),Re=_e.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new _e("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),We=O.internals.Enumerator=function(t,e){this.moveNext=t,this.getCurrent=e},je=We.create=function(t,e){var n=!1;return new We(function(){if(n)return!1;var e=t();return e||(n=!0),e},function(){return e()})},ke=O.internals.Enumerable=function(t){this.getEnumerator=t};ke.prototype.concat=function(){var e=this;return new nn(function(n){var r,i=e.getEnumerator(),o=new me,s=Ce.scheduleRecursive(function(e){var s,u;if(!r){try{u=i.moveNext(),u&&(s=i.getCurrent())}catch(c){return n.onError(c),t}if(!u)return n.onCompleted(),t;var a=new ve;o.setDisposable(a),a.setDisposable(s.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){e()}))}});return new he(o,s,pe(function(){r=!0}))})},ke.prototype.catchException=function(){var e=this;return new nn(function(n){var r,i,o=e.getEnumerator(),s=new me,u=Ce.scheduleRecursive(function(e){var u,c;if(!r){try{c=o.moveNext(),c&&(u=o.getCurrent())}catch(a){return n.onError(a),t}if(!c)return i?n.onError(i):n.onCompleted(),t;var h=new ve;s.setDisposable(h),h.setDisposable(u.subscribe(n.onNext.bind(n),function(t){i=t,e()},n.onCompleted.bind(n)))}});return new he(s,u,pe(function(){r=!0}))})};var Pe=ke.repeat=function(t,e){return 1===arguments.length&&(e=-1),new ke(function(){var n,r=e;return je(function(){return 0===r?!1:(r>0&&r--,n=t,!0)},function(){return n})})},qe=ke.forEach=function(t,e,r){return e||(e=n),new ke(function(){var n,i=-1;return je(function(){return++i0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var r;if(!(n.queue.length>0))return n.isAcquired=!1,t;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}e()}))},n.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},n}(Ie),Fe=function(t){function e(){t.apply(this,arguments)}return ie(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e}(Be),Ue=O.Observable=function(){function t(t){this._subscribe=t}return Le=t.prototype,Le.finalValue=function(){var t=this;return new nn(function(e){var n,r=!1;return t.subscribe(function(t){r=!0,n=t},e.onError.bind(e),function(){r?(e.onNext(n),e.onCompleted()):e.onError(Error(W))})})},Le.subscribe=Le.forEach=function(t,e,n){var r;return r="object"==typeof t?t:Me(t,e,n),this._subscribe(r)},Le.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();Le.observeOn=function(t){var e=this;return new nn(function(n){return e.subscribe(new Fe(t,n))})},Le.subscribeOn=function(t){var e=this;return new nn(function(n){var r=new ve,i=new me;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new w(t,e.subscribe(n)))})),i})};var He=Ue.fromPromise=function(t){return new nn(function(e){t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)})})};Le.toPromise=function(t){if(t||(t=O.config.Promise),!t)throw Error("Promise type not provided nor in Rx.config.Promise");var e=this;return new t(function(t,n){var r,i=!1;e.subscribe(function(t){r=t,i=!0},function(t){n(t)},function(){i&&t(r)})})},Ue.create=Ue.createWithDisposable=function(t){return new nn(t)},Ue.defer=function(t){return new nn(function(e){var n;try{n=t()}catch(r){return Ke(r).subscribe(e)}return n.subscribe(e)})};var $e=Ue.empty=function(t){return t||(t=Ce),new nn(function(e){return t.schedule(function(){e.onCompleted()})})},Qe=Ue.fromArray=function(t,e){return e||(e=De),new nn(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};Ue.fromIterable=function(e,n){return n||(n=De),new nn(function(r){var i;try{i=e[P]()}catch(o){return r.onError(o),t}return n.scheduleRecursive(function(e){var n;try{n=i.next()}catch(o){return r.onError(o),t}n.done?r.onCompleted():(r.onNext(n.value),e())})})},Ue.generate=function(e,n,r,i,o){return o||(o=De),new nn(function(s){var u=!0,c=e;return o.scheduleRecursive(function(e){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(h){return s.onError(h),t}o?(s.onNext(a),e()):s.onCompleted()})})};var Ge=Ue.never=function(){return new nn(function(){return de})};Ue.range=function(t,e,n){return n||(n=De),new nn(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},Ue.repeat=function(t,e,n){return n||(n=De),null==e&&(e=-1),Je(t,n).repeat(e)};var Je=Ue["return"]=Ue.returnValue=function(t,e){return e||(e=Ce),new nn(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Ke=Ue["throw"]=Ue.throwException=function(t,e){return e||(e=Ce),new nn(function(n){return e.schedule(function(){n.onError(t)})})};Ue.using=function(t,e){return new nn(function(n){var r,i,o=de;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new he(Ke(s).subscribe(n),o)}return new he(i.subscribe(n),o)})},Le.amb=function(t){var e=this;return new nn(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new ve,a=new ve;return c.setDisposable(e.subscribe(function(t){r(),o===s&&n.onNext(t)},function(t){r(),o===s&&n.onError(t)},function(){r(),o===s&&n.onCompleted()})),a.setDisposable(t.subscribe(function(t){i(),o===u&&n.onNext(t)},function(t){i(),o===u&&n.onError(t)},function(){i(),o===u&&n.onCompleted()})),new he(c,a)})},Ue.amb=function(){function t(t,e){return t.amb(e)}for(var e=Ge(),n=m(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},Le["catch"]=Le.catchException=function(t){return"function"==typeof t?g(this,t):Xe([this,t])};var Xe=Ue.catchException=Ue["catch"]=function(){var t=m(arguments,0);return qe(t).catchException()};Le.combineLatest=function(){var t=re.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Ye.apply(this,t)};var Ye=Ue.combineLatest=function(){var e=re.call(arguments),r=e.pop();return Array.isArray(e[0])&&(e=e[0]),new nn(function(i){function o(e){var o;if(a[e]=!0,h||(h=a.every(n))){try{o=r.apply(null,l)}catch(s){return i.onError(s),t}i.onNext(o)}else f.filter(function(t,n){return n!==e}).every(n)&&i.onCompleted()}function s(t){f[t]=!0,f.every(n)&&i.onCompleted()}for(var u=function(){return!1},c=e.length,a=y(c,u),h=!1,f=y(c,u),l=Array(c),p=Array(c),d=0;c>d;d++)(function(t){p[t]=new ve,p[t].setDisposable(e[t].subscribe(function(e){l[t]=e,o(t)},i.onError.bind(i),function(){s(t)}))})(d);return new he(p)})};Le.concat=function(){var t=re.call(arguments,0);return t.unshift(this),Ze.apply(this,t)};var Ze=Ue.concat=function(){var t=m(arguments,0);return qe(t).concat()};Le.concatObservable=Le.concatAll=function(){return this.merge(1)},Le.merge=function(t){if("number"!=typeof t)return tn(this,t);var e=this;return new nn(function(n){var r=0,i=new he,o=!1,s=[],c=function(t){var e=new ve;i.add(e),u(t)&&(t=He(t)),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),c(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,c(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var tn=Ue.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=re.call(arguments,1)):(t=Ce,e=re.call(arguments,0)):(t=Ce,e=re.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Qe(e,t).mergeObservable()};Le.mergeObservable=Le.mergeAll=function(){var t=this;return new nn(function(e){var n=new he,r=!1,i=new ve;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new ve;n.add(i),u(t)&&(t=He(t)),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},Le.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return en([this,t])};var en=Ue.onErrorResumeNext=function(){var t=m(arguments,0);return new nn(function(e){var n=0,r=new me,i=Ce.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new ve,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new he(r,i)})};Le.skipUntil=function(t){var e=this;return new nn(function(n){var r=!1,i=new he(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new ve;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Le["switch"]=Le.switchLatest=function(){var t=this;return new nn(function(e){var n=!1,r=new me,i=!1,o=0,s=t.subscribe(function(t){var s=new ve,c=++o;n=!0,r.setDisposable(s),u(t)&&(t=He(t)),s.setDisposable(t.subscribe(function(t){o===c&&e.onNext(t)},function(t){o===c&&e.onError(t)},function(){o===c&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new he(s,r)})},Le.takeUntil=function(t){var n=this;return new nn(function(r){return new he(n.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),e))})},Le.zip=function(){if(Array.isArray(arguments[0]))return E.apply(this,arguments);var e=this,r=re.call(arguments),i=r.pop();return r.unshift(e),new nn(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=r.length,c=y(u,function(){return[]}),a=y(u,function(){return!1}),h=function(r){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(e,u)}catch(h){return o.onError(h),t}o.onNext(s)}else a.filter(function(t,e){return e!==r}).every(n)&&o.onCompleted()},f=Array(u),l=0;u>l;l++)(function(t){f[t]=new ve,f[t].setDisposable(r[t].subscribe(function(e){c[t].push(e),h(t)},o.onError.bind(o),function(){s(t)}))})(l);return new he(f)})},Ue.zip=function(){var t=re.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},Ue.zipArray=function(){var e=m(arguments,0);return new nn(function(r){function i(e){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});r.onNext(i)}else if(c.filter(function(t,n){return n!==e}).every(n))return r.onCompleted(),t}function o(e){return c[e]=!0,c.every(n)?(r.onCompleted(),t):t}for(var s=e.length,u=y(s,function(){return[]}),c=y(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(t){a[t]=new ve,a[t].setDisposable(e[t].subscribe(function(e){u[t].push(e),i(t)},r.onError.bind(r),function(){o(t)}))})(h);var f=new he(a);return f.add(pe(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),f})},Le.asObservable=function(){var t=this;return new nn(function(e){return t.subscribe(e)})},Le.bufferWithCount=function(t,e){return 1===arguments.length&&(e=t),this.windowWithCount(t,e).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},Le.dematerialize=function(){var t=this;return new nn(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Le.distinctUntilChanged=function(e,i){var o=this;return e||(e=n),i||(i=r),new nn(function(n){var r,s=!1;return o.subscribe(function(o){var u,c=!1;try{u=e(o)}catch(a){return n.onError(a),t}if(s)try{c=i(r,u)}catch(a){return n.onError(a),t}s&&c||(s=!0,r=u,n.onNext(o))},n.onError.bind(n),n.onCompleted.bind(n))})},Le["do"]=Le.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new nn(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},Le["finally"]=Le.finallyAction=function(t){var e=this;return new nn(function(n){var r=e.subscribe(n);return pe(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},Le.ignoreElements=function(){var t=this;return new nn(function(n){return t.subscribe(e,n.onError.bind(n),n.onCompleted.bind(n))})},Le.materialize=function(){var t=this;return new nn(function(e){return t.subscribe(function(t){e.onNext(Ne(t))},function(t){e.onNext(Oe(t)),e.onCompleted() -},function(){e.onNext(Re()),e.onCompleted()})})},Le.repeat=function(t){return Pe(this,t).concat()},Le.retry=function(t){return Pe(this,t).catchException()},Le.scan=function(){var e,n,r=!1,i=this;return 2===arguments.length?(r=!0,e=arguments[0],n=arguments[1]):n=arguments[0],new nn(function(o){var s,u,c;return i.subscribe(function(i){try{c||(c=!0),s?u=n(u,i):(u=r?n(e,i):i,s=!0)}catch(a){return o.onError(a),t}o.onNext(u)},o.onError.bind(o),function(){!c&&r&&o.onNext(e),o.onCompleted()})})},Le.skipLast=function(t){var e=this;return new nn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},Le.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=Ce,t=re.call(arguments,n),qe([Qe(t,e),this]).concat()},Le.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Qe(t,e)})},Le.takeLastBuffer=function(t){var e=this;return new nn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},Le.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(j);if(1===arguments.length&&(e=t),0>=e)throw Error(j);return new nn(function(r){var i=new ve,o=new ye(i),s=0,u=[],c=function(){var t=new un;u.push(t),r.onNext(se(t,o))};return c(),i.setDisposable(n.subscribe(function(n){for(var r,i=0,o=u.length;o>i;i++)u[i].onNext(n);var a=s-t+1;a>=0&&0===a%e&&(r=u.shift(),r.onCompleted()),s++,0===s%e&&c()},function(t){for(;u.length>0;)u.shift().onError(t);r.onError(t)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),o})},Le.defaultIfEmpty=function(e){var n=this;return e===t&&(e=null),new nn(function(t){var r=!1;return n.subscribe(function(e){r=!0,t.onNext(e)},t.onError.bind(t),function(){r||t.onNext(e),t.onCompleted()})})},Le.distinct=function(e,r){var i=this;return e||(e=n),r||(r=o),new nn(function(n){var o={};return i.subscribe(function(i){var s,u,c,a=!1;try{s=e(i),u=r(s)}catch(h){return n.onError(h),t}for(c in o)if(u===c){a=!0;break}a||(o[u]=null,n.onNext(i))},n.onError.bind(n),n.onCompleted.bind(n))})},Le.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return Ge()},n)},Le.groupByUntil=function(r,i,s,u){var c=this;return i||(i=n),u||(u=o),new nn(function(n){var o={},a=new he,h=new ye(a);return a.add(c.subscribe(function(c){var f,l,p,d,b,v,m,y,w,g;try{v=r(c),m=u(v)}catch(E){for(g in o)o[g].onError(E);return n.onError(E),t}d=!1;try{w=o[m],w||(w=new un,o[m]=w,d=!0)}catch(E){for(g in o)o[g].onError(E);return n.onError(E),t}if(d){b=new on(v,w,h),l=new on(v,w);try{f=s(l)}catch(E){for(g in o)o[g].onError(E);return n.onError(E),t}n.onNext(b),y=new ve,a.add(y);var x=function(){m in o&&(delete o[m],w.onCompleted()),a.remove(y)};y.setDisposable(f.take(1).subscribe(e,function(t){for(g in o)o[g].onError(t);n.onError(t)},function(){x()}))}try{p=i(c)}catch(E){for(g in o)o[g].onError(E);return n.onError(E),t}w.onNext(p)},function(t){for(var e in o)o[e].onError(t);n.onError(t)},function(){for(var t in o)o[t].onCompleted();n.onCompleted()})),h})},Le.select=Le.map=function(e,n){var r=this;return new nn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Le.pluck=function(t){return this.select(function(e){return e[t]})},Le.selectMany=Le.flatMap=function(t,e){return e?this.selectMany(function(n,r){var i=t(n,r),o=u(i)?He(i):i;return o.select(function(t){return e(n,t,r)})}):"function"==typeof t?x.call(this,t):x.call(this,function(){return t})},Le.selectSwitch=Le.flatMapLatest=function(t,e){return this.select(t,e).switchLatest()},Le.skip=function(t){if(0>t)throw Error(j);var e=this;return new nn(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Le.skipWhile=function(e,n){var r=this;return new nn(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Le.take=function(t,e){if(0>t)throw Error(j);if(0===t)return $e(e);var n=this;return new nn(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},Le.takeWhile=function(e,n){var r=this;return new nn(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},Le.where=Le.filter=function(e,n){var r=this;return new nn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})};var nn=O.AnonymousObservable=function(e){function n(e){return e===t?e=de:"function"==typeof e&&(e=pe(e)),e}function r(i){function o(t){var e=new rn(t);if(De.scheduleRequired())De.schedule(function(){try{e.setDisposable(n(i(e)))}catch(t){if(!e.fail(t))throw t}});else try{e.setDisposable(n(i(e)))}catch(r){if(!e.fail(r))throw r}return e}return this instanceof r?(e.call(this,o),t):new r(i)}return ie(r,e),r}(Ue),rn=function(t){function e(e){t.call(this),this.observer=e,this.m=new ve}ie(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.setDisposable=function(t){this.m.setDisposable(t)},n.getDisposable=function(){return this.m.getDisposable()},n.disposable=function(t){return arguments.length?this.getDisposable():setDisposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Ie),on=function(t){function e(t){return this.underlyingObservable.subscribe(t)}function n(n,r,i){t.call(this,e),this.key=n,this.underlyingObservable=i?new nn(function(t){return new he(i.getDisposable(),r.subscribe(t))}):r}return ie(n,t),n}(Ue),sn=function(t,e){this.subject=t,this.observer=e};sn.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var un=O.Subject=function(t){function e(t){return c.call(this),this.isStopped?this.exception?(t.onError(this.exception),de):(t.onCompleted(),de):(this.observers.push(t),new sn(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return ie(n,t),oe(n.prototype,Te,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(c.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(c.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(c.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new cn(t,e)},n}(Ue);O.AsyncSubject=function(t){function e(t){if(c.call(this),!this.isStopped)return this.observers.push(t),new sn(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),de}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return ie(n,t),oe(n.prototype,Te,{hasObservers:function(){return c.call(this),this.observers.length>0},onCompleted:function(){var t,e,n;if(c.call(this),!this.isStopped){this.isStopped=!0;var r=this.observers.slice(0),i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(c.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){c.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(Ue);var cn=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return ie(n,t),oe(n.prototype,Te,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(Ue);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(D.Rx=O,define(function(){return O})):S&&A?_?(A.exports=O).Rx=O:S.Rx=O:D.Rx=O}).call(this); \ No newline at end of file +(function(t){function e(){}function n(t){return t}function r(t,e){return re(t,e)}function i(t,e){return t-e}function o(t){return""+t}function s(t){throw t}function u(e){return"function"==typeof e.then&&e.subscribe===t}function c(){if(this.isDisposed)throw Error(k)}function a(t){var e=typeof t;return t&&("function"==e||"object"==e)||!1}function h(t){var e=[];if(!a(t))return e;ne.nonEnumArgs&&t.length&&d(t)&&(t=ie.call(t));var n=ne.enumPrototypes&&"function"==typeof t,r=ne.enumErrorProps&&(t===K||t instanceof Error);for(var i in t)n&&"prototype"==i||r&&("message"==i||"name"==i)||e.push(i);if(ne.nonEnumShadows&&t!==X){var o=t.constructor,s=-1,u=te.length;if(t===(o&&o.prototype))var c=t===stringProto?$:t===K?V:Q.call(t),h=ee[c];for(;u>++s;)i=te[s],h&&h[i]||!G.call(t,i)||e.push(i)}return e}function f(t,e,n){for(var r=-1,i=n(t),o=i.length;o>++r;){var s=i[r];if(e(t[s],s,t)===!1)break}return t}function l(t,e){return f(t,e,h)}function p(t){return"function"!=typeof t.toString&&"string"==typeof(t+"")}function d(t){return t&&"object"==typeof t?Q.call(t)==M:!1}function b(t){return"function"==typeof t}function v(e,n,r,i){if(e===n)return 0!==e||1/e==1/n;var o=typeof e,s=typeof n;if(e===e&&(null==e||null==n||"function"!=o&&"object"!=o&&"function"!=s&&"object"!=s))return!1;var u=Q.call(e),c=Q.call(n);if(u==M&&(u=U),c==M&&(c=U),u!=c)return!1;switch(u){case I:case z:return+e==+n;case F:return e!=+e?n!=+n:0==e?1/e==1/n:e==+n;case H:case $:return e==n+""}var a=u==L;if(!a){if(u!=U||!ne.nodeClass&&(p(e)||p(n)))return!1;var h=!ne.argsObject&&d(e)?Object:e.constructor,f=!ne.argsObject&&d(n)?Object:n.constructor;if(!(h==f||G.call(e,"constructor")&&G.call(n,"constructor")||b(h)&&h instanceof h&&b(f)&&f instanceof f||!("constructor"in e&&"constructor"in n)))return!1}r||(r=[]),i||(i=[]);for(var m=r.length;m--;)if(r[m]==e)return i[m]==n;var y=0;if(result=!0,r.push(e),i.push(n),a){if(m=e.length,y=n.length,result=y==m)for(;y--;){var w=n[y];if(!(result=v(e[y],w,r,i)))break}}else l(n,function(n,o,s){return G.call(s,o)?(y++,result=G.call(e,o)&&v(e[o],n,r,i)):t}),result&&l(e,function(e,n,r){return G.call(r,n)?result=--y>-1:t});return r.pop(),i.pop(),result}function m(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:ie.call(t)}function y(t,e){for(var n=Array(t),r=0;t>r;r++)n[r]=e();return n}function w(t,e){this.scheduler=t,this.disposable=e,this.isDisposed=!1}function g(e,n){return new nn(function(r){var i=new me,o=new ye;return o.setDisposable(i),i.setDisposable(e.subscribe(r.onNext.bind(r),function(e){var i,s;try{s=n(e)}catch(u){return r.onError(u),t}i=new me,o.setDisposable(i),i.setDisposable(s.subscribe(r))},r.onCompleted.bind(r))),o})}function E(e,n){var r=this;return new nn(function(i){var o=0,s=e.length;return r.subscribe(function(r){if(s>o){var u,c=e[o++];try{u=n(r,c)}catch(a){return i.onError(a),t}i.onNext(u)}else i.onCompleted()},i.onError.bind(i),i.onCompleted.bind(i))})}function x(t){return this.select(function(e,n){var r=t(e,n);return u(r)?He(r):r}).mergeObservable()}var C={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},D=C[typeof window]&&window||this,S=C[typeof exports]&&exports&&!exports.nodeType&&exports,_=C[typeof module]&&module&&!module.nodeType&&module,A=_&&_.exports===S&&S,N=C[typeof global]&&global;!N||N.global!==N&&N.window!==N||(D=N);var O={internals:{},config:{}},R=Date.now,W="Sequence contains no elements.",j="Argument out of range",k="Object has been disposed",P="object"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";D.Set&&"function"==typeof(new D.Set)["@@iterator"]&&(P="@@iterator");var q,T={done:!0,value:t},M="[object Arguments]",L="[object Array]",I="[object Boolean]",z="[object Date]",V="[object Error]",B="[object Function]",F="[object Number]",U="[object Object]",H="[object RegExp]",$="[object String]",Q=Object.prototype.toString,G=Object.prototype.hasOwnProperty,J=Q.call(arguments)==M,K=Error.prototype,X=Object.prototype,Y=X.propertyIsEnumerable;try{q=!(Q.call(document)==U&&!({toString:0}+""))}catch(Z){q=!0}var te=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ee={};ee[L]=ee[z]=ee[F]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},ee[I]=ee[$]={constructor:!0,toString:!0,valueOf:!0},ee[V]=ee[B]=ee[H]={constructor:!0,toString:!0},ee[U]={constructor:!0};var ne={};(function(){var t=function(){this.x=1},e=[];t.prototype={valueOf:1,y:1};for(var n in new t)e.push(n);for(n in arguments);ne.enumErrorProps=Y.call(K,"message")||Y.call(K,"name"),ne.enumPrototypes=Y.call(t,"prototype"),ne.nonEnumArgs=0!=n,ne.nonEnumShadows=!/valueOf/.test(e)})(1),J||(d=function(t){return t&&"object"==typeof t?G.call(t,"callee"):!1}),b(/x/)&&(b=function(t){return"function"==typeof t&&Q.call(t)==B});var re=O.internals.isEqual=function(t,e){return v(t,e,[],[])},ie=Array.prototype.slice;({}).hasOwnProperty;var oe=this.inherits=O.internals.inherits=function(t,e){function n(){this.constructor=t}n.prototype=e.prototype,t.prototype=new n},se=O.internals.addProperties=function(t){for(var e=ie.call(arguments,1),n=0,r=e.length;r>n;n++){var i=e[n];for(var o in i)t[o]=i[o]}},ue=O.internals.addRef=function(t,e){return new nn(function(n){return new fe(e.getDisposable(),t.subscribe(n))})},ce=function(t,e){this.id=t,this.value=e};ce.prototype.compareTo=function(t){var e=this.value.compareTo(t.value);return 0===e&&(e=this.id-t.id),e};var ae=O.internals.PriorityQueue=function(t){this.items=Array(t),this.length=0},he=ae.prototype;he.isHigherPriority=function(t,e){return 0>this.items[t].compareTo(this.items[e])},he.percolate=function(t){if(!(t>=this.length||0>t)){var e=t-1>>1;if(!(0>e||e===t)&&this.isHigherPriority(t,e)){var n=this.items[t];this.items[t]=this.items[e],this.items[e]=n,this.percolate(e)}}},he.heapify=function(e){if(e===t&&(e=0),!(e>=this.length||0>e)){var n=2*e+1,r=2*e+2,i=e;if(this.length>n&&this.isHigherPriority(n,i)&&(i=n),this.length>r&&this.isHigherPriority(r,i)&&(i=r),i!==e){var o=this.items[e];this.items[e]=this.items[i],this.items[i]=o,this.heapify(i)}}},he.peek=function(){return this.items[0].value},he.removeAt=function(t){this.items[t]=this.items[--this.length],delete this.items[this.length],this.heapify()},he.dequeue=function(){var t=this.peek();return this.removeAt(0),t},he.enqueue=function(t){var e=this.length++;this.items[e]=new ce(ae.count++,t),this.percolate(e)},he.remove=function(t){for(var e=0;this.length>e;e++)if(this.items[e].value===t)return this.removeAt(e),!0;return!1},ae.count=0;var fe=O.CompositeDisposable=function(){this.disposables=m(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},le=fe.prototype;le.add=function(t){this.isDisposed?t.dispose():(this.disposables.push(t),this.length++)},le.remove=function(t){var e=!1;if(!this.isDisposed){var n=this.disposables.indexOf(t);-1!==n&&(e=!0,this.disposables.splice(n,1),this.length--,t.dispose())}return e},le.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()}},le.clear=function(){var t=this.disposables.slice(0);this.disposables=[],this.length=0;for(var e=0,n=t.length;n>e;e++)t[e].dispose()},le.contains=function(t){return-1!==this.disposables.indexOf(t)},le.toArray=function(){return this.disposables.slice(0)};var pe=O.Disposable=function(t){this.isDisposed=!1,this.action=t||e};pe.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var de=pe.create=function(t){return new pe(t)},be=pe.empty={dispose:e},ve=function(){function t(t){this.isSingle=t,this.isDisposed=!1,this.current=null}var e=t.prototype;return e.getDisposable=function(){return this.current},e.setDisposable=function(t){if(this.current&&this.isSingle)throw Error("Disposable has already been assigned");var e,n=this.isDisposed;n||(e=this.current,this.current=t),e&&e.dispose(),n&&t&&t.dispose()},e.dispose=function(){var t;this.isDisposed||(this.isDisposed=!0,t=this.current,this.current=null),t&&t.dispose()},t}(),me=O.SingleAssignmentDisposable=function(t){function e(){t.call(this,!0)}return oe(e,t),e}(ve),ye=O.SerialDisposable=function(t){function e(){t.call(this,!1)}return oe(e,t),e}(ve),we=O.RefCountDisposable=function(){function t(t){this.disposable=t,this.disposable.count++,this.isInnerDisposed=!1}function e(t){this.underlyingDisposable=t,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return t.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},e.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},e.prototype.getDisposable=function(){return this.isDisposed?be:new t(this)},e}();w.prototype.dispose=function(){var t=this;this.scheduler.schedule(function(){t.isDisposed||(t.isDisposed=!0,t.disposable.dispose())})};var ge=O.internals.ScheduledItem=function(t,e,n,r,o){this.scheduler=t,this.state=e,this.action=n,this.dueTime=r,this.comparer=o||i,this.disposable=new me};ge.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},ge.prototype.compareTo=function(t){return this.comparer(this.dueTime,t.dueTime)},ge.prototype.isCancelled=function(){return this.disposable.isDisposed},ge.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Ee=O.Scheduler=function(){function t(t,e,n,r){this.now=t,this._schedule=e,this._scheduleRelative=n,this._scheduleAbsolute=r}function e(t,e){var n=e.first,r=e.second,i=new fe,o=function(e){r(e,function(e){var n=!1,r=!1,s=t.scheduleWithState(e,function(t,e){return n?i.remove(s):r=!0,o(e),be});r||(i.add(s),n=!0)})};return o(n),i}function n(t,e,n){var r=e.first,i=e.second,o=new fe,s=function(e){i(e,function(e,r){var i=!1,u=!1,c=t[n].call(t,e,r,function(t,e){return i?o.remove(c):u=!0,s(e),be});u||(o.add(c),i=!0)})};return s(r),o}function r(t,e){return e(),be}var i=t.prototype;return i.catchException=i["catch"]=function(t){return new Ae(this,t)},i.schedulePeriodic=function(t,e){return this.schedulePeriodicWithState(null,t,function(){e()})},i.schedulePeriodicWithState=function(t,e,n){var r=t,i=setInterval(function(){r=n(r)},e);return de(function(){clearInterval(i)})},i.schedule=function(t){return this._schedule(t,r)},i.scheduleWithState=function(t,e){return this._schedule(t,e)},i.scheduleWithRelative=function(t,e){return this._scheduleRelative(e,t,r)},i.scheduleWithRelativeAndState=function(t,e,n){return this._scheduleRelative(t,e,n)},i.scheduleWithAbsolute=function(t,e){return this._scheduleAbsolute(e,t,r)},i.scheduleWithAbsoluteAndState=function(t,e,n){return this._scheduleAbsolute(t,e,n)},i.scheduleRecursive=function(t){return this.scheduleRecursiveWithState(t,function(t,e){t(function(){e(t)})})},i.scheduleRecursiveWithState=function(t,n){return this.scheduleWithState({first:t,second:n},function(t,n){return e(t,n)})},i.scheduleRecursiveWithRelative=function(t,e){return this.scheduleRecursiveWithRelativeAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithRelativeAndState=function(t,e,r){return this._scheduleRelative({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithRelativeAndState")})},i.scheduleRecursiveWithAbsolute=function(t,e){return this.scheduleRecursiveWithAbsoluteAndState(e,t,function(t,e){t(function(n){e(t,n)})})},i.scheduleRecursiveWithAbsoluteAndState=function(t,e,r){return this._scheduleAbsolute({first:t,second:r},e,function(t,e){return n(t,e,"scheduleWithAbsoluteAndState")})},t.now=R,t.normalize=function(t){return 0>t&&(t=0),t},t}(),xe=Ee.normalize;O.internals.SchedulePeriodicRecursive=function(){function t(t,e){e(0,this._period);try{this._state=this._action(this._state)}catch(n){throw this._cancel.dispose(),n}}function e(t,e,n,r){this._scheduler=t,this._state=e,this._period=n,this._action=r}return e.prototype.start=function(){var e=new me;return this._cancel=e,e.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,t.bind(this))),e},e}();var Ce,De=Ee.immediate=function(){function t(t,e){return e(this,t)}function e(t,e,n){for(var r=xe(r);r-this.now()>0;);return n(this,t)}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Ee(R,t,e,n)}(),Se=Ee.currentThread=function(){function t(t){for(var e;t.length>0;)if(e=t.dequeue(),!e.isCancelled()){for(;e.dueTime-Ee.now()>0;);e.isCancelled()||e.invoke()}}function e(t,e){return this.scheduleWithRelativeAndState(t,0,e)}function n(e,n,r){var o=this.now()+Ee.normalize(n),s=new ge(this,e,r,o);if(i)i.enqueue(s);else{i=new ae(4),i.enqueue(s);try{t(i)}catch(u){throw u}finally{i=null}}return s.disposable}function r(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}var i,o=new Ee(R,e,n,r);return o.scheduleRequired=function(){return null===i},o.ensureTrampoline=function(t){return null===i?this.schedule(t):t()},o}(),_e=e;(function(){function t(){if(!D.postMessage||D.importScripts)return!1;var t=!1,e=D.onmessage;return D.onmessage=function(){t=!0},D.postMessage("","*"),D.onmessage=e,t}function e(t){if("string"==typeof t.data&&t.data.substring(0,o.length)===o){var e=t.data.substring(o.length),n=s[e];n(),delete s[e]}}var n=RegExp("^"+(Q+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),r="function"==typeof(r=N&&A&&N.setImmediate)&&!n.test(r)&&r,i="function"==typeof(i=N&&A&&N.clearImmediate)&&!n.test(i)&&i;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Ce=process.nextTick;else if("function"==typeof r)Ce=r,_e=i;else if(t()){var o="ms.rx.schedule"+Math.random(),s={},u=0;D.addEventListener?D.addEventListener("message",e,!1):D.attachEvent("onmessage",e,!1),Ce=function(t){var e=u++;s[e]=t,D.postMessage(o+e,"*")}}else if(D.MessageChannel){var c=new D.MessageChannel,a={},h=0;c.port1.onmessage=function(t){var e=t.data,n=a[e];n(),delete a[e]},Ce=function(t){var e=h++;a[e]=t,c.port2.postMessage(e)}}else"document"in D&&"onreadystatechange"in D.document.createElement("script")?Ce=function(t){var e=D.document.createElement("script");e.onreadystatechange=function(){t(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},D.document.documentElement.appendChild(e)}:(Ce=function(t){return setTimeout(t,0)},_e=clearTimeout)})(),Ee.timeout=function(){function t(t,e){var n=this,r=new me,i=Ce(function(){r.isDisposed||r.setDisposable(e(n,t))});return new fe(r,de(function(){_e(i)}))}function e(t,e,n){var r=this,i=Ee.normalize(e);if(0===i)return r.scheduleWithState(t,n);var o=new me,s=setTimeout(function(){o.isDisposed||o.setDisposable(n(r,t))},i);return new fe(o,de(function(){clearTimeout(s)}))}function n(t,e,n){return this.scheduleWithRelativeAndState(t,e-this.now(),n)}return new Ee(R,t,e,n)}();var Ae=function(t){function e(){return this._scheduler.now()}function n(t,e){return this._scheduler.scheduleWithState(t,this._wrap(e))}function r(t,e,n){return this._scheduler.scheduleWithRelativeAndState(t,e,this._wrap(n))}function i(t,e,n){return this._scheduler.scheduleWithAbsoluteAndState(t,e,this._wrap(n))}function o(o,s){this._scheduler=o,this._handler=s,this._recursiveOriginal=null,this._recursiveWrapper=null,t.call(this,e,n,r,i)}return oe(o,t),o.prototype._clone=function(t){return new o(t,this._handler)},o.prototype._wrap=function(t){var e=this;return function(n,r){try{return t(e._getRecursiveWrapper(n),r)}catch(i){if(!e._handler(i))throw i;return be}}},o.prototype._getRecursiveWrapper=function(t){if(this._recursiveOriginal!==t){this._recursiveOriginal=t;var e=this._clone(t);e._recursiveOriginal=t,e._recursiveWrapper=e,this._recursiveWrapper=e}return this._recursiveWrapper},o.prototype.schedulePeriodicWithState=function(t,e,n){var r=this,i=!1,o=new me;return o.setDisposable(this._scheduler.schedulePeriodicWithState(t,e,function(t){if(i)return null;try{return n(t)}catch(e){if(i=!0,!r._handler(e))throw e;return o.dispose(),null}})),o},o}(Ee),Ne=O.Notification=function(){function t(t,e){this.hasValue=null==e?!1:e,this.kind=t}var e=t.prototype;return e.accept=function(t,e,n){return 1===arguments.length&&"object"==typeof t?this._acceptObservable(t):this._accept(t,e,n)},e.toObservable=function(t){var e=this;return t||(t=De),new nn(function(n){return t.schedule(function(){e._acceptObservable(n),"N"===e.kind&&n.onCompleted()})})},t}(),Oe=Ne.createOnNext=function(){function t(t){return t(this.value)}function e(t){return t.onNext(this.value)}function n(){return"OnNext("+this.value+")"}return function(r){var i=new Ne("N",!0);return i.value=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),Re=Ne.createOnError=function(){function t(t,e){return e(this.exception)}function e(t){return t.onError(this.exception)}function n(){return"OnError("+this.exception+")"}return function(r){var i=new Ne("E");return i.exception=r,i._accept=t,i._acceptObservable=e,i.toString=n,i}}(),We=Ne.createOnCompleted=function(){function t(t,e,n){return n()}function e(t){return t.onCompleted()}function n(){return"OnCompleted()"}return function(){var r=new Ne("C");return r._accept=t,r._acceptObservable=e,r.toString=n,r}}(),je=O.internals.Enumerator=function(t){this._next=t};je.prototype.next=function(){return this._next()},je.prototype[P]=function(){return this};var ke=O.internals.Enumerable=function(t){this._iterator=t};ke.prototype[P]=function(){return this._iterator()},ke.prototype.concat=function(){var e=this;return new nn(function(n){var r;try{r=e[P]()}catch(i){return n.onError(),t}var o,s=new ye,u=De.scheduleRecursive(function(e){var i;if(!o){try{i=r.next()}catch(u){return n.onError(u),t}if(i.done)return n.onCompleted(),t;var c=new me;s.setDisposable(c),c.setDisposable(i.value.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){e()}))}});return new fe(s,u,de(function(){o=!0}))})},ke.prototype.catchException=function(){var e=this;return new nn(function(n){var r;try{r=e[P]()}catch(i){return n.onError(),t}var o,s,u=new ye,c=De.scheduleRecursive(function(e){if(!o){var i;try{i=r.next()}catch(c){return n.onError(c),t}if(i.done)return s?n.onError(s):n.onCompleted(),t;var a=new me;u.setDisposable(a),a.setDisposable(i.value.subscribe(n.onNext.bind(n),function(t){s=t,e()},n.onCompleted.bind(n)))}});return new fe(u,c,de(function(){o=!0}))})};var Pe=ke.repeat=function(t,e){return null==e&&(e=-1),new ke(function(){var n=e;return new je(function(){return 0===n?T:(n>0&&n--,{done:!1,value:t})})})},qe=ke.forEach=function(t,e,r){return e||(e=n),new ke(function(){var n=-1;return new je(function(){return++n0&&(e=!this.isAcquired,this.isAcquired=!0),e&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(e){var r;if(!(n.queue.length>0))return n.isAcquired=!1,t;r=n.queue.shift();try{r()}catch(i){throw n.queue=[],n.hasFaulted=!0,i}e()}))},n.prototype.dispose=function(){e.prototype.dispose.call(this),this.disposable.dispose()},n}(Ie),Fe=function(t){function e(){t.apply(this,arguments)}return oe(e,t),e.prototype.next=function(e){t.prototype.next.call(this,e),this.ensureActive()},e.prototype.error=function(e){t.prototype.error.call(this,e),this.ensureActive()},e.prototype.completed=function(){t.prototype.completed.call(this),this.ensureActive()},e}(Be),Ue=O.Observable=function(){function t(t){this._subscribe=t}return Le=t.prototype,Le.finalValue=function(){var t=this;return new nn(function(e){var n,r=!1;return t.subscribe(function(t){r=!0,n=t},e.onError.bind(e),function(){r?(e.onNext(n),e.onCompleted()):e.onError(Error(W))})})},Le.subscribe=Le.forEach=function(t,e,n){var r;return r="object"==typeof t?t:Me(t,e,n),this._subscribe(r)},Le.toArray=function(){function t(t,e){var n=t.slice(0);return n.push(e),n}return this.scan([],t).startWith([]).finalValue()},t}();Le.observeOn=function(t){var e=this;return new nn(function(n){return e.subscribe(new Fe(t,n))})},Le.subscribeOn=function(t){var e=this;return new nn(function(n){var r=new me,i=new ye;return i.setDisposable(r),r.setDisposable(t.schedule(function(){i.setDisposable(new w(t,e.subscribe(n)))})),i})};var He=Ue.fromPromise=function(t){return new nn(function(e){t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)})})};Le.toPromise=function(t){if(t||(t=O.config.Promise),!t)throw Error("Promise type not provided nor in Rx.config.Promise");var e=this;return new t(function(t,n){var r,i=!1;e.subscribe(function(t){r=t,i=!0},function(t){n(t)},function(){i&&t(r)})})},Ue.create=Ue.createWithDisposable=function(t){return new nn(t)},Ue.defer=function(t){return new nn(function(e){var n;try{n=t()}catch(r){return Ke(r).subscribe(e)}return n.subscribe(e)})};var $e=Ue.empty=function(t){return t||(t=De),new nn(function(e){return t.schedule(function(){e.onCompleted()})})},Qe=Ue.fromArray=function(t,e){return e||(e=Se),new nn(function(n){var r=0;return e.scheduleRecursive(function(e){t.length>r?(n.onNext(t[r++]),e()):n.onCompleted()})})};Ue.fromIterable=function(e,n){return n||(n=Se),new nn(function(r){var i;try{i=e[P]()}catch(o){return r.onError(o),t}return n.scheduleRecursive(function(e){var n;try{n=i.next()}catch(o){return r.onError(o),t}n.done?r.onCompleted():(r.onNext(n.value),e())})})},Ue.generate=function(e,n,r,i,o){return o||(o=Se),new nn(function(s){var u=!0,c=e;return o.scheduleRecursive(function(e){var o,a;try{u?u=!1:c=r(c),o=n(c),o&&(a=i(c))}catch(h){return s.onError(h),t}o?(s.onNext(a),e()):s.onCompleted()})})};var Ge=Ue.never=function(){return new nn(function(){return be})};Ue.range=function(t,e,n){return n||(n=Se),new nn(function(r){return n.scheduleRecursiveWithState(0,function(n,i){e>n?(r.onNext(t+n),i(n+1)):r.onCompleted()})})},Ue.repeat=function(t,e,n){return n||(n=Se),null==e&&(e=-1),Je(t,n).repeat(e)};var Je=Ue["return"]=Ue.returnValue=function(t,e){return e||(e=De),new nn(function(n){return e.schedule(function(){n.onNext(t),n.onCompleted()})})},Ke=Ue["throw"]=Ue.throwException=function(t,e){return e||(e=De),new nn(function(n){return e.schedule(function(){n.onError(t)})})};Ue.using=function(t,e){return new nn(function(n){var r,i,o=be;try{r=t(),r&&(o=r),i=e(r)}catch(s){return new fe(Ke(s).subscribe(n),o)}return new fe(i.subscribe(n),o)})},Le.amb=function(t){var e=this;return new nn(function(n){function r(){o||(o=s,a.dispose())}function i(){o||(o=u,c.dispose())}var o,s="L",u="R",c=new me,a=new me;return c.setDisposable(e.subscribe(function(t){r(),o===s&&n.onNext(t)},function(t){r(),o===s&&n.onError(t)},function(){r(),o===s&&n.onCompleted()})),a.setDisposable(t.subscribe(function(t){i(),o===u&&n.onNext(t)},function(t){i(),o===u&&n.onError(t)},function(){i(),o===u&&n.onCompleted()})),new fe(c,a)})},Ue.amb=function(){function t(t,e){return t.amb(e)}for(var e=Ge(),n=m(arguments,0),r=0,i=n.length;i>r;r++)e=t(e,n[r]);return e},Le["catch"]=Le.catchException=function(t){return"function"==typeof t?g(this,t):Xe([this,t])};var Xe=Ue.catchException=Ue["catch"]=function(){var t=m(arguments,0);return qe(t).catchException()};Le.combineLatest=function(){var t=ie.call(arguments);return Array.isArray(t[0])?t[0].unshift(this):t.unshift(this),Ye.apply(this,t)};var Ye=Ue.combineLatest=function(){var e=ie.call(arguments),r=e.pop();return Array.isArray(e[0])&&(e=e[0]),new nn(function(i){function o(e){var o;if(a[e]=!0,h||(h=a.every(n))){try{o=r.apply(null,l)}catch(s){return i.onError(s),t}i.onNext(o)}else f.filter(function(t,n){return n!==e}).every(n)&&i.onCompleted()}function s(t){f[t]=!0,f.every(n)&&i.onCompleted()}for(var u=function(){return!1},c=e.length,a=y(c,u),h=!1,f=y(c,u),l=Array(c),p=Array(c),d=0;c>d;d++)(function(t){p[t]=new me,p[t].setDisposable(e[t].subscribe(function(e){l[t]=e,o(t)},i.onError.bind(i),function(){s(t)}))})(d);return new fe(p)})};Le.concat=function(){var t=ie.call(arguments,0);return t.unshift(this),Ze.apply(this,t)};var Ze=Ue.concat=function(){var t=m(arguments,0);return qe(t).concat()};Le.concatObservable=Le.concatAll=function(){return this.merge(1)},Le.merge=function(t){if("number"!=typeof t)return tn(this,t);var e=this;return new nn(function(n){var r=0,i=new fe,o=!1,s=[],c=function(t){var e=new me;i.add(e),u(t)&&(t=He(t)),e.setDisposable(t.subscribe(n.onNext.bind(n),n.onError.bind(n),function(){var t;i.remove(e),s.length>0?(t=s.shift(),c(t)):(r--,o&&0===r&&n.onCompleted())}))};return i.add(e.subscribe(function(e){t>r?(r++,c(e)):s.push(e)},n.onError.bind(n),function(){o=!0,0===r&&n.onCompleted()})),i})};var tn=Ue.merge=function(){var t,e;return arguments[0]?arguments[0].now?(t=arguments[0],e=ie.call(arguments,1)):(t=De,e=ie.call(arguments,0)):(t=De,e=ie.call(arguments,1)),Array.isArray(e[0])&&(e=e[0]),Qe(e,t).mergeObservable()};Le.mergeObservable=Le.mergeAll=function(){var t=this;return new nn(function(e){var n=new fe,r=!1,i=new me;return n.add(i),i.setDisposable(t.subscribe(function(t){var i=new me;n.add(i),u(t)&&(t=He(t)),i.setDisposable(t.subscribe(function(t){e.onNext(t)},e.onError.bind(e),function(){n.remove(i),r&&1===n.length&&e.onCompleted()}))},e.onError.bind(e),function(){r=!0,1===n.length&&e.onCompleted()})),n})},Le.onErrorResumeNext=function(t){if(!t)throw Error("Second observable is required");return en([this,t])};var en=Ue.onErrorResumeNext=function(){var t=m(arguments,0);return new nn(function(e){var n=0,r=new ye,i=De.scheduleRecursive(function(i){var o,s;t.length>n?(o=t[n++],s=new me,r.setDisposable(s),s.setDisposable(o.subscribe(e.onNext.bind(e),function(){i()},function(){i()}))):e.onCompleted()});return new fe(r,i)})};Le.skipUntil=function(t){var e=this;return new nn(function(n){var r=!1,i=new fe(e.subscribe(function(t){r&&n.onNext(t)},n.onError.bind(n),function(){r&&n.onCompleted()})),o=new me;return i.add(o),o.setDisposable(t.subscribe(function(){r=!0,o.dispose()},n.onError.bind(n),function(){o.dispose()})),i})},Le["switch"]=Le.switchLatest=function(){var t=this;return new nn(function(e){var n=!1,r=new ye,i=!1,o=0,s=t.subscribe(function(t){var s=new me,c=++o;n=!0,r.setDisposable(s),u(t)&&(t=He(t)),s.setDisposable(t.subscribe(function(t){o===c&&e.onNext(t)},function(t){o===c&&e.onError(t)},function(){o===c&&(n=!1,i&&e.onCompleted())}))},e.onError.bind(e),function(){i=!0,n||e.onCompleted()});return new fe(s,r)})},Le.takeUntil=function(t){var n=this;return new nn(function(r){return new fe(n.subscribe(r),t.subscribe(r.onCompleted.bind(r),r.onError.bind(r),e))})},Le.zip=function(){if(Array.isArray(arguments[0]))return E.apply(this,arguments);var e=this,r=ie.call(arguments),i=r.pop();return r.unshift(e),new nn(function(o){function s(t){a[t]=!0,a.every(function(t){return t})&&o.onCompleted()}for(var u=r.length,c=y(u,function(){return[]}),a=y(u,function(){return!1}),h=function(r){var s,u;if(c.every(function(t){return t.length>0})){try{u=c.map(function(t){return t.shift()}),s=i.apply(e,u)}catch(h){return o.onError(h),t}o.onNext(s)}else a.filter(function(t,e){return e!==r}).every(n)&&o.onCompleted()},f=Array(u),l=0;u>l;l++)(function(t){f[t]=new me,f[t].setDisposable(r[t].subscribe(function(e){c[t].push(e),h(t)},o.onError.bind(o),function(){s(t)}))})(l);return new fe(f)})},Ue.zip=function(){var t=ie.call(arguments,0),e=t.shift();return e.zip.apply(e,t)},Ue.zipArray=function(){var e=m(arguments,0);return new nn(function(r){function i(e){if(u.every(function(t){return t.length>0})){var i=u.map(function(t){return t.shift()});r.onNext(i)}else if(c.filter(function(t,n){return n!==e}).every(n))return r.onCompleted(),t}function o(e){return c[e]=!0,c.every(n)?(r.onCompleted(),t):t}for(var s=e.length,u=y(s,function(){return[]}),c=y(s,function(){return!1}),a=Array(s),h=0;s>h;h++)(function(t){a[t]=new me,a[t].setDisposable(e[t].subscribe(function(e){u[t].push(e),i(t)},r.onError.bind(r),function(){o(t)}))})(h);var f=new fe(a);return f.add(de(function(){for(var t=0,e=u.length;e>t;t++)u[t]=[]})),f})},Le.asObservable=function(){var t=this;return new nn(function(e){return t.subscribe(e)})},Le.bufferWithCount=function(t,e){return 1===arguments.length&&(e=t),this.windowWithCount(t,e).selectMany(function(t){return t.toArray()}).where(function(t){return t.length>0})},Le.dematerialize=function(){var t=this;return new nn(function(e){return t.subscribe(function(t){return t.accept(e)},e.onError.bind(e),e.onCompleted.bind(e))})},Le.distinctUntilChanged=function(e,i){var o=this;return e||(e=n),i||(i=r),new nn(function(n){var r,s=!1;return o.subscribe(function(o){var u,c=!1;try{u=e(o)}catch(a){return n.onError(a),t}if(s)try{c=i(r,u)}catch(a){return n.onError(a),t}s&&c||(s=!0,r=u,n.onNext(o))},n.onError.bind(n),n.onCompleted.bind(n))})},Le["do"]=Le.doAction=function(t,e,n){var r,i=this;return"function"==typeof t?r=t:(r=t.onNext.bind(t),e=t.onError.bind(t),n=t.onCompleted.bind(t)),new nn(function(t){return i.subscribe(function(e){try{r(e)}catch(n){t.onError(n)}t.onNext(e)},function(n){if(e){try{e(n)}catch(r){t.onError(r)}t.onError(n)}else t.onError(n)},function(){if(n){try{n()}catch(e){t.onError(e)}t.onCompleted()}else t.onCompleted()})})},Le["finally"]=Le.finallyAction=function(t){var e=this;return new nn(function(n){var r=e.subscribe(n);return de(function(){try{r.dispose()}catch(e){throw e}finally{t()}})})},Le.ignoreElements=function(){var t=this;return new nn(function(n){return t.subscribe(e,n.onError.bind(n),n.onCompleted.bind(n))})},Le.materialize=function(){var t=this;return new nn(function(e){return t.subscribe(function(t){e.onNext(Oe(t))},function(t){e.onNext(Re(t)),e.onCompleted() +},function(){e.onNext(We()),e.onCompleted()})})},Le.repeat=function(t){return Pe(this,t).concat()},Le.retry=function(t){return Pe(this,t).catchException()},Le.scan=function(){var e,n,r=!1,i=this;return 2===arguments.length?(r=!0,e=arguments[0],n=arguments[1]):n=arguments[0],new nn(function(o){var s,u,c;return i.subscribe(function(i){try{c||(c=!0),s?u=n(u,i):(u=r?n(e,i):i,s=!0)}catch(a){return o.onError(a),t}o.onNext(u)},o.onError.bind(o),function(){!c&&r&&o.onNext(e),o.onCompleted()})})},Le.skipLast=function(t){var e=this;return new nn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&n.onNext(r.shift())},n.onError.bind(n),n.onCompleted.bind(n))})},Le.startWith=function(){var t,e,n=0;return arguments.length&&"now"in Object(arguments[0])?(e=arguments[0],n=1):e=De,t=ie.call(arguments,n),qe([Qe(t,e),this]).concat()},Le.takeLast=function(t,e){return this.takeLastBuffer(t).selectMany(function(t){return Qe(t,e)})},Le.takeLastBuffer=function(t){var e=this;return new nn(function(n){var r=[];return e.subscribe(function(e){r.push(e),r.length>t&&r.shift()},n.onError.bind(n),function(){n.onNext(r),n.onCompleted()})})},Le.windowWithCount=function(t,e){var n=this;if(0>=t)throw Error(j);if(1===arguments.length&&(e=t),0>=e)throw Error(j);return new nn(function(r){var i=new me,o=new we(i),s=0,u=[],c=function(){var t=new un;u.push(t),r.onNext(ue(t,o))};return c(),i.setDisposable(n.subscribe(function(n){for(var r,i=0,o=u.length;o>i;i++)u[i].onNext(n);var a=s-t+1;a>=0&&0===a%e&&(r=u.shift(),r.onCompleted()),s++,0===s%e&&c()},function(t){for(;u.length>0;)u.shift().onError(t);r.onError(t)},function(){for(;u.length>0;)u.shift().onCompleted();r.onCompleted()})),o})},Le.defaultIfEmpty=function(e){var n=this;return e===t&&(e=null),new nn(function(t){var r=!1;return n.subscribe(function(e){r=!0,t.onNext(e)},t.onError.bind(t),function(){r||t.onNext(e),t.onCompleted()})})},Le.distinct=function(e,r){var i=this;return e||(e=n),r||(r=o),new nn(function(n){var o={};return i.subscribe(function(i){var s,u,c,a=!1;try{s=e(i),u=r(s)}catch(h){return n.onError(h),t}for(c in o)if(u===c){a=!0;break}a||(o[u]=null,n.onNext(i))},n.onError.bind(n),n.onCompleted.bind(n))})},Le.groupBy=function(t,e,n){return this.groupByUntil(t,e,function(){return Ge()},n)},Le.groupByUntil=function(r,i,s,u){var c=this;return i||(i=n),u||(u=o),new nn(function(n){var o={},a=new fe,h=new we(a);return a.add(c.subscribe(function(c){var f,l,p,d,b,v,m,y,w,g;try{v=r(c),m=u(v)}catch(E){for(g in o)o[g].onError(E);return n.onError(E),t}d=!1;try{w=o[m],w||(w=new un,o[m]=w,d=!0)}catch(E){for(g in o)o[g].onError(E);return n.onError(E),t}if(d){b=new on(v,w,h),l=new on(v,w);try{f=s(l)}catch(E){for(g in o)o[g].onError(E);return n.onError(E),t}n.onNext(b),y=new me,a.add(y);var x=function(){m in o&&(delete o[m],w.onCompleted()),a.remove(y)};y.setDisposable(f.take(1).subscribe(e,function(t){for(g in o)o[g].onError(t);n.onError(t)},function(){x()}))}try{p=i(c)}catch(E){for(g in o)o[g].onError(E);return n.onError(E),t}w.onNext(p)},function(t){for(var e in o)o[e].onError(t);n.onError(t)},function(){for(var t in o)o[t].onCompleted();n.onCompleted()})),h})},Le.select=Le.map=function(e,n){var r=this;return new nn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Le.pluck=function(t){return this.select(function(e){return e[t]})},Le.selectMany=Le.flatMap=function(t,e){return e?this.selectMany(function(n,r){var i=t(n,r),o=u(i)?He(i):i;return o.select(function(t){return e(n,t,r)})}):"function"==typeof t?x.call(this,t):x.call(this,function(){return t})},Le.selectSwitch=Le.flatMapLatest=function(t,e){return this.select(t,e).switchLatest()},Le.skip=function(t){if(0>t)throw Error(j);var e=this;return new nn(function(n){var r=t;return e.subscribe(function(t){0>=r?n.onNext(t):r--},n.onError.bind(n),n.onCompleted.bind(n))})},Le.skipWhile=function(e,n){var r=this;return new nn(function(i){var o=0,s=!1;return r.subscribe(function(u){if(!s)try{s=!e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s&&i.onNext(u)},i.onError.bind(i),i.onCompleted.bind(i))})},Le.take=function(t,e){if(0>t)throw Error(j);if(0===t)return $e(e);var n=this;return new nn(function(e){var r=t;return n.subscribe(function(t){r>0&&(r--,e.onNext(t),0===r&&e.onCompleted())},e.onError.bind(e),e.onCompleted.bind(e))})},Le.takeWhile=function(e,n){var r=this;return new nn(function(i){var o=0,s=!0;return r.subscribe(function(u){if(s){try{s=e.call(n,u,o++,r)}catch(c){return i.onError(c),t}s?i.onNext(u):i.onCompleted()}},i.onError.bind(i),i.onCompleted.bind(i))})},Le.where=Le.filter=function(e,n){var r=this;return new nn(function(i){var o=0;return r.subscribe(function(s){var u;try{u=e.call(n,s,o++,r)}catch(c){return i.onError(c),t}u&&i.onNext(s)},i.onError.bind(i),i.onCompleted.bind(i))})};var nn=O.AnonymousObservable=function(e){function n(e){return e===t?e=be:"function"==typeof e&&(e=de(e)),e}function r(i){function o(t){var e=new rn(t);if(Se.scheduleRequired())Se.schedule(function(){try{e.setDisposable(n(i(e)))}catch(t){if(!e.fail(t))throw t}});else try{e.setDisposable(n(i(e)))}catch(r){if(!e.fail(r))throw r}return e}return this instanceof r?(e.call(this,o),t):new r(i)}return oe(r,e),r}(Ue),rn=function(t){function e(e){t.call(this),this.observer=e,this.m=new me}oe(e,t);var n=e.prototype;return n.next=function(t){var e=!1;try{this.observer.onNext(t),e=!0}catch(n){throw n}finally{e||this.dispose()}},n.error=function(t){try{this.observer.onError(t)}catch(e){throw e}finally{this.dispose()}},n.completed=function(){try{this.observer.onCompleted()}catch(t){throw t}finally{this.dispose()}},n.setDisposable=function(t){this.m.setDisposable(t)},n.getDisposable=function(){return this.m.getDisposable()},n.disposable=function(t){return arguments.length?this.getDisposable():setDisposable(t)},n.dispose=function(){t.prototype.dispose.call(this),this.m.dispose()},e}(Ie),on=function(t){function e(t){return this.underlyingObservable.subscribe(t)}function n(n,r,i){t.call(this,e),this.key=n,this.underlyingObservable=i?new nn(function(t){return new fe(i.getDisposable(),r.subscribe(t))}):r}return oe(n,t),n}(Ue),sn=function(t,e){this.subject=t,this.observer=e};sn.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var t=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(t,1),this.observer=null}};var un=O.Subject=function(t){function e(t){return c.call(this),this.isStopped?this.exception?(t.onError(this.exception),be):(t.onCompleted(),be):(this.observers.push(t),new sn(this,t))}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return oe(n,t),se(n.prototype,Te,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(c.call(this),!this.isStopped){var t=this.observers.slice(0);this.isStopped=!0;for(var e=0,n=t.length;n>e;e++)t[e].onCompleted();this.observers=[]}},onError:function(t){if(c.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){if(c.call(this),!this.isStopped)for(var e=this.observers.slice(0),n=0,r=e.length;r>n;n++)e[n].onNext(t)},dispose:function(){this.isDisposed=!0,this.observers=null}}),n.create=function(t,e){return new cn(t,e)},n}(Ue);O.AsyncSubject=function(t){function e(t){if(c.call(this),!this.isStopped)return this.observers.push(t),new sn(this,t);var e=this.exception,n=this.hasValue,r=this.value;return e?t.onError(e):n?(t.onNext(r),t.onCompleted()):t.onCompleted(),be}function n(){t.call(this,e),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return oe(n,t),se(n.prototype,Te,{hasObservers:function(){return c.call(this),this.observers.length>0},onCompleted:function(){var t,e,n;if(c.call(this),!this.isStopped){this.isStopped=!0;var r=this.observers.slice(0),i=this.value,o=this.hasValue;if(o)for(e=0,n=r.length;n>e;e++)t=r[e],t.onNext(i),t.onCompleted();else for(e=0,n=r.length;n>e;e++)r[e].onCompleted();this.observers=[]}},onError:function(t){if(c.call(this),!this.isStopped){var e=this.observers.slice(0);this.isStopped=!0,this.exception=t;for(var n=0,r=e.length;r>n;n++)e[n].onError(t);this.observers=[]}},onNext:function(t){c.call(this),this.isStopped||(this.value=t,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),n}(Ue);var cn=function(t){function e(t){return this.observable.subscribe(t)}function n(n,r){t.call(this,e),this.observer=n,this.observable=r}return oe(n,t),se(n.prototype,Te,{onCompleted:function(){this.observer.onCompleted()},onError:function(t){this.observer.onError(t)},onNext:function(t){this.observer.onNext(t)}}),n}(Ue);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(D.Rx=O,define(function(){return O})):S&&_?A?(_.exports=O).Rx=O:S.Rx=O:D.Rx=O}).call(this); \ No newline at end of file diff --git a/rx.testing.min.js b/rx.testing.min.js index 349013060..85c472d85 100644 --- a/rx.testing.min.js +++ b/rx.testing.min.js @@ -1 +1 @@ -(function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,i=e[typeof module]&&module&&!module.nodeType&&module,o=(i&&i.exports===r&&r,e[typeof global]&&global);!o||o.global!==o&&o.window!==o||(n=o),"function"==typeof define&&define.amd?define(["rx.virtualtime","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n){function r(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:d.call(t)}function i(t){this.predicate=t}function o(t){this.predicate=t}var s=n.Observer,u=n.Observable,c=n.Notification,a=n.VirtualTimeScheduler,l=n.Disposable,h=l.empty,f=l.create,p=n.CompositeDisposable,d=(n.SingleAssignmentDisposable,Array.prototype.slice),b=n.internals.inherits,v=n.internals.isEqual;i.prototype.equals=function(t){return t===this?!0:null==t?!1:"N"!==t.kind?!1:this.predicate(t.value)},o.prototype.equals=function(t){return t===this?!0:null==t?!1:"E"!==t.kind?!1:this.predicate(t.exception)};var m=n.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(t,e){return"function"==typeof e?new y(t,new i(e)):new y(t,c.createOnNext(e))},onError:function(t,e){return"function"==typeof e?new y(t,new o(e)):new y(t,c.createOnError(e))},onCompleted:function(t){return new y(t,c.createOnCompleted())},subscribe:function(t,e){return new g(t,e)}},y=n.Recorded=function(t,e,n){this.time=t,this.value=e,this.comparer=n||v};y.prototype.equals=function(t){return this.time===t.time&&this.comparer(this.value,t.value)},y.prototype.toString=function(){return""+this.value+"@"+this.time};var g=n.Subscription=function(t,e){this.subscribe=t,this.unsubscribe=e||Number.MAX_VALUE};g.prototype.equals=function(t){return this.subscribe===t.subscribe&&this.unsubscribe===t.unsubscribe},g.prototype.toString=function(){return"("+this.subscribe+", "+this.unsubscribe===Number.MAX_VALUE?"Infinite":this.unsubscribe+")"};var w=n.MockDisposable=function(t){this.scheduler=t,this.disposes=[],this.disposes.push(this.scheduler.clock)};w.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var x=function(t){function e(e){t.call(this),this.scheduler=e,this.messages=[]}b(e,t);var n=e.prototype;return n.onNext=function(t){this.messages.push(new y(this.scheduler.clock,c.createOnNext(t)))},n.onError=function(t){this.messages.push(new y(this.scheduler.clock,c.createOnError(t)))},n.onCompleted=function(){this.messages.push(new y(this.scheduler.clock,c.createOnCompleted()))},e}(s),E=function(t){function e(t){var e=this;this.observers.push(t),this.subscriptions.push(new g(this.scheduler.clock));var n=this.subscriptions.length-1;return f(function(){var r=e.observers.indexOf(t);e.observers.splice(r,1),e.subscriptions[n]=new g(e.subscriptions[n].subscribe,e.scheduler.clock)})}function n(n,r){t.call(this,e);var i,o,s=this;this.scheduler=n,this.messages=r,this.subscriptions=[],this.observers=[];for(var u=0,c=this.messages.length;c>u;u++)i=this.messages[u],o=i.value,function(t){n.scheduleAbsoluteWithState(null,i.time,function(){for(var e=s.observers.slice(0),n=0,r=e.length;r>n;n++)t.accept(e[n]);return h})}(o)}return b(n,t),n}(u),C=function(t){function e(t){var e,n,r=this;this.subscriptions.push(new g(this.scheduler.clock));for(var i=this.subscriptions.length-1,o=new p,s=0,u=this.messages.length;u>s;s++)e=this.messages[s],n=e.value,function(n){o.add(r.scheduler.scheduleRelativeWithState(null,e.time,function(){return n.accept(t),h}))}(n);return f(function(){r.subscriptions[i]=new g(r.subscriptions[i].subscribe,r.scheduler.clock),o.dispose()})}function n(n,r){t.call(this,e),this.scheduler=n,this.messages=r,this.subscriptions=[]}return b(n,t),n}(u);return n.TestScheduler=function(t){function e(t,e){return t>e?1:e>t?-1:0}function n(){t.call(this,0,e)}return b(n,t),n.prototype.scheduleAbsoluteWithState=function(e,n,r){return this.clock>=n&&(n=this.clock+1),t.prototype.scheduleAbsoluteWithState.call(this,e,n,r)},n.prototype.add=function(t,e){return t+e},n.prototype.toDateTimeOffset=function(t){return new Date(t).getTime()},n.prototype.toRelative=function(t){return t},n.prototype.startWithTiming=function(t,e,n,r){var i,o,s=this.createObserver();return this.scheduleAbsoluteWithState(null,e,function(){return i=t(),h}),this.scheduleAbsoluteWithState(null,n,function(){return o=i.subscribe(s),h}),this.scheduleAbsoluteWithState(null,r,function(){return o.dispose(),h}),this.start(),s},n.prototype.startWithDispose=function(t,e){return this.startWithTiming(t,m.created,m.subscribed,e)},n.prototype.startWithCreate=function(t){return this.startWithTiming(t,m.created,m.subscribed,m.disposed)},n.prototype.createHotObservable=function(){var t=r(arguments,0);return new E(this,t)},n.prototype.createColdObservable=function(){var t=r(arguments,0);return new C(this,t)},n.prototype.createObserver=function(){return new x(this)},n}(a),n}); \ No newline at end of file +(function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,o=e[typeof module]&&module&&!module.nodeType&&module,i=(o&&o.exports===r&&r,e[typeof global]&&global);!i||i.global!==i&&i.window!==i||(n=i),"function"==typeof define&&define.amd?define(["rx.virtualtime","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n){function r(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:d.call(t)}function o(t){this.predicate=t}function i(t){this.predicate=t}var s=n.Observer,u=n.Observable,c=n.Notification,a=n.VirtualTimeScheduler,l=n.Disposable,h=l.empty,f=l.create,p=n.CompositeDisposable,d=(n.SingleAssignmentDisposable,Array.prototype.slice),b=n.internals.inherits,v=n.internals.isEqual;o.prototype.equals=function(t){return t===this?!0:null==t?!1:"N"!==t.kind?!1:this.predicate(t.value)},i.prototype.equals=function(t){return t===this?!0:null==t?!1:"E"!==t.kind?!1:this.predicate(t.exception)};var m=n.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(t,e){return"function"==typeof e?new y(t,new o(e)):new y(t,c.createOnNext(e))},onError:function(t,e){return"function"==typeof e?new y(t,new i(e)):new y(t,c.createOnError(e))},onCompleted:function(t){return new y(t,c.createOnCompleted())},subscribe:function(t,e){return new w(t,e)}},y=n.Recorded=function(t,e,n){this.time=t,this.value=e,this.comparer=n||v};y.prototype.equals=function(t){return this.time===t.time&&this.comparer(this.value,t.value)},y.prototype.toString=function(){return""+this.value+"@"+this.time};var w=n.Subscription=function(t,e){this.subscribe=t,this.unsubscribe=e||Number.MAX_VALUE};w.prototype.equals=function(t){return this.subscribe===t.subscribe&&this.unsubscribe===t.unsubscribe},w.prototype.toString=function(){return"("+this.subscribe+", "+this.unsubscribe===Number.MAX_VALUE?"Infinite":this.unsubscribe+")"};var g=n.MockDisposable=function(t){this.scheduler=t,this.disposes=[],this.disposes.push(this.scheduler.clock)};g.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var x=function(t){function e(e){t.call(this),this.scheduler=e,this.messages=[]}b(e,t);var n=e.prototype;return n.onNext=function(t){this.messages.push(new y(this.scheduler.clock,c.createOnNext(t)))},n.onError=function(t){this.messages.push(new y(this.scheduler.clock,c.createOnError(t)))},n.onCompleted=function(){this.messages.push(new y(this.scheduler.clock,c.createOnCompleted()))},e}(s),E=function(t){function e(t){var e=this;this.observers.push(t),this.subscriptions.push(new w(this.scheduler.clock));var n=this.subscriptions.length-1;return f(function(){var r=e.observers.indexOf(t);e.observers.splice(r,1),e.subscriptions[n]=new w(e.subscriptions[n].subscribe,e.scheduler.clock)})}function n(n,r){t.call(this,e);var o,i,s=this;this.scheduler=n,this.messages=r,this.subscriptions=[],this.observers=[];for(var u=0,c=this.messages.length;c>u;u++)o=this.messages[u],i=o.value,function(t){n.scheduleAbsoluteWithState(null,o.time,function(){for(var e=s.observers.slice(0),n=0,r=e.length;r>n;n++)t.accept(e[n]);return h})}(i)}return b(n,t),n}(u),C=function(t){function e(t){var e,n,r=this;this.subscriptions.push(new w(this.scheduler.clock));for(var o=this.subscriptions.length-1,i=new p,s=0,u=this.messages.length;u>s;s++)e=this.messages[s],n=e.value,function(n){i.add(r.scheduler.scheduleRelativeWithState(null,e.time,function(){return n.accept(t),h}))}(n);return f(function(){r.subscriptions[o]=new w(r.subscriptions[o].subscribe,r.scheduler.clock),i.dispose()})}function n(n,r){t.call(this,e),this.scheduler=n,this.messages=r,this.subscriptions=[]}return b(n,t),n}(u);return n.TestScheduler=function(t){function e(t,e){return t>e?1:e>t?-1:0}function n(){t.call(this,0,e)}return b(n,t),n.prototype.scheduleAbsoluteWithState=function(e,n,r){return this.clock>=n&&(n=this.clock+1),t.prototype.scheduleAbsoluteWithState.call(this,e,n,r)},n.prototype.add=function(t,e){return t+e},n.prototype.toDateTimeOffset=function(t){return new Date(t).getTime()},n.prototype.toRelative=function(t){return t},n.prototype.startWithTiming=function(t,e,n,r){var o,i,s=this.createObserver();return this.scheduleAbsoluteWithState(null,e,function(){return o=t(),h}),this.scheduleAbsoluteWithState(null,n,function(){return i=o.subscribe(s),h}),this.scheduleAbsoluteWithState(null,r,function(){return i.dispose(),h}),this.start(),s},n.prototype.startWithDispose=function(t,e){return this.startWithTiming(t,m.created,m.subscribed,e)},n.prototype.startWithCreate=function(t){return this.startWithTiming(t,m.created,m.subscribed,m.disposed)},n.prototype.createHotObservable=function(){var t=r(arguments,0);return new E(this,t)},n.prototype.createColdObservable=function(){var t=r(arguments,0);return new C(this,t)},n.prototype.createObserver=function(){return new x(this)},n}(a),n}); \ No newline at end of file diff --git a/rx.time.min.js b/rx.time.min.js index 3c5ff03ea..78ad19ea9 100644 --- a/rx.time.min.js +++ b/rx.time.min.js @@ -1 +1 @@ -(function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,o=e[typeof module]&&module&&!module.nodeType&&module,i=(o&&o.exports===r&&r,e[typeof global]&&global);!i||i.global!==i&&i.window!==i||(n=i),"function"==typeof define&&define.amd?define(["rx","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n,r){function o(t,e){return new p(function(n){return e.scheduleWithAbsolute(t,function(){n.onNext(0),n.onCompleted()})})}function i(t,e,n){var r=N(e);return new p(function(e){var o=0,i=t;return n.scheduleRecursiveWithAbsolute(i,function(t){var s;r>0&&(s=n.now(),i+=r,s>=i&&(i=s+r)),e.onNext(o++),t(i)})})}function s(t,e){var n=N(t);return new p(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function u(t,e,n){return t===e?new p(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):d(function(){return i(n.now()+t,e,n)})}function c(t,e){var n=this;return new p(function(r){var o,i=!1,s=new x,u=null,c=[],a=!1;return o=n.materialize().timestamp(e).subscribe(function(n){var o,l;"E"===n.value.kind?(c=[],c.push(n),u=n.value.exception,l=!a):(c.push({value:n.value,timestamp:n.timestamp+t}),l=!i,i=!0),l&&(null!==u?r.onError(u):(o=new g,s.setDisposable(o),o.setDisposable(e.scheduleRecursiveWithRelative(t,function(t){var n,o,s,l;if(null===u){a=!0;do s=null,c.length>0&&0>=c[0].timestamp-e.now()&&(s=c.shift().value),null!==s&&s.accept(r);while(null!==s);l=!1,o=0,c.length>0?(l=!0,o=Math.max(0,c[0].timestamp-e.now())):i=!1,n=u,a=!1,null!==n?r.onError(n):l&&t(o)}}))))}),new E(o,s)})}function a(t,e){var n=this;return d(function(){var r=t-e.now();return c.call(n,r,e)})}function l(t,e){return new p(function(n){function r(){s&&(s=!1,n.onNext(i)),o&&n.onCompleted()}var o,i,s;return new E(t.subscribe(function(t){s=!0,i=t},n.onError.bind(n),function(){o=!0}),e.subscribe(r,n.onError.bind(n),r))})}var f=n.Observable,h=f.prototype,p=n.AnonymousObservable,d=f.defer,b=f.empty,v=f.never,m=f.throwException,y=f.fromArray,w=n.Scheduler.timeout,g=n.SingleAssignmentDisposable,x=n.SerialDisposable,E=n.CompositeDisposable,C=n.RefCountDisposable,D=n.Subject,A=n.internals.addRef,N=n.Scheduler.normalize,S=f.interval=function(t,e){return e||(e=w),u(t,t,e)},O=f.timer=function(t,e,n){var c;return n||(n=w),e!==r&&"number"==typeof e?c=e:e!==r&&"object"==typeof e&&(n=e),t instanceof Date&&c===r?o(t.getTime(),n):t instanceof Date&&c!==r?(c=e,i(t.getTime(),c,n)):c===r?s(t,n):u(t,c,n)};return h.delay=function(t,e){return e||(e=w),t instanceof Date?a.call(this,t.getTime(),e):c.call(this,t,e)},h.throttle=function(t,e){return e||(e=w),this.throttleWithSelector(function(){return O(t,e)})},h.windowWithTime=function(t,e,n){var o,i=this;return e===r&&(o=t),n===r&&(n=w),"number"==typeof e?o=e:"object"==typeof e&&(o=t,n=e),new p(function(e){function r(){var t=new g,i=!1,s=!1;f.setDisposable(t),a===c?(i=!0,s=!0):c>a?i=!0:s=!0;var p=i?a:c,d=p-h;h=p,i&&(a+=o),s&&(c+=o),t.setDisposable(n.scheduleWithRelative(d,function(){var t;s&&(t=new D,l.push(t),e.onNext(A(t,u))),i&&(t=l.shift(),t.onCompleted()),r()}))}var s,u,c=o,a=t,l=[],f=new x,h=0;return s=new E(f),u=new C(s),l.push(new D),e.onNext(A(l[0],u)),r(),s.add(i.subscribe(function(t){var e,n;for(e=0;l.length>e;e++)n=l[e],n.onNext(t)},function(t){var n,r;for(n=0;l.length>n;n++)r=l[n],r.onError(t);e.onError(t)},function(){var t,n;for(t=0;l.length>t;t++)n=l[t],n.onCompleted();e.onCompleted()})),u})},h.windowWithTimeOrCount=function(t,e,n){var r=this;return n||(n=w),new p(function(o){var i,s,u,c,a=0,l=new x,f=0;return s=new E(l),u=new C(s),i=function(e){var r=new g;l.setDisposable(r),r.setDisposable(n.scheduleWithRelative(t,function(){var t;e===f&&(a=0,t=++f,c.onCompleted(),c=new D,o.onNext(A(c,u)),i(t))}))},c=new D,o.onNext(A(c,u)),i(0),s.add(r.subscribe(function(t){var n=0,r=!1;c.onNext(t),a++,a===e&&(r=!0,a=0,n=++f,c.onCompleted(),c=new D,o.onNext(A(c,u))),r&&i(n)},function(t){c.onError(t),o.onError(t)},function(){c.onCompleted(),o.onCompleted()})),u})},h.bufferWithTime=function(){return this.windowWithTime.apply(this,arguments).selectMany(function(t){return t.toArray()})},h.bufferWithTimeOrCount=function(t,e,n){return this.windowWithTimeOrCount(t,e,n).selectMany(function(t){return t.toArray()})},h.timeInterval=function(t){var e=this;return t||(t=w),d(function(){var n=t.now();return e.select(function(e){var r=t.now(),o=r-n;return n=r,{value:e,interval:o}})})},h.timestamp=function(t){return t||(t=w),this.select(function(e){return{value:e,timestamp:t.now()}})},h.sample=function(t,e){return e||(e=w),"number"==typeof t?l(this,S(t,e)):l(this,t)},h.timeout=function(t,e,n){var r,o=this;return e||(e=m(Error("Timeout"))),n||(n=w),r=t instanceof Date?function(t,e){n.scheduleWithAbsolute(t,e)}:function(t,e){n.scheduleWithRelative(t,e)},new p(function(n){var i,s=0,u=new g,c=new x,a=!1,l=new x;return c.setDisposable(u),i=function(){var o=s;l.setDisposable(r(t,function(){a=s===o;var t=a;t&&c.setDisposable(e.subscribe(n))}))},i(),u.setDisposable(o.subscribe(function(t){var e=!a;e&&(s++,n.onNext(t),i())},function(t){var e=!a;e&&(s++,n.onError(t))},function(){var t=!a;t&&(s++,n.onCompleted())})),new E(c,l)})},f.generateWithAbsoluteTime=function(t,e,n,o,i,s){return s||(s=w),new p(function(u){var c,a,l=!0,f=!1,h=t;return s.scheduleRecursiveWithAbsolute(s.now(),function(t){f&&u.onNext(c);try{l?l=!1:h=n(h),f=e(h),f&&(c=o(h),a=i(h))}catch(s){return u.onError(s),r}f?t(a):u.onCompleted()})})},f.generateWithRelativeTime=function(t,e,n,o,i,s){return s||(s=w),new p(function(u){var c,a,l=!0,f=!1,h=t;return s.scheduleRecursiveWithRelative(0,function(t){f&&u.onNext(c);try{l?l=!1:h=n(h),f=e(h),f&&(c=o(h),a=i(h))}catch(s){return u.onError(s),r}f?t(a):u.onCompleted()})})},h.delaySubscription=function(t,e){return e||(e=w),this.delayWithSelector(O(t,e),function(){return b()})},h.delayWithSelector=function(t,e){var n,o,i=this;return"function"==typeof t?o=t:(n=t,o=e),new p(function(t){var e=new E,s=!1,u=function(){s&&0===e.length&&t.onCompleted()},c=new x,a=function(){c.setDisposable(i.subscribe(function(n){var i;try{i=o(n)}catch(s){return t.onError(s),r}var c=new g;e.add(c),c.setDisposable(i.subscribe(function(){t.onNext(n),e.remove(c),u()},t.onError.bind(t),function(){t.onNext(n),e.remove(c),u()}))},t.onError.bind(t),function(){s=!0,c.dispose(),u()}))};return n?c.setDisposable(n.subscribe(function(){a()},t.onError.bind(t),function(){a()})):a(),new E(c,e)})},h.timeoutWithSelector=function(t,e,n){if(1===arguments.length){e=t;var t=v()}n||(n=m(Error("Timeout")));var o=this;return new p(function(i){var s=new x,u=new x,c=new g;s.setDisposable(c);var a=0,l=!1,f=function(t){var e=a,r=function(){return a===e},o=new g;u.setDisposable(o),o.setDisposable(t.subscribe(function(){r()&&s.setDisposable(n.subscribe(i)),o.dispose()},function(t){r()&&i.onError(t)},function(){r()&&s.setDisposable(n.subscribe(i))}))};f(t);var h=function(){var t=!l;return t&&a++,t};return c.setDisposable(o.subscribe(function(t){if(h()){i.onNext(t);var n;try{n=e(t)}catch(o){return i.onError(o),r}f(n)}},function(t){h()&&i.onError(t)},function(){h()&&i.onCompleted()})),new E(s,u)})},h.throttleWithSelector=function(t){var e=this;return new p(function(n){var o,i=!1,s=new x,u=0,c=e.subscribe(function(e){var c;try{c=t(e)}catch(a){return n.onError(a),r}i=!0,o=e,u++;var l=u,f=new g;s.setDisposable(f),f.setDisposable(c.subscribe(function(){i&&u===l&&n.onNext(o),i=!1,f.dispose()},n.onError.bind(n),function(){i&&u===l&&n.onNext(o),i=!1,f.dispose()}))},function(t){s.dispose(),n.onError(t),i=!1,u++},function(){s.dispose(),i&&n.onNext(o),n.onCompleted(),i=!1,u++});return new E(c,s)})},h.skipLastWithTime=function(t,e){e||(e=w);var n=this;return new p(function(r){var o=[];return n.subscribe(function(n){var i=e.now();for(o.push({interval:i,value:n});o.length>0&&i-o[0].interval>=t;)r.onNext(o.shift().value)},r.onError.bind(r),function(){for(var n=e.now();o.length>0&&n-o[0].interval>=t;)r.onNext(o.shift().value);r.onCompleted()})})},h.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return y(t,n)})},h.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=w),new p(function(r){var o=[];return n.subscribe(function(n){var r=e.now();for(o.push({interval:r,value:n});o.length>0&&r-o[0].interval>=t;)o.shift()},r.onError.bind(r),function(){for(var n=e.now(),i=[];o.length>0;){var s=o.shift();t>=n-s.interval&&i.push(s.value)}r.onNext(i),r.onCompleted()})})},h.takeWithTime=function(t,e){var n=this;return e||(e=w),new p(function(r){var o=e.scheduleWithRelative(t,function(){r.onCompleted()});return new E(o,n.subscribe(r))})},h.skipWithTime=function(t,e){var n=this;return e||(e=w),new p(function(r){var o=!1,i=e.scheduleWithRelative(t,function(){o=!0}),s=n.subscribe(function(t){o&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new E(i,s)})},h.skipUntilWithTime=function(t,e){e||(e=w);var n=this;return new p(function(r){var o=!1,i=e.scheduleWithAbsolute(t,function(){o=!0}),s=n.subscribe(function(t){o&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new E(i,s)})},h.takeUntilWithTime=function(t,e){e||(e=w);var n=this;return new p(function(r){return new E(e.scheduleWithAbsolute(t,function(){r.onCompleted()}),n.subscribe(r))})},n}); \ No newline at end of file +(function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,o=e[typeof module]&&module&&!module.nodeType&&module,i=(o&&o.exports===r&&r,e[typeof global]&&global);!i||i.global!==i&&i.window!==i||(n=i),"function"==typeof define&&define.amd?define(["rx","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n,r){function o(t,e){return new p(function(n){return e.scheduleWithAbsolute(t,function(){n.onNext(0),n.onCompleted()})})}function i(t,e,n){var r=S(e);return new p(function(e){var o=0,i=t;return n.scheduleRecursiveWithAbsolute(i,function(t){var s;r>0&&(s=n.now(),i+=r,s>=i&&(i=s+r)),e.onNext(o++),t(i)})})}function s(t,e){var n=S(t);return new p(function(t){return e.scheduleWithRelative(n,function(){t.onNext(0),t.onCompleted()})})}function u(t,e,n){return t===e?new p(function(t){return n.schedulePeriodicWithState(0,e,function(e){return t.onNext(e),e+1})}):d(function(){return i(n.now()+t,e,n)})}function c(t,e){var n=this;return new p(function(r){var o,i=!1,s=new x,u=null,c=[],a=!1;return o=n.materialize().timestamp(e).subscribe(function(n){var o,l;"E"===n.value.kind?(c=[],c.push(n),u=n.value.exception,l=!a):(c.push({value:n.value,timestamp:n.timestamp+t}),l=!i,i=!0),l&&(null!==u?r.onError(u):(o=new g,s.setDisposable(o),o.setDisposable(e.scheduleRecursiveWithRelative(t,function(t){var n,o,s,l;if(null===u){a=!0;do s=null,c.length>0&&0>=c[0].timestamp-e.now()&&(s=c.shift().value),null!==s&&s.accept(r);while(null!==s);l=!1,o=0,c.length>0?(l=!0,o=Math.max(0,c[0].timestamp-e.now())):i=!1,n=u,a=!1,null!==n?r.onError(n):l&&t(o)}}))))}),new E(o,s)})}function a(t,e){var n=this;return d(function(){var r=t-e.now();return c.call(n,r,e)})}function l(t,e){return new p(function(n){function r(){s&&(s=!1,n.onNext(i)),o&&n.onCompleted()}var o,i,s;return new E(t.subscribe(function(t){s=!0,i=t},n.onError.bind(n),function(){o=!0}),e.subscribe(r,n.onError.bind(n),r))})}var f=n.Observable,h=f.prototype,p=n.AnonymousObservable,d=f.defer,b=f.empty,v=f.never,m=f.throwException,y=f.fromArray,w=n.Scheduler.timeout,g=n.SingleAssignmentDisposable,x=n.SerialDisposable,E=n.CompositeDisposable,C=n.RefCountDisposable,D=n.Subject,A=n.internals.addRef,S=n.Scheduler.normalize,N=f.interval=function(t,e){return e||(e=w),u(t,t,e)},O=f.timer=function(t,e,n){var c;return n||(n=w),e!==r&&"number"==typeof e?c=e:e!==r&&"object"==typeof e&&(n=e),t instanceof Date&&c===r?o(t.getTime(),n):t instanceof Date&&c!==r?(c=e,i(t.getTime(),c,n)):c===r?s(t,n):u(t,c,n)};return h.delay=function(t,e){return e||(e=w),t instanceof Date?a.call(this,t.getTime(),e):c.call(this,t,e)},h.throttle=function(t,e){return e||(e=w),this.throttleWithSelector(function(){return O(t,e)})},h.windowWithTime=function(t,e,n){var o,i=this;return e===r&&(o=t),n===r&&(n=w),"number"==typeof e?o=e:"object"==typeof e&&(o=t,n=e),new p(function(e){function r(){var t=new g,i=!1,s=!1;f.setDisposable(t),a===c?(i=!0,s=!0):c>a?i=!0:s=!0;var p=i?a:c,d=p-h;h=p,i&&(a+=o),s&&(c+=o),t.setDisposable(n.scheduleWithRelative(d,function(){var t;s&&(t=new D,l.push(t),e.onNext(A(t,u))),i&&(t=l.shift(),t.onCompleted()),r()}))}var s,u,c=o,a=t,l=[],f=new x,h=0;return s=new E(f),u=new C(s),l.push(new D),e.onNext(A(l[0],u)),r(),s.add(i.subscribe(function(t){var e,n;for(e=0;l.length>e;e++)n=l[e],n.onNext(t)},function(t){var n,r;for(n=0;l.length>n;n++)r=l[n],r.onError(t);e.onError(t)},function(){var t,n;for(t=0;l.length>t;t++)n=l[t],n.onCompleted();e.onCompleted()})),u})},h.windowWithTimeOrCount=function(t,e,n){var r=this;return n||(n=w),new p(function(o){var i,s,u,c,a=0,l=new x,f=0;return s=new E(l),u=new C(s),i=function(e){var r=new g;l.setDisposable(r),r.setDisposable(n.scheduleWithRelative(t,function(){var t;e===f&&(a=0,t=++f,c.onCompleted(),c=new D,o.onNext(A(c,u)),i(t))}))},c=new D,o.onNext(A(c,u)),i(0),s.add(r.subscribe(function(t){var n=0,r=!1;c.onNext(t),a++,a===e&&(r=!0,a=0,n=++f,c.onCompleted(),c=new D,o.onNext(A(c,u))),r&&i(n)},function(t){c.onError(t),o.onError(t)},function(){c.onCompleted(),o.onCompleted()})),u})},h.bufferWithTime=function(){return this.windowWithTime.apply(this,arguments).selectMany(function(t){return t.toArray()})},h.bufferWithTimeOrCount=function(t,e,n){return this.windowWithTimeOrCount(t,e,n).selectMany(function(t){return t.toArray()})},h.timeInterval=function(t){var e=this;return t||(t=w),d(function(){var n=t.now();return e.select(function(e){var r=t.now(),o=r-n;return n=r,{value:e,interval:o}})})},h.timestamp=function(t){return t||(t=w),this.select(function(e){return{value:e,timestamp:t.now()}})},h.sample=function(t,e){return e||(e=w),"number"==typeof t?l(this,N(t,e)):l(this,t)},h.timeout=function(t,e,n){var r,o=this;return e||(e=m(Error("Timeout"))),n||(n=w),r=t instanceof Date?function(t,e){n.scheduleWithAbsolute(t,e)}:function(t,e){n.scheduleWithRelative(t,e)},new p(function(n){var i,s=0,u=new g,c=new x,a=!1,l=new x;return c.setDisposable(u),i=function(){var o=s;l.setDisposable(r(t,function(){a=s===o;var t=a;t&&c.setDisposable(e.subscribe(n))}))},i(),u.setDisposable(o.subscribe(function(t){var e=!a;e&&(s++,n.onNext(t),i())},function(t){var e=!a;e&&(s++,n.onError(t))},function(){var t=!a;t&&(s++,n.onCompleted())})),new E(c,l)})},f.generateWithAbsoluteTime=function(t,e,n,o,i,s){return s||(s=w),new p(function(u){var c,a,l=!0,f=!1,h=t;return s.scheduleRecursiveWithAbsolute(s.now(),function(t){f&&u.onNext(c);try{l?l=!1:h=n(h),f=e(h),f&&(c=o(h),a=i(h))}catch(s){return u.onError(s),r}f?t(a):u.onCompleted()})})},f.generateWithRelativeTime=function(t,e,n,o,i,s){return s||(s=w),new p(function(u){var c,a,l=!0,f=!1,h=t;return s.scheduleRecursiveWithRelative(0,function(t){f&&u.onNext(c);try{l?l=!1:h=n(h),f=e(h),f&&(c=o(h),a=i(h))}catch(s){return u.onError(s),r}f?t(a):u.onCompleted()})})},h.delaySubscription=function(t,e){return e||(e=w),this.delayWithSelector(O(t,e),function(){return b()})},h.delayWithSelector=function(t,e){var n,o,i=this;return"function"==typeof t?o=t:(n=t,o=e),new p(function(t){var e=new E,s=!1,u=function(){s&&0===e.length&&t.onCompleted()},c=new x,a=function(){c.setDisposable(i.subscribe(function(n){var i;try{i=o(n)}catch(s){return t.onError(s),r}var c=new g;e.add(c),c.setDisposable(i.subscribe(function(){t.onNext(n),e.remove(c),u()},t.onError.bind(t),function(){t.onNext(n),e.remove(c),u()}))},t.onError.bind(t),function(){s=!0,c.dispose(),u()}))};return n?c.setDisposable(n.subscribe(function(){a()},t.onError.bind(t),function(){a()})):a(),new E(c,e)})},h.timeoutWithSelector=function(t,e,n){if(1===arguments.length){e=t;var t=v()}n||(n=m(Error("Timeout")));var o=this;return new p(function(i){var s=new x,u=new x,c=new g;s.setDisposable(c);var a=0,l=!1,f=function(t){var e=a,r=function(){return a===e},o=new g;u.setDisposable(o),o.setDisposable(t.subscribe(function(){r()&&s.setDisposable(n.subscribe(i)),o.dispose()},function(t){r()&&i.onError(t)},function(){r()&&s.setDisposable(n.subscribe(i))}))};f(t);var h=function(){var t=!l;return t&&a++,t};return c.setDisposable(o.subscribe(function(t){if(h()){i.onNext(t);var n;try{n=e(t)}catch(o){return i.onError(o),r}f(n)}},function(t){h()&&i.onError(t)},function(){h()&&i.onCompleted()})),new E(s,u)})},h.throttleWithSelector=function(t){var e=this;return new p(function(n){var o,i=!1,s=new x,u=0,c=e.subscribe(function(e){var c;try{c=t(e)}catch(a){return n.onError(a),r}i=!0,o=e,u++;var l=u,f=new g;s.setDisposable(f),f.setDisposable(c.subscribe(function(){i&&u===l&&n.onNext(o),i=!1,f.dispose()},n.onError.bind(n),function(){i&&u===l&&n.onNext(o),i=!1,f.dispose()}))},function(t){s.dispose(),n.onError(t),i=!1,u++},function(){s.dispose(),i&&n.onNext(o),n.onCompleted(),i=!1,u++});return new E(c,s)})},h.skipLastWithTime=function(t,e){e||(e=w);var n=this;return new p(function(r){var o=[];return n.subscribe(function(n){var i=e.now();for(o.push({interval:i,value:n});o.length>0&&i-o[0].interval>=t;)r.onNext(o.shift().value)},r.onError.bind(r),function(){for(var n=e.now();o.length>0&&n-o[0].interval>=t;)r.onNext(o.shift().value);r.onCompleted()})})},h.takeLastWithTime=function(t,e,n){return this.takeLastBufferWithTime(t,e).selectMany(function(t){return y(t,n)})},h.takeLastBufferWithTime=function(t,e){var n=this;return e||(e=w),new p(function(r){var o=[];return n.subscribe(function(n){var r=e.now();for(o.push({interval:r,value:n});o.length>0&&r-o[0].interval>=t;)o.shift()},r.onError.bind(r),function(){for(var n=e.now(),i=[];o.length>0;){var s=o.shift();t>=n-s.interval&&i.push(s.value)}r.onNext(i),r.onCompleted()})})},h.takeWithTime=function(t,e){var n=this;return e||(e=w),new p(function(r){var o=e.scheduleWithRelative(t,function(){r.onCompleted()});return new E(o,n.subscribe(r))})},h.skipWithTime=function(t,e){var n=this;return e||(e=w),new p(function(r){var o=!1,i=e.scheduleWithRelative(t,function(){o=!0}),s=n.subscribe(function(t){o&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new E(i,s)})},h.skipUntilWithTime=function(t,e){e||(e=w);var n=this;return new p(function(r){var o=!1,i=e.scheduleWithAbsolute(t,function(){o=!0}),s=n.subscribe(function(t){o&&r.onNext(t)},r.onError.bind(r),r.onCompleted.bind(r));return new E(i,s)})},h.takeUntilWithTime=function(t,e){e||(e=w);var n=this;return new p(function(r){return new E(e.scheduleWithAbsolute(t,function(){r.onCompleted()}),n.subscribe(r))})},n}); \ No newline at end of file diff --git a/rx.virtualtime.min.js b/rx.virtualtime.min.js index d732558ce..fec485f00 100644 --- a/rx.virtualtime.min.js +++ b/rx.virtualtime.min.js @@ -1 +1 @@ -(function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,i=e[typeof module]&&module&&!module.nodeType&&module,o=(i&&i.exports===r&&r,e[typeof global]&&global);!o||o.global!==o&&o.window!==o||(n=o),"function"==typeof define&&define.amd?define(["rx","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n){function r(t,e){return t>e?1:e>t?-1:0}var i=n.Scheduler,o=n.internals.PriorityQueue,s=n.internals.ScheduledItem,u=n.internals.SchedulePeriodicRecursive,c=n.Disposable.empty,a=n.internals.inherits;return n.VirtualTimeScheduler=function(t){function e(){throw Error("Not implemented")}function n(){return this.toDateTimeOffset(this.clock)}function r(t,e){return this.scheduleAbsoluteWithState(t,this.clock,e)}function i(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e),n)}function l(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e-this.now()),n)}function h(t,e){return e(),c}function f(e,s){this.clock=e,this.comparer=s,this.isEnabled=!1,this.queue=new o(1024),t.call(this,n,r,i,l)}a(f,t);var p=f.prototype;return p.add=e,p.toDateTimeOffset=e,p.toRelative=e,p.schedulePeriodicWithState=function(t,e,n){var r=new u(this,t,e,n);return r.start()},p.scheduleRelativeWithState=function(t,e,n){var r=this.add(this.clock,e);return this.scheduleAbsoluteWithState(t,r,n)},p.scheduleRelative=function(t,e){return this.scheduleRelativeWithState(e,t,h)},p.start=function(){var t;if(!this.isEnabled){this.isEnabled=!0;do t=this.getNext(),null!==t?(this.comparer(t.dueTime,this.clock)>0&&(this.clock=t.dueTime),t.invoke()):this.isEnabled=!1;while(this.isEnabled)}},p.stop=function(){this.isEnabled=!1},p.advanceTo=function(t){var e,n=this.comparer(this.clock,t);if(this.comparer(this.clock,t)>0)throw Error(argumentOutOfRange);if(0!==n&&!this.isEnabled){this.isEnabled=!0;do e=this.getNext(),null!==e&&0>=this.comparer(e.dueTime,t)?(this.comparer(e.dueTime,this.clock)>0&&(this.clock=e.dueTime),e.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=t}},p.advanceBy=function(t){var e=this.add(this.clock,t),n=this.comparer(this.clock,e);if(n>0)throw Error(argumentOutOfRange);0!==n&&this.advanceTo(e)},p.sleep=function(t){var e=this.add(this.clock,t);if(this.comparer(this.clock,e)>=0)throw Error(argumentOutOfRange);this.clock=e},p.getNext=function(){for(var t;this.queue.length>0;){if(t=this.queue.peek(),!t.isCancelled())return t;this.queue.dequeue()}return null},p.scheduleAbsolute=function(t,e){return this.scheduleAbsoluteWithState(e,t,h)},p.scheduleAbsoluteWithState=function(t,e,n){var r=this,i=function(t,e){return r.queue.remove(o),n(t,e)},o=new s(r,t,i,e,r.comparer);return r.queue.enqueue(o),o.disposable},f}(i),n.HistoricalScheduler=function(t){function e(e,n){var i=null==e?0:e,o=n||r;t.call(this,i,o)}a(e,t);var n=e.prototype;return n.add=function(t,e){return t+e},n.toDateTimeOffset=function(t){return new Date(t).getTime()},n.toRelative=function(t){return t},e}(n.VirtualTimeScheduler),n}); \ No newline at end of file +(function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,o=e[typeof module]&&module&&!module.nodeType&&module,i=(o&&o.exports===r&&r,e[typeof global]&&global);!i||i.global!==i&&i.window!==i||(n=i),"function"==typeof define&&define.amd?define(["rx","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n){function r(t,e){return t>e?1:e>t?-1:0}var o=n.Scheduler,i=n.internals.PriorityQueue,s=n.internals.ScheduledItem,u=n.internals.SchedulePeriodicRecursive,c=n.Disposable.empty,a=n.internals.inherits;return n.VirtualTimeScheduler=function(t){function e(){throw Error("Not implemented")}function n(){return this.toDateTimeOffset(this.clock)}function r(t,e){return this.scheduleAbsoluteWithState(t,this.clock,e)}function o(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e),n)}function l(t,e,n){return this.scheduleRelativeWithState(t,this.toRelative(e-this.now()),n)}function h(t,e){return e(),c}function f(e,s){this.clock=e,this.comparer=s,this.isEnabled=!1,this.queue=new i(1024),t.call(this,n,r,o,l)}a(f,t);var p=f.prototype;return p.add=e,p.toDateTimeOffset=e,p.toRelative=e,p.schedulePeriodicWithState=function(t,e,n){var r=new u(this,t,e,n);return r.start()},p.scheduleRelativeWithState=function(t,e,n){var r=this.add(this.clock,e);return this.scheduleAbsoluteWithState(t,r,n)},p.scheduleRelative=function(t,e){return this.scheduleRelativeWithState(e,t,h)},p.start=function(){var t;if(!this.isEnabled){this.isEnabled=!0;do t=this.getNext(),null!==t?(this.comparer(t.dueTime,this.clock)>0&&(this.clock=t.dueTime),t.invoke()):this.isEnabled=!1;while(this.isEnabled)}},p.stop=function(){this.isEnabled=!1},p.advanceTo=function(t){var e,n=this.comparer(this.clock,t);if(this.comparer(this.clock,t)>0)throw Error(argumentOutOfRange);if(0!==n&&!this.isEnabled){this.isEnabled=!0;do e=this.getNext(),null!==e&&0>=this.comparer(e.dueTime,t)?(this.comparer(e.dueTime,this.clock)>0&&(this.clock=e.dueTime),e.invoke()):this.isEnabled=!1;while(this.isEnabled);this.clock=t}},p.advanceBy=function(t){var e=this.add(this.clock,t),n=this.comparer(this.clock,e);if(n>0)throw Error(argumentOutOfRange);0!==n&&this.advanceTo(e)},p.sleep=function(t){var e=this.add(this.clock,t);if(this.comparer(this.clock,e)>=0)throw Error(argumentOutOfRange);this.clock=e},p.getNext=function(){for(var t;this.queue.length>0;){if(t=this.queue.peek(),!t.isCancelled())return t;this.queue.dequeue()}return null},p.scheduleAbsolute=function(t,e){return this.scheduleAbsoluteWithState(e,t,h)},p.scheduleAbsoluteWithState=function(t,e,n){var r=this,o=function(t,e){return r.queue.remove(i),n(t,e)},i=new s(r,t,o,e,r.comparer);return r.queue.enqueue(i),i.disposable},f}(o),n.HistoricalScheduler=function(t){function e(e,n){var o=null==e?0:e,i=n||r;t.call(this,o,i)}a(e,t);var n=e.prototype;return n.add=function(t,e){return t+e},n.toDateTimeOffset=function(t){return new Date(t).getTime()},n.toRelative=function(t){return t},e}(n.VirtualTimeScheduler),n}); \ No newline at end of file diff --git a/src/core/basicheader-modern.js b/src/core/basicheader-modern.js index 2df0efc96..232ab511d 100644 --- a/src/core/basicheader-modern.js +++ b/src/core/basicheader-modern.js @@ -1,30 +1,16 @@ - // Defaults - function noop() { } - function identity(x) { return x; } - var defaultNow = Date.now; - function defaultComparer(x, y) { return isEqual(x, y); } - function defaultSubComparer(x, y) { return x - y; } - function defaultKeySerializer(x) { return x.toString(); } - function defaultError(err) { throw err; } - function isPromise(p) { return typeof p.then === 'function'; } + // Defaults + function noop() { } + function identity(x) { return x; } + var defaultNow = Date.now; + function defaultComparer(x, y) { return isEqual(x, y); } + function defaultSubComparer(x, y) { return x - y; } + function defaultKeySerializer(x) { return x.toString(); } + function defaultError(err) { throw err; } + function isPromise(p) { return typeof p.then === 'function' && typeof p.subscribe === 'undefined'; } - // Errors - var sequenceContainsNoElements = 'Sequence contains no elements.'; - var argumentOutOfRange = 'Argument out of range'; - var objectDisposed = 'Object has been disposed'; - function checkDisposed() { - if (this.isDisposed) { - throw new Error(objectDisposed); - } - } - - // Shim in iterator support - var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) || - '_es6shim_iterator_'; - // Firefox ships a partial implementation using the name @@iterator. - // https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14 - // So use that name if we detect it. - if (window.Set && typeof new window.Set()['@@iterator'] === 'function') { - $iterator$ = '@@iterator'; - } - \ No newline at end of file + // Errors + var sequenceContainsNoElements = 'Sequence contains no elements.'; + var argumentOutOfRange = 'Argument out of range'; + var objectDisposed = 'Object has been disposed'; + function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } } + \ No newline at end of file diff --git a/src/core/basicheader.js b/src/core/basicheader.js index 98e5fd322..20052d813 100644 --- a/src/core/basicheader.js +++ b/src/core/basicheader.js @@ -1,30 +1,15 @@ - // Defaults - function noop() { } - function identity(x) { return x; } - var defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()); - function defaultComparer(x, y) { return isEqual(x, y); } - function defaultSubComparer(x, y) { return x - y; } - function defaultKeySerializer(x) { return x.toString(); } - function defaultError(err) { throw err; } - function isPromise(p) { return typeof p.then === 'function'; } + // Defaults + function noop() { } + function identity(x) { return x; } + var defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()); + function defaultComparer(x, y) { return isEqual(x, y); } + function defaultSubComparer(x, y) { return x - y; } + function defaultKeySerializer(x) { return x.toString(); } + function defaultError(err) { throw err; } + function isPromise(p) { return typeof p.then === 'function' && typeof p.subscribe === 'undefined'; } - // Errors - var sequenceContainsNoElements = 'Sequence contains no elements.'; - var argumentOutOfRange = 'Argument out of range'; - var objectDisposed = 'Object has been disposed'; - function checkDisposed() { - if (this.isDisposed) { - throw new Error(objectDisposed); - } - } - - // Shim in iterator support - var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) || - '_es6shim_iterator_'; - // Firefox ships a partial implementation using the name @@iterator. - // https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14 - // So use that name if we detect it. - if (window.Set && typeof new window.Set()['@@iterator'] === 'function') { - $iterator$ = '@@iterator'; - } - \ No newline at end of file + // Errors + var sequenceContainsNoElements = 'Sequence contains no elements.'; + var argumentOutOfRange = 'Argument out of range'; + var objectDisposed = 'Object has been disposed'; + function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } } diff --git a/src/core/enumeratorheader.js b/src/core/enumeratorheader.js new file mode 100644 index 000000000..d04226af9 --- /dev/null +++ b/src/core/enumeratorheader.js @@ -0,0 +1,10 @@ + // Shim in iterator support + var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) || + '_es6shim_iterator_'; + // Firefox ships a partial implementation using the name @@iterator. + // https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14 + // So use that name if we detect it. + if (root.Set && typeof new root.Set()['@@iterator'] === 'function') { + $iterator$ = '@@iterator'; + } + var doneEnumerator = { done: true, value: undefined }; diff --git a/src/core/experimentalheader.js b/src/core/experimentalheader.js index 2ab390a47..4fd6d45e9 100644 --- a/src/core/experimentalheader.js +++ b/src/core/experimentalheader.js @@ -1,29 +1,29 @@ - // Aliases - var Observable = Rx.Observable, - observableProto = Observable.prototype, - AnonymousObservable = Rx.AnonymousObservable, - observableConcat = Observable.concat, - observableDefer = Observable.defer, - observableEmpty = Observable.empty, - disposableEmpty = Rx.Disposable.empty, - CompositeDisposable = Rx.CompositeDisposable, - SerialDisposable = Rx.SerialDisposable, - SingleAssignmentDisposable = Rx.SingleAssignmentDisposable, - enumeratorCreate = Rx.internals.Enumerator.create, - Enumerable = Rx.internals.Enumerable, - enumerableForEach = Enumerable.forEach, - immediateScheduler = Rx.Scheduler.immediate, - currentThreadScheduler = Rx.Scheduler.currentThread, - slice = Array.prototype.slice, - AsyncSubject = Rx.AsyncSubject, - Observer = Rx.Observer, - inherits = Rx.internals.inherits, - addProperties = Rx.internals.addProperties; + // Aliases + var Observable = Rx.Observable, + observableProto = Observable.prototype, + AnonymousObservable = Rx.AnonymousObservable, + observableConcat = Observable.concat, + observableDefer = Observable.defer, + observableEmpty = Observable.empty, + disposableEmpty = Rx.Disposable.empty, + CompositeDisposable = Rx.CompositeDisposable, + SerialDisposable = Rx.SerialDisposable, + SingleAssignmentDisposable = Rx.SingleAssignmentDisposable, + Enumerator = Rx.internals.Enumerator, + Enumerable = Rx.internals.Enumerable, + enumerableForEach = Enumerable.forEach, + immediateScheduler = Rx.Scheduler.immediate, + currentThreadScheduler = Rx.Scheduler.currentThread, + slice = Array.prototype.slice, + AsyncSubject = Rx.AsyncSubject, + Observer = Rx.Observer, + inherits = Rx.internals.inherits, + addProperties = Rx.internals.addProperties; - // Utilities - function nothing () { } - function argsOrArray(args, idx) { - return args.length === 1 && Array.isArray(args[idx]) ? - args[idx] : - slice.call(args); - } + // Utilities + function nothing () { } + function argsOrArray(args, idx) { + return args.length === 1 && Array.isArray(args[idx]) ? + args[idx] : + slice.call(args); + } diff --git a/src/core/internal/enumerable.js b/src/core/internal/enumerable.js index 3d4a7552c..b53487124 100644 --- a/src/core/internal/enumerable.js +++ b/src/core/internal/enumerable.js @@ -1,121 +1,127 @@ - var Enumerable = Rx.internals.Enumerable = function (getEnumerator) { - this.getEnumerator = getEnumerator; - }; + var Enumerable = Rx.internals.Enumerable = function (iterator) { + this._iterator = iterator; + }; - Enumerable.prototype.concat = function () { - var sources = this; - return new AnonymousObservable(function (observer) { - var e = sources.getEnumerator(), isDisposed, subscription = new SerialDisposable(); - var cancelable = immediateScheduler.scheduleRecursive(function (self) { - var current, hasNext; - if (isDisposed) { return; } + Enumerable.prototype[$iterator$] = function () { + return this._iterator(); + }; - try { - hasNext = e.moveNext(); - if (hasNext) { - current = e.getCurrent(); - } - } catch (ex) { - observer.onError(ex); - return; - } + Enumerable.prototype.concat = function () { + var sources = this; + return new AnonymousObservable(function (observer) { + var e; + try { + e = sources[$iterator$](); + } catch(err) { + observer.onError(); + return; + } - if (!hasNext) { - observer.onCompleted(); - return; - } + var isDisposed, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursive(function (self) { + var currentItem; + if (isDisposed) { return; } - var d = new SingleAssignmentDisposable(); - subscription.setDisposable(d); - d.setDisposable(current.subscribe( - observer.onNext.bind(observer), - observer.onError.bind(observer), - function () { self(); }) - ); - }); - return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { - isDisposed = true; - })); - }); - }; + try { + currentItem = e.next(); + } catch (ex) { + observer.onError(ex); + return; + } - Enumerable.prototype.catchException = function () { - var sources = this; - return new AnonymousObservable(function (observer) { - var e = sources.getEnumerator(), isDisposed, lastException; - var subscription = new SerialDisposable(); - var cancelable = immediateScheduler.scheduleRecursive(function (self) { - var current, hasNext; - if (isDisposed) { return; } + if (currentItem.done) { + observer.onCompleted(); + return; + } - try { - hasNext = e.moveNext(); - if (hasNext) { - current = e.getCurrent(); - } - } catch (ex) { - observer.onError(ex); - return; - } + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(currentItem.value.subscribe( + observer.onNext.bind(observer), + observer.onError.bind(observer), + function () { self(); }) + ); + }); - if (!hasNext) { - if (lastException) { - observer.onError(lastException); - } else { - observer.onCompleted(); - } - return; - } + return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { + isDisposed = true; + })); + }); + }; - var d = new SingleAssignmentDisposable(); - subscription.setDisposable(d); - d.setDisposable(current.subscribe( - observer.onNext.bind(observer), - function (exn) { - lastException = exn; - self(); - }, - observer.onCompleted.bind(observer))); - }); - return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { - isDisposed = true; - })); - }); - }; + Enumerable.prototype.catchException = function () { + var sources = this; + return new AnonymousObservable(function (observer) { + var e; + try { + e = sources[$iterator$](); + } catch(err) { + observer.onError(); + return; + } + var isDisposed, + lastException, + subscription = new SerialDisposable(); + var cancelable = immediateScheduler.scheduleRecursive(function (self) { + if (isDisposed) { return; } - var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) { - if (arguments.length === 1) { - repeatCount = -1; + var currentItem; + try { + currentItem = e.next(); + } catch (ex) { + observer.onError(ex); + return; } - return new Enumerable(function () { - var current, left = repeatCount; - return enumeratorCreate(function () { - if (left === 0) { - return false; - } - if (left > 0) { - left--; - } - current = value; - return true; - }, function () { return current; }); - }); - }; - var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) { - selector || (selector = identity); - return new Enumerable(function () { - var current, index = -1; - return enumeratorCreate( - function () { - if (++index < source.length) { - current = selector.call(thisArg, source[index], index, source); - return true; - } - return false; - }, - function () { return current; } - ); + if (currentItem.done) { + if (lastException) { + observer.onError(lastException); + } else { + observer.onCompleted(); + } + return; + } + + var d = new SingleAssignmentDisposable(); + subscription.setDisposable(d); + d.setDisposable(currentItem.value.subscribe( + observer.onNext.bind(observer), + function (exn) { + lastException = exn; + self(); + }, + observer.onCompleted.bind(observer))); + }); + return new CompositeDisposable(subscription, cancelable, disposableCreate(function () { + isDisposed = true; + })); + }); + }; + + + var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) { + if (repeatCount == null) { repeatCount = -1; } + return new Enumerable(function () { + var left = repeatCount; + return new Enumerator(function () { + if (left === 0) { return doneEnumerator; } + if (left > 0) { left--; } + return { done: false, value: value }; + }); + }); + }; + + var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) { + selector || (selector = identity); + return new Enumerable(function () { + var index = -1; + return new Enumerator( + function () { + return ++index < source.length ? + { done: false, value: selector.call(thisArg, source[index], index, source) } : + doneEnumerator; }); - }; + }); + }; diff --git a/src/core/internal/enumerator.js b/src/core/internal/enumerator.js index 0621c166a..d374a6db8 100644 --- a/src/core/internal/enumerator.js +++ b/src/core/internal/enumerator.js @@ -1,28 +1,9 @@ - /** - * @constructor - * @private - */ - var Enumerator = Rx.internals.Enumerator = function (moveNext, getCurrent) { - this.moveNext = moveNext; - this.getCurrent = getCurrent; - }; + var Enumerator = Rx.internals.Enumerator = function (next) { + this._next = next; + }; - /** - * @static - * @memberOf Enumerator - * @private - */ - var enumeratorCreate = Enumerator.create = function (moveNext, getCurrent) { - var done = false; - return new Enumerator(function () { - if (done) { - return false; - } - var result = moveNext(); - if (!result) { - done = true; - } - return result; - }, function () { return getCurrent(); }); - }; - \ No newline at end of file + Enumerator.prototype.next = function () { + return this._next(); + }; + + Enumerator.prototype[$iterator$] = function () { return this; } diff --git a/src/core/linq/enumerable/while.js b/src/core/linq/enumerable/while.js index ee8fca5ca..e27ab910e 100644 --- a/src/core/linq/enumerable/while.js +++ b/src/core/linq/enumerable/while.js @@ -1,12 +1,9 @@ - function enumerableWhile(condition, source) { - return new Enumerable(function () { - var current; - return enumeratorCreate(function () { - if (condition()) { - current = source; - return true; - } - return false; - }, function () { return current; }); - }); - } + function enumerableWhile(condition, source) { + return new Enumerable(function () { + return new Enumerator(function () { + return condition() ? + { done: false, value: source } : + { done: true, value: undefined }; + }); + }); + } diff --git a/src/core/liteheader-compat.js b/src/core/liteheader-compat.js index 9f633dd32..31a722149 100644 --- a/src/core/liteheader-compat.js +++ b/src/core/liteheader-compat.js @@ -1,30 +1,16 @@ - // Defaults - function noop() { } - function identity(x) { return x; } - var defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()); - function defaultComparer(x, y) { return isEqual(x, y); } - function defaultSubComparer(x, y) { return x - y; } - function defaultKeySerializer(x) { return x.toString(); } - function defaultError(err) { throw err; } - function isPromise(p) { return typeof p.then === 'function'; } + // Defaults + function noop() { } + function identity(x) { return x; } + var defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()); + function defaultComparer(x, y) { return isEqual(x, y); } + function defaultSubComparer(x, y) { return x - y; } + function defaultKeySerializer(x) { return x.toString(); } + function defaultError(err) { throw err; } + function isPromise(p) { return typeof p.then === 'function' && typeof p.subscribe === 'undefined'; } - // Errors - var sequenceContainsNoElements = 'Sequence contains no elements.'; - var argumentOutOfRange = 'Argument out of range'; - var objectDisposed = 'Object has been disposed'; - function checkDisposed() { - if (this.isDisposed) { - throw new Error(objectDisposed); - } - } - - // Shim in iterator support - var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) || - '_es6shim_iterator_'; - // Firefox ships a partial implementation using the name @@iterator. - // https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14 - // So use that name if we detect it. - if (window.Set && typeof new window.Set()['@@iterator'] === 'function') { - $iterator$ = '@@iterator'; - } - \ No newline at end of file + // Errors + var sequenceContainsNoElements = 'Sequence contains no elements.'; + var argumentOutOfRange = 'Argument out of range'; + var objectDisposed = 'Object has been disposed'; + function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } } + \ No newline at end of file diff --git a/src/core/liteheader.js b/src/core/liteheader.js index dedc88a87..6b508d754 100644 --- a/src/core/liteheader.js +++ b/src/core/liteheader.js @@ -1,29 +1,15 @@ - // Defaults - function noop() { } - function identity(x) { return x; } - var defaultNow = Date.now; - function defaultComparer(x, y) { return isEqual(x, y); } - function defaultSubComparer(x, y) { return x - y; } - function defaultKeySerializer(x) { return x.toString(); } - function defaultError(err) { throw err; } - function isPromise(p) { return typeof p.then === 'function'; } + // Defaults + function noop() { } + function identity(x) { return x; } + var defaultNow = Date.now; + function defaultComparer(x, y) { return isEqual(x, y); } + function defaultSubComparer(x, y) { return x - y; } + function defaultKeySerializer(x) { return x.toString(); } + function defaultError(err) { throw err; } + function isPromise(p) { return typeof p.then === 'function' && typeof p.subscribe === 'undefined'; } - // Errors - var sequenceContainsNoElements = 'Sequence contains no elements.'; - var argumentOutOfRange = 'Argument out of range'; - var objectDisposed = 'Object has been disposed'; - function checkDisposed() { - if (this.isDisposed) { - throw new Error(objectDisposed); - } - } - - // Shim in iterator support - var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) || - '_es6shim_iterator_'; - // Firefox ships a partial implementation using the name @@iterator. - // https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14 - // So use that name if we detect it. - if (window.Set && typeof new window.Set()['@@iterator'] === 'function') { - $iterator$ = '@@iterator'; - } + // Errors + var sequenceContainsNoElements = 'Sequence contains no elements.'; + var argumentOutOfRange = 'Argument out of range'; + var objectDisposed = 'Object has been disposed'; + function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } }