Socket
Socket
Sign inDemoInstall

rx

Package Overview
Dependencies
0
Maintainers
2
Versions
103
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.5.2 to 2.5.3

src/core/perf/observerbase.js

37

bower.json
{
"name": "rxjs",
"version": "2.5.2",
"version": "2.5.3",
"main": [
"dist/rx.all.js",
"dist/rx.all.map",
"dist/rx.all.min.js",
"dist/rx.all.compat.js",
"dist/rx.all.compat.map",
"dist/rx.all.compat.min.js",
"dist/rx.js",
"dist/rx.map",
"dist/rx.min.js",
"dist/rx.compat.js",
"dist/rx.compat.map",
"dist/rx.compat.min.js",
"dist/rx.aggregates.js",
"dist/rx.aggregates.map",
"dist/rx.aggregates.min.js",
"dist/rx.async.js",
"dist/rx.async.map",
"dist/rx.async.min.js",
"dist/rx.async.compat.js",
"dist/rx.async.compat.map",
"dist/rx.async.compat.min.js",
"dist/rx.backpressure.js",
"dist/rx.backpressure.map",
"dist/rx.backpressure.min.js",
"dist/rx.binding.js",
"dist/rx.binding.map",
"dist/rx.binding.min.js",
"dist/rx.coincidence.js",
"dist/rx.coincidence.map",
"dist/rx.coincidence.min.js",
"dist/rx.experimental.js",
"dist/rx.experimental.map",
"dist/rx.experimental.min.js",
"dist/rx.lite.js",
"dist/rx.lite.map",
"dist/rx.lite.min.js",
"dist/rx.lite.compat.js",
"dist/rx.lite.compat.map",
"dist/rx.lite.compat.min.js",
"dist/rx.joinpatterns.js",
"dist/rx.joinpatterns.map",
"dist/rx.joinpatterns.min.js",
"dist/rx.testing.js",
"dist/rx.testing.map",
"dist/rx.testing.min.js",
"dist/rx.time.js",
"dist/rx.time.map",
"dist/rx.time.min.js",
"dist/rx.virtualtime.js",
"dist/rx.virtualtime.map",
"dist/rx.virtualtime.min.js"
],
"ignore": [
".sh",
".*",

@@ -59,0 +26,0 @@ "*.bat",

@@ -51,2 +51,3 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

isIterable = helpers.isIterable,
inherits = Rx.internals.inherits,
observableFromPromise = Observable.fromPromise,

@@ -56,4 +57,24 @@ observableFrom = Observable.from,

EmptyError = Rx.EmptyError,
ObservableBase = Rx.ObservableBase,
ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError;
var errorObj = {e: {}};
var tryCatchTarget;
function tryCatcher() {
try {
return tryCatchTarget.apply(this, arguments);
} catch (e) {
errorObj.e = e;
return errorObj;
}
}
function tryCatch(fn) {
if (!isFunction(fn)) { throw new TypeError('fn must be a function'); }
tryCatchTarget = fn;
return tryCatcher;
}
function thrower(e) {
throw e;
}
function extremaBy(source, keySelector, comparer) {

@@ -143,40 +164,76 @@ return new AnonymousObservable(function (o) {

var ReduceObservable = (function(__super__) {
inherits(ReduceObservable, __super__);
function ReduceObservable(source, acc, hasSeed, seed) {
this.source = source;
this.acc = acc;
this.hasSeed = hasSeed;
this.seed = seed;
__super__.call(this);
}
ReduceObservable.prototype.subscribeCore = function(observer) {
return this.source.subscribe(new InnerObserver(observer,this));
};
function InnerObserver(o, parent) {
this.o = o;
this.acc = parent.acc;
this.hasSeed = parent.hasSeed;
this.seed = parent.seed;
this.hasAccumulation = false;
this.result = null;
this.hasValue = false;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) {
if (this.isStopped) { return; }
!this.hasValue && (this.hasValue = true);
if (this.hasAccumulation) {
this.result = tryCatch(this.acc)(this.result, x);
} else {
this.result = this.hasSeed ? tryCatch(this.acc)(this.seed, x) : x;
this.hasAccumulation = true;
}
if (this.result === errorObj) { this.o.onError(this.result.e); }
};
InnerObserver.prototype.onError = function (e) {
if (!this.isStopped) { this.isStopped = true; this.o.onError(e); }
};
InnerObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.hasValue && this.o.onNext(this.result);
!this.hasValue && this.hasSeed && this.o.onNext(this.seed);
!this.hasValue && !this.hasSeed && this.o.onError(new EmptyError());
this.o.onCompleted();
}
};
InnerObserver.prototype.dispose = function () { this.isStopped = true; };
InnerObserver.prototype.fail = function(e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
return ReduceObservable;
}(ObservableBase));
/**
* Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
* For aggregation behavior with incremental intermediate results, see Observable.scan.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @param {Any} [seed] The initial accumulator value.
* @returns {Observable} An observable sequence containing a single element with the final accumulator value.
*/
* Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
* For aggregation behavior with incremental intermediate results, see Observable.scan.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @param {Any} [seed] The initial accumulator value.
* @returns {Observable} An observable sequence containing a single element with the final accumulator value.
*/
observableProto.reduce = function (accumulator) {
var hasSeed = false, seed, source = this;
var hasSeed = false;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[1];
var seed = arguments[1];
}
return new AnonymousObservable(function (o) {
var hasAccumulation, accumulation, hasValue;
return source.subscribe (
function (x) {
!hasValue && (hasValue = true);
try {
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
} catch (e) {
return o.onError(e);
}
},
function (e) { o.onError(e); },
function () {
hasValue && o.onNext(accumulation);
!hasValue && hasSeed && o.onNext(seed);
!hasValue && !hasSeed && o.onError(new EmptyError());
o.onCompleted();
}
);
}, source);
return new ReduceObservable(this, accumulator, hasSeed, seed);
};

@@ -183,0 +240,0 @@

/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b,c){return new o(function(d){var e=!1,f=null,g=[];return a.subscribe(function(a){var h,i;try{i=b(a)}catch(j){return void d.onError(j)}if(h=0,e)try{h=c(i,f)}catch(k){return void d.onError(k)}else e=!0,f=i;h>0&&(f=i,g=[]),h>=0&&g.push(a)},function(a){d.onError(a)},function(){d.onNext(g),d.onCompleted()})},a)}function f(a){if(0===a.length)throw new C;return a[0]}function g(a,b,c,d){if(0>b)throw new D;return new o(function(e){var f=b;return a.subscribe(function(a){0===f--&&(e.onNext(a),e.onCompleted())},function(a){e.onError(a)},function(){c?(e.onNext(d),e.onCompleted()):e.onError(new D)})},a)}function h(a,b,c){return new o(function(d){var e=c,f=!1;return a.subscribe(function(a){f?d.onError(new Error("Sequence contains more than one element")):(e=a,f=!0)},function(a){d.onError(a)},function(){f||b?(d.onNext(e),d.onCompleted()):d.onError(new C)})},a)}function i(a,b,c){return new o(function(d){return a.subscribe(function(a){d.onNext(a),d.onCompleted()},function(a){d.onError(a)},function(){b?(d.onNext(c),d.onCompleted()):d.onError(new C)})},a)}function j(a,b,c){return new o(function(d){var e=c,f=!1;return a.subscribe(function(a){e=a,f=!0},function(a){d.onError(a)},function(){f||b?(d.onNext(e),d.onCompleted()):d.onError(new C)})},a)}function k(a,b,c,e){var f=B(b,c,3);return new o(function(b){var c=0;return a.subscribe(function(d){var g;try{g=f(d,c,a)}catch(h){return void b.onError(h)}g?(b.onNext(e?c:d),b.onCompleted()):c++},function(a){b.onError(a)},function(){b.onNext(e?-1:d),b.onCompleted()})},a)}var l=c.Observable,m=l.prototype,n=c.CompositeDisposable,o=c.AnonymousObservable,p=c.Disposable.empty,q=(c.internals.isEqual,c.helpers),r=q.not,s=q.defaultComparer,t=q.identity,u=q.defaultSubComparer,v=q.isFunction,w=q.isPromise,x=q.isArrayLike,y=q.isIterable,z=l.fromPromise,A=l.from,B=c.internals.bindCallback,C=c.EmptyError,D=c.ArgumentOutOfRangeError;return m.aggregate=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,b=arguments[0],a=arguments[1]):a=arguments[0],new o(function(e){var f,g,h;return d.subscribe(function(d){!h&&(h=!0);try{f?g=a(g,d):(g=c?a(b,d):d,f=!0)}catch(i){return e.onError(i)}},function(a){e.onError(a)},function(){h&&e.onNext(g),!h&&c&&e.onNext(b),!h&&!c&&e.onError(new C),e.onCompleted()})},d)},m.reduce=function(a){var b,c=!1,d=this;return 2===arguments.length&&(c=!0,b=arguments[1]),new o(function(e){var f,g,h;return d.subscribe(function(d){!h&&(h=!0);try{f?g=a(g,d):(g=c?a(b,d):d,f=!0)}catch(i){return e.onError(i)}},function(a){e.onError(a)},function(){h&&e.onNext(g),!h&&c&&e.onNext(b),!h&&!c&&e.onError(new C),e.onCompleted()})},d)},m.some=function(a,b){var c=this;return a?c.filter(a,b).some():new o(function(a){return c.subscribe(function(){a.onNext(!0),a.onCompleted()},function(b){a.onError(b)},function(){a.onNext(!1),a.onCompleted()})},c)},m.any=function(){return this.some.apply(this,arguments)},m.isEmpty=function(){return this.any().map(r)},m.every=function(a,b){return this.filter(function(b){return!a(b)},b).some().map(r)},m.all=function(){return this.every.apply(this,arguments)},m.includes=function(a,b){function c(a,b){return 0===a&&0===b||a===b||isNaN(a)&&isNaN(b)}var d=this;return new o(function(e){var f=0,g=+b||0;return Math.abs(g)===1/0&&(g=0),0>g?(e.onNext(!1),e.onCompleted(),p):d.subscribe(function(b){f++>=g&&c(b,a)&&(e.onNext(!0),e.onCompleted())},function(a){e.onError(a)},function(){e.onNext(!1),e.onCompleted()})},this)},m.contains=function(a,b){m.includes(a,b)},m.count=function(a,b){return a?this.filter(a,b).count():this.reduce(function(a){return a+1},0)},m.indexOf=function(a,b){var c=this;return new o(function(d){var e=0,f=+b||0;return Math.abs(f)===1/0&&(f=0),0>f?(d.onNext(-1),d.onCompleted(),p):c.subscribe(function(b){e>=f&&b===a&&(d.onNext(e),d.onCompleted()),e++},function(a){d.onError(a)},function(){d.onNext(-1),d.onCompleted()})},c)},m.sum=function(a,b){return a&&v(a)?this.map(a,b).sum():this.reduce(function(a,b){return a+b},0)},m.minBy=function(a,b){return b||(b=u),e(this,a,function(a,c){return-1*b(a,c)})},m.min=function(a){return this.minBy(t,a).map(function(a){return f(a)})},m.maxBy=function(a,b){return b||(b=u),e(this,a,b)},m.max=function(a){return this.maxBy(t,a).map(function(a){return f(a)})},m.average=function(a,b){return a&&v(a)?this.map(a,b).average():this.reduce(function(a,b){return{sum:a.sum+b,count:a.count+1}},{sum:0,count:0}).map(function(a){if(0===a.count)throw new C;return a.sum/a.count})},m.sequenceEqual=function(a,b){var c=this;return b||(b=s),new o(function(d){var e=!1,f=!1,g=[],h=[],i=c.subscribe(function(a){var c,e;if(h.length>0){e=h.shift();try{c=b(e,a)}catch(i){return void d.onError(i)}c||(d.onNext(!1),d.onCompleted())}else f?(d.onNext(!1),d.onCompleted()):g.push(a)},function(a){d.onError(a)},function(){e=!0,0===g.length&&(h.length>0?(d.onNext(!1),d.onCompleted()):f&&(d.onNext(!0),d.onCompleted()))});(x(a)||y(a))&&(a=A(a)),w(a)&&(a=z(a));var j=a.subscribe(function(a){var c;if(g.length>0){var f=g.shift();try{c=b(f,a)}catch(i){return void d.onError(i)}c||(d.onNext(!1),d.onCompleted())}else e?(d.onNext(!1),d.onCompleted()):h.push(a)},function(a){d.onError(a)},function(){f=!0,0===h.length&&(g.length>0?(d.onNext(!1),d.onCompleted()):e&&(d.onNext(!0),d.onCompleted()))});return new n(i,j)},c)},m.elementAt=function(a){return g(this,a,!1)},m.elementAtOrDefault=function(a,b){return g(this,a,!0,b)},m.single=function(a,b){return a&&v(a)?this.where(a,b).single():h(this,!1)},m.singleOrDefault=function(a,b,c){return a&&v(a)?this.filter(a,c).singleOrDefault(null,b):h(this,!0,b)},m.first=function(a,b){return a?this.where(a,b).first():i(this,!1)},m.firstOrDefault=function(a,b){return a?this.where(a).firstOrDefault(null,b):i(this,!0,b)},m.last=function(a,b){return a?this.where(a,b).last():j(this,!1)},m.lastOrDefault=function(a,b,c){return a?this.where(a,c).lastOrDefault(null,b):j(this,!0,b)},m.find=function(a,b){return k(this,a,b,!1)},m.findIndex=function(a,b){return k(this,a,b,!0)},m.toSet=function(){if("undefined"==typeof a.Set)throw new TypeError;var b=this;return new o(function(c){var d=new a.Set;return b.subscribe(function(a){d.add(a)},function(a){c.onError(a)},function(){c.onNext(d),c.onCompleted()})},b)},m.toMap=function(b,c){if("undefined"==typeof a.Map)throw new TypeError;var d=this;return new o(function(e){var f=new a.Map;return d.subscribe(function(a){var d;try{d=b(a)}catch(g){return void e.onError(g)}var h=a;if(c)try{h=c(a)}catch(g){return void e.onError(g)}f.set(d,h)},function(a){e.onError(a)},function(){e.onNext(f),e.onCompleted()})},d)},c});
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(){try{return n.apply(this,arguments)}catch(a){return J.e=a,J}}function f(a){if(!y(a))throw new TypeError("fn must be a function");return n=a,e}function g(a,b,c){return new r(function(d){var e=!1,f=null,g=[];return a.subscribe(function(a){var h,i;try{i=b(a)}catch(j){return void d.onError(j)}if(h=0,e)try{h=c(i,f)}catch(k){return void d.onError(k)}else e=!0,f=i;h>0&&(f=i,g=[]),h>=0&&g.push(a)},function(a){d.onError(a)},function(){d.onNext(g),d.onCompleted()})},a)}function h(a){if(0===a.length)throw new G;return a[0]}function i(a,b,c,d){if(0>b)throw new I;return new r(function(e){var f=b;return a.subscribe(function(a){0===f--&&(e.onNext(a),e.onCompleted())},function(a){e.onError(a)},function(){c?(e.onNext(d),e.onCompleted()):e.onError(new I)})},a)}function j(a,b,c){return new r(function(d){var e=c,f=!1;return a.subscribe(function(a){f?d.onError(new Error("Sequence contains more than one element")):(e=a,f=!0)},function(a){d.onError(a)},function(){f||b?(d.onNext(e),d.onCompleted()):d.onError(new G)})},a)}function k(a,b,c){return new r(function(d){return a.subscribe(function(a){d.onNext(a),d.onCompleted()},function(a){d.onError(a)},function(){b?(d.onNext(c),d.onCompleted()):d.onError(new G)})},a)}function l(a,b,c){return new r(function(d){var e=c,f=!1;return a.subscribe(function(a){e=a,f=!0},function(a){d.onError(a)},function(){f||b?(d.onNext(e),d.onCompleted()):d.onError(new G)})},a)}function m(a,b,c,e){var f=F(b,c,3);return new r(function(b){var c=0;return a.subscribe(function(d){var g;try{g=f(d,c,a)}catch(h){return void b.onError(h)}g?(b.onNext(e?c:d),b.onCompleted()):c++},function(a){b.onError(a)},function(){b.onNext(e?-1:d),b.onCompleted()})},a)}var n,o=c.Observable,p=o.prototype,q=c.CompositeDisposable,r=c.AnonymousObservable,s=c.Disposable.empty,t=(c.internals.isEqual,c.helpers),u=t.not,v=t.defaultComparer,w=t.identity,x=t.defaultSubComparer,y=t.isFunction,z=t.isPromise,A=t.isArrayLike,B=t.isIterable,C=c.internals.inherits,D=o.fromPromise,E=o.from,F=c.internals.bindCallback,G=c.EmptyError,H=c.ObservableBase,I=c.ArgumentOutOfRangeError,J={e:{}};p.aggregate=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,b=arguments[0],a=arguments[1]):a=arguments[0],new r(function(e){var f,g,h;return d.subscribe(function(d){!h&&(h=!0);try{f?g=a(g,d):(g=c?a(b,d):d,f=!0)}catch(i){return e.onError(i)}},function(a){e.onError(a)},function(){h&&e.onNext(g),!h&&c&&e.onNext(b),!h&&!c&&e.onError(new G),e.onCompleted()})},d)};var K=function(a){function b(b,c,d,e){this.source=b,this.acc=c,this.hasSeed=d,this.seed=e,a.call(this)}function c(a,b){this.o=a,this.acc=b.acc,this.hasSeed=b.hasSeed,this.seed=b.seed,this.hasAccumulation=!1,this.result=null,this.hasValue=!1,this.isStopped=!1}return C(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new c(a,this))},c.prototype.onNext=function(a){this.isStopped||(!this.hasValue&&(this.hasValue=!0),this.hasAccumulation?this.result=f(this.acc)(this.result,a):(this.result=this.hasSeed?f(this.acc)(this.seed,a):a,this.hasAccumulation=!0),this.result===J&&this.o.onError(this.result.e))},c.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},c.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.hasValue&&this.o.onNext(this.result),!this.hasValue&&this.hasSeed&&this.o.onNext(this.seed),!this.hasValue&&!this.hasSeed&&this.o.onError(new G),this.o.onCompleted())},c.prototype.dispose=function(){this.isStopped=!0},c.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},b}(H);return p.reduce=function(a){var b=!1;if(2===arguments.length){b=!0;var c=arguments[1]}return new K(this,a,b,c)},p.some=function(a,b){var c=this;return a?c.filter(a,b).some():new r(function(a){return c.subscribe(function(){a.onNext(!0),a.onCompleted()},function(b){a.onError(b)},function(){a.onNext(!1),a.onCompleted()})},c)},p.any=function(){return this.some.apply(this,arguments)},p.isEmpty=function(){return this.any().map(u)},p.every=function(a,b){return this.filter(function(b){return!a(b)},b).some().map(u)},p.all=function(){return this.every.apply(this,arguments)},p.includes=function(a,b){function c(a,b){return 0===a&&0===b||a===b||isNaN(a)&&isNaN(b)}var d=this;return new r(function(e){var f=0,g=+b||0;return Math.abs(g)===1/0&&(g=0),0>g?(e.onNext(!1),e.onCompleted(),s):d.subscribe(function(b){f++>=g&&c(b,a)&&(e.onNext(!0),e.onCompleted())},function(a){e.onError(a)},function(){e.onNext(!1),e.onCompleted()})},this)},p.contains=function(a,b){p.includes(a,b)},p.count=function(a,b){return a?this.filter(a,b).count():this.reduce(function(a){return a+1},0)},p.indexOf=function(a,b){var c=this;return new r(function(d){var e=0,f=+b||0;return Math.abs(f)===1/0&&(f=0),0>f?(d.onNext(-1),d.onCompleted(),s):c.subscribe(function(b){e>=f&&b===a&&(d.onNext(e),d.onCompleted()),e++},function(a){d.onError(a)},function(){d.onNext(-1),d.onCompleted()})},c)},p.sum=function(a,b){return a&&y(a)?this.map(a,b).sum():this.reduce(function(a,b){return a+b},0)},p.minBy=function(a,b){return b||(b=x),g(this,a,function(a,c){return-1*b(a,c)})},p.min=function(a){return this.minBy(w,a).map(function(a){return h(a)})},p.maxBy=function(a,b){return b||(b=x),g(this,a,b)},p.max=function(a){return this.maxBy(w,a).map(function(a){return h(a)})},p.average=function(a,b){return a&&y(a)?this.map(a,b).average():this.reduce(function(a,b){return{sum:a.sum+b,count:a.count+1}},{sum:0,count:0}).map(function(a){if(0===a.count)throw new G;return a.sum/a.count})},p.sequenceEqual=function(a,b){var c=this;return b||(b=v),new r(function(d){var e=!1,f=!1,g=[],h=[],i=c.subscribe(function(a){var c,e;if(h.length>0){e=h.shift();try{c=b(e,a)}catch(i){return void d.onError(i)}c||(d.onNext(!1),d.onCompleted())}else f?(d.onNext(!1),d.onCompleted()):g.push(a)},function(a){d.onError(a)},function(){e=!0,0===g.length&&(h.length>0?(d.onNext(!1),d.onCompleted()):f&&(d.onNext(!0),d.onCompleted()))});(A(a)||B(a))&&(a=E(a)),z(a)&&(a=D(a));var j=a.subscribe(function(a){var c;if(g.length>0){var f=g.shift();try{c=b(f,a)}catch(i){return void d.onError(i)}c||(d.onNext(!1),d.onCompleted())}else e?(d.onNext(!1),d.onCompleted()):h.push(a)},function(a){d.onError(a)},function(){f=!0,0===h.length&&(g.length>0?(d.onNext(!1),d.onCompleted()):e&&(d.onNext(!0),d.onCompleted()))});return new q(i,j)},c)},p.elementAt=function(a){return i(this,a,!1)},p.elementAtOrDefault=function(a,b){return i(this,a,!0,b)},p.single=function(a,b){return a&&y(a)?this.where(a,b).single():j(this,!1)},p.singleOrDefault=function(a,b,c){return a&&y(a)?this.filter(a,c).singleOrDefault(null,b):j(this,!0,b)},p.first=function(a,b){return a?this.where(a,b).first():k(this,!1)},p.firstOrDefault=function(a,b,c){return a?this.where(a).firstOrDefault(null,b):k(this,!0,b)},p.last=function(a,b){return a?this.where(a,b).last():l(this,!1)},p.lastOrDefault=function(a,b,c){return a?this.where(a,c).lastOrDefault(null,b):l(this,!0,b)},p.find=function(a,b){return m(this,a,b,!1)},p.findIndex=function(a,b){return m(this,a,b,!0)},p.toSet=function(){if("undefined"==typeof a.Set)throw new TypeError;var b=this;return new r(function(c){var d=new a.Set;return b.subscribe(function(a){d.add(a)},function(a){c.onError(a)},function(){c.onNext(d),c.onCompleted()})},b)},p.toMap=function(b,c){if("undefined"==typeof a.Map)throw new TypeError;var d=this;return new r(function(e){var f=new a.Map;return d.subscribe(function(a){var d;try{d=b(a)}catch(g){return void e.onError(g)}var h=a;if(c)try{h=c(a)}catch(g){return void e.onError(g)}f.set(d,h)},function(a){e.onError(a)},function(){e.onNext(f),e.onCompleted()})},d)},c});
//# sourceMappingURL=rx.aggregates.map

@@ -382,2 +382,12 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

function isNodeList(el) {
if (window.StaticNodeList) {
// IE8 Specific
// instanceof is slower than Object#toString, but Object#toString will not work as intended in IE8
return (el instanceof window.StaticNodeList || el instanceof window.NodeList);
} else {
return (Object.prototype.toString.call(el) == '[object NodeList]')
}
}
function fixEvent(event) {

@@ -465,3 +475,3 @@ var stopPropagation = function () {

// Asume NodeList
if (Object.prototype.toString.call(el) === '[object NodeList]') {
if (isNodeList(el) || Object.prototype.toString.call(el) === '[object HTMLCollection]') {
for (var i = 0, len = el.length; i < len; i++) {

@@ -468,0 +478,0 @@ disposables.add(createEventListener(el.item(i), eventName, handler));

/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx.binding","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(a,b){return Array.isArray(a)?e.call(b,a):i(a)?A(a.call(b)):j(a)?A(a):h(a)?f(a):isPromise(a)?g(a):typeof a===x?a:z(a)||Array.isArray(a)?e.call(b,a):a}function e(a){var b=this;return function(c){function e(a,e){if(!f)try{if(a=d(a,b),typeof a!==x)return i[e]=a,--h||c(null,i);a.call(b,function(a,b){if(!f){if(a)return f=!0,c(a);i[e]=b,--h||c(null,i)}})}catch(g){f=!0,c(g)}}var f,g=Object.keys(a),h=g.length,i=new a.constructor;if(!h)return void v.schedule(function(){c(null,i)});for(var j=0,k=g.length;k>j;j++)e(a[g[j]],g[j])}}function f(a){return function(b){var c,d=!1;a.subscribe(function(a){c=a,d=!0},b,function(){d&&b(null,c)})}}function g(a){return function(b){a.then(function(a){b(null,a)},b)}}function h(a){return a&&typeof a.subscribe===x}function i(a){return a&&a.constructor&&"GeneratorFunction"===a.constructor.name}function j(a){return a&&typeof a.next===x&&typeof a[y]===x}function k(a){a&&v.schedule(function(){throw a})}function l(b){var c=function(){this.cancelBubble=!0},d=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(a){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(b||(b=a.event),!b.target)switch(b.target=b.target||b.srcElement,"mouseover"==b.type&&(b.relatedTarget=b.fromElement),"mouseout"==b.type&&(b.relatedTarget=b.toElement),b.stopPropagation||(b.stopPropagation=c,b.preventDefault=d),b.type){case"keypress":var e="charCode"in b?b.charCode:b.keyCode;10==e?(e=0,b.keyCode=13):13==e||27==e?e=0:3==e&&(e=99),b.charCode=e,b.keyChar=b.charCode?String.fromCharCode(b.charCode):""}return b}function m(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),t(function(){a.removeEventListener(b,c,!1)});if(a.attachEvent){var d=function(a){c(l(a))};return a.attachEvent("on"+b,d),t(function(){a.detachEvent("on"+b,d)})}return a["on"+b]=c,t(function(){a["on"+b]=null})}function n(a,b,c){var d=new u;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(n(a.item(e),b,c));else a&&d.add(m(a,b,c));return d}var o=c.Observable,p=(o.prototype,o.fromPromise),q=o.throwError,r=c.AnonymousObservable,s=c.AsyncSubject,t=c.Disposable.create,u=c.CompositeDisposable,v=(c.Scheduler.immediate,c.Scheduler["default"]),w=c.Scheduler.isScheduler,x=(Array.prototype.slice,"function"),y="throw",z=c.internals.isObject,A=c.spawn=function(a){var b=i(a);return function(c){function e(a,b){v.schedule(c.bind(g,a,b))}function f(a,b){var c;if(arguments.length>2)for(var b=[],i=1,j=arguments.length;j>i;i++)b.push(arguments[i]);if(a)try{c=h[y](a)}catch(k){return e(k)}if(!a)try{c=h.next(b)}catch(k){return e(k)}if(c.done)return e(null,c.value);if(c.value=d(c.value,g),typeof c.value!==x)f(new TypeError("Rx.spawn only supports a function, Promise, Observable, Object or Array."));else{var l=!1;try{c.value.call(g,function(){l||(l=!0,f.apply(g,arguments))})}catch(k){v.schedule(function(){l||(l=!0,f.call(g,k))})}}}var g=this,h=a;if(b){for(var i=[],j=0,l=arguments.length;l>j;j++)i.push(arguments[j]);var l=i.length,m=l&&typeof i[l-1]===x;c=m?i.pop():k,h=a.apply(this,i)}else c=c||k;f()}};o.start=function(a,b,c){return B(a,b,c)()};var B=o.toAsync=function(a,b,c){return w(c)||(c=v),function(){var d=arguments,e=new s;return c.schedule(function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};o.fromCallback=function(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return new r(function(d){function f(){for(var a=arguments.length,e=new Array(a),f=0;a>f;f++)e[f]=arguments[f];if(c){try{e=c.apply(b,e)}catch(g){return d.onError(g)}d.onNext(e)}else e.length<=1?d.onNext.apply(d,e):d.onNext(e);d.onCompleted()}e.push(f),a.apply(b,e)}).publishLast().refCount()}},o.fromNodeCallback=function(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return new r(function(d){function f(a){if(a)return void d.onError(a);for(var e=arguments.length,f=[],g=1;e>g;g++)f[g-1]=arguments[g];if(c){try{f=c.apply(b,f)}catch(h){return d.onError(h)}d.onNext(f)}else f.length<=1?d.onNext.apply(d,f):d.onNext(f);d.onCompleted()}e.push(f),a.apply(b,e)}).publishLast().refCount()}},c.config.useNativeEvents=!1,o.fromEvent=function(a,b,d){return a.addListener?C(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d):c.config.useNativeEvents||"function"!=typeof a.on||"function"!=typeof a.off?new r(function(c){return n(a,b,function(a){var b=a;if(d)try{b=d(arguments)}catch(e){return c.onError(e)}c.onNext(b)})}).publish().refCount():C(function(c){a.on(b,c)},function(c){a.off(b,c)},d)};var C=o.fromEventPattern=function(a,b,c){return new r(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e)}d.onNext(b)}var f=a(e);return t(function(){b&&b(e,f)})}).publish().refCount()};return o.startAsync=function(a){var b;try{b=a()}catch(c){return q(c)}return p(b)},c});
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx.binding","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){return Array.isArray(a)?f.call(b,a):j(a)?C(a.call(b)):k(a)?C(a):i(a)?g(a):isPromise(a)?h(a):typeof a===z?a:B(a)||Array.isArray(a)?f.call(b,a):a}function f(a){var b=this;return function(c){function d(a,d){if(!f)try{if(a=e(a,b),typeof a!==z)return i[d]=a,--h||c(null,i);a.call(b,function(a,b){if(!f){if(a)return f=!0,c(a);i[d]=b,--h||c(null,i)}})}catch(g){f=!0,c(g)}}var f,g=Object.keys(a),h=g.length,i=new a.constructor;if(!h)return void x.schedule(function(){c(null,i)});for(var j=0,k=g.length;k>j;j++)d(a[g[j]],g[j])}}function g(a){return function(b){var c,d=!1;a.subscribe(function(a){c=a,d=!0},b,function(){d&&b(null,c)})}}function h(a){return function(b){a.then(function(a){b(null,a)},b)}}function i(a){return a&&typeof a.subscribe===z}function j(a){return a&&a.constructor&&"GeneratorFunction"===a.constructor.name}function k(a){return a&&typeof a.next===z&&typeof a[A]===z}function l(a){a&&x.schedule(function(){throw a})}function m(a){return window.StaticNodeList?a instanceof window.StaticNodeList||a instanceof window.NodeList:"[object NodeList]"==Object.prototype.toString.call(a)}function n(b){var c=function(){this.cancelBubble=!0},d=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(a){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(b||(b=a.event),!b.target)switch(b.target=b.target||b.srcElement,"mouseover"==b.type&&(b.relatedTarget=b.fromElement),"mouseout"==b.type&&(b.relatedTarget=b.toElement),b.stopPropagation||(b.stopPropagation=c,b.preventDefault=d),b.type){case"keypress":var e="charCode"in b?b.charCode:b.keyCode;10==e?(e=0,b.keyCode=13):13==e||27==e?e=0:3==e&&(e=99),b.charCode=e,b.keyChar=b.charCode?String.fromCharCode(b.charCode):""}return b}function o(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),v(function(){a.removeEventListener(b,c,!1)});if(a.attachEvent){var d=function(a){c(n(a))};return a.attachEvent("on"+b,d),v(function(){a.detachEvent("on"+b,d)})}return a["on"+b]=c,v(function(){a["on"+b]=null})}function p(a,b,c){var d=new w;if(m(a)||"[object HTMLCollection]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(p(a.item(e),b,c));else a&&d.add(o(a,b,c));return d}var q=c.Observable,r=(q.prototype,q.fromPromise),s=q.throwError,t=c.AnonymousObservable,u=c.AsyncSubject,v=c.Disposable.create,w=c.CompositeDisposable,x=(c.Scheduler.immediate,c.Scheduler["default"]),y=c.Scheduler.isScheduler,z=(Array.prototype.slice,"function"),A="throw",B=c.internals.isObject,C=c.spawn=function(a){var b=j(a);return function(c){function d(a,b){x.schedule(c.bind(g,a,b))}function f(a,b){var c;if(arguments.length>2)for(var b=[],i=1,j=arguments.length;j>i;i++)b.push(arguments[i]);if(a)try{c=h[A](a)}catch(k){return d(k)}if(!a)try{c=h.next(b)}catch(k){return d(k)}if(c.done)return d(null,c.value);if(c.value=e(c.value,g),typeof c.value!==z)f(new TypeError("Rx.spawn only supports a function, Promise, Observable, Object or Array."));else{var l=!1;try{c.value.call(g,function(){l||(l=!0,f.apply(g,arguments))})}catch(k){x.schedule(function(){l||(l=!0,f.call(g,k))})}}}var g=this,h=a;if(b){for(var i=[],j=0,k=arguments.length;k>j;j++)i.push(arguments[j]);var k=i.length,m=k&&typeof i[k-1]===z;c=m?i.pop():l,h=a.apply(this,i)}else c=c||l;f()}};q.start=function(a,b,c){return D(a,b,c)()};var D=q.toAsync=function(a,b,c){return y(c)||(c=x),function(){var d=arguments,e=new u;return c.schedule(function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};q.fromCallback=function(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return new t(function(d){function f(){for(var a=arguments.length,e=new Array(a),f=0;a>f;f++)e[f]=arguments[f];if(c){try{e=c.apply(b,e)}catch(g){return d.onError(g)}d.onNext(e)}else e.length<=1?d.onNext.apply(d,e):d.onNext(e);d.onCompleted()}e.push(f),a.apply(b,e)}).publishLast().refCount()}},q.fromNodeCallback=function(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return new t(function(d){function f(a){if(a)return void d.onError(a);for(var e=arguments.length,f=[],g=1;e>g;g++)f[g-1]=arguments[g];if(c){try{f=c.apply(b,f)}catch(h){return d.onError(h)}d.onNext(f)}else f.length<=1?d.onNext.apply(d,f):d.onNext(f);d.onCompleted()}e.push(f),a.apply(b,e)}).publishLast().refCount()}},c.config.useNativeEvents=!1,q.fromEvent=function(a,b,d){return a.addListener?E(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d):c.config.useNativeEvents||"function"!=typeof a.on||"function"!=typeof a.off?new t(function(c){return p(a,b,function(a){var b=a;if(d)try{b=d(arguments)}catch(e){return c.onError(e)}c.onNext(b)})}).publish().refCount():E(function(c){a.on(b,c)},function(c){a.off(b,c)},d)};var E=q.fromEventPattern=function(a,b,c){return new t(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e)}d.onNext(b)}var f=a(e);return v(function(){b&&b(e,f)})}).publish().refCount()};return q.startAsync=function(a){var b;try{b=a()}catch(c){return s(c)}return r(b)},c});
//# sourceMappingURL=rx.async.compat.map

@@ -395,4 +395,5 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

// Asume NodeList
if (Object.prototype.toString.call(el) === '[object NodeList]') {
// Asume NodeList or HTMLCollection
var toStr = Object.prototype.toString;
if (toStr.call(el) === '[object NodeList]' || toStr.call(el) === '[object HTMLCollection]') {
for (var i = 0, len = el.length; i < len; i++) {

@@ -399,0 +400,0 @@ disposables.add(createEventListener(el.item(i), eventName, handler));

/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx.binding","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(a,b){return Array.isArray(a)?e.call(b,a):i(a)?z(a.call(b)):j(a)?z(a):h(a)?f(a):isPromise(a)?g(a):typeof a===w?a:y(a)||Array.isArray(a)?e.call(b,a):a}function e(a){var b=this;return function(c){function e(a,e){if(!f)try{if(a=d(a,b),typeof a!==w)return i[e]=a,--h||c(null,i);a.call(b,function(a,b){if(!f){if(a)return f=!0,c(a);i[e]=b,--h||c(null,i)}})}catch(g){f=!0,c(g)}}var f,g=Object.keys(a),h=g.length,i=new a.constructor;if(!h)return void u.schedule(function(){c(null,i)});for(var j=0,k=g.length;k>j;j++)e(a[g[j]],g[j])}}function f(a){return function(b){var c,d=!1;a.subscribe(function(a){c=a,d=!0},b,function(){d&&b(null,c)})}}function g(a){return function(b){a.then(function(a){b(null,a)},b)}}function h(a){return a&&typeof a.subscribe===w}function i(a){return a&&a.constructor&&"GeneratorFunction"===a.constructor.name}function j(a){return a&&typeof a.next===w&&typeof a[x]===w}function k(a){a&&u.schedule(function(){throw a})}function l(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),s(function(){a.removeEventListener(b,c,!1)});throw new Error("No listener found")}function m(a,b,c){var d=new t;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(m(a.item(e),b,c));else a&&d.add(l(a,b,c));return d}var n=c.Observable,o=(n.prototype,n.fromPromise),p=n.throwError,q=c.AnonymousObservable,r=c.AsyncSubject,s=c.Disposable.create,t=c.CompositeDisposable,u=(c.Scheduler.immediate,c.Scheduler["default"]),v=c.Scheduler.isScheduler,w=(Array.prototype.slice,"function"),x="throw",y=c.internals.isObject,z=c.spawn=function(a){var b=i(a);return function(c){function e(a,b){u.schedule(c.bind(g,a,b))}function f(a,b){var c;if(arguments.length>2)for(var b=[],i=1,j=arguments.length;j>i;i++)b.push(arguments[i]);if(a)try{c=h[x](a)}catch(k){return e(k)}if(!a)try{c=h.next(b)}catch(k){return e(k)}if(c.done)return e(null,c.value);if(c.value=d(c.value,g),typeof c.value!==w)f(new TypeError("Rx.spawn only supports a function, Promise, Observable, Object or Array."));else{var l=!1;try{c.value.call(g,function(){l||(l=!0,f.apply(g,arguments))})}catch(k){u.schedule(function(){l||(l=!0,f.call(g,k))})}}}var g=this,h=a;if(b){for(var i=[],j=0,l=arguments.length;l>j;j++)i.push(arguments[j]);var l=i.length,m=l&&typeof i[l-1]===w;c=m?i.pop():k,h=a.apply(this,i)}else c=c||k;f()}};n.start=function(a,b,c){return A(a,b,c)()};var A=n.toAsync=function(a,b,c){return v(c)||(c=u),function(){var d=arguments,e=new r;return c.schedule(function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};n.fromCallback=function(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return new q(function(d){function f(){for(var a=arguments.length,e=new Array(a),f=0;a>f;f++)e[f]=arguments[f];if(c){try{e=c.apply(b,e)}catch(g){return d.onError(g)}d.onNext(e)}else e.length<=1?d.onNext.apply(d,e):d.onNext(e);d.onCompleted()}e.push(f),a.apply(b,e)}).publishLast().refCount()}},n.fromNodeCallback=function(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return new q(function(d){function f(a){if(a)return void d.onError(a);for(var e=arguments.length,f=[],g=1;e>g;g++)f[g-1]=arguments[g];if(c){try{f=c.apply(b,f)}catch(h){return d.onError(h)}d.onNext(f)}else f.length<=1?d.onNext.apply(d,f):d.onNext(f);d.onCompleted()}e.push(f),a.apply(b,e)}).publishLast().refCount()}},c.config.useNativeEvents=!1,n.fromEvent=function(a,b,d){return a.addListener?B(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d):c.config.useNativeEvents||"function"!=typeof a.on||"function"!=typeof a.off?new q(function(c){return m(a,b,function(a){var b=a;if(d)try{b=d(arguments)}catch(e){return c.onError(e)}c.onNext(b)})}).publish().refCount():B(function(c){a.on(b,c)},function(c){a.off(b,c)},d)};var B=n.fromEventPattern=function(a,b,c){return new q(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e)}d.onNext(b)}var f=a(e);return s(function(){b&&b(e,f)})}).publish().refCount()};return n.startAsync=function(a){var b;try{b=a()}catch(c){return p(c)}return o(b)},c});
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx.binding","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){return Array.isArray(a)?f.call(b,a):j(a)?A(a.call(b)):k(a)?A(a):i(a)?g(a):isPromise(a)?h(a):typeof a===x?a:z(a)||Array.isArray(a)?f.call(b,a):a}function f(a){var b=this;return function(c){function d(a,d){if(!f)try{if(a=e(a,b),typeof a!==x)return i[d]=a,--h||c(null,i);a.call(b,function(a,b){if(!f){if(a)return f=!0,c(a);i[d]=b,--h||c(null,i)}})}catch(g){f=!0,c(g)}}var f,g=Object.keys(a),h=g.length,i=new a.constructor;if(!h)return void v.schedule(function(){c(null,i)});for(var j=0,k=g.length;k>j;j++)d(a[g[j]],g[j])}}function g(a){return function(b){var c,d=!1;a.subscribe(function(a){c=a,d=!0},b,function(){d&&b(null,c)})}}function h(a){return function(b){a.then(function(a){b(null,a)},b)}}function i(a){return a&&typeof a.subscribe===x}function j(a){return a&&a.constructor&&"GeneratorFunction"===a.constructor.name}function k(a){return a&&typeof a.next===x&&typeof a[y]===x}function l(a){a&&v.schedule(function(){throw a})}function m(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),t(function(){a.removeEventListener(b,c,!1)});throw new Error("No listener found")}function n(a,b,c){var d=new u,e=Object.prototype.toString;if("[object NodeList]"===e.call(a)||"[object HTMLCollection]"===e.call(a))for(var f=0,g=a.length;g>f;f++)d.add(n(a.item(f),b,c));else a&&d.add(m(a,b,c));return d}var o=c.Observable,p=(o.prototype,o.fromPromise),q=o.throwError,r=c.AnonymousObservable,s=c.AsyncSubject,t=c.Disposable.create,u=c.CompositeDisposable,v=(c.Scheduler.immediate,c.Scheduler["default"]),w=c.Scheduler.isScheduler,x=(Array.prototype.slice,"function"),y="throw",z=c.internals.isObject,A=c.spawn=function(a){var b=j(a);return function(c){function d(a,b){v.schedule(c.bind(g,a,b))}function f(a,b){var c;if(arguments.length>2)for(var b=[],i=1,j=arguments.length;j>i;i++)b.push(arguments[i]);if(a)try{c=h[y](a)}catch(k){return d(k)}if(!a)try{c=h.next(b)}catch(k){return d(k)}if(c.done)return d(null,c.value);if(c.value=e(c.value,g),typeof c.value!==x)f(new TypeError("Rx.spawn only supports a function, Promise, Observable, Object or Array."));else{var l=!1;try{c.value.call(g,function(){l||(l=!0,f.apply(g,arguments))})}catch(k){v.schedule(function(){l||(l=!0,f.call(g,k))})}}}var g=this,h=a;if(b){for(var i=[],j=0,k=arguments.length;k>j;j++)i.push(arguments[j]);var k=i.length,m=k&&typeof i[k-1]===x;c=m?i.pop():l,h=a.apply(this,i)}else c=c||l;f()}};o.start=function(a,b,c){return B(a,b,c)()};var B=o.toAsync=function(a,b,c){return w(c)||(c=v),function(){var d=arguments,e=new s;return c.schedule(function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};o.fromCallback=function(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return new r(function(d){function f(){for(var a=arguments.length,e=new Array(a),f=0;a>f;f++)e[f]=arguments[f];if(c){try{e=c.apply(b,e)}catch(g){return d.onError(g)}d.onNext(e)}else e.length<=1?d.onNext.apply(d,e):d.onNext(e);d.onCompleted()}e.push(f),a.apply(b,e)}).publishLast().refCount()}},o.fromNodeCallback=function(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return new r(function(d){function f(a){if(a)return void d.onError(a);for(var e=arguments.length,f=[],g=1;e>g;g++)f[g-1]=arguments[g];if(c){try{f=c.apply(b,f)}catch(h){return d.onError(h)}d.onNext(f)}else f.length<=1?d.onNext.apply(d,f):d.onNext(f);d.onCompleted()}e.push(f),a.apply(b,e)}).publishLast().refCount()}},c.config.useNativeEvents=!1,o.fromEvent=function(a,b,d){return a.addListener?C(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d):c.config.useNativeEvents||"function"!=typeof a.on||"function"!=typeof a.off?new r(function(c){return n(a,b,function(a){var b=a;if(d)try{b=d(arguments)}catch(e){return c.onError(e)}c.onNext(b)})}).publish().refCount():C(function(c){a.on(b,c)},function(c){a.off(b,c)},d)};var C=o.fromEventPattern=function(a,b,c){return new r(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return d.onError(e)}d.onNext(b)}var f=a(e);return t(function(){b&&b(e,f)})}).publish().refCount()};return o.startAsync=function(a){var b;try{b=a()}catch(c){return q(c)}return p(b)},c});
//# sourceMappingURL=rx.async.map

@@ -52,4 +52,24 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

isScheduler = Rx.Scheduler.isScheduler,
isFunction = Rx.helpers.isFunction,
checkDisposed = Rx.Disposable.checkDisposed;
var errorObj = {e: {}};
var tryCatchTarget;
function tryCatcher() {
try {
return tryCatchTarget.apply(this, arguments);
} catch (e) {
errorObj.e = e;
return errorObj;
}
}
function tryCatch(fn) {
if (!isFunction(fn)) { throw new TypeError('fn must be a function'); }
tryCatchTarget = fn;
return tryCatcher;
}
function thrower(e) {
throw e;
}
/**

@@ -146,21 +166,10 @@ * Used to pause and resume streams.

values[i] = x
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
if (err) {
o.onError(err);
return;
}
try {
res = resultSelector.apply(null, values);
} catch (ex) {
o.onError(ex);
return;
}
if (err) { return o.onError(err); }
var res = tryCatch(resultSelector).apply(null, values);
if (res === errorObj) { return o.onError(res.e); }
o.onNext(res);
}
if (isDone && values[1]) {
o.onCompleted();
}
isDone && values[1] && o.onCompleted();
}

@@ -204,2 +213,4 @@

function drainQueue() { while (q.length > 0) { o.onNext(q.shift()); } }
var subscription =

@@ -217,7 +228,3 @@ combineLatestSource(

// change in shouldFire
if (results.shouldFire) {
while (q.length > 0) {
o.onNext(q.shift());
}
}
if (results.shouldFire) { drainQueue(); }
} else {

@@ -234,13 +241,7 @@ previousShouldFire = results.shouldFire;

function (err) {
// Empty buffer before sending error
while (q.length > 0) {
o.onNext(q.shift());
}
drainQueue();
o.onError(err);
},
function () {
// Empty buffer before sending completion
while (q.length > 0) {
o.onNext(q.shift());
}
drainQueue();
o.onCompleted();

@@ -416,3 +417,3 @@ }

* @param {Scheduler} scheduler determines how the requests will be scheduled
* @returns {Observable} The observable sequence which is paused based upon the pauser.
* @returns {Observable} The observable sequence which only propagates values on request.
*/

@@ -419,0 +420,0 @@ observableProto.controlled = function (enableQueue, scheduler) {

/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b,c){return new h(function(d){function e(a,b){k[b]=a;var e;if(g[b]=!0,h||(h=g.every(t))){if(f)return void d.onError(f);try{e=c.apply(null,k)}catch(j){return void d.onError(j)}d.onNext(e)}i&&k[1]&&d.onCompleted()}var f,g=[!1,!1],h=!1,i=!1,k=new Array(2);return new j(a.subscribe(function(a){e(a,0)},function(a){k[1]?d.onError(a):f=a},function(){i=!0,k[1]&&d.onCompleted()}),b.subscribe(function(a){e(a,1)},function(a){d.onError(a)},function(){i=!0,e(!0,1)}))},a)}{var f=c.Observable,g=f.prototype,h=c.AnonymousObservable,i=c.internals.AbstractObserver,j=c.CompositeDisposable,k=c.Notification,l=c.Subject,m=c.Observer,n=c.Disposable.empty,o=c.Disposable.create,p=c.internals.inherits,q=c.internals.addProperties,r=c.Scheduler.timeout,s=c.Scheduler.currentThread,t=c.helpers.identity,u=c.Scheduler.isScheduler;c.Disposable.checkDisposed}c.Pauser=function(a){function b(){a.call(this)}return p(b,a),b.prototype.pause=function(){this.onNext(!1)},b.prototype.resume=function(){this.onNext(!0)},b}(l);var v=function(a){function b(a){var b=this.source.publish(),c=b.subscribe(a),d=n,e=this.pauser.distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=n)});return new j(c,d,e)}function c(c,d){this.source=c,this.controller=new l,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b,c)}return p(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(f);g.pausable=function(a){return new v(this,a)};var w=function(a){function b(a){var b,c=[],f=e(this.source,this.pauser.distinctUntilChanged().startWith(!1),function(a,b){return{data:a,shouldFire:b}}).subscribe(function(e){if(b!==d&&e.shouldFire!=b){if(b=e.shouldFire,e.shouldFire)for(;c.length>0;)a.onNext(c.shift())}else b=e.shouldFire,e.shouldFire?a.onNext(e.data):c.push(e.data)},function(b){for(;c.length>0;)a.onNext(c.shift());a.onError(b)},function(){for(;c.length>0;)a.onNext(c.shift());a.onCompleted()});return f}function c(c,d){this.source=c,this.controller=new l,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b,c)}return p(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(f);g.pausableBuffered=function(a){return new w(this,a)};var x=function(a){function b(a){return this.source.subscribe(a)}function c(c,d,e){a.call(this,b,c),this.subject=new y(d,e),this.source=c.multicast(this.subject).refCount()}return p(c,a),c.prototype.request=function(a){return this.subject.request(null==a?-1:a)},c}(f),y=function(a){function b(a){return this.subject.subscribe(a)}function c(c,d){null==c&&(c=!0),a.call(this,b),this.subject=new l,this.enableQueue=c,this.queue=c?[]:null,this.requestedCount=0,this.requestedDisposable=n,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.scheduler=d||s}return p(c,a),q(c.prototype,m,{onCompleted:function(){this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length?this.queue.push(k.createOnCompleted()):this.subject.onCompleted()},onError:function(a){this.hasFailed=!0,this.error=a,this.enableQueue&&0!==this.queue.length?this.queue.push(k.createOnError(a)):this.subject.onError(a)},onNext:function(a){var b=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(k.createOnNext(a)):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),b=!0),b&&this.subject.onNext(a)},_processRequest:function(a){if(this.enableQueue){for(;this.queue.length>=a&&a>0||this.queue.length>0&&"N"!==this.queue[0].kind;){var b=this.queue.shift();b.accept(this.subject),"N"===b.kind?a--:(this.disposeCurrentRequest(),this.queue=[])}return{numberOfItems:a,returnValue:0!==this.queue.length}}return{numberOfItems:a,returnValue:!1}},request:function(a){this.disposeCurrentRequest();var b=this;return this.requestedDisposable=this.scheduler.scheduleWithState(a,function(a,c){var d=b._processRequest(c),e=d.numberOfItems;d.returnValue||(b.requestedCount=e,b.requestedDisposable=o(function(){b.requestedCount=0}))}),this.requestedDisposable},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=n}}),c}(f);g.controlled=function(a,b){return a&&u(a)&&(b=a,a=!0),null==a&&(a=!0),new x(this,a,b)};var z=function(a){function b(a){this.subscription=this.source.subscribe(new d(a,this,this.subscription));var b=this;return r.schedule(function(){b.source.request(1)}),this.subscription}function c(c){a.call(this,b,c),this.source=c}p(c,a);var d=function(a){function b(b,c,d){a.call(this),this.observer=b,this.observable=c,this.cancel=d}p(b,a);var c=b.prototype;return c.completed=function(){this.observer.onCompleted(),this.dispose()},c.error=function(a){this.observer.onError(a),this.dispose()},c.next=function(a){this.observer.onNext(a);var b=this;r.schedule(function(){b.observable.source.request(1)})},c.dispose=function(){this.observer=null,this.cancel&&(this.cancel.dispose(),this.cancel=null),a.prototype.dispose.call(this)},b}(i);return c}(f);x.prototype.stopAndWait=function(){return new z(this)};var A=function(a){function b(a){this.subscription=this.source.subscribe(new d(a,this,this.subscription));var b=this;return r.schedule(function(){b.source.request(b.windowSize)}),this.subscription}function c(c,d){a.call(this,b,c),this.source=c,this.windowSize=d}p(c,a);var d=function(a){function b(a,b,c){this.observer=a,this.observable=b,this.cancel=c,this.received=0}p(b,a);var c=b.prototype;return c.completed=function(){this.observer.onCompleted(),this.dispose()},c.error=function(a){this.observer.onError(a),this.dispose()},c.next=function(a){if(this.observer.onNext(a),this.received=++this.received%this.observable.windowSize,0===this.received){var b=this;r.schedule(function(){b.observable.source.request(b.observable.windowSize)})}},c.dispose=function(){this.observer=null,this.cancel&&(this.cancel.dispose(),this.cancel=null),a.prototype.dispose.call(this)},b}(i);return c}(f);return x.prototype.windowed=function(a){return new A(this,a)},c});
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(){try{return h.apply(this,arguments)}catch(a){return z.e=a,z}}function f(a){if(!y(a))throw new TypeError("fn must be a function");return h=a,e}function g(a,b,c){return new k(function(d){function e(a,b){if(k[b]=a,h[b]=!0,i||(i=h.every(w))){if(g)return d.onError(g);var e=f(c).apply(null,k);if(e===z)return d.onError(e.e);d.onNext(e)}j&&k[1]&&d.onCompleted()}var g,h=[!1,!1],i=!1,j=!1,k=new Array(2);return new m(a.subscribe(function(a){e(a,0)},function(a){k[1]?d.onError(a):g=a},function(){j=!0,k[1]&&d.onCompleted()}),b.subscribe(function(a){e(a,1)},function(a){d.onError(a)},function(){j=!0,e(!0,1)}))},a)}var h,i=c.Observable,j=i.prototype,k=c.AnonymousObservable,l=c.internals.AbstractObserver,m=c.CompositeDisposable,n=c.Notification,o=c.Subject,p=c.Observer,q=c.Disposable.empty,r=c.Disposable.create,s=c.internals.inherits,t=c.internals.addProperties,u=c.Scheduler.timeout,v=c.Scheduler.currentThread,w=c.helpers.identity,x=c.Scheduler.isScheduler,y=c.helpers.isFunction,z=(c.Disposable.checkDisposed,{e:{}});c.Pauser=function(a){function b(){a.call(this)}return s(b,a),b.prototype.pause=function(){this.onNext(!1)},b.prototype.resume=function(){this.onNext(!0)},b}(o);var A=function(a){function b(a){var b=this.source.publish(),c=b.subscribe(a),d=q,e=this.pauser.distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=q)});return new m(c,d,e)}function c(c,d){this.source=c,this.controller=new o,d&&d.subscribe?this.pauser=this.controller.merge(d):this.pauser=this.controller,a.call(this,b,c)}return s(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(i);j.pausable=function(a){return new A(this,a)};var B=function(a){function b(a){function b(){for(;e.length>0;)a.onNext(e.shift())}var c,e=[],f=g(this.source,this.pauser.distinctUntilChanged().startWith(!1),function(a,b){return{data:a,shouldFire:b}}).subscribe(function(f){c!==d&&f.shouldFire!=c?(c=f.shouldFire,f.shouldFire&&b()):(c=f.shouldFire,f.shouldFire?a.onNext(f.data):e.push(f.data))},function(c){b(),a.onError(c)},function(){b(),a.onCompleted()});return f}function c(c,d){this.source=c,this.controller=new o,d&&d.subscribe?this.pauser=this.controller.merge(d):this.pauser=this.controller,a.call(this,b,c)}return s(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(i);j.pausableBuffered=function(a){return new B(this,a)};var C=function(a){function b(a){return this.source.subscribe(a)}function c(c,d,e){a.call(this,b,c),this.subject=new D(d,e),this.source=c.multicast(this.subject).refCount()}return s(c,a),c.prototype.request=function(a){return this.subject.request(null==a?-1:a)},c}(i),D=function(a){function b(a){return this.subject.subscribe(a)}function c(c,d){null==c&&(c=!0),a.call(this,b),this.subject=new o,this.enableQueue=c,this.queue=c?[]:null,this.requestedCount=0,this.requestedDisposable=q,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.scheduler=d||v}return s(c,a),t(c.prototype,p,{onCompleted:function(){this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length?this.queue.push(n.createOnCompleted()):this.subject.onCompleted()},onError:function(a){this.hasFailed=!0,this.error=a,this.enableQueue&&0!==this.queue.length?this.queue.push(n.createOnError(a)):this.subject.onError(a)},onNext:function(a){var b=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(n.createOnNext(a)):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),b=!0),b&&this.subject.onNext(a)},_processRequest:function(a){if(this.enableQueue){for(;this.queue.length>=a&&a>0||this.queue.length>0&&"N"!==this.queue[0].kind;){var b=this.queue.shift();b.accept(this.subject),"N"===b.kind?a--:(this.disposeCurrentRequest(),this.queue=[])}return{numberOfItems:a,returnValue:0!==this.queue.length}}return{numberOfItems:a,returnValue:!1}},request:function(a){this.disposeCurrentRequest();var b=this;return this.requestedDisposable=this.scheduler.scheduleWithState(a,function(a,c){var d=b._processRequest(c),e=d.numberOfItems;d.returnValue||(b.requestedCount=e,b.requestedDisposable=r(function(){b.requestedCount=0}))}),this.requestedDisposable},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=q}}),c}(i);j.controlled=function(a,b){return a&&x(a)&&(b=a,a=!0),null==a&&(a=!0),new C(this,a,b)};var E=function(a){function b(a){this.subscription=this.source.subscribe(new d(a,this,this.subscription));var b=this;return u.schedule(function(){b.source.request(1)}),this.subscription}function c(c){a.call(this,b,c),this.source=c}s(c,a);var d=function(a){function b(b,c,d){a.call(this),this.observer=b,this.observable=c,this.cancel=d}s(b,a);var c=b.prototype;return c.completed=function(){this.observer.onCompleted(),this.dispose()},c.error=function(a){this.observer.onError(a),this.dispose()},c.next=function(a){this.observer.onNext(a);var b=this;u.schedule(function(){b.observable.source.request(1)})},c.dispose=function(){this.observer=null,this.cancel&&(this.cancel.dispose(),this.cancel=null),a.prototype.dispose.call(this)},b}(l);return c}(i);C.prototype.stopAndWait=function(){return new E(this)};var F=function(a){function b(a){this.subscription=this.source.subscribe(new d(a,this,this.subscription));var b=this;return u.schedule(function(){b.source.request(b.windowSize)}),this.subscription}function c(c,d){a.call(this,b,c),this.source=c,this.windowSize=d}s(c,a);var d=function(a){function b(a,b,c){this.observer=a,this.observable=b,this.cancel=c,this.received=0}s(b,a);var c=b.prototype;return c.completed=function(){this.observer.onCompleted(),this.dispose()},c.error=function(a){this.observer.onError(a),this.dispose()},c.next=function(a){if(this.observer.onNext(a),this.received=++this.received%this.observable.windowSize,0===this.received){var b=this;u.schedule(function(){b.observable.source.request(b.observable.windowSize)})}},c.dispose=function(){this.observer=null,this.cancel&&(this.cancel.dispose(),this.cancel=null),a.prototype.dispose.call(this)},b}(l);return c}(i);return C.prototype.windowed=function(a){return new F(this,a)},c});
//# sourceMappingURL=rx.backpressure.map

@@ -497,3 +497,24 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

/**
* Returns an observable sequence that shares a single subscription to the underlying sequence. This observable sequence
* can be resubscribed to, even if all prior subscriptions have ended. (unlike `.publish().refCount()`)
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source.
*/
observableProto.singleInstance = function() {
var source = this, hasObservable = false, observable;
function getObservable() {
if (!hasObservable) {
hasObservable = true;
observable = source.finally(function() { hasObservable = false; }).publish().refCount();
}
return observable;
};
return new AnonymousObservable(function(o) {
return getObservable().subscribe(o);
});
};
return Rx;
}));
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(a){for(var b=a.length,c=new Array(b),d=0;b>d;d++)c[d]=a[d];return c}var e=c.Observable,f=e.prototype,g=c.AnonymousObservable,h=c.Subject,i=c.AsyncSubject,j=c.Observer,k=c.internals.ScheduledObserver,l=c.Disposable.create,m=c.Disposable.empty,n=c.CompositeDisposable,o=c.Scheduler.currentThread,p=c.helpers.isFunction,q=c.internals.inherits,r=c.internals.addProperties,s=c.Disposable.checkDisposed;f.multicast=function(a,b){var c=this;return"function"==typeof a?new g(function(d){var e=c.multicast(a());return new n(b(e).subscribe(d),e.connect())},c):new w(c,a)},f.publish=function(a){return a&&p(a)?this.multicast(function(){return new h},a):this.multicast(new h)},f.share=function(){return this.publish().refCount()},f.publishLast=function(a){return a&&p(a)?this.multicast(function(){return new i},a):this.multicast(new i)},f.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new u(b)},a):this.multicast(new u(a))},f.shareValue=function(a){return this.publishValue(a).refCount()},f.replay=function(a,b,c,d){return a&&p(a)?this.multicast(function(){return new v(b,c,d)},a):this.multicast(new v(b,c,d))},f.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};var t=function(a,b){this.subject=a,this.observer=b};t.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1),this.observer=null}};var u=c.BehaviorSubject=function(a){function b(a){return s(this),this.isStopped?(this.hasError?a.onError(this.error):a.onCompleted(),m):(this.observers.push(a),a.onNext(this.value),new t(this,a))}function c(c){a.call(this,b),this.value=c,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.hasError=!1}return q(c,a),r(c.prototype,j,{getValue:function(){if(s(this),this.hasError)throw this.error;return this.value},hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(s(this),!this.isStopped){this.isStopped=!0;for(var a=0,b=d(this.observers),c=b.length;c>a;a++)b[a].onCompleted();this.observers.length=0}},onError:function(a){if(s(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var b=0,c=d(this.observers),e=c.length;e>b;b++)c[b].onError(a);this.observers.length=0}},onNext:function(a){if(s(this),!this.isStopped){this.value=a;for(var b=0,c=d(this.observers),e=c.length;e>b;b++)c[b].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),c}(e),v=c.ReplaySubject=function(a){function b(a,b){return l(function(){b.dispose(),!a.isDisposed&&a.observers.splice(a.observers.indexOf(b),1)})}function c(a){var c=new k(this.scheduler,a),d=b(this,c);s(this),this._trim(this.scheduler.now()),this.observers.push(c);for(var e=0,f=this.q.length;f>e;e++)c.onNext(this.q[e].value);return this.hasError?c.onError(this.error):this.isStopped&&c.onCompleted(),c.ensureActive(),d}function e(b,d,e){this.bufferSize=null==b?f:b,this.windowSize=null==d?f:d,this.scheduler=e||o,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,c)}var f=Math.pow(2,53)-1;return q(e,a),r(e.prototype,j.prototype,{hasObservers:function(){return this.observers.length>0},_trim:function(a){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&a-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(a){if(s(this),!this.isStopped){var b=this.scheduler.now();this.q.push({interval:b,value:a}),this._trim(b);for(var c=0,e=d(this.observers),f=e.length;f>c;c++){var g=e[c];g.onNext(a),g.ensureActive()}}},onError:function(a){if(s(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var b=this.scheduler.now();this._trim(b);for(var c=0,e=d(this.observers),f=e.length;f>c;c++){var g=e[c];g.onError(a),g.ensureActive()}this.observers.length=0}},onCompleted:function(){if(s(this),!this.isStopped){this.isStopped=!0;var a=this.scheduler.now();this._trim(a);for(var b=0,c=d(this.observers),e=c.length;e>b;b++){var f=c[b];f.onCompleted(),f.ensureActive()}this.observers.length=0}},dispose:function(){this.isDisposed=!0,this.observers=null}}),e}(e),w=c.ConnectableObservable=function(a){function b(b,c){var d,e=!1,f=b.asObservable();this.connect=function(){return e||(e=!0,d=new n(f.subscribe(c),l(function(){e=!1}))),d},a.call(this,function(a){return c.subscribe(a)})}return q(b,a),b.prototype.refCount=function(){var a,b=0,c=this;return new g(function(d){var e=1===++b,f=c.subscribe(d);return e&&(a=c.connect()),function(){f.dispose(),0===--b&&a.dispose()}})},b}(e);return c});
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a){for(var b=a.length,c=new Array(b),d=0;b>d;d++)c[d]=a[d];return c}var f=c.Observable,g=f.prototype,h=c.AnonymousObservable,i=c.Subject,j=c.AsyncSubject,k=c.Observer,l=c.internals.ScheduledObserver,m=c.Disposable.create,n=c.Disposable.empty,o=c.CompositeDisposable,p=c.Scheduler.currentThread,q=c.helpers.isFunction,r=c.internals.inherits,s=c.internals.addProperties,t=c.Disposable.checkDisposed;g.multicast=function(a,b){var c=this;return"function"==typeof a?new h(function(d){var e=c.multicast(a());return new o(b(e).subscribe(d),e.connect())},c):new x(c,a)},g.publish=function(a){return a&&q(a)?this.multicast(function(){return new i},a):this.multicast(new i)},g.share=function(){return this.publish().refCount()},g.publishLast=function(a){return a&&q(a)?this.multicast(function(){return new j},a):this.multicast(new j)},g.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new v(b)},a):this.multicast(new v(a))},g.shareValue=function(a){return this.publishValue(a).refCount()},g.replay=function(a,b,c,d){return a&&q(a)?this.multicast(function(){return new w(b,c,d)},a):this.multicast(new w(b,c,d))},g.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};var u=function(a,b){this.subject=a,this.observer=b};u.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1),this.observer=null}};var v=c.BehaviorSubject=function(a){function b(a){return t(this),this.isStopped?(this.hasError?a.onError(this.error):a.onCompleted(),n):(this.observers.push(a),a.onNext(this.value),new u(this,a))}function c(c){a.call(this,b),this.value=c,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.hasError=!1}return r(c,a),s(c.prototype,k,{getValue:function(){if(t(this),this.hasError)throw this.error;return this.value},hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(t(this),!this.isStopped){this.isStopped=!0;for(var a=0,b=e(this.observers),c=b.length;c>a;a++)b[a].onCompleted();this.observers.length=0}},onError:function(a){if(t(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var b=0,c=e(this.observers),d=c.length;d>b;b++)c[b].onError(a);this.observers.length=0}},onNext:function(a){if(t(this),!this.isStopped){this.value=a;for(var b=0,c=e(this.observers),d=c.length;d>b;b++)c[b].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),c}(f),w=c.ReplaySubject=function(a){function b(a,b){return m(function(){b.dispose(),!a.isDisposed&&a.observers.splice(a.observers.indexOf(b),1)})}function c(a){var c=new l(this.scheduler,a),d=b(this,c);t(this),this._trim(this.scheduler.now()),this.observers.push(c);for(var e=0,f=this.q.length;f>e;e++)c.onNext(this.q[e].value);return this.hasError?c.onError(this.error):this.isStopped&&c.onCompleted(),c.ensureActive(),d}function d(b,d,e){this.bufferSize=null==b?f:b,this.windowSize=null==d?f:d,this.scheduler=e||p,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,c)}var f=Math.pow(2,53)-1;return r(d,a),s(d.prototype,k.prototype,{hasObservers:function(){return this.observers.length>0},_trim:function(a){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&a-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(a){if(t(this),!this.isStopped){var b=this.scheduler.now();this.q.push({interval:b,value:a}),this._trim(b);for(var c=0,d=e(this.observers),f=d.length;f>c;c++){var g=d[c];g.onNext(a),g.ensureActive()}}},onError:function(a){if(t(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var b=this.scheduler.now();this._trim(b);for(var c=0,d=e(this.observers),f=d.length;f>c;c++){var g=d[c];g.onError(a),g.ensureActive()}this.observers.length=0}},onCompleted:function(){if(t(this),!this.isStopped){this.isStopped=!0;var a=this.scheduler.now();this._trim(a);for(var b=0,c=e(this.observers),d=c.length;d>b;b++){var f=c[b];f.onCompleted(),f.ensureActive()}this.observers.length=0}},dispose:function(){this.isDisposed=!0,this.observers=null}}),d}(f),x=c.ConnectableObservable=function(a){function b(b,c){var d,e=!1,f=b.asObservable();this.connect=function(){return e||(e=!0,d=new o(f.subscribe(c),m(function(){e=!1}))),d},a.call(this,function(a){return c.subscribe(a)})}return r(b,a),b.prototype.refCount=function(){var a,b=0,c=this;return new h(function(d){var e=1===++b,f=c.subscribe(d);return e&&(a=c.connect()),function(){f.dispose(),0===--b&&a.dispose()}})},b}(f);return g.singleInstance=function(){function a(){return d||(d=!0,b=c["finally"](function(){d=!1}).publish().refCount()),b}var b,c=this,d=!1;return new h(function(b){return a().subscribe(b)})},c});
//# sourceMappingURL=rx.binding.map
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){return a.groupJoin(this,b,o,function(a,b){return b})}function f(a){var b=this;return new q(function(c){var d=new m,e=new i,f=new j(e);return c.onNext(r(d,f)),e.add(b.subscribe(function(a){d.onNext(a)},function(a){d.onError(a),c.onError(a)},function(){d.onCompleted(),c.onCompleted()})),w(a)&&(a=x(a)),e.add(a.subscribe(function(){d.onCompleted(),d=new m,c.onNext(r(d,f))},function(a){d.onError(a),c.onError(a)},function(){d.onCompleted(),c.onCompleted()})),f},b)}function g(a){var b=this;return new q(function(c){function d(){var b;try{b=a()}catch(f){return void c.onError(f)}w(b)&&(b=x(b));var i=new k;e.setDisposable(i),i.setDisposable(b.take(1).subscribe(u,function(a){h.onError(a),c.onError(a)},function(){h.onCompleted(),h=new m,c.onNext(r(h,g)),d()}))}var e=new l,f=new i(e),g=new j(f),h=new m;return c.onNext(r(h,g)),f.add(b.subscribe(function(a){h.onNext(a)},function(a){h.onError(a),c.onError(a)},function(){h.onCompleted(),c.onCompleted()})),d(),g},b)}var h=c.Observable,i=c.CompositeDisposable,j=c.RefCountDisposable,k=c.SingleAssignmentDisposable,l=c.SerialDisposable,m=c.Subject,n=h.prototype,o=h.empty,p=h.never,q=c.AnonymousObservable,r=(c.Observer.create,c.internals.addRef),s=c.internals.isEqual,t=c.internals.inherits,u=c.helpers.noop,v=c.helpers.identity,w=c.helpers.isPromise,x=h.fromPromise,y=c.ArgumentOutOfRangeError,z=function(){function a(a){if(0===(1&a))return 2===a;for(var b=Math.sqrt(a),c=3;b>=c;){if(a%c===0)return!1;c+=2}return!0}function b(b){var c,d,e;for(c=0;c<h.length;++c)if(d=h[c],d>=b)return d;for(e=1|b;e<h[h.length-1];){if(a(e))return e;e+=2}return b}function c(a){var b=757602046;if(!a.length)return b;for(var c=0,d=a.length;d>c;c++){var e=a.charCodeAt(c);b=(b<<5)-b+e,b&=b}return b}function e(a){var b=668265261;return a=61^a^a>>>16,a+=a<<3,a^=a>>>4,a*=b,a^=a>>>15}function f(){return{key:null,value:null,next:0,hashCode:0}}function g(a,b){if(0>a)throw new y;a>0&&this._initialize(a),this.comparer=b||s,this.freeCount=0,this.size=0,this.freeList=-1}var h=[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],i="no such key",j="duplicate key",k=function(){var a=0;return function(b){if(null==b)throw new Error(i);if("string"==typeof b)return c(b);if("number"==typeof b)return e(b);if("boolean"==typeof b)return b===!0?1:0;if(b instanceof Date)return e(b.valueOf());if(b instanceof RegExp)return c(b.toString());if("function"==typeof b.valueOf){var d=b.valueOf();if("number"==typeof d)return e(d);if("string"==typeof d)return c(d)}if(b.hashCode)return b.hashCode();var f=17*a++;return b.hashCode=function(){return f},f}}(),l=g.prototype;return l._initialize=function(a){var c,d=b(a);for(this.buckets=new Array(d),this.entries=new Array(d),c=0;d>c;c++)this.buckets[c]=-1,this.entries[c]=f();this.freeList=-1},l.add=function(a,b){this._insert(a,b,!0)},l._insert=function(a,b,c){this.buckets||this._initialize(0);for(var d,e=2147483647&k(a),f=e%this.buckets.length,g=this.buckets[f];g>=0;g=this.entries[g].next)if(this.entries[g].hashCode===e&&this.comparer(this.entries[g].key,a)){if(c)throw new Error(j);return void(this.entries[g].value=b)}this.freeCount>0?(d=this.freeList,this.freeList=this.entries[d].next,--this.freeCount):(this.size===this.entries.length&&(this._resize(),f=e%this.buckets.length),d=this.size,++this.size),this.entries[d].hashCode=e,this.entries[d].next=this.buckets[f],this.entries[d].key=a,this.entries[d].value=b,this.buckets[f]=d},l._resize=function(){var a=b(2*this.size),c=new Array(a);for(e=0;e<c.length;++e)c[e]=-1;var d=new Array(a);for(e=0;e<this.size;++e)d[e]=this.entries[e];for(var e=this.size;a>e;++e)d[e]=f();for(var g=0;g<this.size;++g){var h=d[g].hashCode%a;d[g].next=c[h],c[h]=g}this.buckets=c,this.entries=d},l.remove=function(a){if(this.buckets)for(var b=2147483647&k(a),c=b%this.buckets.length,d=-1,e=this.buckets[c];e>=0;e=this.entries[e].next){if(this.entries[e].hashCode===b&&this.comparer(this.entries[e].key,a))return 0>d?this.buckets[c]=this.entries[e].next:this.entries[d].next=this.entries[e].next,this.entries[e].hashCode=-1,this.entries[e].next=this.freeList,this.entries[e].key=null,this.entries[e].value=null,this.freeList=e,++this.freeCount,!0;d=e}return!1},l.clear=function(){var a,b;if(!(this.size<=0)){for(a=0,b=this.buckets.length;b>a;++a)this.buckets[a]=-1;for(a=0;a<this.size;++a)this.entries[a]=f();this.freeList=-1,this.size=0}},l._findEntry=function(a){if(this.buckets)for(var b=2147483647&k(a),c=this.buckets[b%this.buckets.length];c>=0;c=this.entries[c].next)if(this.entries[c].hashCode===b&&this.comparer(this.entries[c].key,a))return c;return-1},l.count=function(){return this.size-this.freeCount},l.tryGetValue=function(a){var b=this._findEntry(a);return b>=0?this.entries[b].value:d},l.getValues=function(){var a=0,b=[];if(this.entries)for(var c=0;c<this.size;c++)this.entries[c].hashCode>=0&&(b[a++]=this.entries[c].value);return b},l.get=function(a){var b=this._findEntry(a);if(b>=0)return this.entries[b].value;throw new Error(i)},l.set=function(a,b){this._insert(a,b,!1)},l.containskey=function(a){return this._findEntry(a)>=0},g}();n.join=function(a,b,c,d){var e=this;return new q(function(f){var g=new i,h=!1,j=!1,l=0,m=0,n=new z,o=new z;return g.add(e.subscribe(function(a){var c=l++,e=new k;n.add(c,a),g.add(e);var i,j=function(){n.remove(c)&&0===n.count()&&h&&f.onCompleted(),g.remove(e)};try{i=b(a)}catch(m){return void f.onError(m)}e.setDisposable(i.take(1).subscribe(u,f.onError.bind(f),j)),o.getValues().forEach(function(b){var c;try{c=d(a,b)}catch(e){return void f.onError(e)}f.onNext(c)})},f.onError.bind(f),function(){h=!0,(j||0===n.count())&&f.onCompleted()})),g.add(a.subscribe(function(a){var b=m++,e=new k;o.add(b,a),g.add(e);var h,i=function(){o.remove(b)&&0===o.count()&&j&&f.onCompleted(),g.remove(e)};try{h=c(a)}catch(l){return void f.onError(l)}e.setDisposable(h.take(1).subscribe(u,f.onError.bind(f),i)),n.getValues().forEach(function(b){var c;try{c=d(b,a)}catch(e){return void f.onError(e)}f.onNext(c)})},f.onError.bind(f),function(){j=!0,(h||0===o.count())&&f.onCompleted()})),g},e)},n.groupJoin=function(a,b,c,d){var e=this;return new q(function(f){function g(a){return function(b){b.onError(a)}}var h=new i,l=new j(h),n=new z,o=new z,p=0,q=0;return h.add(e.subscribe(function(a){var c=new m,e=p++;n.add(e,c);var i;try{i=d(a,r(c,l))}catch(j){return n.getValues().forEach(g(j)),void f.onError(j)}f.onNext(i),o.getValues().forEach(function(a){c.onNext(a)});var q=new k;h.add(q);var s,t=function(){n.remove(e)&&c.onCompleted(),h.remove(q)};try{s=b(a)}catch(j){return n.getValues().forEach(g(j)),void f.onError(j)}q.setDisposable(s.take(1).subscribe(u,function(a){n.getValues().forEach(g(a)),f.onError(a)},t))},function(a){n.getValues().forEach(g(a)),f.onError(a)},f.onCompleted.bind(f))),h.add(a.subscribe(function(a){var b=q++;o.add(b,a);var d=new k;h.add(d);var e,i=function(){o.remove(b),h.remove(d)};try{e=c(a)}catch(j){return n.getValues().forEach(g(j)),void f.onError(j)}d.setDisposable(e.take(1).subscribe(u,function(a){n.getValues().forEach(g(a)),f.onError(a)},i)),n.getValues().forEach(function(b){b.onNext(a)})},function(a){n.getValues().forEach(g(a)),f.onError(a)})),l},e)},n.buffer=function(){return this.window.apply(this,arguments).selectMany(function(a){return a.toArray()})},n.window=function(a,b){return 1===arguments.length&&"function"!=typeof arguments[0]?f.call(this,a):"function"==typeof a?g.call(this,a):e.call(this,a,b)},n.pairwise=function(){var a=this;return new q(function(b){var c,d=!1;return a.subscribe(function(a){d?b.onNext([c,a]):d=!0,c=a},b.onError.bind(b),b.onCompleted.bind(b))},a)},n.partition=function(a,b){return[this.filter(a,b),this.filter(function(c,d,e){return!a.call(b,c,d,e)})]},n.groupBy=function(a,b,c){return this.groupByUntil(a,b,p,c)},n.groupByUntil=function(a,b,c,d){var e=this;return b||(b=v),d||(d=s),new q(function(f){function g(a){return function(b){b.onError(a)}}var h=new z(0,d),l=new i,n=new j(l);return l.add(e.subscribe(function(d){var e;try{e=a(d)}catch(i){return h.getValues().forEach(g(i)),void f.onError(i)}var j=!1,o=h.tryGetValue(e);if(o||(o=new m,h.set(e,o),j=!0),j){var p=new A(e,o,n),q=new A(e,o);try{duration=c(q)}catch(i){return h.getValues().forEach(g(i)),void f.onError(i)}f.onNext(p);var r=new k;l.add(r);var s=function(){h.remove(e)&&o.onCompleted(),l.remove(r)};r.setDisposable(duration.take(1).subscribe(u,function(a){h.getValues().forEach(g(a)),f.onError(a)},s))}var t;try{t=b(d)}catch(i){return h.getValues().forEach(g(i)),void f.onError(i)}o.onNext(t)},function(a){h.getValues().forEach(g(a)),f.onError(a)},function(){h.getValues().forEach(function(a){a.onCompleted()}),f.onCompleted()})),n},e)};var A=function(a){function b(a){return this.underlyingObservable.subscribe(a)}function c(c,d,e){a.call(this,b),this.key=c,this.underlyingObservable=e?new q(function(a){return new i(e.getDisposable(),d.subscribe(a))}):d}return t(c,a),c}(h);return c});
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){return a.groupJoin(this,b,o,function(a,b){return b})}function f(a){var b=this;return new q(function(c){var d=new m,e=new i,f=new j(e);return c.onNext(r(d,f)),e.add(b.subscribe(function(a){d.onNext(a)},function(a){d.onError(a),c.onError(a)},function(){d.onCompleted(),c.onCompleted()})),w(a)&&(a=x(a)),e.add(a.subscribe(function(a){d.onCompleted(),d=new m,c.onNext(r(d,f))},function(a){d.onError(a),c.onError(a)},function(){d.onCompleted(),c.onCompleted()})),f},b)}function g(a){var b=this;return new q(function(c){function d(){var b;try{b=a()}catch(f){return void c.onError(f)}w(b)&&(b=x(b));var i=new k;e.setDisposable(i),i.setDisposable(b.take(1).subscribe(u,function(a){h.onError(a),c.onError(a)},function(){h.onCompleted(),h=new m,c.onNext(r(h,g)),d()}))}var e=new l,f=new i(e),g=new j(f),h=new m;return c.onNext(r(h,g)),f.add(b.subscribe(function(a){h.onNext(a)},function(a){h.onError(a),c.onError(a)},function(){h.onCompleted(),c.onCompleted()})),d(),g},b)}var h=c.Observable,i=c.CompositeDisposable,j=c.RefCountDisposable,k=c.SingleAssignmentDisposable,l=c.SerialDisposable,m=c.Subject,n=h.prototype,o=h.empty,p=h.never,q=c.AnonymousObservable,r=(c.Observer.create,c.internals.addRef),s=c.internals.isEqual,t=c.internals.inherits,u=c.helpers.noop,v=c.helpers.identity,w=c.helpers.isPromise,x=h.fromPromise,y=c.ArgumentOutOfRangeError,z=function(){function a(a){if(0===(1&a))return 2===a;for(var b=Math.sqrt(a),c=3;b>=c;){if(a%c===0)return!1;c+=2}return!0}function b(b){var c,d,e;for(c=0;c<h.length;++c)if(d=h[c],d>=b)return d;for(e=1|b;e<h[h.length-1];){if(a(e))return e;e+=2}return b}function c(a){var b=757602046;if(!a.length)return b;for(var c=0,d=a.length;d>c;c++){var e=a.charCodeAt(c);b=(b<<5)-b+e,b&=b}return b}function e(a){var b=668265261;return a=61^a^a>>>16,a+=a<<3,a^=a>>>4,a*=b,a^=a>>>15}function f(){return{key:null,value:null,next:0,hashCode:0}}function g(a,b){if(0>a)throw new y;a>0&&this._initialize(a),this.comparer=b||s,this.freeCount=0,this.size=0,this.freeList=-1}var h=[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],i="no such key",j="duplicate key",k=function(){var a=0;return function(b){if(null==b)throw new Error(i);if("string"==typeof b)return c(b);if("number"==typeof b)return e(b);if("boolean"==typeof b)return b===!0?1:0;if(b instanceof Date)return e(b.valueOf());if(b instanceof RegExp)return c(b.toString());if("function"==typeof b.valueOf){var d=b.valueOf();if("number"==typeof d)return e(d);if("string"==typeof d)return c(d)}if(b.hashCode)return b.hashCode();var f=17*a++;return b.hashCode=function(){return f},f}}(),l=g.prototype;return l._initialize=function(a){var c,d=b(a);for(this.buckets=new Array(d),this.entries=new Array(d),c=0;d>c;c++)this.buckets[c]=-1,this.entries[c]=f();this.freeList=-1},l.add=function(a,b){this._insert(a,b,!0)},l._insert=function(a,b,c){this.buckets||this._initialize(0);for(var d,e=2147483647&k(a),f=e%this.buckets.length,g=this.buckets[f];g>=0;g=this.entries[g].next)if(this.entries[g].hashCode===e&&this.comparer(this.entries[g].key,a)){if(c)throw new Error(j);return void(this.entries[g].value=b)}this.freeCount>0?(d=this.freeList,this.freeList=this.entries[d].next,--this.freeCount):(this.size===this.entries.length&&(this._resize(),f=e%this.buckets.length),d=this.size,++this.size),this.entries[d].hashCode=e,this.entries[d].next=this.buckets[f],this.entries[d].key=a,this.entries[d].value=b,this.buckets[f]=d},l._resize=function(){var a=b(2*this.size),c=new Array(a);for(e=0;e<c.length;++e)c[e]=-1;var d=new Array(a);for(e=0;e<this.size;++e)d[e]=this.entries[e];for(var e=this.size;a>e;++e)d[e]=f();for(var g=0;g<this.size;++g){var h=d[g].hashCode%a;d[g].next=c[h],c[h]=g}this.buckets=c,this.entries=d},l.remove=function(a){if(this.buckets)for(var b=2147483647&k(a),c=b%this.buckets.length,d=-1,e=this.buckets[c];e>=0;e=this.entries[e].next){if(this.entries[e].hashCode===b&&this.comparer(this.entries[e].key,a))return 0>d?this.buckets[c]=this.entries[e].next:this.entries[d].next=this.entries[e].next,this.entries[e].hashCode=-1,this.entries[e].next=this.freeList,this.entries[e].key=null,this.entries[e].value=null,this.freeList=e,++this.freeCount,!0;d=e}return!1},l.clear=function(){var a,b;if(!(this.size<=0)){for(a=0,b=this.buckets.length;b>a;++a)this.buckets[a]=-1;for(a=0;a<this.size;++a)this.entries[a]=f();this.freeList=-1,this.size=0}},l._findEntry=function(a){if(this.buckets)for(var b=2147483647&k(a),c=this.buckets[b%this.buckets.length];c>=0;c=this.entries[c].next)if(this.entries[c].hashCode===b&&this.comparer(this.entries[c].key,a))return c;return-1},l.count=function(){return this.size-this.freeCount},l.tryGetValue=function(a){var b=this._findEntry(a);return b>=0?this.entries[b].value:d},l.getValues=function(){var a=0,b=[];if(this.entries)for(var c=0;c<this.size;c++)this.entries[c].hashCode>=0&&(b[a++]=this.entries[c].value);return b},l.get=function(a){var b=this._findEntry(a);if(b>=0)return this.entries[b].value;throw new Error(i)},l.set=function(a,b){this._insert(a,b,!1)},l.containskey=function(a){return this._findEntry(a)>=0},g}();n.join=function(a,b,c,d){var e=this;return new q(function(f){var g=new i,h=!1,j=!1,l=0,m=0,n=new z,o=new z;return g.add(e.subscribe(function(a){var c=l++,e=new k;n.add(c,a),g.add(e);var i,j=function(){n.remove(c)&&0===n.count()&&h&&f.onCompleted(),g.remove(e)};try{i=b(a)}catch(m){return void f.onError(m)}e.setDisposable(i.take(1).subscribe(u,f.onError.bind(f),j)),o.getValues().forEach(function(b){var c;try{c=d(a,b)}catch(e){return void f.onError(e)}f.onNext(c)})},f.onError.bind(f),function(){h=!0,(j||0===n.count())&&f.onCompleted()})),g.add(a.subscribe(function(a){var b=m++,e=new k;o.add(b,a),g.add(e);var h,i=function(){o.remove(b)&&0===o.count()&&j&&f.onCompleted(),g.remove(e)};try{h=c(a)}catch(l){return void f.onError(l)}e.setDisposable(h.take(1).subscribe(u,f.onError.bind(f),i)),n.getValues().forEach(function(b){var c;try{c=d(b,a)}catch(e){return void f.onError(e)}f.onNext(c)})},f.onError.bind(f),function(){j=!0,(h||0===o.count())&&f.onCompleted()})),g},e)},n.groupJoin=function(a,b,c,d){var e=this;return new q(function(f){function g(a){return function(b){b.onError(a)}}var h=new i,l=new j(h),n=new z,o=new z,p=0,q=0;return h.add(e.subscribe(function(a){var c=new m,e=p++;n.add(e,c);var i;try{i=d(a,r(c,l))}catch(j){return n.getValues().forEach(g(j)),void f.onError(j)}f.onNext(i),o.getValues().forEach(function(a){c.onNext(a)});var q=new k;h.add(q);var s,t=function(){n.remove(e)&&c.onCompleted(),h.remove(q)};try{s=b(a)}catch(j){return n.getValues().forEach(g(j)),void f.onError(j)}q.setDisposable(s.take(1).subscribe(u,function(a){n.getValues().forEach(g(a)),f.onError(a)},t))},function(a){n.getValues().forEach(g(a)),f.onError(a)},f.onCompleted.bind(f))),h.add(a.subscribe(function(a){var b=q++;o.add(b,a);var d=new k;h.add(d);var e,i=function(){o.remove(b),h.remove(d)};try{e=c(a)}catch(j){return n.getValues().forEach(g(j)),void f.onError(j)}d.setDisposable(e.take(1).subscribe(u,function(a){n.getValues().forEach(g(a)),f.onError(a)},i)),n.getValues().forEach(function(b){b.onNext(a)})},function(a){n.getValues().forEach(g(a)),f.onError(a)})),l},e)},n.buffer=function(a,b){return this.window.apply(this,arguments).selectMany(function(a){return a.toArray()})},n.window=function(a,b){return 1===arguments.length&&"function"!=typeof arguments[0]?f.call(this,a):"function"==typeof a?g.call(this,a):e.call(this,a,b)},n.pairwise=function(){var a=this;return new q(function(b){var c,d=!1;return a.subscribe(function(a){d?b.onNext([c,a]):d=!0,c=a},b.onError.bind(b),b.onCompleted.bind(b))},a)},n.partition=function(a,b){return[this.filter(a,b),this.filter(function(c,d,e){return!a.call(b,c,d,e)})]},n.groupBy=function(a,b,c){return this.groupByUntil(a,b,p,c)},n.groupByUntil=function(a,b,c,d){var e=this;return b||(b=v),d||(d=s),new q(function(f){function g(a){return function(b){b.onError(a)}}var h=new z(0,d),l=new i,n=new j(l);return l.add(e.subscribe(function(d){var e;try{e=a(d)}catch(i){return h.getValues().forEach(g(i)),void f.onError(i)}var j=!1,o=h.tryGetValue(e);if(o||(o=new m,h.set(e,o),j=!0),j){var p=new A(e,o,n),q=new A(e,o);try{duration=c(q)}catch(i){return h.getValues().forEach(g(i)),void f.onError(i)}f.onNext(p);var r=new k;l.add(r);var s=function(){h.remove(e)&&o.onCompleted(),l.remove(r)};r.setDisposable(duration.take(1).subscribe(u,function(a){h.getValues().forEach(g(a)),f.onError(a)},s))}var t;try{t=b(d)}catch(i){return h.getValues().forEach(g(i)),void f.onError(i)}o.onNext(t)},function(a){h.getValues().forEach(g(a)),f.onError(a)},function(){h.getValues().forEach(function(a){a.onCompleted()}),f.onCompleted()})),n},e)};var A=function(a){function b(a){return this.underlyingObservable.subscribe(a)}function c(c,d,e){a.call(this,b),this.key=c,this.underlyingObservable=e?new q(function(a){return new i(e.getDisposable(),d.subscribe(a))}):d}return t(c,a),c}(h);return c});
//# sourceMappingURL=rx.coincidence.map

@@ -83,11 +83,24 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

var WhileEnumerable = (function(__super__) {
inherits(WhileEnumerable, __super__);
function WhileEnumerable(c, s) {
this.c = c;
this.s = s;
}
WhileEnumerable.prototype[$iterator$] = function () {
var self = this;
return {
next: function () {
return self.c() ?
{ done: false, value: self.s } :
{ done: true, value: void 0 };
}
};
};
return WhileEnumerable;
}(Enumerable));
function enumerableWhile(condition, source) {
return new Enumerable(function () {
return new Enumerator(function () {
return condition() ?
{ done: false, value: source } :
{ done: true, value: undefined };
});
});
}
return new WhileEnumerable(condition, source);
}

@@ -409,3 +422,3 @@ /**

*/
observableProto.manySelect = function (selector, scheduler) {
observableProto.manySelect = observableProto.extend = function (selector, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);

@@ -412,0 +425,0 @@ var source = this;

/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){return new q(function(){return new p(function(){return a()?{done:!1,value:b}:{done:!0,value:d}})})}var f=c.Observable,g=f.prototype,h=c.AnonymousObservable,i=f.concat,j=f.defer,k=f.empty,l=c.Disposable.empty,m=c.CompositeDisposable,n=c.SerialDisposable,o=c.SingleAssignmentDisposable,p=c.internals.Enumerator,q=c.internals.Enumerable,r=q.of,s=c.Scheduler.immediate,t=c.Scheduler.currentThread,u=(Array.prototype.slice,c.AsyncSubject),v=c.Observer,w=c.internals.inherits,x=c.internals.bindCallback,y=c.internals.addProperties,z=c.helpers,A=z.noop,B=z.isPromise,C=c.Scheduler.isScheduler,D=f.fromPromise,E="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";a.Set&&"function"==typeof(new a.Set)["@@iterator"]&&(E="@@iterator");c.doneEnumerator={done:!0,value:d},c.helpers.isIterable=function(a){return a[E]!==d},c.helpers.isArrayLike=function(a){return a&&a.length!==d};c.helpers.iterator=E,g.letBind=g.let=function(a){return a(this)},f["if"]=f.ifThen=function(a,b,c){return j(function(){return c||(c=k()),B(b)&&(b=D(b)),B(c)&&(c=D(c)),"function"==typeof c.now&&(c=k(c)),a()?b:c})},f["for"]=f.forIn=function(a,b,c){return r(a,b,c).concat()};var F=f["while"]=f.whileDo=function(a,b){return B(b)&&(b=D(b)),e(a,b).concat()};g.doWhile=function(a){return i([this,F(a,this)])},f["case"]=f.switchCase=function(a,b,c){return j(function(){B(c)&&(c=D(c)),c||(c=k()),"function"==typeof c.now&&(c=k(c));var d=b[a()];return B(d)&&(d=D(d)),d||c})},g.expand=function(a,b){C(b)||(b=s);var c=this;return new h(function(d){var e=[],f=new n,g=new m(f),h=0,i=!1,j=function(){var c=!1;e.length>0&&(c=!i,i=!0),c&&f.setDisposable(b.scheduleRecursive(function(b){var c;if(!(e.length>0))return void(i=!1);c=e.shift();var f=new o;g.add(f),f.setDisposable(c.subscribe(function(b){d.onNext(b);var c=null;try{c=a(b)}catch(f){d.onError(f)}e.push(c),h++,j()},d.onError.bind(d),function(){g.remove(f),h--,0===h&&d.onCompleted()})),b()}))};return e.push(c),h++,j(),g},this)},f.forkJoin=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return new h(function(b){var c=a.length;if(0===c)return b.onCompleted(),l;for(var d=new m,e=!1,f=new Array(c),g=new Array(c),h=new Array(c),i=0;c>i;i++)!function(i){var j=a[i];B(j)&&(j=D(j)),d.add(j.subscribe(function(a){e||(f[i]=!0,h[i]=a)},function(a){e=!0,b.onError(a),d.dispose()},function(){if(!e){if(!f[i])return void b.onCompleted();g[i]=!0;for(var a=0;c>a;a++)if(!g[a])return;e=!0,b.onNext(h),b.onCompleted()}}))}(i);return d})},g.forkJoin=function(a,b){var c=this;return new h(function(d){var e,f,g=!1,h=!1,i=!1,j=!1,k=new o,l=new o;return B(a)&&(a=D(a)),k.setDisposable(c.subscribe(function(a){i=!0,e=a},function(a){l.dispose(),d.onError(a)},function(){if(g=!0,h)if(i)if(j){var a;try{a=b(e,f)}catch(c){return void d.onError(c)}d.onNext(a),d.onCompleted()}else d.onCompleted();else d.onCompleted()})),l.setDisposable(a.subscribe(function(a){j=!0,f=a},function(a){k.dispose(),d.onError(a)},function(){if(h=!0,g)if(i)if(j){var a;try{a=b(e,f)}catch(c){return void d.onError(c)}d.onNext(a),d.onCompleted()}else d.onCompleted();else d.onCompleted()})),new m(k,l)},c)},g.manySelect=function(a,b){C(b)||(b=s);var c=this;return j(function(){var d;return c.map(function(a){var b=new G(a);return d&&d.onNext(a),d=b,b}).tap(A,function(a){d&&d.onError(a)},function(){d&&d.onCompleted()}).observeOn(b).map(a)},c)};var G=function(a){function b(a){var b=this,c=new m;return c.add(t.schedule(function(){a.onNext(b.head),c.add(b.tail.mergeAll().subscribe(a))})),c}function c(c){a.call(this,b),this.head=c,this.tail=new u}return w(c,a),y(c.prototype,v,{onCompleted:function(){this.onNext(f.empty())},onError:function(a){this.onNext(f.throwError(a))},onNext:function(a){this.tail.onNext(a),this.tail.onCompleted()}}),c}(f);return g.exclusive=function(){var a=this;return new h(function(b){var c=!1,d=!1,e=new o,f=new m;return f.add(e),e.setDisposable(a.subscribe(function(a){if(!c){c=!0,B(a)&&(a=D(a));var e=new o;f.add(e),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){f.remove(e),c=!1,d&&1===f.length&&b.onCompleted()}))}},b.onError.bind(b),function(){d=!0,c||1!==f.length||b.onCompleted()})),f},this)},g.exclusiveMap=function(a,b){var c=this,d=x(a,b,3);return new h(function(a){var b=0,e=!1,f=!0,g=new o,h=new m;return h.add(g),g.setDisposable(c.subscribe(function(c){e||(e=!0,innerSubscription=new o,h.add(innerSubscription),B(c)&&(c=D(c)),innerSubscription.setDisposable(c.subscribe(function(e){var f;try{f=d(e,b++,c)}catch(g){return void a.onError(g)}a.onNext(f)},function(b){a.onError(b)},function(){h.remove(innerSubscription),e=!1,f&&1===h.length&&a.onCompleted()})))},function(b){a.onError(b)},function(){f=!0,1!==h.length||e||a.onCompleted()})),h},this)},c});
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){return new E(a,b)}var f=c.Observable,g=f.prototype,h=c.AnonymousObservable,i=f.concat,j=f.defer,k=f.empty,l=c.Disposable.empty,m=c.CompositeDisposable,n=c.SerialDisposable,o=c.SingleAssignmentDisposable,p=(c.internals.Enumerator,c.internals.Enumerable),q=p.of,r=c.Scheduler.immediate,s=c.Scheduler.currentThread,t=(Array.prototype.slice,c.AsyncSubject),u=c.Observer,v=c.internals.inherits,w=c.internals.bindCallback,x=c.internals.addProperties,y=c.helpers,z=y.noop,A=y.isPromise,B=c.Scheduler.isScheduler,C=f.fromPromise,D="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";a.Set&&"function"==typeof(new a.Set)["@@iterator"]&&(D="@@iterator");c.doneEnumerator={done:!0,value:d},c.helpers.isIterable=function(a){return a[D]!==d},c.helpers.isArrayLike=function(a){return a&&a.length!==d};c.helpers.iterator=D;var E=function(a){function b(a,b){this.c=a,this.s=b}return v(b,a),b.prototype[D]=function(){var a=this;return{next:function(){return a.c()?{done:!1,value:a.s}:{done:!0,value:void 0}}}},b}(p);g.letBind=g.let=function(a){return a(this)},f["if"]=f.ifThen=function(a,b,c){return j(function(){return c||(c=k()),A(b)&&(b=C(b)),A(c)&&(c=C(c)),"function"==typeof c.now&&(c=k(c)),a()?b:c})},f["for"]=f.forIn=function(a,b,c){return q(a,b,c).concat()};var F=f["while"]=f.whileDo=function(a,b){return A(b)&&(b=C(b)),e(a,b).concat()};g.doWhile=function(a){return i([this,F(a,this)])},f["case"]=f.switchCase=function(a,b,c){return j(function(){A(c)&&(c=C(c)),c||(c=k()),"function"==typeof c.now&&(c=k(c));var d=b[a()];return A(d)&&(d=C(d)),d||c})},g.expand=function(a,b){B(b)||(b=r);var c=this;return new h(function(d){var e=[],f=new n,g=new m(f),h=0,i=!1,j=function(){var c=!1;e.length>0&&(c=!i,i=!0),c&&f.setDisposable(b.scheduleRecursive(function(b){var c;if(!(e.length>0))return void(i=!1);c=e.shift();var f=new o;g.add(f),f.setDisposable(c.subscribe(function(b){d.onNext(b);var c=null;try{c=a(b)}catch(f){d.onError(f)}e.push(c),h++,j()},d.onError.bind(d),function(){g.remove(f),h--,0===h&&d.onCompleted()})),b()}))};return e.push(c),h++,j(),g},this)},f.forkJoin=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return new h(function(b){var c=a.length;if(0===c)return b.onCompleted(),l;for(var d=new m,e=!1,f=new Array(c),g=new Array(c),h=new Array(c),i=0;c>i;i++)!function(i){var j=a[i];A(j)&&(j=C(j)),d.add(j.subscribe(function(a){e||(f[i]=!0,h[i]=a)},function(a){e=!0,b.onError(a),d.dispose()},function(){if(!e){if(!f[i])return void b.onCompleted();g[i]=!0;for(var a=0;c>a;a++)if(!g[a])return;e=!0,b.onNext(h),b.onCompleted()}}))}(i);return d})},g.forkJoin=function(a,b){var c=this;return new h(function(d){var e,f,g=!1,h=!1,i=!1,j=!1,k=new o,l=new o;return A(a)&&(a=C(a)),k.setDisposable(c.subscribe(function(a){i=!0,e=a},function(a){l.dispose(),d.onError(a)},function(){if(g=!0,h)if(i)if(j){var a;try{a=b(e,f)}catch(c){return void d.onError(c)}d.onNext(a),d.onCompleted()}else d.onCompleted();else d.onCompleted()})),l.setDisposable(a.subscribe(function(a){j=!0,f=a},function(a){k.dispose(),d.onError(a)},function(){if(h=!0,g)if(i)if(j){var a;try{a=b(e,f)}catch(c){return void d.onError(c)}d.onNext(a),d.onCompleted()}else d.onCompleted();else d.onCompleted()})),new m(k,l)},c)},g.manySelect=g.extend=function(a,b){B(b)||(b=r);var c=this;return j(function(){var d;return c.map(function(a){var b=new G(a);return d&&d.onNext(a),d=b,b}).tap(z,function(a){d&&d.onError(a)},function(){d&&d.onCompleted()}).observeOn(b).map(a)},c)};var G=function(a){function b(a){var b=this,c=new m;return c.add(s.schedule(function(){a.onNext(b.head),c.add(b.tail.mergeAll().subscribe(a))})),c}function c(c){a.call(this,b),this.head=c,this.tail=new t}return v(c,a),x(c.prototype,u,{onCompleted:function(){this.onNext(f.empty())},onError:function(a){this.onNext(f.throwError(a))},onNext:function(a){this.tail.onNext(a),this.tail.onCompleted()}}),c}(f);return g.exclusive=function(){var a=this;return new h(function(b){var c=!1,d=!1,e=new o,f=new m;return f.add(e),e.setDisposable(a.subscribe(function(a){if(!c){c=!0,A(a)&&(a=C(a));var e=new o;f.add(e),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){f.remove(e),c=!1,d&&1===f.length&&b.onCompleted()}))}},b.onError.bind(b),function(){d=!0,c||1!==f.length||b.onCompleted()})),f},this)},g.exclusiveMap=function(a,b){var c=this,d=w(a,b,3);return new h(function(a){var b=0,e=!1,f=!0,g=new o,h=new m;return h.add(g),g.setDisposable(c.subscribe(function(c){e||(e=!0,innerSubscription=new o,h.add(innerSubscription),A(c)&&(c=C(c)),innerSubscription.setDisposable(c.subscribe(function(e){var f;try{f=d(e,b++,c)}catch(g){return void a.onError(g)}a.onNext(f)},function(b){a.onError(b)},function(){h.remove(innerSubscription),e=!1,f&&1===h.length&&a.onCompleted()})))},function(b){a.onError(b)},function(){f=!0,1!==h.length||e||a.onCompleted()})),h},this)},c});
//# sourceMappingURL=rx.experimental.map
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a){this.patterns=a}function f(a,b){this.expression=a,this.selector=b}function g(a,b,c){var d=a.get(b);if(!d){var e=new t(b,c);return a.set(b,e),e}return d}function h(a,b,c){this.joinObserverArray=a,this.onNext=b,this.onCompleted=c,this.joinObservers=new s;for(var d=0,e=this.joinObserverArray.length;e>d;d++){var f=this.joinObserverArray[d];this.joinObservers.set(f,f)}}var i=c.Observable,j=i.prototype,k=c.AnonymousObservable,l=i.throwError,m=c.Observer.create,n=c.SingleAssignmentDisposable,o=c.CompositeDisposable,p=c.internals.AbstractObserver,q=c.helpers.noop,r=(c.internals.isEqual,c.internals.inherits),s=(c.internals.Enumerable,c.internals.Enumerator,c.iterator,c.doneEnumerator,a.Map||function(){function a(){this._keys=[],this._values=[]}return a.prototype.get=function(a){var b=this._keys.indexOf(a);return-1!==b?this._values[b]:d},a.prototype.set=function(a,b){var c=this._keys.indexOf(a);-1!==c&&(this._values[c]=b),this._values[this._keys.push(a)-1]=b},a.prototype.forEach=function(a,b){for(var c=0,d=this._keys.length;d>c;c++)a.call(b,this._values[c],this._keys[c])},a}());e.prototype.and=function(a){return new e(this.patterns.concat(a))},e.prototype.thenDo=function(a){return new f(this,a)},f.prototype.activate=function(a,b,c){for(var d=this,e=[],f=0,i=this.expression.patterns.length;i>f;f++)e.push(g(a,this.expression.patterns[f],b.onError.bind(b)));var j=new h(e,function(){var a;try{a=d.selector.apply(d,arguments)}catch(c){return void b.onError(c)}b.onNext(a)},function(){for(var a=0,b=e.length;b>a;a++)e[a].removeActivePlan(j);c(j)});for(f=0,i=e.length;i>f;f++)e[f].addActivePlan(j);return j},h.prototype.dequeue=function(){this.joinObservers.forEach(function(a){a.queue.shift()})},h.prototype.match=function(){var a,b,c=!0;for(a=0,b=this.joinObserverArray.length;b>a;a++)if(0===this.joinObserverArray[a].queue.length){c=!1;break}if(c){var d=[],e=!1;for(a=0,b=this.joinObserverArray.length;b>a;a++)d.push(this.joinObserverArray[a].queue[0]),"C"===this.joinObserverArray[a].queue[0].kind&&(e=!0);if(e)this.onCompleted();else{this.dequeue();var f=[];for(a=0,b=d.length;a<d.length;a++)f.push(d[a].value);this.onNext.apply(this,f)}}};var t=function(a){function b(b,c){a.call(this),this.source=b,this.onError=c,this.queue=[],this.activePlans=[],this.subscription=new n,this.isDisposed=!1}r(b,a);var c=b.prototype;return c.next=function(a){if(!this.isDisposed){if("E"===a.kind)return this.onError(a.exception);this.queue.push(a);for(var b=this.activePlans.slice(0),c=0,d=b.length;d>c;c++)b[c].match()}},c.error=q,c.completed=q,c.addActivePlan=function(a){this.activePlans.push(a)},c.subscribe=function(){this.subscription.setDisposable(this.source.materialize().subscribe(this))},c.removeActivePlan=function(a){this.activePlans.splice(this.activePlans.indexOf(a),1),0===this.activePlans.length&&this.dispose()},c.dispose=function(){a.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},b}(p);return j.and=function(a){return new e([this,a])},j.thenDo=function(a){return new e([this]).thenDo(a)},i.when=function(){var a,b=arguments.length;if(Array.isArray(arguments[0]))a=arguments[0];else{a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new k(function(b){var c=[],d=new s,e=m(function(a){b.onNext(a)},function(a){d.forEach(function(b){b.onError(a)}),b.onError(a)},function(){b.onCompleted()});try{for(var f=0,g=a.length;g>f;f++)c.push(a[f].activate(d,e,function(a){var d=c.indexOf(a);c.splice(d,1),0===c.length&&b.onCompleted()}))}catch(h){l(h).subscribe(b)}var i=new o;return d.forEach(function(a){a.subscribe(),i.add(a)}),i})},c});
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a){this.patterns=a}function f(a,b){this.expression=a,this.selector=b}function g(a,b,c){var d=a.get(b);if(!d){var e=new t(b,c);return a.set(b,e),e}return d}function h(a,b,c){this.joinObserverArray=a,this.onNext=b,this.onCompleted=c,this.joinObservers=new s;for(var d=0,e=this.joinObserverArray.length;e>d;d++){var f=this.joinObserverArray[d];this.joinObservers.set(f,f)}}var i=c.Observable,j=i.prototype,k=c.AnonymousObservable,l=i.throwError,m=c.Observer.create,n=c.SingleAssignmentDisposable,o=c.CompositeDisposable,p=c.internals.AbstractObserver,q=c.helpers.noop,r=(c.internals.isEqual,c.internals.inherits),s=(c.internals.Enumerable,c.internals.Enumerator,c.iterator,c.doneEnumerator,a.Map||function(){function a(){this._keys=[],this._values=[]}return a.prototype.get=function(a){var b=this._keys.indexOf(a);return-1!==b?this._values[b]:d},a.prototype.set=function(a,b){var c=this._keys.indexOf(a);-1!==c&&(this._values[c]=b),this._values[this._keys.push(a)-1]=b},a.prototype.forEach=function(a,b){for(var c=0,d=this._keys.length;d>c;c++)a.call(b,this._values[c],this._keys[c])},a}());e.prototype.and=function(a){return new e(this.patterns.concat(a))},e.prototype.thenDo=function(a){return new f(this,a)},f.prototype.activate=function(a,b,c){for(var d=this,e=[],f=0,i=this.expression.patterns.length;i>f;f++)e.push(g(a,this.expression.patterns[f],b.onError.bind(b)));var j=new h(e,function(){var a;try{a=d.selector.apply(d,arguments)}catch(c){return void b.onError(c)}b.onNext(a)},function(){for(var a=0,b=e.length;b>a;a++)e[a].removeActivePlan(j);c(j)});for(f=0,i=e.length;i>f;f++)e[f].addActivePlan(j);return j},h.prototype.dequeue=function(){this.joinObservers.forEach(function(a){a.queue.shift()})},h.prototype.match=function(){var a,b,c=!0;for(a=0,b=this.joinObserverArray.length;b>a;a++)if(0===this.joinObserverArray[a].queue.length){c=!1;break}if(c){var d=[],e=!1;for(a=0,b=this.joinObserverArray.length;b>a;a++)d.push(this.joinObserverArray[a].queue[0]),"C"===this.joinObserverArray[a].queue[0].kind&&(e=!0);if(e)this.onCompleted();else{this.dequeue();var f=[];for(a=0,b=d.length;a<d.length;a++)f.push(d[a].value);this.onNext.apply(this,f)}}};var t=function(a){function b(b,c){a.call(this),this.source=b,this.onError=c,this.queue=[],this.activePlans=[],this.subscription=new n,this.isDisposed=!1}r(b,a);var c=b.prototype;return c.next=function(a){if(!this.isDisposed){if("E"===a.kind)return this.onError(a.exception);this.queue.push(a);for(var b=this.activePlans.slice(0),c=0,d=b.length;d>c;c++)b[c].match()}},c.error=q,c.completed=q,c.addActivePlan=function(a){this.activePlans.push(a)},c.subscribe=function(){this.subscription.setDisposable(this.source.materialize().subscribe(this))},c.removeActivePlan=function(a){this.activePlans.splice(this.activePlans.indexOf(a),1),0===this.activePlans.length&&this.dispose()},c.dispose=function(){a.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},b}(p);return j.and=function(a){return new e([this,a])},j.thenDo=function(a){return new e([this]).thenDo(a)},i.when=function(){var a,b=arguments.length;if(Array.isArray(arguments[0]))a=arguments[0];else{a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new k(function(b){var c=[],d=new s,e=m(function(a){b.onNext(a)},function(a){d.forEach(function(b){b.onError(a)}),b.onError(a)},function(a){b.onCompleted()});try{for(var f=0,g=a.length;g>f;f++)c.push(a[f].activate(d,e,function(a){var d=c.indexOf(a);c.splice(d,1),0===c.length&&b.onCompleted()}))}catch(h){l(h).subscribe(b)}var i=new o;return d.forEach(function(a){a.subscribe(),i.add(a)}),i})},c});
//# sourceMappingURL=rx.joinpatterns.map

@@ -341,15 +341,9 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

choiceL();
if (choice === leftChoice) {
observer.onNext(left);
}
choice === leftChoice && observer.onNext(left);
}, function (err) {
choiceL();
if (choice === leftChoice) {
observer.onError(err);
}
choice === leftChoice && observer.onError(err);
}, function () {
choiceL();
if (choice === leftChoice) {
observer.onCompleted();
}
choice === leftChoice && observer.onCompleted();
}));

@@ -359,15 +353,9 @@

choiceR();
if (choice === rightChoice) {
observer.onNext(right);
}
choice === rightChoice && observer.onNext(right);
}, function (err) {
choiceR();
if (choice === rightChoice) {
observer.onError(err);
}
choice === rightChoice && observer.onError(err);
}, function () {
choiceR();
if (choice === rightChoice) {
observer.onCompleted();
}
choice === rightChoice && observer.onCompleted();
}));

@@ -622,3 +610,24 @@

/**
* Returns an observable sequence that shares a single subscription to the underlying sequence. This observable sequence
* can be resubscribed to, even if all prior subscriptions have ended. (unlike `.publish().refCount()`)
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source.
*/
observableProto.singleInstance = function() {
var source = this, hasObservable = false, observable;
function getObservable() {
if (!hasObservable) {
hasObservable = true;
observable = source.finally(function() { hasObservable = false; }).publish().refCount();
}
return observable;
};
return new AnonymousObservable(function(o) {
return getObservable().subscribe(o);
});
};
return Rx;
}));
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx-lite-compat"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("rx-lite-compat")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function f(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function g(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function h(a){this.comparer=a,this.set=[]}var i=c.Observable,j=i.prototype,k=i.never,l=i.throwException,m=c.AnonymousObservable,n=c.AnonymousObserver,o=c.Notification.createOnNext,p=c.Notification.createOnError,q=c.Notification.createOnCompleted,r=c.Observer,s=c.Subject,t=c.internals,u=c.helpers,v=t.ScheduledObserver,w=c.SerialDisposable,x=c.SingleAssignmentDisposable,y=c.CompositeDisposable,z=c.RefCountDisposable,A=c.Disposable.empty,B=c.Scheduler.immediate,C=(u.defaultKeySerializer,c.internals.addRef),D=(u.identity,u.isPromise),E=t.inherits,F=t.bindCallback,G=(u.noop,c.Scheduler.isScheduler),H=i.fromPromise,I=c.ArgumentOutOfRangeError;e.prototype.dispose=function(){this.scheduler.scheduleWithState(this,f)};var J=function(a){function b(b){a.call(this),this._observer=b,this._state=0}E(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();var b=tryCatch(this._observer.onNext).call(this._observer,a);this._state=0,b===errorObj&&thrower(b.e)},c.onError=function(a){this.checkAccess();var b=tryCatch(this._observer.onError).call(this._observer,a);this._state=2,b===errorObj&&thrower(b.e)},c.onCompleted=function(){this.checkAccess();var a=tryCatch(this._observer.onCompleted).call(this._observer);this._state=2,a===errorObj&&thrower(a.e)},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(r),K=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return E(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(v);r.prototype.checked=function(){return new J(this)},r.notifyOn=function(a){return new K(a,this)},r.fromNotifier=function(a,b){var c=F(a,b,1);return new n(function(a){return c(o(a))},function(a){return c(p(a))},function(){return c(q())})},r.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},r.prototype.asObserver=function(){var a=this;return new n(function(b){a.onNext(b)},function(b){a.onError(b)},function(){a.onCompleted()})},j.observeOn=function(a){var b=this;return new m(function(c){return b.subscribe(new K(a,c))},b)},j.subscribeOn=function(a){var b=this;return new m(function(c){var d=new x,f=new w;return f.setDisposable(d),d.setDisposable(a.schedule(function(){f.setDisposable(new e(a,b.subscribe(c)))})),f},b)},i.generate=function(a,b,c,d,e){return G(e)||(e=currentThreadScheduler),new m(function(f){var g=!0;return e.scheduleRecursiveWithState(a,function(a,e){var h,i;try{g?g=!1:a=c(a),h=b(a),h&&(i=d(a))}catch(j){return f.onError(j)}h?(f.onNext(i),e(a)):f.onCompleted()})})},i.using=function(a,b){return new m(function(c){var d,e,f=A;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new y(l(g).subscribe(c),f)}return new y(e.subscribe(c),f)})},j.amb=function(a){var b=this;return new m(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new x,j=new x;return D(a)&&(a=H(a)),i.setDisposable(b.subscribe(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()})),j.setDisposable(a.subscribe(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()})),new y(i,j)})},i.amb=function(){function a(a,b){return a.amb(b)}var b=k(),c=[];if(Array.isArray(arguments[0]))c=arguments[0];else for(var d=0,e=arguments.length;e>d;d++)c.push(arguments[d]);for(var d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},j.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return L([this,a])};var L=i.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return new m(function(b){var c=0,d=new w,e=B.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],D(f)&&(f=H(f)),g=new x,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new y(d,e)})};return j.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).selectMany(function(a){return a.toArray()}).where(function(a){return a.length>0})},j.windowWithCount=function(a,b){var c=this;if(+a||(a=0),Math.abs(a)===1/0&&(a=0),0>=a)throw new I;if(null==b&&(b=a),+b||(b=0),Math.abs(b)===1/0&&(b=0),0>=b)throw new I;return new m(function(d){function e(){var a=new s;i.push(a),d.onNext(C(a,g))}var f=new x,g=new z(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g},c)},j.takeLastBuffer=function(a){var b=this;return new m(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){c.onNext(d),c.onCompleted()})},b)},j.defaultIfEmpty=function(a){var b=this;return a===d&&(a=null),new m(function(c){var d=!1;return b.subscribe(function(a){d=!0,c.onNext(a)},function(a){c.onError(a)},function(){!d&&c.onNext(a),c.onCompleted()})},b)},h.prototype.push=function(a){var b=-1===g(this.set,a,this.comparer);return b&&this.set.push(a),b},j.distinct=function(a,b){var c=this;return b||(b=defaultComparer),new m(function(d){var e=new h(b);return c.subscribe(function(b){var c=b;if(a)try{c=a(b)}catch(f){return void d.onError(f)}e.push(c)&&d.onNext(b)},function(a){d.onError(a)},function(){d.onCompleted()})},this)},c});
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx-lite-compat"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("rx-lite-compat")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function f(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function g(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function h(a){this.comparer=a,this.set=[]}var i=c.Observable,j=i.prototype,k=i.never,l=i.throwException,m=c.AnonymousObservable,n=c.AnonymousObserver,o=c.Notification.createOnNext,p=c.Notification.createOnError,q=c.Notification.createOnCompleted,r=c.Observer,s=c.Subject,t=c.internals,u=c.helpers,v=t.ScheduledObserver,w=c.SerialDisposable,x=c.SingleAssignmentDisposable,y=c.CompositeDisposable,z=c.RefCountDisposable,A=c.Disposable.empty,B=c.Scheduler.immediate,C=(u.defaultKeySerializer,c.internals.addRef),D=(u.identity,u.isPromise),E=t.inherits,F=t.bindCallback,G=(u.noop,c.Scheduler.isScheduler),H=i.fromPromise,I=c.ArgumentOutOfRangeError;e.prototype.dispose=function(){this.scheduler.scheduleWithState(this,f)};var J=function(a){function b(b){a.call(this),this._observer=b,this._state=0}E(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();var b=tryCatch(this._observer.onNext).call(this._observer,a);this._state=0,b===errorObj&&thrower(b.e)},c.onError=function(a){this.checkAccess();var b=tryCatch(this._observer.onError).call(this._observer,a);this._state=2,b===errorObj&&thrower(b.e)},c.onCompleted=function(){this.checkAccess();var a=tryCatch(this._observer.onCompleted).call(this._observer);this._state=2,a===errorObj&&thrower(a.e)},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(r),K=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return E(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(v);r.prototype.checked=function(){return new J(this)},r.notifyOn=function(a){return new K(a,this)},r.fromNotifier=function(a,b){var c=F(a,b,1);return new n(function(a){return c(o(a))},function(a){return c(p(a))},function(){return c(q())})},r.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},r.prototype.asObserver=function(){var a=this;return new n(function(b){a.onNext(b)},function(b){a.onError(b)},function(){a.onCompleted()})},j.observeOn=function(a){var b=this;return new m(function(c){return b.subscribe(new K(a,c))},b)},j.subscribeOn=function(a){var b=this;return new m(function(c){var d=new x,f=new w;return f.setDisposable(d),d.setDisposable(a.schedule(function(){f.setDisposable(new e(a,b.subscribe(c)))})),f},b)},i.generate=function(a,b,c,d,e){return G(e)||(e=currentThreadScheduler),new m(function(f){var g=!0;return e.scheduleRecursiveWithState(a,function(a,e){var h,i;try{g?g=!1:a=c(a),h=b(a),h&&(i=d(a))}catch(j){return f.onError(j)}h?(f.onNext(i),e(a)):f.onCompleted()})})},i.using=function(a,b){return new m(function(c){var d,e,f=A;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new y(l(g).subscribe(c),f)}return new y(e.subscribe(c),f)})},j.amb=function(a){var b=this;return new m(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new x,j=new x;return D(a)&&(a=H(a)),i.setDisposable(b.subscribe(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()})),j.setDisposable(a.subscribe(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()})),new y(i,j)})},i.amb=function(){function a(a,b){return a.amb(b)}var b=k(),c=[];if(Array.isArray(arguments[0]))c=arguments[0];else for(var d=0,e=arguments.length;e>d;d++)c.push(arguments[d]);for(var d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},j.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return L([this,a])};var L=i.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return new m(function(b){var c=0,d=new w,e=B.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],D(f)&&(f=H(f)),g=new x,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new y(d,e)})};return j.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).selectMany(function(a){return a.toArray()}).where(function(a){return a.length>0})},j.windowWithCount=function(a,b){var c=this;if(+a||(a=0),Math.abs(a)===1/0&&(a=0),0>=a)throw new I;if(null==b&&(b=a),+b||(b=0),Math.abs(b)===1/0&&(b=0),0>=b)throw new I;return new m(function(d){function e(){var a=new s;i.push(a),d.onNext(C(a,g))}var f=new x,g=new z(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g},c)},j.takeLastBuffer=function(a){var b=this;return new m(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){c.onNext(d),c.onCompleted()})},b)},j.defaultIfEmpty=function(a){var b=this;return a===d&&(a=null),new m(function(c){var d=!1;return b.subscribe(function(a){d=!0,c.onNext(a)},function(a){c.onError(a)},function(){!d&&c.onNext(a),c.onCompleted()})},b)},h.prototype.push=function(a){var b=-1===g(this.set,a,this.comparer);return b&&this.set.push(a),b},j.distinct=function(a,b){var c=this;return b||(b=defaultComparer),new m(function(d){var e=new h(b);return c.subscribe(function(b){var c=b;if(a)try{c=a(b)}catch(f){return void d.onError(f)}e.push(c)&&d.onNext(b)},function(a){d.onError(a)},function(){d.onCompleted()})},this)},j.singleInstance=function(){function a(){return d||(d=!0,b=c["finally"](function(){d=!1}).publish().refCount()),b}var b,c=this,d=!1;return new m(function(b){return a().subscribe(b)})},c});
//# sourceMappingURL=rx.lite.extras.compat.map

@@ -341,15 +341,9 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

choiceL();
if (choice === leftChoice) {
observer.onNext(left);
}
choice === leftChoice && observer.onNext(left);
}, function (err) {
choiceL();
if (choice === leftChoice) {
observer.onError(err);
}
choice === leftChoice && observer.onError(err);
}, function () {
choiceL();
if (choice === leftChoice) {
observer.onCompleted();
}
choice === leftChoice && observer.onCompleted();
}));

@@ -359,15 +353,9 @@

choiceR();
if (choice === rightChoice) {
observer.onNext(right);
}
choice === rightChoice && observer.onNext(right);
}, function (err) {
choiceR();
if (choice === rightChoice) {
observer.onError(err);
}
choice === rightChoice && observer.onError(err);
}, function () {
choiceR();
if (choice === rightChoice) {
observer.onCompleted();
}
choice === rightChoice && observer.onCompleted();
}));

@@ -622,3 +610,24 @@

/**
* Returns an observable sequence that shares a single subscription to the underlying sequence. This observable sequence
* can be resubscribed to, even if all prior subscriptions have ended. (unlike `.publish().refCount()`)
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source.
*/
observableProto.singleInstance = function() {
var source = this, hasObservable = false, observable;
function getObservable() {
if (!hasObservable) {
hasObservable = true;
observable = source.finally(function() { hasObservable = false; }).publish().refCount();
}
return observable;
};
return new AnonymousObservable(function(o) {
return getObservable().subscribe(o);
});
};
return Rx;
}));
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx-lite"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("rx-lite")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function f(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function g(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function h(a){this.comparer=a,this.set=[]}var i=c.Observable,j=i.prototype,k=i.never,l=i.throwException,m=c.AnonymousObservable,n=c.AnonymousObserver,o=c.Notification.createOnNext,p=c.Notification.createOnError,q=c.Notification.createOnCompleted,r=c.Observer,s=c.Subject,t=c.internals,u=c.helpers,v=t.ScheduledObserver,w=c.SerialDisposable,x=c.SingleAssignmentDisposable,y=c.CompositeDisposable,z=c.RefCountDisposable,A=c.Disposable.empty,B=c.Scheduler.immediate,C=(u.defaultKeySerializer,c.internals.addRef),D=(u.identity,u.isPromise),E=t.inherits,F=t.bindCallback,G=(u.noop,c.Scheduler.isScheduler),H=i.fromPromise,I=c.ArgumentOutOfRangeError;e.prototype.dispose=function(){this.scheduler.scheduleWithState(this,f)};var J=function(a){function b(b){a.call(this),this._observer=b,this._state=0}E(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();var b=tryCatch(this._observer.onNext).call(this._observer,a);this._state=0,b===errorObj&&thrower(b.e)},c.onError=function(a){this.checkAccess();var b=tryCatch(this._observer.onError).call(this._observer,a);this._state=2,b===errorObj&&thrower(b.e)},c.onCompleted=function(){this.checkAccess();var a=tryCatch(this._observer.onCompleted).call(this._observer);this._state=2,a===errorObj&&thrower(a.e)},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(r),K=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return E(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(v);r.prototype.checked=function(){return new J(this)},r.notifyOn=function(a){return new K(a,this)},r.fromNotifier=function(a,b){var c=F(a,b,1);return new n(function(a){return c(o(a))},function(a){return c(p(a))},function(){return c(q())})},r.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},r.prototype.asObserver=function(){var a=this;return new n(function(b){a.onNext(b)},function(b){a.onError(b)},function(){a.onCompleted()})},j.observeOn=function(a){var b=this;return new m(function(c){return b.subscribe(new K(a,c))},b)},j.subscribeOn=function(a){var b=this;return new m(function(c){var d=new x,f=new w;return f.setDisposable(d),d.setDisposable(a.schedule(function(){f.setDisposable(new e(a,b.subscribe(c)))})),f},b)},i.generate=function(a,b,c,d,e){return G(e)||(e=currentThreadScheduler),new m(function(f){var g=!0;return e.scheduleRecursiveWithState(a,function(a,e){var h,i;try{g?g=!1:a=c(a),h=b(a),h&&(i=d(a))}catch(j){return f.onError(j)}h?(f.onNext(i),e(a)):f.onCompleted()})})},i.using=function(a,b){return new m(function(c){var d,e,f=A;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new y(l(g).subscribe(c),f)}return new y(e.subscribe(c),f)})},j.amb=function(a){var b=this;return new m(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new x,j=new x;return D(a)&&(a=H(a)),i.setDisposable(b.subscribe(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()})),j.setDisposable(a.subscribe(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()})),new y(i,j)})},i.amb=function(){function a(a,b){return a.amb(b)}var b=k(),c=[];if(Array.isArray(arguments[0]))c=arguments[0];else for(var d=0,e=arguments.length;e>d;d++)c.push(arguments[d]);for(var d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},j.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return L([this,a])};var L=i.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return new m(function(b){var c=0,d=new w,e=B.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],D(f)&&(f=H(f)),g=new x,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new y(d,e)})};return j.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).selectMany(function(a){return a.toArray()}).where(function(a){return a.length>0})},j.windowWithCount=function(a,b){var c=this;if(+a||(a=0),Math.abs(a)===1/0&&(a=0),0>=a)throw new I;if(null==b&&(b=a),+b||(b=0),Math.abs(b)===1/0&&(b=0),0>=b)throw new I;return new m(function(d){function e(){var a=new s;i.push(a),d.onNext(C(a,g))}var f=new x,g=new z(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g},c)},j.takeLastBuffer=function(a){var b=this;return new m(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){c.onNext(d),c.onCompleted()})},b)},j.defaultIfEmpty=function(a){var b=this;return a===d&&(a=null),new m(function(c){var d=!1;return b.subscribe(function(a){d=!0,c.onNext(a)},function(a){c.onError(a)},function(){!d&&c.onNext(a),c.onCompleted()})},b)},h.prototype.push=function(a){var b=-1===g(this.set,a,this.comparer);return b&&this.set.push(a),b},j.distinct=function(a,b){var c=this;return b||(b=defaultComparer),new m(function(d){var e=new h(b);return c.subscribe(function(b){var c=b;if(a)try{c=a(b)}catch(f){return void d.onError(f)}e.push(c)&&d.onNext(b)},function(a){d.onError(a)},function(){d.onCompleted()})},this)},c});
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx-lite"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("rx-lite")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function f(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function g(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function h(a){this.comparer=a,this.set=[]}var i=c.Observable,j=i.prototype,k=i.never,l=i.throwException,m=c.AnonymousObservable,n=c.AnonymousObserver,o=c.Notification.createOnNext,p=c.Notification.createOnError,q=c.Notification.createOnCompleted,r=c.Observer,s=c.Subject,t=c.internals,u=c.helpers,v=t.ScheduledObserver,w=c.SerialDisposable,x=c.SingleAssignmentDisposable,y=c.CompositeDisposable,z=c.RefCountDisposable,A=c.Disposable.empty,B=c.Scheduler.immediate,C=(u.defaultKeySerializer,c.internals.addRef),D=(u.identity,u.isPromise),E=t.inherits,F=t.bindCallback,G=(u.noop,c.Scheduler.isScheduler),H=i.fromPromise,I=c.ArgumentOutOfRangeError;e.prototype.dispose=function(){this.scheduler.scheduleWithState(this,f)};var J=function(a){function b(b){a.call(this),this._observer=b,this._state=0}E(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();var b=tryCatch(this._observer.onNext).call(this._observer,a);this._state=0,b===errorObj&&thrower(b.e)},c.onError=function(a){this.checkAccess();var b=tryCatch(this._observer.onError).call(this._observer,a);this._state=2,b===errorObj&&thrower(b.e)},c.onCompleted=function(){this.checkAccess();var a=tryCatch(this._observer.onCompleted).call(this._observer);this._state=2,a===errorObj&&thrower(a.e)},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(r),K=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return E(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(v);r.prototype.checked=function(){return new J(this)},r.notifyOn=function(a){return new K(a,this)},r.fromNotifier=function(a,b){var c=F(a,b,1);return new n(function(a){return c(o(a))},function(a){return c(p(a))},function(){return c(q())})},r.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},r.prototype.asObserver=function(){var a=this;return new n(function(b){a.onNext(b)},function(b){a.onError(b)},function(){a.onCompleted()})},j.observeOn=function(a){var b=this;return new m(function(c){return b.subscribe(new K(a,c))},b)},j.subscribeOn=function(a){var b=this;return new m(function(c){var d=new x,f=new w;return f.setDisposable(d),d.setDisposable(a.schedule(function(){f.setDisposable(new e(a,b.subscribe(c)))})),f},b)},i.generate=function(a,b,c,d,e){return G(e)||(e=currentThreadScheduler),new m(function(f){var g=!0;return e.scheduleRecursiveWithState(a,function(a,e){var h,i;try{g?g=!1:a=c(a),h=b(a),h&&(i=d(a))}catch(j){return f.onError(j)}h?(f.onNext(i),e(a)):f.onCompleted()})})},i.using=function(a,b){return new m(function(c){var d,e,f=A;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new y(l(g).subscribe(c),f)}return new y(e.subscribe(c),f)})},j.amb=function(a){var b=this;return new m(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new x,j=new x;return D(a)&&(a=H(a)),i.setDisposable(b.subscribe(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()})),j.setDisposable(a.subscribe(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()})),new y(i,j)})},i.amb=function(){function a(a,b){return a.amb(b)}var b=k(),c=[];if(Array.isArray(arguments[0]))c=arguments[0];else for(var d=0,e=arguments.length;e>d;d++)c.push(arguments[d]);for(var d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},j.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return L([this,a])};var L=i.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return new m(function(b){var c=0,d=new w,e=B.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],D(f)&&(f=H(f)),g=new x,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new y(d,e)})};return j.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).selectMany(function(a){return a.toArray()}).where(function(a){return a.length>0})},j.windowWithCount=function(a,b){var c=this;if(+a||(a=0),Math.abs(a)===1/0&&(a=0),0>=a)throw new I;if(null==b&&(b=a),+b||(b=0),Math.abs(b)===1/0&&(b=0),0>=b)throw new I;return new m(function(d){function e(){var a=new s;i.push(a),d.onNext(C(a,g))}var f=new x,g=new z(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g},c)},j.takeLastBuffer=function(a){var b=this;return new m(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){c.onNext(d),c.onCompleted()})},b)},j.defaultIfEmpty=function(a){var b=this;return a===d&&(a=null),new m(function(c){var d=!1;return b.subscribe(function(a){d=!0,c.onNext(a)},function(a){c.onError(a)},function(){!d&&c.onNext(a),c.onCompleted()})},b)},h.prototype.push=function(a){var b=-1===g(this.set,a,this.comparer);return b&&this.set.push(a),b},j.distinct=function(a,b){var c=this;return b||(b=defaultComparer),new m(function(d){var e=new h(b);return c.subscribe(function(b){var c=b;if(a)try{c=a(b)}catch(f){return void d.onError(f)}e.push(c)&&d.onNext(b)},function(a){d.onError(a)},function(){d.onCompleted()})},this)},j.singleInstance=function(){function a(){return d||(d=!0,b=c["finally"](function(){d=!1}).publish().refCount()),b}var b,c=this,d=!1;return new m(function(b){return a().subscribe(b)})},c});
//# sourceMappingURL=rx.lite.extras.map
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){var d=c.Observable,e=d.prototype,f=c.AnonymousObservable,g=d.never,h=c.internals.isEqual,i=c.helpers.defaultSubComparer;return e.jortSort=function(){return this.jortSortUntil(g())},e.jortSortUntil=function(a){var b=this;return new f(function(c){var d=[];return b.takeUntil(a).subscribe(d.push.bind(d),c.onError.bind(c),function(){var a=d.slice(0).sort(i);c.onNext(h(d,a)),c.onCompleted()})},b)},c});
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){var e=c.Observable,f=e.prototype,g=c.AnonymousObservable,h=e.never,i=c.internals.isEqual,j=c.helpers.defaultSubComparer;return f.jortSort=function(){return this.jortSortUntil(h())},f.jortSortUntil=function(a){var b=this;return new g(function(c){var d=[];return b.takeUntil(a).subscribe(d.push.bind(d),c.onError.bind(c),function(){var a=d.slice(0).sort(j);c.onNext(i(d,a)),c.onCompleted()})},b)},c});
//# sourceMappingURL=rx.sorting.map

@@ -521,4 +521,4 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

function sampleObservable(source, sampler) {
return new AnonymousObservable(function (observer) {
var atEnd, value, hasValue;
return new AnonymousObservable(function (o) {
var atEnd = false, value, hasValue = false;

@@ -528,15 +528,23 @@ function sampleSubscribe() {

hasValue = false;
observer.onNext(value);
o.onNext(value);
}
atEnd && observer.onCompleted();
atEnd && o.onCompleted();
}
return new CompositeDisposable(
source.subscribe(function (newValue) {
var sourceSubscription = new SingleAssignmentDisposable();
sourceSubscription.setDisposable(source.subscribe(
function (newValue) {
hasValue = true;
value = newValue;
}, observer.onError.bind(observer), function () {
},
function (e) { o.onError(e); },
function () {
atEnd = true;
}),
sampler.subscribe(sampleSubscribe, observer.onError.bind(observer), sampleSubscribe)
sourceSubscription.dispose();
}
));
return new CompositeDisposable(
sourceSubscription,
sampler.subscribe(sampleSubscribe, function (e) { o.onError(e); }, sampleSubscribe)
);

@@ -645,8 +653,5 @@ }, source);

var first = true,
hasResult = false,
result,
state = initialState,
time;
return scheduler.scheduleRecursiveWithAbsolute(scheduler.now(), function (self) {
hasResult && observer.onNext(result);
hasResult = false;
return scheduler.scheduleRecursiveWithAbsoluteAndState(initialState, scheduler.now(), function (state, self) {
hasResult && observer.onNext(state);

@@ -661,4 +666,4 @@ try {

if (hasResult) {
result = resultSelector(state);
time = timeSelector(state);
var result = resultSelector(state);
var time = timeSelector(state);
}

@@ -670,3 +675,3 @@ } catch (e) {

if (hasResult) {
self(time);
self(result, time);
} else {

@@ -702,8 +707,5 @@ observer.onCompleted();

var first = true,
hasResult = false,
result,
state = initialState,
time;
return scheduler.scheduleRecursiveWithRelative(0, function (self) {
hasResult && observer.onNext(result);
hasResult = false;
return scheduler.scheduleRecursiveWithRelativeAndState(initialState, 0, function (state, self) {
hasResult && observer.onNext(state);

@@ -718,4 +720,4 @@ try {

if (hasResult) {
result = resultSelector(state);
time = timeSelector(state);
var result = resultSelector(state);
var time = timeSelector(state);
}

@@ -727,3 +729,3 @@ } catch (e) {

if (hasResult) {
self(time);
self(result, time);
} else {

@@ -730,0 +732,0 @@ observer.onCompleted();

/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(){try{return n.apply(this,arguments)}catch(a){return H.e=a,H}}function f(a){if(!E(a))throw new TypeError("fn must be a function");return n=a,e}function g(a,b){return new q(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function h(a,b,c){return new q(function(d){var e=a,f=B(b);return c.scheduleRecursiveWithAbsoluteAndState(0,e,function(a,b){if(f>0){var g=c.now();e+=f,g>=e&&(e=g+f)}d.onNext(a),b(a+1,e)})})}function i(a,b){return new q(function(c){return b.scheduleWithRelative(B(a),function(){c.onNext(0),c.onCompleted()})})}function j(a,b,c){return a===b?new q(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):r(function(){return h(c.now()+a,b,c)})}function k(a,b,c){return new q(function(d){var e,f=!1,g=new w,h=null,i=[],j=!1;return e=a.materialize().timestamp(c).subscribe(function(a){var e,k;"E"===a.value.kind?(i=[],i.push(a),h=a.value.exception,k=!j):(i.push({value:a.value,timestamp:a.timestamp+b}),k=!f,f=!0),k&&(null!==h?d.onError(h):(e=new v,g.setDisposable(e),e.setDisposable(c.scheduleRecursiveWithRelative(b,function(a){var b,e,g,k;if(null===h){j=!0;do g=null,i.length>0&&i[0].timestamp-c.now()<=0&&(g=i.shift().value),null!==g&&g.accept(d);while(null!==g);k=!1,e=0,i.length>0?(k=!0,e=Math.max(0,i[0].timestamp-c.now())):f=!1,b=h,j=!1,null!==b?d.onError(b):k&&a(e)}}))))}),new x(e,g)},a)}function l(a,b,c){return r(function(){return k(a,b-c.now(),c)})}function m(a,b){return new q(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new x(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))},a)}{var n,o=c.Observable,p=o.prototype,q=c.AnonymousObservable,r=o.defer,s=(o.empty,o.never),t=o.throwException,u=(o.fromArray,c.Scheduler["default"]),v=c.SingleAssignmentDisposable,w=c.SerialDisposable,x=c.CompositeDisposable,y=c.RefCountDisposable,z=c.Subject,A=c.internals.addRef,B=c.Scheduler.normalize,C=c.helpers,D=C.isPromise,E=C.isFunction,F=c.Scheduler.isScheduler,G=o.fromPromise,H={e:{}},I=o.interval=function(a,b){return j(a,a,F(b)?b:u)};o.timer=function(a,b,c){var e;return F(c)||(c=u),b!==d&&"number"==typeof b?e=b:F(b)&&(c=b),a instanceof Date&&e===d?g(a.getTime(),c):a instanceof Date&&e!==d?(e=b,h(a.getTime(),e,c)):e===d?i(a,c):j(a,e,c)}}return p.delay=function(a,b){return F(b)||(b=u),a instanceof Date?l(this,a.getTime(),b):k(this,a,b)},p.debounce=p.throttleWithTimeout=function(a,b){F(b)||(b=u);var c=this;return new q(function(d){var e,f=new w,g=!1,h=0,i=c.subscribe(function(c){g=!0,e=c,h++;var i=h,j=new v;f.setDisposable(j),j.setDisposable(b.scheduleWithRelative(a,function(){g&&h===i&&d.onNext(e),g=!1}))},function(a){f.dispose(),d.onError(a),g=!1,h++},function(){f.dispose(),g&&d.onNext(e),d.onCompleted(),g=!1,h++});return new x(i,f)},this)},p.throttle=function(a,b){return this.debounce(a,b)},p.windowWithTime=function(a,b,c){var d,e=this;return null==b&&(d=a),F(c)||(c=u),"number"==typeof b?d=b:F(b)&&(d=a,c=b),new q(function(b){function f(){var a=new v,e=!1,g=!1;l.setDisposable(a),j===i?(e=!0,g=!0):i>j?e=!0:g=!0;var n=e?j:i,o=n-m;m=n,e&&(j+=d),g&&(i+=d),a.setDisposable(c.scheduleWithRelative(o,function(){if(g){var a=new z;k.push(a),b.onNext(A(a,h))}e&&k.shift().onCompleted(),f()}))}var g,h,i=d,j=a,k=[],l=new w,m=0;return g=new x(l),h=new y(g),k.push(new z),b.onNext(A(k[0],h)),f(),g.add(e.subscribe(function(a){for(var b=0,c=k.length;c>b;b++)k[b].onNext(a)},function(a){for(var c=0,d=k.length;d>c;c++)k[c].onError(a);b.onError(a)},function(){for(var a=0,c=k.length;c>a;a++)k[a].onCompleted();b.onCompleted()})),h},e)},p.windowWithTimeOrCount=function(a,b,c){var d=this;return F(c)||(c=u),new q(function(e){function f(b){var d=new v;g.setDisposable(d),d.setDisposable(c.scheduleWithRelative(a,function(){if(b===k){j=0;var a=++k;l.onCompleted(),l=new z,e.onNext(A(l,i)),f(a)}}))}var g=new w,h=new x(g),i=new y(h),j=0,k=0,l=new z;return e.onNext(A(l,i)),f(0),h.add(d.subscribe(function(a){var c=0,d=!1;l.onNext(a),++j===b&&(d=!0,j=0,c=++k,l.onCompleted(),l=new z,e.onNext(A(l,i))),d&&f(c)},function(a){l.onError(a),e.onError(a)},function(){l.onCompleted(),e.onCompleted()})),i},d)},p.bufferWithTime=function(){return this.windowWithTime.apply(this,arguments).selectMany(function(a){return a.toArray()})},p.bufferWithTimeOrCount=function(a,b,c){return this.windowWithTimeOrCount(a,b,c).selectMany(function(a){return a.toArray()})},p.timeInterval=function(a){var b=this;return F(a)||(a=u),r(function(){var c=a.now();return b.map(function(b){var d=a.now(),e=d-c;return c=d,{value:b,interval:e}})})},p.timestamp=function(a){return F(a)||(a=u),this.map(function(b){return{value:b,timestamp:a.now()}})},p.sample=p.throttleLatest=function(a,b){return F(b)||(b=u),"number"==typeof a?m(this,I(a,b)):m(this,a)},p.timeout=function(a,b,c){(null==b||"string"==typeof b)&&(b=t(new Error(b||"Timeout"))),F(c)||(c=u);var d=this,e=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new q(function(f){function g(){var d=h;l.setDisposable(c[e](a,function(){h===d&&(D(b)&&(b=G(b)),j.setDisposable(b.subscribe(f)))}))}var h=0,i=new v,j=new w,k=!1,l=new w;return j.setDisposable(i),g(),i.setDisposable(d.subscribe(function(a){k||(h++,f.onNext(a),g())},function(a){k||(h++,f.onError(a))},function(){k||(h++,f.onCompleted())})),new x(j,l)},d)},o.generateWithAbsoluteTime=function(a,b,c,d,e,f){return F(f)||(f=u),new q(function(g){var h,i,j=!0,k=!1,l=a;return f.scheduleRecursiveWithAbsolute(f.now(),function(a){k&&g.onNext(h);try{j?j=!1:l=c(l),k=b(l),k&&(h=d(l),i=e(l))}catch(f){return void g.onError(f)}k?a(i):g.onCompleted()})})},o.generateWithRelativeTime=function(a,b,c,d,e,f){return F(f)||(f=u),new q(function(g){var h,i,j=!0,k=!1,l=a;return f.scheduleRecursiveWithRelative(0,function(a){k&&g.onNext(h);try{j?j=!1:l=c(l),k=b(l),k&&(h=d(l),i=e(l))}catch(f){return void g.onError(f)}k?a(i):g.onCompleted()})})},p.delaySubscription=function(a,b){var c=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative",d=this;return F(b)||(b=u),new q(function(e){var f=new w;return f.setDisposable(b[c](a,function(){f.setDisposable(d.subscribe(e))})),f},this)},p.delayWithSelector=function(a,b){var c,d,e=this;return E(a)?d=a:(c=a,d=b),new q(function(a){function b(){j.setDisposable(e.subscribe(function(b){var c=f(d)(b);if(c===H)return a.onError(c.e);var e=new v;h.add(e),e.setDisposable(c.subscribe(function(){a.onNext(b),h.remove(e),g()},function(b){a.onError(b)},function(){a.onNext(b),h.remove(e),g()}))},function(b){a.onError(b)},function(){i=!0,j.dispose(),g()}))}function g(){i&&0===h.length&&a.onCompleted()}var h=new x,i=!1,j=new w;return c?j.setDisposable(c.subscribe(b,function(b){a.onError(b)},b)):b(),new x(j,h)},this)},p.timeoutWithSelector=function(a,b,c){1===arguments.length&&(b=a,a=s()),c||(c=t(new Error("Timeout")));var d=this;return new q(function(e){function f(a){function b(){return k===d}var d=k,f=new v;i.setDisposable(f),f.setDisposable(a.subscribe(function(){b()&&h.setDisposable(c.subscribe(e)),f.dispose()},function(a){b()&&e.onError(a)},function(){b()&&h.setDisposable(c.subscribe(e))}))}function g(){var a=!l;return a&&k++,a}var h=new w,i=new w,j=new v;h.setDisposable(j);var k=0,l=!1;return f(a),j.setDisposable(d.subscribe(function(a){if(g()){e.onNext(a);var c;try{c=b(a)}catch(d){return void e.onError(d)}f(D(c)?G(c):c)}},function(a){g()&&e.onError(a)},function(){g()&&e.onCompleted()})),new x(h,i)},d)},p.debounceWithSelector=function(a){var b=this;return new q(function(c){var d,e=!1,f=new w,g=0,h=b.subscribe(function(b){var h;try{h=a(b)}catch(i){return void c.onError(i)}D(h)&&(h=G(h)),e=!0,d=b,g++;var j=g,k=new v;f.setDisposable(k),k.setDisposable(h.subscribe(function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()},c.onError.bind(c),function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()}))},function(a){f.dispose(),c.onError(a),e=!1,g++},function(){f.dispose(),e&&c.onNext(d),c.onCompleted(),e=!1,g++});return new x(h,f)},b)},p.throttleWithSelector=function(a){return this.debounceWithSelector(a)},p.skipLastWithTime=function(a,b){F(b)||(b=u);var c=this;return new q(function(d){var e=[];return c.subscribe(function(c){var f=b.now();for(e.push({interval:f,value:c});e.length>0&&f-e[0].interval>=a;)d.onNext(e.shift().value)},function(a){d.onError(a)},function(){for(var c=b.now();e.length>0&&c-e[0].interval>=a;)d.onNext(e.shift().value);d.onCompleted()})},c)},p.takeLastWithTime=function(a,b){var c=this;return F(b)||(b=u),new q(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},function(a){d.onError(a)},function(){for(var c=b.now();e.length>0;){var f=e.shift();c-f.interval<=a&&d.onNext(f.value)}d.onCompleted()})},c)},p.takeLastBufferWithTime=function(a,b){var c=this;return F(b)||(b=u),new q(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},function(a){d.onError(a)},function(){for(var c=b.now(),f=[];e.length>0;){var g=e.shift();c-g.interval<=a&&f.push(g.value)}d.onNext(f),d.onCompleted()})},c)},p.takeWithTime=function(a,b){var c=this;return F(b)||(b=u),new q(function(d){return new x(b.scheduleWithRelative(a,function(){d.onCompleted()}),c.subscribe(d))},c)},p.skipWithTime=function(a,b){var c=this;return F(b)||(b=u),new q(function(d){var e=!1;return new x(b.scheduleWithRelative(a,function(){e=!0}),c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d)))},c)},p.skipUntilWithTime=function(a,b){F(b)||(b=u);var c=this,d=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new q(function(e){var f=!1;return new x(b[d](a,function(){f=!0}),c.subscribe(function(a){f&&e.onNext(a)},function(a){e.onError(a)},function(){e.onCompleted()}))},c)},p.takeUntilWithTime=function(a,b){F(b)||(b=u);var c=this,d=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new q(function(e){return new x(b[d](a,function(){e.onCompleted()}),c.subscribe(e))},c)},p.throttleFirst=function(a,b){F(b)||(b=u);var c=+a||0;if(0>=c)throw new RangeError("windowDuration cannot be less or equal zero.");var d=this;return new q(function(a){var e=0;return d.subscribe(function(d){var f=b.now();(0===e||f-e>=c)&&(e=f,a.onNext(d))},function(b){a.onError(b)},function(){a.onCompleted()})},d)},c});
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(){try{return n.apply(this,arguments)}catch(a){return H.e=a,H}}function f(a){if(!E(a))throw new TypeError("fn must be a function");return n=a,e}function g(a,b){return new q(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function h(a,b,c){return new q(function(d){var e=a,f=B(b);return c.scheduleRecursiveWithAbsoluteAndState(0,e,function(a,b){if(f>0){var g=c.now();e+=f,g>=e&&(e=g+f)}d.onNext(a),b(a+1,e)})})}function i(a,b){return new q(function(c){return b.scheduleWithRelative(B(a),function(){c.onNext(0),c.onCompleted()})})}function j(a,b,c){return a===b?new q(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):r(function(){return h(c.now()+a,b,c)})}function k(a,b,c){return new q(function(d){var e,f=!1,g=new w,h=null,i=[],j=!1;return e=a.materialize().timestamp(c).subscribe(function(a){var e,k;"E"===a.value.kind?(i=[],i.push(a),h=a.value.exception,k=!j):(i.push({value:a.value,timestamp:a.timestamp+b}),k=!f,f=!0),k&&(null!==h?d.onError(h):(e=new v,g.setDisposable(e),e.setDisposable(c.scheduleRecursiveWithRelative(b,function(a){var b,e,g,k;if(null===h){j=!0;do g=null,i.length>0&&i[0].timestamp-c.now()<=0&&(g=i.shift().value),null!==g&&g.accept(d);while(null!==g);k=!1,e=0,i.length>0?(k=!0,e=Math.max(0,i[0].timestamp-c.now())):f=!1,b=h,j=!1,null!==b?d.onError(b):k&&a(e)}}))))}),new x(e,g)},a)}function l(a,b,c){return r(function(){return k(a,b-c.now(),c)})}function m(a,b){return new q(function(c){function d(){g&&(g=!1,c.onNext(e)),f&&c.onCompleted()}var e,f=!1,g=!1,h=new v;return h.setDisposable(a.subscribe(function(a){g=!0,e=a},function(a){c.onError(a)},function(){f=!0,h.dispose()})),new x(h,b.subscribe(d,function(a){c.onError(a)},d))},a)}{var n,o=c.Observable,p=o.prototype,q=c.AnonymousObservable,r=o.defer,s=(o.empty,o.never),t=o.throwException,u=(o.fromArray,c.Scheduler["default"]),v=c.SingleAssignmentDisposable,w=c.SerialDisposable,x=c.CompositeDisposable,y=c.RefCountDisposable,z=c.Subject,A=c.internals.addRef,B=c.Scheduler.normalize,C=c.helpers,D=C.isPromise,E=C.isFunction,F=c.Scheduler.isScheduler,G=o.fromPromise,H={e:{}},I=o.interval=function(a,b){return j(a,a,F(b)?b:u)};o.timer=function(a,b,c){var e;return F(c)||(c=u),b!==d&&"number"==typeof b?e=b:F(b)&&(c=b),a instanceof Date&&e===d?g(a.getTime(),c):a instanceof Date&&e!==d?(e=b,h(a.getTime(),e,c)):e===d?i(a,c):j(a,e,c)}}return p.delay=function(a,b){return F(b)||(b=u),a instanceof Date?l(this,a.getTime(),b):k(this,a,b)},p.debounce=p.throttleWithTimeout=function(a,b){F(b)||(b=u);var c=this;return new q(function(d){var e,f=new w,g=!1,h=0,i=c.subscribe(function(c){g=!0,e=c,h++;var i=h,j=new v;f.setDisposable(j),j.setDisposable(b.scheduleWithRelative(a,function(){g&&h===i&&d.onNext(e),g=!1}))},function(a){f.dispose(),d.onError(a),g=!1,h++},function(){f.dispose(),g&&d.onNext(e),d.onCompleted(),g=!1,h++});return new x(i,f)},this)},p.throttle=function(a,b){return this.debounce(a,b)},p.windowWithTime=function(a,b,c){var d,e=this;return null==b&&(d=a),F(c)||(c=u),"number"==typeof b?d=b:F(b)&&(d=a,c=b),new q(function(b){function f(){var a=new v,e=!1,g=!1;l.setDisposable(a),j===i?(e=!0,g=!0):i>j?e=!0:g=!0;var n=e?j:i,o=n-m;m=n,e&&(j+=d),g&&(i+=d),a.setDisposable(c.scheduleWithRelative(o,function(){if(g){var a=new z;k.push(a),b.onNext(A(a,h))}e&&k.shift().onCompleted(),f()}))}var g,h,i=d,j=a,k=[],l=new w,m=0;return g=new x(l),h=new y(g),k.push(new z),b.onNext(A(k[0],h)),f(),g.add(e.subscribe(function(a){for(var b=0,c=k.length;c>b;b++)k[b].onNext(a)},function(a){for(var c=0,d=k.length;d>c;c++)k[c].onError(a);b.onError(a)},function(){for(var a=0,c=k.length;c>a;a++)k[a].onCompleted();b.onCompleted()})),h},e)},p.windowWithTimeOrCount=function(a,b,c){var d=this;return F(c)||(c=u),new q(function(e){function f(b){var d=new v;g.setDisposable(d),d.setDisposable(c.scheduleWithRelative(a,function(){if(b===k){j=0;var a=++k;l.onCompleted(),l=new z,e.onNext(A(l,i)),f(a)}}))}var g=new w,h=new x(g),i=new y(h),j=0,k=0,l=new z;return e.onNext(A(l,i)),f(0),h.add(d.subscribe(function(a){var c=0,d=!1;l.onNext(a),++j===b&&(d=!0,j=0,c=++k,l.onCompleted(),l=new z,e.onNext(A(l,i))),d&&f(c)},function(a){l.onError(a),e.onError(a)},function(){l.onCompleted(),e.onCompleted()})),i},d)},p.bufferWithTime=function(a,b,c){return this.windowWithTime.apply(this,arguments).selectMany(function(a){return a.toArray()})},p.bufferWithTimeOrCount=function(a,b,c){return this.windowWithTimeOrCount(a,b,c).selectMany(function(a){return a.toArray()})},p.timeInterval=function(a){var b=this;return F(a)||(a=u),r(function(){var c=a.now();return b.map(function(b){var d=a.now(),e=d-c;return c=d,{value:b,interval:e}})})},p.timestamp=function(a){return F(a)||(a=u),this.map(function(b){return{value:b,timestamp:a.now()}})},p.sample=p.throttleLatest=function(a,b){return F(b)||(b=u),"number"==typeof a?m(this,I(a,b)):m(this,a)},p.timeout=function(a,b,c){(null==b||"string"==typeof b)&&(b=t(new Error(b||"Timeout"))),F(c)||(c=u);var d=this,e=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new q(function(f){function g(){var d=h;l.setDisposable(c[e](a,function(){h===d&&(D(b)&&(b=G(b)),j.setDisposable(b.subscribe(f)))}))}var h=0,i=new v,j=new w,k=!1,l=new w;return j.setDisposable(i),g(),i.setDisposable(d.subscribe(function(a){k||(h++,f.onNext(a),g())},function(a){k||(h++,f.onError(a))},function(){k||(h++,f.onCompleted())})),new x(j,l)},d)},o.generateWithAbsoluteTime=function(a,b,c,d,e,f){return F(f)||(f=u),new q(function(g){var h=!0,i=!1;return f.scheduleRecursiveWithAbsoluteAndState(a,f.now(),function(a,f){i&&g.onNext(a);try{if(h?h=!1:a=c(a),i=b(a))var j=d(a),k=e(a)}catch(l){return void g.onError(l)}i?f(j,k):g.onCompleted()})})},o.generateWithRelativeTime=function(a,b,c,d,e,f){return F(f)||(f=u),new q(function(g){var h=!0,i=!1;return f.scheduleRecursiveWithRelativeAndState(a,0,function(a,f){i&&g.onNext(a);try{if(h?h=!1:a=c(a),i=b(a))var j=d(a),k=e(a)}catch(l){return void g.onError(l)}i?f(j,k):g.onCompleted()})})},p.delaySubscription=function(a,b){var c=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative",d=this;return F(b)||(b=u),new q(function(e){var f=new w;return f.setDisposable(b[c](a,function(){f.setDisposable(d.subscribe(e))})),f},this)},p.delayWithSelector=function(a,b){var c,d,e=this;return E(a)?d=a:(c=a,d=b),new q(function(a){function b(){j.setDisposable(e.subscribe(function(b){var c=f(d)(b);if(c===H)return a.onError(c.e);var e=new v;h.add(e),e.setDisposable(c.subscribe(function(){a.onNext(b),h.remove(e),g()},function(b){a.onError(b)},function(){a.onNext(b),h.remove(e),g()}))},function(b){a.onError(b)},function(){i=!0,j.dispose(),g()}))}function g(){i&&0===h.length&&a.onCompleted()}var h=new x,i=!1,j=new w;return c?j.setDisposable(c.subscribe(b,function(b){a.onError(b)},b)):b(),new x(j,h)},this)},p.timeoutWithSelector=function(a,b,c){1===arguments.length&&(b=a,a=s()),c||(c=t(new Error("Timeout")));var d=this;return new q(function(e){function f(a){function b(){return k===d}var d=k,f=new v;i.setDisposable(f),f.setDisposable(a.subscribe(function(){b()&&h.setDisposable(c.subscribe(e)),f.dispose()},function(a){b()&&e.onError(a)},function(){b()&&h.setDisposable(c.subscribe(e))}))}function g(){var a=!l;return a&&k++,a}var h=new w,i=new w,j=new v;h.setDisposable(j);var k=0,l=!1;return f(a),j.setDisposable(d.subscribe(function(a){if(g()){e.onNext(a);var c;try{c=b(a)}catch(d){return void e.onError(d)}f(D(c)?G(c):c)}},function(a){g()&&e.onError(a)},function(){g()&&e.onCompleted()})),new x(h,i)},d)},p.debounceWithSelector=function(a){var b=this;return new q(function(c){var d,e=!1,f=new w,g=0,h=b.subscribe(function(b){var h;try{h=a(b)}catch(i){return void c.onError(i)}D(h)&&(h=G(h)),e=!0,d=b,g++;var j=g,k=new v;f.setDisposable(k),k.setDisposable(h.subscribe(function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()},c.onError.bind(c),function(){e&&g===j&&c.onNext(d),e=!1,k.dispose()}))},function(a){f.dispose(),c.onError(a),e=!1,g++},function(){f.dispose(),e&&c.onNext(d),c.onCompleted(),e=!1,g++});return new x(h,f)},b)},p.throttleWithSelector=function(a){return this.debounceWithSelector(a)},p.skipLastWithTime=function(a,b){F(b)||(b=u);var c=this;return new q(function(d){var e=[];return c.subscribe(function(c){var f=b.now();for(e.push({interval:f,value:c});e.length>0&&f-e[0].interval>=a;)d.onNext(e.shift().value)},function(a){d.onError(a)},function(){for(var c=b.now();e.length>0&&c-e[0].interval>=a;)d.onNext(e.shift().value);d.onCompleted()})},c)},p.takeLastWithTime=function(a,b){var c=this;return F(b)||(b=u),new q(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},function(a){d.onError(a)},function(){for(var c=b.now();e.length>0;){var f=e.shift();c-f.interval<=a&&d.onNext(f.value)}d.onCompleted()})},c)},p.takeLastBufferWithTime=function(a,b){var c=this;return F(b)||(b=u),new q(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},function(a){d.onError(a)},function(){for(var c=b.now(),f=[];e.length>0;){var g=e.shift();c-g.interval<=a&&f.push(g.value)}d.onNext(f),d.onCompleted()})},c)},p.takeWithTime=function(a,b){var c=this;return F(b)||(b=u),new q(function(d){return new x(b.scheduleWithRelative(a,function(){d.onCompleted()}),c.subscribe(d))},c)},p.skipWithTime=function(a,b){var c=this;return F(b)||(b=u),new q(function(d){var e=!1;return new x(b.scheduleWithRelative(a,function(){e=!0}),c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d)))},c)},p.skipUntilWithTime=function(a,b){F(b)||(b=u);var c=this,d=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new q(function(e){var f=!1;return new x(b[d](a,function(){f=!0}),c.subscribe(function(a){f&&e.onNext(a)},function(a){e.onError(a)},function(){e.onCompleted()}))},c)},p.takeUntilWithTime=function(a,b){F(b)||(b=u);var c=this,d=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new q(function(e){return new x(b[d](a,function(){e.onCompleted()}),c.subscribe(e))},c)},p.throttleFirst=function(a,b){F(b)||(b=u);var c=+a||0;if(0>=c)throw new RangeError("windowDuration cannot be less or equal zero.");var d=this;return new q(function(a){var e=0;return d.subscribe(function(d){var f=b.now();(0===e||f-e>=c)&&(e=f,a.onNext(d))},function(b){a.onError(b)},function(){a.onCompleted()})},d)},c});
//# sourceMappingURL=rx.time.map
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){var d=c.Scheduler,e=c.internals.PriorityQueue,f=c.internals.ScheduledItem,g=c.internals.SchedulePeriodicRecursive,h=c.Disposable.empty,i=c.internals.inherits,j=c.helpers.defaultSubComparer,k=c.helpers.notImplemented;return c.VirtualTimeScheduler=function(a){function b(){return this.toDateTimeOffset(this.clock)}function c(a,b){return this.scheduleAbsoluteWithState(a,this.clock,b)}function d(a,b,c){return this.scheduleRelativeWithState(a,this.toRelative(b),c)}function j(a,b,c){return this.scheduleRelativeWithState(a,this.toRelative(b-this.now()),c)}function l(a,b){return b(),h}function m(f,g){this.clock=f,this.comparer=g,this.isEnabled=!1,this.queue=new e(1024),a.call(this,b,c,d,j)}i(m,a);var n=m.prototype;return n.add=k,n.toDateTimeOffset=k,n.toRelative=k,n.schedulePeriodicWithState=function(a,b,c){var d=new g(this,a,b,c);return d.start()},n.scheduleRelativeWithState=function(a,b,c){var d=this.add(this.clock,b);return this.scheduleAbsoluteWithState(a,d,c)},n.scheduleRelative=function(a,b){return this.scheduleRelativeWithState(b,a,l)},n.start=function(){if(!this.isEnabled){this.isEnabled=!0;do{var a=this.getNext();null!==a?(this.comparer(a.dueTime,this.clock)>0&&(this.clock=a.dueTime),a.invoke()):this.isEnabled=!1}while(this.isEnabled)}},n.stop=function(){this.isEnabled=!1},n.advanceTo=function(a){var b=this.comparer(this.clock,a);if(this.comparer(this.clock,a)>0)throw new ArgumentOutOfRangeError;if(0!==b&&!this.isEnabled){this.isEnabled=!0;do{var c=this.getNext();null!==c&&this.comparer(c.dueTime,a)<=0?(this.comparer(c.dueTime,this.clock)>0&&(this.clock=c.dueTime),c.invoke()):this.isEnabled=!1}while(this.isEnabled);this.clock=a}},n.advanceBy=function(a){var b=this.add(this.clock,a),c=this.comparer(this.clock,b);if(c>0)throw new ArgumentOutOfRangeError;0!==c&&this.advanceTo(b)},n.sleep=function(a){var b=this.add(this.clock,a);if(this.comparer(this.clock,b)>=0)throw new ArgumentOutOfRangeError;this.clock=b},n.getNext=function(){for(;this.queue.length>0;){var a=this.queue.peek();if(!a.isCancelled())return a;this.queue.dequeue()}return null},n.scheduleAbsolute=function(a,b){return this.scheduleAbsoluteWithState(b,a,l)},n.scheduleAbsoluteWithState=function(a,b,c){function d(a,b){return e.queue.remove(g),c(a,b)}var e=this,g=new f(this,a,d,b,this.comparer);return this.queue.enqueue(g),g.disposable},m}(d),c.HistoricalScheduler=function(a){function b(b,c){var d=null==b?0:b,e=c||j;a.call(this,d,e)}i(b,a);var c=b.prototype;return c.add=function(a,b){return a+b},c.toDateTimeOffset=function(a){return new Date(a).getTime()},c.toRelative=function(a){return a},b}(c.VirtualTimeScheduler),c});
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){var e=c.Scheduler,f=c.internals.PriorityQueue,g=c.internals.ScheduledItem,h=c.internals.SchedulePeriodicRecursive,i=c.Disposable.empty,j=c.internals.inherits,k=c.helpers.defaultSubComparer,l=c.helpers.notImplemented;return c.VirtualTimeScheduler=function(a){function b(){return this.toDateTimeOffset(this.clock)}function c(a,b){return this.scheduleAbsoluteWithState(a,this.clock,b)}function d(a,b,c){return this.scheduleRelativeWithState(a,this.toRelative(b),c)}function e(a,b,c){return this.scheduleRelativeWithState(a,this.toRelative(b-this.now()),c)}function k(a,b){return b(),i}function m(g,h){this.clock=g,this.comparer=h,this.isEnabled=!1,this.queue=new f(1024),a.call(this,b,c,d,e)}j(m,a);var n=m.prototype;return n.add=l,n.toDateTimeOffset=l,n.toRelative=l,n.schedulePeriodicWithState=function(a,b,c){var d=new h(this,a,b,c);return d.start()},n.scheduleRelativeWithState=function(a,b,c){var d=this.add(this.clock,b);return this.scheduleAbsoluteWithState(a,d,c)},n.scheduleRelative=function(a,b){return this.scheduleRelativeWithState(b,a,k)},n.start=function(){if(!this.isEnabled){this.isEnabled=!0;do{var a=this.getNext();null!==a?(this.comparer(a.dueTime,this.clock)>0&&(this.clock=a.dueTime),a.invoke()):this.isEnabled=!1}while(this.isEnabled)}},n.stop=function(){this.isEnabled=!1},n.advanceTo=function(a){var b=this.comparer(this.clock,a);if(this.comparer(this.clock,a)>0)throw new ArgumentOutOfRangeError;if(0!==b&&!this.isEnabled){this.isEnabled=!0;do{var c=this.getNext();null!==c&&this.comparer(c.dueTime,a)<=0?(this.comparer(c.dueTime,this.clock)>0&&(this.clock=c.dueTime),c.invoke()):this.isEnabled=!1}while(this.isEnabled);this.clock=a}},n.advanceBy=function(a){var b=this.add(this.clock,a),c=this.comparer(this.clock,b);if(c>0)throw new ArgumentOutOfRangeError;0!==c&&this.advanceTo(b)},n.sleep=function(a){var b=this.add(this.clock,a);if(this.comparer(this.clock,b)>=0)throw new ArgumentOutOfRangeError;this.clock=b},n.getNext=function(){for(;this.queue.length>0;){var a=this.queue.peek();if(!a.isCancelled())return a;this.queue.dequeue()}return null},n.scheduleAbsolute=function(a,b){return this.scheduleAbsoluteWithState(b,a,k)},n.scheduleAbsoluteWithState=function(a,b,c){function d(a,b){return e.queue.remove(f),c(a,b)}var e=this,f=new g(this,a,d,b,this.comparer);return this.queue.enqueue(f),f.disposable},m}(e),c.HistoricalScheduler=function(a){function b(b,c){var d=null==b?0:b,e=c||k;a.call(this,d,e)}j(b,a);var c=b.prototype;return c.add=function(a,b){return a+b},c.toDateTimeOffset=function(a){return new Date(a).getTime()},c.toRelative=function(a){return a},b}(c.VirtualTimeScheduler),c});
//# sourceMappingURL=rx.virtualtime.map

@@ -5,3 +5,3 @@ {

"description": "Library for composing asynchronous and event-based operations in JavaScript",
"version": "2.5.2",
"version": "2.5.3",
"homepage": "https://github.com/Reactive-Extensions/RxJS",

@@ -16,8 +16,3 @@ "author": {

},
"licenses": [
{
"type": "Apache License, Version 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
}
],
"license": "Apache-2.0",
"bugs": "https://github.com/Reactive-Extensions/RxJS/issues",

@@ -24,0 +19,0 @@ "jam": {

@@ -21,3 +21,3 @@ [![Build Status](https://travis-ci.org/Reactive-Extensions/RxJS.png)](https://travis-ci.org/Reactive-Extensions/RxJS)

# The Reactive Extensions for JavaScript (RxJS) <sup>2.4</sup>... #
# The Reactive Extensions for JavaScript (RxJS) <sup>2.5</sup>... #
*...is a set of libraries to compose asynchronous and event-based programs using observable collections and [Array#extras](http://blogs.msdn.com/b/ie/archive/2010/12/13/ecmascript-5-part-2-array-extras.aspx) style composition in JavaScript*

@@ -195,2 +195,3 @@

- [Our complete Unit Tests](https://github.com/Reactive-Extensions/RxJS/tree/master/tests)
- [Our recipes](https://github.com/Reactive-Extensions/RxJS/wiki/Recipes)

@@ -203,6 +204,4 @@ ## Resources

- [Twitter @OpenAtMicrosoft](http://twitter.com/OpenAtMicrosoft)
- [IRC #reactivex](http://webchat.freenode.net/#reactivex)
- [JabbR rx](https://jabbr.net/#/rooms/rx)
- [StackOverflow rxjs](http://stackoverflow.com/questions/tagged/rxjs)
- [Google Group rxjs](https://groups.google.com/forum/#!forum/rxjs)
- [Slack](http://reactivex.slack.com)

@@ -225,2 +224,3 @@ - Tutorials

- [Beginners Guide to Rx](http://msdn.microsoft.com/en-us/data/gg577611)
- [Visualizing Reactive Streams](http://jaredly.github.io/2015/03/06/visualizing-reactive-streams-hot-and-cold/)

@@ -231,2 +231,3 @@ - Community Examples

- [RxReact](https://github.com/AlexMost/RxReact)
- [cycle-react](https://github.com/pH200/cycle-react)
- [React RxJS Autocomplete](https://github.com/eliseumds/react-autocomplete)

@@ -239,2 +240,5 @@ - [React RxJS TODO MVC](https://github.com/fdecampredon/react-rxjs-todomvc)

- [Real-Time with React + RxJS + Meteor](https://medium.com/@bobiblazeski/functional-reactive-interfaces-e8de034de6bd)
- [React + RxJS Flow](https://github.com/justinwoo/react-rxjs-flow)
- [Reactive Widgets](https://github.com/zxbodya/reactive-widgets)
- [React RxJS Infinite Scroll](https://github.com/justinwoo/react-rxjs-scroll)
- [Flux](http://facebook.github.io/flux/)

@@ -245,2 +249,3 @@ - [Rx-Flux](https://github.com/fdecampredon/rx-flux)

- [Flurx](https://github.com/cell303/flurx)
- [RR](https://github.com/winsonwq/RR)
- [Ember](http://emberjs.com/)

@@ -253,6 +258,9 @@ - [RxEmber](https://github.com/blesh/RxEmber)

- [Cycle TODO MVC](https://github.com/staltz/todomvc-cycle)
- [WebRx](https://github.com/oliverw/webrx)
- Everything else
- [RxVision](http://jaredly.github.io/rxvision/)
- [Mario Elm Example](http://fudini.github.io/rx/mario.html)
- [Firebase + RxJS](http://blog.cryptoguru.com/2014/11/frp-using-rxjs-and-firebase.html)
- [Reactive Trader](https://github.com/AdaptiveConsulting/ReactiveTrader) - [Site](https://reactivetrader.azurewebsites.net/)
- [NPM Dependencies](https://www.npmjs.com/browse/depended/rx)

@@ -401,6 +409,7 @@ - Presentations

The Reactive Extensions for JavaScript have no external dependencies any library, so they'll work well with just about any library. We provide bridges and support for various libraries including:
- [Node.js](https://www.npmjs.com/package/rx-node)
- [React](http://facebook.github.io/react/)
- [Rx-React](https://github.com/fdecampredon/rx-react)
- [RxReact](https://github.com/AlexMost/RxReact)
- [cycle-react](https://github.com/pH200/cycle-react)
- [Flux](http://facebook.github.io/flux/)

@@ -411,2 +420,3 @@ - [Rx-Flux](https://github.com/fdecampredon/rx-flux)

- [Flurx](https://github.com/cell303/flurx)
- [RR](https://github.com/winsonwq/RR)
- [Ember](http://emberjs.com/)

@@ -421,4 +431,2 @@ - [RxEmber](https://github.com/blesh/RxEmber)

In addition, we have support for [common Node.js functions](https://github.com/Reactive-Extensions/RxJS/blob/master/doc/api/nodejs/nodejs.md) such as binding to callbacks and the `EventEmitter` class.
## Compatibility ##

@@ -425,0 +433,0 @@

@@ -127,3 +127,3 @@ var ControlledObservable = (function (__super__) {

* @param {Scheduler} scheduler determines how the requests will be scheduled
* @returns {Observable} The observable sequence which is paused based upon the pauser.
* @returns {Observable} The observable sequence which only propagates values on request.
*/

@@ -130,0 +130,0 @@ observableProto.controlled = function (enableQueue, scheduler) {

@@ -11,21 +11,10 @@ function combineLatestSource(source, subject, resultSelector) {

values[i] = x
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
if (err) {
o.onError(err);
return;
}
try {
res = resultSelector.apply(null, values);
} catch (ex) {
o.onError(ex);
return;
}
if (err) { return o.onError(err); }
var res = tryCatch(resultSelector).apply(null, values);
if (res === errorObj) { return o.onError(res.e); }
o.onNext(res);
}
if (isDone && values[1]) {
o.onCompleted();
}
isDone && values[1] && o.onCompleted();
}

@@ -69,2 +58,4 @@

function drainQueue() { while (q.length > 0) { o.onNext(q.shift()); } }
var subscription =

@@ -82,7 +73,3 @@ combineLatestSource(

// change in shouldFire
if (results.shouldFire) {
while (q.length > 0) {
o.onNext(q.shift());
}
}
if (results.shouldFire) { drainQueue(); }
} else {

@@ -99,13 +86,7 @@ previousShouldFire = results.shouldFire;

function (err) {
// Empty buffer before sending error
while (q.length > 0) {
o.onNext(q.shift());
}
drainQueue();
o.onError(err);
},
function () {
// Empty buffer before sending completion
while (q.length > 0) {
o.onNext(q.shift());
}
drainQueue();
o.onCompleted();

@@ -112,0 +93,0 @@ }

@@ -24,3 +24,2 @@ (function (schedulerProto) {

}
recursiveAction(state);

@@ -64,4 +63,3 @@ return group;

schedulerProto.scheduleRecursive = function (action) {
return this.scheduleRecursiveWithState(action, function (_action, self) {
_action(function () { self(_action); }); });
return this.scheduleRecursiveWithState(action, scheduleInnerRecursive);
};

@@ -68,0 +66,0 @@

@@ -1,22 +0,16 @@

var Enumerable = Rx.internals.Enumerable = function (iterator) {
this._iterator = iterator;
};
var Enumerable = Rx.internals.Enumerable = function () { };
Enumerable.prototype[$iterator$] = function () {
return this._iterator();
};
Enumerable.prototype.concat = function () {
var sources = this;
return new AnonymousObservable(function (o) {
var e = sources[$iterator$]();
var ConcatEnumerableObservable = (function(__super__) {
inherits(ConcatEnumerableObservable, __super__);
function ConcatEnumerableObservable(sources) {
this.sources = sources;
__super__.call(this);
}
ConcatEnumerableObservable.prototype.subscribeCore = function (o) {
var isDisposed, subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
var cancelable = immediateScheduler.scheduleRecursiveWithState(this.sources[$iterator$](), function (e, self) {
if (isDisposed) { return; }
try {
var currentItem = e.next();
} catch (ex) {
return o.onError(ex);
}
var currentItem = tryCatch(e.next).call(e);
if (currentItem === errorObj) { return o.onError(currentItem.e); }

@@ -33,7 +27,3 @@ if (currentItem.done) {

subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
function(x) { o.onNext(x); },
function(err) { o.onError(err); },
self)
);
d.setDisposable(currentValue.subscribe(new InnerObserver(o, self, e)));
});

@@ -44,27 +34,58 @@

}));
});
};
function InnerObserver(o, s, e) {
this.o = o;
this.s = s;
this.e = e;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.o.onNext(x); } };
InnerObserver.prototype.onError = function (err) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(err);
}
};
InnerObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.s(this.e);
}
};
InnerObserver.prototype.dispose = function () { this.isStopped = true; };
InnerObserver.prototype.fail = function (err) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(err);
return true;
}
return false;
};
return ConcatEnumerableObservable;
}(ObservableBase));
Enumerable.prototype.concat = function () {
return new ConcatEnumerableObservable(this);
};
var CatchErrorObservable = (function(__super__) {
inherits(CatchErrorObservable, __super__);
function CatchErrorObservable(sources) {
this.sources = sources;
__super__.call(this);
}
CatchErrorObservable.prototype.subscribeCore = function (o) {
var e = this.sources[$iterator$]();
Enumerable.prototype.catchError = function () {
var sources = this;
return new AnonymousObservable(function (o) {
var e = sources[$iterator$]();
var isDisposed, subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursiveWithState(null, function (lastException, self) {
if (isDisposed) { return; }
var currentItem = tryCatch(e.next).call(e);
if (currentItem === errorObj) { return o.onError(currentItem.e); }
try {
var currentItem = e.next();
} catch (ex) {
return observer.onError(ex);
}
if (currentItem.done) {
if (lastException !== null) {
o.onError(lastException);
} else {
o.onCompleted();
}
return;
return lastException !== null ? o.onError(lastException) : o.onCompleted();
}

@@ -86,6 +107,11 @@

}));
});
};
return CatchErrorObservable;
}(ObservableBase));
Enumerable.prototype.catchError = function () {
return new CatchErrorObservable(this);
};
Enumerable.prototype.catchErrorWhen = function (notificationHandler) {

@@ -106,9 +132,5 @@ var sources = this;

if (isDisposed) { return; }
var currentItem = tryCatch(e.next).call(e);
if (currentItem === errorObj) { return o.onError(currentItem.e); }
try {
var currentItem = e.next();
} catch (ex) {
return o.onError(ex);
}
if (currentItem.done) {

@@ -149,28 +171,58 @@ if (lastException) {

};
var RepeatEnumerable = (function (__super__) {
inherits(RepeatEnumerable, __super__);
function RepeatEnumerable(v, c) {
this.v = v;
this.c = c == null ? -1 : c;
}
RepeatEnumerable.prototype[$iterator$] = function () {
return new RepeatEnumerator(this);
};
function RepeatEnumerator(p) {
this.v = p.v;
this.l = p.c;
}
RepeatEnumerator.prototype.next = function () {
if (this.l === 0) { return doneEnumerator; }
if (this.l > 0) { this.l--; }
return { done: false, value: this.v };
};
return RepeatEnumerable;
}(Enumerable));
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 };
});
});
return new RepeatEnumerable(value, repeatCount);
};
var OfEnumerable = (function(__super__) {
inherits(OfEnumerable, __super__);
function OfEnumerable(s, fn, thisArg) {
this.s = s;
this.fn = fn ? bindCallback(fn, thisArg, 3) : null;
}
OfEnumerable.prototype[$iterator$] = function () {
return new OfEnumerator(this);
};
function OfEnumerator(p) {
this.i = -1;
this.s = p.s;
this.l = this.s.length;
this.fn = p.fn;
}
OfEnumerator.prototype.next = function () {
return ++this.i < this.l ?
{ done: false, value: !this.fn ? this.s[this.i] : this.fn(this.s[this.i], this.i, this.s) } :
doneEnumerator;
};
return OfEnumerable;
}(Enumerable));
var enumerableOf = Enumerable.of = function (source, selector, thisArg) {
if (selector) {
var selectorFn = bindCallback(selector, thisArg, 3);
}
return new Enumerable(function () {
var index = -1;
return new Enumerator(
function () {
return ++index < source.length ?
{ done: false, value: !selector ? source[index] : selectorFn(source[index], index, source) } :
doneEnumerator;
});
});
return new OfEnumerable(source, selector, thisArg);
};

@@ -17,2 +17,3 @@ // References

isIterable = helpers.isIterable,
inherits = Rx.internals.inherits,
observableFromPromise = Observable.fromPromise,

@@ -22,2 +23,3 @@ observableFrom = Observable.from,

EmptyError = Rx.EmptyError,
ObservableBase = Rx.ObservableBase,
ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError;

@@ -18,2 +18,3 @@ // References

isScheduler = Rx.Scheduler.isScheduler,
isFunction = Rx.helpers.isFunction,
checkDisposed = Rx.Disposable.checkDisposed;

@@ -12,3 +12,3 @@ // Defaults

defaultError = Rx.helpers.defaultError = function (err) { throw err; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function'; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.subscribe !== 'function' && typeof p.then === 'function'; },
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },

@@ -15,0 +15,0 @@ not = Rx.helpers.not = function (a) { return !a; },

@@ -12,3 +12,3 @@ // Defaults

defaultError = Rx.helpers.defaultError = function (err) { throw err; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function'; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.subscribe !== 'function' && typeof p.then === 'function'; },
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },

@@ -15,0 +15,0 @@ not = Rx.helpers.not = function (a) { return !a; },

@@ -12,3 +12,3 @@ // Defaults

defaultError = Rx.helpers.defaultError = function (err) { throw err; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function'; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.subscribe !== 'function' && typeof p.then === 'function'; },
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },

@@ -15,0 +15,0 @@ not = Rx.helpers.not = function (a) { return !a; },

@@ -12,3 +12,3 @@ // Defaults

defaultError = Rx.helpers.defaultError = function (err) { throw err; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function'; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.subscribe !== 'function' && typeof p.then === 'function'; },
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },

@@ -15,0 +15,0 @@ not = Rx.helpers.not = function (a) { return !a; },

@@ -0,9 +1,22 @@

var WhileEnumerable = (function(__super__) {
inherits(WhileEnumerable, __super__);
function WhileEnumerable(c, s) {
this.c = c;
this.s = s;
}
WhileEnumerable.prototype[$iterator$] = function () {
var self = this;
return {
next: function () {
return self.c() ?
{ done: false, value: self.s } :
{ done: true, value: void 0 };
}
};
};
return WhileEnumerable;
}(Enumerable));
function enumerableWhile(condition, source) {
return new Enumerable(function () {
return new Enumerator(function () {
return condition() ?
{ done: false, value: source } :
{ done: true, value: undefined };
});
});
}
return new WhileEnumerable(condition, source);
}

@@ -32,15 +32,9 @@ /**

choiceL();
if (choice === leftChoice) {
observer.onNext(left);
}
choice === leftChoice && observer.onNext(left);
}, function (err) {
choiceL();
if (choice === leftChoice) {
observer.onError(err);
}
choice === leftChoice && observer.onError(err);
}, function () {
choiceL();
if (choice === leftChoice) {
observer.onCompleted();
}
choice === leftChoice && observer.onCompleted();
}));

@@ -50,15 +44,9 @@

choiceR();
if (choice === rightChoice) {
observer.onNext(right);
}
choice === rightChoice && observer.onNext(right);
}, function (err) {
choiceR();
if (choice === rightChoice) {
observer.onError(err);
}
choice === rightChoice && observer.onError(err);
}, function () {
choiceR();
if (choice === rightChoice) {
observer.onCompleted();
}
choice === rightChoice && observer.onCompleted();
}));

@@ -65,0 +53,0 @@

@@ -7,3 +7,3 @@ /**

var source = this;
return new AnonymousObservable(function (o) { return source.subscribe(o); }, this);
return new AnonymousObservable(function (o) { return source.subscribe(o); }, source);
};

@@ -20,16 +20,8 @@ /**

if (keySelector) {
try {
key = keySelector(value);
} catch (e) {
o.onError(e);
return;
}
key = tryCatch(keySelector)(value);
if (key === errorObj) { return o.onError(key.e); }
}
if (hasCurrentKey) {
try {
var comparerEquals = comparer(currentKey, key);
} catch (e) {
o.onError(e);
return;
}
var comparerEquals = tryCatch(comparer)(currentKey, key);
if (comparerEquals === errorObj) { return o.onError(comparerEquals.e); }
}

@@ -36,0 +28,0 @@ if (!hasCurrentKey || !comparerEquals) {

@@ -17,21 +17,12 @@ /**

return source.subscribe(function (x) {
try {
tapObserver.onNext(x);
} catch (e) {
observer.onError(e);
}
var res = tryCatch(tapObserver.onNext).call(tapObserver, x);
if (res === errorObj) { observer.onError(res.e); }
observer.onNext(x);
}, function (err) {
try {
tapObserver.onError(err);
} catch (e) {
observer.onError(e);
}
var res = tryCatch(tapObserver.onError).call(tapObserver, err);
if (res === errorObj) { observer.onError(res.e); }
observer.onError(err);
}, function () {
try {
tapObserver.onCompleted();
} catch (e) {
observer.onError(e);
}
var res = tryCatch(tapObserver.onCompleted).call(tapObserver);
if (res === errorObj) { observer.onError(res.e); }
observer.onCompleted();

@@ -38,0 +29,0 @@ });

@@ -14,4 +14,5 @@ function createListener (element, name, handler) {

// Asume NodeList
if (Object.prototype.toString.call(el) === '[object NodeList]') {
// Asume NodeList or HTMLCollection
var toStr = Object.prototype.toString;
if (toStr.call(el) === '[object NodeList]' || toStr.call(el) === '[object HTMLCollection]') {
for (var i = 0, len = el.length; i < len; i++) {

@@ -18,0 +19,0 @@ disposables.add(createEventListener(el.item(i), eventName, handler));

@@ -0,1 +1,11 @@

function isNodeList(el) {
if (window.StaticNodeList) {
// IE8 Specific
// instanceof is slower than Object#toString, but Object#toString will not work as intended in IE8
return (el instanceof window.StaticNodeList || el instanceof window.NodeList);
} else {
return (Object.prototype.toString.call(el) == '[object NodeList]')
}
}
function fixEvent(event) {

@@ -83,3 +93,3 @@ var stopPropagation = function () {

// Asume NodeList
if (Object.prototype.toString.call(el) === '[object NodeList]') {
if (isNodeList(el) || Object.prototype.toString.call(el) === '[object HTMLCollection]') {
for (var i = 0, len = el.length; i < len; i++) {

@@ -86,0 +96,0 @@ disposables.add(createEventListener(el.item(i), eventName, handler));

@@ -24,8 +24,5 @@ /**

var first = true,
hasResult = false,
result,
state = initialState,
time;
return scheduler.scheduleRecursiveWithAbsolute(scheduler.now(), function (self) {
hasResult && observer.onNext(result);
hasResult = false;
return scheduler.scheduleRecursiveWithAbsoluteAndState(initialState, scheduler.now(), function (state, self) {
hasResult && observer.onNext(state);

@@ -40,4 +37,4 @@ try {

if (hasResult) {
result = resultSelector(state);
time = timeSelector(state);
var result = resultSelector(state);
var time = timeSelector(state);
}

@@ -49,3 +46,3 @@ } catch (e) {

if (hasResult) {
self(time);
self(result, time);
} else {

@@ -52,0 +49,0 @@ observer.onCompleted();

@@ -24,8 +24,5 @@ /**

var first = true,
hasResult = false,
result,
state = initialState,
time;
return scheduler.scheduleRecursiveWithRelative(0, function (self) {
hasResult && observer.onNext(result);
hasResult = false;
return scheduler.scheduleRecursiveWithRelativeAndState(initialState, 0, function (state, self) {
hasResult && observer.onNext(state);

@@ -40,4 +37,4 @@ try {

if (hasResult) {
result = resultSelector(state);
time = timeSelector(state);
var result = resultSelector(state);
var time = timeSelector(state);
}

@@ -49,3 +46,3 @@ } catch (e) {

if (hasResult) {
self(time);
self(result, time);
} else {

@@ -52,0 +49,0 @@ observer.onCompleted();

@@ -7,3 +7,3 @@ /**

*/
observableProto.manySelect = function (selector, scheduler) {
observableProto.manySelect = observableProto.extend = function (selector, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);

@@ -10,0 +10,0 @@ var source = this;

@@ -8,3 +8,3 @@ /**

if (obj == null) { throw new TypeError('object must not be null or undefined.'); }
if (typeof Object.observe !== 'function' && typeof Object.unobserve !== 'function') { throw new TypeError('Array.observe is not supported on your platform') }
if (typeof Object.observe !== 'function' && typeof Object.unobserve !== 'function') { throw new TypeError('Object.observe is not supported on your platform') }
return new AnonymousObservable(function(observer) {

@@ -11,0 +11,0 @@ function observerFn(changes) {

@@ -27,3 +27,3 @@ /**

} catch (e) {
return o.onError(e);
o.onError(e);
}

@@ -30,0 +30,0 @@ },

function sampleObservable(source, sampler) {
return new AnonymousObservable(function (observer) {
var atEnd, value, hasValue;
return new AnonymousObservable(function (o) {
var atEnd = false, value, hasValue = false;

@@ -8,15 +8,23 @@ function sampleSubscribe() {

hasValue = false;
observer.onNext(value);
o.onNext(value);
}
atEnd && observer.onCompleted();
atEnd && o.onCompleted();
}
return new CompositeDisposable(
source.subscribe(function (newValue) {
var sourceSubscription = new SingleAssignmentDisposable();
sourceSubscription.setDisposable(source.subscribe(
function (newValue) {
hasValue = true;
value = newValue;
}, observer.onError.bind(observer), function () {
},
function (e) { o.onError(e); },
function () {
atEnd = true;
}),
sampler.subscribe(sampleSubscribe, observer.onError.bind(observer), sampleSubscribe)
sourceSubscription.dispose();
}
));
return new CompositeDisposable(
sourceSubscription,
sampler.subscribe(sampleSubscribe, function (e) { o.onError(e); }, sampleSubscribe)
);

@@ -23,0 +31,0 @@ }, source);

@@ -19,3 +19,3 @@ /**

o.onNext(x);
remaining === 0 && o.onCompleted();
remaining <= 0 && o.onCompleted();
}

@@ -22,0 +22,0 @@ }, function (e) { o.onError(e); }, function () { o.onCompleted(); });

@@ -0,7 +1,5 @@

function falseFactory() { return false; }
/**
* Merges the specified observable sequences into one observable sequence by using the selector function only when the (first) source observable sequence produces an element.
*
* @example
* 1 - obs = obs1.withLatestFrom(obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = obs1.withLatestFrom([obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.

@@ -13,16 +11,6 @@ */

var resultSelector = args.pop(), source = this;
Array.isArray(args[0]) && (args = args[0]);
if (typeof source === 'undefined') {
throw new Error('Source observable not found for withLatestFrom().');
}
if (typeof resultSelector !== 'function') {
throw new Error('withLatestFrom() expects a resultSelector function.');
}
if (Array.isArray(args[0])) {
args = args[0];
}
return new AnonymousObservable(function (observer) {
var falseFactory = function () { return false; },
n = args.length,
var n = args.length,
hasValue = arrayInitialize(n, falseFactory),

@@ -41,3 +29,3 @@ hasValueAll = false,

hasValueAll = hasValue.every(identity);
}, observer.onError.bind(observer), function () {}));
}, function (e) { observer.onError(e); }, noop));
subscriptions[i] = sad;

@@ -49,13 +37,8 @@ }(idx));

sad.setDisposable(source.subscribe(function (x) {
var res;
var allValues = [x].concat(values);
if (!hasValueAll) return;
try {
res = resultSelector.apply(null, allValues);
} catch (ex) {
observer.onError(ex);
return;
}
if (!hasValueAll) { return; }
var res = tryCatch(resultSelector).apply(null, allValues);
if (res === errorObj) { return observer.onError(res.e); }
observer.onNext(res);
}, observer.onError.bind(observer), function () {
}, function (e) { observer.onError(e); }, function () {
observer.onCompleted();

@@ -62,0 +45,0 @@ }));

@@ -0,1 +1,4 @@

function falseFactory() { return false; }
function arrayFactory() { return []; }
/**

@@ -15,25 +18,7 @@ * Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.

}
return new AnonymousObservable(function (observer) {
return new AnonymousObservable(function (o) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
queues = arrayInitialize(n, arrayFactory),
isDone = arrayInitialize(n, falseFactory);
function next(i) {
if (queues.every(function (x) { return x.length > 0; })) {
var res = queues.map(function (x) { return x.shift(); });
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
return;
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
return;
}
}
var subscriptions = new Array(n);

@@ -45,5 +30,11 @@ for (var idx = 0; idx < n; idx++) {

queues[i].push(x);
next(i);
}, function (e) { observer.onError(e); }, function () {
done(i);
if (queues.every(function (x) { return x.length > 0; })) {
var res = queues.map(function (x) { return x.shift(); });
o.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
return o.onCompleted();
}
}, function (e) { o.onError(e); }, function () {
isDone[i] = true;
isDone.every(identity) && o.onCompleted();
}));

@@ -50,0 +41,0 @@ })(idx);

function zipArray(second, resultSelector) {
var first = this;
return new AnonymousObservable(function (observer) {
return new AnonymousObservable(function (o) {
var index = 0, len = second.length;
return first.subscribe(function (left) {
if (index < len) {
var right = second[index++], result;
try {
result = resultSelector(left, right);
} catch (e) {
return observer.onError(e);
}
observer.onNext(result);
var right = second[index++], res = tryCatch(resultSelector)(left, right);
if (res === errorObj) { return o.onError(res.e); }
o.onNext(res);
} else {
observer.onCompleted();
o.onCompleted();
}
}, function (e) { observer.onError(e); }, function () { observer.onCompleted(); });
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, first);

@@ -27,6 +23,2 @@ }

* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args.
*
* @example
* 1 - res = obs1.zip(obs2, fn);
* 1 - res = x1.zip([1,2,3], fn);
* @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function.

@@ -41,3 +33,3 @@ */

args.unshift(parent);
return new AnonymousObservable(function (observer) {
return new AnonymousObservable(function (o) {
var n = args.length,

@@ -47,25 +39,2 @@ queues = arrayInitialize(n, emptyArrayFactory),

function next(i) {
var res, queuedValues;
if (queues.every(function (x) { return x.length > 0; })) {
try {
queuedValues = queues.map(function (x) { return x.shift(); });
res = resultSelector.apply(parent, queuedValues);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(function (x) { return x; })) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);

@@ -78,5 +47,13 @@ for (var idx = 0; idx < n; idx++) {

queues[i].push(x);
next(i);
}, function (e) { observer.onError(e); }, function () {
done(i);
if (queues.every(function (x) { return x.length > 0; })) {
var queuedValues = queues.map(function (x) { return x.shift(); }),
res = tryCatch(resultSelector).apply(parent, queuedValues);
if (res === errorObj) { return o.onError(res.e); }
o.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
o.onCompleted();
}
}, function (e) { o.onError(e); }, function () {
isDone[i] = true;
isDone.every(identity) && o.onCompleted();
}));

@@ -83,0 +60,0 @@ subscriptions[i] = sad;

@@ -47,7 +47,4 @@ function falseFactory() { return false; }

if (this.parent.hasValueAll || (this.parent.hasValueAll = this.parent.hasValue.every(identity))) {
try {
var res = this.parent.resultSelector.apply(null, this.parent.values);
} catch (e) {
return this.observer.onError(e);
}
var res = tryCatch(this.parent.resultSelector).apply(null, this.parent.values);
if (res === errorObj) { return this.observer.onError(res.e); }
this.observer.onNext(res);

@@ -54,0 +51,0 @@ } else if (this.parent.isDone.filter(function (x, j) { return j !== i; }).every(identity)) {

@@ -10,10 +10,45 @@ var FilterObservable = (function (__super__) {

FilterObservable.prototype.subscribeCore = function (observer) {
return this.source.subscribe(new FilterObserver(observer, this.predicate, this));
FilterObservable.prototype.subscribeCore = function (o) {
return this.source.subscribe(new InnerObserver(o, this.predicate, this));
};
function innerPredicate(predicate, self) {
return function(x, i, o) { return self.predicate(x, i, o) && predicate.call(this, x, i, o); }
}
FilterObservable.prototype.internalFilter = function(predicate, thisArg) {
var self = this;
return new FilterObservable(this.source, function(x, i, o) { return self.predicate(x, i, o) && predicate.call(this, x, i, o); }, thisArg);
return new FilterObservable(this.source, innerPredicate(predicate, this), thisArg);
};
function InnerObserver(o, predicate, source) {
this.o = o;
this.predicate = predicate;
this.source = source;
this.i = 0;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var shouldYield = tryCatch(this.predicate)(x, this.i++, this.source);
if (shouldYield === errorObj) {
return this.o.onError(shouldYield.e);
}
shouldYield && this.o.onNext(x);
};
InnerObserver.prototype.onError = function (e) {
if(!this.isStopped) { this.isStopped = true; this.o.onError(e); }
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); }
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};

@@ -24,34 +59,2 @@ return FilterObservable;

function FilterObserver(observer, predicate, source) {
this.observer = observer;
this.predicate = predicate;
this.source = source;
this.i = 0;
this.isStopped = false;
}
FilterObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var shouldYield = tryCatch(this.predicate).call(this, x, this.i++, this.source);
if (shouldYield === errorObj) {
return this.observer.onError(shouldYield.e);
}
shouldYield && this.observer.onNext(x);
};
FilterObserver.prototype.onError = function (e) {
if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
};
FilterObserver.prototype.onCompleted = function () {
if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); }
};
FilterObserver.prototype.dispose = function() { this.isStopped = true; };
FilterObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return false;
};
/**

@@ -58,0 +61,0 @@ * Filters the elements of an observable sequence based on a predicate by incorporating the element's index.

@@ -9,11 +9,47 @@ var MapObservable = (function (__super__) {

}
function innerMap(selector, self) {
return function (x, i, o) { return selector.call(this, self.selector(x, i, o), i, o); }
}
MapObservable.prototype.internalMap = function (selector, thisArg) {
var self = this;
return new MapObservable(this.source, function (x, i, o) { return selector.call(this, self.selector(x, i, o), i, o); }, thisArg)
return new MapObservable(this.source, innerMap(selector, this), thisArg);
};
MapObservable.prototype.subscribeCore = function (observer) {
return this.source.subscribe(new MapObserver(observer, this.selector, this));
MapObservable.prototype.subscribeCore = function (o) {
return this.source.subscribe(new InnerObserver(o, this.selector, this));
};
function InnerObserver(o, selector, source) {
this.o = o;
this.selector = selector;
this.source = source;
this.i = 0;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var result = tryCatch(this.selector)(x, this.i++, this.source);
if (result === errorObj) {
return this.o.onError(result.e);
}
this.o.onNext(result);
};
InnerObserver.prototype.onError = function (e) {
if(!this.isStopped) { this.isStopped = true; this.o.onError(e); }
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); }
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};

@@ -24,35 +60,2 @@ return MapObservable;

function MapObserver(observer, selector, source) {
this.observer = observer;
this.selector = selector;
this.source = source;
this.i = 0;
this.isStopped = false;
}
MapObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var result = tryCatch(this.selector).call(this, x, this.i++, this.source);
if (result === errorObj) {
return this.observer.onError(result.e);
}
this.observer.onNext(result);
};
MapObserver.prototype.onError = function (e) {
if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
};
MapObserver.prototype.onCompleted = function () {
if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); }
};
MapObserver.prototype.dispose = function() { this.isStopped = true; };
MapObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return false;
};
/**

@@ -59,0 +62,0 @@ * Projects each element of an observable sequence into a new form by incorporating the element's index.

@@ -15,8 +15,3 @@ var MergeAllObservable = (function (__super__) {

};
return MergeAllObservable;
}(ObservableBase));
var MergeAllObserver = (function() {
function MergeAllObserver(o, g) {

@@ -93,6 +88,5 @@ this.o = o;

return MergeAllObserver;
return MergeAllObservable;
}(ObservableBase));
}());
/**

@@ -99,0 +93,0 @@ * Merges an observable sequence of observable sequences into an observable sequence.

@@ -5,3 +5,3 @@ var RangeObservable = (function(__super__) {

this.start = start;
this.count = count;
this.rangeCount = count;
this.scheduler = scheduler;

@@ -26,3 +26,3 @@ __super__.call(this);

RangeSink.prototype.run = function () {
var start = this.parent.start, count = this.parent.count, observer = this.observer;
var start = this.parent.start, count = this.parent.rangeCount, observer = this.observer;
function loopRecursive(i, recurse) {

@@ -29,0 +29,0 @@ if (i < count) {

var ReduceObservable = (function(__super__) {
inherits(ReduceObservable, __super__);
function ReduceObservable(source, accumulator, hasSeed, seed) {
function ReduceObservable(source, acc, hasSeed, seed) {
this.source = source;
this.accumulator = accumulator;
this.acc = acc;
this.hasSeed = hasSeed;

@@ -12,46 +12,51 @@ this.seed = seed;

ReduceObservable.prototype.subscribeCore = function(observer) {
return this.source.subscribe(new ReduceObserver(observer,this));
return this.source.subscribe(new InnerObserver(observer,this));
};
return ReduceObservable;
}(ObservableBase));
var ReduceObserver = (function(__super__) {
inherits(ReduceObserver, __super__);
function ReduceObserver(observer, parent) {
this.observer = observer;
this.accumulator = parent.accumulator;
function InnerObserver(o, parent) {
this.o = o;
this.acc = parent.acc;
this.hasSeed = parent.hasSeed;
this.seed = parent.seed;
this.hasAccumulation = false;
this.accumulation = null;
this.result = null;
this.hasValue = false;
__super__.call(this);
this.isStopped = false;
}
ReduceObserver.prototype.next = function (x) {
InnerObserver.prototype.onNext = function (x) {
if (this.isStopped) { return; }
!this.hasValue && (this.hasValue = true);
try {
if (this.hasAccumulation) {
this.accumulation = this.accumulator(this.accumulation, x);
} else {
this.accumulation = this.hasSeed ? this.accumulator(this.seed, x) : x;
this.hasAccumulation = true;
}
} catch (e) {
this.observer.onError(e);
return;
if (this.hasAccumulation) {
this.result = tryCatch(this.acc)(this.result, x);
} else {
this.result = this.hasSeed ? tryCatch(this.acc)(this.seed, x) : x;
this.hasAccumulation = true;
}
if (this.result === errorObj) { this.o.onError(this.result.e); }
};
ReduceObserver.prototype.error = function (e) { this.observer.onError(e); };
ReduceObserver.prototype.completed = function () {
this.hasValue && this.observer.onNext(this.accumulation);
!this.hasValue && this.hasSeed && this.observer.onNext(seed);
!this.hasValue && !this.hasSeed && this.observer.onError(new Error(sequenceContainsNoElements));
this.observer.onCompleted();
InnerObserver.prototype.onError = function (e) {
if (!this.isStopped) { this.isStopped = true; this.o.onError(e); }
};
InnerObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.hasValue && this.o.onNext(this.result);
!this.hasValue && this.hasSeed && this.o.onNext(this.seed);
!this.hasValue && !this.hasSeed && this.o.onError(new EmptyError());
this.o.onCompleted();
}
};
InnerObserver.prototype.dispose = function () { this.isStopped = true; };
InnerObserver.prototype.fail = function(e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
return ReduceObserver;
}(AbstractObserver));
return ReduceObservable;
}(ObservableBase));
/**

@@ -58,0 +63,0 @@ * Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.

@@ -12,3 +12,3 @@ var ScanObservable = (function(__super__) {

ScanObservable.prototype.subscribeCore = function(observer) {
return this.source.subscribe(new ScanObserver(observer,this);
return this.source.subscribe(new ScanObserver(observer,this));
};

@@ -19,46 +19,53 @@

var ScanObserver = (function(__super__) {
inherits(ScanObserver, __super__);
function ScanObserver(observer, parent) {
this.observer = observer;
this.accumulator = parent.accumulator;
this.hasSeed = parent.hasSeed;
this.seed = parent.seed;
this.hasAccumulation = false;
this.accumulation = null;
this.hasValue = false;
__super__.call(this);
function ScanObserver(observer, parent) {
this.observer = observer;
this.accumulator = parent.accumulator;
this.hasSeed = parent.hasSeed;
this.seed = parent.seed;
this.hasAccumulation = false;
this.accumulation = null;
this.hasValue = false;
this.isStopped = false;
}
ScanObserver.prototype.onNext = function (x) {
if (this.isStopped) { return; }
!this.hasValue && (this.hasValue = true);
try {
if (this.hasAccumulation) {
this.accumulation = this.accumulator(this.accumulation, x);
} else {
this.accumulation = this.hasSeed ? this.accumulator(this.seed, x) : x;
this.hasAccumulation = true;
}
} catch (e) {
return this.observer.onError(e);
}
ScanObserver.prototype.next = function (x) {
!this.hasValue && (this.hasValue = true);
try {
if (this.hasAccumulation) {
this.accumulation = this.accumulator(this.accumulation, x);
} else {
this.accumulation = this.hasSeed ? this.accumulator(this.seed, x) : x;
this.hasAccumulation = true;
}
} catch (e) {
this.observer.onError(e);
return;
}
this.observer.onNext(accumulation);
};
ScanObserver.prototype.error = function (e) { this.observer.onError(e); };
ScanObserver.prototype.completed = function () {
!this.hasValue && this.hasSeed && this.observer.onNext(seed);
this.observer.onNext(this.accumulation);
};
ScanObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
}
};
ScanObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
!this.hasValue && this.hasSeed && this.observer.onNext(this.seed);
this.observer.onCompleted();
};
}
};
ScanObserver.prototype.dispose = function() { this.isStopped = true; };
ScanObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return false;
};
return ScanObserver;
}(AbstractObserver));
/**
* Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.
* For aggregation behavior with no intermediate results, see Observable.aggregate.
* @example
* var res = source.scan(function (acc, x) { return acc + x; });
* var res = source.scan(0, function (acc, x) { return acc + x; });
* @param {Mixed} [seed] The initial accumulator value.

@@ -65,0 +72,0 @@ * @param {Function} accumulator An accumulator function to be invoked on each element.

@@ -8,64 +8,83 @@ var SwitchObservable = (function(__super__) {

SwitchObservable.prototype.subscribeCore = function (observer) {
var innerSubscription = new SerialDisposable(),
subscription = this.source.subscribe(new SwitchObserver(observer, innerSubscription));
return new CompositeDisposable(subscription, innerSubscription);
SwitchObservable.prototype.subscribeCore = function (o) {
var inner = new SerialDisposable(), s = this.source.subscribe(new SwitchObserver(o, inner));
return new CompositeDisposable(s, inner);
};
return SwitchObservable;
}(ObservableBase));
var SwitchObserver = (function(__super__) {
inherits(SwitchObserver, __super__);
function SwitchObserver(observer, innerSubscription) {
this.observer = observer;
this.innerSubscription = innerSubscription;
function SwitchObserver(o, inner) {
this.o = o;
this.inner = inner;
this.stopped = false;
this.latest = 0;
this.hasLatest = false;
__super__.call(this);
this.isStopped = false;
}
SwitchObserver.prototype.next = function (innerSource) {
SwitchObserver.prototype.onNext = function (innerSource) {
if (this.isStopped) { return; }
var d = new SingleAssignmentDisposable(), id = ++this.latest;
this.hasLatest = true;
this.innerSubscription.setDisposable(d);
// Check if Promise or Observable
this.inner.setDisposable(d);
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
d.setDisposable(innerSource.subscribe(new InnerObserver(this, id)));
};
SwitchObserver.prototype.error = function (e) {
this.observer.onError(e);
SwitchObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
};
SwitchObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.stopped = true;
!this.hasLatest && this.o.onCompleted();
}
};
SwitchObserver.prototype.dispose = function () { this.isStopped = true; };
SwitchObserver.prototype.fail = function (e) {
if(!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
SwitchObserver.prototype.completed = function () {
this.stopped = true;
!this.hasLatest && this.observer.onCompleted();
function InnerObserver(parent, id) {
this.parent = parent;
this.id = id;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) {
if (this.isStopped) { return; }
this.parent.latest === this.id && this.parent.o.onNext(x);
};
var InnerObserver = (function(__base__) {
inherits(InnerObserver, __base__);
function InnerObserver(parent, id) {
this.parent = parent;
this.id = id;
__base__.call(this);
InnerObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.latest === this.id && this.parent.o.onError(e);
}
InnerObserver.prototype.next = function (x) { this.parent.latest === this.id && this.parent.observer.onNext(x); };
InnerObserver.prototype.error = function (e) { this.parent.latest === this.id && this.parent.observer.onError(e); };
InnerObserver.prototype.completed = function () {
};
InnerObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
if (this.parent.latest === this.id) {
this.parent.hasLatest = false;
this.parent.isStopped && this.parent.observer.onCompleted();
this.parent.isStopped && this.parent.o.onCompleted();
}
};
}
};
InnerObserver.prototype.dispose = function () { this.isStopped = true; }
InnerObserver.prototype.fail = function (e) {
if(!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
return true;
}
return false;
};
return InnerObserver;
}(AbstractObserver));
return SwitchObservable;
}(ObservableBase));
return SwitchObserver;
}(AbstractObserver));
/**

@@ -72,0 +91,0 @@ * Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@@ -5,49 +5,51 @@ var TapObservable = (function(__super__) {

this.source = source;
this.tapObserver = !observerOrOnNext || isFunction(observerOrOnNext) ?
this.t = !observerOrOnNext || isFunction(observerOrOnNext) ?
observerCreate(observerOrOnNext || noop, onError || noop, onCompleted || noop) :
observerOrOnNext;;
observerOrOnNext;
__super__.call(this);
}
TapObservable.prototype.subscribeCore = function(observer) {
return this.source.subscribe(new TapObserver(observer, this.tapObserver));
TapObservable.prototype.subscribeCore = function(o) {
return this.source.subscribe(new InnerObserver(o, this.t));
};
return TapObservable;
}(ObservableBase));
var TapObserver = (function(__super__){
inherits(TapObserver, __super__);
function TapObserver(observer, tapObserver) {
this.observer = observer;
this.tapObserver = tapObserver;
__super__.call(this;)
function InnerObserver(o, t) {
this.o = o;
this.t = t;
this.isStopped = false;
}
TapObserver.prototype.next = function(x) {
try {
this.tapObserver.onNext(x);
} catch (e) {
return this.observer.onError(e);
InnerObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var res = tryCatch(this.t.onNext).call(this.t, x);
if (res === errorObj) { this.o.onError(res.e); }
this.o.onNext(x);
};
InnerObserver.prototype.onError = function(err) {
if (!this.isStopped) {
this.isStopped = true;
var res = tryCatch(this.t.onError).call(this.t, err);
if (res === errorObj) { return this.o.onError(res.e); }
this.o.onError(err);
}
this.observer.onNext(x);
};
TapObserver.prototype.error = function(err) {
try {
this.tapObserver.onError(err);
} catch (e) {
return this.observer.onError(e);
InnerObserver.prototype.onCompleted = function() {
if (!this.isStopped) {
this.isStopped = true;
var res = tryCatch(this.t.onCompleted).call(this.t);
if (res === errorObj) { return this.o.onError(res.e); }
this.o.onCompleted();
}
this.observer.onError(err);
};
TapObserver.prototype.completed = function() {
try {
this.tapObserver.onCompleted();
} catch (e) {
return this.observer.onError(e);
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
this.observer.onCompleted();
return false;
};
return TapObserver;
}(AbstractObserver));
return TapObservable;
}(ObservableBase));

@@ -57,3 +59,3 @@ /**

* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an observer.
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an o.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.

@@ -63,13 +65,6 @@ * @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.

*/
observableProto['do'] = observableProto.tap = function (observerOrOnNext, onError, onCompleted) {
observableProto['do'] = observableProto.tap = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) {
return new TapObservable(this, observerOrOnNext, onError, onCompleted);
};
/** @deprecated use #do or #tap instead. */
observableProto.doAction = function () {
//deprecate('doAction', 'do or tap');
return this.tap.apply(this, arguments);
};
/**

@@ -76,0 +71,0 @@ * Invokes an action for each element in the observable sequence.

@@ -9,19 +9,19 @@ var ThrowObservable = (function(__super__) {

ThrowObservable.prototype.subscribeCore = function (observer) {
var sink = new ThrowSink(observer, this);
ThrowObservable.prototype.subscribeCore = function (o) {
var sink = new ThrowSink(o, this);
return sink.run();
};
function ThrowSink(observer, parent) {
this.observer = observer;
this.parent = parent;
function ThrowSink(o, p) {
this.o = o;
this.p = p;
}
function scheduleItem(s, state) {
var error = state[0], observer = state[1];
observer.onError(error);
var e = state[0], o = state[1];
o.onError(e);
}
ThrowSink.prototype.run = function () {
return this.parent.scheduler.scheduleWithState([this.parent.error, this.observer], scheduleItem);
return this.p.scheduler.scheduleWithState([this.p.error, this.o], scheduleItem);
};

@@ -28,0 +28,0 @@

@@ -8,39 +8,39 @@ var ToArrayObservable = (function(__super__) {

ToArrayObservable.prototype.subscribeCore = function(observer) {
return this.source.subscribe(new ToArrayObserver(observer));
ToArrayObservable.prototype.subscribeCore = function(o) {
return this.source.subscribe(new InnerObserver(o));
};
function InnerObserver(o) {
this.o = o;
this.a = [];
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.a.push(x); } };
InnerObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
};
InnerObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.o.onNext(this.a);
this.o.onCompleted();
}
};
InnerObserver.prototype.dispose = function () { this.isStopped = true; }
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
return ToArrayObservable;
}(ObservableBase));
function ToArrayObserver(observer) {
this.observer = observer;
this.a = [];
this.isStopped = false;
}
ToArrayObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.a.push(x); } };
ToArrayObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
}
};
ToArrayObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onNext(this.a);
this.observer.onCompleted();
}
};
ToArrayObserver.prototype.dispose = function () { this.isStopped = true; }
ToArrayObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return false;
};
/**

@@ -47,0 +47,0 @@ * Creates an array from an observable sequence.

@@ -53,3 +53,2 @@ // DefinitelyTyped: partial

function notDefined(value: any): boolean;
function isScheduler(value: any): boolean;
function identity<T>(value: T): T;

@@ -121,2 +120,3 @@ function defaultNow(): number;

now(): number;
isScheduler(value: any): boolean;

@@ -313,3 +313,3 @@ schedule(action: () => void): IDisposable;

tap(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): Observable<T>; // alias for do
doOnNext(onNext: (value: T) => void, thisArg?: any): Observable<T>;

@@ -670,2 +670,4 @@ doOnError(onError: (exception: any) => void, thisArg?: any): Observable<T>;

fromPromise<T>(promise: IPromise<T>): Observable<T>;
prototype: any;
}

@@ -672,0 +674,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc