rxjs-rails 2.3.9 → 2.3.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rxjs/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/rx.aggregates.js +174 -204
  4. data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
  5. data/vendor/assets/javascripts/rx.all.compat.js +1626 -1528
  6. data/vendor/assets/javascripts/rx.all.compat.min.js +3 -3
  7. data/vendor/assets/javascripts/rx.all.js +1624 -1526
  8. data/vendor/assets/javascripts/rx.all.min.js +3 -3
  9. data/vendor/assets/javascripts/rx.async.compat.js +241 -0
  10. data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
  11. data/vendor/assets/javascripts/rx.async.js +241 -0
  12. data/vendor/assets/javascripts/rx.async.min.js +1 -1
  13. data/vendor/assets/javascripts/rx.backpressure.js +3 -3
  14. data/vendor/assets/javascripts/rx.backpressure.min.js +1 -1
  15. data/vendor/assets/javascripts/rx.binding.js +350 -378
  16. data/vendor/assets/javascripts/rx.binding.min.js +1 -1
  17. data/vendor/assets/javascripts/rx.coincidence.js +16 -21
  18. data/vendor/assets/javascripts/rx.compat.js +633 -683
  19. data/vendor/assets/javascripts/rx.compat.min.js +2 -2
  20. data/vendor/assets/javascripts/rx.js +633 -683
  21. data/vendor/assets/javascripts/rx.lite.compat.js +941 -1137
  22. data/vendor/assets/javascripts/rx.lite.compat.min.js +2 -2
  23. data/vendor/assets/javascripts/rx.lite.extras.js +58 -74
  24. data/vendor/assets/javascripts/rx.lite.extras.min.js +1 -1
  25. data/vendor/assets/javascripts/rx.lite.js +941 -1137
  26. data/vendor/assets/javascripts/rx.lite.min.js +2 -2
  27. data/vendor/assets/javascripts/rx.min.js +2 -2
  28. data/vendor/assets/javascripts/rx.time.js +182 -212
  29. data/vendor/assets/javascripts/rx.time.min.js +1 -1
  30. metadata +10 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8095da97fe169dcb17a669c128e30d2b1ba3822e
4
- data.tar.gz: 08b25037b34aaf7eb6af3a27fd15ba98224d8976
3
+ metadata.gz: ede904dde917b436ee0076d08869656a5313ee05
4
+ data.tar.gz: 05be0488209bd1bc630b2ed247abf1358df85068
5
5
  SHA512:
6
- metadata.gz: 300336bd7e50073b590c7607847b108f0bb8f54d3a28b060b94c69ea84a3900d5205043010fa5c75247408e44aae3d3a90b367d245ae9bcb02c810260188293a
7
- data.tar.gz: a1a87f293b1938f3ea16c7c60117f74654ea74c01e3fff68ae5bcf0e72a3eb57d55e6cd7c647bc6ae1ed34923ab1716fa5997991814ba8b8f6b228e3069474f8
6
+ metadata.gz: 495b47df07c77a48ec8c99799da1910e07ba96b850a2ad4d1b5fdbb73826b249cbce8c3f92d4989390aec21012c416fa402ccb97f2cc0bb5b2b4a50a8741470b
7
+ data.tar.gz: 66a5aa342b5df3c1d6ab47d9003ce6d805ef14dbc6b207fee1809075cee2edb59a504ab9a46a6b402611c8c845509f62fbbab965147220ce0ad9107be4513617
@@ -1,6 +1,6 @@
1
1
  module Rxjs
2
2
  module Rails
3
- VERSION = "2.3.9"
3
+ VERSION = "2.3.10"
4
4
  end
5
5
  end
6
6
 
@@ -44,6 +44,7 @@
44
44
  defaultComparer = helpers.defaultComparer,
45
45
  identity = helpers.identity,
46
46
  defaultSubComparer = helpers.defaultSubComparer,
47
+ isFunction = helpers.isFunction,
47
48
  isPromise = helpers.isPromise,
48
49
  observableFromPromise = Observable.fromPromise;
49
50
 
@@ -69,42 +70,40 @@
69
70
  });
70
71
  };
71
72
 
72
- function extremaBy(source, keySelector, comparer) {
73
- return new AnonymousObservable(function (observer) {
74
- var hasValue = false, lastKey = null, list = [];
75
- return source.subscribe(function (x) {
76
- var comparison, key;
77
- try {
78
- key = keySelector(x);
79
- } catch (ex) {
80
- observer.onError(ex);
81
- return;
82
- }
83
- comparison = 0;
84
- if (!hasValue) {
85
- hasValue = true;
86
- lastKey = key;
87
- } else {
88
- try {
89
- comparison = comparer(key, lastKey);
90
- } catch (ex1) {
91
- observer.onError(ex1);
92
- return;
93
- }
94
- }
95
- if (comparison > 0) {
96
- lastKey = key;
97
- list = [];
98
- }
99
- if (comparison >= 0) {
100
- list.push(x);
101
- }
102
- }, observer.onError.bind(observer), function () {
103
- observer.onNext(list);
104
- observer.onCompleted();
105
- });
106
- });
107
- }
73
+ function extremaBy(source, keySelector, comparer) {
74
+ return new AnonymousObservable(function (observer) {
75
+ var hasValue = false, lastKey = null, list = [];
76
+ return source.subscribe(function (x) {
77
+ var comparison, key;
78
+ try {
79
+ key = keySelector(x);
80
+ } catch (ex) {
81
+ observer.onError(ex);
82
+ return;
83
+ }
84
+ comparison = 0;
85
+ if (!hasValue) {
86
+ hasValue = true;
87
+ lastKey = key;
88
+ } else {
89
+ try {
90
+ comparison = comparer(key, lastKey);
91
+ } catch (ex1) {
92
+ observer.onError(ex1);
93
+ return;
94
+ }
95
+ }
96
+ if (comparison > 0) {
97
+ lastKey = key;
98
+ list = [];
99
+ }
100
+ if (comparison >= 0) { list.push(x); }
101
+ }, observer.onError.bind(observer), function () {
102
+ observer.onNext(list);
103
+ observer.onCompleted();
104
+ });
105
+ });
106
+ }
108
107
 
109
108
  function firstOnly(x) {
110
109
  if (x.length === 0) {
@@ -235,22 +234,22 @@
235
234
  });
236
235
  };
237
236
 
238
- /**
239
- * Computes the sum of a sequence of values that are obtained by invoking an optional transform function on each element of the input sequence, else if not specified computes the sum on each item in the sequence.
240
- * @example
241
- * var res = source.sum();
242
- * var res = source.sum(function (x) { return x.value; });
243
- * @param {Function} [selector] A transform function to apply to each element.
244
- * @param {Any} [thisArg] Object to use as this when executing callback.
245
- * @returns {Observable} An observable sequence containing a single element with the sum of the values in the source sequence.
246
- */
247
- observableProto.sum = function (keySelector, thisArg) {
248
- return keySelector ?
249
- this.select(keySelector, thisArg).sum() :
250
- this.aggregate(0, function (prev, curr) {
251
- return prev + curr;
252
- });
253
- };
237
+ /**
238
+ * Computes the sum of a sequence of values that are obtained by invoking an optional transform function on each element of the input sequence, else if not specified computes the sum on each item in the sequence.
239
+ * @example
240
+ * var res = source.sum();
241
+ * var res = source.sum(function (x) { return x.value; });
242
+ * @param {Function} [selector] A transform function to apply to each element.
243
+ * @param {Any} [thisArg] Object to use as this when executing callback.
244
+ * @returns {Observable} An observable sequence containing a single element with the sum of the values in the source sequence.
245
+ */
246
+ observableProto.sum = function (keySelector, thisArg) {
247
+ return keySelector && isFunction(keySelector) ?
248
+ this.map(keySelector, thisArg).sum() :
249
+ this.aggregate(0, function (prev, curr) {
250
+ return prev + curr;
251
+ });
252
+ };
254
253
 
255
254
  /**
256
255
  * Returns the elements in an observable sequence with the minimum key value according to the specified comparer.
@@ -339,27 +338,25 @@
339
338
  };
340
339
 
341
340
  function sequenceEqualArray(first, second, comparer) {
342
- return new AnonymousObservable(function (observer) {
343
- var count = 0, len = second.length;
344
- return first.subscribe(function (value) {
345
- var equal = false;
346
- try {
347
- if (count < len) {
348
- equal = comparer(value, second[count++]);
349
- }
350
- } catch (e) {
351
- observer.onError(e);
352
- return;
353
- }
354
- if (!equal) {
355
- observer.onNext(false);
356
- observer.onCompleted();
357
- }
358
- }, observer.onError.bind(observer), function () {
359
- observer.onNext(count === len);
341
+ return new AnonymousObservable(function (observer) {
342
+ var count = 0, len = second.length;
343
+ return first.subscribe(function (value) {
344
+ var equal = false;
345
+ try {
346
+ count < len && (equal = comparer(value, second[count++]));
347
+ } catch (e) {
348
+ observer.onError(e);
349
+ return;
350
+ }
351
+ if (!equal) {
352
+ observer.onNext(false);
360
353
  observer.onCompleted();
361
- });
354
+ }
355
+ }, observer.onError.bind(observer), function () {
356
+ observer.onNext(count === len);
357
+ observer.onCompleted();
362
358
  });
359
+ });
363
360
  }
364
361
 
365
362
  /**
@@ -385,17 +382,17 @@
385
382
  var subscription1 = first.subscribe(function (x) {
386
383
  var equal, v;
387
384
  if (qr.length > 0) {
388
- v = qr.shift();
389
- try {
390
- equal = comparer(v, x);
391
- } catch (e) {
392
- observer.onError(e);
393
- return;
394
- }
395
- if (!equal) {
396
- observer.onNext(false);
397
- observer.onCompleted();
398
- }
385
+ v = qr.shift();
386
+ try {
387
+ equal = comparer(v, x);
388
+ } catch (e) {
389
+ observer.onError(e);
390
+ return;
391
+ }
392
+ if (!equal) {
393
+ observer.onNext(false);
394
+ observer.onCompleted();
395
+ }
399
396
  } else if (doner) {
400
397
  observer.onNext(false);
401
398
  observer.onCompleted();
@@ -417,9 +414,9 @@
417
414
 
418
415
  isPromise(second) && (second = observableFromPromise(second));
419
416
  var subscription2 = second.subscribe(function (x) {
420
- var equal, v;
417
+ var equal;
421
418
  if (ql.length > 0) {
422
- v = ql.shift();
419
+ var v = ql.shift();
423
420
  try {
424
421
  equal = comparer(v, x);
425
422
  } catch (exception) {
@@ -499,60 +496,60 @@
499
496
  return elementAtOrDefault(this, index, true, defaultValue);
500
497
  };
501
498
 
502
- function singleOrDefaultAsync(source, hasDefault, defaultValue) {
503
- return new AnonymousObservable(function (observer) {
504
- var value = defaultValue, seenValue = false;
505
- return source.subscribe(function (x) {
506
- if (seenValue) {
507
- observer.onError(new Error('Sequence contains more than one element'));
508
- } else {
509
- value = x;
510
- seenValue = true;
511
- }
512
- }, observer.onError.bind(observer), function () {
513
- if (!seenValue && !hasDefault) {
514
- observer.onError(new Error(sequenceContainsNoElements));
515
- } else {
516
- observer.onNext(value);
517
- observer.onCompleted();
518
- }
519
- });
520
- });
521
- }
499
+ function singleOrDefaultAsync(source, hasDefault, defaultValue) {
500
+ return new AnonymousObservable(function (observer) {
501
+ var value = defaultValue, seenValue = false;
502
+ return source.subscribe(function (x) {
503
+ if (seenValue) {
504
+ observer.onError(new Error('Sequence contains more than one element'));
505
+ } else {
506
+ value = x;
507
+ seenValue = true;
508
+ }
509
+ }, observer.onError.bind(observer), function () {
510
+ if (!seenValue && !hasDefault) {
511
+ observer.onError(new Error(sequenceContainsNoElements));
512
+ } else {
513
+ observer.onNext(value);
514
+ observer.onCompleted();
515
+ }
516
+ });
517
+ });
518
+ }
522
519
 
523
- /**
524
- * Returns the only element of an observable sequence that satisfies the condition in the optional predicate, and reports an exception if there is not exactly one element in the observable sequence.
525
- * @example
526
- * var res = res = source.single();
527
- * var res = res = source.single(function (x) { return x === 42; });
528
- * @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
529
- * @param {Any} [thisArg] Object to use as `this` when executing the predicate.
530
- * @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate.
531
- */
532
- observableProto.single = function (predicate, thisArg) {
533
- return predicate ?
534
- this.where(predicate, thisArg).single() :
535
- singleOrDefaultAsync(this, false);
536
- };
520
+ /**
521
+ * Returns the only element of an observable sequence that satisfies the condition in the optional predicate, and reports an exception if there is not exactly one element in the observable sequence.
522
+ * @example
523
+ * var res = res = source.single();
524
+ * var res = res = source.single(function (x) { return x === 42; });
525
+ * @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
526
+ * @param {Any} [thisArg] Object to use as `this` when executing the predicate.
527
+ * @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate.
528
+ */
529
+ observableProto.single = function (predicate, thisArg) {
530
+ return predicate && isFunction(predicate) ?
531
+ this.where(predicate, thisArg).single() :
532
+ singleOrDefaultAsync(this, false);
533
+ };
537
534
 
538
- /**
539
- * Returns the only element of an observable sequence that matches the predicate, or a default value if no such element exists; this method reports an exception if there is more than one element in the observable sequence.
540
- * @example
541
- * var res = res = source.singleOrDefault();
542
- * var res = res = source.singleOrDefault(function (x) { return x === 42; });
543
- * res = source.singleOrDefault(function (x) { return x === 42; }, 0);
544
- * res = source.singleOrDefault(null, 0);
545
- * @memberOf Observable#
546
- * @param {Function} predicate A predicate function to evaluate for elements in the source sequence.
547
- * @param [defaultValue] The default value if the index is outside the bounds of the source sequence.
548
- * @param {Any} [thisArg] Object to use as `this` when executing the predicate.
549
- * @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
550
- */
551
- observableProto.singleOrDefault = function (predicate, defaultValue, thisArg) {
552
- return predicate?
553
- this.where(predicate, thisArg).singleOrDefault(null, defaultValue) :
554
- singleOrDefaultAsync(this, true, defaultValue)
555
- };
535
+ /**
536
+ * Returns the only element of an observable sequence that matches the predicate, or a default value if no such element exists; this method reports an exception if there is more than one element in the observable sequence.
537
+ * @example
538
+ * var res = res = source.singleOrDefault();
539
+ * var res = res = source.singleOrDefault(function (x) { return x === 42; });
540
+ * res = source.singleOrDefault(function (x) { return x === 42; }, 0);
541
+ * res = source.singleOrDefault(null, 0);
542
+ * @memberOf Observable#
543
+ * @param {Function} predicate A predicate function to evaluate for elements in the source sequence.
544
+ * @param [defaultValue] The default value if the index is outside the bounds of the source sequence.
545
+ * @param {Any} [thisArg] Object to use as `this` when executing the predicate.
546
+ * @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
547
+ */
548
+ observableProto.singleOrDefault = function (predicate, defaultValue, thisArg) {
549
+ return predicate && isFunction(predicate) ?
550
+ this.where(predicate, thisArg).singleOrDefault(null, defaultValue) :
551
+ singleOrDefaultAsync(this, true, defaultValue);
552
+ };
556
553
  function firstOrDefaultAsync(source, hasDefault, defaultValue) {
557
554
  return new AnonymousObservable(function (observer) {
558
555
  return source.subscribe(function (x) {
@@ -697,71 +694,26 @@
697
694
  return findValue(this, predicate, thisArg, true);
698
695
  };
699
696
 
700
- function toSet(source, type) {
701
- return new AnonymousObservable(function (observer) {
702
- var s = new type();
703
- return source.subscribe(
704
- s.add.bind(s),
705
- observer.onError.bind(observer),
706
- function () {
707
- observer.onNext(s);
708
- observer.onCompleted();
709
- });
710
- });
711
- }
712
697
  if (!!root.Set) {
713
698
  /**
714
699
  * Converts the observable sequence to a Set if it exists.
715
700
  * @returns {Observable} An observable sequence with a single value of a Set containing the values from the observable sequence.
716
701
  */
717
702
  observableProto.toSet = function () {
718
- return toSet(this, root.Set);
719
- };
720
- }
721
-
722
- if (!!root.WeakSet) {
723
- /**
724
- * Converts the observable sequence to a WeakSet if it exists.
725
- * @returns {Observable} An observable sequence with a single value of a WeakSet containing the values from the observable sequence.
726
- */
727
- observableProto.toWeakSet = function () {
728
- return toSet(this, root.WeakSet);
703
+ var source = this;
704
+ return new AnonymousObservable(function (observer) {
705
+ var s = new root.Set();
706
+ return source.subscribe(
707
+ s.add.bind(s),
708
+ observer.onError.bind(observer),
709
+ function () {
710
+ observer.onNext(s);
711
+ observer.onCompleted();
712
+ });
713
+ });
729
714
  };
730
715
  }
731
716
 
732
- function toMap(source, type, keySelector, elementSelector) {
733
- return new AnonymousObservable(function (observer) {
734
- var m = new type();
735
- return source.subscribe(
736
- function (x) {
737
- var key;
738
- try {
739
- key = keySelector(x);
740
- } catch (e) {
741
- observer.onError(e);
742
- return;
743
- }
744
-
745
- var element = x;
746
- if (elementSelector) {
747
- try {
748
- element = elementSelector(x);
749
- } catch (e) {
750
- observer.onError(e);
751
- return;
752
- }
753
- }
754
-
755
- m.set(key, element);
756
- },
757
- observer.onError.bind(observer),
758
- function () {
759
- observer.onNext(m);
760
- observer.onCompleted();
761
- });
762
- });
763
- }
764
-
765
717
  if (!!root.Map) {
766
718
  /**
767
719
  * Converts the observable sequence to a Map if it exists.
@@ -770,19 +722,37 @@
770
722
  * @returns {Observable} An observable sequence with a single value of a Map containing the values from the observable sequence.
771
723
  */
772
724
  observableProto.toMap = function (keySelector, elementSelector) {
773
- return toMap(this, root.Map, keySelector, elementSelector);
774
- };
775
- }
725
+ var source = this;
726
+ return new AnonymousObservable(function (observer) {
727
+ var m = new root.Map();
728
+ return source.subscribe(
729
+ function (x) {
730
+ var key;
731
+ try {
732
+ key = keySelector(x);
733
+ } catch (e) {
734
+ observer.onError(e);
735
+ return;
736
+ }
776
737
 
777
- if (!!root.WeakMap) {
778
- /**
779
- * Converts the observable sequence to a WeakMap if it exists.
780
- * @param {Function} keySelector A function which produces the key for the WeakMap
781
- * @param {Function} [elementSelector] An optional function which produces the element for the WeakMap. If not present, defaults to the value from the observable sequence.
782
- * @returns {Observable} An observable sequence with a single value of a WeakMap containing the values from the observable sequence.
783
- */
784
- observableProto.toWeakMap = function (keySelector, elementSelector) {
785
- return toMap(this, root.WeakMap, keySelector, elementSelector);
738
+ var element = x;
739
+ if (elementSelector) {
740
+ try {
741
+ element = elementSelector(x);
742
+ } catch (e) {
743
+ observer.onError(e);
744
+ return;
745
+ }
746
+ }
747
+
748
+ m.set(key, element);
749
+ },
750
+ observer.onError.bind(observer),
751
+ function () {
752
+ observer.onNext(m);
753
+ observer.onCompleted();
754
+ });
755
+ });
786
756
  };
787
757
  }
788
758
 
@@ -1 +1 @@
1
- (function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b,c){return new r(function(d){var e=!1,f=null,g=[];return a.subscribe(function(a){var h,i;try{i=b(a)}catch(j){return void d.onError(j)}if(h=0,e)try{h=c(i,f)}catch(k){return void d.onError(k)}else e=!0,f=i;h>0&&(f=i,g=[]),h>=0&&g.push(a)},d.onError.bind(d),function(){d.onNext(g),d.onCompleted()})})}function f(a){if(0===a.length)throw new Error(A);return a[0]}function g(a,b,c){return new r(function(d){var e=0,f=b.length;return a.subscribe(function(a){var g=!1;try{f>e&&(g=c(a,b[e++]))}catch(h){return void d.onError(h)}g||(d.onNext(!1),d.onCompleted())},d.onError.bind(d),function(){d.onNext(e===f),d.onCompleted()})})}function h(a,b,c,d){if(0>b)throw new Error(z);return new r(function(e){var f=b;return a.subscribe(function(a){0===f&&(e.onNext(a),e.onCompleted()),f--},e.onError.bind(e),function(){c?(e.onNext(d),e.onCompleted()):e.onError(new Error(z))})})}function i(a,b,c){return new r(function(d){var e=c,f=!1;return a.subscribe(function(a){f?d.onError(new Error("Sequence contains more than one element")):(e=a,f=!0)},d.onError.bind(d),function(){f||b?(d.onNext(e),d.onCompleted()):d.onError(new Error(A))})})}function j(a,b,c){return new r(function(d){return a.subscribe(function(a){d.onNext(a),d.onCompleted()},d.onError.bind(d),function(){b?(d.onNext(c),d.onCompleted()):d.onError(new Error(A))})})}function k(a,b,c){return new r(function(d){var e=c,f=!1;return a.subscribe(function(a){e=a,f=!0},d.onError.bind(d),function(){f||b?(d.onNext(e),d.onCompleted()):d.onError(new Error(A))})})}function l(a,b,c,e){return new r(function(f){var g=0;return a.subscribe(function(d){var h;try{h=b.call(c,d,g,a)}catch(i){return void f.onError(i)}h?(f.onNext(e?g:d),f.onCompleted()):g++},f.onError.bind(f),function(){f.onNext(e?-1:d),f.onCompleted()})})}function m(a,b){return new r(function(c){var d=new b;return a.subscribe(d.add.bind(d),c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})}function n(a,b,c,d){return new r(function(e){var f=new b;return a.subscribe(function(a){var b;try{b=c(a)}catch(g){return void e.onError(g)}var h=a;if(d)try{h=d(a)}catch(g){return void e.onError(g)}f.set(b,h)},e.onError.bind(e),function(){e.onNext(f),e.onCompleted()})})}var o=c.Observable,p=o.prototype,q=c.CompositeDisposable,r=c.AnonymousObservable,s=(c.internals.isEqual,c.helpers),t=s.not,u=s.defaultComparer,v=s.identity,w=s.defaultSubComparer,x=s.isPromise,y=o.fromPromise,z="Argument out of range",A="Sequence contains no elements.";return p.finalValue=function(){var a=this;return new r(function(b){var c,d=!1;return a.subscribe(function(a){d=!0,c=a},b.onError.bind(b),function(){d?(b.onNext(c),b.onCompleted()):b.onError(new Error(A))})})},p.aggregate=function(){var a,b,c;return 2===arguments.length?(a=arguments[0],b=!0,c=arguments[1]):c=arguments[0],b?this.scan(a,c).startWith(a).finalValue():this.scan(c).finalValue()},p.reduce=function(a){var b,c;return 2===arguments.length&&(c=!0,b=arguments[1]),c?this.scan(b,a).startWith(b).finalValue():this.scan(a).finalValue()},p.some=p.any=function(a,b){var c=this;return a?c.where(a,b).any():new r(function(a){return c.subscribe(function(){a.onNext(!0),a.onCompleted()},a.onError.bind(a),function(){a.onNext(!1),a.onCompleted()})})},p.isEmpty=function(){return this.any().map(t)},p.every=p.all=function(a,b){return this.where(function(b){return!a(b)},b).any().select(function(a){return!a})},p.contains=function(a,b){return b||(b=u),this.where(function(c){return b(c,a)}).any()},p.count=function(a,b){return a?this.where(a,b).count():this.aggregate(0,function(a){return a+1})},p.sum=function(a,b){return a?this.select(a,b).sum():this.aggregate(0,function(a,b){return a+b})},p.minBy=function(a,b){return b||(b=w),e(this,a,function(a,c){return-1*b(a,c)})},p.min=function(a){return this.minBy(v,a).select(function(a){return f(a)})},p.maxBy=function(a,b){return b||(b=w),e(this,a,b)},p.max=function(a){return this.maxBy(v,a).select(function(a){return f(a)})},p.average=function(a,b){return a?this.select(a,b).average():this.scan({sum:0,count:0},function(a,b){return{sum:a.sum+b,count:a.count+1}}).finalValue().select(function(a){if(0===a.count)throw new Error("The input sequence was empty");return a.sum/a.count})},p.sequenceEqual=function(a,b){var c=this;return b||(b=u),Array.isArray(a)?g(c,a,b):new r(function(d){var e=!1,f=!1,g=[],h=[],i=c.subscribe(function(a){var c,e;if(h.length>0){e=h.shift();try{c=b(e,a)}catch(i){return void d.onError(i)}c||(d.onNext(!1),d.onCompleted())}else f?(d.onNext(!1),d.onCompleted()):g.push(a)},d.onError.bind(d),function(){e=!0,0===g.length&&(h.length>0?(d.onNext(!1),d.onCompleted()):f&&(d.onNext(!0),d.onCompleted()))});x(a)&&(a=y(a));var j=a.subscribe(function(a){var c,f;if(g.length>0){f=g.shift();try{c=b(f,a)}catch(i){return void d.onError(i)}c||(d.onNext(!1),d.onCompleted())}else e?(d.onNext(!1),d.onCompleted()):h.push(a)},d.onError.bind(d),function(){f=!0,0===h.length&&(g.length>0?(d.onNext(!1),d.onCompleted()):e&&(d.onNext(!0),d.onCompleted()))});return new q(i,j)})},p.elementAt=function(a){return h(this,a,!1)},p.elementAtOrDefault=function(a,b){return h(this,a,!0,b)},p.single=function(a,b){return a?this.where(a,b).single():i(this,!1)},p.singleOrDefault=function(a,b,c){return a?this.where(a,c).singleOrDefault(null,b):i(this,!0,b)},p.first=function(a,b){return a?this.where(a,b).first():j(this,!1)},p.firstOrDefault=function(a,b){return a?this.where(a).firstOrDefault(null,b):j(this,!0,b)},p.last=function(a,b){return a?this.where(a,b).last():k(this,!1)},p.lastOrDefault=function(a,b,c){return a?this.where(a,c).lastOrDefault(null,b):k(this,!0,b)},p.find=function(a,b){return l(this,a,b,!1)},p.findIndex=function(a,b){return l(this,a,b,!0)},a.Set&&(p.toSet=function(){return m(this,a.Set)}),a.WeakSet&&(p.toWeakSet=function(){return m(this,a.WeakSet)}),a.Map&&(p.toMap=function(b,c){return n(this,a.Map,b,c)}),a.WeakMap&&(p.toWeakMap=function(b,c){return n(this,a.WeakMap,b,c)}),c});
1
+ (function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b,c){return new p(function(d){var e=!1,f=null,g=[];return a.subscribe(function(a){var h,i;try{i=b(a)}catch(j){return void d.onError(j)}if(h=0,e)try{h=c(i,f)}catch(k){return void d.onError(k)}else e=!0,f=i;h>0&&(f=i,g=[]),h>=0&&g.push(a)},d.onError.bind(d),function(){d.onNext(g),d.onCompleted()})})}function f(a){if(0===a.length)throw new Error(z);return a[0]}function g(a,b,c){return new p(function(d){var e=0,f=b.length;return a.subscribe(function(a){var g=!1;try{f>e&&(g=c(a,b[e++]))}catch(h){return void d.onError(h)}g||(d.onNext(!1),d.onCompleted())},d.onError.bind(d),function(){d.onNext(e===f),d.onCompleted()})})}function h(a,b,c,d){if(0>b)throw new Error(y);return new p(function(e){var f=b;return a.subscribe(function(a){0===f&&(e.onNext(a),e.onCompleted()),f--},e.onError.bind(e),function(){c?(e.onNext(d),e.onCompleted()):e.onError(new Error(y))})})}function i(a,b,c){return new p(function(d){var e=c,f=!1;return a.subscribe(function(a){f?d.onError(new Error("Sequence contains more than one element")):(e=a,f=!0)},d.onError.bind(d),function(){f||b?(d.onNext(e),d.onCompleted()):d.onError(new Error(z))})})}function j(a,b,c){return new p(function(d){return a.subscribe(function(a){d.onNext(a),d.onCompleted()},d.onError.bind(d),function(){b?(d.onNext(c),d.onCompleted()):d.onError(new Error(z))})})}function k(a,b,c){return new p(function(d){var e=c,f=!1;return a.subscribe(function(a){e=a,f=!0},d.onError.bind(d),function(){f||b?(d.onNext(e),d.onCompleted()):d.onError(new Error(z))})})}function l(a,b,c,e){return new p(function(f){var g=0;return a.subscribe(function(d){var h;try{h=b.call(c,d,g,a)}catch(i){return void f.onError(i)}h?(f.onNext(e?g:d),f.onCompleted()):g++},f.onError.bind(f),function(){f.onNext(e?-1:d),f.onCompleted()})})}var m=c.Observable,n=m.prototype,o=c.CompositeDisposable,p=c.AnonymousObservable,q=(c.internals.isEqual,c.helpers),r=q.not,s=q.defaultComparer,t=q.identity,u=q.defaultSubComparer,v=q.isFunction,w=q.isPromise,x=m.fromPromise,y="Argument out of range",z="Sequence contains no elements.";return n.finalValue=function(){var a=this;return new p(function(b){var c,d=!1;return a.subscribe(function(a){d=!0,c=a},b.onError.bind(b),function(){d?(b.onNext(c),b.onCompleted()):b.onError(new Error(z))})})},n.aggregate=function(){var a,b,c;return 2===arguments.length?(a=arguments[0],b=!0,c=arguments[1]):c=arguments[0],b?this.scan(a,c).startWith(a).finalValue():this.scan(c).finalValue()},n.reduce=function(a){var b,c;return 2===arguments.length&&(c=!0,b=arguments[1]),c?this.scan(b,a).startWith(b).finalValue():this.scan(a).finalValue()},n.some=n.any=function(a,b){var c=this;return a?c.where(a,b).any():new p(function(a){return c.subscribe(function(){a.onNext(!0),a.onCompleted()},a.onError.bind(a),function(){a.onNext(!1),a.onCompleted()})})},n.isEmpty=function(){return this.any().map(r)},n.every=n.all=function(a,b){return this.where(function(b){return!a(b)},b).any().select(function(a){return!a})},n.contains=function(a,b){return b||(b=s),this.where(function(c){return b(c,a)}).any()},n.count=function(a,b){return a?this.where(a,b).count():this.aggregate(0,function(a){return a+1})},n.sum=function(a,b){return a&&v(a)?this.map(a,b).sum():this.aggregate(0,function(a,b){return a+b})},n.minBy=function(a,b){return b||(b=u),e(this,a,function(a,c){return-1*b(a,c)})},n.min=function(a){return this.minBy(t,a).select(function(a){return f(a)})},n.maxBy=function(a,b){return b||(b=u),e(this,a,b)},n.max=function(a){return this.maxBy(t,a).select(function(a){return f(a)})},n.average=function(a,b){return a?this.select(a,b).average():this.scan({sum:0,count:0},function(a,b){return{sum:a.sum+b,count:a.count+1}}).finalValue().select(function(a){if(0===a.count)throw new Error("The input sequence was empty");return a.sum/a.count})},n.sequenceEqual=function(a,b){var c=this;return b||(b=s),Array.isArray(a)?g(c,a,b):new p(function(d){var e=!1,f=!1,g=[],h=[],i=c.subscribe(function(a){var c,e;if(h.length>0){e=h.shift();try{c=b(e,a)}catch(i){return void d.onError(i)}c||(d.onNext(!1),d.onCompleted())}else f?(d.onNext(!1),d.onCompleted()):g.push(a)},d.onError.bind(d),function(){e=!0,0===g.length&&(h.length>0?(d.onNext(!1),d.onCompleted()):f&&(d.onNext(!0),d.onCompleted()))});w(a)&&(a=x(a));var j=a.subscribe(function(a){var c;if(g.length>0){var f=g.shift();try{c=b(f,a)}catch(i){return void d.onError(i)}c||(d.onNext(!1),d.onCompleted())}else e?(d.onNext(!1),d.onCompleted()):h.push(a)},d.onError.bind(d),function(){f=!0,0===h.length&&(g.length>0?(d.onNext(!1),d.onCompleted()):e&&(d.onNext(!0),d.onCompleted()))});return new o(i,j)})},n.elementAt=function(a){return h(this,a,!1)},n.elementAtOrDefault=function(a,b){return h(this,a,!0,b)},n.single=function(a,b){return a&&v(a)?this.where(a,b).single():i(this,!1)},n.singleOrDefault=function(a,b,c){return a&&v(a)?this.where(a,c).singleOrDefault(null,b):i(this,!0,b)},n.first=function(a,b){return a?this.where(a,b).first():j(this,!1)},n.firstOrDefault=function(a,b){return a?this.where(a).firstOrDefault(null,b):j(this,!0,b)},n.last=function(a,b){return a?this.where(a,b).last():k(this,!1)},n.lastOrDefault=function(a,b,c){return a?this.where(a,c).lastOrDefault(null,b):k(this,!0,b)},n.find=function(a,b){return l(this,a,b,!1)},n.findIndex=function(a,b){return l(this,a,b,!0)},a.Set&&(n.toSet=function(){var b=this;return new p(function(c){var d=new a.Set;return b.subscribe(d.add.bind(d),c.onError.bind(c),function(){c.onNext(d),c.onCompleted()})})}),a.Map&&(n.toMap=function(b,c){var d=this;return new p(function(e){var f=new a.Map;return d.subscribe(function(a){var d;try{d=b(a)}catch(g){return void e.onError(g)}var h=a;if(c)try{h=c(a)}catch(g){return void e.onError(g)}f.set(d,h)},e.onError.bind(e),function(){e.onNext(f),e.onCompleted()})})}),c});