Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

baconjs

Package Overview
Dependencies
Maintainers
0
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

baconjs - npm Package Compare versions

Comparing version 3.0.17 to 3.0.18

2

dist/Bacon.min.js

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

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).Bacon={})}(this,function(t){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])})(t,n)};function n(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}function u(){for(var t=0,n=0,r=arguments.length;n<r;n++)t+=arguments[n].length;var e=Array(t),i=0;for(n=0;n<r;n++)for(var o=arguments[n],u=0,s=o.length;u<s;u++,i++)e[i]=o[u];return e}function a(){}var v=Array.isArray||function(t){return t instanceof Array};function d(t){return t&&t._isObservable}function y(t,n){for(var r=0;r<t.length;r++)if(!n(t[r]))return!1;return!0}function i(t,n){for(var r=0;r<t.length;r++)if(n(t[r]))return!0;return!1}function o(t,n){return-1!==w(t,n)}function b(t,n){for(var r,e=[],i=0;i<n.length;i++)t(r=n[i])&&e.push(r);return e}function s(r){return function(t,n){return r(n,t)}}function c(t,n,r){for(var e=0;e<t.length;e++)n=r(n,t[e]);return n}function f(t){return t[0]}var w=Array.prototype.indexOf?function(t,n){return t.indexOf(n)}:function(t,n){for(var r=0;r<t.length;r++)if(n===t[r])return r;return-1};function h(t){return"function"==typeof t}function m(t,n){for(var r,e=[],i=0;i<n.length;i++)r=n[i],e.push(t(r));return e}function p(t){return t.slice(1,t.length)}function l(t){return v(t)?t:[t]}function g(n){return"function"==typeof n?n:function(t){return n}}var E={indexOf:w,indexWhere:function(t,n){for(var r=0;r<t.length;r++)if(n(t[r]))return r;return-1},head:f,always:function(t){return function(){return t}},negate:function(n){return function(t){return!n(t)}},empty:function(t){return 0===t.length},tail:p,filter:b,map:m,each:function(t,n){for(var r in t){if(Object.prototype.hasOwnProperty.call(t,r))n(r,t[r])}},toArray:l,contains:o,id:function(t){return t},last:function(t){return t[t.length-1]},all:y,any:i,without:function(n,t){return b(function(t){return t!==n},t)},remove:function(t,n){var r=w(n,t);if(0<=r)return n.splice(r,1)},fold:c,flatMap:function(r,t){return c(t,[],function(t,n){return t.concat(r(n))})},bind:function(t,n){return function(){return t.apply(n,arguments)}},isFunction:h,toFunction:g,toString:function t(n){var r={}.hasOwnProperty;try{if(S++,null==n)return"undefined";if(h(n))return"function";if(v(n))return 5<S?"[..]":"["+m(t,n).toString()+"]";if(null!=(null!=n?n.toString:void 0)&&n.toString!==Object.prototype.toString)return n.toString();if("object"!=typeof n)return n;if(5<S)return"{..}";var e=[];for(var i in n)if(r.call(n,i)){var o=function(){try{return n[i]}catch(t){return t}}();e.push(t(i)+":"+t(o))}return"{"+e+"}"}finally{S--}}},S=0,D=void 0,I="<no-more>",A={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()}}};var k=void 0,_=[],B={},x=[],M=0,W={},T=!1;function O(t){t<=M||(x[t-1]||(x[t-1]=[[],0]),M=t)}function P(t,n){if(!k&&!T)return n();O(1);for(var r=0;r<M-1&&!C(t,x[r][0]);)r++;x[r][0].push([t,n]),k||N()}function C(t,n){for(var r=0;r<n.length;r++)if(n[r][0].id==t.id)return 1}function N(){var t=M;if(t){var n=!T;T=!0;try{for(;t<=M;){var r=x[M-1];if(!r)throw new Error("Unexpected stack top: "+r);var e=r[0],i=r[1];if(!(i<e.length)){r[0]=[],r[1]=0;break}var o=e[i][1];r[1]++,O(M+1);var u=!1;try{for(o(),u=!0;t<M&&0==x[M-1][0].length;)M--}finally{u||(x=[],M=0)}}}finally{n&&(T=!1)}}}function r(t,n){if(k){var r=B[t.id];return void 0===r?(r=B[t.id]=[n],_.push(t)):r.push(n)}return n()}function F(t,n){var r=_[t],e=r.id,i=B[e];_.splice(t,1),delete B[e],n&&0<_.length&&function t(n){if(W[n.id])return;var r=n.internalDeps();for(var e,i=0;i<r.length;i++)if(e=r[i],t(e),B[e.id]){var o=E.indexOf(_,e);F(o,!1)}W[n.id]=!0}(r);for(var o=0;o<i.length;o++)(0,i[o])()}var L={toString:function(){return E.toString({rootEvent:k,processingAfters:T,waiterObs:_,waiters:B,aftersStack:x,aftersStackHeight:M,flushed:W})},whenDoneWith:r,hasWaiters:function(){return 0<_.length},inTransaction:function(t,n,r,e){if(k)return r.apply(n,e);k=t;try{var i=r.apply(n,e);!function(){for(;0<_.length;)F(0,!0);W={}}()}finally{k=void 0,N()}return i},currentEventId:function(){return k?k.id:void 0},wrappedSubscribe:function(n,t,r){function e(){i=!0,u()}var i=!1,o=!1,u=function(){o=!0};return u=t(function(t){return P(n,function(){i||r(t)===I&&e()}),D}),o&&u(),e},afterTransaction:P,soonButNotYet:function(t,n){k?r(t,n):A.scheduler.setTimeout(n,0)},isInTransaction:function(){return void 0!==k}},V=(q.prototype.deps=function(){return this.cachedDeps||(this.cachedDeps=U([this.context].concat(this.args))),this.cachedDeps},q.prototype.toString=function(){var t=E.map(E.toString,this.args);return E.toString(this.context)+"."+E.toString(this.method)+"("+t+")"},q);function q(t,n,r){void 0===r&&(r=[]),this._isDesc=!0,this.context=t,this.method=n,this.args=r}function j(t,n){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];var i=t||n;return i&&i._isDesc?t||n:new V(t,n,r)}function U(t){return v(t)?E.flatMap(U,t):d(t)?[t]:null!=t&&t._isSource?[t.obs]:[]}function Q(){return D}function z(){return D}function H(t,n,r){return r.transform((c=t,function(t,n){var r=s(c,t),e=r[0],i=r[1];c=e;for(var o=D,u=0;u<i.length;u++)if((o=n(i[u]))===I)return o;return o}),new V(r,"withStateMachine",[t,s=n]));var s,c}var R=(Y.prototype.getOrElse=function(t){return this.value},Y.prototype.get=function(){return this.value},Y.prototype.filter=function(t){return t(this.value)?new Y(this.value):X},Y.prototype.map=function(t){return new Y(t(this.value))},Y.prototype.forEach=function(t){t(this.value)},Y.prototype.toArray=function(){return[this.value]},Y.prototype.inspect=function(){return"Some("+this.value+")"},Y.prototype.toString=function(){return this.inspect()},Y);function Y(t){this._isSome=!0,this.isDefined=!0,this.value=t}var X={_isNone:!0,getOrElse:function(t){return t},get:function(){throw new Error("None.get()")},filter:function(){return X},map:function(){return X},forEach:function(){},isDefined:!1,toArray:function(){return[]},inspect:function(){return"None"},toString:function(){return this.inspect()}};var $=0,G=(J.prototype.filter=function(t){return!0},J.prototype.inspect=function(){return this.toString()},J.prototype.log=function(){return this.toString()},J.prototype.toNext=function(){return this},J);function J(){this.id=++$,this.isEvent=!0,this._isEvent=!0,this.isEnd=!1,this.isInitial=!1,this.isNext=!1,this.isError=!1,this.hasValue=!1}var K,Z=(n(tt,K=G),tt.prototype.fmap=function(t){return this.apply(t(this.value))},tt.prototype.filter=function(t){return t(this.value)},tt.prototype.toString=function(){return E.toString(this.value)},tt.prototype.log=function(){return this.value},tt);function tt(t){var n=K.call(this)||this;if(n.hasValue=!0,t instanceof G)throw new vt("Wrapping an event inside other event");return n.value=t,n}var nt,rt=(n(et,nt=Z),et.prototype.apply=function(t){return new et(t)},et);function et(t){var n=nt.call(this,t)||this;return n.isNext=!0,n._isNext=!0,n}var it,ot=(n(ut,it=Z),ut.prototype.apply=function(t){return new ut(t)},ut.prototype.toNext=function(){return new rt(this.value)},ut);function ut(t){var n=it.call(this,t)||this;return n.isInitial=!0,n._isInitial=!0,n}var st,ct=(n(ft,st=G),ft.prototype.fmap=function(t){return this},ft);function ft(){var t=null!==st&&st.apply(this,arguments)||this;return t.hasValue=!1,t}var at,ht=(n(pt,at=ct),pt.prototype.toString=function(){return"<end>"},pt);function pt(){var t=null!==at&&at.apply(this,arguments)||this;return t.isEnd=!0,t}var lt,vt=(n(dt,lt=ct),dt.prototype.toString=function(){return"<error> "+E.toString(this.error)},dt);function dt(t){var n=lt.call(this)||this;return n.isError=!0,n.error=t,n}function yt(t){return new ot(t)}function bt(t){return new rt(t)}function wt(){return new ht}function mt(t){return t&&t._isEvent?t:bt(t)}function gt(t){return t&&t._isEvent}function Et(t){return t&&t._isInitial}function St(t){return t.isError}function Dt(t){return t.hasValue}function It(t){return t.isEnd}function At(t,n){return t===n}function kt(t,e){void 0===e&&(e=At);var n=new V(t,"skipDuplicates",[]);return H(X,function(t,n){return Dt(n)?n.isInitial||null!=(r=t)&&r._isNone||!e(t.get(),n.value)?[new R(n.value),[n]]:[t,[]]:[t,[n]];var r},t).withDesc(n)}function _t(t,n,r){return n.transform(Bt(t),r||new V(n,"take",[t]))}function Bt(r){return function(t,n){return!t.hasValue||0<--r?n(t):(0===r&&n(t),n(wt()),I)}}function xt(n,t,u){var s,c=t,f=!1;return s=new ar(new V(n,"scan",[t,u]),function(r){function e(){return i||(i=f=!0,(o=r(new ot(c)))===I&&(t(),t=a)),o}var i=!1,t=a,o=D;return t=n.subscribeInternal(function(t){if(Dt(t)){if(f&&t.isInitial)return D;t.isInitial||e(),i=f=!0;var n=u(c,t.value);return c=n,r(t.apply(n))}return t.isEnd&&(o=e()),o!==I?r(t):o}),L.whenDoneWith(s,e),t})}var Mt=(Wt.prototype.add=function(t){var n=this;if(!this.unsubscribed){var r=!1,e=a;this.starting.push(t),e=t(this.unsubscribe,function(){n.unsubscribed||(r=!0,n.remove(e),E.remove(t,n.starting))}),this.unsubscribed||r?e():this.subscriptions.push(e),E.remove(t,this.starting)}},Wt.prototype.remove=function(t){if(!this.unsubscribed)return void 0!==E.remove(t,this.subscriptions)?t():void 0},Wt.prototype.unsubscribe=function(){if(!this.unsubscribed){this.unsubscribed=!0;for(var t=this.subscriptions,n=0;n<t.length;n++)t[n]();this.subscriptions=[],this.starting=[]}},Wt.prototype.count=function(){return this.unsubscribed?0:this.subscriptions.length+this.starting.length},Wt.prototype.empty=function(){return 0===this.count()},Wt);function Wt(t){void 0===t&&(t=[]),this.unsubscribed=!1,this.unsubscribe=E.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 Tt(s,t){return function(n){function r(){if(!e)return s.forEach(function(t){if(e=!0,(u=n(new ot(t)))===I)return o(),o=a})}var e=!1,i=!1,o=a,u=D;return o=t(function(t){return t instanceof Z?t.isInitial&&!i?(s=new R(t.value),D):(t.isInitial||r(),e=!0,s=new R(t.value),n(t)):(t.isEnd&&(u=r()),u!==I?n(t):u)}),i=!0,r(),o}}function Ot(t,n){return new ar(t,Tt(X,n))}function Pt(n){var r=new dr(new V("Bacon","once",[n]),function(t){return L.soonButNotYet(r,function(){t(mt(n)),t(wt())}),a});return r}function Ct(n,t,e){void 0===e&&(e={});var i=t,r=[i],a=[],h=t._isProperty,p=!1,o=(h?Ot:wr)(e.desc||new V(t,"flatMap_",[n]),function(u){var r=new Mt,s=[];function c(t){if(h&&t.isInitial){if(p)return D;p=!0}var o=Ft(n(t));return a.push(o),r.add(function(e,i){return o.subscribeInternal(function(t){if(t.isEnd)return E.remove(o,a),(n=s.shift())&&c(n),f(i),I;t=t.toNext();var n,r=u(t);return r===I&&e(),r})})}function f(t){return t(),r.empty()?u(wt()):D}return r.add(function(t,n){return i.subscribeInternal(function(t){return t.isEnd?f(n):t.isError&&!e.mapError?u(t):e.firstOnly&&1<r.count()?D:r.unsubscribed?I:(e.limit&&r.count()>e.limit?s.push(t):c(t),D)})}),r.unsubscribe});return o.internalDeps=function(){return a.length?r.concat(a):r},o}function Nt(n){return"function"==typeof n?function(t){return Dt(t)?n(t.value):t}:function(t){return n}}function Ft(t){return d(t)?t:Pt(t)}function Lt(t,n){return Ct(n,t,{mapError:!0,desc:new V(t,"flatMapEvent",[n])})}var Vt=(qt.prototype.subscribe=function(t){return this.obs.subscribeInternal(t)},qt.prototype.toString=function(){return this.obs.toString()},qt.prototype.markEnded=function(){this.ended=!0},qt.prototype.mayHave=function(t){return!0},qt);function qt(t,n){this._isSource=!0,this.flatten=!0,this.ended=!1,this.obs=t,this.sync=n}var jt,Ut=(n(Qt,jt=Vt),Qt.prototype.consume=function(){return this.value},Qt.prototype.push=function(t){this.value=t},Qt.prototype.hasAtLeast=function(t){return!!this.value},Qt);function Qt(){return null!==jt&&jt.apply(this,arguments)||this}var zt,Ht=(n(Rt,zt=Vt),Rt.prototype.consume=function(){return this.queue.shift()},Rt.prototype.push=function(t){this.queue.push(t)},Rt.prototype.mayHave=function(t){return!this.ended||this.queue.length>=t},Rt.prototype.hasAtLeast=function(t){return this.queue.length>=t},Rt);function Rt(t,n){var r=zt.call(this,t,n)||this;return r.flatten=!1,r.queue=[],r}var Yt,Xt=(n($t,Yt=Vt),$t.prototype.consume=function(){var t=this.queue;return this.queue=[],{value:t}},$t.prototype.push=function(t){return this.queue.push(t.value)},$t.prototype.hasAtLeast=function(t){return!0},$t);function $t(t){var n=Yt.call(this,t,!0)||this;return n.queue=[],n}function Gt(t){return null!=t&&t._isSource?t:null!=t&&t._isProperty?new Ut(t,!1):new Ht(t,!0)}function Jt(){return new dr(j("Bacon","never"),function(t){return t(wt()),a})}function Kt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return tn(br,t)}function Zt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return tn(Ot,t)}function tn(t,n){if(0===n.length)return Jt();var r=function(t){for(var n=[],r=[],e=0;e<t.length;e++){for(var i,o=t[e],u=o[0],s={f:o[1],ixs:[]},c=!1,f=0;f<u.length;f++){i=u[f];var a=w(n,i);c=c||null!=(l=i)&&(l._isSource?l.sync:l._isEventStream),a<0&&(n.push(i),a=n.length-1);for(var h=0;h<s.ixs.length;h++){var p=s.ixs[h];p.index===a&&p.count++}s.ixs.push({index:a,count:1})}if(0<u.length&&!c)throw new Error("At least one EventStream required, none found in "+u);0<u.length&&r.push(s)}var l;return[m(Gt,n),r]}(rn(n)),l=r[0],v=r[1];if(!l.length)return Jt();var c=i(l,function(t){return t.flatten})&&function(t,e){void 0===e&&(e=[]);return i(t,function t(n){if(o(e,n))return!0;var r=n.internalDeps();return r.length?(e.push(n),i(r,t)):(e.push(n),!1)})}(m(function(t){return t.obs},l)),d=t(new V("Bacon","when",Array.prototype.slice.call(n)),function(f){var a=[],s=!1;function h(t){for(var n=0;n<t.ixs.length;n++){var r=t.ixs[n];if(!l[r.index].hasAtLeast(r.count))return}return 1}function n(t){for(var n=0;n<t.ixs.length;n++){var r=t.ixs[n];if(!l[r.index].mayHave(r.count))return!0}return!1}function p(t){return!t.source.flatten}return new Mt(m(function(u){return function(e){function i(){return L.whenDoneWith(d,o)}function o(){var t=function t(){var n;if(void 0!==(n=a.pop()))for(var r,e=D,i=0;i<v.length;i++)if(h(r=v[i])){for(var o=[],u=0;u<r.ixs.length;u++){var s=l[r.ixs[u].index].consume();if(!s)throw new Error("Event was undefined");o.push(s.value)}var c=r.f.apply(null,o);return e=f(n.e.apply(c)),a.length&&(a=b(p,a)),e===I?e:t()}return D}();s&&(y(l,en)||y(v,n))&&(t=I,f(wt())),t===I&&e()}return u.subscribe(function(t){var n=D;if(t.isEnd)s=!0,u.markEnded(),i();else if(t.isError)n=f(t);else{var r=t;u.push(r),u.sync&&(a.push({source:u,e:r}),(c||L.hasWaiters()?i:o)())}return n===I&&e(),n})}},l)).unsubscribe});return d}function nn(t){for(var n=0,r=t.length,e=[];n<r;){var i=l(t[n++]),o=g(t[n++]);e.push([i,o])}return e}function rn(t){for(var n,r=[],e=0;e<t.length;e++){var i=t[e];if(!((n=i)instanceof Array)||d(n[n.length-1]))return nn(t);if(i[0]instanceof Array)r.push([i[0],g(i[1])]);else{var o=i.slice(0,i.length-1),u=g(i[i.length-1]);r.push([o,u])}}return r}function en(t){return!t.sync||t.ended}function on(t,n,r){return Kt([new Ut(n.toProperty(),!1),new Ut(t,!0),s(r)]).withDesc(new V(t,"withLatestFrom",[n,r]))}function un(t,n,r){return Zt([new Ut(n.toProperty(),!1),new Ut(t,!0),s(r)]).withDesc(new V(t,"withLatestFrom",[n,r]))}function sn(t,n,r){if(t instanceof ar)return un(t,n,r);if(t instanceof dr)return on(t,n,r);throw new Error("Unknown observable: "+t)}function cn(t,n){return n instanceof ar?sn(t,n,function(t,n){return n}):t.transform(fn(n),new V(t,"map",[n]))}function fn(t){var r=E.toFunction(t);return function(t,n){return n(t.fmap(r))}}function an(n){return new ar(new V("Bacon","constant",[n]),function(t){return t(yt(n)),t(wt()),a})}function hn(t){return t=Array.prototype.slice.call(t),E.flatMap(pn,t)}function pn(t){return d(t)?[t]:v(t)?hn(t):[an(t)]}function ln(t){return E.isFunction(t[0])?[hn(Array.prototype.slice.call(t,1)),t[0]]:[hn(Array.prototype.slice.call(t,0,t.length-1)),E.last(t)]}function vn(t,r){return tn(function(t,n){return new dr(t,n,void 0,r)},[E.map(function(t){return new Xt(t)},t),function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t}]).withDesc(new V("Bacon","groupSimultaneous",t))}function dn(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if((t=hn(t)).length){for(var r=[],e=0;e<t.length;e++){var i=d(t[e])?t[e]:an(t[e]);r.push(mn(i))}return Zt([r,function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t}]).withDesc(new V("Bacon","combineAsArray",t))}return an([])}function yn(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=ln(arguments),e=r[0],i=r[1],o=new V("Bacon","combineWith",u([i],e));return dn(e).map(function(t){return i.apply(void 0,t)}).withDesc(o)}var bn=yn;function wn(t,n,r){return Zt([[mn(t),mn(n)],r]).withDesc(new V(t,"combine",[n,r]))}function mn(t){return new Ut(t,!0)}function gn(t,n){return Ct(Nt(n),t,{desc:new V(t,"flatMapConcat",[n]),limit:1})}function En(e,f){void 0===f&&(f=E.id);var t=new V("Bacon","fromBinder",[e,f]);return new dr(t,function(s){function c(){if(!t)return null!=r?(r(),t=!0):n=!0}var t=!1,n=!1,r=e(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=f.apply(void 0,t),e=v(r)&&gt(E.last(r))?r:[r],i=D,o=0;o<e.length;o++){var u=mt(e[o]);if((i=s(u))===I||u.isEnd)return c(),i}return i});return n&&c(),c})}function Sn(r,t){var n=new V("Bacon","fromPoll",[r,t]);return En(function(t){var n=A.scheduler.setInterval(t,r);return function(){return A.scheduler.clearInterval(n)}},t).withDesc(n)}function Dn(t,n){return Sn(t,function(){return bt(n)}).withDesc(new V("Bacon","interval",[t,n]))}function In(t,n,r){return t instanceof dr?(i=n,o=r,An((e=t).toProperty(),i,o).withDesc(new V(e,"sampledBy",[i]))):An(t,n,r);var e,i,o}function An(t,n,r){var e;return sn(n,t,s("function"==typeof(e=r)?e:E.id)).withDesc(new V(t,"sampledBy",[n]))}function kn(t,r,n){return new ar(new V(t,"transform",[r]),function(n){return t.subscribeInternal(function(t){return r(t,n)})}).withDesc(n)}function _n(r,n){function e(t){return n(t,i)}var i;return function(t,n){return i=n,r(t,e)}}function Bn(t,n,r,e){return n instanceof ar?sn(t,n,function(t,n){return[t,n]}).transform(_n(r(function(t){return t[1]}),fn(function(t){return t[0]})),e):t.transform(r(function(t){if("boolean"==typeof t)return E.always(t);if("function"!=typeof t)throw new Error("Not a function: "+t);return t}(n)),e)}function xn(r){return function(t,n){return t.filter(r)?n(t):D}}function Mn(t){return t.map(function(t){return!t}).withDesc(new V(t,"not",[]))}function Wn(t){return pr(t)?t:an(t)}function Tn(t,n){return Ct(Nt(n),t,{firstOnly:!0,desc:new V(t,"flatMapFirst",[n])})}function On(t,n,r){return t.scan(n,r).last().withDesc(new V(t,"fold",[n,r]))}var Pn={};function Cn(t,n){return Ct(Nt(n),t,{desc:new V(t,"flatMap",[n])})}function Nn(t,r){return Ct(function(t){if(t instanceof vt){var n=t.error;return r(n)}return t},t,{mapError:!0,desc:new V(t,"flatMapError",[r])})}var Fn=[],Ln=!1;function Vn(n){if(Fn.length&&!Ln)try{Ln=!0,Fn.forEach(function(t){t(n)})}finally{Ln=!1}}function qn(t,n){var r=E.toFunction(n),e=pr(t)?t.toEventStream(vr):t,i=Cn(e,function(t){return Ft(r(t)).takeUntil(e)});return pr(t)&&(i=i.toProperty()),i.withDesc(new V(t,"flatMapLatest",[r]))}var jn=(Un.prototype.hasSubscribers=function(){return 0<this.subscriptions.length},Un.prototype.removeSub=function(t){return this.subscriptions=E.without(t,this.subscriptions),this.subscriptions},Un.prototype.push=function(t){return t.isEnd&&(this.ended=!0),L.inTransaction(t,this,this.pushIt,[t])},Un.prototype.pushToSubscriptions=function(t){try{for(var n=this.subscriptions,r=n.length,e=0;e<r;e++){var i=n[e];i.sink(t)!==I&&!t.isEnd||this.removeSub(i)}return!0}catch(t){throw this.pushing=!1,this.queue=[],t}},Un.prototype.pushIt=function(t){if(this.pushing)return this.queue.push(t),D;if(t!==this.prevError){for(t.isError&&(this.prevError=t),this.pushing=!0,this.pushToSubscriptions(t),this.pushing=!1;;){var n=this.queue.shift();if(!n)break;this.push(n)}return this.hasSubscribers()?D:(this.unsubscribeFromSource(),I)}},Un.prototype.handleEvent=function(t){return this._handleEvent?this._handleEvent(t):this.push(t)},Un.prototype.unsubscribeFromSource=function(){this.unsubSrc&&this.unsubSrc(),this.unsubSrc=void 0},Un.prototype.subscribe=function(t){var n=this;if(this.ended)return t(wt()),a;var r={sink:t};return this.subscriptions.push(r),1===this.subscriptions.length&&(this.unsubSrc=this._subscribe(this.handleEvent)),function(){if(n.removeSub(r),!n.hasSubscribers())return n.unsubscribeFromSource()}},Un.prototype.inspect=function(){return this.observable.toString()},Un);function Un(t,n,r){this.pushing=!1,this.ended=!1,this.prevError=void 0,this.unsubSrc=void 0,this._subscribe=n,this._handleEvent=r,this.subscribe=E.bind(this.subscribe,this),this.handleEvent=E.bind(this.handleEvent,this),this.subscriptions=[],this.observable=t,this.queue=[]}var Qn,zn=(n(Hn,Qn=jn),Hn.prototype.push=function(t){return t.isEnd&&(this.propertyEnded=!0),t instanceof Z?(this.current=new R(t),this.currentValueRootId=L.currentEventId()):t.hasValue&&console.error("Unknown event, two Bacons loaded?",t.constructor),Qn.prototype.push.call(this,t)},Hn.prototype.maybeSubSource=function(t,n){return n===I?a:this.propertyEnded?(t(wt()),a):Qn.prototype.subscribe.call(this,t)},Hn.prototype.subscribe=function(t){var n=this,r=D;if(this.current.isDefined&&(this.hasSubscribers()||this.propertyEnded)){var e=L.currentEventId(),i=this.currentValueRootId;return!this.propertyEnded&&i&&e&&e!==i?L.whenDoneWith(this.observable,function(){if(n.currentValueRootId===i)return t(yt(n.current.get().value))}):L.inTransaction(void 0,this,function(){return r=t(yt(n.current.get().value))},[]),this.maybeSubSource(t,r)}return this.maybeSubSource(t,r)},Hn.prototype.inspect=function(){return this.observable+" current= "+this.current},Hn);function Hn(t,n,r){var e=Qn.call(this,t,n,r)||this;return e.current=X,e.propertyEnded=!1,e.subscribe=E.bind(e.subscribe,e),e}function Rn(t,n,r){return Ct(Nt(r),t,{desc:new V(t,"flatMapWithConcurrencyLimit",[n,r]),limit:n})}function Yn(t,n,r){var e=function(t){if(void 0===t)return;if("number"!=typeof t)return t;var n=t;return function(t){return A.scheduler.setTimeout(t,n)}}(n);function i(t){return t.values.length===r?t.flush():void 0!==e?t.schedule(e):void 0}var o=new V(t,"bufferWithTimeOrCount",[n,r]);return function(t,r,n){void 0===r&&(r=a);void 0===n&&(n=a);var e=D,i=new Xn(n,r);return t.transform(function(t,n){return i.push=n,Dt(t)?(i.values.push(t.value),r(i)):St(t)?e=n(t):It(t)&&(i.end=t,i.scheduled||i.flush()),e}).withDesc(new V(t,"buffer",[]))}(t,i,i).withDesc(o)}var Xn=($n.prototype.flush=function(){if(this.scheduled&&(A.scheduler.clearTimeout(this.scheduled),this.scheduled=null),0<this.values.length){var t=this.values;this.values=[];var n=this.push(bt(t));if(null!=this.end)return this.push(this.end);if(n!==I)return this.onFlush(this)}else if(null!=this.end)return this.push(this.end)},$n.prototype.schedule=function(t){var n=this;if(!this.scheduled)return this.scheduled=t(function(){return n.flush()})},$n);function $n(t,n){this.push=function(t){return D},this.scheduled=null,this.end=void 0,this.values=[],this.onFlush=t,this.onInput=n}function Gn(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=hn(t);return o.length?new dr(new V("Bacon","mergeAll",o),function(e){var i=0,t=m(function(t){return function(r){return t.subscribeInternal(function(t){if(t.isEnd)return++i===o.length?e(wt()):D;t=t.toNext();var n=e(t);return n===I&&r(),n})}},o);return new Mt(t).unsubscribe}):Jt()}function Jn(r,e){return En(function(t){var n=A.scheduler.setTimeout(function(){return t([mt(e),wt()])},r);return function(){return A.scheduler.clearTimeout(n)}}).withDesc(new V("Bacon","later",[r,e]))}function Kn(r){return function(t,n){return t.filter(r)?n(t):(n(wt()),I)}}function Zn(r){var e=!1;return function(t,n){return!e&&Dt(t)&&r(t.value)?D:(t.hasValue&&(e=!0),n(t))}}function tr(o,u,s){void 0===s&&(s=E.id);var c={};return o.transform(_n(xn(function(t){return!c[u(t)]}),fn(function(t){var e=u(t),n=o.changes().filter(function(t){return u(t)===e}),r=Pt(t).concat(n),i=s(r,t).toEventStream().transform(function(t,n){var r=n(t);return t.isEnd&&delete c[e],r});return c[e]=i})))}var nr={};function rr(e,s){var c=!1,f=[],a=!1;return new dr(new V(e,"holdWhen",[s]),function(o){function u(t){return t&&t(),n.empty()&&r?o(wt()):D}var n=new Mt,r=!1;return n.add(function(t,i){return s.subscribeInternal(function(t){if(Dt(t)){c=t.value;var n=D;if(!c){var r=f;f=[];for(var e=0;e<r.length;e++)n=o(bt(r[e]));a&&(o(wt()),i(),n=I)}return n}return t.isEnd?u(i):o(t)})}),n.add(function(t,n){return e.subscribeInternal(function(t){return c&&Dt(t)?(f.push(t.value),D):t.isEnd&&f.length?(a=!0,u(n)):o(t)})}),r=!0,u(),n.unsubscribe})}function er(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var e=ln(arguments);n=e[0],t=e[1];return Kt([n=E.map(function(t){return t.toEventStream()},n),t]).withDesc(new V("Bacon","zipWith",[t].concat(n)))}function ir(i){function c(t,n,r){var e;return(e=t)[e.length-1][n]=r}function f(t){return v(t)?[]:{}}function a(t){if(d(t))return 1;if(t&&(t.constructor==Object||t.constructor==Array))for(var n in t){if(Object.prototype.hasOwnProperty.call(t,n))if(a(t[n]))return 1}}function n(t,n){if(d(n))l.push(n),p.push((u=t,s=l.length-1,function(t,n){c(t,u,n[s])}));else if(a(n)){p.push((i=t,o=n,function(t){var n=f(o);c(t,i,n),t.push(n)})),h(n),p.push(function(t){t.pop()})}else p.push((r=t,e=n,function(t){c(t,r,e)}));var r,e,i,o,u,s}function h(t){E.each(t,n)}var p=[],l=[];return(a(i)?(h(i),dn(l).map(function(t){for(var n=f(i),r=[n],e=0;e<p.length;e++)(0,p[e])(r,t);return n})):an(i)).withDesc(new V("Bacon","combineTemplate",[i]))}function or(t,n){function r(n,r){return t.subscribe(function(t){return Dt(t)&&n(t.value),St(t)&&r(t.error),I})}if("function"==typeof n)return new n(r);if("function"==typeof Promise)return new Promise(r);throw new Error("There isn't default Promise, use shim or parameter")}var ur=0,sr=(cr.prototype.awaiting=function(t){return vn([n=this,r=t],vr).map(function(t){return 0===t[1].length}).toProperty(!1).skipDuplicates().withDesc(new V(n,"awaiting",[r]));var n,r},cr.prototype.bufferingThrottle=function(t){return e=new V(n=this,"bufferingThrottle",[r=t]),n.transformChanges(e,function(t){return t.flatMapConcat(function(t){return Pt(t).concat(Jn(r,t).errors())})});var n,r,e},cr.prototype.combine=function(t,n){return wn(this,t,n).withDesc(new V(this,"combine",[t,n]))},cr.prototype.debounce=function(t){return r=t,(n=this).transformChanges(new V(n,"debounce",[r]),function(t){return t.flatMapLatest(function(t){return Jn(r,t)})});var n,r},cr.prototype.debounceImmediate=function(t){return r=t,(n=this).transformChanges(new V(n,"debounceImmediate",[r]),function(t){return t.flatMapFirst(function(t){return Pt(t).concat(Jn(r,t).errors())})});var n,r},cr.prototype.decode=function(t){return r=t,(n=this).combine(ir(r),function(t,n){return n[t]}).withDesc(new V(n,"decode",[r]));var n,r},cr.prototype.delay=function(t){return r=t,(n=this).transformChanges(new V(n,"delay",[r]),function(t){return t.flatMap(function(t){return Jn(r,t)})});var n,r},cr.prototype.deps=function(){return this.desc.deps()},cr.prototype.diff=function(t,n){return i=n,kn(xt(r=this,[e=t,nr],function(t,n){return[n,i(t[0],n)]}),_n(xn(function(t){return t[1]!==nr}),fn(function(t){return t[1]})),new V(r,"diff",[e,i]));var r,e,i},cr.prototype.doAction=function(t){return this.transform(function(t,n){return Dt(t)&&r(t.value),n(t)},new V(this,"doAction",[r=t]));var r},cr.prototype.doEnd=function(t){return this.transform(function(t,n){return It(t)&&r(),n(t)},new V(this,"doEnd",[r=t]));var r},cr.prototype.doError=function(t){return this.transform(function(t,n){return St(t)&&r(t.error),n(t)},new V(this,"doError",[r=t]));var r},cr.prototype.doLog=function(){for(var r,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this.transform(function(t,n){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log&&console.log.apply(console,r.concat([t.log()])),n(t)},new V(this,"doLog",r=t))},cr.prototype.endAsValue=function(){return this.transform(function(t,n){return It(t)?(n(bt({})),n(wt()),I):D})},cr.prototype.endOnError=function(t){return void 0===t&&(t=function(t){return!0}),void 0===(r=t)&&(r=function(t){return!0}),(n=this).transform(function(t,n){return St(t)&&r(t.error)?(n(t),n(wt())):n(t)},new V(n,"endOnError",[]));var n,r},cr.prototype.errors=function(){return this.filter(function(t){return!1}).withDesc(new V(this,"errors"))},cr.prototype.filter=function(t){return Bn(n=this,r=t,xn,new V(n,"filter",[r]));var n,r},cr.prototype.first=function(){return _t(1,this,new V(this,"first"))},cr.prototype.firstToPromise=function(t){return or(this,t)},cr.prototype.fold=function(t,n){return On(this,t,n)},cr.prototype.forEach=function(t){return void 0===t&&(t=Q),this.onValue(t)},cr.prototype.holdWhen=function(t){return rr(this,t)},cr.prototype.inspect=function(){return this.toString()},cr.prototype.internalDeps=function(){return this.initialDesc.deps()},cr.prototype.last=function(){return(t=this).transform(function(t,n){return It(t)?(r&&n(r),n(wt()),I):Dt(t)?(r=t,D):n(t)}).withDesc(new V(t,"last",[]));var t,r},cr.prototype.log=function(){for(var n,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return n=t,this.subscribe(function(t){return"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,n.concat([t.log()])),D}),this},cr.prototype.mapEnd=function(t){return this.transform((n=t,r=E.toFunction(n),function(t,n){return It(t)?(n(bt(r(t))),n(wt()),I):n(t)}),new V(this,"mapEnd",[t]));var n,r},cr.prototype.mapError=function(t){return this.transform((n=t,r=E.toFunction(n),function(t,n){return St(t)?n(bt(r(t.error))):n(t)}),new V(this,"mapError",[t]));var n,r},cr.prototype.name=function(t){return this._name=t,this},cr.prototype.onEnd=function(n){return void 0===n&&(n=z),this.subscribe(function(t){return t.isEnd?n():D})},cr.prototype.onError=function(n){return void 0===n&&(n=Q),this.subscribe(function(t){return St(t)?n(t.error):D})},cr.prototype.onValue=function(n){return void 0===n&&(n=Q),this.subscribe(function(t){return Dt(t)?n(t.value):D})},cr.prototype.onValues=function(n){return this.onValue(function(t){return n.apply(void 0,t)})},cr.prototype.reduce=function(t,n){return On(this,t,n)},cr.prototype.sampledBy=function(t){return In(this,t,arguments[1])},cr.prototype.scan=function(t,n){return xt(this,t,n)},cr.prototype.skip=function(t){return r=t,(n=this).transform(function(t,n){return t.hasValue&&0<r?(r--,D):n(t)},new V(n,"skip",[r]));var n,r},cr.prototype.skipDuplicates=function(t){return kt(this,t)},cr.prototype.skipErrors=function(){return(t=this).transform(function(t,n){return St(t)?D:n(t)},new V(t,"skipErrors",[]));var t},cr.prototype.skipUntil=function(t){return n=this,e=(r=t).transform(_n(Bt(1),fn(!0))).toProperty().startWith(!1),n.filter(e).withDesc(new V(n,"skipUntil",[r]));var n,r,e},cr.prototype.skipWhile=function(t){return Bn(n=this,r=t,Zn,new V(n,"skipWhile",[r]));var n,r},cr.prototype.slidingWindow=function(t,n){return void 0===n&&(n=0),e=t,void 0===(i=n)&&(i=0),(r=this).scan([],function(t,n){return t.concat([n]).slice(-e)}).filter(function(t){return t.length>=i}).withDesc(new V(r,"slidingWindow",[e,i]));var r,e,i},cr.prototype.subscribe=function(t){var n=this;return void 0===t&&(t=Q),L.wrappedSubscribe(this,function(t){return n.subscribeInternal(t)},t)},cr.prototype.take=function(t){return _t(t,this)},cr.prototype.takeUntil=function(t){return r=t,e=vn([(n=this).mapEnd(Pn),r.skipErrors()],vr),n instanceof ar&&(e=e.toProperty()),e.transform(function(t,n){if(Dt(t)){var r=t.value,e=r[0];if(r[1].length)return n(wt());for(var i=D,o=0;o<e.length;o++){var u=e[o];if(u===Pn)return n(wt());i=n(bt(u))}return i}return n(t)},new V(n,"takeUntil",[r]));var n,r,e},cr.prototype.takeWhile=function(t){return Bn(n=this,r=t,Kn,new V(n,"takeWhile",[r]));var n,r},cr.prototype.throttle=function(t){return r=t,(n=this).transformChanges(new V(n,"throttle",[r]),function(t){return t.bufferWithTime(r).map(function(t){return t[t.length-1]})});var n,r},cr.prototype.toPromise=function(t){return n=t,this.last().firstToPromise(n);var n},cr.prototype.toString=function(){return this._name?this._name:this.desc.toString()},cr.prototype.withDesc=function(t){return t&&(this.desc=t),this},cr.prototype.withDescription=function(t,n){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];return this.desc=j.apply(void 0,u([t,n],r)),this},cr.prototype.zip=function(t,n){return r=this,e=t,er(n||Array,r,e).withDesc(new V(r,"zip",[e]));var r,e},cr);function cr(t){this.id=++ur,this._isObservable=!0,this.desc=t,this.initialDesc=t}var fr,ar=(n(hr,fr=sr),hr.prototype.and=function(t){return r=t,(n=this).combine(Wn(r),function(t,n){return!(!t||!n)}).withDesc(new V(n,"and",[r]));var n,r},hr.prototype.changes=function(){var t=this;return new dr(new V(this,"changes",[]),function(n){return t.dispatcher.subscribe(function(t){return t.isInitial?D:n(t)})})},hr.prototype.concat=function(n){return this.transformChanges(j(this,"concat",n),function(t){return t.concat(n)})},hr.prototype.transformChanges=function(t,n){return e=t,u=n(new dr(j(r=this,"changes",[]),function(n){return r.dispatcher.subscribe(function(t){return!i&&Et(t)&&(i=t,L.whenDoneWith(s,function(){if(!o)throw new Error("Init sequence fail");o(i)})),t.isInitial?D:n(t)})},void 0,vr)),s=Ot(e,function(n){return o=n,u.dispatcher.subscribe(function(t){n(t)})});var r,e,i,o,u,s},hr.prototype.flatMap=function(t){return Cn(this,t)},hr.prototype.flatMapConcat=function(t){return gn(this,t)},hr.prototype.flatMapError=function(t){return Nn(this,t)},hr.prototype.flatMapEvent=function(t){return Lt(this,t)},hr.prototype.flatMapFirst=function(t){return Tn(this,t)},hr.prototype.flatMapLatest=function(t){return qn(this,t)},hr.prototype.flatMapWithConcurrencyLimit=function(t,n){return Rn(this,t,n)},hr.prototype.groupBy=function(t,n){return tr(this,t,n)},hr.prototype.map=function(t){return cn(this,t)},hr.prototype.not=function(){return Mn(this)},hr.prototype.or=function(t){return r=t,(n=this).combine(Wn(r),function(t,n){return t||n}).withDesc(new V(n,"or",[r]));var n,r},hr.prototype.sample=function(t){return An(n=this,Dn(r=t,{}),function(t,n){return t}).withDesc(new V(n,"sample",[r]));var n,r},hr.prototype.startWith=function(t){return r=t,(n=this).scan(r,function(t,n){return n}).withDesc(new V(n,"startWith",[r]));var n,r},hr.prototype.subscribeInternal=function(t){return void 0===t&&(t=Q),this.dispatcher.subscribe(t)},hr.prototype.toEventStream=function(t){var r=this;return new dr(new V(this,"toEventStream",[]),function(n){return r.subscribeInternal(function(t){return n(t.toNext())})},void 0,t)},hr.prototype.toProperty=function(){return this},hr.prototype.transform=function(t,n){return kn(this,t,n)},hr.prototype.withLatestFrom=function(t,n){return un(this,t,n)},hr.prototype.withStateMachine=function(t,n){return H(t,n,this)},hr);function hr(t,n,r){var e=fr.call(this,t)||this;return e._isProperty=!0,e.dispatcher=new zn(e,n,r),Vn(e),e}function pr(t){return t._isProperty}var lr,vr={forceAsync:!1},dr=(n(yr,lr=sr),yr.prototype.bufferWithTime=function(t){return Yn(n=this,r=t,Number.MAX_VALUE).withDesc(new V(n,"bufferWithTime",[r]));var n,r},yr.prototype.bufferWithCount=function(t){return Yn(n=this,void 0,r=t).withDesc(new V(n,"bufferWithCount",[r]));var n,r},yr.prototype.bufferWithTimeOrCount=function(t,n){return Yn(this,t,n)},yr.prototype.changes=function(){return this},yr.prototype.concat=function(t,n){return r=n,new dr(new V(e=this,"concat",[i=t]),function(n){var r=a,t=e.dispatcher.subscribe(function(t){return t.isEnd?(r=i.toEventStream().dispatcher.subscribe(n),D):n(t)});return function(){return t(),r()}},void 0,r);var e,i,r},yr.prototype.transformChanges=function(t,n){return n(this).withDesc(t)},yr.prototype.flatMap=function(t){return Cn(this,t)},yr.prototype.flatMapConcat=function(t){return gn(this,t)},yr.prototype.flatMapError=function(t){return Nn(this,t)},yr.prototype.flatMapFirst=function(t){return Tn(this,t)},yr.prototype.flatMapLatest=function(t){return qn(this,t)},yr.prototype.flatMapWithConcurrencyLimit=function(t,n){return Rn(this,t,n)},yr.prototype.flatMapEvent=function(t){return Lt(this,t)},yr.prototype.flatScan=function(t,n){return i=n,o=e=t,(r=this).flatMapConcat(function(t){return Ft(i(o,t)).doAction(function(t){return o=t})}).toProperty().startWith(e).withDesc(new V(r,"flatScan",[e,i]));var r,e,i,o},yr.prototype.groupBy=function(t,n){return tr(this,t,n)},yr.prototype.map=function(t){return cn(this,t)},yr.prototype.merge=function(t){return Gn(this,t).withDesc(new V(this,"merge",[t]))},yr.prototype.not=function(){return Mn(this)},yr.prototype.startWith=function(t){return n=this,Pt(r=t).concat(n).withDesc(new V(n,"startWith",[r]));var n,r},yr.prototype.subscribeInternal=function(t){return void 0===t&&(t=Q),this.dispatcher.subscribe(t)},yr.prototype.toEventStream=function(){return this},yr.prototype.toProperty=function(t){var n,r=arguments.length?(n=t)&&(n._isSome||n._isNone)?n:new R(n):X,e=this.dispatcher,i=new V(this,"toProperty",Array.prototype.slice.apply(arguments)),o=e.subscribe;return new ar(i,Tt(r,o))},yr.prototype.transform=function(t,n){return i=n,new dr(new V(r=this,"transform",[e=t]),function(n){return r.subscribeInternal(function(t){return e(t,n)})},void 0,vr).withDesc(i);var r,e,i},yr.prototype.withLatestFrom=function(t,n){return on(this,t,n)},yr.prototype.withStateMachine=function(t,n){return H(t,n,this)},yr);function yr(t,n,r,e){var o,u,s,i=lr.call(this,t)||this;return i._isEventStream=!0,e!==vr&&(o=i,u=n,s=!1,n=function(r){var e,n=L.isInTransaction();function i(){var t=e||[];e=void 0;for(var n=0;n<t.length;n++)r(t[n])}s=!0;try{return u(function(t){return s||e?(e?e.push(t):(e=[t],n?L.soonButNotYet(o,i):A.scheduler.setTimeout(i,0)),D):r(t)})}finally{s=!1}}),i.dispatcher=new jn(i,n,r),Vn(i),i}function br(t,n){return new dr(t,n)}function wr(t,n){return new dr(t,n,void 0,vr)}function mr(t){return"undefined"!=typeof Symbol&&Symbol[t]?Symbol[t]:"undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol[t]=Symbol.for(t):"@@"+t}var gr=(Er.prototype.subscribe=function(t,n,r){var e="function"==typeof t?{next:t,error:n,complete:r}:t,i={closed:!1,unsubscribe:function(){i.closed=!0,o()}},o=this.observable.subscribe(function(t){Dt(t)&&e.next?e.next(t.value):St(t)?(e.error&&e.error(t.error),i.unsubscribe()):t.isEnd&&(i.closed=!0,e.complete&&e.complete())});return i},Er);function Er(t){this.observable=t}function Sr(r){return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return function(t){return r.apply(void 0,[t].concat(n))}}}gr.prototype[mr("observable")]=function(){return this},sr.prototype.toESObservable=function(){return new gr(this)},sr.prototype[mr("observable")]=sr.prototype.toESObservable;var Dr=[["addEventListener","removeEventListener"],["addListener","removeListener"],["on","off"],["bind","unbind"]];function Ir(r,e,t){var n=function(t){for(var n,r=0;r<Dr.length;r++){var e=[t[(n=Dr[r])[0]],t[n[1]]];if(e[0]&&e[1])return e}for(var i=0;i<Dr.length;i++){var o=t[(n=Dr[i])[0]];if(o)return[o,function(){}]}throw new Error("No suitable event methods in "+t)}(r),i=n[0],o=n[1],u=new V("Bacon","fromEvent",[r,e]);return En(function(t){return n=e,E.isFunction(n)?(e(i.bind(r),t),function(){return e(o.bind(r),t)}):(i.call(r,e,t),function(){return o.call(r,e,t)});var n},t).withDesc(u)}function Ar(s){var c=0;return En(function(n){var r=!1,e=D,i=function(){};function o(t){return t.isEnd?(r?u():r=!0,D):e=n(t)}function u(){var t;for(r=!0;r&&e!==I;)t=s(c++),r=!1,t?i=t.subscribeInternal(o):n(wt());r=!0}return u(),function(){return i()}}).withDesc(new V("Bacon","repeat",[s]))}function kr(t){return Jn(t,"").filter(!1).withDesc(new V("Bacon","silence",[t]))}function _r(t){return[mt(t),wt()]}var Br,xr=(Br=function(t){for(var r,e,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return E.isFunction(t)?n.length?(r=t,e=n,function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return r.apply(void 0,e.concat(t))}):t:E.always(t)},function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if("object"==typeof t&&n.length){var e=t,i=n[0];t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e[i].apply(e,t)},n=n.slice(1)}return Br.apply(void 0,u([t],n))});function Mr(t,n){return xr.apply(void 0,u([t],n))}var Wr,Tr=(n(Or,Wr=dr),Or.prototype.plug=function(t){var n=this;if(!this.ended){var r={input:t,unsub:void 0};return this.subscriptions.push(r),void 0!==this.sink&&this.subscribeInput(r),function(){return n.unsubscribeInput(t)}}},Or.prototype.end=function(){if(this.ended=!0,this.unsubAll(),"function"==typeof this.sink)return this.sink(wt())},Or.prototype.push=function(t){if(!this.ended&&"function"==typeof this.sink){var n=!this.pushing;if(!n)return this.pushQueue||(this.pushQueue=[]),void this.pushQueue.push(t);this.pushing=!0;try{return this.sink(bt(t))}finally{if(n&&this.pushQueue){for(var r=0;r<this.pushQueue.length;){var e=this.pushQueue[r];this.sink(bt(e)),r++}this.pushQueue=void 0}this.pushing=!1}}},Or.prototype.error=function(t){if("function"==typeof this.sink)return this.sink(new vt(t))},Or.prototype.unsubAll=function(){for(var t,n=this.subscriptions,r=0;r<n.length;r++)"function"==typeof(t=n[r]).unsub&&t.unsub()},Or.prototype.subscribeAll=function(t){if(this.ended)t(wt());else{this.sink=t;for(var n,r=this.subscriptions.slice(),e=0;e<r.length;e++)n=r[e],this.subscribeInput(n)}return this.unsubAll},Or.prototype.guardedSink=function(n){var r=this;return function(t){return t.isEnd?(r.unsubscribeInput(n),I):r.sink?r.sink(t):D}},Or.prototype.subscribeInput=function(t){return t.unsub=t.input.subscribeInternal(this.guardedSink(t.input)),t.unsub},Or.prototype.unsubscribeInput=function(t){for(var n,r=this.subscriptions,e=0;e<r.length;e++)if((n=r[e]).input===t)return"function"==typeof n.unsub&&n.unsub(),void this.subscriptions.splice(e,1)},Or);function Or(){var n=Wr.call(this,new V("Bacon","Bus",[]),function(t){return n.subscribeAll(t)})||this;return n.pushing=!1,n.pushQueue=void 0,n.ended=!1,n.subscriptions=[],n.unsubAll=E.bind(n.unsubAll,n),n.push=E.bind(n.push,n),n.subscriptions=[],n.ended=!1,n}var Pr={asEventStream:function(n,r,t){var e=this;return E.isFunction(r)&&(t=r,r=void 0),En(function(t){return e.on(n,r,t),function(){return e.off(n,r,t)}},t).withDesc(new V(this.selector||this,"asEventStream",[n]))},init:function(t){t.fn.asEventStream=Pr.asEventStream}};t.$=Pr,t.Bus=Tr,t.CompositeUnsubscribe=Mt,t.Desc=V,t.End=ht,t.Error=vt,t.Event=G,t.EventStream=dr,t.Initial=ot,t.Next=rt,t.Observable=sr,t.Property=ar,t.Value=Z,t._=E,t.combine=bn,t.combineAsArray=dn,t.combineTemplate=ir,t.combineTwo=wn,t.combineWith=yn,t.concatAll=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=hn(t);return(r.length?c(p(r),f(r).toEventStream(),function(t,n){return t.concat(n)}):Jt()).withDesc(new V("Bacon","concatAll",r))},t.constant=an,t.fromArray=function(s){if(s.length){var c=0,f=new dr(new V("Bacon","fromArray",[s]),function(r){var e=!1,i=D,o=!1,u=!1;return L.soonButNotYet(f,function t(){if(u=!0,!o){if(c===s.length)return r(wt()),!1;for(o=!0;u;)if(u=!1,i!==I&&!e){var n=s[c++];(i=r(mt(n)))!==I&&(c===s.length?r(wt()):L.afterTransaction(f,t))}return o=!1}}),function(){return e=!0}});return f}return Jt().withDesc(new V("Bacon","fromArray",s))},t.fromBinder=En,t.fromCallback=function(n){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return En(function(t){return Mr(n,r)(t),a},function(t){return[t,wt()]}).withDesc(new V("Bacon","fromCallback",u([n],r)))},t.fromESObservable=function(t){var r;r=t[mr("observable")]?t[mr("observable")]():t;var n=new V("Bacon","fromESObservable",[r]);return new dr(n,function(n){var t=r.subscribe({error:function(t){n(new vt(t)),n(new ht)},next:function(t){n(new rt(t))},complete:function(){n(new ht)}});return t.unsubscribe?function(){t.unsubscribe()}:t})},t.fromEvent=Ir,t.fromEventTarget=Ir,t.fromNodeCallback=function(n){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return En(function(t){return Mr(n,r)(t),a},function(t,n){return t?[new vt(t),wt()]:[n,wt()]}).withDesc(new V("Bacon","fromNodeCallback",u([n],r)))},t.fromPoll=Sn,t.fromPromise=function(r,e,t){return void 0===t&&(t=_r),En(function(n){var t=r.then(n,function(t){return n(new vt(t))});return t&&"function"==typeof t.done&&t.done(),e?function(){if("function"==typeof r.abort)return r.abort()}:function(){}},t).withDesc(new V("Bacon","fromPromise",[r]))},t.getScheduler=function(){return A.scheduler},t.groupSimultaneous=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return vn(hn(t))},t.hasValue=Dt,t.interval=Dn,t.isEnd=It,t.isError=St,t.isEvent=gt,t.isInitial=Et,t.isNext=function(t){return t.isNext},t.later=Jn,t.mergeAll=Gn,t.more=D,t.never=Jt,t.noMore=I,t.nullSink=Q,t.nullVoidSink=z,t.onValues=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return dn(t.slice(0,t.length-1)).onValues(t[arguments.length-1])},t.once=Pt,t.repeat=Ar,t.repeatedly=function(t,n){var r=0;return Sn(t,function(){return n[r++%n.length]}).withDesc(new V("Bacon","repeatedly",[t,n]))},t.retry=function(t){if(!E.isFunction(t.source))throw new Error("'source' option has to be a function");var i=t.source,o=t.retries||0,u=0,s=t.delay||function(){return 0},c=t.isRetryable||function(){return!0},f=!1,a=null;return Ar(function(t){function n(){return i(t).endOnError().transform(function(t,n){return St(t)?c((a=t).error)&&(0===o||u<o)?D:(f=!0,n(t)):(Dt(t)&&(f=!(a=null)),n(t))})}if(!f){if(a){var r={error:a.error,retriesDone:u},e=kr(s(r));return u++,e.concat(Pt(null).flatMap(n))}return n()}}).withDesc(new V("Bacon","retry",[t]))},t.sequentially=function(t,n){var r=0;return Sn(t,function(){var t=n[r++];return r<n.length?t:r===n.length?[mt(t),wt()]:wt()}).withDesc(new V("Bacon","sequentially",[t,n]))},t.setScheduler=function(t){A.scheduler=t},t.silence=kr,t.spy=function(t){return Fn.push(t)},t.try=function(n){return function(t){try{return Pt(n(t))}catch(t){return Pt(new vt(t))}}},t.update=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];for(var e=rn(n),i=0;i<e.length;i++){var o=e[i];o[1]=Sr(o[1])}return Kt.apply(void 0,e).scan(t,function(t,n){return n(t)}).withDesc(new V("Bacon","update",u([t],n)))},t.version="3.0.17",t.when=Kt,t.zipAsArray=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return Kt([E.map(function(t){return t.toEventStream()},hn(t)),function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t}]).withDesc(new V("Bacon","zipAsArray",t))},t.zipWith=er,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).Bacon={})}(this,function(t){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])})(t,n)};function n(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}function u(){for(var t=0,n=0,r=arguments.length;n<r;n++)t+=arguments[n].length;var e=Array(t),i=0;for(n=0;n<r;n++)for(var o=arguments[n],u=0,s=o.length;u<s;u++,i++)e[i]=o[u];return e}function a(){}var v=Array.isArray||function(t){return t instanceof Array};function d(t){return t&&t._isObservable}function y(t,n){for(var r=0;r<t.length;r++)if(!n(t[r]))return!1;return!0}function i(t,n){for(var r=0;r<t.length;r++)if(n(t[r]))return!0;return!1}function o(t,n){return-1!==w(t,n)}function b(t,n){for(var r,e=[],i=0;i<n.length;i++)t(r=n[i])&&e.push(r);return e}function s(r){return function(t,n){return r(n,t)}}function c(t,n,r){for(var e=0;e<t.length;e++)n=r(n,t[e]);return n}function f(t){return t[0]}var w=Array.prototype.indexOf?function(t,n){return t.indexOf(n)}:function(t,n){for(var r=0;r<t.length;r++)if(n===t[r])return r;return-1};function h(t){return"function"==typeof t}function m(t,n){for(var r,e=[],i=0;i<n.length;i++)r=n[i],e.push(t(r));return e}function p(t){return t.slice(1,t.length)}function l(t){return v(t)?t:[t]}function g(n){return"function"==typeof n?n:function(t){return n}}var E={indexOf:w,indexWhere:function(t,n){for(var r=0;r<t.length;r++)if(n(t[r]))return r;return-1},head:f,always:function(t){return function(){return t}},negate:function(n){return function(t){return!n(t)}},empty:function(t){return 0===t.length},tail:p,filter:b,map:m,each:function(t,n){for(var r in t){if(Object.prototype.hasOwnProperty.call(t,r))n(r,t[r])}},toArray:l,contains:o,id:function(t){return t},last:function(t){return t[t.length-1]},all:y,any:i,without:function(n,t){return b(function(t){return t!==n},t)},remove:function(t,n){var r=w(n,t);if(0<=r)return n.splice(r,1)},fold:c,flatMap:function(r,t){return c(t,[],function(t,n){return t.concat(r(n))})},bind:function(t,n){return function(){return t.apply(n,arguments)}},isFunction:h,toFunction:g,toString:function t(n){var r={}.hasOwnProperty;try{if(S++,null==n)return"undefined";if(h(n))return"function";if(v(n))return 5<S?"[..]":"["+m(t,n).toString()+"]";if(null!=(null!=n?n.toString:void 0)&&n.toString!==Object.prototype.toString)return n.toString();if("object"!=typeof n)return n;if(5<S)return"{..}";var e=[];for(var i in n)if(r.call(n,i)){var o=function(){try{return n[i]}catch(t){return t}}();e.push(t(i)+":"+t(o))}return"{"+e+"}"}finally{S--}}},S=0,D=void 0,I="<no-more>",A={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()}}};var k=void 0,_=[],B={},x=[],M=0,W={},T=!1;function O(t){t<=M||(x[t-1]||(x[t-1]=[[],0]),M=t)}function P(t,n){if(!k&&!T)return n();O(1);for(var r=0;r<M-1&&!C(t,x[r][0]);)r++;x[r][0].push([t,n]),k||N()}function C(t,n){for(var r=0;r<n.length;r++)if(n[r][0].id==t.id)return 1}function N(){var t=M;if(t){var n=!T;T=!0;try{for(;t<=M;){var r=x[M-1];if(!r)throw new Error("Unexpected stack top: "+r);var e=r[0],i=r[1];if(!(i<e.length)){r[0]=[],r[1]=0;break}var o=e[i][1];r[1]++,O(M+1);var u=!1;try{for(o(),u=!0;t<M&&0==x[M-1][0].length;)M--}finally{u||(x=[],M=0)}}}finally{n&&(T=!1)}}}function r(t,n){if(k){var r=B[t.id];return void 0===r?(r=B[t.id]=[n],_.push(t)):r.push(n)}return n()}function F(t,n){var r=_[t],e=r.id,i=B[e];_.splice(t,1),delete B[e],n&&0<_.length&&function t(n){if(W[n.id])return;var r=n.internalDeps();for(var e,i=0;i<r.length;i++)if(e=r[i],t(e),B[e.id]){var o=E.indexOf(_,e);F(o,!1)}W[n.id]=!0}(r);for(var o=0;o<i.length;o++)(0,i[o])()}var L={toString:function(){return E.toString({rootEvent:k,processingAfters:T,waiterObs:_,waiters:B,aftersStack:x,aftersStackHeight:M,flushed:W})},whenDoneWith:r,hasWaiters:function(){return 0<_.length},inTransaction:function(t,n,r,e){if(k)return r.apply(n,e);k=t;try{var i=r.apply(n,e);!function(){for(;0<_.length;)F(0,!0);W={}}()}finally{k=void 0,N()}return i},currentEventId:function(){return k?k.id:void 0},wrappedSubscribe:function(n,t,r){function e(){i=!0,u()}var i=!1,o=!1,u=function(){o=!0};return u=t(function(t){return P(n,function(){i||r(t)===I&&e()}),D}),o&&u(),e},afterTransaction:P,soonButNotYet:function(t,n){k?r(t,n):A.scheduler.setTimeout(n,0)},isInTransaction:function(){return void 0!==k}},V=(q.prototype.deps=function(){return this.cachedDeps||(this.cachedDeps=U([this.context].concat(this.args))),this.cachedDeps},q.prototype.toString=function(){var t=E.map(E.toString,this.args);return E.toString(this.context)+"."+E.toString(this.method)+"("+t+")"},q);function q(t,n,r){void 0===r&&(r=[]),this._isDesc=!0,this.context=t,this.method=n,this.args=r}function j(t,n){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];var i=t||n;return i&&i._isDesc?t||n:new V(t,n,r)}function U(t){return v(t)?E.flatMap(U,t):d(t)?[t]:null!=t&&t._isSource?[t.obs]:[]}function Q(){return D}function z(){return D}function H(t,n,r){return r.transform((c=t,function(t,n){var r=s(c,t),e=r[0],i=r[1];c=e;for(var o=D,u=0;u<i.length;u++)if((o=n(i[u]))===I)return o;return o}),new V(r,"withStateMachine",[t,s=n]));var s,c}var R=(Y.prototype.getOrElse=function(t){return this.value},Y.prototype.get=function(){return this.value},Y.prototype.filter=function(t){return t(this.value)?new Y(this.value):X},Y.prototype.map=function(t){return new Y(t(this.value))},Y.prototype.forEach=function(t){t(this.value)},Y.prototype.toArray=function(){return[this.value]},Y.prototype.inspect=function(){return"Some("+this.value+")"},Y.prototype.toString=function(){return this.inspect()},Y);function Y(t){this._isSome=!0,this.isDefined=!0,this.value=t}var X={_isNone:!0,getOrElse:function(t){return t},get:function(){throw new Error("None.get()")},filter:function(){return X},map:function(){return X},forEach:function(){},isDefined:!1,toArray:function(){return[]},inspect:function(){return"None"},toString:function(){return this.inspect()}};var $=0,G=(J.prototype.filter=function(t){return!0},J.prototype.inspect=function(){return this.toString()},J.prototype.log=function(){return this.toString()},J.prototype.toNext=function(){return this},J);function J(){this.id=++$,this.isEvent=!0,this._isEvent=!0,this.isEnd=!1,this.isInitial=!1,this.isNext=!1,this.isError=!1,this.hasValue=!1}var K,Z=(n(tt,K=G),tt.prototype.fmap=function(t){return this.apply(t(this.value))},tt.prototype.filter=function(t){return t(this.value)},tt.prototype.toString=function(){return E.toString(this.value)},tt.prototype.log=function(){return this.value},tt);function tt(t){var n=K.call(this)||this;if(n.hasValue=!0,t instanceof G)throw new vt("Wrapping an event inside other event");return n.value=t,n}var nt,rt=(n(et,nt=Z),et.prototype.apply=function(t){return new et(t)},et);function et(t){var n=nt.call(this,t)||this;return n.isNext=!0,n._isNext=!0,n}var it,ot=(n(ut,it=Z),ut.prototype.apply=function(t){return new ut(t)},ut.prototype.toNext=function(){return new rt(this.value)},ut);function ut(t){var n=it.call(this,t)||this;return n.isInitial=!0,n._isInitial=!0,n}var st,ct=(n(ft,st=G),ft.prototype.fmap=function(t){return this},ft);function ft(){var t=null!==st&&st.apply(this,arguments)||this;return t.hasValue=!1,t}var at,ht=(n(pt,at=ct),pt.prototype.toString=function(){return"<end>"},pt);function pt(){var t=null!==at&&at.apply(this,arguments)||this;return t.isEnd=!0,t}var lt,vt=(n(dt,lt=ct),dt.prototype.toString=function(){return"<error> "+E.toString(this.error)},dt);function dt(t){var n=lt.call(this)||this;return n.isError=!0,n.error=t,n}function yt(t){return new ot(t)}function bt(t){return new rt(t)}function wt(){return new ht}function mt(t){return t&&t._isEvent?t:bt(t)}function gt(t){return t&&t._isEvent}function Et(t){return t&&t._isInitial}function St(t){return t.isError}function Dt(t){return t.hasValue}function It(t){return t.isEnd}function At(t,n){return t===n}function kt(t,e){void 0===e&&(e=At);var n=new V(t,"skipDuplicates",[]);return H(X,function(t,n){return Dt(n)?n.isInitial||null!=(r=t)&&r._isNone||!e(t.get(),n.value)?[new R(n.value),[n]]:[t,[]]:[t,[n]];var r},t).withDesc(n)}function _t(t,n,r){return n.transform(Bt(t),r||new V(n,"take",[t]))}function Bt(r){return function(t,n){return!t.hasValue||0<--r?n(t):(0===r&&n(t),n(wt()),I)}}function xt(n,t,u){var s,c=t,f=!1;return s=new ar(new V(n,"scan",[t,u]),function(r){function e(){return i||(i=f=!0,(o=r(new ot(c)))===I&&(t(),t=a)),o}var i=!1,t=a,o=D;return t=n.subscribeInternal(function(t){if(Dt(t)){if(f&&t.isInitial)return D;t.isInitial||e(),i=f=!0;var n=u(c,t.value);return c=n,r(t.apply(n))}return t.isEnd&&(o=e()),o!==I?r(t):o}),L.whenDoneWith(s,e),t})}var Mt=(Wt.prototype.add=function(t){var n=this;if(!this.unsubscribed){var r=!1,e=a;this.starting.push(t),e=t(this.unsubscribe,function(){n.unsubscribed||(r=!0,n.remove(e),E.remove(t,n.starting))}),this.unsubscribed||r?e():this.subscriptions.push(e),E.remove(t,this.starting)}},Wt.prototype.remove=function(t){if(!this.unsubscribed)return void 0!==E.remove(t,this.subscriptions)?t():void 0},Wt.prototype.unsubscribe=function(){if(!this.unsubscribed){this.unsubscribed=!0;for(var t=this.subscriptions,n=0;n<t.length;n++)t[n]();this.subscriptions=[],this.starting=[]}},Wt.prototype.count=function(){return this.unsubscribed?0:this.subscriptions.length+this.starting.length},Wt.prototype.empty=function(){return 0===this.count()},Wt);function Wt(t){void 0===t&&(t=[]),this.unsubscribed=!1,this.unsubscribe=E.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 Tt(s,t){return function(n){function r(){if(!e)return s.forEach(function(t){if(e=!0,(u=n(new ot(t)))===I)return o(),o=a})}var e=!1,i=!1,o=a,u=D;return o=t(function(t){return t instanceof Z?t.isInitial&&!i?(s=new R(t.value),D):(t.isInitial||r(),e=!0,s=new R(t.value),n(t)):(t.isEnd&&(u=r()),u!==I?n(t):u)}),i=!0,r(),o}}function Ot(t,n){return new ar(t,Tt(X,n))}function Pt(n){var r=new dr(new V("Bacon","once",[n]),function(t){return L.soonButNotYet(r,function(){t(mt(n)),t(wt())}),a});return r}function Ct(n,t,e){void 0===e&&(e={});var i=t,r=[i],a=[],h=t._isProperty,p=!1,o=(h?Ot:wr)(e.desc||new V(t,"flatMap_",[n]),function(u){var r=new Mt,s=[];function c(t){if(h&&t.isInitial){if(p)return D;p=!0}var o=Ft(n(t));return a.push(o),r.add(function(e,i){return o.subscribeInternal(function(t){if(t.isEnd)return E.remove(o,a),(n=s.shift())&&c(n),f(i),I;t=t.toNext();var n,r=u(t);return r===I&&e(),r})})}function f(t){return t(),r.empty()?u(wt()):D}return r.add(function(t,n){return i.subscribeInternal(function(t){return t.isEnd?f(n):t.isError&&!e.mapError?u(t):e.firstOnly&&1<r.count()?D:r.unsubscribed?I:(e.limit&&r.count()>e.limit?s.push(t):c(t),D)})}),r.unsubscribe});return o.internalDeps=function(){return a.length?r.concat(a):r},o}function Nt(n){return"function"==typeof n?function(t){return Dt(t)?n(t.value):t}:function(t){return n}}function Ft(t){return d(t)?t:Pt(t)}function Lt(t,n){return Ct(n,t,{mapError:!0,desc:new V(t,"flatMapEvent",[n])})}var Vt=(qt.prototype.subscribe=function(t){return this.obs.subscribeInternal(t)},qt.prototype.toString=function(){return this.obs.toString()},qt.prototype.markEnded=function(){this.ended=!0},qt.prototype.mayHave=function(t){return!0},qt);function qt(t,n){this._isSource=!0,this.flatten=!0,this.ended=!1,this.obs=t,this.sync=n}var jt,Ut=(n(Qt,jt=Vt),Qt.prototype.consume=function(){return this.value},Qt.prototype.push=function(t){this.value=t},Qt.prototype.hasAtLeast=function(t){return!!this.value},Qt);function Qt(){return null!==jt&&jt.apply(this,arguments)||this}var zt,Ht=(n(Rt,zt=Vt),Rt.prototype.consume=function(){return this.queue.shift()},Rt.prototype.push=function(t){this.queue.push(t)},Rt.prototype.mayHave=function(t){return!this.ended||this.queue.length>=t},Rt.prototype.hasAtLeast=function(t){return this.queue.length>=t},Rt);function Rt(t,n){var r=zt.call(this,t,n)||this;return r.flatten=!1,r.queue=[],r}var Yt,Xt=(n($t,Yt=Vt),$t.prototype.consume=function(){var t=this.queue;return this.queue=[],{value:t}},$t.prototype.push=function(t){return this.queue.push(t.value)},$t.prototype.hasAtLeast=function(t){return!0},$t);function $t(t){var n=Yt.call(this,t,!0)||this;return n.queue=[],n}function Gt(t){return null!=t&&t._isSource?t:null!=t&&t._isProperty?new Ut(t,!1):new Ht(t,!0)}function Jt(){return new dr(j("Bacon","never"),function(t){return t(wt()),a})}function Kt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return tn(br,t)}function Zt(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return tn(Ot,t)}function tn(t,n){if(0===n.length)return Jt();var r=function(t){for(var n=[],r=[],e=0;e<t.length;e++){for(var i,o=t[e],u=o[0],s={f:o[1],ixs:[]},c=!1,f=0;f<u.length;f++){i=u[f];var a=w(n,i);c=c||null!=(l=i)&&(l._isSource?l.sync:l._isEventStream),a<0&&(n.push(i),a=n.length-1);for(var h=0;h<s.ixs.length;h++){var p=s.ixs[h];p.index===a&&p.count++}s.ixs.push({index:a,count:1})}if(0<u.length&&!c)throw new Error("At least one EventStream required, none found in "+u);0<u.length&&r.push(s)}var l;return[m(Gt,n),r]}(rn(n)),l=r[0],v=r[1];if(!l.length)return Jt();var c=i(l,function(t){return t.flatten})&&function(t,e){void 0===e&&(e=[]);return i(t,function t(n){if(o(e,n))return!0;var r=n.internalDeps();return r.length?(e.push(n),i(r,t)):(e.push(n),!1)})}(m(function(t){return t.obs},l)),d=t(new V("Bacon","when",Array.prototype.slice.call(n)),function(f){var a=[],s=!1;function h(t){for(var n=0;n<t.ixs.length;n++){var r=t.ixs[n];if(!l[r.index].hasAtLeast(r.count))return}return 1}function n(t){for(var n=0;n<t.ixs.length;n++){var r=t.ixs[n];if(!l[r.index].mayHave(r.count))return!0}return!1}function p(t){return!t.source.flatten}return new Mt(m(function(u){return function(e){function i(){return L.whenDoneWith(d,o)}function o(){var t=function t(){var n;if(void 0!==(n=a.pop()))for(var r,e=D,i=0;i<v.length;i++)if(h(r=v[i])){for(var o=[],u=0;u<r.ixs.length;u++){var s=l[r.ixs[u].index].consume();if(!s)throw new Error("Event was undefined");o.push(s.value)}var c=r.f.apply(null,o);return e=f(n.e.apply(c)),a.length&&(a=b(p,a)),e===I?e:t()}return D}();s&&(y(l,en)||y(v,n))&&(t=I,f(wt())),t===I&&e()}return u.subscribe(function(t){var n=D;if(t.isEnd)s=!0,u.markEnded(),i();else if(t.isError)n=f(t);else{var r=t;u.push(r),u.sync&&(a.push({source:u,e:r}),(c||L.hasWaiters()?i:o)())}return n===I&&e(),n})}},l)).unsubscribe});return d}function nn(t){for(var n=0,r=t.length,e=[];n<r;){var i=l(t[n++]),o=g(t[n++]);e.push([i,o])}return e}function rn(t){for(var n,r=[],e=0;e<t.length;e++){var i=t[e];if(!((n=i)instanceof Array)||d(n[n.length-1]))return nn(t);if(i[0]instanceof Array)r.push([i[0],g(i[1])]);else{var o=i.slice(0,i.length-1),u=g(i[i.length-1]);r.push([o,u])}}return r}function en(t){return!t.sync||t.ended}function on(t,n,r){return Kt([new Ut(n.toProperty(),!1),new Ut(t,!0),s(r)]).withDesc(new V(t,"withLatestFrom",[n,r]))}function un(t,n,r){return Zt([new Ut(n.toProperty(),!1),new Ut(t,!0),s(r)]).withDesc(new V(t,"withLatestFrom",[n,r]))}function sn(t,n,r){if(t instanceof ar)return un(t,n,r);if(t instanceof dr)return on(t,n,r);throw new Error("Unknown observable: "+t)}function cn(t,n){return n instanceof ar?sn(t,n,function(t,n){return n}):t.transform(fn(n),new V(t,"map",[n]))}function fn(t){var r=E.toFunction(t);return function(t,n){return n(t.fmap(r))}}function an(n){return new ar(new V("Bacon","constant",[n]),function(t){return t(yt(n)),t(wt()),a})}function hn(t){return t=Array.prototype.slice.call(t),E.flatMap(pn,t)}function pn(t){return d(t)?[t]:v(t)?hn(t):[an(t)]}function ln(t){return E.isFunction(t[0])?[hn(Array.prototype.slice.call(t,1)),t[0]]:[hn(Array.prototype.slice.call(t,0,t.length-1)),E.last(t)]}function vn(t,r){return tn(function(t,n){return new dr(t,n,void 0,r)},[E.map(function(t){return new Xt(t)},t),function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t}]).withDesc(new V("Bacon","groupSimultaneous",t))}function dn(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if((t=hn(t)).length){for(var r=[],e=0;e<t.length;e++){var i=d(t[e])?t[e]:an(t[e]);r.push(mn(i))}return Zt([r,function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t}]).withDesc(new V("Bacon","combineAsArray",t))}return an([])}function yn(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=ln(arguments),e=r[0],i=r[1],o=new V("Bacon","combineWith",u([i],e));return dn(e).map(function(t){return i.apply(void 0,t)}).withDesc(o)}var bn=yn;function wn(t,n,r){return Zt([[mn(t),mn(n)],r]).withDesc(new V(t,"combine",[n,r]))}function mn(t){return new Ut(t,!0)}function gn(t,n){return Ct(Nt(n),t,{desc:new V(t,"flatMapConcat",[n]),limit:1})}function En(e,f){void 0===f&&(f=E.id);var t=new V("Bacon","fromBinder",[e,f]);return new dr(t,function(s){function c(){if(!t)return null!=r?(r(),t=!0):n=!0}var t=!1,n=!1,r=e(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=f.apply(void 0,t),e=v(r)&&gt(E.last(r))?r:[r],i=D,o=0;o<e.length;o++){var u=mt(e[o]);if((i=s(u))===I||u.isEnd)return c(),i}return i});return n&&c(),c})}function Sn(r,t){var n=new V("Bacon","fromPoll",[r,t]);return En(function(t){var n=A.scheduler.setInterval(t,r);return function(){return A.scheduler.clearInterval(n)}},t).withDesc(n)}function Dn(t,n){return Sn(t,function(){return bt(n)}).withDesc(new V("Bacon","interval",[t,n]))}function In(t,n,r){return t instanceof dr?(i=n,o=r,An((e=t).toProperty(),i,o).withDesc(new V(e,"sampledBy",[i]))):An(t,n,r);var e,i,o}function An(t,n,r){var e;return sn(n,t,s("function"==typeof(e=r)?e:E.id)).withDesc(new V(t,"sampledBy",[n]))}function kn(t,r,n){return new ar(new V(t,"transform",[r]),function(n){return t.subscribeInternal(function(t){return r(t,n)})}).withDesc(n)}function _n(r,n){function e(t){return n(t,i)}var i;return function(t,n){return i=n,r(t,e)}}function Bn(t,n,r,e){return n instanceof ar?sn(t,n,function(t,n){return[t,n]}).transform(_n(r(function(t){return t[1]}),fn(function(t){return t[0]})),e):t.transform(r(function(t){if("boolean"==typeof t)return E.always(t);if("function"!=typeof t)throw new Error("Not a function: "+t);return t}(n)),e)}function xn(r){return function(t,n){return t.filter(r)?n(t):D}}function Mn(t){return t.map(function(t){return!t}).withDesc(new V(t,"not",[]))}function Wn(t){return pr(t)?t:an(t)}function Tn(t,n){return Ct(Nt(n),t,{firstOnly:!0,desc:new V(t,"flatMapFirst",[n])})}function On(t,n,r){return t.scan(n,r).last().withDesc(new V(t,"fold",[n,r]))}var Pn={};function Cn(t,n){return Ct(Nt(n),t,{desc:new V(t,"flatMap",[n])})}function Nn(t,r){return Ct(function(t){if(t instanceof vt){var n=t.error;return r(n)}return t},t,{mapError:!0,desc:new V(t,"flatMapError",[r])})}var Fn=[],Ln=!1;function Vn(n){if(Fn.length&&!Ln)try{Ln=!0,Fn.forEach(function(t){t(n)})}finally{Ln=!1}}function qn(t,n){var r=E.toFunction(n),e=pr(t)?t.toEventStream(vr):t,i=Cn(e,function(t){return Ft(r(t)).takeUntil(e)});return pr(t)&&(i=i.toProperty()),i.withDesc(new V(t,"flatMapLatest",[r]))}var jn=(Un.prototype.hasSubscribers=function(){return 0<this.subscriptions.length},Un.prototype.removeSub=function(t){return this.subscriptions=E.without(t,this.subscriptions),this.subscriptions},Un.prototype.push=function(t){return t.isEnd&&(this.ended=!0),L.inTransaction(t,this,this.pushIt,[t])},Un.prototype.pushToSubscriptions=function(t){try{for(var n=this.subscriptions,r=n.length,e=0;e<r;e++){var i=n[e];i.sink(t)!==I&&!t.isEnd||this.removeSub(i)}return!0}catch(t){throw this.pushing=!1,this.queue=[],t}},Un.prototype.pushIt=function(t){if(this.pushing)return this.queue.push(t),D;if(t!==this.prevError){for(t.isError&&(this.prevError=t),this.pushing=!0,this.pushToSubscriptions(t),this.pushing=!1;;){var n=this.queue.shift();if(!n)break;this.push(n)}return this.hasSubscribers()?D:(this.unsubscribeFromSource(),I)}},Un.prototype.handleEvent=function(t){return this._handleEvent?this._handleEvent(t):this.push(t)},Un.prototype.unsubscribeFromSource=function(){this.unsubSrc&&this.unsubSrc(),this.unsubSrc=void 0},Un.prototype.subscribe=function(t){var n=this;if(this.ended)return t(wt()),a;var r={sink:t};return this.subscriptions.push(r),1===this.subscriptions.length&&(this.unsubSrc=this._subscribe(this.handleEvent)),function(){if(n.removeSub(r),!n.hasSubscribers())return n.unsubscribeFromSource()}},Un.prototype.inspect=function(){return this.observable.toString()},Un);function Un(t,n,r){this.pushing=!1,this.ended=!1,this.prevError=void 0,this.unsubSrc=void 0,this._subscribe=n,this._handleEvent=r,this.subscribe=E.bind(this.subscribe,this),this.handleEvent=E.bind(this.handleEvent,this),this.subscriptions=[],this.observable=t,this.queue=[]}var Qn,zn=(n(Hn,Qn=jn),Hn.prototype.push=function(t){return t.isEnd&&(this.propertyEnded=!0),t instanceof Z?(this.current=new R(t),this.currentValueRootId=L.currentEventId()):t.hasValue&&console.error("Unknown event, two Bacons loaded?",t.constructor),Qn.prototype.push.call(this,t)},Hn.prototype.maybeSubSource=function(t,n){return n===I?a:this.propertyEnded?(t(wt()),a):Qn.prototype.subscribe.call(this,t)},Hn.prototype.subscribe=function(t){var n=this,r=D;if(this.current.isDefined&&(this.hasSubscribers()||this.propertyEnded)){var e=L.currentEventId(),i=this.currentValueRootId;return!this.propertyEnded&&i&&e&&e!==i?L.whenDoneWith(this.observable,function(){if(n.currentValueRootId===i)return t(yt(n.current.get().value))}):L.inTransaction(void 0,this,function(){return r=t(yt(n.current.get().value))},[]),this.maybeSubSource(t,r)}return this.maybeSubSource(t,r)},Hn.prototype.inspect=function(){return this.observable+" current= "+this.current},Hn);function Hn(t,n,r){var e=Qn.call(this,t,n,r)||this;return e.current=X,e.propertyEnded=!1,e.subscribe=E.bind(e.subscribe,e),e}function Rn(t,n,r){return Ct(Nt(r),t,{desc:new V(t,"flatMapWithConcurrencyLimit",[n,r]),limit:n})}function Yn(t,n,r){var e=function(t){if(void 0===t)return;if("number"!=typeof t)return t;var n=t;return function(t){return A.scheduler.setTimeout(t,n)}}(n);function i(t){return t.values.length===r?t.flush():void 0!==e?t.schedule(e):void 0}var o=new V(t,"bufferWithTimeOrCount",[n,r]);return function(t,r,n){void 0===r&&(r=a);void 0===n&&(n=a);var e=D,i=new Xn(n,r);return t.transform(function(t,n){return i.push=n,Dt(t)?(i.values.push(t.value),r(i)):St(t)?e=n(t):It(t)&&(i.end=t,i.scheduled||i.flush()),e}).withDesc(new V(t,"buffer",[]))}(t,i,i).withDesc(o)}var Xn=($n.prototype.flush=function(){if(this.scheduled&&(A.scheduler.clearTimeout(this.scheduled),this.scheduled=null),0<this.values.length){var t=this.values;this.values=[];var n=this.push(bt(t));if(null!=this.end)return this.push(this.end);if(n!==I)return this.onFlush(this)}else if(null!=this.end)return this.push(this.end)},$n.prototype.schedule=function(t){var n=this;if(!this.scheduled)return this.scheduled=t(function(){return n.flush()})},$n);function $n(t,n){this.push=function(t){return D},this.scheduled=null,this.end=void 0,this.values=[],this.onFlush=t,this.onInput=n}function Gn(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=hn(t);return o.length?new dr(new V("Bacon","mergeAll",o),function(e){var i=0,t=m(function(t){return function(r){return t.subscribeInternal(function(t){if(t.isEnd)return++i===o.length?e(wt()):D;t=t.toNext();var n=e(t);return n===I&&r(),n})}},o);return new Mt(t).unsubscribe}):Jt()}function Jn(r,e){return En(function(t){var n=A.scheduler.setTimeout(function(){return t([mt(e),wt()])},r);return function(){return A.scheduler.clearTimeout(n)}}).withDesc(new V("Bacon","later",[r,e]))}function Kn(r){return function(t,n){return t.filter(r)?n(t):(n(wt()),I)}}function Zn(r){var e=!1;return function(t,n){return!e&&Dt(t)&&r(t.value)?D:(t.hasValue&&(e=!0),n(t))}}function tr(o,u,s){void 0===s&&(s=E.id);var c={};return o.transform(_n(xn(function(t){return!c[u(t)]}),fn(function(t){var e=u(t),n=o.changes().filter(function(t){return u(t)===e}),r=Pt(t).concat(n),i=s(r,t).toEventStream().transform(function(t,n){var r=n(t);return t.isEnd&&delete c[e],r});return c[e]=i})))}var nr={};function rr(e,s){var c=!1,f=[],a=!1;return new dr(new V(e,"holdWhen",[s]),function(o){function u(t){return t&&t(),n.empty()&&r?o(wt()):D}var n=new Mt,r=!1;return n.add(function(t,i){return s.subscribeInternal(function(t){if(Dt(t)){c=t.value;var n=D;if(!c){var r=f;f=[];for(var e=0;e<r.length;e++)n=o(bt(r[e]));a&&(o(wt()),i(),n=I)}return n}return t.isEnd?u(i):o(t)})}),n.add(function(t,n){return e.subscribeInternal(function(t){return c&&Dt(t)?(f.push(t.value),D):t.isEnd&&f.length?(a=!0,u(n)):o(t)})}),r=!0,u(),n.unsubscribe})}function er(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var e=ln(arguments);n=e[0],t=e[1];return Kt([n=E.map(function(t){return t.toEventStream()},n),t]).withDesc(new V("Bacon","zipWith",[t].concat(n)))}function ir(i){function c(t,n,r){var e;return(e=t)[e.length-1][n]=r}function f(t){return v(t)?[]:{}}function a(t){if(d(t))return 1;if(t&&(t.constructor==Object||t.constructor==Array))for(var n in t){if(Object.prototype.hasOwnProperty.call(t,n))if(a(t[n]))return 1}}function n(t,n){if(d(n))l.push(n),p.push((u=t,s=l.length-1,function(t,n){c(t,u,n[s])}));else if(a(n)){p.push((i=t,o=n,function(t){var n=f(o);c(t,i,n),t.push(n)})),h(n),p.push(function(t){t.pop()})}else p.push((r=t,e=n,function(t){c(t,r,e)}));var r,e,i,o,u,s}function h(t){E.each(t,n)}var p=[],l=[];return(a(i)?(h(i),dn(l).map(function(t){for(var n=f(i),r=[n],e=0;e<p.length;e++)(0,p[e])(r,t);return n})):an(i)).withDesc(new V("Bacon","combineTemplate",[i]))}function or(t,n){function r(n,r){return t.subscribe(function(t){return Dt(t)&&n(t.value),St(t)&&r(t.error),I})}if("function"==typeof n)return new n(r);if("function"==typeof Promise)return new Promise(r);throw new Error("There isn't default Promise, use shim or parameter")}var ur=0,sr=(cr.prototype.awaiting=function(t){return vn([n=this,r=t],vr).map(function(t){return 0===t[1].length}).toProperty(!1).skipDuplicates().withDesc(new V(n,"awaiting",[r]));var n,r},cr.prototype.bufferingThrottle=function(t){return e=new V(n=this,"bufferingThrottle",[r=t]),n.transformChanges(e,function(t){return t.flatMapConcat(function(t){return Pt(t).concat(Jn(r,t).errors())})});var n,r,e},cr.prototype.combine=function(t,n){return wn(this,t,n).withDesc(new V(this,"combine",[t,n]))},cr.prototype.debounce=function(t){return r=t,(n=this).transformChanges(new V(n,"debounce",[r]),function(t){return t.flatMapLatest(function(t){return Jn(r,t)})});var n,r},cr.prototype.debounceImmediate=function(t){return r=t,(n=this).transformChanges(new V(n,"debounceImmediate",[r]),function(t){return t.flatMapFirst(function(t){return Pt(t).concat(Jn(r,t).errors())})});var n,r},cr.prototype.decode=function(t){return r=t,(n=this).combine(ir(r),function(t,n){return n[t]}).withDesc(new V(n,"decode",[r]));var n,r},cr.prototype.delay=function(t){return r=t,(n=this).transformChanges(new V(n,"delay",[r]),function(t){return t.flatMap(function(t){return Jn(r,t)})});var n,r},cr.prototype.deps=function(){return this.desc.deps()},cr.prototype.diff=function(t,n){return i=n,kn(xt(r=this,[e=t,nr],function(t,n){return[n,i(t[0],n)]}),_n(xn(function(t){return t[1]!==nr}),fn(function(t){return t[1]})),new V(r,"diff",[e,i]));var r,e,i},cr.prototype.doAction=function(t){return this.transform(function(t,n){return Dt(t)&&r(t.value),n(t)},new V(this,"doAction",[r=t]));var r},cr.prototype.doEnd=function(t){return this.transform(function(t,n){return It(t)&&r(),n(t)},new V(this,"doEnd",[r=t]));var r},cr.prototype.doError=function(t){return this.transform(function(t,n){return St(t)&&r(t.error),n(t)},new V(this,"doError",[r=t]));var r},cr.prototype.doLog=function(){for(var r,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this.transform(function(t,n){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log&&console.log.apply(console,r.concat([t.log()])),n(t)},new V(this,"doLog",r=t))},cr.prototype.endAsValue=function(){return this.transform(function(t,n){return It(t)?(n(bt({})),n(wt()),I):D})},cr.prototype.endOnError=function(t){return void 0===t&&(t=function(t){return!0}),void 0===(r=t)&&(r=function(t){return!0}),(n=this).transform(function(t,n){return St(t)&&r(t.error)?(n(t),n(wt())):n(t)},new V(n,"endOnError",[]));var n,r},cr.prototype.errors=function(){return this.filter(function(t){return!1}).withDesc(new V(this,"errors"))},cr.prototype.filter=function(t){return Bn(n=this,r=t,xn,new V(n,"filter",[r]));var n,r},cr.prototype.first=function(){return _t(1,this,new V(this,"first"))},cr.prototype.firstToPromise=function(t){return or(this,t)},cr.prototype.fold=function(t,n){return On(this,t,n)},cr.prototype.forEach=function(t){return void 0===t&&(t=Q),this.onValue(t)},cr.prototype.holdWhen=function(t){return rr(this,t)},cr.prototype.inspect=function(){return this.toString()},cr.prototype.internalDeps=function(){return this.initialDesc.deps()},cr.prototype.last=function(){return(t=this).transform(function(t,n){return It(t)?(r&&n(r),n(wt()),I):Dt(t)?(r=t,D):n(t)}).withDesc(new V(t,"last",[]));var t,r},cr.prototype.log=function(){for(var n,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return n=t,this.subscribe(function(t){return"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,n.concat([t.log()])),D}),this},cr.prototype.mapEnd=function(t){return this.transform((n=t,r=E.toFunction(n),function(t,n){return It(t)?(n(bt(r(t))),n(wt()),I):n(t)}),new V(this,"mapEnd",[t]));var n,r},cr.prototype.mapError=function(t){return this.transform((n=t,r=E.toFunction(n),function(t,n){return St(t)?n(bt(r(t.error))):n(t)}),new V(this,"mapError",[t]));var n,r},cr.prototype.name=function(t){return this._name=t,this},cr.prototype.onEnd=function(n){return void 0===n&&(n=z),this.subscribe(function(t){return t.isEnd?n():D})},cr.prototype.onError=function(n){return void 0===n&&(n=Q),this.subscribe(function(t){return St(t)?n(t.error):D})},cr.prototype.onValue=function(n){return void 0===n&&(n=Q),this.subscribe(function(t){return Dt(t)?n(t.value):D})},cr.prototype.onValues=function(n){return this.onValue(function(t){return n.apply(void 0,t)})},cr.prototype.reduce=function(t,n){return On(this,t,n)},cr.prototype.sampledBy=function(t){return In(this,t,arguments[1])},cr.prototype.scan=function(t,n){return xt(this,t,n)},cr.prototype.skip=function(t){return r=t,(n=this).transform(function(t,n){return t.hasValue&&0<r?(r--,D):n(t)},new V(n,"skip",[r]));var n,r},cr.prototype.skipDuplicates=function(t){return kt(this,t)},cr.prototype.skipErrors=function(){return(t=this).transform(function(t,n){return St(t)?D:n(t)},new V(t,"skipErrors",[]));var t},cr.prototype.skipUntil=function(t){return n=this,e=(r=t).transform(_n(Bt(1),fn(!0))).toProperty().startWith(!1),n.filter(e).withDesc(new V(n,"skipUntil",[r]));var n,r,e},cr.prototype.skipWhile=function(t){return Bn(n=this,r=t,Zn,new V(n,"skipWhile",[r]));var n,r},cr.prototype.slidingWindow=function(t,n){return void 0===n&&(n=0),e=t,void 0===(i=n)&&(i=0),(r=this).scan([],function(t,n){return t.concat([n]).slice(-e)}).filter(function(t){return t.length>=i}).withDesc(new V(r,"slidingWindow",[e,i]));var r,e,i},cr.prototype.subscribe=function(t){var n=this;return void 0===t&&(t=Q),L.wrappedSubscribe(this,function(t){return n.subscribeInternal(t)},t)},cr.prototype.take=function(t){return _t(t,this)},cr.prototype.takeUntil=function(t){return r=t,e=vn([(n=this).mapEnd(Pn),r.skipErrors()],vr),n instanceof ar&&(e=e.toProperty()),e.transform(function(t,n){if(Dt(t)){var r=t.value,e=r[0];if(r[1].length)return n(wt());for(var i=D,o=0;o<e.length;o++){var u=e[o];if(u===Pn)return n(wt());i=n(bt(u))}return i}return n(t)},new V(n,"takeUntil",[r]));var n,r,e},cr.prototype.takeWhile=function(t){return Bn(n=this,r=t,Kn,new V(n,"takeWhile",[r]));var n,r},cr.prototype.throttle=function(t){return r=t,(n=this).transformChanges(new V(n,"throttle",[r]),function(t){return t.bufferWithTime(r).map(function(t){return t[t.length-1]})});var n,r},cr.prototype.toPromise=function(t){return n=t,this.last().firstToPromise(n);var n},cr.prototype.toString=function(){return this._name?this._name:this.desc.toString()},cr.prototype.withDesc=function(t){return t&&(this.desc=t),this},cr.prototype.withDescription=function(t,n){for(var r=[],e=2;e<arguments.length;e++)r[e-2]=arguments[e];return this.desc=j.apply(void 0,u([t,n],r)),this},cr.prototype.zip=function(t,n){return r=this,e=t,er(n||Array,r,e).withDesc(new V(r,"zip",[e]));var r,e},cr);function cr(t){this.id=++ur,this._isObservable=!0,this.desc=t,this.initialDesc=t}var fr,ar=(n(hr,fr=sr),hr.prototype.and=function(t){return r=t,(n=this).combine(Wn(r),function(t,n){return!(!t||!n)}).withDesc(new V(n,"and",[r]));var n,r},hr.prototype.changes=function(){var t=this;return new dr(new V(this,"changes",[]),function(n){return t.dispatcher.subscribe(function(t){return t.isInitial?D:n(t)})})},hr.prototype.concat=function(n){return this.transformChanges(j(this,"concat",n),function(t){return t.concat(n)})},hr.prototype.transformChanges=function(t,n){return e=t,u=n(new dr(j(r=this,"changes",[]),function(n){return r.dispatcher.subscribe(function(t){return!i&&Et(t)&&(i=t,L.whenDoneWith(s,function(){if(!o)throw new Error("Init sequence fail");o(i)})),t.isInitial?D:n(t)})},void 0,vr)),s=Ot(e,function(n){return o=n,u.dispatcher.subscribe(function(t){n(t)})});var r,e,i,o,u,s},hr.prototype.flatMap=function(t){return Cn(this,t)},hr.prototype.flatMapConcat=function(t){return gn(this,t)},hr.prototype.flatMapError=function(t){return Nn(this,t)},hr.prototype.flatMapEvent=function(t){return Lt(this,t)},hr.prototype.flatMapFirst=function(t){return Tn(this,t)},hr.prototype.flatMapLatest=function(t){return qn(this,t)},hr.prototype.flatMapWithConcurrencyLimit=function(t,n){return Rn(this,t,n)},hr.prototype.groupBy=function(t,n){return tr(this,t,n)},hr.prototype.map=function(t){return cn(this,t)},hr.prototype.not=function(){return Mn(this)},hr.prototype.or=function(t){return r=t,(n=this).combine(Wn(r),function(t,n){return t||n}).withDesc(new V(n,"or",[r]));var n,r},hr.prototype.sample=function(t){return An(n=this,Dn(r=t,{}),function(t,n){return t}).withDesc(new V(n,"sample",[r]));var n,r},hr.prototype.startWith=function(t){return r=t,(n=this).scan(r,function(t,n){return n}).withDesc(new V(n,"startWith",[r]));var n,r},hr.prototype.subscribeInternal=function(t){return void 0===t&&(t=Q),this.dispatcher.subscribe(t)},hr.prototype.toEventStream=function(t){var r=this;return new dr(new V(this,"toEventStream",[]),function(n){return r.subscribeInternal(function(t){return n(t.toNext())})},void 0,t)},hr.prototype.toProperty=function(){return this},hr.prototype.transform=function(t,n){return kn(this,t,n)},hr.prototype.withLatestFrom=function(t,n){return un(this,t,n)},hr.prototype.withStateMachine=function(t,n){return H(t,n,this)},hr);function hr(t,n,r){var e=fr.call(this,t)||this;return e._isProperty=!0,e.dispatcher=new zn(e,n,r),Vn(e),e}function pr(t){return!!t._isProperty}var lr,vr={forceAsync:!1},dr=(n(yr,lr=sr),yr.prototype.bufferWithTime=function(t){return Yn(n=this,r=t,Number.MAX_VALUE).withDesc(new V(n,"bufferWithTime",[r]));var n,r},yr.prototype.bufferWithCount=function(t){return Yn(n=this,void 0,r=t).withDesc(new V(n,"bufferWithCount",[r]));var n,r},yr.prototype.bufferWithTimeOrCount=function(t,n){return Yn(this,t,n)},yr.prototype.changes=function(){return this},yr.prototype.concat=function(t,n){return r=n,new dr(new V(e=this,"concat",[i=t]),function(n){var r=a,t=e.dispatcher.subscribe(function(t){return t.isEnd?(r=i.toEventStream().dispatcher.subscribe(n),D):n(t)});return function(){return t(),r()}},void 0,r);var e,i,r},yr.prototype.transformChanges=function(t,n){return n(this).withDesc(t)},yr.prototype.flatMap=function(t){return Cn(this,t)},yr.prototype.flatMapConcat=function(t){return gn(this,t)},yr.prototype.flatMapError=function(t){return Nn(this,t)},yr.prototype.flatMapFirst=function(t){return Tn(this,t)},yr.prototype.flatMapLatest=function(t){return qn(this,t)},yr.prototype.flatMapWithConcurrencyLimit=function(t,n){return Rn(this,t,n)},yr.prototype.flatMapEvent=function(t){return Lt(this,t)},yr.prototype.flatScan=function(t,n){return i=n,o=e=t,(r=this).flatMapConcat(function(t){return Ft(i(o,t)).doAction(function(t){return o=t})}).toProperty().startWith(e).withDesc(new V(r,"flatScan",[e,i]));var r,e,i,o},yr.prototype.groupBy=function(t,n){return tr(this,t,n)},yr.prototype.map=function(t){return cn(this,t)},yr.prototype.merge=function(t){return Gn(this,t).withDesc(new V(this,"merge",[t]))},yr.prototype.not=function(){return Mn(this)},yr.prototype.startWith=function(t){return n=this,Pt(r=t).concat(n).withDesc(new V(n,"startWith",[r]));var n,r},yr.prototype.subscribeInternal=function(t){return void 0===t&&(t=Q),this.dispatcher.subscribe(t)},yr.prototype.toEventStream=function(){return this},yr.prototype.toProperty=function(t){var n,r=arguments.length?(n=t)&&(n._isSome||n._isNone)?n:new R(n):X,e=this.dispatcher,i=new V(this,"toProperty",Array.prototype.slice.apply(arguments)),o=e.subscribe;return new ar(i,Tt(r,o))},yr.prototype.transform=function(t,n){return i=n,new dr(new V(r=this,"transform",[e=t]),function(n){return r.subscribeInternal(function(t){return e(t,n)})},void 0,vr).withDesc(i);var r,e,i},yr.prototype.withLatestFrom=function(t,n){return on(this,t,n)},yr.prototype.withStateMachine=function(t,n){return H(t,n,this)},yr);function yr(t,n,r,e){var o,u,s,i=lr.call(this,t)||this;return i._isEventStream=!0,e!==vr&&(o=i,u=n,s=!1,n=function(r){var e,n=L.isInTransaction();function i(){var t=e||[];e=void 0;for(var n=0;n<t.length;n++)r(t[n])}s=!0;try{return u(function(t){return s||e?(e?e.push(t):(e=[t],n?L.soonButNotYet(o,i):A.scheduler.setTimeout(i,0)),D):r(t)})}finally{s=!1}}),i.dispatcher=new jn(i,n,r),Vn(i),i}function br(t,n){return new dr(t,n)}function wr(t,n){return new dr(t,n,void 0,vr)}function mr(t){return"undefined"!=typeof Symbol&&Symbol[t]?Symbol[t]:"undefined"!=typeof Symbol&&"function"==typeof Symbol.for?Symbol[t]=Symbol.for(t):"@@"+t}var gr=(Er.prototype.subscribe=function(t,n,r){var e="function"==typeof t?{next:t,error:n,complete:r}:t,i={closed:!1,unsubscribe:function(){i.closed=!0,o()}},o=this.observable.subscribe(function(t){Dt(t)&&e.next?e.next(t.value):St(t)?(e.error&&e.error(t.error),i.unsubscribe()):t.isEnd&&(i.closed=!0,e.complete&&e.complete())});return i},Er);function Er(t){this.observable=t}function Sr(r){return function(){for(var n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];return function(t){return r.apply(void 0,[t].concat(n))}}}gr.prototype[mr("observable")]=function(){return this},sr.prototype.toESObservable=function(){return new gr(this)},sr.prototype[mr("observable")]=sr.prototype.toESObservable;var Dr=[["addEventListener","removeEventListener"],["addListener","removeListener"],["on","off"],["bind","unbind"]];function Ir(r,e,t){var n=function(t){for(var n,r=0;r<Dr.length;r++){var e=[t[(n=Dr[r])[0]],t[n[1]]];if(e[0]&&e[1])return e}for(var i=0;i<Dr.length;i++){var o=t[(n=Dr[i])[0]];if(o)return[o,function(){}]}throw new Error("No suitable event methods in "+t)}(r),i=n[0],o=n[1],u=new V("Bacon","fromEvent",[r,e]);return En(function(t){return n=e,E.isFunction(n)?(e(i.bind(r),t),function(){return e(o.bind(r),t)}):(i.call(r,e,t),function(){return o.call(r,e,t)});var n},t).withDesc(u)}function Ar(s){var c=0;return En(function(n){var r=!1,e=D,i=function(){};function o(t){return t.isEnd?(r?u():r=!0,D):e=n(t)}function u(){var t;for(r=!0;r&&e!==I;)t=s(c++),r=!1,t?i=t.subscribeInternal(o):n(wt());r=!0}return u(),function(){return i()}}).withDesc(new V("Bacon","repeat",[s]))}function kr(t){return Jn(t,"").filter(!1).withDesc(new V("Bacon","silence",[t]))}function _r(t){return[mt(t),wt()]}var Br,xr=(Br=function(t){for(var r,e,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return E.isFunction(t)?n.length?(r=t,e=n,function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return r.apply(void 0,e.concat(t))}):t:E.always(t)},function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if("object"==typeof t&&n.length){var e=t,i=n[0];t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e[i].apply(e,t)},n=n.slice(1)}return Br.apply(void 0,u([t],n))});function Mr(t,n){return xr.apply(void 0,u([t],n))}var Wr,Tr=(n(Or,Wr=dr),Or.prototype.plug=function(t){var n=this;if(!this.ended){var r={input:t,unsub:void 0};return this.subscriptions.push(r),void 0!==this.sink&&this.subscribeInput(r),function(){return n.unsubscribeInput(t)}}},Or.prototype.end=function(){if(this.ended=!0,this.unsubAll(),"function"==typeof this.sink)return this.sink(wt())},Or.prototype.push=function(t){if(!this.ended&&"function"==typeof this.sink){var n=!this.pushing;if(!n)return this.pushQueue||(this.pushQueue=[]),void this.pushQueue.push(t);this.pushing=!0;try{return this.sink(bt(t))}finally{if(n&&this.pushQueue){for(var r=0;r<this.pushQueue.length;){var e=this.pushQueue[r];this.sink(bt(e)),r++}this.pushQueue=void 0}this.pushing=!1}}},Or.prototype.error=function(t){if("function"==typeof this.sink)return this.sink(new vt(t))},Or.prototype.unsubAll=function(){for(var t,n=this.subscriptions,r=0;r<n.length;r++)"function"==typeof(t=n[r]).unsub&&t.unsub()},Or.prototype.subscribeAll=function(t){if(this.ended)t(wt());else{this.sink=t;for(var n,r=this.subscriptions.slice(),e=0;e<r.length;e++)n=r[e],this.subscribeInput(n)}return this.unsubAll},Or.prototype.guardedSink=function(n){var r=this;return function(t){return t.isEnd?(r.unsubscribeInput(n),I):r.sink?r.sink(t):D}},Or.prototype.subscribeInput=function(t){return t.unsub=t.input.subscribeInternal(this.guardedSink(t.input)),t.unsub},Or.prototype.unsubscribeInput=function(t){for(var n,r=this.subscriptions,e=0;e<r.length;e++)if((n=r[e]).input===t)return"function"==typeof n.unsub&&n.unsub(),void this.subscriptions.splice(e,1)},Or);function Or(){var n=Wr.call(this,new V("Bacon","Bus",[]),function(t){return n.subscribeAll(t)})||this;return n.pushing=!1,n.pushQueue=void 0,n.ended=!1,n.subscriptions=[],n.unsubAll=E.bind(n.unsubAll,n),n.push=E.bind(n.push,n),n.subscriptions=[],n.ended=!1,n}var Pr={asEventStream:function(n,r,t){var e=this;return E.isFunction(r)&&(t=r,r=void 0),En(function(t){return e.on(n,r,t),function(){return e.off(n,r,t)}},t).withDesc(new V(this.selector||this,"asEventStream",[n]))},init:function(t){t.fn.asEventStream=Pr.asEventStream}};t.$=Pr,t.Bus=Tr,t.CompositeUnsubscribe=Mt,t.Desc=V,t.End=ht,t.Error=vt,t.Event=G,t.EventStream=dr,t.Initial=ot,t.Next=rt,t.Observable=sr,t.Property=ar,t.Value=Z,t._=E,t.combine=bn,t.combineAsArray=dn,t.combineTemplate=ir,t.combineTwo=wn,t.combineWith=yn,t.concatAll=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=hn(t);return(r.length?c(p(r),f(r).toEventStream(),function(t,n){return t.concat(n)}):Jt()).withDesc(new V("Bacon","concatAll",r))},t.constant=an,t.fromArray=function(s){if(s.length){var c=0,f=new dr(new V("Bacon","fromArray",[s]),function(r){var e=!1,i=D,o=!1,u=!1;return L.soonButNotYet(f,function t(){if(u=!0,!o){if(c===s.length)return r(wt()),!1;for(o=!0;u;)if(u=!1,i!==I&&!e){var n=s[c++];(i=r(mt(n)))!==I&&(c===s.length?r(wt()):L.afterTransaction(f,t))}return o=!1}}),function(){return e=!0}});return f}return Jt().withDesc(new V("Bacon","fromArray",s))},t.fromBinder=En,t.fromCallback=function(n){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return En(function(t){return Mr(n,r)(t),a},function(t){return[t,wt()]}).withDesc(new V("Bacon","fromCallback",u([n],r)))},t.fromESObservable=function(t){var r;r=t[mr("observable")]?t[mr("observable")]():t;var n=new V("Bacon","fromESObservable",[r]);return new dr(n,function(n){var t=r.subscribe({error:function(t){n(new vt(t)),n(new ht)},next:function(t){n(new rt(t))},complete:function(){n(new ht)}});return t.unsubscribe?function(){t.unsubscribe()}:t})},t.fromEvent=Ir,t.fromEventTarget=Ir,t.fromNodeCallback=function(n){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return En(function(t){return Mr(n,r)(t),a},function(t,n){return t?[new vt(t),wt()]:[n,wt()]}).withDesc(new V("Bacon","fromNodeCallback",u([n],r)))},t.fromPoll=Sn,t.fromPromise=function(r,e,t){return void 0===t&&(t=_r),En(function(n){var t=r.then(n,function(t){return n(new vt(t))});return t&&"function"==typeof t.done&&t.done(),e?function(){if("function"==typeof r.abort)return r.abort()}:function(){}},t).withDesc(new V("Bacon","fromPromise",[r]))},t.getScheduler=function(){return A.scheduler},t.groupSimultaneous=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return vn(hn(t))},t.hasValue=Dt,t.interval=Dn,t.isEnd=It,t.isError=St,t.isEvent=gt,t.isInitial=Et,t.isNext=function(t){return t.isNext},t.isProperty=pr,t.later=Jn,t.mergeAll=Gn,t.more=D,t.never=Jt,t.noMore=I,t.nullSink=Q,t.nullVoidSink=z,t.onValues=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return dn(t.slice(0,t.length-1)).onValues(t[arguments.length-1])},t.once=Pt,t.repeat=Ar,t.repeatedly=function(t,n){var r=0;return Sn(t,function(){return n[r++%n.length]}).withDesc(new V("Bacon","repeatedly",[t,n]))},t.retry=function(t){if(!E.isFunction(t.source))throw new Error("'source' option has to be a function");var i=t.source,o=t.retries||0,u=0,s=t.delay||function(){return 0},c=t.isRetryable||function(){return!0},f=!1,a=null;return Ar(function(t){function n(){return i(t).endOnError().transform(function(t,n){return St(t)?c((a=t).error)&&(0===o||u<o)?D:(f=!0,n(t)):(Dt(t)&&(f=!(a=null)),n(t))})}if(!f){if(a){var r={error:a.error,retriesDone:u},e=kr(s(r));return u++,e.concat(Pt(null).flatMap(n))}return n()}}).withDesc(new V("Bacon","retry",[t]))},t.sequentially=function(t,n){var r=0;return Sn(t,function(){var t=n[r++];return r<n.length?t:r===n.length?[mt(t),wt()]:wt()}).withDesc(new V("Bacon","sequentially",[t,n]))},t.setScheduler=function(t){A.scheduler=t},t.silence=kr,t.spy=function(t){return Fn.push(t)},t.try=function(n){return function(t){try{return Pt(n(t))}catch(t){return Pt(new vt(t))}}},t.update=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];for(var e=rn(n),i=0;i<e.length;i++){var o=e[i];o[1]=Sr(o[1])}return Kt.apply(void 0,e).scan(t,function(t,n){return n(t)}).withDesc(new V("Bacon","update",u([t],n)))},t.version="3.0.17",t.when=Kt,t.zipAsArray=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return Kt([E.map(function(t){return t.toEventStream()},hn(t)),function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t}]).withDesc(new V("Bacon","zipAsArray",t))},t.zipWith=er,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "baconjs",
"description": "A small functional reactive programming lib for JavaScript.",
"version": "3.0.17",
"version": "3.0.18",
"keywords": [

@@ -81,3 +81,3 @@ "bacon.js",

"prepublish": "npm run lint && npm run dist",
"version": "3.0.17",
"version": "3.0.18",
"browsertest-bundle": "browsertest/browserify",

@@ -84,0 +84,0 @@ "browsertest-open": "open browsertest/mocha.runner.html",

@@ -198,3 +198,3 @@ Bacon.js

Properties are usually created based on EventStreams. Some common ways are intruduced in [Property](http://baconjs.github.io/api3/classes/property.html) documentation.
Properties are usually created based on EventStreams. Some common ways are introduced in [Property](http://baconjs.github.io/api3/classes/property.html) documentation.

@@ -201,0 +201,0 @@ Combining multiple streams and properties

@@ -33,3 +33,3 @@ import "./esobservable";

export { default as fromESObservable } from "./fromesobservable";
export { EventStream, Observable, Property } from "./observable";
export { EventStream, Observable, Property, isProperty } from "./observable";
export { default as Bus } from "./bus";

@@ -36,0 +36,0 @@ export * from "./types";

@@ -170,3 +170,3 @@ import { Desc } from "./describe";

```js
var distance = function (a,b) { return Math.abs(b - a) }
var distance = function (a,b) { return a - b }
Bacon.sequentially(1, [1,2,3]).diff(0, distance)

@@ -177,5 +177,5 @@ ```

1 - 0 = 1
2 - 1 = 1
3 - 2 = 1
0 - 1 = -1
1 - 2 = -1
2 - 3 = -1

@@ -440,3 +440,3 @@ */

onValues(f: Function): Unsub;
/** A synonym for [scan](#scan).
/** A synonym for [fold](#fold).
*/

@@ -443,0 +443,0 @@ reduce<V2>(seed: V2, f: Accumulator<V, V2>): Property<V2>;

import { EventStream } from "./observable";
/** @hidden */
/**
* A helper for creating an EventStream of a single value, or a single Error event in case the given
* function throws an exception.
*/
export default function tryF<In, Out>(f: (value: In) => Out): (value: In) => EventStream<Out>;

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc