Socket
Socket
Sign inDemoInstall

kefir

Package Overview
Dependencies
0
Maintainers
1
Versions
86
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

LICENSE.txt

12

changelog.md

@@ -0,1 +1,8 @@

## 1.1.0
- The `Bus` and `Pool` classes are exposed as `Kefir.Bus` and `Kefir.Pool`
- A bug in `.merge` and `.zip` fixed which may cause them to not unsubscribe from their sources in very rare cases
- New method `.emitEvent` in Emitter, Emitter Object, and Bus
- New method `Kefir.repeat`
## 1.0.0

@@ -29,7 +36,6 @@

- Base errors support added (i.e. errors flow through all kind of transformations/combinations)
- Properties now may have a current error (as well as current value)
- New method `.onError`
- New method `.offError`
- Emitter now has `.error` method for emitting errors
- Emitter object also now has `.error` method
- Properties now may have a current error (as well as current value)
- New method `.error` in Emitter, Emitter Object, and Bus
- New method `Kefir.constantError`

@@ -36,0 +42,0 @@ - New method `.mapErrors`

@@ -1,2 +0,2 @@

/*! Kefir.js v1.0.0
/*! Kefir.js v1.1.0
* https://github.com/pozadi/kefir

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

error: function(x) { $._send(ERROR, x) },
end: function() { $._send(END) }
end: function() { $._send(END) },
emitEvent: function(e) { $._send(e.type, e.value) }
}

@@ -987,3 +988,7 @@ },

this._activating = true;
for (i = 0; i < sources.length; i++) { this._subscribe(sources[i]) }
for (i = 0; i < sources.length; i++) {
if (this._active) {
this._subscribe(sources[i]);
}
}
this._activating = false;

@@ -1068,2 +1073,3 @@ },

}
Kefir.Pool = Pool;

@@ -1098,2 +1104,3 @@ inherit(Pool, _AbstractPool, {

}
Kefir.Bus = Bus;

@@ -1124,2 +1131,5 @@ inherit(Bus, _AbstractPool, {

return this;
},
emitEvent: function(event) {
this._send(event.type, event.value);
}

@@ -1261,3 +1271,5 @@

for (i = 0; i < length; i++) {
this._sources[i].onAny(this._bindHandleAny(i), [this, i]);
if (this._active) {
this._sources[i].onAny(this._bindHandleAny(i), [this, i]);
}
}

@@ -1523,3 +1535,4 @@ },

error: function(x) { $._send(ERROR, x, $._forcedCurrent) },
end: function() { $._send(END, null, $._forcedCurrent) }
end: function() { $._send(END, null, $._forcedCurrent) },
emitEvent: function(e) { $._send(e.type, e.value, $._forcedCurrent) }
}

@@ -2183,3 +2196,4 @@ },

error: function(x) { $._send(ERROR, x, isCurrent) },
end: function() { $._send(END, null, isCurrent) }
end: function() { $._send(END, null, isCurrent) },
emitEvent: function(e) { $._send(e.type, e.value, isCurrent) }
};

@@ -2238,2 +2252,5 @@ this._unsubscribe = this._fn(emitter) || null;

return this;
},
emitEvent: function(event) {
this._send(event.type, event.value);
}

@@ -2301,2 +2318,79 @@ });

// Kefir.repeat(generator)
function Repeat(generator) {
Stream.call(this);
this._generator = generator;
this._source = null;
this._inLoop = false;
this._activating = false;
this._iteration = 0;
var $ = this;
this._$handleAny = function(event) {
$._handleAny(event);
};
}
inherit(Repeat, Stream, {
_name: 'repeat',
_handleAny: function(event) {
if (event.type === END) {
this._source = null;
this._startLoop();
} else {
this._send(event.type, event.value, this._activating);
}
},
_startLoop: function() {
if (!this._inLoop) {
this._inLoop = true;
while (this._source === null && this._alive && this._active) {
this._source = this._generator(this._iteration++);
if (this._source) {
this._source.onAny(this._$handleAny);
} else {
this._send(END);
}
}
this._inLoop = false;
}
},
_onActivation: function() {
this._activating = true;
if (this._source) {
this._source.onAny(this._$handleAny);
} else {
this._startLoop();
}
this._activating = false;
},
_onDeactivation: function() {
if (this._source) {
this._source.offAny(this._$handleAny);
}
},
_clear: function() {
Stream.prototype._clear.call(this);
this._generator = null;
this._source = null;
this._$handleAny = null;
}
});
Kefir.repeat = function(generator) {
return new Repeat(generator);
}
// .setName

@@ -2303,0 +2397,0 @@

@@ -1,6 +0,7 @@

/*! Kefir.js v1.0.0
/*! Kefir.js v1.1.0
* https://github.com/pozadi/kefir
*/
!function(a){"use strict";function b(){for(var a=0;a<arguments.length;a++)if(!arguments[a])return arguments[a];return arguments[a-1]}function c(){for(var a=0;a<arguments.length;a++)if(arguments[a])return arguments[a];return arguments[a-1]}function d(a){return!a}function e(a,b){var c,d,e,f;if(0===a.length)return b;if(0===b.length)return a;for(f=0,c=new Array(a.length+b.length),d=a.length,e=0;d>e;e++,f++)c[f]=a[e];for(d=b.length,e=0;d>e;e++,f++)c[f]=b[e];return c}function f(a,b){var c,d=a.length;for(c=0;d>c;c++)if(a[c]===b)return c;return-1}function g(a,b){var c,d=a.length;for(c=0;d>c;c++)if(b(a[c]))return c;return-1}function h(a){var b,c=a.length,d=new Array(c);for(b=0;c>b;b++)d[b]=a[b];return d}function i(a,b){var c,d,e,f=a.length;if(b>=0&&f>b){if(1===f)return[];for(c=new Array(f-1),d=0,e=0;f>d;d++)d!==b&&(c[e]=a[d],e++);return c}return a}function j(a,b){return i(a,g(a,b))}function k(a,b){var c,d=a.length,e=new Array(d);for(c=0;d>c;c++)e[c]=b(a[c]);return e}function l(a,b){var c,d=a.length;for(c=0;d>c;c++)b(a[c])}function m(a,b){var c,d=a.length;for(c=0;d>c;c++)a[c]=b}function n(a,b){return-1!==f(a,b)}function o(a,b,c){return a.length>b?Array.prototype.slice.call(a,b):c}function p(a,b,c){var d,e=Math.min(c,a.length+1),f=a.length-e+1,g=new Array(e);for(d=f;e>d;d++)g[d-f]=a[d];return g[e-1]=b,g}function q(a,b){var c,d;if(null==a&&null==b)return!0;if(null==a||null==b)return!1;if(a.length!==b.length)return!1;for(d=0,c=a.length;c>d;d++)if(a[d]!==b[d])return!1;return!0}function r(a,b){switch(b){case 0:return function(){return a()};case 1:return function(b){return a(b[0])};case 2:return function(b){return a(b[0],b[1])};case 3:return function(b){return a(b[0],b[1],b[2])};case 4:return function(b){return a(b[0],b[1],b[2],b[3])};default:return function(b){return a.apply(null,b)}}}function s(a,b,c){var d=c?c.length:0;if(null==b)switch(d){case 0:return a();case 1:return a(c[0]);case 2:return a(c[0],c[1]);case 3:return a(c[0],c[1],c[2]);case 4:return a(c[0],c[1],c[2],c[3]);default:return a.apply(null,c)}else switch(d){case 0:return a.call(b);default:return a.apply(b,c)}}function t(a,b,c){return a&&b in a?a[b]:c}function u(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function v(a){var b=function(){};return b.prototype=a,new b}function w(a){var b,c,d=arguments.length;for(b=1;d>b;b++)for(c in arguments[b])a[c]=arguments[b][c];return a}function x(a,b){var c,d=arguments.length;for(a.prototype=v(b.prototype),a.prototype.constructor=a,c=2;d>c;c++)w(a.prototype,arguments[c]);return a}function y(a){return a}function z(a,b){return a===b}function A(a,b){return[a,b]}function B(a){return"function"==typeof a}function C(a,b){function c(a,b){I.call(this),this._wait=a,this._intervalId=null;var c=this;this._$onTick=function(){c._onTick()},this._init(b)}x(c,I,{_name:a,_init:function(){},_free:function(){},_onTick:function(){},_onActivation:function(){this._intervalId=setInterval(this._$onTick,this._wait)},_onDeactivation:function(){null!==this._intervalId&&(clearInterval(this._intervalId),this._intervalId=null)},_clear:function(){I.prototype._clear.call(this),this._$onTick=null,this._free()}},b),_[a]=function(a){return new c(a,o(arguments,1,[]))}}function D(a,b,c){function d(c){function d(b,d){c.call(this),this._source=b,this._name=b._name+"."+a,this._init(d);var e=this;this._$handleAny=function(a){e._handleAny(a)}}return x(d,c,{_clear:function(){c.prototype._clear.call(this),this._source=null,this._$handleAny=null,this._free()}},b),d}c=w({streamMethod:function(a){return function(){return new a(this,arguments)}},propertyMethod:function(a,b){return function(){return new b(this,arguments)}}},c||{}),b=w({_init:function(){},_free:function(){},_handleValue:function(a,b){this._send(cb,a,b)},_handleError:function(a,b){this._send(db,a,b)},_handleEnd:function(a,b){this._send(bb,null,b)},_handleAny:function(a){switch(a.type){case cb:this._handleValue(a.value,a.current);break;case db:this._handleError(a.value,a.current);break;case bb:this._handleEnd(a.value,a.current)}},_onActivation:function(){this._source.onAny(this._$handleAny)},_onDeactivation:function(){this._source.offAny(this._$handleAny)}},b||{});var e=d(I),f=d(J);c.streamMethod&&(I.prototype[a]=c.streamMethod(e,f)),c.propertyMethod&&(J.prototype[a]=c.propertyMethod(e,f))}function E(a,b){function c(c){function d(b,d,e){c.call(this),this._primary=b,this._secondary=d,this._name=b._name+"."+a,this._lastSecondary=ab;var f=this;this._$handleSecondaryAny=function(a){f._handleSecondaryAny(a)},this._$handlePrimaryAny=function(a){f._handlePrimaryAny(a)},this._init(e)}return x(d,c,{_clear:function(){c.prototype._clear.call(this),this._primary=null,this._secondary=null,this._lastSecondary=null,this._$handleSecondaryAny=null,this._$handlePrimaryAny=null,this._free()}},b),d}b=w({_init:function(){},_free:function(){},_handlePrimaryValue:function(a,b){this._send(cb,a,b)},_handlePrimaryError:function(a,b){this._send(db,a,b)},_handlePrimaryEnd:function(a,b){this._send(bb,null,b)},_handleSecondaryValue:function(a){this._lastSecondary=a},_handleSecondaryError:function(a,b){this._send(db,a,b)},_handleSecondaryEnd:function(){},_handlePrimaryAny:function(a){switch(a.type){case cb:this._handlePrimaryValue(a.value,a.current);break;case db:this._handlePrimaryError(a.value,a.current);break;case bb:this._handlePrimaryEnd(a.value,a.current)}},_handleSecondaryAny:function(a){switch(a.type){case cb:this._handleSecondaryValue(a.value,a.current);break;case db:this._handleSecondaryError(a.value,a.current);break;case bb:this._handleSecondaryEnd(a.value,a.current),this._removeSecondary()}},_removeSecondary:function(){null!==this._secondary&&(this._secondary.offAny(this._$handleSecondaryAny),this._$handleSecondaryAny=null,this._secondary=null)},_onActivation:function(){null!==this._secondary&&this._secondary.onAny(this._$handleSecondaryAny),this._alive&&this._primary.onAny(this._$handlePrimaryAny)},_onDeactivation:function(){null!==this._secondary&&this._secondary.offAny(this._$handleSecondaryAny),this._primary.offAny(this._$handlePrimaryAny)}},b||{});var d=c(I),e=c(J);I.prototype[a]=function(a){return new d(this,a,o(arguments,1,[]))},J.prototype[a]=function(a){return new e(this,a,o(arguments,1,[]))}}function F(){this._items=[]}function G(a,b,c){return{type:a,value:b,current:!!c}}function H(){this._subscribers=new F,this._active=!1,this._alive=!0}function I(){H.call(this)}function J(){H.call(this),this._current=ab,this._currentError=ab}function K(a){if(I.call(this),this._queueLim=t(a,"queueLim",0),this._concurLim=t(a,"concurLim",-1),this._drop=t(a,"drop","new"),0===this._concurLim)throw new Error("options.concurLim can't be 0");var b=this;this._$handleSubAny=function(a){b._handleSubAny(a)},this._queue=[],this._curSources=[],this._activating=!1}function L(a){K.call(this),0===a.length?this._send(bb):this._addAll(a),this._initialised=!0}function M(a){K.call(this,{concurLim:1,queueLim:-1}),0===a.length?this._send(bb):this._addAll(a),this._initialised=!0}function N(){K.call(this)}function O(){K.call(this)}function P(a,b,c){K.call(this,c),this._source=a,this._fn=b||y,this._mainEnded=!1,this._lastCurrent=null;var d=this;this._$handleMainSource=function(a){d._handleMainSource(a)}}function Q(a,b){I.call(this),0===a.length?this._send(bb):(this._buffers=k(a,function(a){return gb(a)?h(a):[]}),this._sources=k(a,function(a){return gb(a)?_.never():a}),this._combinator=b?r(b,this._sources.length):y,this._aliveCount=0)}function R(a,b,c){I.call(this),0===b.length?this._send(bb):(this._passiveCount=a.length,this._sources=e(a,b),this._combinator=c?r(c,this._sources.length):y,this._aliveCount=0,this._currents=new Array(this._sources.length),m(this._currents,ab),this._activating=!1,this._emitAfterActivation=!1,this._endAfterActivation=!1)}function S(a){return function(){return new a(this,arguments)}}function T(a,b){return function(){return new b(this,arguments)}}function U(a){return{step:function(b,c){return a._send(cb,c,a._forcedCurrent),null},result:function(){return a._send(bb,null,a._forcedCurrent),null}}}function V(a){return{convert:!0,value:a}}function W(a){return{convert:!0,error:a}}function X(a){I.call(this),this._fn=a,this._unsubscribe=null}function Y(){I.call(this)}function Z(a){J.call(this),this._send(cb,a),this._send(bb)}function $(a){J.call(this),this._send(db,a),this._send(bb)}var _={},ab=["<nothing>"],bb="end",cb="value",db="error",eb="any",fb=Date.now?function(){return Date.now()}:function(){return(new Date).getTime()},gb=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},hb=function(a){return"[object Arguments]"===Object.prototype.toString.call(a)};hb(arguments)||(hb=function(a){return!(!a||!u(a,"callee"))}),w(F,{callOne:function(a,b){a.type===eb?a.fn(b):a.type===b.type&&(a.type===cb||a.type===db?a.fn(b.value):a.fn())},callOnce:function(a,b,c){a===eb?b(c):a===c.type&&(a===cb||a===db?b(c.value):b())}}),w(F.prototype,{add:function(a,b,c){this._items=e(this._items,[{type:a,fn:b,key:c||null}])},remove:function(a,b,c){var d=gb(c)?function(b){return b.type===a&&q(b.key,c)}:function(c){return c.type===a&&c.fn===b};this._items=j(this._items,d)},callAll:function(a){for(var b=this._items,c=0;c<b.length;c++)F.callOne(b[c],a)},isEmpty:function(){return 0===this._items.length}});var ib=G(bb,void 0,!0);_.Observable=H,w(H.prototype,{_name:"observable",_onActivation:function(){},_onDeactivation:function(){},_setActive:function(a){this._active!==a&&(this._active=a,a?this._onActivation():this._onDeactivation())},_clear:function(){this._setActive(!1),this._alive=!1,this._subscribers=null},_send:function(a,b,c){this._alive&&(this._subscribers.callAll(G(a,b,c)),a===bb&&this._clear())},_on:function(a,b,c){return this._alive?(this._subscribers.add(a,b,c),this._setActive(!0)):F.callOnce(a,b,ib),this},_off:function(a,b,c){return this._alive&&(this._subscribers.remove(a,b,c),this._subscribers.isEmpty()&&this._setActive(!1)),this},onValue:function(a,b){return this._on(cb,a,b)},onError:function(a,b){return this._on(db,a,b)},onEnd:function(a,b){return this._on(bb,a,b)},onAny:function(a,b){return this._on(eb,a,b)},offValue:function(a,b){return this._off(cb,a,b)},offError:function(a,b){return this._off(db,a,b)},offEnd:function(a,b){return this._off(bb,a,b)},offAny:function(a,b){return this._off(eb,a,b)}}),H.prototype.toString=function(){return"["+this._name+"]"},_.Stream=I,x(I,H,{_name:"stream"}),_.Property=J,x(J,H,{_name:"property",_send:function(a,b,c){this._alive&&(c||this._subscribers.callAll(G(a,b)),a===cb&&(this._current=b),a===db&&(this._currentError=b),a===bb&&this._clear())},_on:function(a,b,c){return this._alive&&(this._subscribers.add(a,b,c),this._setActive(!0)),this._current!==ab&&F.callOnce(a,b,G(cb,this._current,!0)),this._currentError!==ab&&F.callOnce(a,b,G(db,this._currentError,!0)),this._alive||F.callOnce(a,b,ib),this}}),H.prototype.log=function(a){return a=a||this.toString(),this.onAny(function(b){var c="<"+b.type+(b.current?":current":"")+">";b.type===cb||b.type===db?console.log(a,c,b.value):console.log(a,c)},["__logKey__",this,a]),this},H.prototype.offLog=function(a){return a=a||this.toString(),this.offAny(null,["__logKey__",this,a]),this},C("withInterval",{_init:function(a){this._fn=a[0];var b=this;this._emitter={emit:function(a){b._send(cb,a)},error:function(a){b._send(db,a)},end:function(){b._send(bb)}}},_free:function(){this._fn=null,this._emitter=null},_onTick:function(){this._fn(this._emitter)}}),C("fromPoll",{_init:function(a){this._fn=a[0]},_free:function(){this._fn=null},_onTick:function(){this._send(cb,this._fn())}}),C("interval",{_init:function(a){this._x=a[0]},_free:function(){this._x=null},_onTick:function(){this._send(cb,this._x)}}),C("sequentially",{_init:function(a){this._xs=h(a[0]),0===this._xs.length&&this._send(bb)},_free:function(){this._xs=null},_onTick:function(){switch(this._xs.length){case 1:this._send(cb,this._xs[0]),this._send(bb);break;default:this._send(cb,this._xs.shift())}}}),C("repeatedly",{_init:function(a){this._xs=h(a[0]),this._i=-1},_onTick:function(){this._xs.length>0&&(this._i=(this._i+1)%this._xs.length,this._send(cb,this._xs[this._i]))}}),C("later",{_init:function(a){this._x=a[0]},_free:function(){this._x=null},_onTick:function(){this._send(cb,this._x),this._send(bb)}}),x(K,I,{_name:"abstractPool",_add:function(a,b){b=b||y,-1===this._concurLim||this._curSources.length<this._concurLim?this._addToCur(b(a)):-1===this._queueLim||this._queue.length<this._queueLim?this._addToQueue(b(a)):"old"===this._drop&&(this._removeOldest(),this._add(b(a)))},_addAll:function(a){var b=this;l(a,function(a){b._add(a)})},_remove:function(a){-1===this._removeCur(a)&&this._removeQueue(a)},_addToQueue:function(a){this._queue=e(this._queue,[a])},_addToCur:function(a){this._curSources=e(this._curSources,[a]),this._active&&this._subscribe(a)},_subscribe:function(a){var b=this;a.onAny(this._$handleSubAny),a.onEnd(function(){b._removeCur(a)},[this,a])},_unsubscribe:function(a){a.offAny(this._$handleSubAny),a.offEnd(null,[this,a])},_handleSubAny:function(a){(a.type===cb||a.type===db)&&this._send(a.type,a.value,a.current&&this._activating)},_removeQueue:function(a){var b=f(this._queue,a);return this._queue=i(this._queue,b),b},_removeCur:function(a){this._active&&this._unsubscribe(a);var b=f(this._curSources,a);return this._curSources=i(this._curSources,b),-1!==b&&(0!==this._queue.length?this._pullQueue():0===this._curSources.length&&this._onEmpty()),b},_removeOldest:function(){this._removeCur(this._curSources[0])},_pullQueue:function(){0!==this._queue.length&&(this._queue=h(this._queue),this._addToCur(this._queue.shift()))},_onActivation:function(){var a,b=this._curSources;for(this._activating=!0,a=0;a<b.length;a++)this._subscribe(b[a]);this._activating=!1},_onDeactivation:function(){var a,b=this._curSources;for(a=0;a<b.length;a++)this._unsubscribe(b[a])},_isEmpty:function(){return 0===this._curSources.length},_onEmpty:function(){},_clear:function(){I.prototype._clear.call(this),this._queue=null,this._curSources=null,this._$handleSubAny=null}});var jb={_onEmpty:function(){this._initialised&&this._send(bb,null,this._activating)}};x(L,K,w({_name:"merge"},jb)),_.merge=function(a){return new L(a)},H.prototype.merge=function(a){return _.merge([this,a])},x(M,K,w({_name:"concat"},jb)),_.concat=function(a){return new M(a)},H.prototype.concat=function(a){return _.concat([this,a])},x(N,K,{_name:"pool",plug:function(a){return this._add(a),this},unplug:function(a){return this._remove(a),this}}),_.pool=function(){return new N},x(O,K,{_name:"bus",plug:function(a){return this._add(a),this},unplug:function(a){return this._remove(a),this},emit:function(a){return this._send(cb,a),this},error:function(a){return this._send(db,a),this},end:function(){return this._send(bb),this}}),_.bus=function(){return new O},x(P,K,{_onActivation:function(){K.prototype._onActivation.call(this),this._active&&(this._activating=!0,this._source.onAny(this._$handleMainSource),this._activating=!1)},_onDeactivation:function(){K.prototype._onDeactivation.call(this),this._source.offAny(this._$handleMainSource)},_handleMainSource:function(a){a.type===cb&&(a.current&&this._lastCurrent===a.value||this._add(a.value,this._fn),this._lastCurrent=a.value),a.type===db&&this._send(db,a.value,a.current),a.type===bb&&(this._isEmpty()?this._send(bb,null,a.current):this._mainEnded=!0)},_onEmpty:function(){this._mainEnded&&this._send(bb)},_clear:function(){K.prototype._clear.call(this),this._source=null,this._lastCurrent=null,this._$handleMainSource=null}}),H.prototype.flatMap=function(a){return new P(this,a).setName(this,"flatMap")},H.prototype.flatMapLatest=function(a){return new P(this,a,{concurLim:1,drop:"old"}).setName(this,"flatMapLatest")},H.prototype.flatMapFirst=function(a){return new P(this,a,{concurLim:1}).setName(this,"flatMapFirst")},H.prototype.flatMapConcat=function(a){return new P(this,a,{queueLim:-1,concurLim:1}).setName(this,"flatMapConcat")},H.prototype.flatMapConcurLimit=function(a,b){var c;return 0===b?c=_.never():(0>b&&(b=-1),c=new P(this,a,{queueLim:-1,concurLim:b})),c.setName(this,"flatMapConcurLimit")},x(Q,I,{_name:"zip",_onActivation:function(){var a,b=this._sources.length;for(this._drainArrays(),this._aliveCount=b,a=0;b>a;a++)this._sources[a].onAny(this._bindHandleAny(a),[this,a])},_onDeactivation:function(){for(var a=0;a<this._sources.length;a++)this._sources[a].offAny(null,[this,a])},_emit:function(a){for(var b=new Array(this._buffers.length),c=0;c<this._buffers.length;c++)b[c]=this._buffers[c].shift();this._send(cb,this._combinator(b),a)},_isFull:function(){for(var a=0;a<this._buffers.length;a++)if(0===this._buffers[a].length)return!1;return!0},_emitIfFull:function(a){this._isFull()&&this._emit(a)},_drainArrays:function(){for(;this._isFull();)this._emit(!0)},_bindHandleAny:function(a){var b=this;return function(c){b._handleAny(a,c)}},_handleAny:function(a,b){b.type===cb&&(this._buffers[a].push(b.value),this._emitIfFull(b.current)),b.type===db&&this._send(db,b.value,b.current),b.type===bb&&(this._aliveCount--,0===this._aliveCount&&this._send(bb,null,b.current))},_clear:function(){I.prototype._clear.call(this),this._sources=null,this._buffers=null,this._combinator=null}}),_.zip=function(a,b){return new Q(a,b)},H.prototype.zip=function(a,b){return new Q([this,a],b)},x(R,I,{_name:"sampledBy",_onActivation:function(){var a,b=this._sources.length;for(this._aliveCount=b-this._passiveCount,this._activating=!0,a=0;b>a;a++)this._sources[a].onAny(this._bindHandleAny(a),[this,a]);this._activating=!1,this._emitAfterActivation&&(this._emitAfterActivation=!1,this._emitIfFull(!0)),this._endAfterActivation&&this._send(bb,null,!0)},_onDeactivation:function(){var a,b=this._sources.length;for(a=0;b>a;a++)this._sources[a].offAny(null,[this,a])},_emitIfFull:function(a){if(!n(this._currents,ab)){var b=h(this._currents);b=this._combinator(b),this._send(cb,b,a)}},_bindHandleAny:function(a){var b=this;return function(c){b._handleAny(a,c)}},_handleAny:function(a,b){b.type===cb&&(this._currents[a]=b.value,a>=this._passiveCount&&(this._activating?this._emitAfterActivation=!0:this._emitIfFull(b.current))),b.type===db&&this._send(db,b.value,b.current),b.type===bb&&a>=this._passiveCount&&(this._aliveCount--,0===this._aliveCount&&(this._activating?this._endAfterActivation=!0:this._send(bb,null,b.current)))},_clear:function(){I.prototype._clear.call(this),this._sources=null,this._currents=null,this._combinator=null}}),_.sampledBy=function(a,b,c){return new R(a,b,c)},H.prototype.sampledBy=function(a,b){return _.sampledBy([this],[a],b||y)},_.combine=function(a,b){return new R([],a,b).setName("combine")},H.prototype.combine=function(a,b){return _.combine([this,a],b)},D("toProperty",{_init:function(a){a.length>0&&this._send(cb,a[0])}},{propertyMethod:T,streamMethod:T}),D("changes",{_handleValue:function(a,b){b||this._send(cb,a)},_handleError:function(a,b){b||this._send(db,a)}},{streamMethod:function(){return function(){return this}},propertyMethod:S}),D("withHandler",{_init:function(a){this._handler=a[0],this._forcedCurrent=!1;var b=this;this._emitter={emit:function(a){b._send(cb,a,b._forcedCurrent)},error:function(a){b._send(db,a,b._forcedCurrent)},end:function(){b._send(bb,null,b._forcedCurrent)}}},_free:function(){this._handler=null,this._emitter=null},_handleAny:function(a){this._forcedCurrent=a.current,this._handler(this._emitter,a),this._forcedCurrent=!1}}),D("flatten",{_init:function(a){this._fn=a[0]?a[0]:y},_free:function(){this._fn=null},_handleValue:function(a,b){for(var c=this._fn(a),d=0;d<c.length;d++)this._send(cb,c[d],b)}}),D("transduce",{_init:function(a){this._xform=a[0](U(this))},_free:function(){this._xform=null},_handleValue:function(a,b){this._forcedCurrent=b,null!==this._xform.step(null,a)&&this._xform.result(null),this._forcedCurrent=!1},_handleEnd:function(a,b){this._forcedCurrent=b,this._xform.result(null),this._forcedCurrent=!1}});var kb={_init:function(a){this._fn=a[0]||y},_free:function(){this._fn=null}};D("map",w({_handleValue:function(a,b){this._send(cb,this._fn(a),b)}},kb)),D("mapErrors",w({_handleError:function(a,b){this._send(db,this._fn(a),b)}},kb)),D("errorsToValues",w({_init:function(a){this._fn=a[0]||V},_free:function(){this._fn=null},_handleError:function(a,b){var c=this._fn(a),d=c.convert?cb:db,e=c.convert?c.value:a;this._send(d,e,b)}})),D("valuesToErrors",w({_init:function(a){this._fn=a[0]||W},_free:function(){this._fn=null},_handleValue:function(a,b){var c=this._fn(a),d=c.convert?db:cb,e=c.convert?c.error:a;this._send(d,e,b)}})),D("filter",w({_handleValue:function(a,b){this._fn(a)&&this._send(cb,a,b)}},kb)),D("filterErrors",w({_handleError:function(a,b){this._fn(a)&&this._send(db,a,b)}},kb)),D("takeWhile",w({_handleValue:function(a,b){this._fn(a)?this._send(cb,a,b):this._send(bb,null,b)}},kb)),D("take",{_init:function(a){this._n=a[0],this._n<=0&&this._send(bb)},_handleValue:function(a,b){this._n--,this._send(cb,a,b),0===this._n&&this._send(bb,null,b)}}),D("skip",{_init:function(a){this._n=Math.max(0,a[0])},_handleValue:function(a,b){0===this._n?this._send(cb,a,b):this._n--}}),D("skipDuplicates",{_init:function(a){this._fn=a[0]||z,this._prev=ab},_free:function(){this._fn=null,this._prev=null},_handleValue:function(a,b){this._prev!==ab&&this._fn(this._prev,a)||(this._prev=a,this._send(cb,a,b))}}),D("skipWhile",{_init:function(a){this._fn=a[0]||y,this._skip=!0},_free:function(){this._fn=null},_handleValue:function(a,b){return this._skip?void(this._fn(a)||(this._skip=!1,this._fn=null,this._send(cb,a,b))):void this._send(cb,a,b)}}),D("diff",{_init:function(a){this._fn=a[0]||A,this._prev=a.length>1?a[1]:ab},_free:function(){this._prev=null,this._fn=null},_handleValue:function(a,b){this._prev!==ab&&this._send(cb,this._fn(this._prev,a),b),this._prev=a}}),D("scan",{_init:function(a){this._fn=a[0],a.length>1&&this._send(cb,a[1],!0)},_free:function(){this._fn=null},_handleValue:function(a,b){this._current!==ab&&(a=this._fn(this._current,a)),this._send(cb,a,b)}},{streamMethod:T}),D("reduce",{_init:function(a){this._fn=a[0],this._result=a.length>1?a[1]:ab},_free:function(){this._fn=null,this._result=null},_handleValue:function(a){this._result=this._result===ab?a:this._fn(this._result,a)},_handleEnd:function(a,b){this._result!==ab&&this._send(cb,this._result,b),this._send(bb,null,b)}}),D("mapEnd",{_init:function(a){this._fn=a[0]},_free:function(){this._fn=null},_handleEnd:function(a,b){this._send(cb,this._fn(),b),this._send(bb,null,b)}}),D("skipValues",{_handleValue:function(){}}),D("skipErrors",{_handleError:function(){}}),D("skipEnd",{_handleEnd:function(){}}),D("endOnError",w({_handleError:function(a,b){this._send(db,a,b),this._send(bb,null,b)}})),D("slidingWindow",{_init:function(a){this._max=a[0],this._min=a[1]||0,this._buff=[]},_free:function(){this._buff=null},_handleValue:function(a,b){this._buff=p(this._buff,a,this._max),this._buff.length>=this._min&&this._send(cb,this._buff,b)}}),D("bufferWhile",{_init:function(a){this._fn=a[0]||y,this._flushOnEnd=t(a[1],"flushOnEnd",!0),this._buff=[]},_free:function(){this._buff=null},_flush:function(a){null!==this._buff&&0!==this._buff.length&&(this._send(cb,this._buff,a),this._buff=[])},_handleValue:function(a,b){this._buff.push(a),this._fn(a)||this._flush(b)},_handleEnd:function(a,b){this._flushOnEnd&&this._flush(b),this._send(bb,null,b)}}),D("debounce",{_init:function(a){this._wait=Math.max(0,a[0]),this._immediate=t(a[1],"immediate",!1),this._lastAttempt=0,this._timeoutId=null,this._laterValue=null,this._endLater=!1;var b=this;this._$later=function(){b._later()}},_free:function(){this._laterValue=null,this._$later=null},_handleValue:function(a,b){b?this._send(cb,a,b):(this._lastAttempt=fb(),this._immediate&&!this._timeoutId&&this._send(cb,a),this._timeoutId||(this._timeoutId=setTimeout(this._$later,this._wait)),this._immediate||(this._laterValue=a))},_handleEnd:function(a,b){b?this._send(bb,null,b):this._timeoutId&&!this._immediate?this._endLater=!0:this._send(bb)},_later:function(){var a=fb()-this._lastAttempt;a<this._wait&&a>=0?this._timeoutId=setTimeout(this._$later,this._wait-a):(this._timeoutId=null,this._immediate||(this._send(cb,this._laterValue),this._laterValue=null),this._endLater&&this._send(bb))}}),D("throttle",{_init:function(a){this._wait=Math.max(0,a[0]),this._leading=t(a[1],"leading",!0),this._trailing=t(a[1],"trailing",!0),this._trailingValue=null,this._timeoutId=null,this._endLater=!1,this._lastCallTime=0;var b=this;this._$trailingCall=function(){b._trailingCall()}},_free:function(){this._trailingValue=null,this._$trailingCall=null},_handleValue:function(a,b){if(b)this._send(cb,a,b);else{var c=fb();0!==this._lastCallTime||this._leading||(this._lastCallTime=c);var d=this._wait-(c-this._lastCallTime);0>=d?(this._cancelTraling(),this._lastCallTime=c,this._send(cb,a)):this._trailing&&(this._cancelTraling(),this._trailingValue=a,this._timeoutId=setTimeout(this._$trailingCall,d))}},_handleEnd:function(a,b){b?this._send(bb,null,b):this._timeoutId?this._endLater=!0:this._send(bb)},_cancelTraling:function(){null!==this._timeoutId&&(clearTimeout(this._timeoutId),this._timeoutId=null)},_trailingCall:function(){this._send(cb,this._trailingValue),this._timeoutId=null,this._trailingValue=null,this._lastCallTime=this._leading?fb():0,this._endLater&&this._send(bb)}}),D("delay",{_init:function(a){this._wait=Math.max(0,a[0]),this._buff=[];var b=this;this._$shiftBuff=function(){b._send(cb,b._buff.shift())}},_free:function(){this._buff=null,this._$shiftBuff=null},_handleValue:function(a,b){b?this._send(cb,a,b):(this._buff.push(a),setTimeout(this._$shiftBuff,this._wait))},_handleEnd:function(a,b){if(b)this._send(bb,null,b);else{var c=this;setTimeout(function(){c._send(bb)},this._wait)}}}),x(X,I,{_name:"fromBinder",_onActivation:function(){var a=this,b=!0,c={emit:function(c){a._send(cb,c,b)},error:function(c){a._send(db,c,b)},end:function(){a._send(bb,null,b)}};this._unsubscribe=this._fn(c)||null,this._active||null===this._unsubscribe||(this._unsubscribe(),this._unsubscribe=null),b=!1},_onDeactivation:function(){null!==this._unsubscribe&&(this._unsubscribe(),this._unsubscribe=null)},_clear:function(){I.prototype._clear.call(this),this._fn=null}}),_.fromBinder=function(a){return new X(a)},x(Y,I,{_name:"emitter",emit:function(a){return this._send(cb,a),this},error:function(a){return this._send(db,a),this},end:function(){return this._send(bb),this}}),_.emitter=function(){return new Y},_.Emitter=Y;var lb=new I;lb._send(bb),lb._name="never",_.never=function(){return lb},x(Z,J,{_name:"constant"}),_.constant=function(a){return new Z(a)},x($,J,{_name:"constantError"}),_.constantError=function(a){return new $(a)},H.prototype.setName=function(a,b){return this._name=b?a._name+"."+b:a,this},H.prototype.mapTo=function(a){return this.map(function(){return a}).setName(this,"mapTo")},H.prototype.pluck=function(a){return this.map(function(b){return b[a]}).setName(this,"pluck")},H.prototype.invoke=function(a){var b=o(arguments,1);return this.map(b?function(c){return s(c[a],c,b)}:function(b){return b[a]()}).setName(this,"invoke")},H.prototype.timestamp=function(){return this.map(function(a){return{value:a,time:fb()}}).setName(this,"timestamp")},H.prototype.tap=function(a){return this.map(function(b){return a(b),b}).setName(this,"tap")},_.and=function(a){return _.combine(a,b).setName("and")},H.prototype.and=function(a){return this.combine(a,b).setName("and")},_.or=function(a){return _.combine(a,c).setName("or")},H.prototype.or=function(a){return this.combine(a,c).setName("or")},H.prototype.not=function(){return this.map(d).setName(this,"not")},H.prototype.awaiting=function(a){return _.merge([this.mapTo(!0),a.mapTo(!1)]).skipDuplicates().toProperty(!1).setName(this,"awaiting")},_.fromCallback=function(a){var b=!1;return _.fromBinder(function(c){b||(a(function(a){c.emit(a),c.end()}),b=!0)}).setName("fromCallback")},_.fromNodeCallback=function(a){var b=!1;return _.fromBinder(function(c){b||(a(function(a,b){a?c.error(a):c.emit(b),c.end()}),b=!0)}).setName("fromNodeCallback")},_.fromPromise=function(a){var b=!1;return _.fromBinder(function(c){if(!b){var d=function(a){c.emit(a),c.end()},e=function(a){c.error(a),c.end()},f=a.then(d,e);f&&B(f.done)&&f.done(),b=!0}}).toProperty().setName("fromPromise")},_.fromSubUnsub=function(a,b,c){return _.fromBinder(function(d){var e=c?function(){d.emit(s(c,this,arguments))}:d.emit;return a(e),function(){b(e)}})};var mb=[["addEventListener","removeEventListener"],["addListener","removeListener"],["on","off"]];_.fromEvent=function(a,b,c){for(var d,e,f,g=0;g<mb.length;g++)if(d=mb[g],B(a[d[0]])&&B(a[d[1]])){e=d[0],f=d[1];break}if(void 0===e)throw new Error("target don't support any of addEventListener/removeEventListener, addListener/removeListener, on/off method pair");return _.fromSubUnsub(function(c){a[e](b,c)},function(c){a[f](b,c)},c).setName("fromEvent")};var nb={_init:function(a){this._buff=[],this._flushOnEnd=t(a[0],"flushOnEnd",!0)},_free:function(){this._buff=null},_flush:function(a){null!==this._buff&&0!==this._buff.length&&(this._send(cb,this._buff,a),this._buff=[])},_handlePrimaryEnd:function(a,b){this._flushOnEnd&&this._flush(b),this._send(bb,null,b)}};E("bufferBy",w({_onActivation:function(){this._primary.onAny(this._$handlePrimaryAny),this._alive&&null!==this._secondary&&this._secondary.onAny(this._$handleSecondaryAny)},_handlePrimaryValue:function(a){this._buff.push(a)},_handleSecondaryValue:function(a,b){this._flush(b)},_handleSecondaryEnd:function(a,b){this._flushOnEnd||this._send(bb,null,b)}},nb)),E("bufferWhileBy",w({_handlePrimaryValue:function(a,b){this._buff.push(a),this._lastSecondary===ab||this._lastSecondary||this._flush(b)},_handleSecondaryEnd:function(a,b){this._flushOnEnd||this._lastSecondary!==ab&&!this._lastSecondary||this._send(bb,null,b)}},nb)),E("filterBy",{_handlePrimaryValue:function(a,b){this._lastSecondary!==ab&&this._lastSecondary&&this._send(cb,a,b)},_handleSecondaryEnd:function(a,b){this._lastSecondary!==ab&&this._lastSecondary||this._send(bb,null,b)}}),E("skipUntilBy",{_handlePrimaryValue:function(a,b){this._lastSecondary!==ab&&this._send(cb,a,b)},_handleSecondaryEnd:function(a,b){this._lastSecondary===ab&&this._send(bb,null,b)}}),E("takeUntilBy",{_handleSecondaryValue:function(a,b){this._send(bb,null,b)}}),E("takeWhileBy",{_handlePrimaryValue:function(a,b){this._lastSecondary!==ab&&this._send(cb,a,b)},_handleSecondaryValue:function(a,b){this._lastSecondary=a,this._lastSecondary||this._send(bb,null,b)},_handleSecondaryEnd:function(a,b){this._lastSecondary===ab&&this._send(bb,null,b)}}),E("skipWhileBy",{_init:function(){this._hasFalseyFromSecondary=!1},_handlePrimaryValue:function(a,b){this._hasFalseyFromSecondary&&this._send(cb,a,b)},_handleSecondaryValue:function(a){this._hasFalseyFromSecondary=this._hasFalseyFromSecondary||!a},_handleSecondaryEnd:function(a,b){this._hasFalseyFromSecondary||this._send(bb,null,b)}}),"function"==typeof define&&define.amd?(define([],function(){return _}),a.Kefir=_):"object"==typeof module&&"object"==typeof exports?(module.exports=_,_.Kefir=_):a.Kefir=_}(this);
!function(a){"use strict";function b(){for(var a=0;a<arguments.length;a++)if(!arguments[a])return arguments[a];return arguments[a-1]}function c(){for(var a=0;a<arguments.length;a++)if(arguments[a])return arguments[a];return arguments[a-1]}function d(a){return!a}function e(a,b){var c,d,e,f;if(0===a.length)return b;if(0===b.length)return a;for(f=0,c=new Array(a.length+b.length),d=a.length,e=0;d>e;e++,f++)c[f]=a[e];for(d=b.length,e=0;d>e;e++,f++)c[f]=b[e];return c}function f(a,b){var c,d=a.length;for(c=0;d>c;c++)if(a[c]===b)return c;return-1}function g(a,b){var c,d=a.length;for(c=0;d>c;c++)if(b(a[c]))return c;return-1}function h(a){var b,c=a.length,d=new Array(c);for(b=0;c>b;b++)d[b]=a[b];return d}function i(a,b){var c,d,e,f=a.length;if(b>=0&&f>b){if(1===f)return[];for(c=new Array(f-1),d=0,e=0;f>d;d++)d!==b&&(c[e]=a[d],e++);return c}return a}function j(a,b){return i(a,g(a,b))}function k(a,b){var c,d=a.length,e=new Array(d);for(c=0;d>c;c++)e[c]=b(a[c]);return e}function l(a,b){var c,d=a.length;for(c=0;d>c;c++)b(a[c])}function m(a,b){var c,d=a.length;for(c=0;d>c;c++)a[c]=b}function n(a,b){return-1!==f(a,b)}function o(a,b,c){return a.length>b?Array.prototype.slice.call(a,b):c}function p(a,b,c){var d,e=Math.min(c,a.length+1),f=a.length-e+1,g=new Array(e);for(d=f;e>d;d++)g[d-f]=a[d];return g[e-1]=b,g}function q(a,b){var c,d;if(null==a&&null==b)return!0;if(null==a||null==b)return!1;if(a.length!==b.length)return!1;for(d=0,c=a.length;c>d;d++)if(a[d]!==b[d])return!1;return!0}function r(a,b){switch(b){case 0:return function(){return a()};case 1:return function(b){return a(b[0])};case 2:return function(b){return a(b[0],b[1])};case 3:return function(b){return a(b[0],b[1],b[2])};case 4:return function(b){return a(b[0],b[1],b[2],b[3])};default:return function(b){return a.apply(null,b)}}}function s(a,b,c){var d=c?c.length:0;if(null==b)switch(d){case 0:return a();case 1:return a(c[0]);case 2:return a(c[0],c[1]);case 3:return a(c[0],c[1],c[2]);case 4:return a(c[0],c[1],c[2],c[3]);default:return a.apply(null,c)}else switch(d){case 0:return a.call(b);default:return a.apply(b,c)}}function t(a,b,c){return a&&b in a?a[b]:c}function u(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function v(a){var b=function(){};return b.prototype=a,new b}function w(a){var b,c,d=arguments.length;for(b=1;d>b;b++)for(c in arguments[b])a[c]=arguments[b][c];return a}function x(a,b){var c,d=arguments.length;for(a.prototype=v(b.prototype),a.prototype.constructor=a,c=2;d>c;c++)w(a.prototype,arguments[c]);return a}function y(a){return a}function z(a,b){return a===b}function A(a,b){return[a,b]}function B(a){return"function"==typeof a}function C(a,b){function c(a,b){I.call(this),this._wait=a,this._intervalId=null;var c=this;this._$onTick=function(){c._onTick()},this._init(b)}x(c,I,{_name:a,_init:function(){},_free:function(){},_onTick:function(){},_onActivation:function(){this._intervalId=setInterval(this._$onTick,this._wait)},_onDeactivation:function(){null!==this._intervalId&&(clearInterval(this._intervalId),this._intervalId=null)},_clear:function(){I.prototype._clear.call(this),this._$onTick=null,this._free()}},b),ab[a]=function(a){return new c(a,o(arguments,1,[]))}}function D(a,b,c){function d(c){function d(b,d){c.call(this),this._source=b,this._name=b._name+"."+a,this._init(d);var e=this;this._$handleAny=function(a){e._handleAny(a)}}return x(d,c,{_clear:function(){c.prototype._clear.call(this),this._source=null,this._$handleAny=null,this._free()}},b),d}c=w({streamMethod:function(a){return function(){return new a(this,arguments)}},propertyMethod:function(a,b){return function(){return new b(this,arguments)}}},c||{}),b=w({_init:function(){},_free:function(){},_handleValue:function(a,b){this._send(db,a,b)},_handleError:function(a,b){this._send(eb,a,b)},_handleEnd:function(a,b){this._send(cb,null,b)},_handleAny:function(a){switch(a.type){case db:this._handleValue(a.value,a.current);break;case eb:this._handleError(a.value,a.current);break;case cb:this._handleEnd(a.value,a.current)}},_onActivation:function(){this._source.onAny(this._$handleAny)},_onDeactivation:function(){this._source.offAny(this._$handleAny)}},b||{});var e=d(I),f=d(J);c.streamMethod&&(I.prototype[a]=c.streamMethod(e,f)),c.propertyMethod&&(J.prototype[a]=c.propertyMethod(e,f))}function E(a,b){function c(c){function d(b,d,e){c.call(this),this._primary=b,this._secondary=d,this._name=b._name+"."+a,this._lastSecondary=bb;var f=this;this._$handleSecondaryAny=function(a){f._handleSecondaryAny(a)},this._$handlePrimaryAny=function(a){f._handlePrimaryAny(a)},this._init(e)}return x(d,c,{_clear:function(){c.prototype._clear.call(this),this._primary=null,this._secondary=null,this._lastSecondary=null,this._$handleSecondaryAny=null,this._$handlePrimaryAny=null,this._free()}},b),d}b=w({_init:function(){},_free:function(){},_handlePrimaryValue:function(a,b){this._send(db,a,b)},_handlePrimaryError:function(a,b){this._send(eb,a,b)},_handlePrimaryEnd:function(a,b){this._send(cb,null,b)},_handleSecondaryValue:function(a){this._lastSecondary=a},_handleSecondaryError:function(a,b){this._send(eb,a,b)},_handleSecondaryEnd:function(){},_handlePrimaryAny:function(a){switch(a.type){case db:this._handlePrimaryValue(a.value,a.current);break;case eb:this._handlePrimaryError(a.value,a.current);break;case cb:this._handlePrimaryEnd(a.value,a.current)}},_handleSecondaryAny:function(a){switch(a.type){case db:this._handleSecondaryValue(a.value,a.current);break;case eb:this._handleSecondaryError(a.value,a.current);break;case cb:this._handleSecondaryEnd(a.value,a.current),this._removeSecondary()}},_removeSecondary:function(){null!==this._secondary&&(this._secondary.offAny(this._$handleSecondaryAny),this._$handleSecondaryAny=null,this._secondary=null)},_onActivation:function(){null!==this._secondary&&this._secondary.onAny(this._$handleSecondaryAny),this._alive&&this._primary.onAny(this._$handlePrimaryAny)},_onDeactivation:function(){null!==this._secondary&&this._secondary.offAny(this._$handleSecondaryAny),this._primary.offAny(this._$handlePrimaryAny)}},b||{});var d=c(I),e=c(J);I.prototype[a]=function(a){return new d(this,a,o(arguments,1,[]))},J.prototype[a]=function(a){return new e(this,a,o(arguments,1,[]))}}function F(){this._items=[]}function G(a,b,c){return{type:a,value:b,current:!!c}}function H(){this._subscribers=new F,this._active=!1,this._alive=!0}function I(){H.call(this)}function J(){H.call(this),this._current=bb,this._currentError=bb}function K(a){if(I.call(this),this._queueLim=t(a,"queueLim",0),this._concurLim=t(a,"concurLim",-1),this._drop=t(a,"drop","new"),0===this._concurLim)throw new Error("options.concurLim can't be 0");var b=this;this._$handleSubAny=function(a){b._handleSubAny(a)},this._queue=[],this._curSources=[],this._activating=!1}function L(a){K.call(this),0===a.length?this._send(cb):this._addAll(a),this._initialised=!0}function M(a){K.call(this,{concurLim:1,queueLim:-1}),0===a.length?this._send(cb):this._addAll(a),this._initialised=!0}function N(){K.call(this)}function O(){K.call(this)}function P(a,b,c){K.call(this,c),this._source=a,this._fn=b||y,this._mainEnded=!1,this._lastCurrent=null;var d=this;this._$handleMainSource=function(a){d._handleMainSource(a)}}function Q(a,b){I.call(this),0===a.length?this._send(cb):(this._buffers=k(a,function(a){return hb(a)?h(a):[]}),this._sources=k(a,function(a){return hb(a)?ab.never():a}),this._combinator=b?r(b,this._sources.length):y,this._aliveCount=0)}function R(a,b,c){I.call(this),0===b.length?this._send(cb):(this._passiveCount=a.length,this._sources=e(a,b),this._combinator=c?r(c,this._sources.length):y,this._aliveCount=0,this._currents=new Array(this._sources.length),m(this._currents,bb),this._activating=!1,this._emitAfterActivation=!1,this._endAfterActivation=!1)}function S(a){return function(){return new a(this,arguments)}}function T(a,b){return function(){return new b(this,arguments)}}function U(a){return{step:function(b,c){return a._send(db,c,a._forcedCurrent),null},result:function(){return a._send(cb,null,a._forcedCurrent),null}}}function V(a){return{convert:!0,value:a}}function W(a){return{convert:!0,error:a}}function X(a){I.call(this),this._fn=a,this._unsubscribe=null}function Y(){I.call(this)}function Z(a){J.call(this),this._send(db,a),this._send(cb)}function $(a){J.call(this),this._send(eb,a),this._send(cb)}function _(a){I.call(this),this._generator=a,this._source=null,this._inLoop=!1,this._activating=!1,this._iteration=0;var b=this;this._$handleAny=function(a){b._handleAny(a)}}var ab={},bb=["<nothing>"],cb="end",db="value",eb="error",fb="any",gb=Date.now?function(){return Date.now()}:function(){return(new Date).getTime()},hb=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},ib=function(a){return"[object Arguments]"===Object.prototype.toString.call(a)};ib(arguments)||(ib=function(a){return!(!a||!u(a,"callee"))}),w(F,{callOne:function(a,b){a.type===fb?a.fn(b):a.type===b.type&&(a.type===db||a.type===eb?a.fn(b.value):a.fn())},callOnce:function(a,b,c){a===fb?b(c):a===c.type&&(a===db||a===eb?b(c.value):b())}}),w(F.prototype,{add:function(a,b,c){this._items=e(this._items,[{type:a,fn:b,key:c||null}])},remove:function(a,b,c){var d=hb(c)?function(b){return b.type===a&&q(b.key,c)}:function(c){return c.type===a&&c.fn===b};this._items=j(this._items,d)},callAll:function(a){for(var b=this._items,c=0;c<b.length;c++)F.callOne(b[c],a)},isEmpty:function(){return 0===this._items.length}});var jb=G(cb,void 0,!0);ab.Observable=H,w(H.prototype,{_name:"observable",_onActivation:function(){},_onDeactivation:function(){},_setActive:function(a){this._active!==a&&(this._active=a,a?this._onActivation():this._onDeactivation())},_clear:function(){this._setActive(!1),this._alive=!1,this._subscribers=null},_send:function(a,b,c){this._alive&&(this._subscribers.callAll(G(a,b,c)),a===cb&&this._clear())},_on:function(a,b,c){return this._alive?(this._subscribers.add(a,b,c),this._setActive(!0)):F.callOnce(a,b,jb),this},_off:function(a,b,c){return this._alive&&(this._subscribers.remove(a,b,c),this._subscribers.isEmpty()&&this._setActive(!1)),this},onValue:function(a,b){return this._on(db,a,b)},onError:function(a,b){return this._on(eb,a,b)},onEnd:function(a,b){return this._on(cb,a,b)},onAny:function(a,b){return this._on(fb,a,b)},offValue:function(a,b){return this._off(db,a,b)},offError:function(a,b){return this._off(eb,a,b)},offEnd:function(a,b){return this._off(cb,a,b)},offAny:function(a,b){return this._off(fb,a,b)}}),H.prototype.toString=function(){return"["+this._name+"]"},ab.Stream=I,x(I,H,{_name:"stream"}),ab.Property=J,x(J,H,{_name:"property",_send:function(a,b,c){this._alive&&(c||this._subscribers.callAll(G(a,b)),a===db&&(this._current=b),a===eb&&(this._currentError=b),a===cb&&this._clear())},_on:function(a,b,c){return this._alive&&(this._subscribers.add(a,b,c),this._setActive(!0)),this._current!==bb&&F.callOnce(a,b,G(db,this._current,!0)),this._currentError!==bb&&F.callOnce(a,b,G(eb,this._currentError,!0)),this._alive||F.callOnce(a,b,jb),this}}),H.prototype.log=function(a){return a=a||this.toString(),this.onAny(function(b){var c="<"+b.type+(b.current?":current":"")+">";b.type===db||b.type===eb?console.log(a,c,b.value):console.log(a,c)},["__logKey__",this,a]),this},H.prototype.offLog=function(a){return a=a||this.toString(),this.offAny(null,["__logKey__",this,a]),this},C("withInterval",{_init:function(a){this._fn=a[0];var b=this;this._emitter={emit:function(a){b._send(db,a)},error:function(a){b._send(eb,a)},end:function(){b._send(cb)},emitEvent:function(a){b._send(a.type,a.value)}}},_free:function(){this._fn=null,this._emitter=null},_onTick:function(){this._fn(this._emitter)}}),C("fromPoll",{_init:function(a){this._fn=a[0]},_free:function(){this._fn=null},_onTick:function(){this._send(db,this._fn())}}),C("interval",{_init:function(a){this._x=a[0]},_free:function(){this._x=null},_onTick:function(){this._send(db,this._x)}}),C("sequentially",{_init:function(a){this._xs=h(a[0]),0===this._xs.length&&this._send(cb)},_free:function(){this._xs=null},_onTick:function(){switch(this._xs.length){case 1:this._send(db,this._xs[0]),this._send(cb);break;default:this._send(db,this._xs.shift())}}}),C("repeatedly",{_init:function(a){this._xs=h(a[0]),this._i=-1},_onTick:function(){this._xs.length>0&&(this._i=(this._i+1)%this._xs.length,this._send(db,this._xs[this._i]))}}),C("later",{_init:function(a){this._x=a[0]},_free:function(){this._x=null},_onTick:function(){this._send(db,this._x),this._send(cb)}}),x(K,I,{_name:"abstractPool",_add:function(a,b){b=b||y,-1===this._concurLim||this._curSources.length<this._concurLim?this._addToCur(b(a)):-1===this._queueLim||this._queue.length<this._queueLim?this._addToQueue(b(a)):"old"===this._drop&&(this._removeOldest(),this._add(b(a)))},_addAll:function(a){var b=this;l(a,function(a){b._add(a)})},_remove:function(a){-1===this._removeCur(a)&&this._removeQueue(a)},_addToQueue:function(a){this._queue=e(this._queue,[a])},_addToCur:function(a){this._curSources=e(this._curSources,[a]),this._active&&this._subscribe(a)},_subscribe:function(a){var b=this;a.onAny(this._$handleSubAny),a.onEnd(function(){b._removeCur(a)},[this,a])},_unsubscribe:function(a){a.offAny(this._$handleSubAny),a.offEnd(null,[this,a])},_handleSubAny:function(a){(a.type===db||a.type===eb)&&this._send(a.type,a.value,a.current&&this._activating)},_removeQueue:function(a){var b=f(this._queue,a);return this._queue=i(this._queue,b),b},_removeCur:function(a){this._active&&this._unsubscribe(a);var b=f(this._curSources,a);return this._curSources=i(this._curSources,b),-1!==b&&(0!==this._queue.length?this._pullQueue():0===this._curSources.length&&this._onEmpty()),b},_removeOldest:function(){this._removeCur(this._curSources[0])},_pullQueue:function(){0!==this._queue.length&&(this._queue=h(this._queue),this._addToCur(this._queue.shift()))},_onActivation:function(){var a,b=this._curSources;for(this._activating=!0,a=0;a<b.length;a++)this._active&&this._subscribe(b[a]);this._activating=!1},_onDeactivation:function(){var a,b=this._curSources;for(a=0;a<b.length;a++)this._unsubscribe(b[a])},_isEmpty:function(){return 0===this._curSources.length},_onEmpty:function(){},_clear:function(){I.prototype._clear.call(this),this._queue=null,this._curSources=null,this._$handleSubAny=null}});var kb={_onEmpty:function(){this._initialised&&this._send(cb,null,this._activating)}};x(L,K,w({_name:"merge"},kb)),ab.merge=function(a){return new L(a)},H.prototype.merge=function(a){return ab.merge([this,a])},x(M,K,w({_name:"concat"},kb)),ab.concat=function(a){return new M(a)},H.prototype.concat=function(a){return ab.concat([this,a])},ab.Pool=N,x(N,K,{_name:"pool",plug:function(a){return this._add(a),this},unplug:function(a){return this._remove(a),this}}),ab.pool=function(){return new N},ab.Bus=O,x(O,K,{_name:"bus",plug:function(a){return this._add(a),this},unplug:function(a){return this._remove(a),this},emit:function(a){return this._send(db,a),this},error:function(a){return this._send(eb,a),this},end:function(){return this._send(cb),this},emitEvent:function(a){this._send(a.type,a.value)}}),ab.bus=function(){return new O},x(P,K,{_onActivation:function(){K.prototype._onActivation.call(this),this._active&&(this._activating=!0,this._source.onAny(this._$handleMainSource),this._activating=!1)},_onDeactivation:function(){K.prototype._onDeactivation.call(this),this._source.offAny(this._$handleMainSource)},_handleMainSource:function(a){a.type===db&&(a.current&&this._lastCurrent===a.value||this._add(a.value,this._fn),this._lastCurrent=a.value),a.type===eb&&this._send(eb,a.value,a.current),a.type===cb&&(this._isEmpty()?this._send(cb,null,a.current):this._mainEnded=!0)},_onEmpty:function(){this._mainEnded&&this._send(cb)},_clear:function(){K.prototype._clear.call(this),this._source=null,this._lastCurrent=null,this._$handleMainSource=null}}),H.prototype.flatMap=function(a){return new P(this,a).setName(this,"flatMap")},H.prototype.flatMapLatest=function(a){return new P(this,a,{concurLim:1,drop:"old"}).setName(this,"flatMapLatest")},H.prototype.flatMapFirst=function(a){return new P(this,a,{concurLim:1}).setName(this,"flatMapFirst")},H.prototype.flatMapConcat=function(a){return new P(this,a,{queueLim:-1,concurLim:1}).setName(this,"flatMapConcat")},H.prototype.flatMapConcurLimit=function(a,b){var c;return 0===b?c=ab.never():(0>b&&(b=-1),c=new P(this,a,{queueLim:-1,concurLim:b})),c.setName(this,"flatMapConcurLimit")},x(Q,I,{_name:"zip",_onActivation:function(){var a,b=this._sources.length;for(this._drainArrays(),this._aliveCount=b,a=0;b>a;a++)this._active&&this._sources[a].onAny(this._bindHandleAny(a),[this,a])},_onDeactivation:function(){for(var a=0;a<this._sources.length;a++)this._sources[a].offAny(null,[this,a])},_emit:function(a){for(var b=new Array(this._buffers.length),c=0;c<this._buffers.length;c++)b[c]=this._buffers[c].shift();this._send(db,this._combinator(b),a)},_isFull:function(){for(var a=0;a<this._buffers.length;a++)if(0===this._buffers[a].length)return!1;return!0},_emitIfFull:function(a){this._isFull()&&this._emit(a)},_drainArrays:function(){for(;this._isFull();)this._emit(!0)},_bindHandleAny:function(a){var b=this;return function(c){b._handleAny(a,c)}},_handleAny:function(a,b){b.type===db&&(this._buffers[a].push(b.value),this._emitIfFull(b.current)),b.type===eb&&this._send(eb,b.value,b.current),b.type===cb&&(this._aliveCount--,0===this._aliveCount&&this._send(cb,null,b.current))},_clear:function(){I.prototype._clear.call(this),this._sources=null,this._buffers=null,this._combinator=null}}),ab.zip=function(a,b){return new Q(a,b)},H.prototype.zip=function(a,b){return new Q([this,a],b)},x(R,I,{_name:"sampledBy",_onActivation:function(){var a,b=this._sources.length;for(this._aliveCount=b-this._passiveCount,this._activating=!0,a=0;b>a;a++)this._sources[a].onAny(this._bindHandleAny(a),[this,a]);this._activating=!1,this._emitAfterActivation&&(this._emitAfterActivation=!1,this._emitIfFull(!0)),this._endAfterActivation&&this._send(cb,null,!0)},_onDeactivation:function(){var a,b=this._sources.length;for(a=0;b>a;a++)this._sources[a].offAny(null,[this,a])},_emitIfFull:function(a){if(!n(this._currents,bb)){var b=h(this._currents);b=this._combinator(b),this._send(db,b,a)}},_bindHandleAny:function(a){var b=this;return function(c){b._handleAny(a,c)}},_handleAny:function(a,b){b.type===db&&(this._currents[a]=b.value,a>=this._passiveCount&&(this._activating?this._emitAfterActivation=!0:this._emitIfFull(b.current))),b.type===eb&&this._send(eb,b.value,b.current),b.type===cb&&a>=this._passiveCount&&(this._aliveCount--,0===this._aliveCount&&(this._activating?this._endAfterActivation=!0:this._send(cb,null,b.current)))},_clear:function(){I.prototype._clear.call(this),this._sources=null,this._currents=null,this._combinator=null}}),ab.sampledBy=function(a,b,c){return new R(a,b,c)},H.prototype.sampledBy=function(a,b){return ab.sampledBy([this],[a],b||y)},ab.combine=function(a,b){return new R([],a,b).setName("combine")},H.prototype.combine=function(a,b){return ab.combine([this,a],b)},D("toProperty",{_init:function(a){a.length>0&&this._send(db,a[0])}},{propertyMethod:T,streamMethod:T}),D("changes",{_handleValue:function(a,b){b||this._send(db,a)},_handleError:function(a,b){b||this._send(eb,a)}},{streamMethod:function(){return function(){return this}},propertyMethod:S}),D("withHandler",{_init:function(a){this._handler=a[0],this._forcedCurrent=!1;var b=this;this._emitter={emit:function(a){b._send(db,a,b._forcedCurrent)},error:function(a){b._send(eb,a,b._forcedCurrent)},end:function(){b._send(cb,null,b._forcedCurrent)},emitEvent:function(a){b._send(a.type,a.value,b._forcedCurrent)}}},_free:function(){this._handler=null,this._emitter=null},_handleAny:function(a){this._forcedCurrent=a.current,this._handler(this._emitter,a),this._forcedCurrent=!1}}),D("flatten",{_init:function(a){this._fn=a[0]?a[0]:y},_free:function(){this._fn=null},_handleValue:function(a,b){for(var c=this._fn(a),d=0;d<c.length;d++)this._send(db,c[d],b)}}),D("transduce",{_init:function(a){this._xform=a[0](U(this))},_free:function(){this._xform=null},_handleValue:function(a,b){this._forcedCurrent=b,null!==this._xform.step(null,a)&&this._xform.result(null),this._forcedCurrent=!1},_handleEnd:function(a,b){this._forcedCurrent=b,this._xform.result(null),this._forcedCurrent=!1}});var lb={_init:function(a){this._fn=a[0]||y},_free:function(){this._fn=null}};D("map",w({_handleValue:function(a,b){this._send(db,this._fn(a),b)}},lb)),D("mapErrors",w({_handleError:function(a,b){this._send(eb,this._fn(a),b)}},lb)),D("errorsToValues",w({_init:function(a){this._fn=a[0]||V},_free:function(){this._fn=null},_handleError:function(a,b){var c=this._fn(a),d=c.convert?db:eb,e=c.convert?c.value:a;this._send(d,e,b)}})),D("valuesToErrors",w({_init:function(a){this._fn=a[0]||W},_free:function(){this._fn=null},_handleValue:function(a,b){var c=this._fn(a),d=c.convert?eb:db,e=c.convert?c.error:a;this._send(d,e,b)}})),D("filter",w({_handleValue:function(a,b){this._fn(a)&&this._send(db,a,b)}},lb)),D("filterErrors",w({_handleError:function(a,b){this._fn(a)&&this._send(eb,a,b)}},lb)),D("takeWhile",w({_handleValue:function(a,b){this._fn(a)?this._send(db,a,b):this._send(cb,null,b)}},lb)),D("take",{_init:function(a){this._n=a[0],this._n<=0&&this._send(cb)},_handleValue:function(a,b){this._n--,this._send(db,a,b),0===this._n&&this._send(cb,null,b)}}),D("skip",{_init:function(a){this._n=Math.max(0,a[0])},_handleValue:function(a,b){0===this._n?this._send(db,a,b):this._n--}}),D("skipDuplicates",{_init:function(a){this._fn=a[0]||z,this._prev=bb},_free:function(){this._fn=null,this._prev=null},_handleValue:function(a,b){this._prev!==bb&&this._fn(this._prev,a)||(this._prev=a,this._send(db,a,b))}}),D("skipWhile",{_init:function(a){this._fn=a[0]||y,this._skip=!0},_free:function(){this._fn=null},_handleValue:function(a,b){return this._skip?void(this._fn(a)||(this._skip=!1,this._fn=null,this._send(db,a,b))):void this._send(db,a,b)}}),D("diff",{_init:function(a){this._fn=a[0]||A,this._prev=a.length>1?a[1]:bb},_free:function(){this._prev=null,this._fn=null},_handleValue:function(a,b){this._prev!==bb&&this._send(db,this._fn(this._prev,a),b),this._prev=a}}),D("scan",{_init:function(a){this._fn=a[0],a.length>1&&this._send(db,a[1],!0)},_free:function(){this._fn=null},_handleValue:function(a,b){this._current!==bb&&(a=this._fn(this._current,a)),this._send(db,a,b)}},{streamMethod:T}),D("reduce",{_init:function(a){this._fn=a[0],this._result=a.length>1?a[1]:bb},_free:function(){this._fn=null,this._result=null},_handleValue:function(a){this._result=this._result===bb?a:this._fn(this._result,a)},_handleEnd:function(a,b){this._result!==bb&&this._send(db,this._result,b),this._send(cb,null,b)}}),D("mapEnd",{_init:function(a){this._fn=a[0]},_free:function(){this._fn=null},_handleEnd:function(a,b){this._send(db,this._fn(),b),this._send(cb,null,b)}}),D("skipValues",{_handleValue:function(){}}),D("skipErrors",{_handleError:function(){}}),D("skipEnd",{_handleEnd:function(){}}),D("endOnError",w({_handleError:function(a,b){this._send(eb,a,b),this._send(cb,null,b)}})),D("slidingWindow",{_init:function(a){this._max=a[0],this._min=a[1]||0,this._buff=[]},_free:function(){this._buff=null},_handleValue:function(a,b){this._buff=p(this._buff,a,this._max),this._buff.length>=this._min&&this._send(db,this._buff,b)}}),D("bufferWhile",{_init:function(a){this._fn=a[0]||y,this._flushOnEnd=t(a[1],"flushOnEnd",!0),this._buff=[]},_free:function(){this._buff=null},_flush:function(a){null!==this._buff&&0!==this._buff.length&&(this._send(db,this._buff,a),this._buff=[])},_handleValue:function(a,b){this._buff.push(a),this._fn(a)||this._flush(b)},_handleEnd:function(a,b){this._flushOnEnd&&this._flush(b),this._send(cb,null,b)}}),D("debounce",{_init:function(a){this._wait=Math.max(0,a[0]),this._immediate=t(a[1],"immediate",!1),this._lastAttempt=0,this._timeoutId=null,this._laterValue=null,this._endLater=!1;var b=this;this._$later=function(){b._later()}},_free:function(){this._laterValue=null,this._$later=null},_handleValue:function(a,b){b?this._send(db,a,b):(this._lastAttempt=gb(),this._immediate&&!this._timeoutId&&this._send(db,a),this._timeoutId||(this._timeoutId=setTimeout(this._$later,this._wait)),this._immediate||(this._laterValue=a))},_handleEnd:function(a,b){b?this._send(cb,null,b):this._timeoutId&&!this._immediate?this._endLater=!0:this._send(cb)},_later:function(){var a=gb()-this._lastAttempt;a<this._wait&&a>=0?this._timeoutId=setTimeout(this._$later,this._wait-a):(this._timeoutId=null,this._immediate||(this._send(db,this._laterValue),this._laterValue=null),this._endLater&&this._send(cb))}}),D("throttle",{_init:function(a){this._wait=Math.max(0,a[0]),this._leading=t(a[1],"leading",!0),this._trailing=t(a[1],"trailing",!0),this._trailingValue=null,this._timeoutId=null,this._endLater=!1,this._lastCallTime=0;var b=this;this._$trailingCall=function(){b._trailingCall()}},_free:function(){this._trailingValue=null,this._$trailingCall=null},_handleValue:function(a,b){if(b)this._send(db,a,b);else{var c=gb();0!==this._lastCallTime||this._leading||(this._lastCallTime=c);var d=this._wait-(c-this._lastCallTime);0>=d?(this._cancelTraling(),this._lastCallTime=c,this._send(db,a)):this._trailing&&(this._cancelTraling(),this._trailingValue=a,this._timeoutId=setTimeout(this._$trailingCall,d))}},_handleEnd:function(a,b){b?this._send(cb,null,b):this._timeoutId?this._endLater=!0:this._send(cb)},_cancelTraling:function(){null!==this._timeoutId&&(clearTimeout(this._timeoutId),this._timeoutId=null)},_trailingCall:function(){this._send(db,this._trailingValue),this._timeoutId=null,this._trailingValue=null,this._lastCallTime=this._leading?gb():0,this._endLater&&this._send(cb)}}),D("delay",{_init:function(a){this._wait=Math.max(0,a[0]),this._buff=[];var b=this;this._$shiftBuff=function(){b._send(db,b._buff.shift())}},_free:function(){this._buff=null,this._$shiftBuff=null},_handleValue:function(a,b){b?this._send(db,a,b):(this._buff.push(a),setTimeout(this._$shiftBuff,this._wait))},_handleEnd:function(a,b){if(b)this._send(cb,null,b);else{var c=this;setTimeout(function(){c._send(cb)},this._wait)}}}),x(X,I,{_name:"fromBinder",_onActivation:function(){var a=this,b=!0,c={emit:function(c){a._send(db,c,b)},error:function(c){a._send(eb,c,b)},end:function(){a._send(cb,null,b)},emitEvent:function(c){a._send(c.type,c.value,b)}};this._unsubscribe=this._fn(c)||null,this._active||null===this._unsubscribe||(this._unsubscribe(),this._unsubscribe=null),b=!1},_onDeactivation:function(){null!==this._unsubscribe&&(this._unsubscribe(),this._unsubscribe=null)},_clear:function(){I.prototype._clear.call(this),this._fn=null}}),ab.fromBinder=function(a){return new X(a)},x(Y,I,{_name:"emitter",emit:function(a){return this._send(db,a),this},error:function(a){return this._send(eb,a),this},end:function(){return this._send(cb),this},emitEvent:function(a){this._send(a.type,a.value)}}),ab.emitter=function(){return new Y},ab.Emitter=Y;var mb=new I;mb._send(cb),mb._name="never",ab.never=function(){return mb},x(Z,J,{_name:"constant"}),ab.constant=function(a){return new Z(a)},x($,J,{_name:"constantError"}),ab.constantError=function(a){return new $(a)},x(_,I,{_name:"repeat",_handleAny:function(a){a.type===cb?(this._source=null,this._startLoop()):this._send(a.type,a.value,this._activating)},_startLoop:function(){if(!this._inLoop){for(this._inLoop=!0;null===this._source&&this._alive&&this._active;)this._source=this._generator(this._iteration++),this._source?this._source.onAny(this._$handleAny):this._send(cb);this._inLoop=!1}},_onActivation:function(){this._activating=!0,this._source?this._source.onAny(this._$handleAny):this._startLoop(),this._activating=!1},_onDeactivation:function(){this._source&&this._source.offAny(this._$handleAny)},_clear:function(){I.prototype._clear.call(this),this._generator=null,this._source=null,this._$handleAny=null}}),ab.repeat=function(a){return new _(a)},H.prototype.setName=function(a,b){return this._name=b?a._name+"."+b:a,this},H.prototype.mapTo=function(a){return this.map(function(){return a}).setName(this,"mapTo")},H.prototype.pluck=function(a){return this.map(function(b){return b[a]}).setName(this,"pluck")},H.prototype.invoke=function(a){var b=o(arguments,1);return this.map(b?function(c){return s(c[a],c,b)}:function(b){return b[a]()}).setName(this,"invoke")},H.prototype.timestamp=function(){return this.map(function(a){return{value:a,time:gb()}}).setName(this,"timestamp")},H.prototype.tap=function(a){return this.map(function(b){return a(b),b}).setName(this,"tap")},ab.and=function(a){return ab.combine(a,b).setName("and")},H.prototype.and=function(a){return this.combine(a,b).setName("and")},ab.or=function(a){return ab.combine(a,c).setName("or")},H.prototype.or=function(a){return this.combine(a,c).setName("or")},H.prototype.not=function(){return this.map(d).setName(this,"not")},H.prototype.awaiting=function(a){return ab.merge([this.mapTo(!0),a.mapTo(!1)]).skipDuplicates().toProperty(!1).setName(this,"awaiting")},ab.fromCallback=function(a){var b=!1;return ab.fromBinder(function(c){b||(a(function(a){c.emit(a),c.end()}),b=!0)}).setName("fromCallback")},ab.fromNodeCallback=function(a){var b=!1;return ab.fromBinder(function(c){b||(a(function(a,b){a?c.error(a):c.emit(b),c.end()}),b=!0)}).setName("fromNodeCallback")},ab.fromPromise=function(a){var b=!1;return ab.fromBinder(function(c){if(!b){var d=function(a){c.emit(a),c.end()},e=function(a){c.error(a),c.end()},f=a.then(d,e);f&&B(f.done)&&f.done(),b=!0}}).toProperty().setName("fromPromise")},ab.fromSubUnsub=function(a,b,c){return ab.fromBinder(function(d){var e=c?function(){d.emit(s(c,this,arguments))}:d.emit;return a(e),function(){b(e)}})};var nb=[["addEventListener","removeEventListener"],["addListener","removeListener"],["on","off"]];ab.fromEvent=function(a,b,c){for(var d,e,f,g=0;g<nb.length;g++)if(d=nb[g],B(a[d[0]])&&B(a[d[1]])){e=d[0],f=d[1];break}if(void 0===e)throw new Error("target don't support any of addEventListener/removeEventListener, addListener/removeListener, on/off method pair");return ab.fromSubUnsub(function(c){a[e](b,c)},function(c){a[f](b,c)},c).setName("fromEvent")};var ob={_init:function(a){this._buff=[],this._flushOnEnd=t(a[0],"flushOnEnd",!0)},_free:function(){this._buff=null},_flush:function(a){null!==this._buff&&0!==this._buff.length&&(this._send(db,this._buff,a),this._buff=[])},_handlePrimaryEnd:function(a,b){this._flushOnEnd&&this._flush(b),this._send(cb,null,b)}};E("bufferBy",w({_onActivation:function(){this._primary.onAny(this._$handlePrimaryAny),this._alive&&null!==this._secondary&&this._secondary.onAny(this._$handleSecondaryAny)},_handlePrimaryValue:function(a){this._buff.push(a)},_handleSecondaryValue:function(a,b){this._flush(b)},_handleSecondaryEnd:function(a,b){this._flushOnEnd||this._send(cb,null,b)}},ob)),E("bufferWhileBy",w({_handlePrimaryValue:function(a,b){this._buff.push(a),this._lastSecondary===bb||this._lastSecondary||this._flush(b)},_handleSecondaryEnd:function(a,b){this._flushOnEnd||this._lastSecondary!==bb&&!this._lastSecondary||this._send(cb,null,b)}},ob)),E("filterBy",{_handlePrimaryValue:function(a,b){this._lastSecondary!==bb&&this._lastSecondary&&this._send(db,a,b)},_handleSecondaryEnd:function(a,b){this._lastSecondary!==bb&&this._lastSecondary||this._send(cb,null,b)}}),E("skipUntilBy",{_handlePrimaryValue:function(a,b){this._lastSecondary!==bb&&this._send(db,a,b)},_handleSecondaryEnd:function(a,b){this._lastSecondary===bb&&this._send(cb,null,b)}}),E("takeUntilBy",{_handleSecondaryValue:function(a,b){this._send(cb,null,b)}}),E("takeWhileBy",{_handlePrimaryValue:function(a,b){this._lastSecondary!==bb&&this._send(db,a,b)},_handleSecondaryValue:function(a,b){this._lastSecondary=a,this._lastSecondary||this._send(cb,null,b)},_handleSecondaryEnd:function(a,b){this._lastSecondary===bb&&this._send(cb,null,b)}}),E("skipWhileBy",{_init:function(){this._hasFalseyFromSecondary=!1},_handlePrimaryValue:function(a,b){this._hasFalseyFromSecondary&&this._send(db,a,b)},_handleSecondaryValue:function(a){this._hasFalseyFromSecondary=this._hasFalseyFromSecondary||!a
},_handleSecondaryEnd:function(a,b){this._hasFalseyFromSecondary||this._send(cb,null,b)}}),"function"==typeof define&&define.amd?(define([],function(){return ab}),a.Kefir=ab):"object"==typeof module&&"object"==typeof exports?(module.exports=ab,ab.Kefir=ab):a.Kefir=ab}(this);
//# sourceMappingURL=kefir.min.js.map
{
"name": "kefir",
"version": "1.0.0",
"version": "1.1.0",
"description": "Reactive Programming library for JavaScript inspired by Bacon.js and RxJS with focus on high performance and low memory usage",

@@ -32,3 +32,3 @@ "main": "dist/kefir.js",

"devDependencies": {
"baconjs": "0.7.43",
"baconjs": "0.7.48",
"benchmark": "1.0.0",

@@ -43,10 +43,11 @@ "coffee-script": "1.9.0",

"grunt-contrib-concat": "0.5.0",
"grunt-contrib-jade": "0.14.0",
"grunt-contrib-jade": "0.14.1",
"grunt-contrib-jshint": "0.11.0",
"grunt-contrib-uglify": "0.7.0",
"grunt-contrib-watch": "0.6.1",
"grunt-jasmine-node": "0.2.1",
"grunt-jasmine-node": "git+https://git@github.com/pozadi/grunt-jasmine-node.git",
"grunt-release": "0.7.0",
"jasmine-node": "1.14.5",
"load-grunt-tasks": "3.1.0",
"rx": "2.3.24",
"rx": "2.3.25",
"semver": "2.3.0",

@@ -53,0 +54,0 @@ "shelljs": "0.3.0",

@@ -28,3 +28,3 @@ # <a href="http://pozadi.github.io/kefir/"><img src="http://pozadi.github.io/kefir/Kefir-with-bg.svg" width="60" height="60"></a> Kefir

### NPN
### NPM
```sh

@@ -31,0 +31,0 @@ npm install kefir

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc