Socket
Socket
Sign inDemoInstall

rx

Package Overview
Dependencies
Maintainers
2
Versions
103
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rx - npm Package Compare versions

Comparing version 2.3.25 to 2.4.0

src/core/internal/trycatch.js

2

bower.json
{
"name": "rxjs",
"version": "2.3.25",
"version": "2.4.0",
"main": [

@@ -5,0 +5,0 @@ "dist/rx.all.js",

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

if (!Rx.config.useNativeEvents) {
// Handles jq, Angular.js, Zepto, Marionette
// Handles jq, Angular.js, Zepto, Marionette, Ember.js
if (typeof element.on === 'function' && typeof element.off === 'function') {

@@ -506,8 +506,2 @@ return fromEventPattern(

}
if (!!root.Ember && typeof root.Ember.addListener === 'function') {
return fromEventPattern(
function (h) { Ember.addListener(element, eventName, h); },
function (h) { Ember.removeListener(element, eventName, h); },
selector);
}
}

@@ -514,0 +508,0 @@ return new AnonymousObservable(function (observer) {

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

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

if (!Rx.config.useNativeEvents) {
// Handles jq, Angular.js, Zepto, Marionette
// Handles jq, Angular.js, Zepto, Marionette, Ember.js
if (typeof element.on === 'function' && typeof element.off === 'function') {

@@ -438,8 +438,2 @@ return fromEventPattern(

}
if (!!root.Ember && typeof root.Ember.addListener === 'function') {
return fromEventPattern(
function (h) { Ember.addListener(element, eventName, h); },
function (h) { Ember.removeListener(element, eventName, h); },
selector);
}
}

@@ -446,0 +440,0 @@ return new AnonymousObservable(function (observer) {

/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx.binding","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(a,b){return Array.isArray(a)?e.call(b,a):i(a)?z(a.call(b)):j(a)?z(a):h(a)?f(a):isPromise(a)?g(a):typeof a===w?a:y(a)||Array.isArray(a)?e.call(b,a):a}function e(a){var b=this;return function(c){function e(a,e){if(!f)try{if(a=d(a,b),typeof a!==w)return i[e]=a,--h||c(null,i);a.call(b,function(a,b){if(!f){if(a)return f=!0,c(a);i[e]=b,--h||c(null,i)}})}catch(g){f=!0,c(g)}}var f,g=Object.keys(a),h=g.length,i=new a.constructor;if(!h)return void u.schedule(function(){c(null,i)});for(var j=0,k=g.length;k>j;j++)e(a[g[j]],g[j])}}function f(a){return function(b){var c,d=!1;a.subscribe(function(a){c=a,d=!0},b,function(){d&&b(null,c)})}}function g(a){return function(b){a.then(function(a){b(null,a)},b)}}function h(a){return a&&typeof a.subscribe===w}function i(a){return a&&a.constructor&&"GeneratorFunction"===a.constructor.name}function j(a){return a&&typeof a.next===w&&typeof a[x]===w}function k(a){a&&u.schedule(function(){throw a})}function l(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),s(function(){a.removeEventListener(b,c,!1)});throw new Error("No listener found")}function m(a,b,c){var d=new t;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(m(a.item(e),b,c));else a&&d.add(l(a,b,c));return d}var n=c.Observable,o=(n.prototype,n.fromPromise),p=n.throwException,q=c.AnonymousObservable,r=c.AsyncSubject,s=c.Disposable.create,t=c.CompositeDisposable,u=(c.Scheduler.immediate,c.Scheduler.timeout),v=c.helpers.isScheduler,w=(Array.prototype.slice,"function"),x="throw",y=c.internals.isObject,z=c.spawn=function(a){var b=i(a);return function(c){function e(a,b){u.schedule(c.bind(g,a,b))}function f(a,b){var c;if(arguments.length>2)for(var b=[],i=1,j=arguments.length;j>i;i++)b.push(arguments[i]);if(a)try{c=h[x](a)}catch(k){return e(k)}if(!a)try{c=h.next(b)}catch(k){return e(k)}if(c.done)return e(null,c.value);if(c.value=d(c.value,g),typeof c.value!==w)f(new TypeError("Rx.spawn only supports a function, Promise, Observable, Object or Array."));else{var l=!1;try{c.value.call(g,function(){l||(l=!0,f.apply(g,arguments))})}catch(k){u.schedule(function(){l||(l=!0,f.call(g,k))})}}}var g=this,h=a;if(b){for(var i=[],j=0,l=arguments.length;l>j;j++)i.push(arguments[j]);var l=i.length,m=l&&typeof i[l-1]===w;c=m?i.pop():k,h=a.apply(this,i)}else c=c||k;f()}};n.start=function(a,b,c){return A(a,b,c)()};var A=n.toAsync=function(a,b,c){return v(c)||(c=u),function(){var d=arguments,e=new r;return c.schedule(function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};n.fromCallback=function(a,b,c){return function(){for(var d=[],e=0,f=arguments.length;f>e;e++)d.push(arguments[e]);return new q(function(e){function f(){var a=arguments;if(c){try{a=c(a)}catch(b){return e.onError(b)}e.onNext(a)}else a.length<=1?e.onNext.apply(e,a):e.onNext(a);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},n.fromNodeCallback=function(a,b,c){return function(){for(var d=[],e=0,f=arguments.length;f>e;e++)d.push(arguments[e]);return new q(function(e){function f(a){if(a)return void e.onError(a);for(var b=[],d=1,f=arguments.length;f>d;d++)b.push(arguments[d]);if(c){try{b=c(b)}catch(g){return e.onError(g)}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()}},c.config.useNativeEvents=!1,n.fromEvent=function(b,d,e){if(b.addListener)return B(function(a){b.addListener(d,a)},function(a){b.removeListener(d,a)},e);if(!c.config.useNativeEvents){if("function"==typeof b.on&&"function"==typeof b.off)return B(function(a){b.on(d,a)},function(a){b.off(d,a)},e);if(a.Ember&&"function"==typeof a.Ember.addListener)return B(function(a){Ember.addListener(b,d,a)},function(a){Ember.removeListener(b,d,a)},e)}return new q(function(a){return m(b,d,function(b){var c=b;if(e)try{c=e(arguments)}catch(d){return void a.onError(d)}a.onNext(c)})}).publish().refCount()};var B=n.fromEventPattern=function(a,b,c){return new q(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)}var f=a(e);return s(function(){b&&b(e,f)})}).publish().refCount()};return n.startAsync=function(a){var b;try{b=a()}catch(c){return p(c)}return o(b)},c});
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx.binding","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(a,b){return Array.isArray(a)?e.call(b,a):i(a)?z(a.call(b)):j(a)?z(a):h(a)?f(a):isPromise(a)?g(a):typeof a===w?a:y(a)||Array.isArray(a)?e.call(b,a):a}function e(a){var b=this;return function(c){function e(a,e){if(!f)try{if(a=d(a,b),typeof a!==w)return i[e]=a,--h||c(null,i);a.call(b,function(a,b){if(!f){if(a)return f=!0,c(a);i[e]=b,--h||c(null,i)}})}catch(g){f=!0,c(g)}}var f,g=Object.keys(a),h=g.length,i=new a.constructor;if(!h)return void u.schedule(function(){c(null,i)});for(var j=0,k=g.length;k>j;j++)e(a[g[j]],g[j])}}function f(a){return function(b){var c,d=!1;a.subscribe(function(a){c=a,d=!0},b,function(){d&&b(null,c)})}}function g(a){return function(b){a.then(function(a){b(null,a)},b)}}function h(a){return a&&typeof a.subscribe===w}function i(a){return a&&a.constructor&&"GeneratorFunction"===a.constructor.name}function j(a){return a&&typeof a.next===w&&typeof a[x]===w}function k(a){a&&u.schedule(function(){throw a})}function l(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),s(function(){a.removeEventListener(b,c,!1)});throw new Error("No listener found")}function m(a,b,c){var d=new t;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(m(a.item(e),b,c));else a&&d.add(l(a,b,c));return d}var n=c.Observable,o=(n.prototype,n.fromPromise),p=n.throwException,q=c.AnonymousObservable,r=c.AsyncSubject,s=c.Disposable.create,t=c.CompositeDisposable,u=(c.Scheduler.immediate,c.Scheduler.timeout),v=c.helpers.isScheduler,w=(Array.prototype.slice,"function"),x="throw",y=c.internals.isObject,z=c.spawn=function(a){var b=i(a);return function(c){function e(a,b){u.schedule(c.bind(g,a,b))}function f(a,b){var c;if(arguments.length>2)for(var b=[],i=1,j=arguments.length;j>i;i++)b.push(arguments[i]);if(a)try{c=h[x](a)}catch(k){return e(k)}if(!a)try{c=h.next(b)}catch(k){return e(k)}if(c.done)return e(null,c.value);if(c.value=d(c.value,g),typeof c.value!==w)f(new TypeError("Rx.spawn only supports a function, Promise, Observable, Object or Array."));else{var l=!1;try{c.value.call(g,function(){l||(l=!0,f.apply(g,arguments))})}catch(k){u.schedule(function(){l||(l=!0,f.call(g,k))})}}}var g=this,h=a;if(b){for(var i=[],j=0,l=arguments.length;l>j;j++)i.push(arguments[j]);var l=i.length,m=l&&typeof i[l-1]===w;c=m?i.pop():k,h=a.apply(this,i)}else c=c||k;f()}};n.start=function(a,b,c){return A(a,b,c)()};var A=n.toAsync=function(a,b,c){return v(c)||(c=u),function(){var d=arguments,e=new r;return c.schedule(function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};n.fromCallback=function(a,b,c){return function(){for(var d=[],e=0,f=arguments.length;f>e;e++)d.push(arguments[e]);return new q(function(e){function f(){var a=arguments;if(c){try{a=c(a)}catch(b){return e.onError(b)}e.onNext(a)}else a.length<=1?e.onNext.apply(e,a):e.onNext(a);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},n.fromNodeCallback=function(a,b,c){return function(){for(var d=[],e=0,f=arguments.length;f>e;e++)d.push(arguments[e]);return new q(function(e){function f(a){if(a)return void e.onError(a);for(var b=[],d=1,f=arguments.length;f>d;d++)b.push(arguments[d]);if(c){try{b=c(b)}catch(g){return e.onError(g)}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()}},c.config.useNativeEvents=!1,n.fromEvent=function(a,b,d){return a.addListener?B(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d):c.config.useNativeEvents||"function"!=typeof a.on||"function"!=typeof a.off?new q(function(c){return m(a,b,function(a){var b=a;if(d)try{b=d(arguments)}catch(e){return void c.onError(e)}c.onNext(b)})}).publish().refCount():B(function(c){a.on(b,c)},function(c){a.off(b,c)},d)};var B=n.fromEventPattern=function(a,b,c){return new q(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)}var f=a(e);return s(function(){b&&b(e,f)})}).publish().refCount()};return n.startAsync=function(a){var b;try{b=a()}catch(c){return p(c)}return o(b)},c});
//# sourceMappingURL=rx.async.map
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){function b(a){if(a.isDisposed)throw new Error(cb)}function c(a){for(var b=[],c=0,d=a.length;d>c;c++)b.push(a[c]);return b}function d(a,b){if(db&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(hb)){for(var c=[],d=b;d;d=d.source)d.stack&&c.unshift(d.stack);c.unshift(a.stack);var f=c.join("\n"+hb+"\n");a.stack=e(f)}}function e(a){for(var b=a.split("\n"),c=[],d=0,e=b.length;e>d;d++){var h=b[d];f(h)||g(h)||!h||c.push(h)}return c.join("\n")}function f(a){var b=j(a);if(!b)return!1;var c=b[0],d=b[1];return c===fb&&d>=gb&&$c>=d}function g(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function h(){if(db)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=j(c);if(!d)return;return fb=d[0],d[1]}}function j(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}function k(a){var b=[];if(!Jb(a))return b;Ib.nonEnumArgs&&a.length&&Kb(a)&&(a=Mb.call(a));var c=Ib.enumPrototypes&&"function"==typeof a,d=Ib.enumErrorProps&&(a===Db||a instanceof Error);for(var e in a)c&&"prototype"==e||d&&("message"==e||"name"==e)||b.push(e);if(Ib.nonEnumShadows&&a!==Eb){var f=a.constructor,g=-1,h=pb;if(a===(f&&f.prototype))var i=a===Fb?zb:a===Db?ub:Ab.call(a),j=Hb[i];for(;++g<h;)e=ob[g],j&&j[e]||!Bb.call(a,e)||b.push(e)}return b}function l(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 m(a,b){return l(a,b,k)}function n(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function o(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,f=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=f&&"object"!=f))return!1;var g=Ab.call(a),h=Ab.call(b);if(g==qb&&(g=xb),h==qb&&(h=xb),g!=h)return!1;switch(g){case sb:case tb:return+a==+b;case wb:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case yb:case zb:return a==String(b)}var i=g==rb;if(!i){if(g!=xb||!Ib.nodeClass&&(n(a)||n(b)))return!1;var j=!Ib.argsObject&&Kb(a)?Object:a.constructor,k=!Ib.argsObject&&Kb(b)?Object:b.constructor;if(!(j==k||Bb.call(a,"constructor")&&Bb.call(b,"constructor")||ab(j)&&j instanceof j&&ab(k)&&k instanceof k||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var l=c.length;l--;)if(c[l]==a)return d[l]==b;var p=0,q=!0;if(c.push(a),d.push(b),i){if(l=a.length,p=b.length,q=p==l)for(;p--;){var r=b[p];if(!(q=o(a[p],r,c,d)))break}}else m(b,function(b,e,f){return Bb.call(f,e)?(p++,q=Bb.call(a,e)&&o(a[e],b,c,d)):void 0}),q&&m(a,function(a,b,c){return Bb.call(c,b)?q=--p>-1:void 0});return c.pop(),d.pop(),q}function p(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function q(a,b){this.id=a,this.value=b}function r(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function t(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function u(){this._s=s}function v(){this._s=s,this._l=s.length,this._i=0}function w(a){this._a=a}function x(a){this._a=a,this._l=B(a),this._i=0}function y(a){return"number"==typeof a&&O.isFinite(a)}function z(b){var c,d=b[ib];if(!d&&"string"==typeof b)return c=new u(b),c[ib]();if(!d&&b.length!==a)return c=new w(b),c[ib]();if(!d)throw new TypeError("Object is not iterable");return b[ib]()}function A(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function B(a){var b=+a.length;return isNaN(b)?0:0!==b&&y(b)?(b=A(b)*Math.floor(Math.abs(b)),0>=b?0:b>Gc?Gc:b):b}function C(a,b){return V(a)||(a=fc),new Vc(function(c){var d=0,e=b.length;return a.scheduleRecursive(function(a){e>d?(c.onNext(b[d++]),a()):c.onCompleted()})})}function D(a,b){return new Vc(function(c){var d=new Zb,e=new $b;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)}_(f)&&(f=Dc(f)),d=new Zb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e},a)}function E(a,b){var c=this;return new Vc(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 d.onError(i)}d.onNext(g)}else d.onCompleted()},function(a){d.onError(a)},function(){d.onCompleted()})},c)}function F(){return!1}function G(){return[]}function H(a,b,c){var d=nb(b,c,3);return a.map(function(b,c){var e=d(b,c,a);return _(e)&&(e=Dc(e)),(lb(e)||kb(e))&&(e=Hc(e)),e}).concatAll()}function I(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function J(a){this.comparer=a,this.set=[]}function K(a,b,c){this.observer=a,this.selector=b,this.source=c,this.index=0,this.isStopped=!1}function L(a,b,c){var d=nb(b,c,3);return a.map(function(b,c){var e=d(b,c,a);return _(e)&&(e=Dc(e)),(lb(e)||kb(e))&&(e=Hc(e)),e}).mergeAll()}function M(a,b,c){this.observer=a,this.predicate=b,this.source=c,this.index=0,this.isStopped=!1}var N={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},O=N[typeof window]&&window||this,P=N[typeof exports]&&exports&&!exports.nodeType&&exports,Q=N[typeof module]&&module&&!module.nodeType&&module,R=Q&&Q.exports===P&&P,S=N[typeof global]&&global;!S||S.global!==S&&S.window!==S||(O=S);var T={internals:{},config:{Promise:O.Promise},helpers:{}},U=T.helpers.noop=function(){},V=(T.helpers.notDefined=function(a){return"undefined"==typeof a},T.helpers.isScheduler=function(a){return a instanceof T.Scheduler}),W=T.helpers.identity=function(a){return a},X=(T.helpers.pluck=function(a){return function(b){return b[a]}},T.helpers.just=function(a){return function(){return a}},T.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}()),Y=T.helpers.defaultComparer=function(a,b){return Lb(a,b)},Z=T.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},$=(T.helpers.defaultKeySerializer=function(a){return a.toString()},T.helpers.defaultError=function(a){throw a}),_=T.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},ab=(T.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},T.helpers.not=function(a){return!a},T.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==Ab.call(a)}),a}()),bb="Argument out of range",cb="Object has been disposed";T.config.longStackSupport=!1;var db=!1;try{throw new Error}catch(eb){db=!!eb.stack}var fb,gb=h(),hb="From previous event:",ib="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";O.Set&&"function"==typeof(new O.Set)["@@iterator"]&&(ib="@@iterator");var jb=T.doneEnumerator={done:!0,value:a},kb=T.helpers.isIterable=function(b){return b[ib]!==a},lb=T.helpers.isArrayLike=function(b){return b&&b.length!==a};T.helpers.iterator=ib;var mb,nb=T.internals.bindCallback=function(a,b,c){if("undefined"==typeof b)return a;switch(c){case 0:return function(){return a.call(b)};case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)}}return function(){return a.apply(b,arguments)}},ob=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],pb=ob.length,qb="[object Arguments]",rb="[object Array]",sb="[object Boolean]",tb="[object Date]",ub="[object Error]",vb="[object Function]",wb="[object Number]",xb="[object Object]",yb="[object RegExp]",zb="[object String]",Ab=Object.prototype.toString,Bb=Object.prototype.hasOwnProperty,Cb=Ab.call(arguments)==qb,Db=Error.prototype,Eb=Object.prototype,Fb=String.prototype,Gb=Eb.propertyIsEnumerable;try{mb=!(Ab.call(document)==xb&&!({toString:0}+""))}catch(eb){mb=!0}var Hb={};Hb[rb]=Hb[tb]=Hb[wb]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},Hb[sb]=Hb[zb]={constructor:!0,toString:!0,valueOf:!0},Hb[ub]=Hb[vb]=Hb[yb]={constructor:!0,toString:!0},Hb[xb]={constructor:!0};var Ib={};!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);Ib.enumErrorProps=Gb.call(Db,"message")||Gb.call(Db,"name"),Ib.enumPrototypes=Gb.call(a,"prototype"),Ib.nonEnumArgs=0!=c,Ib.nonEnumShadows=!/valueOf/.test(b)}(1);var Jb=T.internals.isObject=function(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1},Kb=function(a){return a&&"object"==typeof a?Ab.call(a)==qb:!1};Cb||(Kb=function(a){return a&&"object"==typeof a?Bb.call(a,"callee"):!1});var Lb=T.internals.isEqual=function(a,b){return o(a,b,[],[])},Mb=({}.hasOwnProperty,Array.prototype.slice),Nb=this.inherits=T.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c},Ob=T.internals.addProperties=function(a){for(var b=[],c=1,d=arguments.length;d>c;c++)b.push(arguments[c]);for(var e=0,f=b.length;f>e;e++){var g=b[e];for(var h in g)a[h]=g[h]}},Pb=T.internals.addRef=function(a,b){return new Vc(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)==zb?this.split(""):b,d=c.length>>>0,e=arguments[1];if({}.toString.call(a)!=vb)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)==zb?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if({}.toString.call(a)!=vb)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)==rb}),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}),Object.prototype.propertyIsEnumerable||(Object.prototype.propertyIsEnumerable=function(a){for(var b in this)if(b===a)return!0;return!1}),Object.keys||(Object.keys=function(){"use strict";var a=Object.prototype.hasOwnProperty,b=!{toString:null}.propertyIsEnumerable("toString");return function(c){if("object"!=typeof c&&("function"!=typeof c||null===c))throw new TypeError("Object.keys called on non-object");var d,e,f=[];for(d in c)a.call(c,d)&&f.push(d);if(b)for(e=0;pb>e;e++)a.call(c,ob[e])&&f.push(ob[e]);return f}}()),q.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var Sb=T.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(b){this.items[b]=this.items[--this.length],this.items[this.length]=a,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 q(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=T.CompositeDisposable=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);this.disposables=a,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;for(var a=[],b=0,c=this.disposables.length;c>b;b++)a.push(this.disposables[b]);for(this.disposables=[],this.length=0,b=0,c=a.length;c>b;b++)a[b].dispose()}},Vb.toArray=function(){for(var a=[],b=this.disposables.length;b>i;i++)a.push(this.disposables[i]);return a};var Wb=T.Disposable=function(a){this.isDisposed=!1,this.action=a||U};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:U},Zb=T.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=this.isDisposed;if(!b){var c=this.current;this.current=a}c&&c.dispose(),b&&a&&a.dispose()},b.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()},a}(),$b=T.SerialDisposable=Zb,_b=T.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}();r.prototype.dispose=function(){this.scheduler.scheduleWithState(this,t)};var ac=T.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||Z,this.disposable=new Zb};ac.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},ac.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},ac.prototype.isCancelled=function(){return this.disposable.isDisposed},ac.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var bc=T.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=X,a.normalize=function(a){return 0>a&&(a=0),a},a}(),cc=bc.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](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")})}}(bc.prototype),function(){bc.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},bc.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof O.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=O.setInterval(function(){d=c(d)},b);return Xb(function(){O.clearInterval(e)})}}(bc.prototype),function(a){a.catchError=a["catch"]=function(a){return new kc(this,a)}}(bc.prototype);var dc,ec=(T.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}(),bc.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=this.now()+cc(b);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new bc(X,a,b,c)}()),fc=bc.currentThread=function(){function a(a){for(;a.length>0;){var b=a.dequeue();if(!b.isCancelled()){for(;b.dueTime-bc.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()+bc.normalize(c),g=new ac(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 bc(X,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),gc=U,hc=function(){var a,b=U;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!O.setTimeout)throw new Error("No concurrency detected!");a=O.setTimeout,b=O.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),ic=hc.setTimeout,jc=hc.clearTimeout;!function(){function a(){if(!O.postMessage||O.importScripts)return!1;var a=!1,b=O.onmessage;return O.onmessage=function(){a=!0},O.postMessage("","*"),O.onmessage=b,a}var b=RegExp("^"+String(Ab).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),c="function"==typeof(c=S&&R&&S.setImmediate)&&!b.test(c)&&c,d="function"==typeof(d=S&&R&&S.clearImmediate)&&!b.test(d)&&d;if("function"==typeof c)dc=c,gc=d;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))dc=process.nextTick;else if(a()){var e="ms.rx.schedule"+Math.random(),f={},g=0,h=function(a){if("string"==typeof a.data&&a.data.substring(0,e.length)===e){var b=a.data.substring(e.length),c=f[b];c(),delete f[b]}};O.addEventListener?O.addEventListener("message",h,!1):O.attachEvent("onmessage",h,!1),dc=function(a){var b=g++;f[b]=a,O.postMessage(e+b,"*")}}else if(O.MessageChannel){var i=new O.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},dc=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in O&&"onreadystatechange"in O.document.createElement("script")?dc=function(a){var b=O.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},O.document.documentElement.appendChild(b)}:(dc=function(a){return ic(a,0)},gc=jc)}();var kc=(bc.timeout=function(){function a(a,b){var c=this,d=new Zb,e=dc(function(){d.isDisposed||d.setDisposable(b(c,a))});return new Ub(d,Xb(function(){gc(e)}))}function b(a,b,c){var d=this,e=bc.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new Zb,g=ic(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new Ub(f,Xb(function(){jc(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new bc(X,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}(bc)),lc=T.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 V(a)||(a=ec),new Vc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),mc=lc.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 lc("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),nc=lc.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 lc("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),oc=lc.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new lc("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),pc=T.internals.Enumerator=function(a){this._next=a};pc.prototype.next=function(){return this._next()},pc.prototype[ib]=function(){return this};var qc=T.internals.Enumerable=function(a){this._iterator=a};qc.prototype[ib]=function(){return this._iterator()},qc.prototype.concat=function(){var a=this;return new Vc(function(b){var c,d=a[ib](),e=new $b,f=ec.scheduleRecursive(function(a){if(!c){try{var f=d.next()}catch(g){return b.onError(g)}if(f.done)return b.onCompleted();var h=f.value;_(h)&&(h=Dc(h));var i=new Zb;e.setDisposable(i),i.setDisposable(h.subscribe(function(a){b.onNext(a)},function(a){b.onError(a)},a))}});return new Ub(e,f,Xb(function(){c=!0}))})},qc.prototype.catchError=function(){var a=this;return new Vc(function(b){var c,d=a[ib](),e=new $b,f=ec.scheduleRecursiveWithState(null,function(a,f){if(!c){try{var g=d.next()}catch(h){return observer.onError(h)}if(g.done)return void(null!==a?b.onError(a):b.onCompleted());var i=g.value;_(i)&&(i=Dc(i));var j=new Zb;e.setDisposable(j),j.setDisposable(i.subscribe(function(a){b.onNext(a)},f,function(){b.onCompleted()}))}});return new Ub(e,f,Xb(function(){c=!0}))})},qc.prototype.catchErrorWhen=function(a){var b=this;return new Vc(function(c){var d,e,f=new Yc,g=new Yc,h=a(f),i=h.subscribe(g),j=b[ib](),k=new $b,l=ec.scheduleRecursive(function(a){if(!d){try{var b=j.next()}catch(h){return c.onError(h)}if(b.done)return void(e?c.onError(e):c.onCompleted());var i=b.value;_(i)&&(i=Dc(i));var l=new Zb,m=new Zb;k.setDisposable(new Ub(m,l)),l.setDisposable(i.subscribe(function(a){c.onNext(a)},function(b){m.setDisposable(g.subscribe(a,function(a){c.onError(a)},function(){c.onCompleted()})),f.onNext(b)},function(){c.onCompleted()}))}});return new Ub(i,k,l,Xb(function(){d=!0}))})};var rc=qc.repeat=function(a,b){return null==b&&(b=-1),new qc(function(){var c=b;return new pc(function(){return 0===c?jb:(c>0&&c--,{done:!1,value:a})})})},sc=qc.of=function(a,b,c){if(b)var d=nb(b,c,3);return new qc(function(){var c=-1;return new pc(function(){return++c<a.length?{done:!1,value:b?d(a[c],c,a):a[c]}:jb})})},tc=T.Observer=function(){};tc.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},tc.prototype.asObserver=function(){return new xc(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},tc.prototype.checked=function(){return new yc(this)};var uc=tc.create=function(a,b,c){return a||(a=U),b||(b=$),c||(c=U),new xc(a,b,c)};tc.fromNotifier=function(a,b){return new xc(function(c){return a.call(b,mc(c))},function(c){return a.call(b,nc(c))},function(){return a.call(b,oc())})},tc.prototype.notifyOn=function(a){return new Ac(a,this)},tc.prototype.makeSafe=function(a){return new AnonymousSafeObserver(this._onNext,this._onError,this._onCompleted,a)};var vc,wc=T.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}(tc),xc=T.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}(wc),yc=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}(tc),zc=T.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 $b}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}(wc),Ac=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}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.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(zc),Bc=T.Observable=function(){function a(a){if(T.config.longStackSupport&&db){try{throw new Error}catch(b){this.stack=b.stack.substring(b.stack.indexOf("\n")+1)}var c=this;this._subscribe=function(b){var e=b.onError.bind(b);return b.onError=function(a){d(a,c),e(a)},a.call(c,b)}}else this._subscribe=a}return vc=a.prototype,vc.subscribe=vc.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:uc(a,b,c))},vc.subscribeOnNext=function(a,b){return this._subscribe(uc("undefined"!=typeof b?function(c){a.call(b,c)}:a))},vc.subscribeOnError=function(a,b){return this._subscribe(uc(null,"undefined"!=typeof b?function(c){a.call(b,c)}:a))},vc.subscribeOnCompleted=function(a,b){return this._subscribe(uc(null,null,"undefined"!=typeof b?function(){a.call(b)}:a))},a}(),Cc=T.ObservableBase=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?Xb(a):Yb}function c(a,c){var d=c[0],e=c[1];try{d.setDisposable(b(e.subscribeCore(d)))}catch(f){if(!d.fail(f))throw f}}function d(a){var b=new Wc(a),d=[b,this];return fc.scheduleRequired()?fc.scheduleWithState(d,c):c(null,d),b}function e(){a.call(this,d)}return Nb(e,a),e.prototype.subscribeCore=function(){throw new Error("Not implemeneted")},e}(Bc);vc.observeOn=function(a){var b=this;return new Vc(function(c){return b.subscribe(new Ac(a,c))},b)},vc.subscribeOn=function(a){var b=this;return new Vc(function(c){var d=new Zb,e=new $b;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new r(a,b.subscribe(c)))})),e},b)};var Dc=Bc.fromPromise=function(a){return Ec(function(){var b=new T.AsyncSubject;return a.then(function(a){b.onNext(a),b.onCompleted()},b.onError.bind(b)),b})};vc.toPromise=function(a){if(a||(a=T.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)})})},vc.toArray=function(){var a=this;return new Vc(function(b){var c=[];return a.subscribe(function(a){c.push(a)},function(a){b.onError(a)},function(){b.onNext(c),b.onCompleted()})},a)},Bc.create=Bc.createWithDisposable=function(a,b){return new Vc(a,b)};var Ec=Bc.defer=function(a){return new Vc(function(b){var c;try{c=a()}catch(d){return Nc(d).subscribe(b)}return _(c)&&(c=Dc(c)),c.subscribe(b)})},Fc=Bc.empty=function(a){return V(a)||(a=ec),new Vc(function(b){return a.schedule(function(){b.onCompleted()})})},Gc=Math.pow(2,53)-1;u.prototype[ib]=function(){return new v(this._s)},v.prototype[ib]=function(){return this},v.prototype.next=function(){if(this._i<this._l){var a=this._s.charAt(this._i++);return{done:!1,value:a}}return jb},w.prototype[ib]=function(){return new x(this._a)},x.prototype[ib]=function(){return this},x.prototype.next=function(){if(this._i<this._l){var a=this._a[this._i++];return{done:!1,value:a}}return jb};var Hc=Bc.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!ab(b))throw new Error("mapFn when provided must be a function");if(b)var e=nb(b,c,2);
V(d)||(d=fc);var f=Object(a),g=z(f);return new Vc(function(a){return d.scheduleRecursiveWithState(0,function(b,c){try{var d=g.next()}catch(f){return void a.onError(f)}if(d.done)return void a.onCompleted();var h=d.value;if(e)try{h=e(h,b)}catch(f){return void a.onError(f)}a.onNext(h),c(b+1)})})},Ic=function(a){function b(b,c){this.args=b,this.scheduler=c||fc,a.call(this)}return Nb(b,a),b.prototype.subscribeCore=function(a){var b=new Jc(a,this);return b.run()},b}(Cc),Jc=function(){function a(a,b){this.observer=a,this.parent=b}function b(a,b){a.i<a.len?(a.observer.onNext(a.args[a.i++]),b(a)):a.observer.onCompleted()}return a.prototype.run=function(){return this.parent.scheduler.scheduleRecursiveWithState({i:0,args:this.parent.args,len:this.parent.args.length,observer:this.observer},b)},a}(),Kc=Bc.fromArray=function(a,b){return new Ic(a,b)};Bc.generate=function(a,b,c,d,e){return V(e)||(e=fc),new Vc(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 Lc=Bc.never=function(){return new Vc(function(){return Yb})};Bc.of=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return C(null,a)},Bc.ofWithScheduler=function(a){for(var b=[],c=1,d=arguments.length;d>c;c++)b.push(arguments[c]);return C(a,b)},Bc.pairs=function(a,b){return b||(b=T.Scheduler.currentThread),new Vc(function(c){var d=Object.keys(a),e=d.length;return b.scheduleRecursiveWithState(0,function(b,f){if(e>b){var g=d[b];c.onNext([g,a[g]]),f(b+1)}else c.onCompleted()})})},Bc.range=function(a,b,c){return V(c)||(c=fc),new Vc(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 V(c)||(c=fc),Mc(a,c).repeat(null==b?-1:b)};var Mc=Bc["return"]=Bc.just=function(a,b){return V(b)||(b=ec),new Vc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})};Bc.returnValue=function(){return Mc.apply(null,arguments)};var Nc=Bc["throw"]=Bc.throwError=function(a,b){return V(b)||(b=ec),new Vc(function(c){return b.schedule(function(){c.onError(a)})})};Bc.throwException=function(){return Bc.throwError.apply(null,arguments)},Bc.using=function(a,b){return new Vc(function(c){var d,e,f=Yb;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new Ub(Nc(g).subscribe(c),f)}return new Ub(e.subscribe(c),f)})},vc.amb=function(a){var b=this;return new Vc(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 _(a)&&(a=Dc(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)}var b=Lc(),c=[];if(Array.isArray(arguments[0]))c=arguments[0];else for(var d=0,e=arguments.length;e>d;d++)c.push(arguments[d]);for(var d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},vc["catch"]=vc.catchError=function(a){return"function"==typeof a?D(this,a):Oc([this,a])},vc.catchException=function(a){return this.catchError(a)};var Oc=Bc.catchError=Bc["catch"]=Bc.catchException=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return sc(a).catchError()};vc.combineLatest=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),Pc.apply(this,a)};var Pc=Bc.combineLatest=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);var d=a.pop();return Array.isArray(a[0])&&(a=a[0]),new Vc(function(b){function c(a){var c;if(h[a]=!0,i||(i=h.every(W))){try{c=d.apply(null,k)}catch(e){return void b.onError(e)}b.onNext(c)}else j.filter(function(b,c){return c!==a}).every(W)&&b.onCompleted()}function e(a){j[a]=!0,j.every(W)&&b.onCompleted()}for(var f=function(){return!1},g=a.length,h=p(g,f),i=!1,j=p(g,f),k=new Array(g),l=new Array(g),m=0;g>m;m++)!function(d){var f=a[d],g=new Zb;_(f)&&(f=Dc(f)),g.setDisposable(f.subscribe(function(a){k[d]=a,c(d)},function(a){b.onError(a)},function(){e(d)})),l[d]=g}(m);return new Ub(l)},this)};vc.concat=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return a.unshift(this),Qc.apply(null,a)};var Qc=Bc.concat=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return sc(a).concat()};vc.concatAll=vc.concatObservable=function(){return this.merge(1)},vc.merge=function(a){if("number"!=typeof a)return Rc(this,a);var b=this;return new Vc(function(c){function d(a){var b=new Zb;f.add(b),_(a)&&(a=Dc(a)),b.setDisposable(a.subscribe(function(a){c.onNext(a)},function(a){c.onError(a)},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)},function(a){c.onError(a)},function(){g=!0,0===e&&c.onCompleted()})),f},b)};var Rc=Bc.merge=function(){var a,b,c=[],d=arguments.length;if(arguments[0])if(V(arguments[0]))for(a=arguments[0],b=1;d>b;b++)c.push(arguments[b]);else for(a=ec,b=0;d>b;b++)c.push(arguments[b]);else for(a=ec,b=1;d>b;b++)c.push(arguments[b]);return Array.isArray(c[0])&&(c=c[0]),C(a,c).mergeAll()};vc.mergeAll=function(){var a=this;return new Vc(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),_(a)&&(a=Dc(a)),e.setDisposable(a.subscribe(function(a){b.onNext(a)},function(a){b.onError(a)},function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},function(a){b.onError(a)},function(){d=!0,1===c.length&&b.onCompleted()})),c},a)},vc.mergeObservable=function(){return this.mergeAll.apply(this,arguments)},vc.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return Sc([this,a])};var Sc=Bc.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return new Vc(function(b){var c=0,d=new $b,e=ec.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],_(f)&&(f=Dc(f)),g=new Zb,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new Ub(d,e)})};vc.skipUntil=function(a){var b=this;return new Vc(function(c){var d=!1,e=new Ub(b.subscribe(function(a){d&&c.onNext(a)},function(a){c.onError(a)},function(){d&&c.onCompleted()}));_(a)&&(a=Dc(a));var f=new Zb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},function(a){c.onError(a)},function(){f.dispose()})),e},b)},vc["switch"]=vc.switchLatest=function(){var a=this;return new Vc(function(b){var c=!1,d=new $b,e=!1,f=0,g=a.subscribe(function(a){var g=new Zb,h=++f;c=!0,d.setDisposable(g),_(a)&&(a=Dc(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())}))},function(a){b.onError(a)},function(){e=!0,!c&&b.onCompleted()});return new Ub(g,d)},a)},vc.takeUntil=function(a){var b=this;return new Vc(function(c){return _(a)&&(a=Dc(a)),new Ub(b.subscribe(c),a.subscribe(function(){c.onCompleted()},function(a){c.onError(a)},U))},b)},vc.withLatestFrom=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);var d=a.pop(),e=this;if("undefined"==typeof e)throw new Error("Source observable not found for withLatestFrom().");if("function"!=typeof d)throw new Error("withLatestFrom() expects a resultSelector function.");return Array.isArray(a[0])&&(a=a[0]),new Vc(function(b){for(var c=function(){return!1},f=a.length,g=p(f,c),h=!1,i=new Array(f),j=new Array(f+1),k=0;f>k;k++)!function(c){var d=a[c],e=new Zb;_(d)&&(d=Dc(d)),e.setDisposable(d.subscribe(function(a){i[c]=a,g[c]=!0,h=g.every(W)},b.onError.bind(b),function(){})),j[c]=e}(k);var l=new Zb;return l.setDisposable(e.subscribe(function(a){var c,e=[a].concat(i);if(h){try{c=d.apply(null,e)}catch(f){return void b.onError(f)}b.onNext(c)}},b.onError.bind(b),function(){b.onCompleted()})),j[f]=l,new Ub(j)},this)},vc.zip=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);if(Array.isArray(a[0]))return E.apply(this,a);var d=this,e=a.pop();return a.unshift(d),new Vc(function(b){function c(a){var c,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),c=e.apply(d,f)}catch(g){return void b.onError(g)}b.onNext(c)}else i.filter(function(b,c){return c!==a}).every(W)&&b.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&b.onCompleted()}for(var g=a.length,h=p(g,G),i=p(g,F),j=new Array(g),k=0;g>k;k++)!function(d){var e=a[d],g=new Zb;_(e)&&(e=Dc(e)),g.setDisposable(e.subscribe(function(a){h[d].push(a),c(d)},function(a){b.onError(a)},function(){f(d)})),j[d]=g}(k);return new Ub(j)},d)},Bc.zip=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);var d=a.shift();return d.zip.apply(d,a)},Bc.zipArray=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return new Vc(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(W))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(W)?void b.onCompleted():void 0}for(var e=a.length,f=p(e,function(){return[]}),g=p(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)},function(a){b.onError(a)},function(){d(e)}))}(i);return new Ub(h)})},vc.asObservable=function(){var a=this;return new Vc(function(b){return a.subscribe(b)},this)},vc.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})},vc.dematerialize=function(){var a=this;return new Vc(function(b){return a.subscribe(function(a){return a.accept(b)},function(a){b.onError(a)},function(){b.onCompleted()})},this)},vc.distinctUntilChanged=function(a,b){var c=this;return b||(b=Y),new Vc(function(d){var e,f=!1;return c.subscribe(function(c){var g=c;if(a)try{g=a(c)}catch(h){return void d.onError(h)}if(f)try{var i=b(e,g)}catch(h){return void d.onError(h)}f&&i||(f=!0,e=g,d.onNext(c))},function(a){d.onError(a)},function(){d.onCompleted()})},this)},vc["do"]=vc.tap=vc.doAction=function(a,b,c){var d=this,e="function"==typeof a||"undefined"==typeof a?uc(a||U,b||U,c||U):a;return new Vc(function(a){return d.subscribe(function(b){try{e.onNext(b)}catch(c){a.onError(c)}a.onNext(b)},function(b){try{e.onError(b)}catch(c){a.onError(c)}a.onError(b)},function(){try{e.onCompleted()}catch(b){a.onError(b)}a.onCompleted()})},this)},vc.doOnNext=vc.tapOnNext=function(a,b){return this.tap("undefined"!=typeof b?function(c){a.call(b,c)}:a)},vc.doOnError=vc.tapOnError=function(a,b){return this.tap(U,"undefined"!=typeof b?function(c){a.call(b,c)}:a)},vc.doOnCompleted=vc.tapOnCompleted=function(a,b){return this.tap(U,null,"undefined"!=typeof b?function(){a.call(b)}:a)},vc["finally"]=vc.ensure=function(a){var b=this;return new Vc(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()}})},this)},vc.finallyAction=function(a){return this.ensure(a)},vc.ignoreElements=function(){var a=this;return new Vc(function(b){return a.subscribe(U,function(a){b.onError(a)},function(){b.onCompleted()})},a)},vc.materialize=function(){var a=this;return new Vc(function(b){return a.subscribe(function(a){b.onNext(mc(a))},function(a){b.onNext(nc(a)),b.onCompleted()},function(){b.onNext(oc()),b.onCompleted()})},a)},vc.repeat=function(a){return rc(this,a).concat()},vc.retry=function(a){return rc(this,a).catchError()},vc.retryWhen=function(a){return rc(this).catchErrorWhen(a)},vc.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 Vc(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)},function(a){e.onError(a)},function(){!h&&c&&e.onNext(a),e.onCompleted()})},d)},vc.skipLast=function(a){var b=this;return new Vc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},function(a){c.onError(a)},function(){c.onCompleted()})},b)},vc.startWith=function(){var a,b=0;arguments.length&&V(arguments[0])?(a=arguments[0],b=1):a=ec;for(var c=[],d=b,e=arguments.length;e>d;d++)c.push(arguments[d]);return sc([Kc(c,a),this]).concat()},vc.takeLast=function(a){var b=this;return new Vc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})},b)},vc.takeLastBuffer=function(a){var b=this;return new Vc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){c.onNext(d),c.onCompleted()})},b)},vc.windowWithCount=function(a,b){var c=this;if(+a||(a=0),1/0===Math.abs(a)&&(a=0),0>=a)throw new Error(bb);if(null==b&&(b=a),+b||(b=0),1/0===Math.abs(b)&&(b=0),0>=b)throw new Error(bb);return new Vc(function(d){function e(){var a=new Yc;i.push(a),d.onNext(Pb(a,g))}var f=new Zb,g=new _b(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g},c)},vc.selectConcat=vc.concatMap=function(a,b,c){return ab(a)&&ab(b)?this.concatMap(function(c,d){var e=a(c,d);return _(e)&&(e=Dc(e)),(lb(e)||kb(e))&&(e=Hc(e)),e.map(function(a,e){return b(c,a,d,e)})}):ab(a)?H(this,a,c):H(this,function(){return a})},vc.concatMapObserver=vc.selectConcatObserver=function(a,b,c,d){var e=this,f=nb(a,d,2),g=nb(b,d,1),h=nb(c,d,0);return new Vc(function(a){var b=0;return e.subscribe(function(c){var d;try{d=f(c,b++)}catch(e){return void a.onError(e)}_(d)&&(d=Dc(d)),a.onNext(d)},function(b){var c;try{c=g(b)}catch(d){return void a.onError(d)}_(c)&&(c=Dc(c)),a.onNext(c),a.onCompleted()},function(){var b;try{b=h()}catch(c){return void a.onError(c)}_(b)&&(b=Dc(b)),a.onNext(b),a.onCompleted()})},this).concatAll()},vc.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new Vc(function(a){var d=!1;return c.subscribe(function(b){d=!0,a.onNext(b)},function(b){a.onError(b)},function(){!d&&a.onNext(b),a.onCompleted()})},c)},J.prototype.push=function(a){var b=-1===I(this.set,a,this.comparer);return b&&this.set.push(a),b},vc.distinct=function(a,b){var c=this;return b||(b=Y),new Vc(function(d){var e=new J(b);return c.subscribe(function(b){var c=b;if(a)try{c=a(b)}catch(f){return void d.onError(f)}e.push(c)&&d.onNext(b)},function(a){d.onError(a)},function(){d.onCompleted()})},this)};var Tc=function(a){function b(b,c,d){this.source=b,this.selector=nb(c,d,3),a.call(this)}return Nb(b,a),b.prototype.internalMap=function(a,c){var d=this;return new b(this.source,function(b,c,e){return a(d.selector(b,c,e),c,e)},c)},b.prototype.subscribeCore=function(a){return this.source.subscribe(new K(a,this.selector,this))},b}(Cc);K.prototype.onNext=function(a){if(!this.isStopped){try{var b=this.selector(a,this.index++,this.source)}catch(c){return this.observer.onError(c)}this.observer.onNext(b)}},K.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.observer.onError(a))},K.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.observer.onCompleted())},K.prototype.dispose=function(){this.isStopped=!0},K.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},vc.map=vc.select=function(a,b){var c="function"==typeof a?a:function(){return a};return this instanceof Tc?this.internalMap(a,b):new Tc(this,c,b)},vc.pluck=function(){var b=arguments,c=arguments.length;if(0===c)throw new Error("List of properties cannot be empty.");return this.map(function(d){for(var e=d,f=0;c>f;f++){var g=e[b[f]];if("undefined"==typeof g)return a;e=g}return e})},vc.selectMany=vc.flatMap=function(a,b,c){return ab(a)&&ab(b)?this.flatMap(function(c,d){var e=a(c,d);return _(e)&&(e=Dc(e)),(lb(e)||kb(e))&&(e=Hc(e)),e.map(function(a,e){return b(c,a,d,e)})},c):ab(a)?L(this,a,c):L(this,function(){return a})},vc.flatMapObserver=vc.selectManyObserver=function(a,b,c,d){var e=this;return new Vc(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)}_(c)&&(c=Dc(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}_(c)&&(c=Dc(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}_(a)&&(a=Dc(a)),f.onNext(a),f.onCompleted()})},e).mergeAll()},vc.selectSwitch=vc.flatMapLatest=vc.switchMap=function(a,b){return this.select(a,b).switchLatest()},vc.skip=function(a){if(0>a)throw new Error(bb);var b=this;return new Vc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},function(a){c.onError(a)},function(){c.onCompleted()})},b)},vc.skipWhile=function(a,b){var c=this,d=nb(a,b,3);return new Vc(function(a){var b=0,e=!1;return c.subscribe(function(f){if(!e)try{e=!d(f,b++,c)}catch(g){return void a.onError(g)}e&&a.onNext(f)},function(b){a.onError(b)},function(){a.onCompleted()})},c)},vc.take=function(a,b){if(0>a)throw new RangeError(bb);if(0===a)return Fc(b);var c=this;return new Vc(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},function(a){b.onError(a)},function(){b.onCompleted()})},c)},vc.takeWhile=function(a,b){var c=this,d=nb(a,b,3);return new Vc(function(a){var b=0,e=!0;return c.subscribe(function(f){if(e){try{e=d(f,b++,c)}catch(g){return void a.onError(g)}e?a.onNext(f):a.onCompleted()}},function(b){a.onError(b)},function(){a.onCompleted()})},c)};var Uc=function(a){function b(b,c,d){this.source=b,this.predicate=nb(c,d,3),a.call(this)}return Nb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new M(a,this.predicate,this))},b.prototype.internalFilter=function(a,c){var d=this;return new b(this.source,function(b,c,e){return d.predicate(b,c,e)&&a(b,c,e)},c)},b}(Cc);M.prototype.onNext=function(a){try{var b=this.predicate(a,this.index++,this.source)}catch(c){return this.observer.onError(c)}b&&this.observer.onNext(a)},M.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.observer.onError(a))},M.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.observer.onCompleted())},M.prototype.dispose=function(){this.isStopped=!0},M.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},vc.filter=vc.where=function(a,b){return this instanceof Uc?this.internalFilter(a,b):new Uc(this,a,b)},vc.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 Vc(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)})},c)};var Vc=T.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?Xb(a):Yb}function c(a,c){var d=c[0],e=c[1];try{d.setDisposable(b(e(d)))}catch(f){if(!d.fail(f))throw f}}function d(b,d){function e(a){var d=new Wc(a),e=[d,b];return fc.scheduleRequired()?fc.scheduleWithState(e,c):c(null,e),d}this.source=d,a.call(this,e)}return Nb(d,a),d}(Bc),Wc=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.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(wc),Xc=function(a,b){this.subject=a,this.observer=b};Xc.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 Yc=T.Subject=function(a){function d(a){return b(this),this.isStopped?this.hasError?(a.onError(this.error),Yb):(a.onCompleted(),Yb):(this.observers.push(a),new Xc(this,a))}function e(){a.call(this,d),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return Nb(e,a),Ob(e.prototype,tc.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b(this),!this.isStopped){this.isStopped=!0;for(var a=0,d=c(this.observers),e=d.length;e>a;a++)d[a].onCompleted();this.observers.length=0}},onError:function(a){if(b(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onError(a);this.observers.length=0}},onNext:function(a){if(b(this),!this.isStopped)for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),e.create=function(a,b){return new Zc(a,b)},e}(Bc),Zc=(T.AsyncSubject=function(a){function d(a){return b(this),this.isStopped?(this.hasError?a.onError(this.error):this.hasValue?(a.onNext(this.value),a.onCompleted()):a.onCompleted(),Yb):(this.observers.push(a),new Xc(this,a))}function e(){a.call(this,d),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return Nb(e,a),Ob(e.prototype,tc,{hasObservers:function(){return b(this),this.observers.length>0},onCompleted:function(){var a,d;if(b(this),!this.isStopped){this.isStopped=!0;var e=c(this.observers),d=e.length;if(this.hasValue)for(a=0;d>a;a++){var f=e[a];f.onNext(this.value),f.onCompleted()}else for(a=0;d>a;a++)e[a].onCompleted();this.observers.length=0}},onError:function(a){if(b(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onError(a);this.observers.length=0}},onNext:function(a){b(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),e}(Bc),T.AnonymousSubject=function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){this.observer=c,this.observable=d,a.call(this,b)}return Nb(c,a),Ob(c.prototype,tc.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(Bc));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(O.Rx=T,define(function(){return T})):P&&Q?R?(Q.exports=T).Rx=T:P.Rx=T:O.Rx=T;var $c=h()}).call(this);
(function(a){function b(a){if(a.isDisposed)throw new Error(gb)}function c(a){for(var b=[],c=0,d=a.length;d>c;c++)b.push(a[c]);return b}function d(a,b){if(hb&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(lb)){for(var c=[],d=b;d;d=d.source)d.stack&&c.unshift(d.stack);c.unshift(a.stack);var f=c.join("\n"+lb+"\n");a.stack=e(f)}}function e(a){for(var b=a.split("\n"),c=[],d=0,e=b.length;e>d;d++){var h=b[d];f(h)||g(h)||!h||c.push(h)}return c.join("\n")}function f(a){var b=i(a);if(!b)return!1;var c=b[0],d=b[1];return c===jb&&d>=kb&&nd>=d}function g(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function h(){if(hb)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=i(c);if(!d)return;return jb=d[0],d[1]}}function i(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}function j(a){var b=[];if(!Nb(a))return b;Mb.nonEnumArgs&&a.length&&Ob(a)&&(a=Rb.call(a));var c=Mb.enumPrototypes&&"function"==typeof a,d=Mb.enumErrorProps&&(a===Hb||a instanceof Error);for(var e in a)c&&"prototype"==e||d&&("message"==e||"name"==e)||b.push(e);if(Mb.nonEnumShadows&&a!==Ib){var f=a.constructor,g=-1,h=tb;if(a===(f&&f.prototype))var i=a===Jb?Db:a===Hb?yb:Eb.call(a),j=Lb[i];for(;++g<h;)e=sb[g],j&&j[e]||!Fb.call(a,e)||b.push(e)}return b}function k(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 l(a,b){return k(a,b,j)}function m(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function n(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,f=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=f&&"object"!=f))return!1;var g=Eb.call(a),h=Eb.call(b);if(g==ub&&(g=Bb),h==ub&&(h=Bb),g!=h)return!1;switch(g){case wb:case xb:return+a==+b;case Ab:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case Cb:case Db:return a==String(b)}var i=g==vb;if(!i){if(g!=Bb||!Mb.nodeClass&&(m(a)||m(b)))return!1;var j=!Mb.argsObject&&Ob(a)?Object:a.constructor,k=!Mb.argsObject&&Ob(b)?Object:b.constructor;if(!(j==k||Fb.call(a,"constructor")&&Fb.call(b,"constructor")||eb(j)&&j instanceof j&&eb(k)&&k instanceof k||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var o=c.length;o--;)if(c[o]==a)return d[o]==b;var p=0,q=!0;if(c.push(a),d.push(b),i){if(o=a.length,p=b.length,q=p==o)for(;p--;){var r=b[p];if(!(q=n(a[p],r,c,d)))break}}else l(b,function(b,e,f){return Fb.call(f,e)?(p++,q=Fb.call(a,e)&&n(a[e],b,c,d)):void 0}),q&&l(a,function(a,b,c){return Fb.call(c,b)?q=--p>-1:void 0});return c.pop(),d.pop(),q}function o(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function p(){try{return Pb.apply(this,arguments)}catch(a){return Vb.e=a,Vb}}function q(a){if(!eb(a))throw new TypeError("fn must be a function");return Pb=a,p}function r(a){throw a}function t(a,b){this.id=a,this.value=b}function u(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function v(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function w(a){this.observer=a,this.a=[],this.isStopped=!1}function x(){this._s=s}function y(){this._s=s,this._l=s.length,this._i=0}function z(a){this._a=a}function A(a){this._a=a,this._l=E(a),this._i=0}function B(a){return"number"==typeof a&&S.isFinite(a)}function C(b){var c,d=b[mb];if(!d&&"string"==typeof b)return c=new x(b),c[mb]();if(!d&&b.length!==a)return c=new z(b),c[mb]();if(!d)throw new TypeError("Object is not iterable");return b[mb]()}function D(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function E(a){var b=+a.length;return isNaN(b)?0:0!==b&&B(b)?(b=D(b)*Math.floor(Math.abs(b)),0>=b?0:b>Pc?Pc:b):b}function F(a,b){this.observer=a,this.parent=b}function G(a,b){return new Rc(b,a)}function H(a,b){return new id(function(c){var d=new ec,e=new fc;return e.setDisposable(d),d.setDisposable(a.subscribe(function(a){c.onNext(a)},function(a){try{var d=b(a)}catch(f){return c.onError(f)}db(d)&&(d=Jc(d));var g=new ec;e.setDisposable(g),g.setDisposable(d.subscribe(c))},function(a){c.onCompleted(a)})),e},a)}function I(a,b){var c=this;return new id(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 d.onError(i)}d.onNext(g)}else d.onCompleted()},function(a){d.onError(a)},function(){d.onCompleted()})},c)}function J(){return!1}function K(){return[]}function L(a,b,c){var d=rb(b,c,3);return a.map(function(b,c){var e=d(b,c,a);return db(e)&&(e=Jc(e)),(pb(e)||ob(e))&&(e=Qc(e)),e}).concatAll()}function M(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function N(a){this.comparer=a,this.set=[]}function O(a,b,c){this.observer=a,this.selector=b,this.source=c,this.i=0,this.isStopped=!1}function P(a,b,c){var d=rb(b,c,3);return a.map(function(b,c){var e=d(b,c,a);return db(e)&&(e=Jc(e)),(pb(e)||ob(e))&&(e=Qc(e)),e}).mergeAll()}function Q(a,b,c){this.observer=a,this.predicate=b,this.source=c,this.i=0,this.isStopped=!1}var R={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},S=R[typeof window]&&window||this,T=R[typeof exports]&&exports&&!exports.nodeType&&exports,U=R[typeof module]&&module&&!module.nodeType&&module,V=U&&U.exports===T&&T,W=R[typeof global]&&global;!W||W.global!==W&&W.window!==W||(S=W);var X={internals:{},config:{Promise:S.Promise},helpers:{}},Y=X.helpers.noop=function(){},Z=(X.helpers.notDefined=function(a){return"undefined"==typeof a},X.helpers.isScheduler=function(a){return a instanceof X.Scheduler}),$=X.helpers.identity=function(a){return a},_=(X.helpers.pluck=function(a){return function(b){return b[a]}},X.helpers.just=function(a){return function(){return a}},X.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}()),ab=X.helpers.defaultComparer=function(a,b){return Qb(a,b)},bb=X.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},cb=(X.helpers.defaultKeySerializer=function(a){return a.toString()},X.helpers.defaultError=function(a){throw a}),db=X.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},eb=(X.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},X.helpers.not=function(a){return!a},X.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==Eb.call(a)}),a}()),fb="Argument out of range",gb="Object has been disposed";X.config.longStackSupport=!1;var hb=!1;try{throw new Error}catch(ib){hb=!!ib.stack}var jb,kb=h(),lb="From previous event:",mb="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";S.Set&&"function"==typeof(new S.Set)["@@iterator"]&&(mb="@@iterator");var nb=X.doneEnumerator={done:!0,value:a},ob=X.helpers.isIterable=function(b){return b[mb]!==a},pb=X.helpers.isArrayLike=function(b){return b&&b.length!==a};X.helpers.iterator=mb;var qb,rb=X.internals.bindCallback=function(a,b,c){if("undefined"==typeof b)return a;switch(c){case 0:return function(){return a.call(b)};case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)}}return function(){return a.apply(b,arguments)}},sb=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],tb=sb.length,ub="[object Arguments]",vb="[object Array]",wb="[object Boolean]",xb="[object Date]",yb="[object Error]",zb="[object Function]",Ab="[object Number]",Bb="[object Object]",Cb="[object RegExp]",Db="[object String]",Eb=Object.prototype.toString,Fb=Object.prototype.hasOwnProperty,Gb=Eb.call(arguments)==ub,Hb=Error.prototype,Ib=Object.prototype,Jb=String.prototype,Kb=Ib.propertyIsEnumerable;try{qb=!(Eb.call(document)==Bb&&!({toString:0}+""))}catch(ib){qb=!0}var Lb={};Lb[vb]=Lb[xb]=Lb[Ab]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},Lb[wb]=Lb[Db]={constructor:!0,toString:!0,valueOf:!0},Lb[yb]=Lb[zb]=Lb[Cb]={constructor:!0,toString:!0},Lb[Bb]={constructor:!0};var Mb={};!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);Mb.enumErrorProps=Kb.call(Hb,"message")||Kb.call(Hb,"name"),Mb.enumPrototypes=Kb.call(a,"prototype"),Mb.nonEnumArgs=0!=c,Mb.nonEnumShadows=!/valueOf/.test(b)}(1);var Nb=X.internals.isObject=function(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1},Ob=function(a){return a&&"object"==typeof a?Eb.call(a)==ub:!1};Gb||(Ob=function(a){return a&&"object"==typeof a?Fb.call(a,"callee"):!1});var Pb,Qb=X.internals.isEqual=function(a,b){return n(a,b,[],[])},Rb=({}.hasOwnProperty,Array.prototype.slice),Sb=this.inherits=X.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c},Tb=X.internals.addProperties=function(a){for(var b=[],c=1,d=arguments.length;d>c;c++)b.push(arguments[c]);for(var e=0,f=b.length;f>e;e++){var g=b[e];for(var h in g)a[h]=g[h]}},Ub=X.internals.addRef=function(a,b){return new id(function(c){return new $b(b.getDisposable(),a.subscribe(c))})},Vb={e:{}};Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=Rb.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(Rb.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(Rb.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 Wb=Object("a"),Xb="a"!=Wb[0]||!(0 in Wb);Array.prototype.every||(Array.prototype.every=function(a){var b=Object(this),c=Xb&&{}.toString.call(this)==Db?this.split(""):b,d=c.length>>>0,e=arguments[1];if({}.toString.call(a)!=zb)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=Xb&&{}.toString.call(this)==Db?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if({}.toString.call(a)!=zb)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)==vb}),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}),Object.prototype.propertyIsEnumerable||(Object.prototype.propertyIsEnumerable=function(a){for(var b in this)if(b===a)return!0;return!1}),Object.keys||(Object.keys=function(){"use strict";var a=Object.prototype.hasOwnProperty,b=!{toString:null}.propertyIsEnumerable("toString");return function(c){if("object"!=typeof c&&("function"!=typeof c||null===c))throw new TypeError("Object.keys called on non-object");var d,e,f=[];for(d in c)a.call(c,d)&&f.push(d);if(b)for(e=0;tb>e;e++)a.call(c,sb[e])&&f.push(sb[e]);return f}}()),t.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var Yb=X.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},Zb=Yb.prototype;Zb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},Zb.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)}}},Zb.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)}}},Zb.peek=function(){return this.items[0].value},Zb.removeAt=function(b){this.items[b]=this.items[--this.length],this.items[this.length]=a,this.heapify()},Zb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},Zb.enqueue=function(a){var b=this.length++;this.items[b]=new t(Yb.count++,a),this.percolate(b)},Zb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},Yb.count=0;var $b=X.CompositeDisposable=function(){var a,b,c=[];if(Array.isArray(arguments[0]))c=arguments[0],b=c.length;else for(b=arguments.length,c=new Array(b),a=0;b>a;a++)c[a]=arguments[a];for(a=0;b>a;a++)if(!dc(c[a]))throw new TypeError("Not a disposable");this.disposables=c,this.isDisposed=!1,this.length=c.length},_b=$b.prototype;_b.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},_b.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},_b.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var a=this.disposables.length,b=new Array(a),c=0;a>c;c++)b[c]=this.disposables[c];for(this.disposables=[],this.length=0,c=0;a>c;c++)b[c].dispose()}};var ac=X.Disposable=function(a){this.isDisposed=!1,this.action=a||Y};ac.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var bc=ac.create=function(a){return new ac(a)},cc=ac.empty={dispose:Y},dc=ac.isDisposable=function(a){return a&&eb(a.dispose)},ec=X.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=this.isDisposed;if(!b){var c=this.current;this.current=a}c&&c.dispose(),b&&a&&a.dispose()},b.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()},a}(),fc=X.SerialDisposable=ec,gc=X.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?cc:new a(this)},b}();u.prototype.dispose=function(){this.scheduler.scheduleWithState(this,v)};var hc=X.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||bb,this.disposable=new ec};hc.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},hc.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},hc.prototype.isCancelled=function(){return this.disposable.isDisposed},hc.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};{var ic=X.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(),cc}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=_,a.normalize=function(a){return 0>a&&(a=0),a},a}();ic.normalize}!function(a){function b(a,b){var c=b.first,d=b.second,e=new $b,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),cc});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new $b,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c](b,d,function(a,b){return e?f.remove(i):h=!0,g(b),cc});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")})}}(ic.prototype),function(){ic.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},ic.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof S.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=S.setInterval(function(){d=c(d)},b);return bc(function(){S.clearInterval(e)})}}(ic.prototype),function(a){a.catchError=a["catch"]=function(a){return new qc(this,a)}}(ic.prototype);var jc,kc=(X.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 ec;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),ic.immediate=function(){function a(a,b){return b(this,a)}function b(){throw new Error("Not supported")}return new ic(_,a,b,b)}()),lc=ic.currentThread=function(){function a(){for(;d.length>0;){var a=d.dequeue();a.isCancelled()||!a.isCancelled()&&a.invoke()}}function b(b,c){var e=new hc(this,b,c,this.now());if(d)d.enqueue(e);else{d=new Yb(4),d.enqueue(e);var f=q(a)();if(d=null,f===Vb)return r(f.e)}return e.disposable}function c(){throw new Error("Not supported")}var d,e=new ic(_,b,c,c);return e.scheduleRequired=function(){return!d},e.ensureTrampoline=function(a){d?a():this.schedule(a)},e}(),mc=Y,nc=function(){var a,b=Y;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!S.setTimeout)throw new Error("No concurrency detected!");a=S.setTimeout,b=S.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),oc=nc.setTimeout,pc=nc.clearTimeout;!function(){function a(){if(!S.postMessage||S.importScripts)return!1;var a=!1,b=S.onmessage;return S.onmessage=function(){a=!0},S.postMessage("","*"),S.onmessage=b,a}var b=RegExp("^"+String(Eb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),c="function"==typeof(c=W&&V&&W.setImmediate)&&!b.test(c)&&c,d="function"==typeof(d=W&&V&&W.clearImmediate)&&!b.test(d)&&d;if("function"==typeof c)jc=c,mc=d;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))jc=process.nextTick;else if(a()){var e="ms.rx.schedule"+Math.random(),f={},g=0,h=function(a){if("string"==typeof a.data&&a.data.substring(0,e.length)===e){var b=a.data.substring(e.length),c=f[b];c(),delete f[b]}};S.addEventListener?S.addEventListener("message",h,!1):S.attachEvent("onmessage",h,!1),jc=function(a){var b=g++;f[b]=a,S.postMessage(e+b,"*")}}else if(S.MessageChannel){var i=new S.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},jc=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in S&&"onreadystatechange"in S.document.createElement("script")?jc=function(a){var b=S.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},S.document.documentElement.appendChild(b)}:(jc=function(a){return oc(a,0)},mc=pc)}();var qc=(ic.timeout=function(){function a(a,b){var c=this,d=new ec,e=jc(function(){d.isDisposed||d.setDisposable(b(c,a))});return new $b(d,bc(function(){mc(e)}))}function b(a,b,c){var d=this,e=ic.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new ec,g=oc(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new $b(f,bc(function(){pc(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new ic(_,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 Sb(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 cc}}},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 ec;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}(ic)),rc=X.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 Z(a)||(a=kc),new id(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),sc=rc.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 rc("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),tc=rc.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 rc("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),uc=rc.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new rc("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),vc=X.internals.Enumerator=function(a){this._next=a};vc.prototype.next=function(){return this._next()},vc.prototype[mb]=function(){return this};var wc=X.internals.Enumerable=function(a){this._iterator=a};wc.prototype[mb]=function(){return this._iterator()},wc.prototype.concat=function(){var a=this;return new id(function(b){var c,d=a[mb](),e=new fc,f=kc.scheduleRecursive(function(a){if(!c){try{var f=d.next()}catch(g){return b.onError(g)}if(f.done)return b.onCompleted();var h=f.value;db(h)&&(h=Jc(h));var i=new ec;e.setDisposable(i),i.setDisposable(h.subscribe(function(a){b.onNext(a)},function(a){b.onError(a)},a))}});return new $b(e,f,bc(function(){c=!0}))})},wc.prototype.catchError=function(){var a=this;return new id(function(b){var c,d=a[mb](),e=new fc,f=kc.scheduleRecursiveWithState(null,function(a,f){if(!c){try{var g=d.next()}catch(h){return observer.onError(h)}if(g.done)return void(null!==a?b.onError(a):b.onCompleted());var i=g.value;db(i)&&(i=Jc(i));var j=new ec;e.setDisposable(j),j.setDisposable(i.subscribe(function(a){b.onNext(a)},f,function(){b.onCompleted()}))}});return new $b(e,f,bc(function(){c=!0}))})},wc.prototype.catchErrorWhen=function(a){var b=this;return new id(function(c){var d,e,f=new ld,g=new ld,h=a(f),i=h.subscribe(g),j=b[mb](),k=new fc,l=kc.scheduleRecursive(function(a){if(!d){try{var b=j.next()}catch(h){return c.onError(h)}if(b.done)return void(e?c.onError(e):c.onCompleted());var i=b.value;db(i)&&(i=Jc(i));var l=new ec,m=new ec;k.setDisposable(new $b(m,l)),l.setDisposable(i.subscribe(function(a){c.onNext(a)},function(b){m.setDisposable(g.subscribe(a,function(a){c.onError(a)},function(){c.onCompleted()})),f.onNext(b)},function(){c.onCompleted()}))}});return new $b(i,k,l,bc(function(){d=!0}))})};var xc=wc.repeat=function(a,b){return null==b&&(b=-1),new wc(function(){var c=b;return new vc(function(){return 0===c?nb:(c>0&&c--,{done:!1,value:a})})})},yc=wc.of=function(a,b,c){if(b)var d=rb(b,c,3);return new wc(function(){var c=-1;return new vc(function(){return++c<a.length?{done:!1,value:b?d(a[c],c,a):a[c]}:nb})})},zc=X.Observer=function(){};zc.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},zc.prototype.asObserver=function(){return new Dc(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},zc.prototype.checked=function(){return new Ec(this)};var Ac=zc.create=function(a,b,c){return a||(a=Y),b||(b=cb),c||(c=Y),new Dc(a,b,c)};zc.fromNotifier=function(a,b){return new Dc(function(c){return a.call(b,sc(c))},function(c){return a.call(b,tc(c))},function(){return a.call(b,uc())})},zc.prototype.notifyOn=function(a){return new Gc(a,this)},zc.prototype.makeSafe=function(a){return new AnonymousSafeObserver(this._onNext,this._onError,this._onCompleted,a)};var Bc,Cc=X.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}function c(){throw new Error("Method not implemented")}return Sb(b,a),b.prototype.next=c,b.prototype.error=c,b.prototype.completed=c,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}(zc),Dc=X.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return Sb(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=function(a){function b(b){a.call(this),this._observer=b,this._state=0}Sb(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}(zc),Fc=X.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 fc}return Sb(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),Gc=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return Sb(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(Fc),Hc=X.Observable=function(){function a(a){if(X.config.longStackSupport&&hb){try{throw new Error}catch(b){this.stack=b.stack.substring(b.stack.indexOf("\n")+1)}var c=this;this._subscribe=function(b){var e=b.onError.bind(b);return b.onError=function(a){d(a,c),e(a)},a.call(c,b)}}else 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("undefined"!=typeof b?function(c){a.call(b,c)}:a))},Bc.subscribeOnError=function(a,b){return this._subscribe(Ac(null,"undefined"!=typeof b?function(c){a.call(b,c)}:a))},Bc.subscribeOnCompleted=function(a,b){return this._subscribe(Ac(null,null,"undefined"!=typeof b?function(){a.call(b)}:a))},a}(),Ic=X.ObservableBase=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?bc(a):cc}function c(a,c){var d=c[0],e=c[1],f=q(e.subscribeCore).call(e,d);return f!==Vb||d.fail(Vb.e)?void d.setDisposable(b(f)):r(Vb.e)}function d(a){var b=new jd(a),d=[b,this];return lc.scheduleRequired()?lc.scheduleWithState(d,c):c(null,d),b}function e(){a.call(this,d)}return Sb(e,a),e.prototype.subscribeCore=function(){throw new Error("Not implemeneted")},e}(Hc);Bc.observeOn=function(a){var b=this;return new id(function(c){return b.subscribe(new Gc(a,c))},b)},Bc.subscribeOn=function(a){var b=this;return new id(function(c){var d=new ec,e=new fc;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new u(a,b.subscribe(c)))})),e},b)};var Jc=Hc.fromPromise=function(a){return Lc(function(){var b=new X.AsyncSubject;return a.then(function(a){b.onNext(a),b.onCompleted()},b.onError.bind(b)),b})};Bc.toPromise=function(a){if(a||(a=X.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)})})};var Kc=function(a){function b(b){this.source=b,a.call(this)}return Sb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new w(a))},b}(Ic);w.prototype.onNext=function(a){this.isStopped||this.a.push(a)},w.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.observer.onError(a))},w.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.observer.onNext(this.a),this.observer.onCompleted())},w.prototype.dispose=function(){this.isStopped=!0},w.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},Bc.toArray=function(){return new Kc(this)},Hc.create=Hc.createWithDisposable=function(a,b){return new id(a,b)};var Lc=Hc.defer=function(a){return new id(function(b){var c;try{c=a()}catch(d){return Xc(d).subscribe(b)}return db(c)&&(c=Jc(c)),c.subscribe(b)})},Mc=Hc.empty=function(a){return Z(a)||(a=kc),new id(function(b){return a.schedule(function(){b.onCompleted()})})},Nc=function(a){function b(b,c,d){this.iterable=b,this.mapper=c,this.scheduler=d,a.call(this)
}return Sb(b,a),b.prototype.subscribeCore=function(a){var b=new Oc(a,this);return b.run()},b}(Ic),Oc=function(){function a(a,b){this.observer=a,this.parent=b}return a.prototype.run=function(){function a(a,b){try{var f=c.next()}catch(g){return d.onError(g)}if(f.done)return d.onCompleted();var h=f.value;if(e)try{h=e(h,a)}catch(g){return d.onError(g)}d.onNext(h),b(a+1)}var b=Object(this.parent.iterable),c=C(b),d=this.observer,e=this.parent.mapper;return this.parent.scheduler.scheduleRecursiveWithState(0,a)},a}(),Pc=Math.pow(2,53)-1;x.prototype[mb]=function(){return new y(this._s)},y.prototype[mb]=function(){return this},y.prototype.next=function(){return this._i<this._l?{done:!1,value:this._s.charAt(this._i++)}:nb},z.prototype[mb]=function(){return new A(this._a)},A.prototype[mb]=function(){return this},A.prototype.next=function(){return this._i<this._l?{done:!1,value:this._a[this._i++]}:nb};var Qc=Hc.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!eb(b))throw new Error("mapFn when provided must be a function");if(b)var e=rb(b,c,2);return Z(d)||(d=lc),new Nc(a,e,d)},Rc=function(a){function b(b,c){this.args=b,this.scheduler=c||lc,a.call(this)}return Sb(b,a),b.prototype.subscribeCore=function(a){var b=new F(a,this);return b.run()},b}(Ic);F.prototype.run=function(){function a(a,e){d>a?(b.onNext(c[a]),e(a+1)):b.onCompleted()}var b=this.observer,c=this.parent.args,d=c.length;return this.parent.scheduler.scheduleRecursiveWithState(0,a)};var Sc=Hc.fromArray=function(a,b){return new Rc(a,b)};Hc.generate=function(a,b,c,d,e){return Z(e)||(e=lc),new id(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 Tc=Hc.never=function(){return new id(function(){return cc})};Hc.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return new Rc(b)},Hc.ofWithScheduler=function(a){for(var b=arguments.length,c=new Array(b-1),d=1;b>d;d++)c[d-1]=arguments[d];return new Rc(c,a)},Hc.pairs=function(a,b){return b||(b=X.Scheduler.currentThread),new id(function(c){var d=Object.keys(a),e=d.length;return b.scheduleRecursiveWithState(0,function(b,f){if(e>b){var g=d[b];c.onNext([g,a[g]]),f(b+1)}else c.onCompleted()})})};var Uc=function(a){function b(b,c,d){this.start=b,this.count=c,this.scheduler=d,a.call(this)}return Sb(b,a),b.prototype.subscribeCore=function(a){var b=new Vc(a,this);return b.run()},b}(Ic),Vc=function(){function a(a,b){this.observer=a,this.parent=b}return a.prototype.run=function(){function a(a,e){c>a?(d.onNext(b+a),e(a+1)):d.onCompleted()}var b=this.parent.start,c=this.parent.count,d=this.observer;return this.parent.scheduler.scheduleRecursiveWithState(0,a)},a}();Hc.range=function(a,b,c){return Z(c)||(c=lc),new Uc(a,b,c)},Hc.repeat=function(a,b,c){return Z(c)||(c=lc),Wc(a,c).repeat(null==b?-1:b)};var Wc=Hc["return"]=Hc.just=function(a,b){return Z(b)||(b=kc),new id(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})};Hc.returnValue=function(){return Wc.apply(null,arguments)};var Xc=Hc["throw"]=Hc.throwError=function(a,b){return Z(b)||(b=kc),new id(function(c){return b.schedule(function(){c.onError(a)})})};Hc.throwException=function(){return Hc.throwError.apply(null,arguments)},Hc.using=function(a,b){return new id(function(c){var d,e,f=cc;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new $b(Xc(g).subscribe(c),f)}return new $b(e.subscribe(c),f)})},Bc.amb=function(a){var b=this;return new id(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new ec,j=new ec;return db(a)&&(a=Jc(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 $b(i,j)})},Hc.amb=function(){function a(a,b){return a.amb(b)}var b=Tc(),c=[];if(Array.isArray(arguments[0]))c=arguments[0];else for(var d=0,e=arguments.length;e>d;d++)c.push(arguments[d]);for(var d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},Bc["catch"]=Bc.catchError=Bc.catchException=function(a){return"function"==typeof a?H(this,a):Yc([this,a])};var Yc=Hc.catchError=Hc["catch"]=Hc.catchException=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return yc(a).catchError()};Bc.combineLatest=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return Array.isArray(b[0])?b[0].unshift(this):b.unshift(this),Zc.apply(this,b)};var Zc=Hc.combineLatest=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=b.pop();return a--,Array.isArray(b[0])&&(b=b[0]),new id(function(c){function e(a){if(h[a]=!0,i||(i=h.every($))){try{var b=d.apply(null,k)}catch(e){return void c.onError(e)}c.onNext(b)}else j.filter(function(b,c){return c!==a}).every($)&&c.onCompleted()}function f(a){j[a]=!0,j.every($)&&c.onCompleted()}for(var g=function(){return!1},h=o(a,g),i=!1,j=o(a,g),k=new Array(a),l=new Array(a),m=0;a>m;m++)!function(a){var d=b[a],g=new ec;db(d)&&(d=Jc(d)),g.setDisposable(d.subscribe(function(b){k[a]=b,e(a)},function(a){c.onError(a)},function(){f(a)})),l[a]=g}(m);return new $b(l)},this)};Bc.concat=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return a.unshift(this),$c.apply(null,a)};var $c=Hc.concat=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{a=new Array(arguments.length);for(var b=0,c=arguments.length;c>b;b++)a[b]=arguments[b]}return yc(a).concat()};Bc.concatAll=Bc.concatObservable=function(){return this.merge(1)};var _c=function(a){function b(b,c){this.source=b,this.maxConcurrent=c,a.call(this)}return Sb(b,a),b.prototype.subscribeCore=function(a){var b=new $b;return b.add(this.source.subscribe(new ad(a,this.maxConcurrent,b))),b},b}(Ic),ad=function(){function a(a,b,c){this.o=a,this.max=b,this.g=c,this.done=!1,this.q=[],this.activeCount=0,this.isStopped=!1}function b(a,b){this.parent=a,this.sad=b,this.isStopped=!1}return a.prototype.handleSubscribe=function(a){var c=new ec;this.g.add(c),db(a)&&(a=Jc(a)),c.setDisposable(a.subscribe(new b(this,c)))},a.prototype.onNext=function(a){this.isStopped||(this.activeCount<this.max?(this.activeCount++,this.handleSubscribe(a)):this.q.push(a))},a.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},a.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,0===this.activeCount&&this.o.onCompleted())},a.prototype.dispose=function(){this.isStopped=!0},a.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},b.prototype.onNext=function(a){this.isStopped||this.parent.o.onNext(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.parent.o.onError(a))},b.prototype.onCompleted=function(){if(!this.isStopped){var a=this.parent;a.g.remove(this.sad),a.q.length>0?a.handleSubscribe(a.q.shift()):(a.activeCount--,a.done&&0===a.activeCount&&a.o.onCompleted())}},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(a),!0)},a}();Bc.merge=function(a){return"number"!=typeof a?bd(this,a):new _c(this,a)};var bd=Hc.merge=function(){var a,b,c=[],d=arguments.length;if(arguments[0])if(Z(arguments[0]))for(a=arguments[0],b=1;d>b;b++)c.push(arguments[b]);else for(a=kc,b=0;d>b;b++)c.push(arguments[b]);else for(a=kc,b=1;d>b;b++)c.push(arguments[b]);return Array.isArray(c[0])&&(c=c[0]),G(a,c).mergeAll()},cd=function(a){function b(b){this.source=b,a.call(this)}return Sb(b,a),b.prototype.subscribeCore=function(a){var b=new $b,c=new ec;return b.add(c),c.setDisposable(this.source.subscribe(new dd(a,b))),b},b}(Ic),dd=function(){function a(a,b){this.o=a,this.g=b,this.isStopped=!1,this.done=!1}function b(a,b,c){this.parent=a,this.g=b,this.sad=c,this.isStopped=!1}return a.prototype.onNext=function(a){if(!this.isStopped){var c=new ec;this.g.add(c),db(a)&&(a=Jc(a)),c.setDisposable(a.subscribe(new b(this,this.g,c)))}},a.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},a.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,1===this.g.length&&this.o.onCompleted())},a.prototype.dispose=function(){this.isStopped=!0},a.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},b.prototype.onNext=function(a){this.isStopped||this.parent.o.onNext(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.parent.o.onError(a))},b.prototype.onCompleted=function(){if(!this.isStopped){var a=this.parent;this.isStopped=!0,a.g.remove(this.sad),a.done&&1===a.g.length&&a.o.onCompleted()}},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(a),!0)},a}();Bc.mergeAll=Bc.mergeObservable=function(){return new cd(this)};var ed=X.CompositeError=function(a){this.name="NotImplementedError",this.innerErrors=a,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};ed.prototype=Error.prototype,Hc.mergeDelayError=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}var d=G(null,a);return new id(function(a){function b(){0===g.length?a.onCompleted():a.onError(1===g.length?g[0]:new ed(g))}var c=new $b,e=new ec,f=!1,g=[];return c.add(e),e.setDisposable(d.subscribe(function(d){var e=new ec;c.add(e),db(d)&&(d=Jc(d)),e.setDisposable(d.subscribe(function(b){a.onNext(b)},function(a){g.push(a),c.remove(e),f&&1===c.length&&b()},function(){c.remove(e),f&&1===c.length&&b()}))},function(a){g.push(a),f=!0,1===c.length&&b()},function(){f=!0,1===c.length&&b()})),c})},Bc.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return fd([this,a])};var fd=Hc.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return new id(function(b){var c=0,d=new fc,e=kc.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],db(f)&&(f=Jc(f)),g=new ec,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new $b(d,e)})};Bc.skipUntil=function(a){var b=this;return new id(function(c){var d=!1,e=new $b(b.subscribe(function(a){d&&c.onNext(a)},function(a){c.onError(a)},function(){d&&c.onCompleted()}));db(a)&&(a=Jc(a));var f=new ec;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},function(a){c.onError(a)},function(){f.dispose()})),e},b)},Bc["switch"]=Bc.switchLatest=function(){var a=this;return new id(function(b){var c=!1,d=new fc,e=!1,f=0,g=a.subscribe(function(a){var g=new ec,h=++f;c=!0,d.setDisposable(g),db(a)&&(a=Jc(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())}))},function(a){b.onError(a)},function(){e=!0,!c&&b.onCompleted()});return new $b(g,d)},a)},Bc.takeUntil=function(a){var b=this;return new id(function(c){return db(a)&&(a=Jc(a)),new $b(b.subscribe(c),a.subscribe(function(){c.onCompleted()},function(a){c.onError(a)},Y))},b)},Bc.withLatestFrom=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);var d=a.pop(),e=this;if("undefined"==typeof e)throw new Error("Source observable not found for withLatestFrom().");if("function"!=typeof d)throw new Error("withLatestFrom() expects a resultSelector function.");return Array.isArray(a[0])&&(a=a[0]),new id(function(b){for(var c=function(){return!1},f=a.length,g=o(f,c),h=!1,i=new Array(f),j=new Array(f+1),k=0;f>k;k++)!function(c){var d=a[c],e=new ec;db(d)&&(d=Jc(d)),e.setDisposable(d.subscribe(function(a){i[c]=a,g[c]=!0,h=g.every($)},b.onError.bind(b),function(){})),j[c]=e}(k);var l=new ec;return l.setDisposable(e.subscribe(function(a){var c,e=[a].concat(i);if(h){try{c=d.apply(null,e)}catch(f){return void b.onError(f)}b.onNext(c)}},b.onError.bind(b),function(){b.onCompleted()})),j[f]=l,new $b(j)},this)},Bc.zip=function(){if(Array.isArray(arguments[0]))return I.apply(this,arguments);for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=this,e=b.pop();return b.unshift(d),new id(function(a){function c(b){var c,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),c=e.apply(d,f)}catch(g){return void a.onError(g)}a.onNext(c)}else i.filter(function(a,c){return c!==b}).every($)&&a.onCompleted()}function f(b){i[b]=!0,i.every(function(a){return a})&&a.onCompleted()}for(var g=b.length,h=o(g,K),i=o(g,J),j=new Array(g),k=0;g>k;k++)!function(d){var e=b[d],g=new ec;db(e)&&(e=Jc(e)),g.setDisposable(e.subscribe(function(a){h[d].push(a),c(d)},function(b){a.onError(b)},function(){f(d)})),j[d]=g}(k);return new $b(j)},d)},Hc.zip=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=b.shift();return d.zip.apply(d,b)},Hc.zipArray=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new id(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($))return void b.onCompleted()}function d(a){return g[a]=!0,g.every($)?void b.onCompleted():void 0}for(var e=a.length,f=o(e,function(){return[]}),g=o(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new ec,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},function(a){b.onError(a)},function(){d(e)}))}(i);return new $b(h)})},Bc.asObservable=function(){var a=this;return new id(function(b){return a.subscribe(b)},this)},Bc.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})},Bc.dematerialize=function(){var a=this;return new id(function(b){return a.subscribe(function(a){return a.accept(b)},function(a){b.onError(a)},function(){b.onCompleted()})},this)},Bc.distinctUntilChanged=function(a,b){var c=this;return b||(b=ab),new id(function(d){var e,f=!1;return c.subscribe(function(c){var g=c;if(a)try{g=a(c)}catch(h){return void d.onError(h)}if(f)try{var i=b(e,g)}catch(h){return void d.onError(h)}f&&i||(f=!0,e=g,d.onNext(c))},function(a){d.onError(a)},function(){d.onCompleted()})},this)},Bc["do"]=Bc.tap=Bc.doAction=function(a,b,c){var d=this,e="function"==typeof a||"undefined"==typeof a?Ac(a||Y,b||Y,c||Y):a;return new id(function(a){return d.subscribe(function(b){try{e.onNext(b)}catch(c){a.onError(c)}a.onNext(b)},function(b){try{e.onError(b)}catch(c){a.onError(c)}a.onError(b)},function(){try{e.onCompleted()}catch(b){a.onError(b)}a.onCompleted()})},this)},Bc.doOnNext=Bc.tapOnNext=function(a,b){return this.tap("undefined"!=typeof b?function(c){a.call(b,c)}:a)},Bc.doOnError=Bc.tapOnError=function(a,b){return this.tap(Y,"undefined"!=typeof b?function(c){a.call(b,c)}:a)},Bc.doOnCompleted=Bc.tapOnCompleted=function(a,b){return this.tap(Y,null,"undefined"!=typeof b?function(){a.call(b)}:a)},Bc["finally"]=Bc.ensure=function(a){var b=this;return new id(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return bc(function(){try{d.dispose()}catch(b){throw b}finally{a()}})},this)},Bc.finallyAction=function(a){return this.ensure(a)},Bc.ignoreElements=function(){var a=this;return new id(function(b){return a.subscribe(Y,function(a){b.onError(a)},function(){b.onCompleted()})},a)},Bc.materialize=function(){var a=this;return new id(function(b){return a.subscribe(function(a){b.onNext(sc(a))},function(a){b.onNext(tc(a)),b.onCompleted()},function(){b.onNext(uc()),b.onCompleted()})},a)},Bc.repeat=function(a){return xc(this,a).concat()},Bc.retry=function(a){return xc(this,a).catchError()},Bc.retryWhen=function(a){return xc(this).catchErrorWhen(a)},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 id(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)},function(a){e.onError(a)},function(){!h&&c&&e.onNext(a),e.onCompleted()})},d)},Bc.skipLast=function(a){var b=this;return new id(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},function(a){c.onError(a)},function(){c.onCompleted()})},b)},Bc.startWith=function(){var a,b=0;arguments.length&&Z(arguments[0])?(a=arguments[0],b=1):a=kc;for(var c=[],d=b,e=arguments.length;e>d;d++)c.push(arguments[d]);return yc([Sc(c,a),this]).concat()},Bc.takeLast=function(a){var b=this;return new id(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})},b)},Bc.takeLastBuffer=function(a){var b=this;return new id(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){c.onNext(d),c.onCompleted()})},b)},Bc.windowWithCount=function(a,b){var c=this;if(+a||(a=0),1/0===Math.abs(a)&&(a=0),0>=a)throw new Error(fb);if(null==b&&(b=a),+b||(b=0),1/0===Math.abs(b)&&(b=0),0>=b)throw new Error(fb);return new id(function(d){function e(){var a=new ld;i.push(a),d.onNext(Ub(a,g))}var f=new ec,g=new gc(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g},c)},Bc.selectConcat=Bc.concatMap=function(a,b,c){return eb(a)&&eb(b)?this.concatMap(function(c,d){var e=a(c,d);return db(e)&&(e=Jc(e)),(pb(e)||ob(e))&&(e=Qc(e)),e.map(function(a,e){return b(c,a,d,e)})}):eb(a)?L(this,a,c):L(this,function(){return a})},Bc.concatMapObserver=Bc.selectConcatObserver=function(a,b,c,d){var e=this,f=rb(a,d,2),g=rb(b,d,1),h=rb(c,d,0);return new id(function(a){var b=0;return e.subscribe(function(c){var d;try{d=f(c,b++)}catch(e){return void a.onError(e)}db(d)&&(d=Jc(d)),a.onNext(d)},function(b){var c;try{c=g(b)}catch(d){return void a.onError(d)}db(c)&&(c=Jc(c)),a.onNext(c),a.onCompleted()},function(){var b;try{b=h()}catch(c){return void a.onError(c)}db(b)&&(b=Jc(b)),a.onNext(b),a.onCompleted()})},this).concatAll()},Bc.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new id(function(a){var d=!1;return c.subscribe(function(b){d=!0,a.onNext(b)},function(b){a.onError(b)},function(){!d&&a.onNext(b),a.onCompleted()})},c)},N.prototype.push=function(a){var b=-1===M(this.set,a,this.comparer);return b&&this.set.push(a),b},Bc.distinct=function(a,b){var c=this;return b||(b=ab),new id(function(d){var e=new N(b);return c.subscribe(function(b){var c=b;if(a)try{c=a(b)}catch(f){return void d.onError(f)}e.push(c)&&d.onNext(b)},function(a){d.onError(a)},function(){d.onCompleted()})},this)};var gd=function(a){function b(b,c,d){this.source=b,this.selector=rb(c,d,3),a.call(this)}return Sb(b,a),b.prototype.internalMap=function(a,c){var d=this;return new b(this.source,function(b,c,e){return a(d.selector(b,c,e),c,e)},c)},b.prototype.subscribeCore=function(a){return this.source.subscribe(new O(a,this.selector,this))},b}(Ic);O.prototype.onNext=function(a){if(!this.isStopped){var b=q(this.selector).call(this,a,this.i++,this.source);return b===Vb?this.observer.onError(b.e):void this.observer.onNext(b)}},O.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.observer.onError(a))},O.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.observer.onCompleted())},O.prototype.dispose=function(){this.isStopped=!0},O.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},Bc.map=Bc.select=function(a,b){var c="function"==typeof a?a:function(){return a};return this instanceof gd?this.internalMap(c,b):new gd(this,c,b)},Bc.pluck=function(){var b=arguments,c=arguments.length;if(0===c)throw new Error("List of properties cannot be empty.");return this.map(function(d){for(var e=d,f=0;c>f;f++){var g=e[b[f]];if("undefined"==typeof g)return a;e=g}return e})},Bc.selectMany=Bc.flatMap=function(a,b,c){return eb(a)&&eb(b)?this.flatMap(function(c,d){var e=a(c,d);return db(e)&&(e=Jc(e)),(pb(e)||ob(e))&&(e=Qc(e)),e.map(function(a,e){return b(c,a,d,e)})},c):eb(a)?P(this,a,c):P(this,function(){return a})},Bc.flatMapObserver=Bc.selectManyObserver=function(a,b,c,d){var e=this;return new id(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)}db(c)&&(c=Jc(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}db(c)&&(c=Jc(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}db(a)&&(a=Jc(a)),f.onNext(a),f.onCompleted()})},e).mergeAll()},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(fb);var b=this;return new id(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},function(a){c.onError(a)},function(){c.onCompleted()})},b)},Bc.skipWhile=function(a,b){var c=this,d=rb(a,b,3);return new id(function(a){var b=0,e=!1;return c.subscribe(function(f){if(!e)try{e=!d(f,b++,c)}catch(g){return void a.onError(g)}e&&a.onNext(f)},function(b){a.onError(b)},function(){a.onCompleted()})},c)},Bc.take=function(a,b){if(0>a)throw new RangeError(fb);if(0===a)return Mc(b);var c=this;return new id(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},function(a){b.onError(a)},function(){b.onCompleted()})},c)},Bc.takeWhile=function(a,b){var c=this,d=rb(a,b,3);return new id(function(a){var b=0,e=!0;return c.subscribe(function(f){if(e){try{e=d(f,b++,c)}catch(g){return void a.onError(g)}e?a.onNext(f):a.onCompleted()}},function(b){a.onError(b)},function(){a.onCompleted()})},c)};var hd=function(a){function b(b,c,d){this.source=b,this.predicate=rb(c,d,3),a.call(this)}return Sb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Q(a,this.predicate,this))},b.prototype.internalFilter=function(a,c){var d=this;return new b(this.source,function(b,c,e){return d.predicate(b,c,e)&&a(b,c,e)},c)},b}(Ic);Q.prototype.onNext=function(a){if(!this.isStopped){var b=q(this.predicate).call(this,a,this.i++,this.source);return b===Vb?this.observer.onError(b.e):void(b&&this.observer.onNext(a))}},Q.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.observer.onError(a))},Q.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.observer.onCompleted())},Q.prototype.dispose=function(){this.isStopped=!0},Q.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},Bc.filter=Bc.where=function(a,b){return this instanceof hd?this.internalFilter(a,b):new hd(this,a,b)},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 id(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)})},c)};var id=X.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?bc(a):cc}function c(a,c){var d=c[0],e=c[1];try{d.setDisposable(b(e(d)))}catch(f){if(!d.fail(f))throw f}}function d(b,d){function e(a){var d=new jd(a),e=[d,b];return lc.scheduleRequired()?lc.scheduleWithState(e,c):c(null,e),d}this.source=d,a.call(this,e)}return Sb(d,a),d}(Hc),jd=function(a){function b(b){a.call(this),this.observer=b,this.m=new ec}Sb(b,a);var c=b.prototype;return c.next=function(a){var b=q(this.observer.onNext).call(this.observer,a);return b===Vb?(this.dispose(),r(b.e)):void 0},c.error=function(a){var b=q(this.observer.onError).call(this.observer,a);return this.dispose(),b===Vb?r(b.e):void 0},c.completed=function(){var a=q(this.observer.onCompleted).call(this.observer);return this.dispose(),a===Vb?r(a.e):void 0},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Cc),kd=function(a,b){this.subject=a,this.observer=b};kd.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 ld=X.Subject=function(a){function d(a){return b(this),this.isStopped?this.hasError?(a.onError(this.error),cc):(a.onCompleted(),cc):(this.observers.push(a),new kd(this,a))}function e(){a.call(this,d),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return Sb(e,a),Tb(e.prototype,zc.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b(this),!this.isStopped){this.isStopped=!0;for(var a=0,d=c(this.observers),e=d.length;e>a;a++)d[a].onCompleted();this.observers.length=0}},onError:function(a){if(b(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onError(a);this.observers.length=0}},onNext:function(a){if(b(this),!this.isStopped)for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),e.create=function(a,b){return new md(a,b)},e}(Hc),md=(X.AsyncSubject=function(a){function d(a){return b(this),this.isStopped?(this.hasError?a.onError(this.error):this.hasValue?(a.onNext(this.value),a.onCompleted()):a.onCompleted(),cc):(this.observers.push(a),new kd(this,a))}function e(){a.call(this,d),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return Sb(e,a),Tb(e.prototype,zc,{hasObservers:function(){return b(this),this.observers.length>0},onCompleted:function(){var a,d;if(b(this),!this.isStopped){this.isStopped=!0;var e=c(this.observers),d=e.length;if(this.hasValue)for(a=0;d>a;a++){var f=e[a];f.onNext(this.value),f.onCompleted()}else for(a=0;d>a;a++)e[a].onCompleted();this.observers.length=0}},onError:function(a){if(b(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onError(a);this.observers.length=0}},onNext:function(a){b(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),e}(Hc),X.AnonymousSubject=function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){this.observer=c,this.observable=d,a.call(this,b)}return Sb(c,a),Tb(c.prototype,zc.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(Hc));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(S.Rx=X,define(function(){return X})):T&&U?V?(U.exports=X).Rx=X:T.Rx=X:S.Rx=X;var nd=h()}).call(this);
//# sourceMappingURL=rx.compat.map

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

Observable.when = function () {
var plans = [];
var len = arguments.length, plans;
if (Array.isArray(arguments[0])) {
plans = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { plans.push(arguments[i]); }
plans = new Array(len);
for(var i = 0; i < len; i++) { plans[i] = arguments[i]; }
}
return new AnonymousObservable(function (observer) {
return new AnonymousObservable(function (o) {
var activePlans = [],
externalSubscriptions = new Map();
var outObserver = observerCreate(
observer.onNext.bind(observer),
function (x) { o.onNext(x); },
function (err) {
externalSubscriptions.forEach(function (v) { v.onError(err); });
observer.onError(err);
o.onError(err);
},
observer.onCompleted.bind(observer)
function (x) { o.onCompleted(); }
);

@@ -304,7 +305,7 @@ try {

activePlans.splice(idx, 1);
activePlans.length === 0 && observer.onCompleted();
activePlans.length === 0 && o.onCompleted();
}));
}
} catch (e) {
observableThrow(e).subscribe(observer);
observableThrow(e).subscribe(o);
}

@@ -311,0 +312,0 @@ var group = new CompositeDisposable();

/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a){this.patterns=a}function f(a,b){this.expression=a,this.selector=b}function g(a,b,c){var d=a.get(b);if(!d){var e=new t(b,c);return a.set(b,e),e}return d}function h(a,b,c){this.joinObserverArray=a,this.onNext=b,this.onCompleted=c,this.joinObservers=new s;for(var d=0,e=this.joinObserverArray.length;e>d;d++){var f=this.joinObserverArray[d];this.joinObservers.set(f,f)}}var i=c.Observable,j=i.prototype,k=c.AnonymousObservable,l=i.throwException,m=c.Observer.create,n=c.SingleAssignmentDisposable,o=c.CompositeDisposable,p=c.internals.AbstractObserver,q=c.helpers.noop,r=(c.internals.isEqual,c.internals.inherits),s=(c.internals.Enumerable,c.internals.Enumerator,c.iterator,c.doneEnumerator,Array.prototype.slice,a.Map||function(){function a(){this._keys=[],this._values=[]}return a.prototype.get=function(a){var b=this._keys.indexOf(a);return-1!==b?this._values[b]:d},a.prototype.set=function(a,b){var c=this._keys.indexOf(a);-1!==c&&(this._values[c]=b),this._values[this._keys.push(a)-1]=b},a.prototype.forEach=function(a,b){for(var c=0,d=this._keys.length;d>c;c++)a.call(b,this._values[c],this._keys[c])},a}());e.prototype.and=function(a){return new e(this.patterns.concat(a))},e.prototype.thenDo=function(a){return new f(this,a)},f.prototype.activate=function(a,b,c){for(var d=this,e=[],f=0,i=this.expression.patterns.length;i>f;f++)e.push(g(a,this.expression.patterns[f],b.onError.bind(b)));var j=new h(e,function(){var a;try{a=d.selector.apply(d,arguments)}catch(c){return void b.onError(c)}b.onNext(a)},function(){for(var a=0,b=e.length;b>a;a++)e[a].removeActivePlan(j);c(j)});for(f=0,i=e.length;i>f;f++)e[f].addActivePlan(j);return j},h.prototype.dequeue=function(){this.joinObservers.forEach(function(a){a.queue.shift()})},h.prototype.match=function(){var a,b,c=!0;for(a=0,b=this.joinObserverArray.length;b>a;a++)if(0===this.joinObserverArray[a].queue.length){c=!1;break}if(c){var d=[],e=!1;for(a=0,b=this.joinObserverArray.length;b>a;a++)d.push(this.joinObserverArray[a].queue[0]),"C"===this.joinObserverArray[a].queue[0].kind&&(e=!0);if(e)this.onCompleted();else{this.dequeue();var f=[];for(a=0,b=d.length;a<d.length;a++)f.push(d[a].value);this.onNext.apply(this,f)}}};var t=function(a){function b(b,c){a.call(this),this.source=b,this.onError=c,this.queue=[],this.activePlans=[],this.subscription=new n,this.isDisposed=!1}r(b,a);var c=b.prototype;return c.next=function(a){if(!this.isDisposed){if("E"===a.kind)return this.onError(a.exception);this.queue.push(a);for(var b=this.activePlans.slice(0),c=0,d=b.length;d>c;c++)b[c].match()}},c.error=q,c.completed=q,c.addActivePlan=function(a){this.activePlans.push(a)},c.subscribe=function(){this.subscription.setDisposable(this.source.materialize().subscribe(this))},c.removeActivePlan=function(a){this.activePlans.splice(this.activePlans.indexOf(a),1),0===this.activePlans.length&&this.dispose()},c.dispose=function(){a.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},b}(p);return j.and=function(a){return new e([this,a])},j.thenDo=function(a){return new e([this]).thenDo(a)},i.when=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return new k(function(b){var c=[],d=new s,e=m(b.onNext.bind(b),function(a){d.forEach(function(b){b.onError(a)}),b.onError(a)},b.onCompleted.bind(b));try{for(var f=0,g=a.length;g>f;f++)c.push(a[f].activate(d,e,function(a){var d=c.indexOf(a);c.splice(d,1),0===c.length&&b.onCompleted()}))}catch(h){l(h).subscribe(b)}var i=new o;return d.forEach(function(a){a.subscribe(),i.add(a)}),i})},c});
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a){this.patterns=a}function f(a,b){this.expression=a,this.selector=b}function g(a,b,c){var d=a.get(b);if(!d){var e=new t(b,c);return a.set(b,e),e}return d}function h(a,b,c){this.joinObserverArray=a,this.onNext=b,this.onCompleted=c,this.joinObservers=new s;for(var d=0,e=this.joinObserverArray.length;e>d;d++){var f=this.joinObserverArray[d];this.joinObservers.set(f,f)}}var i=c.Observable,j=i.prototype,k=c.AnonymousObservable,l=i.throwException,m=c.Observer.create,n=c.SingleAssignmentDisposable,o=c.CompositeDisposable,p=c.internals.AbstractObserver,q=c.helpers.noop,r=(c.internals.isEqual,c.internals.inherits),s=(c.internals.Enumerable,c.internals.Enumerator,c.iterator,c.doneEnumerator,Array.prototype.slice,a.Map||function(){function a(){this._keys=[],this._values=[]}return a.prototype.get=function(a){var b=this._keys.indexOf(a);return-1!==b?this._values[b]:d},a.prototype.set=function(a,b){var c=this._keys.indexOf(a);-1!==c&&(this._values[c]=b),this._values[this._keys.push(a)-1]=b},a.prototype.forEach=function(a,b){for(var c=0,d=this._keys.length;d>c;c++)a.call(b,this._values[c],this._keys[c])},a}());e.prototype.and=function(a){return new e(this.patterns.concat(a))},e.prototype.thenDo=function(a){return new f(this,a)},f.prototype.activate=function(a,b,c){for(var d=this,e=[],f=0,i=this.expression.patterns.length;i>f;f++)e.push(g(a,this.expression.patterns[f],b.onError.bind(b)));var j=new h(e,function(){var a;try{a=d.selector.apply(d,arguments)}catch(c){return void b.onError(c)}b.onNext(a)},function(){for(var a=0,b=e.length;b>a;a++)e[a].removeActivePlan(j);c(j)});for(f=0,i=e.length;i>f;f++)e[f].addActivePlan(j);return j},h.prototype.dequeue=function(){this.joinObservers.forEach(function(a){a.queue.shift()})},h.prototype.match=function(){var a,b,c=!0;for(a=0,b=this.joinObserverArray.length;b>a;a++)if(0===this.joinObserverArray[a].queue.length){c=!1;break}if(c){var d=[],e=!1;for(a=0,b=this.joinObserverArray.length;b>a;a++)d.push(this.joinObserverArray[a].queue[0]),"C"===this.joinObserverArray[a].queue[0].kind&&(e=!0);if(e)this.onCompleted();else{this.dequeue();var f=[];for(a=0,b=d.length;a<d.length;a++)f.push(d[a].value);this.onNext.apply(this,f)}}};var t=function(a){function b(b,c){a.call(this),this.source=b,this.onError=c,this.queue=[],this.activePlans=[],this.subscription=new n,this.isDisposed=!1}r(b,a);var c=b.prototype;return c.next=function(a){if(!this.isDisposed){if("E"===a.kind)return this.onError(a.exception);this.queue.push(a);for(var b=this.activePlans.slice(0),c=0,d=b.length;d>c;c++)b[c].match()}},c.error=q,c.completed=q,c.addActivePlan=function(a){this.activePlans.push(a)},c.subscribe=function(){this.subscription.setDisposable(this.source.materialize().subscribe(this))},c.removeActivePlan=function(a){this.activePlans.splice(this.activePlans.indexOf(a),1),0===this.activePlans.length&&this.dispose()},c.dispose=function(){a.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},b}(p);return j.and=function(a){return new e([this,a])},j.thenDo=function(a){return new e([this]).thenDo(a)},i.when=function(){var a,b=arguments.length;if(Array.isArray(arguments[0]))a=arguments[0];else{a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new k(function(b){var c=[],d=new s,e=m(function(a){b.onNext(a)},function(a){d.forEach(function(b){b.onError(a)}),b.onError(a)},function(){b.onCompleted()});try{for(var f=0,g=a.length;g>f;f++)c.push(a[f].activate(d,e,function(a){var d=c.indexOf(a);c.splice(d,1),0===c.length&&b.onCompleted()}))}catch(h){l(h).subscribe(b)}var i=new o;return d.forEach(function(a){a.subscribe(),i.add(a)}),i})},c});
//# sourceMappingURL=rx.joinpatterns.map
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
(function(a){function b(a){if(a.isDisposed)throw new Error(ib)}function c(a){for(var b=[],c=0,d=a.length;d>c;c++)b.push(a[c]);return b}function d(a,b){if(jb&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(nb)){for(var c=[],d=b;d;d=d.source)d.stack&&c.unshift(d.stack);c.unshift(a.stack);var f=c.join("\n"+nb+"\n");a.stack=e(f)}}function e(a){for(var b=a.split("\n"),c=[],d=0,e=b.length;e>d;d++){var h=b[d];f(h)||g(h)||!h||c.push(h)}return c.join("\n")}function f(a){var b=j(a);if(!b)return!1;var c=b[0],d=b[1];return c===lb&&d>=mb&&gd>=d}function g(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function h(){if(jb)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=j(c);if(!d)return;return lb=d[0],d[1]}}function j(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}function k(a){var b=[];if(!Pb(a))return b;Ob.nonEnumArgs&&a.length&&Qb(a)&&(a=Sb.call(a));var c=Ob.enumPrototypes&&"function"==typeof a,d=Ob.enumErrorProps&&(a===Jb||a instanceof Error);for(var e in a)c&&"prototype"==e||d&&("message"==e||"name"==e)||b.push(e);if(Ob.nonEnumShadows&&a!==Kb){var f=a.constructor,g=-1,h=vb;if(a===(f&&f.prototype))var i=a===Lb?Fb:a===Jb?Ab:Gb.call(a),j=Nb[i];for(;++g<h;)e=ub[g],j&&j[e]||!Hb.call(a,e)||b.push(e)}return b}function l(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 m(a,b){return l(a,b,k)}function n(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function o(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,f=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=f&&"object"!=f))return!1;var g=Gb.call(a),h=Gb.call(b);if(g==wb&&(g=Db),h==wb&&(h=Db),g!=h)return!1;switch(g){case yb:case zb:return+a==+b;case Cb:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case Eb:case Fb:return a==String(b)}var i=g==xb;if(!i){if(g!=Db||!Ob.nodeClass&&(n(a)||n(b)))return!1;var j=!Ob.argsObject&&Qb(a)?Object:a.constructor,k=!Ob.argsObject&&Qb(b)?Object:b.constructor;if(!(j==k||Hb.call(a,"constructor")&&Hb.call(b,"constructor")||gb(j)&&j instanceof j&&gb(k)&&k instanceof k||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var l=c.length;l--;)if(c[l]==a)return d[l]==b;var p=0,q=!0;if(c.push(a),d.push(b),i){if(l=a.length,p=b.length,q=p==l)for(;p--;){var r=b[p];if(!(q=o(a[p],r,c,d)))break}}else m(b,function(b,e,f){return Hb.call(f,e)?(p++,q=Hb.call(a,e)&&o(a[e],b,c,d)):void 0}),q&&m(a,function(a,b,c){return Hb.call(c,b)?q=--p>-1:void 0});return c.pop(),d.pop(),q}function p(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function q(a,b){this.id=a,this.value=b}function r(){this._s=s}function t(){this._s=s,this._l=s.length,this._i=0}function u(a){this._a=a}function v(a){this._a=a,this._l=z(a),this._i=0}function w(a){return"number"==typeof a&&U.isFinite(a)}function x(b){var c,d=b[ob];if(!d&&"string"==typeof b)return c=new r(b),c[ob]();if(!d&&b.length!==a)return c=new u(b),c[ob]();if(!d)throw new TypeError("Object is not iterable");return b[ob]()}function y(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function z(a){var b=+a.length;return isNaN(b)?0:0!==b&&w(b)?(b=y(b)*Math.floor(Math.abs(b)),0>=b?0:b>Fc?Fc:b):b}function A(a,b){return _(a)||(a=hc),new $c(function(c){var d=0,e=b.length;return a.scheduleRecursive(function(a){e>d?(c.onNext(b[d++]),a()):c.onCompleted()})})}function B(a,b){return new $c(function(c){var d=new ac,e=new bc;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)}fb(f)&&(f=Tc(f)),d=new ac,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e},a)}function C(a,b){var c=this;return new $c(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 d.onError(i)}d.onNext(g)}else d.onCompleted()},function(a){d.onError(a)},function(){d.onCompleted()})},c)}function D(){return!1}function E(){return[]}function F(a,b,c){var d=tb(b,c,3);return a.map(function(b,c){var e=d(b,c,a);return fb(e)&&(e=Tc(e)),(rb(e)||qb(e))&&(e=Gc(e)),e}).concatAll()}function G(a,b,c){this.observer=a,this.selector=b,this.source=c,this.index=0,this.isStopped=!1}function H(a,b,c){var d=tb(b,c,3);return a.map(function(b,c){var e=d(b,c,a);return fb(e)&&(e=Tc(e)),(rb(e)||qb(e))&&(e=Gc(e)),e}).mergeAll()}function I(a,b,c){this.observer=a,this.predicate=b,this.source=c,this.index=0,this.isStopped=!1}function J(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),$b(function(){a.removeEventListener(b,c,!1)});throw new Error("No listener found")}function K(a,b,c){var d=new Xb;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(K(a.item(e),b,c));else a&&d.add(J(a,b,c));return d}function L(a,b){return new $c(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function M(a,b,c){return new $c(function(d){var e=a,f=ec(b);return c.scheduleRecursiveWithAbsoluteAndState(0,e,function(a,b){if(f>0){var g=c.now();e+=f,g>=e&&(e=g+f)}d.onNext(a),b(a+1,e)})})}function N(a,b){return new $c(function(c){return b.scheduleWithRelative(ec(a),function(){c.onNext(0),c.onCompleted()})})}function O(a,b,c){return a===b?new $c(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):Dc(function(){return M(c.now()+a,b,c)})}function P(a,b,c){return new $c(function(d){var e,f=!1,g=new bc,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 ac,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 Xb(e,g)},a)}function Q(a,b,c){return Dc(function(){return P(a,b-c.now(),c)})}function R(a,b){return new $c(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new Xb(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))},a)}function S(a,b,c){return new $c(function(d){function e(a,b){j[b]=a;var e;if(g[b]=!0,h||(h=g.every(ab))){if(f)return void d.onError(f);try{e=c.apply(null,j)}catch(k){return void d.onError(k)}d.onNext(e)}i&&j[1]&&d.onCompleted()}var f,g=[!1,!1],h=!1,i=!1,j=new Array(2);return new Xb(a.subscribe(function(a){e(a,0)},function(a){j[1]?d.onError(a):f=a},function(){i=!0,j[1]&&d.onCompleted()}),b.subscribe(function(a){e(a,1)},function(a){d.onError(a)},function(){i=!0,e(!0,1)}))},a)}var T={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},U=T[typeof window]&&window||this,V=T[typeof exports]&&exports&&!exports.nodeType&&exports,W=T[typeof module]&&module&&!module.nodeType&&module,X=W&&W.exports===V&&V,Y=T[typeof global]&&global;!Y||Y.global!==Y&&Y.window!==Y||(U=Y);var Z={internals:{},config:{Promise:U.Promise},helpers:{}},$=Z.helpers.noop=function(){},_=(Z.helpers.notDefined=function(a){return"undefined"==typeof a},Z.helpers.isScheduler=function(a){return a instanceof Z.Scheduler}),ab=Z.helpers.identity=function(a){return a},bb=(Z.helpers.pluck=function(a){return function(b){return b[a]}},Z.helpers.just=function(a){return function(){return a}},Z.helpers.defaultNow=Date.now),cb=Z.helpers.defaultComparer=function(a,b){return Rb(a,b)},db=Z.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},eb=(Z.helpers.defaultKeySerializer=function(a){return a.toString()},Z.helpers.defaultError=function(a){throw a}),fb=Z.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},gb=(Z.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},Z.helpers.not=function(a){return!a},Z.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==Gb.call(a)}),a}()),hb="Argument out of range",ib="Object has been disposed";Z.config.longStackSupport=!1;var jb=!1;try{throw new Error}catch(kb){jb=!!kb.stack}var lb,mb=h(),nb="From previous event:",ob="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";U.Set&&"function"==typeof(new U.Set)["@@iterator"]&&(ob="@@iterator");var pb=Z.doneEnumerator={done:!0,value:a},qb=Z.helpers.isIterable=function(b){return b[ob]!==a},rb=Z.helpers.isArrayLike=function(b){return b&&b.length!==a};Z.helpers.iterator=ob;var sb,tb=Z.internals.bindCallback=function(a,b,c){if("undefined"==typeof b)return a;switch(c){case 0:return function(){return a.call(b)};case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)}}return function(){return a.apply(b,arguments)}},ub=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],vb=ub.length,wb="[object Arguments]",xb="[object Array]",yb="[object Boolean]",zb="[object Date]",Ab="[object Error]",Bb="[object Function]",Cb="[object Number]",Db="[object Object]",Eb="[object RegExp]",Fb="[object String]",Gb=Object.prototype.toString,Hb=Object.prototype.hasOwnProperty,Ib=Gb.call(arguments)==wb,Jb=Error.prototype,Kb=Object.prototype,Lb=String.prototype,Mb=Kb.propertyIsEnumerable;try{sb=!(Gb.call(document)==Db&&!({toString:0}+""))}catch(kb){sb=!0}var Nb={};Nb[xb]=Nb[zb]=Nb[Cb]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},Nb[yb]=Nb[Fb]={constructor:!0,toString:!0,valueOf:!0},Nb[Ab]=Nb[Bb]=Nb[Eb]={constructor:!0,toString:!0},Nb[Db]={constructor:!0};var Ob={};!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);Ob.enumErrorProps=Mb.call(Jb,"message")||Mb.call(Jb,"name"),Ob.enumPrototypes=Mb.call(a,"prototype"),Ob.nonEnumArgs=0!=c,Ob.nonEnumShadows=!/valueOf/.test(b)}(1);var Pb=Z.internals.isObject=function(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1},Qb=function(a){return a&&"object"==typeof a?Gb.call(a)==wb:!1};Ib||(Qb=function(a){return a&&"object"==typeof a?Hb.call(a,"callee"):!1});{var Rb=Z.internals.isEqual=function(a,b){return o(a,b,[],[])},Sb=({}.hasOwnProperty,Array.prototype.slice),Tb=this.inherits=Z.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c},Ub=Z.internals.addProperties=function(a){for(var b=[],c=1,d=arguments.length;d>c;c++)b.push(arguments[c]);for(var e=0,f=b.length;f>e;e++){var g=b[e];for(var h in g)a[h]=g[h]}};Z.internals.addRef=function(a,b){return new $c(function(c){return new Xb(b.getDisposable(),a.subscribe(c))})}}q.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var Vb=Z.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},Wb=Vb.prototype;Wb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},Wb.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)}}},Wb.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)}}},Wb.peek=function(){return this.items[0].value},Wb.removeAt=function(b){this.items[b]=this.items[--this.length],this.items[this.length]=a,this.heapify()},Wb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},Wb.enqueue=function(a){var b=this.length++;this.items[b]=new q(Vb.count++,a),this.percolate(b)},Wb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},Vb.count=0;var Xb=Z.CompositeDisposable=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);this.disposables=a,this.isDisposed=!1,this.length=this.disposables.length},Yb=Xb.prototype;Yb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},Yb.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},Yb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var a=[],b=0,c=this.disposables.length;c>b;b++)a.push(this.disposables[b]);for(this.disposables=[],this.length=0,b=0,c=a.length;c>b;b++)a[b].dispose()}},Yb.toArray=function(){for(var a=[],b=this.disposables.length;b>i;i++)a.push(this.disposables[i]);return a};var Zb=Z.Disposable=function(a){this.isDisposed=!1,this.action=a||$};Zb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var $b=Zb.create=function(a){return new Zb(a)},_b=Zb.empty={dispose:$},ac=Z.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=this.isDisposed;if(!b){var c=this.current;this.current=a}c&&c.dispose(),b&&a&&a.dispose()},b.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()},a}(),bc=Z.SerialDisposable=ac,cc=(Z.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?_b:new a(this)},b}(),Z.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||db,this.disposable=new ac});cc.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},cc.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},cc.prototype.isCancelled=function(){return this.disposable.isDisposed},cc.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var dc=Z.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(),_b}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=bb,a.normalize=function(a){return 0>a&&(a=0),a},a}(),ec=dc.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new Xb,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),_b});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new Xb,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c](b,d,function(a,b){return e?f.remove(i):h=!0,g(b),_b});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")})}}(dc.prototype),function(){dc.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},dc.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof U.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=U.setInterval(function(){d=c(d)},b);return $b(function(){U.clearInterval(e)})}}(dc.prototype);var fc,gc=dc.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=this.now()+ec(b);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new dc(bb,a,b,c)}(),hc=dc.currentThread=function(){function a(a){for(;a.length>0;){var b=a.dequeue();if(!b.isCancelled()){for(;b.dueTime-dc.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()+dc.normalize(c),g=new cc(this,b,d,f);if(e)e.enqueue(g);else{e=new Vb(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 dc(bb,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),ic=(Z.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 ac;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),$),jc=function(){var a,b=$;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!U.setTimeout)throw new Error("No concurrency detected!");a=U.setTimeout,b=U.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),kc=jc.setTimeout,lc=jc.clearTimeout;!function(){function a(){if(!U.postMessage||U.importScripts)return!1;var a=!1,b=U.onmessage;return U.onmessage=function(){a=!0},U.postMessage("","*"),U.onmessage=b,a}var b=RegExp("^"+String(Gb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),c="function"==typeof(c=Y&&X&&Y.setImmediate)&&!b.test(c)&&c,d="function"==typeof(d=Y&&X&&Y.clearImmediate)&&!b.test(d)&&d;if("function"==typeof c)fc=c,ic=d;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))fc=process.nextTick;else if(a()){var e="ms.rx.schedule"+Math.random(),f={},g=0,h=function(a){if("string"==typeof a.data&&a.data.substring(0,e.length)===e){var b=a.data.substring(e.length),c=f[b];c(),delete f[b]}};U.addEventListener?U.addEventListener("message",h,!1):U.attachEvent("onmessage",h,!1),fc=function(a){var b=g++;f[b]=a,U.postMessage(e+b,"*")}}else if(U.MessageChannel){var i=new U.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},fc=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in U&&"onreadystatechange"in U.document.createElement("script")?fc=function(a){var b=U.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},U.document.documentElement.appendChild(b)}:(fc=function(a){return kc(a,0)},ic=lc)}();var mc=dc.timeout=function(){function a(a,b){var c=this,d=new ac,e=fc(function(){d.isDisposed||d.setDisposable(b(c,a))});return new Xb(d,$b(function(){ic(e)}))}function b(a,b,c){var d=this,e=dc.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new ac,g=kc(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new Xb(f,$b(function(){lc(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new dc(bb,a,b,c)}(),nc=Z.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 _(a)||(a=gc),new $c(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),oc=nc.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 nc("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),pc=nc.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 nc("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),qc=nc.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new nc("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),rc=Z.internals.Enumerator=function(a){this._next=a};rc.prototype.next=function(){return this._next()},rc.prototype[ob]=function(){return this};var sc=Z.internals.Enumerable=function(a){this._iterator=a};sc.prototype[ob]=function(){return this._iterator()},sc.prototype.concat=function(){var a=this;return new $c(function(b){var c,d=a[ob](),e=new bc,f=gc.scheduleRecursive(function(a){if(!c){try{var f=d.next()}catch(g){return b.onError(g)}if(f.done)return b.onCompleted();var h=f.value;fb(h)&&(h=Tc(h));var i=new ac;e.setDisposable(i),i.setDisposable(h.subscribe(function(a){b.onNext(a)},function(a){b.onError(a)},a))}});return new Xb(e,f,$b(function(){c=!0}))})},sc.prototype.catchError=function(){var a=this;return new $c(function(b){var c,d=a[ob](),e=new bc,f=gc.scheduleRecursiveWithState(null,function(a,f){if(!c){try{var g=d.next()}catch(h){return observer.onError(h)}if(g.done)return void(null!==a?b.onError(a):b.onCompleted());var i=g.value;fb(i)&&(i=Tc(i));var j=new ac;e.setDisposable(j),j.setDisposable(i.subscribe(function(a){b.onNext(a)},f,function(){b.onCompleted()}))}});return new Xb(e,f,$b(function(){c=!0}))})},sc.prototype.catchErrorWhen=function(a){var b=this;return new $c(function(c){var d,e,f=new bd,g=new bd,h=a(f),i=h.subscribe(g),j=b[ob](),k=new bc,l=gc.scheduleRecursive(function(a){if(!d){try{var b=j.next()}catch(h){return c.onError(h)}if(b.done)return void(e?c.onError(e):c.onCompleted());var i=b.value;fb(i)&&(i=Tc(i));var l=new ac,m=new ac;k.setDisposable(new Xb(m,l)),l.setDisposable(i.subscribe(function(a){c.onNext(a)},function(b){m.setDisposable(g.subscribe(a,function(a){c.onError(a)},function(){c.onCompleted()})),f.onNext(b)},function(){c.onCompleted()}))}});return new Xb(i,k,l,$b(function(){d=!0}))})};var tc,uc=sc.repeat=function(a,b){return null==b&&(b=-1),new sc(function(){var c=b;return new rc(function(){return 0===c?pb:(c>0&&c--,{done:!1,value:a})})})},vc=sc.of=function(a,b,c){if(b)var d=tb(b,c,3);return new sc(function(){var c=-1;return new rc(function(){return++c<a.length?{done:!1,value:b?d(a[c],c,a):a[c]}:pb})})},wc=Z.Observer=function(){},xc=wc.create=function(a,b,c){return a||(a=$),b||(b=eb),c||(c=$),new zc(a,b,c)},yc=Z.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return Tb(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}(wc),zc=Z.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return Tb(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}(yc),Ac=Z.Observable=function(){function a(a){if(Z.config.longStackSupport&&jb){try{throw new Error}catch(b){this.stack=b.stack.substring(b.stack.indexOf("\n")+1)}var c=this;this._subscribe=function(b){var e=b.onError.bind(b);return b.onError=function(a){d(a,c),e(a)},a.call(c,b)}}else this._subscribe=a}return tc=a.prototype,tc.subscribe=tc.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:xc(a,b,c))},tc.subscribeOnNext=function(a,b){return this._subscribe(xc("undefined"!=typeof b?function(c){a.call(b,c)}:a))},tc.subscribeOnError=function(a,b){return this._subscribe(xc(null,"undefined"!=typeof b?function(c){a.call(b,c)}:a))},tc.subscribeOnCompleted=function(a,b){return this._subscribe(xc(null,null,"undefined"!=typeof b?function(){a.call(b)}:a))},a}(),Bc=Z.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 bc}return Tb(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}(yc),Cc=Z.ObservableBase=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?$b(a):_b}function c(a,c){var d=c[0],e=c[1];try{d.setDisposable(b(e.subscribeCore(d)))}catch(f){if(!d.fail(f))throw f}}function d(a){var b=new _c(a),d=[b,this];return hc.scheduleRequired()?hc.scheduleWithState(d,c):c(null,d),b}function e(){a.call(this,d)}return Tb(e,a),e.prototype.subscribeCore=function(){throw new Error("Not implemeneted")},e}(Ac);tc.toArray=function(){var a=this;return new $c(function(b){var c=[];return a.subscribe(function(a){c.push(a)},function(a){b.onError(a)},function(){b.onNext(c),b.onCompleted()})},a)},Ac.create=Ac.createWithDisposable=function(a,b){return new $c(a,b)};var Dc=Ac.defer=function(a){return new $c(function(b){var c;try{c=a()}catch(d){return Lc(d).subscribe(b)}return fb(c)&&(c=Tc(c)),c.subscribe(b)})},Ec=Ac.empty=function(a){return _(a)||(a=gc),new $c(function(b){return a.schedule(function(){b.onCompleted()})})},Fc=Math.pow(2,53)-1;r.prototype[ob]=function(){return new t(this._s)},t.prototype[ob]=function(){return this},t.prototype.next=function(){if(this._i<this._l){var a=this._s.charAt(this._i++);return{done:!1,value:a}}return pb},u.prototype[ob]=function(){return new v(this._a)},v.prototype[ob]=function(){return this},v.prototype.next=function(){if(this._i<this._l){var a=this._a[this._i++];return{done:!1,value:a}}return pb};{var Gc=Ac.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!gb(b))throw new Error("mapFn when provided must be a function");if(b)var e=tb(b,c,2);_(d)||(d=hc);var f=Object(a),g=x(f);return new $c(function(a){return d.scheduleRecursiveWithState(0,function(b,c){try{var d=g.next()}catch(f){return void a.onError(f)}if(d.done)return void a.onCompleted();var h=d.value;if(e)try{h=e(h,b)}catch(f){return void a.onError(f)}a.onNext(h),c(b+1)})})},Hc=function(a){function b(b,c){this.args=b,this.scheduler=c||hc,a.call(this)}return Tb(b,a),b.prototype.subscribeCore=function(a){var b=new Ic(a,this);return b.run()},b}(Cc),Ic=function(){function a(a,b){this.observer=a,this.parent=b}function b(a,b){a.i<a.len?(a.observer.onNext(a.args[a.i++]),b(a)):a.observer.onCompleted()}return a.prototype.run=function(){return this.parent.scheduler.scheduleRecursiveWithState({i:0,args:this.parent.args,len:this.parent.args.length,observer:this.observer},b)},a}(),Jc=Ac.fromArray=function(a,b){return new Hc(a,b)};Ac.never=function(){return new $c(function(){return _b})}}Ac.of=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return A(null,a)},Ac.ofWithScheduler=function(a){for(var b=[],c=1,d=arguments.length;d>c;c++)b.push(arguments[c]);return A(a,b)},Ac.pairs=function(a,b){return b||(b=Z.Scheduler.currentThread),new $c(function(c){var d=Object.keys(a),e=d.length;return b.scheduleRecursiveWithState(0,function(b,f){if(e>b){var g=d[b];c.onNext([g,a[g]]),f(b+1)}else c.onCompleted()})})},Ac.range=function(a,b,c){return _(c)||(c=hc),new $c(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},Ac.repeat=function(a,b,c){return _(c)||(c=hc),Kc(a,c).repeat(null==b?-1:b)};var Kc=Ac["return"]=Ac.just=function(a,b){return _(b)||(b=gc),new $c(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})};Ac.returnValue=function(){return Kc.apply(null,arguments)};var Lc=Ac["throw"]=Ac.throwError=function(a,b){return _(b)||(b=gc),new $c(function(c){return b.schedule(function(){c.onError(a)})})};Ac.throwException=function(){return Ac.throwError.apply(null,arguments)},tc["catch"]=tc.catchError=function(a){return"function"==typeof a?B(this,a):Mc([this,a])},tc.catchException=function(a){return this.catchError(a)};var Mc=Ac.catchError=Ac["catch"]=Ac.catchException=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return vc(a).catchError()};tc.combineLatest=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),Nc.apply(this,a)};var Nc=Ac.combineLatest=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);var d=a.pop();return Array.isArray(a[0])&&(a=a[0]),new $c(function(b){function c(a){var c;if(h[a]=!0,i||(i=h.every(ab))){try{c=d.apply(null,k)}catch(e){return void b.onError(e)}b.onNext(c)}else j.filter(function(b,c){return c!==a}).every(ab)&&b.onCompleted()}function e(a){j[a]=!0,j.every(ab)&&b.onCompleted()}for(var f=function(){return!1},g=a.length,h=p(g,f),i=!1,j=p(g,f),k=new Array(g),l=new Array(g),m=0;g>m;m++)!function(d){var f=a[d],g=new ac;fb(f)&&(f=Tc(f)),g.setDisposable(f.subscribe(function(a){k[d]=a,c(d)},function(a){b.onError(a)},function(){e(d)})),l[d]=g}(m);return new Xb(l)},this)};tc.concat=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return a.unshift(this),Oc.apply(null,a)};var Oc=Ac.concat=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return vc(a).concat()};tc.concatAll=tc.concatObservable=function(){return this.merge(1)},tc.merge=function(a){if("number"!=typeof a)return Pc(this,a);var b=this;return new $c(function(c){function d(a){var b=new ac;f.add(b),fb(a)&&(a=Tc(a)),b.setDisposable(a.subscribe(function(a){c.onNext(a)},function(a){c.onError(a)},function(){f.remove(b),h.length>0?d(h.shift()):(e--,g&&0===e&&c.onCompleted())}))}var e=0,f=new Xb,g=!1,h=[];return f.add(b.subscribe(function(b){a>e?(e++,d(b)):h.push(b)},function(a){c.onError(a)},function(){g=!0,0===e&&c.onCompleted()
})),f},b)};var Pc=Ac.merge=function(){var a,b,c=[],d=arguments.length;if(arguments[0])if(_(arguments[0]))for(a=arguments[0],b=1;d>b;b++)c.push(arguments[b]);else for(a=gc,b=0;d>b;b++)c.push(arguments[b]);else for(a=gc,b=1;d>b;b++)c.push(arguments[b]);return Array.isArray(c[0])&&(c=c[0]),A(a,c).mergeAll()};tc.mergeAll=function(){var a=this;return new $c(function(b){var c=new Xb,d=!1,e=new ac;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new ac;c.add(e),fb(a)&&(a=Tc(a)),e.setDisposable(a.subscribe(function(a){b.onNext(a)},function(a){b.onError(a)},function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},function(a){b.onError(a)},function(){d=!0,1===c.length&&b.onCompleted()})),c},a)},tc.mergeObservable=function(){return this.mergeAll.apply(this,arguments)},tc.skipUntil=function(a){var b=this;return new $c(function(c){var d=!1,e=new Xb(b.subscribe(function(a){d&&c.onNext(a)},function(a){c.onError(a)},function(){d&&c.onCompleted()}));fb(a)&&(a=Tc(a));var f=new ac;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},function(a){c.onError(a)},function(){f.dispose()})),e},b)},tc["switch"]=tc.switchLatest=function(){var a=this;return new $c(function(b){var c=!1,d=new bc,e=!1,f=0,g=a.subscribe(function(a){var g=new ac,h=++f;c=!0,d.setDisposable(g),fb(a)&&(a=Tc(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())}))},function(a){b.onError(a)},function(){e=!0,!c&&b.onCompleted()});return new Xb(g,d)},a)},tc.takeUntil=function(a){var b=this;return new $c(function(c){return fb(a)&&(a=Tc(a)),new Xb(b.subscribe(c),a.subscribe(function(){c.onCompleted()},function(a){c.onError(a)},$))},b)},tc.withLatestFrom=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);var d=a.pop(),e=this;if("undefined"==typeof e)throw new Error("Source observable not found for withLatestFrom().");if("function"!=typeof d)throw new Error("withLatestFrom() expects a resultSelector function.");return Array.isArray(a[0])&&(a=a[0]),new $c(function(b){for(var c=function(){return!1},f=a.length,g=p(f,c),h=!1,i=new Array(f),j=new Array(f+1),k=0;f>k;k++)!function(c){var d=a[c],e=new ac;fb(d)&&(d=Tc(d)),e.setDisposable(d.subscribe(function(a){i[c]=a,g[c]=!0,h=g.every(ab)},b.onError.bind(b),function(){})),j[c]=e}(k);var l=new ac;return l.setDisposable(e.subscribe(function(a){var c,e=[a].concat(i);if(h){try{c=d.apply(null,e)}catch(f){return void b.onError(f)}b.onNext(c)}},b.onError.bind(b),function(){b.onCompleted()})),j[f]=l,new Xb(j)},this)},tc.zip=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);if(Array.isArray(a[0]))return C.apply(this,a);var d=this,e=a.pop();return a.unshift(d),new $c(function(b){function c(a){var c,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),c=e.apply(d,f)}catch(g){return void b.onError(g)}b.onNext(c)}else i.filter(function(b,c){return c!==a}).every(ab)&&b.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&b.onCompleted()}for(var g=a.length,h=p(g,E),i=p(g,D),j=new Array(g),k=0;g>k;k++)!function(d){var e=a[d],g=new ac;fb(e)&&(e=Tc(e)),g.setDisposable(e.subscribe(function(a){h[d].push(a),c(d)},function(a){b.onError(a)},function(){f(d)})),j[d]=g}(k);return new Xb(j)},d)},Ac.zip=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);var d=a.shift();return d.zip.apply(d,a)},Ac.zipArray=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return new $c(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(ab))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(ab)?void b.onCompleted():void 0}for(var e=a.length,f=p(e,function(){return[]}),g=p(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new ac,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},function(a){b.onError(a)},function(){d(e)}))}(i);return new Xb(h)})},tc.asObservable=function(){var a=this;return new $c(function(b){return a.subscribe(b)},this)},tc.dematerialize=function(){var a=this;return new $c(function(b){return a.subscribe(function(a){return a.accept(b)},function(a){b.onError(a)},function(){b.onCompleted()})},this)},tc.distinctUntilChanged=function(a,b){var c=this;return b||(b=cb),new $c(function(d){var e,f=!1;return c.subscribe(function(c){var g=c;if(a)try{g=a(c)}catch(h){return void d.onError(h)}if(f)try{var i=b(e,g)}catch(h){return void d.onError(h)}f&&i||(f=!0,e=g,d.onNext(c))},function(a){d.onError(a)},function(){d.onCompleted()})},this)},tc["do"]=tc.tap=tc.doAction=function(a,b,c){var d=this,e="function"==typeof a||"undefined"==typeof a?xc(a||$,b||$,c||$):a;return new $c(function(a){return d.subscribe(function(b){try{e.onNext(b)}catch(c){a.onError(c)}a.onNext(b)},function(b){try{e.onError(b)}catch(c){a.onError(c)}a.onError(b)},function(){try{e.onCompleted()}catch(b){a.onError(b)}a.onCompleted()})},this)},tc.doOnNext=tc.tapOnNext=function(a,b){return this.tap("undefined"!=typeof b?function(c){a.call(b,c)}:a)},tc.doOnError=tc.tapOnError=function(a,b){return this.tap($,"undefined"!=typeof b?function(c){a.call(b,c)}:a)},tc.doOnCompleted=tc.tapOnCompleted=function(a,b){return this.tap($,null,"undefined"!=typeof b?function(){a.call(b)}:a)},tc["finally"]=tc.ensure=function(a){var b=this;return new $c(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return $b(function(){try{d.dispose()}catch(b){throw b}finally{a()}})},this)},tc.finallyAction=function(a){return this.ensure(a)},tc.ignoreElements=function(){var a=this;return new $c(function(b){return a.subscribe($,function(a){b.onError(a)},function(){b.onCompleted()})},a)},tc.materialize=function(){var a=this;return new $c(function(b){return a.subscribe(function(a){b.onNext(oc(a))},function(a){b.onNext(pc(a)),b.onCompleted()},function(){b.onNext(qc()),b.onCompleted()})},a)},tc.repeat=function(a){return uc(this,a).concat()},tc.retry=function(a){return uc(this,a).catchError()},tc.retryWhen=function(a){return uc(this).catchErrorWhen(a)},tc.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 $c(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)},function(a){e.onError(a)},function(){!h&&c&&e.onNext(a),e.onCompleted()})},d)},tc.skipLast=function(a){var b=this;return new $c(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},function(a){c.onError(a)},function(){c.onCompleted()})},b)},tc.startWith=function(){var a,b=0;arguments.length&&_(arguments[0])?(a=arguments[0],b=1):a=gc;for(var c=[],d=b,e=arguments.length;e>d;d++)c.push(arguments[d]);return vc([Jc(c,a),this]).concat()},tc.takeLast=function(a){var b=this;return new $c(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})},b)},tc.selectConcat=tc.concatMap=function(a,b,c){return gb(a)&&gb(b)?this.concatMap(function(c,d){var e=a(c,d);return fb(e)&&(e=Tc(e)),(rb(e)||qb(e))&&(e=Gc(e)),e.map(function(a,e){return b(c,a,d,e)})}):gb(a)?F(this,a,c):F(this,function(){return a})};var Qc=function(a){function b(b,c,d){this.source=b,this.selector=tb(c,d,3),a.call(this)}return Tb(b,a),b.prototype.internalMap=function(a,c){var d=this;return new b(this.source,function(b,c,e){return a(d.selector(b,c,e),c,e)},c)},b.prototype.subscribeCore=function(a){return this.source.subscribe(new G(a,this.selector,this))},b}(Cc);G.prototype.onNext=function(a){if(!this.isStopped){try{var b=this.selector(a,this.index++,this.source)}catch(c){return this.observer.onError(c)}this.observer.onNext(b)}},G.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.observer.onError(a))},G.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.observer.onCompleted())},G.prototype.dispose=function(){this.isStopped=!0},G.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},tc.map=tc.select=function(a,b){var c="function"==typeof a?a:function(){return a};return this instanceof Qc?this.internalMap(a,b):new Qc(this,c,b)},tc.pluck=function(){var b=arguments,c=arguments.length;if(0===c)throw new Error("List of properties cannot be empty.");return this.map(function(d){for(var e=d,f=0;c>f;f++){var g=e[b[f]];if("undefined"==typeof g)return a;e=g}return e})},tc.selectMany=tc.flatMap=function(a,b,c){return gb(a)&&gb(b)?this.flatMap(function(c,d){var e=a(c,d);return fb(e)&&(e=Tc(e)),(rb(e)||qb(e))&&(e=Gc(e)),e.map(function(a,e){return b(c,a,d,e)})},c):gb(a)?H(this,a,c):H(this,function(){return a})},tc.selectSwitch=tc.flatMapLatest=tc.switchMap=function(a,b){return this.select(a,b).switchLatest()},tc.skip=function(a){if(0>a)throw new Error(hb);var b=this;return new $c(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},function(a){c.onError(a)},function(){c.onCompleted()})},b)},tc.skipWhile=function(a,b){var c=this,d=tb(a,b,3);return new $c(function(a){var b=0,e=!1;return c.subscribe(function(f){if(!e)try{e=!d(f,b++,c)}catch(g){return void a.onError(g)}e&&a.onNext(f)},function(b){a.onError(b)},function(){a.onCompleted()})},c)},tc.take=function(a,b){if(0>a)throw new RangeError(hb);if(0===a)return Ec(b);var c=this;return new $c(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},function(a){b.onError(a)},function(){b.onCompleted()})},c)},tc.takeWhile=function(a,b){var c=this,d=tb(a,b,3);return new $c(function(a){var b=0,e=!0;return c.subscribe(function(f){if(e){try{e=d(f,b++,c)}catch(g){return void a.onError(g)}e?a.onNext(f):a.onCompleted()}},function(b){a.onError(b)},function(){a.onCompleted()})},c)};var Rc=function(a){function b(b,c,d){this.source=b,this.predicate=tb(c,d,3),a.call(this)}return Tb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new I(a,this.predicate,this))},b.prototype.internalFilter=function(a,c){var d=this;return new b(this.source,function(b,c,e){return d.predicate(b,c,e)&&a(b,c,e)},c)},b}(Cc);I.prototype.onNext=function(a){try{var b=this.predicate(a,this.index++,this.source)}catch(c){return this.observer.onError(c)}b&&this.observer.onNext(a)},I.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.observer.onError(a))},I.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.observer.onCompleted())},I.prototype.dispose=function(){this.isStopped=!0},I.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},tc.filter=tc.where=function(a,b){return this instanceof Rc?this.internalFilter(a,b):new Rc(this,a,b)},Ac.fromCallback=function(a,b,c){return function(){for(var d=[],e=0,f=arguments.length;f>e;e++)d.push(arguments[e]);return new $c(function(e){function f(){var a=arguments;if(c){try{a=c(a)}catch(b){return e.onError(b)}e.onNext(a)}else a.length<=1?e.onNext.apply(e,a):e.onNext(a);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},Ac.fromNodeCallback=function(a,b,c){return function(){for(var d=[],e=0,f=arguments.length;f>e;e++)d.push(arguments[e]);return new $c(function(e){function f(a){if(a)return void e.onError(a);for(var b=[],d=1,f=arguments.length;f>d;d++)b.push(arguments[d]);if(c){try{b=c(b)}catch(g){return e.onError(g)}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()}},Z.config.useNativeEvents=!1,Ac.fromEvent=function(a,b,c){if(a.addListener)return Sc(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},c);if(!Z.config.useNativeEvents){if("function"==typeof a.on&&"function"==typeof a.off)return Sc(function(c){a.on(b,c)},function(c){a.off(b,c)},c);if(U.Ember&&"function"==typeof U.Ember.addListener)return Sc(function(c){Ember.addListener(a,b,c)},function(c){Ember.removeListener(a,b,c)},c)}return new $c(function(d){return K(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 Sc=Ac.fromEventPattern=function(a,b,c){return new $c(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 $b(function(){b&&b(e,f)})}).publish().refCount()},Tc=Ac.fromPromise=function(a){return Dc(function(){var b=new Z.AsyncSubject;return a.then(function(a){b.onNext(a),b.onCompleted()},b.onError.bind(b)),b})};tc.toPromise=function(a){if(a||(a=Z.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)})})},Ac.startAsync=function(a){var b;try{b=a()}catch(c){return Lc(c)}return Tc(b)},tc.multicast=function(a,b){var c=this;return"function"==typeof a?new $c(function(d){var e=c.multicast(a());return new Xb(b(e).subscribe(d),e.connect())},c):new Uc(c,a)},tc.publish=function(a){return a&&gb(a)?this.multicast(function(){return new bd},a):this.multicast(new bd)},tc.share=function(){return this.publish().refCount()},tc.publishLast=function(a){return a&&gb(a)?this.multicast(function(){return new cd},a):this.multicast(new cd)},tc.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new ed(b)},a):this.multicast(new ed(a))},tc.shareValue=function(a){return this.publishValue(a).refCount()},tc.replay=function(a,b,c,d){return a&&gb(a)?this.multicast(function(){return new fd(b,c,d)},a):this.multicast(new fd(b,c,d))},tc.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};{var Uc=Z.ConnectableObservable=function(a){function b(b,c){var d,e=!1,f=b.asObservable();this.connect=function(){return e||(e=!0,d=new Xb(f.subscribe(c),$b(function(){e=!1}))),d},a.call(this,function(a){return c.subscribe(a)})}return Tb(b,a),b.prototype.refCount=function(){var a,b=0,c=this;return new $c(function(d){var e=1===++b,f=c.subscribe(d);return e&&(a=c.connect()),function(){f.dispose(),0===--b&&a.dispose()}})},b}(Ac),Vc=Ac.interval=function(a,b){return O(a,a,_(b)?b:mc)};Ac.timer=function(b,c,d){var e;return _(d)||(d=mc),c!==a&&"number"==typeof c?e=c:_(c)&&(d=c),b instanceof Date&&e===a?L(b.getTime(),d):b instanceof Date&&e!==a?(e=c,M(b.getTime(),e,d)):e===a?N(b,d):O(b,e,d)}}tc.delay=function(a,b){return _(b)||(b=mc),a instanceof Date?Q(this,a.getTime(),b):P(this,a,b)},tc.debounce=tc.throttleWithTimeout=function(a,b){_(b)||(b=mc);var c=this;return new $c(function(d){var e,f=new bc,g=!1,h=0,i=c.subscribe(function(c){g=!0,e=c,h++;var i=h,j=new ac;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 Xb(i,f)},this)},tc.throttle=function(a,b){return this.debounce(a,b)},tc.timestamp=function(a){return _(a)||(a=mc),this.map(function(b){return{value:b,timestamp:a.now()}})},tc.sample=tc.throttleLatest=function(a,b){return _(b)||(b=mc),"number"==typeof a?R(this,Vc(a,b)):R(this,a)},tc.timeout=function(a,b,c){(null==b||"string"==typeof b)&&(b=Lc(new Error(b||"Timeout"))),_(c)||(c=mc);var d=this,e=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new $c(function(f){function g(){var d=h;l.setDisposable(c[e](a,function(){h===d&&(fb(b)&&(b=Tc(b)),j.setDisposable(b.subscribe(f)))}))}var h=0,i=new ac,j=new bc,k=!1,l=new bc;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 Xb(j,l)},d)},tc.throttleFirst=function(a,b){_(b)||(b=mc);var c=+a||0;if(0>=c)throw new RangeError("windowDuration cannot be less or equal zero.");var d=this;return new $c(function(a){var e=0;return d.subscribe(function(d){var f=b.now();(0===e||f-e>=c)&&(e=f,a.onNext(d))},function(b){a.onError(b)},function(){a.onCompleted()})},d)};var Wc=function(a){function b(a){var b=this.source.publish(),c=b.subscribe(a),d=_b,e=this.pauser.distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=_b)});return new Xb(c,d,e)}function c(c,d){this.source=c,this.controller=new bd,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b,c)}return Tb(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(Ac);tc.pausable=function(a){return new Wc(this,a)};var Xc=function(b){function c(b){var c,d=[],e=S(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 bd,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,b.call(this,c,a)}return Tb(d,b),d.prototype.pause=function(){this.controller.onNext(!1)},d.prototype.resume=function(){this.controller.onNext(!0)},d}(Ac);tc.pausableBuffered=function(a){return new Xc(this,a)};var Yc=function(a){function b(a){return this.source.subscribe(a)}function c(c,d){a.call(this,b,c),this.subject=new Zc(d),this.source=c.multicast(this.subject).refCount()}return Tb(c,a),c.prototype.request=function(a){return null==a&&(a=-1),this.subject.request(a)},c}(Ac),Zc=function(a){function b(a){return this.subject.subscribe(a)}function c(c){null==c&&(c=!0),a.call(this,b),this.subject=new bd,this.enableQueue=c,this.queue=c?[]:null,this.requestedCount=0,this.requestedDisposable=_b,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=_b}return Tb(c,a),Ub(c.prototype,wc,{onCompleted:function(){this.hasCompleted=!0,(!this.enableQueue||0===this.queue.length)&&this.subject.onCompleted()},onError:function(a){this.hasFailed=!0,this.error=a,(!this.enableQueue||0===this.queue.length)&&this.subject.onError(a)},onNext:function(a){var b=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(a):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),b=!0),b&&this.subject.onNext(a)},_processRequest:function(a){if(this.enableQueue){for(;this.queue.length>=a&&a>0;)this.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=_b):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=_b),{numberOfItems:a,returnValue:!1}},request:function(a){this.disposeCurrentRequest();var b=this,c=this._processRequest(a),a=c.numberOfItems;return c.returnValue?_b:(this.requestedCount=a,this.requestedDisposable=$b(function(){b.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=_b}}),c}(Ac);tc.controlled=function(a){return null==a&&(a=!0),new Yc(this,a)},tc.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 $c(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)})},c)};var $c=Z.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?$b(a):_b}function c(a,c){var d=c[0],e=c[1];try{d.setDisposable(b(e(d)))}catch(f){if(!d.fail(f))throw f}}function d(b,d){function e(a){var d=new _c(a),e=[d,b];return hc.scheduleRequired()?hc.scheduleWithState(e,c):c(null,e),d}this.source=d,a.call(this,e)}return Tb(d,a),d}(Ac),_c=function(a){function b(b){a.call(this),this.observer=b,this.m=new ac}Tb(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.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(yc),ad=function(a,b){this.subject=a,this.observer=b};ad.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 bd=Z.Subject=function(a){function d(a){return b(this),this.isStopped?this.hasError?(a.onError(this.error),_b):(a.onCompleted(),_b):(this.observers.push(a),new ad(this,a))}function e(){a.call(this,d),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return Tb(e,a),Ub(e.prototype,wc.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b(this),!this.isStopped){this.isStopped=!0;for(var a=0,d=c(this.observers),e=d.length;e>a;a++)d[a].onCompleted();this.observers.length=0}},onError:function(a){if(b(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onError(a);this.observers.length=0}},onNext:function(a){if(b(this),!this.isStopped)for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),e.create=function(a,b){return new dd(a,b)},e}(Ac),cd=Z.AsyncSubject=function(a){function d(a){return b(this),this.isStopped?(this.hasError?a.onError(this.error):this.hasValue?(a.onNext(this.value),a.onCompleted()):a.onCompleted(),_b):(this.observers.push(a),new ad(this,a))}function e(){a.call(this,d),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return Tb(e,a),Ub(e.prototype,wc,{hasObservers:function(){return b(this),this.observers.length>0},onCompleted:function(){var a,d;if(b(this),!this.isStopped){this.isStopped=!0;var e=c(this.observers),d=e.length;if(this.hasValue)for(a=0;d>a;a++){var f=e[a];f.onNext(this.value),f.onCompleted()}else for(a=0;d>a;a++)e[a].onCompleted();this.observers.length=0}},onError:function(a){if(b(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onError(a);this.observers.length=0}},onNext:function(a){b(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),e}(Ac),dd=Z.AnonymousSubject=function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){this.observer=c,this.observable=d,a.call(this,b)}return Tb(c,a),Ub(c.prototype,wc.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(Ac),ed=Z.BehaviorSubject=function(a){function d(a){return b(this),this.isStopped?(this.hasError?a.onError(this.error):a.onCompleted(),_b):(this.observers.push(a),a.onNext(this.value),new ad(this,a))}function e(b){a.call(this,d),this.value=b,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.hasError=!1}return Tb(e,a),Ub(e.prototype,wc,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b(this),!this.isStopped){this.isStopped=!0;for(var a=0,d=c(this.observers),e=d.length;e>a;a++)d[a].onCompleted();this.observers.length=0}},onError:function(a){if(b(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onError(a);this.observers.length=0}},onNext:function(a){if(b(this),!this.isStopped){this.value=a;for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),e}(Ac),fd=Z.ReplaySubject=function(a){function d(a,b){return $b(function(){b.dispose(),!a.isDisposed&&a.observers.splice(a.observers.indexOf(b),1)})}function e(a){var c=new Bc(this.scheduler,a),e=d(this,c);b(this),this._trim(this.scheduler.now()),this.observers.push(c);for(var f=0,g=this.q.length;g>f;f++)c.onNext(this.q[f].value);return this.hasError?c.onError(this.error):this.isStopped&&c.onCompleted(),c.ensureActive(),e}function f(b,c,d){this.bufferSize=null==b?Number.MAX_VALUE:b,this.windowSize=null==c?Number.MAX_VALUE:c,this.scheduler=d||hc,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,e)}return Tb(f,a),Ub(f.prototype,wc.prototype,{hasObservers:function(){return this.observers.length>0},_trim:function(a){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&a-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(a){if(b(this),!this.isStopped){var d=this.scheduler.now();this.q.push({interval:d,value:a}),this._trim(d);for(var e=0,f=c(this.observers),g=f.length;g>e;e++){var h=f[e];h.onNext(a),h.ensureActive()}}},onError:function(a){if(b(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var d=this.scheduler.now();this._trim(d);for(var e=0,f=c(this.observers),g=f.length;g>e;e++){var h=f[e];h.onError(a),h.ensureActive()}this.observers.length=0}},onCompleted:function(){if(b(this),!this.isStopped){this.isStopped=!0;var a=this.scheduler.now();this._trim(a);for(var d=0,e=c(this.observers),f=e.length;f>d;d++){var g=e[d];g.onCompleted(),g.ensureActive()}this.observers.length=0}},dispose:function(){this.isDisposed=!0,this.observers=null}}),f}(Ac);Z.Pauser=function(a){function b(){a.call(this)}return Tb(b,a),b.prototype.pause=function(){this.onNext(!1)},b.prototype.resume=function(){this.onNext(!0)},b}(bd),"function"==typeof define&&"object"==typeof define.amd&&define.amd?(U.Rx=Z,define(function(){return Z})):V&&W?X?(W.exports=Z).Rx=Z:V.Rx=Z:U.Rx=Z;var gd=h()}).call(this);
(function(a){function b(a){if(a.isDisposed)throw new Error(mb)}function c(a){for(var b=[],c=0,d=a.length;d>c;c++)b.push(a[c]);return b}function d(a,b){if(nb&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(rb)){for(var c=[],d=b;d;d=d.source)d.stack&&c.unshift(d.stack);c.unshift(a.stack);var f=c.join("\n"+rb+"\n");a.stack=e(f)}}function e(a){for(var b=a.split("\n"),c=[],d=0,e=b.length;e>d;d++){var h=b[d];f(h)||g(h)||!h||c.push(h)}return c.join("\n")}function f(a){var b=i(a);if(!b)return!1;var c=b[0],d=b[1];return c===pb&&d>=qb&&wd>=d}function g(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function h(){if(nb)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=i(c);if(!d)return;return pb=d[0],d[1]}}function i(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}function j(a){var b=[];if(!Tb(a))return b;Sb.nonEnumArgs&&a.length&&Ub(a)&&(a=Yb.call(a));var c=Sb.enumPrototypes&&"function"==typeof a,d=Sb.enumErrorProps&&(a===Nb||a instanceof Error);for(var e in a)c&&"prototype"==e||d&&("message"==e||"name"==e)||b.push(e);if(Sb.nonEnumShadows&&a!==Ob){var f=a.constructor,g=-1,h=zb;if(a===(f&&f.prototype))var i=a===Pb?Jb:a===Nb?Eb:Kb.call(a),j=Rb[i];for(;++g<h;)e=yb[g],j&&j[e]||!Lb.call(a,e)||b.push(e)}return b}function k(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 l(a,b){return k(a,b,j)}function m(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function n(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,f=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=f&&"object"!=f))return!1;var g=Kb.call(a),h=Kb.call(b);if(g==Ab&&(g=Hb),h==Ab&&(h=Hb),g!=h)return!1;switch(g){case Cb:case Db:return+a==+b;case Gb:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case Ib:case Jb:return a==String(b)}var i=g==Bb;if(!i){if(g!=Hb||!Sb.nodeClass&&(m(a)||m(b)))return!1;var j=!Sb.argsObject&&Ub(a)?Object:a.constructor,k=!Sb.argsObject&&Ub(b)?Object:b.constructor;if(!(j==k||Lb.call(a,"constructor")&&Lb.call(b,"constructor")||kb(j)&&j instanceof j&&kb(k)&&k instanceof k||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var o=c.length;o--;)if(c[o]==a)return d[o]==b;var p=0,q=!0;if(c.push(a),d.push(b),i){if(o=a.length,p=b.length,q=p==o)for(;p--;){var r=b[p];if(!(q=n(a[p],r,c,d)))break}}else l(b,function(b,e,f){return Lb.call(f,e)?(p++,q=Lb.call(a,e)&&n(a[e],b,c,d)):void 0}),q&&l(a,function(a,b,c){return Lb.call(c,b)?q=--p>-1:void 0});return c.pop(),d.pop(),q}function o(){try{return Vb.apply(this,arguments)}catch(a){return Xb.e=a,Xb}}function p(a){if(!kb(a))throw new TypeError("fn must be a function");return Vb=a,o}function q(a){throw a}function r(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function t(a,b){this.id=a,this.value=b}function u(a){this.observer=a,this.a=[],this.isStopped=!1}function v(){this._s=s}function w(){this._s=s,this._l=s.length,this._i=0}function x(a){this._a=a}function y(a){this._a=a,this._l=C(a),this._i=0}function z(a){return"number"==typeof a&&Y.isFinite(a)}function A(b){var c,d=b[sb];if(!d&&"string"==typeof b)return c=new v(b),c[sb]();if(!d&&b.length!==a)return c=new x(b),c[sb]();if(!d)throw new TypeError("Object is not iterable");return b[sb]()}function B(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function C(a){var b=+a.length;return isNaN(b)?0:0!==b&&z(b)?(b=B(b)*Math.floor(Math.abs(b)),0>=b?0:b>Pc?Pc:b):b}function D(a,b){this.observer=a,this.parent=b}function E(a,b){return new Rc(b,a)}function F(a,b){return new od(function(c){var d=new hc,e=new ic;return e.setDisposable(d),d.setDisposable(a.subscribe(function(a){c.onNext(a)},function(a){try{var d=b(a)}catch(f){return c.onError(f)}jb(d)&&(d=hd(d));var g=new hc;e.setDisposable(g),g.setDisposable(d.subscribe(c))},function(a){c.onCompleted(a)})),e},a)}function G(a,b){var c=this;return new od(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 d.onError(i)}d.onNext(g)}else d.onCompleted()},function(a){d.onError(a)},function(){d.onCompleted()})},c)}function H(){return!1}function I(){return[]}function J(a,b,c){var d=xb(b,c,3);return a.map(function(b,c){var e=d(b,c,a);return jb(e)&&(e=hd(e)),(vb(e)||ub(e))&&(e=Qc(e)),e}).concatAll()}function K(a,b,c){this.observer=a,this.selector=b,this.source=c,this.i=0,this.isStopped=!1}function L(a,b,c){var d=xb(b,c,3);return a.map(function(b,c){var e=d(b,c,a);return jb(e)&&(e=hd(e)),(vb(e)||ub(e))&&(e=Qc(e)),e}).mergeAll()}function M(a,b,c){this.observer=a,this.predicate=b,this.source=c,this.i=0,this.isStopped=!1}function N(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),ec(function(){a.removeEventListener(b,c,!1)});throw new Error("No listener found")}function O(a,b,c){var d=new bc;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(O(a.item(e),b,c));else a&&d.add(N(a,b,c));return d}function P(a,b){return new od(function(c){return b.scheduleWithAbsolute(a,function(){c.onNext(0),c.onCompleted()})})}function Q(a,b,c){return new od(function(d){var e=a,f=lc(b);return c.scheduleRecursiveWithAbsoluteAndState(0,e,function(a,b){if(f>0){var g=c.now();e+=f,g>=e&&(e=g+f)}d.onNext(a),b(a+1,e)})})}function R(a,b){return new od(function(c){return b.scheduleWithRelative(lc(a),function(){c.onNext(0),c.onCompleted()})})}function S(a,b,c){return a===b?new od(function(a){return c.schedulePeriodicWithState(0,b,function(b){return a.onNext(b),b+1})}):Lc(function(){return Q(c.now()+a,b,c)})}function T(a,b,c){return new od(function(d){var e,f=!1,g=new ic,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 hc,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 bc(e,g)},a)}function U(a,b,c){return Lc(function(){return T(a,b-c.now(),c)})}function V(a,b){return new od(function(c){function d(){g&&(g=!1,c.onNext(f)),e&&c.onCompleted()}var e,f,g;return new bc(a.subscribe(function(a){g=!0,f=a},c.onError.bind(c),function(){e=!0}),b.subscribe(d,c.onError.bind(c),d))},a)}function W(a,b,c){return new od(function(d){function e(a,b){j[b]=a;var e;if(g[b]=!0,h||(h=g.every(eb))){if(f)return void d.onError(f);try{e=c.apply(null,j)}catch(k){return void d.onError(k)}d.onNext(e)}i&&j[1]&&d.onCompleted()}var f,g=[!1,!1],h=!1,i=!1,j=new Array(2);return new bc(a.subscribe(function(a){e(a,0)},function(a){j[1]?d.onError(a):f=a},function(){i=!0,j[1]&&d.onCompleted()}),b.subscribe(function(a){e(a,1)},function(a){d.onError(a)},function(){i=!0,e(!0,1)}))},a)}var X={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},Y=X[typeof window]&&window||this,Z=X[typeof exports]&&exports&&!exports.nodeType&&exports,$=X[typeof module]&&module&&!module.nodeType&&module,_=$&&$.exports===Z&&Z,ab=X[typeof global]&&global;!ab||ab.global!==ab&&ab.window!==ab||(Y=ab);var bb={internals:{},config:{Promise:Y.Promise},helpers:{}},cb=bb.helpers.noop=function(){},db=(bb.helpers.notDefined=function(a){return"undefined"==typeof a},bb.helpers.isScheduler=function(a){return a instanceof bb.Scheduler}),eb=bb.helpers.identity=function(a){return a},fb=(bb.helpers.pluck=function(a){return function(b){return b[a]}},bb.helpers.just=function(a){return function(){return a}},bb.helpers.defaultNow=Date.now),gb=bb.helpers.defaultComparer=function(a,b){return Wb(a,b)},hb=bb.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},ib=(bb.helpers.defaultKeySerializer=function(a){return a.toString()},bb.helpers.defaultError=function(a){throw a}),jb=bb.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},kb=(bb.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},bb.helpers.not=function(a){return!a},bb.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==Kb.call(a)}),a}()),lb="Argument out of range",mb="Object has been disposed";bb.config.longStackSupport=!1;var nb=!1;try{throw new Error}catch(ob){nb=!!ob.stack}var pb,qb=h(),rb="From previous event:",sb="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";Y.Set&&"function"==typeof(new Y.Set)["@@iterator"]&&(sb="@@iterator");var tb=bb.doneEnumerator={done:!0,value:a},ub=bb.helpers.isIterable=function(b){return b[sb]!==a},vb=bb.helpers.isArrayLike=function(b){return b&&b.length!==a};bb.helpers.iterator=sb;var wb,xb=bb.internals.bindCallback=function(a,b,c){if("undefined"==typeof b)return a;switch(c){case 0:return function(){return a.call(b)};case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)}}return function(){return a.apply(b,arguments)}},yb=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],zb=yb.length,Ab="[object Arguments]",Bb="[object Array]",Cb="[object Boolean]",Db="[object Date]",Eb="[object Error]",Fb="[object Function]",Gb="[object Number]",Hb="[object Object]",Ib="[object RegExp]",Jb="[object String]",Kb=Object.prototype.toString,Lb=Object.prototype.hasOwnProperty,Mb=Kb.call(arguments)==Ab,Nb=Error.prototype,Ob=Object.prototype,Pb=String.prototype,Qb=Ob.propertyIsEnumerable;try{wb=!(Kb.call(document)==Hb&&!({toString:0}+""))}catch(ob){wb=!0}var Rb={};Rb[Bb]=Rb[Db]=Rb[Gb]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},Rb[Cb]=Rb[Jb]={constructor:!0,toString:!0,valueOf:!0},Rb[Eb]=Rb[Fb]=Rb[Ib]={constructor:!0,toString:!0},Rb[Hb]={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=Qb.call(Nb,"message")||Qb.call(Nb,"name"),Sb.enumPrototypes=Qb.call(a,"prototype"),Sb.nonEnumArgs=0!=c,Sb.nonEnumShadows=!/valueOf/.test(b)}(1);var Tb=bb.internals.isObject=function(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1},Ub=function(a){return a&&"object"==typeof a?Kb.call(a)==Ab:!1};Mb||(Ub=function(a){return a&&"object"==typeof a?Lb.call(a,"callee"):!1});{var Vb,Wb=bb.internals.isEqual=function(a,b){return n(a,b,[],[])},Xb={e:{}},Yb=({}.hasOwnProperty,Array.prototype.slice),Zb=this.inherits=bb.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c},$b=bb.internals.addProperties=function(a){for(var b=[],c=1,d=arguments.length;d>c;c++)b.push(arguments[c]);for(var e=0,f=b.length;f>e;e++){var g=b[e];for(var h in g)a[h]=g[h]}};bb.internals.addRef=function(a,b){return new od(function(c){return new bc(b.getDisposable(),a.subscribe(c))})}}t.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var _b=bb.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},ac=_b.prototype;ac.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},ac.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)}}},ac.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)}}},ac.peek=function(){return this.items[0].value},ac.removeAt=function(b){this.items[b]=this.items[--this.length],this.items[this.length]=a,this.heapify()},ac.dequeue=function(){var a=this.peek();return this.removeAt(0),a},ac.enqueue=function(a){var b=this.length++;this.items[b]=new t(_b.count++,a),this.percolate(b)},ac.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},_b.count=0;var bc=bb.CompositeDisposable=function(){var a,b,c=[];if(Array.isArray(arguments[0]))c=arguments[0],b=c.length;else for(b=arguments.length,c=new Array(b),a=0;b>a;a++)c[a]=arguments[a];for(a=0;b>a;a++)if(!gc(c[a]))throw new TypeError("Not a disposable");this.disposables=c,this.isDisposed=!1,this.length=c.length},cc=bc.prototype;cc.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},cc.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},cc.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var a=this.disposables.length,b=new Array(a),c=0;a>c;c++)b[c]=this.disposables[c];for(this.disposables=[],this.length=0,c=0;a>c;c++)b[c].dispose()}};var dc=bb.Disposable=function(a){this.isDisposed=!1,this.action=a||cb};dc.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var ec=dc.create=function(a){return new dc(a)},fc=dc.empty={dispose:cb},gc=dc.isDisposable=function(a){return a&&kb(a.dispose)},hc=bb.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=this.isDisposed;if(!b){var c=this.current;this.current=a}c&&c.dispose(),b&&a&&a.dispose()},b.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()},a}(),ic=bb.SerialDisposable=hc,jc=(bb.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?fc:new a(this)},b}(),bb.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||hb,this.disposable=new hc});jc.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},jc.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},jc.prototype.isCancelled=function(){return this.disposable.isDisposed},jc.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var kc=bb.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(),fc}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=fb,a.normalize=function(a){return 0>a&&(a=0),a},a}(),lc=kc.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new bc,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),fc});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new bc,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c](b,d,function(a,b){return e?f.remove(i):h=!0,g(b),fc});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")})}}(kc.prototype),function(){kc.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},kc.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof Y.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=Y.setInterval(function(){d=c(d)},b);return ec(function(){Y.clearInterval(e)})}}(kc.prototype);var mc,nc=kc.immediate=function(){function a(a,b){return b(this,a)}function b(){throw new Error("Not supported")}return new kc(fb,a,b,b)}(),oc=kc.currentThread=function(){function a(){for(;d.length>0;){var a=d.dequeue();a.isCancelled()||!a.isCancelled()&&a.invoke()}}function b(b,c){var e=new jc(this,b,c,this.now());if(d)d.enqueue(e);else{d=new _b(4),d.enqueue(e);var f=p(a)();if(d=null,f===Xb)return q(f.e)}return e.disposable}function c(){throw new Error("Not supported")}var d,e=new kc(fb,b,c,c);return e.scheduleRequired=function(){return!d},e.ensureTrampoline=function(a){d?a():this.schedule(a)},e}(),pc=(bb.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 hc;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),cb),qc=function(){var a,b=cb;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!Y.setTimeout)throw new Error("No concurrency detected!");a=Y.setTimeout,b=Y.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),rc=qc.setTimeout,sc=qc.clearTimeout;!function(){function a(){if(!Y.postMessage||Y.importScripts)return!1;var a=!1,b=Y.onmessage;return Y.onmessage=function(){a=!0},Y.postMessage("","*"),Y.onmessage=b,a}var b=RegExp("^"+String(Kb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),c="function"==typeof(c=ab&&_&&ab.setImmediate)&&!b.test(c)&&c,d="function"==typeof(d=ab&&_&&ab.clearImmediate)&&!b.test(d)&&d;if("function"==typeof c)mc=c,pc=d;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))mc=process.nextTick;else if(a()){var e="ms.rx.schedule"+Math.random(),f={},g=0,h=function(a){if("string"==typeof a.data&&a.data.substring(0,e.length)===e){var b=a.data.substring(e.length),c=f[b];c(),delete f[b]}};Y.addEventListener?Y.addEventListener("message",h,!1):Y.attachEvent("onmessage",h,!1),mc=function(a){var b=g++;f[b]=a,Y.postMessage(e+b,"*")}}else if(Y.MessageChannel){var i=new Y.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},mc=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in Y&&"onreadystatechange"in Y.document.createElement("script")?mc=function(a){var b=Y.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},Y.document.documentElement.appendChild(b)}:(mc=function(a){return rc(a,0)},pc=sc)}();var tc=kc.timeout=function(){function a(a,b){var c=this,d=new hc,e=mc(function(){d.isDisposed||d.setDisposable(b(c,a))});return new bc(d,ec(function(){pc(e)}))}function b(a,b,c){var d=this,e=kc.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new hc,g=rc(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new bc(f,ec(function(){sc(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new kc(fb,a,b,c)}(),uc=bb.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 db(a)||(a=nc),new od(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),vc=uc.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 uc("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),wc=uc.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 uc("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),xc=uc.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new uc("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),yc=bb.internals.Enumerator=function(a){this._next=a};yc.prototype.next=function(){return this._next()},yc.prototype[sb]=function(){return this};var zc=bb.internals.Enumerable=function(a){this._iterator=a};zc.prototype[sb]=function(){return this._iterator()},zc.prototype.concat=function(){var a=this;return new od(function(b){var c,d=a[sb](),e=new ic,f=nc.scheduleRecursive(function(a){if(!c){try{var f=d.next()}catch(g){return b.onError(g)}if(f.done)return b.onCompleted();var h=f.value;jb(h)&&(h=hd(h));var i=new hc;e.setDisposable(i),i.setDisposable(h.subscribe(function(a){b.onNext(a)},function(a){b.onError(a)},a))}});return new bc(e,f,ec(function(){c=!0}))})},zc.prototype.catchError=function(){var a=this;return new od(function(b){var c,d=a[sb](),e=new ic,f=nc.scheduleRecursiveWithState(null,function(a,f){if(!c){try{var g=d.next()}catch(h){return observer.onError(h)}if(g.done)return void(null!==a?b.onError(a):b.onCompleted());var i=g.value;jb(i)&&(i=hd(i));var j=new hc;e.setDisposable(j),j.setDisposable(i.subscribe(function(a){b.onNext(a)},f,function(){b.onCompleted()}))}});return new bc(e,f,ec(function(){c=!0}))})},zc.prototype.catchErrorWhen=function(a){var b=this;return new od(function(c){var d,e,f=new rd,g=new rd,h=a(f),i=h.subscribe(g),j=b[sb](),k=new ic,l=nc.scheduleRecursive(function(a){if(!d){try{var b=j.next()}catch(h){return c.onError(h)}if(b.done)return void(e?c.onError(e):c.onCompleted());var i=b.value;jb(i)&&(i=hd(i));var l=new hc,m=new hc;k.setDisposable(new bc(m,l)),l.setDisposable(i.subscribe(function(a){c.onNext(a)},function(b){m.setDisposable(g.subscribe(a,function(a){c.onError(a)},function(){c.onCompleted()})),f.onNext(b)},function(){c.onCompleted()}))}});return new bc(i,k,l,ec(function(){d=!0}))})};var Ac,Bc=zc.repeat=function(a,b){return null==b&&(b=-1),new zc(function(){var c=b;return new yc(function(){return 0===c?tb:(c>0&&c--,{done:!1,value:a})})})},Cc=zc.of=function(a,b,c){if(b)var d=xb(b,c,3);return new zc(function(){var c=-1;return new yc(function(){return++c<a.length?{done:!1,value:b?d(a[c],c,a):a[c]}:tb})})},Dc=bb.Observer=function(){},Ec=Dc.create=function(a,b,c){return a||(a=cb),b||(b=ib),c||(c=cb),new Gc(a,b,c)},Fc=bb.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}function c(){throw new Error("Method not implemented")}return Zb(b,a),b.prototype.next=c,b.prototype.error=c,b.prototype.completed=c,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}(Dc),Gc=bb.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return Zb(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}(Fc),Hc=bb.Observable=function(){function a(a){if(bb.config.longStackSupport&&nb){try{throw new Error}catch(b){this.stack=b.stack.substring(b.stack.indexOf("\n")+1)}var c=this;this._subscribe=function(b){var e=b.onError.bind(b);return b.onError=function(a){d(a,c),e(a)},a.call(c,b)}}else this._subscribe=a}return Ac=a.prototype,Ac.subscribe=Ac.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:Ec(a,b,c))},Ac.subscribeOnNext=function(a,b){return this._subscribe(Ec("undefined"!=typeof b?function(c){a.call(b,c)}:a))},Ac.subscribeOnError=function(a,b){return this._subscribe(Ec(null,"undefined"!=typeof b?function(c){a.call(b,c)}:a))},Ac.subscribeOnCompleted=function(a,b){return this._subscribe(Ec(null,null,"undefined"!=typeof b?function(){a.call(b)}:a))},a}(),Ic=bb.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 ic}return Zb(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}(Fc),Jc=bb.ObservableBase=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?ec(a):fc}function c(a,c){var d=c[0],e=c[1],f=p(e.subscribeCore).call(e,d);return f!==Xb||d.fail(Xb.e)?void d.setDisposable(b(f)):q(Xb.e)}function d(a){var b=new pd(a),d=[b,this];return oc.scheduleRequired()?oc.scheduleWithState(d,c):c(null,d),b}function e(){a.call(this,d)}return Zb(e,a),e.prototype.subscribeCore=function(){throw new Error("Not implemeneted")},e}(Hc),Kc=function(a){function b(b){this.source=b,a.call(this)}return Zb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new u(a))},b}(Jc);u.prototype.onNext=function(a){this.isStopped||this.a.push(a)},u.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.observer.onError(a))},u.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.observer.onNext(this.a),this.observer.onCompleted())},u.prototype.dispose=function(){this.isStopped=!0},u.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},Ac.toArray=function(){return new Kc(this)},Hc.create=Hc.createWithDisposable=function(a,b){return new od(a,b)};var Lc=Hc.defer=function(a){return new od(function(b){var c;try{c=a()}catch(d){return Wc(d).subscribe(b)}return jb(c)&&(c=hd(c)),c.subscribe(b)})},Mc=Hc.empty=function(a){return db(a)||(a=nc),new od(function(b){return a.schedule(function(){b.onCompleted()})})},Nc=function(a){function b(b,c,d){this.iterable=b,this.mapper=c,this.scheduler=d,a.call(this)}return Zb(b,a),b.prototype.subscribeCore=function(a){var b=new Oc(a,this);return b.run()},b}(Jc),Oc=function(){function a(a,b){this.observer=a,this.parent=b}return a.prototype.run=function(){function a(a,b){try{var f=c.next()}catch(g){return d.onError(g)}if(f.done)return d.onCompleted();var h=f.value;if(e)try{h=e(h,a)}catch(g){return d.onError(g)}d.onNext(h),b(a+1)}var b=Object(this.parent.iterable),c=A(b),d=this.observer,e=this.parent.mapper;return this.parent.scheduler.scheduleRecursiveWithState(0,a)},a}(),Pc=Math.pow(2,53)-1;v.prototype[sb]=function(){return new w(this._s)},w.prototype[sb]=function(){return this},w.prototype.next=function(){return this._i<this._l?{done:!1,value:this._s.charAt(this._i++)}:tb},x.prototype[sb]=function(){return new y(this._a)},y.prototype[sb]=function(){return this},y.prototype.next=function(){return this._i<this._l?{done:!1,value:this._a[this._i++]}:tb};var Qc=Hc.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!kb(b))throw new Error("mapFn when provided must be a function");if(b)var e=xb(b,c,2);return db(d)||(d=oc),new Nc(a,e,d)},Rc=function(a){function b(b,c){this.args=b,this.scheduler=c||oc,a.call(this)}return Zb(b,a),b.prototype.subscribeCore=function(a){var b=new D(a,this);return b.run()},b}(Jc);D.prototype.run=function(){function a(a,e){d>a?(b.onNext(c[a]),e(a+1)):b.onCompleted()}var b=this.observer,c=this.parent.args,d=c.length;return this.parent.scheduler.scheduleRecursiveWithState(0,a)};{var Sc=Hc.fromArray=function(a,b){return new Rc(a,b)};Hc.never=function(){return new od(function(){return fc})}}Hc.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return new Rc(b)},Hc.ofWithScheduler=function(a){for(var b=arguments.length,c=new Array(b-1),d=1;b>d;d++)c[d-1]=arguments[d];return new Rc(c,a)},Hc.pairs=function(a,b){return b||(b=bb.Scheduler.currentThread),new od(function(c){var d=Object.keys(a),e=d.length;return b.scheduleRecursiveWithState(0,function(b,f){if(e>b){var g=d[b];c.onNext([g,a[g]]),f(b+1)}else c.onCompleted()})})};var Tc=function(a){function b(b,c,d){this.start=b,this.count=c,this.scheduler=d,a.call(this)}return Zb(b,a),b.prototype.subscribeCore=function(a){var b=new Uc(a,this);return b.run()},b}(Jc),Uc=function(){function a(a,b){this.observer=a,this.parent=b}return a.prototype.run=function(){function a(a,e){c>a?(d.onNext(b+a),e(a+1)):d.onCompleted()}var b=this.parent.start,c=this.parent.count,d=this.observer;return this.parent.scheduler.scheduleRecursiveWithState(0,a)},a}();Hc.range=function(a,b,c){return db(c)||(c=oc),new Tc(a,b,c)},Hc.repeat=function(a,b,c){return db(c)||(c=oc),Vc(a,c).repeat(null==b?-1:b)};var Vc=Hc["return"]=Hc.just=function(a,b){return db(b)||(b=nc),new od(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})};Hc.returnValue=function(){return Vc.apply(null,arguments)};var Wc=Hc["throw"]=Hc.throwError=function(a,b){return db(b)||(b=nc),new od(function(c){return b.schedule(function(){c.onError(a)})})};Hc.throwException=function(){return Hc.throwError.apply(null,arguments)},Ac["catch"]=Ac.catchError=Ac.catchException=function(a){return"function"==typeof a?F(this,a):Xc([this,a])};var Xc=Hc.catchError=Hc["catch"]=Hc.catchException=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return Cc(a).catchError()};Ac.combineLatest=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return Array.isArray(b[0])?b[0].unshift(this):b.unshift(this),Yc.apply(this,b)};var Yc=Hc.combineLatest=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=b.pop();return a--,Array.isArray(b[0])&&(b=b[0]),new od(function(c){function e(a){if(h[a]=!0,i||(i=h.every(eb))){try{var b=d.apply(null,k)}catch(e){return void c.onError(e)}c.onNext(b)}else j.filter(function(b,c){return c!==a}).every(eb)&&c.onCompleted()}function f(a){j[a]=!0,j.every(eb)&&c.onCompleted()
}for(var g=function(){return!1},h=r(a,g),i=!1,j=r(a,g),k=new Array(a),l=new Array(a),m=0;a>m;m++)!function(a){var d=b[a],g=new hc;jb(d)&&(d=hd(d)),g.setDisposable(d.subscribe(function(b){k[a]=b,e(a)},function(a){c.onError(a)},function(){f(a)})),l[a]=g}(m);return new bc(l)},this)};Ac.concat=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return a.unshift(this),Zc.apply(null,a)};var Zc=Hc.concat=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{a=new Array(arguments.length);for(var b=0,c=arguments.length;c>b;b++)a[b]=arguments[b]}return Cc(a).concat()};Ac.concatAll=Ac.concatObservable=function(){return this.merge(1)};var $c=function(a){function b(b,c){this.source=b,this.maxConcurrent=c,a.call(this)}return Zb(b,a),b.prototype.subscribeCore=function(a){var b=new bc;return b.add(this.source.subscribe(new _c(a,this.maxConcurrent,b))),b},b}(Jc),_c=function(){function a(a,b,c){this.o=a,this.max=b,this.g=c,this.done=!1,this.q=[],this.activeCount=0,this.isStopped=!1}function b(a,b){this.parent=a,this.sad=b,this.isStopped=!1}return a.prototype.handleSubscribe=function(a){var c=new hc;this.g.add(c),jb(a)&&(a=hd(a)),c.setDisposable(a.subscribe(new b(this,c)))},a.prototype.onNext=function(a){this.isStopped||(this.activeCount<this.max?(this.activeCount++,this.handleSubscribe(a)):this.q.push(a))},a.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},a.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,0===this.activeCount&&this.o.onCompleted())},a.prototype.dispose=function(){this.isStopped=!0},a.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},b.prototype.onNext=function(a){this.isStopped||this.parent.o.onNext(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.parent.o.onError(a))},b.prototype.onCompleted=function(){if(!this.isStopped){var a=this.parent;a.g.remove(this.sad),a.q.length>0?a.handleSubscribe(a.q.shift()):(a.activeCount--,a.done&&0===a.activeCount&&a.o.onCompleted())}},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(a),!0)},a}();Ac.merge=function(a){return"number"!=typeof a?ad(this,a):new $c(this,a)};var ad=Hc.merge=function(){var a,b,c=[],d=arguments.length;if(arguments[0])if(db(arguments[0]))for(a=arguments[0],b=1;d>b;b++)c.push(arguments[b]);else for(a=nc,b=0;d>b;b++)c.push(arguments[b]);else for(a=nc,b=1;d>b;b++)c.push(arguments[b]);return Array.isArray(c[0])&&(c=c[0]),E(a,c).mergeAll()},bd=bb.CompositeError=function(a){this.name="NotImplementedError",this.innerErrors=a,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};bd.prototype=Error.prototype,Hc.mergeDelayError=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}var d=E(null,a);return new od(function(a){function b(){0===g.length?a.onCompleted():a.onError(1===g.length?g[0]:new bd(g))}var c=new bc,e=new hc,f=!1,g=[];return c.add(e),e.setDisposable(d.subscribe(function(d){var e=new hc;c.add(e),jb(d)&&(d=hd(d)),e.setDisposable(d.subscribe(function(b){a.onNext(b)},function(a){g.push(a),c.remove(e),f&&1===c.length&&b()},function(){c.remove(e),f&&1===c.length&&b()}))},function(a){g.push(a),f=!0,1===c.length&&b()},function(){f=!0,1===c.length&&b()})),c})};var cd=function(a){function b(b){this.source=b,a.call(this)}return Zb(b,a),b.prototype.subscribeCore=function(a){var b=new bc,c=new hc;return b.add(c),c.setDisposable(this.source.subscribe(new dd(a,b))),b},b}(Jc),dd=function(){function a(a,b){this.o=a,this.g=b,this.isStopped=!1,this.done=!1}function b(a,b,c){this.parent=a,this.g=b,this.sad=c,this.isStopped=!1}return a.prototype.onNext=function(a){if(!this.isStopped){var c=new hc;this.g.add(c),jb(a)&&(a=hd(a)),c.setDisposable(a.subscribe(new b(this,this.g,c)))}},a.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},a.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,1===this.g.length&&this.o.onCompleted())},a.prototype.dispose=function(){this.isStopped=!0},a.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},b.prototype.onNext=function(a){this.isStopped||this.parent.o.onNext(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.parent.o.onError(a))},b.prototype.onCompleted=function(){if(!this.isStopped){var a=this.parent;this.isStopped=!0,a.g.remove(this.sad),a.done&&1===a.g.length&&a.o.onCompleted()}},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(a),!0)},a}();Ac.mergeAll=Ac.mergeObservable=function(){return new cd(this)},Ac.skipUntil=function(a){var b=this;return new od(function(c){var d=!1,e=new bc(b.subscribe(function(a){d&&c.onNext(a)},function(a){c.onError(a)},function(){d&&c.onCompleted()}));jb(a)&&(a=hd(a));var f=new hc;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},function(a){c.onError(a)},function(){f.dispose()})),e},b)},Ac["switch"]=Ac.switchLatest=function(){var a=this;return new od(function(b){var c=!1,d=new ic,e=!1,f=0,g=a.subscribe(function(a){var g=new hc,h=++f;c=!0,d.setDisposable(g),jb(a)&&(a=hd(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())}))},function(a){b.onError(a)},function(){e=!0,!c&&b.onCompleted()});return new bc(g,d)},a)},Ac.takeUntil=function(a){var b=this;return new od(function(c){return jb(a)&&(a=hd(a)),new bc(b.subscribe(c),a.subscribe(function(){c.onCompleted()},function(a){c.onError(a)},cb))},b)},Ac.withLatestFrom=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);var d=a.pop(),e=this;if("undefined"==typeof e)throw new Error("Source observable not found for withLatestFrom().");if("function"!=typeof d)throw new Error("withLatestFrom() expects a resultSelector function.");return Array.isArray(a[0])&&(a=a[0]),new od(function(b){for(var c=function(){return!1},f=a.length,g=r(f,c),h=!1,i=new Array(f),j=new Array(f+1),k=0;f>k;k++)!function(c){var d=a[c],e=new hc;jb(d)&&(d=hd(d)),e.setDisposable(d.subscribe(function(a){i[c]=a,g[c]=!0,h=g.every(eb)},b.onError.bind(b),function(){})),j[c]=e}(k);var l=new hc;return l.setDisposable(e.subscribe(function(a){var c,e=[a].concat(i);if(h){try{c=d.apply(null,e)}catch(f){return void b.onError(f)}b.onNext(c)}},b.onError.bind(b),function(){b.onCompleted()})),j[f]=l,new bc(j)},this)},Ac.zip=function(){if(Array.isArray(arguments[0]))return G.apply(this,arguments);for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=this,e=b.pop();return b.unshift(d),new od(function(a){function c(b){var c,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),c=e.apply(d,f)}catch(g){return void a.onError(g)}a.onNext(c)}else i.filter(function(a,c){return c!==b}).every(eb)&&a.onCompleted()}function f(b){i[b]=!0,i.every(function(a){return a})&&a.onCompleted()}for(var g=b.length,h=r(g,I),i=r(g,H),j=new Array(g),k=0;g>k;k++)!function(d){var e=b[d],g=new hc;jb(e)&&(e=hd(e)),g.setDisposable(e.subscribe(function(a){h[d].push(a),c(d)},function(b){a.onError(b)},function(){f(d)})),j[d]=g}(k);return new bc(j)},d)},Hc.zip=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=b.shift();return d.zip.apply(d,b)},Hc.zipArray=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new od(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(eb))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(eb)?void b.onCompleted():void 0}for(var e=a.length,f=r(e,function(){return[]}),g=r(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new hc,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},function(a){b.onError(a)},function(){d(e)}))}(i);return new bc(h)})},Ac.asObservable=function(){var a=this;return new od(function(b){return a.subscribe(b)},this)},Ac.dematerialize=function(){var a=this;return new od(function(b){return a.subscribe(function(a){return a.accept(b)},function(a){b.onError(a)},function(){b.onCompleted()})},this)},Ac.distinctUntilChanged=function(a,b){var c=this;return b||(b=gb),new od(function(d){var e,f=!1;return c.subscribe(function(c){var g=c;if(a)try{g=a(c)}catch(h){return void d.onError(h)}if(f)try{var i=b(e,g)}catch(h){return void d.onError(h)}f&&i||(f=!0,e=g,d.onNext(c))},function(a){d.onError(a)},function(){d.onCompleted()})},this)},Ac["do"]=Ac.tap=Ac.doAction=function(a,b,c){var d=this,e="function"==typeof a||"undefined"==typeof a?Ec(a||cb,b||cb,c||cb):a;return new od(function(a){return d.subscribe(function(b){try{e.onNext(b)}catch(c){a.onError(c)}a.onNext(b)},function(b){try{e.onError(b)}catch(c){a.onError(c)}a.onError(b)},function(){try{e.onCompleted()}catch(b){a.onError(b)}a.onCompleted()})},this)},Ac.doOnNext=Ac.tapOnNext=function(a,b){return this.tap("undefined"!=typeof b?function(c){a.call(b,c)}:a)},Ac.doOnError=Ac.tapOnError=function(a,b){return this.tap(cb,"undefined"!=typeof b?function(c){a.call(b,c)}:a)},Ac.doOnCompleted=Ac.tapOnCompleted=function(a,b){return this.tap(cb,null,"undefined"!=typeof b?function(){a.call(b)}:a)},Ac["finally"]=Ac.ensure=function(a){var b=this;return new od(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return ec(function(){try{d.dispose()}catch(b){throw b}finally{a()}})},this)},Ac.finallyAction=function(a){return this.ensure(a)},Ac.ignoreElements=function(){var a=this;return new od(function(b){return a.subscribe(cb,function(a){b.onError(a)},function(){b.onCompleted()})},a)},Ac.materialize=function(){var a=this;return new od(function(b){return a.subscribe(function(a){b.onNext(vc(a))},function(a){b.onNext(wc(a)),b.onCompleted()},function(){b.onNext(xc()),b.onCompleted()})},a)},Ac.repeat=function(a){return Bc(this,a).concat()},Ac.retry=function(a){return Bc(this,a).catchError()},Ac.retryWhen=function(a){return Bc(this).catchErrorWhen(a)},Ac.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 od(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)},function(a){e.onError(a)},function(){!h&&c&&e.onNext(a),e.onCompleted()})},d)},Ac.skipLast=function(a){var b=this;return new od(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},function(a){c.onError(a)},function(){c.onCompleted()})},b)},Ac.startWith=function(){var a,b=0;arguments.length&&db(arguments[0])?(a=arguments[0],b=1):a=nc;for(var c=[],d=b,e=arguments.length;e>d;d++)c.push(arguments[d]);return Cc([Sc(c,a),this]).concat()},Ac.takeLast=function(a){var b=this;return new od(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})},b)},Ac.selectConcat=Ac.concatMap=function(a,b,c){return kb(a)&&kb(b)?this.concatMap(function(c,d){var e=a(c,d);return jb(e)&&(e=hd(e)),(vb(e)||ub(e))&&(e=Qc(e)),e.map(function(a,e){return b(c,a,d,e)})}):kb(a)?J(this,a,c):J(this,function(){return a})};var ed=function(a){function b(b,c,d){this.source=b,this.selector=xb(c,d,3),a.call(this)}return Zb(b,a),b.prototype.internalMap=function(a,c){var d=this;return new b(this.source,function(b,c,e){return a(d.selector(b,c,e),c,e)},c)},b.prototype.subscribeCore=function(a){return this.source.subscribe(new K(a,this.selector,this))},b}(Jc);K.prototype.onNext=function(a){if(!this.isStopped){var b=p(this.selector).call(this,a,this.i++,this.source);return b===Xb?this.observer.onError(b.e):void this.observer.onNext(b)}},K.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.observer.onError(a))},K.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.observer.onCompleted())},K.prototype.dispose=function(){this.isStopped=!0},K.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},Ac.map=Ac.select=function(a,b){var c="function"==typeof a?a:function(){return a};return this instanceof ed?this.internalMap(c,b):new ed(this,c,b)},Ac.pluck=function(){var b=arguments,c=arguments.length;if(0===c)throw new Error("List of properties cannot be empty.");return this.map(function(d){for(var e=d,f=0;c>f;f++){var g=e[b[f]];if("undefined"==typeof g)return a;e=g}return e})},Ac.selectMany=Ac.flatMap=function(a,b,c){return kb(a)&&kb(b)?this.flatMap(function(c,d){var e=a(c,d);return jb(e)&&(e=hd(e)),(vb(e)||ub(e))&&(e=Qc(e)),e.map(function(a,e){return b(c,a,d,e)})},c):kb(a)?L(this,a,c):L(this,function(){return a})},Ac.selectSwitch=Ac.flatMapLatest=Ac.switchMap=function(a,b){return this.select(a,b).switchLatest()},Ac.skip=function(a){if(0>a)throw new Error(lb);var b=this;return new od(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},function(a){c.onError(a)},function(){c.onCompleted()})},b)},Ac.skipWhile=function(a,b){var c=this,d=xb(a,b,3);return new od(function(a){var b=0,e=!1;return c.subscribe(function(f){if(!e)try{e=!d(f,b++,c)}catch(g){return void a.onError(g)}e&&a.onNext(f)},function(b){a.onError(b)},function(){a.onCompleted()})},c)},Ac.take=function(a,b){if(0>a)throw new RangeError(lb);if(0===a)return Mc(b);var c=this;return new od(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},function(a){b.onError(a)},function(){b.onCompleted()})},c)},Ac.takeWhile=function(a,b){var c=this,d=xb(a,b,3);return new od(function(a){var b=0,e=!0;return c.subscribe(function(f){if(e){try{e=d(f,b++,c)}catch(g){return void a.onError(g)}e?a.onNext(f):a.onCompleted()}},function(b){a.onError(b)},function(){a.onCompleted()})},c)};var fd=function(a){function b(b,c,d){this.source=b,this.predicate=xb(c,d,3),a.call(this)}return Zb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new M(a,this.predicate,this))},b.prototype.internalFilter=function(a,c){var d=this;return new b(this.source,function(b,c,e){return d.predicate(b,c,e)&&a(b,c,e)},c)},b}(Jc);M.prototype.onNext=function(a){if(!this.isStopped){var b=p(this.predicate).call(this,a,this.i++,this.source);return b===Xb?this.observer.onError(b.e):void(b&&this.observer.onNext(a))}},M.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.observer.onError(a))},M.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.observer.onCompleted())},M.prototype.dispose=function(){this.isStopped=!0},M.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},Ac.filter=Ac.where=function(a,b){return this instanceof fd?this.internalFilter(a,b):new fd(this,a,b)},Hc.fromCallback=function(a,b,c){return function(){for(var d=[],e=0,f=arguments.length;f>e;e++)d.push(arguments[e]);return new od(function(e){function f(){var a=arguments;if(c){try{a=c(a)}catch(b){return e.onError(b)}e.onNext(a)}else a.length<=1?e.onNext.apply(e,a):e.onNext(a);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},Hc.fromNodeCallback=function(a,b,c){return function(){for(var d=[],e=0,f=arguments.length;f>e;e++)d.push(arguments[e]);return new od(function(e){function f(a){if(a)return void e.onError(a);for(var b=[],d=1,f=arguments.length;f>d;d++)b.push(arguments[d]);if(c){try{b=c(b)}catch(g){return e.onError(g)}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()}},bb.config.useNativeEvents=!1,Hc.fromEvent=function(a,b,c){return a.addListener?gd(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},c):bb.config.useNativeEvents||"function"!=typeof a.on||"function"!=typeof a.off?new od(function(d){return O(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():gd(function(c){a.on(b,c)},function(c){a.off(b,c)},c)};var gd=Hc.fromEventPattern=function(a,b,c){return new od(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 ec(function(){b&&b(e,f)})}).publish().refCount()},hd=Hc.fromPromise=function(a){return Lc(function(){var b=new bb.AsyncSubject;return a.then(function(a){b.onNext(a),b.onCompleted()},b.onError.bind(b)),b})};Ac.toPromise=function(a){if(a||(a=bb.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)})})},Hc.startAsync=function(a){var b;try{b=a()}catch(c){return Wc(c)}return hd(b)},Ac.multicast=function(a,b){var c=this;return"function"==typeof a?new od(function(d){var e=c.multicast(a());return new bc(b(e).subscribe(d),e.connect())},c):new id(c,a)},Ac.publish=function(a){return a&&kb(a)?this.multicast(function(){return new rd},a):this.multicast(new rd)},Ac.share=function(){return this.publish().refCount()},Ac.publishLast=function(a){return a&&kb(a)?this.multicast(function(){return new sd},a):this.multicast(new sd)},Ac.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new ud(b)},a):this.multicast(new ud(a))},Ac.shareValue=function(a){return this.publishValue(a).refCount()},Ac.replay=function(a,b,c,d){return a&&kb(a)?this.multicast(function(){return new vd(b,c,d)},a):this.multicast(new vd(b,c,d))},Ac.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};{var id=bb.ConnectableObservable=function(a){function b(b,c){var d,e=!1,f=b.asObservable();this.connect=function(){return e||(e=!0,d=new bc(f.subscribe(c),ec(function(){e=!1}))),d},a.call(this,function(a){return c.subscribe(a)})}return Zb(b,a),b.prototype.refCount=function(){var a,b=0,c=this;return new od(function(d){var e=1===++b,f=c.subscribe(d);return e&&(a=c.connect()),function(){f.dispose(),0===--b&&a.dispose()}})},b}(Hc),jd=Hc.interval=function(a,b){return S(a,a,db(b)?b:tc)};Hc.timer=function(b,c,d){var e;return db(d)||(d=tc),c!==a&&"number"==typeof c?e=c:db(c)&&(d=c),b instanceof Date&&e===a?P(b.getTime(),d):b instanceof Date&&e!==a?(e=c,Q(b.getTime(),e,d)):e===a?R(b,d):S(b,e,d)}}Ac.delay=function(a,b){return db(b)||(b=tc),a instanceof Date?U(this,a.getTime(),b):T(this,a,b)},Ac.debounce=Ac.throttleWithTimeout=function(a,b){db(b)||(b=tc);var c=this;return new od(function(d){var e,f=new ic,g=!1,h=0,i=c.subscribe(function(c){g=!0,e=c,h++;var i=h,j=new hc;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 bc(i,f)},this)},Ac.throttle=function(a,b){return this.debounce(a,b)},Ac.timestamp=function(a){return db(a)||(a=tc),this.map(function(b){return{value:b,timestamp:a.now()}})},Ac.sample=Ac.throttleLatest=function(a,b){return db(b)||(b=tc),"number"==typeof a?V(this,jd(a,b)):V(this,a)},Ac.timeout=function(a,b,c){(null==b||"string"==typeof b)&&(b=Wc(new Error(b||"Timeout"))),db(c)||(c=tc);var d=this,e=a instanceof Date?"scheduleWithAbsolute":"scheduleWithRelative";return new od(function(f){function g(){var d=h;l.setDisposable(c[e](a,function(){h===d&&(jb(b)&&(b=hd(b)),j.setDisposable(b.subscribe(f)))}))}var h=0,i=new hc,j=new ic,k=!1,l=new ic;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 bc(j,l)},d)},Ac.throttleFirst=function(a,b){db(b)||(b=tc);var c=+a||0;if(0>=c)throw new RangeError("windowDuration cannot be less or equal zero.");var d=this;return new od(function(a){var e=0;return d.subscribe(function(d){var f=b.now();(0===e||f-e>=c)&&(e=f,a.onNext(d))},function(b){a.onError(b)},function(){a.onCompleted()})},d)};var kd=function(a){function b(a){var b=this.source.publish(),c=b.subscribe(a),d=fc,e=this.pauser.distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=fc)});return new bc(c,d,e)}function c(c,d){this.source=c,this.controller=new rd,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b,c)}return Zb(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(Hc);Ac.pausable=function(a){return new kd(this,a)};var ld=function(b){function c(b){var c,d=[],e=W(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 rd,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,b.call(this,c,a)}return Zb(d,b),d.prototype.pause=function(){this.controller.onNext(!1)},d.prototype.resume=function(){this.controller.onNext(!0)},d}(Hc);Ac.pausableBuffered=function(a){return new ld(this,a)};var md=function(a){function b(a){return this.source.subscribe(a)}function c(c,d){a.call(this,b,c),this.subject=new nd(d),this.source=c.multicast(this.subject).refCount()}return Zb(c,a),c.prototype.request=function(a){return null==a&&(a=-1),this.subject.request(a)},c}(Hc),nd=function(a){function b(a){return this.subject.subscribe(a)}function c(c){null==c&&(c=!0),a.call(this,b),this.subject=new rd,this.enableQueue=c,this.queue=c?[]:null,this.requestedCount=0,this.requestedDisposable=fc,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=fc}return Zb(c,a),$b(c.prototype,Dc,{onCompleted:function(){this.hasCompleted=!0,(!this.enableQueue||0===this.queue.length)&&this.subject.onCompleted()},onError:function(a){this.hasFailed=!0,this.error=a,(!this.enableQueue||0===this.queue.length)&&this.subject.onError(a)},onNext:function(a){var b=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(a):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),b=!0),b&&this.subject.onNext(a)},_processRequest:function(a){if(this.enableQueue){for(;this.queue.length>=a&&a>0;)this.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=fc):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=fc),{numberOfItems:a,returnValue:!1}},request:function(a){this.disposeCurrentRequest();var b=this,c=this._processRequest(a),a=c.numberOfItems;return c.returnValue?fc:(this.requestedCount=a,this.requestedDisposable=ec(function(){b.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=fc}}),c}(Hc);Ac.controlled=function(a){return null==a&&(a=!0),new md(this,a)},Ac.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 od(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)})},c)};var od=bb.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?ec(a):fc}function c(a,c){var d=c[0],e=c[1];try{d.setDisposable(b(e(d)))}catch(f){if(!d.fail(f))throw f}}function d(b,d){function e(a){var d=new pd(a),e=[d,b];return oc.scheduleRequired()?oc.scheduleWithState(e,c):c(null,e),d}this.source=d,a.call(this,e)}return Zb(d,a),d}(Hc),pd=function(a){function b(b){a.call(this),this.observer=b,this.m=new hc}Zb(b,a);var c=b.prototype;return c.next=function(a){var b=p(this.observer.onNext).call(this.observer,a);return b===Xb?(this.dispose(),q(b.e)):void 0},c.error=function(a){var b=p(this.observer.onError).call(this.observer,a);return this.dispose(),b===Xb?q(b.e):void 0},c.completed=function(){var a=p(this.observer.onCompleted).call(this.observer);return this.dispose(),a===Xb?q(a.e):void 0},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Fc),qd=function(a,b){this.subject=a,this.observer=b};qd.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 rd=bb.Subject=function(a){function d(a){return b(this),this.isStopped?this.hasError?(a.onError(this.error),fc):(a.onCompleted(),fc):(this.observers.push(a),new qd(this,a))}function e(){a.call(this,d),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return Zb(e,a),$b(e.prototype,Dc.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b(this),!this.isStopped){this.isStopped=!0;for(var a=0,d=c(this.observers),e=d.length;e>a;a++)d[a].onCompleted();this.observers.length=0}},onError:function(a){if(b(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onError(a);this.observers.length=0}},onNext:function(a){if(b(this),!this.isStopped)for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),e.create=function(a,b){return new td(a,b)},e}(Hc),sd=bb.AsyncSubject=function(a){function d(a){return b(this),this.isStopped?(this.hasError?a.onError(this.error):this.hasValue?(a.onNext(this.value),a.onCompleted()):a.onCompleted(),fc):(this.observers.push(a),new qd(this,a))}function e(){a.call(this,d),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return Zb(e,a),$b(e.prototype,Dc,{hasObservers:function(){return b(this),this.observers.length>0},onCompleted:function(){var a,d;if(b(this),!this.isStopped){this.isStopped=!0;var e=c(this.observers),d=e.length;if(this.hasValue)for(a=0;d>a;a++){var f=e[a];f.onNext(this.value),f.onCompleted()}else for(a=0;d>a;a++)e[a].onCompleted();this.observers.length=0}},onError:function(a){if(b(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onError(a);this.observers.length=0}},onNext:function(a){b(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),e}(Hc),td=bb.AnonymousSubject=function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){this.observer=c,this.observable=d,a.call(this,b)}return Zb(c,a),$b(c.prototype,Dc.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(Hc),ud=bb.BehaviorSubject=function(a){function d(a){return b(this),this.isStopped?(this.hasError?a.onError(this.error):a.onCompleted(),fc):(this.observers.push(a),a.onNext(this.value),new qd(this,a))}function e(b){a.call(this,d),this.value=b,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.hasError=!1}return Zb(e,a),$b(e.prototype,Dc,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b(this),!this.isStopped){this.isStopped=!0;for(var a=0,d=c(this.observers),e=d.length;e>a;a++)d[a].onCompleted();this.observers.length=0}},onError:function(a){if(b(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onError(a);this.observers.length=0}},onNext:function(a){if(b(this),!this.isStopped){this.value=a;for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),e}(Hc),vd=bb.ReplaySubject=function(a){function d(a,b){return ec(function(){b.dispose(),!a.isDisposed&&a.observers.splice(a.observers.indexOf(b),1)})}function e(a){var c=new Ic(this.scheduler,a),e=d(this,c);b(this),this._trim(this.scheduler.now()),this.observers.push(c);for(var f=0,g=this.q.length;g>f;f++)c.onNext(this.q[f].value);return this.hasError?c.onError(this.error):this.isStopped&&c.onCompleted(),c.ensureActive(),e}function f(b,c,d){this.bufferSize=null==b?Number.MAX_VALUE:b,this.windowSize=null==c?Number.MAX_VALUE:c,this.scheduler=d||oc,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,e)}return Zb(f,a),$b(f.prototype,Dc.prototype,{hasObservers:function(){return this.observers.length>0},_trim:function(a){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&a-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(a){if(b(this),!this.isStopped){var d=this.scheduler.now();this.q.push({interval:d,value:a}),this._trim(d);for(var e=0,f=c(this.observers),g=f.length;g>e;e++){var h=f[e];h.onNext(a),h.ensureActive()}}},onError:function(a){if(b(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var d=this.scheduler.now();this._trim(d);for(var e=0,f=c(this.observers),g=f.length;g>e;e++){var h=f[e];h.onError(a),h.ensureActive()}this.observers.length=0}},onCompleted:function(){if(b(this),!this.isStopped){this.isStopped=!0;var a=this.scheduler.now();this._trim(a);for(var d=0,e=c(this.observers),f=e.length;f>d;d++){var g=e[d];g.onCompleted(),g.ensureActive()}this.observers.length=0}},dispose:function(){this.isDisposed=!0,this.observers=null}}),f}(Hc);bb.Pauser=function(a){function b(){a.call(this)}return Zb(b,a),b.prototype.pause=function(){this.onNext(!1)},b.prototype.resume=function(){this.onNext(!0)},b}(rd),"function"==typeof define&&"object"==typeof define.amd&&define.amd?(Y.Rx=bb,define(function(){return bb})):Z&&$?_?($.exports=bb).Rx=bb:Z.Rx=bb:Y.Rx=bb;var wd=h()}).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(a){if(a.isDisposed)throw new Error(cb)}function c(a){for(var b=[],c=0,d=a.length;d>c;c++)b.push(a[c]);return b}function d(a,b){if(db&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(hb)){for(var c=[],d=b;d;d=d.source)d.stack&&c.unshift(d.stack);c.unshift(a.stack);var f=c.join("\n"+hb+"\n");a.stack=e(f)}}function e(a){for(var b=a.split("\n"),c=[],d=0,e=b.length;e>d;d++){var h=b[d];f(h)||g(h)||!h||c.push(h)}return c.join("\n")}function f(a){var b=j(a);if(!b)return!1;var c=b[0],d=b[1];return c===fb&&d>=gb&&Yc>=d}function g(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function h(){if(db)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=j(c);if(!d)return;return fb=d[0],d[1]}}function j(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}function k(a){var b=[];if(!Jb(a))return b;Ib.nonEnumArgs&&a.length&&Kb(a)&&(a=Mb.call(a));var c=Ib.enumPrototypes&&"function"==typeof a,d=Ib.enumErrorProps&&(a===Db||a instanceof Error);for(var e in a)c&&"prototype"==e||d&&("message"==e||"name"==e)||b.push(e);if(Ib.nonEnumShadows&&a!==Eb){var f=a.constructor,g=-1,h=pb;if(a===(f&&f.prototype))var i=a===Fb?zb:a===Db?ub:Ab.call(a),j=Hb[i];for(;++g<h;)e=ob[g],j&&j[e]||!Bb.call(a,e)||b.push(e)}return b}function l(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 m(a,b){return l(a,b,k)}function n(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function o(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,f=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=f&&"object"!=f))return!1;var g=Ab.call(a),h=Ab.call(b);if(g==qb&&(g=xb),h==qb&&(h=xb),g!=h)return!1;switch(g){case sb:case tb:return+a==+b;case wb:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case yb:case zb:return a==String(b)}var i=g==rb;if(!i){if(g!=xb||!Ib.nodeClass&&(n(a)||n(b)))return!1;var j=!Ib.argsObject&&Kb(a)?Object:a.constructor,k=!Ib.argsObject&&Kb(b)?Object:b.constructor;if(!(j==k||Bb.call(a,"constructor")&&Bb.call(b,"constructor")||ab(j)&&j instanceof j&&ab(k)&&k instanceof k||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var l=c.length;l--;)if(c[l]==a)return d[l]==b;var p=0,q=!0;if(c.push(a),d.push(b),i){if(l=a.length,p=b.length,q=p==l)for(;p--;){var r=b[p];if(!(q=o(a[p],r,c,d)))break}}else m(b,function(b,e,f){return Bb.call(f,e)?(p++,q=Bb.call(a,e)&&o(a[e],b,c,d)):void 0}),q&&m(a,function(a,b,c){return Bb.call(c,b)?q=--p>-1:void 0});return c.pop(),d.pop(),q}function p(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function q(a,b){this.id=a,this.value=b}function r(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function t(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function u(){this._s=s}function v(){this._s=s,this._l=s.length,this._i=0}function w(a){this._a=a}function x(a){this._a=a,this._l=B(a),this._i=0}function y(a){return"number"==typeof a&&O.isFinite(a)}function z(b){var c,d=b[ib];if(!d&&"string"==typeof b)return c=new u(b),c[ib]();if(!d&&b.length!==a)return c=new w(b),c[ib]();if(!d)throw new TypeError("Object is not iterable");return b[ib]()}function A(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function B(a){var b=+a.length;return isNaN(b)?0:0!==b&&y(b)?(b=A(b)*Math.floor(Math.abs(b)),0>=b?0:b>Ec?Ec:b):b}function C(a,b){return V(a)||(a=dc),new Tc(function(c){var d=0,e=b.length;return a.scheduleRecursive(function(a){e>d?(c.onNext(b[d++]),a()):c.onCompleted()})})}function D(a,b){return new Tc(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)}_(f)&&(f=Bc(f)),d=new Xb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e},a)}function E(a,b){var c=this;return new Tc(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 d.onError(i)}d.onNext(g)}else d.onCompleted()},function(a){d.onError(a)},function(){d.onCompleted()})},c)}function F(){return!1}function G(){return[]}function H(a,b,c){var d=nb(b,c,3);return a.map(function(b,c){var e=d(b,c,a);return _(e)&&(e=Bc(e)),(lb(e)||kb(e))&&(e=Fc(e)),e}).concatAll()}function I(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function J(a){this.comparer=a,this.set=[]}function K(a,b,c){this.observer=a,this.selector=b,this.source=c,this.index=0,this.isStopped=!1}function L(a,b,c){var d=nb(b,c,3);return a.map(function(b,c){var e=d(b,c,a);return _(e)&&(e=Bc(e)),(lb(e)||kb(e))&&(e=Fc(e)),e}).mergeAll()}function M(a,b,c){this.observer=a,this.predicate=b,this.source=c,this.index=0,this.isStopped=!1}var N={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},O=N[typeof window]&&window||this,P=N[typeof exports]&&exports&&!exports.nodeType&&exports,Q=N[typeof module]&&module&&!module.nodeType&&module,R=Q&&Q.exports===P&&P,S=N[typeof global]&&global;!S||S.global!==S&&S.window!==S||(O=S);var T={internals:{},config:{Promise:O.Promise},helpers:{}},U=T.helpers.noop=function(){},V=(T.helpers.notDefined=function(a){return"undefined"==typeof a},T.helpers.isScheduler=function(a){return a instanceof T.Scheduler}),W=T.helpers.identity=function(a){return a},X=(T.helpers.pluck=function(a){return function(b){return b[a]}},T.helpers.just=function(a){return function(){return a}},T.helpers.defaultNow=Date.now),Y=T.helpers.defaultComparer=function(a,b){return Lb(a,b)},Z=T.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},$=(T.helpers.defaultKeySerializer=function(a){return a.toString()},T.helpers.defaultError=function(a){throw a}),_=T.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},ab=(T.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},T.helpers.not=function(a){return!a},T.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==Ab.call(a)}),a}()),bb="Argument out of range",cb="Object has been disposed";T.config.longStackSupport=!1;var db=!1;try{throw new Error}catch(eb){db=!!eb.stack}var fb,gb=h(),hb="From previous event:",ib="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";O.Set&&"function"==typeof(new O.Set)["@@iterator"]&&(ib="@@iterator");var jb=T.doneEnumerator={done:!0,value:a},kb=T.helpers.isIterable=function(b){return b[ib]!==a},lb=T.helpers.isArrayLike=function(b){return b&&b.length!==a};T.helpers.iterator=ib;var mb,nb=T.internals.bindCallback=function(a,b,c){if("undefined"==typeof b)return a;switch(c){case 0:return function(){return a.call(b)};case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)}}return function(){return a.apply(b,arguments)}},ob=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],pb=ob.length,qb="[object Arguments]",rb="[object Array]",sb="[object Boolean]",tb="[object Date]",ub="[object Error]",vb="[object Function]",wb="[object Number]",xb="[object Object]",yb="[object RegExp]",zb="[object String]",Ab=Object.prototype.toString,Bb=Object.prototype.hasOwnProperty,Cb=Ab.call(arguments)==qb,Db=Error.prototype,Eb=Object.prototype,Fb=String.prototype,Gb=Eb.propertyIsEnumerable;try{mb=!(Ab.call(document)==xb&&!({toString:0}+""))}catch(eb){mb=!0}var Hb={};Hb[rb]=Hb[tb]=Hb[wb]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},Hb[sb]=Hb[zb]={constructor:!0,toString:!0,valueOf:!0},Hb[ub]=Hb[vb]=Hb[yb]={constructor:!0,toString:!0},Hb[xb]={constructor:!0};var Ib={};!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);Ib.enumErrorProps=Gb.call(Db,"message")||Gb.call(Db,"name"),Ib.enumPrototypes=Gb.call(a,"prototype"),Ib.nonEnumArgs=0!=c,Ib.nonEnumShadows=!/valueOf/.test(b)}(1);var Jb=T.internals.isObject=function(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1},Kb=function(a){return a&&"object"==typeof a?Ab.call(a)==qb:!1};Cb||(Kb=function(a){return a&&"object"==typeof a?Bb.call(a,"callee"):!1});var Lb=T.internals.isEqual=function(a,b){return o(a,b,[],[])},Mb=({}.hasOwnProperty,Array.prototype.slice),Nb=this.inherits=T.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c},Ob=T.internals.addProperties=function(a){for(var b=[],c=1,d=arguments.length;d>c;c++)b.push(arguments[c]);for(var e=0,f=b.length;f>e;e++){var g=b[e];for(var h in g)a[h]=g[h]}},Pb=T.internals.addRef=function(a,b){return new Tc(function(c){return new Sb(b.getDisposable(),a.subscribe(c))})};q.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var Qb=T.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(b){this.items[b]=this.items[--this.length],this.items[this.length]=a,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 q(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=T.CompositeDisposable=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);this.disposables=a,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;for(var a=[],b=0,c=this.disposables.length;c>b;b++)a.push(this.disposables[b]);for(this.disposables=[],this.length=0,b=0,c=a.length;c>b;b++)a[b].dispose()}},Tb.toArray=function(){for(var a=[],b=this.disposables.length;b>i;i++)a.push(this.disposables[i]);return a};var Ub=T.Disposable=function(a){this.isDisposed=!1,this.action=a||U};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:U},Xb=T.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=this.isDisposed;if(!b){var c=this.current;this.current=a}c&&c.dispose(),b&&a&&a.dispose()},b.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()},a}(),Yb=T.SerialDisposable=Xb,Zb=T.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}();r.prototype.dispose=function(){this.scheduler.scheduleWithState(this,t)};var $b=T.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||Z,this.disposable=new Xb};$b.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},$b.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},$b.prototype.isCancelled=function(){return this.disposable.isDisposed},$b.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var _b=T.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=X,a.normalize=function(a){return 0>a&&(a=0),a},a}(),ac=_b.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](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")})}}(_b.prototype),function(){_b.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},_b.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof O.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=O.setInterval(function(){d=c(d)},b);return Vb(function(){O.clearInterval(e)})}}(_b.prototype),function(a){a.catchError=a["catch"]=function(a){return new ic(this,a)}}(_b.prototype);var bc,cc=(T.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}(),_b.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=this.now()+ac(b);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new _b(X,a,b,c)}()),dc=_b.currentThread=function(){function a(a){for(;a.length>0;){var b=a.dequeue();if(!b.isCancelled()){for(;b.dueTime-_b.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()+_b.normalize(c),g=new $b(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 _b(X,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),ec=U,fc=function(){var a,b=U;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!O.setTimeout)throw new Error("No concurrency detected!");a=O.setTimeout,b=O.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),gc=fc.setTimeout,hc=fc.clearTimeout;!function(){function a(){if(!O.postMessage||O.importScripts)return!1;var a=!1,b=O.onmessage;return O.onmessage=function(){a=!0},O.postMessage("","*"),O.onmessage=b,a}var b=RegExp("^"+String(Ab).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),c="function"==typeof(c=S&&R&&S.setImmediate)&&!b.test(c)&&c,d="function"==typeof(d=S&&R&&S.clearImmediate)&&!b.test(d)&&d;if("function"==typeof c)bc=c,ec=d;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))bc=process.nextTick;else if(a()){var e="ms.rx.schedule"+Math.random(),f={},g=0,h=function(a){if("string"==typeof a.data&&a.data.substring(0,e.length)===e){var b=a.data.substring(e.length),c=f[b];c(),delete f[b]}};O.addEventListener?O.addEventListener("message",h,!1):O.attachEvent("onmessage",h,!1),bc=function(a){var b=g++;f[b]=a,O.postMessage(e+b,"*")}}else if(O.MessageChannel){var i=new O.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},bc=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in O&&"onreadystatechange"in O.document.createElement("script")?bc=function(a){var b=O.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},O.document.documentElement.appendChild(b)}:(bc=function(a){return gc(a,0)},ec=hc)}();var ic=(_b.timeout=function(){function a(a,b){var c=this,d=new Xb,e=bc(function(){d.isDisposed||d.setDisposable(b(c,a))});return new Sb(d,Vb(function(){ec(e)}))}function b(a,b,c){var d=this,e=_b.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new Xb,g=gc(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new Sb(f,Vb(function(){hc(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new _b(X,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}(_b)),jc=T.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 V(a)||(a=cc),new Tc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),kc=jc.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 jc("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),lc=jc.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 jc("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),mc=jc.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new jc("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),nc=T.internals.Enumerator=function(a){this._next=a};nc.prototype.next=function(){return this._next()},nc.prototype[ib]=function(){return this};var oc=T.internals.Enumerable=function(a){this._iterator=a};oc.prototype[ib]=function(){return this._iterator()},oc.prototype.concat=function(){var a=this;return new Tc(function(b){var c,d=a[ib](),e=new Yb,f=cc.scheduleRecursive(function(a){if(!c){try{var f=d.next()}catch(g){return b.onError(g)}if(f.done)return b.onCompleted();var h=f.value;_(h)&&(h=Bc(h));var i=new Xb;e.setDisposable(i),i.setDisposable(h.subscribe(function(a){b.onNext(a)},function(a){b.onError(a)},a))}});return new Sb(e,f,Vb(function(){c=!0}))})},oc.prototype.catchError=function(){var a=this;return new Tc(function(b){var c,d=a[ib](),e=new Yb,f=cc.scheduleRecursiveWithState(null,function(a,f){if(!c){try{var g=d.next()}catch(h){return observer.onError(h)}if(g.done)return void(null!==a?b.onError(a):b.onCompleted());var i=g.value;_(i)&&(i=Bc(i));var j=new Xb;e.setDisposable(j),j.setDisposable(i.subscribe(function(a){b.onNext(a)},f,function(){b.onCompleted()}))}});return new Sb(e,f,Vb(function(){c=!0}))})},oc.prototype.catchErrorWhen=function(a){var b=this;return new Tc(function(c){var d,e,f=new Wc,g=new Wc,h=a(f),i=h.subscribe(g),j=b[ib](),k=new Yb,l=cc.scheduleRecursive(function(a){if(!d){try{var b=j.next()}catch(h){return c.onError(h)}if(b.done)return void(e?c.onError(e):c.onCompleted());var i=b.value;_(i)&&(i=Bc(i));var l=new Xb,m=new Xb;k.setDisposable(new Sb(m,l)),l.setDisposable(i.subscribe(function(a){c.onNext(a)},function(b){m.setDisposable(g.subscribe(a,function(a){c.onError(a)},function(){c.onCompleted()})),f.onNext(b)},function(){c.onCompleted()}))}});return new Sb(i,k,l,Vb(function(){d=!0}))})};var pc=oc.repeat=function(a,b){return null==b&&(b=-1),new oc(function(){var c=b;return new nc(function(){return 0===c?jb:(c>0&&c--,{done:!1,value:a})})})},qc=oc.of=function(a,b,c){if(b)var d=nb(b,c,3);return new oc(function(){var c=-1;return new nc(function(){return++c<a.length?{done:!1,value:b?d(a[c],c,a):a[c]}:jb})})},rc=T.Observer=function(){};rc.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},rc.prototype.asObserver=function(){return new vc(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},rc.prototype.checked=function(){return new wc(this)};var sc=rc.create=function(a,b,c){return a||(a=U),b||(b=$),c||(c=U),new vc(a,b,c)};rc.fromNotifier=function(a,b){return new vc(function(c){return a.call(b,kc(c))},function(c){return a.call(b,lc(c))},function(){return a.call(b,mc())})},rc.prototype.notifyOn=function(a){return new yc(a,this)},rc.prototype.makeSafe=function(a){return new AnonymousSafeObserver(this._onNext,this._onError,this._onCompleted,a)};var tc,uc=T.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}(rc),vc=T.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}(uc),wc=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}(rc),xc=T.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}(uc),yc=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}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.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(xc),zc=T.Observable=function(){function a(a){if(T.config.longStackSupport&&db){try{throw new Error}catch(b){this.stack=b.stack.substring(b.stack.indexOf("\n")+1)}var c=this;this._subscribe=function(b){var e=b.onError.bind(b);return b.onError=function(a){d(a,c),e(a)},a.call(c,b)}}else this._subscribe=a}return tc=a.prototype,tc.subscribe=tc.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:sc(a,b,c))},tc.subscribeOnNext=function(a,b){return this._subscribe(sc("undefined"!=typeof b?function(c){a.call(b,c)}:a))},tc.subscribeOnError=function(a,b){return this._subscribe(sc(null,"undefined"!=typeof b?function(c){a.call(b,c)}:a))},tc.subscribeOnCompleted=function(a,b){return this._subscribe(sc(null,null,"undefined"!=typeof b?function(){a.call(b)}:a))},a}(),Ac=T.ObservableBase=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?Vb(a):Wb}function c(a,c){var d=c[0],e=c[1];try{d.setDisposable(b(e.subscribeCore(d)))}catch(f){if(!d.fail(f))throw f}}function d(a){var b=new Uc(a),d=[b,this];return dc.scheduleRequired()?dc.scheduleWithState(d,c):c(null,d),b}function e(){a.call(this,d)}return Nb(e,a),e.prototype.subscribeCore=function(){throw new Error("Not implemeneted")},e}(zc);tc.observeOn=function(a){var b=this;return new Tc(function(c){return b.subscribe(new yc(a,c))},b)},tc.subscribeOn=function(a){var b=this;return new Tc(function(c){var d=new Xb,e=new Yb;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new r(a,b.subscribe(c)))})),e},b)};var Bc=zc.fromPromise=function(a){return Cc(function(){var b=new T.AsyncSubject;return a.then(function(a){b.onNext(a),b.onCompleted()},b.onError.bind(b)),b})};tc.toPromise=function(a){if(a||(a=T.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)})})},tc.toArray=function(){var a=this;return new Tc(function(b){var c=[];return a.subscribe(function(a){c.push(a)},function(a){b.onError(a)},function(){b.onNext(c),b.onCompleted()})},a)},zc.create=zc.createWithDisposable=function(a,b){return new Tc(a,b)};var Cc=zc.defer=function(a){return new Tc(function(b){var c;try{c=a()}catch(d){return Lc(d).subscribe(b)}return _(c)&&(c=Bc(c)),c.subscribe(b)})},Dc=zc.empty=function(a){return V(a)||(a=cc),new Tc(function(b){return a.schedule(function(){b.onCompleted()})})},Ec=Math.pow(2,53)-1;u.prototype[ib]=function(){return new v(this._s)},v.prototype[ib]=function(){return this},v.prototype.next=function(){if(this._i<this._l){var a=this._s.charAt(this._i++);return{done:!1,value:a}}return jb},w.prototype[ib]=function(){return new x(this._a)},x.prototype[ib]=function(){return this},x.prototype.next=function(){if(this._i<this._l){var a=this._a[this._i++];return{done:!1,value:a}}return jb};var Fc=zc.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!ab(b))throw new Error("mapFn when provided must be a function");if(b)var e=nb(b,c,2);V(d)||(d=dc);var f=Object(a),g=z(f);return new Tc(function(a){return d.scheduleRecursiveWithState(0,function(b,c){try{var d=g.next()}catch(f){return void a.onError(f)}if(d.done)return void a.onCompleted();var h=d.value;if(e)try{h=e(h,b)}catch(f){return void a.onError(f)}a.onNext(h),c(b+1)})})},Gc=function(a){function b(b,c){this.args=b,this.scheduler=c||dc,a.call(this)}return Nb(b,a),b.prototype.subscribeCore=function(a){var b=new Hc(a,this);return b.run()},b}(Ac),Hc=function(){function a(a,b){this.observer=a,this.parent=b}function b(a,b){a.i<a.len?(a.observer.onNext(a.args[a.i++]),b(a)):a.observer.onCompleted()}return a.prototype.run=function(){return this.parent.scheduler.scheduleRecursiveWithState({i:0,args:this.parent.args,len:this.parent.args.length,observer:this.observer},b)},a}(),Ic=zc.fromArray=function(a,b){return new Gc(a,b)};zc.generate=function(a,b,c,d,e){return V(e)||(e=dc),new Tc(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 Jc=zc.never=function(){return new Tc(function(){return Wb})};zc.of=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return C(null,a)},zc.ofWithScheduler=function(a){for(var b=[],c=1,d=arguments.length;d>c;c++)b.push(arguments[c]);return C(a,b)},zc.pairs=function(a,b){return b||(b=T.Scheduler.currentThread),new Tc(function(c){var d=Object.keys(a),e=d.length;return b.scheduleRecursiveWithState(0,function(b,f){if(e>b){var g=d[b];c.onNext([g,a[g]]),f(b+1)}else c.onCompleted()})})},zc.range=function(a,b,c){return V(c)||(c=dc),new Tc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},zc.repeat=function(a,b,c){return V(c)||(c=dc),Kc(a,c).repeat(null==b?-1:b)};var Kc=zc["return"]=zc.just=function(a,b){return V(b)||(b=cc),new Tc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})};zc.returnValue=function(){return Kc.apply(null,arguments)};var Lc=zc["throw"]=zc.throwError=function(a,b){return V(b)||(b=cc),new Tc(function(c){return b.schedule(function(){c.onError(a)})})};zc.throwException=function(){return zc.throwError.apply(null,arguments)},zc.using=function(a,b){return new Tc(function(c){var d,e,f=Wb;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new Sb(Lc(g).subscribe(c),f)}return new Sb(e.subscribe(c),f)})},tc.amb=function(a){var b=this;return new Tc(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 _(a)&&(a=Bc(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)})},zc.amb=function(){function a(a,b){return a.amb(b)}var b=Jc(),c=[];if(Array.isArray(arguments[0]))c=arguments[0];else for(var d=0,e=arguments.length;e>d;d++)c.push(arguments[d]);for(var d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},tc["catch"]=tc.catchError=function(a){return"function"==typeof a?D(this,a):Mc([this,a])},tc.catchException=function(a){return this.catchError(a)};var Mc=zc.catchError=zc["catch"]=zc.catchException=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return qc(a).catchError()};tc.combineLatest=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),Nc.apply(this,a)};var Nc=zc.combineLatest=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);var d=a.pop();return Array.isArray(a[0])&&(a=a[0]),new Tc(function(b){function c(a){var c;if(h[a]=!0,i||(i=h.every(W))){try{c=d.apply(null,k)}catch(e){return void b.onError(e)}b.onNext(c)}else j.filter(function(b,c){return c!==a}).every(W)&&b.onCompleted()}function e(a){j[a]=!0,j.every(W)&&b.onCompleted()}for(var f=function(){return!1},g=a.length,h=p(g,f),i=!1,j=p(g,f),k=new Array(g),l=new Array(g),m=0;g>m;m++)!function(d){var f=a[d],g=new Xb;_(f)&&(f=Bc(f)),g.setDisposable(f.subscribe(function(a){k[d]=a,c(d)},function(a){b.onError(a)},function(){e(d)})),l[d]=g}(m);return new Sb(l)},this)};tc.concat=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return a.unshift(this),Oc.apply(null,a)};var Oc=zc.concat=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return qc(a).concat()};tc.concatAll=tc.concatObservable=function(){return this.merge(1)},tc.merge=function(a){if("number"!=typeof a)return Pc(this,a);var b=this;return new Tc(function(c){function d(a){var b=new Xb;f.add(b),_(a)&&(a=Bc(a)),b.setDisposable(a.subscribe(function(a){c.onNext(a)},function(a){c.onError(a)},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)},function(a){c.onError(a)},function(){g=!0,0===e&&c.onCompleted()})),f},b)};var Pc=zc.merge=function(){var a,b,c=[],d=arguments.length;if(arguments[0])if(V(arguments[0]))for(a=arguments[0],b=1;d>b;b++)c.push(arguments[b]);else for(a=cc,b=0;d>b;b++)c.push(arguments[b]);else for(a=cc,b=1;d>b;b++)c.push(arguments[b]);return Array.isArray(c[0])&&(c=c[0]),C(a,c).mergeAll()};tc.mergeAll=function(){var a=this;return new Tc(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),_(a)&&(a=Bc(a)),e.setDisposable(a.subscribe(function(a){b.onNext(a)},function(a){b.onError(a)},function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},function(a){b.onError(a)},function(){d=!0,1===c.length&&b.onCompleted()})),c},a)},tc.mergeObservable=function(){return this.mergeAll.apply(this,arguments)},tc.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return Qc([this,a])};var Qc=zc.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return new Tc(function(b){var c=0,d=new Yb,e=cc.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],_(f)&&(f=Bc(f)),g=new Xb,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new Sb(d,e)})};tc.skipUntil=function(a){var b=this;return new Tc(function(c){var d=!1,e=new Sb(b.subscribe(function(a){d&&c.onNext(a)},function(a){c.onError(a)},function(){d&&c.onCompleted()}));_(a)&&(a=Bc(a));var f=new Xb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},function(a){c.onError(a)},function(){f.dispose()})),e},b)},tc["switch"]=tc.switchLatest=function(){var a=this;return new Tc(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),_(a)&&(a=Bc(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())}))},function(a){b.onError(a)},function(){e=!0,!c&&b.onCompleted()});return new Sb(g,d)},a)},tc.takeUntil=function(a){var b=this;return new Tc(function(c){return _(a)&&(a=Bc(a)),new Sb(b.subscribe(c),a.subscribe(function(){c.onCompleted()},function(a){c.onError(a)},U))},b)},tc.withLatestFrom=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);var d=a.pop(),e=this;if("undefined"==typeof e)throw new Error("Source observable not found for withLatestFrom().");if("function"!=typeof d)throw new Error("withLatestFrom() expects a resultSelector function.");return Array.isArray(a[0])&&(a=a[0]),new Tc(function(b){for(var c=function(){return!1},f=a.length,g=p(f,c),h=!1,i=new Array(f),j=new Array(f+1),k=0;f>k;k++)!function(c){var d=a[c],e=new Xb;_(d)&&(d=Bc(d)),e.setDisposable(d.subscribe(function(a){i[c]=a,g[c]=!0,h=g.every(W)},b.onError.bind(b),function(){})),j[c]=e}(k);var l=new Xb;return l.setDisposable(e.subscribe(function(a){var c,e=[a].concat(i);if(h){try{c=d.apply(null,e)}catch(f){return void b.onError(f)}b.onNext(c)}},b.onError.bind(b),function(){b.onCompleted()})),j[f]=l,new Sb(j)},this)},tc.zip=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);if(Array.isArray(a[0]))return E.apply(this,a);var d=this,e=a.pop();return a.unshift(d),new Tc(function(b){function c(a){var c,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),c=e.apply(d,f)}catch(g){return void b.onError(g)}b.onNext(c)}else i.filter(function(b,c){return c!==a}).every(W)&&b.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&b.onCompleted()}for(var g=a.length,h=p(g,G),i=p(g,F),j=new Array(g),k=0;g>k;k++)!function(d){var e=a[d],g=new Xb;_(e)&&(e=Bc(e)),g.setDisposable(e.subscribe(function(a){h[d].push(a),c(d)},function(a){b.onError(a)},function(){f(d)})),j[d]=g}(k);return new Sb(j)},d)},zc.zip=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);var d=a.shift();return d.zip.apply(d,a)},zc.zipArray=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return new Tc(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(W))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(W)?void b.onCompleted():void 0}for(var e=a.length,f=p(e,function(){return[]}),g=p(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)},function(a){b.onError(a)},function(){d(e)}))}(i);return new Sb(h)})},tc.asObservable=function(){var a=this;return new Tc(function(b){return a.subscribe(b)},this)},tc.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})},tc.dematerialize=function(){var a=this;return new Tc(function(b){return a.subscribe(function(a){return a.accept(b)},function(a){b.onError(a)},function(){b.onCompleted()})},this)},tc.distinctUntilChanged=function(a,b){var c=this;return b||(b=Y),new Tc(function(d){var e,f=!1;return c.subscribe(function(c){var g=c;if(a)try{g=a(c)}catch(h){return void d.onError(h)}if(f)try{var i=b(e,g)}catch(h){return void d.onError(h)}f&&i||(f=!0,e=g,d.onNext(c))},function(a){d.onError(a)},function(){d.onCompleted()})},this)},tc["do"]=tc.tap=tc.doAction=function(a,b,c){var d=this,e="function"==typeof a||"undefined"==typeof a?sc(a||U,b||U,c||U):a;return new Tc(function(a){return d.subscribe(function(b){try{e.onNext(b)}catch(c){a.onError(c)}a.onNext(b)},function(b){try{e.onError(b)}catch(c){a.onError(c)}a.onError(b)},function(){try{e.onCompleted()}catch(b){a.onError(b)}a.onCompleted()})},this)},tc.doOnNext=tc.tapOnNext=function(a,b){return this.tap("undefined"!=typeof b?function(c){a.call(b,c)}:a)},tc.doOnError=tc.tapOnError=function(a,b){return this.tap(U,"undefined"!=typeof b?function(c){a.call(b,c)}:a)},tc.doOnCompleted=tc.tapOnCompleted=function(a,b){return this.tap(U,null,"undefined"!=typeof b?function(){a.call(b)}:a)},tc["finally"]=tc.ensure=function(a){var b=this;return new Tc(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()}})},this)},tc.finallyAction=function(a){return this.ensure(a)},tc.ignoreElements=function(){var a=this;return new Tc(function(b){return a.subscribe(U,function(a){b.onError(a)},function(){b.onCompleted()})},a)},tc.materialize=function(){var a=this;return new Tc(function(b){return a.subscribe(function(a){b.onNext(kc(a))},function(a){b.onNext(lc(a)),b.onCompleted()},function(){b.onNext(mc()),b.onCompleted()})},a)},tc.repeat=function(a){return pc(this,a).concat()},tc.retry=function(a){return pc(this,a).catchError()},tc.retryWhen=function(a){return pc(this).catchErrorWhen(a)},tc.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 Tc(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)},function(a){e.onError(a)},function(){!h&&c&&e.onNext(a),e.onCompleted()})},d)},tc.skipLast=function(a){var b=this;return new Tc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},function(a){c.onError(a)},function(){c.onCompleted()})},b)},tc.startWith=function(){var a,b=0;arguments.length&&V(arguments[0])?(a=arguments[0],b=1):a=cc;for(var c=[],d=b,e=arguments.length;e>d;d++)c.push(arguments[d]);return qc([Ic(c,a),this]).concat()},tc.takeLast=function(a){var b=this;return new Tc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})},b)},tc.takeLastBuffer=function(a){var b=this;return new Tc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){c.onNext(d),c.onCompleted()})},b)},tc.windowWithCount=function(a,b){var c=this;if(+a||(a=0),1/0===Math.abs(a)&&(a=0),0>=a)throw new Error(bb);if(null==b&&(b=a),+b||(b=0),1/0===Math.abs(b)&&(b=0),0>=b)throw new Error(bb);return new Tc(function(d){function e(){var a=new Wc;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},c)},tc.selectConcat=tc.concatMap=function(a,b,c){return ab(a)&&ab(b)?this.concatMap(function(c,d){var e=a(c,d);return _(e)&&(e=Bc(e)),(lb(e)||kb(e))&&(e=Fc(e)),e.map(function(a,e){return b(c,a,d,e)})}):ab(a)?H(this,a,c):H(this,function(){return a})},tc.concatMapObserver=tc.selectConcatObserver=function(a,b,c,d){var e=this,f=nb(a,d,2),g=nb(b,d,1),h=nb(c,d,0);return new Tc(function(a){var b=0;return e.subscribe(function(c){var d;try{d=f(c,b++)}catch(e){return void a.onError(e)}_(d)&&(d=Bc(d)),a.onNext(d)},function(b){var c;try{c=g(b)}catch(d){return void a.onError(d)}_(c)&&(c=Bc(c)),a.onNext(c),a.onCompleted()},function(){var b;try{b=h()}catch(c){return void a.onError(c)}_(b)&&(b=Bc(b)),a.onNext(b),a.onCompleted()})},this).concatAll()},tc.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new Tc(function(a){var d=!1;return c.subscribe(function(b){d=!0,a.onNext(b)},function(b){a.onError(b)},function(){!d&&a.onNext(b),a.onCompleted()})},c)},J.prototype.push=function(a){var b=-1===I(this.set,a,this.comparer);return b&&this.set.push(a),b},tc.distinct=function(a,b){var c=this;return b||(b=Y),new Tc(function(d){var e=new J(b);return c.subscribe(function(b){var c=b;if(a)try{c=a(b)}catch(f){return void d.onError(f)}e.push(c)&&d.onNext(b)},function(a){d.onError(a)},function(){d.onCompleted()})},this)};var Rc=function(a){function b(b,c,d){this.source=b,this.selector=nb(c,d,3),a.call(this)}return Nb(b,a),b.prototype.internalMap=function(a,c){var d=this;return new b(this.source,function(b,c,e){return a(d.selector(b,c,e),c,e)},c)},b.prototype.subscribeCore=function(a){return this.source.subscribe(new K(a,this.selector,this))},b}(Ac);K.prototype.onNext=function(a){if(!this.isStopped){try{var b=this.selector(a,this.index++,this.source)}catch(c){return this.observer.onError(c)}this.observer.onNext(b)}},K.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.observer.onError(a))},K.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.observer.onCompleted())},K.prototype.dispose=function(){this.isStopped=!0},K.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},tc.map=tc.select=function(a,b){var c="function"==typeof a?a:function(){return a};return this instanceof Rc?this.internalMap(a,b):new Rc(this,c,b)},tc.pluck=function(){var b=arguments,c=arguments.length;if(0===c)throw new Error("List of properties cannot be empty.");return this.map(function(d){for(var e=d,f=0;c>f;f++){var g=e[b[f]];if("undefined"==typeof g)return a;e=g}return e})},tc.flatMapObserver=tc.selectManyObserver=function(a,b,c,d){var e=this;return new Tc(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)}_(c)&&(c=Bc(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}_(c)&&(c=Bc(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}_(a)&&(a=Bc(a)),f.onNext(a),f.onCompleted()})},e).mergeAll()},tc.selectMany=tc.flatMap=function(a,b,c){return ab(a)&&ab(b)?this.flatMap(function(c,d){var e=a(c,d);return _(e)&&(e=Bc(e)),(lb(e)||kb(e))&&(e=Fc(e)),e.map(function(a,e){return b(c,a,d,e)})},c):ab(a)?L(this,a,c):L(this,function(){return a})},tc.selectSwitch=tc.flatMapLatest=tc.switchMap=function(a,b){return this.select(a,b).switchLatest()},tc.skip=function(a){if(0>a)throw new Error(bb);var b=this;return new Tc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},function(a){c.onError(a)},function(){c.onCompleted()})},b)},tc.skipWhile=function(a,b){var c=this,d=nb(a,b,3);return new Tc(function(a){var b=0,e=!1;return c.subscribe(function(f){if(!e)try{e=!d(f,b++,c)}catch(g){return void a.onError(g)}e&&a.onNext(f)},function(b){a.onError(b)},function(){a.onCompleted()})},c)},tc.take=function(a,b){if(0>a)throw new RangeError(bb);if(0===a)return Dc(b);var c=this;return new Tc(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},function(a){b.onError(a)},function(){b.onCompleted()})},c)},tc.takeWhile=function(a,b){var c=this,d=nb(a,b,3);return new Tc(function(a){var b=0,e=!0;return c.subscribe(function(f){if(e){try{e=d(f,b++,c)}catch(g){return void a.onError(g)}e?a.onNext(f):a.onCompleted()}},function(b){a.onError(b)},function(){a.onCompleted()})},c)};var Sc=function(a){function b(b,c,d){this.source=b,this.predicate=nb(c,d,3),a.call(this)}return Nb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new M(a,this.predicate,this))},b.prototype.internalFilter=function(a,c){var d=this;return new b(this.source,function(b,c,e){return d.predicate(b,c,e)&&a(b,c,e)},c)},b}(Ac);M.prototype.onNext=function(a){try{var b=this.predicate(a,this.index++,this.source)}catch(c){return this.observer.onError(c)}b&&this.observer.onNext(a)},M.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.observer.onError(a))},M.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.observer.onCompleted())},M.prototype.dispose=function(){this.isStopped=!0},M.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},tc.filter=tc.where=function(a,b){return this instanceof Sc?this.internalFilter(a,b):new Sc(this,a,b)},tc.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 Tc(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)})},c)};var Tc=T.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?Vb(a):Wb}function c(a,c){var d=c[0],e=c[1];try{d.setDisposable(b(e(d)))}catch(f){if(!d.fail(f))throw f}}function d(b,d){function e(a){var d=new Uc(a),e=[d,b];return dc.scheduleRequired()?dc.scheduleWithState(e,c):c(null,e),d}this.source=d,a.call(this,e)}return Nb(d,a),d}(zc),Uc=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.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(uc),Vc=function(a,b){this.subject=a,this.observer=b};Vc.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 Wc=T.Subject=function(a){function d(a){return b(this),this.isStopped?this.hasError?(a.onError(this.error),Wb):(a.onCompleted(),Wb):(this.observers.push(a),new Vc(this,a))}function e(){a.call(this,d),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return Nb(e,a),Ob(e.prototype,rc.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b(this),!this.isStopped){this.isStopped=!0;for(var a=0,d=c(this.observers),e=d.length;e>a;a++)d[a].onCompleted();this.observers.length=0}},onError:function(a){if(b(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onError(a);this.observers.length=0}},onNext:function(a){if(b(this),!this.isStopped)for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),e.create=function(a,b){return new Xc(a,b)},e}(zc),Xc=(T.AsyncSubject=function(a){function d(a){return b(this),this.isStopped?(this.hasError?a.onError(this.error):this.hasValue?(a.onNext(this.value),a.onCompleted()):a.onCompleted(),Wb):(this.observers.push(a),new Vc(this,a))}function e(){a.call(this,d),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return Nb(e,a),Ob(e.prototype,rc,{hasObservers:function(){return b(this),this.observers.length>0},onCompleted:function(){var a,d;if(b(this),!this.isStopped){this.isStopped=!0;var e=c(this.observers),d=e.length;if(this.hasValue)for(a=0;d>a;a++){var f=e[a];f.onNext(this.value),f.onCompleted()}else for(a=0;d>a;a++)e[a].onCompleted();this.observers.length=0}},onError:function(a){if(b(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onError(a);this.observers.length=0}},onNext:function(a){b(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),e}(zc),T.AnonymousSubject=function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){this.observer=c,this.observable=d,a.call(this,b)}return Nb(c,a),Ob(c.prototype,rc.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(zc));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(O.Rx=T,define(function(){return T})):P&&Q?R?(Q.exports=T).Rx=T:P.Rx=T:O.Rx=T;var Yc=h()}).call(this);
(function(a){function b(a){if(a.isDisposed)throw new Error(gb)}function c(a){for(var b=[],c=0,d=a.length;d>c;c++)b.push(a[c]);return b}function d(a,b){if(hb&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(lb)){for(var c=[],d=b;d;d=d.source)d.stack&&c.unshift(d.stack);c.unshift(a.stack);var f=c.join("\n"+lb+"\n");a.stack=e(f)}}function e(a){for(var b=a.split("\n"),c=[],d=0,e=b.length;e>d;d++){var h=b[d];f(h)||g(h)||!h||c.push(h)}return c.join("\n")}function f(a){var b=i(a);if(!b)return!1;var c=b[0],d=b[1];return c===jb&&d>=kb&&ld>=d}function g(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function h(){if(hb)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=i(c);if(!d)return;return jb=d[0],d[1]}}function i(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}function j(a){var b=[];if(!Nb(a))return b;Mb.nonEnumArgs&&a.length&&Ob(a)&&(a=Rb.call(a));var c=Mb.enumPrototypes&&"function"==typeof a,d=Mb.enumErrorProps&&(a===Hb||a instanceof Error);for(var e in a)c&&"prototype"==e||d&&("message"==e||"name"==e)||b.push(e);if(Mb.nonEnumShadows&&a!==Ib){var f=a.constructor,g=-1,h=tb;if(a===(f&&f.prototype))var i=a===Jb?Db:a===Hb?yb:Eb.call(a),j=Lb[i];for(;++g<h;)e=sb[g],j&&j[e]||!Fb.call(a,e)||b.push(e)}return b}function k(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 l(a,b){return k(a,b,j)}function m(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function n(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,f=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=f&&"object"!=f))return!1;var g=Eb.call(a),h=Eb.call(b);if(g==ub&&(g=Bb),h==ub&&(h=Bb),g!=h)return!1;switch(g){case wb:case xb:return+a==+b;case Ab:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case Cb:case Db:return a==String(b)}var i=g==vb;if(!i){if(g!=Bb||!Mb.nodeClass&&(m(a)||m(b)))return!1;var j=!Mb.argsObject&&Ob(a)?Object:a.constructor,k=!Mb.argsObject&&Ob(b)?Object:b.constructor;if(!(j==k||Fb.call(a,"constructor")&&Fb.call(b,"constructor")||eb(j)&&j instanceof j&&eb(k)&&k instanceof k||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var o=c.length;o--;)if(c[o]==a)return d[o]==b;var p=0,q=!0;if(c.push(a),d.push(b),i){if(o=a.length,p=b.length,q=p==o)for(;p--;){var r=b[p];if(!(q=n(a[p],r,c,d)))break}}else l(b,function(b,e,f){return Fb.call(f,e)?(p++,q=Fb.call(a,e)&&n(a[e],b,c,d)):void 0}),q&&l(a,function(a,b,c){return Fb.call(c,b)?q=--p>-1:void 0});return c.pop(),d.pop(),q}function o(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function p(){try{return Pb.apply(this,arguments)}catch(a){return Vb.e=a,Vb}}function q(a){if(!eb(a))throw new TypeError("fn must be a function");return Pb=a,p}function r(a){throw a}function t(a,b){this.id=a,this.value=b}function u(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function v(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function w(a){this.observer=a,this.a=[],this.isStopped=!1}function x(){this._s=s}function y(){this._s=s,this._l=s.length,this._i=0}function z(a){this._a=a}function A(a){this._a=a,this._l=E(a),this._i=0}function B(a){return"number"==typeof a&&S.isFinite(a)}function C(b){var c,d=b[mb];if(!d&&"string"==typeof b)return c=new x(b),c[mb]();if(!d&&b.length!==a)return c=new z(b),c[mb]();if(!d)throw new TypeError("Object is not iterable");return b[mb]()}function D(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function E(a){var b=+a.length;return isNaN(b)?0:0!==b&&B(b)?(b=D(b)*Math.floor(Math.abs(b)),0>=b?0:b>Nc?Nc:b):b}function F(a,b){this.observer=a,this.parent=b}function G(a,b){return new Pc(b,a)}function H(a,b){return new gd(function(c){var d=new cc,e=new dc;return e.setDisposable(d),d.setDisposable(a.subscribe(function(a){c.onNext(a)},function(a){try{var d=b(a)}catch(f){return c.onError(f)}db(d)&&(d=Hc(d));var g=new cc;e.setDisposable(g),g.setDisposable(d.subscribe(c))},function(a){c.onCompleted(a)})),e},a)}function I(a,b){var c=this;return new gd(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 d.onError(i)}d.onNext(g)}else d.onCompleted()},function(a){d.onError(a)},function(){d.onCompleted()})},c)}function J(){return!1}function K(){return[]}function L(a,b,c){var d=rb(b,c,3);return a.map(function(b,c){var e=d(b,c,a);return db(e)&&(e=Hc(e)),(pb(e)||ob(e))&&(e=Oc(e)),e}).concatAll()}function M(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function N(a){this.comparer=a,this.set=[]}function O(a,b,c){this.observer=a,this.selector=b,this.source=c,this.i=0,this.isStopped=!1}function P(a,b,c){var d=rb(b,c,3);return a.map(function(b,c){var e=d(b,c,a);return db(e)&&(e=Hc(e)),(pb(e)||ob(e))&&(e=Oc(e)),e}).mergeAll()}function Q(a,b,c){this.observer=a,this.predicate=b,this.source=c,this.i=0,this.isStopped=!1}var R={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},S=R[typeof window]&&window||this,T=R[typeof exports]&&exports&&!exports.nodeType&&exports,U=R[typeof module]&&module&&!module.nodeType&&module,V=U&&U.exports===T&&T,W=R[typeof global]&&global;!W||W.global!==W&&W.window!==W||(S=W);var X={internals:{},config:{Promise:S.Promise},helpers:{}},Y=X.helpers.noop=function(){},Z=(X.helpers.notDefined=function(a){return"undefined"==typeof a},X.helpers.isScheduler=function(a){return a instanceof X.Scheduler}),$=X.helpers.identity=function(a){return a},_=(X.helpers.pluck=function(a){return function(b){return b[a]}},X.helpers.just=function(a){return function(){return a}},X.helpers.defaultNow=Date.now),ab=X.helpers.defaultComparer=function(a,b){return Qb(a,b)},bb=X.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},cb=(X.helpers.defaultKeySerializer=function(a){return a.toString()},X.helpers.defaultError=function(a){throw a}),db=X.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},eb=(X.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},X.helpers.not=function(a){return!a},X.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==Eb.call(a)}),a}()),fb="Argument out of range",gb="Object has been disposed";X.config.longStackSupport=!1;var hb=!1;try{throw new Error}catch(ib){hb=!!ib.stack}var jb,kb=h(),lb="From previous event:",mb="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";S.Set&&"function"==typeof(new S.Set)["@@iterator"]&&(mb="@@iterator");var nb=X.doneEnumerator={done:!0,value:a},ob=X.helpers.isIterable=function(b){return b[mb]!==a},pb=X.helpers.isArrayLike=function(b){return b&&b.length!==a};X.helpers.iterator=mb;var qb,rb=X.internals.bindCallback=function(a,b,c){if("undefined"==typeof b)return a;switch(c){case 0:return function(){return a.call(b)};case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)}}return function(){return a.apply(b,arguments)}},sb=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],tb=sb.length,ub="[object Arguments]",vb="[object Array]",wb="[object Boolean]",xb="[object Date]",yb="[object Error]",zb="[object Function]",Ab="[object Number]",Bb="[object Object]",Cb="[object RegExp]",Db="[object String]",Eb=Object.prototype.toString,Fb=Object.prototype.hasOwnProperty,Gb=Eb.call(arguments)==ub,Hb=Error.prototype,Ib=Object.prototype,Jb=String.prototype,Kb=Ib.propertyIsEnumerable;try{qb=!(Eb.call(document)==Bb&&!({toString:0}+""))}catch(ib){qb=!0}var Lb={};Lb[vb]=Lb[xb]=Lb[Ab]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},Lb[wb]=Lb[Db]={constructor:!0,toString:!0,valueOf:!0},Lb[yb]=Lb[zb]=Lb[Cb]={constructor:!0,toString:!0},Lb[Bb]={constructor:!0};var Mb={};!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);Mb.enumErrorProps=Kb.call(Hb,"message")||Kb.call(Hb,"name"),Mb.enumPrototypes=Kb.call(a,"prototype"),Mb.nonEnumArgs=0!=c,Mb.nonEnumShadows=!/valueOf/.test(b)}(1);var Nb=X.internals.isObject=function(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1},Ob=function(a){return a&&"object"==typeof a?Eb.call(a)==ub:!1};Gb||(Ob=function(a){return a&&"object"==typeof a?Fb.call(a,"callee"):!1});var Pb,Qb=X.internals.isEqual=function(a,b){return n(a,b,[],[])},Rb=({}.hasOwnProperty,Array.prototype.slice),Sb=this.inherits=X.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c},Tb=X.internals.addProperties=function(a){for(var b=[],c=1,d=arguments.length;d>c;c++)b.push(arguments[c]);for(var e=0,f=b.length;f>e;e++){var g=b[e];for(var h in g)a[h]=g[h]}},Ub=X.internals.addRef=function(a,b){return new gd(function(c){return new Yb(b.getDisposable(),a.subscribe(c))})},Vb={e:{}};t.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var Wb=X.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(b){this.items[b]=this.items[--this.length],this.items[this.length]=a,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 t(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=X.CompositeDisposable=function(){var a,b,c=[];if(Array.isArray(arguments[0]))c=arguments[0],b=c.length;else for(b=arguments.length,c=new Array(b),a=0;b>a;a++)c[a]=arguments[a];for(a=0;b>a;a++)if(!bc(c[a]))throw new TypeError("Not a disposable");this.disposables=c,this.isDisposed=!1,this.length=c.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;for(var a=this.disposables.length,b=new Array(a),c=0;a>c;c++)b[c]=this.disposables[c];for(this.disposables=[],this.length=0,c=0;a>c;c++)b[c].dispose()}};var $b=X.Disposable=function(a){this.isDisposed=!1,this.action=a||Y};$b.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var _b=$b.create=function(a){return new $b(a)},ac=$b.empty={dispose:Y},bc=$b.isDisposable=function(a){return a&&eb(a.dispose)},cc=X.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=this.isDisposed;if(!b){var c=this.current;this.current=a}c&&c.dispose(),b&&a&&a.dispose()},b.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()},a}(),dc=X.SerialDisposable=cc,ec=X.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?ac:new a(this)},b}();u.prototype.dispose=function(){this.scheduler.scheduleWithState(this,v)};var fc=X.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||bb,this.disposable=new cc};fc.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},fc.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},fc.prototype.isCancelled=function(){return this.disposable.isDisposed},fc.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};{var gc=X.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(),ac}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=_,a.normalize=function(a){return 0>a&&(a=0),a},a}();gc.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),ac});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](b,d,function(a,b){return e?f.remove(i):h=!0,g(b),ac});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")})}}(gc.prototype),function(){gc.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},gc.prototype.schedulePeriodicWithState=function(a,b,c){if("undefined"==typeof S.setInterval)throw new Error("Periodic scheduling not supported.");var d=a,e=S.setInterval(function(){d=c(d)},b);return _b(function(){S.clearInterval(e)})}}(gc.prototype),function(a){a.catchError=a["catch"]=function(a){return new oc(this,a)}}(gc.prototype);var hc,ic=(X.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 cc;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),gc.immediate=function(){function a(a,b){return b(this,a)}function b(){throw new Error("Not supported")}return new gc(_,a,b,b)}()),jc=gc.currentThread=function(){function a(){for(;d.length>0;){var a=d.dequeue();a.isCancelled()||!a.isCancelled()&&a.invoke()}}function b(b,c){var e=new fc(this,b,c,this.now());if(d)d.enqueue(e);else{d=new Wb(4),d.enqueue(e);var f=q(a)();if(d=null,f===Vb)return r(f.e)}return e.disposable}function c(){throw new Error("Not supported")}var d,e=new gc(_,b,c,c);return e.scheduleRequired=function(){return!d},e.ensureTrampoline=function(a){d?a():this.schedule(a)},e}(),kc=Y,lc=function(){var a,b=Y;if("WScript"in this)a=function(a,b){WScript.Sleep(b),a()};else{if(!S.setTimeout)throw new Error("No concurrency detected!");a=S.setTimeout,b=S.clearTimeout}return{setTimeout:a,clearTimeout:b}}(),mc=lc.setTimeout,nc=lc.clearTimeout;!function(){function a(){if(!S.postMessage||S.importScripts)return!1;var a=!1,b=S.onmessage;return S.onmessage=function(){a=!0},S.postMessage("","*"),S.onmessage=b,a}var b=RegExp("^"+String(Eb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),c="function"==typeof(c=W&&V&&W.setImmediate)&&!b.test(c)&&c,d="function"==typeof(d=W&&V&&W.clearImmediate)&&!b.test(d)&&d;if("function"==typeof c)hc=c,kc=d;else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))hc=process.nextTick;else if(a()){var e="ms.rx.schedule"+Math.random(),f={},g=0,h=function(a){if("string"==typeof a.data&&a.data.substring(0,e.length)===e){var b=a.data.substring(e.length),c=f[b];c(),delete f[b]}};S.addEventListener?S.addEventListener("message",h,!1):S.attachEvent("onmessage",h,!1),hc=function(a){var b=g++;f[b]=a,S.postMessage(e+b,"*")}}else if(S.MessageChannel){var i=new S.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},hc=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in S&&"onreadystatechange"in S.document.createElement("script")?hc=function(a){var b=S.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},S.document.documentElement.appendChild(b)}:(hc=function(a){return mc(a,0)},kc=nc)}();var oc=(gc.timeout=function(){function a(a,b){var c=this,d=new cc,e=hc(function(){d.isDisposed||d.setDisposable(b(c,a))});return new Yb(d,_b(function(){kc(e)}))}function b(a,b,c){var d=this,e=gc.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new cc,g=mc(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new Yb(f,_b(function(){nc(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new gc(_,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 Sb(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 ac}}},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 cc;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}(gc)),pc=X.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 Z(a)||(a=ic),new gd(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),qc=pc.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 pc("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),rc=pc.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 pc("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),sc=pc.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new pc("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),tc=X.internals.Enumerator=function(a){this._next=a};tc.prototype.next=function(){return this._next()},tc.prototype[mb]=function(){return this};var uc=X.internals.Enumerable=function(a){this._iterator=a};uc.prototype[mb]=function(){return this._iterator()},uc.prototype.concat=function(){var a=this;return new gd(function(b){var c,d=a[mb](),e=new dc,f=ic.scheduleRecursive(function(a){if(!c){try{var f=d.next()}catch(g){return b.onError(g)}if(f.done)return b.onCompleted();var h=f.value;db(h)&&(h=Hc(h));var i=new cc;e.setDisposable(i),i.setDisposable(h.subscribe(function(a){b.onNext(a)},function(a){b.onError(a)},a))}});return new Yb(e,f,_b(function(){c=!0}))})},uc.prototype.catchError=function(){var a=this;return new gd(function(b){var c,d=a[mb](),e=new dc,f=ic.scheduleRecursiveWithState(null,function(a,f){if(!c){try{var g=d.next()}catch(h){return observer.onError(h)}if(g.done)return void(null!==a?b.onError(a):b.onCompleted());var i=g.value;db(i)&&(i=Hc(i));var j=new cc;e.setDisposable(j),j.setDisposable(i.subscribe(function(a){b.onNext(a)},f,function(){b.onCompleted()}))}});return new Yb(e,f,_b(function(){c=!0}))})},uc.prototype.catchErrorWhen=function(a){var b=this;return new gd(function(c){var d,e,f=new jd,g=new jd,h=a(f),i=h.subscribe(g),j=b[mb](),k=new dc,l=ic.scheduleRecursive(function(a){if(!d){try{var b=j.next()}catch(h){return c.onError(h)}if(b.done)return void(e?c.onError(e):c.onCompleted());var i=b.value;db(i)&&(i=Hc(i));var l=new cc,m=new cc;k.setDisposable(new Yb(m,l)),l.setDisposable(i.subscribe(function(a){c.onNext(a)},function(b){m.setDisposable(g.subscribe(a,function(a){c.onError(a)},function(){c.onCompleted()})),f.onNext(b)},function(){c.onCompleted()}))}});return new Yb(i,k,l,_b(function(){d=!0}))})};var vc=uc.repeat=function(a,b){return null==b&&(b=-1),new uc(function(){var c=b;return new tc(function(){return 0===c?nb:(c>0&&c--,{done:!1,value:a})})})},wc=uc.of=function(a,b,c){if(b)var d=rb(b,c,3);return new uc(function(){var c=-1;return new tc(function(){return++c<a.length?{done:!1,value:b?d(a[c],c,a):a[c]}:nb})})},xc=X.Observer=function(){};xc.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},xc.prototype.asObserver=function(){return new Bc(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},xc.prototype.checked=function(){return new Cc(this)};var yc=xc.create=function(a,b,c){return a||(a=Y),b||(b=cb),c||(c=Y),new Bc(a,b,c)};xc.fromNotifier=function(a,b){return new Bc(function(c){return a.call(b,qc(c))},function(c){return a.call(b,rc(c))},function(){return a.call(b,sc())})},xc.prototype.notifyOn=function(a){return new Ec(a,this)},xc.prototype.makeSafe=function(a){return new AnonymousSafeObserver(this._onNext,this._onError,this._onCompleted,a)};var zc,Ac=X.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}function c(){throw new Error("Method not implemented")}return Sb(b,a),b.prototype.next=c,b.prototype.error=c,b.prototype.completed=c,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}(xc),Bc=X.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return Sb(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}(Ac),Cc=function(a){function b(b){a.call(this),this._observer=b,this._state=0}Sb(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}(xc),Dc=X.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 dc}return Sb(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}(Ac),Ec=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return Sb(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(Dc),Fc=X.Observable=function(){function a(a){if(X.config.longStackSupport&&hb){try{throw new Error}catch(b){this.stack=b.stack.substring(b.stack.indexOf("\n")+1)}var c=this;this._subscribe=function(b){var e=b.onError.bind(b);return b.onError=function(a){d(a,c),e(a)},a.call(c,b)}}else this._subscribe=a}return zc=a.prototype,zc.subscribe=zc.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:yc(a,b,c))},zc.subscribeOnNext=function(a,b){return this._subscribe(yc("undefined"!=typeof b?function(c){a.call(b,c)}:a))},zc.subscribeOnError=function(a,b){return this._subscribe(yc(null,"undefined"!=typeof b?function(c){a.call(b,c)}:a))},zc.subscribeOnCompleted=function(a,b){return this._subscribe(yc(null,null,"undefined"!=typeof b?function(){a.call(b)}:a))},a}(),Gc=X.ObservableBase=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?_b(a):ac}function c(a,c){var d=c[0],e=c[1],f=q(e.subscribeCore).call(e,d);return f!==Vb||d.fail(Vb.e)?void d.setDisposable(b(f)):r(Vb.e)}function d(a){var b=new hd(a),d=[b,this];return jc.scheduleRequired()?jc.scheduleWithState(d,c):c(null,d),b}function e(){a.call(this,d)}return Sb(e,a),e.prototype.subscribeCore=function(){throw new Error("Not implemeneted")},e}(Fc);zc.observeOn=function(a){var b=this;return new gd(function(c){return b.subscribe(new Ec(a,c))},b)},zc.subscribeOn=function(a){var b=this;return new gd(function(c){var d=new cc,e=new dc;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new u(a,b.subscribe(c)))})),e},b)};var Hc=Fc.fromPromise=function(a){return Jc(function(){var b=new X.AsyncSubject;return a.then(function(a){b.onNext(a),b.onCompleted()},b.onError.bind(b)),b})};zc.toPromise=function(a){if(a||(a=X.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)})})};var Ic=function(a){function b(b){this.source=b,a.call(this)}return Sb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new w(a))},b}(Gc);w.prototype.onNext=function(a){this.isStopped||this.a.push(a)},w.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.observer.onError(a))},w.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.observer.onNext(this.a),this.observer.onCompleted())},w.prototype.dispose=function(){this.isStopped=!0},w.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},zc.toArray=function(){return new Ic(this)},Fc.create=Fc.createWithDisposable=function(a,b){return new gd(a,b)};var Jc=Fc.defer=function(a){return new gd(function(b){var c;try{c=a()}catch(d){return Vc(d).subscribe(b)}return db(c)&&(c=Hc(c)),c.subscribe(b)})},Kc=Fc.empty=function(a){return Z(a)||(a=ic),new gd(function(b){return a.schedule(function(){b.onCompleted()})})},Lc=function(a){function b(b,c,d){this.iterable=b,this.mapper=c,this.scheduler=d,a.call(this)}return Sb(b,a),b.prototype.subscribeCore=function(a){var b=new Mc(a,this);return b.run()},b}(Gc),Mc=function(){function a(a,b){this.observer=a,this.parent=b}return a.prototype.run=function(){function a(a,b){try{var f=c.next()}catch(g){return d.onError(g)}if(f.done)return d.onCompleted();var h=f.value;if(e)try{h=e(h,a)}catch(g){return d.onError(g)}d.onNext(h),b(a+1)}var b=Object(this.parent.iterable),c=C(b),d=this.observer,e=this.parent.mapper;return this.parent.scheduler.scheduleRecursiveWithState(0,a)},a}(),Nc=Math.pow(2,53)-1;x.prototype[mb]=function(){return new y(this._s)},y.prototype[mb]=function(){return this},y.prototype.next=function(){return this._i<this._l?{done:!1,value:this._s.charAt(this._i++)}:nb},z.prototype[mb]=function(){return new A(this._a)},A.prototype[mb]=function(){return this},A.prototype.next=function(){return this._i<this._l?{done:!1,value:this._a[this._i++]}:nb};var Oc=Fc.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!eb(b))throw new Error("mapFn when provided must be a function");if(b)var e=rb(b,c,2);return Z(d)||(d=jc),new Lc(a,e,d)},Pc=function(a){function b(b,c){this.args=b,this.scheduler=c||jc,a.call(this)}return Sb(b,a),b.prototype.subscribeCore=function(a){var b=new F(a,this);return b.run()},b}(Gc);F.prototype.run=function(){function a(a,e){d>a?(b.onNext(c[a]),e(a+1)):b.onCompleted()}var b=this.observer,c=this.parent.args,d=c.length;return this.parent.scheduler.scheduleRecursiveWithState(0,a)};var Qc=Fc.fromArray=function(a,b){return new Pc(a,b)};Fc.generate=function(a,b,c,d,e){return Z(e)||(e=jc),new gd(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 Rc=Fc.never=function(){return new gd(function(){return ac})};Fc.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return new Pc(b)},Fc.ofWithScheduler=function(a){for(var b=arguments.length,c=new Array(b-1),d=1;b>d;d++)c[d-1]=arguments[d];return new Pc(c,a)},Fc.pairs=function(a,b){return b||(b=X.Scheduler.currentThread),new gd(function(c){var d=Object.keys(a),e=d.length;return b.scheduleRecursiveWithState(0,function(b,f){if(e>b){var g=d[b];c.onNext([g,a[g]]),f(b+1)}else c.onCompleted()})})};var Sc=function(a){function b(b,c,d){this.start=b,this.count=c,this.scheduler=d,a.call(this)}return Sb(b,a),b.prototype.subscribeCore=function(a){var b=new Tc(a,this);
return b.run()},b}(Gc),Tc=function(){function a(a,b){this.observer=a,this.parent=b}return a.prototype.run=function(){function a(a,e){c>a?(d.onNext(b+a),e(a+1)):d.onCompleted()}var b=this.parent.start,c=this.parent.count,d=this.observer;return this.parent.scheduler.scheduleRecursiveWithState(0,a)},a}();Fc.range=function(a,b,c){return Z(c)||(c=jc),new Sc(a,b,c)},Fc.repeat=function(a,b,c){return Z(c)||(c=jc),Uc(a,c).repeat(null==b?-1:b)};var Uc=Fc["return"]=Fc.just=function(a,b){return Z(b)||(b=ic),new gd(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})};Fc.returnValue=function(){return Uc.apply(null,arguments)};var Vc=Fc["throw"]=Fc.throwError=function(a,b){return Z(b)||(b=ic),new gd(function(c){return b.schedule(function(){c.onError(a)})})};Fc.throwException=function(){return Fc.throwError.apply(null,arguments)},Fc.using=function(a,b){return new gd(function(c){var d,e,f=ac;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new Yb(Vc(g).subscribe(c),f)}return new Yb(e.subscribe(c),f)})},zc.amb=function(a){var b=this;return new gd(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new cc,j=new cc;return db(a)&&(a=Hc(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 Yb(i,j)})},Fc.amb=function(){function a(a,b){return a.amb(b)}var b=Rc(),c=[];if(Array.isArray(arguments[0]))c=arguments[0];else for(var d=0,e=arguments.length;e>d;d++)c.push(arguments[d]);for(var d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},zc["catch"]=zc.catchError=zc.catchException=function(a){return"function"==typeof a?H(this,a):Wc([this,a])};var Wc=Fc.catchError=Fc["catch"]=Fc.catchException=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return wc(a).catchError()};zc.combineLatest=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return Array.isArray(b[0])?b[0].unshift(this):b.unshift(this),Xc.apply(this,b)};var Xc=Fc.combineLatest=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=b.pop();return a--,Array.isArray(b[0])&&(b=b[0]),new gd(function(c){function e(a){if(h[a]=!0,i||(i=h.every($))){try{var b=d.apply(null,k)}catch(e){return void c.onError(e)}c.onNext(b)}else j.filter(function(b,c){return c!==a}).every($)&&c.onCompleted()}function f(a){j[a]=!0,j.every($)&&c.onCompleted()}for(var g=function(){return!1},h=o(a,g),i=!1,j=o(a,g),k=new Array(a),l=new Array(a),m=0;a>m;m++)!function(a){var d=b[a],g=new cc;db(d)&&(d=Hc(d)),g.setDisposable(d.subscribe(function(b){k[a]=b,e(a)},function(a){c.onError(a)},function(){f(a)})),l[a]=g}(m);return new Yb(l)},this)};zc.concat=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return a.unshift(this),Yc.apply(null,a)};var Yc=Fc.concat=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{a=new Array(arguments.length);for(var b=0,c=arguments.length;c>b;b++)a[b]=arguments[b]}return wc(a).concat()};zc.concatAll=zc.concatObservable=function(){return this.merge(1)};var Zc=function(a){function b(b,c){this.source=b,this.maxConcurrent=c,a.call(this)}return Sb(b,a),b.prototype.subscribeCore=function(a){var b=new Yb;return b.add(this.source.subscribe(new $c(a,this.maxConcurrent,b))),b},b}(Gc),$c=function(){function a(a,b,c){this.o=a,this.max=b,this.g=c,this.done=!1,this.q=[],this.activeCount=0,this.isStopped=!1}function b(a,b){this.parent=a,this.sad=b,this.isStopped=!1}return a.prototype.handleSubscribe=function(a){var c=new cc;this.g.add(c),db(a)&&(a=Hc(a)),c.setDisposable(a.subscribe(new b(this,c)))},a.prototype.onNext=function(a){this.isStopped||(this.activeCount<this.max?(this.activeCount++,this.handleSubscribe(a)):this.q.push(a))},a.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},a.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,0===this.activeCount&&this.o.onCompleted())},a.prototype.dispose=function(){this.isStopped=!0},a.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},b.prototype.onNext=function(a){this.isStopped||this.parent.o.onNext(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.parent.o.onError(a))},b.prototype.onCompleted=function(){if(!this.isStopped){var a=this.parent;a.g.remove(this.sad),a.q.length>0?a.handleSubscribe(a.q.shift()):(a.activeCount--,a.done&&0===a.activeCount&&a.o.onCompleted())}},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(a),!0)},a}();zc.merge=function(a){return"number"!=typeof a?_c(this,a):new Zc(this,a)};var _c=Fc.merge=function(){var a,b,c=[],d=arguments.length;if(arguments[0])if(Z(arguments[0]))for(a=arguments[0],b=1;d>b;b++)c.push(arguments[b]);else for(a=ic,b=0;d>b;b++)c.push(arguments[b]);else for(a=ic,b=1;d>b;b++)c.push(arguments[b]);return Array.isArray(c[0])&&(c=c[0]),G(a,c).mergeAll()},ad=X.CompositeError=function(a){this.name="NotImplementedError",this.innerErrors=a,this.message="This contains multiple errors. Check the innerErrors",Error.call(this)};ad.prototype=Error.prototype,Fc.mergeDelayError=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}var d=G(null,a);return new gd(function(a){function b(){0===g.length?a.onCompleted():a.onError(1===g.length?g[0]:new ad(g))}var c=new Yb,e=new cc,f=!1,g=[];return c.add(e),e.setDisposable(d.subscribe(function(d){var e=new cc;c.add(e),db(d)&&(d=Hc(d)),e.setDisposable(d.subscribe(function(b){a.onNext(b)},function(a){g.push(a),c.remove(e),f&&1===c.length&&b()},function(){c.remove(e),f&&1===c.length&&b()}))},function(a){g.push(a),f=!0,1===c.length&&b()},function(){f=!0,1===c.length&&b()})),c})};var bd=function(a){function b(b){this.source=b,a.call(this)}return Sb(b,a),b.prototype.subscribeCore=function(a){var b=new Yb,c=new cc;return b.add(c),c.setDisposable(this.source.subscribe(new cd(a,b))),b},b}(Gc),cd=function(){function a(a,b){this.o=a,this.g=b,this.isStopped=!1,this.done=!1}function b(a,b,c){this.parent=a,this.g=b,this.sad=c,this.isStopped=!1}return a.prototype.onNext=function(a){if(!this.isStopped){var c=new cc;this.g.add(c),db(a)&&(a=Hc(a)),c.setDisposable(a.subscribe(new b(this,this.g,c)))}},a.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.o.onError(a))},a.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.done=!0,1===this.g.length&&this.o.onCompleted())},a.prototype.dispose=function(){this.isStopped=!0},a.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.o.onError(a),!0)},b.prototype.onNext=function(a){this.isStopped||this.parent.o.onNext(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.parent.o.onError(a))},b.prototype.onCompleted=function(){if(!this.isStopped){var a=this.parent;this.isStopped=!0,a.g.remove(this.sad),a.done&&1===a.g.length&&a.o.onCompleted()}},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.parent.o.onError(a),!0)},a}();zc.mergeAll=zc.mergeObservable=function(){return new bd(this)},zc.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return dd([this,a])};var dd=Fc.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return new gd(function(b){var c=0,d=new dc,e=ic.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],db(f)&&(f=Hc(f)),g=new cc,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new Yb(d,e)})};zc.skipUntil=function(a){var b=this;return new gd(function(c){var d=!1,e=new Yb(b.subscribe(function(a){d&&c.onNext(a)},function(a){c.onError(a)},function(){d&&c.onCompleted()}));db(a)&&(a=Hc(a));var f=new cc;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},function(a){c.onError(a)},function(){f.dispose()})),e},b)},zc["switch"]=zc.switchLatest=function(){var a=this;return new gd(function(b){var c=!1,d=new dc,e=!1,f=0,g=a.subscribe(function(a){var g=new cc,h=++f;c=!0,d.setDisposable(g),db(a)&&(a=Hc(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())}))},function(a){b.onError(a)},function(){e=!0,!c&&b.onCompleted()});return new Yb(g,d)},a)},zc.takeUntil=function(a){var b=this;return new gd(function(c){return db(a)&&(a=Hc(a)),new Yb(b.subscribe(c),a.subscribe(function(){c.onCompleted()},function(a){c.onError(a)},Y))},b)},zc.withLatestFrom=function(){for(var a=[],b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);var d=a.pop(),e=this;if("undefined"==typeof e)throw new Error("Source observable not found for withLatestFrom().");if("function"!=typeof d)throw new Error("withLatestFrom() expects a resultSelector function.");return Array.isArray(a[0])&&(a=a[0]),new gd(function(b){for(var c=function(){return!1},f=a.length,g=o(f,c),h=!1,i=new Array(f),j=new Array(f+1),k=0;f>k;k++)!function(c){var d=a[c],e=new cc;db(d)&&(d=Hc(d)),e.setDisposable(d.subscribe(function(a){i[c]=a,g[c]=!0,h=g.every($)},b.onError.bind(b),function(){})),j[c]=e}(k);var l=new cc;return l.setDisposable(e.subscribe(function(a){var c,e=[a].concat(i);if(h){try{c=d.apply(null,e)}catch(f){return void b.onError(f)}b.onNext(c)}},b.onError.bind(b),function(){b.onCompleted()})),j[f]=l,new Yb(j)},this)},zc.zip=function(){if(Array.isArray(arguments[0]))return I.apply(this,arguments);for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=this,e=b.pop();return b.unshift(d),new gd(function(a){function c(b){var c,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),c=e.apply(d,f)}catch(g){return void a.onError(g)}a.onNext(c)}else i.filter(function(a,c){return c!==b}).every($)&&a.onCompleted()}function f(b){i[b]=!0,i.every(function(a){return a})&&a.onCompleted()}for(var g=b.length,h=o(g,K),i=o(g,J),j=new Array(g),k=0;g>k;k++)!function(d){var e=b[d],g=new cc;db(e)&&(e=Hc(e)),g.setDisposable(e.subscribe(function(a){h[d].push(a),c(d)},function(b){a.onError(b)},function(){f(d)})),j[d]=g}(k);return new Yb(j)},d)},Fc.zip=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];var d=b.shift();return d.zip.apply(d,b)},Fc.zipArray=function(){var a;if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new gd(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($))return void b.onCompleted()}function d(a){return g[a]=!0,g.every($)?void b.onCompleted():void 0}for(var e=a.length,f=o(e,function(){return[]}),g=o(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new cc,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},function(a){b.onError(a)},function(){d(e)}))}(i);return new Yb(h)})},zc.asObservable=function(){var a=this;return new gd(function(b){return a.subscribe(b)},this)},zc.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})},zc.dematerialize=function(){var a=this;return new gd(function(b){return a.subscribe(function(a){return a.accept(b)},function(a){b.onError(a)},function(){b.onCompleted()})},this)},zc.distinctUntilChanged=function(a,b){var c=this;return b||(b=ab),new gd(function(d){var e,f=!1;return c.subscribe(function(c){var g=c;if(a)try{g=a(c)}catch(h){return void d.onError(h)}if(f)try{var i=b(e,g)}catch(h){return void d.onError(h)}f&&i||(f=!0,e=g,d.onNext(c))},function(a){d.onError(a)},function(){d.onCompleted()})},this)},zc["do"]=zc.tap=zc.doAction=function(a,b,c){var d=this,e="function"==typeof a||"undefined"==typeof a?yc(a||Y,b||Y,c||Y):a;return new gd(function(a){return d.subscribe(function(b){try{e.onNext(b)}catch(c){a.onError(c)}a.onNext(b)},function(b){try{e.onError(b)}catch(c){a.onError(c)}a.onError(b)},function(){try{e.onCompleted()}catch(b){a.onError(b)}a.onCompleted()})},this)},zc.doOnNext=zc.tapOnNext=function(a,b){return this.tap("undefined"!=typeof b?function(c){a.call(b,c)}:a)},zc.doOnError=zc.tapOnError=function(a,b){return this.tap(Y,"undefined"!=typeof b?function(c){a.call(b,c)}:a)},zc.doOnCompleted=zc.tapOnCompleted=function(a,b){return this.tap(Y,null,"undefined"!=typeof b?function(){a.call(b)}:a)},zc["finally"]=zc.ensure=function(a){var b=this;return new gd(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return _b(function(){try{d.dispose()}catch(b){throw b}finally{a()}})},this)},zc.finallyAction=function(a){return this.ensure(a)},zc.ignoreElements=function(){var a=this;return new gd(function(b){return a.subscribe(Y,function(a){b.onError(a)},function(){b.onCompleted()})},a)},zc.materialize=function(){var a=this;return new gd(function(b){return a.subscribe(function(a){b.onNext(qc(a))},function(a){b.onNext(rc(a)),b.onCompleted()},function(){b.onNext(sc()),b.onCompleted()})},a)},zc.repeat=function(a){return vc(this,a).concat()},zc.retry=function(a){return vc(this,a).catchError()},zc.retryWhen=function(a){return vc(this).catchErrorWhen(a)},zc.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 gd(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)},function(a){e.onError(a)},function(){!h&&c&&e.onNext(a),e.onCompleted()})},d)},zc.skipLast=function(a){var b=this;return new gd(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},function(a){c.onError(a)},function(){c.onCompleted()})},b)},zc.startWith=function(){var a,b=0;arguments.length&&Z(arguments[0])?(a=arguments[0],b=1):a=ic;for(var c=[],d=b,e=arguments.length;e>d;d++)c.push(arguments[d]);return wc([Qc(c,a),this]).concat()},zc.takeLast=function(a){var b=this;return new gd(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})},b)},zc.takeLastBuffer=function(a){var b=this;return new gd(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){c.onNext(d),c.onCompleted()})},b)},zc.windowWithCount=function(a,b){var c=this;if(+a||(a=0),1/0===Math.abs(a)&&(a=0),0>=a)throw new Error(fb);if(null==b&&(b=a),+b||(b=0),1/0===Math.abs(b)&&(b=0),0>=b)throw new Error(fb);return new gd(function(d){function e(){var a=new jd;i.push(a),d.onNext(Ub(a,g))}var f=new cc,g=new ec(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g},c)},zc.selectConcat=zc.concatMap=function(a,b,c){return eb(a)&&eb(b)?this.concatMap(function(c,d){var e=a(c,d);return db(e)&&(e=Hc(e)),(pb(e)||ob(e))&&(e=Oc(e)),e.map(function(a,e){return b(c,a,d,e)})}):eb(a)?L(this,a,c):L(this,function(){return a})},zc.concatMapObserver=zc.selectConcatObserver=function(a,b,c,d){var e=this,f=rb(a,d,2),g=rb(b,d,1),h=rb(c,d,0);return new gd(function(a){var b=0;return e.subscribe(function(c){var d;try{d=f(c,b++)}catch(e){return void a.onError(e)}db(d)&&(d=Hc(d)),a.onNext(d)},function(b){var c;try{c=g(b)}catch(d){return void a.onError(d)}db(c)&&(c=Hc(c)),a.onNext(c),a.onCompleted()},function(){var b;try{b=h()}catch(c){return void a.onError(c)}db(b)&&(b=Hc(b)),a.onNext(b),a.onCompleted()})},this).concatAll()},zc.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new gd(function(a){var d=!1;return c.subscribe(function(b){d=!0,a.onNext(b)},function(b){a.onError(b)},function(){!d&&a.onNext(b),a.onCompleted()})},c)},N.prototype.push=function(a){var b=-1===M(this.set,a,this.comparer);return b&&this.set.push(a),b},zc.distinct=function(a,b){var c=this;return b||(b=ab),new gd(function(d){var e=new N(b);return c.subscribe(function(b){var c=b;if(a)try{c=a(b)}catch(f){return void d.onError(f)}e.push(c)&&d.onNext(b)},function(a){d.onError(a)},function(){d.onCompleted()})},this)};var ed=function(a){function b(b,c,d){this.source=b,this.selector=rb(c,d,3),a.call(this)}return Sb(b,a),b.prototype.internalMap=function(a,c){var d=this;return new b(this.source,function(b,c,e){return a(d.selector(b,c,e),c,e)},c)},b.prototype.subscribeCore=function(a){return this.source.subscribe(new O(a,this.selector,this))},b}(Gc);O.prototype.onNext=function(a){if(!this.isStopped){var b=q(this.selector).call(this,a,this.i++,this.source);return b===Vb?this.observer.onError(b.e):void this.observer.onNext(b)}},O.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.observer.onError(a))},O.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.observer.onCompleted())},O.prototype.dispose=function(){this.isStopped=!0},O.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},zc.map=zc.select=function(a,b){var c="function"==typeof a?a:function(){return a};return this instanceof ed?this.internalMap(c,b):new ed(this,c,b)},zc.pluck=function(){var b=arguments,c=arguments.length;if(0===c)throw new Error("List of properties cannot be empty.");return this.map(function(d){for(var e=d,f=0;c>f;f++){var g=e[b[f]];if("undefined"==typeof g)return a;e=g}return e})},zc.flatMapObserver=zc.selectManyObserver=function(a,b,c,d){var e=this;return new gd(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)}db(c)&&(c=Hc(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}db(c)&&(c=Hc(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}db(a)&&(a=Hc(a)),f.onNext(a),f.onCompleted()})},e).mergeAll()},zc.selectMany=zc.flatMap=function(a,b,c){return eb(a)&&eb(b)?this.flatMap(function(c,d){var e=a(c,d);return db(e)&&(e=Hc(e)),(pb(e)||ob(e))&&(e=Oc(e)),e.map(function(a,e){return b(c,a,d,e)})},c):eb(a)?P(this,a,c):P(this,function(){return a})},zc.selectSwitch=zc.flatMapLatest=zc.switchMap=function(a,b){return this.select(a,b).switchLatest()},zc.skip=function(a){if(0>a)throw new Error(fb);var b=this;return new gd(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},function(a){c.onError(a)},function(){c.onCompleted()})},b)},zc.skipWhile=function(a,b){var c=this,d=rb(a,b,3);return new gd(function(a){var b=0,e=!1;return c.subscribe(function(f){if(!e)try{e=!d(f,b++,c)}catch(g){return void a.onError(g)}e&&a.onNext(f)},function(b){a.onError(b)},function(){a.onCompleted()})},c)},zc.take=function(a,b){if(0>a)throw new RangeError(fb);if(0===a)return Kc(b);var c=this;return new gd(function(b){var d=a;return c.subscribe(function(a){d-->0&&(b.onNext(a),0===d&&b.onCompleted())},function(a){b.onError(a)},function(){b.onCompleted()})},c)},zc.takeWhile=function(a,b){var c=this,d=rb(a,b,3);return new gd(function(a){var b=0,e=!0;return c.subscribe(function(f){if(e){try{e=d(f,b++,c)}catch(g){return void a.onError(g)}e?a.onNext(f):a.onCompleted()}},function(b){a.onError(b)},function(){a.onCompleted()})},c)};var fd=function(a){function b(b,c,d){this.source=b,this.predicate=rb(c,d,3),a.call(this)}return Sb(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Q(a,this.predicate,this))},b.prototype.internalFilter=function(a,c){var d=this;return new b(this.source,function(b,c,e){return d.predicate(b,c,e)&&a(b,c,e)},c)},b}(Gc);Q.prototype.onNext=function(a){if(!this.isStopped){var b=q(this.predicate).call(this,a,this.i++,this.source);return b===Vb?this.observer.onError(b.e):void(b&&this.observer.onNext(a))}},Q.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.observer.onError(a))},Q.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.observer.onCompleted())},Q.prototype.dispose=function(){this.isStopped=!0},Q.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.observer.onError(a),!0)},zc.filter=zc.where=function(a,b){return this instanceof fd?this.internalFilter(a,b):new fd(this,a,b)},zc.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 gd(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)})},c)};var gd=X.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?_b(a):ac}function c(a,c){var d=c[0],e=c[1];try{d.setDisposable(b(e(d)))}catch(f){if(!d.fail(f))throw f}}function d(b,d){function e(a){var d=new hd(a),e=[d,b];return jc.scheduleRequired()?jc.scheduleWithState(e,c):c(null,e),d}this.source=d,a.call(this,e)}return Sb(d,a),d}(Fc),hd=function(a){function b(b){a.call(this),this.observer=b,this.m=new cc}Sb(b,a);var c=b.prototype;return c.next=function(a){var b=q(this.observer.onNext).call(this.observer,a);return b===Vb?(this.dispose(),r(b.e)):void 0},c.error=function(a){var b=q(this.observer.onError).call(this.observer,a);return this.dispose(),b===Vb?r(b.e):void 0},c.completed=function(){var a=q(this.observer.onCompleted).call(this.observer);return this.dispose(),a===Vb?r(a.e):void 0},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Ac),id=function(a,b){this.subject=a,this.observer=b};id.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 jd=X.Subject=function(a){function d(a){return b(this),this.isStopped?this.hasError?(a.onError(this.error),ac):(a.onCompleted(),ac):(this.observers.push(a),new id(this,a))}function e(){a.call(this,d),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return Sb(e,a),Tb(e.prototype,xc.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b(this),!this.isStopped){this.isStopped=!0;for(var a=0,d=c(this.observers),e=d.length;e>a;a++)d[a].onCompleted();this.observers.length=0}},onError:function(a){if(b(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onError(a);this.observers.length=0}},onNext:function(a){if(b(this),!this.isStopped)for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),e.create=function(a,b){return new kd(a,b)},e}(Fc),kd=(X.AsyncSubject=function(a){function d(a){return b(this),this.isStopped?(this.hasError?a.onError(this.error):this.hasValue?(a.onNext(this.value),a.onCompleted()):a.onCompleted(),ac):(this.observers.push(a),new id(this,a))}function e(){a.call(this,d),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return Sb(e,a),Tb(e.prototype,xc,{hasObservers:function(){return b(this),this.observers.length>0},onCompleted:function(){var a,d;if(b(this),!this.isStopped){this.isStopped=!0;var e=c(this.observers),d=e.length;if(this.hasValue)for(a=0;d>a;a++){var f=e[a];f.onNext(this.value),f.onCompleted()}else for(a=0;d>a;a++)e[a].onCompleted();this.observers.length=0}},onError:function(a){if(b(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var d=0,e=c(this.observers),f=e.length;f>d;d++)e[d].onError(a);this.observers.length=0}},onNext:function(a){b(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),e}(Fc),X.AnonymousSubject=function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){this.observer=c,this.observable=d,a.call(this,b)}return Sb(c,a),Tb(c.prototype,xc.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(Fc));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(S.Rx=X,define(function(){return X})):T&&U?V?(U.exports=X).Rx=X:T.Rx=X:S.Rx=X;var ld=h()}).call(this);
//# sourceMappingURL=rx.map
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
;(function (factory) {
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
var root = (objectTypes[typeof window] && window) || this,
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
freeGlobal = objectTypes[typeof global] && global;
var root = (objectTypes[typeof window] && window) || this,
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
freeGlobal = objectTypes[typeof global] && global;
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
root = freeGlobal;
}
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
root = freeGlobal;
}
// Because of build optimizers
if (typeof define === 'function' && define.amd) {
define(['rx.virtualtime', 'exports'], function (Rx, exports) {
root.Rx = factory(root, exports, Rx);
return root.Rx;
});
} else if (typeof module === 'object' && module && module.exports === freeExports) {
module.exports = factory(root, module.exports, require('./rx.all'));
} else {
root.Rx = factory(root, {}, root.Rx);
}
// Because of build optimizers
if (typeof define === 'function' && define.amd) {
define(['rx.virtualtime', 'exports'], function (Rx, exports) {
root.Rx = factory(root, exports, Rx);
return root.Rx;
});
} else if (typeof module === 'object' && module && module.exports === freeExports) {
module.exports = factory(root, module.exports, require('./rx'));
} else {
root.Rx = factory(root, {}, root.Rx);
}
}.call(this, function (root, exp, Rx, undefined) {
// Defaults
var Observer = Rx.Observer,
Observable = Rx.Observable,
Notification = Rx.Notification,
VirtualTimeScheduler = Rx.VirtualTimeScheduler,
Disposable = Rx.Disposable,
disposableEmpty = Disposable.empty,
disposableCreate = Disposable.create,
CompositeDisposable = Rx.CompositeDisposable,
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
slice = Array.prototype.slice,
inherits = Rx.internals.inherits,
defaultComparer = Rx.internals.isEqual;
// Defaults
var Observer = Rx.Observer,
Observable = Rx.Observable,
Notification = Rx.Notification,
VirtualTimeScheduler = Rx.VirtualTimeScheduler,
Disposable = Rx.Disposable,
disposableEmpty = Disposable.empty,
disposableCreate = Disposable.create,
CompositeDisposable = Rx.CompositeDisposable,
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
slice = Array.prototype.slice,
inherits = Rx.internals.inherits,
defaultComparer = Rx.internals.isEqual;
function argsOrArray(args, idx) {
return args.length === 1 && Array.isArray(args[idx]) ?
args[idx] :
slice.call(args);
}
function OnNextPredicate(predicate) {

@@ -199,16 +193,11 @@ this.predicate = predicate;

/** @private */
var MockDisposable = Rx.MockDisposable = function (scheduler) {
this.scheduler = scheduler;
this.disposes = [];
this.disposes.push(this.scheduler.clock);
};
var MockDisposable = Rx.MockDisposable = function (scheduler) {
this.scheduler = scheduler;
this.disposes = [];
this.disposes.push(this.scheduler.clock);
};
/*
* @memberOf MockDisposable#
* @prviate
*/
MockDisposable.prototype.dispose = function () {
this.disposes.push(this.scheduler.clock);
};
MockDisposable.prototype.dispose = function () {
this.disposes.push(this.scheduler.clock);
};

@@ -485,4 +474,10 @@ var MockObserver = (function (__super__) {

TestScheduler.prototype.createHotObservable = function () {
var messages = argsOrArray(arguments, 0);
return new HotObservable(this, messages);
var len = arguments.length, args;
if (Array.isArray(arguments[0])) {
args = arguments[0];
} else {
args = new Array(len);
for (var i = 0; i < len; i++) { args[i] = arguments[i]; }
}
return new HotObservable(this, args);
};

@@ -496,4 +491,10 @@

TestScheduler.prototype.createColdObservable = function () {
var messages = argsOrArray(arguments, 0);
return new ColdObservable(this, messages);
var len = arguments.length, args;
if (Array.isArray(arguments[0])) {
args = arguments[0];
} else {
args = new Array(len);
for (var i = 0; i < len; i++) { args[i] = arguments[i]; }
}
return new ColdObservable(this, args);
};

@@ -500,0 +501,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.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,d){function e(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:q.call(a)}function f(a){this.predicate=a}function g(a){this.predicate=a}function h(a,b){var c=this;this.scheduler=a,this.messages=b,this.subscriptions=[],this.observers=[];for(var d=0,e=this.messages.length;e>d;d++){var f=this.messages[d],g=f.value;!function(b){a.scheduleAbsoluteWithState(null,f.time,function(){for(var a=c.observers.slice(0),d=0,e=a.length;e>d;d++)b.accept(a[d]);return n})}(g)}}var i=c.Observer,j=c.Observable,k=c.Notification,l=c.VirtualTimeScheduler,m=c.Disposable,n=m.empty,o=m.create,p=c.CompositeDisposable,q=(c.SingleAssignmentDisposable,Array.prototype.slice),r=c.internals.inherits,s=c.internals.isEqual;f.prototype.equals=function(a){return a===this?!0:null==a?!1:"N"!==a.kind?!1:this.predicate(a.value)},g.prototype.equals=function(a){return a===this?!0:null==a?!1:"E"!==a.kind?!1:this.predicate(a.exception)};var t=c.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(a,b){return"function"==typeof b?new u(a,new f(b)):new u(a,k.createOnNext(b))},onError:function(a,b){return"function"==typeof b?new u(a,new g(b)):new u(a,k.createOnError(b))},onCompleted:function(a){return new u(a,k.createOnCompleted())},subscribe:function(a,b){return new v(a,b)}},u=c.Recorded=function(a,b,c){this.time=a,this.value=b,this.comparer=c||s};u.prototype.equals=function(a){return this.time===a.time&&this.comparer(this.value,a.value)},u.prototype.toString=function(){return this.value.toString()+"@"+this.time};var v=c.Subscription=function(a,b){this.subscribe=a,this.unsubscribe=b||Number.MAX_VALUE};v.prototype.equals=function(a){return this.subscribe===a.subscribe&&this.unsubscribe===a.unsubscribe},v.prototype.toString=function(){return"("+this.subscribe+", "+(this.unsubscribe===Number.MAX_VALUE?"Infinite":this.unsubscribe)+")"};var w=c.MockDisposable=function(a){this.scheduler=a,this.disposes=[],this.disposes.push(this.scheduler.clock)};w.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var x=function(a){function b(b){a.call(this),this.scheduler=b,this.messages=[]}r(b,a);var c=b.prototype;return c.onNext=function(a){this.messages.push(new u(this.scheduler.clock,k.createOnNext(a)))},c.onError=function(a){this.messages.push(new u(this.scheduler.clock,k.createOnError(a)))},c.onCompleted=function(){this.messages.push(new u(this.scheduler.clock,k.createOnCompleted()))},b}(i);h.prototype.then=function(a,b){var e=this;this.subscriptions.push(new v(this.scheduler.clock));var f,g=this.subscriptions.length-1,i=c.Observer.create(function(b){var j=a(b);if(j&&"function"==typeof j.then)f=j;else{var k=e.scheduler.clock;f=new h(e.scheduler,[c.ReactiveTest.onNext(k,d),c.ReactiveTest.onCompleted(k)])}var l=e.observers.indexOf(i);e.observers.splice(l,1),e.subscriptions[g]=new v(e.subscriptions[g].subscribe,e.scheduler.clock)},function(a){b(a);var c=e.observers.indexOf(i);e.observers.splice(c,1),e.subscriptions[g]=new v(e.subscriptions[g].subscribe,e.scheduler.clock)});return this.observers.push(i),f||new h(this.scheduler,this.messages)};var y=function(a){function b(a){var b=this;this.observers.push(a),this.subscriptions.push(new v(this.scheduler.clock));var c=this.subscriptions.length-1;return o(function(){var d=b.observers.indexOf(a);b.observers.splice(d,1),b.subscriptions[c]=new v(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 n})}(f)}return r(c,a),c}(j),z=function(a){function b(a){var b,c,d=this;this.subscriptions.push(new v(this.scheduler.clock));for(var e=this.subscriptions.length-1,f=new p,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),n}))}(c);return o(function(){d.subscriptions[e]=new v(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 r(c,a),c}(j);return c.TestScheduler=function(a){function b(a,b){return a>b?1:b>a?-1:0}function d(){a.call(this,0,b)}return r(d,a),d.prototype.scheduleAbsoluteWithState=function(b,c,d){return c<=this.clock&&(c=this.clock+1),a.prototype.scheduleAbsoluteWithState.call(this,b,c,d)},d.prototype.add=function(a,b){return a+b},d.prototype.toDateTimeOffset=function(a){return new Date(a).getTime()},d.prototype.toRelative=function(a){return a},d.prototype.startWithTiming=function(a,b,c,d){var e,f,g=this.createObserver();return this.scheduleAbsoluteWithState(null,b,function(){return e=a(),n}),this.scheduleAbsoluteWithState(null,c,function(){return f=e.subscribe(g),n}),this.scheduleAbsoluteWithState(null,d,function(){return f.dispose(),n}),this.start(),g},d.prototype.startWithDispose=function(a,b){return this.startWithTiming(a,t.created,t.subscribed,b)},d.prototype.startWithCreate=function(a){return this.startWithTiming(a,t.created,t.subscribed,t.disposed)},d.prototype.createHotObservable=function(){var a=e(arguments,0);return new y(this,a)},d.prototype.createColdObservable=function(){var a=e(arguments,0);return new z(this,a)},d.prototype.createResolvedPromise=function(a,b){return new h(this,[c.ReactiveTest.onNext(a,b),c.ReactiveTest.onCompleted(a)])},d.prototype.createRejectedPromise=function(a,b){return new h(this,[c.ReactiveTest.onError(a,b)])},d.prototype.createObserver=function(){return new x(this)},d}(l),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")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a){this.predicate=a}function f(a){this.predicate=a}function g(a,b){var c=this;this.scheduler=a,this.messages=b,this.subscriptions=[],this.observers=[];for(var d=0,e=this.messages.length;e>d;d++){var f=this.messages[d],g=f.value;!function(b){a.scheduleAbsoluteWithState(null,f.time,function(){for(var a=c.observers.slice(0),d=0,e=a.length;e>d;d++)b.accept(a[d]);return m})}(g)}}var h=c.Observer,i=c.Observable,j=c.Notification,k=c.VirtualTimeScheduler,l=c.Disposable,m=l.empty,n=l.create,o=c.CompositeDisposable,p=(c.SingleAssignmentDisposable,Array.prototype.slice,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,j.createOnNext(b))},onError:function(a,b){return"function"==typeof b?new s(a,new f(b)):new s(a,j.createOnError(b))},onCompleted:function(a){return new s(a,j.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,j.createOnNext(a)))},c.onError=function(a){this.messages.push(new s(this.scheduler.clock,j.createOnError(a)))},c.onCompleted=function(){this.messages.push(new s(this.scheduler.clock,j.createOnCompleted()))},b}(h);g.prototype.then=function(a,b){var e=this;this.subscriptions.push(new t(this.scheduler.clock));var f,h=this.subscriptions.length-1,i=c.Observer.create(function(b){var j=a(b);if(j&&"function"==typeof j.then)f=j;else{var k=e.scheduler.clock;f=new g(e.scheduler,[c.ReactiveTest.onNext(k,d),c.ReactiveTest.onCompleted(k)])}var l=e.observers.indexOf(i);e.observers.splice(l,1),e.subscriptions[h]=new t(e.subscriptions[h].subscribe,e.scheduler.clock)},function(a){b(a);var c=e.observers.indexOf(i);e.observers.splice(c,1),e.subscriptions[h]=new t(e.subscriptions[h].subscribe,e.scheduler.clock)});return this.observers.push(i),f||new g(this.scheduler,this.messages)};var 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 n(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 m})}(f)}return p(c,a),c}(i),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 o,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),m}))}(c);return n(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}(i);return c.TestScheduler=function(a){function b(a,b){return a>b?1:b>a?-1:0}function d(){a.call(this,0,b)}return p(d,a),d.prototype.scheduleAbsoluteWithState=function(b,c,d){return c<=this.clock&&(c=this.clock+1),a.prototype.scheduleAbsoluteWithState.call(this,b,c,d)},d.prototype.add=function(a,b){return a+b},d.prototype.toDateTimeOffset=function(a){return new Date(a).getTime()},d.prototype.toRelative=function(a){return a},d.prototype.startWithTiming=function(a,b,c,d){var e,f,g=this.createObserver();return this.scheduleAbsoluteWithState(null,b,function(){return e=a(),m}),this.scheduleAbsoluteWithState(null,c,function(){return f=e.subscribe(g),m}),this.scheduleAbsoluteWithState(null,d,function(){return f.dispose(),m}),this.start(),g},d.prototype.startWithDispose=function(a,b){return this.startWithTiming(a,r.created,r.subscribed,b)},d.prototype.startWithCreate=function(a){return this.startWithTiming(a,r.created,r.subscribed,r.disposed)},d.prototype.createHotObservable=function(){var a,b=arguments.length;if(Array.isArray(arguments[0]))a=arguments[0];else{a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new w(this,a)},d.prototype.createColdObservable=function(){var a,b=arguments.length;if(Array.isArray(arguments[0]))a=arguments[0];else{a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new x(this,a)},d.prototype.createResolvedPromise=function(a,b){return new g(this,[c.ReactiveTest.onNext(a,b),c.ReactiveTest.onCompleted(a)])},d.prototype.createRejectedPromise=function(a,b){return new g(this,[c.ReactiveTest.onError(a,b)])},d.prototype.createObserver=function(){return new v(this)},d}(k),c});
//# sourceMappingURL=rx.testing.map

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

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

@@ -8,0 +8,0 @@ "author": {

@@ -16,2 +16,11 @@ /**

function notImplemented() {
throw new Error('Method not implemented');
}
// Must be implemented by other observers
AbstractObserver.prototype.next = notImplemented;
AbstractObserver.prototype.error = notImplemented;
AbstractObserver.prototype.completed = notImplemented;
/**

@@ -18,0 +27,0 @@ * Notifies the observer of a new element in the sequence.

@@ -13,10 +13,6 @@ var AutoDetachObserver = (function (__super__) {

AutoDetachObserverPrototype.next = function (value) {
var noError = false;
try {
this.observer.onNext(value);
noError = true;
} catch (e) {
throw e;
} finally {
!noError && this.dispose();
var result = tryCatch(this.observer.onNext).call(this.observer, value);
if (result === errorObj) {
this.dispose();
return thrower(result.e);
}

@@ -26,8 +22,6 @@ };

AutoDetachObserverPrototype.error = function (err) {
try {
this.observer.onError(err);
} catch (e) {
throw e;
} finally {
this.dispose();
var result = tryCatch(this.observer.onError).call(this.observer, err);
this.dispose();
if (result === errorObj) {
return thrower(result.e);
}

@@ -37,8 +31,6 @@ };

AutoDetachObserverPrototype.completed = function () {
try {
this.observer.onCompleted();
} catch (e) {
throw e;
} finally {
this.dispose();
var result = tryCatch(this.observer.onCompleted).call(this.observer);
this.dispose();
if (result === errorObj) {
return thrower(result.e);
}

@@ -45,0 +37,0 @@ };

@@ -7,9 +7,6 @@ /**

function runTrampoline (q) {
while (q.length > 0) {
var item = q.dequeue();
function runTrampoline () {
while (queue.length > 0) {
var item = queue.dequeue();
if (!item.isCancelled()) {
// Note, do not schedule blocking work!
while (item.dueTime - Scheduler.now() > 0) {
}
!item.isCancelled() && item.invoke();

@@ -21,19 +18,11 @@ }

function scheduleNow(state, action) {
return this.scheduleWithRelativeAndState(state, 0, action);
}
var si = new ScheduledItem(this, state, action, this.now());
function scheduleRelative(state, dueTime, action) {
var dt = this.now() + Scheduler.normalize(dueTime),
si = new ScheduledItem(this, state, action, dt);
if (!queue) {
queue = new PriorityQueue(4);
queue.enqueue(si);
try {
runTrampoline(queue);
} catch (e) {
throw e;
} finally {
queue = null;
}
var result = tryCatch(runTrampoline)();
queue = null;
if (result === errorObj) { return thrower(result.e); }
} else {

@@ -45,7 +34,5 @@ queue.enqueue(si);

function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
function notSupported() { throw new Error('Not supported'); }
var currentScheduler = new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
var currentScheduler = new Scheduler(defaultNow, scheduleNow, notSupported, notSupported);

@@ -52,0 +39,0 @@ currentScheduler.scheduleRequired = function () { return !queue; };

@@ -5,14 +5,5 @@ /** Gets a scheduler that schedules work immediately on the current thread. */

function scheduleNow(state, action) { return action(this, state); }
function notSupported() { throw new Error('Not supported'); }
function scheduleRelative(state, dueTime, action) {
var dt = this.now() + normalizeTime(dueTime);
while (dt - this.now() > 0) { }
return action(this, state);
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
return new Scheduler(defaultNow, scheduleNow, notSupported, notSupported);
}());

@@ -6,11 +6,17 @@ /**

var CompositeDisposable = Rx.CompositeDisposable = function () {
var args = [];
var args = [], i, len;
if (Array.isArray(arguments[0])) {
args = arguments[0];
len = args.length;
} else {
for(var i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
len = arguments.length;
args = new Array(len);
for(i = 0; i < len; i++) { args[i] = arguments[i]; }
}
for(i = 0; i < len; i++) {
if (!isDisposable(args[i])) { throw new TypeError('Not a disposable'); }
}
this.disposables = args;
this.isDisposed = false;
this.length = this.disposables.length;
this.length = args.length;
};

@@ -58,7 +64,8 @@

this.isDisposed = true;
for(var currentDisposables = [], i = 0, len = this.disposables.length; i < len; i++) { currentDisposables.push(this.disposables[i]); }
var len = this.disposables.length, currentDisposables = new Array(len);
for(var i = 0; i < len; i++) { currentDisposables[i] = this.disposables[i]; }
this.disposables = [];
this.length = 0;
for (i = 0, len = currentDisposables.length; i < len; i++) {
for (i = 0; i < len; i++) {
currentDisposables[i].dispose();

@@ -68,10 +75,1 @@ }

};
/**
* Converts the existing CompositeDisposable to an array of disposables
* @returns {Array} An array of disposable objects.
*/
CompositeDisposablePrototype.toArray = function () {
for(var currentDisposables = [], ix = 0, len = this.disposables.length; i < len; i++) { currentDisposables.push(this.disposables[i]); }
return currentDisposables;
};
/**
* Provides a set of static methods for creating Disposables.
*
* @constructor
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.

@@ -31,1 +29,10 @@ */

var disposableEmpty = Disposable.empty = { dispose: noop };
/**
* Validates whether the given object is a disposable
* @param {Object} Object to test whether it has a dispose method
* @returns {Boolean} true if a disposable object, else false.
*/
var isDisposable = Disposable.isDisposable = function (d) {
return d && isFunction(d.dispose);
};
function observableCatchHandler(source, handler) {
return new AnonymousObservable(function (observer) {
return new AnonymousObservable(function (o) {
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
subscription.setDisposable(d1);
d1.setDisposable(source.subscribe(observer.onNext.bind(observer), function (exception) {
var d, result;
d1.setDisposable(source.subscribe(function (x) { o.onNext(x); }, function (e) {
try {
result = handler(exception);
var result = handler(e);
} catch (ex) {
observer.onError(ex);
return;
return o.onError(ex);
}
isPromise(result) && (result = observableFromPromise(result));
d = new SingleAssignmentDisposable();
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(result.subscribe(observer));
}, observer.onCompleted.bind(observer)));
d.setDisposable(result.subscribe(o));
}, function (x) { o.onCompleted(x); }));

@@ -32,3 +30,3 @@ return subscription;

*/
observableProto['catch'] = observableProto.catchError = function (handlerOrSecond) {
observableProto['catch'] = observableProto.catchError = observableProto.catchException = function (handlerOrSecond) {
return typeof handlerOrSecond === 'function' ?

@@ -38,9 +36,1 @@ observableCatchHandler(this, handlerOrSecond) :

};
/**
* @deprecated use #catch or #catchError instead.
*/
observableProto.catchException = function (handlerOrSecond) {
//deprecate('catchException', 'catch or catchError');
return this.catchError(handlerOrSecond);
};

@@ -10,30 +10,27 @@ /**

var combineLatest = Observable.combineLatest = function () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var resultSelector = args.pop();
len--;
Array.isArray(args[0]) && (args = args[0]);
if (Array.isArray(args[0])) {
args = args[0];
}
return new AnonymousObservable(function (observer) {
return new AnonymousObservable(function (o) {
var falseFactory = function () { return false; },
n = args.length,
hasValue = arrayInitialize(n, falseFactory),
hasValue = arrayInitialize(len, falseFactory),
hasValueAll = false,
isDone = arrayInitialize(n, falseFactory),
values = new Array(n);
isDone = arrayInitialize(len, falseFactory),
values = new Array(len);
function next(i) {
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
try {
res = resultSelector.apply(null, values);
var res = resultSelector.apply(null, values);
} catch (ex) {
observer.onError(ex);
o.onError(ex);
return;
}
observer.onNext(res);
o.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
o.onCompleted();
}

@@ -44,9 +41,7 @@ }

isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
}
isDone.every(identity) && o.onCompleted();
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
var subscriptions = new Array(len);
for (var idx = 0; idx < len; idx++) {
(function (i) {

@@ -59,3 +54,3 @@ var source = args[i], sad = new SingleAssignmentDisposable();

},
function(e) { observer.onError(e); },
function(e) { o.onError(e); },
function () { done(i); }

@@ -62,0 +57,0 @@ ));

@@ -11,3 +11,4 @@ /**

observableProto.combineLatest = function () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
if (Array.isArray(args[0])) {

@@ -14,0 +15,0 @@ args[0].unshift(this);

@@ -7,9 +7,10 @@ /**

var observableConcat = Observable.concat = function () {
var items = [];
var args;
if (Array.isArray(arguments[0])) {
items = arguments[0];
args = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { items.push(arguments[i]); }
args = new Array(arguments.length);
for(var i = 0, len = arguments.length; i < len; i++) { args[i] = arguments[i]; }
}
return enumerableOf(items).concat();
return enumerableOf(args).concat();
};

@@ -22,8 +22,3 @@ var maxSafeInteger = Math.pow(2, 53) - 1;

StringIterator.prototype.next = function () {
if (this._i < this._l) {
var val = this._s.charAt(this._i++);
return { done: false, value: val };
} else {
return doneEnumerator;
}
return this._i < this._l ? { done: false, value: this._s.charAt(this._i++) } : doneEnumerator;
};

@@ -50,8 +45,3 @@

ArrayIterator.prototype.next = function () {
if (this._i < this._l) {
var val = this._a[this._i++];
return { done: false, value: val };
} else {
return doneEnumerator;
}
return this._i < this._l ? { done: false, value: this._a[this._i++] } : doneEnumerator;
};

@@ -122,9 +112,5 @@

} catch (e) {
observer.onError(e);
return;
return observer.onError(e);
}
if (next.done) {
observer.onCompleted();
return;
}
if (next.done) { return observer.onCompleted(); }

@@ -137,4 +123,3 @@ var result = next.value;

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

@@ -141,0 +126,0 @@ }

@@ -53,3 +53,3 @@ function createListener (element, name, handler) {

if (!Rx.config.useNativeEvents) {
// Handles jq, Angular.js, Zepto, Marionette
// Handles jq, Angular.js, Zepto, Marionette, Ember.js
if (typeof element.on === 'function' && typeof element.off === 'function') {

@@ -61,8 +61,2 @@ return fromEventPattern(

}
if (!!root.Ember && typeof root.Ember.addListener === 'function') {
return fromEventPattern(
function (h) { Ember.addListener(element, eventName, h); },
function (h) { Ember.removeListener(element, eventName, h); },
selector);
}
}

@@ -69,0 +63,0 @@ return new AnonymousObservable(function (observer) {

@@ -121,3 +121,3 @@ function fixEvent(event) {

if (!Rx.config.useNativeEvents) {
// Handles jq, Angular.js, Zepto, Marionette
// Handles jq, Angular.js, Zepto, Marionette, Ember.js
if (typeof element.on === 'function' && typeof element.off === 'function') {

@@ -129,8 +129,2 @@ return fromEventPattern(

}
if (!!root.Ember && typeof root.Ember.addListener === 'function') {
return fromEventPattern(
function (h) { Ember.addListener(element, eventName, h); },
function (h) { Ember.removeListener(element, eventName, h); },
selector);
}
}

@@ -137,0 +131,0 @@ return new AnonymousObservable(function (observer) {

@@ -5,3 +5,3 @@ /**

*/
observableProto.mergeAll = function () {
observableProto.mergeAll = observableProto.mergeObservable = function () {
var sources = this;

@@ -32,9 +32,1 @@ return new AnonymousObservable(function (o) {

};
/**
* @deprecated use #mergeAll instead.
*/
observableProto.mergeObservable = function () {
//deprecate('mergeObservable', 'mergeAll');
return this.mergeAll.apply(this, arguments);
};
function observableOf (scheduler, array) {
var len = array.length;
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var count = 0, len = array.length;
return scheduler.scheduleRecursive(function (self) {
if (count < len) {
observer.onNext(array[count++]);
self();
return scheduler.scheduleRecursiveWithState(0, function (i, self) {
if (i < len) {
observer.onNext(array[i]);
self(i + 1);
} else {

@@ -21,3 +21,4 @@ observer.onCompleted();

Observable.of = function () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return observableOf(null, args);

@@ -32,4 +33,5 @@ };

Observable.ofWithScheduler = function (scheduler) {
for(var args = [], i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
var len = arguments.length, args = new Array(len - 1);
for(var i = 0; i < len - 1; i++) { args[i] = arguments[i + 1]; }
return observableOf(scheduler, args);
};

@@ -11,9 +11,10 @@ /**

return new AnonymousObservable(function (o) {
var count = 0;
return source.subscribe(function (value) {
var i = 0;
return source.subscribe(function (x) {
try {
var result = selectorFn(value, count++, source);
var result = selector(x, i++, source);
} catch (e) {
return o.onError(e);
return observer.onError(e);
}
o.onNext(result);

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

@@ -8,18 +8,19 @@ /**

Observable.when = function () {
var plans = [];
var len = arguments.length, plans;
if (Array.isArray(arguments[0])) {
plans = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { plans.push(arguments[i]); }
plans = new Array(len);
for(var i = 0; i < len; i++) { plans[i] = arguments[i]; }
}
return new AnonymousObservable(function (observer) {
return new AnonymousObservable(function (o) {
var activePlans = [],
externalSubscriptions = new Map();
var outObserver = observerCreate(
observer.onNext.bind(observer),
function (x) { o.onNext(x); },
function (err) {
externalSubscriptions.forEach(function (v) { v.onError(err); });
observer.onError(err);
o.onError(err);
},
observer.onCompleted.bind(observer)
function (x) { o.onCompleted(); }
);

@@ -31,7 +32,7 @@ try {

activePlans.splice(idx, 1);
activePlans.length === 0 && observer.onCompleted();
activePlans.length === 0 && o.onCompleted();
}));
}
} catch (e) {
observableThrow(e).subscribe(observer);
observableThrow(e).subscribe(o);
}

@@ -38,0 +39,0 @@ var group = new CompositeDisposable();

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

Observable.zip = function () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var first = args.shift();
return first.zip.apply(first, args);
};

@@ -7,7 +7,9 @@ /**

Observable.zipArray = function () {
var sources = [];
var sources;
if (Array.isArray(arguments[0])) {
sources = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { sources.push(arguments[i]); }
var len = arguments.length;
sources = new Array(len);
for(var i = 0; i < len; i++) { sources[i] = arguments[i]; }
}

@@ -14,0 +16,0 @@ return new AnonymousObservable(function (observer) {

@@ -34,4 +34,6 @@ function zipArray(second, resultSelector) {

observableProto.zip = function () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
if (Array.isArray(args[0])) { return zipArray.apply(this, args); }
if (Array.isArray(arguments[0])) { return zipArray.apply(this, arguments); }
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var parent = this, resultSelector = args.pop();

@@ -38,0 +40,0 @@ args.unshift(parent);

@@ -16,7 +16,8 @@ var ObservableBase = Rx.ObservableBase = (function (__super__) {

var ado = state[0], self = state[1];
try {
ado.setDisposable(fixSubscriber(self.subscribeCore(ado)));
} catch (e) {
if (!ado.fail(e)) { throw e; }
var sub = tryCatch(self.subscribeCore).call(self, ado);
if (sub === errorObj) {
if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); }
}
ado.setDisposable(fixSubscriber(sub));
}

@@ -23,0 +24,0 @@

@@ -17,10 +17,10 @@ function falseFactory() { return false; }

CombineLatestObservable.prototype.subscribeCore = function(observer) {
var self = this, n = this.length, subscriptions = new Array(n);
var self = this, parameters = self.parameters, n = this.length, subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = self.parameters[i], sad = new SingleAssignmentDisposable();
var source = parameters[i], sad = new SingleAssignmentDisposable();
subscriptions[i] = sad;
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(new CombineLatestObserver(observer, i, self)));
subscriptions[i] = sad;
}(idx));

@@ -35,50 +35,46 @@ }

var CombineLatestObserver = (function() {
function CombineLatestObserver(observer, i, parent) {
this.observer = observer;
this.i = i;
this.parent = parent;
this.isStopped = false;
}
function CombineLatestObserver(observer, i, parent) {
this.observer = observer;
this.i = i;
this.parent = parent;
this.isStopped = false;
}
CombineLatestObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var i = this.i;
this.parent.values[i] = x;
this.parent.hasValue[i] = true;
if (this.parent.hasValueAll || (this.parent.hasValueAll = this.parent.hasValue.every(identity))) {
try {
var res = this.parent.resultSelector.apply(null, this.parent.values);
} catch (e) {
return this.observer.onError(e);
}
this.observer.onNext(res);
} else if (this.parent.isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
this.observer.onCompleted();
CombineLatestObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var i = this.i;
this.parent.values[i] = x;
this.parent.hasValue[i] = true;
if (this.parent.hasValueAll || (this.parent.hasValueAll = this.parent.hasValue.every(identity))) {
try {
var res = this.parent.resultSelector.apply(null, this.parent.values);
} catch (e) {
return this.observer.onError(e);
}
};
CombineLatestObserver.prototype.onError = function(e) {
if (!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
};
CombineLatestObserver.prototype.onCompleted = function() {
if (!this.isStopped) {
this.isStopped = true;
this.parent.isDone[this.i] = true;
this.parent.isDone.every(identity) && this.observer.onCompleted();
}
};
CombineLatestObserver.prototype.dispose = function() { this.isStopped = true; };
CombineLatestObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
this.observer.onNext(res);
} else if (this.parent.isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
this.observer.onCompleted();
}
};
CombineLatestObserver.prototype.onError = function(e) {
if (!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
};
CombineLatestObserver.prototype.onCompleted = function() {
if (!this.isStopped) {
this.isStopped = true;
this.parent.isDone[this.i] = true;
this.parent.isDone.every(identity) && this.observer.onCompleted();
}
};
CombineLatestObserver.prototype.dispose = function() { this.isStopped = true; };
CombineLatestObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return false;
};
return false;
};
return CombineLatestObserver;
}());
/**

@@ -93,3 +89,4 @@ * Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.

var combineLatest = Observable.combineLatest = function () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
var len = arguments.length, args = new Array(len)
for(i = 0; i < len; i++) { args[i] = arguments[i]; }
var resultSelector = args.pop();

@@ -96,0 +93,0 @@ Array.isArray(args[0]) && (args = args[0]);

@@ -17,42 +17,56 @@ var DistinctUntilChangedObservable = (function(__super__) {

var DistinctUntilChangedObserver = (function(__super__) {
inherits(DistinctUntilChangedObserver, __super__);
function DistinctUntilChangedObserver(observer, keySelector, comparer) {
this.observer = observer;
this.keySelector = keySelector;
this.comparer = comparer;
this.hasCurrentKey = false;
this.currentKey = null;
__super__.call(this);
}
function DistinctUntilChangedObserver(observer, keySelector, comparer) {
this.observer = observer;
this.keySelector = keySelector;
this.comparer = comparer;
this.hasCurrentKey = false;
this.currentKey = null;
this.isStopped = false;
}
DistinctUntilChangedObserver.prototype.next = function (x) {
var key = x;
if (this.keySelector) {
try {
key = keySelector(x);
} catch (e) {
this.observer.onError(e);
return;
}
DistinctUntilChangedObserver.prototype.onNext = function (x) {
if (this.isStopped) { return; }
var key = x;
if (this.keySelector) {
try {
key = keySelector(x);
} catch (e) {
return this.observer.onError(e);
}
if (this.hasCurrentKey) {
try {
var comparerEquals = this.comparer(this.currentKey, key);
} catch (e) {
this.observer.onError(e);
return;
}
}
if (this.hasCurrentKey) {
try {
var comparerEquals = this.comparer(this.currentKey, key);
} catch (e) {
return this.observer.onError(e);
}
if (!this.hasCurrentKey || !comparerEquals) {
this.hasCurrentKey = true;
this.currentKey = key;
this.observer.onNext(value);
}
};
DistinctUntilChangedObserver.prototype.error = function(e) { this.observer.onError(e); };
DistinctUntilChangedObserver.prototype.completed = function () { this.observer.onCompleted(); };
}
if (!this.hasCurrentKey || !comparerEquals) {
this.hasCurrentKey = true;
this.currentKey = key;
this.observer.onNext(value);
}
};
DistinctUntilChangedObserver.prototype.onError = function(e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
}
};
DistinctUntilChangedObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onCompleted();
}
};
DistinctUntilChangedObserver.prototype.dispose = function() { this.isStopped = true; };
DistinctUntilChangedObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return DistinctUntilChangedObserver;
}(AbstractObserver));
return false;
};

@@ -59,0 +73,0 @@ /**

@@ -27,3 +27,3 @@ var FilterObservable = (function (__super__) {

this.source = source;
this.index = 0;
this.i = 0;
this.isStopped = false;

@@ -33,10 +33,9 @@ }

FilterObserver.prototype.onNext = function(x) {
try {
var shouldYield = this.predicate(x, this.index++, this.source);
} catch(e) {
return this.observer.onError(e);
if (this.isStopped) { return; }
var shouldYield = tryCatch(this.predicate).call(this, x, this.i++, this.source);
if (shouldYield === errorObj) {
return this.observer.onError(shouldYield.e);
}
shouldYield && this.observer.onNext(x);
};
FilterObserver.prototype.onError = function (e) {

@@ -55,8 +54,5 @@ if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }

}
return false;
};
/**

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

@@ -24,36 +24,33 @@ var FromObservable = (function(__super__) {

function loopRecursive(state, recurse) {
try {
var next = state.it.next();
} catch (e) {
state.observer.onError(e);
return;
}
if (next.done) {
state.observer.onCompleted();
return;
}
FromSink.prototype.run = function () {
var list = Object(this.parent.iterable),
it = getIterable(list),
observer = this.observer,
mapper = this.parent.mapper;
var result = next.value;
if (state.mapper) {
function loopRecursive(i, recurse) {
try {
result = state.mapper(result, state.i);
var next = it.next();
} catch (e) {
state.observer.onError(e);
return;
return observer.onError(e);
}
}
if (next.done) {
return observer.onCompleted();
}
state.observer.onNext(result);
state.i++;
recurse(state);
}
var result = next.value;
FromSink.prototype.run = function () {
var list = Object(this.parent.iterable), it = getIterable(list);
if (mapper) {
try {
result = mapper(result, i);
} catch (e) {
return observer.onError(e);
}
}
return this.parent.scheduler.scheduleRecursiveWithState(
{i: 0, it: it, mapper: this.parent.mapper, observer: this.observer },
loopRecursive);
observer.onNext(result);
recurse(i + 1);
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};

@@ -85,8 +82,3 @@

StringIterator.prototype.next = function () {
if (this._i < this._l) {
var val = this._s.charAt(this._i++);
return { done: false, value: val };
} else {
return doneEnumerator;
}
return this._i < this._l ? { done: false, value: this._s.charAt(this._i++) } : doneEnumerator;
};

@@ -113,8 +105,3 @@

ArrayIterator.prototype.next = function () {
if (this._i < this._l) {
var val = this._a[this._i++];
return { done: false, value: val };
} else {
return doneEnumerator;
}
return this._i < this._l ? { done: false, value: this._a[this._i++] } : doneEnumerator;
};

@@ -121,0 +108,0 @@

@@ -1,41 +0,1 @@

var FromArrayObservable = (function(__super__) {
inherits(FromArrayObservable, __super__);
function FromArrayObservable(args, scheduler) {
this.args = args;
this.scheduler = scheduler || currentThreadScheduler;
__super__.call(this);
}
FromArrayObservable.prototype.subscribeCore = function (observer) {
var sink = new FromArraySink(observer, this);
return sink.run();
};
return FromArrayObservable;
}(ObservableBase));
var FromArraySink = (function () {
function FromArraySink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
function loopRecursive(state, recurse) {
if (state.i < state.len) {
state.observer.onNext(state.args[state.i++]);
recurse(state);
} else {
state.observer.onCompleted();
}
}
FromArraySink.prototype.run = function () {
return this.parent.scheduler.scheduleRecursiveWithState(
{i: 0, args: this.parent.args, len: this.parent.args.length, observer: this.observer },
loopRecursive);
};
return FromArraySink;
}());
/**

@@ -42,0 +2,0 @@ * Converts an array to an observable sequence, using an optional scheduler to enumerate the array.

@@ -27,3 +27,3 @@ var MapObservable = (function (__super__) {

this.source = source;
this.index = 0;
this.i = 0;
this.isStopped = false;

@@ -34,8 +34,13 @@ }

if (this.isStopped) { return; }
try {
var result = this.selector(x, this.index++, this.source);
} catch(e) {
var result = tryCatch(this.selector).call(this, x, this.i++, this.source);
if (result === errorObj) {
return this.observer.onError(result.e);
}
this.observer.onNext(result);
/*try {
var result = this.selector(x, this.i++, this.source);
} catch (e) {
return this.observer.onError(e);
}
this.observer.onNext(result);
this.observer.onNext(result);*/
};

@@ -68,4 +73,4 @@ MapObserver.prototype.onError = function (e) {

return this instanceof MapObservable ?
this.internalMap(selector, thisArg) :
this.internalMap(selectorFn, thisArg) :
new MapObservable(this, selectorFn, thisArg);
};

@@ -10,4 +10,3 @@ var MergeAllObservable = (function (__super__) {

MergeAllObservable.prototype.subscribeCore = function (observer) {
var g = new CompositeDisposable(),
m = new SingleAssignmentDisposable();
var g = new CompositeDisposable(), m = new SingleAssignmentDisposable();
g.add(m);

@@ -21,52 +20,78 @@ m.setDisposable(this.source.subscribe(new MergeAllObserver(observer, g)));

var MergeAllObserver = (function (__super__) {
var MergeAllObserver = (function() {
inherits(MergeAllObserver, __super__);
function MergeAllObserver(observer, group) {
this.observer = observer;
this.group = group;
this.stopped = false;
__super__.call(this);
function MergeAllObserver(o, g) {
this.o = o;
this.g = g;
this.isStopped = false;
this.done = false;
}
MergeAllObserver.prototype.onNext = function(innerSource) {
if(this.isStopped) { return; }
var sad = new SingleAssignmentDisposable();
this.g.add(sad);
MergeAllObserver.prototype.next = function (innerSource) {
var innerSubscription = new SingleAssignmentDisposable();
this.group.add(innerSubscription);
// Check for promises support
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
innerSubscription.setDisposable(innerSource.subscribe(new InnerObserver(this, innerSubscription)));
sad.setDisposable(innerSource.subscribe(new InnerObserver(this, this.g, sad)));
};
MergeAllObserver.prototype.error = function (e) {
this.observer.onError(e);
MergeAllObserver.prototype.onError = function (e) {
if(!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
};
MergeAllObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
this.isStopped = true;
this.done = true;
this.g.length === 1 && this.o.onCompleted();
}
};
MergeAllObserver.prototype.dispose = function() { this.isStopped = true; };
MergeAllObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
MergeAllObserver.prototype.completed = function () {
this.stopped = true;
this.group.length === 1 && this.observer.onCompleted();
return false;
};
var InnerObserver = (function (__base__) {
inherits(InnerObserver, __base__)
function InnerObserver(parent, innerSubscription) {
this.parent = parent;
this.innerSubscription = innerSubscription;
__base__.call(this);
function InnerObserver(parent, g, sad) {
this.parent = parent;
this.g = g;
this.sad = sad;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) { if (!this.isStopped) { this.parent.o.onNext(x); } };
InnerObserver.prototype.onError = function (e) {
if(!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
}
InnerObserver.prototype.next = function (x) { this.parent.observer.onNext(x); };
InnerObserver.prototype.error = function (e) { this.parent.observer.onError(e); };
InnerObserver.prototype.completed = function () {
this.parent.group.remove(this.innerSubscription);
this.parent.stopped && this.parent.group.length === 1 && this.parent.observer.onCompleted();
};
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
var parent = this.parent;
this.isStopped = true;
parent.g.remove(this.sad);
parent.done && parent.g.length === 1 && parent.o.onCompleted();
}
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
return true;
}
return InnerObserver;
}(AbstractObserver));
return false;
};
return MergeAllObserver;
}(AbstractObserver));
}());

@@ -73,0 +98,0 @@ /**

@@ -20,69 +20,93 @@ var MergeObservable = (function (__super__) {

var MergeObserver = (function(__super__) {
inherits(MergeObserver, __super__);
function MergeObserver(observer, maxConcurrent, g) {
this.observer = observer;
this.maxConcurrent = maxConcurrent;
var MergeObserver = (function () {
function MergeObserver(o, max, g) {
this.o = o;
this.max = max;
this.g = g;
this.stopped = false;
this.done = false;
this.q = [];
this.activeCount = 0;
__super__.call(this);
this.isStopped = false;
}
MergeObserver.prototype.handleSubscribe = function (xs) {
var subscription = new SingleAssignmentDisposable();
this.g.add(subscription);
// Check for promises support
var sad = new SingleAssignmentDisposable();
this.g.add(sad);
isPromise(xs) && (xs = observableFromPromise(xs));
subscription.setDisposable(xs.subscribe(new InnerObserver(xs, this, subscription)));
sad.setDisposable(xs.subscribe(new InnerObserver(this, sad)));
};
MergeObserver.prototype.onNext = function (innerSource) {
if (this.isStopped) { return; }
if(this.activeCount < this.max) {
this.activeCount++;
this.handleSubscribe(innerSource);
} else {
this.q.push(innerSource);
}
};
MergeObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
};
MergeObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.done = true;
this.activeCount === 0 && this.o.onCompleted();
}
};
MergeObserver.prototype.dispose = function() { this.isStopped = true; };
MergeObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
MergeObserver.prototype.next = function (innerSource) {
if(this.activeCount < this.maxConcurrent) {
this.activeCount++;
this.handleSubscribe(innerSource);
} else {
this.q.push(innerSource);
}
};
return false;
};
MergeObserver.prototype.error = function (e) {
this.observer.onError(e);
};
MergeObserver.prototype.completed = function () {
this.stopped = true;
this.activeCount === 0 && this.observer.onCompleted();
};
var InnerObserver = (function(__base__) {
inherits(InnerObserver, __base__);
function InnerObserver(xs, self, subscription) {
this.xs = xs;
this.self = self;
this.subscription = subscription;
__base__.call(this);
function InnerObserver(parent, sad) {
this.parent = parent;
this.sad = sad;
this.isStopped = false;
}
InnerObserver.prototype.next = function(x) { this.self.observer.onNext(x); };
InnerObserver.prototype.error = function(e) { this.self.observer.onError(e); };
InnerObserver.prototype.completed = function () {
this.self.g.remove(this.subscription);
if (this.self.q.length > 0) {
this.self.handleSubscribe(this.self.q.shift());
} else {
this.self.activeCount--;
this.self.stopped && this.self.activeCount === 0 && this.self.observer.onCompleted();
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.parent.o.onNext(x); } };
InnerObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
}
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
var parent = this.parent;
parent.g.remove(this.sad);
if (parent.q.length > 0) {
parent.handleSubscribe(parent.q.shift());
} else {
parent.activeCount--;
parent.done && parent.activeCount === 0 && parent.o.onCompleted();
}
}
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
return true;
}
return InnerObserver;
}(AbstractObserver));
return false;
};
return MergeObserver;
return MergeObserver;
}());
}(AbstractObserver));
/**

@@ -89,0 +113,0 @@ * Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.

@@ -10,4 +10,4 @@ function observableOf (scheduler, array) {

Observable.of = function () {
var args = [];
for(var i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return new FromArrayObservable(args);

@@ -22,5 +22,5 @@ };

Observable.ofWithScheduler = function (scheduler) {
var args = [];
for(var i = 1, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
var len = arguments.length, args = new Array(len - 1);
for(var i = 1; i < len; i++) { args[i - 1] = arguments[i]; }
return new FromArrayObservable(args, scheduler);
};

@@ -24,15 +24,14 @@ var RangeObservable = (function(__super__) {

function loopRecursive(state, recurse) {
if (state.i < state.count) {
state.observer.onNext(state.start + state.i++);
recurse(state);
} else {
state.observer.onCompleted();
RangeSink.prototype.run = function () {
var start = this.parent.start, count = this.parent.count, observer = this.observer;
function loopRecursive(i, recurse) {
if (i < count) {
observer.onNext(start + i);
recurse(i + 1);
} else {
observer.onCompleted();
}
}
}
RangeSink.prototype.run = function () {
return this.parent.scheduler.scheduleRecursiveWithState(
{i: 0, start: this.parent.start, count: this.parent.count, observer: this.observer },
loopRecursive);
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};

@@ -39,0 +38,0 @@

@@ -15,18 +15,31 @@ var ToArrayObservable = (function(__super__) {

var ToArrayObserver = (function(__super__) {
inherits(ToArrayObserver, __super__);
function ToArrayObserver(observer) {
this.observer = observer;
this.a = [];
__super__.call(this);
function ToArrayObserver(observer) {
this.observer = observer;
this.a = [];
this.isStopped = false;
}
ToArrayObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.a.push(x); } };
ToArrayObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
}
ToArrayObserver.prototype.next = function (x) { this.a.push(x); };
ToArrayObserver.prototype.error = function (e) { this.observer.onError(e); };
ToArrayObserver.prototype.completed = function () {
};
ToArrayObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onNext(this.a);
this.observer.onCompleted();
};
}
};
ToArrayObserver.prototype.dispose = function () { this.isStopped = true; }
ToArrayObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return ToArrayObserver;
}(AbstractObserver));
return false;
};

@@ -33,0 +46,0 @@ /**

@@ -1,19 +0,13 @@

// Defaults
var Observer = Rx.Observer,
Observable = Rx.Observable,
Notification = Rx.Notification,
VirtualTimeScheduler = Rx.VirtualTimeScheduler,
Disposable = Rx.Disposable,
disposableEmpty = Disposable.empty,
disposableCreate = Disposable.create,
CompositeDisposable = Rx.CompositeDisposable,
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
slice = Array.prototype.slice,
inherits = Rx.internals.inherits,
defaultComparer = Rx.internals.isEqual;
function argsOrArray(args, idx) {
return args.length === 1 && Array.isArray(args[idx]) ?
args[idx] :
slice.call(args);
}
// Defaults
var Observer = Rx.Observer,
Observable = Rx.Observable,
Notification = Rx.Notification,
VirtualTimeScheduler = Rx.VirtualTimeScheduler,
Disposable = Rx.Disposable,
disposableEmpty = Disposable.empty,
disposableCreate = Disposable.create,
CompositeDisposable = Rx.CompositeDisposable,
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
slice = Array.prototype.slice,
inherits = Rx.internals.inherits,
defaultComparer = Rx.internals.isEqual;

@@ -1,14 +0,9 @@

/** @private */
var MockDisposable = Rx.MockDisposable = function (scheduler) {
this.scheduler = scheduler;
this.disposes = [];
this.disposes.push(this.scheduler.clock);
};
var MockDisposable = Rx.MockDisposable = function (scheduler) {
this.scheduler = scheduler;
this.disposes = [];
this.disposes.push(this.scheduler.clock);
};
/*
* @memberOf MockDisposable#
* @prviate
*/
MockDisposable.prototype.dispose = function () {
this.disposes.push(this.scheduler.clock);
};
MockDisposable.prototype.dispose = function () {
this.disposes.push(this.scheduler.clock);
};

@@ -113,4 +113,10 @@ /** Virtual time scheduler used for testing applications and libraries built using Reactive Extensions. */

TestScheduler.prototype.createHotObservable = function () {
var messages = argsOrArray(arguments, 0);
return new HotObservable(this, messages);
var len = arguments.length, args;
if (Array.isArray(arguments[0])) {
args = arguments[0];
} else {
args = new Array(len);
for (var i = 0; i < len; i++) { args[i] = arguments[i]; }
}
return new HotObservable(this, args);
};

@@ -124,4 +130,10 @@

TestScheduler.prototype.createColdObservable = function () {
var messages = argsOrArray(arguments, 0);
return new ColdObservable(this, messages);
var len = arguments.length, args;
if (Array.isArray(arguments[0])) {
args = arguments[0];
} else {
args = new Array(len);
for (var i = 0; i < len; i++) { args[i] = arguments[i]; }
}
return new ColdObservable(this, args);
};

@@ -128,0 +140,0 @@

;(function (factory) {
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
var root = (objectTypes[typeof window] && window) || this,
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
freeGlobal = objectTypes[typeof global] && global;
var root = (objectTypes[typeof window] && window) || this,
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
freeGlobal = objectTypes[typeof global] && global;
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
root = freeGlobal;
}
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
root = freeGlobal;
}
// Because of build optimizers
if (typeof define === 'function' && define.amd) {
define(['rx.virtualtime', 'exports'], function (Rx, exports) {
root.Rx = factory(root, exports, Rx);
return root.Rx;
});
} else if (typeof module === 'object' && module && module.exports === freeExports) {
module.exports = factory(root, module.exports, require('./rx.all'));
} else {
root.Rx = factory(root, {}, root.Rx);
}
// Because of build optimizers
if (typeof define === 'function' && define.amd) {
define(['rx.virtualtime', 'exports'], function (Rx, exports) {
root.Rx = factory(root, exports, Rx);
return root.Rx;
});
} else if (typeof module === 'object' && module && module.exports === freeExports) {
module.exports = factory(root, module.exports, require('./rx'));
} else {
root.Rx = factory(root, {}, root.Rx);
}
}.call(this, function (root, exp, Rx, undefined) {

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

Sorry, the diff of this file is not supported yet

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

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

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is 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 too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc