Socket
Socket
Sign inDemoInstall

baconjs

Package Overview
Dependencies
0
Maintainers
2
Versions
222
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.7.82 to 0.7.83

1

assemble.js

@@ -65,2 +65,3 @@ #!/usr/bin/env babel-node

loose: [
"es6.spread",
"es6.destructuring"

@@ -67,0 +68,0 @@ ]

4

dist/Bacon.min.js

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

(function(){function t(t){if(Array.isArray(t)){for(var n=0,r=Array(t.length);n<t.length;n++)r[n]=t[n];return r}return Array.from(t)}function n(t,n){var r=arguments.length<=2||void 0===arguments[2]?!1:arguments[2];this.obs=t,this.sync=n,this.lazy=r,this.queue=[]}function r(){n.apply(this,arguments)}function e(t){n.call(this,t,!0)}function i(t,n,r){this.context=t,this.method=n,this.args=r}function u(t){this.value=t}function o(){this.id=++Z}function s(t,n){return this instanceof s?(o.call(this),void(!n&&P.isFunction(t)||(null!=t?t._isNext:void 0)?(this.valueF=t,this.valueInternal=void 0):(this.valueF=void 0,this.valueInternal=t))):new s(t,n)}function a(t,n){return this instanceof a?void s.call(this,t,n):new a(t,n)}function c(){return this instanceof c?void o.call(this):new c}function f(t){return this instanceof f?(this.error=t,void o.call(this)):new f(t)}function h(t){this.desc=t,this.id=++Y,this.initialDesc=this.desc}function l(){var t=arguments.length<=0||void 0===arguments[0]?[]:arguments[0];this.unsubscribe=P.bind(this.unsubscribe,this),this.unsubscribed=!1,this.subscriptions=[],this.starting=[];for(var n,r=0;r<t.length;r++)n=t[r],this.add(n)}function p(t,n){this._subscribe=t,this._handleEvent=n,this.subscribe=P.bind(this.subscribe,this),this.handleEvent=P.bind(this.handleEvent,this),this.pushing=!1,this.ended=!1,this.prevError=void 0,this.unsubSrc=void 0,this.subscriptions=[],this.queue=[]}function v(t,n,r){return this instanceof v?(P.isFunction(t)&&(r=n,n=t,t=i.empty),h.call(this,t),this.dispatcher=new p(n,r),void tt(this)):new v(t,n,r)}function d(t,n,r){p.call(this,n,r),this.property=t,this.subscribe=P.bind(this.subscribe,this),this.current=$,this.currentValueRootId=void 0,this.propertyEnded=!1}function y(t,n,r){h.call(this,t),this.dispatcher=new d(this,n,r),tt(this)}function m(){return this instanceof m?(this.unsubAll=P.bind(this.unsubAll,this),this.subscribeAll=P.bind(this.subscribeAll,this),this.guardedSink=P.bind(this.guardedSink,this),this.sink=void 0,this.subscriptions=[],this.ended=!1,void v.call(this,new w.Desc(w,"Bus",[]),this.subscribeAll)):new m}function b(t){return[t,J()]}var g=Array.prototype.slice,w={toString:function(){return"Bacon"}};w.version="0.7.82";var E=("undefined"!=typeof global&&null!==global?global:this).Error,D=function(){},S=function(t,n){return t},A=function(t){return t.slice(0)},O=function(t){return t instanceof Array},M=function(t){return t&&t._isObservable},k=function(t){for(var n=arguments.length,r=1;n>1?n>r:r>n;n>1?r++:r--)for(var e in arguments[r])t[e]=arguments[r][e];return t},I=function(t,n){var r={}.hasOwnProperty,e=function(){};e.prototype=n.prototype,t.prototype=new e;for(var i in n)r.call(n,i)&&(t[i]=n[i]);return t},P={indexOf:function(){return Array.prototype.indexOf?function(t,n){return t.indexOf(n)}:function(t,n){for(var r,e=0;e<t.length;e++)if(r=t[e],n===r)return e;return-1}}(),indexWhere:function(t,n){for(var r,e=0;e<t.length;e++)if(r=t[e],n(r))return e;return-1},head:function(t){return t[0]},always:function(t){return function(){return t}},negate:function(t){return function(n){return!t(n)}},empty:function(t){return 0===t.length},tail:function(t){return t.slice(1,t.length)},filter:function(t,n){for(var r,e=[],i=0;i<n.length;i++)r=n[i],t(r)&&e.push(r);return e},map:function(t,n){return function(){for(var r,e=[],i=0;i<n.length;i++)r=n[i],e.push(t(r));return e}()},each:function(t,n){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var e=t[r];n(r,e)}},toArray:function(t){return O(t)?t:[t]},contains:function(t,n){return-1!==P.indexOf(t,n)},id:function(t){return t},last:function(t){return t[t.length-1]},all:function(t){for(var n,r=arguments.length<=1||void 0===arguments[1]?P.id:arguments[1],e=0;e<t.length;e++)if(n=t[e],!r(n))return!1;return!0},any:function(t){for(var n,r=arguments.length<=1||void 0===arguments[1]?P.id:arguments[1],e=0;e<t.length;e++)if(n=t[e],r(n))return!0;return!1},without:function(t,n){return P.filter(function(n){return n!==t},n)},remove:function(t,n){var r=P.indexOf(n,t);return r>=0?n.splice(r,1):void 0},fold:function(t,n,r){for(var e,i=0;i<t.length;i++)e=t[i],n=r(n,e);return n},flatMap:function(t,n){return P.fold(n,[],function(n,r){return n.concat(t(r))})},cached:function(t){var n=$;return function(){return("undefined"!=typeof n&&null!==n?n._isNone:void 0)&&(n=t(),t=void 0),n}},bind:function(t,n){return function(){return t.apply(n,arguments)}},isFunction:function(t){return"function"==typeof t},toString:function(t){var n,r,e,i={}.hasOwnProperty;try{return _++,null==t?"undefined":P.isFunction(t)?"function":O(t)?_>5?"[..]":"["+P.map(P.toString,t).toString()+"]":null!=(null!=t?t.toString:void 0)&&t.toString!==Object.prototype.toString?t.toString():"object"==typeof t?_>5?"{..}":(n=function(){var n=[];for(r in t)i.call(t,r)&&(e=function(){var n;try{return t[r]}catch(n){return n}}(),n.push(P.toString(r)+":"+P.toString(e)));return n}(),"{"+n+"}"):t}finally{_--}}},_=0;w._=P;var x=w.UpdateBarrier=function(){var t,n=[],r={},e=[],i=0,u={},o=function(n){return t?e.push(n):n()},s=function(e,i){if(t){var u=r[e.id];return"undefined"==typeof u||null===u?(u=r[e.id]=[i],n.push(e)):u.push(i)}return i()},a=function(){for(;n.length>0;)c(0,!0);u={}},c=function(t,e){var i=n[t],u=i.id,o=r[u];n.splice(t,1),delete r[u],e&&n.length>0&&f(i);for(var s,a=0;a<o.length;a++)(s=o[a])()},f=function(t){if(!u[t.id]){for(var e,i=t.internalDeps(),o=0;o<i.length;o++)if(e=i[o],f(e),r[e.id]){var s=P.indexOf(n,e);c(s,!1)}u[t.id]=!0}},h=function(n,r,u,o){if(t)return u.apply(r,o);t=n;try{var s=u.apply(r,o);a()}finally{for(t=void 0;i<e.length;){var c=e[i];i++,c()}i=0,e=[]}return s},l=function(){return t?t.id:void 0},p=function(t,n){var r=!1,e=!1,i=function(){return e=!0},u=function(){return r=!0,i()};return i=t.dispatcher.subscribe(function(t){return o(function(){if(!r){var e=n(t);if(e===w.noMore)return u()}})}),e&&i(),u},v=function(){return n.length>0};return{whenDoneWith:s,hasWaiters:v,inTransaction:h,currentEventId:l,wrappedSubscribe:p,afterTransaction:o}}();k(n.prototype,{_isSource:!0,subscribe:function(t){return this.obs.dispatcher.subscribe(t)},toString:function(){return this.obs.toString()},markEnded:function(){return this.ended=!0,!0},consume:function(){return this.lazy?{value:P.always(this.queue[0])}:this.queue[0]},push:function(t){return this.queue=[t],[t]},mayHave:function(){return!0},hasAtLeast:function(){return this.queue.length},flatten:!0}),I(r,n),k(r.prototype,{consume:function(){return this.queue.shift()},push:function(t){return this.queue.push(t)},mayHave:function(t){return!this.ended||this.queue.length>=t},hasAtLeast:function(t){return this.queue.length>=t},flatten:!1}),I(e,n),k(e.prototype,{consume:function(){var t=this.queue;return this.queue=[],{value:function(){return t}}},push:function(t){return this.queue.push(t.value())},hasAtLeast:function(){return!0}}),n.isTrigger=function(t){return(null!=t?t._isSource:void 0)?t.sync:null!=t?t._isEventStream:void 0},n.fromObservable=function(t){return(null!=t?t._isSource:void 0)?t:(null!=t?t._isProperty:void 0)?new n(t,!1):new r(t,!0)},k(i.prototype,{_isDesc:!0,deps:function(){return this.cached||(this.cached=V([this.context].concat(this.args))),this.cached},toString:function(){return P.toString(this.context)+"."+P.toString(this.method)+"("+P.map(P.toString,this.args)+")"}});var W=function(t,n){var r=t||n;if(r&&r._isDesc)return t||n;for(var e=arguments.length,u=Array(e>2?e-2:0),o=2;e>o;o++)u[o-2]=arguments[o];return new i(t,n,u)},T=function(t,n){return n.desc=t,n},V=function(t){return O(t)?P.flatMap(V,t):M(t)?[t]:("undefined"!=typeof t&&null!==t?t._isSource:void 0)?[t.obs]:[]};w.Desc=i,w.Desc.empty=new w.Desc("","",[]);var H=function(n){return function(r){for(var e=arguments.length,i=Array(e>1?e-1:0),u=1;e>u;u++)i[u-1]=arguments[u];if("object"==typeof r&&i.length){var o=r,s=i[0];r=function(){return o[s].apply(o,arguments)},i=i.slice(1)}return n.apply(void 0,[r].concat(t(i)))}},B=function(n){return n=Array.prototype.slice.call(n),L.apply(void 0,t(n))},F=function(n,r){return function(){for(var e=arguments.length,i=Array(e),u=0;e>u;u++)i[u]=arguments[u];return n.apply(void 0,t(r.concat(i)))}},C=function(t){return function(n){return function(r){if("undefined"!=typeof r&&null!==r){var e=r[n];return P.isFunction(e)?e.apply(r,t):e}}}},q=function(t,n){var r=t.slice(1).split("."),e=P.map(C(n),r);return function(t){for(var n,r=0;r<e.length;r++)n=e[r],t=n(t);return t}},N=function(t){return"string"==typeof t&&t.length>1&&"."===t.charAt(0)},L=H(function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;n>e;e++)r[e-1]=arguments[e];return P.isFunction(t)?r.length?F(t,r):t:N(t)?q(t,r):P.always(t)}),U=function(n,r){return L.apply(void 0,[n].concat(t(r)))},z=function(t,n,r,e){if("undefined"!=typeof n&&null!==n?n._isProperty:void 0){var i=n.sampledBy(t,function(t,n){return[t,n]});return e.call(i,function(t){{var n=t[0];t[1]}return n}).map(function(t){var n=(t[0],t[1]);return n})}return n=U(n,r),e.call(t,n)},j=function(t){if(P.isFunction(t))return t;if(N(t)){var n=R(t);return function(t,r){return t[n](r)}}throw new E("not a function or a field key: "+t)},R=function(t){return t.slice(1)};k(u.prototype,{_isSome:!0,getOrElse:function(){return this.value},get:function(){return this.value},filter:function(t){return t(this.value)?new u(this.value):$},map:function(t){return new u(t(this.value))},forEach:function(t){return t(this.value)},isDefined:!0,toArray:function(){return[this.value]},inspect:function(){return"Some("+this.value+")"},toString:function(){return this.inspect()}});var $={_isNone:!0,getOrElse:function(t){return t},filter:function(){return $},map:function(){return $},forEach:function(){},isDefined:!1,toArray:function(){return[]},inspect:function(){return"None"},toString:function(){return this.inspect()}},Q=function(t){return("undefined"!=typeof t&&null!==t?t._isSome:void 0)||("undefined"!=typeof t&&null!==t?t._isNone:void 0)?t:new u(t)};w.noMore="<no-more>",w.more="<more>";var Z=0;o.prototype._isEvent=!0,o.prototype.isEvent=function(){return!0},o.prototype.isEnd=function(){return!1},o.prototype.isInitial=function(){return!1},o.prototype.isNext=function(){return!1},o.prototype.isError=function(){return!1},o.prototype.hasValue=function(){return!1},o.prototype.filter=function(){return!0},o.prototype.inspect=function(){return this.toString()},o.prototype.log=function(){return this.toString()},I(s,o),s.prototype.isNext=function(){return!0},s.prototype.hasValue=function(){return!0},s.prototype.value=function(){var t;return(null!=(t=this.valueF)?t._isNext:void 0)?(this.valueInternal=this.valueF.value(),this.valueF=void 0):this.valueF&&(this.valueInternal=this.valueF(),this.valueF=void 0),this.valueInternal},s.prototype.fmap=function(t){var n,r;return this.valueInternal?(r=this.valueInternal,this.apply(function(){return t(r)})):(n=this,this.apply(function(){return t(n.value())}))},s.prototype.apply=function(t){return new s(t)},s.prototype.filter=function(t){return t(this.value())},s.prototype.toString=function(){return P.toString(this.value())},s.prototype.log=function(){return this.value()},s.prototype._isNext=!0,I(a,s),a.prototype._isInitial=!0,a.prototype.isInitial=function(){return!0},a.prototype.isNext=function(){return!1},a.prototype.apply=function(t){return new a(t)},a.prototype.toNext=function(){return new s(this)},I(c,o),c.prototype.isEnd=function(){return!0},c.prototype.fmap=function(){return this},c.prototype.apply=function(){return this},c.prototype.toString=function(){return"<end>"},I(f,o),f.prototype.isError=function(){return!0},f.prototype.fmap=function(){return this},f.prototype.apply=function(){return this},f.prototype.toString=function(){return"<error> "+P.toString(this.error)},w.Event=o,w.Initial=a,w.Next=s,w.End=c,w.Error=f;var X=function(t){return new a(t,!0)},G=function(t){return new s(t,!0)},J=function(){return new c},K=function(t){return t&&t._isEvent?t:G(t)},Y=0,tt=function(){};k(h.prototype,{_isObservable:!0,subscribe:function(t){return x.wrappedSubscribe(this,t)},subscribeInternal:function(t){return this.dispatcher.subscribe(t)},onValue:function(){var t=B(arguments);return this.subscribe(function(n){return n.hasValue()?t(n.value()):void 0})},onValues:function(n){return this.onValue(function(r){return n.apply(void 0,t(r))})},onError:function(){var t=B(arguments);return this.subscribe(function(n){return n.isError()?t(n.error):void 0})},onEnd:function(){var t=B(arguments);return this.subscribe(function(n){return n.isEnd()?t():void 0})},name:function(t){return this._name=t,this},withDescription:function(){return this.desc=W.apply(void 0,arguments),this},toString:function(){return this._name?this._name:this.desc.toString()},internalDeps:function(){return this.initialDesc.deps()}}),h.prototype.assign=h.prototype.onValue,h.prototype.forEach=h.prototype.onValue,h.prototype.inspect=h.prototype.toString,w.Observable=h,k(l.prototype,{add:function(t){var n=this;if(!this.unsubscribed){var r=!1,e=D;this.starting.push(t);var i=function(){return n.unsubscribed?void 0:(r=!0,n.remove(e),P.remove(t,n.starting))};return e=t(this.unsubscribe,i),this.unsubscribed||r?e():this.subscriptions.push(e),P.remove(t,this.starting),e}},remove:function(t){return this.unsubscribed?void 0:void 0!==P.remove(t,this.subscriptions)?t():void 0},unsubscribe:function(){if(!this.unsubscribed){this.unsubscribed=!0;for(var t=this.subscriptions,n=0;n<t.length;n++)t[n]();return this.subscriptions=[],this.starting=[],[]}},count:function(){return this.unsubscribed?0:this.subscriptions.length+this.starting.length},empty:function(){return 0===this.count()}}),w.CompositeUnsubscribe=l,p.prototype.hasSubscribers=function(){return this.subscriptions.length>0},p.prototype.removeSub=function(t){return this.subscriptions=P.without(t,this.subscriptions),this.subscriptions},p.prototype.push=function(t){return t.isEnd()&&(this.ended=!0),x.inTransaction(t,this,this.pushIt,[t])},p.prototype.pushToSubscriptions=function(t){try{for(var n=this.subscriptions,r=n.length,e=0;r>e;e++){var i=n[e],u=i.sink(t);(u===w.noMore||t.isEnd())&&this.removeSub(i)}return!0}catch(o){throw this.pushing=!1,this.queue=[],o}},p.prototype.pushIt=function(t){if(this.pushing)return this.queue.push(t),w.more;if(t!==this.prevError){for(t.isError()&&(this.prevError=t),this.pushing=!0,this.pushToSubscriptions(t),this.pushing=!1;this.queue.length;)t=this.queue.shift(),this.push(t);return this.hasSubscribers()?w.more:(this.unsubscribeFromSource(),w.noMore)}},p.prototype.handleEvent=function(t){return this._handleEvent?this._handleEvent(t):this.push(t)},p.prototype.unsubscribeFromSource=function(){this.unsubSrc&&this.unsubSrc(),this.unsubSrc=void 0},p.prototype.subscribe=function(t){var n;return this.ended?(t(J()),D):(n={sink:t},this.subscriptions.push(n),1===this.subscriptions.length&&(this.unsubSrc=this._subscribe(this.handleEvent)),function(t){return function(){return t.removeSub(n),t.hasSubscribers()?void 0:t.unsubscribeFromSource()}}(this))},w.Dispatcher=p,I(v,h),k(v.prototype,{_isEventStream:!0,toProperty:function(t){var n=0===arguments.length?$:Q(function(){return t}),r=this.dispatcher,e=new w.Desc(this,"toProperty",[t]);return new y(e,function(t){var e=!1,i=!1,o=D,s=w.more,c=function(){return e?void 0:n.forEach(function(n){return e=!0,s=t(new a(n)),s===w.noMore?(o(),o=D,D):void 0})};return o=r.subscribe(function(r){return r.hasValue()?r.isInitial()&&!i?(n=new u(function(){return r.value()}),w.more):(r.isInitial()||c(),e=!0,n=new u(r),t(r)):(r.isEnd()&&(s=c()),s!==w.noMore?t(r):void 0)}),i=!0,c(),o})},toEventStream:function(){return this},withHandler:function(t){return new v(new w.Desc(this,"withHandler",[t]),this.dispatcher.subscribe,t)}}),w.EventStream=v,w.never=function(){return new v(W(w,"never"),function(t){return t(J()),D})},w.when=function(){if(0===arguments.length)return w.never();for(var r=arguments.length,e=[],i=[],u=0,o=[];r>u;){o[u]=arguments[u],o[u+1]=arguments[u+1];for(var s,a=P.toArray(arguments[u]),c=rt(arguments[u+1]),f={f:c,ixs:[]},h=!1,l=0;l<a.length;l++){s=a[l];var p=P.indexOf(e,s);h||(h=n.isTrigger(s)),0>p&&(e.push(s),p=e.length-1);for(var d,y=0;y<f.ixs.length;y++)d=f.ixs[y],d.index===p&&d.count++;f.ixs.push({index:p,count:1})}a.length>0&&i.push(f),u+=2}if(!e.length)return w.never();e=P.map(n.fromObservable,e);var m=P.any(e,function(t){return t.flatten})&&nt(P.map(function(t){return t.obs},e)),b=new w.Desc(w,"when",o),g=new v(b,function(n){var r=[],u=!1,o=function(t){for(var n,r=0;r<t.ixs.length;r++)if(n=t.ixs[r],!e[n.index].hasAtLeast(n.count))return!1;return!0},s=function(t){return!t.sync||t.ended},a=function(t){for(var n,r=0;r<t.ixs.length;r++)if(n=t.ixs[r],!e[n.index].mayHave(n.count))return!0},c=function(t){return!t.source.flatten},f=function(f){return function(h){var l=function(){return x.whenDoneWith(g,v)},p=function(){if(!(r.length>0))return w.more;for(var u,s=w.more,a=r.pop(),f=0;f<i.length;f++)if(u=i[f],o(u)){var h=function(){for(var t,n=[],r=0;r<u.ixs.length;r++)t=u.ixs[r],n.push(e[t.index].consume());return n}();return s=n(a.e.apply(function(){var n,r=function(){for(var t,n=[],r=0;r<h.length;r++)t=h[r],n.push(t.value());return n}();return(n=u).f.apply(n,t(r))})),r.length&&(r=P.filter(c,r)),s===w.noMore?s:p()}},v=function(){var t=p();return u&&(P.all(e,s)||P.all(i,a))&&(t=w.noMore,n(J())),t===w.noMore&&h(),t};return f.subscribe(function(t){if(t.isEnd())u=!0,f.markEnded(),l();else if(t.isError())var e=n(t);else f.push(t),f.sync&&(r.push({source:f,e:t}),m||x.hasWaiters()?l():v());return e===w.noMore&&h(),e||w.more})}};return new w.CompositeUnsubscribe(function(){for(var t,n=[],r=0;r<e.length;r++)t=e[r],n.push(f(t));return n}()).unsubscribe});return g};var nt=function(t){var n=arguments.length<=1||void 0===arguments[1]?[]:arguments[1],r=function(t){if(P.contains(n,t))return!0;var e=t.internalDeps();return e.length?(n.push(t),P.any(e,r)):(n.push(t),!1)};return P.any(t,r)},rt=function(t){return P.isFunction(t)?t:P.always(t)};w.groupSimultaneous=function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];1===n.length&&O(n[0])&&(n=n[0]);var i=function(){for(var t,r=[],i=0;i<n.length;i++)t=n[i],r.push(new e(t));return r}();return T(new w.Desc(w,"groupSimultaneous",n),w.when(i,function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return n}))},I(d,p),k(d.prototype,{push:function(t){return t.isEnd()&&(this.propertyEnded=!0),t.hasValue()&&(this.current=new u(t),this.currentValueRootId=x.currentEventId()),p.prototype.push.call(this,t)},maybeSubSource:function(t,n){return n===w.noMore?D:this.propertyEnded?(t(J()),D):p.prototype.subscribe.call(this,t)},subscribe:function(t){var n=this,r=w.more;if(this.current.isDefined&&(this.hasSubscribers()||this.propertyEnded)){var e=x.currentEventId(),i=this.currentValueRootId;return!this.propertyEnded&&i&&e&&e!==i?(x.whenDoneWith(this.property,function(){return n.currentValueRootId===i?t(X(n.current.get().value())):void 0}),this.maybeSubSource(t,r)):(x.inTransaction(void 0,this,function(){return r=t(X(this.current.get().value()))},[]),this.maybeSubSource(t,r))}return this.maybeSubSource(t,r)}}),I(y,h),k(y.prototype,{_isProperty:!0,changes:function(){var t=this;return new v(new w.Desc(this,"changes",[]),function(n){return t.dispatcher.subscribe(function(t){return t.isInitial()?void 0:n(t)})})},withHandler:function(t){return new y(new w.Desc(this,"withHandler",[t]),this.dispatcher.subscribe,t)},toProperty:function(){return this},toEventStream:function(){var t=this;return new v(new w.Desc(this,"toEventStream",[]),function(n){return t.dispatcher.subscribe(function(t){return t.isInitial()&&(t=t.toNext()),n(t)})})}}),w.Property=y,w.constant=function(t){return new y(new w.Desc(w,"constant",[t]),function(n){return n(X(t)),n(J()),D})},w.fromBinder=function(t){var n=arguments.length<=1||void 0===arguments[1]?P.id:arguments[1],r=new w.Desc(w,"fromBinder",[t,n]);return new v(r,function(r){var e=!1,i=!1,u=function(){return e?void 0:"undefined"!=typeof o&&null!==o?(o(),e=!0):i=!0},o=t(function(){for(var t,e=arguments.length,i=Array(e),o=0;e>o;o++)i[o]=arguments[o];var s=n.apply(this,i);O(s)&&(null!=(t=P.last(s))?t._isEvent:void 0)||(s=[s]);for(var a,c=w.more,f=0;f<s.length;f++)if(a=s[f],c=r(a=K(a)),c===w.noMore||a.isEnd())return u(),c;return c});return i&&u(),u})},w.Observable.prototype.map=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;n>e;e++)r[e-1]=arguments[e];return z(this,t,r,function(t){return T(new w.Desc(this,"map",[t]),this.withHandler(function(n){return this.push(n.fmap(t))}))})};var et=function(t){return O(t[0])?t[0]:Array.prototype.slice.call(t)},it=function(t){return P.isFunction(t[0])?[et(Array.prototype.slice.call(t,1)),t[0]]:[et(Array.prototype.slice.call(t,0,t.length-1)),P.last(t)]};w.combineAsArray=function(){for(var t,r=et(arguments),e=0;e<r.length;e++)t=r[e],M(t)||(r[e]=w.constant(t));if(r.length){var i=function(){for(var t,e=[],i=0;i<r.length;i++)t=r[i],e.push(new n(t,!0));return e}();return T(new w.Desc(w,"combineAsArray",r),w.when(i,function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return n}).toProperty())}return w.constant([])},w.onValues=function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return w.combineAsArray(n.slice(0,n.length-1)).onValues(n[n.length-1])},w.combineWith=function(){var n=it(arguments),r=n[0],e=n[1],i=new w.Desc(w,"combineWith",[e].concat(t(r)));return T(i,w.combineAsArray(r).map(function(n){return e.apply(void 0,t(n))}))},w.Observable.prototype.combine=function(t,n){var r=j(n),e=new w.Desc(this,"combine",[t,n]);return T(e,w.combineAsArray(this,t).map(function(t){return r(t[0],t[1])}))},w.Observable.prototype.withStateMachine=function(t,n){var r=t,e=new w.Desc(this,"withStateMachine",[t,n]);return T(e,this.withHandler(function(t){var e=n(r,t),i=e[0],u=e[1];r=i;for(var o,s=w.more,a=0;a<u.length;a++)if(o=u[a],s=this.push(o),s===w.noMore)return s;return s}))};var ut=function(t,n){return t===n},ot=function(t){return"undefined"!=typeof t&&null!==t?t._isNone:!1};w.Observable.prototype.skipDuplicates=function(){var t=arguments.length<=0||void 0===arguments[0]?ut:arguments[0],n=new w.Desc(this,"skipDuplicates",[]);return T(n,this.withStateMachine($,function(n,r){return r.hasValue()?r.isInitial()||ot(n)||!t(n.get(),r.value())?[new u(r.value()),[r]]:[n,[]]:[n,[r]]}))},w.Observable.prototype.awaiting=function(t){var n=new w.Desc(this,"awaiting",[t]);return T(n,w.groupSimultaneous(this,t).map(function(t){return 0===t[1].length}).toProperty(!1).skipDuplicates())},w.Observable.prototype.not=function(){return T(new w.Desc(this,"not",[]),this.map(function(t){return!t}))},w.Property.prototype.and=function(t){return T(new w.Desc(this,"and",[t]),this.combine(t,function(t,n){return t&&n}))},w.Property.prototype.or=function(t){return T(new w.Desc(this,"or",[t]),this.combine(t,function(t,n){return t||n}))},w.scheduler={setTimeout:function(t,n){return setTimeout(t,n)},setInterval:function(t,n){return setInterval(t,n)},clearInterval:function(t){return clearInterval(t)},clearTimeout:function(t){return clearTimeout(t)},now:function(){return(new Date).getTime()}},w.EventStream.prototype.bufferWithTime=function(t){return T(new w.Desc(this,"bufferWithTime",[t]),this.bufferWithTimeOrCount(t,Number.MAX_VALUE))},w.EventStream.prototype.bufferWithCount=function(t){return T(new w.Desc(this,"bufferWithCount",[t]),this.bufferWithTimeOrCount(void 0,t))},w.EventStream.prototype.bufferWithTimeOrCount=function(t,n){var r=function(r){return r.values.length===n?r.flush():void 0!==t?r.schedule():void 0},e=new w.Desc(this,"bufferWithTimeOrCount",[t,n]);return T(e,this.buffer(t,r,r))},w.EventStream.prototype.buffer=function(t){var n=arguments.length<=1||void 0===arguments[1]?D:arguments[1],r=arguments.length<=2||void 0===arguments[2]?D:arguments[2],e={scheduled:null,end:void 0,values:[],flush:function(){if(this.scheduled&&(w.scheduler.clearTimeout(this.scheduled),this.scheduled=null),this.values.length>0){var t=this.values;this.values=[];var n=this.push(G(t));if(null!=this.end)return this.push(this.end);if(n!==w.noMore)return r(this)}else if(null!=this.end)return this.push(this.end)},schedule:function(){var n=this;return this.scheduled?void 0:this.scheduled=t(function(){return n.flush()})}},i=w.more;if(!P.isFunction(t)){var u=t;t=function(t){return w.scheduler.setTimeout(t,u)}}return T(new w.Desc(this,"buffer",[]),this.withHandler(function(t){var r=this;return e.push=function(t){return r.push(t)},t.isError()?i=this.push(t):t.isEnd()?(e.end=t,e.scheduled||e.flush()):(e.values.push(t.value()),n(e)),i}))},w.Observable.prototype.filter=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;n>e;e++)r[e-1]=arguments[e];return z(this,t,r,function(t){return T(new w.Desc(this,"filter",[t]),this.withHandler(function(n){return n.filter(t)?this.push(n):w.more}))})},w.once=function(t){return new v(new i(w,"once",[t]),function(n){return n(K(t)),n(J()),D})},w.EventStream.prototype.concat=function(t){var n=this;return new v(new w.Desc(n,"concat",[t]),function(r){var e=D,i=n.dispatcher.subscribe(function(n){return n.isEnd()?e=t.dispatcher.subscribe(r):r(n)});return function(){return i(),e()}})},w.Observable.prototype.flatMap=function(){return ct(this,st(arguments))},w.Observable.prototype.flatMapFirst=function(){return ct(this,st(arguments),!0)};var st=function(t){return 1===t.length&&M(t[0])?P.always(t[0]):B(t)},at=function(t){return M(t)?t:w.once(t)},ct=function(t,n,r,e){var i=[t],u=[],o=new w.Desc(t,"flatMap"+(r?"First":""),[n]),s=new v(o,function(i){var o=new l,s=[],a=function(t){var r=at(n(t.value()));return u.push(r),o.add(function(t,n){return r.dispatcher.subscribe(function(e){if(e.isEnd())return P.remove(r,u),c(),f(n),w.noMore;("undefined"!=typeof e&&null!==e?e._isInitial:void 0)&&(e=e.toNext());var o=i(e);return o===w.noMore&&t(),o})})},c=function(){var t=s.shift();return t?a(t):void 0},f=function(t){return t(),o.empty()?i(J()):void 0};return o.add(function(n,u){return t.dispatcher.subscribe(function(t){return t.isEnd()?f(u):t.isError()?i(t):r&&o.count()>1?w.more:o.unsubscribed?w.noMore:e&&o.count()>e?s.push(t):a(t)})}),o.unsubscribe});return s.internalDeps=function(){return u.length?i.concat(u):i},s};w.Observable.prototype.flatMapWithConcurrencyLimit=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;n>e;e++)r[e-1]=arguments[e];var i=new w.Desc(this,"flatMapWithConcurrencyLimit",[t].concat(r));return T(i,ct(this,st(r),!1,t))},w.Observable.prototype.flatMapConcat=function(){var t=new w.Desc(this,"flatMapConcat",Array.prototype.slice.call(arguments,0));return T(t,this.flatMapWithConcurrencyLimit.apply(this,[1].concat(g.call(arguments))))},w.later=function(t,n){return T(new w.Desc(w,"later",[t,n]),w.fromBinder(function(r){var e=function(){return r([n,J()])},i=w.scheduler.setTimeout(e,t);return function(){return w.scheduler.clearTimeout(i)}}))},w.Observable.prototype.bufferingThrottle=function(t){var n=new w.Desc(this,"bufferingThrottle",[t]);return T(n,this.flatMapConcat(function(n){return w.once(n).concat(w.later(t).filter(!1))}))},w.Property.prototype.bufferingThrottle=function(){return w.Observable.prototype.bufferingThrottle.apply(this,arguments).toProperty()},I(m,v),k(m.prototype,{unsubAll:function(){for(var t,n=this.subscriptions,r=0;r<n.length;r++)t=n[r],"function"==typeof t.unsub&&t.unsub()},subscribeAll:function(t){if(this.ended)t(J());else{this.sink=t;for(var n,r=A(this.subscriptions),e=0;e<r.length;e++)n=r[e],this.subscribeInput(n)}return this.unsubAll},guardedSink:function(t){var n=this;return function(r){return r.isEnd()?(n.unsubscribeInput(t),w.noMore):n.sink(r)}},subscribeInput:function(t){return t.unsub=t.input.dispatcher.subscribe(this.guardedSink(t.input)),t.unsub},unsubscribeInput:function(t){for(var n,r=this.subscriptions,e=0;e<r.length;e++)if(n=r[e],n.input===t)return"function"==typeof n.unsub&&n.unsub(),void this.subscriptions.splice(e,1)},plug:function(t){var n=this;if(!this.ended){var r={input:t};return this.subscriptions.push(r),"undefined"!=typeof this.sink&&this.subscribeInput(r),function(){return n.unsubscribeInput(t)}}},end:function(){return this.ended=!0,this.unsubAll(),"function"==typeof this.sink?this.sink(J()):void 0},push:function(t){return this.ended||"function"!=typeof this.sink?void 0:this.sink(G(t))},error:function(t){return"function"==typeof this.sink?this.sink(new f(t)):void 0}}),w.Bus=m;var ft=function(n,r){return H(function(e){for(var i=F(r,[function(n,r){return e.apply(void 0,t(n).concat([r]))}]),u=arguments.length,o=Array(u>1?u-1:0),s=1;u>s;s++)o[s-1]=arguments[s];return T(new w.Desc(w,n,[e].concat(o)),w.combineAsArray(o).flatMap(i))})};w.fromCallback=ft("fromCallback",function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;n>e;e++)r[e-1]=arguments[e];return w.fromBinder(function(n){return U(t,r)(n),D},function(t){return[t,J()]})}),w.fromNodeCallback=ft("fromNodeCallback",function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;n>e;e++)r[e-1]=arguments[e];return w.fromBinder(function(n){return U(t,r)(n),D},function(t,n){return t?[new f(t),J()]:[n,J()]})}),w.combineTemplate=function(t){function n(t){return t[t.length-1]}function r(t,r,e){return n(t)[r]=e,e}function e(t,n){return function(e,i){return r(e,t,i[n])}}function i(t,n){return function(e){return r(e,t,n)}}function u(t){return O(t)?[]:{}}function o(t,n){return function(e){var i=u(n);return r(e,t,i),e.push(i)}}function s(t,n){if(M(n))return h.push(n),f.push(e(t,h.length-1));if(!n||n.constructor!=Object&&n.constructor!=Array)return f.push(i(t,n));var r=function(t){return t.pop()};return f.push(o(t,n)),c(n),f.push(r)}function a(n){for(var r,e=u(t),i=[e],o=0;o<f.length;o++)(r=f[o])(i,n);return e}function c(t){return P.each(t,s)}var f=[],h=[];return c(t),T(new w.Desc(w,"combineTemplate",[t]),w.combineAsArray(h).map(a))};var ht=function(t,n){var r=new v(W(t,"justInitValue"),function(n){var e=void 0,i=t.dispatcher.subscribe(function(t){return t.isEnd()||(e=t),w.noMore});return x.whenDoneWith(r,function(){return"undefined"!=typeof e&&null!==e&&n(e),n(J())}),i});return r.concat(n).toProperty()};w.Observable.prototype.mapEnd=function(){var t=B(arguments);return T(new w.Desc(this,"mapEnd",[t]),this.withHandler(function(n){return n.isEnd()?(this.push(G(t(n))),this.push(J()),w.noMore):this.push(n)}))},w.Observable.prototype.skipErrors=function(){return T(new w.Desc(this,"skipErrors",[]),this.withHandler(function(t){return t.isError()?w.more:this.push(t)}))},w.EventStream.prototype.takeUntil=function(t){var n={};return T(new w.Desc(this,"takeUntil",[t]),w.groupSimultaneous(this.mapEnd(n),t.skipErrors()).withHandler(function(t){if(t.hasValue()){var r=t.value(),e=r[0],i=r[1];if(i.length)return this.push(J());for(var u,o=w.more,s=0;s<e.length;s++)u=e[s],o=this.push(u===n?J():G(u));return o}return this.push(t)}))},w.Property.prototype.takeUntil=function(t){var n=this.changes().takeUntil(t);return T(new w.Desc(this,"takeUntil",[t]),ht(this,n))},w.Observable.prototype.flatMapLatest=function(){var t=st(arguments),n=this.toEventStream();return T(new w.Desc(this,"flatMapLatest",[t]),n.flatMap(function(r){return at(t(r)).takeUntil(n)}))},w.Property.prototype.delayChanges=function(t,n){return T(t,ht(this,n(this.changes())))},w.EventStream.prototype.delay=function(t){return T(new w.Desc(this,"delay",[t]),this.flatMap(function(n){return w.later(t,n)}))},w.Property.prototype.delay=function(t){return this.delayChanges(new w.Desc(this,"delay",[t]),function(n){return n.delay(t)})},w.EventStream.prototype.debounce=function(t){return T(new w.Desc(this,"debounce",[t]),this.flatMapLatest(function(n){return w.later(t,n)}))},w.Property.prototype.debounce=function(t){return this.delayChanges(new w.Desc(this,"debounce",[t]),function(n){return n.debounce(t)})},w.EventStream.prototype.debounceImmediate=function(t){return T(new w.Desc(this,"debounceImmediate",[t]),this.flatMapFirst(function(n){return w.once(n).concat(w.later(t).filter(!1))}))},w.Observable.prototype.decode=function(t){return T(new w.Desc(this,"decode",[t]),this.combine(w.combineTemplate(t),function(t,n){
return n[t]}))},w.Observable.prototype.scan=function(t,n){var r,e=this;n=j(n);var i=Q(t),o=!1,s=function(t){var s=!1,c=D,f=w.more,h=function(){return s?void 0:i.forEach(function(n){return s=o=!0,f=t(new a(function(){return n})),f===w.noMore?(c(),c=D):void 0})};return c=e.dispatcher.subscribe(function(r){if(r.hasValue()){if(o&&r.isInitial())return w.more;r.isInitial()||h(),s=o=!0;var e=i.getOrElse(void 0),a=n(e,r.value());return i=new u(a),t(r.apply(function(){return a}))}return r.isEnd()&&(f=h()),f!==w.noMore?t(r):void 0}),x.whenDoneWith(r,h),c};return r=new y(new w.Desc(this,"scan",[t,n]),s)},w.Observable.prototype.diff=function(t,n){return n=j(n),T(new w.Desc(this,"diff",[t,n]),this.scan([t],function(t,r){return[r,n(t[0],r)]}).filter(function(t){return 2===t.length}).map(function(t){return t[1]}))},w.Observable.prototype.doAction=function(){var t=B(arguments);return T(new w.Desc(this,"doAction",[t]),this.withHandler(function(n){return n.hasValue()&&t(n.value()),this.push(n)}))},w.Observable.prototype.doEnd=function(){var t=B(arguments);return T(new w.Desc(this,"doEnd",[t]),this.withHandler(function(n){return n.isEnd()&&t(),this.push(n)}))},w.Observable.prototype.doError=function(){var t=B(arguments);return T(new w.Desc(this,"doError",[t]),this.withHandler(function(n){return n.isError()&&t(n.error),this.push(n)}))},w.Observable.prototype.doLog=function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return T(new w.Desc(this,"doLog",n),this.withHandler(function(t){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log&&console.log.apply(console,n.concat([t.log()])),this.push(t)}))},w.Observable.prototype.endOnError=function(t){("undefined"==typeof t||null===t)&&(t=!0);for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;n>e;e++)r[e-1]=arguments[e];return z(this,t,r,function(t){return T(new w.Desc(this,"endOnError",[]),this.withHandler(function(n){return n.isError()&&t(n.error)?(this.push(n),this.push(J())):this.push(n)}))})},h.prototype.errors=function(){return T(new w.Desc(this,"errors",[]),this.filter(function(){return!1}))},w.Observable.prototype.take=function(t){return 0>=t?w.never():T(new w.Desc(this,"take",[t]),this.withHandler(function(n){return n.hasValue()?(t--,t>0?this.push(n):(0===t&&this.push(n),this.push(J()),w.noMore)):this.push(n)}))},w.Observable.prototype.first=function(){return T(new w.Desc(this,"first",[]),this.take(1))},w.Observable.prototype.mapError=function(){var t=B(arguments);return T(new w.Desc(this,"mapError",[t]),this.withHandler(function(n){return this.push(n.isError()?G(t(n.error)):n)}))},w.Observable.prototype.flatMapError=function(t){var n=new w.Desc(this,"flatMapError",[t]);return T(n,this.mapError(function(t){return new f(t)}).flatMap(function(n){return n instanceof f?t(n.error):w.once(n)}))},w.EventStream.prototype.sampledBy=function(t,n){return T(new w.Desc(this,"sampledBy",[t,n]),this.toProperty().sampledBy(t,n))},w.Property.prototype.sampledBy=function(t,r){var e=!1;"undefined"!=typeof r&&null!==r?r=j(r):(e=!0,r=function(t){return t.value()});var i=new n(this,!1,e),u=new n(t,!0,e),o=w.when([i,u],r),s=t._isProperty?o.toProperty():o;return T(new w.Desc(this,"sampledBy",[t,r]),s)},w.Property.prototype.sample=function(t){return T(new w.Desc(this,"sample",[t]),this.sampledBy(w.interval(t,{})))},w.Observable.prototype.map=function(t){if(t&&t._isProperty)return t.sampledBy(this,S);for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;n>e;e++)r[e-1]=arguments[e];return z(this,t,r,function(t){return T(new w.Desc(this,"map",[t]),this.withHandler(function(n){return this.push(n.fmap(t))}))})},w.Observable.prototype.fold=function(t,n){return T(new w.Desc(this,"fold",[t,n]),this.scan(t,n).sampledBy(this.filter(!1).mapEnd().toProperty()))},h.prototype.reduce=h.prototype.fold;var lt=[["addEventListener","removeEventListener"],["addListener","removeListener"],["on","off"],["bind","unbind"]],pt=function(t){for(var n,r=0;r<lt.length;r++){n=lt[r];var e=[t[n[0]],t[n[1]]];if(e[0]&&e[1])return e}for(var i=0;i<lt.length;i++){n=lt[i];var u=t[n[0]];if(u)return[u,function(){}]}throw new f("No suitable event methods in "+t)};w.fromEventTarget=function(t,n,r){var e=pt(t),i=e[0],u=e[1],o=new w.Desc(w,"fromEvent",[t,n]);return T(o,w.fromBinder(function(r){return i.call(t,n,r),function(){return u.call(t,n,r)}},r))},w.fromEvent=w.fromEventTarget,w.fromPoll=function(t,n){var r=new w.Desc(w,"fromPoll",[t,n]);return T(r,w.fromBinder(function(n){var r=w.scheduler.setInterval(n,t);return function(){return w.scheduler.clearInterval(r)}},n))},w.fromPromise=function(t,n){var r=arguments.length<=2||void 0===arguments[2]?b:arguments[2];return T(new w.Desc(w,"fromPromise",[t]),w.fromBinder(function(r){var e=t.then(r,function(t){return r(new f(t))});return e&&"function"==typeof e.done&&e.done(),n?function(){return"function"==typeof t.abort?t.abort():void 0}:function(){}},r))},w.Observable.prototype.groupBy=function(t){var n=arguments.length<=1||void 0===arguments[1]?w._.id:arguments[1],r={},e=this;return e.filter(function(n){return!r[t(n)]}).map(function(i){var u=t(i),o=e.filter(function(n){return t(n)===u}),s=w.once(i).concat(o),a=n(s,i).withHandler(function(t){return this.push(t),t.isEnd()?delete r[u]:void 0});return r[u]=a,a})},w.fromArray=function(t){if(t.length){var n=0;return new v(new w.Desc(w,"fromArray",[t]),function(r){var e=!1,i=w.more,u=!1,o=!1,s=function(){if(o=!0,!u){for(u=!0;o;)if(o=!1,i!==w.noMore&&!e){var a=t[n++];i=r(K(a)),i!==w.noMore&&(n===t.length?r(J()):x.afterTransaction(s))}return u=!1}};return s(),function(){return e=!0}})}return T(new w.Desc(w,"fromArray",t),w.never())},w.EventStream.prototype.holdWhen=function(t){var n=!1,r=[],e=this;return new v(new w.Desc(this,"holdWhen",[t]),function(i){var u=new l,o=!1,s=function(t){return"function"==typeof t&&t(),u.empty()&&o?i(J()):void 0};return u.add(function(e,u){return t.subscribeInternal(function(t){if(!t.hasValue())return t.isEnd()?s(u):i(t);if(n=t.value(),!n){var e=r;return r=[],function(){for(var t,n=[],r=0;r<e.length;r++)t=e[r],n.push(i(G(t)));return n}()}})}),u.add(function(t,u){return e.subscribeInternal(function(t){return n&&t.hasValue()?r.push(t.value()):t.isEnd()&&r.length?s(u):i(t)})}),o=!0,s(),u.unsubscribe})},w.interval=function(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return T(new w.Desc(w,"interval",[t,n]),w.fromPoll(t,function(){return G(n)}))},w.$={},w.$.asEventStream=function(t,n,r){var e=this;return P.isFunction(n)&&(r=n,n=void 0),T(new w.Desc(this.selector||this,"asEventStream",[t]),w.fromBinder(function(r){return e.on(t,n,r),function(){return e.off(t,n,r)}},r))},"undefined"!=typeof jQuery&&jQuery&&(jQuery.fn.asEventStream=w.$.asEventStream),"undefined"!=typeof Zepto&&Zepto&&(Zepto.fn.asEventStream=w.$.asEventStream),w.Observable.prototype.last=function(){var t;return T(new w.Desc(this,"last",[]),this.withHandler(function(n){return n.isEnd()?(t&&this.push(t),this.push(J()),w.noMore):void(t=n)}))},w.Observable.prototype.log=function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return this.subscribe(function(t){"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,n.concat([t.log()]))}),this},w.EventStream.prototype.merge=function(t){var n=this;return T(new w.Desc(n,"merge",[t]),w.mergeAll(this,t))},w.mergeAll=function(){var t=et(arguments);return t.length?new v(new w.Desc(w,"mergeAll",t),function(n){var r=0,e=function(e){return function(i){return e.dispatcher.subscribe(function(e){if(e.isEnd())return r++,r===t.length?n(J()):w.more;var u=n(e);return u===w.noMore&&i(),u})}},i=P.map(e,t);return new w.CompositeUnsubscribe(i).unsubscribe}):w.never()},w.repeatedly=function(t,n){var r=0;return T(new w.Desc(w,"repeatedly",[t,n]),w.fromPoll(t,function(){return n[r++%n.length]}))},w.repeat=function(t){var n=0;return w.fromBinder(function(r){function e(t){return t.isEnd()?u?i():u=!0:o=r(t)}function i(){var i;for(u=!0;u&&o!==w.noMore;)i=t(n++),u=!1,i?s=i.subscribeInternal(e):r(J());return u=!0}var u=!1,o=w.more,s=function(){};return i(),function(){return s()}})},w.retry=function(t){if(!P.isFunction(t.source))throw new E("'source' option has to be a function");var n=t.source,r=t.retries||0,e=t.maxRetries||r,i=t.delay||function(){return 0},u=t.isRetryable||function(){return!0},o=!1,s=null;return T(new w.Desc(w,"retry",[t]),w.repeat(function(){function t(){return n().endOnError().withHandler(function(t){return t.isError()?(s=t,u(s.error)&&r>0?void 0:(o=!0,this.push(t))):(t.hasValue()&&(s=null,o=!0),this.push(t))})}if(o)return null;if(s){var a={error:s.error,retriesDone:e-r},c=w.later(i(a)).filter(!1);return r-=1,c.concat(w.once().flatMap(t))}return t()}))},w.sequentially=function(t,n){var r=0;return T(new w.Desc(w,"sequentially",[t,n]),w.fromPoll(t,function(){var t=n[r++];return r<n.length?t:r===n.length?[t,J()]:J()}))},w.Observable.prototype.skip=function(t){return T(new w.Desc(this,"skip",[t]),this.withHandler(function(n){return n.hasValue()&&t>0?(t--,w.more):this.push(n)}))},w.EventStream.prototype.skipUntil=function(t){var n=t.take(1).map(!0).toProperty(!1);return T(new w.Desc(this,"skipUntil",[t]),this.filter(n))},w.EventStream.prototype.skipWhile=function(t){for(var n=!1,r=arguments.length,e=Array(r>1?r-1:0),i=1;r>i;i++)e[i-1]=arguments[i];return z(this,t,e,function(t){return T(new w.Desc(this,"skipWhile",[t]),this.withHandler(function(r){return!n&&r.hasValue()&&t(r.value())?w.more:(r.hasValue()&&(n=!0),this.push(r))}))})},w.Observable.prototype.slidingWindow=function(t){var n=arguments.length<=1||void 0===arguments[1]?0:arguments[1];return T(new w.Desc(this,"slidingWindow",[t,n]),this.scan([],function(n,r){return n.concat([r]).slice(-t)}).filter(function(t){return t.length>=n}))};var vt=[],tt=function(t){if(vt.length&&!tt.running)try{tt.running=!0,vt.forEach(function(n){n(t)})}finally{delete tt.running}};w.spy=function(t){return vt.push(t)},w.Property.prototype.startWith=function(t){return T(new w.Desc(this,"startWith",[t]),this.scan(t,function(t,n){return n}))},w.EventStream.prototype.startWith=function(t){return T(new w.Desc(this,"startWith",[t]),w.once(t).concat(this))},w.Observable.prototype.takeWhile=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;n>e;e++)r[e-1]=arguments[e];return z(this,t,r,function(t){return T(new w.Desc(this,"takeWhile",[t]),this.withHandler(function(n){return n.filter(t)?this.push(n):(this.push(J()),w.noMore)}))})},w.EventStream.prototype.throttle=function(t){return T(new w.Desc(this,"throttle",[t]),this.bufferWithTime(t).map(function(t){return t[t.length-1]}))},w.Property.prototype.throttle=function(t){return this.delayChanges(new w.Desc(this,"throttle",[t]),function(n){return n.throttle(t)})},h.prototype.firstToPromise=function(t){var n=this;if("function"!=typeof t){if("function"!=typeof Promise)throw new E("There isn't default Promise, use shim or parameter");t=Promise}return new t(function(t,r){return n.subscribe(function(n){return n.hasValue()&&t(n.value()),n.isError()&&r(n.error),w.noMore})})},h.prototype.toPromise=function(t){return this.last().firstToPromise(t)},w["try"]=function(t){return function(n){try{return w.once(t(n))}catch(r){return new w.Error(r)}}},w.update=function(n){function r(n){return function(){for(var r=arguments.length,e=Array(r),i=0;r>i;i++)e[i]=arguments[i];return function(r){return n.apply(void 0,t([r].concat(e)))}}}for(var e=arguments.length,i=Array(e>1?e-1:0),u=1;e>u;u++)i[u-1]=arguments[u];for(var o=i.length-1;o>0;)i[o]instanceof Function||(i[o]=P.always(i[o])),i[o]=r(i[o]),o-=2;return T(new w.Desc(w,"update",[n].concat(i)),w.when.apply(w,i).scan(n,function(t,n){return n(t)}))},w.zipAsArray=function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];var e=et(n);return T(new w.Desc(w,"zipAsArray",e),w.zipWith(e,function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return n}))},w.zipWith=function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];var e=it(n),i=e[0],u=e[1];return i=P.map(function(t){return t.toEventStream()},i),T(new w.Desc(w,"zipWith",[u].concat(i)),w.when(i,u))},w.Observable.prototype.zip=function(t,n){return T(new w.Desc(this,"zip",[t]),w.zipWith([this,t],n||Array))},"undefined"!=typeof define&&null!==define&&null!=define.amd?(define([],function(){return w}),"undefined"!=typeof this&&null!==this&&(this.Bacon=w)):"undefined"!=typeof module&&null!==module&&null!=module.exports?(module.exports=w,w.Bacon=w):this.Bacon=w}).call(this);
(function(){function t(t,n){var r=arguments.length<=2||void 0===arguments[2]?!1:arguments[2];this.obs=t,this.sync=n,this.lazy=r,this.queue=[]}function n(){t.apply(this,arguments)}function r(n){t.call(this,n,!0)}function e(t,n,r){this.context=t,this.method=n,this.args=r}function i(t){this.value=t}function u(){this.id=++Q}function o(t,n){return this instanceof o?(u.call(this),void(!n&&I.isFunction(t)||(null!=t?t._isNext:void 0)?(this.valueF=t,this.valueInternal=void 0):(this.valueF=void 0,this.valueInternal=t))):new o(t,n)}function s(t,n){return this instanceof s?void o.call(this,t,n):new s(t,n)}function a(){return this instanceof a?void u.call(this):new a}function c(t){return this instanceof c?(this.error=t,void u.call(this)):new c(t)}function f(t){this.desc=t,this.id=++K,this.initialDesc=this.desc}function h(){var t=arguments.length<=0||void 0===arguments[0]?[]:arguments[0];this.unsubscribe=I.bind(this.unsubscribe,this),this.unsubscribed=!1,this.subscriptions=[],this.starting=[];for(var n,r=0;r<t.length;r++)n=t[r],this.add(n)}function l(t,n){this._subscribe=t,this._handleEvent=n,this.subscribe=I.bind(this.subscribe,this),this.handleEvent=I.bind(this.handleEvent,this),this.pushing=!1,this.ended=!1,this.prevError=void 0,this.unsubSrc=void 0,this.subscriptions=[],this.queue=[]}function p(t,n,r){return this instanceof p?(I.isFunction(t)&&(r=n,n=t,t=e.empty),f.call(this,t),this.dispatcher=new l(n,r),void Y(this)):new p(t,n,r)}function v(t,n,r){l.call(this,n,r),this.property=t,this.subscribe=I.bind(this.subscribe,this),this.current=R,this.currentValueRootId=void 0,this.propertyEnded=!1}function d(t,n,r){f.call(this,t),this.dispatcher=new v(this,n,r),Y(this)}function y(){return this instanceof y?(this.unsubAll=I.bind(this.unsubAll,this),this.subscribeAll=I.bind(this.subscribeAll,this),this.guardedSink=I.bind(this.guardedSink,this),this.sink=void 0,this.subscriptions=[],this.ended=!1,void p.call(this,new g.Desc(g,"Bus",[]),this.subscribeAll)):new y}function m(t){return[t,G()]}var b=Array.prototype.slice,g={toString:function(){return"Bacon"}};g.version="0.7.83";var w=("undefined"!=typeof global&&null!==global?global:this).Error,E=function(){},D=function(t){return t},S=function(t){return t.slice(0)},A=function(t){return t instanceof Array},O=function(t){return t&&t._isObservable},M=function(t){for(var n=arguments.length,r=1;n>1?n>r:r>n;n>1?r++:r--)for(var e in arguments[r])t[e]=arguments[r][e];return t},k=function(t,n){var r={}.hasOwnProperty,e=function(){};e.prototype=n.prototype,t.prototype=new e;for(var i in n)r.call(n,i)&&(t[i]=n[i]);return t},I={indexOf:function(){return Array.prototype.indexOf?function(t,n){return t.indexOf(n)}:function(t,n){for(var r,e=0;e<t.length;e++)if(r=t[e],n===r)return e;return-1}}(),indexWhere:function(t,n){for(var r,e=0;e<t.length;e++)if(r=t[e],n(r))return e;return-1},head:function(t){return t[0]},always:function(t){return function(){return t}},negate:function(t){return function(n){return!t(n)}},empty:function(t){return 0===t.length},tail:function(t){return t.slice(1,t.length)},filter:function(t,n){for(var r,e=[],i=0;i<n.length;i++)r=n[i],t(r)&&e.push(r);return e},map:function(t,n){return function(){for(var r,e=[],i=0;i<n.length;i++)r=n[i],e.push(t(r));return e}()},each:function(t,n){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var e=t[r];n(r,e)}},toArray:function(t){return A(t)?t:[t]},contains:function(t,n){return-1!==I.indexOf(t,n)},id:function(t){return t},last:function(t){return t[t.length-1]},all:function(t){for(var n,r=arguments.length<=1||void 0===arguments[1]?I.id:arguments[1],e=0;e<t.length;e++)if(n=t[e],!r(n))return!1;return!0},any:function(t){for(var n,r=arguments.length<=1||void 0===arguments[1]?I.id:arguments[1],e=0;e<t.length;e++)if(n=t[e],r(n))return!0;return!1},without:function(t,n){return I.filter(function(n){return n!==t},n)},remove:function(t,n){var r=I.indexOf(n,t);return r>=0?n.splice(r,1):void 0},fold:function(t,n,r){for(var e,i=0;i<t.length;i++)e=t[i],n=r(n,e);return n},flatMap:function(t,n){return I.fold(n,[],function(n,r){return n.concat(t(r))})},cached:function(t){var n=R;return function(){return("undefined"!=typeof n&&null!==n?n._isNone:void 0)&&(n=t(),t=void 0),n}},bind:function(t,n){return function(){return t.apply(n,arguments)}},isFunction:function(t){return"function"==typeof t},toString:function(t){var n,r,e,i={}.hasOwnProperty;try{return P++,null==t?"undefined":I.isFunction(t)?"function":A(t)?P>5?"[..]":"["+I.map(I.toString,t).toString()+"]":null!=(null!=t?t.toString:void 0)&&t.toString!==Object.prototype.toString?t.toString():"object"==typeof t?P>5?"{..}":(n=function(){var n=[];for(r in t)i.call(t,r)&&(e=function(){var n;try{return t[r]}catch(n){return n}}(),n.push(I.toString(r)+":"+I.toString(e)));return n}(),"{"+n+"}"):t}finally{P--}}},P=0;g._=I;var _=g.UpdateBarrier=function(){var t,n=[],r={},e=[],i=0,u={},o=function(n){return t?e.push(n):n()},s=function(e,i){if(t){var u=r[e.id];return"undefined"==typeof u||null===u?(u=r[e.id]=[i],n.push(e)):u.push(i)}return i()},a=function(){for(;n.length>0;)c(0,!0);u={}},c=function(t,e){var i=n[t],u=i.id,o=r[u];n.splice(t,1),delete r[u],e&&n.length>0&&f(i);for(var s,a=0;a<o.length;a++)(s=o[a])()},f=function(t){if(!u[t.id]){for(var e,i=t.internalDeps(),o=0;o<i.length;o++)if(e=i[o],f(e),r[e.id]){var s=I.indexOf(n,e);c(s,!1)}u[t.id]=!0}},h=function(n,r,u,o){if(t)return u.apply(r,o);t=n;try{var s=u.apply(r,o);a()}finally{for(t=void 0;i<e.length;){var c=e[i];i++,c()}i=0,e=[]}return s},l=function(){return t?t.id:void 0},p=function(t,n){var r=!1,e=!1,i=function(){return e=!0},u=function(){return r=!0,i()};return i=t.dispatcher.subscribe(function(t){return o(function(){if(!r){var e=n(t);if(e===g.noMore)return u()}})}),e&&i(),u},v=function(){return n.length>0};return{whenDoneWith:s,hasWaiters:v,inTransaction:h,currentEventId:l,wrappedSubscribe:p,afterTransaction:o}}();M(t.prototype,{_isSource:!0,subscribe:function(t){return this.obs.dispatcher.subscribe(t)},toString:function(){return this.obs.toString()},markEnded:function(){return this.ended=!0,!0},consume:function(){return this.lazy?{value:I.always(this.queue[0])}:this.queue[0]},push:function(t){return this.queue=[t],[t]},mayHave:function(){return!0},hasAtLeast:function(){return this.queue.length},flatten:!0}),k(n,t),M(n.prototype,{consume:function(){return this.queue.shift()},push:function(t){return this.queue.push(t)},mayHave:function(t){return!this.ended||this.queue.length>=t},hasAtLeast:function(t){return this.queue.length>=t},flatten:!1}),k(r,t),M(r.prototype,{consume:function(){var t=this.queue;return this.queue=[],{value:function(){return t}}},push:function(t){return this.queue.push(t.value())},hasAtLeast:function(){return!0}}),t.isTrigger=function(t){return(null!=t?t._isSource:void 0)?t.sync:null!=t?t._isEventStream:void 0},t.fromObservable=function(r){return(null!=r?r._isSource:void 0)?r:(null!=r?r._isProperty:void 0)?new t(r,!1):new n(r,!0)},M(e.prototype,{_isDesc:!0,deps:function(){return this.cached||(this.cached=T([this.context].concat(this.args))),this.cached},toString:function(){return I.toString(this.context)+"."+I.toString(this.method)+"("+I.map(I.toString,this.args)+")"}});var x=function(t,n){var r=t||n;if(r&&r._isDesc)return t||n;for(var i=arguments.length,u=Array(i>2?i-2:0),o=2;i>o;o++)u[o-2]=arguments[o];return new e(t,n,u)},W=function(t,n){return n.desc=t,n},T=function(t){return A(t)?I.flatMap(T,t):O(t)?[t]:("undefined"!=typeof t&&null!==t?t._isSource:void 0)?[t.obs]:[]};g.Desc=e,g.Desc.empty=new g.Desc("","",[]);var V=function(t){return function(n){for(var r=arguments.length,e=Array(r>1?r-1:0),i=1;r>i;i++)e[i-1]=arguments[i];if("object"==typeof n&&e.length){var u=n,o=e[0];n=function(){return u[o].apply(u,arguments)},e=e.slice(1)}return t.apply(void 0,[n].concat(e))}},H=function(t){return t=Array.prototype.slice.call(t),N.apply(void 0,t)},B=function(t,n){return function(){for(var r=arguments.length,e=Array(r),i=0;r>i;i++)e[i]=arguments[i];return t.apply(void 0,n.concat(e))}},F=function(t){return function(n){return function(r){if("undefined"!=typeof r&&null!==r){var e=r[n];return I.isFunction(e)?e.apply(r,t):e}}}},C=function(t,n){var r=t.slice(1).split("."),e=I.map(F(n),r);return function(t){for(var n,r=0;r<e.length;r++)n=e[r],t=n(t);return t}},q=function(t){return"string"==typeof t&&t.length>1&&"."===t.charAt(0)},N=V(function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;n>e;e++)r[e-1]=arguments[e];return I.isFunction(t)?r.length?B(t,r):t:q(t)?C(t,r):I.always(t)}),L=function(t,n){return N.apply(void 0,[t].concat(n))},U=function(t,n,r,e){if("undefined"!=typeof n&&null!==n?n._isProperty:void 0){var i=n.sampledBy(t,function(t,n){return[t,n]});return e.call(i,function(t){{var n=t[0];t[1]}return n}).map(function(t){var n=(t[0],t[1]);return n})}return n=L(n,r),e.call(t,n)},z=function(t){if(I.isFunction(t))return t;if(q(t)){var n=j(t);return function(t,r){return t[n](r)}}throw new w("not a function or a field key: "+t)},j=function(t){return t.slice(1)};M(i.prototype,{_isSome:!0,getOrElse:function(){return this.value},get:function(){return this.value},filter:function(t){return t(this.value)?new i(this.value):R},map:function(t){return new i(t(this.value))},forEach:function(t){return t(this.value)},isDefined:!0,toArray:function(){return[this.value]},inspect:function(){return"Some("+this.value+")"},toString:function(){return this.inspect()}});var R={_isNone:!0,getOrElse:function(t){return t},filter:function(){return R},map:function(){return R},forEach:function(){},isDefined:!1,toArray:function(){return[]},inspect:function(){return"None"},toString:function(){return this.inspect()}},$=function(t){return("undefined"!=typeof t&&null!==t?t._isSome:void 0)||("undefined"!=typeof t&&null!==t?t._isNone:void 0)?t:new i(t)};g.noMore="<no-more>",g.more="<more>";var Q=0;u.prototype._isEvent=!0,u.prototype.isEvent=function(){return!0},u.prototype.isEnd=function(){return!1},u.prototype.isInitial=function(){return!1},u.prototype.isNext=function(){return!1},u.prototype.isError=function(){return!1},u.prototype.hasValue=function(){return!1},u.prototype.filter=function(){return!0},u.prototype.inspect=function(){return this.toString()},u.prototype.log=function(){return this.toString()},k(o,u),o.prototype.isNext=function(){return!0},o.prototype.hasValue=function(){return!0},o.prototype.value=function(){var t;return(null!=(t=this.valueF)?t._isNext:void 0)?(this.valueInternal=this.valueF.value(),this.valueF=void 0):this.valueF&&(this.valueInternal=this.valueF(),this.valueF=void 0),this.valueInternal},o.prototype.fmap=function(t){var n,r;return this.valueInternal?(r=this.valueInternal,this.apply(function(){return t(r)})):(n=this,this.apply(function(){return t(n.value())}))},o.prototype.apply=function(t){return new o(t)},o.prototype.filter=function(t){return t(this.value())},o.prototype.toString=function(){return I.toString(this.value())},o.prototype.log=function(){return this.value()},o.prototype._isNext=!0,k(s,o),s.prototype._isInitial=!0,s.prototype.isInitial=function(){return!0},s.prototype.isNext=function(){return!1},s.prototype.apply=function(t){return new s(t)},s.prototype.toNext=function(){return new o(this)},k(a,u),a.prototype.isEnd=function(){return!0},a.prototype.fmap=function(){return this},a.prototype.apply=function(){return this},a.prototype.toString=function(){return"<end>"},k(c,u),c.prototype.isError=function(){return!0},c.prototype.fmap=function(){return this},c.prototype.apply=function(){return this},c.prototype.toString=function(){return"<error> "+I.toString(this.error)},g.Event=u,g.Initial=s,g.Next=o,g.End=a,g.Error=c;var Z=function(t){return new s(t,!0)},X=function(t){return new o(t,!0)},G=function(){return new a},J=function(t){return t&&t._isEvent?t:X(t)},K=0,Y=function(){};M(f.prototype,{_isObservable:!0,subscribe:function(t){return _.wrappedSubscribe(this,t)},subscribeInternal:function(t){return this.dispatcher.subscribe(t)},onValue:function(){var t=H(arguments);return this.subscribe(function(n){return n.hasValue()?t(n.value()):void 0})},onValues:function(t){return this.onValue(function(n){return t.apply(void 0,n)})},onError:function(){var t=H(arguments);return this.subscribe(function(n){return n.isError()?t(n.error):void 0})},onEnd:function(){var t=H(arguments);return this.subscribe(function(n){return n.isEnd()?t():void 0})},name:function(t){return this._name=t,this},withDescription:function(){return this.desc=x.apply(void 0,arguments),this},toString:function(){return this._name?this._name:this.desc.toString()},internalDeps:function(){return this.initialDesc.deps()}}),f.prototype.assign=f.prototype.onValue,f.prototype.forEach=f.prototype.onValue,f.prototype.inspect=f.prototype.toString,g.Observable=f,M(h.prototype,{add:function(t){var n=this;if(!this.unsubscribed){var r=!1,e=E;this.starting.push(t);var i=function(){return n.unsubscribed?void 0:(r=!0,n.remove(e),I.remove(t,n.starting))};return e=t(this.unsubscribe,i),this.unsubscribed||r?e():this.subscriptions.push(e),I.remove(t,this.starting),e}},remove:function(t){return this.unsubscribed?void 0:void 0!==I.remove(t,this.subscriptions)?t():void 0},unsubscribe:function(){if(!this.unsubscribed){this.unsubscribed=!0;for(var t=this.subscriptions,n=0;n<t.length;n++)t[n]();return this.subscriptions=[],this.starting=[],[]}},count:function(){return this.unsubscribed?0:this.subscriptions.length+this.starting.length},empty:function(){return 0===this.count()}}),g.CompositeUnsubscribe=h,l.prototype.hasSubscribers=function(){return this.subscriptions.length>0},l.prototype.removeSub=function(t){return this.subscriptions=I.without(t,this.subscriptions),this.subscriptions},l.prototype.push=function(t){return t.isEnd()&&(this.ended=!0),_.inTransaction(t,this,this.pushIt,[t])},l.prototype.pushToSubscriptions=function(t){try{for(var n=this.subscriptions,r=n.length,e=0;r>e;e++){var i=n[e],u=i.sink(t);(u===g.noMore||t.isEnd())&&this.removeSub(i)}return!0}catch(o){throw this.pushing=!1,this.queue=[],o}},l.prototype.pushIt=function(t){if(this.pushing)return this.queue.push(t),g.more;if(t!==this.prevError){for(t.isError()&&(this.prevError=t),this.pushing=!0,this.pushToSubscriptions(t),this.pushing=!1;this.queue.length;)t=this.queue.shift(),this.push(t);return this.hasSubscribers()?g.more:(this.unsubscribeFromSource(),g.noMore)}},l.prototype.handleEvent=function(t){return this._handleEvent?this._handleEvent(t):this.push(t)},l.prototype.unsubscribeFromSource=function(){this.unsubSrc&&this.unsubSrc(),this.unsubSrc=void 0},l.prototype.subscribe=function(t){var n;return this.ended?(t(G()),E):(n={sink:t},this.subscriptions.push(n),1===this.subscriptions.length&&(this.unsubSrc=this._subscribe(this.handleEvent)),function(t){return function(){return t.removeSub(n),t.hasSubscribers()?void 0:t.unsubscribeFromSource()}}(this))},g.Dispatcher=l,k(p,f),M(p.prototype,{_isEventStream:!0,toProperty:function(t){var n=0===arguments.length?R:$(function(){return t}),r=this.dispatcher,e=new g.Desc(this,"toProperty",[t]);return new d(e,function(t){var e=!1,u=!1,o=E,a=g.more,c=function(){return e?void 0:n.forEach(function(n){return e=!0,a=t(new s(n)),a===g.noMore?(o(),o=E,E):void 0})};return o=r.subscribe(function(r){return r.hasValue()?r.isInitial()&&!u?(n=new i(function(){return r.value()}),g.more):(r.isInitial()||c(),e=!0,n=new i(r),t(r)):(r.isEnd()&&(a=c()),a!==g.noMore?t(r):void 0)}),u=!0,c(),o})},toEventStream:function(){return this},withHandler:function(t){return new p(new g.Desc(this,"withHandler",[t]),this.dispatcher.subscribe,t)}}),g.EventStream=p,g.never=function(){return new p(x(g,"never"),function(t){return t(G()),E})},g.when=function(){if(0===arguments.length)return g.never();for(var n=arguments.length,r=[],e=[],i=0,u=[];n>i;){u[i]=arguments[i],u[i+1]=arguments[i+1];for(var o,s=I.toArray(arguments[i]),a=nn(arguments[i+1]),c={f:a,ixs:[]},f=!1,h=0;h<s.length;h++){o=s[h];var l=I.indexOf(r,o);f||(f=t.isTrigger(o)),0>l&&(r.push(o),l=r.length-1);for(var v,d=0;d<c.ixs.length;d++)v=c.ixs[d],v.index===l&&v.count++;c.ixs.push({index:l,count:1})}s.length>0&&e.push(c),i+=2}if(!r.length)return g.never();r=I.map(t.fromObservable,r);var y=I.any(r,function(t){return t.flatten})&&tn(I.map(function(t){return t.obs},r)),m=new g.Desc(g,"when",u),b=new p(m,function(t){var n=[],i=!1,u=function(t){for(var n,e=0;e<t.ixs.length;e++)if(n=t.ixs[e],!r[n.index].hasAtLeast(n.count))return!1;return!0},o=function(t){return!t.sync||t.ended},s=function(t){for(var n,e=0;e<t.ixs.length;e++)if(n=t.ixs[e],!r[n.index].mayHave(n.count))return!0},a=function(t){return!t.source.flatten},c=function(c){return function(f){var h=function(){return _.whenDoneWith(b,p)},l=function(){if(!(n.length>0))return g.more;for(var i,o=g.more,s=n.pop(),c=0;c<e.length;c++)if(i=e[c],u(i)){var f=function(){for(var t,n=[],e=0;e<i.ixs.length;e++)t=i.ixs[e],n.push(r[t.index].consume());return n}();return o=t(s.e.apply(function(){var t,n=function(){for(var t,n=[],r=0;r<f.length;r++)t=f[r],n.push(t.value());return n}();return(t=i).f.apply(t,n)})),n.length&&(n=I.filter(a,n)),o===g.noMore?o:l()}},p=function(){var n=l();return i&&(I.all(r,o)||I.all(e,s))&&(n=g.noMore,t(G())),n===g.noMore&&f(),n};return c.subscribe(function(r){if(r.isEnd())i=!0,c.markEnded(),h();else if(r.isError())var e=t(r);else c.push(r),c.sync&&(n.push({source:c,e:r}),y||_.hasWaiters()?h():p());return e===g.noMore&&f(),e||g.more})}};return new g.CompositeUnsubscribe(function(){for(var t,n=[],e=0;e<r.length;e++)t=r[e],n.push(c(t));return n}()).unsubscribe});return b};var tn=function(t){var n=arguments.length<=1||void 0===arguments[1]?[]:arguments[1],r=function(t){if(I.contains(n,t))return!0;var e=t.internalDeps();return e.length?(n.push(t),I.any(e,r)):(n.push(t),!1)};return I.any(t,r)},nn=function(t){return I.isFunction(t)?t:I.always(t)};g.groupSimultaneous=function(){for(var t=arguments.length,n=Array(t),e=0;t>e;e++)n[e]=arguments[e];1===n.length&&A(n[0])&&(n=n[0]);var i=function(){for(var t,e=[],i=0;i<n.length;i++)t=n[i],e.push(new r(t));return e}();return W(new g.Desc(g,"groupSimultaneous",n),g.when(i,function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return n}))},k(v,l),M(v.prototype,{push:function(t){return t.isEnd()&&(this.propertyEnded=!0),t.hasValue()&&(this.current=new i(t),this.currentValueRootId=_.currentEventId()),l.prototype.push.call(this,t)},maybeSubSource:function(t,n){return n===g.noMore?E:this.propertyEnded?(t(G()),E):l.prototype.subscribe.call(this,t)},subscribe:function(t){var n=this,r=g.more;if(this.current.isDefined&&(this.hasSubscribers()||this.propertyEnded)){var e=_.currentEventId(),i=this.currentValueRootId;return!this.propertyEnded&&i&&e&&e!==i?(_.whenDoneWith(this.property,function(){return n.currentValueRootId===i?t(Z(n.current.get().value())):void 0}),this.maybeSubSource(t,r)):(_.inTransaction(void 0,this,function(){return r=t(Z(this.current.get().value()))},[]),this.maybeSubSource(t,r))}return this.maybeSubSource(t,r)}}),k(d,f),M(d.prototype,{_isProperty:!0,changes:function(){var t=this;return new p(new g.Desc(this,"changes",[]),function(n){return t.dispatcher.subscribe(function(t){return t.isInitial()?void 0:n(t)})})},withHandler:function(t){return new d(new g.Desc(this,"withHandler",[t]),this.dispatcher.subscribe,t)},toProperty:function(){return this},toEventStream:function(){var t=this;return new p(new g.Desc(this,"toEventStream",[]),function(n){return t.dispatcher.subscribe(function(t){return t.isInitial()&&(t=t.toNext()),n(t)})})}}),g.Property=d,g.constant=function(t){return new d(new g.Desc(g,"constant",[t]),function(n){return n(Z(t)),n(G()),E})},g.fromBinder=function(t){var n=arguments.length<=1||void 0===arguments[1]?I.id:arguments[1],r=new g.Desc(g,"fromBinder",[t,n]);return new p(r,function(r){var e=!1,i=!1,u=function(){return e?void 0:"undefined"!=typeof o&&null!==o?(o(),e=!0):i=!0},o=t(function(){for(var t,e=arguments.length,i=Array(e),o=0;e>o;o++)i[o]=arguments[o];var s=n.apply(this,i);A(s)&&(null!=(t=I.last(s))?t._isEvent:void 0)||(s=[s]);for(var a,c=g.more,f=0;f<s.length;f++)if(a=s[f],c=r(a=J(a)),c===g.noMore||a.isEnd())return u(),c;return c});return i&&u(),u})},g.Observable.prototype.map=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;n>e;e++)r[e-1]=arguments[e];return U(this,t,r,function(t){return W(new g.Desc(this,"map",[t]),this.withHandler(function(n){return this.push(n.fmap(t))}))})};var rn=function(t){return A(t[0])?t[0]:Array.prototype.slice.call(t)},en=function(t){return I.isFunction(t[0])?[rn(Array.prototype.slice.call(t,1)),t[0]]:[rn(Array.prototype.slice.call(t,0,t.length-1)),I.last(t)]};g.combineAsArray=function(){for(var n,r=rn(arguments),e=0;e<r.length;e++)n=r[e],O(n)||(r[e]=g.constant(n));if(r.length){var i=function(){for(var n,e=[],i=0;i<r.length;i++)n=r[i],e.push(new t(n,!0));return e}();return W(new g.Desc(g,"combineAsArray",r),g.when(i,function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return n}).toProperty())}return g.constant([])},g.onValues=function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return g.combineAsArray(n.slice(0,n.length-1)).onValues(n[n.length-1])},g.combineWith=function(){var t=en(arguments),n=t[0],r=t[1],e=new g.Desc(g,"combineWith",[r].concat(n));return W(e,g.combineAsArray(n).map(function(t){return r.apply(void 0,t)}))},g.Observable.prototype.combine=function(t,n){var r=z(n),e=new g.Desc(this,"combine",[t,n]);return W(e,g.combineAsArray(this,t).map(function(t){return r(t[0],t[1])}))},g.Observable.prototype.withStateMachine=function(t,n){var r=t,e=new g.Desc(this,"withStateMachine",[t,n]);return W(e,this.withHandler(function(t){var e=n(r,t),i=e[0],u=e[1];r=i;for(var o,s=g.more,a=0;a<u.length;a++)if(o=u[a],s=this.push(o),s===g.noMore)return s;return s}))};var un=function(t,n){return t===n},on=function(t){return"undefined"!=typeof t&&null!==t?t._isNone:!1};g.Observable.prototype.skipDuplicates=function(){var t=arguments.length<=0||void 0===arguments[0]?un:arguments[0],n=new g.Desc(this,"skipDuplicates",[]);return W(n,this.withStateMachine(R,function(n,r){return r.hasValue()?r.isInitial()||on(n)||!t(n.get(),r.value())?[new i(r.value()),[r]]:[n,[]]:[n,[r]]}))},g.Observable.prototype.awaiting=function(t){var n=new g.Desc(this,"awaiting",[t]);return W(n,g.groupSimultaneous(this,t).map(function(t){return 0===t[1].length}).toProperty(!1).skipDuplicates())},g.Observable.prototype.not=function(){return W(new g.Desc(this,"not",[]),this.map(function(t){return!t}))},g.Property.prototype.and=function(t){return W(new g.Desc(this,"and",[t]),this.combine(t,function(t,n){return t&&n}))},g.Property.prototype.or=function(t){return W(new g.Desc(this,"or",[t]),this.combine(t,function(t,n){return t||n}))},g.scheduler={setTimeout:function(t,n){return setTimeout(t,n)},setInterval:function(t,n){return setInterval(t,n)},clearInterval:function(t){return clearInterval(t)},clearTimeout:function(t){return clearTimeout(t)},now:function(){return(new Date).getTime()}},g.EventStream.prototype.bufferWithTime=function(t){return W(new g.Desc(this,"bufferWithTime",[t]),this.bufferWithTimeOrCount(t,Number.MAX_VALUE))},g.EventStream.prototype.bufferWithCount=function(t){return W(new g.Desc(this,"bufferWithCount",[t]),this.bufferWithTimeOrCount(void 0,t))},g.EventStream.prototype.bufferWithTimeOrCount=function(t,n){var r=function(r){return r.values.length===n?r.flush():void 0!==t?r.schedule():void 0},e=new g.Desc(this,"bufferWithTimeOrCount",[t,n]);return W(e,this.buffer(t,r,r))},g.EventStream.prototype.buffer=function(t){var n=arguments.length<=1||void 0===arguments[1]?E:arguments[1],r=arguments.length<=2||void 0===arguments[2]?E:arguments[2],e={scheduled:null,end:void 0,values:[],flush:function(){if(this.scheduled&&(g.scheduler.clearTimeout(this.scheduled),this.scheduled=null),this.values.length>0){var t=this.values;this.values=[];var n=this.push(X(t));if(null!=this.end)return this.push(this.end);if(n!==g.noMore)return r(this)}else if(null!=this.end)return this.push(this.end)},schedule:function(){var n=this;return this.scheduled?void 0:this.scheduled=t(function(){return n.flush()})}},i=g.more;if(!I.isFunction(t)){var u=t;t=function(t){return g.scheduler.setTimeout(t,u)}}return W(new g.Desc(this,"buffer",[]),this.withHandler(function(t){var r=this;return e.push=function(t){return r.push(t)},t.isError()?i=this.push(t):t.isEnd()?(e.end=t,e.scheduled||e.flush()):(e.values.push(t.value()),n(e)),i}))},g.Observable.prototype.filter=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;n>e;e++)r[e-1]=arguments[e];return U(this,t,r,function(t){return W(new g.Desc(this,"filter",[t]),this.withHandler(function(n){return n.filter(t)?this.push(n):g.more}))})},g.once=function(t){return new p(new e(g,"once",[t]),function(n){return n(J(t)),n(G()),E})},g.EventStream.prototype.concat=function(t){var n=this;return new p(new g.Desc(n,"concat",[t]),function(r){var e=E,i=n.dispatcher.subscribe(function(n){return n.isEnd()?e=t.dispatcher.subscribe(r):r(n)});return function(){return i(),e()}})},g.Observable.prototype.flatMap=function(){return cn(this,sn(arguments))},g.Observable.prototype.flatMapFirst=function(){return cn(this,sn(arguments),!0)};var sn=function(t){return 1===t.length&&O(t[0])?I.always(t[0]):H(t)},an=function(t){return O(t)?t:g.once(t)},cn=function(t,n,r,e){var i=[t],u=[],o=new g.Desc(t,"flatMap"+(r?"First":""),[n]),s=new p(o,function(i){var o=new h,s=[],a=function(t){var r=an(n(t.value()));return u.push(r),o.add(function(t,n){return r.dispatcher.subscribe(function(e){if(e.isEnd())return I.remove(r,u),c(),f(n),g.noMore;("undefined"!=typeof e&&null!==e?e._isInitial:void 0)&&(e=e.toNext());var o=i(e);return o===g.noMore&&t(),o})})},c=function(){var t=s.shift();return t?a(t):void 0},f=function(t){return t(),o.empty()?i(G()):void 0};return o.add(function(n,u){return t.dispatcher.subscribe(function(t){return t.isEnd()?f(u):t.isError()?i(t):r&&o.count()>1?g.more:o.unsubscribed?g.noMore:e&&o.count()>e?s.push(t):a(t)})}),o.unsubscribe});return s.internalDeps=function(){return u.length?i.concat(u):i},s};g.Observable.prototype.flatMapWithConcurrencyLimit=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;n>e;e++)r[e-1]=arguments[e];var i=new g.Desc(this,"flatMapWithConcurrencyLimit",[t].concat(r));return W(i,cn(this,sn(r),!1,t))},g.Observable.prototype.flatMapConcat=function(){var t=new g.Desc(this,"flatMapConcat",Array.prototype.slice.call(arguments,0));return W(t,this.flatMapWithConcurrencyLimit.apply(this,[1].concat(b.call(arguments))))},g.later=function(t,n){return W(new g.Desc(g,"later",[t,n]),g.fromBinder(function(r){var e=function(){return r([n,G()])},i=g.scheduler.setTimeout(e,t);return function(){return g.scheduler.clearTimeout(i)}}))},g.Observable.prototype.bufferingThrottle=function(t){var n=new g.Desc(this,"bufferingThrottle",[t]);return W(n,this.flatMapConcat(function(n){return g.once(n).concat(g.later(t).filter(!1))}))},g.Property.prototype.bufferingThrottle=function(){return g.Observable.prototype.bufferingThrottle.apply(this,arguments).toProperty()},k(y,p),M(y.prototype,{unsubAll:function(){for(var t,n=this.subscriptions,r=0;r<n.length;r++)t=n[r],"function"==typeof t.unsub&&t.unsub()},subscribeAll:function(t){if(this.ended)t(G());else{this.sink=t;for(var n,r=S(this.subscriptions),e=0;e<r.length;e++)n=r[e],this.subscribeInput(n)}return this.unsubAll},guardedSink:function(t){var n=this;return function(r){return r.isEnd()?(n.unsubscribeInput(t),g.noMore):n.sink(r)}},subscribeInput:function(t){return t.unsub=t.input.dispatcher.subscribe(this.guardedSink(t.input)),t.unsub},unsubscribeInput:function(t){for(var n,r=this.subscriptions,e=0;e<r.length;e++)if(n=r[e],n.input===t)return"function"==typeof n.unsub&&n.unsub(),void this.subscriptions.splice(e,1)},plug:function(t){var n=this;if(!this.ended){var r={input:t};return this.subscriptions.push(r),"undefined"!=typeof this.sink&&this.subscribeInput(r),function(){return n.unsubscribeInput(t)}}},end:function(){return this.ended=!0,this.unsubAll(),"function"==typeof this.sink?this.sink(G()):void 0},push:function(t){return this.ended||"function"!=typeof this.sink?void 0:this.sink(X(t))},error:function(t){return"function"==typeof this.sink?this.sink(new c(t)):void 0}}),g.Bus=y;var fn=function(t,n){return V(function(r){for(var e=B(n,[function(t,n){return r.apply(void 0,t.concat([n]))}]),i=arguments.length,u=Array(i>1?i-1:0),o=1;i>o;o++)u[o-1]=arguments[o];return W(new g.Desc(g,t,[r].concat(u)),g.combineAsArray(u).flatMap(e))})};g.fromCallback=fn("fromCallback",function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;n>e;e++)r[e-1]=arguments[e];return g.fromBinder(function(n){return L(t,r)(n),E},function(t){return[t,G()]})}),g.fromNodeCallback=fn("fromNodeCallback",function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;n>e;e++)r[e-1]=arguments[e];return g.fromBinder(function(n){return L(t,r)(n),E},function(t,n){return t?[new c(t),G()]:[n,G()]})}),g.combineTemplate=function(t){function n(t){return t[t.length-1]}function r(t,r,e){return n(t)[r]=e,e}function e(t,n){return function(e,i){return r(e,t,i[n])}}function i(t,n){return function(e){return r(e,t,n)}}function u(t){return A(t)?[]:{}}function o(t,n){return function(e){var i=u(n);return r(e,t,i),e.push(i)}}function s(t,n){if(O(n))return h.push(n),f.push(e(t,h.length-1));if(!n||n.constructor!=Object&&n.constructor!=Array)return f.push(i(t,n));var r=function(t){return t.pop()};return f.push(o(t,n)),c(n),f.push(r)}function a(n){for(var r,e=u(t),i=[e],o=0;o<f.length;o++)(r=f[o])(i,n);return e}function c(t){return I.each(t,s)}var f=[],h=[];return c(t),W(new g.Desc(g,"combineTemplate",[t]),g.combineAsArray(h).map(a))};var hn=function(t,n){var r=new p(x(t,"justInitValue"),function(n){var e=void 0,i=t.dispatcher.subscribe(function(t){return t.isEnd()||(e=t),g.noMore});return _.whenDoneWith(r,function(){return"undefined"!=typeof e&&null!==e&&n(e),n(G())}),i});return r.concat(n).toProperty()};g.Observable.prototype.mapEnd=function(){var t=H(arguments);return W(new g.Desc(this,"mapEnd",[t]),this.withHandler(function(n){return n.isEnd()?(this.push(X(t(n))),this.push(G()),g.noMore):this.push(n)}))},g.Observable.prototype.skipErrors=function(){return W(new g.Desc(this,"skipErrors",[]),this.withHandler(function(t){return t.isError()?g.more:this.push(t)}))},g.EventStream.prototype.takeUntil=function(t){var n={};return W(new g.Desc(this,"takeUntil",[t]),g.groupSimultaneous(this.mapEnd(n),t.skipErrors()).withHandler(function(t){if(t.hasValue()){var r=t.value(),e=r[0],i=r[1];if(i.length)return this.push(G());for(var u,o=g.more,s=0;s<e.length;s++)u=e[s],o=this.push(u===n?G():X(u));return o}return this.push(t)}))},g.Property.prototype.takeUntil=function(t){var n=this.changes().takeUntil(t);return W(new g.Desc(this,"takeUntil",[t]),hn(this,n))},g.Observable.prototype.flatMapLatest=function(){var t=sn(arguments),n=this.toEventStream();return W(new g.Desc(this,"flatMapLatest",[t]),n.flatMap(function(r){return an(t(r)).takeUntil(n)}))},g.Property.prototype.delayChanges=function(t,n){return W(t,hn(this,n(this.changes())))},g.EventStream.prototype.delay=function(t){return W(new g.Desc(this,"delay",[t]),this.flatMap(function(n){return g.later(t,n)}))},g.Property.prototype.delay=function(t){return this.delayChanges(new g.Desc(this,"delay",[t]),function(n){return n.delay(t)})},g.EventStream.prototype.debounce=function(t){return W(new g.Desc(this,"debounce",[t]),this.flatMapLatest(function(n){return g.later(t,n)}))},g.Property.prototype.debounce=function(t){return this.delayChanges(new g.Desc(this,"debounce",[t]),function(n){return n.debounce(t)})},g.EventStream.prototype.debounceImmediate=function(t){return W(new g.Desc(this,"debounceImmediate",[t]),this.flatMapFirst(function(n){return g.once(n).concat(g.later(t).filter(!1))}))},g.Observable.prototype.decode=function(t){return W(new g.Desc(this,"decode",[t]),this.combine(g.combineTemplate(t),function(t,n){return n[t]}))},g.Observable.prototype.scan=function(t,n){var r,e=this;n=z(n);var u=$(t),o=!1,a=function(t){var a=!1,c=E,f=g.more,h=function(){return a?void 0:u.forEach(function(n){return a=o=!0,f=t(new s(function(){return n
})),f===g.noMore?(c(),c=E):void 0})};return c=e.dispatcher.subscribe(function(r){if(r.hasValue()){if(o&&r.isInitial())return g.more;r.isInitial()||h(),a=o=!0;var e=u.getOrElse(void 0),s=n(e,r.value());return u=new i(s),t(r.apply(function(){return s}))}return r.isEnd()&&(f=h()),f!==g.noMore?t(r):void 0}),_.whenDoneWith(r,h),c};return r=new d(new g.Desc(this,"scan",[t,n]),a)},g.Observable.prototype.diff=function(t,n){return n=z(n),W(new g.Desc(this,"diff",[t,n]),this.scan([t],function(t,r){return[r,n(t[0],r)]}).filter(function(t){return 2===t.length}).map(function(t){return t[1]}))},g.Observable.prototype.doAction=function(){var t=H(arguments);return W(new g.Desc(this,"doAction",[t]),this.withHandler(function(n){return n.hasValue()&&t(n.value()),this.push(n)}))},g.Observable.prototype.doEnd=function(){var t=H(arguments);return W(new g.Desc(this,"doEnd",[t]),this.withHandler(function(n){return n.isEnd()&&t(),this.push(n)}))},g.Observable.prototype.doError=function(){var t=H(arguments);return W(new g.Desc(this,"doError",[t]),this.withHandler(function(n){return n.isError()&&t(n.error),this.push(n)}))},g.Observable.prototype.doLog=function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return W(new g.Desc(this,"doLog",n),this.withHandler(function(t){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log&&console.log.apply(console,n.concat([t.log()])),this.push(t)}))},g.Observable.prototype.endOnError=function(t){("undefined"==typeof t||null===t)&&(t=!0);for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;n>e;e++)r[e-1]=arguments[e];return U(this,t,r,function(t){return W(new g.Desc(this,"endOnError",[]),this.withHandler(function(n){return n.isError()&&t(n.error)?(this.push(n),this.push(G())):this.push(n)}))})},f.prototype.errors=function(){return W(new g.Desc(this,"errors",[]),this.filter(function(){return!1}))},g.Observable.prototype.take=function(t){return 0>=t?g.never():W(new g.Desc(this,"take",[t]),this.withHandler(function(n){return n.hasValue()?(t--,t>0?this.push(n):(0===t&&this.push(n),this.push(G()),g.noMore)):this.push(n)}))},g.Observable.prototype.first=function(){return W(new g.Desc(this,"first",[]),this.take(1))},g.Observable.prototype.mapError=function(){var t=H(arguments);return W(new g.Desc(this,"mapError",[t]),this.withHandler(function(n){return this.push(n.isError()?X(t(n.error)):n)}))},g.Observable.prototype.flatMapError=function(t){var n=new g.Desc(this,"flatMapError",[t]);return W(n,this.mapError(function(t){return new c(t)}).flatMap(function(n){return n instanceof c?t(n.error):g.once(n)}))},g.EventStream.prototype.sampledBy=function(t,n){return W(new g.Desc(this,"sampledBy",[t,n]),this.toProperty().sampledBy(t,n))},g.Property.prototype.sampledBy=function(n,r){var e=!1;"undefined"!=typeof r&&null!==r?r=z(r):(e=!0,r=function(t){return t.value()});var i=new t(this,!1,e),u=new t(n,!0,e),o=g.when([i,u],r),s=n._isProperty?o.toProperty():o;return W(new g.Desc(this,"sampledBy",[n,r]),s)},g.Property.prototype.sample=function(t){return W(new g.Desc(this,"sample",[t]),this.sampledBy(g.interval(t,{})))},g.Observable.prototype.map=function(t){if(t&&t._isProperty)return t.sampledBy(this,D);for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;n>e;e++)r[e-1]=arguments[e];return U(this,t,r,function(t){return W(new g.Desc(this,"map",[t]),this.withHandler(function(n){return this.push(n.fmap(t))}))})},g.Observable.prototype.fold=function(t,n){return W(new g.Desc(this,"fold",[t,n]),this.scan(t,n).sampledBy(this.filter(!1).mapEnd().toProperty()))},f.prototype.reduce=f.prototype.fold;var ln=[["addEventListener","removeEventListener"],["addListener","removeListener"],["on","off"],["bind","unbind"]],pn=function(t){for(var n,r=0;r<ln.length;r++){n=ln[r];var e=[t[n[0]],t[n[1]]];if(e[0]&&e[1])return e}for(var i=0;i<ln.length;i++){n=ln[i];var u=t[n[0]];if(u)return[u,function(){}]}throw new c("No suitable event methods in "+t)};g.fromEventTarget=function(t,n,r){var e=pn(t),i=e[0],u=e[1],o=new g.Desc(g,"fromEvent",[t,n]);return W(o,g.fromBinder(function(r){return i.call(t,n,r),function(){return u.call(t,n,r)}},r))},g.fromEvent=g.fromEventTarget,g.fromPoll=function(t,n){var r=new g.Desc(g,"fromPoll",[t,n]);return W(r,g.fromBinder(function(n){var r=g.scheduler.setInterval(n,t);return function(){return g.scheduler.clearInterval(r)}},n))},g.fromPromise=function(t,n){var r=arguments.length<=2||void 0===arguments[2]?m:arguments[2];return W(new g.Desc(g,"fromPromise",[t]),g.fromBinder(function(r){var e=t.then(r,function(t){return r(new c(t))});return e&&"function"==typeof e.done&&e.done(),n?function(){return"function"==typeof t.abort?t.abort():void 0}:function(){}},r))},g.Observable.prototype.groupBy=function(t){var n=arguments.length<=1||void 0===arguments[1]?g._.id:arguments[1],r={},e=this;return e.filter(function(n){return!r[t(n)]}).map(function(i){var u=t(i),o=e.filter(function(n){return t(n)===u}),s=g.once(i).concat(o),a=n(s,i).withHandler(function(t){return this.push(t),t.isEnd()?delete r[u]:void 0});return r[u]=a,a})},g.fromArray=function(t){if(t.length){var n=0;return new p(new g.Desc(g,"fromArray",[t]),function(r){var e=!1,i=g.more,u=!1,o=!1,s=function(){if(o=!0,!u){for(u=!0;o;)if(o=!1,i!==g.noMore&&!e){var a=t[n++];i=r(J(a)),i!==g.noMore&&(n===t.length?r(G()):_.afterTransaction(s))}return u=!1}};return s(),function(){return e=!0}})}return W(new g.Desc(g,"fromArray",t),g.never())},g.EventStream.prototype.holdWhen=function(t){var n=!1,r=[],e=this;return new p(new g.Desc(this,"holdWhen",[t]),function(i){var u=new h,o=!1,s=function(t){return"function"==typeof t&&t(),u.empty()&&o?i(G()):void 0};return u.add(function(e,u){return t.subscribeInternal(function(t){if(!t.hasValue())return t.isEnd()?s(u):i(t);if(n=t.value(),!n){var e=r;return r=[],function(){for(var t,n=[],r=0;r<e.length;r++)t=e[r],n.push(i(X(t)));return n}()}})}),u.add(function(t,u){return e.subscribeInternal(function(t){return n&&t.hasValue()?r.push(t.value()):t.isEnd()&&r.length?s(u):i(t)})}),o=!0,s(),u.unsubscribe})},g.interval=function(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return W(new g.Desc(g,"interval",[t,n]),g.fromPoll(t,function(){return X(n)}))},g.$={},g.$.asEventStream=function(t,n,r){var e=this;return I.isFunction(n)&&(r=n,n=void 0),W(new g.Desc(this.selector||this,"asEventStream",[t]),g.fromBinder(function(r){return e.on(t,n,r),function(){return e.off(t,n,r)}},r))},"undefined"!=typeof jQuery&&jQuery&&(jQuery.fn.asEventStream=g.$.asEventStream),"undefined"!=typeof Zepto&&Zepto&&(Zepto.fn.asEventStream=g.$.asEventStream),g.Observable.prototype.last=function(){var t;return W(new g.Desc(this,"last",[]),this.withHandler(function(n){return n.isEnd()?(t&&this.push(t),this.push(G()),g.noMore):void(t=n)}))},g.Observable.prototype.log=function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return this.subscribe(function(t){"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,n.concat([t.log()]))}),this},g.EventStream.prototype.merge=function(t){var n=this;return W(new g.Desc(n,"merge",[t]),g.mergeAll(this,t))},g.mergeAll=function(){var t=rn(arguments);return t.length?new p(new g.Desc(g,"mergeAll",t),function(n){var r=0,e=function(e){return function(i){return e.dispatcher.subscribe(function(e){if(e.isEnd())return r++,r===t.length?n(G()):g.more;var u=n(e);return u===g.noMore&&i(),u})}},i=I.map(e,t);return new g.CompositeUnsubscribe(i).unsubscribe}):g.never()},g.repeatedly=function(t,n){var r=0;return W(new g.Desc(g,"repeatedly",[t,n]),g.fromPoll(t,function(){return n[r++%n.length]}))},g.repeat=function(t){var n=0;return g.fromBinder(function(r){function e(t){return t.isEnd()?u?i():u=!0:o=r(t)}function i(){var i;for(u=!0;u&&o!==g.noMore;)i=t(n++),u=!1,i?s=i.subscribeInternal(e):r(G());return u=!0}var u=!1,o=g.more,s=function(){};return i(),function(){return s()}})},g.retry=function(t){if(!I.isFunction(t.source))throw new w("'source' option has to be a function");var n=t.source,r=t.retries||0,e=t.maxRetries||r,i=t.delay||function(){return 0},u=t.isRetryable||function(){return!0},o=!1,s=null;return W(new g.Desc(g,"retry",[t]),g.repeat(function(){function t(){return n().endOnError().withHandler(function(t){return t.isError()?(s=t,u(s.error)&&r>0?void 0:(o=!0,this.push(t))):(t.hasValue()&&(s=null,o=!0),this.push(t))})}if(o)return null;if(s){var a={error:s.error,retriesDone:e-r},c=g.later(i(a)).filter(!1);return r-=1,c.concat(g.once().flatMap(t))}return t()}))},g.sequentially=function(t,n){var r=0;return W(new g.Desc(g,"sequentially",[t,n]),g.fromPoll(t,function(){var t=n[r++];return r<n.length?t:r===n.length?[t,G()]:G()}))},g.Observable.prototype.skip=function(t){return W(new g.Desc(this,"skip",[t]),this.withHandler(function(n){return n.hasValue()&&t>0?(t--,g.more):this.push(n)}))},g.EventStream.prototype.skipUntil=function(t){var n=t.take(1).map(!0).toProperty(!1);return W(new g.Desc(this,"skipUntil",[t]),this.filter(n))},g.EventStream.prototype.skipWhile=function(t){for(var n=!1,r=arguments.length,e=Array(r>1?r-1:0),i=1;r>i;i++)e[i-1]=arguments[i];return U(this,t,e,function(t){return W(new g.Desc(this,"skipWhile",[t]),this.withHandler(function(r){return!n&&r.hasValue()&&t(r.value())?g.more:(r.hasValue()&&(n=!0),this.push(r))}))})},g.Observable.prototype.slidingWindow=function(t){var n=arguments.length<=1||void 0===arguments[1]?0:arguments[1];return W(new g.Desc(this,"slidingWindow",[t,n]),this.scan([],function(n,r){return n.concat([r]).slice(-t)}).filter(function(t){return t.length>=n}))};var vn=[],Y=function(t){if(vn.length&&!Y.running)try{Y.running=!0,vn.forEach(function(n){n(t)})}finally{delete Y.running}};g.spy=function(t){return vn.push(t)},g.Property.prototype.startWith=function(t){return W(new g.Desc(this,"startWith",[t]),this.scan(t,function(t,n){return n}))},g.EventStream.prototype.startWith=function(t){return W(new g.Desc(this,"startWith",[t]),g.once(t).concat(this))},g.Observable.prototype.takeWhile=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),e=1;n>e;e++)r[e-1]=arguments[e];return U(this,t,r,function(t){return W(new g.Desc(this,"takeWhile",[t]),this.withHandler(function(n){return n.filter(t)?this.push(n):(this.push(G()),g.noMore)}))})},g.EventStream.prototype.throttle=function(t){return W(new g.Desc(this,"throttle",[t]),this.bufferWithTime(t).map(function(t){return t[t.length-1]}))},g.Property.prototype.throttle=function(t){return this.delayChanges(new g.Desc(this,"throttle",[t]),function(n){return n.throttle(t)})},f.prototype.firstToPromise=function(t){var n=this;if("function"!=typeof t){if("function"!=typeof Promise)throw new w("There isn't default Promise, use shim or parameter");t=Promise}return new t(function(t,r){return n.subscribe(function(n){return n.hasValue()&&t(n.value()),n.isError()&&r(n.error),g.noMore})})},f.prototype.toPromise=function(t){return this.last().firstToPromise(t)},g["try"]=function(t){return function(n){try{return g.once(t(n))}catch(r){return new g.Error(r)}}},g.update=function(t){function n(t){return function(){for(var n=arguments.length,r=Array(n),e=0;n>e;e++)r[e]=arguments[e];return function(n){return t.apply(void 0,[n].concat(r))}}}for(var r=arguments.length,e=Array(r>1?r-1:0),i=1;r>i;i++)e[i-1]=arguments[i];for(var u=e.length-1;u>0;)e[u]instanceof Function||(e[u]=I.always(e[u])),e[u]=n(e[u]),u-=2;return W(new g.Desc(g,"update",[t].concat(e)),g.when.apply(g,e).scan(t,function(t,n){return n(t)}))},g.zipAsArray=function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];var e=rn(n);return W(new g.Desc(g,"zipAsArray",e),g.zipWith(e,function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return n}))},g.zipWith=function(){for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];var e=en(n),i=e[0],u=e[1];return i=I.map(function(t){return t.toEventStream()},i),W(new g.Desc(g,"zipWith",[u].concat(i)),g.when(i,u))},g.Observable.prototype.zip=function(t,n){return W(new g.Desc(this,"zip",[t]),g.zipWith([this,t],n||Array))},"undefined"!=typeof define&&null!==define&&null!=define.amd?(define([],function(){return g}),"undefined"!=typeof this&&null!==this&&(this.Bacon=g)):"undefined"!=typeof module&&null!==module&&null!=module.exports?(module.exports=g,g.Bacon=g):this.Bacon=g}).call(this);
{
"name": "baconjs",
"description": "A small functional reactive programming lib for JavaScript.",
"version": "0.7.82",
"version": "0.7.83",
"keywords": [

@@ -6,0 +6,0 @@ "bacon.js",

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

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc