rxjs-rails 2.3.0 → 2.3.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rxjs/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/rx.aggregates.js +115 -27
  4. data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
  5. data/vendor/assets/javascripts/rx.all.compat.js +2751 -2702
  6. data/vendor/assets/javascripts/rx.all.compat.min.js +3 -3
  7. data/vendor/assets/javascripts/rx.all.js +2605 -2589
  8. data/vendor/assets/javascripts/rx.all.min.js +3 -3
  9. data/vendor/assets/javascripts/rx.async.compat.js +41 -22
  10. data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
  11. data/vendor/assets/javascripts/rx.async.js +41 -22
  12. data/vendor/assets/javascripts/rx.async.min.js +1 -1
  13. data/vendor/assets/javascripts/rx.backpressure.js +41 -45
  14. data/vendor/assets/javascripts/rx.backpressure.min.js +1 -1
  15. data/vendor/assets/javascripts/rx.binding.js +81 -111
  16. data/vendor/assets/javascripts/rx.binding.min.js +1 -1
  17. data/vendor/assets/javascripts/rx.coincidence.js +567 -486
  18. data/vendor/assets/javascripts/rx.coincidence.min.js +1 -1
  19. data/vendor/assets/javascripts/rx.compat.js +1430 -1532
  20. data/vendor/assets/javascripts/rx.compat.min.js +2 -2
  21. data/vendor/assets/javascripts/rx.core.compat.js +76 -127
  22. data/vendor/assets/javascripts/rx.core.compat.min.js +1 -1
  23. data/vendor/assets/javascripts/rx.core.js +76 -127
  24. data/vendor/assets/javascripts/rx.core.min.js +1 -1
  25. data/vendor/assets/javascripts/rx.experimental.js +36 -36
  26. data/vendor/assets/javascripts/rx.experimental.min.js +1 -1
  27. data/vendor/assets/javascripts/rx.joinpatterns.js +281 -281
  28. data/vendor/assets/javascripts/rx.js +1286 -1421
  29. data/vendor/assets/javascripts/rx.lite.compat.js +1443 -1749
  30. data/vendor/assets/javascripts/rx.lite.compat.min.js +2 -2
  31. data/vendor/assets/javascripts/rx.lite.extras.js +133 -205
  32. data/vendor/assets/javascripts/rx.lite.extras.min.js +1 -1
  33. data/vendor/assets/javascripts/rx.lite.js +1319 -1658
  34. data/vendor/assets/javascripts/rx.lite.min.js +2 -2
  35. data/vendor/assets/javascripts/rx.min.js +2 -2
  36. data/vendor/assets/javascripts/rx.testing.js +302 -322
  37. data/vendor/assets/javascripts/rx.testing.min.js +1 -1
  38. data/vendor/assets/javascripts/rx.time.js +90 -75
  39. data/vendor/assets/javascripts/rx.time.min.js +1 -1
  40. data/vendor/assets/javascripts/rx.virtualtime.js +264 -279
  41. data/vendor/assets/javascripts/rx.virtualtime.min.js +1 -1
  42. metadata +10 -11
@@ -1,2 +1,2 @@
1
- (function(a){function b(){if(this.isDisposed)throw new Error(N)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;ib.nonEnumArgs&&a.length&&h(a)&&(a=kb.call(a));var d=ib.enumPrototypes&&"function"==typeof a,e=ib.enumErrorProps&&(a===cb||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(ib.nonEnumShadows&&a!==db){var g=a.constructor,i=-1,j=gb.length;if(a===(g&&g.prototype))var k=a===stringProto?$:a===cb?V:_.call(a),l=hb[k];for(;++i<j;)f=gb[i],l&&l[f]||!ab.call(a,f)||b.push(f)}return b}function e(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function f(a,b){return e(a,b,d)}function g(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function h(a){return a&&"object"==typeof a?_.call(a)==R:!1}function i(a){return"function"==typeof a||!1}function j(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,k=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=k&&"object"!=k))return!1;var l=_.call(a),m=_.call(b);if(l==R&&(l=Y),m==R&&(m=Y),l!=m)return!1;switch(l){case T:case U:return+a==+b;case X:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case Z:case $:return a==String(b)}var n=l==S;if(!n){if(l!=Y||!ib.nodeClass&&(g(a)||g(b)))return!1;var o=!ib.argsObject&&h(a)?Object:a.constructor,p=!ib.argsObject&&h(b)?Object:b.constructor;if(!(o==p||ab.call(a,"constructor")&&ab.call(b,"constructor")||i(o)&&o instanceof o&&i(p)&&p instanceof p||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var q=c.length;q--;)if(c[q]==a)return d[q]==b;var r=0;if(result=!0,c.push(a),d.push(b),n){if(q=a.length,r=b.length,result=r==q)for(;r--;){var s=b[r];if(!(result=j(a[r],s,c,d)))break}}else f(b,function(b,e,f){return ab.call(f,e)?(r++,result=ab.call(a,e)&&j(a[e],b,c,d)):void 0}),result&&f(a,function(a,b,c){return ab.call(c,b)?result=--r>-1:void 0});return c.pop(),d.pop(),result}function k(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:kb.call(a)}function l(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function m(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function n(a){return"number"==typeof a&&x.isFinite(a)}function o(b){return b[O]!==a}function p(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function q(a){var b=+a.length;return isNaN(b)?0:0!==b&&n(b)?(b=p(b)*Math.floor(Math.abs(b)),0>=b?0:b>bc?bc:b):b}function r(a){return"[object Function]"===Object.prototype.toString.call(a)&&"function"==typeof a}function s(a,b){return new lc(function(c){var d=new zb,e=new Ab;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}L(f)&&(f=_b(f)),d=new zb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function t(a,b){var c=this;return new lc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return void d.onError(i)}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function u(a){return this.map(function(b,c){var d=a(b,c);return L(d)?_b(d):d}).concatAll()}function v(a){return this.select(function(b,c){var d=a(b,c);return L(d)?_b(d):d}).mergeObservable()}var w={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},x=w[typeof window]&&window||this,y=w[typeof exports]&&exports&&!exports.nodeType&&exports,z=w[typeof module]&&module&&!module.nodeType&&module,A=z&&z.exports===y&&y,B=w[typeof global]&&global;!B||B.global!==B&&B.window!==B||(x=B);var C={internals:{},config:{Promise:x.Promise},helpers:{}},D=C.helpers.noop=function(){},E=(C.helpers.notDefined=function(a){return"undefined"==typeof a},C.helpers.isScheduler=function(a){return a instanceof C.Scheduler}),F=C.helpers.identity=function(a){return a},G=(C.helpers.pluck=function(a){return function(b){return b[a]}},C.helpers.just=function(a){return function(){return a}},C.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}()),H=C.helpers.defaultComparer=function(a,b){return jb(a,b)},I=C.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},J=C.helpers.defaultKeySerializer=function(a){return a.toString()},K=C.helpers.defaultError=function(a){throw a},L=C.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then&&a.then!==C.Observable.prototype.then},M=(C.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},C.helpers.not=function(a){return!a},"Argument out of range"),N="Object has been disposed",O="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";x.Set&&"function"==typeof(new x.Set)["@@iterator"]&&(O="@@iterator");var P,Q={done:!0,value:a},R="[object Arguments]",S="[object Array]",T="[object Boolean]",U="[object Date]",V="[object Error]",W="[object Function]",X="[object Number]",Y="[object Object]",Z="[object RegExp]",$="[object String]",_=Object.prototype.toString,ab=Object.prototype.hasOwnProperty,bb=_.call(arguments)==R,cb=Error.prototype,db=Object.prototype,eb=db.propertyIsEnumerable;try{P=!(_.call(document)==Y&&!({toString:0}+""))}catch(fb){P=!0}var gb=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],hb={};hb[S]=hb[U]=hb[X]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},hb[T]=hb[$]={constructor:!0,toString:!0,valueOf:!0},hb[V]=hb[W]=hb[Z]={constructor:!0,toString:!0},hb[Y]={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=eb.call(cb,"message")||eb.call(cb,"name"),ib.enumPrototypes=eb.call(a,"prototype"),ib.nonEnumArgs=0!=c,ib.nonEnumShadows=!/valueOf/.test(b)}(1),bb||(h=function(a){return a&&"object"==typeof a?ab.call(a,"callee"):!1}),i(/x/)&&(i=function(a){return"function"==typeof a&&_.call(a)==W});var jb=C.internals.isEqual=function(a,b){return j(a,b,[],[])},kb=Array.prototype.slice,lb=({}.hasOwnProperty,this.inherits=C.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),mb=C.internals.addProperties=function(a){for(var b=kb.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},nb=C.internals.addRef=function(a,b){return new lc(function(c){return new tb(b.getDisposable(),a.subscribe(c))})};Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=kb.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(kb.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(kb.call(arguments)))};return d});var ob=Object("a"),pb="a"!=ob[0]||!(0 in ob);Array.prototype.every||(Array.prototype.every=function(a){var b=Object(this),c=pb&&{}.toString.call(this)==$?this.split(""):b,d=c.length>>>0,e=arguments[1];if({}.toString.call(a)!=W)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=pb&&{}.toString.call(this)==$?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if({}.toString.call(a)!=W)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 Object.prototype.toString.call(a)==S}),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});var qb=function(a,b){this.id=a,this.value=b};qb.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var rb=C.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},sb=rb.prototype;sb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},sb.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)}}},sb.heapify=function(b){if(b===a&&(b=0),!(b>=this.length||0>b)){var c=2*b+1,d=2*b+2,e=b;if(c<this.length&&this.isHigherPriority(c,e)&&(e=c),d<this.length&&this.isHigherPriority(d,e)&&(e=d),e!==b){var f=this.items[b];this.items[b]=this.items[e],this.items[e]=f,this.heapify(e)}}},sb.peek=function(){return this.items[0].value},sb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},sb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},sb.enqueue=function(a){var b=this.length++;this.items[b]=new qb(rb.count++,a),this.percolate(b)},sb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},rb.count=0;var tb=C.CompositeDisposable=function(){this.disposables=k(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},ub=tb.prototype;ub.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},ub.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},ub.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},ub.clear=function(){var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()},ub.contains=function(a){return-1!==this.disposables.indexOf(a)},ub.toArray=function(){return this.disposables.slice(0)};var vb=C.Disposable=function(a){this.isDisposed=!1,this.action=a||D};vb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var wb=vb.create=function(a){return new vb(a)},xb=vb.empty={dispose:D},yb=function(){function a(a){this.isSingle=a,this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){if(this.current&&this.isSingle)throw new Error("Disposable has already been assigned");var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),zb=C.SingleAssignmentDisposable=function(a){function b(){a.call(this,!0)}return lb(b,a),b}(yb),Ab=C.SerialDisposable=function(a){function b(){a.call(this,!1)}return lb(b,a),b}(yb),Bb=C.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?xb:new a(this)},b}();m.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var Cb=C.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||I,this.disposable=new zb};Cb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Cb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Cb.prototype.isCancelled=function(){return this.disposable.isDisposed},Cb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Db,Eb=C.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){var c=b.first,d=b.second,e=new tb,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),xb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new tb,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),xb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){return b(),xb}var e=a.prototype;return e.catchException=e["catch"]=function(a){return new Jb(this,a)},e.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,function(){b()})},e.schedulePeriodicWithState=function(a,b,c){var d=a,e=setInterval(function(){d=c(d)},b);return wb(function(){clearInterval(e)})},e.schedule=function(a){return this._schedule(a,d)},e.scheduleWithState=function(a,b){return this._schedule(a,b)},e.scheduleWithRelative=function(a,b){return this._scheduleRelative(b,a,d)},e.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},e.scheduleWithAbsolute=function(a,b){return this._scheduleAbsolute(b,a,d)},e.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},e.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},e.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},function(a,c){return b(a,c)})},e.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})},a.now=G,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Fb=Eb.normalize,Gb=(C.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}(),Eb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Fb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Eb(G,a,b,c)}()),Hb=Eb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Eb.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()+Eb.normalize(c),g=new Cb(this,b,d,f);if(e)e.enqueue(g);else{e=new rb(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 Eb(G,b,c,d);return f.scheduleRequired=function(){return null===e},f.ensureTrampoline=function(a){return null===e?this.schedule(a):a()},f}(),Ib=D;!function(){function a(){if(!x.postMessage||x.importScripts)return!1;var a=!1,b=x.onmessage;return x.onmessage=function(){a=!0},x.postMessage("","*"),x.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(_).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=B&&A&&B.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=B&&A&&B.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Db=process.nextTick;else if("function"==typeof d)Db=d,Ib=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;x.addEventListener?x.addEventListener("message",b,!1):x.attachEvent("onmessage",b,!1),Db=function(a){var b=h++;g[b]=a,x.postMessage(f+b,"*")}}else if(x.MessageChannel){var i=new x.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Db=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in x&&"onreadystatechange"in x.document.createElement("script")?Db=function(a){var b=x.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},x.document.documentElement.appendChild(b)}:(Db=function(a){return setTimeout(a,0)},Ib=clearTimeout)}();var Jb=(Eb.timeout=function(){function a(a,b){var c=this,d=new zb,e=Db(function(){d.isDisposed||d.setDisposable(b(c,a))});return new tb(d,wb(function(){Ib(e)}))}function b(a,b,c){var d=this,e=Eb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new zb,g=setTimeout(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new tb(f,wb(function(){clearTimeout(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Eb(G,a,b,c)}(),function(a){function b(){return this._scheduler.now()}function c(a,b){return this._scheduler.scheduleWithState(a,this._wrap(b))}function d(a,b,c){return this._scheduler.scheduleWithRelativeAndState(a,b,this._wrap(c))}function e(a,b,c){return this._scheduler.scheduleWithAbsoluteAndState(a,b,this._wrap(c))}function f(f,g){this._scheduler=f,this._handler=g,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this,b,c,d,e)}return lb(f,a),f.prototype._clone=function(a){return new f(a,this._handler)},f.prototype._wrap=function(a){var b=this;return function(c,d){try{return a(b._getRecursiveWrapper(c),d)}catch(e){if(!b._handler(e))throw e;return xb}}},f.prototype._getRecursiveWrapper=function(a){if(this._recursiveOriginal!==a){this._recursiveOriginal=a;var b=this._clone(a);b._recursiveOriginal=a,b._recursiveWrapper=b,this._recursiveWrapper=b}return this._recursiveWrapper},f.prototype.schedulePeriodicWithState=function(a,b,c){var d=this,e=!1,f=new zb;return f.setDisposable(this._scheduler.schedulePeriodicWithState(a,b,function(a){if(e)return null;try{return c(a)}catch(b){if(e=!0,!d._handler(b))throw b;return f.dispose(),null}})),f},f}(Eb)),Kb=C.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 E(a)||(a=Gb),new lc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Lb=Kb.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 Kb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Mb=Kb.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 Kb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Nb=Kb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Kb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Ob=C.internals.Enumerator=function(a){this._next=a};Ob.prototype.next=function(){return this._next()},Ob.prototype[O]=function(){return this};var Pb=C.internals.Enumerable=function(a){this._iterator=a};Pb.prototype[O]=function(){return this._iterator()},Pb.prototype.concat=function(){var a=this;return new lc(function(b){var c;try{c=a[O]()}catch(d){return void b.onError()}var e,f=new Ab,g=Gb.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;L(h)&&(h=_b(h));var i=new zb;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new tb(f,g,wb(function(){e=!0}))})},Pb.prototype.catchException=function(){var a=this;return new lc(function(b){var c;try{c=a[O]()}catch(d){return void b.onError()}var e,f,g=new Ab,h=Gb.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;L(i)&&(i=_b(i));var j=new zb;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new tb(g,h,wb(function(){e=!0}))})};var Qb=Pb.repeat=function(a,b){return null==b&&(b=-1),new Pb(function(){var c=b;return new Ob(function(){return 0===c?Q:(c>0&&c--,{done:!1,value:a})})})},Rb=Pb.forEach=function(a,b,c){return b||(b=F),new Pb(function(){var d=-1;return new Ob(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:Q})})},Sb=C.Observer=function(){};Sb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Sb.prototype.asObserver=function(){return new Wb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Sb.prototype.checked=function(){return new Xb(this)};var Tb=Sb.create=function(a,b,c){return a||(a=D),b||(b=K),c||(c=D),new Wb(a,b,c)};Sb.fromNotifier=function(a){return new Wb(function(b){return a(Lb(b))},function(b){return a(Mb(b))},function(){return a(Nb())})},Sb.notifyOn=function(a){return new Zb(a,this)};var Ub,Vb=C.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return lb(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}(Sb),Wb=C.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return lb(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}(Vb),Xb=function(a){function b(b){a.call(this),this._observer=b,this._state=0}lb(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}(Sb),Yb=C.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new Ab}return lb(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}(Vb),Zb=function(a){function b(){a.apply(this,arguments)}return lb(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}(Yb),$b=C.Observable=function(){function a(a){this._subscribe=a}return Ub=a.prototype,Ub.subscribe=Ub.forEach=function(a,b,c){var d="object"==typeof a?a:Tb(a,b,c);return this._subscribe(d)},a}();Ub.observeOn=function(a){var b=this;return new lc(function(c){return b.subscribe(new Zb(a,c))})},Ub.subscribeOn=function(a){var b=this;return new lc(function(c){var d=new zb,e=new Ab;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new m(a,b.subscribe(c)))})),e})};var _b=$b.fromPromise=function(a){return new lc(function(b){return a.then(function(a){b.onNext(a),b.onCompleted()},function(a){b.onError(a)}),function(){a&&a.abort&&a.abort()}})};Ub.toPromise=function(a){if(a||(a=C.config.Promise),!a)throw new Error("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},function(a){c(a)},function(){e&&a(d)})})},Ub.toArray=function(){var a=this;return new lc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})})},$b.create=$b.createWithDisposable=function(a){return new lc(a)};var ac=($b.defer=function(a){return new lc(function(b){var c;try{c=a()}catch(d){return fc(d).subscribe(b)}return L(c)&&(c=_b(c)),c.subscribe(b)})},$b.empty=function(a){return E(a)||(a=Gb),new lc(function(b){return a.schedule(function(){b.onCompleted()})})}),bc=Math.pow(2,53)-1;$b.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!r(b))throw new Error("mapFn when provided must be a function");return E(d)||(d=Hb),new lc(function(e){var f=Object(a),g=o(f),h=g?0:q(f),i=g?f[O]():null,j=0;return d.scheduleRecursive(function(a){if(h>j||g){var d;if(g){var k=i.next();if(k.done)return void e.onCompleted();d=k.value}else d=f[j];if(b&&r(b))try{d=c?b.call(c,d,j):b(d,j)}catch(l){return void e.onError(l)}e.onNext(d),j++,a()}else e.onCompleted()})})};var cc=$b.fromArray=function(a,b){return E(b)||(b=Hb),new lc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};$b.generate=function(a,b,c,d,e){return E(e)||(e=Hb),new lc(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 dc=$b.never=function(){return new lc(function(){return xb})};$b.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return cc(b)};$b.ofWithScheduler=function(a){for(var b=arguments.length-1,c=new Array(b),d=0;b>d;d++)c[d]=arguments[d+1];return cc(c,a)};$b.range=function(a,b,c){return E(c)||(c=Hb),new lc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},$b.repeat=function(a,b,c){return E(c)||(c=Hb),ec(a,c).repeat(null==b?-1:b)};var ec=$b["return"]=$b.returnValue=$b.just=function(a,b){return E(b)||(b=Gb),new lc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},fc=$b["throw"]=$b.throwException=function(a,b){return E(b)||(b=Gb),new lc(function(c){return b.schedule(function(){c.onError(a)})})};$b.using=function(a,b){return new lc(function(c){var d,e,f=xb;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new tb(fc(g).subscribe(c),f)}return new tb(e.subscribe(c),f)})},Ub.amb=function(a){var b=this;return new lc(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 L(a)&&(a=_b(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 tb(i,j)})},$b.amb=function(){function a(a,b){return a.amb(b)}for(var b=dc(),c=k(arguments,0),d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},Ub["catch"]=Ub.catchException=function(a){return"function"==typeof a?s(this,a):gc([this,a])};var gc=$b.catchException=$b["catch"]=function(){var a=k(arguments,0);return Rb(a).catchException()};Ub.combineLatest=function(){var a=kb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),hc.apply(this,a)};var hc=$b.combineLatest=function(){var a=kb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new lc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(F))){try{d=b.apply(null,k)}catch(e){return void c.onError(e)}c.onNext(d)}else j.filter(function(b,c){return c!==a}).every(F)&&c.onCompleted()}function e(a){j[a]=!0,j.every(F)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=l(g,f),i=!1,j=l(g,f),k=new Array(g),m=new Array(g),n=0;g>n;n++)!function(b){var f=a[b],g=new zb;L(f)&&(f=_b(f)),g.setDisposable(f.subscribe(function(a){k[b]=a,d(b)},c.onError.bind(c),function(){e(b)})),m[b]=g}(n);return new tb(m)})};Ub.concat=function(){var a=kb.call(arguments,0);return a.unshift(this),ic.apply(this,a)};var ic=$b.concat=function(){var a=k(arguments,0);return Rb(a).concat()};Ub.concatObservable=Ub.concatAll=function(){return this.merge(1)},Ub.merge=function(a){if("number"!=typeof a)return jc(this,a);var b=this;return new lc(function(c){var d=0,e=new tb,f=!1,g=[],h=function(a){var b=new zb;e.add(b),L(a)&&(a=_b(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){var a;e.remove(b),g.length>0?(a=g.shift(),h(a)):(d--,f&&0===d&&c.onCompleted())}))};return e.add(b.subscribe(function(b){a>d?(d++,h(b)):g.push(b)},c.onError.bind(c),function(){f=!0,0===d&&c.onCompleted()})),e})};var jc=$b.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=kb.call(arguments,1)):(a=Gb,b=kb.call(arguments,0)):(a=Gb,b=kb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),cc(b,a).mergeObservable()};Ub.mergeObservable=Ub.mergeAll=function(){var a=this;return new lc(function(b){var c=new tb,d=!1,e=new zb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new zb;c.add(e),L(a)&&(a=_b(a)),e.setDisposable(a.subscribe(function(a){b.onNext(a)},b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Ub.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return kc([this,a])};var kc=$b.onErrorResumeNext=function(){var a=k(arguments,0);return new lc(function(b){var c=0,d=new Ab,e=Gb.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],L(f)&&(f=_b(f)),g=new zb,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),function(){e()},function(){e()}))):b.onCompleted()});return new tb(d,e)})};Ub.skipUntil=function(a){var b=this;return new lc(function(c){var d=!1,e=new tb(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));L(a)&&(a=_b(a));var f=new zb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Ub["switch"]=Ub.switchLatest=function(){var a=this;return new lc(function(b){var c=!1,d=new Ab,e=!1,f=0,g=a.subscribe(function(a){var g=new zb,h=++f;c=!0,d.setDisposable(g),L(a)&&(a=_b(a)),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)},function(a){f===h&&b.onError(a)
2
- },function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,c||b.onCompleted()});return new tb(g,d)})},Ub.takeUntil=function(a){var b=this;return new lc(function(c){return L(a)&&(a=_b(a)),new tb(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),D))})},Ub.zip=function(){if(Array.isArray(arguments[0]))return t.apply(this,arguments);var a=this,b=kb.call(arguments),c=b.pop();return b.unshift(a),new lc(function(d){function e(b){var e,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),e=c.apply(a,f)}catch(g){return void d.onError(g)}d.onNext(e)}else i.filter(function(a,c){return c!==b}).every(F)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=l(g,function(){return[]}),i=l(g,function(){return!1}),j=new Array(g),k=0;g>k;k++)!function(a){var c=b[a],g=new zb;L(c)&&(c=_b(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},d.onError.bind(d),function(){f(a)})),j[a]=g}(k);return new tb(j)})},$b.zip=function(){var a=kb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},$b.zipArray=function(){var a=k(arguments,0);return new lc(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(F))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(F)?void b.onCompleted():void 0}for(var e=a.length,f=l(e,function(){return[]}),g=l(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new zb,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},b.onError.bind(b),function(){d(e)}))}(i);var j=new tb(h);return j.add(wb(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},Ub.asObservable=function(){var a=this;return new lc(function(b){return a.subscribe(b)})},Ub.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})},Ub.dematerialize=function(){var a=this;return new lc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Ub.distinctUntilChanged=function(a,b){var c=this;return a||(a=F),b||(b=H),new lc(function(d){var e,f=!1;return c.subscribe(function(c){var g,h=!1;try{g=a(c)}catch(i){return void d.onError(i)}if(f)try{h=b(e,g)}catch(i){return void d.onError(i)}f&&h||(f=!0,e=g,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))})},Ub["do"]=Ub.doAction=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new lc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b){try{b(c)}catch(d){a.onError(d)}a.onError(c)}else a.onError(c)},function(){if(c){try{c()}catch(b){a.onError(b)}a.onCompleted()}else a.onCompleted()})})},Ub["finally"]=Ub.finallyAction=function(a){var b=this;return new lc(function(c){var d;try{d=b.subscribe(c)}catch(e){throw a(),e}return wb(function(){try{d.dispose()}catch(b){throw b}finally{a()}})})},Ub.ignoreElements=function(){var a=this;return new lc(function(b){return a.subscribe(D,b.onError.bind(b),b.onCompleted.bind(b))})},Ub.materialize=function(){var a=this;return new lc(function(b){return a.subscribe(function(a){b.onNext(Lb(a))},function(a){b.onNext(Mb(a)),b.onCompleted()},function(){b.onNext(Nb()),b.onCompleted()})})},Ub.repeat=function(a){return Qb(this,a).concat()},Ub.retry=function(a){return Qb(this,a).catchException()},Ub.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 lc(function(e){var f,g,h;return d.subscribe(function(d){try{h||(h=!0),f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return void e.onError(i)}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Ub.skipLast=function(a){var b=this;return new lc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},Ub.startWith=function(){var a,b,c=0;return arguments.length&&"now"in Object(arguments[0])?(b=arguments[0],c=1):b=Gb,a=kb.call(arguments,c),Rb([cc(a,b),this]).concat()},Ub.takeLast=function(a,b){return this.takeLastBuffer(a).selectMany(function(a){return cc(a,b)})},Ub.takeLastBuffer=function(a){var b=this;return new lc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})},Ub.windowWithCount=function(a,b){var c=this;if(0>=a)throw new Error(M);if(1===arguments.length&&(b=a),0>=b)throw new Error(M);return new lc(function(d){var e=new zb,f=new Bb(e),g=0,h=[],i=function(){var a=new pc;h.push(a),d.onNext(nb(a,f))};return i(),e.setDisposable(c.subscribe(function(c){for(var d,e=0,f=h.length;f>e;e++)h[e].onNext(c);var j=g-a+1;j>=0&&j%b===0&&(d=h.shift(),d.onCompleted()),g++,g%b===0&&i()},function(a){for(;h.length>0;)h.shift().onError(a);d.onError(a)},function(){for(;h.length>0;)h.shift().onCompleted();d.onCompleted()})),f})},Ub.selectConcat=Ub.concatMap=function(a,b){return b?this.concatMap(function(c,d){var e=a(c,d),f=L(e)?_b(e):e;return f.map(function(a){return b(c,a,d)})}):"function"==typeof a?u.call(this,a):u.call(this,function(){return a})},Ub.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new lc(function(a){var d=!1;return c.subscribe(function(b){d=!0,a.onNext(b)},a.onError.bind(a),function(){d||a.onNext(b),a.onCompleted()})})},Ub.distinct=function(a,b){var c=this;return a||(a=F),b||(b=J),new lc(function(d){var e={};return c.subscribe(function(c){var f,g,h,i=!1;try{f=a(c),g=b(f)}catch(j){return void d.onError(j)}for(h in e)if(g===h){i=!0;break}i||(e[g]=null,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))})},Ub.groupBy=function(a,b,c){return this.groupByUntil(a,b,function(){return dc()},c)},Ub.groupByUntil=function(a,b,c,d){var e=this;return b||(b=F),d||(d=J),new lc(function(f){var g={},h=new tb,i=new Bb(h);return h.add(e.subscribe(function(e){var j,k,l,m,n,o,p,q,r,s;try{o=a(e),p=d(o)}catch(t){for(s in g)g[s].onError(t);return void f.onError(t)}m=!1;try{r=g[p],r||(r=new pc,g[p]=r,m=!0)}catch(t){for(s in g)g[s].onError(t);return void f.onError(t)}if(m){n=new nc(o,r,i),k=new nc(o,r);try{j=c(k)}catch(t){for(s in g)g[s].onError(t);return void f.onError(t)}f.onNext(n),q=new zb,h.add(q);var u=function(){p in g&&(delete g[p],r.onCompleted()),h.remove(q)};q.setDisposable(j.take(1).subscribe(D,function(a){for(s in g)g[s].onError(a);f.onError(a)},function(){u()}))}try{l=b(e)}catch(t){for(s in g)g[s].onError(t);return void f.onError(t)}r.onNext(l)},function(a){for(var b in g)g[b].onError(a);f.onError(a)},function(){for(var a in g)g[a].onCompleted();f.onCompleted()})),i})},Ub.select=Ub.map=function(a,b){var c=this;return new lc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Ub.pluck=function(a){return this.select(function(b){return b[a]})},Ub.selectMany=Ub.flatMap=function(a,b){return b?this.selectMany(function(c,d){var e=a(c,d),f=L(e)?_b(e):e;return f.select(function(a){return b(c,a,d)})}):"function"==typeof a?v.call(this,a):v.call(this,function(){return a})},Ub.selectSwitch=Ub.flatMapLatest=Ub.switchMap=function(a,b){return this.select(a,b).switchLatest()},Ub.skip=function(a){if(0>a)throw new Error(M);var b=this;return new lc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Ub.skipWhile=function(a,b){var c=this;return new lc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Ub.take=function(a,b){if(0>a)throw new Error(M);if(0===a)return ac(b);var c=this;return new lc(function(b){var d=a;return c.subscribe(function(a){d>0&&(d--,b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Ub.takeWhile=function(a,b){var c=this;return new lc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Ub.where=Ub.filter=function(a,b){var c=this;return new lc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},Ub.exclusive=function(){var a=this;return new lc(function(b){var c=!1,d=!1,e=new zb,f=new tb;return f.add(e),e.setDisposable(a.subscribe(function(a){if(!c){c=!0,L(a)&&(a=_b(a));var e=new zb;f.add(e),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){f.remove(e),c=!1,d&&1===f.length&&b.onCompleted()}))}},b.onError.bind(b),function(){d=!0,c||1!==f.length||b.onCompleted()})),f})},Ub.exclusiveMap=function(a,b){var c=this;return new lc(function(d){var e=0,f=!1,g=!0,h=new zb,i=new tb;return i.add(h),h.setDisposable(c.subscribe(function(c){f||(f=!0,innerSubscription=new zb,i.add(innerSubscription),L(c)&&(c=_b(c)),innerSubscription.setDisposable(c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),function(){i.remove(innerSubscription),f=!1,g&&1===i.length&&d.onCompleted()})))},d.onError.bind(d),function(){g=!0,1!==i.length||f||d.onCompleted()})),i})};var lc=C.AnonymousObservable=function(a){function b(a){return"undefined"==typeof a?a=xb:"function"==typeof a&&(a=wb(a)),a}function c(d){function e(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new mc(a);return Hb.scheduleRequired()?Hb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return lb(c,a),c}($b),mc=function(a){function b(b){a.call(this),this.observer=b,this.m=new zb}lb(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Vb),nc=function(a){function b(a){return this.underlyingObservable.subscribe(a)}function c(c,d,e){a.call(this,b),this.key=c,this.underlyingObservable=e?new lc(function(a){return new tb(e.getDisposable(),d.subscribe(a))}):d}return lb(c,a),c}($b),oc=function(a,b){this.subject=a,this.observer=b};oc.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 pc=C.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),xb):(a.onCompleted(),xb):(this.observers.push(a),new oc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return lb(d,a),mb(d.prototype,Sb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new qc(a,b)},d}($b),qc=(C.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new oc(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),xb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return lb(d,a),mb(d.prototype,Sb,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}($b),function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){a.call(this,b),this.observer=c,this.observable=d}return lb(c,a),mb(c.prototype,Sb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}($b));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(x.Rx=C,define(function(){return C})):y&&z?A?(z.exports=C).Rx=C:y.Rx=C:x.Rx=C}).call(this);
1
+ (function(a){function b(){if(this.isDisposed)throw new Error(O)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;jb.nonEnumArgs&&a.length&&h(a)&&(a=lb.call(a));var d=jb.enumPrototypes&&"function"==typeof a,e=jb.enumErrorProps&&(a===db||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(jb.nonEnumShadows&&a!==eb){var g=a.constructor,i=-1,j=hb.length;if(a===(g&&g.prototype))var k=a===stringProto?_:a===db?W:ab.call(a),l=ib[k];for(;++i<j;)f=hb[i],l&&l[f]||!bb.call(a,f)||b.push(f)}return b}function e(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function f(a,b){return e(a,b,d)}function g(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function h(a){return a&&"object"==typeof a?ab.call(a)==S:!1}function i(a){return"function"==typeof a||!1}function j(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,k=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=k&&"object"!=k))return!1;var l=ab.call(a),m=ab.call(b);if(l==S&&(l=Z),m==S&&(m=Z),l!=m)return!1;switch(l){case U:case V:return+a==+b;case Y:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case $:case _:return a==String(b)}var n=l==T;if(!n){if(l!=Z||!jb.nodeClass&&(g(a)||g(b)))return!1;var o=!jb.argsObject&&h(a)?Object:a.constructor,p=!jb.argsObject&&h(b)?Object:b.constructor;if(!(o==p||bb.call(a,"constructor")&&bb.call(b,"constructor")||i(o)&&o instanceof o&&i(p)&&p instanceof p||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var q=c.length;q--;)if(c[q]==a)return d[q]==b;var r=0;if(result=!0,c.push(a),d.push(b),n){if(q=a.length,r=b.length,result=r==q)for(;r--;){var s=b[r];if(!(result=j(a[r],s,c,d)))break}}else f(b,function(b,e,f){return bb.call(f,e)?(r++,result=bb.call(a,e)&&j(a[e],b,c,d)):void 0}),result&&f(a,function(a,b,c){return bb.call(c,b)?result=--r>-1:void 0});return c.pop(),d.pop(),result}function k(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:lb.call(a)}function l(a,b){for(var c=new Array(a),d=0;a>d;d++)c[d]=b();return c}function m(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function n(a){return"number"==typeof a&&z.isFinite(a)}function o(b){return b[P]!==a}function p(a){var b=+a;return 0===b?b:isNaN(b)?b:0>b?-1:1}function q(a){var b=+a.length;return isNaN(b)?0:0!==b&&n(b)?(b=p(b)*Math.floor(Math.abs(b)),0>=b?0:b>bc?bc:b):b}function r(a){return"[object Function]"===Object.prototype.toString.call(a)&&"function"==typeof a}function s(a,b){return new lc(function(c){var d=new zb,e=new SerialDisposable;return e.setDisposable(d),d.setDisposable(a.subscribe(c.onNext.bind(c),function(a){var d,f;try{f=b(a)}catch(g){return void c.onError(g)}M(f)&&(f=$b(f)),d=new zb,e.setDisposable(d),d.setDisposable(f.subscribe(c))},c.onCompleted.bind(c))),e})}function t(a,b){var c=this;return new lc(function(d){var e=0,f=a.length;return c.subscribe(function(c){if(f>e){var g,h=a[e++];try{g=b(c,h)}catch(i){return void d.onError(i)}d.onNext(g)}else d.onCompleted()},d.onError.bind(d),d.onCompleted.bind(d))})}function u(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return M(e)?$b(e):e}).concatAll()}function v(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function w(a){this.comparer=a,this.set=[]}function x(a,b,c){return a.map(function(a,d){var e=b.call(c,a,d);return M(e)?$b(e):e}).mergeObservable()}var y={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},z=y[typeof window]&&window||this,A=y[typeof exports]&&exports&&!exports.nodeType&&exports,B=y[typeof module]&&module&&!module.nodeType&&module,C=B&&B.exports===A&&A,D=y[typeof global]&&global;!D||D.global!==D&&D.window!==D||(z=D);var E={internals:{},config:{Promise:z.Promise},helpers:{}},F=E.helpers.noop=function(){},G=(E.helpers.notDefined=function(a){return"undefined"==typeof a},E.helpers.isScheduler=function(a){return a instanceof E.Scheduler}),H=E.helpers.identity=function(a){return a},I=(E.helpers.pluck=function(a){return function(b){return b[a]}},E.helpers.just=function(a){return function(){return a}},E.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}()),J=E.helpers.defaultComparer=function(a,b){return kb(a,b)},K=E.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0},L=(E.helpers.defaultKeySerializer=function(a){return a.toString()},E.helpers.defaultError=function(a){throw a}),M=E.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},N=(E.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},E.helpers.not=function(a){return!a},"Argument out of range"),O="Object has been disposed",P="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";z.Set&&"function"==typeof(new z.Set)["@@iterator"]&&(P="@@iterator");var Q,R={done:!0,value:a},S="[object Arguments]",T="[object Array]",U="[object Boolean]",V="[object Date]",W="[object Error]",X="[object Function]",Y="[object Number]",Z="[object Object]",$="[object RegExp]",_="[object String]",ab=Object.prototype.toString,bb=Object.prototype.hasOwnProperty,cb=ab.call(arguments)==S,db=Error.prototype,eb=Object.prototype,fb=eb.propertyIsEnumerable;try{Q=!(ab.call(document)==Z&&!({toString:0}+""))}catch(gb){Q=!0}var hb=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ib={};ib[T]=ib[V]=ib[Y]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},ib[U]=ib[_]={constructor:!0,toString:!0,valueOf:!0},ib[W]=ib[X]=ib[$]={constructor:!0,toString:!0},ib[Z]={constructor:!0};var jb={};!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);jb.enumErrorProps=fb.call(db,"message")||fb.call(db,"name"),jb.enumPrototypes=fb.call(a,"prototype"),jb.nonEnumArgs=0!=c,jb.nonEnumShadows=!/valueOf/.test(b)}(1),cb||(h=function(a){return a&&"object"==typeof a?bb.call(a,"callee"):!1}),i(/x/)&&(i=function(a){return"function"==typeof a&&ab.call(a)==X});var kb=E.internals.isEqual=function(a,b){return j(a,b,[],[])},lb=Array.prototype.slice,mb=({}.hasOwnProperty,this.inherits=E.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),nb=E.internals.addProperties=function(a){for(var b=lb.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}},ob=E.internals.addRef=function(a,b){return new lc(function(c){return new ub(b.getDisposable(),a.subscribe(c))})};Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=lb.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(lb.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(lb.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 pb=Object("a"),qb="a"!=pb[0]||!(0 in pb);Array.prototype.every||(Array.prototype.every=function(a){var b=Object(this),c=qb&&{}.toString.call(this)==_?this.split(""):b,d=c.length>>>0,e=arguments[1];if({}.toString.call(a)!=X)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=qb&&{}.toString.call(this)==_?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if({}.toString.call(a)!=X)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)==T}),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});var rb=function(a,b){this.id=a,this.value=b};rb.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var sb=E.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},tb=sb.prototype;tb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},tb.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},tb.heapify=function(b){if(b===a&&(b=0),!(b>=this.length||0>b)){var c=2*b+1,d=2*b+2,e=b;if(c<this.length&&this.isHigherPriority(c,e)&&(e=c),d<this.length&&this.isHigherPriority(d,e)&&(e=d),e!==b){var f=this.items[b];this.items[b]=this.items[e],this.items[e]=f,this.heapify(e)}}},tb.peek=function(){return this.items[0].value},tb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},tb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},tb.enqueue=function(a){var b=this.length++;this.items[b]=new rb(sb.count++,a),this.percolate(b)},tb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},sb.count=0;var ub=E.CompositeDisposable=function(){this.disposables=k(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},vb=ub.prototype;vb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},vb.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},vb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},vb.toArray=function(){return this.disposables.slice(0)};var wb=E.Disposable=function(a){this.isDisposed=!1,this.action=a||F};wb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var xb=wb.create=function(a){return new wb(a)},yb=wb.empty={dispose:F},zb=E.SingleAssignmentDisposable=SerialDisposable=E.SerialDisposable=function(){function a(){this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),Ab=E.RefCountDisposable=function(){function a(a){this.disposable=a,this.disposable.count++,this.isInnerDisposed=!1}function b(a){this.underlyingDisposable=a,this.isDisposed=!1,this.isPrimaryDisposed=!1,this.count=0}return a.prototype.dispose=function(){this.disposable.isDisposed||this.isInnerDisposed||(this.isInnerDisposed=!0,this.disposable.count--,0===this.disposable.count&&this.disposable.isPrimaryDisposed&&(this.disposable.isDisposed=!0,this.disposable.underlyingDisposable.dispose()))},b.prototype.dispose=function(){this.isDisposed||this.isPrimaryDisposed||(this.isPrimaryDisposed=!0,0===this.count&&(this.isDisposed=!0,this.underlyingDisposable.dispose()))},b.prototype.getDisposable=function(){return this.isDisposed?yb:new a(this)},b}();m.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var Bb=E.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||K,this.disposable=new zb};Bb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},Bb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},Bb.prototype.isCancelled=function(){return this.disposable.isDisposed},Bb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var Cb=E.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){return b(),yb}var c=a.prototype;return c.schedule=function(a){return this._schedule(a,b)},c.scheduleWithState=function(a,b){return this._schedule(a,b)},c.scheduleWithRelative=function(a,c){return this._scheduleRelative(c,a,b)},c.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},c.scheduleWithAbsolute=function(a,c){return this._scheduleAbsolute(c,a,b)},c.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},a.now=I,a.normalize=function(a){return 0>a&&(a=0),a},a}(),Db=Cb.normalize;!function(a){function b(a,b){var c=b.first,d=b.second,e=new ub,f=function(b){d(b,function(b){var c=!1,d=!1,g=a.scheduleWithState(b,function(a,b){return c?e.remove(g):d=!0,f(b),yb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new ub,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),yb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){a(function(c){b(a,c)})}a.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},a.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},b)},a.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,d)},a.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},a.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,d)},a.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})}}(Cb.prototype),function(){Cb.prototype.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,b)},Cb.prototype.schedulePeriodicWithState=function(a,b,c){var d=a,e=setInterval(function(){d=c(d)},b);return xb(function(){clearInterval(e)})}}(Cb.prototype),function(a){a.catchError=a["catch"]=function(a){return new Ib(this,a)}}(Cb.prototype);var Eb,Fb=(E.internals.SchedulePeriodicRecursive=function(){function a(a,b){b(0,this._period);try{this._state=this._action(this._state)}catch(c){throw this._cancel.dispose(),c}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new zb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),Cb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=Db(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Cb(I,a,b,c)}()),Gb=Cb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-Cb.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()+Cb.normalize(c),g=new Bb(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 Cb(I,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),Hb=F;!function(){function a(){if(!z.postMessage||z.importScripts)return!1;var a=!1,b=z.onmessage;return z.onmessage=function(){a=!0},z.postMessage("","*"),z.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(ab).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=D&&C&&D.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=D&&C&&D.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Eb=process.nextTick;else if("function"==typeof d)Eb=d,Hb=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;z.addEventListener?z.addEventListener("message",b,!1):z.attachEvent("onmessage",b,!1),Eb=function(a){var b=h++;g[b]=a,z.postMessage(f+b,"*")}}else if(z.MessageChannel){var i=new z.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},Eb=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in z&&"onreadystatechange"in z.document.createElement("script")?Eb=function(a){var b=z.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},z.document.documentElement.appendChild(b)}:(Eb=function(a){return setTimeout(a,0)},Hb=clearTimeout)}();var Ib=(Cb.timeout=function(){function a(a,b){var c=this,d=new zb,e=Eb(function(){d.isDisposed||d.setDisposable(b(c,a))});return new ub(d,xb(function(){Hb(e)}))}function b(a,b,c){var d=this,e=Cb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new zb,g=setTimeout(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new ub(f,xb(function(){clearTimeout(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new Cb(I,a,b,c)}(),function(a){function b(){return this._scheduler.now()}function c(a,b){return this._scheduler.scheduleWithState(a,this._wrap(b))}function d(a,b,c){return this._scheduler.scheduleWithRelativeAndState(a,b,this._wrap(c))}function e(a,b,c){return this._scheduler.scheduleWithAbsoluteAndState(a,b,this._wrap(c))}function f(f,g){this._scheduler=f,this._handler=g,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this,b,c,d,e)}return mb(f,a),f.prototype._clone=function(a){return new f(a,this._handler)},f.prototype._wrap=function(a){var b=this;return function(c,d){try{return a(b._getRecursiveWrapper(c),d)}catch(e){if(!b._handler(e))throw e;return yb}}},f.prototype._getRecursiveWrapper=function(a){if(this._recursiveOriginal!==a){this._recursiveOriginal=a;var b=this._clone(a);b._recursiveOriginal=a,b._recursiveWrapper=b,this._recursiveWrapper=b}return this._recursiveWrapper},f.prototype.schedulePeriodicWithState=function(a,b,c){var d=this,e=!1,f=new zb;return f.setDisposable(this._scheduler.schedulePeriodicWithState(a,b,function(a){if(e)return null;try{return c(a)}catch(b){if(e=!0,!d._handler(b))throw b;return f.dispose(),null}})),f},f}(Cb)),Jb=E.Notification=function(){function a(a,b){this.hasValue=null==b?!1:b,this.kind=a}return a.prototype.accept=function(a,b,c){return a&&"object"==typeof a?this._acceptObservable(a):this._accept(a,b,c)},a.prototype.toObservable=function(a){var b=this;return G(a)||(a=Fb),new lc(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),Kb=Jb.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 Jb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Lb=Jb.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 Jb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),Mb=Jb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new Jb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),Nb=E.internals.Enumerator=function(a){this._next=a};Nb.prototype.next=function(){return this._next()},Nb.prototype[P]=function(){return this};var Ob=E.internals.Enumerable=function(a){this._iterator=a};Ob.prototype[P]=function(){return this._iterator()},Ob.prototype.concat=function(){var a=this;return new lc(function(b){var c;try{c=a[P]()}catch(d){return void b.onError()}var e,f=new SerialDisposable,g=Fb.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;M(h)&&(h=$b(h));var i=new zb;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new ub(f,g,xb(function(){e=!0}))})},Ob.prototype.catchException=function(){var a=this;return new lc(function(b){var c;try{c=a[P]()}catch(d){return void b.onError()}var e,f,g=new SerialDisposable,h=Fb.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;M(i)&&(i=$b(i));var j=new zb;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new ub(g,h,xb(function(){e=!0}))})};var Pb=Ob.repeat=function(a,b){return null==b&&(b=-1),new Ob(function(){var c=b;return new Nb(function(){return 0===c?R:(c>0&&c--,{done:!1,value:a})})})},Qb=Ob.forEach=function(a,b,c){return b||(b=H),new Ob(function(){var d=-1;return new Nb(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:R})})},Rb=E.Observer=function(){};Rb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Rb.prototype.asObserver=function(){return new Vb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Rb.prototype.checked=function(){return new Wb(this)};var Sb=Rb.create=function(a,b,c){return a||(a=F),b||(b=L),c||(c=F),new Vb(a,b,c)};Rb.fromNotifier=function(a){return new Vb(function(b){return a(Kb(b))},function(b){return a(Lb(b))},function(){return a(Mb())})},Rb.notifyOn=function(a){return new Yb(a,this)};var Tb,Ub=E.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return mb(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}(Rb),Vb=E.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return mb(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}(Ub),Wb=function(a){function b(b){a.call(this),this._observer=b,this._state=0}mb(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}(Rb),Xb=E.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new SerialDisposable}return mb(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}(Ub),Yb=function(a){function b(){a.apply(this,arguments)}return mb(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}(Xb),Zb=E.Observable=function(){function a(a){this._subscribe=a}return Tb=a.prototype,Tb.subscribe=Tb.forEach=function(a,b,c){var d="object"==typeof a?a:Sb(a,b,c);return this._subscribe(d)},a}();Tb.observeOn=function(a){var b=this;return new lc(function(c){return b.subscribe(new Yb(a,c))})},Tb.subscribeOn=function(a){var b=this;return new lc(function(c){var d=new zb,e=new SerialDisposable;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new m(a,b.subscribe(c)))})),e})};var $b=Zb.fromPromise=function(a){return _b(function(){var b=new E.AsyncSubject;return a.then(function(a){b.isDisposed||(b.onNext(a),b.onCompleted())},b.onError.bind(b)),b})};Tb.toPromise=function(a){if(a||(a=E.config.Promise),!a)throw new Error("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},function(a){c(a)},function(){e&&a(d)})})},Tb.toArray=function(){var a=this;return new lc(function(b){var c=[];return a.subscribe(c.push.bind(c),b.onError.bind(b),function(){b.onNext(c),b.onCompleted()})})},Zb.create=Zb.createWithDisposable=function(a){return new lc(a)};var _b=Zb.defer=function(a){return new lc(function(b){var c;try{c=a()}catch(d){return fc(d).subscribe(b)}return M(c)&&(c=$b(c)),c.subscribe(b)})},ac=Zb.empty=function(a){return G(a)||(a=Fb),new lc(function(b){return a.schedule(function(){b.onCompleted()})})},bc=Math.pow(2,53)-1;Zb.from=function(a,b,c,d){if(null==a)throw new Error("iterable cannot be null.");if(b&&!r(b))throw new Error("mapFn when provided must be a function");return G(d)||(d=Gb),new lc(function(e){var f=Object(a),g=o(f),h=g?0:q(f),i=g?f[P]():null,j=0;return d.scheduleRecursive(function(a){if(h>j||g){var d;if(g){var k=i.next();if(k.done)return void e.onCompleted();d=k.value}else d=f[j];if(b&&r(b))try{d=c?b.call(c,d,j):b(d,j)}catch(l){return void e.onError(l)}e.onNext(d),j++,a()}else e.onCompleted()})})};var cc=Zb.fromArray=function(a,b){return G(b)||(b=Gb),new lc(function(c){var d=0,e=a.length;return b.scheduleRecursive(function(b){e>d?(c.onNext(a[d++]),b()):c.onCompleted()})})};Zb.generate=function(a,b,c,d,e){return G(e)||(e=Gb),new lc(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 dc=Zb.never=function(){return new lc(function(){return yb})};Zb.of=function(){for(var a=arguments.length,b=new Array(a),c=0;a>c;c++)b[c]=arguments[c];return cc(b)};Zb.ofWithScheduler=function(a){for(var b=arguments.length-1,c=new Array(b),d=0;b>d;d++)c[d]=arguments[d+1];return cc(c,a)};Zb.range=function(a,b,c){return G(c)||(c=Gb),new lc(function(d){return c.scheduleRecursiveWithState(0,function(c,e){b>c?(d.onNext(a+c),e(c+1)):d.onCompleted()})})},Zb.repeat=function(a,b,c){return G(c)||(c=Gb),ec(a,c).repeat(null==b?-1:b)};var ec=Zb["return"]=Zb.returnValue=Zb.just=function(a,b){return G(b)||(b=Fb),new lc(function(c){return b.schedule(function(){c.onNext(a),c.onCompleted()})})},fc=Zb["throw"]=Zb.throwException=function(a,b){return G(b)||(b=Fb),new lc(function(c){return b.schedule(function(){c.onError(a)})})};Zb.using=function(a,b){return new lc(function(c){var d,e,f=yb;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new ub(fc(g).subscribe(c),f)}return new ub(e.subscribe(c),f)})},Tb.amb=function(a){var b=this;return new lc(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new zb,j=new zb;return M(a)&&(a=$b(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)})},Zb.amb=function(){function a(a,b){return a.amb(b)}for(var b=dc(),c=k(arguments,0),d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},Tb["catch"]=Tb.catchException=function(a){return"function"==typeof a?s(this,a):gc([this,a])};var gc=Zb.catchException=Zb["catch"]=function(){var a=k(arguments,0);return Qb(a).catchException()};Tb.combineLatest=function(){var a=lb.call(arguments);return Array.isArray(a[0])?a[0].unshift(this):a.unshift(this),hc.apply(this,a)};var hc=Zb.combineLatest=function(){var a=lb.call(arguments),b=a.pop();return Array.isArray(a[0])&&(a=a[0]),new lc(function(c){function d(a){var d;if(h[a]=!0,i||(i=h.every(H))){try{d=b.apply(null,k)}catch(e){return void c.onError(e)}c.onNext(d)}else j.filter(function(b,c){return c!==a}).every(H)&&c.onCompleted()}function e(a){j[a]=!0,j.every(H)&&c.onCompleted()}for(var f=function(){return!1},g=a.length,h=l(g,f),i=!1,j=l(g,f),k=new Array(g),m=new Array(g),n=0;g>n;n++)!function(b){var f=a[b],g=new zb;M(f)&&(f=$b(f)),g.setDisposable(f.subscribe(function(a){k[b]=a,d(b)},c.onError.bind(c),function(){e(b)})),m[b]=g}(n);return new ub(m)})};Tb.concat=function(){var a=lb.call(arguments,0);return a.unshift(this),ic.apply(this,a)};var ic=Zb.concat=function(){var a=k(arguments,0);return Qb(a).concat()};Tb.concatObservable=Tb.concatAll=function(){return this.merge(1)},Tb.merge=function(a){if("number"!=typeof a)return jc(this,a);var b=this;return new lc(function(c){function d(a){var b=new zb;f.add(b),M(a)&&(a=$b(a)),b.setDisposable(a.subscribe(c.onNext.bind(c),c.onError.bind(c),function(){f.remove(b),h.length>0?d(h.shift()):(e--,g&&0===e&&c.onCompleted())}))}var e=0,f=new ub,g=!1,h=[];return f.add(b.subscribe(function(b){a>e?(e++,d(b)):h.push(b)},c.onError.bind(c),function(){g=!0,0===e&&c.onCompleted()})),f})};var jc=Zb.merge=function(){var a,b;return arguments[0]?arguments[0].now?(a=arguments[0],b=lb.call(arguments,1)):(a=Fb,b=lb.call(arguments,0)):(a=Fb,b=lb.call(arguments,1)),Array.isArray(b[0])&&(b=b[0]),cc(b,a).mergeObservable()};Tb.mergeObservable=Tb.mergeAll=function(){var a=this;return new lc(function(b){var c=new ub,d=!1,e=new zb;return c.add(e),e.setDisposable(a.subscribe(function(a){var e=new zb;c.add(e),M(a)&&(a=$b(a)),e.setDisposable(a.subscribe(function(a){b.onNext(a)},b.onError.bind(b),function(){c.remove(e),d&&1===c.length&&b.onCompleted()}))},b.onError.bind(b),function(){d=!0,1===c.length&&b.onCompleted()})),c})},Tb.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return kc([this,a])};var kc=Zb.onErrorResumeNext=function(){var a=k(arguments,0);return new lc(function(b){var c=0,d=new SerialDisposable,e=Fb.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],M(f)&&(f=$b(f)),g=new zb,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),function(){e()},function(){e()}))):b.onCompleted()});return new ub(d,e)})};Tb.skipUntil=function(a){var b=this;return new lc(function(c){var d=!1,e=new ub(b.subscribe(function(a){d&&c.onNext(a)},c.onError.bind(c),function(){d&&c.onCompleted()}));M(a)&&(a=$b(a));var f=new zb;return e.add(f),f.setDisposable(a.subscribe(function(){d=!0,f.dispose()},c.onError.bind(c),function(){f.dispose()})),e})},Tb["switch"]=Tb.switchLatest=function(){var a=this;return new lc(function(b){var c=!1,d=new SerialDisposable,e=!1,f=0,g=a.subscribe(function(a){var g=new zb,h=++f;c=!0,d.setDisposable(g),M(a)&&(a=$b(a)),g.setDisposable(a.subscribe(function(a){f===h&&b.onNext(a)
2
+ },function(a){f===h&&b.onError(a)},function(){f===h&&(c=!1,e&&b.onCompleted())}))},b.onError.bind(b),function(){e=!0,c||b.onCompleted()});return new ub(g,d)})},Tb.takeUntil=function(a){var b=this;return new lc(function(c){return M(a)&&(a=$b(a)),new ub(b.subscribe(c),a.subscribe(c.onCompleted.bind(c),c.onError.bind(c),F))})},Tb.zip=function(){if(Array.isArray(arguments[0]))return t.apply(this,arguments);var a=this,b=lb.call(arguments),c=b.pop();return b.unshift(a),new lc(function(d){function e(b){var e,f;if(h.every(function(a){return a.length>0})){try{f=h.map(function(a){return a.shift()}),e=c.apply(a,f)}catch(g){return void d.onError(g)}d.onNext(e)}else i.filter(function(a,c){return c!==b}).every(H)&&d.onCompleted()}function f(a){i[a]=!0,i.every(function(a){return a})&&d.onCompleted()}for(var g=b.length,h=l(g,function(){return[]}),i=l(g,function(){return!1}),j=new Array(g),k=0;g>k;k++)!function(a){var c=b[a],g=new zb;M(c)&&(c=$b(c)),g.setDisposable(c.subscribe(function(b){h[a].push(b),e(a)},d.onError.bind(d),function(){f(a)})),j[a]=g}(k);return new ub(j)})},Zb.zip=function(){var a=lb.call(arguments,0),b=a.shift();return b.zip.apply(b,a)},Zb.zipArray=function(){var a=k(arguments,0);return new lc(function(b){function c(a){if(f.every(function(a){return a.length>0})){var c=f.map(function(a){return a.shift()});b.onNext(c)}else if(g.filter(function(b,c){return c!==a}).every(H))return void b.onCompleted()}function d(a){return g[a]=!0,g.every(H)?void b.onCompleted():void 0}for(var e=a.length,f=l(e,function(){return[]}),g=l(e,function(){return!1}),h=new Array(e),i=0;e>i;i++)!function(e){h[e]=new zb,h[e].setDisposable(a[e].subscribe(function(a){f[e].push(a),c(e)},b.onError.bind(b),function(){d(e)}))}(i);var j=new ub(h);return j.add(xb(function(){for(var a=0,b=f.length;b>a;a++)f[a]=[]})),j})},Tb.asObservable=function(){var a=this;return new lc(function(b){return a.subscribe(b)})},Tb.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})},Tb.dematerialize=function(){var a=this;return new lc(function(b){return a.subscribe(function(a){return a.accept(b)},b.onError.bind(b),b.onCompleted.bind(b))})},Tb.distinctUntilChanged=function(a,b){var c=this;return a||(a=H),b||(b=J),new lc(function(d){var e,f=!1;return c.subscribe(function(c){var g,h=!1;try{g=a(c)}catch(i){return void d.onError(i)}if(f)try{h=b(e,g)}catch(i){return void d.onError(i)}f&&h||(f=!0,e=g,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))})},Tb["do"]=Tb.doAction=Tb.tap=function(a,b,c){var d,e=this;return"function"==typeof a?d=a:(d=a.onNext.bind(a),b=a.onError.bind(a),c=a.onCompleted.bind(a)),new lc(function(a){return e.subscribe(function(b){try{d(b)}catch(c){a.onError(c)}a.onNext(b)},function(c){if(b){try{b(c)}catch(d){a.onError(d)}a.onError(c)}else a.onError(c)},function(){if(c){try{c()}catch(b){a.onError(b)}a.onCompleted()}else a.onCompleted()})})},Tb["finally"]=Tb.finallyAction=function(a){var b=this;return new lc(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()}})})},Tb.ignoreElements=function(){var a=this;return new lc(function(b){return a.subscribe(F,b.onError.bind(b),b.onCompleted.bind(b))})},Tb.materialize=function(){var a=this;return new lc(function(b){return a.subscribe(function(a){b.onNext(Kb(a))},function(a){b.onNext(Lb(a)),b.onCompleted()},function(){b.onNext(Mb()),b.onCompleted()})})},Tb.repeat=function(a){return Pb(this,a).concat()},Tb.retry=function(a){return Pb(this,a).catchException()},Tb.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 lc(function(e){var f,g,h;return d.subscribe(function(d){try{h||(h=!0),f?g=b(g,d):(g=c?b(a,d):d,f=!0)}catch(i){return void e.onError(i)}e.onNext(g)},e.onError.bind(e),function(){!h&&c&&e.onNext(a),e.onCompleted()})})},Tb.skipLast=function(a){var b=this;return new lc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&c.onNext(d.shift())},c.onError.bind(c),c.onCompleted.bind(c))})},Tb.startWith=function(){var a,b,c=0;return arguments.length&&"now"in Object(arguments[0])?(b=arguments[0],c=1):b=Fb,a=lb.call(arguments,c),Qb([cc(a,b),this]).concat()},Tb.takeLast=function(a){var b=this;return new lc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){for(;d.length>0;)c.onNext(d.shift());c.onCompleted()})})},Tb.takeLastBuffer=function(a){var b=this;return new lc(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})},Tb.windowWithCount=function(a,b){var c=this;if(0>=a)throw new Error(N);if(1===arguments.length&&(b=a),0>=b)throw new Error(N);return new lc(function(d){var e=new zb,f=new Ab(e),g=0,h=[],i=function(){var a=new oc;h.push(a),d.onNext(ob(a,f))};return i(),e.setDisposable(c.subscribe(function(c){for(var d,e=0,f=h.length;f>e;e++)h[e].onNext(c);var j=g-a+1;j>=0&&j%b===0&&(d=h.shift(),d.onCompleted()),g++,g%b===0&&i()},function(a){for(;h.length>0;)h.shift().onError(a);d.onError(a)},function(){for(;h.length>0;)h.shift().onCompleted();d.onCompleted()})),f})},Tb.selectConcat=Tb.concatMap=function(a,b,c){return b?this.concatMap(function(c,d){var e=a(c,d),f=M(e)?$b(e):e;return f.map(function(a){return b(c,a,d)})}):"function"==typeof a?u(this,a,c):u(this,function(){return a})},Tb.concatMapObserver=Tb.selectConcatObserver=function(a,b,c,d){var e=this;return new lc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}M(c)&&(c=$b(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}M(c)&&(c=$b(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}M(a)&&(a=$b(a)),f.onNext(a),f.onCompleted()})}).concatAll()},Tb.defaultIfEmpty=function(b){var c=this;return b===a&&(b=null),new lc(function(a){var d=!1;return c.subscribe(function(b){d=!0,a.onNext(b)},a.onError.bind(a),function(){d||a.onNext(b),a.onCompleted()})})},w.prototype.push=function(a){var b=-1===v(this.set,a,this.comparer);return b&&this.set.push(a),b},Tb.distinct=function(a,b){var c=this;return b||(b=J),new lc(function(d){var e=new w(b);return c.subscribe(function(b){var c=b;if(a)try{c=a(b)}catch(f){return void d.onError(f)}e.push(c)&&d.onNext(b)},d.onError.bind(d),d.onCompleted.bind(d))})},Tb.select=Tb.map=function(a,b){var c=this;return new lc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Tb.pluck=function(a){return this.select(function(b){return b[a]})},Tb.selectMany=Tb.flatMap=function(a,b,c){return b?this.flatMap(function(c,d){var e=a(c,d),f=M(e)?$b(e):e;return f.map(function(a){return b(c,a,d)})},c):"function"==typeof a?x(this,a,c):x(this,function(){return a})},Tb.flatMapObserver=Tb.selectManyObserver=function(a,b,c,d){var e=this;return new lc(function(f){var g=0;return e.subscribe(function(b){var c;try{c=a.call(d,b,g++)}catch(e){return void f.onError(e)}M(c)&&(c=$b(c)),f.onNext(c)},function(a){var c;try{c=b.call(d,a)}catch(e){return void f.onError(e)}M(c)&&(c=$b(c)),f.onNext(c),f.onCompleted()},function(){var a;try{a=c.call(d)}catch(b){return void f.onError(b)}M(a)&&(a=$b(a)),f.onNext(a),f.onCompleted()})}).mergeAll()},Tb.selectSwitch=Tb.flatMapLatest=Tb.switchMap=function(a,b){return this.select(a,b).switchLatest()},Tb.skip=function(a){if(0>a)throw new Error(N);var b=this;return new lc(function(c){var d=a;return b.subscribe(function(a){0>=d?c.onNext(a):d--},c.onError.bind(c),c.onCompleted.bind(c))})},Tb.skipWhile=function(a,b){var c=this;return new lc(function(d){var e=0,f=!1;return c.subscribe(function(g){if(!f)try{f=!a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f&&d.onNext(g)},d.onError.bind(d),d.onCompleted.bind(d))})},Tb.take=function(a,b){if(0>a)throw new Error(N);if(0===a)return ac(b);var c=this;return new lc(function(b){var d=a;return c.subscribe(function(a){d>0&&(d--,b.onNext(a),0===d&&b.onCompleted())},b.onError.bind(b),b.onCompleted.bind(b))})},Tb.takeWhile=function(a,b){var c=this;return new lc(function(d){var e=0,f=!0;return c.subscribe(function(g){if(f){try{f=a.call(b,g,e++,c)}catch(h){return void d.onError(h)}f?d.onNext(g):d.onCompleted()}},d.onError.bind(d),d.onCompleted.bind(d))})},Tb.where=Tb.filter=function(a,b){var c=this;return new lc(function(d){var e=0;return c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}g&&d.onNext(f)},d.onError.bind(d),d.onCompleted.bind(d))})},Tb.exclusive=function(){var a=this;return new lc(function(b){var c=!1,d=!1,e=new zb,f=new ub;return f.add(e),e.setDisposable(a.subscribe(function(a){if(!c){c=!0,M(a)&&(a=$b(a));var e=new zb;f.add(e),e.setDisposable(a.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){f.remove(e),c=!1,d&&1===f.length&&b.onCompleted()}))}},b.onError.bind(b),function(){d=!0,c||1!==f.length||b.onCompleted()})),f})},Tb.exclusiveMap=function(a,b){var c=this;return new lc(function(d){var e=0,f=!1,g=!0,h=new zb,i=new ub;return i.add(h),h.setDisposable(c.subscribe(function(c){f||(f=!0,innerSubscription=new zb,i.add(innerSubscription),M(c)&&(c=$b(c)),innerSubscription.setDisposable(c.subscribe(function(f){var g;try{g=a.call(b,f,e++,c)}catch(h){return void d.onError(h)}d.onNext(g)},d.onError.bind(d),function(){i.remove(innerSubscription),f=!1,g&&1===i.length&&d.onCompleted()})))},d.onError.bind(d),function(){g=!0,1!==i.length||f||d.onCompleted()})),i})};var lc=E.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?xb(a):yb}function c(d){function e(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new mc(a);return Gb.scheduleRequired()?Gb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return mb(c,a),c}(Zb),mc=function(a){function b(b){a.call(this),this.observer=b,this.m=new zb}mb(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Ub),nc=function(a,b){this.subject=a,this.observer=b};nc.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 oc=E.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),yb):(a.onCompleted(),yb):(this.observers.push(a),new nc(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return mb(d,a),nb(d.prototype,Rb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new pc(a,b)},d}(Zb),pc=(E.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new nc(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),yb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return mb(d,a),nb(d.prototype,Rb,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(Zb),E.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return mb(b,a),nb(b.prototype,Rb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(Zb));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(z.Rx=E,define(function(){return E})):A&&B?C?(B.exports=E).Rx=E:A.Rx=E:z.Rx=E}).call(this);
@@ -41,7 +41,7 @@
41
41
  defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
42
42
  defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },
43
43
  defaultError = Rx.helpers.defaultError = function (err) { throw err; },
44
- isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function' && p.then !== Rx.Observable.prototype.then; },
44
+ isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function'; },
45
45
  asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },
46
46
  not = Rx.helpers.not = function (a) { return !a; };
47
47
 
@@ -1231,67 +1231,64 @@
1231
1231
  return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
1232
1232
  }());
1233
1233
 
1234
- /**
1235
- * Gets a scheduler that schedules work as soon as possible on the current thread.
1236
- */
1237
- var currentThreadScheduler = Scheduler.currentThread = (function () {
1238
- var queue;
1239
-
1240
- function runTrampoline (q) {
1241
- var item;
1242
- while (q.length > 0) {
1243
- item = q.dequeue();
1244
- if (!item.isCancelled()) {
1245
- // Note, do not schedule blocking work!
1246
- while (item.dueTime - Scheduler.now() > 0) {
1247
- }
1248
- if (!item.isCancelled()) {
1249
- item.invoke();
1250
- }
1251
- }
1252
- }
1234
+ /**
1235
+ * Gets a scheduler that schedules work as soon as possible on the current thread.
1236
+ */
1237
+ var currentThreadScheduler = Scheduler.currentThread = (function () {
1238
+ var queue;
1239
+
1240
+ function runTrampoline (q) {
1241
+ var item;
1242
+ while (q.length > 0) {
1243
+ item = q.dequeue();
1244
+ if (!item.isCancelled()) {
1245
+ // Note, do not schedule blocking work!
1246
+ while (item.dueTime - Scheduler.now() > 0) {
1247
+ }
1248
+ if (!item.isCancelled()) {
1249
+ item.invoke();
1250
+ }
1253
1251
  }
1252
+ }
1253
+ }
1254
1254
 
1255
- function scheduleNow(state, action) {
1256
- return this.scheduleWithRelativeAndState(state, 0, action);
1257
- }
1255
+ function scheduleNow(state, action) {
1256
+ return this.scheduleWithRelativeAndState(state, 0, action);
1257
+ }
1258
1258
 
1259
- function scheduleRelative(state, dueTime, action) {
1260
- var dt = this.now() + Scheduler.normalize(dueTime),
1261
- si = new ScheduledItem(this, state, action, dt),
1262
- t;
1263
- if (!queue) {
1264
- queue = new PriorityQueue(4);
1265
- queue.enqueue(si);
1266
- try {
1267
- runTrampoline(queue);
1268
- } catch (e) {
1269
- throw e;
1270
- } finally {
1271
- queue = null;
1272
- }
1273
- } else {
1274
- queue.enqueue(si);
1275
- }
1276
- return si.disposable;
1277
- }
1259
+ function scheduleRelative(state, dueTime, action) {
1260
+ var dt = this.now() + Scheduler.normalize(dueTime),
1261
+ si = new ScheduledItem(this, state, action, dt);
1278
1262
 
1279
- function scheduleAbsolute(state, dueTime, action) {
1280
- return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
1263
+ if (!queue) {
1264
+ queue = new PriorityQueue(4);
1265
+ queue.enqueue(si);
1266
+ try {
1267
+ runTrampoline(queue);
1268
+ } catch (e) {
1269
+ throw e;
1270
+ } finally {
1271
+ queue = null;
1281
1272
  }
1273
+ } else {
1274
+ queue.enqueue(si);
1275
+ }
1276
+ return si.disposable;
1277
+ }
1282
1278
 
1283
- var currentScheduler = new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
1284
- currentScheduler.scheduleRequired = function () { return queue === null; };
1285
- currentScheduler.ensureTrampoline = function (action) {
1286
- if (queue === null) {
1287
- return this.schedule(action);
1288
- } else {
1289
- return action();
1290
- }
1291
- };
1279
+ function scheduleAbsolute(state, dueTime, action) {
1280
+ return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
1281
+ }
1292
1282
 
1293
- return currentScheduler;
1294
- }());
1283
+ var currentScheduler = new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
1284
+
1285
+ currentScheduler.scheduleRequired = function () { return !queue; };
1286
+ currentScheduler.ensureTrampoline = function (action) {
1287
+ if (!queue) { this.schedule(action); } else { action(); }
1288
+ };
1289
+
1290
+ return currentScheduler;
1291
+ }());
1295
1292
 
1296
1293
 
1297
1294
  var scheduleMethod, clearMethod = noop;
@@ -2155,13 +2152,11 @@
2155
2152
 
2156
2153
  // Fix subscriber to check for undefined or function returned to decorate as Disposable
2157
2154
  function fixSubscriber(subscriber) {
2158
- if (typeof subscriber === 'undefined') {
2159
- subscriber = disposableEmpty;
2160
- } else if (typeof subscriber === 'function') {
2161
- subscriber = disposableCreate(subscriber);
2162
- }
2155
+ if (subscriber && typeof subscriber.dispose === 'function') { return subscriber; }
2163
2156
 
2164
- return subscriber;
2157
+ return typeof subscriber === 'function' ?
2158
+ disposableCreate(subscriber) :
2159
+ disposableEmpty;
2165
2160
  }
2166
2161
 
2167
2162
  function AnonymousObservable(subscribe) {
@@ -2258,31 +2253,6 @@
2258
2253
  return AutoDetachObserver;
2259
2254
  }(AbstractObserver));
2260
2255
 
2261
- /** @private */
2262
- var GroupedObservable = (function (_super) {
2263
- inherits(GroupedObservable, _super);
2264
-
2265
- function subscribe(observer) {
2266
- return this.underlyingObservable.subscribe(observer);
2267
- }
2268
-
2269
- /**
2270
- * @constructor
2271
- * @private
2272
- */
2273
- function GroupedObservable(key, underlyingObservable, mergedDisposable) {
2274
- _super.call(this, subscribe);
2275
- this.key = key;
2276
- this.underlyingObservable = !mergedDisposable ?
2277
- underlyingObservable :
2278
- new AnonymousObservable(function (observer) {
2279
- return new CompositeDisposable(mergedDisposable.getDisposable(), underlyingObservable.subscribe(observer));
2280
- });
2281
- }
2282
-
2283
- return GroupedObservable;
2284
- }(Observable));
2285
-
2286
2256
  /** @private */
2287
2257
  var InnerSubscription = function (subject, observer) {
2288
2258
  this.subject = subject;
@@ -2534,50 +2504,29 @@
2534
2504
  return AsyncSubject;
2535
2505
  }(Observable));
2536
2506
 
2537
- /** @private */
2538
- var AnonymousSubject = (function (_super) {
2539
- inherits(AnonymousSubject, _super);
2540
-
2541
- function subscribe(observer) {
2542
- return this.observable.subscribe(observer);
2543
- }
2507
+ var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) {
2508
+ inherits(AnonymousSubject, __super__);
2544
2509
 
2545
- /**
2546
- * @private
2547
- * @constructor
2548
- */
2549
- function AnonymousSubject(observer, observable) {
2550
- _super.call(this, subscribe);
2551
- this.observer = observer;
2552
- this.observable = observable;
2553
- }
2510
+ function AnonymousSubject(observer, observable) {
2511
+ this.observer = observer;
2512
+ this.observable = observable;
2513
+ __super__.call(this, this.observable.subscribe.bind(this.observable));
2514
+ }
2554
2515
 
2555
- addProperties(AnonymousSubject.prototype, Observer, {
2556
- /**
2557
- * @private
2558
- * @memberOf AnonymousSubject#
2559
- */
2560
- onCompleted: function () {
2561
- this.observer.onCompleted();
2562
- },
2563
- /**
2564
- * @private
2565
- * @memberOf AnonymousSubject#
2566
- */
2567
- onError: function (exception) {
2568
- this.observer.onError(exception);
2569
- },
2570
- /**
2571
- * @private
2572
- * @memberOf AnonymousSubject#
2573
- */
2574
- onNext: function (value) {
2575
- this.observer.onNext(value);
2576
- }
2577
- });
2516
+ addProperties(AnonymousSubject.prototype, Observer, {
2517
+ onCompleted: function () {
2518
+ this.observer.onCompleted();
2519
+ },
2520
+ onError: function (exception) {
2521
+ this.observer.onError(exception);
2522
+ },
2523
+ onNext: function (value) {
2524
+ this.observer.onNext(value);
2525
+ }
2526
+ });
2578
2527
 
2579
- return AnonymousSubject;
2580
- }(Observable));
2528
+ return AnonymousSubject;
2529
+ }(Observable));
2581
2530
 
2582
2531
  if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
2583
2532
  root.Rx = Rx;
@@ -1 +1 @@
1
- (function(a){function b(){if(this.isDisposed)throw new Error(A)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;X.nonEnumArgs&&a.length&&h(a)&&(a=Z.call(a));var d=X.enumPrototypes&&"function"==typeof a,e=X.enumErrorProps&&(a===R||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(X.nonEnumShadows&&a!==S){var g=a.constructor,i=-1,j=V.length;if(a===(g&&g.prototype))var k=a===stringProto?N:a===R?I:O.call(a),l=W[k];for(;++i<j;)f=V[i],l&&l[f]||!P.call(a,f)||b.push(f)}return b}function e(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function f(a,b){return e(a,b,d)}function g(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function h(a){return a&&"object"==typeof a?O.call(a)==E:!1}function i(a){return"function"==typeof a||!1}function j(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,k=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=k&&"object"!=k))return!1;var l=O.call(a),m=O.call(b);if(l==E&&(l=L),m==E&&(m=L),l!=m)return!1;switch(l){case G:case H:return+a==+b;case K:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case M:case N:return a==String(b)}var n=l==F;if(!n){if(l!=L||!X.nodeClass&&(g(a)||g(b)))return!1;var o=!X.argsObject&&h(a)?Object:a.constructor,p=!X.argsObject&&h(b)?Object:b.constructor;if(!(o==p||P.call(a,"constructor")&&P.call(b,"constructor")||i(o)&&o instanceof o&&i(p)&&p instanceof p||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var q=c.length;q--;)if(c[q]==a)return d[q]==b;var r=0;if(result=!0,c.push(a),d.push(b),n){if(q=a.length,r=b.length,result=r==q)for(;r--;){var s=b[r];if(!(result=j(a[r],s,c,d)))break}}else f(b,function(b,e,f){return P.call(f,e)?(r++,result=P.call(a,e)&&j(a[e],b,c,d)):void 0}),result&&f(a,function(a,b,c){return P.call(c,b)?result=--r>-1:void 0});return c.pop(),d.pop(),result}function k(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:Z.call(a)}function l(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}var m={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=m[typeof window]&&window||this,o=m[typeof exports]&&exports&&!exports.nodeType&&exports,p=m[typeof module]&&module&&!module.nodeType&&module,q=p&&p.exports===o&&o,r=m[typeof global]&&global;!r||r.global!==r&&r.window!==r||(n=r);var s={internals:{},config:{Promise:n.Promise},helpers:{}},t=s.helpers.noop=function(){},u=(s.helpers.notDefined=function(a){return"undefined"==typeof a},s.helpers.isScheduler=function(a){return a instanceof s.Scheduler}),v=s.helpers.identity=function(a){return a},w=(s.helpers.pluck=function(a){return function(b){return b[a]}},s.helpers.just=function(a){return function(){return a}},s.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}()),x=(s.helpers.defaultComparer=function(a,b){return Y(a,b)},s.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0}),y=(s.helpers.defaultKeySerializer=function(a){return a.toString()},s.helpers.defaultError=function(a){throw a}),z=s.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then&&a.then!==s.Observable.prototype.then},A=(s.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},s.helpers.not=function(a){return!a},"Object has been disposed"),B="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";n.Set&&"function"==typeof(new n.Set)["@@iterator"]&&(B="@@iterator");var C,D={done:!0,value:a},E="[object Arguments]",F="[object Array]",G="[object Boolean]",H="[object Date]",I="[object Error]",J="[object Function]",K="[object Number]",L="[object Object]",M="[object RegExp]",N="[object String]",O=Object.prototype.toString,P=Object.prototype.hasOwnProperty,Q=O.call(arguments)==E,R=Error.prototype,S=Object.prototype,T=S.propertyIsEnumerable;try{C=!(O.call(document)==L&&!({toString:0}+""))}catch(U){C=!0}var V=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],W={};W[F]=W[H]=W[K]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},W[G]=W[N]={constructor:!0,toString:!0,valueOf:!0},W[I]=W[J]=W[M]={constructor:!0,toString:!0},W[L]={constructor:!0};var X={};!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);X.enumErrorProps=T.call(R,"message")||T.call(R,"name"),X.enumPrototypes=T.call(a,"prototype"),X.nonEnumArgs=0!=c,X.nonEnumShadows=!/valueOf/.test(b)}(1),Q||(h=function(a){return a&&"object"==typeof a?P.call(a,"callee"):!1}),i(/x/)&&(i=function(a){return"function"==typeof a&&O.call(a)==J});{var Y=s.internals.isEqual=function(a,b){return j(a,b,[],[])},Z=Array.prototype.slice,$=({}.hasOwnProperty,this.inherits=s.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),_=s.internals.addProperties=function(a){for(var b=Z.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}};s.internals.addRef=function(a,b){return new Kb(function(c){return new fb(b.getDisposable(),a.subscribe(c))})}}Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=Z.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(Z.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(Z.call(arguments)))};return d});var ab=Object("a"),bb="a"!=ab[0]||!(0 in ab);Array.prototype.every||(Array.prototype.every=function(a){var b=Object(this),c=bb&&{}.toString.call(this)==N?this.split(""):b,d=c.length>>>0,e=arguments[1];if({}.toString.call(a)!=J)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=bb&&{}.toString.call(this)==N?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if({}.toString.call(a)!=J)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 Object.prototype.toString.call(a)==F}),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});var cb=function(a,b){this.id=a,this.value=b};cb.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var db=s.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},eb=db.prototype;eb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},eb.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)}}},eb.heapify=function(b){if(b===a&&(b=0),!(b>=this.length||0>b)){var c=2*b+1,d=2*b+2,e=b;if(c<this.length&&this.isHigherPriority(c,e)&&(e=c),d<this.length&&this.isHigherPriority(d,e)&&(e=d),e!==b){var f=this.items[b];this.items[b]=this.items[e],this.items[e]=f,this.heapify(e)}}},eb.peek=function(){return this.items[0].value},eb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},eb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},eb.enqueue=function(a){var b=this.length++;this.items[b]=new cb(db.count++,a),this.percolate(b)},eb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},db.count=0;var fb=s.CompositeDisposable=function(){this.disposables=k(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},gb=fb.prototype;gb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},gb.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},gb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},gb.clear=function(){var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()},gb.contains=function(a){return-1!==this.disposables.indexOf(a)},gb.toArray=function(){return this.disposables.slice(0)};var hb=s.Disposable=function(a){this.isDisposed=!1,this.action=a||t};hb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};{var ib=hb.create=function(a){return new hb(a)},jb=hb.empty={dispose:t},kb=function(){function a(a){this.isSingle=a,this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){if(this.current&&this.isSingle)throw new Error("Disposable has already been assigned");var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),lb=s.SingleAssignmentDisposable=function(a){function b(){a.call(this,!0)}return $(b,a),b}(kb),mb=s.SerialDisposable=function(a){function b(){a.call(this,!1)}return $(b,a),b}(kb);s.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?jb:new a(this)},b}()}l.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var nb=s.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||x,this.disposable=new lb};nb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},nb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},nb.prototype.isCancelled=function(){return this.disposable.isDisposed},nb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var ob,pb=s.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){var c=b.first,d=b.second,e=new fb,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),jb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new fb,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),jb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){return b(),jb}var e=a.prototype;return e.catchException=e["catch"]=function(a){return new ub(this,a)},e.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,function(){b()})},e.schedulePeriodicWithState=function(a,b,c){var d=a,e=setInterval(function(){d=c(d)},b);return ib(function(){clearInterval(e)})},e.schedule=function(a){return this._schedule(a,d)},e.scheduleWithState=function(a,b){return this._schedule(a,b)},e.scheduleWithRelative=function(a,b){return this._scheduleRelative(b,a,d)},e.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},e.scheduleWithAbsolute=function(a,b){return this._scheduleAbsolute(b,a,d)},e.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},e.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},e.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},function(a,c){return b(a,c)})},e.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})},a.now=w,a.normalize=function(a){return 0>a&&(a=0),a},a}(),qb=pb.normalize,rb=(s.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 lb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),pb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=qb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new pb(w,a,b,c)}()),sb=pb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-pb.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()+pb.normalize(c),g=new nb(this,b,d,f);if(e)e.enqueue(g);else{e=new db(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 pb(w,b,c,d);return f.scheduleRequired=function(){return null===e},f.ensureTrampoline=function(a){return null===e?this.schedule(a):a()},f}(),tb=t;!function(){function a(){if(!n.postMessage||n.importScripts)return!1;var a=!1,b=n.onmessage;return n.onmessage=function(){a=!0},n.postMessage("","*"),n.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(O).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=r&&q&&r.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=r&&q&&r.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))ob=process.nextTick;else if("function"==typeof d)ob=d,tb=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;n.addEventListener?n.addEventListener("message",b,!1):n.attachEvent("onmessage",b,!1),ob=function(a){var b=h++;g[b]=a,n.postMessage(f+b,"*")}}else if(n.MessageChannel){var i=new n.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},ob=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in n&&"onreadystatechange"in n.document.createElement("script")?ob=function(a){var b=n.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},n.document.documentElement.appendChild(b)}:(ob=function(a){return setTimeout(a,0)},tb=clearTimeout)}();var ub=(pb.timeout=function(){function a(a,b){var c=this,d=new lb,e=ob(function(){d.isDisposed||d.setDisposable(b(c,a))});return new fb(d,ib(function(){tb(e)}))}function b(a,b,c){var d=this,e=pb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new lb,g=setTimeout(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new fb(f,ib(function(){clearTimeout(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new pb(w,a,b,c)}(),function(a){function b(){return this._scheduler.now()}function c(a,b){return this._scheduler.scheduleWithState(a,this._wrap(b))}function d(a,b,c){return this._scheduler.scheduleWithRelativeAndState(a,b,this._wrap(c))}function e(a,b,c){return this._scheduler.scheduleWithAbsoluteAndState(a,b,this._wrap(c))}function f(f,g){this._scheduler=f,this._handler=g,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this,b,c,d,e)}return $(f,a),f.prototype._clone=function(a){return new f(a,this._handler)},f.prototype._wrap=function(a){var b=this;return function(c,d){try{return a(b._getRecursiveWrapper(c),d)}catch(e){if(!b._handler(e))throw e;return jb}}},f.prototype._getRecursiveWrapper=function(a){if(this._recursiveOriginal!==a){this._recursiveOriginal=a;var b=this._clone(a);b._recursiveOriginal=a,b._recursiveWrapper=b,this._recursiveWrapper=b}return this._recursiveWrapper},f.prototype.schedulePeriodicWithState=function(a,b,c){var d=this,e=!1,f=new lb;return f.setDisposable(this._scheduler.schedulePeriodicWithState(a,b,function(a){if(e)return null;try{return c(a)}catch(b){if(e=!0,!d._handler(b))throw b;return f.dispose(),null}})),f},f}(pb)),vb=s.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 u(a)||(a=rb),new Kb(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),wb=vb.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 vb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),xb=vb.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 vb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),yb=vb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new vb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),zb=s.internals.Enumerator=function(a){this._next=a};zb.prototype.next=function(){return this._next()},zb.prototype[B]=function(){return this};var Ab=s.internals.Enumerable=function(a){this._iterator=a};Ab.prototype[B]=function(){return this._iterator()},Ab.prototype.concat=function(){var a=this;return new Kb(function(b){var c;try{c=a[B]()}catch(d){return void b.onError()}var e,f=new mb,g=rb.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;z(h)&&(h=observableFromPromise(h));var i=new lb;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new fb(f,g,ib(function(){e=!0}))})},Ab.prototype.catchException=function(){var a=this;return new Kb(function(b){var c;try{c=a[B]()}catch(d){return void b.onError()}var e,f,g=new mb,h=rb.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;z(i)&&(i=observableFromPromise(i));var j=new lb;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new fb(g,h,ib(function(){e=!0}))})};var Bb=(Ab.repeat=function(a,b){return null==b&&(b=-1),new Ab(function(){var c=b;return new zb(function(){return 0===c?D:(c>0&&c--,{done:!1,value:a})})})},Ab.forEach=function(a,b,c){return b||(b=v),new Ab(function(){var d=-1;return new zb(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:D})})},s.Observer=function(){});Bb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Bb.prototype.asObserver=function(){return new Fb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Bb.prototype.checked=function(){return new Gb(this)};var Cb=Bb.create=function(a,b,c){return a||(a=t),b||(b=y),c||(c=t),new Fb(a,b,c)};Bb.fromNotifier=function(a){return new Fb(function(b){return a(wb(b))},function(b){return a(xb(b))},function(){return a(yb())})},Bb.notifyOn=function(a){return new Ib(a,this)};var Db,Eb=s.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return $(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}(Bb),Fb=s.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return $(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}(Eb),Gb=function(a){function b(b){a.call(this),this._observer=b,this._state=0}$(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}(Bb),Hb=s.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 mb}return $(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}(Eb),Ib=function(a){function b(){a.apply(this,arguments)}return $(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}(Hb),Jb=s.Observable=function(){function a(a){this._subscribe=a}return Db=a.prototype,Db.subscribe=Db.forEach=function(a,b,c){var d="object"==typeof a?a:Cb(a,b,c);return this._subscribe(d)},a}(),Kb=s.AnonymousObservable=function(a){function b(a){return"undefined"==typeof a?a=jb:"function"==typeof a&&(a=ib(a)),a}function c(d){function e(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new Lb(a);return sb.scheduleRequired()?sb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return $(c,a),c}(Jb),Lb=function(a){function b(b){a.call(this),this.observer=b,this.m=new lb}$(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Eb),Mb=(function(a){function b(a){return this.underlyingObservable.subscribe(a)}function c(c,d,e){a.call(this,b),this.key=c,this.underlyingObservable=e?new Kb(function(a){return new fb(e.getDisposable(),d.subscribe(a))}):d}return $(c,a),c}(Jb),function(a,b){this.subject=a,this.observer=b});Mb.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 Nb=(s.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),jb):(a.onCompleted(),jb):(this.observers.push(a),new Mb(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return $(d,a),_(d.prototype,Bb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new Nb(a,b)},d}(Jb),s.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new Mb(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),jb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return $(d,a),_(d.prototype,Bb,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(Jb),function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){a.call(this,b),this.observer=c,this.observable=d}return $(c,a),_(c.prototype,Bb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(Jb));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(n.Rx=s,define(function(){return s})):o&&p?q?(p.exports=s).Rx=s:o.Rx=s:n.Rx=s}).call(this);
1
+ (function(a){function b(){if(this.isDisposed)throw new Error(A)}function c(a){var b=typeof a;return a&&("function"==b||"object"==b)||!1}function d(a){var b=[];if(!c(a))return b;X.nonEnumArgs&&a.length&&h(a)&&(a=Z.call(a));var d=X.enumPrototypes&&"function"==typeof a,e=X.enumErrorProps&&(a===R||a instanceof Error);for(var f in a)d&&"prototype"==f||e&&("message"==f||"name"==f)||b.push(f);if(X.nonEnumShadows&&a!==S){var g=a.constructor,i=-1,j=V.length;if(a===(g&&g.prototype))var k=a===stringProto?N:a===R?I:O.call(a),l=W[k];for(;++i<j;)f=V[i],l&&l[f]||!P.call(a,f)||b.push(f)}return b}function e(a,b,c){for(var d=-1,e=c(a),f=e.length;++d<f;){var g=e[d];if(b(a[g],g,a)===!1)break}return a}function f(a,b){return e(a,b,d)}function g(a){return"function"!=typeof a.toString&&"string"==typeof(a+"")}function h(a){return a&&"object"==typeof a?O.call(a)==E:!1}function i(a){return"function"==typeof a||!1}function j(a,b,c,d){if(a===b)return 0!==a||1/a==1/b;var e=typeof a,k=typeof b;if(a===a&&(null==a||null==b||"function"!=e&&"object"!=e&&"function"!=k&&"object"!=k))return!1;var l=O.call(a),m=O.call(b);if(l==E&&(l=L),m==E&&(m=L),l!=m)return!1;switch(l){case G:case H:return+a==+b;case K:return a!=+a?b!=+b:0==a?1/a==1/b:a==+b;case M:case N:return a==String(b)}var n=l==F;if(!n){if(l!=L||!X.nodeClass&&(g(a)||g(b)))return!1;var o=!X.argsObject&&h(a)?Object:a.constructor,p=!X.argsObject&&h(b)?Object:b.constructor;if(!(o==p||P.call(a,"constructor")&&P.call(b,"constructor")||i(o)&&o instanceof o&&i(p)&&p instanceof p||!("constructor"in a&&"constructor"in b)))return!1}c||(c=[]),d||(d=[]);for(var q=c.length;q--;)if(c[q]==a)return d[q]==b;var r=0;if(result=!0,c.push(a),d.push(b),n){if(q=a.length,r=b.length,result=r==q)for(;r--;){var s=b[r];if(!(result=j(a[r],s,c,d)))break}}else f(b,function(b,e,f){return P.call(f,e)?(r++,result=P.call(a,e)&&j(a[e],b,c,d)):void 0}),result&&f(a,function(a,b,c){return P.call(c,b)?result=--r>-1:void 0});return c.pop(),d.pop(),result}function k(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:Z.call(a)}function l(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}var m={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=m[typeof window]&&window||this,o=m[typeof exports]&&exports&&!exports.nodeType&&exports,p=m[typeof module]&&module&&!module.nodeType&&module,q=p&&p.exports===o&&o,r=m[typeof global]&&global;!r||r.global!==r&&r.window!==r||(n=r);var s={internals:{},config:{Promise:n.Promise},helpers:{}},t=s.helpers.noop=function(){},u=(s.helpers.notDefined=function(a){return"undefined"==typeof a},s.helpers.isScheduler=function(a){return a instanceof s.Scheduler}),v=s.helpers.identity=function(a){return a},w=(s.helpers.pluck=function(a){return function(b){return b[a]}},s.helpers.just=function(a){return function(){return a}},s.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}()),x=(s.helpers.defaultComparer=function(a,b){return Y(a,b)},s.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0}),y=(s.helpers.defaultKeySerializer=function(a){return a.toString()},s.helpers.defaultError=function(a){throw a}),z=s.helpers.isPromise=function(a){return!!a&&"function"==typeof a.then},A=(s.helpers.asArray=function(){return Array.prototype.slice.call(arguments)},s.helpers.not=function(a){return!a},"Object has been disposed"),B="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";n.Set&&"function"==typeof(new n.Set)["@@iterator"]&&(B="@@iterator");var C,D={done:!0,value:a},E="[object Arguments]",F="[object Array]",G="[object Boolean]",H="[object Date]",I="[object Error]",J="[object Function]",K="[object Number]",L="[object Object]",M="[object RegExp]",N="[object String]",O=Object.prototype.toString,P=Object.prototype.hasOwnProperty,Q=O.call(arguments)==E,R=Error.prototype,S=Object.prototype,T=S.propertyIsEnumerable;try{C=!(O.call(document)==L&&!({toString:0}+""))}catch(U){C=!0}var V=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],W={};W[F]=W[H]=W[K]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},W[G]=W[N]={constructor:!0,toString:!0,valueOf:!0},W[I]=W[J]=W[M]={constructor:!0,toString:!0},W[L]={constructor:!0};var X={};!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);X.enumErrorProps=T.call(R,"message")||T.call(R,"name"),X.enumPrototypes=T.call(a,"prototype"),X.nonEnumArgs=0!=c,X.nonEnumShadows=!/valueOf/.test(b)}(1),Q||(h=function(a){return a&&"object"==typeof a?P.call(a,"callee"):!1}),i(/x/)&&(i=function(a){return"function"==typeof a&&O.call(a)==J});{var Y=s.internals.isEqual=function(a,b){return j(a,b,[],[])},Z=Array.prototype.slice,$=({}.hasOwnProperty,this.inherits=s.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),_=s.internals.addProperties=function(a){for(var b=Z.call(arguments,1),c=0,d=b.length;d>c;c++){var e=b[c];for(var f in e)a[f]=e[f]}};s.internals.addRef=function(a,b){return new Kb(function(c){return new fb(b.getDisposable(),a.subscribe(c))})}}Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=Z.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(Z.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(Z.call(arguments)))};return d});var ab=Object("a"),bb="a"!=ab[0]||!(0 in ab);Array.prototype.every||(Array.prototype.every=function(a){var b=Object(this),c=bb&&{}.toString.call(this)==N?this.split(""):b,d=c.length>>>0,e=arguments[1];if({}.toString.call(a)!=J)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=bb&&{}.toString.call(this)==N?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if({}.toString.call(a)!=J)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 Object.prototype.toString.call(a)==F}),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});var cb=function(a,b){this.id=a,this.value=b};cb.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var db=s.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},eb=db.prototype;eb.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},eb.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)}}},eb.heapify=function(b){if(b===a&&(b=0),!(b>=this.length||0>b)){var c=2*b+1,d=2*b+2,e=b;if(c<this.length&&this.isHigherPriority(c,e)&&(e=c),d<this.length&&this.isHigherPriority(d,e)&&(e=d),e!==b){var f=this.items[b];this.items[b]=this.items[e],this.items[e]=f,this.heapify(e)}}},eb.peek=function(){return this.items[0].value},eb.removeAt=function(a){this.items[a]=this.items[--this.length],delete this.items[this.length],this.heapify()},eb.dequeue=function(){var a=this.peek();return this.removeAt(0),a},eb.enqueue=function(a){var b=this.length++;this.items[b]=new cb(db.count++,a),this.percolate(b)},eb.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},db.count=0;var fb=s.CompositeDisposable=function(){this.disposables=k(arguments,0),this.isDisposed=!1,this.length=this.disposables.length},gb=fb.prototype;gb.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},gb.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},gb.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()}},gb.clear=function(){var a=this.disposables.slice(0);this.disposables=[],this.length=0;for(var b=0,c=a.length;c>b;b++)a[b].dispose()},gb.contains=function(a){return-1!==this.disposables.indexOf(a)},gb.toArray=function(){return this.disposables.slice(0)};var hb=s.Disposable=function(a){this.isDisposed=!1,this.action=a||t};hb.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};{var ib=hb.create=function(a){return new hb(a)},jb=hb.empty={dispose:t},kb=function(){function a(a){this.isSingle=a,this.isDisposed=!1,this.current=null}var b=a.prototype;return b.getDisposable=function(){return this.current},b.setDisposable=function(a){if(this.current&&this.isSingle)throw new Error("Disposable has already been assigned");var b,c=this.isDisposed;c||(b=this.current,this.current=a),b&&b.dispose(),c&&a&&a.dispose()},b.dispose=function(){var a;this.isDisposed||(this.isDisposed=!0,a=this.current,this.current=null),a&&a.dispose()},a}(),lb=s.SingleAssignmentDisposable=function(a){function b(){a.call(this,!0)}return $(b,a),b}(kb),mb=s.SerialDisposable=function(a){function b(){a.call(this,!1)}return $(b,a),b}(kb);s.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?jb:new a(this)},b}()}l.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var nb=s.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||x,this.disposable=new lb};nb.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},nb.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},nb.prototype.isCancelled=function(){return this.disposable.isDisposed},nb.prototype.invokeCore=function(){return this.action(this.scheduler,this.state)};var ob,pb=s.Scheduler=function(){function a(a,b,c,d){this.now=a,this._schedule=b,this._scheduleRelative=c,this._scheduleAbsolute=d}function b(a,b){var c=b.first,d=b.second,e=new fb,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),jb});d||(e.add(g),c=!0)})};return f(c),e}function c(a,b,c){var d=b.first,e=b.second,f=new fb,g=function(b){e(b,function(b,d){var e=!1,h=!1,i=a[c].call(a,b,d,function(a,b){return e?f.remove(i):h=!0,g(b),jb});h||(f.add(i),e=!0)})};return g(d),f}function d(a,b){return b(),jb}var e=a.prototype;return e.catchException=e["catch"]=function(a){return new ub(this,a)},e.schedulePeriodic=function(a,b){return this.schedulePeriodicWithState(null,a,function(){b()})},e.schedulePeriodicWithState=function(a,b,c){var d=a,e=setInterval(function(){d=c(d)},b);return ib(function(){clearInterval(e)})},e.schedule=function(a){return this._schedule(a,d)},e.scheduleWithState=function(a,b){return this._schedule(a,b)},e.scheduleWithRelative=function(a,b){return this._scheduleRelative(b,a,d)},e.scheduleWithRelativeAndState=function(a,b,c){return this._scheduleRelative(a,b,c)},e.scheduleWithAbsolute=function(a,b){return this._scheduleAbsolute(b,a,d)},e.scheduleWithAbsoluteAndState=function(a,b,c){return this._scheduleAbsolute(a,b,c)},e.scheduleRecursive=function(a){return this.scheduleRecursiveWithState(a,function(a,b){a(function(){b(a)})})},e.scheduleRecursiveWithState=function(a,c){return this.scheduleWithState({first:a,second:c},function(a,c){return b(a,c)})},e.scheduleRecursiveWithRelative=function(a,b){return this.scheduleRecursiveWithRelativeAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithRelativeAndState=function(a,b,d){return this._scheduleRelative({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithRelativeAndState")})},e.scheduleRecursiveWithAbsolute=function(a,b){return this.scheduleRecursiveWithAbsoluteAndState(b,a,function(a,b){a(function(c){b(a,c)})})},e.scheduleRecursiveWithAbsoluteAndState=function(a,b,d){return this._scheduleAbsolute({first:a,second:d},b,function(a,b){return c(a,b,"scheduleWithAbsoluteAndState")})},a.now=w,a.normalize=function(a){return 0>a&&(a=0),a},a}(),qb=pb.normalize,rb=(s.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 lb;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0,this._period,a.bind(this))),b},b}(),pb.immediate=function(){function a(a,b){return b(this,a)}function b(a,b,c){for(var d=qb(d);d-this.now()>0;);return c(this,a)}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new pb(w,a,b,c)}()),sb=pb.currentThread=function(){function a(a){for(var b;a.length>0;)if(b=a.dequeue(),!b.isCancelled()){for(;b.dueTime-pb.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()+pb.normalize(c),g=new nb(this,b,d,f);if(e)e.enqueue(g);else{e=new db(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 pb(w,b,c,d);return f.scheduleRequired=function(){return!e},f.ensureTrampoline=function(a){e?a():this.schedule(a)},f}(),tb=t;!function(){function a(){if(!n.postMessage||n.importScripts)return!1;var a=!1,b=n.onmessage;return n.onmessage=function(){a=!0},n.postMessage("","*"),n.onmessage=b,a}function b(a){if("string"==typeof a.data&&a.data.substring(0,f.length)===f){var b=a.data.substring(f.length),c=g[b];c(),delete g[b]}}var c=RegExp("^"+String(O).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),d="function"==typeof(d=r&&q&&r.setImmediate)&&!c.test(d)&&d,e="function"==typeof(e=r&&q&&r.clearImmediate)&&!c.test(e)&&e;if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))ob=process.nextTick;else if("function"==typeof d)ob=d,tb=e;else if(a()){var f="ms.rx.schedule"+Math.random(),g={},h=0;n.addEventListener?n.addEventListener("message",b,!1):n.attachEvent("onmessage",b,!1),ob=function(a){var b=h++;g[b]=a,n.postMessage(f+b,"*")}}else if(n.MessageChannel){var i=new n.MessageChannel,j={},k=0;i.port1.onmessage=function(a){var b=a.data,c=j[b];c(),delete j[b]},ob=function(a){var b=k++;j[b]=a,i.port2.postMessage(b)}}else"document"in n&&"onreadystatechange"in n.document.createElement("script")?ob=function(a){var b=n.document.createElement("script");b.onreadystatechange=function(){a(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},n.document.documentElement.appendChild(b)}:(ob=function(a){return setTimeout(a,0)},tb=clearTimeout)}();var ub=(pb.timeout=function(){function a(a,b){var c=this,d=new lb,e=ob(function(){d.isDisposed||d.setDisposable(b(c,a))});return new fb(d,ib(function(){tb(e)}))}function b(a,b,c){var d=this,e=pb.normalize(b);if(0===e)return d.scheduleWithState(a,c);var f=new lb,g=setTimeout(function(){f.isDisposed||f.setDisposable(c(d,a))},e);return new fb(f,ib(function(){clearTimeout(g)}))}function c(a,b,c){return this.scheduleWithRelativeAndState(a,b-this.now(),c)}return new pb(w,a,b,c)}(),function(a){function b(){return this._scheduler.now()}function c(a,b){return this._scheduler.scheduleWithState(a,this._wrap(b))}function d(a,b,c){return this._scheduler.scheduleWithRelativeAndState(a,b,this._wrap(c))}function e(a,b,c){return this._scheduler.scheduleWithAbsoluteAndState(a,b,this._wrap(c))}function f(f,g){this._scheduler=f,this._handler=g,this._recursiveOriginal=null,this._recursiveWrapper=null,a.call(this,b,c,d,e)}return $(f,a),f.prototype._clone=function(a){return new f(a,this._handler)},f.prototype._wrap=function(a){var b=this;return function(c,d){try{return a(b._getRecursiveWrapper(c),d)}catch(e){if(!b._handler(e))throw e;return jb}}},f.prototype._getRecursiveWrapper=function(a){if(this._recursiveOriginal!==a){this._recursiveOriginal=a;var b=this._clone(a);b._recursiveOriginal=a,b._recursiveWrapper=b,this._recursiveWrapper=b}return this._recursiveWrapper},f.prototype.schedulePeriodicWithState=function(a,b,c){var d=this,e=!1,f=new lb;return f.setDisposable(this._scheduler.schedulePeriodicWithState(a,b,function(a){if(e)return null;try{return c(a)}catch(b){if(e=!0,!d._handler(b))throw b;return f.dispose(),null}})),f},f}(pb)),vb=s.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 u(a)||(a=rb),new Kb(function(c){return a.schedule(function(){b._acceptObservable(c),"N"===b.kind&&c.onCompleted()})})},a}(),wb=vb.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 vb("N",!0);return e.value=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),xb=vb.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 vb("E");return e.exception=d,e._accept=a,e._acceptObservable=b,e.toString=c,e}}(),yb=vb.createOnCompleted=function(){function a(a,b,c){return c()}function b(a){return a.onCompleted()}function c(){return"OnCompleted()"}return function(){var d=new vb("C");return d._accept=a,d._acceptObservable=b,d.toString=c,d}}(),zb=s.internals.Enumerator=function(a){this._next=a};zb.prototype.next=function(){return this._next()},zb.prototype[B]=function(){return this};var Ab=s.internals.Enumerable=function(a){this._iterator=a};Ab.prototype[B]=function(){return this._iterator()},Ab.prototype.concat=function(){var a=this;return new Kb(function(b){var c;try{c=a[B]()}catch(d){return void b.onError()}var e,f=new mb,g=rb.scheduleRecursive(function(a){var d;if(!e){try{d=c.next()}catch(g){return void b.onError(g)}if(d.done)return void b.onCompleted();var h=d.value;z(h)&&(h=observableFromPromise(h));var i=new lb;f.setDisposable(i),i.setDisposable(h.subscribe(b.onNext.bind(b),b.onError.bind(b),function(){a()}))}});return new fb(f,g,ib(function(){e=!0}))})},Ab.prototype.catchException=function(){var a=this;return new Kb(function(b){var c;try{c=a[B]()}catch(d){return void b.onError()}var e,f,g=new mb,h=rb.scheduleRecursive(function(a){if(!e){var d;try{d=c.next()}catch(h){return void b.onError(h)}if(d.done)return void(f?b.onError(f):b.onCompleted());var i=d.value;z(i)&&(i=observableFromPromise(i));var j=new lb;g.setDisposable(j),j.setDisposable(i.subscribe(b.onNext.bind(b),function(b){f=b,a()},b.onCompleted.bind(b)))}});return new fb(g,h,ib(function(){e=!0}))})};var Bb=(Ab.repeat=function(a,b){return null==b&&(b=-1),new Ab(function(){var c=b;return new zb(function(){return 0===c?D:(c>0&&c--,{done:!1,value:a})})})},Ab.forEach=function(a,b,c){return b||(b=v),new Ab(function(){var d=-1;return new zb(function(){return++d<a.length?{done:!1,value:b.call(c,a[d],d,a)}:D})})},s.Observer=function(){});Bb.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},Bb.prototype.asObserver=function(){return new Fb(this.onNext.bind(this),this.onError.bind(this),this.onCompleted.bind(this))},Bb.prototype.checked=function(){return new Gb(this)};var Cb=Bb.create=function(a,b,c){return a||(a=t),b||(b=y),c||(c=t),new Fb(a,b,c)};Bb.fromNotifier=function(a){return new Fb(function(b){return a(wb(b))},function(b){return a(xb(b))},function(){return a(yb())})},Bb.notifyOn=function(a){return new Ib(a,this)};var Db,Eb=s.internals.AbstractObserver=function(a){function b(){this.isStopped=!1,a.call(this)}return $(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}(Bb),Fb=s.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return $(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}(Eb),Gb=function(a){function b(b){a.call(this),this._observer=b,this._state=0}$(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}(Bb),Hb=s.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 mb}return $(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}(Eb),Ib=function(a){function b(){a.apply(this,arguments)}return $(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}(Hb),Jb=s.Observable=function(){function a(a){this._subscribe=a}return Db=a.prototype,Db.subscribe=Db.forEach=function(a,b,c){var d="object"==typeof a?a:Cb(a,b,c);return this._subscribe(d)},a}(),Kb=s.AnonymousObservable=function(a){function b(a){return a&&"function"==typeof a.dispose?a:"function"==typeof a?ib(a):jb}function c(d){function e(a){var c=function(){try{e.setDisposable(b(d(e)))}catch(a){if(!e.fail(a))throw a}},e=new Lb(a);return sb.scheduleRequired()?sb.schedule(c):c(),e}return this instanceof c?void a.call(this,e):new c(d)}return $(c,a),c}(Jb),Lb=function(a){function b(b){a.call(this),this.observer=b,this.m=new lb}$(b,a);var c=b.prototype;return c.next=function(a){var b=!1;try{this.observer.onNext(a),b=!0}catch(c){throw c}finally{b||this.dispose()}},c.error=function(a){try{this.observer.onError(a)}catch(b){throw b}finally{this.dispose()}},c.completed=function(){try{this.observer.onCompleted()}catch(a){throw a}finally{this.dispose()}},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.disposable=function(a){return arguments.length?this.getDisposable():setDisposable(a)},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(Eb),Mb=function(a,b){this.subject=a,this.observer=b};Mb.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 Nb=(s.Subject=function(a){function c(a){return b.call(this),this.isStopped?this.exception?(a.onError(this.exception),jb):(a.onCompleted(),jb):(this.observers.push(a),new Mb(this,a))}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.observers=[]}return $(d,a),_(d.prototype,Bb,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(b.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var c=0,d=a.length;d>c;c++)a[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){if(b.call(this),!this.isStopped)for(var c=this.observers.slice(0),d=0,e=c.length;e>d;d++)c[d].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),d.create=function(a,b){return new Nb(a,b)},d}(Jb),s.AsyncSubject=function(a){function c(a){if(b.call(this),!this.isStopped)return this.observers.push(a),new Mb(this,a);var c=this.exception,d=this.hasValue,e=this.value;return c?a.onError(c):d?(a.onNext(e),a.onCompleted()):a.onCompleted(),jb}function d(){a.call(this,c),this.isDisposed=!1,this.isStopped=!1,this.value=null,this.hasValue=!1,this.observers=[],this.exception=null}return $(d,a),_(d.prototype,Bb,{hasObservers:function(){return b.call(this),this.observers.length>0},onCompleted:function(){var a,c,d;if(b.call(this),!this.isStopped){this.isStopped=!0;var e=this.observers.slice(0),f=this.value,g=this.hasValue;if(g)for(c=0,d=e.length;d>c;c++)a=e[c],a.onNext(f),a.onCompleted();else for(c=0,d=e.length;d>c;c++)e[c].onCompleted();this.observers=[]}},onError:function(a){if(b.call(this),!this.isStopped){var c=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var d=0,e=c.length;e>d;d++)c[d].onError(a);this.observers=[]}},onNext:function(a){b.call(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),d}(Jb),s.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this,this.observable.subscribe.bind(this.observable))}return $(b,a),_(b.prototype,Bb,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(Jb));"function"==typeof define&&"object"==typeof define.amd&&define.amd?(n.Rx=s,define(function(){return s})):o&&p?q?(p.exports=s).Rx=s:o.Rx=s:n.Rx=s}).call(this);