Comparing version 2.3.13 to 2.3.14
{ | ||
"name": "rxjs", | ||
"version": "2.3.13", | ||
"version": "2.3.14", | ||
"main": [ | ||
@@ -5,0 +5,0 @@ "dist/rx.all.js", |
@@ -115,42 +115,36 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | ||
/** | ||
* 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. | ||
* @example | ||
* 1 - res = source.aggregate(function (acc, x) { return acc + x; }); | ||
* 2 - res = source.aggregate(0, function (acc, x) { return acc + x; }); | ||
* @param {Mixed} [seed] The initial accumulator value. | ||
* @param {Function} accumulator An accumulator function to be invoked on each element. | ||
* @returns {Observable} An observable sequence containing a single element with the final accumulator value. | ||
*/ | ||
observableProto.aggregate = function () { | ||
var seed, hasSeed, accumulator; | ||
if (arguments.length === 2) { | ||
seed = arguments[0]; | ||
hasSeed = true; | ||
accumulator = arguments[1]; | ||
} else { | ||
accumulator = arguments[0]; | ||
} | ||
return hasSeed ? this.scan(seed, accumulator).startWith(seed).finalValue() : this.scan(accumulator).finalValue(); | ||
}; | ||
/** | ||
* 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 {Mixed} [seed] The initial accumulator value. | ||
* @param {Function} accumulator An accumulator function to be invoked on each element. | ||
* @returns {Observable} An observable sequence containing a single element with the final accumulator value. | ||
*/ | ||
observableProto.aggregate = function () { | ||
var seed, hasSeed, accumulator; | ||
if (arguments.length === 2) { | ||
seed = arguments[0]; | ||
hasSeed = true; | ||
accumulator = arguments[1]; | ||
} else { | ||
accumulator = arguments[0]; | ||
} | ||
return hasSeed ? this.scan(seed, accumulator).startWith(seed).finalValue() : this.scan(accumulator).finalValue(); | ||
}; | ||
/** | ||
* 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. | ||
* @example | ||
* 1 - res = source.reduce(function (acc, x) { return acc + x; }); | ||
* 2 - res = source.reduce(function (acc, x) { return acc + x; }, 0); | ||
* @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 seed, hasSeed; | ||
if (arguments.length === 2) { | ||
hasSeed = true; | ||
seed = arguments[1]; | ||
} | ||
return hasSeed ? this.scan(seed, accumulator).startWith(seed).finalValue() : this.scan(accumulator).finalValue(); | ||
}; | ||
/** | ||
* 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 seed, hasSeed; | ||
if (arguments.length === 2) { | ||
hasSeed = true; | ||
seed = arguments[1]; | ||
} | ||
return hasSeed ? this.scan(seed, accumulator).startWith(seed).finalValue() : this.scan(accumulator).finalValue(); | ||
}; | ||
@@ -362,29 +356,23 @@ /** | ||
/** | ||
* Computes the average of an observable sequence of values that are in the sequence or obtained by invoking a transform function on each element of the input sequence if present. | ||
* @example | ||
* var res = res = source.average(); | ||
* var res = res = source.average(function (x) { return x.value; }); | ||
* @param {Function} [selector] A transform function to apply to each element. | ||
* @param {Any} [thisArg] Object to use as this when executing callback. | ||
* @returns {Observable} An observable sequence containing a single element with the average of the sequence of values. | ||
*/ | ||
observableProto.average = function (keySelector, thisArg) { | ||
return keySelector ? | ||
this.select(keySelector, thisArg).average() : | ||
this.scan({ | ||
sum: 0, | ||
count: 0 | ||
}, function (prev, cur) { | ||
return { | ||
sum: prev.sum + cur, | ||
count: prev.count + 1 | ||
}; | ||
}).finalValue().select(function (s) { | ||
if (s.count === 0) { | ||
throw new Error('The input sequence was empty'); | ||
} | ||
return s.sum / s.count; | ||
}); | ||
}; | ||
/** | ||
* Computes the average of an observable sequence of values that are in the sequence or obtained by invoking a transform function on each element of the input sequence if present. | ||
* @param {Function} [selector] A transform function to apply to each element. | ||
* @param {Any} [thisArg] Object to use as this when executing callback. | ||
* @returns {Observable} An observable sequence containing a single element with the average of the sequence of values. | ||
*/ | ||
observableProto.average = function (keySelector, thisArg) { | ||
return keySelector && isFunction(keySelector) ? | ||
this.select(keySelector, thisArg).average() : | ||
this.scan({sum: 0, count: 0 }, function (prev, cur) { | ||
return { | ||
sum: prev.sum + cur, | ||
count: prev.count + 1 | ||
}; | ||
}).finalValue().map(function (s) { | ||
if (s.count === 0) { | ||
throw new Error('The input sequence was empty'); | ||
} | ||
return s.sum / s.count; | ||
}); | ||
}; | ||
@@ -391,0 +379,0 @@ function sequenceEqualArray(first, second, comparer) { |
/* 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 p(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)},d.onError.bind(d),function(){d.onNext(g),d.onCompleted()})})}function f(a){if(0===a.length)throw new Error(A);return a[0]}function g(a,b,c){return new p(function(d){var e=0,f=b.length;return a.subscribe(function(a){var g=!1;try{f>e&&(g=c(a,b[e++]))}catch(h){return void d.onError(h)}g||(d.onNext(!1),d.onCompleted())},d.onError.bind(d),function(){d.onNext(e===f),d.onCompleted()})})}function h(a,b,c,d){if(0>b)throw new Error(z);return new p(function(e){var f=b;return a.subscribe(function(a){0===f&&(e.onNext(a),e.onCompleted()),f--},e.onError.bind(e),function(){c?(e.onNext(d),e.onCompleted()):e.onError(new Error(z))})})}function i(a,b,c){return new p(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)},d.onError.bind(d),function(){f||b?(d.onNext(e),d.onCompleted()):d.onError(new Error(A))})})}function j(a,b,c){return new p(function(d){return a.subscribe(function(a){d.onNext(a),d.onCompleted()},d.onError.bind(d),function(){b?(d.onNext(c),d.onCompleted()):d.onError(new Error(A))})})}function k(a,b,c){return new p(function(d){var e=c,f=!1;return a.subscribe(function(a){e=a,f=!0},d.onError.bind(d),function(){f||b?(d.onNext(e),d.onCompleted()):d.onError(new Error(A))})})}function l(a,b,c,e){return new p(function(f){var g=0;return a.subscribe(function(d){var h;try{h=b.call(c,d,g,a)}catch(i){return void f.onError(i)}h?(f.onNext(e?g:d),f.onCompleted()):g++},f.onError.bind(f),function(){f.onNext(e?-1:d),f.onCompleted()})})}var m=c.Observable,n=m.prototype,o=c.CompositeDisposable,p=c.AnonymousObservable,q=c.Disposable.empty,r=(c.internals.isEqual,c.helpers),s=r.not,t=r.defaultComparer,u=r.identity,v=r.defaultSubComparer,w=r.isFunction,x=r.isPromise,y=m.fromPromise,z="Argument out of range",A="Sequence contains no elements.";return n.finalValue=function(){var a=this;return new p(function(b){var c,d=!1;return a.subscribe(function(a){d=!0,c=a},b.onError.bind(b),function(){d?(b.onNext(c),b.onCompleted()):b.onError(new Error(A))})})},n.aggregate=function(){var a,b,c;return 2===arguments.length?(a=arguments[0],b=!0,c=arguments[1]):c=arguments[0],b?this.scan(a,c).startWith(a).finalValue():this.scan(c).finalValue()},n.reduce=function(a){var b,c;return 2===arguments.length&&(c=!0,b=arguments[1]),c?this.scan(b,a).startWith(b).finalValue():this.scan(a).finalValue()},n.some=n.any=function(a,b){var c=this;return a?c.where(a,b).any():new p(function(a){return c.subscribe(function(){a.onNext(!0),a.onCompleted()},a.onError.bind(a),function(){a.onNext(!1),a.onCompleted()})})},n.isEmpty=function(){return this.any().map(s)},n.every=n.all=function(a,b){return this.where(function(b){return!a(b)},b).any().select(function(a){return!a})},n.contains=function(a,b){function c(a,b){return 0===a&&0===b||a===b||isNaN(a)&&isNaN(b)}var d=this;return new p(function(e){var f=0,g=+b||0;return 1/0===Math.abs(g)&&(g=0),0>g?(e.onNext(!1),e.onCompleted(),q):d.subscribe(function(b){f++>=g&&c(b,a)&&(e.onNext(!0),e.onCompleted())},e.onError.bind(e),function(){e.onNext(!1),e.onCompleted()})})},n.count=function(a,b){return a?this.where(a,b).count():this.aggregate(0,function(a){return a+1})},n.indexOf=function(a,b){var c=this;return new p(function(d){var e=0,f=+b||0;return 1/0===Math.abs(f)&&(f=0),0>f?(d.onNext(-1),d.onCompleted(),q):c.subscribe(function(b){e>=f&&b===a&&(d.onNext(e),d.onCompleted()),e++},d.onError.bind(d),function(){d.onNext(-1),d.onCompleted()})})},n.sum=function(a,b){return a&&w(a)?this.map(a,b).sum():this.aggregate(0,function(a,b){return a+b})},n.minBy=function(a,b){return b||(b=v),e(this,a,function(a,c){return-1*b(a,c)})},n.min=function(a){return this.minBy(u,a).select(function(a){return f(a)})},n.maxBy=function(a,b){return b||(b=v),e(this,a,b)},n.max=function(a){return this.maxBy(u,a).select(function(a){return f(a)})},n.average=function(a,b){return a?this.select(a,b).average():this.scan({sum:0,count:0},function(a,b){return{sum:a.sum+b,count:a.count+1}}).finalValue().select(function(a){if(0===a.count)throw new Error("The input sequence was empty");return a.sum/a.count})},n.sequenceEqual=function(a,b){var c=this;return b||(b=t),Array.isArray(a)?g(c,a,b):new p(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)},d.onError.bind(d),function(){e=!0,0===g.length&&(h.length>0?(d.onNext(!1),d.onCompleted()):f&&(d.onNext(!0),d.onCompleted()))});x(a)&&(a=y(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)},d.onError.bind(d),function(){f=!0,0===h.length&&(g.length>0?(d.onNext(!1),d.onCompleted()):e&&(d.onNext(!0),d.onCompleted()))});return new o(i,j)})},n.elementAt=function(a){return h(this,a,!1)},n.elementAtOrDefault=function(a,b){return h(this,a,!0,b)},n.single=function(a,b){return a&&w(a)?this.where(a,b).single():i(this,!1)},n.singleOrDefault=function(a,b,c){return a&&w(a)?this.where(a,c).singleOrDefault(null,b):i(this,!0,b)},n.first=function(a,b){return a?this.where(a,b).first():j(this,!1)},n.firstOrDefault=function(a,b){return a?this.where(a).firstOrDefault(null,b):j(this,!0,b)},n.last=function(a,b){return a?this.where(a,b).last():k(this,!1)},n.lastOrDefault=function(a,b,c){return a?this.where(a,c).lastOrDefault(null,b):k(this,!0,b)},n.find=function(a,b){return l(this,a,b,!1)},n.findIndex=function(a,b){return l(this,a,b,!0)},a.Set&&(n.toSet=function(){var b=this;return new p(function(c){var d=new a.Set;return b.subscribe(d.add.bind(d),c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})}),a.Map&&(n.toMap=function(b,c){var d=this;return new p(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)},e.onError.bind(e),function(){e.onNext(f),e.onCompleted()})})}),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,c){return new p(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)},d.onError.bind(d),function(){d.onNext(g),d.onCompleted()})})}function f(a){if(0===a.length)throw new Error(A);return a[0]}function g(a,b,c){return new p(function(d){var e=0,f=b.length;return a.subscribe(function(a){var g=!1;try{f>e&&(g=c(a,b[e++]))}catch(h){return void d.onError(h)}g||(d.onNext(!1),d.onCompleted())},d.onError.bind(d),function(){d.onNext(e===f),d.onCompleted()})})}function h(a,b,c,d){if(0>b)throw new Error(z);return new p(function(e){var f=b;return a.subscribe(function(a){0===f&&(e.onNext(a),e.onCompleted()),f--},e.onError.bind(e),function(){c?(e.onNext(d),e.onCompleted()):e.onError(new Error(z))})})}function i(a,b,c){return new p(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)},d.onError.bind(d),function(){f||b?(d.onNext(e),d.onCompleted()):d.onError(new Error(A))})})}function j(a,b,c){return new p(function(d){return a.subscribe(function(a){d.onNext(a),d.onCompleted()},d.onError.bind(d),function(){b?(d.onNext(c),d.onCompleted()):d.onError(new Error(A))})})}function k(a,b,c){return new p(function(d){var e=c,f=!1;return a.subscribe(function(a){e=a,f=!0},d.onError.bind(d),function(){f||b?(d.onNext(e),d.onCompleted()):d.onError(new Error(A))})})}function l(a,b,c,e){return new p(function(f){var g=0;return a.subscribe(function(d){var h;try{h=b.call(c,d,g,a)}catch(i){return void f.onError(i)}h?(f.onNext(e?g:d),f.onCompleted()):g++},f.onError.bind(f),function(){f.onNext(e?-1:d),f.onCompleted()})})}var m=c.Observable,n=m.prototype,o=c.CompositeDisposable,p=c.AnonymousObservable,q=c.Disposable.empty,r=(c.internals.isEqual,c.helpers),s=r.not,t=r.defaultComparer,u=r.identity,v=r.defaultSubComparer,w=r.isFunction,x=r.isPromise,y=m.fromPromise,z="Argument out of range",A="Sequence contains no elements.";return n.finalValue=function(){var a=this;return new p(function(b){var c,d=!1;return a.subscribe(function(a){d=!0,c=a},b.onError.bind(b),function(){d?(b.onNext(c),b.onCompleted()):b.onError(new Error(A))})})},n.aggregate=function(){var a,b,c;return 2===arguments.length?(a=arguments[0],b=!0,c=arguments[1]):c=arguments[0],b?this.scan(a,c).startWith(a).finalValue():this.scan(c).finalValue()},n.reduce=function(a){var b,c;return 2===arguments.length&&(c=!0,b=arguments[1]),c?this.scan(b,a).startWith(b).finalValue():this.scan(a).finalValue()},n.some=n.any=function(a,b){var c=this;return a?c.where(a,b).any():new p(function(a){return c.subscribe(function(){a.onNext(!0),a.onCompleted()},a.onError.bind(a),function(){a.onNext(!1),a.onCompleted()})})},n.isEmpty=function(){return this.any().map(s)},n.every=n.all=function(a,b){return this.where(function(b){return!a(b)},b).any().select(function(a){return!a})},n.contains=function(a,b){function c(a,b){return 0===a&&0===b||a===b||isNaN(a)&&isNaN(b)}var d=this;return new p(function(e){var f=0,g=+b||0;return 1/0===Math.abs(g)&&(g=0),0>g?(e.onNext(!1),e.onCompleted(),q):d.subscribe(function(b){f++>=g&&c(b,a)&&(e.onNext(!0),e.onCompleted())},e.onError.bind(e),function(){e.onNext(!1),e.onCompleted()})})},n.count=function(a,b){return a?this.where(a,b).count():this.aggregate(0,function(a){return a+1})},n.indexOf=function(a,b){var c=this;return new p(function(d){var e=0,f=+b||0;return 1/0===Math.abs(f)&&(f=0),0>f?(d.onNext(-1),d.onCompleted(),q):c.subscribe(function(b){e>=f&&b===a&&(d.onNext(e),d.onCompleted()),e++},d.onError.bind(d),function(){d.onNext(-1),d.onCompleted()})})},n.sum=function(a,b){return a&&w(a)?this.map(a,b).sum():this.aggregate(0,function(a,b){return a+b})},n.minBy=function(a,b){return b||(b=v),e(this,a,function(a,c){return-1*b(a,c)})},n.min=function(a){return this.minBy(u,a).select(function(a){return f(a)})},n.maxBy=function(a,b){return b||(b=v),e(this,a,b)},n.max=function(a){return this.maxBy(u,a).select(function(a){return f(a)})},n.average=function(a,b){return a&&w(a)?this.select(a,b).average():this.scan({sum:0,count:0},function(a,b){return{sum:a.sum+b,count:a.count+1}}).finalValue().map(function(a){if(0===a.count)throw new Error("The input sequence was empty");return a.sum/a.count})},n.sequenceEqual=function(a,b){var c=this;return b||(b=t),Array.isArray(a)?g(c,a,b):new p(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)},d.onError.bind(d),function(){e=!0,0===g.length&&(h.length>0?(d.onNext(!1),d.onCompleted()):f&&(d.onNext(!0),d.onCompleted()))});x(a)&&(a=y(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)},d.onError.bind(d),function(){f=!0,0===h.length&&(g.length>0?(d.onNext(!1),d.onCompleted()):e&&(d.onNext(!0),d.onCompleted()))});return new o(i,j)})},n.elementAt=function(a){return h(this,a,!1)},n.elementAtOrDefault=function(a,b){return h(this,a,!0,b)},n.single=function(a,b){return a&&w(a)?this.where(a,b).single():i(this,!1)},n.singleOrDefault=function(a,b,c){return a&&w(a)?this.where(a,c).singleOrDefault(null,b):i(this,!0,b)},n.first=function(a,b){return a?this.where(a,b).first():j(this,!1)},n.firstOrDefault=function(a,b){return a?this.where(a).firstOrDefault(null,b):j(this,!0,b)},n.last=function(a,b){return a?this.where(a,b).last():k(this,!1)},n.lastOrDefault=function(a,b,c){return a?this.where(a,c).lastOrDefault(null,b):k(this,!0,b)},n.find=function(a,b){return l(this,a,b,!1)},n.findIndex=function(a,b){return l(this,a,b,!0)},a.Set&&(n.toSet=function(){var b=this;return new p(function(c){var d=new a.Set;return b.subscribe(d.add.bind(d),c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})}),a.Map&&(n.toMap=function(b,c){var d=this;return new p(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)},e.onError.bind(e),function(){e.onNext(f),e.onCompleted()})})}),c}); | ||
//# sourceMappingURL=rx.aggregates.map |
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/ | ||
(function(a){function b(){if(this.isDisposed)throw new Error(P)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;kb.nonEnumArgs&&a.length&&h(a)&&(a=mb.call(a));var d=kb.enumPrototypes&&"function"==typeof a,e=kb.enumErrorProps&&(a===eb||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(kb.nonEnumShadows&&a!==fb){var g=a.constructor,i=-1,j=ib.length;if(a===(g&&g.prototype))var k=a===stringProto?ab:a===eb?X:bb.call(a),l=jb[k];for(;++i<j;)f=ib[i],l&&l[f]||!cb.call(a,f)||b.push(f)}return b}function e(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function f(a,b){return e(a,b,d)}function g(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function h(a){return a&&"object"==typeof a?bb.call(a)==T:!1}function i(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,j=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=j&&"object"!=j))return!1;var k=bb.call(a),l=bb.call(b);if(k==T&&(k=$),l==T&&(l=$),k!=l)return!1;switch(k){case V:case W:return+a==+b;case Z:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case _:case ab:return a==String(b)}var m=k==U;if(!m){if(k!=$||!kb.nodeClass&&(g(a)||g(b)))return!1;var n=!kb.argsObject&&h(a)?Object:a.constructor,o=!kb.argsObject&&h(b)?Object:b.constructor;if(!(n==o||cb.call(a,"constructor")&&cb.call(b,"constructor")||N(n)&&n instanceof n&&N(o)&&o instanceof o||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var p=c.length;p--;)if(c[p]==a)return d[p]==b;var q=0;if(result=!0,c.push(a),d.push(b),m){if(p=a.length,q=b.length,result=q==p)for(;q--;){var r=b[q];if(!(result=i(a[q],r,c,d)))break}}else f(b,function(b,e,f){return cb.call(f,e)?(q++,result=cb.call(a,e)&&i(a[e],b,c,d)):void 0}),result&&f(a,function(a,b,c){return cb.call(c,b)?result=--q>-1:void 0});return c.pop(),d.pop(),result}function j(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:mb.call(a)}function k(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function l(a,b){this.id=a,this.value=b}function m(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function n(a){return"number"==typeof a&&z.isFinite(a)}function o(b){return b[Q]!==a}function p(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function q(a){var b=+a.length;return isNaN(b)?0:0!==b&&n(b)?(b=p(b)*Math.floor(Math.abs(b)),0>=b?0:b>fc?fc:b):b}function r(a){return"[object Function]"===Object.prototype.toString.call(a)&&"function"==typeof a}function s(a,b){return new pc(function(c){var d=new zb,e=new Ab;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}M(f)&&(f=cc(f)),d=new zb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function t(a,b){var c=this;return new pc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return void d.onError(i)}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function u(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return M(e)?cc(e):e}).concatAll()}function v(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function w(a){this.comparer=a,this.set=[]}function x(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return M(e)?cc(e):e}).mergeObservable()}var y={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},z=y[typeof window]&&window||this,A=y[typeof exports]&&exports&&!exports.nodeType&&exports,B=y[typeof module]&&module&&!module.nodeType&&module,C=B&&B.exports===A&&A,D=y[typeof global]&&global;!D||D.global!==D&&D.window!==D||(z=D);var E={internals:{},config:{Promise:z.Promise},helpers:{}},F=E.helpers.noop=function(){},G=(E.helpers.notDefined=function(a){return"undefined"==typeof a},E.helpers.isScheduler=function(a){return a instanceof E.Scheduler}),H=E.helpers.identity=function(a){return a},I=(E.helpers.pluck=function(a){return function(b){return b[a]}},E.helpers.just=function(a){return function(){return a}},E.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}()),J=E.helpers.defaultComparer=function(a,b){return lb(a,b)},K=E.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},L=(E.helpers.defaultKeySerializer=function(a){return a.toString()},E.helpers.defaultError=function(a){throw a}),M=E.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},N=(E.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},E.helpers.not=function(a){return!a},E.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==bb.call(a)}),a}()),O="Argument out of range",P="Object has been disposed",Q="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";z.Set&&"function"==typeof(new z.Set)["@@iterator"]&&(Q="@@iterator");var R=E.doneEnumerator={done:!0,value:a};E.iterator=Q;var S,T="[object Arguments]",U="[object Array]",V="[object Boolean]",W="[object Date]",X="[object Error]",Y="[object Function]",Z="[object Number]",$="[object Object]",_="[object RegExp]",ab="[object String]",bb=Object.prototype.toString,cb=Object.prototype.hasOwnProperty,db=bb.call(arguments)==T,eb=Error.prototype,fb=Object.prototype,gb=fb.propertyIsEnumerable;try{S=!(bb.call(document)==$&&!({toString:0}+""))}catch(hb){S=!0}var ib=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],jb={};jb[U]=jb[W]=jb[Z]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},jb[V]=jb[ab]={constructor:!0,toString:!0,valueOf:!0},jb[X]=jb[Y]=jb[_]={constructor:!0,toString:!0},jb[$]={constructor:!0};var kb={};!function(){var a=function(){this.x=1},b=[];a.prototype={valueOf:1,y:1};for(var c in new a)b.push(c);for(c in arguments);kb.enumErrorProps=gb.call(eb,"message")||gb.call(eb,"name"),kb.enumPrototypes=gb.call(a,"prototype"),kb.nonEnumArgs=0!=c,kb.nonEnumShadows=!/valueOf/.test(b)}(1),db||(h=function(a){return a&&"object"==typeof a?cb.call(a,"callee"):!1});var lb=E.internals.isEqual=function(a,b){return i(a,b,[],[])},mb=Array.prototype.slice,nb=({}.hasOwnProperty,this.inherits=E.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),ob=E.internals.addProperties=function(a){for(var b=mb.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},pb=E.internals.addRef=function(a,b){return new pc(function(c){return new ub(b.getDisposable(),a.subscribe(c))})};Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=mb.call(arguments,1),d=function(){function e(){}if(this instanceof d){e.prototype=b.prototype;var f=new e,g=b.apply(f,c.concat(mb.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(mb.call(arguments)))};return d}),Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var c,d;if(null==this)throw new TypeError(" this is null or not defined");var e=Object(this),f=e.length>>>0;if("function"!=typeof a)throw new TypeError(a+" is not a function");for(arguments.length>1&&(c=b),d=0;f>d;){var g;d in e&&(g=e[d],a.call(c,g,d,e)),d++}});var qb=Object("a"),rb="a"!=qb[0]||!(0 in qb);Array.prototype.every||(Array.prototype.every=function(a){var b=Object(this),c=rb&&{}.toString.call(this)==ab?this.split(""):b,d=c.length>>>0,e=arguments[1];if({}.toString.call(a)!=Y)throw new TypeError(a+" is not a function");for(var f=0;d>f;f++)if(f in c&&!a.call(e,c[f],f,b))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(a){var b=Object(this),c=rb&&{}.toString.call(this)==ab?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if({}.toString.call(a)!=Y)throw new TypeError(a+" is not a function");for(var g=0;d>g;g++)g in c&&(e[g]=a.call(f,c[g],g,b));return e}),Array.prototype.filter||(Array.prototype.filter=function(a){for(var b,c=[],d=new Object(this),e=0,f=d.length>>>0;f>e;e++)b=d[e],e in d&&a.call(arguments[1],b,e,d)&&c.push(b);return c}),Array.isArray||(Array.isArray=function(a){return{}.toString.call(a)==U}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>1&&(d=Number(arguments[1]),d!==d?d=0:0!==d&&1/0!=d&&d!==-1/0&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),l.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var sb=E.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},tb=sb.prototype;tb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},tb.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},tb.heapify=function(a){if(+a||(a=0),!(a>=this.length||0>a)){var b=2*a+1,c=2*a+2,d=a;if(b<this.length&&this.isHigherPriority(b,d)&&(d=b),c<this.length&&this.isHigherPriority(c,d)&&(d=c),d!==a){var e=this.items[a];this.items[a]=this.items[d],this.items[d]=e,this.heapify(d)}}},tb.peek=function(){return this.items[0].value},tb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},tb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},tb.enqueue=function(a){var b=this.length++;this.items[b]=new l(sb.count++,a),this.percolate(b)},tb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},sb.count=0;var ub=E.CompositeDisposable=function(){this.disposables=j(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},vb=ub.prototype;vb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},vb.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},vb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},vb.toArray=function(){return this.disposables.slice(0)};var wb=E.Disposable=function(a){this.isDisposed=!1,this.action=a||F};wb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var xb=wb.create=function(a){return new wb(a)},yb=wb.empty={dispose:F},zb=E.SingleAssignmentDisposable=function(){function a(){this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),Ab=E.SerialDisposable=zb,Bb=E.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?yb:new a(this)},b}();m.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var Cb=E.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||K,this.disposable=new zb};Cb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Cb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Cb.prototype.isCancelled=function(){return this.disposable.isDisposed},Cb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Db=E.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),yb}var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=I,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Eb=Db.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new ub,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),yb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new ub,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),yb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,d)},a.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,d)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})}}(Db.prototype),function(){Db.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},Db.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof z.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=z.setInterval(function(){d=c(d)},b);return xb(function(){z.clearInterval(e)})}}(Db.prototype),function(a){a.catchError=a["catch"]=function(a){return new Mb(this,a)}}(Db.prototype);var Fb,Gb=(E.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new zb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),Db.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Eb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Db(I,a,b,c)}()),Hb=Db.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Db.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+Db.normalize(c),g=new Cb(this,b,d,f);if(e)e.enqueue(g);else{e=new sb(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new Db(I,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),Ib=F,Jb=function(){var a,b=F;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!z.setTimeout)throw new Error("No concurrency detected!");a=z.setTimeout,b=z.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),Kb=Jb.setTimeout,Lb=Jb.clearTimeout;!function(){function a(){if(!z.postMessage||z.importScripts)return!1;var a=!1,b=z.onmessage;return z.onmessage=function(){a=!0},z.postMessage("","*"),z.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(bb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=D&&C&&D.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=D&&C&&D.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Fb=process.nextTick;else if("function"==typeof d)Fb=d,Ib=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;z.addEventListener?z.addEventListener("message",b,!1):z.attachEvent("onmessage",b,!1),Fb=function(a){var b=h++;g[b]=a,z.postMessage(f+b,"*")}}else if(z.MessageChannel){var i=new z.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Fb=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in z&&"onreadystatechange"in z.document.createElement("script")?Fb=function(a){var b=z.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},z.document.documentElement.appendChild(b)}:(Fb=function(a){return Kb(a,0)},Ib=Lb)}();var Mb=(Db.timeout=function(){function a(a,b){var c=this,d=new zb,e=Fb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new ub(d,xb(function(){Ib(e)}))}function b(a,b,c){var d=this,e=Db.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new zb,g=Kb(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new ub(f,xb(function(){Lb(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Db(I,a,b,c)}(),function(a){function b(){return this._scheduler.now()}function c(a,b){return this._scheduler.scheduleWithState(a,this._wrap(b))}function d(a,b,c){return this._scheduler.scheduleWithRelativeAndState(a,b,this._wrap(c))}function e(a,b,c){return this._scheduler.scheduleWithAbsoluteAndState(a,b,this._wrap(c))}function f(f,g){this._scheduler=f,this._handler=g,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this,b,c,d,e)}return nb(f,a),f.prototype._clone=function(a){return new f(a,this._handler)},f.prototype._wrap=function(a){var b=this;return function(c,d){try{return a(b._getRecursiveWrapper(c),d)}catch(e){if(!b._handler(e))throw e;return yb}}},f.prototype._getRecursiveWrapper=function(a){if(this._recursiveOriginal!==a){this._recursiveOriginal=a;var b=this._clone(a);b._recursiveOriginal=a,b._recursiveWrapper=b,this._recursiveWrapper=b}return this._recursiveWrapper},f.prototype.schedulePeriodicWithState=function(a,b,c){var d=this,e=!1,f=new zb;return f.setDisposable(this._scheduler.schedulePeriodicWithState(a,b,function(a){if(e)return null;try{return c(a)}catch(b){if(e=!0,!d._handler(b))throw b;return f.dispose(),null}})),f},f}(Db)),Nb=E.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}return a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return G(a)||(a=Gb),new pc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Ob=Nb.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new Nb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Pb=Nb.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new Nb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Qb=Nb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Nb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Rb=E.internals.Enumerator=function(a){this._next=a};Rb.prototype.next=function(){return this._next()},Rb.prototype[Q]=function(){return this};var Sb=E.internals.Enumerable=function(a){this._iterator=a};Sb.prototype[Q]=function(){return this._iterator()},Sb.prototype.concat=function(){var a=this;return new pc(function(b){var c;try{c=a[Q]()}catch(d){return void b.onError()}var e,f=new Ab,g=Gb.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;M(h)&&(h=cc(h));var i=new zb;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new ub(f,g,xb(function(){e=!0}))})},Sb.prototype.catchException=function(){var a=this;return new pc(function(b){var c;try{c=a[Q]()}catch(d){return void b.onError()}var e,f,g=new Ab,h=Gb.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;M(i)&&(i=cc(i));var j=new zb;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new ub(g,h,xb(function(){e=!0}))})};var Tb=Sb.repeat=function(a,b){return null==b&&(b=-1),new Sb(function(){var c=b;return new Rb(function(){return 0===c?R:(c>0&&c--,{done:!1,value:a})})})},Ub=Sb.of=function(a,b,c){return b||(b=H),new Sb(function(){var d=-1;return new Rb(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:R})})},Vb=E.Observer=function(){};Vb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Vb.prototype.asObserver=function(){return new Zb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Vb.prototype.checked=function(){return new $b(this)};var Wb=Vb.create=function(a,b,c){return a||(a=F),b||(b=L),c||(c=F),new Zb(a,b,c)};Vb.fromNotifier=function(a,b){return new Zb(function(c){return a.call(b,Ob(c))},function(c){return a.call(b,Pb(c))},function(){return a.call(b,Qb())})},Vb.notifyOn=function(a){return new ac(a,this)};var Xb,Yb=E.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return nb(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Vb),Zb=E.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return nb(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(Yb),$b=function(a){function b(b){a.call(this),this._observer=b,this._state=0}nb(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();try{this._observer.onNext(a)}catch(b){throw b}finally{this._state=0}},c.onError=function(a){this.checkAccess();try{this._observer.onError(a)}catch(b){throw b}finally{this._state=2}},c.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(a){throw a}finally{this._state=2}},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}(Vb),_b=E.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new Ab}return nb(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return void(b.isAcquired=!1);c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Yb),ac=function(a){function b(){a.apply(this,arguments)}return nb(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}(_b),bc=E.Observable=function(){function a(a){this._subscribe=a}return Xb=a.prototype,Xb.subscribe=Xb.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:Wb(a,b,c))},Xb.subscribeOnNext=function(a,b){return this._subscribe(Wb(2===arguments.length?function(c){a.call(b,c)}:a))},Xb.subscribeOnError=function(a,b){return this._subscribe(Wb(null,2===arguments.length?function(c){a.call(b,c)}:a))},Xb.subscribeOnCompleted=function(a,b){return this._subscribe(Wb(null,null,2===arguments.length?function(){a.call(b)}:a))},a}();Xb.observeOn=function(a){var b=this;return new pc(function(c){return b.subscribe(new ac(a,c))})},Xb.subscribeOn=function(a){var b=this;return new pc(function(c){var d=new zb,e=new Ab;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new m(a,b.subscribe(c)))})),e})};var cc=bc.fromPromise=function(a){return dc(function(){var b=new E.AsyncSubject;return a.then(function(a){b.isDisposed||(b.onNext(a),b.onCompleted())},b.onError.bind(b)),b})};Xb.toPromise=function(a){if(a||(a=E.config.Promise),!a)throw new TypeError("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},c,function(){e&&a(d)})})},Xb.toArray=function(){var a=this;return new pc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})})},bc.create=bc.createWithDisposable=function(a){return new pc(a)};var dc=bc.defer=function(a){return new pc(function(b){var c;try{c=a()}catch(d){return jc(d).subscribe(b)}return M(c)&&(c=cc(c)),c.subscribe(b)})},ec=bc.empty=function(a){return G(a)||(a=Gb),new pc(function(b){return a.schedule(function(){b.onCompleted()})})},fc=Math.pow(2,53)-1;bc.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!r(b))throw new Error("mapFn when provided must be a function");return G(d)||(d=Hb),new pc(function(e){var f=Object(a),g=o(f),h=g?0:q(f),i=g?f[Q]():null,j=0;return d.scheduleRecursive(function(a){if(h>j||g){var d;if(g){var k=i.next();if(k.done)return void e.onCompleted();d=k.value}else d=f[j];if(b&&r(b))try{d=c?b.call(c,d,j):b(d,j)}catch(l){return void e.onError(l)}e.onNext(d),j++,a()}else e.onCompleted()})})};var gc=bc.fromArray=function(a,b){return G(b)||(b=Hb),new pc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};bc.generate=function(a,b,c,d,e){return G(e)||(e=Hb),new pc(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return void f.onError(j)}e?(f.onNext(i),a()):f.onCompleted()})})};var hc=bc.never=function(){return new pc(function(){return yb})};bc.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return gc(b)};bc.ofWithScheduler=function(a){for(var b=arguments.length-1,c=new Array(b),d=0;b>d;d++)c[d]=arguments[d+1];return gc(c,a)};bc.range=function(a,b,c){return G(c)||(c=Hb),new pc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},bc.repeat=function(a,b,c){return G(c)||(c=Hb),ic(a,c).repeat(null==b?-1:b)};var ic=bc["return"]=bc.returnValue=bc.just=function(a,b){return G(b)||(b=Gb),new pc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},jc=bc["throw"]=bc.throwException=bc.throwError=function(a,b){return G(b)||(b=Gb),new pc(function(c){return b.schedule(function(){c.onError(a)})})};bc.using=function(a,b){return new pc(function(c){var d,e,f=yb;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new ub(jc(g).subscribe(c),f)}return new ub(e.subscribe(c),f)})},Xb.amb=function(a){var b=this;return new pc(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new zb,j=new zb;return M(a)&&(a=cc(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 ub(i,j)})},bc.amb=function(){function a(a,b){return a.amb(b)}for(var b=hc(),c=j(arguments,0),d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},Xb["catch"]=Xb.catchError=Xb.catchException=function(a){return"function"==typeof a?s(this,a):kc([this,a])};var kc=bc.catchException=bc.catchError=bc["catch"]=function(){return Ub(j(arguments,0)).catchException()};Xb.combineLatest=function(){var a=mb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),lc.apply(this,a)};var lc=bc.combineLatest=function(){var a=mb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new pc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(H))){try{d=b.apply(null,l)}catch(e){return void c.onError(e)}c.onNext(d)}else j.filter(function(b,c){return c!==a}).every(H)&&c.onCompleted()}function e(a){j[a]=!0,j.every(H)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=k(g,f),i=!1,j=k(g,f),l=new Array(g),m=new Array(g),n=0;g>n;n++)!function(b){var f=a[b],g=new zb;M(f)&&(f=cc(f)),g.setDisposable(f.subscribe(function(a){l[b]=a,d(b)},c.onError.bind(c),function(){e(b)})),m[b]=g}(n);return new ub(m)})};Xb.concat=function(){var a=mb.call(arguments,0);return a.unshift(this),mc.apply(this,a)};var mc=bc.concat=function(){return Ub(j(arguments,0)).concat()};Xb.concatObservable=Xb.concatAll=function(){return this.merge(1)},Xb.merge=function(a){if("number"!=typeof a)return nc(this,a);var b=this;return new pc(function(c){function d(a){var b=new zb;f.add(b),M(a)&&(a=cc(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){f.remove(b),h.length>0?d(h.shift()):(e--,g&&0===e&&c.onCompleted())}))}var e=0,f=new ub,g=!1,h=[];return f.add(b.subscribe(function(b){a>e?(e++,d(b)):h.push(b)},c.onError.bind(c),function(){g=!0,0===e&&c.onCompleted()})),f})};var nc=bc.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=mb.call(arguments,1)):(a=Gb,b=mb.call(arguments,0)):(a=Gb,b=mb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),gc(b,a).mergeObservable()};Xb.mergeObservable=Xb.mergeAll=function(){var a=this;return new pc(function(b){var c=new ub,d=!1,e=new zb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new zb;c.add(e),M(a)&&(a=cc(a)),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Xb.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return oc([this,a])};var oc=bc.onErrorResumeNext=function(){var a=j(arguments,0);return new pc(function(b){var c=0,d=new Ab,e=Gb.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],M(f)&&(f=cc(f)),g=new zb,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted() | ||
});return new ub(d,e)})};Xb.skipUntil=function(a){var b=this;return new pc(function(c){var d=!1,e=new ub(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));M(a)&&(a=cc(a));var f=new zb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Xb["switch"]=Xb.switchLatest=function(){var a=this;return new pc(function(b){var c=!1,d=new Ab,e=!1,f=0,g=a.subscribe(function(a){var g=new zb,h=++f;c=!0,d.setDisposable(g),M(a)&&(a=cc(a)),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,!c&&b.onCompleted()});return new ub(g,d)})},Xb.takeUntil=function(a){var b=this;return new pc(function(c){return M(a)&&(a=cc(a)),new ub(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),F))})},Xb.zip=function(){if(Array.isArray(arguments[0]))return t.apply(this,arguments);var a=this,b=mb.call(arguments),c=b.pop();return b.unshift(a),new pc(function(d){function e(b){var e,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),e=c.apply(a,f)}catch(g){return void d.onError(g)}d.onNext(e)}else i.filter(function(a,c){return c!==b}).every(H)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=k(g,function(){return[]}),i=k(g,function(){return!1}),j=new Array(g),l=0;g>l;l++)!function(a){var c=b[a],g=new zb;M(c)&&(c=cc(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},d.onError.bind(d),function(){f(a)})),j[a]=g}(l);return new ub(j)})},bc.zip=function(){var a=mb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},bc.zipArray=function(){var a=j(arguments,0);return new pc(function(b){function c(a){if(f.every(function(a){return a.length>0})){var c=f.map(function(a){return a.shift()});b.onNext(c)}else if(g.filter(function(b,c){return c!==a}).every(H))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(H)?void b.onCompleted():void 0}for(var e=a.length,f=k(e,function(){return[]}),g=k(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new zb,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},b.onError.bind(b),function(){d(e)}))}(i);var j=new ub(h);return j.add(xb(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},Xb.asObservable=function(){return new pc(this.subscribe.bind(this))},Xb.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})},Xb.dematerialize=function(){var a=this;return new pc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Xb.distinctUntilChanged=function(a,b){var c=this;return a||(a=H),b||(b=J),new pc(function(d){var e,f=!1;return c.subscribe(function(c){var g,h=!1;try{g=a(c)}catch(i){return void d.onError(i)}if(f)try{h=b(e,g)}catch(i){return void d.onError(i)}f&&h||(f=!0,e=g,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))})},Xb["do"]=Xb.doAction=Xb.tap=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new pc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b)try{b(c)}catch(d){a.onError(d)}a.onError(c)},function(){if(c)try{c()}catch(b){a.onError(b)}a.onCompleted()})})},Xb.doOnNext=Xb.tapOnNext=function(a,b){return this.tap(2===arguments.length?function(c){a.call(b,c)}:a)},Xb.doOnError=Xb.tapOnError=function(a,b){return this.tap(F,2===arguments.length?function(c){a.call(b,c)}:a)},Xb.doOnCompleted=Xb.tapOnCompleted=function(a,b){return this.tap(F,null,2===arguments.length?function(){a.call(b)}:a)},Xb["finally"]=Xb.finallyAction=function(a){var b=this;return new pc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return xb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},Xb.ignoreElements=function(){var a=this;return new pc(function(b){return a.subscribe(F,b.onError.bind(b),b.onCompleted.bind(b))})},Xb.materialize=function(){var a=this;return new pc(function(b){return a.subscribe(function(a){b.onNext(Ob(a))},function(a){b.onNext(Pb(a)),b.onCompleted()},function(){b.onNext(Qb()),b.onCompleted()})})},Xb.repeat=function(a){return Tb(this,a).concat()},Xb.retry=function(a){return Tb(this,a).catchException()},Xb.scan=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new pc(function(e){var f,g,h;return d.subscribe(function(d){!h&&(h=!0);try{f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return void e.onError(i)}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Xb.skipLast=function(a){var b=this;return new pc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},Xb.startWith=function(){var a,b,c=0;return arguments.length&&G(arguments[0])?(b=arguments[0],c=1):b=Gb,a=mb.call(arguments,c),Ub([gc(a,b),this]).concat()},Xb.takeLast=function(a){var b=this;return new pc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})})},Xb.takeLastBuffer=function(a){var b=this;return new pc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})},Xb.windowWithCount=function(a,b){var c=this;if(+a||(a=0),1/0===Math.abs(a)&&(a=0),0>=a)throw new Error(O);if(null==b&&(b=a),+b||(b=0),1/0===Math.abs(b)&&(b=0),0>=b)throw new Error(O);return new pc(function(d){function e(){var a=new sc;i.push(a),d.onNext(pb(a,g))}var f=new zb,g=new Bb(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})},Xb.selectConcat=Xb.concatMap=function(a,b,c){return b?this.concatMap(function(c,d){var e=a(c,d),f=M(e)?cc(e):e;return f.map(function(a){return b(c,a,d)})}):"function"==typeof a?u(this,a,c):u(this,function(){return a})},Xb.concatMapObserver=Xb.selectConcatObserver=function(a,b,c,d){var e=this;return new pc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}M(c)&&(c=cc(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}M(c)&&(c=cc(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}M(a)&&(a=cc(a)),f.onNext(a),f.onCompleted()})}).concatAll()},Xb.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new pc(function(a){var d=!1;return c.subscribe(function(b){d=!0,a.onNext(b)},a.onError.bind(a),function(){d||a.onNext(b),a.onCompleted()})})},w.prototype.push=function(a){var b=-1===v(this.set,a,this.comparer);return b&&this.set.push(a),b},Xb.distinct=function(a,b){var c=this;return b||(b=J),new pc(function(d){var e=new w(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)},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.select=Xb.map=function(a,b){var c=this;return new pc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.pluck=function(a){return this.map(function(b){return b[a]})},Xb.selectMany=Xb.flatMap=function(a,b,c){return b?this.flatMap(function(c,d){var e=a(c,d),f=M(e)?cc(e):e;return f.map(function(a){return b(c,a,d)})},c):"function"==typeof a?x(this,a,c):x(this,function(){return a})},Xb.flatMapObserver=Xb.selectManyObserver=function(a,b,c,d){var e=this;return new pc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}M(c)&&(c=cc(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}M(c)&&(c=cc(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}M(a)&&(a=cc(a)),f.onNext(a),f.onCompleted()})}).mergeAll()},Xb.selectSwitch=Xb.flatMapLatest=Xb.switchMap=function(a,b){return this.select(a,b).switchLatest()},Xb.skip=function(a){if(0>a)throw new Error(O);var b=this;return new pc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Xb.skipWhile=function(a,b){var c=this;return new pc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.take=function(a,b){if(0>a)throw new RangeError(O);if(0===a)return ec(b);var c=this;return new pc(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Xb.takeWhile=function(a,b){var c=this;return new pc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.where=Xb.filter=function(a,b){var c=this;return new pc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.exclusive=function(){var a=this;return new pc(function(b){var c=!1,d=!1,e=new zb,f=new ub;return f.add(e),e.setDisposable(a.subscribe(function(a){if(!c){c=!0,M(a)&&(a=cc(a));var e=new zb;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})},Xb.exclusiveMap=function(a,b){var c=this;return new pc(function(d){var e=0,f=!1,g=!0,h=new zb,i=new ub;return i.add(h),h.setDisposable(c.subscribe(function(c){f||(f=!0,innerSubscription=new zb,i.add(innerSubscription),M(c)&&(c=cc(c)),innerSubscription.setDisposable(c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),function(){i.remove(innerSubscription),f=!1,g&&1===i.length&&d.onCompleted()})))},d.onError.bind(d),function(){g=!0,1!==i.length||f||d.onCompleted()})),i})};var pc=E.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?xb(a):yb}function c(d){function e(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new qc(a);return Hb.scheduleRequired()?Hb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return nb(c,a),c}(bc),qc=function(a){function b(b){a.call(this),this.observer=b,this.m=new zb}nb(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Yb),rc=function(a,b){this.subject=a,this.observer=b};rc.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 sc=E.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),yb):(a.onCompleted(),yb):(this.observers.push(a),new rc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return nb(d,a),ob(d.prototype,Vb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new tc(a,b)},d}(bc),tc=(E.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new rc(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),yb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return nb(d,a),ob(d.prototype,Vb,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(bc),E.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return nb(b,a),ob(b.prototype,Vb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(bc));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(z.Rx=E,define(function(){return E})):A&&B?C?(B.exports=E).Rx=E:A.Rx=E:z.Rx=E}).call(this); | ||
(function(a){function b(){if(this.isDisposed)throw new Error(P)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;kb.nonEnumArgs&&a.length&&h(a)&&(a=mb.call(a));var d=kb.enumPrototypes&&"function"==typeof a,e=kb.enumErrorProps&&(a===eb||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(kb.nonEnumShadows&&a!==fb){var g=a.constructor,i=-1,j=ib.length;if(a===(g&&g.prototype))var k=a===stringProto?ab:a===eb?X:bb.call(a),l=jb[k];for(;++i<j;)f=ib[i],l&&l[f]||!cb.call(a,f)||b.push(f)}return b}function e(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function f(a,b){return e(a,b,d)}function g(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function h(a){return a&&"object"==typeof a?bb.call(a)==T:!1}function i(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,j=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=j&&"object"!=j))return!1;var k=bb.call(a),l=bb.call(b);if(k==T&&(k=$),l==T&&(l=$),k!=l)return!1;switch(k){case V:case W:return+a==+b;case Z:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case _:case ab:return a==String(b)}var m=k==U;if(!m){if(k!=$||!kb.nodeClass&&(g(a)||g(b)))return!1;var n=!kb.argsObject&&h(a)?Object:a.constructor,o=!kb.argsObject&&h(b)?Object:b.constructor;if(!(n==o||cb.call(a,"constructor")&&cb.call(b,"constructor")||N(n)&&n instanceof n&&N(o)&&o instanceof o||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var p=c.length;p--;)if(c[p]==a)return d[p]==b;var q=0,r=!0;if(c.push(a),d.push(b),m){if(p=a.length,q=b.length,r=q==p)for(;q--;){var s=b[q];if(!(r=i(a[q],s,c,d)))break}}else f(b,function(b,e,f){return cb.call(f,e)?(q++,r=cb.call(a,e)&&i(a[e],b,c,d)):void 0}),r&&f(a,function(a,b,c){return cb.call(c,b)?r=--q>-1:void 0});return c.pop(),d.pop(),r}function j(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:mb.call(a)}function k(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function l(a,b){this.id=a,this.value=b}function m(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function n(a){return"number"==typeof a&&z.isFinite(a)}function o(b){return b[Q]!==a}function p(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function q(a){var b=+a.length;return isNaN(b)?0:0!==b&&n(b)?(b=p(b)*Math.floor(Math.abs(b)),0>=b?0:b>fc?fc:b):b}function r(a){return"[object Function]"===Object.prototype.toString.call(a)&&"function"==typeof a}function s(a,b){return new qc(function(c){var d=new zb,e=new Ab;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}M(f)&&(f=cc(f)),d=new zb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function t(a,b){var c=this;return new qc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return void d.onError(i)}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function u(a,b,c){return a.map(function(d,e){var f=b.call(c,d,e,a);return M(f)&&(f=cc(f)),(Array.isArray(f)||o(f))&&(f=gc(f)),f}).concatAll()}function v(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function w(a){this.comparer=a,this.set=[]}function x(a,b,c){return a.map(function(d,e){var f=b.call(c,d,e,a);return M(f)&&(f=cc(f)),(Array.isArray(f)||o(f))&&(f=gc(f)),f}).mergeObservable()}var y={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},z=y[typeof window]&&window||this,A=y[typeof exports]&&exports&&!exports.nodeType&&exports,B=y[typeof module]&&module&&!module.nodeType&&module,C=B&&B.exports===A&&A,D=y[typeof global]&&global;!D||D.global!==D&&D.window!==D||(z=D);var E={internals:{},config:{Promise:z.Promise},helpers:{}},F=E.helpers.noop=function(){},G=(E.helpers.notDefined=function(a){return"undefined"==typeof a},E.helpers.isScheduler=function(a){return a instanceof E.Scheduler}),H=E.helpers.identity=function(a){return a},I=(E.helpers.pluck=function(a){return function(b){return b[a]}},E.helpers.just=function(a){return function(){return a}},E.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}()),J=E.helpers.defaultComparer=function(a,b){return lb(a,b)},K=E.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},L=(E.helpers.defaultKeySerializer=function(a){return a.toString()},E.helpers.defaultError=function(a){throw a}),M=E.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},N=(E.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},E.helpers.not=function(a){return!a},E.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==bb.call(a)}),a}()),O="Argument out of range",P="Object has been disposed",Q="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";z.Set&&"function"==typeof(new z.Set)["@@iterator"]&&(Q="@@iterator");var R=E.doneEnumerator={done:!0,value:a};E.iterator=Q;var S,T="[object Arguments]",U="[object Array]",V="[object Boolean]",W="[object Date]",X="[object Error]",Y="[object Function]",Z="[object Number]",$="[object Object]",_="[object RegExp]",ab="[object String]",bb=Object.prototype.toString,cb=Object.prototype.hasOwnProperty,db=bb.call(arguments)==T,eb=Error.prototype,fb=Object.prototype,gb=fb.propertyIsEnumerable;try{S=!(bb.call(document)==$&&!({toString:0}+""))}catch(hb){S=!0}var ib=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],jb={};jb[U]=jb[W]=jb[Z]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},jb[V]=jb[ab]={constructor:!0,toString:!0,valueOf:!0},jb[X]=jb[Y]=jb[_]={constructor:!0,toString:!0},jb[$]={constructor:!0};var kb={};!function(){var a=function(){this.x=1},b=[];a.prototype={valueOf:1,y:1};for(var c in new a)b.push(c);for(c in arguments);kb.enumErrorProps=gb.call(eb,"message")||gb.call(eb,"name"),kb.enumPrototypes=gb.call(a,"prototype"),kb.nonEnumArgs=0!=c,kb.nonEnumShadows=!/valueOf/.test(b)}(1),db||(h=function(a){return a&&"object"==typeof a?cb.call(a,"callee"):!1});var lb=E.internals.isEqual=function(a,b){return i(a,b,[],[])},mb=Array.prototype.slice,nb=({}.hasOwnProperty,this.inherits=E.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),ob=E.internals.addProperties=function(a){for(var b=mb.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},pb=E.internals.addRef=function(a,b){return new qc(function(c){return new ub(b.getDisposable(),a.subscribe(c))})};Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=mb.call(arguments,1),d=function(){function e(){}if(this instanceof d){e.prototype=b.prototype;var f=new e,g=b.apply(f,c.concat(mb.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(mb.call(arguments)))};return d}),Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var c,d;if(null==this)throw new TypeError(" this is null or not defined");var e=Object(this),f=e.length>>>0;if("function"!=typeof a)throw new TypeError(a+" is not a function");for(arguments.length>1&&(c=b),d=0;f>d;){var g;d in e&&(g=e[d],a.call(c,g,d,e)),d++}});var qb=Object("a"),rb="a"!=qb[0]||!(0 in qb);Array.prototype.every||(Array.prototype.every=function(a){var b=Object(this),c=rb&&{}.toString.call(this)==ab?this.split(""):b,d=c.length>>>0,e=arguments[1];if({}.toString.call(a)!=Y)throw new TypeError(a+" is not a function");for(var f=0;d>f;f++)if(f in c&&!a.call(e,c[f],f,b))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(a){var b=Object(this),c=rb&&{}.toString.call(this)==ab?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if({}.toString.call(a)!=Y)throw new TypeError(a+" is not a function");for(var g=0;d>g;g++)g in c&&(e[g]=a.call(f,c[g],g,b));return e}),Array.prototype.filter||(Array.prototype.filter=function(a){for(var b,c=[],d=new Object(this),e=0,f=d.length>>>0;f>e;e++)b=d[e],e in d&&a.call(arguments[1],b,e,d)&&c.push(b);return c}),Array.isArray||(Array.isArray=function(a){return{}.toString.call(a)==U}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>1&&(d=Number(arguments[1]),d!==d?d=0:0!==d&&1/0!=d&&d!==-1/0&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),l.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var sb=E.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},tb=sb.prototype;tb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},tb.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},tb.heapify=function(a){if(+a||(a=0),!(a>=this.length||0>a)){var b=2*a+1,c=2*a+2,d=a;if(b<this.length&&this.isHigherPriority(b,d)&&(d=b),c<this.length&&this.isHigherPriority(c,d)&&(d=c),d!==a){var e=this.items[a];this.items[a]=this.items[d],this.items[d]=e,this.heapify(d)}}},tb.peek=function(){return this.items[0].value},tb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},tb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},tb.enqueue=function(a){var b=this.length++;this.items[b]=new l(sb.count++,a),this.percolate(b)},tb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},sb.count=0;var ub=E.CompositeDisposable=function(){this.disposables=j(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},vb=ub.prototype;vb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},vb.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},vb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},vb.toArray=function(){return this.disposables.slice(0)};var wb=E.Disposable=function(a){this.isDisposed=!1,this.action=a||F};wb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var xb=wb.create=function(a){return new wb(a)},yb=wb.empty={dispose:F},zb=E.SingleAssignmentDisposable=function(){function a(){this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),Ab=E.SerialDisposable=zb,Bb=E.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?yb:new a(this)},b}();m.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var Cb=E.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||K,this.disposable=new zb};Cb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Cb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Cb.prototype.isCancelled=function(){return this.disposable.isDisposed},Cb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Db=E.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),yb}var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=I,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Eb=Db.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new ub,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),yb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new ub,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),yb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,d)},a.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,d)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})}}(Db.prototype),function(){Db.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},Db.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof z.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=z.setInterval(function(){d=c(d)},b);return xb(function(){z.clearInterval(e)})}}(Db.prototype),function(a){a.catchError=a["catch"]=function(a){return new Mb(this,a)}}(Db.prototype);var Fb,Gb=(E.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new zb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),Db.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Eb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Db(I,a,b,c)}()),Hb=Db.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Db.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+Db.normalize(c),g=new Cb(this,b,d,f);if(e)e.enqueue(g);else{e=new sb(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new Db(I,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),Ib=F,Jb=function(){var a,b=F;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!z.setTimeout)throw new Error("No concurrency detected!");a=z.setTimeout,b=z.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),Kb=Jb.setTimeout,Lb=Jb.clearTimeout;!function(){function a(){if(!z.postMessage||z.importScripts)return!1;var a=!1,b=z.onmessage;return z.onmessage=function(){a=!0},z.postMessage("","*"),z.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(bb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=D&&C&&D.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=D&&C&&D.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Fb=process.nextTick;else if("function"==typeof d)Fb=d,Ib=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;z.addEventListener?z.addEventListener("message",b,!1):z.attachEvent("onmessage",b,!1),Fb=function(a){var b=h++;g[b]=a,z.postMessage(f+b,"*")}}else if(z.MessageChannel){var i=new z.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Fb=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in z&&"onreadystatechange"in z.document.createElement("script")?Fb=function(a){var b=z.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},z.document.documentElement.appendChild(b)}:(Fb=function(a){return Kb(a,0)},Ib=Lb)}();var Mb=(Db.timeout=function(){function a(a,b){var c=this,d=new zb,e=Fb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new ub(d,xb(function(){Ib(e)}))}function b(a,b,c){var d=this,e=Db.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new zb,g=Kb(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new ub(f,xb(function(){Lb(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Db(I,a,b,c)}(),function(a){function b(a,b){return this._scheduler.scheduleWithState(a,this._wrap(b))}function c(a,b,c){return this._scheduler.scheduleWithRelativeAndState(a,b,this._wrap(c))}function d(a,b,c){return this._scheduler.scheduleWithAbsoluteAndState(a,b,this._wrap(c))}function e(e,f){this._scheduler=e,this._handler=f,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this,this._scheduler.now.bind(this._scheduler),b,c,d)}return nb(e,a),e.prototype._clone=function(a){return new e(a,this._handler)},e.prototype._wrap=function(a){var b=this;return function(c,d){try{return a(b._getRecursiveWrapper(c),d)}catch(e){if(!b._handler(e))throw e;return yb}}},e.prototype._getRecursiveWrapper=function(a){if(this._recursiveOriginal!==a){this._recursiveOriginal=a;var b=this._clone(a);b._recursiveOriginal=a,b._recursiveWrapper=b,this._recursiveWrapper=b}return this._recursiveWrapper},e.prototype.schedulePeriodicWithState=function(a,b,c){var d=this,e=!1,f=new zb;return f.setDisposable(this._scheduler.schedulePeriodicWithState(a,b,function(a){if(e)return null;try{return c(a)}catch(b){if(e=!0,!d._handler(b))throw b;return f.dispose(),null}})),f},e}(Db)),Nb=E.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}return a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return G(a)||(a=Gb),new qc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Ob=Nb.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new Nb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Pb=Nb.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new Nb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Qb=Nb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Nb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Rb=E.internals.Enumerator=function(a){this._next=a};Rb.prototype.next=function(){return this._next()},Rb.prototype[Q]=function(){return this};var Sb=E.internals.Enumerable=function(a){this._iterator=a};Sb.prototype[Q]=function(){return this._iterator()},Sb.prototype.concat=function(){var a=this;return new qc(function(b){var c;try{c=a[Q]()}catch(d){return void b.onError()}var e,f=new Ab,g=Gb.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;M(h)&&(h=cc(h));var i=new zb;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new ub(f,g,xb(function(){e=!0}))})},Sb.prototype.catchException=function(){var a=this;return new qc(function(b){var c;try{c=a[Q]()}catch(d){return void b.onError()}var e,f,g=new Ab,h=Gb.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;M(i)&&(i=cc(i));var j=new zb;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new ub(g,h,xb(function(){e=!0}))})};var Tb=Sb.repeat=function(a,b){return null==b&&(b=-1),new Sb(function(){var c=b;return new Rb(function(){return 0===c?R:(c>0&&c--,{done:!1,value:a})})})},Ub=Sb.of=function(a,b,c){return b||(b=H),new Sb(function(){var d=-1;return new Rb(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:R})})},Vb=E.Observer=function(){};Vb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Vb.prototype.asObserver=function(){return new Zb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Vb.prototype.checked=function(){return new $b(this)};var Wb=Vb.create=function(a,b,c){return a||(a=F),b||(b=L),c||(c=F),new Zb(a,b,c)};Vb.fromNotifier=function(a,b){return new Zb(function(c){return a.call(b,Ob(c))},function(c){return a.call(b,Pb(c))},function(){return a.call(b,Qb())})},Vb.notifyOn=function(a){return new ac(a,this)};var Xb,Yb=E.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return nb(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Vb),Zb=E.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return nb(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(Yb),$b=function(a){function b(b){a.call(this),this._observer=b,this._state=0}nb(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();try{this._observer.onNext(a)}catch(b){throw b}finally{this._state=0}},c.onError=function(a){this.checkAccess();try{this._observer.onError(a)}catch(b){throw b}finally{this._state=2}},c.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(a){throw a}finally{this._state=2}},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}(Vb),_b=E.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new Ab}return nb(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return void(b.isAcquired=!1);c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Yb),ac=function(a){function b(){a.apply(this,arguments)}return nb(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}(_b),bc=E.Observable=function(){function a(a){this._subscribe=a}return Xb=a.prototype,Xb.subscribe=Xb.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:Wb(a,b,c))},Xb.subscribeOnNext=function(a,b){return this._subscribe(Wb(2===arguments.length?function(c){a.call(b,c)}:a))},Xb.subscribeOnError=function(a,b){return this._subscribe(Wb(null,2===arguments.length?function(c){a.call(b,c)}:a))},Xb.subscribeOnCompleted=function(a,b){return this._subscribe(Wb(null,null,2===arguments.length?function(){a.call(b)}:a))},a}();Xb.observeOn=function(a){var b=this;return new qc(function(c){return b.subscribe(new ac(a,c))})},Xb.subscribeOn=function(a){var b=this;return new qc(function(c){var d=new zb,e=new Ab;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new m(a,b.subscribe(c)))})),e})};var cc=bc.fromPromise=function(a){return dc(function(){var b=new E.AsyncSubject;return a.then(function(a){b.isDisposed||(b.onNext(a),b.onCompleted())},b.onError.bind(b)),b})};Xb.toPromise=function(a){if(a||(a=E.config.Promise),!a)throw new TypeError("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},c,function(){e&&a(d)})})},Xb.toArray=function(){var a=this;return new qc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})})},bc.create=bc.createWithDisposable=function(a){return new qc(a)};var dc=bc.defer=function(a){return new qc(function(b){var c;try{c=a()}catch(d){return kc(d).subscribe(b)}return M(c)&&(c=cc(c)),c.subscribe(b)})},ec=bc.empty=function(a){return G(a)||(a=Gb),new qc(function(b){return a.schedule(function(){b.onCompleted()})})},fc=Math.pow(2,53)-1,gc=bc.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!r(b))throw new Error("mapFn when provided must be a function");return G(d)||(d=Hb),new qc(function(e){var f=Object(a),g=o(f),h=g?0:q(f),i=g?f[Q]():null,j=0;return d.scheduleRecursive(function(a){if(h>j||g){var d;if(g){var k;try{k=i.next()}catch(l){return void e.onError(l)}if(k.done)return void e.onCompleted();d=k.value}else d=f.charAt?f.charAt(j):f[j];if(b&&r(b))try{d=c?b.call(c,d,j):b(d,j)}catch(l){return void e.onError(l)}e.onNext(d),j++,a()}else e.onCompleted()})})},hc=bc.fromArray=function(a,b){return G(b)||(b=Hb),new qc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};bc.generate=function(a,b,c,d,e){return G(e)||(e=Hb),new qc(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return void f.onError(j)}e?(f.onNext(i),a()):f.onCompleted()})})};var ic=bc.never=function(){return new qc(function(){return yb})};bc.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return hc(b)};bc.ofWithScheduler=function(a){for(var b=arguments.length-1,c=new Array(b),d=0;b>d;d++)c[d]=arguments[d+1];return hc(c,a)};bc.range=function(a,b,c){return G(c)||(c=Hb),new qc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},bc.repeat=function(a,b,c){return G(c)||(c=Hb),jc(a,c).repeat(null==b?-1:b)};var jc=bc["return"]=bc.returnValue=bc.just=function(a,b){return G(b)||(b=Gb),new qc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},kc=bc["throw"]=bc.throwException=bc.throwError=function(a,b){return G(b)||(b=Gb),new qc(function(c){return b.schedule(function(){c.onError(a)})})};bc.using=function(a,b){return new qc(function(c){var d,e,f=yb;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new ub(kc(g).subscribe(c),f)}return new ub(e.subscribe(c),f)})},Xb.amb=function(a){var b=this;return new qc(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new zb,j=new zb;return M(a)&&(a=cc(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 ub(i,j)})},bc.amb=function(){function a(a,b){return a.amb(b)}for(var b=ic(),c=j(arguments,0),d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},Xb["catch"]=Xb.catchError=Xb.catchException=function(a){return"function"==typeof a?s(this,a):lc([this,a])};var lc=bc.catchException=bc.catchError=bc["catch"]=function(){return Ub(j(arguments,0)).catchException()};Xb.combineLatest=function(){var a=mb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),mc.apply(this,a)};var mc=bc.combineLatest=function(){var a=mb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new qc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(H))){try{d=b.apply(null,l)}catch(e){return void c.onError(e)}c.onNext(d)}else j.filter(function(b,c){return c!==a}).every(H)&&c.onCompleted()}function e(a){j[a]=!0,j.every(H)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=k(g,f),i=!1,j=k(g,f),l=new Array(g),m=new Array(g),n=0;g>n;n++)!function(b){var f=a[b],g=new zb;M(f)&&(f=cc(f)),g.setDisposable(f.subscribe(function(a){l[b]=a,d(b)},c.onError.bind(c),function(){e(b)})),m[b]=g}(n);return new ub(m)})};Xb.concat=function(){var a=mb.call(arguments,0);return a.unshift(this),nc.apply(this,a)};var nc=bc.concat=function(){return Ub(j(arguments,0)).concat()};Xb.concatObservable=Xb.concatAll=function(){return this.merge(1)},Xb.merge=function(a){if("number"!=typeof a)return oc(this,a);var b=this;return new qc(function(c){function d(a){var b=new zb;f.add(b),M(a)&&(a=cc(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){f.remove(b),h.length>0?d(h.shift()):(e--,g&&0===e&&c.onCompleted())}))}var e=0,f=new ub,g=!1,h=[];return f.add(b.subscribe(function(b){a>e?(e++,d(b)):h.push(b)},c.onError.bind(c),function(){g=!0,0===e&&c.onCompleted()})),f})};var oc=bc.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=mb.call(arguments,1)):(a=Gb,b=mb.call(arguments,0)):(a=Gb,b=mb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),hc(b,a).mergeObservable()};Xb.mergeObservable=Xb.mergeAll=function(){var a=this;return new qc(function(b){var c=new ub,d=!1,e=new zb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new zb;c.add(e),M(a)&&(a=cc(a)),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Xb.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return pc([this,a])};var pc=bc.onErrorResumeNext=function(){var a=j(arguments,0); | ||
return new qc(function(b){var c=0,d=new Ab,e=Gb.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],M(f)&&(f=cc(f)),g=new zb,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new ub(d,e)})};Xb.skipUntil=function(a){var b=this;return new qc(function(c){var d=!1,e=new ub(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));M(a)&&(a=cc(a));var f=new zb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Xb["switch"]=Xb.switchLatest=function(){var a=this;return new qc(function(b){var c=!1,d=new Ab,e=!1,f=0,g=a.subscribe(function(a){var g=new zb,h=++f;c=!0,d.setDisposable(g),M(a)&&(a=cc(a)),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,!c&&b.onCompleted()});return new ub(g,d)})},Xb.takeUntil=function(a){var b=this;return new qc(function(c){return M(a)&&(a=cc(a)),new ub(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),F))})},Xb.zip=function(){if(Array.isArray(arguments[0]))return t.apply(this,arguments);var a=this,b=mb.call(arguments),c=b.pop();return b.unshift(a),new qc(function(d){function e(b){var e,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),e=c.apply(a,f)}catch(g){return void d.onError(g)}d.onNext(e)}else i.filter(function(a,c){return c!==b}).every(H)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=k(g,function(){return[]}),i=k(g,function(){return!1}),j=new Array(g),l=0;g>l;l++)!function(a){var c=b[a],g=new zb;M(c)&&(c=cc(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},d.onError.bind(d),function(){f(a)})),j[a]=g}(l);return new ub(j)})},bc.zip=function(){var a=mb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},bc.zipArray=function(){var a=j(arguments,0);return new qc(function(b){function c(a){if(f.every(function(a){return a.length>0})){var c=f.map(function(a){return a.shift()});b.onNext(c)}else if(g.filter(function(b,c){return c!==a}).every(H))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(H)?void b.onCompleted():void 0}for(var e=a.length,f=k(e,function(){return[]}),g=k(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new zb,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},b.onError.bind(b),function(){d(e)}))}(i);var j=new ub(h);return j.add(xb(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},Xb.asObservable=function(){return new qc(this.subscribe.bind(this))},Xb.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})},Xb.dematerialize=function(){var a=this;return new qc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Xb.distinctUntilChanged=function(a,b){var c=this;return a||(a=H),b||(b=J),new qc(function(d){var e,f=!1;return c.subscribe(function(c){var g,h=!1;try{g=a(c)}catch(i){return void d.onError(i)}if(f)try{h=b(e,g)}catch(i){return void d.onError(i)}f&&h||(f=!0,e=g,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))})},Xb["do"]=Xb.doAction=Xb.tap=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new qc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b)try{b(c)}catch(d){a.onError(d)}a.onError(c)},function(){if(c)try{c()}catch(b){a.onError(b)}a.onCompleted()})})},Xb.doOnNext=Xb.tapOnNext=function(a,b){return this.tap(2===arguments.length?function(c){a.call(b,c)}:a)},Xb.doOnError=Xb.tapOnError=function(a,b){return this.tap(F,2===arguments.length?function(c){a.call(b,c)}:a)},Xb.doOnCompleted=Xb.tapOnCompleted=function(a,b){return this.tap(F,null,2===arguments.length?function(){a.call(b)}:a)},Xb["finally"]=Xb.finallyAction=function(a){var b=this;return new qc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return xb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},Xb.ignoreElements=function(){var a=this;return new qc(function(b){return a.subscribe(F,b.onError.bind(b),b.onCompleted.bind(b))})},Xb.materialize=function(){var a=this;return new qc(function(b){return a.subscribe(function(a){b.onNext(Ob(a))},function(a){b.onNext(Pb(a)),b.onCompleted()},function(){b.onNext(Qb()),b.onCompleted()})})},Xb.repeat=function(a){return Tb(this,a).concat()},Xb.retry=function(a){return Tb(this,a).catchException()},Xb.scan=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new qc(function(e){var f,g,h;return d.subscribe(function(d){!h&&(h=!0);try{f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return void e.onError(i)}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Xb.skipLast=function(a){var b=this;return new qc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},Xb.startWith=function(){var a,b,c=0;return arguments.length&&G(arguments[0])?(b=arguments[0],c=1):b=Gb,a=mb.call(arguments,c),Ub([hc(a,b),this]).concat()},Xb.takeLast=function(a){var b=this;return new qc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})})},Xb.takeLastBuffer=function(a){var b=this;return new qc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})},Xb.windowWithCount=function(a,b){var c=this;if(+a||(a=0),1/0===Math.abs(a)&&(a=0),0>=a)throw new Error(O);if(null==b&&(b=a),+b||(b=0),1/0===Math.abs(b)&&(b=0),0>=b)throw new Error(O);return new qc(function(d){function e(){var a=new tc;i.push(a),d.onNext(pb(a,g))}var f=new zb,g=new Bb(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})},Xb.selectConcat=Xb.concatMap=function(a,b,c){return"function"==typeof a&&"function"==typeof b?this.concatMap(function(c,d){var e=a(c,d);return M(e)&&(e=cc(e)),(Array.isArray(e)||o(e))&&(e=gc(e)),e.map(function(a,e){return b(c,a,d,e)})}):"function"==typeof a?u(this,a,c):u(this,function(){return a})},Xb.concatMapObserver=Xb.selectConcatObserver=function(a,b,c,d){var e=this;return new qc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}M(c)&&(c=cc(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}M(c)&&(c=cc(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}M(a)&&(a=cc(a)),f.onNext(a),f.onCompleted()})}).concatAll()},Xb.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new qc(function(a){var d=!1;return c.subscribe(function(b){d=!0,a.onNext(b)},a.onError.bind(a),function(){d||a.onNext(b),a.onCompleted()})})},w.prototype.push=function(a){var b=-1===v(this.set,a,this.comparer);return b&&this.set.push(a),b},Xb.distinct=function(a,b){var c=this;return b||(b=J),new qc(function(d){var e=new w(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)},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.select=Xb.map=function(a,b){var c=this;return new qc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.pluck=function(a){return this.map(function(b){return b[a]})},Xb.selectMany=Xb.flatMap=function(a,b,c){return"function"==typeof a&&"function"==typeof b?this.flatMap(function(c,d){var e=a(c,d);return M(e)&&(e=cc(e)),(Array.isArray(e)||o(e))&&(e=gc(e)),e.map(function(a,e){return b(c,a,d,e)})},c):"function"==typeof a?x(this,a,c):x(this,function(){return a})},Xb.flatMapObserver=Xb.selectManyObserver=function(a,b,c,d){var e=this;return new qc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}M(c)&&(c=cc(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}M(c)&&(c=cc(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}M(a)&&(a=cc(a)),f.onNext(a),f.onCompleted()})}).mergeAll()},Xb.selectSwitch=Xb.flatMapLatest=Xb.switchMap=function(a,b){return this.select(a,b).switchLatest()},Xb.skip=function(a){if(0>a)throw new Error(O);var b=this;return new qc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Xb.skipWhile=function(a,b){var c=this;return new qc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.take=function(a,b){if(0>a)throw new RangeError(O);if(0===a)return ec(b);var c=this;return new qc(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Xb.takeWhile=function(a,b){var c=this;return new qc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.where=Xb.filter=function(a,b){var c=this;return new qc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},Xb.transduce=function(a){function b(a){return{init:function(){return a},step:function(a,b){return a.onNext(b)},result:function(a){return a.onCompleted()}}}var c=this;return new qc(function(d){var e=a(b(d));return c.subscribe(function(a){try{e.step(d,a)}catch(b){d.onError(b)}},d.onError.bind(d),function(){e.result(d)})})};var qc=E.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?xb(a):yb}function c(d){function e(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new rc(a);return Hb.scheduleRequired()?Hb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return nb(c,a),c}(bc),rc=function(a){function b(b){a.call(this),this.observer=b,this.m=new zb}nb(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Yb),sc=function(a,b){this.subject=a,this.observer=b};sc.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 tc=E.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),yb):(a.onCompleted(),yb):(this.observers.push(a),new sc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return nb(d,a),ob(d.prototype,Vb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new uc(a,b)},d}(bc),uc=(E.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new sc(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),yb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return nb(d,a),ob(d.prototype,Vb,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(bc),E.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return nb(b,a),ob(b.prototype,Vb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(bc));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(z.Rx=E,define(function(){return E})):A&&B?C?(B.exports=E).Rx=E:A.Rx=E:z.Rx=E}).call(this); | ||
//# sourceMappingURL=rx.compat.map |
@@ -464,3 +464,115 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | ||
/* | ||
* Performs a exclusive waiting for the first to finish before subscribing to another observable. | ||
* Observables that come in between subscriptions will be dropped on the floor. | ||
* @returns {Observable} A exclusive observable with only the results that happen when subscribed. | ||
*/ | ||
observableProto.exclusive = function () { | ||
var sources = this; | ||
return new AnonymousObservable(function (observer) { | ||
var hasCurrent = false, | ||
isStopped = false, | ||
m = new SingleAssignmentDisposable(), | ||
g = new CompositeDisposable(); | ||
g.add(m); | ||
m.setDisposable(sources.subscribe( | ||
function (innerSource) { | ||
if (!hasCurrent) { | ||
hasCurrent = true; | ||
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); | ||
var innerSubscription = new SingleAssignmentDisposable(); | ||
g.add(innerSubscription); | ||
innerSubscription.setDisposable(innerSource.subscribe( | ||
observer.onNext.bind(observer), | ||
observer.onError.bind(observer), | ||
function () { | ||
g.remove(innerSubscription); | ||
hasCurrent = false; | ||
if (isStopped && g.length === 1) { | ||
observer.onCompleted(); | ||
} | ||
})); | ||
} | ||
}, | ||
observer.onError.bind(observer), | ||
function () { | ||
isStopped = true; | ||
if (!hasCurrent && g.length === 1) { | ||
observer.onCompleted(); | ||
} | ||
})); | ||
return g; | ||
}); | ||
}; | ||
/* | ||
* Performs a exclusive map waiting for the first to finish before subscribing to another observable. | ||
* Observables that come in between subscriptions will be dropped on the floor. | ||
* @param {Function} selector Selector to invoke for every item in the current subscription. | ||
* @param {Any} [thisArg] An optional context to invoke with the selector parameter. | ||
* @returns {Observable} An exclusive observable with only the results that happen when subscribed. | ||
*/ | ||
observableProto.exclusiveMap = function (selector, thisArg) { | ||
var sources = this; | ||
return new AnonymousObservable(function (observer) { | ||
var index = 0, | ||
hasCurrent = false, | ||
isStopped = true, | ||
m = new SingleAssignmentDisposable(), | ||
g = new CompositeDisposable(); | ||
g.add(m); | ||
m.setDisposable(sources.subscribe( | ||
function (innerSource) { | ||
if (!hasCurrent) { | ||
hasCurrent = true; | ||
innerSubscription = new SingleAssignmentDisposable(); | ||
g.add(innerSubscription); | ||
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource)); | ||
innerSubscription.setDisposable(innerSource.subscribe( | ||
function (x) { | ||
var result; | ||
try { | ||
result = selector.call(thisArg, x, index++, innerSource); | ||
} catch (e) { | ||
observer.onError(e); | ||
return; | ||
} | ||
observer.onNext(result); | ||
}, | ||
observer.onError.bind(observer), | ||
function () { | ||
g.remove(innerSubscription); | ||
hasCurrent = false; | ||
if (isStopped && g.length === 1) { | ||
observer.onCompleted(); | ||
} | ||
})); | ||
} | ||
}, | ||
observer.onError.bind(observer), | ||
function () { | ||
isStopped = true; | ||
if (g.length === 1 && !hasCurrent) { | ||
observer.onCompleted(); | ||
} | ||
})); | ||
return g; | ||
}); | ||
}; | ||
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,d){function e(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:v.call(a)}function f(a,b){return new r(function(){return new q(function(){return a()?{done:!1,value:b}:{done:!0,value:d}})})}var g=c.Observable,h=g.prototype,i=c.AnonymousObservable,j=g.concat,k=g.defer,l=g.empty,m=c.Disposable.empty,n=c.CompositeDisposable,o=c.SerialDisposable,p=c.SingleAssignmentDisposable,q=c.internals.Enumerator,r=c.internals.Enumerable,s=r.of,t=c.Scheduler.immediate,u=c.Scheduler.currentThread,v=Array.prototype.slice,w=c.AsyncSubject,x=c.Observer,y=c.internals.inherits,z=c.internals.addProperties,A=c.helpers,B=A.noop,C=A.isPromise,D=A.isScheduler,E=g.fromPromise,F="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";a.Set&&"function"==typeof(new a.Set)["@@iterator"]&&(F="@@iterator");c.doneEnumerator={done:!0,value:d};c.iterator=F,h.letBind=h.let=function(a){return a(this)},g["if"]=g.ifThen=function(a,b,c){return k(function(){return c||(c=l()),C(b)&&(b=E(b)),C(c)&&(c=E(c)),"function"==typeof c.now&&(c=l(c)),a()?b:c})},g["for"]=g.forIn=function(a,b,c){return s(a,b,c).concat()};var G=g["while"]=g.whileDo=function(a,b){return C(b)&&(b=E(b)),f(a,b).concat()};h.doWhile=function(a){return j([this,G(a,this)])},g["case"]=g.switchCase=function(a,b,c){return k(function(){C(c)&&(c=E(c)),c||(c=l()),"function"==typeof c.now&&(c=l(c));var d=b[a()];return C(d)&&(d=E(d)),d||c})},h.expand=function(a,b){D(b)||(b=t);var c=this;return new i(function(d){var e=[],f=new o,g=new n(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 p;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})},g.forkJoin=function(){var a=e(arguments,0);return new i(function(b){var c=a.length;if(0===c)return b.onCompleted(),m;for(var d=new n,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];C(j)&&(j=E(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})},h.forkJoin=function(a,b){var c=this;return new i(function(d){var e,f,g=!1,h=!1,i=!1,j=!1,k=new p,l=new p;return C(a)&&(a=E(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 n(k,l)})},h.manySelect=function(a,b){D(b)||(b=t);var c=this;return k(function(){var d;return c.map(function(a){var b=new H(a);return d&&d.onNext(a),d=b,b}).tap(B,function(a){d&&d.onError(a)},function(){d&&d.onCompleted()}).observeOn(b).map(a)})};var H=function(a){function b(a){var b=this,c=new n;return c.add(u.schedule(function(){a.onNext(b.head),c.add(b.tail.mergeObservable().subscribe(a))})),c}function c(c){a.call(this,b),this.head=c,this.tail=new w}return y(c,a),z(c.prototype,x,{onCompleted:function(){this.onNext(g.empty())},onError:function(a){this.onNext(g.throwException(a))},onNext:function(a){this.tail.onNext(a),this.tail.onCompleted()}}),c}(g);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 1===a.length&&Array.isArray(a[b])?a[b]:v.call(a)}function f(a,b){return new r(function(){return new q(function(){return a()?{done:!1,value:b}:{done:!0,value:d}})})}var g=c.Observable,h=g.prototype,i=c.AnonymousObservable,j=g.concat,k=g.defer,l=g.empty,m=c.Disposable.empty,n=c.CompositeDisposable,o=c.SerialDisposable,p=c.SingleAssignmentDisposable,q=c.internals.Enumerator,r=c.internals.Enumerable,s=r.of,t=c.Scheduler.immediate,u=c.Scheduler.currentThread,v=Array.prototype.slice,w=c.AsyncSubject,x=c.Observer,y=c.internals.inherits,z=c.internals.addProperties,A=c.helpers,B=A.noop,C=A.isPromise,D=A.isScheduler,E=g.fromPromise,F="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";a.Set&&"function"==typeof(new a.Set)["@@iterator"]&&(F="@@iterator");c.doneEnumerator={done:!0,value:d};c.iterator=F,h.letBind=h.let=function(a){return a(this)},g["if"]=g.ifThen=function(a,b,c){return k(function(){return c||(c=l()),C(b)&&(b=E(b)),C(c)&&(c=E(c)),"function"==typeof c.now&&(c=l(c)),a()?b:c})},g["for"]=g.forIn=function(a,b,c){return s(a,b,c).concat()};var G=g["while"]=g.whileDo=function(a,b){return C(b)&&(b=E(b)),f(a,b).concat()};h.doWhile=function(a){return j([this,G(a,this)])},g["case"]=g.switchCase=function(a,b,c){return k(function(){C(c)&&(c=E(c)),c||(c=l()),"function"==typeof c.now&&(c=l(c));var d=b[a()];return C(d)&&(d=E(d)),d||c})},h.expand=function(a,b){D(b)||(b=t);var c=this;return new i(function(d){var e=[],f=new o,g=new n(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 p;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})},g.forkJoin=function(){var a=e(arguments,0);return new i(function(b){var c=a.length;if(0===c)return b.onCompleted(),m;for(var d=new n,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];C(j)&&(j=E(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})},h.forkJoin=function(a,b){var c=this;return new i(function(d){var e,f,g=!1,h=!1,i=!1,j=!1,k=new p,l=new p;return C(a)&&(a=E(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 n(k,l)})},h.manySelect=function(a,b){D(b)||(b=t);var c=this;return k(function(){var d;return c.map(function(a){var b=new H(a);return d&&d.onNext(a),d=b,b}).tap(B,function(a){d&&d.onError(a)},function(){d&&d.onCompleted()}).observeOn(b).map(a)})};var H=function(a){function b(a){var b=this,c=new n;return c.add(u.schedule(function(){a.onNext(b.head),c.add(b.tail.mergeObservable().subscribe(a))})),c}function c(c){a.call(this,b),this.head=c,this.tail=new w}return y(c,a),z(c.prototype,x,{onCompleted:function(){this.onNext(g.empty())},onError:function(a){this.onNext(g.throwException(a))},onNext:function(a){this.tail.onNext(a),this.tail.onCompleted()}}),c}(g);return h.exclusive=function(){var a=this;return new i(function(b){var c=!1,d=!1,e=new p,f=new n;return f.add(e),e.setDisposable(a.subscribe(function(a){if(!c){c=!0,C(a)&&(a=E(a));var e=new p;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})},h.exclusiveMap=function(a,b){var c=this;return new i(function(d){var e=0,f=!1,g=!0,h=new p,i=new n;return i.add(h),h.setDisposable(c.subscribe(function(c){f||(f=!0,innerSubscription=new p,i.add(innerSubscription),C(c)&&(c=E(c)),innerSubscription.setDisposable(c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),function(){i.remove(innerSubscription),f=!1,g&&1===i.length&&d.onCompleted()})))},d.onError.bind(d),function(){g=!0,1!==i.length||f||d.onCompleted()})),i})},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){function b(){if(this.isDisposed)throw new Error(X)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;sb.nonEnumArgs&&a.length&&h(a)&&(a=ub.call(a));var d=sb.enumPrototypes&&"function"==typeof a,e=sb.enumErrorProps&&(a===mb||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(sb.nonEnumShadows&&a!==nb){var g=a.constructor,i=-1,j=qb.length;if(a===(g&&g.prototype))var k=a===stringProto?ib:a===mb?db:jb.call(a),l=rb[k];for(;++i<j;)f=qb[i],l&&l[f]||!kb.call(a,f)||b.push(f)}return b}function e(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function f(a,b){return e(a,b,d)}function g(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function h(a){return a&&"object"==typeof a?jb.call(a)==_:!1}function i(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,j=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=j&&"object"!=j))return!1;var k=jb.call(a),l=jb.call(b);if(k==_&&(k=gb),l==_&&(l=gb),k!=l)return!1;switch(k){case bb:case cb:return+a==+b;case fb:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case hb:case ib:return a==String(b)}var m=k==ab;if(!m){if(k!=gb||!sb.nodeClass&&(g(a)||g(b)))return!1;var n=!sb.argsObject&&h(a)?Object:a.constructor,o=!sb.argsObject&&h(b)?Object:b.constructor;if(!(n==o||kb.call(a,"constructor")&&kb.call(b,"constructor")||V(n)&&n instanceof n&&V(o)&&o instanceof o||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var p=c.length;p--;)if(c[p]==a)return d[p]==b;var q=0;if(result=!0,c.push(a),d.push(b),m){if(p=a.length,q=b.length,result=q==p)for(;q--;){var r=b[q];if(!(result=i(a[q],r,c,d)))break}}else f(b,function(b,e,f){return kb.call(f,e)?(q++,result=kb.call(a,e)&&i(a[e],b,c,d)):void 0}),result&&f(a,function(a,b,c){return kb.call(c,b)?result=--q>-1:void 0});return c.pop(),d.pop(),result}function j(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:ub.call(a)}function k(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function l(a,b){this.id=a,this.value=b}function m(a){return"number"==typeof a&&H.isFinite(a)}function n(b){return b[Y]!==a}function o(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function p(a){var b=+a.length;return isNaN(b)?0:0!==b&&m(b)?(b=o(b)*Math.floor(Math.abs(b)),0>=b?0:b>ic?ic:b):b}function q(a){return"[object Function]"===Object.prototype.toString.call(a)&&"function"==typeof a}function r(a,b){return new Bc(function(c){var d=new Gb,e=new Hb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}U(f)&&(f=uc(f)),d=new Gb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function s(a,b){var c=this;return new Bc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return void d.onError(i)}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function t(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return U(e)?uc(e):e}).concatAll()}function u(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return U(e)?uc(e):e}).mergeObservable()}function v(a){var b=function(){this.cancelBubble=!0},c=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(a){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(a||(a=H.event),!a.target)switch(a.target=a.target||a.srcElement,"mouseover"==a.type&&(a.relatedTarget=a.fromElement),"mouseout"==a.type&&(a.relatedTarget=a.toElement),a.stopPropagation||(a.stopPropagation=b,a.preventDefault=c),a.type){case"keypress":var d="charCode"in a?a.charCode:a.keyCode;10==d?(d=0,a.keyCode=13):13==d||27==d?d=0:3==d&&(d=99),a.charCode=d,a.keyChar=a.charCode?String.fromCharCode(a.charCode):""}return a}function w(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),Eb(function(){a.removeEventListener(b,c,!1)});if(a.attachEvent){var d=function(a){c(v(a))};return a.attachEvent("on"+b,d),Eb(function(){a.detachEvent("on"+b,d)})}return a["on"+b]=c,Eb(function(){a["on"+b]=null})}function x(a,b,c){var d=new Bb;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(x(a.item(e),b,c));else a&&d.add(w(a,b,c));return d}function y(a,b){return new Bc(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function z(a,b,c){return new Bc(function(d){var e=0,f=a,g=Kb(b);return c.scheduleRecursiveWithAbsolute(f,function(a){if(g>0){var b=c.now();f+=g,b>=f&&(f=b+g)}d.onNext(e++),a(f)})})}function A(a,b){return new Bc(function(c){return b.scheduleWithRelative(Kb(a),function(){c.onNext(0),c.onCompleted()})})}function B(a,b,c){return a===b?new Bc(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):gc(function(){return z(c.now()+a,b,c)})}function C(a,b,c){return new Bc(function(d){var e,f=!1,g=new Hb,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 Gb,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 Bb(e,g)})}function D(a,b,c){return gc(function(){return C(a,b-c.now(),c)})}function E(a,b){return new Bc(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new Bb(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))})}function F(a,b,c){return new Bc(function(d){function e(a,b){j[b]=a;var e;if(g[b]=!0,h||(h=g.every(P))){try{e=c.apply(null,j)}catch(f){return void d.onError(f)}d.onNext(e)}else i&&d.onCompleted()}var f=2,g=[!1,!1],h=!1,i=!1,j=new Array(f);return new Bb(a.subscribe(function(a){e(a,0)},d.onError.bind(d),function(){i=!0,d.onCompleted()}),b.subscribe(function(a){e(a,1)},d.onError.bind(d)))})}var G={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},H=G[typeof window]&&window||this,I=G[typeof exports]&&exports&&!exports.nodeType&&exports,J=G[typeof module]&&module&&!module.nodeType&&module,K=J&&J.exports===I&&I,L=G[typeof global]&&global;!L||L.global!==L&&L.window!==L||(H=L);var M={internals:{},config:{Promise:H.Promise},helpers:{}},N=M.helpers.noop=function(){},O=(M.helpers.notDefined=function(a){return"undefined"==typeof a},M.helpers.isScheduler=function(a){return a instanceof M.Scheduler}),P=M.helpers.identity=function(a){return a},Q=(M.helpers.pluck=function(a){return function(b){return b[a]}},M.helpers.just=function(a){return function(){return a}},M.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}()),R=M.helpers.defaultComparer=function(a,b){return tb(a,b)},S=M.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},T=(M.helpers.defaultKeySerializer=function(a){return a.toString()},M.helpers.defaultError=function(a){throw a}),U=M.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},V=(M.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},M.helpers.not=function(a){return!a},M.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==jb.call(a)}),a}()),W="Argument out of range",X="Object has been disposed",Y="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";H.Set&&"function"==typeof(new H.Set)["@@iterator"]&&(Y="@@iterator");var Z=M.doneEnumerator={done:!0,value:a};M.iterator=Y;var $,_="[object Arguments]",ab="[object Array]",bb="[object Boolean]",cb="[object Date]",db="[object Error]",eb="[object Function]",fb="[object Number]",gb="[object Object]",hb="[object RegExp]",ib="[object String]",jb=Object.prototype.toString,kb=Object.prototype.hasOwnProperty,lb=jb.call(arguments)==_,mb=Error.prototype,nb=Object.prototype,ob=nb.propertyIsEnumerable;try{$=!(jb.call(document)==gb&&!({toString:0}+""))}catch(pb){$=!0}var qb=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],rb={};rb[ab]=rb[cb]=rb[fb]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},rb[bb]=rb[ib]={constructor:!0,toString:!0,valueOf:!0},rb[db]=rb[eb]=rb[hb]={constructor:!0,toString:!0},rb[gb]={constructor:!0};var sb={};!function(){var a=function(){this.x=1},b=[];a.prototype={valueOf:1,y:1};for(var c in new a)b.push(c);for(c in arguments);sb.enumErrorProps=ob.call(mb,"message")||ob.call(mb,"name"),sb.enumPrototypes=ob.call(a,"prototype"),sb.nonEnumArgs=0!=c,sb.nonEnumShadows=!/valueOf/.test(b)}(1),lb||(h=function(a){return a&&"object"==typeof a?kb.call(a,"callee"):!1});{var tb=M.internals.isEqual=function(a,b){return i(a,b,[],[])},ub=Array.prototype.slice,vb=({}.hasOwnProperty,this.inherits=M.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),wb=M.internals.addProperties=function(a){for(var b=ub.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}};M.internals.addRef=function(a,b){return new Bc(function(c){return new Bb(b.getDisposable(),a.subscribe(c))})}}Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=ub.call(arguments,1),d=function(){function e(){}if(this instanceof d){e.prototype=b.prototype;var f=new e,g=b.apply(f,c.concat(ub.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(ub.call(arguments)))};return d}),Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var c,d;if(null==this)throw new TypeError(" this is null or not defined");var e=Object(this),f=e.length>>>0;if("function"!=typeof a)throw new TypeError(a+" is not a function");for(arguments.length>1&&(c=b),d=0;f>d;){var g;d in e&&(g=e[d],a.call(c,g,d,e)),d++}});var xb=Object("a"),yb="a"!=xb[0]||!(0 in xb);Array.prototype.every||(Array.prototype.every=function(a){var b=Object(this),c=yb&&{}.toString.call(this)==ib?this.split(""):b,d=c.length>>>0,e=arguments[1];if({}.toString.call(a)!=eb)throw new TypeError(a+" is not a function");for(var f=0;d>f;f++)if(f in c&&!a.call(e,c[f],f,b))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(a){var b=Object(this),c=yb&&{}.toString.call(this)==ib?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if({}.toString.call(a)!=eb)throw new TypeError(a+" is not a function");for(var g=0;d>g;g++)g in c&&(e[g]=a.call(f,c[g],g,b));return e}),Array.prototype.filter||(Array.prototype.filter=function(a){for(var b,c=[],d=new Object(this),e=0,f=d.length>>>0;f>e;e++)b=d[e],e in d&&a.call(arguments[1],b,e,d)&&c.push(b);return c}),Array.isArray||(Array.isArray=function(a){return{}.toString.call(a)==ab}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>1&&(d=Number(arguments[1]),d!==d?d=0:0!==d&&1/0!=d&&d!==-1/0&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),l.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var zb=M.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},Ab=zb.prototype;Ab.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},Ab.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},Ab.heapify=function(a){if(+a||(a=0),!(a>=this.length||0>a)){var b=2*a+1,c=2*a+2,d=a;if(b<this.length&&this.isHigherPriority(b,d)&&(d=b),c<this.length&&this.isHigherPriority(c,d)&&(d=c),d!==a){var e=this.items[a];this.items[a]=this.items[d],this.items[d]=e,this.heapify(d)}}},Ab.peek=function(){return this.items[0].value},Ab.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},Ab.dequeue=function(){var a=this.peek();return this.removeAt(0),a},Ab.enqueue=function(a){var b=this.length++;this.items[b]=new l(zb.count++,a),this.percolate(b)},Ab.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},zb.count=0;var Bb=M.CompositeDisposable=function(){this.disposables=j(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},Cb=Bb.prototype;Cb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},Cb.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},Cb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},Cb.toArray=function(){return this.disposables.slice(0)};var Db=M.Disposable=function(a){this.isDisposed=!1,this.action=a||N};Db.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var Eb=Db.create=function(a){return new Db(a)},Fb=Db.empty={dispose:N},Gb=M.SingleAssignmentDisposable=function(){function a(){this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),Hb=M.SerialDisposable=Gb,Ib=(M.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?Fb:new a(this)},b}(),M.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||S,this.disposable=new Gb});Ib.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Ib.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Ib.prototype.isCancelled=function(){return this.disposable.isDisposed},Ib.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Jb=M.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),Fb}var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=Q,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Kb=Jb.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new Bb,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),Fb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new Bb,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),Fb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,d)},a.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,d)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})}}(Jb.prototype),function(){Jb.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},Jb.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof H.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=H.setInterval(function(){d=c(d)},b);return Eb(function(){H.clearInterval(e)})}}(Jb.prototype);var Lb,Mb=Jb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Kb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Jb(Q,a,b,c)}(),Nb=Jb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Jb.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+Jb.normalize(c),g=new Ib(this,b,d,f);if(e)e.enqueue(g);else{e=new zb(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new Jb(Q,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),Ob=(M.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new Gb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),N),Pb=function(){var a,b=N;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!H.setTimeout)throw new Error("No concurrency detected!");a=H.setTimeout,b=H.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),Qb=Pb.setTimeout,Rb=Pb.clearTimeout;!function(){function a(){if(!H.postMessage||H.importScripts)return!1;var a=!1,b=H.onmessage;return H.onmessage=function(){a=!0},H.postMessage("","*"),H.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(jb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=L&&K&&L.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=L&&K&&L.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Lb=process.nextTick;else if("function"==typeof d)Lb=d,Ob=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;H.addEventListener?H.addEventListener("message",b,!1):H.attachEvent("onmessage",b,!1),Lb=function(a){var b=h++;g[b]=a,H.postMessage(f+b,"*")}}else if(H.MessageChannel){var i=new H.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Lb=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in H&&"onreadystatechange"in H.document.createElement("script")?Lb=function(a){var b=H.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},H.document.documentElement.appendChild(b)}:(Lb=function(a){return Qb(a,0)},Ob=Rb)}();var Sb=Jb.timeout=function(){function a(a,b){var c=this,d=new Gb,e=Lb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new Bb(d,Eb(function(){Ob(e)}))}function b(a,b,c){var d=this,e=Jb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new Gb,g=Qb(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new Bb(f,Eb(function(){Rb(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Jb(Q,a,b,c)}(),Tb=M.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}return a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return O(a)||(a=Mb),new Bc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Ub=Tb.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new Tb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Vb=Tb.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new Tb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Wb=Tb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Tb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Xb=M.internals.Enumerator=function(a){this._next=a};Xb.prototype.next=function(){return this._next()},Xb.prototype[Y]=function(){return this};var Yb=M.internals.Enumerable=function(a){this._iterator=a};Yb.prototype[Y]=function(){return this._iterator()},Yb.prototype.concat=function(){var a=this;return new Bc(function(b){var c;try{c=a[Y]()}catch(d){return void b.onError()}var e,f=new Hb,g=Mb.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;U(h)&&(h=uc(h));var i=new Gb;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new Bb(f,g,Eb(function(){e=!0}))})},Yb.prototype.catchException=function(){var a=this;return new Bc(function(b){var c;try{c=a[Y]()}catch(d){return void b.onError()}var e,f,g=new Hb,h=Mb.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;U(i)&&(i=uc(i));var j=new Gb;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new Bb(g,h,Eb(function(){e=!0}))})};var Zb=Yb.repeat=function(a,b){return null==b&&(b=-1),new Yb(function(){var c=b;return new Xb(function(){return 0===c?Z:(c>0&&c--,{done:!1,value:a})})})},$b=Yb.of=function(a,b,c){return b||(b=P),new Yb(function(){var d=-1;return new Xb(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:Z})})},_b=M.Observer=function(){};_b.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},_b.prototype.asObserver=function(){return new dc(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))};var ac=_b.create=function(a,b,c){return a||(a=N),b||(b=T),c||(c=N),new dc(a,b,c)};_b.fromNotifier=function(a,b){return new dc(function(c){return a.call(b,Ub(c))},function(c){return a.call(b,Vb(c))},function(){return a.call(b,Wb())})};var bc,cc=M.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return vb(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(_b),dc=M.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return vb(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(cc),ec=M.Observable=function(){function a(a){this._subscribe=a}return bc=a.prototype,bc.subscribe=bc.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:ac(a,b,c))},bc.subscribeOnNext=function(a,b){return this._subscribe(ac(2===arguments.length?function(c){a.call(b,c)}:a))},bc.subscribeOnError=function(a,b){return this._subscribe(ac(null,2===arguments.length?function(c){a.call(b,c)}:a))},bc.subscribeOnCompleted=function(a,b){return this._subscribe(ac(null,null,2===arguments.length?function(){a.call(b)}:a))},a}(),fc=M.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new Hb}return vb(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return void(b.isAcquired=!1);c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(cc);bc.toArray=function(){var a=this;return new Bc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})})},ec.create=ec.createWithDisposable=function(a){return new Bc(a)};var gc=ec.defer=function(a){return new Bc(function(b){var c;try{c=a()}catch(d){return lc(d).subscribe(b)}return U(c)&&(c=uc(c)),c.subscribe(b)})},hc=ec.empty=function(a){return O(a)||(a=Mb),new Bc(function(b){return a.schedule(function(){b.onCompleted()})})},ic=Math.pow(2,53)-1;ec.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!q(b))throw new Error("mapFn when provided must be a function");return O(d)||(d=Nb),new Bc(function(e){var f=Object(a),g=n(f),h=g?0:p(f),i=g?f[Y]():null,j=0;return d.scheduleRecursive(function(a){if(h>j||g){var d;if(g){var k=i.next();if(k.done)return void e.onCompleted();d=k.value}else d=f[j];if(b&&q(b))try{d=c?b.call(c,d,j):b(d,j)}catch(l){return void e.onError(l)}e.onNext(d),j++,a()}else e.onCompleted()})})};{var jc=ec.fromArray=function(a,b){return O(b)||(b=Nb),new Bc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};ec.never=function(){return new Bc(function(){return Fb})}}ec.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return jc(b)};ec.ofWithScheduler=function(a){for(var b=arguments.length-1,c=new Array(b),d=0;b>d;d++)c[d]=arguments[d+1];return jc(c,a)};ec.range=function(a,b,c){return O(c)||(c=Nb),new Bc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},ec.repeat=function(a,b,c){return O(c)||(c=Nb),kc(a,c).repeat(null==b?-1:b)};var kc=ec["return"]=ec.returnValue=ec.just=function(a,b){return O(b)||(b=Mb),new Bc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},lc=ec["throw"]=ec.throwException=ec.throwError=function(a,b){return O(b)||(b=Mb),new Bc(function(c){return b.schedule(function(){c.onError(a)})})};bc["catch"]=bc.catchError=bc.catchException=function(a){return"function"==typeof a?r(this,a):mc([this,a])};var mc=ec.catchException=ec.catchError=ec["catch"]=function(){return $b(j(arguments,0)).catchException()};bc.combineLatest=function(){var a=ub.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),nc.apply(this,a)};var nc=ec.combineLatest=function(){var a=ub.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new Bc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(P))){try{d=b.apply(null,l)}catch(e){return void c.onError(e)}c.onNext(d)}else j.filter(function(b,c){return c!==a}).every(P)&&c.onCompleted()}function e(a){j[a]=!0,j.every(P)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=k(g,f),i=!1,j=k(g,f),l=new Array(g),m=new Array(g),n=0;g>n;n++)!function(b){var f=a[b],g=new Gb;U(f)&&(f=uc(f)),g.setDisposable(f.subscribe(function(a){l[b]=a,d(b)},c.onError.bind(c),function(){e(b)})),m[b]=g}(n);return new Bb(m)})};bc.concat=function(){var a=ub.call(arguments,0);return a.unshift(this),oc.apply(this,a)};var oc=ec.concat=function(){return $b(j(arguments,0)).concat()};bc.concatObservable=bc.concatAll=function(){return this.merge(1)},bc.merge=function(a){if("number"!=typeof a)return pc(this,a);var b=this;return new Bc(function(c){function d(a){var b=new Gb;f.add(b),U(a)&&(a=uc(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){f.remove(b),h.length>0?d(h.shift()):(e--,g&&0===e&&c.onCompleted())}))}var e=0,f=new Bb,g=!1,h=[];return f.add(b.subscribe(function(b){a>e?(e++,d(b)):h.push(b)},c.onError.bind(c),function(){g=!0,0===e&&c.onCompleted()})),f})};var pc=ec.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=ub.call(arguments,1)):(a=Mb,b=ub.call(arguments,0)):(a=Mb,b=ub.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),jc(b,a).mergeObservable()};bc.mergeObservable=bc.mergeAll=function(){var a=this;return new Bc(function(b){var c=new Bb,d=!1,e=new Gb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new Gb;c.add(e),U(a)&&(a=uc(a)),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},bc.skipUntil=function(a){var b=this;return new Bc(function(c){var d=!1,e=new Bb(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));U(a)&&(a=uc(a));var f=new Gb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},bc["switch"]=bc.switchLatest=function(){var a=this;return new Bc(function(b){var c=!1,d=new Hb,e=!1,f=0,g=a.subscribe(function(a){var g=new Gb,h=++f;c=!0,d.setDisposable(g),U(a)&&(a=uc(a)),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,!c&&b.onCompleted()});return new Bb(g,d)})},bc.takeUntil=function(a){var b=this;return new Bc(function(c){return U(a)&&(a=uc(a)),new Bb(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),N))})},bc.zip=function(){if(Array.isArray(arguments[0]))return s.apply(this,arguments);var a=this,b=ub.call(arguments),c=b.pop();return b.unshift(a),new Bc(function(d){function e(b){var e,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),e=c.apply(a,f)}catch(g){return void d.onError(g)}d.onNext(e)}else i.filter(function(a,c){return c!==b}).every(P)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=k(g,function(){return[]}),i=k(g,function(){return!1}),j=new Array(g),l=0;g>l;l++)!function(a){var c=b[a],g=new Gb;U(c)&&(c=uc(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},d.onError.bind(d),function(){f(a) | ||
})),j[a]=g}(l);return new Bb(j)})},ec.zip=function(){var a=ub.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},ec.zipArray=function(){var a=j(arguments,0);return new Bc(function(b){function c(a){if(f.every(function(a){return a.length>0})){var c=f.map(function(a){return a.shift()});b.onNext(c)}else if(g.filter(function(b,c){return c!==a}).every(P))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(P)?void b.onCompleted():void 0}for(var e=a.length,f=k(e,function(){return[]}),g=k(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new Gb,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},b.onError.bind(b),function(){d(e)}))}(i);var j=new Bb(h);return j.add(Eb(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},bc.asObservable=function(){return new Bc(this.subscribe.bind(this))},bc.dematerialize=function(){var a=this;return new Bc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},bc.distinctUntilChanged=function(a,b){var c=this;return a||(a=P),b||(b=R),new Bc(function(d){var e,f=!1;return c.subscribe(function(c){var g,h=!1;try{g=a(c)}catch(i){return void d.onError(i)}if(f)try{h=b(e,g)}catch(i){return void d.onError(i)}f&&h||(f=!0,e=g,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))})},bc["do"]=bc.doAction=bc.tap=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new Bc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b)try{b(c)}catch(d){a.onError(d)}a.onError(c)},function(){if(c)try{c()}catch(b){a.onError(b)}a.onCompleted()})})},bc.doOnNext=bc.tapOnNext=function(a,b){return this.tap(2===arguments.length?function(c){a.call(b,c)}:a)},bc.doOnError=bc.tapOnError=function(a,b){return this.tap(N,2===arguments.length?function(c){a.call(b,c)}:a)},bc.doOnCompleted=bc.tapOnCompleted=function(a,b){return this.tap(N,null,2===arguments.length?function(){a.call(b)}:a)},bc["finally"]=bc.finallyAction=function(a){var b=this;return new Bc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return Eb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},bc.ignoreElements=function(){var a=this;return new Bc(function(b){return a.subscribe(N,b.onError.bind(b),b.onCompleted.bind(b))})},bc.materialize=function(){var a=this;return new Bc(function(b){return a.subscribe(function(a){b.onNext(Ub(a))},function(a){b.onNext(Vb(a)),b.onCompleted()},function(){b.onNext(Wb()),b.onCompleted()})})},bc.repeat=function(a){return Zb(this,a).concat()},bc.retry=function(a){return Zb(this,a).catchException()},bc.scan=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new Bc(function(e){var f,g,h;return d.subscribe(function(d){!h&&(h=!0);try{f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return void e.onError(i)}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},bc.skipLast=function(a){var b=this;return new Bc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},bc.startWith=function(){var a,b,c=0;return arguments.length&&O(arguments[0])?(b=arguments[0],c=1):b=Mb,a=ub.call(arguments,c),$b([jc(a,b),this]).concat()},bc.takeLast=function(a){var b=this;return new Bc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})})},bc.selectConcat=bc.concatMap=function(a,b,c){return b?this.concatMap(function(c,d){var e=a(c,d),f=U(e)?uc(e):e;return f.map(function(a){return b(c,a,d)})}):"function"==typeof a?t(this,a,c):t(this,function(){return a})},bc.select=bc.map=function(a,b){var c=this;return new Bc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},bc.pluck=function(a){return this.map(function(b){return b[a]})},bc.selectMany=bc.flatMap=function(a,b,c){return b?this.flatMap(function(c,d){var e=a(c,d),f=U(e)?uc(e):e;return f.map(function(a){return b(c,a,d)})},c):"function"==typeof a?u(this,a,c):u(this,function(){return a})},bc.selectSwitch=bc.flatMapLatest=bc.switchMap=function(a,b){return this.select(a,b).switchLatest()},bc.skip=function(a){if(0>a)throw new Error(W);var b=this;return new Bc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},bc.skipWhile=function(a,b){var c=this;return new Bc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},bc.take=function(a,b){if(0>a)throw new RangeError(W);if(0===a)return hc(b);var c=this;return new Bc(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},bc.takeWhile=function(a,b){var c=this;return new Bc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},bc.where=bc.filter=function(a,b){var c=this;return new Bc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},ec.fromCallback=function(a,b,c){return function(){var d=ub.call(arguments,0);return new Bc(function(e){function f(a){var b=a;if(c){try{b=c(arguments)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},ec.fromNodeCallback=function(a,b,c){return function(){var d=ub.call(arguments,0);return new Bc(function(e){function f(a){if(a)return void e.onError(a);var b=ub.call(arguments,1);if(c){try{b=c(b)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},M.config.useNativeEvents=!1;var qc=H.angular&&angular.element?angular.element:H.jQuery?H.jQuery:H.Zepto?H.Zepto:null,rc=!!H.Ember&&"function"==typeof H.Ember.addListener,sc=!!H.Backbone&&!!H.Backbone.Marionette;ec.fromEvent=function(a,b,c){if(a.addListener)return tc(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},c);if(!M.config.useNativeEvents){if(sc)return tc(function(c){a.on(b,c)},function(c){a.off(b,c)},c);if(rc)return tc(function(c){Ember.addListener(a,b,c)},function(c){Ember.removeListener(a,b,c)},c);if(qc){var d=qc(a);return tc(function(a){d.on(b,a)},function(a){d.off(b,a)},c)}}return new Bc(function(d){return x(a,b,function(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)})}).publish().refCount()};var tc=ec.fromEventPattern=function(a,b,c){return new Bc(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)}var f=a(e);return Eb(function(){b&&b(e,f)})}).publish().refCount()},uc=ec.fromPromise=function(a){return gc(function(){var b=new M.AsyncSubject;return a.then(function(a){b.isDisposed||(b.onNext(a),b.onCompleted())},b.onError.bind(b)),b})};bc.toPromise=function(a){if(a||(a=M.config.Promise),!a)throw new TypeError("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},c,function(){e&&a(d)})})},ec.startAsync=function(a){var b;try{b=a()}catch(c){return lc(c)}return uc(b)},bc.multicast=function(a,b){var c=this;return"function"==typeof a?new Bc(function(d){var e=c.multicast(a());return new Bb(b(e).subscribe(d),e.connect())}):new vc(c,a)},bc.publish=function(a){return a&&V(a)?this.multicast(function(){return new Ec},a):this.multicast(new Ec)},bc.share=function(){return this.publish().refCount()},bc.publishLast=function(a){return a&&V(a)?this.multicast(function(){return new Fc},a):this.multicast(new Fc)},bc.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new Hc(b)},a):this.multicast(new Hc(a))},bc.shareValue=function(a){return this.publishValue(a).refCount()},bc.replay=function(a,b,c,d){return a&&V(a)?this.multicast(function(){return new Ic(b,c,d)},a):this.multicast(new Ic(b,c,d))},bc.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};{var vc=M.ConnectableObservable=function(a){function b(b,c){var d,e=!1,f=b.asObservable();this.connect=function(){return e||(e=!0,d=new Bb(f.subscribe(c),Eb(function(){e=!1}))),d},a.call(this,c.subscribe.bind(c))}return vb(b,a),b.prototype.refCount=function(){var a,b=0,c=this;return new Bc(function(d){var e=1===++b,f=c.subscribe(d);return e&&(a=c.connect()),function(){f.dispose(),0===--b&&a.dispose()}})},b}(ec),wc=ec.interval=function(a,b){return B(a,a,O(b)?b:Sb)};ec.timer=function(b,c,d){var e;return O(d)||(d=Sb),c!==a&&"number"==typeof c?e=c:O(c)&&(d=c),b instanceof Date&&e===a?y(b.getTime(),d):b instanceof Date&&e!==a?(e=c,z(b.getTime(),e,d)):e===a?A(b,d):B(b,e,d)}}bc.delay=function(a,b){return O(b)||(b=Sb),a instanceof Date?D(this,a.getTime(),b):C(this,a,b)},bc.throttle=function(a,b){O(b)||(b=Sb);var c=this;return new Bc(function(d){var e,f=new Hb,g=!1,h=0,i=c.subscribe(function(c){g=!0,e=c,h++;var i=h,j=new Gb;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 Bb(i,f)})},bc.timestamp=function(a){return O(a)||(a=Sb),this.map(function(b){return{value:b,timestamp:a.now()}})},bc.sample=function(a,b){return O(b)||(b=Sb),"number"==typeof a?E(this,wc(a,b)):E(this,a)},bc.timeout=function(a,b,c){b||(b=lc(new Error("Timeout"))),O(c)||(c=Sb);var d=this,e=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new Bc(function(f){function g(){var d=h;l.setDisposable(c[e](a,function(){h===d&&(U(b)&&(b=uc(b)),j.setDisposable(b.subscribe(f)))}))}var h=0,i=new Gb,j=new Hb,k=!1,l=new Hb;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 Bb(j,l)})};var xc=function(a){function b(a){var b=this.source.publish(),c=b.subscribe(a),d=Fb,e=this.pauser.distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=Fb)});return new Bb(c,d,e)}function c(c,d){this.source=c,this.controller=new Ec,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b)}return vb(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(ec);bc.pausable=function(a){return new xc(this,a)};var yc=function(b){function c(b){var c,d=[],e=F(this.source,this.pauser.distinctUntilChanged().startWith(!1),function(a,b){return{data:a,shouldFire:b}}).subscribe(function(e){if(c!==a&&e.shouldFire!=c){if(c=e.shouldFire,e.shouldFire)for(;d.length>0;)b.onNext(d.shift())}else c=e.shouldFire,e.shouldFire?b.onNext(e.data):d.push(e.data)},function(a){for(;d.length>0;)b.onNext(d.shift());b.onError(a)},function(){for(;d.length>0;)b.onNext(d.shift());b.onCompleted()});return e}function d(a,d){this.source=a,this.controller=new Ec,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,b.call(this,c)}return vb(d,b),d.prototype.pause=function(){this.controller.onNext(!1)},d.prototype.resume=function(){this.controller.onNext(!0)},d}(ec);bc.pausableBuffered=function(a){return new yc(this,a)},bc.controlled=function(a){return null==a&&(a=!0),new zc(this,a)};var zc=function(a){function b(a){return this.source.subscribe(a)}function c(c,d){a.call(this,b),this.subject=new Ac(d),this.source=c.multicast(this.subject).refCount()}return vb(c,a),c.prototype.request=function(a){return null==a&&(a=-1),this.subject.request(a)},c}(ec),Ac=M.ControlledSubject=function(a){function c(a){return this.subject.subscribe(a)}function d(b){null==b&&(b=!0),a.call(this,c),this.subject=new Ec,this.enableQueue=b,this.queue=b?[]:null,this.requestedCount=0,this.requestedDisposable=Fb,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=Fb}return vb(d,a),wb(d.prototype,_b,{onCompleted:function(){b.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(a){b.call(this),this.hasFailed=!0,this.error=a,this.enableQueue&&0!==this.queue.length||this.subject.onError(a)},onNext:function(a){b.call(this);var c=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(a):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),c=!0),c&&this.subject.onNext(a)},_processRequest:function(a){if(this.enableQueue){for(;this.queue.length>=a&&a>0;)this.subject.onNext(this.queue.shift()),a--;return 0!==this.queue.length?{numberOfItems:a,returnValue:!0}:{numberOfItems:a,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=Fb):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=Fb),{numberOfItems:a,returnValue:!1}},request:function(a){b.call(this),this.disposeCurrentRequest();var c=this,d=this._processRequest(a);return a=d.numberOfItems,d.returnValue?Fb:(this.requestedCount=a,this.requestedDisposable=Eb(function(){c.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=Fb},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),d}(ec);bc.exclusive=function(){var a=this;return new Bc(function(b){var c=!1,d=!1,e=new Gb,f=new Bb;return f.add(e),e.setDisposable(a.subscribe(function(a){if(!c){c=!0,U(a)&&(a=uc(a));var e=new Gb;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})},bc.exclusiveMap=function(a,b){var c=this;return new Bc(function(d){var e=0,f=!1,g=!0,h=new Gb,i=new Bb;return i.add(h),h.setDisposable(c.subscribe(function(c){f||(f=!0,innerSubscription=new Gb,i.add(innerSubscription),U(c)&&(c=uc(c)),innerSubscription.setDisposable(c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),function(){i.remove(innerSubscription),f=!1,g&&1===i.length&&d.onCompleted()})))},d.onError.bind(d),function(){g=!0,1!==i.length||f||d.onCompleted()})),i})};var Bc=M.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?Eb(a):Fb}function c(d){function e(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new Cc(a);return Nb.scheduleRequired()?Nb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return vb(c,a),c}(ec),Cc=function(a){function b(b){a.call(this),this.observer=b,this.m=new Gb}vb(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(cc),Dc=function(a,b){this.subject=a,this.observer=b};Dc.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 Ec=M.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),Fb):(a.onCompleted(),Fb):(this.observers.push(a),new Dc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return vb(d,a),wb(d.prototype,_b,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new Gc(a,b)},d}(ec),Fc=M.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new Dc(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),Fb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return vb(d,a),wb(d.prototype,_b,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(ec),Gc=M.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return vb(b,a),wb(b.prototype,_b,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(ec),Hc=M.BehaviorSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),a.onNext(this.value),new Dc(this,a);var c=this.exception;return c?a.onError(c):a.onCompleted(),Fb}function d(b){a.call(this,c),this.value=b,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return vb(d,a),wb(d.prototype,_b,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){this.isStopped=!0;for(var a=0,c=this.observers.slice(0),d=c.length;d>a;a++)c[a].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){this.isStopped=!0,this.exception=a;for(var c=0,d=this.observers.slice(0),e=d.length;e>c;c++)d[c].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped){this.value=a;for(var c=0,d=this.observers.slice(0),e=d.length;e>c;c++)d[c].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),d}(ec),Ic=M.ReplaySubject=function(a){function c(a,b){return Eb(function(){b.dispose(),!a.isDisposed&&a.observers.splice(a.observers.indexOf(b),1)})}function d(a){var d=new fc(this.scheduler,a),e=c(this,d);b.call(this),this._trim(this.scheduler.now()),this.observers.push(d);for(var f=this.q.length,g=0,h=this.q.length;h>g;g++)d.onNext(this.q[g].value);return this.hasError?(f++,d.onError(this.error)):this.isStopped&&(f++,d.onCompleted()),d.ensureActive(f),e}function e(b,c,e){this.bufferSize=null==b?Number.MAX_VALUE:b,this.windowSize=null==c?Number.MAX_VALUE:c,this.scheduler=e||Nb,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,d)}return vb(e,a),wb(e.prototype,_b,{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(b.call(this),!this.isStopped){var c=this.scheduler.now();this.q.push({interval:c,value:a}),this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++){var g=d[e];g.onNext(a),g.ensureActive()}}},onError:function(a){if(b.call(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var c=this.scheduler.now();this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++){var g=d[e];g.onError(a),g.ensureActive()}this.observers=[]}},onCompleted:function(){if(b.call(this),!this.isStopped){this.isStopped=!0;var a=this.scheduler.now();this._trim(a);for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++){var f=c[d];f.onCompleted(),f.ensureActive()}this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),e}(ec);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(H.Rx=M,define(function(){return M})):I&&J?K?(J.exports=M).Rx=M:I.Rx=M:H.Rx=M}).call(this); | ||
(function(a){function b(){if(this.isDisposed)throw new Error(X)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;sb.nonEnumArgs&&a.length&&h(a)&&(a=ub.call(a));var d=sb.enumPrototypes&&"function"==typeof a,e=sb.enumErrorProps&&(a===mb||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(sb.nonEnumShadows&&a!==nb){var g=a.constructor,i=-1,j=qb.length;if(a===(g&&g.prototype))var k=a===stringProto?ib:a===mb?db:jb.call(a),l=rb[k];for(;++i<j;)f=qb[i],l&&l[f]||!kb.call(a,f)||b.push(f)}return b}function e(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function f(a,b){return e(a,b,d)}function g(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function h(a){return a&&"object"==typeof a?jb.call(a)==_:!1}function i(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,j=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=j&&"object"!=j))return!1;var k=jb.call(a),l=jb.call(b);if(k==_&&(k=gb),l==_&&(l=gb),k!=l)return!1;switch(k){case bb:case cb:return+a==+b;case fb:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case hb:case ib:return a==String(b)}var m=k==ab;if(!m){if(k!=gb||!sb.nodeClass&&(g(a)||g(b)))return!1;var n=!sb.argsObject&&h(a)?Object:a.constructor,o=!sb.argsObject&&h(b)?Object:b.constructor;if(!(n==o||kb.call(a,"constructor")&&kb.call(b,"constructor")||V(n)&&n instanceof n&&V(o)&&o instanceof o||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var p=c.length;p--;)if(c[p]==a)return d[p]==b;var q=0,r=!0;if(c.push(a),d.push(b),m){if(p=a.length,q=b.length,r=q==p)for(;q--;){var s=b[q];if(!(r=i(a[q],s,c,d)))break}}else f(b,function(b,e,f){return kb.call(f,e)?(q++,r=kb.call(a,e)&&i(a[e],b,c,d)):void 0}),r&&f(a,function(a,b,c){return kb.call(c,b)?r=--q>-1:void 0});return c.pop(),d.pop(),r}function j(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:ub.call(a)}function k(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function l(a,b){this.id=a,this.value=b}function m(a){return"number"==typeof a&&H.isFinite(a)}function n(b){return b[Y]!==a}function o(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function p(a){var b=+a.length;return isNaN(b)?0:0!==b&&m(b)?(b=o(b)*Math.floor(Math.abs(b)),0>=b?0:b>ic?ic:b):b}function q(a){return"[object Function]"===Object.prototype.toString.call(a)&&"function"==typeof a}function r(a,b){return new Cc(function(c){var d=new Gb,e=new Hb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}U(f)&&(f=vc(f)),d=new Gb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function s(a,b){var c=this;return new Cc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return void d.onError(i)}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function t(a,b,c){return a.map(function(d,e){var f=b.call(c,d,e,a);return U(f)&&(f=vc(f)),(Array.isArray(f)||n(f))&&(f=jc(f)),f}).concatAll()}function u(a,b,c){return a.map(function(d,e){var f=b.call(c,d,e,a);return U(f)&&(f=vc(f)),(Array.isArray(f)||n(f))&&(f=jc(f)),f}).mergeObservable()}function v(a){var b=function(){this.cancelBubble=!0},c=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(a){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(a||(a=H.event),!a.target)switch(a.target=a.target||a.srcElement,"mouseover"==a.type&&(a.relatedTarget=a.fromElement),"mouseout"==a.type&&(a.relatedTarget=a.toElement),a.stopPropagation||(a.stopPropagation=b,a.preventDefault=c),a.type){case"keypress":var d="charCode"in a?a.charCode:a.keyCode;10==d?(d=0,a.keyCode=13):13==d||27==d?d=0:3==d&&(d=99),a.charCode=d,a.keyChar=a.charCode?String.fromCharCode(a.charCode):""}return a}function w(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),Eb(function(){a.removeEventListener(b,c,!1)});if(a.attachEvent){var d=function(a){c(v(a))};return a.attachEvent("on"+b,d),Eb(function(){a.detachEvent("on"+b,d)})}return a["on"+b]=c,Eb(function(){a["on"+b]=null})}function x(a,b,c){var d=new Bb;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(x(a.item(e),b,c));else a&&d.add(w(a,b,c));return d}function y(a,b){return new Cc(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function z(a,b,c){return new Cc(function(d){var e=0,f=a,g=Kb(b);return c.scheduleRecursiveWithAbsolute(f,function(a){if(g>0){var b=c.now();f+=g,b>=f&&(f=b+g)}d.onNext(e++),a(f)})})}function A(a,b){return new Cc(function(c){return b.scheduleWithRelative(Kb(a),function(){c.onNext(0),c.onCompleted()})})}function B(a,b,c){return a===b?new Cc(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):gc(function(){return z(c.now()+a,b,c)})}function C(a,b,c){return new Cc(function(d){var e,f=!1,g=new Hb,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 Gb,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 Bb(e,g)})}function D(a,b,c){return gc(function(){return C(a,b-c.now(),c)})}function E(a,b){return new Cc(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new Bb(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))})}function F(a,b,c){return new Cc(function(d){function e(a,b){j[b]=a;var e;if(g[b]=!0,h||(h=g.every(P))){try{e=c.apply(null,j)}catch(f){return void d.onError(f)}d.onNext(e)}else i&&d.onCompleted()}var f=2,g=[!1,!1],h=!1,i=!1,j=new Array(f);return new Bb(a.subscribe(function(a){e(a,0)},d.onError.bind(d),function(){i=!0,d.onCompleted()}),b.subscribe(function(a){e(a,1)},d.onError.bind(d)))})}var G={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},H=G[typeof window]&&window||this,I=G[typeof exports]&&exports&&!exports.nodeType&&exports,J=G[typeof module]&&module&&!module.nodeType&&module,K=J&&J.exports===I&&I,L=G[typeof global]&&global;!L||L.global!==L&&L.window!==L||(H=L);var M={internals:{},config:{Promise:H.Promise},helpers:{}},N=M.helpers.noop=function(){},O=(M.helpers.notDefined=function(a){return"undefined"==typeof a},M.helpers.isScheduler=function(a){return a instanceof M.Scheduler}),P=M.helpers.identity=function(a){return a},Q=(M.helpers.pluck=function(a){return function(b){return b[a]}},M.helpers.just=function(a){return function(){return a}},M.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}()),R=M.helpers.defaultComparer=function(a,b){return tb(a,b)},S=M.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},T=(M.helpers.defaultKeySerializer=function(a){return a.toString()},M.helpers.defaultError=function(a){throw a}),U=M.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},V=(M.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},M.helpers.not=function(a){return!a},M.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==jb.call(a)}),a}()),W="Argument out of range",X="Object has been disposed",Y="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";H.Set&&"function"==typeof(new H.Set)["@@iterator"]&&(Y="@@iterator");var Z=M.doneEnumerator={done:!0,value:a};M.iterator=Y;var $,_="[object Arguments]",ab="[object Array]",bb="[object Boolean]",cb="[object Date]",db="[object Error]",eb="[object Function]",fb="[object Number]",gb="[object Object]",hb="[object RegExp]",ib="[object String]",jb=Object.prototype.toString,kb=Object.prototype.hasOwnProperty,lb=jb.call(arguments)==_,mb=Error.prototype,nb=Object.prototype,ob=nb.propertyIsEnumerable;try{$=!(jb.call(document)==gb&&!({toString:0}+""))}catch(pb){$=!0}var qb=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],rb={};rb[ab]=rb[cb]=rb[fb]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},rb[bb]=rb[ib]={constructor:!0,toString:!0,valueOf:!0},rb[db]=rb[eb]=rb[hb]={constructor:!0,toString:!0},rb[gb]={constructor:!0};var sb={};!function(){var a=function(){this.x=1},b=[];a.prototype={valueOf:1,y:1};for(var c in new a)b.push(c);for(c in arguments);sb.enumErrorProps=ob.call(mb,"message")||ob.call(mb,"name"),sb.enumPrototypes=ob.call(a,"prototype"),sb.nonEnumArgs=0!=c,sb.nonEnumShadows=!/valueOf/.test(b)}(1),lb||(h=function(a){return a&&"object"==typeof a?kb.call(a,"callee"):!1});{var tb=M.internals.isEqual=function(a,b){return i(a,b,[],[])},ub=Array.prototype.slice,vb=({}.hasOwnProperty,this.inherits=M.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),wb=M.internals.addProperties=function(a){for(var b=ub.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}};M.internals.addRef=function(a,b){return new Cc(function(c){return new Bb(b.getDisposable(),a.subscribe(c))})}}Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=ub.call(arguments,1),d=function(){function e(){}if(this instanceof d){e.prototype=b.prototype;var f=new e,g=b.apply(f,c.concat(ub.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(ub.call(arguments)))};return d}),Array.prototype.forEach||(Array.prototype.forEach=function(a,b){var c,d;if(null==this)throw new TypeError(" this is null or not defined");var e=Object(this),f=e.length>>>0;if("function"!=typeof a)throw new TypeError(a+" is not a function");for(arguments.length>1&&(c=b),d=0;f>d;){var g;d in e&&(g=e[d],a.call(c,g,d,e)),d++}});var xb=Object("a"),yb="a"!=xb[0]||!(0 in xb);Array.prototype.every||(Array.prototype.every=function(a){var b=Object(this),c=yb&&{}.toString.call(this)==ib?this.split(""):b,d=c.length>>>0,e=arguments[1];if({}.toString.call(a)!=eb)throw new TypeError(a+" is not a function");for(var f=0;d>f;f++)if(f in c&&!a.call(e,c[f],f,b))return!1;return!0}),Array.prototype.map||(Array.prototype.map=function(a){var b=Object(this),c=yb&&{}.toString.call(this)==ib?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if({}.toString.call(a)!=eb)throw new TypeError(a+" is not a function");for(var g=0;d>g;g++)g in c&&(e[g]=a.call(f,c[g],g,b));return e}),Array.prototype.filter||(Array.prototype.filter=function(a){for(var b,c=[],d=new Object(this),e=0,f=d.length>>>0;f>e;e++)b=d[e],e in d&&a.call(arguments[1],b,e,d)&&c.push(b);return c}),Array.isArray||(Array.isArray=function(a){return{}.toString.call(a)==ab}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){var b=Object(this),c=b.length>>>0;if(0===c)return-1;var d=0;if(arguments.length>1&&(d=Number(arguments[1]),d!==d?d=0:0!==d&&1/0!=d&&d!==-1/0&&(d=(d>0||-1)*Math.floor(Math.abs(d)))),d>=c)return-1;for(var e=d>=0?d:Math.max(c-Math.abs(d),0);c>e;e++)if(e in b&&b[e]===a)return e;return-1}),l.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var zb=M.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},Ab=zb.prototype;Ab.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},Ab.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},Ab.heapify=function(a){if(+a||(a=0),!(a>=this.length||0>a)){var b=2*a+1,c=2*a+2,d=a;if(b<this.length&&this.isHigherPriority(b,d)&&(d=b),c<this.length&&this.isHigherPriority(c,d)&&(d=c),d!==a){var e=this.items[a];this.items[a]=this.items[d],this.items[d]=e,this.heapify(d)}}},Ab.peek=function(){return this.items[0].value},Ab.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},Ab.dequeue=function(){var a=this.peek();return this.removeAt(0),a},Ab.enqueue=function(a){var b=this.length++;this.items[b]=new l(zb.count++,a),this.percolate(b)},Ab.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},zb.count=0;var Bb=M.CompositeDisposable=function(){this.disposables=j(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},Cb=Bb.prototype;Cb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},Cb.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},Cb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},Cb.toArray=function(){return this.disposables.slice(0)};var Db=M.Disposable=function(a){this.isDisposed=!1,this.action=a||N};Db.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var Eb=Db.create=function(a){return new Db(a)},Fb=Db.empty={dispose:N},Gb=M.SingleAssignmentDisposable=function(){function a(){this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),Hb=M.SerialDisposable=Gb,Ib=(M.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?Fb:new a(this)},b}(),M.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||S,this.disposable=new Gb});Ib.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Ib.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Ib.prototype.isCancelled=function(){return this.disposable.isDisposed},Ib.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Jb=M.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),Fb}var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=Q,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Kb=Jb.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new Bb,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),Fb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new Bb,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),Fb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,d)},a.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,d)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})}}(Jb.prototype),function(){Jb.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},Jb.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof H.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=H.setInterval(function(){d=c(d)},b);return Eb(function(){H.clearInterval(e)})}}(Jb.prototype);var Lb,Mb=Jb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Kb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Jb(Q,a,b,c)}(),Nb=Jb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Jb.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+Jb.normalize(c),g=new Ib(this,b,d,f);if(e)e.enqueue(g);else{e=new zb(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new Jb(Q,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),Ob=(M.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new Gb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),N),Pb=function(){var a,b=N;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!H.setTimeout)throw new Error("No concurrency detected!");a=H.setTimeout,b=H.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),Qb=Pb.setTimeout,Rb=Pb.clearTimeout;!function(){function a(){if(!H.postMessage||H.importScripts)return!1;var a=!1,b=H.onmessage;return H.onmessage=function(){a=!0},H.postMessage("","*"),H.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(jb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=L&&K&&L.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=L&&K&&L.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Lb=process.nextTick;else if("function"==typeof d)Lb=d,Ob=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;H.addEventListener?H.addEventListener("message",b,!1):H.attachEvent("onmessage",b,!1),Lb=function(a){var b=h++;g[b]=a,H.postMessage(f+b,"*")}}else if(H.MessageChannel){var i=new H.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Lb=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in H&&"onreadystatechange"in H.document.createElement("script")?Lb=function(a){var b=H.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},H.document.documentElement.appendChild(b)}:(Lb=function(a){return Qb(a,0)},Ob=Rb)}();var Sb=Jb.timeout=function(){function a(a,b){var c=this,d=new Gb,e=Lb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new Bb(d,Eb(function(){Ob(e)}))}function b(a,b,c){var d=this,e=Jb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new Gb,g=Qb(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new Bb(f,Eb(function(){Rb(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Jb(Q,a,b,c)}(),Tb=M.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}return a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return O(a)||(a=Mb),new Cc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Ub=Tb.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new Tb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Vb=Tb.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new Tb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Wb=Tb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Tb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Xb=M.internals.Enumerator=function(a){this._next=a};Xb.prototype.next=function(){return this._next()},Xb.prototype[Y]=function(){return this};var Yb=M.internals.Enumerable=function(a){this._iterator=a};Yb.prototype[Y]=function(){return this._iterator()},Yb.prototype.concat=function(){var a=this;return new Cc(function(b){var c;try{c=a[Y]()}catch(d){return void b.onError()}var e,f=new Hb,g=Mb.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;U(h)&&(h=vc(h));var i=new Gb;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new Bb(f,g,Eb(function(){e=!0}))})},Yb.prototype.catchException=function(){var a=this;return new Cc(function(b){var c;try{c=a[Y]()}catch(d){return void b.onError()}var e,f,g=new Hb,h=Mb.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;U(i)&&(i=vc(i));var j=new Gb;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new Bb(g,h,Eb(function(){e=!0}))})};var Zb=Yb.repeat=function(a,b){return null==b&&(b=-1),new Yb(function(){var c=b;return new Xb(function(){return 0===c?Z:(c>0&&c--,{done:!1,value:a})})})},$b=Yb.of=function(a,b,c){return b||(b=P),new Yb(function(){var d=-1;return new Xb(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:Z})})},_b=M.Observer=function(){};_b.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},_b.prototype.asObserver=function(){return new dc(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))};var ac=_b.create=function(a,b,c){return a||(a=N),b||(b=T),c||(c=N),new dc(a,b,c)};_b.fromNotifier=function(a,b){return new dc(function(c){return a.call(b,Ub(c))},function(c){return a.call(b,Vb(c))},function(){return a.call(b,Wb())})};var bc,cc=M.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return vb(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(_b),dc=M.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return vb(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(cc),ec=M.Observable=function(){function a(a){this._subscribe=a}return bc=a.prototype,bc.subscribe=bc.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:ac(a,b,c))},bc.subscribeOnNext=function(a,b){return this._subscribe(ac(2===arguments.length?function(c){a.call(b,c)}:a))},bc.subscribeOnError=function(a,b){return this._subscribe(ac(null,2===arguments.length?function(c){a.call(b,c)}:a))},bc.subscribeOnCompleted=function(a,b){return this._subscribe(ac(null,null,2===arguments.length?function(){a.call(b)}:a))},a}(),fc=M.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new Hb}return vb(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return void(b.isAcquired=!1);c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(cc);bc.toArray=function(){var a=this;return new Cc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})})},ec.create=ec.createWithDisposable=function(a){return new Cc(a)};{var gc=ec.defer=function(a){return new Cc(function(b){var c;try{c=a()}catch(d){return mc(d).subscribe(b)}return U(c)&&(c=vc(c)),c.subscribe(b)})},hc=ec.empty=function(a){return O(a)||(a=Mb),new Cc(function(b){return a.schedule(function(){b.onCompleted()})})},ic=Math.pow(2,53)-1,jc=ec.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!q(b))throw new Error("mapFn when provided must be a function");return O(d)||(d=Nb),new Cc(function(e){var f=Object(a),g=n(f),h=g?0:p(f),i=g?f[Y]():null,j=0;return d.scheduleRecursive(function(a){if(h>j||g){var d;if(g){var k;try{k=i.next()}catch(l){return void e.onError(l)}if(k.done)return void e.onCompleted();d=k.value}else d=f.charAt?f.charAt(j):f[j];if(b&&q(b))try{d=c?b.call(c,d,j):b(d,j)}catch(l){return void e.onError(l)}e.onNext(d),j++,a()}else e.onCompleted()})})},kc=ec.fromArray=function(a,b){return O(b)||(b=Nb),new Cc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};ec.never=function(){return new Cc(function(){return Fb})}}ec.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return kc(b)};ec.ofWithScheduler=function(a){for(var b=arguments.length-1,c=new Array(b),d=0;b>d;d++)c[d]=arguments[d+1];return kc(c,a)};ec.range=function(a,b,c){return O(c)||(c=Nb),new Cc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},ec.repeat=function(a,b,c){return O(c)||(c=Nb),lc(a,c).repeat(null==b?-1:b)};var lc=ec["return"]=ec.returnValue=ec.just=function(a,b){return O(b)||(b=Mb),new Cc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},mc=ec["throw"]=ec.throwException=ec.throwError=function(a,b){return O(b)||(b=Mb),new Cc(function(c){return b.schedule(function(){c.onError(a)})})};bc["catch"]=bc.catchError=bc.catchException=function(a){return"function"==typeof a?r(this,a):nc([this,a])};var nc=ec.catchException=ec.catchError=ec["catch"]=function(){return $b(j(arguments,0)).catchException()};bc.combineLatest=function(){var a=ub.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),oc.apply(this,a)};var oc=ec.combineLatest=function(){var a=ub.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new Cc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(P))){try{d=b.apply(null,l)}catch(e){return void c.onError(e)}c.onNext(d)}else j.filter(function(b,c){return c!==a}).every(P)&&c.onCompleted()}function e(a){j[a]=!0,j.every(P)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=k(g,f),i=!1,j=k(g,f),l=new Array(g),m=new Array(g),n=0;g>n;n++)!function(b){var f=a[b],g=new Gb;U(f)&&(f=vc(f)),g.setDisposable(f.subscribe(function(a){l[b]=a,d(b)},c.onError.bind(c),function(){e(b)})),m[b]=g}(n);return new Bb(m)})};bc.concat=function(){var a=ub.call(arguments,0);return a.unshift(this),pc.apply(this,a)};var pc=ec.concat=function(){return $b(j(arguments,0)).concat()};bc.concatObservable=bc.concatAll=function(){return this.merge(1)},bc.merge=function(a){if("number"!=typeof a)return qc(this,a);var b=this;return new Cc(function(c){function d(a){var b=new Gb;f.add(b),U(a)&&(a=vc(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){f.remove(b),h.length>0?d(h.shift()):(e--,g&&0===e&&c.onCompleted())}))}var e=0,f=new Bb,g=!1,h=[];return f.add(b.subscribe(function(b){a>e?(e++,d(b)):h.push(b)},c.onError.bind(c),function(){g=!0,0===e&&c.onCompleted()})),f})};var qc=ec.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=ub.call(arguments,1)):(a=Mb,b=ub.call(arguments,0)):(a=Mb,b=ub.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),kc(b,a).mergeObservable()};bc.mergeObservable=bc.mergeAll=function(){var a=this;return new Cc(function(b){var c=new Bb,d=!1,e=new Gb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new Gb;c.add(e),U(a)&&(a=vc(a)),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},bc.skipUntil=function(a){var b=this;return new Cc(function(c){var d=!1,e=new Bb(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));U(a)&&(a=vc(a));var f=new Gb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},bc["switch"]=bc.switchLatest=function(){var a=this;return new Cc(function(b){var c=!1,d=new Hb,e=!1,f=0,g=a.subscribe(function(a){var g=new Gb,h=++f;c=!0,d.setDisposable(g),U(a)&&(a=vc(a)),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,!c&&b.onCompleted()});return new Bb(g,d)})},bc.takeUntil=function(a){var b=this;return new Cc(function(c){return U(a)&&(a=vc(a)),new Bb(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),N))})},bc.zip=function(){if(Array.isArray(arguments[0]))return s.apply(this,arguments);var a=this,b=ub.call(arguments),c=b.pop();return b.unshift(a),new Cc(function(d){function e(b){var e,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),e=c.apply(a,f)}catch(g){return void d.onError(g)}d.onNext(e)}else i.filter(function(a,c){return c!==b}).every(P)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=k(g,function(){return[]}),i=k(g,function(){return!1}),j=new Array(g),l=0;g>l;l++)!function(a){var c=b[a],g=new Gb; | ||
U(c)&&(c=vc(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},d.onError.bind(d),function(){f(a)})),j[a]=g}(l);return new Bb(j)})},ec.zip=function(){var a=ub.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},ec.zipArray=function(){var a=j(arguments,0);return new Cc(function(b){function c(a){if(f.every(function(a){return a.length>0})){var c=f.map(function(a){return a.shift()});b.onNext(c)}else if(g.filter(function(b,c){return c!==a}).every(P))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(P)?void b.onCompleted():void 0}for(var e=a.length,f=k(e,function(){return[]}),g=k(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new Gb,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},b.onError.bind(b),function(){d(e)}))}(i);var j=new Bb(h);return j.add(Eb(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},bc.asObservable=function(){return new Cc(this.subscribe.bind(this))},bc.dematerialize=function(){var a=this;return new Cc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},bc.distinctUntilChanged=function(a,b){var c=this;return a||(a=P),b||(b=R),new Cc(function(d){var e,f=!1;return c.subscribe(function(c){var g,h=!1;try{g=a(c)}catch(i){return void d.onError(i)}if(f)try{h=b(e,g)}catch(i){return void d.onError(i)}f&&h||(f=!0,e=g,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))})},bc["do"]=bc.doAction=bc.tap=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new Cc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b)try{b(c)}catch(d){a.onError(d)}a.onError(c)},function(){if(c)try{c()}catch(b){a.onError(b)}a.onCompleted()})})},bc.doOnNext=bc.tapOnNext=function(a,b){return this.tap(2===arguments.length?function(c){a.call(b,c)}:a)},bc.doOnError=bc.tapOnError=function(a,b){return this.tap(N,2===arguments.length?function(c){a.call(b,c)}:a)},bc.doOnCompleted=bc.tapOnCompleted=function(a,b){return this.tap(N,null,2===arguments.length?function(){a.call(b)}:a)},bc["finally"]=bc.finallyAction=function(a){var b=this;return new Cc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return Eb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},bc.ignoreElements=function(){var a=this;return new Cc(function(b){return a.subscribe(N,b.onError.bind(b),b.onCompleted.bind(b))})},bc.materialize=function(){var a=this;return new Cc(function(b){return a.subscribe(function(a){b.onNext(Ub(a))},function(a){b.onNext(Vb(a)),b.onCompleted()},function(){b.onNext(Wb()),b.onCompleted()})})},bc.repeat=function(a){return Zb(this,a).concat()},bc.retry=function(a){return Zb(this,a).catchException()},bc.scan=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new Cc(function(e){var f,g,h;return d.subscribe(function(d){!h&&(h=!0);try{f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return void e.onError(i)}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},bc.skipLast=function(a){var b=this;return new Cc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},bc.startWith=function(){var a,b,c=0;return arguments.length&&O(arguments[0])?(b=arguments[0],c=1):b=Mb,a=ub.call(arguments,c),$b([kc(a,b),this]).concat()},bc.takeLast=function(a){var b=this;return new Cc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})})},bc.selectConcat=bc.concatMap=function(a,b,c){return"function"==typeof a&&"function"==typeof b?this.concatMap(function(c,d){var e=a(c,d);return U(e)&&(e=vc(e)),(Array.isArray(e)||n(e))&&(e=jc(e)),e.map(function(a,e){return b(c,a,d,e)})}):"function"==typeof a?t(this,a,c):t(this,function(){return a})},bc.select=bc.map=function(a,b){var c=this;return new Cc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},bc.pluck=function(a){return this.map(function(b){return b[a]})},bc.selectMany=bc.flatMap=function(a,b,c){return"function"==typeof a&&"function"==typeof b?this.flatMap(function(c,d){var e=a(c,d);return U(e)&&(e=vc(e)),(Array.isArray(e)||n(e))&&(e=jc(e)),e.map(function(a,e){return b(c,a,d,e)})},c):"function"==typeof a?u(this,a,c):u(this,function(){return a})},bc.selectSwitch=bc.flatMapLatest=bc.switchMap=function(a,b){return this.select(a,b).switchLatest()},bc.skip=function(a){if(0>a)throw new Error(W);var b=this;return new Cc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},bc.skipWhile=function(a,b){var c=this;return new Cc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},bc.take=function(a,b){if(0>a)throw new RangeError(W);if(0===a)return hc(b);var c=this;return new Cc(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},bc.takeWhile=function(a,b){var c=this;return new Cc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},bc.where=bc.filter=function(a,b){var c=this;return new Cc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},ec.fromCallback=function(a,b,c){return function(){var d=ub.call(arguments,0);return new Cc(function(e){function f(a){var b=a;if(c){try{b=c(arguments)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},ec.fromNodeCallback=function(a,b,c){return function(){var d=ub.call(arguments,0);return new Cc(function(e){function f(a){if(a)return void e.onError(a);var b=ub.call(arguments,1);if(c){try{b=c(b)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},M.config.useNativeEvents=!1;var rc=H.angular&&angular.element?angular.element:H.jQuery?H.jQuery:H.Zepto?H.Zepto:null,sc=!!H.Ember&&"function"==typeof H.Ember.addListener,tc=!!H.Backbone&&!!H.Backbone.Marionette;ec.fromEvent=function(a,b,c){if(a.addListener)return uc(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},c);if(!M.config.useNativeEvents){if(tc)return uc(function(c){a.on(b,c)},function(c){a.off(b,c)},c);if(sc)return uc(function(c){Ember.addListener(a,b,c)},function(c){Ember.removeListener(a,b,c)},c);if(rc){var d=rc(a);return uc(function(a){d.on(b,a)},function(a){d.off(b,a)},c)}}return new Cc(function(d){return x(a,b,function(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)})}).publish().refCount()};var uc=ec.fromEventPattern=function(a,b,c){return new Cc(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)}var f=a(e);return Eb(function(){b&&b(e,f)})}).publish().refCount()},vc=ec.fromPromise=function(a){return gc(function(){var b=new M.AsyncSubject;return a.then(function(a){b.isDisposed||(b.onNext(a),b.onCompleted())},b.onError.bind(b)),b})};bc.toPromise=function(a){if(a||(a=M.config.Promise),!a)throw new TypeError("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},c,function(){e&&a(d)})})},ec.startAsync=function(a){var b;try{b=a()}catch(c){return mc(c)}return vc(b)},bc.multicast=function(a,b){var c=this;return"function"==typeof a?new Cc(function(d){var e=c.multicast(a());return new Bb(b(e).subscribe(d),e.connect())}):new wc(c,a)},bc.publish=function(a){return a&&V(a)?this.multicast(function(){return new Fc},a):this.multicast(new Fc)},bc.share=function(){return this.publish().refCount()},bc.publishLast=function(a){return a&&V(a)?this.multicast(function(){return new Gc},a):this.multicast(new Gc)},bc.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new Ic(b)},a):this.multicast(new Ic(a))},bc.shareValue=function(a){return this.publishValue(a).refCount()},bc.replay=function(a,b,c,d){return a&&V(a)?this.multicast(function(){return new Jc(b,c,d)},a):this.multicast(new Jc(b,c,d))},bc.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};{var wc=M.ConnectableObservable=function(a){function b(b,c){var d,e=!1,f=b.asObservable();this.connect=function(){return e||(e=!0,d=new Bb(f.subscribe(c),Eb(function(){e=!1}))),d},a.call(this,c.subscribe.bind(c))}return vb(b,a),b.prototype.refCount=function(){var a,b=0,c=this;return new Cc(function(d){var e=1===++b,f=c.subscribe(d);return e&&(a=c.connect()),function(){f.dispose(),0===--b&&a.dispose()}})},b}(ec),xc=ec.interval=function(a,b){return B(a,a,O(b)?b:Sb)};ec.timer=function(b,c,d){var e;return O(d)||(d=Sb),c!==a&&"number"==typeof c?e=c:O(c)&&(d=c),b instanceof Date&&e===a?y(b.getTime(),d):b instanceof Date&&e!==a?(e=c,z(b.getTime(),e,d)):e===a?A(b,d):B(b,e,d)}}bc.delay=function(a,b){return O(b)||(b=Sb),a instanceof Date?D(this,a.getTime(),b):C(this,a,b)},bc.throttle=function(a,b){O(b)||(b=Sb);var c=this;return new Cc(function(d){var e,f=new Hb,g=!1,h=0,i=c.subscribe(function(c){g=!0,e=c,h++;var i=h,j=new Gb;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 Bb(i,f)})},bc.timestamp=function(a){return O(a)||(a=Sb),this.map(function(b){return{value:b,timestamp:a.now()}})},bc.sample=function(a,b){return O(b)||(b=Sb),"number"==typeof a?E(this,xc(a,b)):E(this,a)},bc.timeout=function(a,b,c){(null==b||"string"==typeof b)&&(b=mc(new Error(b||"Timeout"))),O(c)||(c=Sb);var d=this,e=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new Cc(function(f){function g(){var d=h;l.setDisposable(c[e](a,function(){h===d&&(U(b)&&(b=vc(b)),j.setDisposable(b.subscribe(f)))}))}var h=0,i=new Gb,j=new Hb,k=!1,l=new Hb;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 Bb(j,l)})};var yc=function(a){function b(a){var b=this.source.publish(),c=b.subscribe(a),d=Fb,e=this.pauser.distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=Fb)});return new Bb(c,d,e)}function c(c,d){this.source=c,this.controller=new Fc,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b)}return vb(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(ec);bc.pausable=function(a){return new yc(this,a)};var zc=function(b){function c(b){var c,d=[],e=F(this.source,this.pauser.distinctUntilChanged().startWith(!1),function(a,b){return{data:a,shouldFire:b}}).subscribe(function(e){if(c!==a&&e.shouldFire!=c){if(c=e.shouldFire,e.shouldFire)for(;d.length>0;)b.onNext(d.shift())}else c=e.shouldFire,e.shouldFire?b.onNext(e.data):d.push(e.data)},function(a){for(;d.length>0;)b.onNext(d.shift());b.onError(a)},function(){for(;d.length>0;)b.onNext(d.shift());b.onCompleted()});return e}function d(a,d){this.source=a,this.controller=new Fc,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,b.call(this,c)}return vb(d,b),d.prototype.pause=function(){this.controller.onNext(!1)},d.prototype.resume=function(){this.controller.onNext(!0)},d}(ec);bc.pausableBuffered=function(a){return new zc(this,a)},bc.controlled=function(a){return null==a&&(a=!0),new Ac(this,a)};var Ac=function(a){function b(a){return this.source.subscribe(a)}function c(c,d){a.call(this,b),this.subject=new Bc(d),this.source=c.multicast(this.subject).refCount()}return vb(c,a),c.prototype.request=function(a){return null==a&&(a=-1),this.subject.request(a)},c}(ec),Bc=M.ControlledSubject=function(a){function c(a){return this.subject.subscribe(a)}function d(b){null==b&&(b=!0),a.call(this,c),this.subject=new Fc,this.enableQueue=b,this.queue=b?[]:null,this.requestedCount=0,this.requestedDisposable=Fb,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=Fb}return vb(d,a),wb(d.prototype,_b,{onCompleted:function(){b.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(a){b.call(this),this.hasFailed=!0,this.error=a,this.enableQueue&&0!==this.queue.length||this.subject.onError(a)},onNext:function(a){b.call(this);var c=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(a):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),c=!0),c&&this.subject.onNext(a)},_processRequest:function(a){if(this.enableQueue){for(;this.queue.length>=a&&a>0;)this.subject.onNext(this.queue.shift()),a--;return 0!==this.queue.length?{numberOfItems:a,returnValue:!0}:{numberOfItems:a,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=Fb):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=Fb),{numberOfItems:a,returnValue:!1}},request:function(a){b.call(this),this.disposeCurrentRequest();var c=this,d=this._processRequest(a);return a=d.numberOfItems,d.returnValue?Fb:(this.requestedCount=a,this.requestedDisposable=Eb(function(){c.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=Fb},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),d}(ec);bc.transduce=function(a){function b(a){return{init:function(){return a},step:function(a,b){return a.onNext(b)},result:function(a){return a.onCompleted()}}}var c=this;return new Cc(function(d){var e=a(b(d));return c.subscribe(function(a){try{e.step(d,a)}catch(b){d.onError(b)}},d.onError.bind(d),function(){e.result(d)})})};var Cc=M.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?Eb(a):Fb}function c(d){function e(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new Dc(a);return Nb.scheduleRequired()?Nb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return vb(c,a),c}(ec),Dc=function(a){function b(b){a.call(this),this.observer=b,this.m=new Gb}vb(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(cc),Ec=function(a,b){this.subject=a,this.observer=b};Ec.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 Fc=M.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),Fb):(a.onCompleted(),Fb):(this.observers.push(a),new Ec(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return vb(d,a),wb(d.prototype,_b,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new Hc(a,b)},d}(ec),Gc=M.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new Ec(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),Fb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return vb(d,a),wb(d.prototype,_b,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(ec),Hc=M.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return vb(b,a),wb(b.prototype,_b,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(ec),Ic=M.BehaviorSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),a.onNext(this.value),new Ec(this,a);var c=this.exception;return c?a.onError(c):a.onCompleted(),Fb}function d(b){a.call(this,c),this.value=b,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return vb(d,a),wb(d.prototype,_b,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){this.isStopped=!0;for(var a=0,c=this.observers.slice(0),d=c.length;d>a;a++)c[a].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){this.isStopped=!0,this.exception=a;for(var c=0,d=this.observers.slice(0),e=d.length;e>c;c++)d[c].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped){this.value=a;for(var c=0,d=this.observers.slice(0),e=d.length;e>c;c++)d[c].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),d}(ec),Jc=M.ReplaySubject=function(a){function c(a,b){return Eb(function(){b.dispose(),!a.isDisposed&&a.observers.splice(a.observers.indexOf(b),1)})}function d(a){var d=new fc(this.scheduler,a),e=c(this,d);b.call(this),this._trim(this.scheduler.now()),this.observers.push(d);for(var f=this.q.length,g=0,h=this.q.length;h>g;g++)d.onNext(this.q[g].value);return this.hasError?(f++,d.onError(this.error)):this.isStopped&&(f++,d.onCompleted()),d.ensureActive(f),e}function e(b,c,e){this.bufferSize=null==b?Number.MAX_VALUE:b,this.windowSize=null==c?Number.MAX_VALUE:c,this.scheduler=e||Nb,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,d)}return vb(e,a),wb(e.prototype,_b,{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(b.call(this),!this.isStopped){var c=this.scheduler.now();this.q.push({interval:c,value:a}),this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++){var g=d[e];g.onNext(a),g.ensureActive()}}},onError:function(a){if(b.call(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var c=this.scheduler.now();this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++){var g=d[e];g.onError(a),g.ensureActive()}this.observers=[]}},onCompleted:function(){if(b.call(this),!this.isStopped){this.isStopped=!0;var a=this.scheduler.now();this._trim(a);for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++){var f=c[d];f.onCompleted(),f.ensureActive()}this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),e}(ec);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(H.Rx=M,define(function(){return M})):I&&J?K?(J.exports=M).Rx=M:I.Rx=M:H.Rx=M}).call(this); | ||
//# sourceMappingURL=rx.lite.compat.map |
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/ | ||
(function(a){function b(){if(this.isDisposed)throw new Error(W)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;rb.nonEnumArgs&&a.length&&h(a)&&(a=tb.call(a));var d=rb.enumPrototypes&&"function"==typeof a,e=rb.enumErrorProps&&(a===lb||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(rb.nonEnumShadows&&a!==mb){var g=a.constructor,i=-1,j=pb.length;if(a===(g&&g.prototype))var k=a===stringProto?hb:a===lb?cb:ib.call(a),l=qb[k];for(;++i<j;)f=pb[i],l&&l[f]||!jb.call(a,f)||b.push(f)}return b}function e(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function f(a,b){return e(a,b,d)}function g(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function h(a){return a&&"object"==typeof a?ib.call(a)==$:!1}function i(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,j=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=j&&"object"!=j))return!1;var k=ib.call(a),l=ib.call(b);if(k==$&&(k=fb),l==$&&(l=fb),k!=l)return!1;switch(k){case ab:case bb:return+a==+b;case eb:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case gb:case hb:return a==String(b)}var m=k==_;if(!m){if(k!=fb||!rb.nodeClass&&(g(a)||g(b)))return!1;var n=!rb.argsObject&&h(a)?Object:a.constructor,o=!rb.argsObject&&h(b)?Object:b.constructor;if(!(n==o||jb.call(a,"constructor")&&jb.call(b,"constructor")||U(n)&&n instanceof n&&U(o)&&o instanceof o||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var p=c.length;p--;)if(c[p]==a)return d[p]==b;var q=0;if(result=!0,c.push(a),d.push(b),m){if(p=a.length,q=b.length,result=q==p)for(;q--;){var r=b[q];if(!(result=i(a[q],r,c,d)))break}}else f(b,function(b,e,f){return jb.call(f,e)?(q++,result=jb.call(a,e)&&i(a[e],b,c,d)):void 0}),result&&f(a,function(a,b,c){return jb.call(c,b)?result=--q>-1:void 0});return c.pop(),d.pop(),result}function j(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:tb.call(a)}function k(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function l(a,b){this.id=a,this.value=b}function m(a){return"number"==typeof a&&G.isFinite(a)}function n(b){return b[X]!==a}function o(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function p(a){var b=+a.length;return isNaN(b)?0:0!==b&&m(b)?(b=o(b)*Math.floor(Math.abs(b)),0>=b?0:b>fc?fc:b):b}function q(a){return"[object Function]"===Object.prototype.toString.call(a)&&"function"==typeof a}function r(a,b){return new yc(function(c){var d=new Db,e=new Eb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}T(f)&&(f=rc(f)),d=new Db,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function s(a,b){var c=this;return new yc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return void d.onError(i)}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function t(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return T(e)?rc(e):e}).concatAll()}function u(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return T(e)?rc(e):e}).mergeObservable()}function v(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),Bb(function(){a.removeEventListener(b,c,!1)});throw new Error("No listener found")}function w(a,b,c){var d=new yb;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(w(a.item(e),b,c));else a&&d.add(v(a,b,c));return d}function x(a,b){return new yc(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function y(a,b,c){return new yc(function(d){var e=0,f=a,g=Hb(b);return c.scheduleRecursiveWithAbsolute(f,function(a){if(g>0){var b=c.now();f+=g,b>=f&&(f=b+g)}d.onNext(e++),a(f)})})}function z(a,b){return new yc(function(c){return b.scheduleWithRelative(Hb(a),function(){c.onNext(0),c.onCompleted()})})}function A(a,b,c){return a===b?new yc(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):dc(function(){return y(c.now()+a,b,c)})}function B(a,b,c){return new yc(function(d){var e,f=!1,g=new Eb,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 Db,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 yb(e,g)})}function C(a,b,c){return dc(function(){return B(a,b-c.now(),c)})}function D(a,b){return new yc(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new yb(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))})}function E(a,b,c){return new yc(function(d){function e(a,b){j[b]=a;var e;if(g[b]=!0,h||(h=g.every(O))){try{e=c.apply(null,j)}catch(f){return void d.onError(f)}d.onNext(e)}else i&&d.onCompleted()}var f=2,g=[!1,!1],h=!1,i=!1,j=new Array(f);return new yb(a.subscribe(function(a){e(a,0)},d.onError.bind(d),function(){i=!0,d.onCompleted()}),b.subscribe(function(a){e(a,1)},d.onError.bind(d)))})}var F={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},G=F[typeof window]&&window||this,H=F[typeof exports]&&exports&&!exports.nodeType&&exports,I=F[typeof module]&&module&&!module.nodeType&&module,J=I&&I.exports===H&&H,K=F[typeof global]&&global;!K||K.global!==K&&K.window!==K||(G=K);var L={internals:{},config:{Promise:G.Promise},helpers:{}},M=L.helpers.noop=function(){},N=(L.helpers.notDefined=function(a){return"undefined"==typeof a},L.helpers.isScheduler=function(a){return a instanceof L.Scheduler}),O=L.helpers.identity=function(a){return a},P=(L.helpers.pluck=function(a){return function(b){return b[a]}},L.helpers.just=function(a){return function(){return a}},L.helpers.defaultNow=Date.now),Q=L.helpers.defaultComparer=function(a,b){return sb(a,b)},R=L.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},S=(L.helpers.defaultKeySerializer=function(a){return a.toString()},L.helpers.defaultError=function(a){throw a}),T=L.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},U=(L.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},L.helpers.not=function(a){return!a},L.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==ib.call(a)}),a}()),V="Argument out of range",W="Object has been disposed",X="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";G.Set&&"function"==typeof(new G.Set)["@@iterator"]&&(X="@@iterator");var Y=L.doneEnumerator={done:!0,value:a};L.iterator=X;var Z,$="[object Arguments]",_="[object Array]",ab="[object Boolean]",bb="[object Date]",cb="[object Error]",db="[object Function]",eb="[object Number]",fb="[object Object]",gb="[object RegExp]",hb="[object String]",ib=Object.prototype.toString,jb=Object.prototype.hasOwnProperty,kb=ib.call(arguments)==$,lb=Error.prototype,mb=Object.prototype,nb=mb.propertyIsEnumerable;try{Z=!(ib.call(document)==fb&&!({toString:0}+""))}catch(ob){Z=!0}var pb=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],qb={};qb[_]=qb[bb]=qb[eb]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},qb[ab]=qb[hb]={constructor:!0,toString:!0,valueOf:!0},qb[cb]=qb[db]=qb[gb]={constructor:!0,toString:!0},qb[fb]={constructor:!0};var rb={};!function(){var a=function(){this.x=1},b=[];a.prototype={valueOf:1,y:1};for(var c in new a)b.push(c);for(c in arguments);rb.enumErrorProps=nb.call(lb,"message")||nb.call(lb,"name"),rb.enumPrototypes=nb.call(a,"prototype"),rb.nonEnumArgs=0!=c,rb.nonEnumShadows=!/valueOf/.test(b)}(1),kb||(h=function(a){return a&&"object"==typeof a?jb.call(a,"callee"):!1});{var sb=L.internals.isEqual=function(a,b){return i(a,b,[],[])},tb=Array.prototype.slice,ub=({}.hasOwnProperty,this.inherits=L.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),vb=L.internals.addProperties=function(a){for(var b=tb.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}};L.internals.addRef=function(a,b){return new yc(function(c){return new yb(b.getDisposable(),a.subscribe(c))})}}l.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var wb=L.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},xb=wb.prototype;xb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},xb.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},xb.heapify=function(a){if(+a||(a=0),!(a>=this.length||0>a)){var b=2*a+1,c=2*a+2,d=a;if(b<this.length&&this.isHigherPriority(b,d)&&(d=b),c<this.length&&this.isHigherPriority(c,d)&&(d=c),d!==a){var e=this.items[a];this.items[a]=this.items[d],this.items[d]=e,this.heapify(d)}}},xb.peek=function(){return this.items[0].value},xb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},xb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},xb.enqueue=function(a){var b=this.length++;this.items[b]=new l(wb.count++,a),this.percolate(b)},xb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},wb.count=0;var yb=L.CompositeDisposable=function(){this.disposables=j(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},zb=yb.prototype;zb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},zb.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},zb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},zb.toArray=function(){return this.disposables.slice(0)};var Ab=L.Disposable=function(a){this.isDisposed=!1,this.action=a||M};Ab.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var Bb=Ab.create=function(a){return new Ab(a)},Cb=Ab.empty={dispose:M},Db=L.SingleAssignmentDisposable=function(){function a(){this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),Eb=L.SerialDisposable=Db,Fb=(L.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?Cb:new a(this)},b}(),L.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||R,this.disposable=new Db});Fb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Fb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Fb.prototype.isCancelled=function(){return this.disposable.isDisposed},Fb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Gb=L.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),Cb}var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=P,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Hb=Gb.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new yb,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),Cb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new yb,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),Cb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,d)},a.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,d)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})}}(Gb.prototype),function(){Gb.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},Gb.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof G.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=G.setInterval(function(){d=c(d)},b);return Bb(function(){G.clearInterval(e)})}}(Gb.prototype);var Ib,Jb=Gb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Hb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Gb(P,a,b,c)}(),Kb=Gb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Gb.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+Gb.normalize(c),g=new Fb(this,b,d,f);if(e)e.enqueue(g);else{e=new wb(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new Gb(P,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),Lb=(L.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new Db;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),M),Mb=function(){var a,b=M;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!G.setTimeout)throw new Error("No concurrency detected!");a=G.setTimeout,b=G.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),Nb=Mb.setTimeout,Ob=Mb.clearTimeout;!function(){function a(){if(!G.postMessage||G.importScripts)return!1;var a=!1,b=G.onmessage;return G.onmessage=function(){a=!0},G.postMessage("","*"),G.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(ib).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=K&&J&&K.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=K&&J&&K.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Ib=process.nextTick;else if("function"==typeof d)Ib=d,Lb=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;G.addEventListener?G.addEventListener("message",b,!1):G.attachEvent("onmessage",b,!1),Ib=function(a){var b=h++;g[b]=a,G.postMessage(f+b,"*")}}else if(G.MessageChannel){var i=new G.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Ib=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in G&&"onreadystatechange"in G.document.createElement("script")?Ib=function(a){var b=G.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},G.document.documentElement.appendChild(b)}:(Ib=function(a){return Nb(a,0)},Lb=Ob)}();var Pb=Gb.timeout=function(){function a(a,b){var c=this,d=new Db,e=Ib(function(){d.isDisposed||d.setDisposable(b(c,a))});return new yb(d,Bb(function(){Lb(e)}))}function b(a,b,c){var d=this,e=Gb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new Db,g=Nb(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new yb(f,Bb(function(){Ob(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Gb(P,a,b,c)}(),Qb=L.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}return a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return N(a)||(a=Jb),new yc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Rb=Qb.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new Qb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Sb=Qb.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new Qb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Tb=Qb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Qb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Ub=L.internals.Enumerator=function(a){this._next=a};Ub.prototype.next=function(){return this._next()},Ub.prototype[X]=function(){return this};var Vb=L.internals.Enumerable=function(a){this._iterator=a};Vb.prototype[X]=function(){return this._iterator()},Vb.prototype.concat=function(){var a=this;return new yc(function(b){var c;try{c=a[X]()}catch(d){return void b.onError()}var e,f=new Eb,g=Jb.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;T(h)&&(h=rc(h));var i=new Db;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new yb(f,g,Bb(function(){e=!0}))})},Vb.prototype.catchException=function(){var a=this;return new yc(function(b){var c;try{c=a[X]()}catch(d){return void b.onError()}var e,f,g=new Eb,h=Jb.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;T(i)&&(i=rc(i));var j=new Db;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new yb(g,h,Bb(function(){e=!0}))})};var Wb=Vb.repeat=function(a,b){return null==b&&(b=-1),new Vb(function(){var c=b;return new Ub(function(){return 0===c?Y:(c>0&&c--,{done:!1,value:a})})})},Xb=Vb.of=function(a,b,c){return b||(b=O),new Vb(function(){var d=-1;return new Ub(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:Y})})},Yb=L.Observer=function(){};Yb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Yb.prototype.asObserver=function(){return new ac(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))};var Zb=Yb.create=function(a,b,c){return a||(a=M),b||(b=S),c||(c=M),new ac(a,b,c)};Yb.fromNotifier=function(a,b){return new ac(function(c){return a.call(b,Rb(c))},function(c){return a.call(b,Sb(c))},function(){return a.call(b,Tb())})};var $b,_b=L.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return ub(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Yb),ac=L.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return ub(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(_b),bc=L.Observable=function(){function a(a){this._subscribe=a}return $b=a.prototype,$b.subscribe=$b.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:Zb(a,b,c))},$b.subscribeOnNext=function(a,b){return this._subscribe(Zb(2===arguments.length?function(c){a.call(b,c)}:a))},$b.subscribeOnError=function(a,b){return this._subscribe(Zb(null,2===arguments.length?function(c){a.call(b,c)}:a))},$b.subscribeOnCompleted=function(a,b){return this._subscribe(Zb(null,null,2===arguments.length?function(){a.call(b)}:a))},a}(),cc=L.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new Eb}return ub(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return void(b.isAcquired=!1);c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(_b);$b.toArray=function(){var a=this;return new yc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})})},bc.create=bc.createWithDisposable=function(a){return new yc(a)};var dc=bc.defer=function(a){return new yc(function(b){var c;try{c=a()}catch(d){return ic(d).subscribe(b)}return T(c)&&(c=rc(c)),c.subscribe(b)})},ec=bc.empty=function(a){return N(a)||(a=Jb),new yc(function(b){return a.schedule(function(){b.onCompleted()})})},fc=Math.pow(2,53)-1;bc.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!q(b))throw new Error("mapFn when provided must be a function");return N(d)||(d=Kb),new yc(function(e){var f=Object(a),g=n(f),h=g?0:p(f),i=g?f[X]():null,j=0;return d.scheduleRecursive(function(a){if(h>j||g){var d;if(g){var k=i.next();if(k.done)return void e.onCompleted();d=k.value}else d=f[j];if(b&&q(b))try{d=c?b.call(c,d,j):b(d,j)}catch(l){return void e.onError(l)}e.onNext(d),j++,a()}else e.onCompleted()})})};{var gc=bc.fromArray=function(a,b){return N(b)||(b=Kb),new yc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};bc.never=function(){return new yc(function(){return Cb})}}bc.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return gc(b)};bc.ofWithScheduler=function(a){for(var b=arguments.length-1,c=new Array(b),d=0;b>d;d++)c[d]=arguments[d+1];return gc(c,a)};bc.range=function(a,b,c){return N(c)||(c=Kb),new yc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},bc.repeat=function(a,b,c){return N(c)||(c=Kb),hc(a,c).repeat(null==b?-1:b)};var hc=bc["return"]=bc.returnValue=bc.just=function(a,b){return N(b)||(b=Jb),new yc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},ic=bc["throw"]=bc.throwException=bc.throwError=function(a,b){return N(b)||(b=Jb),new yc(function(c){return b.schedule(function(){c.onError(a)})})};$b["catch"]=$b.catchError=$b.catchException=function(a){return"function"==typeof a?r(this,a):jc([this,a])};var jc=bc.catchException=bc.catchError=bc["catch"]=function(){return Xb(j(arguments,0)).catchException()};$b.combineLatest=function(){var a=tb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),kc.apply(this,a)};var kc=bc.combineLatest=function(){var a=tb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new yc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(O))){try{d=b.apply(null,l)}catch(e){return void c.onError(e)}c.onNext(d)}else j.filter(function(b,c){return c!==a}).every(O)&&c.onCompleted()}function e(a){j[a]=!0,j.every(O)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=k(g,f),i=!1,j=k(g,f),l=new Array(g),m=new Array(g),n=0;g>n;n++)!function(b){var f=a[b],g=new Db;T(f)&&(f=rc(f)),g.setDisposable(f.subscribe(function(a){l[b]=a,d(b)},c.onError.bind(c),function(){e(b)})),m[b]=g}(n);return new yb(m)})};$b.concat=function(){var a=tb.call(arguments,0);return a.unshift(this),lc.apply(this,a)};var lc=bc.concat=function(){return Xb(j(arguments,0)).concat()};$b.concatObservable=$b.concatAll=function(){return this.merge(1)},$b.merge=function(a){if("number"!=typeof a)return mc(this,a);var b=this;return new yc(function(c){function d(a){var b=new Db;f.add(b),T(a)&&(a=rc(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){f.remove(b),h.length>0?d(h.shift()):(e--,g&&0===e&&c.onCompleted())}))}var e=0,f=new yb,g=!1,h=[];return f.add(b.subscribe(function(b){a>e?(e++,d(b)):h.push(b)},c.onError.bind(c),function(){g=!0,0===e&&c.onCompleted()})),f})};var mc=bc.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=tb.call(arguments,1)):(a=Jb,b=tb.call(arguments,0)):(a=Jb,b=tb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),gc(b,a).mergeObservable()};$b.mergeObservable=$b.mergeAll=function(){var a=this;return new yc(function(b){var c=new yb,d=!1,e=new Db;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new Db;c.add(e),T(a)&&(a=rc(a)),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},$b.skipUntil=function(a){var b=this;return new yc(function(c){var d=!1,e=new yb(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));T(a)&&(a=rc(a));var f=new Db;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},$b["switch"]=$b.switchLatest=function(){var a=this;return new yc(function(b){var c=!1,d=new Eb,e=!1,f=0,g=a.subscribe(function(a){var g=new Db,h=++f;c=!0,d.setDisposable(g),T(a)&&(a=rc(a)),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,!c&&b.onCompleted()});return new yb(g,d)})},$b.takeUntil=function(a){var b=this;return new yc(function(c){return T(a)&&(a=rc(a)),new yb(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),M))})},$b.zip=function(){if(Array.isArray(arguments[0]))return s.apply(this,arguments);var a=this,b=tb.call(arguments),c=b.pop();return b.unshift(a),new yc(function(d){function e(b){var e,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),e=c.apply(a,f)}catch(g){return void d.onError(g)}d.onNext(e)}else i.filter(function(a,c){return c!==b}).every(O)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=k(g,function(){return[]}),i=k(g,function(){return!1}),j=new Array(g),l=0;g>l;l++)!function(a){var c=b[a],g=new Db;T(c)&&(c=rc(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},d.onError.bind(d),function(){f(a)})),j[a]=g}(l);return new yb(j)})},bc.zip=function(){var a=tb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},bc.zipArray=function(){var a=j(arguments,0);return new yc(function(b){function c(a){if(f.every(function(a){return a.length>0})){var c=f.map(function(a){return a.shift()});b.onNext(c)}else if(g.filter(function(b,c){return c!==a}).every(O))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(O)?void b.onCompleted():void 0}for(var e=a.length,f=k(e,function(){return[]}),g=k(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new Db,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},b.onError.bind(b),function(){d(e)}))}(i);var j=new yb(h);return j.add(Bb(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},$b.asObservable=function(){return new yc(this.subscribe.bind(this))},$b.dematerialize=function(){var a=this;return new yc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},$b.distinctUntilChanged=function(a,b){var c=this;return a||(a=O),b||(b=Q),new yc(function(d){var e,f=!1;return c.subscribe(function(c){var g,h=!1;try{g=a(c)}catch(i){return void d.onError(i)}if(f)try{h=b(e,g)}catch(i){return void d.onError(i)}f&&h||(f=!0,e=g,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))})},$b["do"]=$b.doAction=$b.tap=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new yc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b)try{b(c)}catch(d){a.onError(d)}a.onError(c)},function(){if(c)try{c()}catch(b){a.onError(b)}a.onCompleted()})})},$b.doOnNext=$b.tapOnNext=function(a,b){return this.tap(2===arguments.length?function(c){a.call(b,c)}:a)},$b.doOnError=$b.tapOnError=function(a,b){return this.tap(M,2===arguments.length?function(c){a.call(b,c)}:a)},$b.doOnCompleted=$b.tapOnCompleted=function(a,b){return this.tap(M,null,2===arguments.length?function(){a.call(b)}:a)},$b["finally"]=$b.finallyAction=function(a){var b=this;return new yc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return Bb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},$b.ignoreElements=function(){var a=this;return new yc(function(b){return a.subscribe(M,b.onError.bind(b),b.onCompleted.bind(b))})},$b.materialize=function(){var a=this;return new yc(function(b){return a.subscribe(function(a){b.onNext(Rb(a))},function(a){b.onNext(Sb(a)),b.onCompleted()},function(){b.onNext(Tb()),b.onCompleted()})})},$b.repeat=function(a){return Wb(this,a).concat()},$b.retry=function(a){return Wb(this,a).catchException()},$b.scan=function(){var a,b,c=!1,d=this; | ||
return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new yc(function(e){var f,g,h;return d.subscribe(function(d){!h&&(h=!0);try{f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return void e.onError(i)}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},$b.skipLast=function(a){var b=this;return new yc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},$b.startWith=function(){var a,b,c=0;return arguments.length&&N(arguments[0])?(b=arguments[0],c=1):b=Jb,a=tb.call(arguments,c),Xb([gc(a,b),this]).concat()},$b.takeLast=function(a){var b=this;return new yc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})})},$b.selectConcat=$b.concatMap=function(a,b,c){return b?this.concatMap(function(c,d){var e=a(c,d),f=T(e)?rc(e):e;return f.map(function(a){return b(c,a,d)})}):"function"==typeof a?t(this,a,c):t(this,function(){return a})},$b.select=$b.map=function(a,b){var c=this;return new yc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},$b.pluck=function(a){return this.map(function(b){return b[a]})},$b.selectMany=$b.flatMap=function(a,b,c){return b?this.flatMap(function(c,d){var e=a(c,d),f=T(e)?rc(e):e;return f.map(function(a){return b(c,a,d)})},c):"function"==typeof a?u(this,a,c):u(this,function(){return a})},$b.selectSwitch=$b.flatMapLatest=$b.switchMap=function(a,b){return this.select(a,b).switchLatest()},$b.skip=function(a){if(0>a)throw new Error(V);var b=this;return new yc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},$b.skipWhile=function(a,b){var c=this;return new yc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},$b.take=function(a,b){if(0>a)throw new RangeError(V);if(0===a)return ec(b);var c=this;return new yc(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},$b.takeWhile=function(a,b){var c=this;return new yc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},$b.where=$b.filter=function(a,b){var c=this;return new yc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},bc.fromCallback=function(a,b,c){return function(){var d=tb.call(arguments,0);return new yc(function(e){function f(a){var b=a;if(c){try{b=c(arguments)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},bc.fromNodeCallback=function(a,b,c){return function(){var d=tb.call(arguments,0);return new yc(function(e){function f(a){if(a)return void e.onError(a);var b=tb.call(arguments,1);if(c){try{b=c(b)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},L.config.useNativeEvents=!1;var nc=G.angular&&angular.element?angular.element:G.jQuery?G.jQuery:G.Zepto?G.Zepto:null,oc=!!G.Ember&&"function"==typeof G.Ember.addListener,pc=!!G.Backbone&&!!G.Backbone.Marionette;bc.fromEvent=function(a,b,c){if(a.addListener)return qc(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},c);if(!L.config.useNativeEvents){if(pc)return qc(function(c){a.on(b,c)},function(c){a.off(b,c)},c);if(oc)return qc(function(c){Ember.addListener(a,b,c)},function(c){Ember.removeListener(a,b,c)},c);if(nc){var d=nc(a);return qc(function(a){d.on(b,a)},function(a){d.off(b,a)},c)}}return new yc(function(d){return w(a,b,function(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)})}).publish().refCount()};var qc=bc.fromEventPattern=function(a,b,c){return new yc(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)}var f=a(e);return Bb(function(){b&&b(e,f)})}).publish().refCount()},rc=bc.fromPromise=function(a){return dc(function(){var b=new L.AsyncSubject;return a.then(function(a){b.isDisposed||(b.onNext(a),b.onCompleted())},b.onError.bind(b)),b})};$b.toPromise=function(a){if(a||(a=L.config.Promise),!a)throw new TypeError("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},c,function(){e&&a(d)})})},bc.startAsync=function(a){var b;try{b=a()}catch(c){return ic(c)}return rc(b)},$b.multicast=function(a,b){var c=this;return"function"==typeof a?new yc(function(d){var e=c.multicast(a());return new yb(b(e).subscribe(d),e.connect())}):new sc(c,a)},$b.publish=function(a){return a&&U(a)?this.multicast(function(){return new Bc},a):this.multicast(new Bc)},$b.share=function(){return this.publish().refCount()},$b.publishLast=function(a){return a&&U(a)?this.multicast(function(){return new Cc},a):this.multicast(new Cc)},$b.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new Ec(b)},a):this.multicast(new Ec(a))},$b.shareValue=function(a){return this.publishValue(a).refCount()},$b.replay=function(a,b,c,d){return a&&U(a)?this.multicast(function(){return new Fc(b,c,d)},a):this.multicast(new Fc(b,c,d))},$b.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};{var sc=L.ConnectableObservable=function(a){function b(b,c){var d,e=!1,f=b.asObservable();this.connect=function(){return e||(e=!0,d=new yb(f.subscribe(c),Bb(function(){e=!1}))),d},a.call(this,c.subscribe.bind(c))}return ub(b,a),b.prototype.refCount=function(){var a,b=0,c=this;return new yc(function(d){var e=1===++b,f=c.subscribe(d);return e&&(a=c.connect()),function(){f.dispose(),0===--b&&a.dispose()}})},b}(bc),tc=bc.interval=function(a,b){return A(a,a,N(b)?b:Pb)};bc.timer=function(b,c,d){var e;return N(d)||(d=Pb),c!==a&&"number"==typeof c?e=c:N(c)&&(d=c),b instanceof Date&&e===a?x(b.getTime(),d):b instanceof Date&&e!==a?(e=c,y(b.getTime(),e,d)):e===a?z(b,d):A(b,e,d)}}$b.delay=function(a,b){return N(b)||(b=Pb),a instanceof Date?C(this,a.getTime(),b):B(this,a,b)},$b.throttle=function(a,b){N(b)||(b=Pb);var c=this;return new yc(function(d){var e,f=new Eb,g=!1,h=0,i=c.subscribe(function(c){g=!0,e=c,h++;var i=h,j=new Db;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 yb(i,f)})},$b.timestamp=function(a){return N(a)||(a=Pb),this.map(function(b){return{value:b,timestamp:a.now()}})},$b.sample=function(a,b){return N(b)||(b=Pb),"number"==typeof a?D(this,tc(a,b)):D(this,a)},$b.timeout=function(a,b,c){b||(b=ic(new Error("Timeout"))),N(c)||(c=Pb);var d=this,e=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new yc(function(f){function g(){var d=h;l.setDisposable(c[e](a,function(){h===d&&(T(b)&&(b=rc(b)),j.setDisposable(b.subscribe(f)))}))}var h=0,i=new Db,j=new Eb,k=!1,l=new Eb;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 yb(j,l)})};var uc=function(a){function b(a){var b=this.source.publish(),c=b.subscribe(a),d=Cb,e=this.pauser.distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=Cb)});return new yb(c,d,e)}function c(c,d){this.source=c,this.controller=new Bc,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b)}return ub(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(bc);$b.pausable=function(a){return new uc(this,a)};var vc=function(b){function c(b){var c,d=[],e=E(this.source,this.pauser.distinctUntilChanged().startWith(!1),function(a,b){return{data:a,shouldFire:b}}).subscribe(function(e){if(c!==a&&e.shouldFire!=c){if(c=e.shouldFire,e.shouldFire)for(;d.length>0;)b.onNext(d.shift())}else c=e.shouldFire,e.shouldFire?b.onNext(e.data):d.push(e.data)},function(a){for(;d.length>0;)b.onNext(d.shift());b.onError(a)},function(){for(;d.length>0;)b.onNext(d.shift());b.onCompleted()});return e}function d(a,d){this.source=a,this.controller=new Bc,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,b.call(this,c)}return ub(d,b),d.prototype.pause=function(){this.controller.onNext(!1)},d.prototype.resume=function(){this.controller.onNext(!0)},d}(bc);$b.pausableBuffered=function(a){return new vc(this,a)},$b.controlled=function(a){return null==a&&(a=!0),new wc(this,a)};var wc=function(a){function b(a){return this.source.subscribe(a)}function c(c,d){a.call(this,b),this.subject=new xc(d),this.source=c.multicast(this.subject).refCount()}return ub(c,a),c.prototype.request=function(a){return null==a&&(a=-1),this.subject.request(a)},c}(bc),xc=L.ControlledSubject=function(a){function c(a){return this.subject.subscribe(a)}function d(b){null==b&&(b=!0),a.call(this,c),this.subject=new Bc,this.enableQueue=b,this.queue=b?[]:null,this.requestedCount=0,this.requestedDisposable=Cb,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=Cb}return ub(d,a),vb(d.prototype,Yb,{onCompleted:function(){b.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(a){b.call(this),this.hasFailed=!0,this.error=a,this.enableQueue&&0!==this.queue.length||this.subject.onError(a)},onNext:function(a){b.call(this);var c=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(a):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),c=!0),c&&this.subject.onNext(a)},_processRequest:function(a){if(this.enableQueue){for(;this.queue.length>=a&&a>0;)this.subject.onNext(this.queue.shift()),a--;return 0!==this.queue.length?{numberOfItems:a,returnValue:!0}:{numberOfItems:a,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=Cb):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=Cb),{numberOfItems:a,returnValue:!1}},request:function(a){b.call(this),this.disposeCurrentRequest();var c=this,d=this._processRequest(a);return a=d.numberOfItems,d.returnValue?Cb:(this.requestedCount=a,this.requestedDisposable=Bb(function(){c.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=Cb},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),d}(bc);$b.exclusive=function(){var a=this;return new yc(function(b){var c=!1,d=!1,e=new Db,f=new yb;return f.add(e),e.setDisposable(a.subscribe(function(a){if(!c){c=!0,T(a)&&(a=rc(a));var e=new Db;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})},$b.exclusiveMap=function(a,b){var c=this;return new yc(function(d){var e=0,f=!1,g=!0,h=new Db,i=new yb;return i.add(h),h.setDisposable(c.subscribe(function(c){f||(f=!0,innerSubscription=new Db,i.add(innerSubscription),T(c)&&(c=rc(c)),innerSubscription.setDisposable(c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),function(){i.remove(innerSubscription),f=!1,g&&1===i.length&&d.onCompleted()})))},d.onError.bind(d),function(){g=!0,1!==i.length||f||d.onCompleted()})),i})};var yc=L.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?Bb(a):Cb}function c(d){function e(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new zc(a);return Kb.scheduleRequired()?Kb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return ub(c,a),c}(bc),zc=function(a){function b(b){a.call(this),this.observer=b,this.m=new Db}ub(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(_b),Ac=function(a,b){this.subject=a,this.observer=b};Ac.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 Bc=L.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),Cb):(a.onCompleted(),Cb):(this.observers.push(a),new Ac(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return ub(d,a),vb(d.prototype,Yb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new Dc(a,b)},d}(bc),Cc=L.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new Ac(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),Cb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return ub(d,a),vb(d.prototype,Yb,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(bc),Dc=L.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return ub(b,a),vb(b.prototype,Yb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(bc),Ec=L.BehaviorSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),a.onNext(this.value),new Ac(this,a);var c=this.exception;return c?a.onError(c):a.onCompleted(),Cb}function d(b){a.call(this,c),this.value=b,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return ub(d,a),vb(d.prototype,Yb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){this.isStopped=!0;for(var a=0,c=this.observers.slice(0),d=c.length;d>a;a++)c[a].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){this.isStopped=!0,this.exception=a;for(var c=0,d=this.observers.slice(0),e=d.length;e>c;c++)d[c].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped){this.value=a;for(var c=0,d=this.observers.slice(0),e=d.length;e>c;c++)d[c].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),d}(bc),Fc=L.ReplaySubject=function(a){function c(a,b){return Bb(function(){b.dispose(),!a.isDisposed&&a.observers.splice(a.observers.indexOf(b),1)})}function d(a){var d=new cc(this.scheduler,a),e=c(this,d);b.call(this),this._trim(this.scheduler.now()),this.observers.push(d);for(var f=this.q.length,g=0,h=this.q.length;h>g;g++)d.onNext(this.q[g].value);return this.hasError?(f++,d.onError(this.error)):this.isStopped&&(f++,d.onCompleted()),d.ensureActive(f),e}function e(b,c,e){this.bufferSize=null==b?Number.MAX_VALUE:b,this.windowSize=null==c?Number.MAX_VALUE:c,this.scheduler=e||Kb,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,d)}return ub(e,a),vb(e.prototype,Yb,{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(b.call(this),!this.isStopped){var c=this.scheduler.now();this.q.push({interval:c,value:a}),this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++){var g=d[e];g.onNext(a),g.ensureActive()}}},onError:function(a){if(b.call(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var c=this.scheduler.now();this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++){var g=d[e];g.onError(a),g.ensureActive()}this.observers=[]}},onCompleted:function(){if(b.call(this),!this.isStopped){this.isStopped=!0;var a=this.scheduler.now();this._trim(a);for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++){var f=c[d];f.onCompleted(),f.ensureActive()}this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),e}(bc);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(G.Rx=L,define(function(){return L})):H&&I?J?(I.exports=L).Rx=L:H.Rx=L:G.Rx=L}).call(this); | ||
(function(a){function b(){if(this.isDisposed)throw new Error(W)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;rb.nonEnumArgs&&a.length&&h(a)&&(a=tb.call(a));var d=rb.enumPrototypes&&"function"==typeof a,e=rb.enumErrorProps&&(a===lb||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(rb.nonEnumShadows&&a!==mb){var g=a.constructor,i=-1,j=pb.length;if(a===(g&&g.prototype))var k=a===stringProto?hb:a===lb?cb:ib.call(a),l=qb[k];for(;++i<j;)f=pb[i],l&&l[f]||!jb.call(a,f)||b.push(f)}return b}function e(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function f(a,b){return e(a,b,d)}function g(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function h(a){return a&&"object"==typeof a?ib.call(a)==$:!1}function i(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,j=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=j&&"object"!=j))return!1;var k=ib.call(a),l=ib.call(b);if(k==$&&(k=fb),l==$&&(l=fb),k!=l)return!1;switch(k){case ab:case bb:return+a==+b;case eb:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case gb:case hb:return a==String(b)}var m=k==_;if(!m){if(k!=fb||!rb.nodeClass&&(g(a)||g(b)))return!1;var n=!rb.argsObject&&h(a)?Object:a.constructor,o=!rb.argsObject&&h(b)?Object:b.constructor;if(!(n==o||jb.call(a,"constructor")&&jb.call(b,"constructor")||U(n)&&n instanceof n&&U(o)&&o instanceof o||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var p=c.length;p--;)if(c[p]==a)return d[p]==b;var q=0,r=!0;if(c.push(a),d.push(b),m){if(p=a.length,q=b.length,r=q==p)for(;q--;){var s=b[q];if(!(r=i(a[q],s,c,d)))break}}else f(b,function(b,e,f){return jb.call(f,e)?(q++,r=jb.call(a,e)&&i(a[e],b,c,d)):void 0}),r&&f(a,function(a,b,c){return jb.call(c,b)?r=--q>-1:void 0});return c.pop(),d.pop(),r}function j(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:tb.call(a)}function k(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function l(a,b){this.id=a,this.value=b}function m(a){return"number"==typeof a&&G.isFinite(a)}function n(b){return b[X]!==a}function o(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function p(a){var b=+a.length;return isNaN(b)?0:0!==b&&m(b)?(b=o(b)*Math.floor(Math.abs(b)),0>=b?0:b>fc?fc:b):b}function q(a){return"[object Function]"===Object.prototype.toString.call(a)&&"function"==typeof a}function r(a,b){return new zc(function(c){var d=new Db,e=new Eb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}T(f)&&(f=sc(f)),d=new Db,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function s(a,b){var c=this;return new zc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return void d.onError(i)}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function t(a,b,c){return a.map(function(d,e){var f=b.call(c,d,e,a);return T(f)&&(f=sc(f)),(Array.isArray(f)||n(f))&&(f=gc(f)),f}).concatAll()}function u(a,b,c){return a.map(function(d,e){var f=b.call(c,d,e,a);return T(f)&&(f=sc(f)),(Array.isArray(f)||n(f))&&(f=gc(f)),f}).mergeObservable()}function v(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),Bb(function(){a.removeEventListener(b,c,!1)});throw new Error("No listener found")}function w(a,b,c){var d=new yb;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(w(a.item(e),b,c));else a&&d.add(v(a,b,c));return d}function x(a,b){return new zc(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function y(a,b,c){return new zc(function(d){var e=0,f=a,g=Hb(b);return c.scheduleRecursiveWithAbsolute(f,function(a){if(g>0){var b=c.now();f+=g,b>=f&&(f=b+g)}d.onNext(e++),a(f)})})}function z(a,b){return new zc(function(c){return b.scheduleWithRelative(Hb(a),function(){c.onNext(0),c.onCompleted()})})}function A(a,b,c){return a===b?new zc(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):dc(function(){return y(c.now()+a,b,c)})}function B(a,b,c){return new zc(function(d){var e,f=!1,g=new Eb,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 Db,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 yb(e,g)})}function C(a,b,c){return dc(function(){return B(a,b-c.now(),c)})}function D(a,b){return new zc(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new yb(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))})}function E(a,b,c){return new zc(function(d){function e(a,b){j[b]=a;var e;if(g[b]=!0,h||(h=g.every(O))){try{e=c.apply(null,j)}catch(f){return void d.onError(f)}d.onNext(e)}else i&&d.onCompleted()}var f=2,g=[!1,!1],h=!1,i=!1,j=new Array(f);return new yb(a.subscribe(function(a){e(a,0)},d.onError.bind(d),function(){i=!0,d.onCompleted()}),b.subscribe(function(a){e(a,1)},d.onError.bind(d)))})}var F={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},G=F[typeof window]&&window||this,H=F[typeof exports]&&exports&&!exports.nodeType&&exports,I=F[typeof module]&&module&&!module.nodeType&&module,J=I&&I.exports===H&&H,K=F[typeof global]&&global;!K||K.global!==K&&K.window!==K||(G=K);var L={internals:{},config:{Promise:G.Promise},helpers:{}},M=L.helpers.noop=function(){},N=(L.helpers.notDefined=function(a){return"undefined"==typeof a},L.helpers.isScheduler=function(a){return a instanceof L.Scheduler}),O=L.helpers.identity=function(a){return a},P=(L.helpers.pluck=function(a){return function(b){return b[a]}},L.helpers.just=function(a){return function(){return a}},L.helpers.defaultNow=Date.now),Q=L.helpers.defaultComparer=function(a,b){return sb(a,b)},R=L.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},S=(L.helpers.defaultKeySerializer=function(a){return a.toString()},L.helpers.defaultError=function(a){throw a}),T=L.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},U=(L.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},L.helpers.not=function(a){return!a},L.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==ib.call(a)}),a}()),V="Argument out of range",W="Object has been disposed",X="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";G.Set&&"function"==typeof(new G.Set)["@@iterator"]&&(X="@@iterator");var Y=L.doneEnumerator={done:!0,value:a};L.iterator=X;var Z,$="[object Arguments]",_="[object Array]",ab="[object Boolean]",bb="[object Date]",cb="[object Error]",db="[object Function]",eb="[object Number]",fb="[object Object]",gb="[object RegExp]",hb="[object String]",ib=Object.prototype.toString,jb=Object.prototype.hasOwnProperty,kb=ib.call(arguments)==$,lb=Error.prototype,mb=Object.prototype,nb=mb.propertyIsEnumerable;try{Z=!(ib.call(document)==fb&&!({toString:0}+""))}catch(ob){Z=!0}var pb=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],qb={};qb[_]=qb[bb]=qb[eb]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},qb[ab]=qb[hb]={constructor:!0,toString:!0,valueOf:!0},qb[cb]=qb[db]=qb[gb]={constructor:!0,toString:!0},qb[fb]={constructor:!0};var rb={};!function(){var a=function(){this.x=1},b=[];a.prototype={valueOf:1,y:1};for(var c in new a)b.push(c);for(c in arguments);rb.enumErrorProps=nb.call(lb,"message")||nb.call(lb,"name"),rb.enumPrototypes=nb.call(a,"prototype"),rb.nonEnumArgs=0!=c,rb.nonEnumShadows=!/valueOf/.test(b)}(1),kb||(h=function(a){return a&&"object"==typeof a?jb.call(a,"callee"):!1});{var sb=L.internals.isEqual=function(a,b){return i(a,b,[],[])},tb=Array.prototype.slice,ub=({}.hasOwnProperty,this.inherits=L.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),vb=L.internals.addProperties=function(a){for(var b=tb.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}};L.internals.addRef=function(a,b){return new zc(function(c){return new yb(b.getDisposable(),a.subscribe(c))})}}l.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var wb=L.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},xb=wb.prototype;xb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},xb.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},xb.heapify=function(a){if(+a||(a=0),!(a>=this.length||0>a)){var b=2*a+1,c=2*a+2,d=a;if(b<this.length&&this.isHigherPriority(b,d)&&(d=b),c<this.length&&this.isHigherPriority(c,d)&&(d=c),d!==a){var e=this.items[a];this.items[a]=this.items[d],this.items[d]=e,this.heapify(d)}}},xb.peek=function(){return this.items[0].value},xb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},xb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},xb.enqueue=function(a){var b=this.length++;this.items[b]=new l(wb.count++,a),this.percolate(b)},xb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},wb.count=0;var yb=L.CompositeDisposable=function(){this.disposables=j(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},zb=yb.prototype;zb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},zb.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},zb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},zb.toArray=function(){return this.disposables.slice(0)};var Ab=L.Disposable=function(a){this.isDisposed=!1,this.action=a||M};Ab.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var Bb=Ab.create=function(a){return new Ab(a)},Cb=Ab.empty={dispose:M},Db=L.SingleAssignmentDisposable=function(){function a(){this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),Eb=L.SerialDisposable=Db,Fb=(L.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?Cb:new a(this)},b}(),L.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||R,this.disposable=new Db});Fb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Fb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Fb.prototype.isCancelled=function(){return this.disposable.isDisposed},Fb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Gb=L.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),Cb}var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=P,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Hb=Gb.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new yb,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),Cb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new yb,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),Cb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,d)},a.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,d)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})}}(Gb.prototype),function(){Gb.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},Gb.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof G.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=G.setInterval(function(){d=c(d)},b);return Bb(function(){G.clearInterval(e)})}}(Gb.prototype);var Ib,Jb=Gb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Hb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Gb(P,a,b,c)}(),Kb=Gb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Gb.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+Gb.normalize(c),g=new Fb(this,b,d,f);if(e)e.enqueue(g);else{e=new wb(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new Gb(P,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),Lb=(L.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new Db;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),M),Mb=function(){var a,b=M;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!G.setTimeout)throw new Error("No concurrency detected!");a=G.setTimeout,b=G.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),Nb=Mb.setTimeout,Ob=Mb.clearTimeout;!function(){function a(){if(!G.postMessage||G.importScripts)return!1;var a=!1,b=G.onmessage;return G.onmessage=function(){a=!0},G.postMessage("","*"),G.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(ib).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=K&&J&&K.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=K&&J&&K.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Ib=process.nextTick;else if("function"==typeof d)Ib=d,Lb=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;G.addEventListener?G.addEventListener("message",b,!1):G.attachEvent("onmessage",b,!1),Ib=function(a){var b=h++;g[b]=a,G.postMessage(f+b,"*")}}else if(G.MessageChannel){var i=new G.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Ib=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in G&&"onreadystatechange"in G.document.createElement("script")?Ib=function(a){var b=G.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},G.document.documentElement.appendChild(b)}:(Ib=function(a){return Nb(a,0)},Lb=Ob)}();var Pb=Gb.timeout=function(){function a(a,b){var c=this,d=new Db,e=Ib(function(){d.isDisposed||d.setDisposable(b(c,a))});return new yb(d,Bb(function(){Lb(e)}))}function b(a,b,c){var d=this,e=Gb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new Db,g=Nb(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new yb(f,Bb(function(){Ob(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Gb(P,a,b,c)}(),Qb=L.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}return a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return N(a)||(a=Jb),new zc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Rb=Qb.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new Qb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Sb=Qb.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new Qb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Tb=Qb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Qb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Ub=L.internals.Enumerator=function(a){this._next=a};Ub.prototype.next=function(){return this._next()},Ub.prototype[X]=function(){return this};var Vb=L.internals.Enumerable=function(a){this._iterator=a};Vb.prototype[X]=function(){return this._iterator()},Vb.prototype.concat=function(){var a=this;return new zc(function(b){var c;try{c=a[X]()}catch(d){return void b.onError()}var e,f=new Eb,g=Jb.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;T(h)&&(h=sc(h));var i=new Db;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new yb(f,g,Bb(function(){e=!0}))})},Vb.prototype.catchException=function(){var a=this;return new zc(function(b){var c;try{c=a[X]()}catch(d){return void b.onError()}var e,f,g=new Eb,h=Jb.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;T(i)&&(i=sc(i));var j=new Db;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new yb(g,h,Bb(function(){e=!0}))})};var Wb=Vb.repeat=function(a,b){return null==b&&(b=-1),new Vb(function(){var c=b;return new Ub(function(){return 0===c?Y:(c>0&&c--,{done:!1,value:a})})})},Xb=Vb.of=function(a,b,c){return b||(b=O),new Vb(function(){var d=-1;return new Ub(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:Y})})},Yb=L.Observer=function(){};Yb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Yb.prototype.asObserver=function(){return new ac(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))};var Zb=Yb.create=function(a,b,c){return a||(a=M),b||(b=S),c||(c=M),new ac(a,b,c)};Yb.fromNotifier=function(a,b){return new ac(function(c){return a.call(b,Rb(c))},function(c){return a.call(b,Sb(c))},function(){return a.call(b,Tb())})};var $b,_b=L.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return ub(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Yb),ac=L.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return ub(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(_b),bc=L.Observable=function(){function a(a){this._subscribe=a}return $b=a.prototype,$b.subscribe=$b.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:Zb(a,b,c))},$b.subscribeOnNext=function(a,b){return this._subscribe(Zb(2===arguments.length?function(c){a.call(b,c)}:a))},$b.subscribeOnError=function(a,b){return this._subscribe(Zb(null,2===arguments.length?function(c){a.call(b,c)}:a))},$b.subscribeOnCompleted=function(a,b){return this._subscribe(Zb(null,null,2===arguments.length?function(){a.call(b)}:a))},a}(),cc=L.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new Eb}return ub(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return void(b.isAcquired=!1);c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(_b);$b.toArray=function(){var a=this;return new zc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})})},bc.create=bc.createWithDisposable=function(a){return new zc(a)};{var dc=bc.defer=function(a){return new zc(function(b){var c;try{c=a()}catch(d){return jc(d).subscribe(b)}return T(c)&&(c=sc(c)),c.subscribe(b)})},ec=bc.empty=function(a){return N(a)||(a=Jb),new zc(function(b){return a.schedule(function(){b.onCompleted()})})},fc=Math.pow(2,53)-1,gc=bc.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!q(b))throw new Error("mapFn when provided must be a function");return N(d)||(d=Kb),new zc(function(e){var f=Object(a),g=n(f),h=g?0:p(f),i=g?f[X]():null,j=0;return d.scheduleRecursive(function(a){if(h>j||g){var d;if(g){var k;try{k=i.next()}catch(l){return void e.onError(l)}if(k.done)return void e.onCompleted();d=k.value}else d=f.charAt?f.charAt(j):f[j];if(b&&q(b))try{d=c?b.call(c,d,j):b(d,j)}catch(l){return void e.onError(l)}e.onNext(d),j++,a()}else e.onCompleted()})})},hc=bc.fromArray=function(a,b){return N(b)||(b=Kb),new zc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};bc.never=function(){return new zc(function(){return Cb})}}bc.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return hc(b)};bc.ofWithScheduler=function(a){for(var b=arguments.length-1,c=new Array(b),d=0;b>d;d++)c[d]=arguments[d+1];return hc(c,a)};bc.range=function(a,b,c){return N(c)||(c=Kb),new zc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},bc.repeat=function(a,b,c){return N(c)||(c=Kb),ic(a,c).repeat(null==b?-1:b)};var ic=bc["return"]=bc.returnValue=bc.just=function(a,b){return N(b)||(b=Jb),new zc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},jc=bc["throw"]=bc.throwException=bc.throwError=function(a,b){return N(b)||(b=Jb),new zc(function(c){return b.schedule(function(){c.onError(a)})})};$b["catch"]=$b.catchError=$b.catchException=function(a){return"function"==typeof a?r(this,a):kc([this,a])};var kc=bc.catchException=bc.catchError=bc["catch"]=function(){return Xb(j(arguments,0)).catchException()};$b.combineLatest=function(){var a=tb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),lc.apply(this,a)};var lc=bc.combineLatest=function(){var a=tb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new zc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(O))){try{d=b.apply(null,l)}catch(e){return void c.onError(e)}c.onNext(d)}else j.filter(function(b,c){return c!==a}).every(O)&&c.onCompleted()}function e(a){j[a]=!0,j.every(O)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=k(g,f),i=!1,j=k(g,f),l=new Array(g),m=new Array(g),n=0;g>n;n++)!function(b){var f=a[b],g=new Db;T(f)&&(f=sc(f)),g.setDisposable(f.subscribe(function(a){l[b]=a,d(b)},c.onError.bind(c),function(){e(b)})),m[b]=g}(n);return new yb(m)})};$b.concat=function(){var a=tb.call(arguments,0);return a.unshift(this),mc.apply(this,a)};var mc=bc.concat=function(){return Xb(j(arguments,0)).concat()};$b.concatObservable=$b.concatAll=function(){return this.merge(1)},$b.merge=function(a){if("number"!=typeof a)return nc(this,a);var b=this;return new zc(function(c){function d(a){var b=new Db;f.add(b),T(a)&&(a=sc(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){f.remove(b),h.length>0?d(h.shift()):(e--,g&&0===e&&c.onCompleted())}))}var e=0,f=new yb,g=!1,h=[];return f.add(b.subscribe(function(b){a>e?(e++,d(b)):h.push(b)},c.onError.bind(c),function(){g=!0,0===e&&c.onCompleted()})),f})};var nc=bc.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=tb.call(arguments,1)):(a=Jb,b=tb.call(arguments,0)):(a=Jb,b=tb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),hc(b,a).mergeObservable()};$b.mergeObservable=$b.mergeAll=function(){var a=this;return new zc(function(b){var c=new yb,d=!1,e=new Db;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new Db;c.add(e),T(a)&&(a=sc(a)),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},$b.skipUntil=function(a){var b=this;return new zc(function(c){var d=!1,e=new yb(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));T(a)&&(a=sc(a));var f=new Db;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},$b["switch"]=$b.switchLatest=function(){var a=this;return new zc(function(b){var c=!1,d=new Eb,e=!1,f=0,g=a.subscribe(function(a){var g=new Db,h=++f;c=!0,d.setDisposable(g),T(a)&&(a=sc(a)),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,!c&&b.onCompleted()});return new yb(g,d)})},$b.takeUntil=function(a){var b=this;return new zc(function(c){return T(a)&&(a=sc(a)),new yb(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),M))})},$b.zip=function(){if(Array.isArray(arguments[0]))return s.apply(this,arguments);var a=this,b=tb.call(arguments),c=b.pop();return b.unshift(a),new zc(function(d){function e(b){var e,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),e=c.apply(a,f)}catch(g){return void d.onError(g)}d.onNext(e)}else i.filter(function(a,c){return c!==b}).every(O)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=k(g,function(){return[]}),i=k(g,function(){return!1}),j=new Array(g),l=0;g>l;l++)!function(a){var c=b[a],g=new Db;T(c)&&(c=sc(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},d.onError.bind(d),function(){f(a)})),j[a]=g}(l);return new yb(j)})},bc.zip=function(){var a=tb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},bc.zipArray=function(){var a=j(arguments,0);return new zc(function(b){function c(a){if(f.every(function(a){return a.length>0})){var c=f.map(function(a){return a.shift()});b.onNext(c)}else if(g.filter(function(b,c){return c!==a}).every(O))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(O)?void b.onCompleted():void 0}for(var e=a.length,f=k(e,function(){return[]}),g=k(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new Db,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},b.onError.bind(b),function(){d(e)}))}(i);var j=new yb(h);return j.add(Bb(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},$b.asObservable=function(){return new zc(this.subscribe.bind(this))},$b.dematerialize=function(){var a=this;return new zc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},$b.distinctUntilChanged=function(a,b){var c=this;return a||(a=O),b||(b=Q),new zc(function(d){var e,f=!1;return c.subscribe(function(c){var g,h=!1;try{g=a(c)}catch(i){return void d.onError(i)}if(f)try{h=b(e,g)}catch(i){return void d.onError(i)}f&&h||(f=!0,e=g,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))})},$b["do"]=$b.doAction=$b.tap=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new zc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b)try{b(c)}catch(d){a.onError(d)}a.onError(c)},function(){if(c)try{c()}catch(b){a.onError(b)}a.onCompleted()})})},$b.doOnNext=$b.tapOnNext=function(a,b){return this.tap(2===arguments.length?function(c){a.call(b,c)}:a)},$b.doOnError=$b.tapOnError=function(a,b){return this.tap(M,2===arguments.length?function(c){a.call(b,c)}:a)},$b.doOnCompleted=$b.tapOnCompleted=function(a,b){return this.tap(M,null,2===arguments.length?function(){a.call(b)}:a)},$b["finally"]=$b.finallyAction=function(a){var b=this;return new zc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return Bb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},$b.ignoreElements=function(){var a=this;return new zc(function(b){return a.subscribe(M,b.onError.bind(b),b.onCompleted.bind(b))})},$b.materialize=function(){var a=this;return new zc(function(b){return a.subscribe(function(a){b.onNext(Rb(a))},function(a){b.onNext(Sb(a)),b.onCompleted()},function(){b.onNext(Tb()),b.onCompleted()})})},$b.repeat=function(a){return Wb(this,a).concat() | ||
},$b.retry=function(a){return Wb(this,a).catchException()},$b.scan=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new zc(function(e){var f,g,h;return d.subscribe(function(d){!h&&(h=!0);try{f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return void e.onError(i)}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},$b.skipLast=function(a){var b=this;return new zc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},$b.startWith=function(){var a,b,c=0;return arguments.length&&N(arguments[0])?(b=arguments[0],c=1):b=Jb,a=tb.call(arguments,c),Xb([hc(a,b),this]).concat()},$b.takeLast=function(a){var b=this;return new zc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})})},$b.selectConcat=$b.concatMap=function(a,b,c){return"function"==typeof a&&"function"==typeof b?this.concatMap(function(c,d){var e=a(c,d);return T(e)&&(e=sc(e)),(Array.isArray(e)||n(e))&&(e=gc(e)),e.map(function(a,e){return b(c,a,d,e)})}):"function"==typeof a?t(this,a,c):t(this,function(){return a})},$b.select=$b.map=function(a,b){var c=this;return new zc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},$b.pluck=function(a){return this.map(function(b){return b[a]})},$b.selectMany=$b.flatMap=function(a,b,c){return"function"==typeof a&&"function"==typeof b?this.flatMap(function(c,d){var e=a(c,d);return T(e)&&(e=sc(e)),(Array.isArray(e)||n(e))&&(e=gc(e)),e.map(function(a,e){return b(c,a,d,e)})},c):"function"==typeof a?u(this,a,c):u(this,function(){return a})},$b.selectSwitch=$b.flatMapLatest=$b.switchMap=function(a,b){return this.select(a,b).switchLatest()},$b.skip=function(a){if(0>a)throw new Error(V);var b=this;return new zc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},$b.skipWhile=function(a,b){var c=this;return new zc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},$b.take=function(a,b){if(0>a)throw new RangeError(V);if(0===a)return ec(b);var c=this;return new zc(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},$b.takeWhile=function(a,b){var c=this;return new zc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},$b.where=$b.filter=function(a,b){var c=this;return new zc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},bc.fromCallback=function(a,b,c){return function(){var d=tb.call(arguments,0);return new zc(function(e){function f(a){var b=a;if(c){try{b=c(arguments)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},bc.fromNodeCallback=function(a,b,c){return function(){var d=tb.call(arguments,0);return new zc(function(e){function f(a){if(a)return void e.onError(a);var b=tb.call(arguments,1);if(c){try{b=c(b)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},L.config.useNativeEvents=!1;var oc=G.angular&&angular.element?angular.element:G.jQuery?G.jQuery:G.Zepto?G.Zepto:null,pc=!!G.Ember&&"function"==typeof G.Ember.addListener,qc=!!G.Backbone&&!!G.Backbone.Marionette;bc.fromEvent=function(a,b,c){if(a.addListener)return rc(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},c);if(!L.config.useNativeEvents){if(qc)return rc(function(c){a.on(b,c)},function(c){a.off(b,c)},c);if(pc)return rc(function(c){Ember.addListener(a,b,c)},function(c){Ember.removeListener(a,b,c)},c);if(oc){var d=oc(a);return rc(function(a){d.on(b,a)},function(a){d.off(b,a)},c)}}return new zc(function(d){return w(a,b,function(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)})}).publish().refCount()};var rc=bc.fromEventPattern=function(a,b,c){return new zc(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)}var f=a(e);return Bb(function(){b&&b(e,f)})}).publish().refCount()},sc=bc.fromPromise=function(a){return dc(function(){var b=new L.AsyncSubject;return a.then(function(a){b.isDisposed||(b.onNext(a),b.onCompleted())},b.onError.bind(b)),b})};$b.toPromise=function(a){if(a||(a=L.config.Promise),!a)throw new TypeError("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},c,function(){e&&a(d)})})},bc.startAsync=function(a){var b;try{b=a()}catch(c){return jc(c)}return sc(b)},$b.multicast=function(a,b){var c=this;return"function"==typeof a?new zc(function(d){var e=c.multicast(a());return new yb(b(e).subscribe(d),e.connect())}):new tc(c,a)},$b.publish=function(a){return a&&U(a)?this.multicast(function(){return new Cc},a):this.multicast(new Cc)},$b.share=function(){return this.publish().refCount()},$b.publishLast=function(a){return a&&U(a)?this.multicast(function(){return new Dc},a):this.multicast(new Dc)},$b.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new Fc(b)},a):this.multicast(new Fc(a))},$b.shareValue=function(a){return this.publishValue(a).refCount()},$b.replay=function(a,b,c,d){return a&&U(a)?this.multicast(function(){return new Gc(b,c,d)},a):this.multicast(new Gc(b,c,d))},$b.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};{var tc=L.ConnectableObservable=function(a){function b(b,c){var d,e=!1,f=b.asObservable();this.connect=function(){return e||(e=!0,d=new yb(f.subscribe(c),Bb(function(){e=!1}))),d},a.call(this,c.subscribe.bind(c))}return ub(b,a),b.prototype.refCount=function(){var a,b=0,c=this;return new zc(function(d){var e=1===++b,f=c.subscribe(d);return e&&(a=c.connect()),function(){f.dispose(),0===--b&&a.dispose()}})},b}(bc),uc=bc.interval=function(a,b){return A(a,a,N(b)?b:Pb)};bc.timer=function(b,c,d){var e;return N(d)||(d=Pb),c!==a&&"number"==typeof c?e=c:N(c)&&(d=c),b instanceof Date&&e===a?x(b.getTime(),d):b instanceof Date&&e!==a?(e=c,y(b.getTime(),e,d)):e===a?z(b,d):A(b,e,d)}}$b.delay=function(a,b){return N(b)||(b=Pb),a instanceof Date?C(this,a.getTime(),b):B(this,a,b)},$b.throttle=function(a,b){N(b)||(b=Pb);var c=this;return new zc(function(d){var e,f=new Eb,g=!1,h=0,i=c.subscribe(function(c){g=!0,e=c,h++;var i=h,j=new Db;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 yb(i,f)})},$b.timestamp=function(a){return N(a)||(a=Pb),this.map(function(b){return{value:b,timestamp:a.now()}})},$b.sample=function(a,b){return N(b)||(b=Pb),"number"==typeof a?D(this,uc(a,b)):D(this,a)},$b.timeout=function(a,b,c){(null==b||"string"==typeof b)&&(b=jc(new Error(b||"Timeout"))),N(c)||(c=Pb);var d=this,e=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new zc(function(f){function g(){var d=h;l.setDisposable(c[e](a,function(){h===d&&(T(b)&&(b=sc(b)),j.setDisposable(b.subscribe(f)))}))}var h=0,i=new Db,j=new Eb,k=!1,l=new Eb;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 yb(j,l)})};var vc=function(a){function b(a){var b=this.source.publish(),c=b.subscribe(a),d=Cb,e=this.pauser.distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=Cb)});return new yb(c,d,e)}function c(c,d){this.source=c,this.controller=new Cc,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b)}return ub(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(bc);$b.pausable=function(a){return new vc(this,a)};var wc=function(b){function c(b){var c,d=[],e=E(this.source,this.pauser.distinctUntilChanged().startWith(!1),function(a,b){return{data:a,shouldFire:b}}).subscribe(function(e){if(c!==a&&e.shouldFire!=c){if(c=e.shouldFire,e.shouldFire)for(;d.length>0;)b.onNext(d.shift())}else c=e.shouldFire,e.shouldFire?b.onNext(e.data):d.push(e.data)},function(a){for(;d.length>0;)b.onNext(d.shift());b.onError(a)},function(){for(;d.length>0;)b.onNext(d.shift());b.onCompleted()});return e}function d(a,d){this.source=a,this.controller=new Cc,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,b.call(this,c)}return ub(d,b),d.prototype.pause=function(){this.controller.onNext(!1)},d.prototype.resume=function(){this.controller.onNext(!0)},d}(bc);$b.pausableBuffered=function(a){return new wc(this,a)},$b.controlled=function(a){return null==a&&(a=!0),new xc(this,a)};var xc=function(a){function b(a){return this.source.subscribe(a)}function c(c,d){a.call(this,b),this.subject=new yc(d),this.source=c.multicast(this.subject).refCount()}return ub(c,a),c.prototype.request=function(a){return null==a&&(a=-1),this.subject.request(a)},c}(bc),yc=L.ControlledSubject=function(a){function c(a){return this.subject.subscribe(a)}function d(b){null==b&&(b=!0),a.call(this,c),this.subject=new Cc,this.enableQueue=b,this.queue=b?[]:null,this.requestedCount=0,this.requestedDisposable=Cb,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=Cb}return ub(d,a),vb(d.prototype,Yb,{onCompleted:function(){b.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(a){b.call(this),this.hasFailed=!0,this.error=a,this.enableQueue&&0!==this.queue.length||this.subject.onError(a)},onNext:function(a){b.call(this);var c=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(a):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),c=!0),c&&this.subject.onNext(a)},_processRequest:function(a){if(this.enableQueue){for(;this.queue.length>=a&&a>0;)this.subject.onNext(this.queue.shift()),a--;return 0!==this.queue.length?{numberOfItems:a,returnValue:!0}:{numberOfItems:a,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=Cb):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=Cb),{numberOfItems:a,returnValue:!1}},request:function(a){b.call(this),this.disposeCurrentRequest();var c=this,d=this._processRequest(a);return a=d.numberOfItems,d.returnValue?Cb:(this.requestedCount=a,this.requestedDisposable=Bb(function(){c.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=Cb},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),d}(bc);$b.transduce=function(a){function b(a){return{init:function(){return a},step:function(a,b){return a.onNext(b)},result:function(a){return a.onCompleted()}}}var c=this;return new zc(function(d){var e=a(b(d));return c.subscribe(function(a){try{e.step(d,a)}catch(b){d.onError(b)}},d.onError.bind(d),function(){e.result(d)})})};var zc=L.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?Bb(a):Cb}function c(d){function e(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new Ac(a);return Kb.scheduleRequired()?Kb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return ub(c,a),c}(bc),Ac=function(a){function b(b){a.call(this),this.observer=b,this.m=new Db}ub(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(_b),Bc=function(a,b){this.subject=a,this.observer=b};Bc.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 Cc=L.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),Cb):(a.onCompleted(),Cb):(this.observers.push(a),new Bc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return ub(d,a),vb(d.prototype,Yb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new Ec(a,b)},d}(bc),Dc=L.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new Bc(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),Cb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return ub(d,a),vb(d.prototype,Yb,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(bc),Ec=L.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return ub(b,a),vb(b.prototype,Yb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(bc),Fc=L.BehaviorSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),a.onNext(this.value),new Bc(this,a);var c=this.exception;return c?a.onError(c):a.onCompleted(),Cb}function d(b){a.call(this,c),this.value=b,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return ub(d,a),vb(d.prototype,Yb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){this.isStopped=!0;for(var a=0,c=this.observers.slice(0),d=c.length;d>a;a++)c[a].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){this.isStopped=!0,this.exception=a;for(var c=0,d=this.observers.slice(0),e=d.length;e>c;c++)d[c].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped){this.value=a;for(var c=0,d=this.observers.slice(0),e=d.length;e>c;c++)d[c].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),d}(bc),Gc=L.ReplaySubject=function(a){function c(a,b){return Bb(function(){b.dispose(),!a.isDisposed&&a.observers.splice(a.observers.indexOf(b),1)})}function d(a){var d=new cc(this.scheduler,a),e=c(this,d);b.call(this),this._trim(this.scheduler.now()),this.observers.push(d);for(var f=this.q.length,g=0,h=this.q.length;h>g;g++)d.onNext(this.q[g].value);return this.hasError?(f++,d.onError(this.error)):this.isStopped&&(f++,d.onCompleted()),d.ensureActive(f),e}function e(b,c,e){this.bufferSize=null==b?Number.MAX_VALUE:b,this.windowSize=null==c?Number.MAX_VALUE:c,this.scheduler=e||Kb,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,d)}return ub(e,a),vb(e.prototype,Yb,{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(b.call(this),!this.isStopped){var c=this.scheduler.now();this.q.push({interval:c,value:a}),this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++){var g=d[e];g.onNext(a),g.ensureActive()}}},onError:function(a){if(b.call(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var c=this.scheduler.now();this._trim(c);for(var d=this.observers.slice(0),e=0,f=d.length;f>e;e++){var g=d[e];g.onError(a),g.ensureActive()}this.observers=[]}},onCompleted:function(){if(b.call(this),!this.isStopped){this.isStopped=!0;var a=this.scheduler.now();this._trim(a);for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++){var f=c[d];f.onCompleted(),f.ensureActive()}this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),e}(bc);"function"==typeof define&&"object"==typeof define.amd&&define.amd?(G.Rx=L,define(function(){return L})):H&&I?J?(I.exports=L).Rx=L:H.Rx=L:G.Rx=L}).call(this); | ||
//# sourceMappingURL=rx.lite.map |
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/ | ||
(function(a){function b(){if(this.isDisposed)throw new Error(P)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;kb.nonEnumArgs&&a.length&&h(a)&&(a=mb.call(a));var d=kb.enumPrototypes&&"function"==typeof a,e=kb.enumErrorProps&&(a===eb||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(kb.nonEnumShadows&&a!==fb){var g=a.constructor,i=-1,j=ib.length;if(a===(g&&g.prototype))var k=a===stringProto?ab:a===eb?X:bb.call(a),l=jb[k];for(;++i<j;)f=ib[i],l&&l[f]||!cb.call(a,f)||b.push(f)}return b}function e(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function f(a,b){return e(a,b,d)}function g(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function h(a){return a&&"object"==typeof a?bb.call(a)==T:!1}function i(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,j=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=j&&"object"!=j))return!1;var k=bb.call(a),l=bb.call(b);if(k==T&&(k=$),l==T&&(l=$),k!=l)return!1;switch(k){case V:case W:return+a==+b;case Z:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case _:case ab:return a==String(b)}var m=k==U;if(!m){if(k!=$||!kb.nodeClass&&(g(a)||g(b)))return!1;var n=!kb.argsObject&&h(a)?Object:a.constructor,o=!kb.argsObject&&h(b)?Object:b.constructor;if(!(n==o||cb.call(a,"constructor")&&cb.call(b,"constructor")||N(n)&&n instanceof n&&N(o)&&o instanceof o||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var p=c.length;p--;)if(c[p]==a)return d[p]==b;var q=0;if(result=!0,c.push(a),d.push(b),m){if(p=a.length,q=b.length,result=q==p)for(;q--;){var r=b[q];if(!(result=i(a[q],r,c,d)))break}}else f(b,function(b,e,f){return cb.call(f,e)?(q++,result=cb.call(a,e)&&i(a[e],b,c,d)):void 0}),result&&f(a,function(a,b,c){return cb.call(c,b)?result=--q>-1:void 0});return c.pop(),d.pop(),result}function j(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:mb.call(a)}function k(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function l(a,b){this.id=a,this.value=b}function m(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function n(a){return"number"==typeof a&&z.isFinite(a)}function o(b){return b[Q]!==a}function p(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function q(a){var b=+a.length;return isNaN(b)?0:0!==b&&n(b)?(b=p(b)*Math.floor(Math.abs(b)),0>=b?0:b>dc?dc:b):b}function r(a){return"[object Function]"===Object.prototype.toString.call(a)&&"function"==typeof a}function s(a,b){return new nc(function(c){var d=new xb,e=new yb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}M(f)&&(f=ac(f)),d=new xb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function t(a,b){var c=this;return new nc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return void d.onError(i)}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function u(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return M(e)?ac(e):e}).concatAll()}function v(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function w(a){this.comparer=a,this.set=[]}function x(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return M(e)?ac(e):e}).mergeObservable()}var y={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},z=y[typeof window]&&window||this,A=y[typeof exports]&&exports&&!exports.nodeType&&exports,B=y[typeof module]&&module&&!module.nodeType&&module,C=B&&B.exports===A&&A,D=y[typeof global]&&global;!D||D.global!==D&&D.window!==D||(z=D);var E={internals:{},config:{Promise:z.Promise},helpers:{}},F=E.helpers.noop=function(){},G=(E.helpers.notDefined=function(a){return"undefined"==typeof a},E.helpers.isScheduler=function(a){return a instanceof E.Scheduler}),H=E.helpers.identity=function(a){return a},I=(E.helpers.pluck=function(a){return function(b){return b[a]}},E.helpers.just=function(a){return function(){return a}},E.helpers.defaultNow=Date.now),J=E.helpers.defaultComparer=function(a,b){return lb(a,b)},K=E.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},L=(E.helpers.defaultKeySerializer=function(a){return a.toString()},E.helpers.defaultError=function(a){throw a}),M=E.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},N=(E.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},E.helpers.not=function(a){return!a},E.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==bb.call(a)}),a}()),O="Argument out of range",P="Object has been disposed",Q="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";z.Set&&"function"==typeof(new z.Set)["@@iterator"]&&(Q="@@iterator");var R=E.doneEnumerator={done:!0,value:a};E.iterator=Q;var S,T="[object Arguments]",U="[object Array]",V="[object Boolean]",W="[object Date]",X="[object Error]",Y="[object Function]",Z="[object Number]",$="[object Object]",_="[object RegExp]",ab="[object String]",bb=Object.prototype.toString,cb=Object.prototype.hasOwnProperty,db=bb.call(arguments)==T,eb=Error.prototype,fb=Object.prototype,gb=fb.propertyIsEnumerable;try{S=!(bb.call(document)==$&&!({toString:0}+""))}catch(hb){S=!0}var ib=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],jb={};jb[U]=jb[W]=jb[Z]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},jb[V]=jb[ab]={constructor:!0,toString:!0,valueOf:!0},jb[X]=jb[Y]=jb[_]={constructor:!0,toString:!0},jb[$]={constructor:!0};var kb={};!function(){var a=function(){this.x=1},b=[];a.prototype={valueOf:1,y:1};for(var c in new a)b.push(c);for(c in arguments);kb.enumErrorProps=gb.call(eb,"message")||gb.call(eb,"name"),kb.enumPrototypes=gb.call(a,"prototype"),kb.nonEnumArgs=0!=c,kb.nonEnumShadows=!/valueOf/.test(b)}(1),db||(h=function(a){return a&&"object"==typeof a?cb.call(a,"callee"):!1});var lb=E.internals.isEqual=function(a,b){return i(a,b,[],[])},mb=Array.prototype.slice,nb=({}.hasOwnProperty,this.inherits=E.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),ob=E.internals.addProperties=function(a){for(var b=mb.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},pb=E.internals.addRef=function(a,b){return new nc(function(c){return new sb(b.getDisposable(),a.subscribe(c))})};l.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var qb=E.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},rb=qb.prototype;rb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},rb.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},rb.heapify=function(a){if(+a||(a=0),!(a>=this.length||0>a)){var b=2*a+1,c=2*a+2,d=a;if(b<this.length&&this.isHigherPriority(b,d)&&(d=b),c<this.length&&this.isHigherPriority(c,d)&&(d=c),d!==a){var e=this.items[a];this.items[a]=this.items[d],this.items[d]=e,this.heapify(d)}}},rb.peek=function(){return this.items[0].value},rb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},rb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},rb.enqueue=function(a){var b=this.length++;this.items[b]=new l(qb.count++,a),this.percolate(b)},rb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},qb.count=0;var sb=E.CompositeDisposable=function(){this.disposables=j(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},tb=sb.prototype;tb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},tb.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},tb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},tb.toArray=function(){return this.disposables.slice(0)};var ub=E.Disposable=function(a){this.isDisposed=!1,this.action=a||F};ub.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var vb=ub.create=function(a){return new ub(a)},wb=ub.empty={dispose:F},xb=E.SingleAssignmentDisposable=function(){function a(){this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),yb=E.SerialDisposable=xb,zb=E.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?wb:new a(this)},b}();m.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var Ab=E.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||K,this.disposable=new xb};Ab.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Ab.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Ab.prototype.isCancelled=function(){return this.disposable.isDisposed},Ab.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Bb=E.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),wb}var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=I,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Cb=Bb.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new sb,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),wb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new sb,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),wb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,d)},a.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,d)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})}}(Bb.prototype),function(){Bb.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},Bb.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof z.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=z.setInterval(function(){d=c(d)},b);return vb(function(){z.clearInterval(e)})}}(Bb.prototype),function(a){a.catchError=a["catch"]=function(a){return new Kb(this,a)}}(Bb.prototype);var Db,Eb=(E.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new xb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),Bb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Cb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Bb(I,a,b,c)}()),Fb=Bb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Bb.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+Bb.normalize(c),g=new Ab(this,b,d,f);if(e)e.enqueue(g);else{e=new qb(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new Bb(I,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),Gb=F,Hb=function(){var a,b=F;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!z.setTimeout)throw new Error("No concurrency detected!");a=z.setTimeout,b=z.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),Ib=Hb.setTimeout,Jb=Hb.clearTimeout;!function(){function a(){if(!z.postMessage||z.importScripts)return!1;var a=!1,b=z.onmessage;return z.onmessage=function(){a=!0},z.postMessage("","*"),z.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(bb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=D&&C&&D.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=D&&C&&D.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Db=process.nextTick;else if("function"==typeof d)Db=d,Gb=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;z.addEventListener?z.addEventListener("message",b,!1):z.attachEvent("onmessage",b,!1),Db=function(a){var b=h++;g[b]=a,z.postMessage(f+b,"*")}}else if(z.MessageChannel){var i=new z.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Db=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in z&&"onreadystatechange"in z.document.createElement("script")?Db=function(a){var b=z.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},z.document.documentElement.appendChild(b)}:(Db=function(a){return Ib(a,0)},Gb=Jb)}();var Kb=(Bb.timeout=function(){function a(a,b){var c=this,d=new xb,e=Db(function(){d.isDisposed||d.setDisposable(b(c,a))});return new sb(d,vb(function(){Gb(e)}))}function b(a,b,c){var d=this,e=Bb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new xb,g=Ib(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new sb(f,vb(function(){Jb(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Bb(I,a,b,c)}(),function(a){function b(){return this._scheduler.now()}function c(a,b){return this._scheduler.scheduleWithState(a,this._wrap(b))}function d(a,b,c){return this._scheduler.scheduleWithRelativeAndState(a,b,this._wrap(c))}function e(a,b,c){return this._scheduler.scheduleWithAbsoluteAndState(a,b,this._wrap(c))}function f(f,g){this._scheduler=f,this._handler=g,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this,b,c,d,e)}return nb(f,a),f.prototype._clone=function(a){return new f(a,this._handler)},f.prototype._wrap=function(a){var b=this;return function(c,d){try{return a(b._getRecursiveWrapper(c),d)}catch(e){if(!b._handler(e))throw e;return wb}}},f.prototype._getRecursiveWrapper=function(a){if(this._recursiveOriginal!==a){this._recursiveOriginal=a;var b=this._clone(a);b._recursiveOriginal=a,b._recursiveWrapper=b,this._recursiveWrapper=b}return this._recursiveWrapper},f.prototype.schedulePeriodicWithState=function(a,b,c){var d=this,e=!1,f=new xb;return f.setDisposable(this._scheduler.schedulePeriodicWithState(a,b,function(a){if(e)return null;try{return c(a)}catch(b){if(e=!0,!d._handler(b))throw b;return f.dispose(),null}})),f},f}(Bb)),Lb=E.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}return a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return G(a)||(a=Eb),new nc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Mb=Lb.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new Lb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Nb=Lb.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new Lb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Ob=Lb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Lb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Pb=E.internals.Enumerator=function(a){this._next=a};Pb.prototype.next=function(){return this._next()},Pb.prototype[Q]=function(){return this};var Qb=E.internals.Enumerable=function(a){this._iterator=a};Qb.prototype[Q]=function(){return this._iterator()},Qb.prototype.concat=function(){var a=this;return new nc(function(b){var c;try{c=a[Q]()}catch(d){return void b.onError()}var e,f=new yb,g=Eb.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;M(h)&&(h=ac(h));var i=new xb;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new sb(f,g,vb(function(){e=!0}))})},Qb.prototype.catchException=function(){var a=this;return new nc(function(b){var c;try{c=a[Q]()}catch(d){return void b.onError()}var e,f,g=new yb,h=Eb.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;M(i)&&(i=ac(i));var j=new xb;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new sb(g,h,vb(function(){e=!0}))})};var Rb=Qb.repeat=function(a,b){return null==b&&(b=-1),new Qb(function(){var c=b;return new Pb(function(){return 0===c?R:(c>0&&c--,{done:!1,value:a})})})},Sb=Qb.of=function(a,b,c){return b||(b=H),new Qb(function(){var d=-1;return new Pb(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:R})})},Tb=E.Observer=function(){};Tb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Tb.prototype.asObserver=function(){return new Xb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Tb.prototype.checked=function(){return new Yb(this)};var Ub=Tb.create=function(a,b,c){return a||(a=F),b||(b=L),c||(c=F),new Xb(a,b,c)};Tb.fromNotifier=function(a,b){return new Xb(function(c){return a.call(b,Mb(c))},function(c){return a.call(b,Nb(c))},function(){return a.call(b,Ob())})},Tb.notifyOn=function(a){return new $b(a,this)};var Vb,Wb=E.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return nb(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Tb),Xb=E.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return nb(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(Wb),Yb=function(a){function b(b){a.call(this),this._observer=b,this._state=0}nb(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();try{this._observer.onNext(a)}catch(b){throw b}finally{this._state=0}},c.onError=function(a){this.checkAccess();try{this._observer.onError(a)}catch(b){throw b}finally{this._state=2}},c.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(a){throw a}finally{this._state=2}},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}(Tb),Zb=E.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new yb}return nb(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return void(b.isAcquired=!1);c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Wb),$b=function(a){function b(){a.apply(this,arguments)}return nb(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}(Zb),_b=E.Observable=function(){function a(a){this._subscribe=a}return Vb=a.prototype,Vb.subscribe=Vb.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:Ub(a,b,c))},Vb.subscribeOnNext=function(a,b){return this._subscribe(Ub(2===arguments.length?function(c){a.call(b,c)}:a))},Vb.subscribeOnError=function(a,b){return this._subscribe(Ub(null,2===arguments.length?function(c){a.call(b,c)}:a))},Vb.subscribeOnCompleted=function(a,b){return this._subscribe(Ub(null,null,2===arguments.length?function(){a.call(b)}:a))},a}();Vb.observeOn=function(a){var b=this;return new nc(function(c){return b.subscribe(new $b(a,c))})},Vb.subscribeOn=function(a){var b=this;return new nc(function(c){var d=new xb,e=new yb;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new m(a,b.subscribe(c)))})),e})};var ac=_b.fromPromise=function(a){return bc(function(){var b=new E.AsyncSubject;return a.then(function(a){b.isDisposed||(b.onNext(a),b.onCompleted())},b.onError.bind(b)),b})};Vb.toPromise=function(a){if(a||(a=E.config.Promise),!a)throw new TypeError("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},c,function(){e&&a(d)})})},Vb.toArray=function(){var a=this;return new nc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})})},_b.create=_b.createWithDisposable=function(a){return new nc(a)};var bc=_b.defer=function(a){return new nc(function(b){var c;try{c=a()}catch(d){return hc(d).subscribe(b)}return M(c)&&(c=ac(c)),c.subscribe(b)})},cc=_b.empty=function(a){return G(a)||(a=Eb),new nc(function(b){return a.schedule(function(){b.onCompleted()})})},dc=Math.pow(2,53)-1;_b.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!r(b))throw new Error("mapFn when provided must be a function");return G(d)||(d=Fb),new nc(function(e){var f=Object(a),g=o(f),h=g?0:q(f),i=g?f[Q]():null,j=0;return d.scheduleRecursive(function(a){if(h>j||g){var d;if(g){var k=i.next();if(k.done)return void e.onCompleted();d=k.value}else d=f[j];if(b&&r(b))try{d=c?b.call(c,d,j):b(d,j)}catch(l){return void e.onError(l)}e.onNext(d),j++,a()}else e.onCompleted()})})};var ec=_b.fromArray=function(a,b){return G(b)||(b=Fb),new nc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};_b.generate=function(a,b,c,d,e){return G(e)||(e=Fb),new nc(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return void f.onError(j)}e?(f.onNext(i),a()):f.onCompleted()})})};var fc=_b.never=function(){return new nc(function(){return wb})};_b.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return ec(b)};_b.ofWithScheduler=function(a){for(var b=arguments.length-1,c=new Array(b),d=0;b>d;d++)c[d]=arguments[d+1];return ec(c,a)};_b.range=function(a,b,c){return G(c)||(c=Fb),new nc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},_b.repeat=function(a,b,c){return G(c)||(c=Fb),gc(a,c).repeat(null==b?-1:b)};var gc=_b["return"]=_b.returnValue=_b.just=function(a,b){return G(b)||(b=Eb),new nc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},hc=_b["throw"]=_b.throwException=_b.throwError=function(a,b){return G(b)||(b=Eb),new nc(function(c){return b.schedule(function(){c.onError(a)})})};_b.using=function(a,b){return new nc(function(c){var d,e,f=wb;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new sb(hc(g).subscribe(c),f)}return new sb(e.subscribe(c),f)})},Vb.amb=function(a){var b=this;return new nc(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new xb,j=new xb;return M(a)&&(a=ac(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 sb(i,j)})},_b.amb=function(){function a(a,b){return a.amb(b)}for(var b=fc(),c=j(arguments,0),d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},Vb["catch"]=Vb.catchError=Vb.catchException=function(a){return"function"==typeof a?s(this,a):ic([this,a])};var ic=_b.catchException=_b.catchError=_b["catch"]=function(){return Sb(j(arguments,0)).catchException()};Vb.combineLatest=function(){var a=mb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),jc.apply(this,a)};var jc=_b.combineLatest=function(){var a=mb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new nc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(H))){try{d=b.apply(null,l)}catch(e){return void c.onError(e)}c.onNext(d)}else j.filter(function(b,c){return c!==a}).every(H)&&c.onCompleted()}function e(a){j[a]=!0,j.every(H)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=k(g,f),i=!1,j=k(g,f),l=new Array(g),m=new Array(g),n=0;g>n;n++)!function(b){var f=a[b],g=new xb;M(f)&&(f=ac(f)),g.setDisposable(f.subscribe(function(a){l[b]=a,d(b)},c.onError.bind(c),function(){e(b)})),m[b]=g}(n);return new sb(m)})};Vb.concat=function(){var a=mb.call(arguments,0);return a.unshift(this),kc.apply(this,a)};var kc=_b.concat=function(){return Sb(j(arguments,0)).concat()};Vb.concatObservable=Vb.concatAll=function(){return this.merge(1)},Vb.merge=function(a){if("number"!=typeof a)return lc(this,a);var b=this;return new nc(function(c){function d(a){var b=new xb;f.add(b),M(a)&&(a=ac(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){f.remove(b),h.length>0?d(h.shift()):(e--,g&&0===e&&c.onCompleted())}))}var e=0,f=new sb,g=!1,h=[];return f.add(b.subscribe(function(b){a>e?(e++,d(b)):h.push(b)},c.onError.bind(c),function(){g=!0,0===e&&c.onCompleted()})),f})};var lc=_b.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=mb.call(arguments,1)):(a=Eb,b=mb.call(arguments,0)):(a=Eb,b=mb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),ec(b,a).mergeObservable()};Vb.mergeObservable=Vb.mergeAll=function(){var a=this;return new nc(function(b){var c=new sb,d=!1,e=new xb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new xb;c.add(e),M(a)&&(a=ac(a)),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Vb.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return mc([this,a])};var mc=_b.onErrorResumeNext=function(){var a=j(arguments,0);return new nc(function(b){var c=0,d=new yb,e=Eb.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],M(f)&&(f=ac(f)),g=new xb,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new sb(d,e)})};Vb.skipUntil=function(a){var b=this;return new nc(function(c){var d=!1,e=new sb(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));M(a)&&(a=ac(a));var f=new xb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Vb["switch"]=Vb.switchLatest=function(){var a=this;return new nc(function(b){var c=!1,d=new yb,e=!1,f=0,g=a.subscribe(function(a){var g=new xb,h=++f;c=!0,d.setDisposable(g),M(a)&&(a=ac(a)),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,!c&&b.onCompleted()});return new sb(g,d)})},Vb.takeUntil=function(a){var b=this;return new nc(function(c){return M(a)&&(a=ac(a)),new sb(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),F))})},Vb.zip=function(){if(Array.isArray(arguments[0]))return t.apply(this,arguments);var a=this,b=mb.call(arguments),c=b.pop();return b.unshift(a),new nc(function(d){function e(b){var e,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),e=c.apply(a,f)}catch(g){return void d.onError(g)}d.onNext(e)}else i.filter(function(a,c){return c!==b}).every(H)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=k(g,function(){return[]}),i=k(g,function(){return!1}),j=new Array(g),l=0;g>l;l++)!function(a){var c=b[a],g=new xb;M(c)&&(c=ac(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},d.onError.bind(d),function(){f(a)})),j[a]=g}(l);return new sb(j)})},_b.zip=function(){var a=mb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},_b.zipArray=function(){var a=j(arguments,0);return new nc(function(b){function c(a){if(f.every(function(a){return a.length>0 | ||
})){var c=f.map(function(a){return a.shift()});b.onNext(c)}else if(g.filter(function(b,c){return c!==a}).every(H))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(H)?void b.onCompleted():void 0}for(var e=a.length,f=k(e,function(){return[]}),g=k(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new xb,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},b.onError.bind(b),function(){d(e)}))}(i);var j=new sb(h);return j.add(vb(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},Vb.asObservable=function(){return new nc(this.subscribe.bind(this))},Vb.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})},Vb.dematerialize=function(){var a=this;return new nc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Vb.distinctUntilChanged=function(a,b){var c=this;return a||(a=H),b||(b=J),new nc(function(d){var e,f=!1;return c.subscribe(function(c){var g,h=!1;try{g=a(c)}catch(i){return void d.onError(i)}if(f)try{h=b(e,g)}catch(i){return void d.onError(i)}f&&h||(f=!0,e=g,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))})},Vb["do"]=Vb.doAction=Vb.tap=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new nc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b)try{b(c)}catch(d){a.onError(d)}a.onError(c)},function(){if(c)try{c()}catch(b){a.onError(b)}a.onCompleted()})})},Vb.doOnNext=Vb.tapOnNext=function(a,b){return this.tap(2===arguments.length?function(c){a.call(b,c)}:a)},Vb.doOnError=Vb.tapOnError=function(a,b){return this.tap(F,2===arguments.length?function(c){a.call(b,c)}:a)},Vb.doOnCompleted=Vb.tapOnCompleted=function(a,b){return this.tap(F,null,2===arguments.length?function(){a.call(b)}:a)},Vb["finally"]=Vb.finallyAction=function(a){var b=this;return new nc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return vb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},Vb.ignoreElements=function(){var a=this;return new nc(function(b){return a.subscribe(F,b.onError.bind(b),b.onCompleted.bind(b))})},Vb.materialize=function(){var a=this;return new nc(function(b){return a.subscribe(function(a){b.onNext(Mb(a))},function(a){b.onNext(Nb(a)),b.onCompleted()},function(){b.onNext(Ob()),b.onCompleted()})})},Vb.repeat=function(a){return Rb(this,a).concat()},Vb.retry=function(a){return Rb(this,a).catchException()},Vb.scan=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new nc(function(e){var f,g,h;return d.subscribe(function(d){!h&&(h=!0);try{f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return void e.onError(i)}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Vb.skipLast=function(a){var b=this;return new nc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},Vb.startWith=function(){var a,b,c=0;return arguments.length&&G(arguments[0])?(b=arguments[0],c=1):b=Eb,a=mb.call(arguments,c),Sb([ec(a,b),this]).concat()},Vb.takeLast=function(a){var b=this;return new nc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})})},Vb.takeLastBuffer=function(a){var b=this;return new nc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})},Vb.windowWithCount=function(a,b){var c=this;if(+a||(a=0),1/0===Math.abs(a)&&(a=0),0>=a)throw new Error(O);if(null==b&&(b=a),+b||(b=0),1/0===Math.abs(b)&&(b=0),0>=b)throw new Error(O);return new nc(function(d){function e(){var a=new qc;i.push(a),d.onNext(pb(a,g))}var f=new xb,g=new zb(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})},Vb.selectConcat=Vb.concatMap=function(a,b,c){return b?this.concatMap(function(c,d){var e=a(c,d),f=M(e)?ac(e):e;return f.map(function(a){return b(c,a,d)})}):"function"==typeof a?u(this,a,c):u(this,function(){return a})},Vb.concatMapObserver=Vb.selectConcatObserver=function(a,b,c,d){var e=this;return new nc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}M(c)&&(c=ac(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}M(c)&&(c=ac(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}M(a)&&(a=ac(a)),f.onNext(a),f.onCompleted()})}).concatAll()},Vb.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new nc(function(a){var d=!1;return c.subscribe(function(b){d=!0,a.onNext(b)},a.onError.bind(a),function(){d||a.onNext(b),a.onCompleted()})})},w.prototype.push=function(a){var b=-1===v(this.set,a,this.comparer);return b&&this.set.push(a),b},Vb.distinct=function(a,b){var c=this;return b||(b=J),new nc(function(d){var e=new w(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)},d.onError.bind(d),d.onCompleted.bind(d))})},Vb.select=Vb.map=function(a,b){var c=this;return new nc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Vb.pluck=function(a){return this.map(function(b){return b[a]})},Vb.flatMapObserver=Vb.selectManyObserver=function(a,b,c,d){var e=this;return new nc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}M(c)&&(c=ac(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}M(c)&&(c=ac(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}M(a)&&(a=ac(a)),f.onNext(a),f.onCompleted()})}).mergeAll()},Vb.selectMany=Vb.flatMap=function(a,b,c){return b?this.flatMap(function(c,d){var e=a(c,d),f=M(e)?ac(e):e;return f.map(function(a){return b(c,a,d)})},c):"function"==typeof a?x(this,a,c):x(this,function(){return a})},Vb.selectSwitch=Vb.flatMapLatest=Vb.switchMap=function(a,b){return this.select(a,b).switchLatest()},Vb.skip=function(a){if(0>a)throw new Error(O);var b=this;return new nc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Vb.skipWhile=function(a,b){var c=this;return new nc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Vb.take=function(a,b){if(0>a)throw new RangeError(O);if(0===a)return cc(b);var c=this;return new nc(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Vb.takeWhile=function(a,b){var c=this;return new nc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Vb.where=Vb.filter=function(a,b){var c=this;return new nc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},Vb.exclusive=function(){var a=this;return new nc(function(b){var c=!1,d=!1,e=new xb,f=new sb;return f.add(e),e.setDisposable(a.subscribe(function(a){if(!c){c=!0,M(a)&&(a=ac(a));var e=new xb;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})},Vb.exclusiveMap=function(a,b){var c=this;return new nc(function(d){var e=0,f=!1,g=!0,h=new xb,i=new sb;return i.add(h),h.setDisposable(c.subscribe(function(c){f||(f=!0,innerSubscription=new xb,i.add(innerSubscription),M(c)&&(c=ac(c)),innerSubscription.setDisposable(c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),function(){i.remove(innerSubscription),f=!1,g&&1===i.length&&d.onCompleted()})))},d.onError.bind(d),function(){g=!0,1!==i.length||f||d.onCompleted()})),i})};var nc=E.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?vb(a):wb}function c(d){function e(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new oc(a);return Fb.scheduleRequired()?Fb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return nb(c,a),c}(_b),oc=function(a){function b(b){a.call(this),this.observer=b,this.m=new xb}nb(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Wb),pc=function(a,b){this.subject=a,this.observer=b};pc.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 qc=E.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),wb):(a.onCompleted(),wb):(this.observers.push(a),new pc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return nb(d,a),ob(d.prototype,Tb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new rc(a,b)},d}(_b),rc=(E.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new pc(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),wb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return nb(d,a),ob(d.prototype,Tb,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(_b),E.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return nb(b,a),ob(b.prototype,Tb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(_b));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(z.Rx=E,define(function(){return E})):A&&B?C?(B.exports=E).Rx=E:A.Rx=E:z.Rx=E}).call(this); | ||
(function(a){function b(){if(this.isDisposed)throw new Error(P)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;kb.nonEnumArgs&&a.length&&h(a)&&(a=mb.call(a));var d=kb.enumPrototypes&&"function"==typeof a,e=kb.enumErrorProps&&(a===eb||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(kb.nonEnumShadows&&a!==fb){var g=a.constructor,i=-1,j=ib.length;if(a===(g&&g.prototype))var k=a===stringProto?ab:a===eb?X:bb.call(a),l=jb[k];for(;++i<j;)f=ib[i],l&&l[f]||!cb.call(a,f)||b.push(f)}return b}function e(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function f(a,b){return e(a,b,d)}function g(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function h(a){return a&&"object"==typeof a?bb.call(a)==T:!1}function i(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,j=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=j&&"object"!=j))return!1;var k=bb.call(a),l=bb.call(b);if(k==T&&(k=$),l==T&&(l=$),k!=l)return!1;switch(k){case V:case W:return+a==+b;case Z:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case _:case ab:return a==String(b)}var m=k==U;if(!m){if(k!=$||!kb.nodeClass&&(g(a)||g(b)))return!1;var n=!kb.argsObject&&h(a)?Object:a.constructor,o=!kb.argsObject&&h(b)?Object:b.constructor;if(!(n==o||cb.call(a,"constructor")&&cb.call(b,"constructor")||N(n)&&n instanceof n&&N(o)&&o instanceof o||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var p=c.length;p--;)if(c[p]==a)return d[p]==b;var q=0,r=!0;if(c.push(a),d.push(b),m){if(p=a.length,q=b.length,r=q==p)for(;q--;){var s=b[q];if(!(r=i(a[q],s,c,d)))break}}else f(b,function(b,e,f){return cb.call(f,e)?(q++,r=cb.call(a,e)&&i(a[e],b,c,d)):void 0}),r&&f(a,function(a,b,c){return cb.call(c,b)?r=--q>-1:void 0});return c.pop(),d.pop(),r}function j(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:mb.call(a)}function k(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function l(a,b){this.id=a,this.value=b}function m(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function n(a){return"number"==typeof a&&z.isFinite(a)}function o(b){return b[Q]!==a}function p(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function q(a){var b=+a.length;return isNaN(b)?0:0!==b&&n(b)?(b=p(b)*Math.floor(Math.abs(b)),0>=b?0:b>dc?dc:b):b}function r(a){return"[object Function]"===Object.prototype.toString.call(a)&&"function"==typeof a}function s(a,b){return new oc(function(c){var d=new xb,e=new yb;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}M(f)&&(f=ac(f)),d=new xb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function t(a,b){var c=this;return new oc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return void d.onError(i)}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function u(a,b,c){return a.map(function(d,e){var f=b.call(c,d,e,a);return M(f)&&(f=ac(f)),(Array.isArray(f)||o(f))&&(f=ec(f)),f}).concatAll()}function v(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function w(a){this.comparer=a,this.set=[]}function x(a,b,c){return a.map(function(d,e){var f=b.call(c,d,e,a);return M(f)&&(f=ac(f)),(Array.isArray(f)||o(f))&&(f=ec(f)),f}).mergeObservable()}var y={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},z=y[typeof window]&&window||this,A=y[typeof exports]&&exports&&!exports.nodeType&&exports,B=y[typeof module]&&module&&!module.nodeType&&module,C=B&&B.exports===A&&A,D=y[typeof global]&&global;!D||D.global!==D&&D.window!==D||(z=D);var E={internals:{},config:{Promise:z.Promise},helpers:{}},F=E.helpers.noop=function(){},G=(E.helpers.notDefined=function(a){return"undefined"==typeof a},E.helpers.isScheduler=function(a){return a instanceof E.Scheduler}),H=E.helpers.identity=function(a){return a},I=(E.helpers.pluck=function(a){return function(b){return b[a]}},E.helpers.just=function(a){return function(){return a}},E.helpers.defaultNow=Date.now),J=E.helpers.defaultComparer=function(a,b){return lb(a,b)},K=E.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},L=(E.helpers.defaultKeySerializer=function(a){return a.toString()},E.helpers.defaultError=function(a){throw a}),M=E.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},N=(E.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},E.helpers.not=function(a){return!a},E.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==bb.call(a)}),a}()),O="Argument out of range",P="Object has been disposed",Q="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";z.Set&&"function"==typeof(new z.Set)["@@iterator"]&&(Q="@@iterator");var R=E.doneEnumerator={done:!0,value:a};E.iterator=Q;var S,T="[object Arguments]",U="[object Array]",V="[object Boolean]",W="[object Date]",X="[object Error]",Y="[object Function]",Z="[object Number]",$="[object Object]",_="[object RegExp]",ab="[object String]",bb=Object.prototype.toString,cb=Object.prototype.hasOwnProperty,db=bb.call(arguments)==T,eb=Error.prototype,fb=Object.prototype,gb=fb.propertyIsEnumerable;try{S=!(bb.call(document)==$&&!({toString:0}+""))}catch(hb){S=!0}var ib=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],jb={};jb[U]=jb[W]=jb[Z]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},jb[V]=jb[ab]={constructor:!0,toString:!0,valueOf:!0},jb[X]=jb[Y]=jb[_]={constructor:!0,toString:!0},jb[$]={constructor:!0};var kb={};!function(){var a=function(){this.x=1},b=[];a.prototype={valueOf:1,y:1};for(var c in new a)b.push(c);for(c in arguments);kb.enumErrorProps=gb.call(eb,"message")||gb.call(eb,"name"),kb.enumPrototypes=gb.call(a,"prototype"),kb.nonEnumArgs=0!=c,kb.nonEnumShadows=!/valueOf/.test(b)}(1),db||(h=function(a){return a&&"object"==typeof a?cb.call(a,"callee"):!1});var lb=E.internals.isEqual=function(a,b){return i(a,b,[],[])},mb=Array.prototype.slice,nb=({}.hasOwnProperty,this.inherits=E.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),ob=E.internals.addProperties=function(a){for(var b=mb.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},pb=E.internals.addRef=function(a,b){return new oc(function(c){return new sb(b.getDisposable(),a.subscribe(c))})};l.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var qb=E.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},rb=qb.prototype;rb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},rb.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},rb.heapify=function(a){if(+a||(a=0),!(a>=this.length||0>a)){var b=2*a+1,c=2*a+2,d=a;if(b<this.length&&this.isHigherPriority(b,d)&&(d=b),c<this.length&&this.isHigherPriority(c,d)&&(d=c),d!==a){var e=this.items[a];this.items[a]=this.items[d],this.items[d]=e,this.heapify(d)}}},rb.peek=function(){return this.items[0].value},rb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},rb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},rb.enqueue=function(a){var b=this.length++;this.items[b]=new l(qb.count++,a),this.percolate(b)},rb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},qb.count=0;var sb=E.CompositeDisposable=function(){this.disposables=j(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},tb=sb.prototype;tb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},tb.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},tb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},tb.toArray=function(){return this.disposables.slice(0)};var ub=E.Disposable=function(a){this.isDisposed=!1,this.action=a||F};ub.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var vb=ub.create=function(a){return new ub(a)},wb=ub.empty={dispose:F},xb=E.SingleAssignmentDisposable=function(){function a(){this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),yb=E.SerialDisposable=xb,zb=E.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?wb:new a(this)},b}();m.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var Ab=E.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||K,this.disposable=new xb};Ab.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Ab.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Ab.prototype.isCancelled=function(){return this.disposable.isDisposed},Ab.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Bb=E.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),wb}var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=I,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Cb=Bb.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new sb,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),wb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new sb,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),wb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,d)},a.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,d)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})}}(Bb.prototype),function(){Bb.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},Bb.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof z.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=z.setInterval(function(){d=c(d)},b);return vb(function(){z.clearInterval(e)})}}(Bb.prototype),function(a){a.catchError=a["catch"]=function(a){return new Kb(this,a)}}(Bb.prototype);var Db,Eb=(E.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new xb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),Bb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Cb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Bb(I,a,b,c)}()),Fb=Bb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Bb.now()>0;);b.isCancelled()||b.invoke()}}function b(a,b){return this.scheduleWithRelativeAndState(a,0,b)}function c(b,c,d){var f=this.now()+Bb.normalize(c),g=new Ab(this,b,d,f);if(e)e.enqueue(g);else{e=new qb(4),e.enqueue(g);try{a(e)}catch(h){throw h}finally{e=null}}return g.disposable}function d(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}var e,f=new Bb(I,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),Gb=F,Hb=function(){var a,b=F;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!z.setTimeout)throw new Error("No concurrency detected!");a=z.setTimeout,b=z.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),Ib=Hb.setTimeout,Jb=Hb.clearTimeout;!function(){function a(){if(!z.postMessage||z.importScripts)return!1;var a=!1,b=z.onmessage;return z.onmessage=function(){a=!0},z.postMessage("","*"),z.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(bb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=D&&C&&D.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=D&&C&&D.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Db=process.nextTick;else if("function"==typeof d)Db=d,Gb=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;z.addEventListener?z.addEventListener("message",b,!1):z.attachEvent("onmessage",b,!1),Db=function(a){var b=h++;g[b]=a,z.postMessage(f+b,"*")}}else if(z.MessageChannel){var i=new z.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Db=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in z&&"onreadystatechange"in z.document.createElement("script")?Db=function(a){var b=z.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},z.document.documentElement.appendChild(b)}:(Db=function(a){return Ib(a,0)},Gb=Jb)}();var Kb=(Bb.timeout=function(){function a(a,b){var c=this,d=new xb,e=Db(function(){d.isDisposed||d.setDisposable(b(c,a))});return new sb(d,vb(function(){Gb(e)}))}function b(a,b,c){var d=this,e=Bb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new xb,g=Ib(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new sb(f,vb(function(){Jb(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Bb(I,a,b,c)}(),function(a){function b(a,b){return this._scheduler.scheduleWithState(a,this._wrap(b))}function c(a,b,c){return this._scheduler.scheduleWithRelativeAndState(a,b,this._wrap(c))}function d(a,b,c){return this._scheduler.scheduleWithAbsoluteAndState(a,b,this._wrap(c))}function e(e,f){this._scheduler=e,this._handler=f,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this,this._scheduler.now.bind(this._scheduler),b,c,d)}return nb(e,a),e.prototype._clone=function(a){return new e(a,this._handler)},e.prototype._wrap=function(a){var b=this;return function(c,d){try{return a(b._getRecursiveWrapper(c),d)}catch(e){if(!b._handler(e))throw e;return wb}}},e.prototype._getRecursiveWrapper=function(a){if(this._recursiveOriginal!==a){this._recursiveOriginal=a;var b=this._clone(a);b._recursiveOriginal=a,b._recursiveWrapper=b,this._recursiveWrapper=b}return this._recursiveWrapper},e.prototype.schedulePeriodicWithState=function(a,b,c){var d=this,e=!1,f=new xb;return f.setDisposable(this._scheduler.schedulePeriodicWithState(a,b,function(a){if(e)return null;try{return c(a)}catch(b){if(e=!0,!d._handler(b))throw b;return f.dispose(),null}})),f},e}(Bb)),Lb=E.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}return a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return G(a)||(a=Eb),new oc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Mb=Lb.createOnNext=function(){function a(a){return a(this.value)}function b(a){return a.onNext(this.value)}function c(){return"OnNext("+this.value+")"}return function(d){var e=new Lb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Nb=Lb.createOnError=function(){function a(a,b){return b(this.exception)}function b(a){return a.onError(this.exception)}function c(){return"OnError("+this.exception+")"}return function(d){var e=new Lb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Ob=Lb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Lb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Pb=E.internals.Enumerator=function(a){this._next=a};Pb.prototype.next=function(){return this._next()},Pb.prototype[Q]=function(){return this};var Qb=E.internals.Enumerable=function(a){this._iterator=a};Qb.prototype[Q]=function(){return this._iterator()},Qb.prototype.concat=function(){var a=this;return new oc(function(b){var c;try{c=a[Q]()}catch(d){return void b.onError()}var e,f=new yb,g=Eb.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;M(h)&&(h=ac(h));var i=new xb;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new sb(f,g,vb(function(){e=!0}))})},Qb.prototype.catchException=function(){var a=this;return new oc(function(b){var c;try{c=a[Q]()}catch(d){return void b.onError()}var e,f,g=new yb,h=Eb.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;M(i)&&(i=ac(i));var j=new xb;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new sb(g,h,vb(function(){e=!0}))})};var Rb=Qb.repeat=function(a,b){return null==b&&(b=-1),new Qb(function(){var c=b;return new Pb(function(){return 0===c?R:(c>0&&c--,{done:!1,value:a})})})},Sb=Qb.of=function(a,b,c){return b||(b=H),new Qb(function(){var d=-1;return new Pb(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:R})})},Tb=E.Observer=function(){};Tb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Tb.prototype.asObserver=function(){return new Xb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Tb.prototype.checked=function(){return new Yb(this)};var Ub=Tb.create=function(a,b,c){return a||(a=F),b||(b=L),c||(c=F),new Xb(a,b,c)};Tb.fromNotifier=function(a,b){return new Xb(function(c){return a.call(b,Mb(c))},function(c){return a.call(b,Nb(c))},function(){return a.call(b,Ob())})},Tb.notifyOn=function(a){return new $b(a,this)};var Vb,Wb=E.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return nb(b,a),b.prototype.onNext=function(a){this.isStopped||this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(Tb),Xb=E.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return nb(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(Wb),Yb=function(a){function b(b){a.call(this),this._observer=b,this._state=0}nb(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();try{this._observer.onNext(a)}catch(b){throw b}finally{this._state=0}},c.onError=function(a){this.checkAccess();try{this._observer.onError(a)}catch(b){throw b}finally{this._state=2}},c.onCompleted=function(){this.checkAccess();try{this._observer.onCompleted()}catch(a){throw a}finally{this._state=2}},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}(Tb),Zb=E.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new yb}return nb(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},b.prototype.ensureActive=function(){var a=!1,b=this;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(function(a){var c;if(!(b.queue.length>0))return void(b.isAcquired=!1);c=b.queue.shift();try{c()}catch(d){throw b.queue=[],b.hasFaulted=!0,d}a()}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(Wb),$b=function(a){function b(){a.apply(this,arguments)}return nb(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}(Zb),_b=E.Observable=function(){function a(a){this._subscribe=a}return Vb=a.prototype,Vb.subscribe=Vb.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:Ub(a,b,c))},Vb.subscribeOnNext=function(a,b){return this._subscribe(Ub(2===arguments.length?function(c){a.call(b,c)}:a))},Vb.subscribeOnError=function(a,b){return this._subscribe(Ub(null,2===arguments.length?function(c){a.call(b,c)}:a))},Vb.subscribeOnCompleted=function(a,b){return this._subscribe(Ub(null,null,2===arguments.length?function(){a.call(b)}:a))},a}();Vb.observeOn=function(a){var b=this;return new oc(function(c){return b.subscribe(new $b(a,c))})},Vb.subscribeOn=function(a){var b=this;return new oc(function(c){var d=new xb,e=new yb;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new m(a,b.subscribe(c)))})),e})};var ac=_b.fromPromise=function(a){return bc(function(){var b=new E.AsyncSubject;return a.then(function(a){b.isDisposed||(b.onNext(a),b.onCompleted())},b.onError.bind(b)),b})};Vb.toPromise=function(a){if(a||(a=E.config.Promise),!a)throw new TypeError("Promise type not provided nor in Rx.config.Promise");var b=this;return new a(function(a,c){var d,e=!1;b.subscribe(function(a){d=a,e=!0},c,function(){e&&a(d)})})},Vb.toArray=function(){var a=this;return new oc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})})},_b.create=_b.createWithDisposable=function(a){return new oc(a)};var bc=_b.defer=function(a){return new oc(function(b){var c;try{c=a()}catch(d){return ic(d).subscribe(b)}return M(c)&&(c=ac(c)),c.subscribe(b)})},cc=_b.empty=function(a){return G(a)||(a=Eb),new oc(function(b){return a.schedule(function(){b.onCompleted()})})},dc=Math.pow(2,53)-1,ec=_b.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!r(b))throw new Error("mapFn when provided must be a function");return G(d)||(d=Fb),new oc(function(e){var f=Object(a),g=o(f),h=g?0:q(f),i=g?f[Q]():null,j=0;return d.scheduleRecursive(function(a){if(h>j||g){var d;if(g){var k;try{k=i.next()}catch(l){return void e.onError(l)}if(k.done)return void e.onCompleted();d=k.value}else d=f.charAt?f.charAt(j):f[j];if(b&&r(b))try{d=c?b.call(c,d,j):b(d,j)}catch(l){return void e.onError(l)}e.onNext(d),j++,a()}else e.onCompleted()})})},fc=_b.fromArray=function(a,b){return G(b)||(b=Fb),new oc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};_b.generate=function(a,b,c,d,e){return G(e)||(e=Fb),new oc(function(f){var g=!0,h=a;return e.scheduleRecursive(function(a){var e,i;try{g?g=!1:h=c(h),e=b(h),e&&(i=d(h))}catch(j){return void f.onError(j)}e?(f.onNext(i),a()):f.onCompleted()})})};var gc=_b.never=function(){return new oc(function(){return wb})};_b.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return fc(b)};_b.ofWithScheduler=function(a){for(var b=arguments.length-1,c=new Array(b),d=0;b>d;d++)c[d]=arguments[d+1];return fc(c,a)};_b.range=function(a,b,c){return G(c)||(c=Fb),new oc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},_b.repeat=function(a,b,c){return G(c)||(c=Fb),hc(a,c).repeat(null==b?-1:b)};var hc=_b["return"]=_b.returnValue=_b.just=function(a,b){return G(b)||(b=Eb),new oc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},ic=_b["throw"]=_b.throwException=_b.throwError=function(a,b){return G(b)||(b=Eb),new oc(function(c){return b.schedule(function(){c.onError(a)})})};_b.using=function(a,b){return new oc(function(c){var d,e,f=wb;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new sb(ic(g).subscribe(c),f)}return new sb(e.subscribe(c),f)})},Vb.amb=function(a){var b=this;return new oc(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new xb,j=new xb;return M(a)&&(a=ac(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 sb(i,j)})},_b.amb=function(){function a(a,b){return a.amb(b)}for(var b=gc(),c=j(arguments,0),d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},Vb["catch"]=Vb.catchError=Vb.catchException=function(a){return"function"==typeof a?s(this,a):jc([this,a])};var jc=_b.catchException=_b.catchError=_b["catch"]=function(){return Sb(j(arguments,0)).catchException()};Vb.combineLatest=function(){var a=mb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),kc.apply(this,a)};var kc=_b.combineLatest=function(){var a=mb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new oc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(H))){try{d=b.apply(null,l)}catch(e){return void c.onError(e)}c.onNext(d)}else j.filter(function(b,c){return c!==a}).every(H)&&c.onCompleted()}function e(a){j[a]=!0,j.every(H)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=k(g,f),i=!1,j=k(g,f),l=new Array(g),m=new Array(g),n=0;g>n;n++)!function(b){var f=a[b],g=new xb;M(f)&&(f=ac(f)),g.setDisposable(f.subscribe(function(a){l[b]=a,d(b)},c.onError.bind(c),function(){e(b)})),m[b]=g}(n);return new sb(m)})};Vb.concat=function(){var a=mb.call(arguments,0);return a.unshift(this),lc.apply(this,a)};var lc=_b.concat=function(){return Sb(j(arguments,0)).concat()};Vb.concatObservable=Vb.concatAll=function(){return this.merge(1)},Vb.merge=function(a){if("number"!=typeof a)return mc(this,a);var b=this;return new oc(function(c){function d(a){var b=new xb;f.add(b),M(a)&&(a=ac(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){f.remove(b),h.length>0?d(h.shift()):(e--,g&&0===e&&c.onCompleted())}))}var e=0,f=new sb,g=!1,h=[];return f.add(b.subscribe(function(b){a>e?(e++,d(b)):h.push(b)},c.onError.bind(c),function(){g=!0,0===e&&c.onCompleted()})),f})};var mc=_b.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=mb.call(arguments,1)):(a=Eb,b=mb.call(arguments,0)):(a=Eb,b=mb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),fc(b,a).mergeObservable()};Vb.mergeObservable=Vb.mergeAll=function(){var a=this;return new oc(function(b){var c=new sb,d=!1,e=new xb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new xb;c.add(e),M(a)&&(a=ac(a)),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Vb.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return nc([this,a])};var nc=_b.onErrorResumeNext=function(){var a=j(arguments,0);return new oc(function(b){var c=0,d=new yb,e=Eb.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],M(f)&&(f=ac(f)),g=new xb,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new sb(d,e)})};Vb.skipUntil=function(a){var b=this;return new oc(function(c){var d=!1,e=new sb(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));M(a)&&(a=ac(a));var f=new xb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Vb["switch"]=Vb.switchLatest=function(){var a=this;return new oc(function(b){var c=!1,d=new yb,e=!1,f=0,g=a.subscribe(function(a){var g=new xb,h=++f;c=!0,d.setDisposable(g),M(a)&&(a=ac(a)),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,!c&&b.onCompleted()});return new sb(g,d)})},Vb.takeUntil=function(a){var b=this;return new oc(function(c){return M(a)&&(a=ac(a)),new sb(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),F))})},Vb.zip=function(){if(Array.isArray(arguments[0]))return t.apply(this,arguments);var a=this,b=mb.call(arguments),c=b.pop();return b.unshift(a),new oc(function(d){function e(b){var e,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),e=c.apply(a,f)}catch(g){return void d.onError(g)}d.onNext(e)}else i.filter(function(a,c){return c!==b}).every(H)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=k(g,function(){return[]}),i=k(g,function(){return!1}),j=new Array(g),l=0;g>l;l++)!function(a){var c=b[a],g=new xb;M(c)&&(c=ac(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},d.onError.bind(d),function(){f(a)})),j[a]=g}(l);return new sb(j)})},_b.zip=function(){var a=mb.call(arguments,0),b=a.shift(); | ||
return b.zip.apply(b,a)},_b.zipArray=function(){var a=j(arguments,0);return new oc(function(b){function c(a){if(f.every(function(a){return a.length>0})){var c=f.map(function(a){return a.shift()});b.onNext(c)}else if(g.filter(function(b,c){return c!==a}).every(H))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(H)?void b.onCompleted():void 0}for(var e=a.length,f=k(e,function(){return[]}),g=k(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new xb,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},b.onError.bind(b),function(){d(e)}))}(i);var j=new sb(h);return j.add(vb(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},Vb.asObservable=function(){return new oc(this.subscribe.bind(this))},Vb.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})},Vb.dematerialize=function(){var a=this;return new oc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Vb.distinctUntilChanged=function(a,b){var c=this;return a||(a=H),b||(b=J),new oc(function(d){var e,f=!1;return c.subscribe(function(c){var g,h=!1;try{g=a(c)}catch(i){return void d.onError(i)}if(f)try{h=b(e,g)}catch(i){return void d.onError(i)}f&&h||(f=!0,e=g,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))})},Vb["do"]=Vb.doAction=Vb.tap=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new oc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b)try{b(c)}catch(d){a.onError(d)}a.onError(c)},function(){if(c)try{c()}catch(b){a.onError(b)}a.onCompleted()})})},Vb.doOnNext=Vb.tapOnNext=function(a,b){return this.tap(2===arguments.length?function(c){a.call(b,c)}:a)},Vb.doOnError=Vb.tapOnError=function(a,b){return this.tap(F,2===arguments.length?function(c){a.call(b,c)}:a)},Vb.doOnCompleted=Vb.tapOnCompleted=function(a,b){return this.tap(F,null,2===arguments.length?function(){a.call(b)}:a)},Vb["finally"]=Vb.finallyAction=function(a){var b=this;return new oc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return vb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},Vb.ignoreElements=function(){var a=this;return new oc(function(b){return a.subscribe(F,b.onError.bind(b),b.onCompleted.bind(b))})},Vb.materialize=function(){var a=this;return new oc(function(b){return a.subscribe(function(a){b.onNext(Mb(a))},function(a){b.onNext(Nb(a)),b.onCompleted()},function(){b.onNext(Ob()),b.onCompleted()})})},Vb.repeat=function(a){return Rb(this,a).concat()},Vb.retry=function(a){return Rb(this,a).catchException()},Vb.scan=function(){var a,b,c=!1,d=this;return 2===arguments.length?(c=!0,a=arguments[0],b=arguments[1]):b=arguments[0],new oc(function(e){var f,g,h;return d.subscribe(function(d){!h&&(h=!0);try{f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return void e.onError(i)}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Vb.skipLast=function(a){var b=this;return new oc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},Vb.startWith=function(){var a,b,c=0;return arguments.length&&G(arguments[0])?(b=arguments[0],c=1):b=Eb,a=mb.call(arguments,c),Sb([fc(a,b),this]).concat()},Vb.takeLast=function(a){var b=this;return new oc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})})},Vb.takeLastBuffer=function(a){var b=this;return new oc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})},Vb.windowWithCount=function(a,b){var c=this;if(+a||(a=0),1/0===Math.abs(a)&&(a=0),0>=a)throw new Error(O);if(null==b&&(b=a),+b||(b=0),1/0===Math.abs(b)&&(b=0),0>=b)throw new Error(O);return new oc(function(d){function e(){var a=new rc;i.push(a),d.onNext(pb(a,g))}var f=new xb,g=new zb(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})},Vb.selectConcat=Vb.concatMap=function(a,b,c){return"function"==typeof a&&"function"==typeof b?this.concatMap(function(c,d){var e=a(c,d);return M(e)&&(e=ac(e)),(Array.isArray(e)||o(e))&&(e=ec(e)),e.map(function(a,e){return b(c,a,d,e)})}):"function"==typeof a?u(this,a,c):u(this,function(){return a})},Vb.concatMapObserver=Vb.selectConcatObserver=function(a,b,c,d){var e=this;return new oc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}M(c)&&(c=ac(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}M(c)&&(c=ac(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}M(a)&&(a=ac(a)),f.onNext(a),f.onCompleted()})}).concatAll()},Vb.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new oc(function(a){var d=!1;return c.subscribe(function(b){d=!0,a.onNext(b)},a.onError.bind(a),function(){d||a.onNext(b),a.onCompleted()})})},w.prototype.push=function(a){var b=-1===v(this.set,a,this.comparer);return b&&this.set.push(a),b},Vb.distinct=function(a,b){var c=this;return b||(b=J),new oc(function(d){var e=new w(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)},d.onError.bind(d),d.onCompleted.bind(d))})},Vb.select=Vb.map=function(a,b){var c=this;return new oc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Vb.pluck=function(a){return this.map(function(b){return b[a]})},Vb.flatMapObserver=Vb.selectManyObserver=function(a,b,c,d){var e=this;return new oc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}M(c)&&(c=ac(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}M(c)&&(c=ac(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}M(a)&&(a=ac(a)),f.onNext(a),f.onCompleted()})}).mergeAll()},Vb.selectMany=Vb.flatMap=function(a,b,c){return"function"==typeof a&&"function"==typeof b?this.flatMap(function(c,d){var e=a(c,d);return M(e)&&(e=ac(e)),(Array.isArray(e)||o(e))&&(e=ec(e)),e.map(function(a,e){return b(c,a,d,e)})},c):"function"==typeof a?x(this,a,c):x(this,function(){return a})},Vb.selectSwitch=Vb.flatMapLatest=Vb.switchMap=function(a,b){return this.select(a,b).switchLatest()},Vb.skip=function(a){if(0>a)throw new Error(O);var b=this;return new oc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Vb.skipWhile=function(a,b){var c=this;return new oc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Vb.take=function(a,b){if(0>a)throw new RangeError(O);if(0===a)return cc(b);var c=this;return new oc(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Vb.takeWhile=function(a,b){var c=this;return new oc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Vb.where=Vb.filter=function(a,b){var c=this;return new oc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},Vb.transduce=function(a){function b(a){return{init:function(){return a},step:function(a,b){return a.onNext(b)},result:function(a){return a.onCompleted()}}}var c=this;return new oc(function(d){var e=a(b(d));return c.subscribe(function(a){try{e.step(d,a)}catch(b){d.onError(b)}},d.onError.bind(d),function(){e.result(d)})})};var oc=E.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?vb(a):wb}function c(d){function e(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new pc(a);return Fb.scheduleRequired()?Fb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return nb(c,a),c}(_b),pc=function(a){function b(b){a.call(this),this.observer=b,this.m=new xb}nb(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Wb),qc=function(a,b){this.subject=a,this.observer=b};qc.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 rc=E.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),wb):(a.onCompleted(),wb):(this.observers.push(a),new qc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return nb(d,a),ob(d.prototype,Tb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new sc(a,b)},d}(_b),sc=(E.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new qc(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),wb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return nb(d,a),ob(d.prototype,Tb,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(_b),E.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return nb(b,a),ob(b.prototype,Tb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(_b));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(z.Rx=E,define(function(){return E})):A&&B?C?(B.exports=E).Rx=E:A.Rx=E:z.Rx=E}).call(this); | ||
//# sourceMappingURL=rx.map |
@@ -56,84 +56,82 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | ||
function OnNextPredicate(predicate) { | ||
this.predicate = predicate; | ||
}; | ||
function OnNextPredicate(predicate) { | ||
this.predicate = predicate; | ||
}; | ||
OnNextPredicate.prototype.equals = function (other) { | ||
if (other === this) { return true; } | ||
if (other == null) { return false; } | ||
if (other.kind !== 'N') { return false; } | ||
return this.predicate(other.value); | ||
}; | ||
OnNextPredicate.prototype.equals = function (other) { | ||
if (other === this) { return true; } | ||
if (other == null) { return false; } | ||
if (other.kind !== 'N') { return false; } | ||
return this.predicate(other.value); | ||
}; | ||
function OnErrorPredicate(predicate) { | ||
this.predicate = predicate; | ||
}; | ||
function OnErrorPredicate(predicate) { | ||
this.predicate = predicate; | ||
}; | ||
OnErrorPredicate.prototype.equals = function (other) { | ||
if (other === this) { return true; } | ||
if (other == null) { return false; } | ||
if (other.kind !== 'E') { return false; } | ||
return this.predicate(other.exception); | ||
}; | ||
OnErrorPredicate.prototype.equals = function (other) { | ||
if (other === this) { return true; } | ||
if (other == null) { return false; } | ||
if (other.kind !== 'E') { return false; } | ||
return this.predicate(other.exception); | ||
}; | ||
var ReactiveTest = Rx.ReactiveTest = { | ||
/** Default virtual time used for creation of observable sequences in unit tests. */ | ||
created: 100, | ||
/** Default virtual time used to subscribe to observable sequences in unit tests. */ | ||
subscribed: 200, | ||
/** Default virtual time used to dispose subscriptions in unit tests. */ | ||
disposed: 1000, | ||
var ReactiveTest = Rx.ReactiveTest = { | ||
/** Default virtual time used for creation of observable sequences in unit tests. */ | ||
created: 100, | ||
/** Default virtual time used to subscribe to observable sequences in unit tests. */ | ||
subscribed: 200, | ||
/** Default virtual time used to dispose subscriptions in unit tests. */ | ||
disposed: 1000, | ||
/** | ||
* Factory method for an OnNext notification record at a given time with a given value or a predicate function. | ||
* | ||
* 1 - ReactiveTest.onNext(200, 42); | ||
* 2 - ReactiveTest.onNext(200, function (x) { return x.length == 2; }); | ||
* | ||
* @param ticks Recorded virtual time the OnNext notification occurs. | ||
* @param value Recorded value stored in the OnNext notification or a predicate. | ||
* @return Recorded OnNext notification. | ||
*/ | ||
onNext: function (ticks, value) { | ||
if (typeof value === 'function') { | ||
return new Recorded(ticks, new OnNextPredicate(value)); | ||
} | ||
return new Recorded(ticks, Notification.createOnNext(value)); | ||
}, | ||
/** | ||
* Factory method for an OnError notification record at a given time with a given error. | ||
* | ||
* 1 - ReactiveTest.onNext(200, new Error('error')); | ||
* 2 - ReactiveTest.onNext(200, function (e) { return e.message === 'error'; }); | ||
* | ||
* @param ticks Recorded virtual time the OnError notification occurs. | ||
* @param exception Recorded exception stored in the OnError notification. | ||
* @return Recorded OnError notification. | ||
*/ | ||
onError: function (ticks, exception) { | ||
if (typeof exception === 'function') { | ||
return new Recorded(ticks, new OnErrorPredicate(exception)); | ||
} | ||
return new Recorded(ticks, Notification.createOnError(exception)); | ||
}, | ||
/** | ||
* Factory method for an OnCompleted notification record at a given time. | ||
* | ||
* @param ticks Recorded virtual time the OnCompleted notification occurs. | ||
* @return Recorded OnCompleted notification. | ||
*/ | ||
onCompleted: function (ticks) { | ||
return new Recorded(ticks, Notification.createOnCompleted()); | ||
}, | ||
/** | ||
* Factory method for a subscription record based on a given subscription and disposal time. | ||
* | ||
* @param start Virtual time indicating when the subscription was created. | ||
* @param end Virtual time indicating when the subscription was disposed. | ||
* @return Subscription object. | ||
*/ | ||
subscribe: function (start, end) { | ||
return new Subscription(start, end); | ||
} | ||
}; | ||
/** | ||
* Factory method for an OnNext notification record at a given time with a given value or a predicate function. | ||
* | ||
* 1 - ReactiveTest.onNext(200, 42); | ||
* 2 - ReactiveTest.onNext(200, function (x) { return x.length == 2; }); | ||
* | ||
* @param ticks Recorded virtual time the OnNext notification occurs. | ||
* @param value Recorded value stored in the OnNext notification or a predicate. | ||
* @return Recorded OnNext notification. | ||
*/ | ||
onNext: function (ticks, value) { | ||
return typeof value === 'function' ? | ||
new Recorded(ticks, new OnNextPredicate(value)) : | ||
new Recorded(ticks, Notification.createOnNext(value)); | ||
}, | ||
/** | ||
* Factory method for an OnError notification record at a given time with a given error. | ||
* | ||
* 1 - ReactiveTest.onNext(200, new Error('error')); | ||
* 2 - ReactiveTest.onNext(200, function (e) { return e.message === 'error'; }); | ||
* | ||
* @param ticks Recorded virtual time the OnError notification occurs. | ||
* @param exception Recorded exception stored in the OnError notification. | ||
* @return Recorded OnError notification. | ||
*/ | ||
onError: function (ticks, error) { | ||
return typeof error === 'function' ? | ||
new Recorded(ticks, new OnErrorPredicate(error)) : | ||
new Recorded(ticks, Notification.createOnError(error)); | ||
}, | ||
/** | ||
* Factory method for an OnCompleted notification record at a given time. | ||
* | ||
* @param ticks Recorded virtual time the OnCompleted notification occurs. | ||
* @return Recorded OnCompleted notification. | ||
*/ | ||
onCompleted: function (ticks) { | ||
return new Recorded(ticks, Notification.createOnCompleted()); | ||
}, | ||
/** | ||
* Factory method for a subscription record based on a given subscription and disposal time. | ||
* | ||
* @param start Virtual time indicating when the subscription was created. | ||
* @param end Virtual time indicating when the subscription was disposed. | ||
* @return Subscription object. | ||
*/ | ||
subscribe: function (start, end) { | ||
return new Subscription(start, end); | ||
} | ||
}; | ||
@@ -260,48 +258,43 @@ /** | ||
/** @private */ | ||
var HotObservable = (function (_super) { | ||
var HotObservable = (function (__super__) { | ||
function subscribe(observer) { | ||
var observable = this; | ||
this.observers.push(observer); | ||
this.subscriptions.push(new Subscription(this.scheduler.clock)); | ||
var index = this.subscriptions.length - 1; | ||
return disposableCreate(function () { | ||
var idx = observable.observers.indexOf(observer); | ||
observable.observers.splice(idx, 1); | ||
observable.subscriptions[index] = new Subscription(observable.subscriptions[index].subscribe, observable.scheduler.clock); | ||
}); | ||
} | ||
function subscribe(observer) { | ||
var observable = this; | ||
this.observers.push(observer); | ||
this.subscriptions.push(new Subscription(this.scheduler.clock)); | ||
var index = this.subscriptions.length - 1; | ||
return disposableCreate(function () { | ||
var idx = observable.observers.indexOf(observer); | ||
observable.observers.splice(idx, 1); | ||
observable.subscriptions[index] = new Subscription(observable.subscriptions[index].subscribe, observable.scheduler.clock); | ||
}); | ||
} | ||
inherits(HotObservable, _super); | ||
inherits(HotObservable, __super__); | ||
/** | ||
* @private | ||
* @constructor | ||
*/ | ||
function HotObservable(scheduler, messages) { | ||
_super.call(this, subscribe); | ||
var message, notification, observable = this; | ||
this.scheduler = scheduler; | ||
this.messages = messages; | ||
this.subscriptions = []; | ||
this.observers = []; | ||
for (var i = 0, len = this.messages.length; i < len; i++) { | ||
message = this.messages[i]; | ||
notification = message.value; | ||
(function (innerNotification) { | ||
scheduler.scheduleAbsoluteWithState(null, message.time, function () { | ||
var obs = observable.observers.slice(0); | ||
function HotObservable(scheduler, messages) { | ||
__super__.call(this, subscribe); | ||
var message, notification, observable = this; | ||
this.scheduler = scheduler; | ||
this.messages = messages; | ||
this.subscriptions = []; | ||
this.observers = []; | ||
for (var i = 0, len = this.messages.length; i < len; i++) { | ||
message = this.messages[i]; | ||
notification = message.value; | ||
(function (innerNotification) { | ||
scheduler.scheduleAbsoluteWithState(null, message.time, function () { | ||
var obs = observable.observers.slice(0); | ||
for (var j = 0, jLen = obs.length; j < jLen; j++) { | ||
innerNotification.accept(obs[j]); | ||
} | ||
return disposableEmpty; | ||
}); | ||
})(notification); | ||
for (var j = 0, jLen = obs.length; j < jLen; j++) { | ||
innerNotification.accept(obs[j]); | ||
} | ||
} | ||
return disposableEmpty; | ||
}); | ||
})(notification); | ||
} | ||
} | ||
return HotObservable; | ||
})(Observable); | ||
return HotObservable; | ||
})(Observable); | ||
@@ -348,136 +341,160 @@ /** @private */ | ||
/** Virtual time scheduler used for testing applications and libraries built using Reactive Extensions. */ | ||
Rx.TestScheduler = (function (_super) { | ||
inherits(TestScheduler, _super); | ||
/** Virtual time scheduler used for testing applications and libraries built using Reactive Extensions. */ | ||
Rx.TestScheduler = (function (__super__) { | ||
inherits(TestScheduler, __super__); | ||
function baseComparer(x, y) { | ||
return x > y ? 1 : (x < y ? -1 : 0); | ||
} | ||
function baseComparer(x, y) { | ||
return x > y ? 1 : (x < y ? -1 : 0); | ||
} | ||
/** @constructor */ | ||
function TestScheduler() { | ||
_super.call(this, 0, baseComparer); | ||
} | ||
function TestScheduler() { | ||
__super__.call(this, 0, baseComparer); | ||
} | ||
/** | ||
* Schedules an action to be executed at the specified virtual time. | ||
* | ||
* @param state State passed to the action to be executed. | ||
* @param dueTime Absolute virtual time at which to execute the action. | ||
* @param action Action to be executed. | ||
* @return Disposable object used to cancel the scheduled action (best effort). | ||
*/ | ||
TestScheduler.prototype.scheduleAbsoluteWithState = function (state, dueTime, action) { | ||
if (dueTime <= this.clock) { | ||
dueTime = this.clock + 1; | ||
} | ||
return _super.prototype.scheduleAbsoluteWithState.call(this, state, dueTime, action); | ||
}; | ||
/** | ||
* Adds a relative virtual time to an absolute virtual time value. | ||
* | ||
* @param absolute Absolute virtual time value. | ||
* @param relative Relative virtual time value to add. | ||
* @return Resulting absolute virtual time sum value. | ||
*/ | ||
TestScheduler.prototype.add = function (absolute, relative) { | ||
return absolute + relative; | ||
}; | ||
/** | ||
* Converts the absolute virtual time value to a DateTimeOffset value. | ||
* | ||
* @param absolute Absolute virtual time value to convert. | ||
* @return Corresponding DateTimeOffset value. | ||
*/ | ||
TestScheduler.prototype.toDateTimeOffset = function (absolute) { | ||
return new Date(absolute).getTime(); | ||
}; | ||
/** | ||
* Converts the TimeSpan value to a relative virtual time value. | ||
* | ||
* @param timeSpan TimeSpan value to convert. | ||
* @return Corresponding relative virtual time value. | ||
*/ | ||
TestScheduler.prototype.toRelative = function (timeSpan) { | ||
return timeSpan; | ||
}; | ||
/** | ||
* Starts the test scheduler and uses the specified virtual times to invoke the factory function, subscribe to the resulting sequence, and dispose the subscription. | ||
* | ||
* @param create Factory method to create an observable sequence. | ||
* @param created Virtual time at which to invoke the factory to create an observable sequence. | ||
* @param subscribed Virtual time at which to subscribe to the created observable sequence. | ||
* @param disposed Virtual time at which to dispose the subscription. | ||
* @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active. | ||
*/ | ||
TestScheduler.prototype.startWithTiming = function (create, created, subscribed, disposed) { | ||
var observer = this.createObserver(), source, subscription; | ||
this.scheduleAbsoluteWithState(null, created, function () { | ||
source = create(); | ||
return disposableEmpty; | ||
}); | ||
this.scheduleAbsoluteWithState(null, subscribed, function () { | ||
subscription = source.subscribe(observer); | ||
return disposableEmpty; | ||
}); | ||
this.scheduleAbsoluteWithState(null, disposed, function () { | ||
subscription.dispose(); | ||
return disposableEmpty; | ||
}); | ||
this.start(); | ||
return observer; | ||
}; | ||
/** | ||
* Starts the test scheduler and uses the specified virtual time to dispose the subscription to the sequence obtained through the factory function. | ||
* Default virtual times are used for factory invocation and sequence subscription. | ||
* | ||
* @param create Factory method to create an observable sequence. | ||
* @param disposed Virtual time at which to dispose the subscription. | ||
* @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active. | ||
*/ | ||
TestScheduler.prototype.startWithDispose = function (create, disposed) { | ||
return this.startWithTiming(create, ReactiveTest.created, ReactiveTest.subscribed, disposed); | ||
}; | ||
/** | ||
* Starts the test scheduler and uses default virtual times to invoke the factory function, to subscribe to the resulting sequence, and to dispose the subscription. | ||
* | ||
* @param create Factory method to create an observable sequence. | ||
* @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active. | ||
*/ | ||
TestScheduler.prototype.startWithCreate = function (create) { | ||
return this.startWithTiming(create, ReactiveTest.created, ReactiveTest.subscribed, ReactiveTest.disposed); | ||
}; | ||
/** | ||
* Creates a hot observable using the specified timestamped notification messages either as an array or arguments. | ||
* | ||
* @param messages Notifications to surface through the created sequence at their specified absolute virtual times. | ||
* @return Hot observable sequence that can be used to assert the timing of subscriptions and notifications. | ||
*/ | ||
TestScheduler.prototype.createHotObservable = function () { | ||
var messages = argsOrArray(arguments, 0); | ||
return new HotObservable(this, messages); | ||
}; | ||
/** | ||
* Creates a cold observable using the specified timestamped notification messages either as an array or arguments. | ||
* | ||
* @param messages Notifications to surface through the created sequence at their specified virtual time offsets from the sequence subscription time. | ||
* @return Cold observable sequence that can be used to assert the timing of subscriptions and notifications. | ||
*/ | ||
TestScheduler.prototype.createColdObservable = function () { | ||
var messages = argsOrArray(arguments, 0); | ||
return new ColdObservable(this, messages); | ||
}; | ||
/** | ||
* Creates an observer that records received notification messages and timestamps those. | ||
* | ||
* @return Observer that can be used to assert the timing of received notifications. | ||
*/ | ||
TestScheduler.prototype.createObserver = function () { | ||
return new MockObserver(this); | ||
}; | ||
/** | ||
* Schedules an action to be executed at the specified virtual time. | ||
* | ||
* @param state State passed to the action to be executed. | ||
* @param dueTime Absolute virtual time at which to execute the action. | ||
* @param action Action to be executed. | ||
* @return Disposable object used to cancel the scheduled action (best effort). | ||
*/ | ||
TestScheduler.prototype.scheduleAbsoluteWithState = function (state, dueTime, action) { | ||
dueTime <= this.clock && (dueTime = this.clock + 1); | ||
return __super__.prototype.scheduleAbsoluteWithState.call(this, state, dueTime, action); | ||
}; | ||
/** | ||
* Adds a relative virtual time to an absolute virtual time value. | ||
* | ||
* @param absolute Absolute virtual time value. | ||
* @param relative Relative virtual time value to add. | ||
* @return Resulting absolute virtual time sum value. | ||
*/ | ||
TestScheduler.prototype.add = function (absolute, relative) { | ||
return absolute + relative; | ||
}; | ||
/** | ||
* Converts the absolute virtual time value to a DateTimeOffset value. | ||
* | ||
* @param absolute Absolute virtual time value to convert. | ||
* @return Corresponding DateTimeOffset value. | ||
*/ | ||
TestScheduler.prototype.toDateTimeOffset = function (absolute) { | ||
return new Date(absolute).getTime(); | ||
}; | ||
/** | ||
* Converts the TimeSpan value to a relative virtual time value. | ||
* | ||
* @param timeSpan TimeSpan value to convert. | ||
* @return Corresponding relative virtual time value. | ||
*/ | ||
TestScheduler.prototype.toRelative = function (timeSpan) { | ||
return timeSpan; | ||
}; | ||
/** | ||
* Starts the test scheduler and uses the specified virtual times to invoke the factory function, subscribe to the resulting sequence, and dispose the subscription. | ||
* | ||
* @param create Factory method to create an observable sequence. | ||
* @param created Virtual time at which to invoke the factory to create an observable sequence. | ||
* @param subscribed Virtual time at which to subscribe to the created observable sequence. | ||
* @param disposed Virtual time at which to dispose the subscription. | ||
* @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active. | ||
*/ | ||
TestScheduler.prototype.startWithTiming = function (create, created, subscribed, disposed) { | ||
var observer = this.createObserver(), source, subscription; | ||
return TestScheduler; | ||
})(VirtualTimeScheduler); | ||
this.scheduleAbsoluteWithState(null, created, function () { | ||
source = create(); | ||
return disposableEmpty; | ||
}); | ||
this.scheduleAbsoluteWithState(null, subscribed, function () { | ||
subscription = source.subscribe(observer); | ||
return disposableEmpty; | ||
}); | ||
this.scheduleAbsoluteWithState(null, disposed, function () { | ||
subscription.dispose(); | ||
return disposableEmpty; | ||
}); | ||
this.start(); | ||
return observer; | ||
}; | ||
/** | ||
* Starts the test scheduler and uses the specified virtual time to dispose the subscription to the sequence obtained through the factory function. | ||
* Default virtual times are used for factory invocation and sequence subscription. | ||
* | ||
* @param create Factory method to create an observable sequence. | ||
* @param disposed Virtual time at which to dispose the subscription. | ||
* @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active. | ||
*/ | ||
TestScheduler.prototype.startWithDispose = function (create, disposed) { | ||
return this.startWithTiming(create, ReactiveTest.created, ReactiveTest.subscribed, disposed); | ||
}; | ||
/** | ||
* Starts the test scheduler and uses default virtual times to invoke the factory function, to subscribe to the resulting sequence, and to dispose the subscription. | ||
* | ||
* @param create Factory method to create an observable sequence. | ||
* @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active. | ||
*/ | ||
TestScheduler.prototype.startWithCreate = function (create) { | ||
return this.startWithTiming(create, ReactiveTest.created, ReactiveTest.subscribed, ReactiveTest.disposed); | ||
}; | ||
/** | ||
* Creates a hot observable using the specified timestamped notification messages either as an array or arguments. | ||
* @param messages Notifications to surface through the created sequence at their specified absolute virtual times. | ||
* @return Hot observable sequence that can be used to assert the timing of subscriptions and notifications. | ||
*/ | ||
TestScheduler.prototype.createHotObservable = function () { | ||
var messages = argsOrArray(arguments, 0); | ||
return new HotObservable(this, messages); | ||
}; | ||
/** | ||
* Creates a cold observable using the specified timestamped notification messages either as an array or arguments. | ||
* @param messages Notifications to surface through the created sequence at their specified virtual time offsets from the sequence subscription time. | ||
* @return Cold observable sequence that can be used to assert the timing of subscriptions and notifications. | ||
*/ | ||
TestScheduler.prototype.createColdObservable = function () { | ||
var messages = argsOrArray(arguments, 0); | ||
return new ColdObservable(this, messages); | ||
}; | ||
/** | ||
* Creates a resolved promise with the given value and ticks | ||
* @param {Number} ticks The absolute time of the resolution. | ||
* @param {Any} value The value to yield at the given tick. | ||
* @returns {MockPromise} A mock Promise which fulfills with the given value. | ||
*/ | ||
TestScheduler.prototype.createResolvedPromise = function (ticks, value) { | ||
return new MockPromise(this, [Rx.ReactiveTest.onNext(ticks, value), Rx.ReactiveTest.onCompleted(ticks)]); | ||
}; | ||
/** | ||
* Creates a rejected promise with the given reason and ticks | ||
* @param {Number} ticks The absolute time of the resolution. | ||
* @param {Any} reason The reason for rejection to yield at the given tick. | ||
* @returns {MockPromise} A mock Promise which rejects with the given reason. | ||
*/ | ||
TestScheduler.prototype.createRejectedPromise = function (ticks, reason) { | ||
return new MockPromise(this, [Rx.ReactiveTest.onError(ticks, reason)]); | ||
}; | ||
/** | ||
* Creates an observer that records received notification messages and timestamps those. | ||
* @return Observer that can be used to assert the timing of received notifications. | ||
*/ | ||
TestScheduler.prototype.createObserver = function () { | ||
return new MockObserver(this); | ||
}; | ||
return TestScheduler; | ||
})(VirtualTimeScheduler); | ||
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.virtualtime","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.all")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:o.call(a)}function e(a){this.predicate=a}function f(a){this.predicate=a}var g=c.Observer,h=c.Observable,i=c.Notification,j=c.VirtualTimeScheduler,k=c.Disposable,l=k.empty,m=k.create,n=c.CompositeDisposable,o=(c.SingleAssignmentDisposable,Array.prototype.slice),p=c.internals.inherits,q=c.internals.isEqual;e.prototype.equals=function(a){return a===this?!0:null==a?!1:"N"!==a.kind?!1:this.predicate(a.value)},f.prototype.equals=function(a){return a===this?!0:null==a?!1:"E"!==a.kind?!1:this.predicate(a.exception)};var r=c.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(a,b){return"function"==typeof b?new s(a,new e(b)):new s(a,i.createOnNext(b))},onError:function(a,b){return"function"==typeof b?new s(a,new f(b)):new s(a,i.createOnError(b))},onCompleted:function(a){return new s(a,i.createOnCompleted())},subscribe:function(a,b){return new t(a,b)}},s=c.Recorded=function(a,b,c){this.time=a,this.value=b,this.comparer=c||q};s.prototype.equals=function(a){return this.time===a.time&&this.comparer(this.value,a.value)},s.prototype.toString=function(){return this.value.toString()+"@"+this.time};var t=c.Subscription=function(a,b){this.subscribe=a,this.unsubscribe=b||Number.MAX_VALUE};t.prototype.equals=function(a){return this.subscribe===a.subscribe&&this.unsubscribe===a.unsubscribe},t.prototype.toString=function(){return"("+this.subscribe+", "+(this.unsubscribe===Number.MAX_VALUE?"Infinite":this.unsubscribe)+")"};var u=c.MockDisposable=function(a){this.scheduler=a,this.disposes=[],this.disposes.push(this.scheduler.clock)};u.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var v=function(a){function b(b){a.call(this),this.scheduler=b,this.messages=[]}p(b,a);var c=b.prototype;return c.onNext=function(a){this.messages.push(new s(this.scheduler.clock,i.createOnNext(a)))},c.onError=function(a){this.messages.push(new s(this.scheduler.clock,i.createOnError(a)))},c.onCompleted=function(){this.messages.push(new s(this.scheduler.clock,i.createOnCompleted()))},b}(g),w=function(a){function b(a){var b=this;this.observers.push(a),this.subscriptions.push(new t(this.scheduler.clock));var c=this.subscriptions.length-1;return m(function(){var d=b.observers.indexOf(a);b.observers.splice(d,1),b.subscriptions[c]=new t(b.subscriptions[c].subscribe,b.scheduler.clock)})}function c(c,d){a.call(this,b);var e,f,g=this;this.scheduler=c,this.messages=d,this.subscriptions=[],this.observers=[];for(var h=0,i=this.messages.length;i>h;h++)e=this.messages[h],f=e.value,function(a){c.scheduleAbsoluteWithState(null,e.time,function(){for(var b=g.observers.slice(0),c=0,d=b.length;d>c;c++)a.accept(b[c]);return l})}(f)}return p(c,a),c}(h),x=function(a){function b(a){var b,c,d=this;this.subscriptions.push(new t(this.scheduler.clock));for(var e=this.subscriptions.length-1,f=new n,g=0,h=this.messages.length;h>g;g++)b=this.messages[g],c=b.value,function(c){f.add(d.scheduler.scheduleRelativeWithState(null,b.time,function(){return c.accept(a),l}))}(c);return m(function(){d.subscriptions[e]=new t(d.subscriptions[e].subscribe,d.scheduler.clock),f.dispose()})}function c(c,d){a.call(this,b),this.scheduler=c,this.messages=d,this.subscriptions=[]}return p(c,a),c}(h);return c.TestScheduler=function(a){function b(a,b){return a>b?1:b>a?-1:0}function c(){a.call(this,0,b)}return p(c,a),c.prototype.scheduleAbsoluteWithState=function(b,c,d){return c<=this.clock&&(c=this.clock+1),a.prototype.scheduleAbsoluteWithState.call(this,b,c,d)},c.prototype.add=function(a,b){return a+b},c.prototype.toDateTimeOffset=function(a){return new Date(a).getTime()},c.prototype.toRelative=function(a){return a},c.prototype.startWithTiming=function(a,b,c,d){var e,f,g=this.createObserver();return this.scheduleAbsoluteWithState(null,b,function(){return e=a(),l}),this.scheduleAbsoluteWithState(null,c,function(){return f=e.subscribe(g),l}),this.scheduleAbsoluteWithState(null,d,function(){return f.dispose(),l}),this.start(),g},c.prototype.startWithDispose=function(a,b){return this.startWithTiming(a,r.created,r.subscribed,b)},c.prototype.startWithCreate=function(a){return this.startWithTiming(a,r.created,r.subscribed,r.disposed)},c.prototype.createHotObservable=function(){var a=d(arguments,0);return new w(this,a)},c.prototype.createColdObservable=function(){var a=d(arguments,0);return new x(this,a)},c.prototype.createObserver=function(){return new v(this)},c}(j),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.virtualtime","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.all")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:o.call(a)}function e(a){this.predicate=a}function f(a){this.predicate=a}var g=c.Observer,h=c.Observable,i=c.Notification,j=c.VirtualTimeScheduler,k=c.Disposable,l=k.empty,m=k.create,n=c.CompositeDisposable,o=(c.SingleAssignmentDisposable,Array.prototype.slice),p=c.internals.inherits,q=c.internals.isEqual;e.prototype.equals=function(a){return a===this?!0:null==a?!1:"N"!==a.kind?!1:this.predicate(a.value)},f.prototype.equals=function(a){return a===this?!0:null==a?!1:"E"!==a.kind?!1:this.predicate(a.exception)};var r=c.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(a,b){return"function"==typeof b?new s(a,new e(b)):new s(a,i.createOnNext(b))},onError:function(a,b){return"function"==typeof b?new s(a,new f(b)):new s(a,i.createOnError(b))},onCompleted:function(a){return new s(a,i.createOnCompleted())},subscribe:function(a,b){return new t(a,b)}},s=c.Recorded=function(a,b,c){this.time=a,this.value=b,this.comparer=c||q};s.prototype.equals=function(a){return this.time===a.time&&this.comparer(this.value,a.value)},s.prototype.toString=function(){return this.value.toString()+"@"+this.time};var t=c.Subscription=function(a,b){this.subscribe=a,this.unsubscribe=b||Number.MAX_VALUE};t.prototype.equals=function(a){return this.subscribe===a.subscribe&&this.unsubscribe===a.unsubscribe},t.prototype.toString=function(){return"("+this.subscribe+", "+(this.unsubscribe===Number.MAX_VALUE?"Infinite":this.unsubscribe)+")"};var u=c.MockDisposable=function(a){this.scheduler=a,this.disposes=[],this.disposes.push(this.scheduler.clock)};u.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var v=function(a){function b(b){a.call(this),this.scheduler=b,this.messages=[]}p(b,a);var c=b.prototype;return c.onNext=function(a){this.messages.push(new s(this.scheduler.clock,i.createOnNext(a)))},c.onError=function(a){this.messages.push(new s(this.scheduler.clock,i.createOnError(a)))},c.onCompleted=function(){this.messages.push(new s(this.scheduler.clock,i.createOnCompleted()))},b}(g),w=function(a){function b(a){var b=this;this.observers.push(a),this.subscriptions.push(new t(this.scheduler.clock));var c=this.subscriptions.length-1;return m(function(){var d=b.observers.indexOf(a);b.observers.splice(d,1),b.subscriptions[c]=new t(b.subscriptions[c].subscribe,b.scheduler.clock)})}function c(c,d){a.call(this,b);var e,f,g=this;this.scheduler=c,this.messages=d,this.subscriptions=[],this.observers=[];for(var h=0,i=this.messages.length;i>h;h++)e=this.messages[h],f=e.value,function(a){c.scheduleAbsoluteWithState(null,e.time,function(){for(var b=g.observers.slice(0),c=0,d=b.length;d>c;c++)a.accept(b[c]);return l})}(f)}return p(c,a),c}(h),x=function(a){function b(a){var b,c,d=this;this.subscriptions.push(new t(this.scheduler.clock));for(var e=this.subscriptions.length-1,f=new n,g=0,h=this.messages.length;h>g;g++)b=this.messages[g],c=b.value,function(c){f.add(d.scheduler.scheduleRelativeWithState(null,b.time,function(){return c.accept(a),l}))}(c);return m(function(){d.subscriptions[e]=new t(d.subscriptions[e].subscribe,d.scheduler.clock),f.dispose()})}function c(c,d){a.call(this,b),this.scheduler=c,this.messages=d,this.subscriptions=[]}return p(c,a),c}(h);return c.TestScheduler=function(a){function b(a,b){return a>b?1:b>a?-1:0}function e(){a.call(this,0,b)}return p(e,a),e.prototype.scheduleAbsoluteWithState=function(b,c,d){return c<=this.clock&&(c=this.clock+1),a.prototype.scheduleAbsoluteWithState.call(this,b,c,d)},e.prototype.add=function(a,b){return a+b},e.prototype.toDateTimeOffset=function(a){return new Date(a).getTime()},e.prototype.toRelative=function(a){return a},e.prototype.startWithTiming=function(a,b,c,d){var e,f,g=this.createObserver();return this.scheduleAbsoluteWithState(null,b,function(){return e=a(),l}),this.scheduleAbsoluteWithState(null,c,function(){return f=e.subscribe(g),l}),this.scheduleAbsoluteWithState(null,d,function(){return f.dispose(),l}),this.start(),g},e.prototype.startWithDispose=function(a,b){return this.startWithTiming(a,r.created,r.subscribed,b)},e.prototype.startWithCreate=function(a){return this.startWithTiming(a,r.created,r.subscribed,r.disposed)},e.prototype.createHotObservable=function(){var a=d(arguments,0);return new w(this,a)},e.prototype.createColdObservable=function(){var a=d(arguments,0);return new x(this,a)},e.prototype.createResolvedPromise=function(a,b){return new MockPromise(this,[c.ReactiveTest.onNext(a,b),c.ReactiveTest.onCompleted(a)])},e.prototype.createRejectedPromise=function(a,b){return new MockPromise(this,[c.ReactiveTest.onError(a,b)])},e.prototype.createObserver=function(){return new v(this)},e}(j),c}); | ||
//# sourceMappingURL=rx.testing.map |
@@ -550,3 +550,3 @@ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. | ||
observableProto.timeout = function (dueTime, other, scheduler) { | ||
other || (other = observableThrow(new Error('Timeout'))); | ||
(other == null || typeof other === 'string') && (other = observableThrow(new Error(other || 'Timeout'))); | ||
isScheduler(scheduler) || (scheduler = timeoutScheduler); | ||
@@ -553,0 +553,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){return new n(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function f(a,b,c){return new n(function(d){var e=0,f=a,g=z(b);return c.scheduleRecursiveWithAbsolute(f,function(a){if(g>0){var b=c.now();f+=g,b>=f&&(f=b+g)}d.onNext(e++),a(f)})})}function g(a,b){return new n(function(c){return b.scheduleWithRelative(z(a),function(){c.onNext(0),c.onCompleted()})})}function h(a,b,c){return a===b?new n(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):o(function(){return f(c.now()+a,b,c)})}function i(a,b,c){return new n(function(d){var e,f=!1,g=new u,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 t,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 v(e,g)})}function j(a,b,c){return o(function(){return i(a,b-c.now(),c)})}function k(a,b){return new n(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new v(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))})}var l=c.Observable,m=l.prototype,n=c.AnonymousObservable,o=l.defer,p=l.empty,q=l.never,r=l.throwException,s=(l.fromArray,c.Scheduler.timeout),t=c.SingleAssignmentDisposable,u=c.SerialDisposable,v=c.CompositeDisposable,w=c.RefCountDisposable,x=c.Subject,y=c.internals.addRef,z=c.Scheduler.normalize,A=c.helpers,B=A.isPromise,C=A.isScheduler,D=l.fromPromise,E=(A.notDefined,l.interval=function(a,b){return h(a,a,C(b)?b:s)}),F=l.timer=function(a,b,c){var i;return C(c)||(c=s),b!==d&&"number"==typeof b?i=b:C(b)&&(c=b),a instanceof Date&&i===d?e(a.getTime(),c):a instanceof Date&&i!==d?(i=b,f(a.getTime(),i,c)):i===d?g(a,c):h(a,i,c)};return m.delay=function(a,b){return C(b)||(b=s),a instanceof Date?j(this,a.getTime(),b):i(this,a,b)},m.throttle=function(a,b){C(b)||(b=s);var c=this;return new n(function(d){var e,f=new u,g=!1,h=0,i=c.subscribe(function(c){g=!0,e=c,h++;var i=h,j=new t;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 v(i,f)})},m.windowWithTime=function(a,b,c){var d,e=this;return null==b&&(d=a),C(c)||(c=s),"number"==typeof b?d=b:C(b)&&(d=a,c=b),new n(function(b){function f(){var a=new t,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 x;k.push(a),b.onNext(y(a,h))}e&&k.shift().onCompleted(),f()}))}var g,h,i=d,j=a,k=[],l=new u,m=0;return g=new v(l),h=new w(g),k.push(new x),b.onNext(y(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})},m.windowWithTimeOrCount=function(a,b,c){var d=this;return C(c)||(c=s),new n(function(e){function f(b){var d=new t;g.setDisposable(d),d.setDisposable(c.scheduleWithRelative(a,function(){if(b===k){j=0;var a=++k;l.onCompleted(),l=new x,e.onNext(y(l,i)),f(a)}}))}var g=new u,h=new v(g),i=new w(h),j=0,k=0,l=new x;return e.onNext(y(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 x,e.onNext(y(l,i))),d&&f(c)},function(a){l.onError(a),e.onError(a)},function(){l.onCompleted(),e.onCompleted()})),i})},m.bufferWithTime=function(){return this.windowWithTime.apply(this,arguments).selectMany(function(a){return a.toArray()})},m.bufferWithTimeOrCount=function(a,b,c){return this.windowWithTimeOrCount(a,b,c).selectMany(function(a){return a.toArray()})},m.timeInterval=function(a){var b=this;return C(a)||(a=s),o(function(){var c=a.now();return b.map(function(b){var d=a.now(),e=d-c;return c=d,{value:b,interval:e}})})},m.timestamp=function(a){return C(a)||(a=s),this.map(function(b){return{value:b,timestamp:a.now()}})},m.sample=function(a,b){return C(b)||(b=s),"number"==typeof a?k(this,E(a,b)):k(this,a)},m.timeout=function(a,b,c){b||(b=r(new Error("Timeout"))),C(c)||(c=s);var d=this,e=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new n(function(f){function g(){var d=h;l.setDisposable(c[e](a,function(){h===d&&(B(b)&&(b=D(b)),j.setDisposable(b.subscribe(f)))}))}var h=0,i=new t,j=new u,k=!1,l=new u;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 v(j,l)})},l.generateWithAbsoluteTime=function(a,b,c,d,e,f){return C(f)||(f=s),new n(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()})})},l.generateWithRelativeTime=function(a,b,c,d,e,f){return C(f)||(f=s),new n(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()})})},m.delaySubscription=function(a,b){return this.delayWithSelector(F(a,C(b)?b:s),p)},m.delayWithSelector=function(a,b){var c,d,e=this;return"function"==typeof a?d=a:(c=a,d=b),new n(function(a){var b=new v,f=!1,g=function(){f&&0===b.length&&a.onCompleted()},h=new u,i=function(){h.setDisposable(e.subscribe(function(c){var e;try{e=d(c)}catch(f){return void a.onError(f)}var h=new t;b.add(h),h.setDisposable(e.subscribe(function(){a.onNext(c),b.remove(h),g()},a.onError.bind(a),function(){a.onNext(c),b.remove(h),g()}))},a.onError.bind(a),function(){f=!0,h.dispose(),g()}))};return c?h.setDisposable(c.subscribe(function(){i()},a.onError.bind(a),function(){i()})):i(),new v(h,b)})},m.timeoutWithSelector=function(a,b,c){1===arguments.length&&(b=a,a=q()),c||(c=r(new Error("Timeout")));var d=this;return new n(function(e){function f(a){function b(){return k===d}var d=k,f=new t;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 u,i=new u,j=new t;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(B(c)?D(c):c)}},function(a){g()&&e.onError(a)},function(){g()&&e.onCompleted()})),new v(h,i)})},m.throttleWithSelector=function(a){var b=this;return new n(function(c){var d,e=!1,f=new u,g=0,h=b.subscribe(function(b){var h;try{h=a(b)}catch(i){return void c.onError(i)}B(h)&&(h=D(h)),e=!0,d=b,g++;var j=g,k=new t;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 v(h,f)})},m.skipLastWithTime=function(a,b){C(b)||(b=s);var c=this;return new n(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)},d.onError.bind(d),function(){for(var c=b.now();e.length>0&&c-e[0].interval>=a;)d.onNext(e.shift().value);d.onCompleted()})})},m.takeLastWithTime=function(a,b){var c=this;return C(b)||(b=s),new n(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()},d.onError.bind(d),function(){for(var c=b.now();e.length>0;){var f=e.shift();c-f.interval<=a&&d.onNext(f.value)}d.onCompleted()})})},m.takeLastBufferWithTime=function(a,b){var c=this;return C(b)||(b=s),new n(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()},d.onError.bind(d),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()})})},m.takeWithTime=function(a,b){var c=this;return C(b)||(b=s),new n(function(d){return new v(b.scheduleWithRelative(a,d.onCompleted.bind(d)),c.subscribe(d))})},m.skipWithTime=function(a,b){var c=this;return C(b)||(b=s),new n(function(d){var e=!1;return new v(b.scheduleWithRelative(a,function(){e=!0}),c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d)))})},m.skipUntilWithTime=function(a,b){C(b)||(b=s);var c=this,d=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new n(function(e){var f=!1;return new v(b[d](a,function(){f=!0}),c.subscribe(function(a){f&&e.onNext(a)},e.onError.bind(e),e.onCompleted.bind(e)))})},m.takeUntilWithTime=function(a,b){C(b)||(b=s);var c=this,d=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new n(function(e){return new v(b[d](a,e.onCompleted.bind(e)),c.subscribe(e))})},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 n(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function f(a,b,c){return new n(function(d){var e=0,f=a,g=z(b);return c.scheduleRecursiveWithAbsolute(f,function(a){if(g>0){var b=c.now();f+=g,b>=f&&(f=b+g)}d.onNext(e++),a(f)})})}function g(a,b){return new n(function(c){return b.scheduleWithRelative(z(a),function(){c.onNext(0),c.onCompleted()})})}function h(a,b,c){return a===b?new n(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):o(function(){return f(c.now()+a,b,c)})}function i(a,b,c){return new n(function(d){var e,f=!1,g=new u,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 t,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 v(e,g)})}function j(a,b,c){return o(function(){return i(a,b-c.now(),c)})}function k(a,b){return new n(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new v(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))})}var l=c.Observable,m=l.prototype,n=c.AnonymousObservable,o=l.defer,p=l.empty,q=l.never,r=l.throwException,s=(l.fromArray,c.Scheduler.timeout),t=c.SingleAssignmentDisposable,u=c.SerialDisposable,v=c.CompositeDisposable,w=c.RefCountDisposable,x=c.Subject,y=c.internals.addRef,z=c.Scheduler.normalize,A=c.helpers,B=A.isPromise,C=A.isScheduler,D=l.fromPromise,E=(A.notDefined,l.interval=function(a,b){return h(a,a,C(b)?b:s)}),F=l.timer=function(a,b,c){var i;return C(c)||(c=s),b!==d&&"number"==typeof b?i=b:C(b)&&(c=b),a instanceof Date&&i===d?e(a.getTime(),c):a instanceof Date&&i!==d?(i=b,f(a.getTime(),i,c)):i===d?g(a,c):h(a,i,c)};return m.delay=function(a,b){return C(b)||(b=s),a instanceof Date?j(this,a.getTime(),b):i(this,a,b)},m.throttle=function(a,b){C(b)||(b=s);var c=this;return new n(function(d){var e,f=new u,g=!1,h=0,i=c.subscribe(function(c){g=!0,e=c,h++;var i=h,j=new t;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 v(i,f)})},m.windowWithTime=function(a,b,c){var d,e=this;return null==b&&(d=a),C(c)||(c=s),"number"==typeof b?d=b:C(b)&&(d=a,c=b),new n(function(b){function f(){var a=new t,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 x;k.push(a),b.onNext(y(a,h))}e&&k.shift().onCompleted(),f()}))}var g,h,i=d,j=a,k=[],l=new u,m=0;return g=new v(l),h=new w(g),k.push(new x),b.onNext(y(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})},m.windowWithTimeOrCount=function(a,b,c){var d=this;return C(c)||(c=s),new n(function(e){function f(b){var d=new t;g.setDisposable(d),d.setDisposable(c.scheduleWithRelative(a,function(){if(b===k){j=0;var a=++k;l.onCompleted(),l=new x,e.onNext(y(l,i)),f(a)}}))}var g=new u,h=new v(g),i=new w(h),j=0,k=0,l=new x;return e.onNext(y(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 x,e.onNext(y(l,i))),d&&f(c)},function(a){l.onError(a),e.onError(a)},function(){l.onCompleted(),e.onCompleted()})),i})},m.bufferWithTime=function(){return this.windowWithTime.apply(this,arguments).selectMany(function(a){return a.toArray()})},m.bufferWithTimeOrCount=function(a,b,c){return this.windowWithTimeOrCount(a,b,c).selectMany(function(a){return a.toArray()})},m.timeInterval=function(a){var b=this;return C(a)||(a=s),o(function(){var c=a.now();return b.map(function(b){var d=a.now(),e=d-c;return c=d,{value:b,interval:e}})})},m.timestamp=function(a){return C(a)||(a=s),this.map(function(b){return{value:b,timestamp:a.now()}})},m.sample=function(a,b){return C(b)||(b=s),"number"==typeof a?k(this,E(a,b)):k(this,a)},m.timeout=function(a,b,c){(null==b||"string"==typeof b)&&(b=r(new Error(b||"Timeout"))),C(c)||(c=s);var d=this,e=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new n(function(f){function g(){var d=h;l.setDisposable(c[e](a,function(){h===d&&(B(b)&&(b=D(b)),j.setDisposable(b.subscribe(f)))}))}var h=0,i=new t,j=new u,k=!1,l=new u;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 v(j,l)})},l.generateWithAbsoluteTime=function(a,b,c,d,e,f){return C(f)||(f=s),new n(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()})})},l.generateWithRelativeTime=function(a,b,c,d,e,f){return C(f)||(f=s),new n(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()})})},m.delaySubscription=function(a,b){return this.delayWithSelector(F(a,C(b)?b:s),p)},m.delayWithSelector=function(a,b){var c,d,e=this;return"function"==typeof a?d=a:(c=a,d=b),new n(function(a){var b=new v,f=!1,g=function(){f&&0===b.length&&a.onCompleted()},h=new u,i=function(){h.setDisposable(e.subscribe(function(c){var e;try{e=d(c)}catch(f){return void a.onError(f)}var h=new t;b.add(h),h.setDisposable(e.subscribe(function(){a.onNext(c),b.remove(h),g()},a.onError.bind(a),function(){a.onNext(c),b.remove(h),g()}))},a.onError.bind(a),function(){f=!0,h.dispose(),g()}))};return c?h.setDisposable(c.subscribe(function(){i()},a.onError.bind(a),function(){i()})):i(),new v(h,b)})},m.timeoutWithSelector=function(a,b,c){1===arguments.length&&(b=a,a=q()),c||(c=r(new Error("Timeout")));var d=this;return new n(function(e){function f(a){function b(){return k===d}var d=k,f=new t;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 u,i=new u,j=new t;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(B(c)?D(c):c)}},function(a){g()&&e.onError(a)},function(){g()&&e.onCompleted()})),new v(h,i)})},m.throttleWithSelector=function(a){var b=this;return new n(function(c){var d,e=!1,f=new u,g=0,h=b.subscribe(function(b){var h;try{h=a(b)}catch(i){return void c.onError(i)}B(h)&&(h=D(h)),e=!0,d=b,g++;var j=g,k=new t;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 v(h,f)})},m.skipLastWithTime=function(a,b){C(b)||(b=s);var c=this;return new n(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)},d.onError.bind(d),function(){for(var c=b.now();e.length>0&&c-e[0].interval>=a;)d.onNext(e.shift().value);d.onCompleted()})})},m.takeLastWithTime=function(a,b){var c=this;return C(b)||(b=s),new n(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()},d.onError.bind(d),function(){for(var c=b.now();e.length>0;){var f=e.shift();c-f.interval<=a&&d.onNext(f.value)}d.onCompleted()})})},m.takeLastBufferWithTime=function(a,b){var c=this;return C(b)||(b=s),new n(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()},d.onError.bind(d),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()})})},m.takeWithTime=function(a,b){var c=this;return C(b)||(b=s),new n(function(d){return new v(b.scheduleWithRelative(a,d.onCompleted.bind(d)),c.subscribe(d))})},m.skipWithTime=function(a,b){var c=this;return C(b)||(b=s),new n(function(d){var e=!1;return new v(b.scheduleWithRelative(a,function(){e=!0}),c.subscribe(function(a){e&&d.onNext(a)},d.onError.bind(d),d.onCompleted.bind(d)))})},m.skipUntilWithTime=function(a,b){C(b)||(b=s);var c=this,d=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new n(function(e){var f=!1;return new v(b[d](a,function(){f=!0}),c.subscribe(function(a){f&&e.onNext(a)},e.onError.bind(e),e.onCompleted.bind(e)))})},m.takeUntilWithTime=function(a,b){C(b)||(b=s);var c=this,d=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new n(function(e){return new v(b[d](a,e.onCompleted.bind(e)),c.subscribe(e))})},c}); | ||
//# sourceMappingURL=rx.time.map |
@@ -5,3 +5,3 @@ { | ||
"description": "Library for composing asynchronous and event-based operations in JavaScript", | ||
"version": "2.3.13", | ||
"version": "2.3.14", | ||
"homepage": "https://github.com/Reactive-Extensions/RxJS", | ||
@@ -8,0 +8,0 @@ "author": { |
@@ -117,3 +117,3 @@ [![Build Status](https://travis-ci.org/Reactive-Extensions/RxJS.png)](https://travis-ci.org/Reactive-Extensions/RxJS) | ||
``` | ||
Next, we'll get the user input from an input, listening to the keyup event by using the `Rx.Observable.fromEvent` method. This will either use the event binding from [jQuery](http://jquery.com), [Zepto](http://zeptojs.com/), [AngularJS](https://angularjs.org/) and [Ember.js](http://emberjs.com/) if available, and if not, falls back to the native event binding. This gives you consistent ways of thinking of events depending on your framework, so there are no surprises. | ||
Next, we'll get the user input from an input, listening to the keyup event by using the `Rx.Observable.fromEvent` method. This will either use the event binding from [jQuery](http://jquery.com), [Zepto](http://zeptojs.com/), [AngularJS](https://angularjs.org/), [Backbone.js](http://backbonejs.org/) and [Ember.js](http://emberjs.com/) if available, and if not, falls back to the native event binding. This gives you consistent ways of thinking of events depending on your framework, so there are no surprises. | ||
@@ -189,4 +189,8 @@ ```js | ||
You can find the documentation [here](https://github.com/Reactive-Extensions/RxJS/tree/master/doc) as well as examples [here](https://github.com/Reactive-Extensions/RxJS/tree/master/examples) and plenty of [unit tests](https://github.com/Reactive-Extensions/RxJS/tree/master/tests). | ||
Please check out: | ||
- [The full documentation](https://github.com/Reactive-Extensions/RxJS/tree/master/doc) | ||
- [Our great set of examples](https://github.com/Reactive-Extensions/RxJS/tree/master/examples) | ||
- [Our numerous unit tests](https://github.com/Reactive-Extensions/RxJS/tree/master/tests). | ||
## Resources | ||
@@ -236,2 +240,4 @@ | ||
- Videos | ||
- [Practical Rx with Matthew Podwysocki, Bart de Smet and Jafar Husain](http://channel9.msdn.com/posts/Bart-De-Smet-Jafar-Hussain-Matthew-Podwysocki-Pragmatic-Rx) | ||
- [Netflix and RxJS](http://channel9.msdn.com/posts/Rx-and-Netflix) | ||
- [Hello RxJS - Channel 9](http://channel9.msdn.com/Blogs/Charles/Introducing-RxJS-Reactive-Extensions-for-JavaScript) | ||
@@ -238,0 +244,0 @@ - [MIX 2011](http://channel9.msdn.com/events/MIX/MIX11/HTM07) |
@@ -1,81 +0,71 @@ | ||
/** @private */ | ||
var CatchScheduler = (function (_super) { | ||
var CatchScheduler = (function (__super__) { | ||
function localNow() { | ||
return this._scheduler.now(); | ||
} | ||
function scheduleNow(state, action) { | ||
return this._scheduler.scheduleWithState(state, this._wrap(action)); | ||
} | ||
function scheduleNow(state, action) { | ||
return this._scheduler.scheduleWithState(state, this._wrap(action)); | ||
} | ||
function scheduleRelative(state, dueTime, action) { | ||
return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action)); | ||
} | ||
function scheduleRelative(state, dueTime, action) { | ||
return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action)); | ||
} | ||
function scheduleAbsolute(state, dueTime, action) { | ||
return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action)); | ||
} | ||
function scheduleAbsolute(state, dueTime, action) { | ||
return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action)); | ||
} | ||
inherits(CatchScheduler, __super__); | ||
inherits(CatchScheduler, _super); | ||
function CatchScheduler(scheduler, handler) { | ||
this._scheduler = scheduler; | ||
this._handler = handler; | ||
this._recursiveOriginal = null; | ||
this._recursiveWrapper = null; | ||
__super__.call(this, this._scheduler.now.bind(this._scheduler), scheduleNow, scheduleRelative, scheduleAbsolute); | ||
} | ||
/** @private */ | ||
function CatchScheduler(scheduler, handler) { | ||
this._scheduler = scheduler; | ||
this._handler = handler; | ||
this._recursiveOriginal = null; | ||
this._recursiveWrapper = null; | ||
_super.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute); | ||
CatchScheduler.prototype._clone = function (scheduler) { | ||
return new CatchScheduler(scheduler, this._handler); | ||
}; | ||
CatchScheduler.prototype._wrap = function (action) { | ||
var parent = this; | ||
return function (self, state) { | ||
try { | ||
return action(parent._getRecursiveWrapper(self), state); | ||
} catch (e) { | ||
if (!parent._handler(e)) { throw e; } | ||
return disposableEmpty; | ||
} | ||
}; | ||
}; | ||
/** @private */ | ||
CatchScheduler.prototype._clone = function (scheduler) { | ||
return new CatchScheduler(scheduler, this._handler); | ||
}; | ||
CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) { | ||
if (this._recursiveOriginal !== scheduler) { | ||
this._recursiveOriginal = scheduler; | ||
var wrapper = this._clone(scheduler); | ||
wrapper._recursiveOriginal = scheduler; | ||
wrapper._recursiveWrapper = wrapper; | ||
this._recursiveWrapper = wrapper; | ||
} | ||
return this._recursiveWrapper; | ||
}; | ||
/** @private */ | ||
CatchScheduler.prototype._wrap = function (action) { | ||
var parent = this; | ||
return function (self, state) { | ||
try { | ||
return action(parent._getRecursiveWrapper(self), state); | ||
} catch (e) { | ||
if (!parent._handler(e)) { throw e; } | ||
return disposableEmpty; | ||
} | ||
}; | ||
}; | ||
CatchScheduler.prototype.schedulePeriodicWithState = function (state, period, action) { | ||
var self = this, failed = false, d = new SingleAssignmentDisposable(); | ||
/** @private */ | ||
CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) { | ||
if (this._recursiveOriginal !== scheduler) { | ||
this._recursiveOriginal = scheduler; | ||
var wrapper = this._clone(scheduler); | ||
wrapper._recursiveOriginal = scheduler; | ||
wrapper._recursiveWrapper = wrapper; | ||
this._recursiveWrapper = wrapper; | ||
} | ||
return this._recursiveWrapper; | ||
}; | ||
d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function (state1) { | ||
if (failed) { return null; } | ||
try { | ||
return action(state1); | ||
} catch (e) { | ||
failed = true; | ||
if (!self._handler(e)) { throw e; } | ||
d.dispose(); | ||
return null; | ||
} | ||
})); | ||
/** @private */ | ||
CatchScheduler.prototype.schedulePeriodicWithState = function (state, period, action) { | ||
var self = this, failed = false, d = new SingleAssignmentDisposable(); | ||
return d; | ||
}; | ||
d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function (state1) { | ||
if (failed) { return null; } | ||
try { | ||
return action(state1); | ||
} catch (e) { | ||
failed = true; | ||
if (!self._handler(e)) { throw e; } | ||
d.dispose(); | ||
return null; | ||
} | ||
})); | ||
return d; | ||
}; | ||
return CatchScheduler; | ||
}(Scheduler)); | ||
return CatchScheduler; | ||
}(Scheduler)); |
@@ -1,24 +0,24 @@ | ||
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) { | ||
this.scheduler = scheduler; | ||
this.state = state; | ||
this.action = action; | ||
this.dueTime = dueTime; | ||
this.comparer = comparer || defaultSubComparer; | ||
this.disposable = new SingleAssignmentDisposable(); | ||
} | ||
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) { | ||
this.scheduler = scheduler; | ||
this.state = state; | ||
this.action = action; | ||
this.dueTime = dueTime; | ||
this.comparer = comparer || defaultSubComparer; | ||
this.disposable = new SingleAssignmentDisposable(); | ||
} | ||
ScheduledItem.prototype.invoke = function () { | ||
this.disposable.setDisposable(this.invokeCore()); | ||
}; | ||
ScheduledItem.prototype.invoke = function () { | ||
this.disposable.setDisposable(this.invokeCore()); | ||
}; | ||
ScheduledItem.prototype.compareTo = function (other) { | ||
return this.comparer(this.dueTime, other.dueTime); | ||
}; | ||
ScheduledItem.prototype.compareTo = function (other) { | ||
return this.comparer(this.dueTime, other.dueTime); | ||
}; | ||
ScheduledItem.prototype.isCancelled = function () { | ||
return this.disposable.isDisposed; | ||
}; | ||
ScheduledItem.prototype.isCancelled = function () { | ||
return this.disposable.isDisposed; | ||
}; | ||
ScheduledItem.prototype.invokeCore = function () { | ||
return this.action(this.scheduler, this.state); | ||
}; | ||
ScheduledItem.prototype.invokeCore = function () { | ||
return this.action(this.scheduler, this.state); | ||
}; |
@@ -1,28 +0,28 @@ | ||
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () { | ||
function tick(command, recurse) { | ||
recurse(0, this._period); | ||
try { | ||
this._state = this._action(this._state); | ||
} catch (e) { | ||
this._cancel.dispose(); | ||
throw e; | ||
} | ||
} | ||
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () { | ||
function tick(command, recurse) { | ||
recurse(0, this._period); | ||
try { | ||
this._state = this._action(this._state); | ||
} catch (e) { | ||
this._cancel.dispose(); | ||
throw e; | ||
} | ||
} | ||
function SchedulePeriodicRecursive(scheduler, state, period, action) { | ||
this._scheduler = scheduler; | ||
this._state = state; | ||
this._period = period; | ||
this._action = action; | ||
} | ||
function SchedulePeriodicRecursive(scheduler, state, period, action) { | ||
this._scheduler = scheduler; | ||
this._state = state; | ||
this._period = period; | ||
this._action = action; | ||
} | ||
SchedulePeriodicRecursive.prototype.start = function () { | ||
var d = new SingleAssignmentDisposable(); | ||
this._cancel = d; | ||
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this))); | ||
SchedulePeriodicRecursive.prototype.start = function () { | ||
var d = new SingleAssignmentDisposable(); | ||
this._cancel = d; | ||
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this))); | ||
return d; | ||
}; | ||
return d; | ||
}; | ||
return SchedulePeriodicRecursive; | ||
}()); | ||
return SchedulePeriodicRecursive; | ||
}()); |
@@ -11,50 +11,2 @@ /** Provides a set of static properties to access commonly used schedulers. */ | ||
function invokeRecImmediate(scheduler, pair) { | ||
var state = pair.first, action = pair.second, group = new CompositeDisposable(), | ||
recursiveAction = function (state1) { | ||
action(state1, function (state2) { | ||
var isAdded = false, isDone = false, | ||
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) { | ||
if (isAdded) { | ||
group.remove(d); | ||
} else { | ||
isDone = true; | ||
} | ||
recursiveAction(state3); | ||
return disposableEmpty; | ||
}); | ||
if (!isDone) { | ||
group.add(d); | ||
isAdded = true; | ||
} | ||
}); | ||
}; | ||
recursiveAction(state); | ||
return group; | ||
} | ||
function invokeRecDate(scheduler, pair, method) { | ||
var state = pair.first, action = pair.second, group = new CompositeDisposable(), | ||
recursiveAction = function (state1) { | ||
action(state1, function (state2, dueTime1) { | ||
var isAdded = false, isDone = false, | ||
d = scheduler[method].call(scheduler, state2, dueTime1, function (scheduler1, state3) { | ||
if (isAdded) { | ||
group.remove(d); | ||
} else { | ||
isDone = true; | ||
} | ||
recursiveAction(state3); | ||
return disposableEmpty; | ||
}); | ||
if (!isDone) { | ||
group.add(d); | ||
isAdded = true; | ||
} | ||
}); | ||
}; | ||
recursiveAction(state); | ||
return group; | ||
} | ||
function invokeAction(scheduler, action) { | ||
@@ -61,0 +13,0 @@ action(); |
@@ -230,3 +230,3 @@ /** `Object#toString` result shortcuts */ | ||
var size = 0; | ||
result = true; | ||
var result = true; | ||
@@ -233,0 +233,0 @@ // add `a` and `b` to the stack of traversed objects |
@@ -1,21 +0,18 @@ | ||
/** | ||
* 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. | ||
* @example | ||
* 1 - res = source.aggregate(function (acc, x) { return acc + x; }); | ||
* 2 - res = source.aggregate(0, function (acc, x) { return acc + x; }); | ||
* @param {Mixed} [seed] The initial accumulator value. | ||
* @param {Function} accumulator An accumulator function to be invoked on each element. | ||
* @returns {Observable} An observable sequence containing a single element with the final accumulator value. | ||
*/ | ||
observableProto.aggregate = function () { | ||
var seed, hasSeed, accumulator; | ||
if (arguments.length === 2) { | ||
seed = arguments[0]; | ||
hasSeed = true; | ||
accumulator = arguments[1]; | ||
} else { | ||
accumulator = arguments[0]; | ||
} | ||
return hasSeed ? this.scan(seed, accumulator).startWith(seed).finalValue() : this.scan(accumulator).finalValue(); | ||
}; | ||
/** | ||
* 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 {Mixed} [seed] The initial accumulator value. | ||
* @param {Function} accumulator An accumulator function to be invoked on each element. | ||
* @returns {Observable} An observable sequence containing a single element with the final accumulator value. | ||
*/ | ||
observableProto.aggregate = function () { | ||
var seed, hasSeed, accumulator; | ||
if (arguments.length === 2) { | ||
seed = arguments[0]; | ||
hasSeed = true; | ||
accumulator = arguments[1]; | ||
} else { | ||
accumulator = arguments[0]; | ||
} | ||
return hasSeed ? this.scan(seed, accumulator).startWith(seed).finalValue() : this.scan(accumulator).finalValue(); | ||
}; |
@@ -1,27 +0,21 @@ | ||
/** | ||
* Computes the average of an observable sequence of values that are in the sequence or obtained by invoking a transform function on each element of the input sequence if present. | ||
* @example | ||
* var res = res = source.average(); | ||
* var res = res = source.average(function (x) { return x.value; }); | ||
* @param {Function} [selector] A transform function to apply to each element. | ||
* @param {Any} [thisArg] Object to use as this when executing callback. | ||
* @returns {Observable} An observable sequence containing a single element with the average of the sequence of values. | ||
*/ | ||
observableProto.average = function (keySelector, thisArg) { | ||
return keySelector ? | ||
this.select(keySelector, thisArg).average() : | ||
this.scan({ | ||
sum: 0, | ||
count: 0 | ||
}, function (prev, cur) { | ||
return { | ||
sum: prev.sum + cur, | ||
count: prev.count + 1 | ||
}; | ||
}).finalValue().select(function (s) { | ||
if (s.count === 0) { | ||
throw new Error('The input sequence was empty'); | ||
} | ||
return s.sum / s.count; | ||
}); | ||
}; | ||
/** | ||
* Computes the average of an observable sequence of values that are in the sequence or obtained by invoking a transform function on each element of the input sequence if present. | ||
* @param {Function} [selector] A transform function to apply to each element. | ||
* @param {Any} [thisArg] Object to use as this when executing callback. | ||
* @returns {Observable} An observable sequence containing a single element with the average of the sequence of values. | ||
*/ | ||
observableProto.average = function (keySelector, thisArg) { | ||
return keySelector && isFunction(keySelector) ? | ||
this.select(keySelector, thisArg).average() : | ||
this.scan({sum: 0, count: 0 }, function (prev, cur) { | ||
return { | ||
sum: prev.sum + cur, | ||
count: prev.count + 1 | ||
}; | ||
}).finalValue().map(function (s) { | ||
if (s.count === 0) { | ||
throw new Error('The input sequence was empty'); | ||
} | ||
return s.sum / s.count; | ||
}); | ||
}; |
@@ -1,41 +0,44 @@ | ||
function concatMap(source, selector, thisArg) { | ||
return source.map(function (x, i) { | ||
var result = selector.call(thisArg, x, i); | ||
return isPromise(result) ? observableFromPromise(result) : result; | ||
}).concatAll(); | ||
} | ||
function concatMap(source, selector, thisArg) { | ||
return source.map(function (x, i) { | ||
var result = selector.call(thisArg, x, i, source); | ||
isPromise(result) && (result = observableFromPromise(result)); | ||
(Array.isArray(result) || isIterable(result)) && (result = observableFrom(result)); | ||
return result; | ||
}).concatAll(); | ||
} | ||
/** | ||
* One of the Following: | ||
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. | ||
* | ||
* @example | ||
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }); | ||
* Or: | ||
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence. | ||
* | ||
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; }); | ||
* Or: | ||
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence. | ||
* | ||
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3])); | ||
* @param selector A transform function to apply to each element or an observable sequence to project each element from the | ||
* source sequence onto which could be either an observable or Promise. | ||
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence. | ||
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element. | ||
*/ | ||
observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) { | ||
if (resultSelector) { | ||
return this.concatMap(function (x, i) { | ||
var selectorResult = selector(x, i), | ||
result = isPromise(selectorResult) ? observableFromPromise(selectorResult) : selectorResult; | ||
/** | ||
* One of the Following: | ||
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. | ||
* | ||
* @example | ||
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }); | ||
* Or: | ||
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence. | ||
* | ||
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; }); | ||
* Or: | ||
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence. | ||
* | ||
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3])); | ||
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the | ||
* source sequence onto which could be either an observable or Promise. | ||
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence. | ||
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element. | ||
*/ | ||
observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) { | ||
if (typeof selector === 'function' && typeof resultSelector === 'function') { | ||
return this.concatMap(function (x, i) { | ||
var selectorResult = selector(x, i); | ||
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult)); | ||
(Array.isArray(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult)); | ||
return result.map(function (y) { | ||
return resultSelector(x, y, i); | ||
}); | ||
}); | ||
} | ||
return typeof selector === 'function' ? | ||
concatMap(this, selector, thisArg) : | ||
concatMap(this, function () { return selector; }); | ||
}; | ||
return selectorResult.map(function (y, i2) { | ||
return resultSelector(x, y, i, i2); | ||
}); | ||
}); | ||
} | ||
return typeof selector === 'function' ? | ||
concatMap(this, selector, thisArg) : | ||
concatMap(this, function () { return selector; }); | ||
}; |
@@ -43,3 +43,3 @@ var maxSafeInteger = Math.pow(2, 53) - 1; | ||
*/ | ||
Observable.from = function (iterable, mapFn, thisArg, scheduler) { | ||
var observableFrom = Observable.from = function (iterable, mapFn, thisArg, scheduler) { | ||
if (iterable == null) { | ||
@@ -62,3 +62,9 @@ throw new Error('iterable cannot be null.') | ||
if (objIsIterable) { | ||
var next = it.next(); | ||
var next; | ||
try { | ||
next = it.next(); | ||
} catch (e) { | ||
observer.onError(e); | ||
return; | ||
} | ||
if (next.done) { | ||
@@ -71,3 +77,3 @@ observer.onCompleted(); | ||
} else { | ||
result = list[i]; | ||
result = !!list.charAt ? list.charAt(i) : list[i]; | ||
} | ||
@@ -74,0 +80,0 @@ |
@@ -1,18 +0,15 @@ | ||
/** | ||
* 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. | ||
* @example | ||
* 1 - res = source.reduce(function (acc, x) { return acc + x; }); | ||
* 2 - res = source.reduce(function (acc, x) { return acc + x; }, 0); | ||
* @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 seed, hasSeed; | ||
if (arguments.length === 2) { | ||
hasSeed = true; | ||
seed = arguments[1]; | ||
} | ||
return hasSeed ? this.scan(seed, accumulator).startWith(seed).finalValue() : this.scan(accumulator).finalValue(); | ||
}; | ||
/** | ||
* 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 seed, hasSeed; | ||
if (arguments.length === 2) { | ||
hasSeed = true; | ||
seed = arguments[1]; | ||
} | ||
return hasSeed ? this.scan(seed, accumulator).startWith(seed).finalValue() : this.scan(accumulator).finalValue(); | ||
}; |
@@ -1,42 +0,44 @@ | ||
function flatMap(source, selector, thisArg) { | ||
return source.map(function (x, i) { | ||
var result = selector.call(thisArg, x, i); | ||
return isPromise(result) ? observableFromPromise(result) : result; | ||
}).mergeObservable(); | ||
} | ||
function flatMap(source, selector, thisArg) { | ||
return source.map(function (x, i) { | ||
var result = selector.call(thisArg, x, i, source); | ||
isPromise(result) && (result = observableFromPromise(result)); | ||
(Array.isArray(result) || isIterable(result)) && (result = observableFrom(result)); | ||
return result; | ||
}).mergeObservable(); | ||
} | ||
/** | ||
* One of the Following: | ||
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. | ||
* | ||
* @example | ||
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }); | ||
* Or: | ||
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence. | ||
* | ||
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; }); | ||
* Or: | ||
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence. | ||
* | ||
* var res = source.selectMany(Rx.Observable.fromArray([1,2,3])); | ||
* @param selector A transform function to apply to each element or an observable sequence to project each element from the | ||
* source sequence onto which could be either an observable or Promise. | ||
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence. | ||
* @param {Any} [thisArg] Object to use as this when executing callback. | ||
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element. | ||
*/ | ||
observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector, thisArg) { | ||
if (resultSelector) { | ||
return this.flatMap(function (x, i) { | ||
var selectorResult = selector(x, i), | ||
result = isPromise(selectorResult) ? observableFromPromise(selectorResult) : selectorResult; | ||
/** | ||
* One of the Following: | ||
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence. | ||
* | ||
* @example | ||
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }); | ||
* Or: | ||
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence. | ||
* | ||
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; }); | ||
* Or: | ||
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence. | ||
* | ||
* var res = source.selectMany(Rx.Observable.fromArray([1,2,3])); | ||
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the source sequence onto which could be either an observable or Promise. | ||
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence. | ||
* @param {Any} [thisArg] Object to use as this when executing callback. | ||
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element. | ||
*/ | ||
observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector, thisArg) { | ||
if (typeof selector === 'function' && typeof resultSelector === 'function') { | ||
return this.flatMap(function (x, i) { | ||
var selectorResult = selector(x, i); | ||
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult)); | ||
(Array.isArray(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult)); | ||
return result.map(function (y) { | ||
return resultSelector(x, y, i); | ||
}); | ||
}, thisArg); | ||
} | ||
return typeof selector === 'function' ? | ||
flatMap(this, selector, thisArg) : | ||
flatMap(this, function () { return selector; }); | ||
}; | ||
return selectorResult.map(function (y, i2) { | ||
return resultSelector(x, y, i, i2); | ||
}); | ||
}, thisArg); | ||
} | ||
return typeof selector === 'function' ? | ||
flatMap(this, selector, thisArg) : | ||
flatMap(this, function () { return selector; }); | ||
}; |
@@ -9,3 +9,3 @@ /** | ||
observableProto.timeout = function (dueTime, other, scheduler) { | ||
other || (other = observableThrow(new Error('Timeout'))); | ||
(other == null || typeof other === 'string') && (other = observableThrow(new Error(other || 'Timeout'))); | ||
isScheduler(scheduler) || (scheduler = timeoutScheduler); | ||
@@ -12,0 +12,0 @@ |
@@ -78,5 +78,5 @@ /** | ||
return function (exception) { | ||
return function (e) { | ||
var notification = new Notification('E'); | ||
notification.exception = exception; | ||
notification.exception = e; | ||
notification._accept = _accept; | ||
@@ -86,3 +86,3 @@ notification._acceptObservable = _acceptObservable; | ||
return notification; | ||
}; | ||
}; | ||
}()); | ||
@@ -96,13 +96,13 @@ | ||
function _accept (onNext, onError, onCompleted) { return onCompleted(); } | ||
function _acceptObservable(observer) { return observer.onCompleted(); } | ||
function toString () { return 'OnCompleted()'; } | ||
function _accept (onNext, onError, onCompleted) { return onCompleted(); } | ||
function _acceptObservable(observer) { return observer.onCompleted(); } | ||
function toString () { return 'OnCompleted()'; } | ||
return function () { | ||
var notification = new Notification('C'); | ||
notification._accept = _accept; | ||
notification._acceptObservable = _acceptObservable; | ||
notification.toString = toString; | ||
return notification; | ||
}; | ||
return function () { | ||
var notification = new Notification('C'); | ||
notification._accept = _accept; | ||
notification._acceptObservable = _acceptObservable; | ||
notification.toString = toString; | ||
return notification; | ||
}; | ||
}()); |
@@ -1,46 +0,41 @@ | ||
/** @private */ | ||
var HotObservable = (function (_super) { | ||
var HotObservable = (function (__super__) { | ||
function subscribe(observer) { | ||
var observable = this; | ||
this.observers.push(observer); | ||
this.subscriptions.push(new Subscription(this.scheduler.clock)); | ||
var index = this.subscriptions.length - 1; | ||
return disposableCreate(function () { | ||
var idx = observable.observers.indexOf(observer); | ||
observable.observers.splice(idx, 1); | ||
observable.subscriptions[index] = new Subscription(observable.subscriptions[index].subscribe, observable.scheduler.clock); | ||
}); | ||
} | ||
function subscribe(observer) { | ||
var observable = this; | ||
this.observers.push(observer); | ||
this.subscriptions.push(new Subscription(this.scheduler.clock)); | ||
var index = this.subscriptions.length - 1; | ||
return disposableCreate(function () { | ||
var idx = observable.observers.indexOf(observer); | ||
observable.observers.splice(idx, 1); | ||
observable.subscriptions[index] = new Subscription(observable.subscriptions[index].subscribe, observable.scheduler.clock); | ||
}); | ||
} | ||
inherits(HotObservable, _super); | ||
inherits(HotObservable, __super__); | ||
/** | ||
* @private | ||
* @constructor | ||
*/ | ||
function HotObservable(scheduler, messages) { | ||
_super.call(this, subscribe); | ||
var message, notification, observable = this; | ||
this.scheduler = scheduler; | ||
this.messages = messages; | ||
this.subscriptions = []; | ||
this.observers = []; | ||
for (var i = 0, len = this.messages.length; i < len; i++) { | ||
message = this.messages[i]; | ||
notification = message.value; | ||
(function (innerNotification) { | ||
scheduler.scheduleAbsoluteWithState(null, message.time, function () { | ||
var obs = observable.observers.slice(0); | ||
function HotObservable(scheduler, messages) { | ||
__super__.call(this, subscribe); | ||
var message, notification, observable = this; | ||
this.scheduler = scheduler; | ||
this.messages = messages; | ||
this.subscriptions = []; | ||
this.observers = []; | ||
for (var i = 0, len = this.messages.length; i < len; i++) { | ||
message = this.messages[i]; | ||
notification = message.value; | ||
(function (innerNotification) { | ||
scheduler.scheduleAbsoluteWithState(null, message.time, function () { | ||
var obs = observable.observers.slice(0); | ||
for (var j = 0, jLen = obs.length; j < jLen; j++) { | ||
innerNotification.accept(obs[j]); | ||
} | ||
return disposableEmpty; | ||
}); | ||
})(notification); | ||
for (var j = 0, jLen = obs.length; j < jLen; j++) { | ||
innerNotification.accept(obs[j]); | ||
} | ||
} | ||
return disposableEmpty; | ||
}); | ||
})(notification); | ||
} | ||
} | ||
return HotObservable; | ||
})(Observable); | ||
return HotObservable; | ||
})(Observable); |
@@ -1,82 +0,80 @@ | ||
function OnNextPredicate(predicate) { | ||
this.predicate = predicate; | ||
}; | ||
function OnNextPredicate(predicate) { | ||
this.predicate = predicate; | ||
}; | ||
OnNextPredicate.prototype.equals = function (other) { | ||
if (other === this) { return true; } | ||
if (other == null) { return false; } | ||
if (other.kind !== 'N') { return false; } | ||
return this.predicate(other.value); | ||
}; | ||
OnNextPredicate.prototype.equals = function (other) { | ||
if (other === this) { return true; } | ||
if (other == null) { return false; } | ||
if (other.kind !== 'N') { return false; } | ||
return this.predicate(other.value); | ||
}; | ||
function OnErrorPredicate(predicate) { | ||
this.predicate = predicate; | ||
}; | ||
function OnErrorPredicate(predicate) { | ||
this.predicate = predicate; | ||
}; | ||
OnErrorPredicate.prototype.equals = function (other) { | ||
if (other === this) { return true; } | ||
if (other == null) { return false; } | ||
if (other.kind !== 'E') { return false; } | ||
return this.predicate(other.exception); | ||
}; | ||
OnErrorPredicate.prototype.equals = function (other) { | ||
if (other === this) { return true; } | ||
if (other == null) { return false; } | ||
if (other.kind !== 'E') { return false; } | ||
return this.predicate(other.exception); | ||
}; | ||
var ReactiveTest = Rx.ReactiveTest = { | ||
/** Default virtual time used for creation of observable sequences in unit tests. */ | ||
created: 100, | ||
/** Default virtual time used to subscribe to observable sequences in unit tests. */ | ||
subscribed: 200, | ||
/** Default virtual time used to dispose subscriptions in unit tests. */ | ||
disposed: 1000, | ||
var ReactiveTest = Rx.ReactiveTest = { | ||
/** Default virtual time used for creation of observable sequences in unit tests. */ | ||
created: 100, | ||
/** Default virtual time used to subscribe to observable sequences in unit tests. */ | ||
subscribed: 200, | ||
/** Default virtual time used to dispose subscriptions in unit tests. */ | ||
disposed: 1000, | ||
/** | ||
* Factory method for an OnNext notification record at a given time with a given value or a predicate function. | ||
* | ||
* 1 - ReactiveTest.onNext(200, 42); | ||
* 2 - ReactiveTest.onNext(200, function (x) { return x.length == 2; }); | ||
* | ||
* @param ticks Recorded virtual time the OnNext notification occurs. | ||
* @param value Recorded value stored in the OnNext notification or a predicate. | ||
* @return Recorded OnNext notification. | ||
*/ | ||
onNext: function (ticks, value) { | ||
if (typeof value === 'function') { | ||
return new Recorded(ticks, new OnNextPredicate(value)); | ||
} | ||
return new Recorded(ticks, Notification.createOnNext(value)); | ||
}, | ||
/** | ||
* Factory method for an OnError notification record at a given time with a given error. | ||
* | ||
* 1 - ReactiveTest.onNext(200, new Error('error')); | ||
* 2 - ReactiveTest.onNext(200, function (e) { return e.message === 'error'; }); | ||
* | ||
* @param ticks Recorded virtual time the OnError notification occurs. | ||
* @param exception Recorded exception stored in the OnError notification. | ||
* @return Recorded OnError notification. | ||
*/ | ||
onError: function (ticks, exception) { | ||
if (typeof exception === 'function') { | ||
return new Recorded(ticks, new OnErrorPredicate(exception)); | ||
} | ||
return new Recorded(ticks, Notification.createOnError(exception)); | ||
}, | ||
/** | ||
* Factory method for an OnCompleted notification record at a given time. | ||
* | ||
* @param ticks Recorded virtual time the OnCompleted notification occurs. | ||
* @return Recorded OnCompleted notification. | ||
*/ | ||
onCompleted: function (ticks) { | ||
return new Recorded(ticks, Notification.createOnCompleted()); | ||
}, | ||
/** | ||
* Factory method for a subscription record based on a given subscription and disposal time. | ||
* | ||
* @param start Virtual time indicating when the subscription was created. | ||
* @param end Virtual time indicating when the subscription was disposed. | ||
* @return Subscription object. | ||
*/ | ||
subscribe: function (start, end) { | ||
return new Subscription(start, end); | ||
} | ||
}; | ||
/** | ||
* Factory method for an OnNext notification record at a given time with a given value or a predicate function. | ||
* | ||
* 1 - ReactiveTest.onNext(200, 42); | ||
* 2 - ReactiveTest.onNext(200, function (x) { return x.length == 2; }); | ||
* | ||
* @param ticks Recorded virtual time the OnNext notification occurs. | ||
* @param value Recorded value stored in the OnNext notification or a predicate. | ||
* @return Recorded OnNext notification. | ||
*/ | ||
onNext: function (ticks, value) { | ||
return typeof value === 'function' ? | ||
new Recorded(ticks, new OnNextPredicate(value)) : | ||
new Recorded(ticks, Notification.createOnNext(value)); | ||
}, | ||
/** | ||
* Factory method for an OnError notification record at a given time with a given error. | ||
* | ||
* 1 - ReactiveTest.onNext(200, new Error('error')); | ||
* 2 - ReactiveTest.onNext(200, function (e) { return e.message === 'error'; }); | ||
* | ||
* @param ticks Recorded virtual time the OnError notification occurs. | ||
* @param exception Recorded exception stored in the OnError notification. | ||
* @return Recorded OnError notification. | ||
*/ | ||
onError: function (ticks, error) { | ||
return typeof error === 'function' ? | ||
new Recorded(ticks, new OnErrorPredicate(error)) : | ||
new Recorded(ticks, Notification.createOnError(error)); | ||
}, | ||
/** | ||
* Factory method for an OnCompleted notification record at a given time. | ||
* | ||
* @param ticks Recorded virtual time the OnCompleted notification occurs. | ||
* @return Recorded OnCompleted notification. | ||
*/ | ||
onCompleted: function (ticks) { | ||
return new Recorded(ticks, Notification.createOnCompleted()); | ||
}, | ||
/** | ||
* Factory method for a subscription record based on a given subscription and disposal time. | ||
* | ||
* @param start Virtual time indicating when the subscription was created. | ||
* @param end Virtual time indicating when the subscription was disposed. | ||
* @return Subscription object. | ||
*/ | ||
subscribe: function (start, end) { | ||
return new Subscription(start, end); | ||
} | ||
}; |
@@ -1,132 +0,156 @@ | ||
/** Virtual time scheduler used for testing applications and libraries built using Reactive Extensions. */ | ||
Rx.TestScheduler = (function (_super) { | ||
inherits(TestScheduler, _super); | ||
/** Virtual time scheduler used for testing applications and libraries built using Reactive Extensions. */ | ||
Rx.TestScheduler = (function (__super__) { | ||
inherits(TestScheduler, __super__); | ||
function baseComparer(x, y) { | ||
return x > y ? 1 : (x < y ? -1 : 0); | ||
} | ||
function baseComparer(x, y) { | ||
return x > y ? 1 : (x < y ? -1 : 0); | ||
} | ||
/** @constructor */ | ||
function TestScheduler() { | ||
_super.call(this, 0, baseComparer); | ||
} | ||
function TestScheduler() { | ||
__super__.call(this, 0, baseComparer); | ||
} | ||
/** | ||
* Schedules an action to be executed at the specified virtual time. | ||
* | ||
* @param state State passed to the action to be executed. | ||
* @param dueTime Absolute virtual time at which to execute the action. | ||
* @param action Action to be executed. | ||
* @return Disposable object used to cancel the scheduled action (best effort). | ||
*/ | ||
TestScheduler.prototype.scheduleAbsoluteWithState = function (state, dueTime, action) { | ||
if (dueTime <= this.clock) { | ||
dueTime = this.clock + 1; | ||
} | ||
return _super.prototype.scheduleAbsoluteWithState.call(this, state, dueTime, action); | ||
}; | ||
/** | ||
* Adds a relative virtual time to an absolute virtual time value. | ||
* | ||
* @param absolute Absolute virtual time value. | ||
* @param relative Relative virtual time value to add. | ||
* @return Resulting absolute virtual time sum value. | ||
*/ | ||
TestScheduler.prototype.add = function (absolute, relative) { | ||
return absolute + relative; | ||
}; | ||
/** | ||
* Converts the absolute virtual time value to a DateTimeOffset value. | ||
* | ||
* @param absolute Absolute virtual time value to convert. | ||
* @return Corresponding DateTimeOffset value. | ||
*/ | ||
TestScheduler.prototype.toDateTimeOffset = function (absolute) { | ||
return new Date(absolute).getTime(); | ||
}; | ||
/** | ||
* Converts the TimeSpan value to a relative virtual time value. | ||
* | ||
* @param timeSpan TimeSpan value to convert. | ||
* @return Corresponding relative virtual time value. | ||
*/ | ||
TestScheduler.prototype.toRelative = function (timeSpan) { | ||
return timeSpan; | ||
}; | ||
/** | ||
* Starts the test scheduler and uses the specified virtual times to invoke the factory function, subscribe to the resulting sequence, and dispose the subscription. | ||
* | ||
* @param create Factory method to create an observable sequence. | ||
* @param created Virtual time at which to invoke the factory to create an observable sequence. | ||
* @param subscribed Virtual time at which to subscribe to the created observable sequence. | ||
* @param disposed Virtual time at which to dispose the subscription. | ||
* @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active. | ||
*/ | ||
TestScheduler.prototype.startWithTiming = function (create, created, subscribed, disposed) { | ||
var observer = this.createObserver(), source, subscription; | ||
this.scheduleAbsoluteWithState(null, created, function () { | ||
source = create(); | ||
return disposableEmpty; | ||
}); | ||
this.scheduleAbsoluteWithState(null, subscribed, function () { | ||
subscription = source.subscribe(observer); | ||
return disposableEmpty; | ||
}); | ||
this.scheduleAbsoluteWithState(null, disposed, function () { | ||
subscription.dispose(); | ||
return disposableEmpty; | ||
}); | ||
this.start(); | ||
return observer; | ||
}; | ||
/** | ||
* Starts the test scheduler and uses the specified virtual time to dispose the subscription to the sequence obtained through the factory function. | ||
* Default virtual times are used for factory invocation and sequence subscription. | ||
* | ||
* @param create Factory method to create an observable sequence. | ||
* @param disposed Virtual time at which to dispose the subscription. | ||
* @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active. | ||
*/ | ||
TestScheduler.prototype.startWithDispose = function (create, disposed) { | ||
return this.startWithTiming(create, ReactiveTest.created, ReactiveTest.subscribed, disposed); | ||
}; | ||
/** | ||
* Starts the test scheduler and uses default virtual times to invoke the factory function, to subscribe to the resulting sequence, and to dispose the subscription. | ||
* | ||
* @param create Factory method to create an observable sequence. | ||
* @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active. | ||
*/ | ||
TestScheduler.prototype.startWithCreate = function (create) { | ||
return this.startWithTiming(create, ReactiveTest.created, ReactiveTest.subscribed, ReactiveTest.disposed); | ||
}; | ||
/** | ||
* Creates a hot observable using the specified timestamped notification messages either as an array or arguments. | ||
* | ||
* @param messages Notifications to surface through the created sequence at their specified absolute virtual times. | ||
* @return Hot observable sequence that can be used to assert the timing of subscriptions and notifications. | ||
*/ | ||
TestScheduler.prototype.createHotObservable = function () { | ||
var messages = argsOrArray(arguments, 0); | ||
return new HotObservable(this, messages); | ||
}; | ||
/** | ||
* Creates a cold observable using the specified timestamped notification messages either as an array or arguments. | ||
* | ||
* @param messages Notifications to surface through the created sequence at their specified virtual time offsets from the sequence subscription time. | ||
* @return Cold observable sequence that can be used to assert the timing of subscriptions and notifications. | ||
*/ | ||
TestScheduler.prototype.createColdObservable = function () { | ||
var messages = argsOrArray(arguments, 0); | ||
return new ColdObservable(this, messages); | ||
}; | ||
/** | ||
* Creates an observer that records received notification messages and timestamps those. | ||
* | ||
* @return Observer that can be used to assert the timing of received notifications. | ||
*/ | ||
TestScheduler.prototype.createObserver = function () { | ||
return new MockObserver(this); | ||
}; | ||
/** | ||
* Schedules an action to be executed at the specified virtual time. | ||
* | ||
* @param state State passed to the action to be executed. | ||
* @param dueTime Absolute virtual time at which to execute the action. | ||
* @param action Action to be executed. | ||
* @return Disposable object used to cancel the scheduled action (best effort). | ||
*/ | ||
TestScheduler.prototype.scheduleAbsoluteWithState = function (state, dueTime, action) { | ||
dueTime <= this.clock && (dueTime = this.clock + 1); | ||
return __super__.prototype.scheduleAbsoluteWithState.call(this, state, dueTime, action); | ||
}; | ||
/** | ||
* Adds a relative virtual time to an absolute virtual time value. | ||
* | ||
* @param absolute Absolute virtual time value. | ||
* @param relative Relative virtual time value to add. | ||
* @return Resulting absolute virtual time sum value. | ||
*/ | ||
TestScheduler.prototype.add = function (absolute, relative) { | ||
return absolute + relative; | ||
}; | ||
/** | ||
* Converts the absolute virtual time value to a DateTimeOffset value. | ||
* | ||
* @param absolute Absolute virtual time value to convert. | ||
* @return Corresponding DateTimeOffset value. | ||
*/ | ||
TestScheduler.prototype.toDateTimeOffset = function (absolute) { | ||
return new Date(absolute).getTime(); | ||
}; | ||
/** | ||
* Converts the TimeSpan value to a relative virtual time value. | ||
* | ||
* @param timeSpan TimeSpan value to convert. | ||
* @return Corresponding relative virtual time value. | ||
*/ | ||
TestScheduler.prototype.toRelative = function (timeSpan) { | ||
return timeSpan; | ||
}; | ||
/** | ||
* Starts the test scheduler and uses the specified virtual times to invoke the factory function, subscribe to the resulting sequence, and dispose the subscription. | ||
* | ||
* @param create Factory method to create an observable sequence. | ||
* @param created Virtual time at which to invoke the factory to create an observable sequence. | ||
* @param subscribed Virtual time at which to subscribe to the created observable sequence. | ||
* @param disposed Virtual time at which to dispose the subscription. | ||
* @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active. | ||
*/ | ||
TestScheduler.prototype.startWithTiming = function (create, created, subscribed, disposed) { | ||
var observer = this.createObserver(), source, subscription; | ||
return TestScheduler; | ||
})(VirtualTimeScheduler); | ||
this.scheduleAbsoluteWithState(null, created, function () { | ||
source = create(); | ||
return disposableEmpty; | ||
}); | ||
this.scheduleAbsoluteWithState(null, subscribed, function () { | ||
subscription = source.subscribe(observer); | ||
return disposableEmpty; | ||
}); | ||
this.scheduleAbsoluteWithState(null, disposed, function () { | ||
subscription.dispose(); | ||
return disposableEmpty; | ||
}); | ||
this.start(); | ||
return observer; | ||
}; | ||
/** | ||
* Starts the test scheduler and uses the specified virtual time to dispose the subscription to the sequence obtained through the factory function. | ||
* Default virtual times are used for factory invocation and sequence subscription. | ||
* | ||
* @param create Factory method to create an observable sequence. | ||
* @param disposed Virtual time at which to dispose the subscription. | ||
* @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active. | ||
*/ | ||
TestScheduler.prototype.startWithDispose = function (create, disposed) { | ||
return this.startWithTiming(create, ReactiveTest.created, ReactiveTest.subscribed, disposed); | ||
}; | ||
/** | ||
* Starts the test scheduler and uses default virtual times to invoke the factory function, to subscribe to the resulting sequence, and to dispose the subscription. | ||
* | ||
* @param create Factory method to create an observable sequence. | ||
* @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active. | ||
*/ | ||
TestScheduler.prototype.startWithCreate = function (create) { | ||
return this.startWithTiming(create, ReactiveTest.created, ReactiveTest.subscribed, ReactiveTest.disposed); | ||
}; | ||
/** | ||
* Creates a hot observable using the specified timestamped notification messages either as an array or arguments. | ||
* @param messages Notifications to surface through the created sequence at their specified absolute virtual times. | ||
* @return Hot observable sequence that can be used to assert the timing of subscriptions and notifications. | ||
*/ | ||
TestScheduler.prototype.createHotObservable = function () { | ||
var messages = argsOrArray(arguments, 0); | ||
return new HotObservable(this, messages); | ||
}; | ||
/** | ||
* Creates a cold observable using the specified timestamped notification messages either as an array or arguments. | ||
* @param messages Notifications to surface through the created sequence at their specified virtual time offsets from the sequence subscription time. | ||
* @return Cold observable sequence that can be used to assert the timing of subscriptions and notifications. | ||
*/ | ||
TestScheduler.prototype.createColdObservable = function () { | ||
var messages = argsOrArray(arguments, 0); | ||
return new ColdObservable(this, messages); | ||
}; | ||
/** | ||
* Creates a resolved promise with the given value and ticks | ||
* @param {Number} ticks The absolute time of the resolution. | ||
* @param {Any} value The value to yield at the given tick. | ||
* @returns {MockPromise} A mock Promise which fulfills with the given value. | ||
*/ | ||
TestScheduler.prototype.createResolvedPromise = function (ticks, value) { | ||
return new MockPromise(this, [Rx.ReactiveTest.onNext(ticks, value), Rx.ReactiveTest.onCompleted(ticks)]); | ||
}; | ||
/** | ||
* Creates a rejected promise with the given reason and ticks | ||
* @param {Number} ticks The absolute time of the resolution. | ||
* @param {Any} reason The reason for rejection to yield at the given tick. | ||
* @returns {MockPromise} A mock Promise which rejects with the given reason. | ||
*/ | ||
TestScheduler.prototype.createRejectedPromise = function (ticks, reason) { | ||
return new MockPromise(this, [Rx.ReactiveTest.onError(ticks, reason)]); | ||
}; | ||
/** | ||
* Creates an observer that records received notification messages and timestamps those. | ||
* @return Observer that can be used to assert the timing of received notifications. | ||
*/ | ||
TestScheduler.prototype.createObserver = function () { | ||
return new MockObserver(this); | ||
}; | ||
return TestScheduler; | ||
})(VirtualTimeScheduler); |
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 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 not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
356
405
3416438
53862