Comparing version 0.7.74 to 0.7.75
@@ -1,2 +0,2 @@ | ||
(function(){var t,n,r,e,u,i,o,s,c,a,f,h,l,p,d,v,y,b,m,g,w,E,D,S,O,M,A,_,k,I,W,P,T,x,V,B,F,H,C,q,L,U,N,z,j,R,Q,Z,$,X,G,J,K,Y,tt,nt,rt,et,ut,it,ot,st,ct,at,ft,ht={}.hasOwnProperty,lt=function(t,n){function r(){this.constructor=t}for(var e in n)ht.call(n,e)&&(t[e]=n[e]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},pt=[].slice,dt=function(t,n){return function(){return t.apply(n,arguments)}};t={toString:function(){return"Bacon"}},t.version="0.7.74",h=("undefined"!=typeof global&&null!==global?global:this).Error,G=function(){},N=function(t,n){return n},F=function(t,n){return t},M=function(t){return t.slice(0)},q=function(t){return t instanceof Array},U=function(t){return t instanceof v},E={indexOf:Array.prototype.indexOf?function(t,n){return t.indexOf(n)}:function(t,n){var r,e,u,i;for(r=e=0,u=t.length;u>e;r=++e)if(i=t[r],n===i)return r;return-1},indexWhere:function(t,n){var r,e,u,i;for(r=e=0,u=t.length;u>e;r=++e)if(i=t[r],n(i))return r;return-1},head:function(t){return t[0]},always:function(t){return function(){return t}},negate:function(t){return function(n){return!t(n)}},empty:function(t){return 0===t.length},tail:function(t){return t.slice(1,t.length)},filter:function(t,n){var r,e,u,i;for(r=[],e=0,u=n.length;u>e;e++)i=n[e],t(i)&&r.push(i);return r},map:function(t,n){var r,e,u,i;for(u=[],r=0,e=n.length;e>r;r++)i=n[r],u.push(t(i));return u},each:function(t,n){var r,e;for(r in t)ht.call(t,r)&&(e=t[r],n(r,e));return void 0},toArray:function(t){return q(t)?t:[t]},contains:function(t,n){return-1!==E.indexOf(t,n)},id:function(t){return t},last:function(t){return t[t.length-1]},all:function(t,n){var r,e,u;for(null==n&&(n=E.id),r=0,e=t.length;e>r;r++)if(u=t[r],!n(u))return!1;return!0},any:function(t,n){var r,e,u;for(null==n&&(n=E.id),r=0,e=t.length;e>r;r++)if(u=t[r],n(u))return!0;return!1},without:function(t,n){return E.filter(function(n){return n!==t},n)},remove:function(t,n){var r;return r=E.indexOf(n,t),r>=0?n.splice(r,1):void 0},fold:function(t,n,r){var e,u,i;for(e=0,u=t.length;u>e;e++)i=t[e],n=r(n,i);return n},flatMap:function(t,n){return E.fold(n,[],function(n,r){return n.concat(t(r))})},cached:function(t){var n;return n=d,function(){return n===d&&(n=t(),t=void 0),n}},isFunction:function(t){return"function"==typeof t},toString:function(t){var n,r,e,u;try{return K++,null==t?"undefined":E.isFunction(t)?"function":q(t)?K>5?"[..]":"["+E.map(E.toString,t).toString()+"]":null!=(null!=t?t.toString:void 0)&&t.toString!==Object.prototype.toString?t.toString():"object"==typeof t?K>5?"{..}":(r=function(){var r;r=[];for(e in t)ht.call(t,e)&&(u=function(){try{return t[e]}catch(r){return n=r}}(),r.push(E.toString(e)+":"+E.toString(u)));return r}(),"{"+r+"}"):t}finally{K--}}},K=0,t._=E,w=t.UpdateBarrier=function(){var n,r,e,u,i,o,s,c,a,f,h,l,p,d;return f=void 0,h=[],l={},r=[],e=0,n=function(t){return f?r.push(t):t()},p=function(t,n){var r;return f?(r=l[t.id],null==r?(r=l[t.id]=[n],h.push(t)):r.push(n)):n()},i=function(){for(;h.length>0;)s(0);return void 0},s=function(t){var n,r,e,u,i,s;for(u=h[t],i=u.id,s=l[i],h.splice(t,1),delete l[i],o(u),r=0,e=s.length;e>r;r++)(n=s[r])();return void 0},o=function(t){var n,r,e,u,i;for(r=t.internalDeps(),u=0,i=r.length;i>u;u++)n=r[u],o(n),l[n.id]&&(e=E.indexOf(h,n),s(e));return void 0},a=function(t,n,u,o){var s,c;if(f)return u.apply(n,o);f=t;try{c=u.apply(n,o),i()}finally{for(f=void 0;e<r.length;)s=r[e],e++,s();e=0,r=[]}return c},u=function(){return f?f.id:void 0},d=function(r,e){var u,i,o,s;return s=!1,i=!1,u=function(){return i=!0},o=function(){return s=!0,u()},u=r.dispatcher.subscribe(function(r){return n(function(){var n;return s||(n=e(r),n!==t.noMore)?void 0:o()})}),i&&u(),o},c=function(){return h.length>0},{whenDoneWith:p,hasWaiters:c,inTransaction:a,currentEventId:u,wrappedSubscribe:d,afterTransaction:n}}(),g=function(){function t(t,n,r){this.obs=t,this.sync=n,this.lazy=null!=r?r:!1,this.queue=[]}return t.prototype.subscribe=function(t){return this.obs.dispatcher.subscribe(t)},t.prototype.toString=function(){return this.obs.toString()},t.prototype.markEnded=function(){return this.ended=!0},t.prototype.consume=function(){return this.lazy?{value:E.always(this.queue[0])}:this.queue[0]},t.prototype.push=function(t){return this.queue=[t]},t.prototype.mayHave=function(){return!0},t.prototype.hasAtLeast=function(){return this.queue.length},t.prototype.flatten=!0,t}(),u=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return lt(n,t),n.prototype.consume=function(){return this.queue.shift()},n.prototype.push=function(t){return this.queue.push(t)},n.prototype.mayHave=function(t){return!this.ended||this.queue.length>=t},n.prototype.hasAtLeast=function(t){return this.queue.length>=t},n.prototype.flatten=!1,n}(g),n=function(t){function n(t){n.__super__.constructor.call(this,t,!0)}return lt(n,t),n.prototype.consume=function(){var t;return t=this.queue,this.queue=[],{value:function(){return t}}},n.prototype.push=function(t){return this.queue.push(t.value())},n.prototype.hasAtLeast=function(){return!0},n}(g),g.isTrigger=function(t){return t instanceof g?t.sync:t instanceof f},g.fromObservable=function(t){return t instanceof g?t:t instanceof y?new g(t,!1):new u(t,!0)},i=function(){function t(t,n,r){this.context=t,this.method=n,this.args=r}return t.prototype.deps=function(){return this.cached||(this.cached=x([this.context].concat(this.args)))},t.prototype.toString=function(){return E.toString(this.context)+"."+E.toString(this.method)+"("+E.map(E.toString,this.args)+")"},t}(),I=function(){var t,n,r;return n=arguments[0],r=arguments[1],t=3<=arguments.length?pt.call(arguments,2):[],(n||r)instanceof i?n||r:new i(n,r,t)},at=function(t,n){return n.desc=t,n},x=function(t){return q(t)?E.flatMap(x,t):U(t)?[t]:t instanceof g?[t.obs]:[]},t.Desc=i,t.Desc.empty=new t.Desc("","",[]),ft=function(t){return function(){var n,r,e,u;return e=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],"object"==typeof e&&n.length&&(r=e,u=n[0],e=function(){return r[u].apply(r,arguments)},n=n.slice(1)),t.apply(null,[e].concat(pt.call(n)))}},R=function(t){return t=Array.prototype.slice.call(t),Q.apply(null,t)},J=function(t,n){return function(){var r;return r=1<=arguments.length?pt.call(arguments,0):[],t.apply(null,n.concat(r))}},st=function(t){return function(n){return function(r){var e;return null==r?void 0:(e=r[n],E.isFunction(e)?e.apply(r,t):e)}}},ut=function(t,n){var r,e;return e=t.slice(1).split("."),r=E.map(st(n),e),function(n){var e,u;for(e=0,u=r.length;u>e;e++)t=r[e],n=t(n);return n}},L=function(t){return"string"==typeof t&&t.length>1&&"."===t.charAt(0)},Q=ft(function(){var t,n;return n=arguments[0],t=2<=arguments.length?pt.call(arguments,1):[],E.isFunction(n)?t.length?J(n,t):n:L(n)?ut(n,t):E.always(n)}),j=function(t,n){return Q.apply(null,[t].concat(pt.call(n)))},k=function(t,n,r,e){var u;return n instanceof y?(u=n.sampledBy(t,function(t,n){return[t,n]}),e.call(u,function(t){var n,r;return n=t[0],r=t[1],n}).map(function(t){var n,r;return n=t[0],r=t[1]})):(n=j(n,r),e.call(t,n))},rt=function(t){var n;if(E.isFunction(t))return t;if(L(t))return n=it(t),function(t,r){return t[n](r)};throw new h("not a function or a field key: "+t)},it=function(t){return t.slice(1)},m=function(){function t(t){this.value=t}return t.prototype.getOrElse=function(){return this.value},t.prototype.get=function(){return this.value},t.prototype.filter=function(n){return n(this.value)?new t(this.value):d},t.prototype.map=function(n){return new t(n(this.value))},t.prototype.forEach=function(t){return t(this.value)},t.prototype.isDefined=!0,t.prototype.toArray=function(){return[this.value]},t.prototype.inspect=function(){return"Some("+this.value+")"},t.prototype.toString=function(){return this.inspect()},t}(),d={getOrElse:function(t){return t},filter:function(){return d},map:function(){return d},forEach:function(){},isDefined:!1,toArray:function(){return[]},inspect:function(){return"None"},toString:function(){return this.inspect()}},ot=function(t){return t instanceof m||t===d?t:new m(t)},t.noMore=["<no-more>"],t.more=["<more>"],P=0,a=function(){function t(){this.id=++P}return t.prototype.isEvent=function(){return!0},t.prototype.isEnd=function(){return!1},t.prototype.isInitial=function(){return!1},t.prototype.isNext=function(){return!1},t.prototype.isError=function(){return!1},t.prototype.hasValue=function(){return!1},t.prototype.filter=function(){return!0},t.prototype.inspect=function(){return this.toString()},t.prototype.log=function(){return this.toString()},t}(),p=function(t){function n(t,r){return this instanceof n?(n.__super__.constructor.call(this),void(!r&&E.isFunction(t)||t instanceof n?(this.valueF=t,this.valueInternal=void 0):(this.valueF=void 0,this.valueInternal=t))):new n(t,r)}return lt(n,t),n.prototype.isNext=function(){return!0},n.prototype.hasValue=function(){return!0},n.prototype.value=function(){return this.valueF instanceof n?(this.valueInternal=this.valueF.value(),this.valueF=void 0):this.valueF&&(this.valueInternal=this.valueF(),this.valueF=void 0),this.valueInternal},n.prototype.fmap=function(t){var n,r;return this.valueInternal?(r=this.valueInternal,this.apply(function(){return t(r)})):(n=this,this.apply(function(){return t(n.value())}))},n.prototype.apply=function(t){return new n(t)},n.prototype.filter=function(t){return t(this.value())},n.prototype.toString=function(){return E.toString(this.value())},n.prototype.log=function(){return this.value()},n}(a),l=function(t){function n(t,r){return this instanceof n?void n.__super__.constructor.call(this,t,r):new n(t,r)}return lt(n,t),n.prototype.isInitial=function(){return!0},n.prototype.isNext=function(){return!1},n.prototype.apply=function(t){return new n(t)},n.prototype.toNext=function(){return new p(this)},n}(p),s=function(t){function n(){return this instanceof n?void 0:new n}return lt(n,t),n.prototype.isEnd=function(){return!0},n.prototype.fmap=function(){return this},n.prototype.apply=function(){return this},n.prototype.toString=function(){return"<end>"},n}(a),c=function(t){function n(t){return this instanceof n?void(this.error=t):new n(t)}return lt(n,t),n.prototype.isError=function(){return!0},n.prototype.fmap=function(){return this},n.prototype.apply=function(){return this},n.prototype.toString=function(){return"<error> "+E.toString(this.error)},n}(a),t.Event=a,t.Initial=l,t.Next=p,t.End=s,t.Error=c,C=function(t){return new l(t,!0)},X=function(t){return new p(t,!0)},W=function(){return new s},et=function(t){return t instanceof a?t:X(t)},H=0,tt=function(){},v=function(){function t(t){this.desc=t,this.id=++H,this.initialDesc=this.desc}return t.prototype.subscribe=function(t){return w.wrappedSubscribe(this,t)},t.prototype.subscribeInternal=function(t){return this.dispatcher.subscribe(t)},t.prototype.onValue=function(){var t;return t=R(arguments),this.subscribe(function(n){return n.hasValue()?t(n.value()):void 0})},t.prototype.onValues=function(t){return this.onValue(function(n){return t.apply(null,n)})},t.prototype.onError=function(){var t;return t=R(arguments),this.subscribe(function(n){return n.isError()?t(n.error):void 0})},t.prototype.onEnd=function(){var t;return t=R(arguments),this.subscribe(function(n){return n.isEnd()?t():void 0})},t.prototype.name=function(t){return this._name=t,this},t.prototype.withDescription=function(){return this.desc=I.apply(null,arguments),this},t.prototype.toString=function(){return this._name?this._name:this.desc.toString()},t.prototype.internalDeps=function(){return this.initialDesc.deps()},t}(),v.prototype.assign=v.prototype.onValue,v.prototype.forEach=v.prototype.onValue,v.prototype.inspect=v.prototype.toString,t.Observable=v,e=function(){function t(t){var n,r,e;for(null==t&&(t=[]),this.unsubscribe=dt(this.unsubscribe,this),this.unsubscribed=!1,this.subscriptions=[],this.starting=[],n=0,r=t.length;r>n;n++)e=t[n],this.add(e)}return t.prototype.add=function(t){var n,r,e;if(!this.unsubscribed)return n=!1,r=G,this.starting.push(t),e=function(e){return function(){return e.unsubscribed?void 0:(n=!0,e.remove(r),E.remove(t,e.starting))}}(this),r=t(this.unsubscribe,e),this.unsubscribed||n?r():this.subscriptions.push(r),E.remove(t,this.starting),r},t.prototype.remove=function(t){return this.unsubscribed?void 0:void 0!==E.remove(t,this.subscriptions)?t():void 0},t.prototype.unsubscribe=function(){var t,n,r,e;if(!this.unsubscribed){for(this.unsubscribed=!0,r=this.subscriptions,t=0,n=r.length;n>t;t++)(e=r[t])();return this.subscriptions=[],this.starting=[]}},t.prototype.count=function(){return this.unsubscribed?0:this.subscriptions.length+this.starting.length},t.prototype.empty=function(){return 0===this.count()},t}(),t.CompositeUnsubscribe=e,o=function(){function n(t,n){this._subscribe=t,this._handleEvent=n,this.subscribe=dt(this.subscribe,this),this.handleEvent=dt(this.handleEvent,this),this.subscriptions=[],this.queue=[]}return n.prototype.pushing=!1,n.prototype.ended=!1,n.prototype.prevError=void 0,n.prototype.unsubSrc=void 0,n.prototype.hasSubscribers=function(){return this.subscriptions.length>0},n.prototype.removeSub=function(t){return this.subscriptions=E.without(t,this.subscriptions)},n.prototype.push=function(t){return t.isEnd()&&(this.ended=!0),w.inTransaction(t,this,this.pushIt,[t])},n.prototype.pushToSubscriptions=function(n){var r,e,u,i,o,s;try{for(s=this.subscriptions,e=0,u=s.length;u>e;e++)o=s[e],i=o.sink(n),(i===t.noMore||n.isEnd())&&this.removeSub(o);return!0}catch(c){throw r=c,this.pushing=!1,this.queue=[],r}},n.prototype.pushIt=function(n){if(this.pushing)return this.queue.push(n),t.more;if(n!==this.prevError){for(n.isError()&&(this.prevError=n),this.pushing=!0,this.pushToSubscriptions(n),this.pushing=!1;this.queue.length;)n=this.queue.shift(),this.push(n);return this.hasSubscribers()?t.more:(this.unsubscribeFromSource(),t.noMore)}},n.prototype.handleEvent=function(t){return this._handleEvent?this._handleEvent(t):this.push(t)},n.prototype.unsubscribeFromSource=function(){return this.unsubSrc&&this.unsubSrc(),this.unsubSrc=void 0},n.prototype.subscribe=function(t){var n;return this.ended?(t(W()),G):(n={sink:t},this.subscriptions.push(n),1===this.subscriptions.length&&(this.unsubSrc=this._subscribe(this.handleEvent)),function(t){return function(){return t.removeSub(n),t.hasSubscribers()?void 0:t.unsubscribeFromSource()}}(this))},n}(),t.Dispatcher=o,f=function(n){function r(t,n,e){return this instanceof r?(E.isFunction(t)&&(e=n,n=t,t=i.empty),r.__super__.constructor.call(this,t),this.dispatcher=new o(n,e),void tt(this)):new r(t,n,e)}return lt(r,n),r.prototype.toProperty=function(n){var r,e;return e=0===arguments.length?d:ot(function(){return n}),r=this.dispatcher,new y(new t.Desc(this,"toProperty",[n]),function(n){var u,i,o,s;return u=!1,s=G,i=t.more,o=function(){return u?void 0:e.forEach(function(r){return u=!0,i=n(new l(r)),i===t.noMore?(s(),s=G):void 0})},s=r.subscribe(function(r){return r.hasValue()?u&&r.isInitial()?t.more:(r.isInitial()||o(),u=!0,e=new m(r),n(r)):(r.isEnd()&&(i=o()),i!==t.noMore?n(r):void 0)}),o(),s})},r.prototype.toEventStream=function(){return this},r.prototype.withHandler=function(n){return new r(new t.Desc(this,"withHandler",[n]),this.dispatcher.subscribe,n)},r}(v),t.EventStream=f,t.never=function(){return new f(I(t,"never"),function(t){return t(W()),G})},t.when=function(){var n,r,e,u,i,o,s,c,a,h,l,p,d,v,y,b,m,D,S,O;if(0===arguments.length)return t.never();for(s=arguments.length,O="when: expecting arguments in the form (Observable+,function)+",D=[],d=[],r=0,v=[];s>r;){for(v[r]=arguments[r],v[r+1]=arguments[r+1],p=E.toArray(arguments[r]),n=A(arguments[r+1]),l={f:n,ixs:[]},S=!1,i=0,c=p.length;c>i;i++){for(m=p[i],e=E.indexOf(D,m),S||(S=g.isTrigger(m)),0>e&&(D.push(m),e=D.length-1),y=l.ixs,o=0,a=y.length;a>o;o++)u=y[o],u.index===e&&u.count++;l.ixs.push({index:e,count:1})}p.length>0&&d.push(l),r+=2}return D.length?(D=E.map(g.fromObservable,D),h=E.any(D,function(t){return t.flatten})&&_(E.map(function(t){return t.obs},D)),b=new f(new t.Desc(t,"when",v),function(n){var e,u,i,o,s,c,a;return a=[],i=!1,o=function(t){var n,e,u;for(u=t.ixs,n=0,e=u.length;e>n;n++)if(r=u[n],!D[r.index].hasAtLeast(r.count))return!1;return!0},u=function(t){return!t.sync||t.ended},e=function(t){var n,e,u;for(u=t.ixs,n=0,e=u.length;e>n;n++)if(r=u[n],!D[r.index].mayHave(r.count))return!0},s=function(t){return!t.source.flatten},c=function(c){return function(f){var l,p,v;return p=function(){return w.whenDoneWith(b,l)},v=function(){var e,u,i,c,f,h;if(!(a.length>0))return t.more;for(f=t.more,h=a.pop(),u=0,i=d.length;i>u;u++)if(c=d[u],o(c))return e=function(){var t,n,e,u;for(e=c.ixs,u=[],n=0,t=e.length;t>n;n++)r=e[n],u.push(D[r.index].consume());return u}(),f=n(h.e.apply(function(){var t,n;return n=function(){var n,r,u;for(u=[],r=0,n=e.length;n>r;r++)t=e[r],u.push(t.value());return u}(),c.f.apply(c,n)})),a.length&&(a=E.filter(s,a)),f===t.noMore?f:v()},l=function(){var r;return r=v(),i&&(E.all(D,u)||E.all(d,e))&&(r=t.noMore,n(W())),r===t.noMore&&f(),r},c.subscribe(function(r){var e;return r.isEnd()?(i=!0,c.markEnded(),p()):r.isError()?e=n(r):(c.push(r),c.sync&&(a.push({source:c,e:r}),h||w.hasWaiters()?p():l())),e===t.noMore&&f(),e||t.more})}},new t.CompositeUnsubscribe(function(){var t,n,r;for(r=[],t=0,n=D.length;n>t;t++)m=D[t],r.push(c(m));return r}()).unsubscribe})):t.never()},_=function(t,n){var r;return null==n&&(n=[]),r=function(t){var e;return E.contains(n,t)?!0:(e=t.internalDeps(),e.length?(n.push(t),E.any(e,r)):(n.push(t),!1))},E.any(t,r)},A=function(t){return E.isFunction(t)?t:E.always(t)},t.groupSimultaneous=function(){var r,e,u;return u=1<=arguments.length?pt.call(arguments,0):[],1===u.length&&q(u[0])&&(u=u[0]),e=function(){var t,e,i;for(i=[],t=0,e=u.length;e>t;t++)r=u[t],i.push(new n(r));return i}(),at(new t.Desc(t,"groupSimultaneous",u),t.when(e,function(){var t;return t=1<=arguments.length?pt.call(arguments,0):[]}))},b=function(n){function r(t,n,e){this.property=t,this.subscribe=dt(this.subscribe,this),r.__super__.constructor.call(this,n,e),this.current=d,this.currentValueRootId=void 0,this.propertyEnded=!1}return lt(r,n),r.prototype.push=function(t){return t.isEnd()&&(this.propertyEnded=!0),t.hasValue()&&(this.current=new m(t),this.currentValueRootId=w.currentEventId()),r.__super__.push.call(this,t)},r.prototype.maybeSubSource=function(n,r){return r===t.noMore?G:this.propertyEnded?(n(W()),G):o.prototype.subscribe.call(this,n)},r.prototype.subscribe=function(n){var r,e,u,i;return e=!1,u=t.more,this.current.isDefined&&(this.hasSubscribers()||this.propertyEnded)?(r=w.currentEventId(),i=this.currentValueRootId,!this.propertyEnded&&i&&r&&r!==i?(w.whenDoneWith(this.property,function(t){return function(){return t.currentValueRootId===i?n(C(t.current.get().value())):void 0}}(this)),this.maybeSubSource(n,u)):(w.inTransaction(void 0,this,function(){return u=n(C(this.current.get().value()))},[]),this.maybeSubSource(n,u))):this.maybeSubSource(n,u)},r}(o),y=function(n){function r(t,n,e){r.__super__.constructor.call(this,t),this.dispatcher=new b(this,n,e),tt(this)}return lt(r,n),r.prototype.changes=function(){return new f(new t.Desc(this,"changes",[]),function(t){return function(n){return t.dispatcher.subscribe(function(t){return t.isInitial()?void 0:n(t)})}}(this))},r.prototype.withHandler=function(n){return new r(new t.Desc(this,"withHandler",[n]),this.dispatcher.subscribe,n)},r.prototype.toProperty=function(){return this},r.prototype.toEventStream=function(){return new f(new t.Desc(this,"toEventStream",[]),function(t){return function(n){return t.dispatcher.subscribe(function(t){return t.isInitial()&&(t=t.toNext()),n(t)})}}(this))},r}(v),t.Property=y,t.constant=function(n){return new y(new t.Desc(t,"constant",[n]),function(t){return t(C(n)),t(W()),G})},t.fromBinder=function(n,r){return null==r&&(r=E.id),new f(new t.Desc(t,"fromBinder",[n,r]),function(e){var u,i,o,s;return s=!1,u=!1,i=function(){return s?void 0:"undefined"!=typeof o&&null!==o?(o(),s=!0):u=!0},o=n(function(){var n,u,o,s,c,f;for(n=1<=arguments.length?pt.call(arguments,0):[],f=r.apply(this,n),q(f)&&E.last(f)instanceof a||(f=[f]),c=t.more,o=0,s=f.length;s>o;o++)if(u=f[o],c=e(u=et(u)),c===t.noMore||u.isEnd())return i(),c;return c}),u&&i(),i})},T=[["addEventListener","removeEventListener"],["addListener","removeListener"],["on","off"],["bind","unbind"]],V=function(t){var n,r,e,u;for(n=0,r=T.length;r>n;n++)if(u=T[n],e=[t[u[0]],t[u[1]]],e[0]&&e[1])return e;throw new c("No suitable event methods in "+t)},t.fromEventTarget=function(n,r,e){var u,i,o;return u=V(n),i=u[0],o=u[1],at(new t.Desc(t,"fromEvent",[n,r]),t.fromBinder(function(t){return i.call(n,r,t),function(){return o.call(n,r,t)}},e))},t.fromEvent=t.fromEventTarget,t.Observable.prototype.map=function(){var n,r;return r=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],k(this,r,n,function(n){return at(new t.Desc(this,"map",[n]),this.withHandler(function(t){return this.push(t.fmap(n))}))})},S=function(t){return q(t[0])?t[0]:Array.prototype.slice.call(t)},O=function(t){return E.isFunction(t[0])?[S(Array.prototype.slice.call(t,1)),t[0]]:[S(Array.prototype.slice.call(t,0,t.length-1)),E.last(t)]},t.combineAsArray=function(){var n,r,e,u,i,o,s;for(s=S(arguments),n=r=0,e=s.length;e>r;n=++r)o=s[n],U(o)||(s[n]=t.constant(o));return s.length?(i=function(){var t,n,r;for(r=[],t=0,n=s.length;n>t;t++)u=s[t],r.push(new g(u,!0));return r}(),at(new t.Desc(t,"combineAsArray",s),t.when(i,function(){var t;return t=1<=arguments.length?pt.call(arguments,0):[]}).toProperty())):t.constant([])},t.onValues=function(){var n,r,e;return e=2<=arguments.length?pt.call(arguments,0,r=arguments.length-1):(r=0,[]),n=arguments[r++],t.combineAsArray(e).onValues(n)},t.combineWith=function(){var n,r,e;return r=O(arguments),e=r[0],n=r[1],at(new t.Desc(t,"combineWith",[n].concat(pt.call(e))),t.combineAsArray(e).map(function(t){return n.apply(null,t)}))},t.Observable.prototype.combine=function(n,r){var e;return e=rt(r),at(new t.Desc(this,"combine",[n,r]),t.combineAsArray(this,n).map(function(t){return e(t[0],t[1])}))},t.Observable.prototype.withStateMachine=function(n,r){var e;return e=n,at(new t.Desc(this,"withStateMachine",[n,r]),this.withHandler(function(n){var u,i,o,s,c,a,f;for(u=r(e,n),s=u[0],a=u[1],e=s,f=t.more,i=0,o=a.length;o>i;i++)if(c=a[i],f=this.push(c),f===t.noMore)return f;return f}))},t.Observable.prototype.skipDuplicates=function(n){return null==n&&(n=function(t,n){return t===n}),at(new t.Desc(this,"skipDuplicates",[]),this.withStateMachine(d,function(t,r){return r.hasValue()?r.isInitial()||t===d||!n(t.get(),r.value())?[new m(r.value()),[r]]:[t,[]]:[t,[r]]}))},t.Observable.prototype.awaiting=function(n){return at(new t.Desc(this,"awaiting",[n]),t.groupSimultaneous(this,n).map(function(t){var n,r;return n=t[0],r=t[1],0===r.length}).toProperty(!1).skipDuplicates())},t.Observable.prototype.not=function(){return at(new t.Desc(this,"not",[]),this.map(function(t){return!t}))},t.Property.prototype.and=function(n){return at(new t.Desc(this,"and",[n]),this.combine(n,function(t,n){return t&&n}))},t.Property.prototype.or=function(n){return at(new t.Desc(this,"or",[n]),this.combine(n,function(t,n){return t||n}))},t.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()}},t.EventStream.prototype.bufferWithTime=function(n){return at(new t.Desc(this,"bufferWithTime",[n]),this.bufferWithTimeOrCount(n,Number.MAX_VALUE))},t.EventStream.prototype.bufferWithCount=function(n){return at(new t.Desc(this,"bufferWithCount",[n]),this.bufferWithTimeOrCount(void 0,n))},t.EventStream.prototype.bufferWithTimeOrCount=function(n,r){var e;return e=function(t){return t.values.length===r?t.flush():void 0!==n?t.schedule():void 0},at(new t.Desc(this,"bufferWithTimeOrCount",[n,r]),this.buffer(n,e,e))},t.EventStream.prototype.buffer=function(n,r,e){var u,i,o;return null==r&&(r=G),null==e&&(e=G),u={scheduled:null,end:void 0,values:[],flush:function(){var n,r;if(this.scheduled&&(t.scheduler.clearTimeout(this.scheduled),this.scheduled=null),this.values.length>0){if(r=this.values,this.values=[],n=this.push(X(r)),null!=this.end)return this.push(this.end);if(n!==t.noMore)return e(this)}else if(null!=this.end)return this.push(this.end)},schedule:function(){return this.scheduled?void 0:this.scheduled=n(function(t){return function(){return t.flush()}}(this))}},o=t.more,E.isFunction(n)||(i=n,n=function(n){return t.scheduler.setTimeout(n,i)}),at(new t.Desc(this,"buffer",[]),this.withHandler(function(t){return u.push=function(t){return function(n){return t.push(n)}}(this),t.isError()?o=this.push(t):t.isEnd()?(u.end=t,u.scheduled||u.flush()):(u.values.push(t.value()),r(u)),o}))},t.Observable.prototype.filter=function(){var n,r;return r=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],k(this,r,n,function(n){return at(new t.Desc(this,"filter",[n]),this.withHandler(function(r){return r.filter(n)?this.push(r):t.more}))})},t.once=function(n){return new f(new i(t,"once",[n]),function(t){return t(et(n)),t(W()),G})},t.EventStream.prototype.concat=function(n){var r;return r=this,new f(new t.Desc(r,"concat",[n]),function(t){var e,u;return u=G,e=r.dispatcher.subscribe(function(r){return r.isEnd()?u=n.dispatcher.subscribe(t):t(r)}),function(){return e(),u()}})},t.Observable.prototype.flatMap=function(){return B(this,$(arguments))},t.Observable.prototype.flatMapFirst=function(){return B(this,$(arguments),!0)},B=function(n,r,u,i){var o,s,c;return c=[n],o=[],s=new f(new t.Desc(n,"flatMap"+(u?"First":""),[r]),function(s){var c,a,f,h,p;return f=new e,h=[],p=function(n){var e;return e=Z(r(n.value())),o.push(e),f.add(function(n,r){return e.dispatcher.subscribe(function(u){var i;return u.isEnd()?(E.remove(e,o),a(),c(r),t.noMore):(u instanceof l&&(u=u.toNext()),i=s(u),i===t.noMore&&n(),i)})})},a=function(){var t;return t=h.shift(),t?p(t):void 0},c=function(t){return t(),f.empty()?s(W()):void 0},f.add(function(r,e){return n.dispatcher.subscribe(function(n){return n.isEnd()?c(e):n.isError()?s(n):u&&f.count()>1?t.more:f.unsubscribed?t.noMore:i&&f.count()>i?h.push(n):p(n)})}),f.unsubscribe}),s.internalDeps=function(){return o.length?c.concat(o):c},s},$=function(t){return 1===t.length&&U(t[0])?E.always(t[0]):R(t)},Z=function(n){return U(n)?n:t.once(n)},t.Observable.prototype.flatMapWithConcurrencyLimit=function(){var n,r;return r=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],at(new t.Desc(this,"flatMapWithConcurrencyLimit",[r].concat(pt.call(n))),B(this,$(n),!1,r))},t.Observable.prototype.flatMapConcat=function(){return at(new t.Desc(this,"flatMapConcat",Array.prototype.slice.call(arguments,0)),this.flatMapWithConcurrencyLimit.apply(this,[1].concat(pt.call(arguments))))},t.later=function(n,r){return at(new t.Desc(t,"later",[n,r]),t.fromBinder(function(e){var u,i;return i=function(){return e([r,W()])},u=t.scheduler.setTimeout(i,n),function(){return t.scheduler.clearTimeout(u)}}))},t.Observable.prototype.bufferingThrottle=function(n){return at(new t.Desc(this,"bufferingThrottle",[n]),this.flatMapConcat(function(r){return t.once(r).concat(t.later(n).filter(!1))}))},t.Property.prototype.bufferingThrottle=function(){return t.Observable.prototype.bufferingThrottle.apply(this,arguments).toProperty()},r=function(n){function r(){return this.guardedSink=dt(this.guardedSink,this),this.subscribeAll=dt(this.subscribeAll,this),this.unsubAll=dt(this.unsubAll,this),this instanceof r?(this.sink=void 0,this.subscriptions=[],this.ended=!1,void r.__super__.constructor.call(this,new t.Desc(t,"Bus",[]),this.subscribeAll)):new r}return lt(r,n),r.prototype.unsubAll=function(){var t,n,r,e;for(r=this.subscriptions,t=0,n=r.length;n>t;t++)e=r[t],"function"==typeof e.unsub&&e.unsub();return void 0},r.prototype.subscribeAll=function(t){var n,r,e,u;if(this.ended)t(W());else for(this.sink=t,e=M(this.subscriptions),n=0,r=e.length;r>n;n++)u=e[n],this.subscribeInput(u);return this.unsubAll},r.prototype.guardedSink=function(n){return function(r){return function(e){return e.isEnd()?(r.unsubscribeInput(n),t.noMore):r.sink(e)}}(this)},r.prototype.subscribeInput=function(t){return t.unsub=t.input.dispatcher.subscribe(this.guardedSink(t.input))},r.prototype.unsubscribeInput=function(t){var n,r,e,u,i;for(u=this.subscriptions,n=r=0,e=u.length;e>r;n=++r)if(i=u[n],i.input===t)return"function"==typeof i.unsub&&i.unsub(),void this.subscriptions.splice(n,1)},r.prototype.plug=function(t){var n;if(!this.ended)return n={input:t},this.subscriptions.push(n),null!=this.sink&&this.subscribeInput(n),function(n){return function(){return n.unsubscribeInput(t)}}(this)},r.prototype.end=function(){return this.ended=!0,this.unsubAll(),"function"==typeof this.sink?this.sink(W()):void 0},r.prototype.push=function(t){return this.ended?void 0:"function"==typeof this.sink?this.sink(X(t)):void 0},r.prototype.error=function(t){return"function"==typeof this.sink?this.sink(new c(t)):void 0},r}(f),t.Bus=r,z=function(n,r){return ft(function(){var e,u,i;return u=arguments[0],e=2<=arguments.length?pt.call(arguments,1):[],i=J(r,[function(t,n){return u.apply(null,pt.call(t).concat([n]))}]),at(new t.Desc(t,n,[u].concat(pt.call(e))),t.combineAsArray(e).flatMap(i))})},t.fromCallback=z("fromCallback",function(){var n,r;return r=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],t.fromBinder(function(t){return j(r,n)(t),G},function(t){return[t,W()]})}),t.fromNodeCallback=z("fromNodeCallback",function(){var n,r;return r=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],t.fromBinder(function(t){return j(r,n)(t),G},function(t,n){return t?[new c(t),W()]:[n,W()]})}),t.combineTemplate=function(n){var r,e,u,i,o,s,c,a,f,h,l;return c=[],l=[],s=function(t){return t[t.length-1]},h=function(t,n,r){return s(t)[n]=r},r=function(t,n){return function(r,e){return h(r,t,e[n])}},o=function(t,n){return function(r){return h(r,t,n)}},a=function(t){return q(t)?[]:{}},f=function(t,n){return function(r){var e;return e=a(n),h(r,t,e),r.push(e)}},u=function(t,n){var e;return U(n)?(l.push(n),c.push(r(t,l.length-1))):n!==Object(n)||"function"==typeof n||n instanceof RegExp||n instanceof Date?c.push(o(t,n)):(e=function(t){return t.pop()},c.push(f(t,n)),i(n),c.push(e))},i=function(t){return E.each(t,u)},i(n),e=function(t){var r,e,u,i,o;for(o=a(n),r=[o],u=0,i=c.length;i>u;u++)(e=c[u])(r,t);return o},at(new t.Desc(t,"combineTemplate",[n]),t.combineAsArray(l).map(e))},D=function(n,r){var e;return e=new f(I(n,"justInitValue"),function(r){var u,i;return i=void 0,u=n.dispatcher.subscribe(function(n){return n.isEnd()||(i=n),t.noMore}),w.whenDoneWith(e,function(){return null!=i&&r(i),r(W())}),u}),e.concat(r).toProperty()},t.Observable.prototype.mapEnd=function(){var n;return n=R(arguments),at(new t.Desc(this,"mapEnd",[n]),this.withHandler(function(r){return r.isEnd()?(this.push(X(n(r))),this.push(W()),t.noMore):this.push(r)}))},t.Observable.prototype.skipErrors=function(){return at(new t.Desc(this,"skipErrors",[]),this.withHandler(function(n){return n.isError()?t.more:this.push(n)}))},t.EventStream.prototype.takeUntil=function(n){var r;return r={},at(new t.Desc(this,"takeUntil",[n]),t.groupSimultaneous(this.mapEnd(r),n.skipErrors()).withHandler(function(e){var u,i,o,s,c,a;if(e.hasValue()){if(s=e.value(),u=s[0],n=s[1],n.length)return this.push(W());for(c=t.more,i=0,o=u.length;o>i;i++)a=u[i],c=this.push(a===r?W():X(a));return c}return this.push(e)}))},t.Property.prototype.takeUntil=function(n){var r;return r=this.changes().takeUntil(n),at(new t.Desc(this,"takeUntil",[n]),D(this,r))},t.Observable.prototype.flatMapLatest=function(){var n,r;return n=$(arguments),r=this.toEventStream(),at(new t.Desc(this,"flatMapLatest",[n]),r.flatMap(function(t){return Z(n(t)).takeUntil(r)}))},t.Property.prototype.delayChanges=function(t,n){return at(t,D(this,n(this.changes())))},t.EventStream.prototype.delay=function(n){return at(new t.Desc(this,"delay",[n]),this.flatMap(function(r){ | ||
return t.later(n,r)}))},t.Property.prototype.delay=function(n){return this.delayChanges(new t.Desc(this,"delay",[n]),function(t){return t.delay(n)})},t.EventStream.prototype.debounce=function(n){return at(new t.Desc(this,"debounce",[n]),this.flatMapLatest(function(r){return t.later(n,r)}))},t.Property.prototype.debounce=function(n){return this.delayChanges(new t.Desc(this,"debounce",[n]),function(t){return t.debounce(n)})},t.EventStream.prototype.debounceImmediate=function(n){return at(new t.Desc(this,"debounceImmediate",[n]),this.flatMapFirst(function(r){return t.once(r).concat(t.later(n).filter(!1))}))},t.Observable.prototype.decode=function(n){return at(new t.Desc(this,"decode",[n]),this.combine(t.combineTemplate(n),function(t,n){return n[t]}))},t.Observable.prototype.scan=function(n,r){var e,u,i,o;return r=rt(r),e=ot(n),u=!1,o=function(n){return function(o){var s,c,a,f;return s=!1,f=G,c=t.more,a=function(){return s?void 0:e.forEach(function(n){return s=u=!0,c=o(new l(function(){return n})),c===t.noMore?(f(),f=G):void 0})},f=n.dispatcher.subscribe(function(n){var i,f;return n.hasValue()?u&&n.isInitial()?t.more:(n.isInitial()||a(),s=u=!0,f=e.getOrElse(void 0),i=r(f,n.value()),e=new m(i),o(n.apply(function(){return i}))):(n.isEnd()&&(c=a()),c!==t.noMore?o(n):void 0)}),w.whenDoneWith(i,a),f}}(this),i=new y(new t.Desc(this,"scan",[n,r]),o)},t.Observable.prototype.diff=function(n,r){return r=rt(r),at(new t.Desc(this,"diff",[n,r]),this.scan([n],function(t,n){return[n,r(t[0],n)]}).filter(function(t){return 2===t.length}).map(function(t){return t[1]}))},t.Observable.prototype.doAction=function(){var n;return n=R(arguments),at(new t.Desc(this,"doAction",[n]),this.withHandler(function(t){return t.hasValue()&&n(t.value()),this.push(t)}))},t.Observable.prototype.doError=function(){var n;return n=R(arguments),at(new t.Desc(this,"doError",[n]),this.withHandler(function(t){return t.isError()&&n(t.error),this.push(t)}))},t.Observable.prototype.doLog=function(){var n;return n=1<=arguments.length?pt.call(arguments,0):[],at(new t.Desc(this,"doLog",n),this.withHandler(function(t){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log&&console.log.apply(console,pt.call(n).concat([t.log()])),this.push(t)}))},t.Observable.prototype.endOnError=function(){var n,r;return r=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],null==r&&(r=!0),k(this,r,n,function(n){return at(new t.Desc(this,"endOnError",[]),this.withHandler(function(t){return t.isError()&&n(t.error)?(this.push(t),this.push(W())):this.push(t)}))})},v.prototype.errors=function(){return at(new t.Desc(this,"errors",[]),this.filter(function(){return!1}))},ct=function(t){return[t,W()]},t.fromPromise=function(n,r,e){return null==e&&(e=ct),at(new t.Desc(t,"fromPromise",[n]),t.fromBinder(function(t){var e;return null!=(e=n.then(t,function(n){return t(new c(n))}))&&"function"==typeof e.done&&e.done(),function(){return r&&"function"==typeof n.abort?n.abort():void 0}},e))},t.Observable.prototype.mapError=function(){var n;return n=R(arguments),at(new t.Desc(this,"mapError",[n]),this.withHandler(function(t){return this.push(t.isError()?X(n(t.error)):t)}))},t.Observable.prototype.flatMapError=function(n){return at(new t.Desc(this,"flatMapError",[n]),this.mapError(function(t){return new c(t)}).flatMap(function(r){return r instanceof c?n(r.error):t.once(r)}))},t.EventStream.prototype.sampledBy=function(n,r){return at(new t.Desc(this,"sampledBy",[n,r]),this.toProperty().sampledBy(n,r))},t.Property.prototype.sampledBy=function(n,r){var e,u,i,o,s;return null!=r?r=rt(r):(e=!0,r=function(t){return t.value()}),s=new g(this,!1,e),i=new g(n,!0,e),o=t.when([s,i],r),u=n instanceof y?o.toProperty():o,at(new t.Desc(this,"sampledBy",[n,r]),u)},t.Property.prototype.sample=function(n){return at(new t.Desc(this,"sample",[n]),this.sampledBy(t.interval(n,{})))},t.Observable.prototype.map=function(){var n,r;return r=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],r instanceof y?r.sampledBy(this,F):k(this,r,n,function(n){return at(new t.Desc(this,"map",[n]),this.withHandler(function(t){return this.push(t.fmap(n))}))})},t.Observable.prototype.fold=function(n,r){return at(new t.Desc(this,"fold",[n,r]),this.scan(n,r).sampledBy(this.filter(!1).mapEnd().toProperty()))},v.prototype.reduce=v.prototype.fold,t.fromPoll=function(n,r){return at(new t.Desc(t,"fromPoll",[n,r]),t.fromBinder(function(r){var e;return e=t.scheduler.setInterval(r,n),function(){return t.scheduler.clearInterval(e)}},r))},t.Observable.prototype.groupBy=function(n,r){var e,u;return null==r&&(r=t._.id),u={},e=this,e.filter(function(t){return!u[n(t)]}).map(function(i){var o,s,c,a;return s=n(i),a=e.filter(function(t){return n(t)===s}),o=t.once(i).concat(a),c=r(o,i).withHandler(function(t){return this.push(t),t.isEnd()?delete u[s]:void 0}),u[s]=c})},t.fromArray=function(n){var r;return n.length?(r=0,new f(new t.Desc(t,"fromArray",[n]),function(e){var u,i,o,s,c;return c=!1,s=t.more,o=!1,i=!1,u=function(){var a;if(i=!0,!o){for(o=!0;i;)i=!1,s===t.noMore||c||(a=n[r++],s=e(et(a)),s!==t.noMore&&(r===n.length?e(W()):w.afterTransaction(u)));return o=!1}},u(),function(){return c=!0}})):at(new t.Desc(t,"fromArray",n),t.never())},t.EventStream.prototype.holdWhen=function(n){var r,u,i;return u=!1,r=[],i=this,new f(new t.Desc(this,"holdWhen",[n]),function(t){var o,s,c;return o=new e,c=!1,s=function(n){return"function"==typeof n&&n(),o.empty()&&c?t(W()):void 0},o.add(function(e,i){return n.subscribeInternal(function(n){var e,o,c,a,f;if(!n.hasValue())return n.isEnd()?s(i):t(n);if(u=n.value(),!u){for(a=r,r=[],c=[],e=0,o=a.length;o>e;e++)f=a[e],c.push(t(X(f)));return c}})}),o.add(function(n,e){return i.subscribeInternal(function(n){return u&&n.hasValue()?r.push(n.value()):n.isEnd()&&r.length?s(e):t(n)})}),c=!0,s(),o.unsubscribe})},t.interval=function(n,r){return null==r&&(r={}),at(new t.Desc(t,"interval",[n,r]),t.fromPoll(n,function(){return X(r)}))},t.$={},t.$.asEventStream=function(n,r,e){var u;return E.isFunction(r)&&(u=[r,void 0],e=u[0],r=u[1]),at(new t.Desc(this.selector||this,"asEventStream",[n]),t.fromBinder(function(t){return function(e){return t.on(n,r,e),function(){return t.off(n,r,e)}}}(this),e))},null!=(Y="undefined"!=typeof jQuery&&null!==jQuery?jQuery:"undefined"!=typeof Zepto&&null!==Zepto?Zepto:void 0)&&(Y.fn.asEventStream=t.$.asEventStream),t.Observable.prototype.log=function(){var t;return t=1<=arguments.length?pt.call(arguments,0):[],this.subscribe(function(n){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log?console.log.apply(console,pt.call(t).concat([n.log()])):void 0}),this},t.EventStream.prototype.merge=function(n){var r;return r=this,at(new t.Desc(r,"merge",[n]),t.mergeAll(this,n))},t.mergeAll=function(){var n;return n=S(arguments),n.length?new f(new t.Desc(t,"mergeAll",n),function(r){var e,u,i;return e=0,i=function(u){return function(i){return u.dispatcher.subscribe(function(u){var o;return u.isEnd()?(e++,e===n.length?r(W()):t.more):(o=r(u),o===t.noMore&&i(),o)})}},u=E.map(i,n),new t.CompositeUnsubscribe(u).unsubscribe}):t.never()},t.repeatedly=function(n,r){var e;return e=0,at(new t.Desc(t,"repeatedly",[n,r]),t.fromPoll(n,function(){return r[e++%r.length]}))},t.repeat=function(n){var r;return r=0,t.fromBinder(function(e){var u,i,o,s,c;return u=!1,o=t.more,c=function(){},i=function(t){return t.isEnd()?u?s():u=!0:o=e(t)},s=function(){var s;for(u=!0;u&&o!==t.noMore;)s=n(r++),u=!1,s?c=s.subscribeInternal(i):e(W());return u=!0},s(),function(){return c()}})},t.retry=function(n){var r,e,u,i,o,s,c;if(!E.isFunction(n.source))throw new h("'source' option has to be a function");return c=n.source,s=n.retries||0,o=n.maxRetries||s,r=n.delay||function(){return 0},i=n.isRetryable||function(){return!0},u=!1,e=null,at(new t.Desc(t,"retry",[n]),t.repeat(function(){var n,a,f;return u?null:(f=function(){return c().endOnError().withHandler(function(t){return t.isError()?(e=t,i(e.error)&&s>0?void 0:(u=!0,this.push(t))):(t.hasValue()&&(e=null,u=!0),this.push(t))})},e?(n={error:e.error,retriesDone:o-s},a=t.later(r(n)).filter(!1),s-=1,a.concat(t.once().flatMap(f))):f())}))},t.sequentially=function(n,r){var e;return e=0,at(new t.Desc(t,"sequentially",[n,r]),t.fromPoll(n,function(){var t;return t=r[e++],e<r.length?t:e===r.length?[t,W()]:W()}))},t.Observable.prototype.skip=function(n){return at(new t.Desc(this,"skip",[n]),this.withHandler(function(r){return r.hasValue()&&n>0?(n--,t.more):this.push(r)}))},t.Observable.prototype.take=function(n){return 0>=n?t.never():at(new t.Desc(this,"take",[n]),this.withHandler(function(r){return r.hasValue()?(n--,n>0?this.push(r):(0===n&&this.push(r),this.push(W()),t.noMore)):this.push(r)}))},t.EventStream.prototype.skipUntil=function(n){var r;return r=n.take(1).map(!0).toProperty(!1),at(new t.Desc(this,"skipUntil",[n]),this.filter(r))},t.EventStream.prototype.skipWhile=function(){var n,r,e;return r=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],e=!1,k(this,r,n,function(n){return at(new t.Desc(this,"skipWhile",[n]),this.withHandler(function(r){return!e&&r.hasValue()&&n(r.value())?t.more:(r.hasValue()&&(e=!0),this.push(r))}))})},t.Observable.prototype.slidingWindow=function(n,r){return null==r&&(r=0),at(new t.Desc(this,"slidingWindow",[n,r]),this.scan([],function(t,r){return t.concat([r]).slice(-n)}).filter(function(t){return t.length>=r}))},t.spy=function(t){return nt.push(t)},nt=[],tt=function(t){var n,r,e;if(nt.length&&!tt.running)try{for(tt.running=!0,n=0,r=nt.length;r>n;n++)(e=nt[n])(t)}finally{delete tt.running}return void 0},t.Property.prototype.startWith=function(n){return at(new t.Desc(this,"startWith",[n]),this.scan(n,function(t,n){return n}))},t.EventStream.prototype.startWith=function(n){return at(new t.Desc(this,"startWith",[n]),t.once(n).concat(this))},t.Observable.prototype.takeWhile=function(){var n,r;return r=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],k(this,r,n,function(n){return at(new t.Desc(this,"takeWhile",[n]),this.withHandler(function(r){return r.filter(n)?this.push(r):(this.push(W()),t.noMore)}))})},t["try"]=function(n){return function(r){var e;try{return t.once(n(r))}catch(u){return e=u,new t.Error(e)}}},t.update=function(){var n,r,e,u;for(r=arguments[0],u=2<=arguments.length?pt.call(arguments,1):[],e=function(t){return function(){var n;return n=1<=arguments.length?pt.call(arguments,0):[],function(r){return t.apply(null,[r].concat(n))}}},n=u.length-1;n>0;)u[n]instanceof Function||(u[n]=function(t){return function(){return t}}(u[n])),u[n]=e(u[n]),n-=2;return at(new t.Desc(t,"update",[r].concat(pt.call(u))),t.when.apply(t,u).scan(r,function(t,n){return n(t)}))},t.zipAsArray=function(){var n;return n=S(arguments),at(new t.Desc(t,"zipAsArray",n),t.zipWith(n,function(){var t;return t=1<=arguments.length?pt.call(arguments,0):[]}))},t.zipWith=function(){var n,r,e;return r=O(arguments),e=r[0],n=r[1],e=E.map(function(t){return t.toEventStream()},e),at(new t.Desc(t,"zipWith",[n].concat(pt.call(e))),t.when(e,n))},t.Observable.prototype.zip=function(n,r){return null==r&&(r=Array),at(new t.Desc(this,"zip",[n]),t.zipWith([this,n],r))},t.Observable.prototype.first=function(){return at(new t.Desc(this,"first",[]),this.take(1))},t.Observable.prototype.last=function(){var n;return at(new t.Desc(this,"last",[]),this.withHandler(function(r){return r.isEnd()?(n&&this.push(n),this.push(W()),t.noMore):void(n=r)}))},t.EventStream.prototype.throttle=function(n){return at(new t.Desc(this,"throttle",[n]),this.bufferWithTime(n).map(function(t){return t[t.length-1]}))},t.Property.prototype.throttle=function(n){return this.delayChanges(new t.Desc(this,"throttle",[n]),function(t){return t.throttle(n)})},v.prototype.firstToPromise=function(n){var r=this;if("function"!=typeof n){if("function"!=typeof Promise)throw new h("There isn't default Promise, use shim or parameter");n=Promise}return new n(function(n,e){return r.subscribe(function(r){return r.hasValue()&&n(r.value()),r.isError()&&e(r.error),t.noMore})})},v.prototype.toPromise=function(t){return this.last().firstToPromise(t)},"undefined"!=typeof define&&null!==define&&null!=define.amd?(define([],function(){return t}),"undefined"!=typeof this&&null!==this&&(this.Bacon=t)):"undefined"!=typeof module&&null!==module&&null!=module.exports?(module.exports=t,t.Bacon=t):this.Bacon=t}).call(this); | ||
(function(){var t,n,r,e,u,i,o,s,c,a,f,h,l,p,d,v,y,b,m,g,w,E,D,S,O,M,A,_,k,I,W,P,T,x,V,B,F,H,C,q,L,U,N,z,j,R,Q,Z,$,X,G,J,K,Y,tt,nt,rt,et,ut,it,ot,st,ct,at,ft,ht={}.hasOwnProperty,lt=function(t,n){function r(){this.constructor=t}for(var e in n)ht.call(n,e)&&(t[e]=n[e]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},pt=[].slice,dt=function(t,n){return function(){return t.apply(n,arguments)}};t={toString:function(){return"Bacon"}},t.version="0.7.75",h=("undefined"!=typeof global&&null!==global?global:this).Error,G=function(){},N=function(t,n){return n},F=function(t,n){return t},M=function(t){return t.slice(0)},q=function(t){return t instanceof Array},U=function(t){return t instanceof v},E={indexOf:Array.prototype.indexOf?function(t,n){return t.indexOf(n)}:function(t,n){var r,e,u,i;for(r=e=0,u=t.length;u>e;r=++e)if(i=t[r],n===i)return r;return-1},indexWhere:function(t,n){var r,e,u,i;for(r=e=0,u=t.length;u>e;r=++e)if(i=t[r],n(i))return r;return-1},head:function(t){return t[0]},always:function(t){return function(){return t}},negate:function(t){return function(n){return!t(n)}},empty:function(t){return 0===t.length},tail:function(t){return t.slice(1,t.length)},filter:function(t,n){var r,e,u,i;for(r=[],e=0,u=n.length;u>e;e++)i=n[e],t(i)&&r.push(i);return r},map:function(t,n){var r,e,u,i;for(u=[],r=0,e=n.length;e>r;r++)i=n[r],u.push(t(i));return u},each:function(t,n){var r,e;for(r in t)ht.call(t,r)&&(e=t[r],n(r,e));return void 0},toArray:function(t){return q(t)?t:[t]},contains:function(t,n){return-1!==E.indexOf(t,n)},id:function(t){return t},last:function(t){return t[t.length-1]},all:function(t,n){var r,e,u;for(null==n&&(n=E.id),r=0,e=t.length;e>r;r++)if(u=t[r],!n(u))return!1;return!0},any:function(t,n){var r,e,u;for(null==n&&(n=E.id),r=0,e=t.length;e>r;r++)if(u=t[r],n(u))return!0;return!1},without:function(t,n){return E.filter(function(n){return n!==t},n)},remove:function(t,n){var r;return r=E.indexOf(n,t),r>=0?n.splice(r,1):void 0},fold:function(t,n,r){var e,u,i;for(e=0,u=t.length;u>e;e++)i=t[e],n=r(n,i);return n},flatMap:function(t,n){return E.fold(n,[],function(n,r){return n.concat(t(r))})},cached:function(t){var n;return n=d,function(){return n===d&&(n=t(),t=void 0),n}},isFunction:function(t){return"function"==typeof t},toString:function(t){var n,r,e,u;try{return K++,null==t?"undefined":E.isFunction(t)?"function":q(t)?K>5?"[..]":"["+E.map(E.toString,t).toString()+"]":null!=(null!=t?t.toString:void 0)&&t.toString!==Object.prototype.toString?t.toString():"object"==typeof t?K>5?"{..}":(r=function(){var r;r=[];for(e in t)ht.call(t,e)&&(u=function(){try{return t[e]}catch(r){return n=r}}(),r.push(E.toString(e)+":"+E.toString(u)));return r}(),"{"+r+"}"):t}finally{K--}}},K=0,t._=E,w=t.UpdateBarrier=function(){var n,r,e,u,i,o,s,c,a,f,h,l,p,d;return f=void 0,h=[],l={},r=[],e=0,n=function(t){return f?r.push(t):t()},p=function(t,n){var r;return f?(r=l[t.id],null==r?(r=l[t.id]=[n],h.push(t)):r.push(n)):n()},i=function(){for(;h.length>0;)s(0);return void 0},s=function(t){var n,r,e,u,i,s;for(u=h[t],i=u.id,s=l[i],h.splice(t,1),delete l[i],o(u),r=0,e=s.length;e>r;r++)(n=s[r])();return void 0},o=function(t){var n,r,e,u,i;for(r=t.internalDeps(),u=0,i=r.length;i>u;u++)n=r[u],o(n),l[n.id]&&(e=E.indexOf(h,n),s(e));return void 0},a=function(t,n,u,o){var s,c;if(f)return u.apply(n,o);f=t;try{c=u.apply(n,o),i()}finally{for(f=void 0;e<r.length;)s=r[e],e++,s();e=0,r=[]}return c},u=function(){return f?f.id:void 0},d=function(r,e){var u,i,o,s;return s=!1,i=!1,u=function(){return i=!0},o=function(){return s=!0,u()},u=r.dispatcher.subscribe(function(r){return n(function(){var n;return s||(n=e(r),n!==t.noMore)?void 0:o()})}),i&&u(),o},c=function(){return h.length>0},{whenDoneWith:p,hasWaiters:c,inTransaction:a,currentEventId:u,wrappedSubscribe:d,afterTransaction:n}}(),g=function(){function t(t,n,r){this.obs=t,this.sync=n,this.lazy=null!=r?r:!1,this.queue=[]}return t.prototype.subscribe=function(t){return this.obs.dispatcher.subscribe(t)},t.prototype.toString=function(){return this.obs.toString()},t.prototype.markEnded=function(){return this.ended=!0},t.prototype.consume=function(){return this.lazy?{value:E.always(this.queue[0])}:this.queue[0]},t.prototype.push=function(t){return this.queue=[t]},t.prototype.mayHave=function(){return!0},t.prototype.hasAtLeast=function(){return this.queue.length},t.prototype.flatten=!0,t}(),u=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}return lt(n,t),n.prototype.consume=function(){return this.queue.shift()},n.prototype.push=function(t){return this.queue.push(t)},n.prototype.mayHave=function(t){return!this.ended||this.queue.length>=t},n.prototype.hasAtLeast=function(t){return this.queue.length>=t},n.prototype.flatten=!1,n}(g),n=function(t){function n(t){n.__super__.constructor.call(this,t,!0)}return lt(n,t),n.prototype.consume=function(){var t;return t=this.queue,this.queue=[],{value:function(){return t}}},n.prototype.push=function(t){return this.queue.push(t.value())},n.prototype.hasAtLeast=function(){return!0},n}(g),g.isTrigger=function(t){return t instanceof g?t.sync:t instanceof f},g.fromObservable=function(t){return t instanceof g?t:t instanceof y?new g(t,!1):new u(t,!0)},i=function(){function t(t,n,r){this.context=t,this.method=n,this.args=r}return t.prototype.deps=function(){return this.cached||(this.cached=x([this.context].concat(this.args)))},t.prototype.toString=function(){return E.toString(this.context)+"."+E.toString(this.method)+"("+E.map(E.toString,this.args)+")"},t}(),I=function(){var t,n,r;return n=arguments[0],r=arguments[1],t=3<=arguments.length?pt.call(arguments,2):[],(n||r)instanceof i?n||r:new i(n,r,t)},at=function(t,n){return n.desc=t,n},x=function(t){return q(t)?E.flatMap(x,t):U(t)?[t]:t instanceof g?[t.obs]:[]},t.Desc=i,t.Desc.empty=new t.Desc("","",[]),ft=function(t){return function(){var n,r,e,u;return e=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],"object"==typeof e&&n.length&&(r=e,u=n[0],e=function(){return r[u].apply(r,arguments)},n=n.slice(1)),t.apply(null,[e].concat(pt.call(n)))}},R=function(t){return t=Array.prototype.slice.call(t),Q.apply(null,t)},J=function(t,n){return function(){var r;return r=1<=arguments.length?pt.call(arguments,0):[],t.apply(null,n.concat(r))}},st=function(t){return function(n){return function(r){var e;return null==r?void 0:(e=r[n],E.isFunction(e)?e.apply(r,t):e)}}},ut=function(t,n){var r,e;return e=t.slice(1).split("."),r=E.map(st(n),e),function(n){var e,u;for(e=0,u=r.length;u>e;e++)t=r[e],n=t(n);return n}},L=function(t){return"string"==typeof t&&t.length>1&&"."===t.charAt(0)},Q=ft(function(){var t,n;return n=arguments[0],t=2<=arguments.length?pt.call(arguments,1):[],E.isFunction(n)?t.length?J(n,t):n:L(n)?ut(n,t):E.always(n)}),j=function(t,n){return Q.apply(null,[t].concat(pt.call(n)))},k=function(t,n,r,e){var u;return n instanceof y?(u=n.sampledBy(t,function(t,n){return[t,n]}),e.call(u,function(t){var n,r;return n=t[0],r=t[1],n}).map(function(t){var n,r;return n=t[0],r=t[1]})):(n=j(n,r),e.call(t,n))},rt=function(t){var n;if(E.isFunction(t))return t;if(L(t))return n=it(t),function(t,r){return t[n](r)};throw new h("not a function or a field key: "+t)},it=function(t){return t.slice(1)},m=function(){function t(t){this.value=t}return t.prototype.getOrElse=function(){return this.value},t.prototype.get=function(){return this.value},t.prototype.filter=function(n){return n(this.value)?new t(this.value):d},t.prototype.map=function(n){return new t(n(this.value))},t.prototype.forEach=function(t){return t(this.value)},t.prototype.isDefined=!0,t.prototype.toArray=function(){return[this.value]},t.prototype.inspect=function(){return"Some("+this.value+")"},t.prototype.toString=function(){return this.inspect()},t}(),d={getOrElse:function(t){return t},filter:function(){return d},map:function(){return d},forEach:function(){},isDefined:!1,toArray:function(){return[]},inspect:function(){return"None"},toString:function(){return this.inspect()}},ot=function(t){return t instanceof m||t===d?t:new m(t)},t.noMore=["<no-more>"],t.more=["<more>"],P=0,a=function(){function t(){this.id=++P}return t.prototype.isEvent=function(){return!0},t.prototype.isEnd=function(){return!1},t.prototype.isInitial=function(){return!1},t.prototype.isNext=function(){return!1},t.prototype.isError=function(){return!1},t.prototype.hasValue=function(){return!1},t.prototype.filter=function(){return!0},t.prototype.inspect=function(){return this.toString()},t.prototype.log=function(){return this.toString()},t}(),p=function(t){function n(t,r){return this instanceof n?(n.__super__.constructor.call(this),void(!r&&E.isFunction(t)||t instanceof n?(this.valueF=t,this.valueInternal=void 0):(this.valueF=void 0,this.valueInternal=t))):new n(t,r)}return lt(n,t),n.prototype.isNext=function(){return!0},n.prototype.hasValue=function(){return!0},n.prototype.value=function(){return this.valueF instanceof n?(this.valueInternal=this.valueF.value(),this.valueF=void 0):this.valueF&&(this.valueInternal=this.valueF(),this.valueF=void 0),this.valueInternal},n.prototype.fmap=function(t){var n,r;return this.valueInternal?(r=this.valueInternal,this.apply(function(){return t(r)})):(n=this,this.apply(function(){return t(n.value())}))},n.prototype.apply=function(t){return new n(t)},n.prototype.filter=function(t){return t(this.value())},n.prototype.toString=function(){return E.toString(this.value())},n.prototype.log=function(){return this.value()},n}(a),l=function(t){function n(t,r){return this instanceof n?void n.__super__.constructor.call(this,t,r):new n(t,r)}return lt(n,t),n.prototype.isInitial=function(){return!0},n.prototype.isNext=function(){return!1},n.prototype.apply=function(t){return new n(t)},n.prototype.toNext=function(){return new p(this)},n}(p),s=function(t){function n(){return this instanceof n?void 0:new n}return lt(n,t),n.prototype.isEnd=function(){return!0},n.prototype.fmap=function(){return this},n.prototype.apply=function(){return this},n.prototype.toString=function(){return"<end>"},n}(a),c=function(t){function n(t){return this instanceof n?void(this.error=t):new n(t)}return lt(n,t),n.prototype.isError=function(){return!0},n.prototype.fmap=function(){return this},n.prototype.apply=function(){return this},n.prototype.toString=function(){return"<error> "+E.toString(this.error)},n}(a),t.Event=a,t.Initial=l,t.Next=p,t.End=s,t.Error=c,C=function(t){return new l(t,!0)},X=function(t){return new p(t,!0)},W=function(){return new s},et=function(t){return t instanceof a?t:X(t)},H=0,tt=function(){},v=function(){function t(t){this.desc=t,this.id=++H,this.initialDesc=this.desc}return t.prototype.subscribe=function(t){return w.wrappedSubscribe(this,t)},t.prototype.subscribeInternal=function(t){return this.dispatcher.subscribe(t)},t.prototype.onValue=function(){var t;return t=R(arguments),this.subscribe(function(n){return n.hasValue()?t(n.value()):void 0})},t.prototype.onValues=function(t){return this.onValue(function(n){return t.apply(null,n)})},t.prototype.onError=function(){var t;return t=R(arguments),this.subscribe(function(n){return n.isError()?t(n.error):void 0})},t.prototype.onEnd=function(){var t;return t=R(arguments),this.subscribe(function(n){return n.isEnd()?t():void 0})},t.prototype.name=function(t){return this._name=t,this},t.prototype.withDescription=function(){return this.desc=I.apply(null,arguments),this},t.prototype.toString=function(){return this._name?this._name:this.desc.toString()},t.prototype.internalDeps=function(){return this.initialDesc.deps()},t}(),v.prototype.assign=v.prototype.onValue,v.prototype.forEach=v.prototype.onValue,v.prototype.inspect=v.prototype.toString,t.Observable=v,e=function(){function t(t){var n,r,e;for(null==t&&(t=[]),this.unsubscribe=dt(this.unsubscribe,this),this.unsubscribed=!1,this.subscriptions=[],this.starting=[],n=0,r=t.length;r>n;n++)e=t[n],this.add(e)}return t.prototype.add=function(t){var n,r,e;if(!this.unsubscribed)return n=!1,r=G,this.starting.push(t),e=function(e){return function(){return e.unsubscribed?void 0:(n=!0,e.remove(r),E.remove(t,e.starting))}}(this),r=t(this.unsubscribe,e),this.unsubscribed||n?r():this.subscriptions.push(r),E.remove(t,this.starting),r},t.prototype.remove=function(t){return this.unsubscribed?void 0:void 0!==E.remove(t,this.subscriptions)?t():void 0},t.prototype.unsubscribe=function(){var t,n,r,e;if(!this.unsubscribed){for(this.unsubscribed=!0,r=this.subscriptions,t=0,n=r.length;n>t;t++)(e=r[t])();return this.subscriptions=[],this.starting=[]}},t.prototype.count=function(){return this.unsubscribed?0:this.subscriptions.length+this.starting.length},t.prototype.empty=function(){return 0===this.count()},t}(),t.CompositeUnsubscribe=e,o=function(){function n(t,n){this._subscribe=t,this._handleEvent=n,this.subscribe=dt(this.subscribe,this),this.handleEvent=dt(this.handleEvent,this),this.subscriptions=[],this.queue=[]}return n.prototype.pushing=!1,n.prototype.ended=!1,n.prototype.prevError=void 0,n.prototype.unsubSrc=void 0,n.prototype.hasSubscribers=function(){return this.subscriptions.length>0},n.prototype.removeSub=function(t){return this.subscriptions=E.without(t,this.subscriptions)},n.prototype.push=function(t){return t.isEnd()&&(this.ended=!0),w.inTransaction(t,this,this.pushIt,[t])},n.prototype.pushToSubscriptions=function(n){var r,e,u,i,o,s;try{for(s=this.subscriptions,e=0,u=s.length;u>e;e++)o=s[e],i=o.sink(n),(i===t.noMore||n.isEnd())&&this.removeSub(o);return!0}catch(c){throw r=c,this.pushing=!1,this.queue=[],r}},n.prototype.pushIt=function(n){if(this.pushing)return this.queue.push(n),t.more;if(n!==this.prevError){for(n.isError()&&(this.prevError=n),this.pushing=!0,this.pushToSubscriptions(n),this.pushing=!1;this.queue.length;)n=this.queue.shift(),this.push(n);return this.hasSubscribers()?t.more:(this.unsubscribeFromSource(),t.noMore)}},n.prototype.handleEvent=function(t){return this._handleEvent?this._handleEvent(t):this.push(t)},n.prototype.unsubscribeFromSource=function(){return this.unsubSrc&&this.unsubSrc(),this.unsubSrc=void 0},n.prototype.subscribe=function(t){var n;return this.ended?(t(W()),G):(n={sink:t},this.subscriptions.push(n),1===this.subscriptions.length&&(this.unsubSrc=this._subscribe(this.handleEvent)),function(t){return function(){return t.removeSub(n),t.hasSubscribers()?void 0:t.unsubscribeFromSource()}}(this))},n}(),t.Dispatcher=o,f=function(n){function r(t,n,e){return this instanceof r?(E.isFunction(t)&&(e=n,n=t,t=i.empty),r.__super__.constructor.call(this,t),this.dispatcher=new o(n,e),void tt(this)):new r(t,n,e)}return lt(r,n),r.prototype.toProperty=function(n){var r,e;return e=0===arguments.length?d:ot(function(){return n}),r=this.dispatcher,new y(new t.Desc(this,"toProperty",[n]),function(n){var u,i,o,s;return u=!1,s=G,i=t.more,o=function(){return u?void 0:e.forEach(function(r){return u=!0,i=n(new l(r)),i===t.noMore?(s(),s=G):void 0})},s=r.subscribe(function(r){return r.hasValue()?u&&r.isInitial()?t.more:(r.isInitial()||o(),u=!0,e=new m(r),n(r)):(r.isEnd()&&(i=o()),i!==t.noMore?n(r):void 0)}),o(),s})},r.prototype.toEventStream=function(){return this},r.prototype.withHandler=function(n){return new r(new t.Desc(this,"withHandler",[n]),this.dispatcher.subscribe,n)},r}(v),t.EventStream=f,t.never=function(){return new f(I(t,"never"),function(t){return t(W()),G})},t.when=function(){var n,r,e,u,i,o,s,c,a,h,l,p,d,v,y,b,m,D,S,O;if(0===arguments.length)return t.never();for(s=arguments.length,O="when: expecting arguments in the form (Observable+,function)+",D=[],d=[],r=0,v=[];s>r;){for(v[r]=arguments[r],v[r+1]=arguments[r+1],p=E.toArray(arguments[r]),n=A(arguments[r+1]),l={f:n,ixs:[]},S=!1,i=0,c=p.length;c>i;i++){for(m=p[i],e=E.indexOf(D,m),S||(S=g.isTrigger(m)),0>e&&(D.push(m),e=D.length-1),y=l.ixs,o=0,a=y.length;a>o;o++)u=y[o],u.index===e&&u.count++;l.ixs.push({index:e,count:1})}p.length>0&&d.push(l),r+=2}return D.length?(D=E.map(g.fromObservable,D),h=E.any(D,function(t){return t.flatten})&&_(E.map(function(t){return t.obs},D)),b=new f(new t.Desc(t,"when",v),function(n){var e,u,i,o,s,c,a;return a=[],i=!1,o=function(t){var n,e,u;for(u=t.ixs,n=0,e=u.length;e>n;n++)if(r=u[n],!D[r.index].hasAtLeast(r.count))return!1;return!0},u=function(t){return!t.sync||t.ended},e=function(t){var n,e,u;for(u=t.ixs,n=0,e=u.length;e>n;n++)if(r=u[n],!D[r.index].mayHave(r.count))return!0},s=function(t){return!t.source.flatten},c=function(c){return function(f){var l,p,v;return p=function(){return w.whenDoneWith(b,l)},v=function(){var e,u,i,c,f,h;if(!(a.length>0))return t.more;for(f=t.more,h=a.pop(),u=0,i=d.length;i>u;u++)if(c=d[u],o(c))return e=function(){var t,n,e,u;for(e=c.ixs,u=[],n=0,t=e.length;t>n;n++)r=e[n],u.push(D[r.index].consume());return u}(),f=n(h.e.apply(function(){var t,n;return n=function(){var n,r,u;for(u=[],r=0,n=e.length;n>r;r++)t=e[r],u.push(t.value());return u}(),c.f.apply(c,n)})),a.length&&(a=E.filter(s,a)),f===t.noMore?f:v()},l=function(){var r;return r=v(),i&&(E.all(D,u)||E.all(d,e))&&(r=t.noMore,n(W())),r===t.noMore&&f(),r},c.subscribe(function(r){var e;return r.isEnd()?(i=!0,c.markEnded(),p()):r.isError()?e=n(r):(c.push(r),c.sync&&(a.push({source:c,e:r}),h||w.hasWaiters()?p():l())),e===t.noMore&&f(),e||t.more})}},new t.CompositeUnsubscribe(function(){var t,n,r;for(r=[],t=0,n=D.length;n>t;t++)m=D[t],r.push(c(m));return r}()).unsubscribe})):t.never()},_=function(t,n){var r;return null==n&&(n=[]),r=function(t){var e;return E.contains(n,t)?!0:(e=t.internalDeps(),e.length?(n.push(t),E.any(e,r)):(n.push(t),!1))},E.any(t,r)},A=function(t){return E.isFunction(t)?t:E.always(t)},t.groupSimultaneous=function(){var r,e,u;return u=1<=arguments.length?pt.call(arguments,0):[],1===u.length&&q(u[0])&&(u=u[0]),e=function(){var t,e,i;for(i=[],t=0,e=u.length;e>t;t++)r=u[t],i.push(new n(r));return i}(),at(new t.Desc(t,"groupSimultaneous",u),t.when(e,function(){var t;return t=1<=arguments.length?pt.call(arguments,0):[]}))},b=function(n){function r(t,n,e){this.property=t,this.subscribe=dt(this.subscribe,this),r.__super__.constructor.call(this,n,e),this.current=d,this.currentValueRootId=void 0,this.propertyEnded=!1}return lt(r,n),r.prototype.push=function(t){return t.isEnd()&&(this.propertyEnded=!0),t.hasValue()&&(this.current=new m(t),this.currentValueRootId=w.currentEventId()),r.__super__.push.call(this,t)},r.prototype.maybeSubSource=function(n,r){return r===t.noMore?G:this.propertyEnded?(n(W()),G):o.prototype.subscribe.call(this,n)},r.prototype.subscribe=function(n){var r,e,u,i;return e=!1,u=t.more,this.current.isDefined&&(this.hasSubscribers()||this.propertyEnded)?(r=w.currentEventId(),i=this.currentValueRootId,!this.propertyEnded&&i&&r&&r!==i?(w.whenDoneWith(this.property,function(t){return function(){return t.currentValueRootId===i?n(C(t.current.get().value())):void 0}}(this)),this.maybeSubSource(n,u)):(w.inTransaction(void 0,this,function(){return u=n(C(this.current.get().value()))},[]),this.maybeSubSource(n,u))):this.maybeSubSource(n,u)},r}(o),y=function(n){function r(t,n,e){r.__super__.constructor.call(this,t),this.dispatcher=new b(this,n,e),tt(this)}return lt(r,n),r.prototype.changes=function(){return new f(new t.Desc(this,"changes",[]),function(t){return function(n){return t.dispatcher.subscribe(function(t){return t.isInitial()?void 0:n(t)})}}(this))},r.prototype.withHandler=function(n){return new r(new t.Desc(this,"withHandler",[n]),this.dispatcher.subscribe,n)},r.prototype.toProperty=function(){return this},r.prototype.toEventStream=function(){return new f(new t.Desc(this,"toEventStream",[]),function(t){return function(n){return t.dispatcher.subscribe(function(t){return t.isInitial()&&(t=t.toNext()),n(t)})}}(this))},r}(v),t.Property=y,t.constant=function(n){return new y(new t.Desc(t,"constant",[n]),function(t){return t(C(n)),t(W()),G})},t.fromBinder=function(n,r){return null==r&&(r=E.id),new f(new t.Desc(t,"fromBinder",[n,r]),function(e){var u,i,o,s;return s=!1,u=!1,i=function(){return s?void 0:"undefined"!=typeof o&&null!==o?(o(),s=!0):u=!0},o=n(function(){var n,u,o,s,c,f;for(n=1<=arguments.length?pt.call(arguments,0):[],f=r.apply(this,n),q(f)&&E.last(f)instanceof a||(f=[f]),c=t.more,o=0,s=f.length;s>o;o++)if(u=f[o],c=e(u=et(u)),c===t.noMore||u.isEnd())return i(),c;return c}),u&&i(),i})},t.Observable.prototype.map=function(){var n,r;return r=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],k(this,r,n,function(n){return at(new t.Desc(this,"map",[n]),this.withHandler(function(t){return this.push(t.fmap(n))}))})},S=function(t){return q(t[0])?t[0]:Array.prototype.slice.call(t)},O=function(t){return E.isFunction(t[0])?[S(Array.prototype.slice.call(t,1)),t[0]]:[S(Array.prototype.slice.call(t,0,t.length-1)),E.last(t)]},t.combineAsArray=function(){var n,r,e,u,i,o,s;for(s=S(arguments),n=r=0,e=s.length;e>r;n=++r)o=s[n],U(o)||(s[n]=t.constant(o));return s.length?(i=function(){var t,n,r;for(r=[],t=0,n=s.length;n>t;t++)u=s[t],r.push(new g(u,!0));return r}(),at(new t.Desc(t,"combineAsArray",s),t.when(i,function(){var t;return t=1<=arguments.length?pt.call(arguments,0):[]}).toProperty())):t.constant([])},t.onValues=function(){var n,r,e;return e=2<=arguments.length?pt.call(arguments,0,r=arguments.length-1):(r=0,[]),n=arguments[r++],t.combineAsArray(e).onValues(n)},t.combineWith=function(){var n,r,e;return r=O(arguments),e=r[0],n=r[1],at(new t.Desc(t,"combineWith",[n].concat(pt.call(e))),t.combineAsArray(e).map(function(t){return n.apply(null,t)}))},t.Observable.prototype.combine=function(n,r){var e;return e=rt(r),at(new t.Desc(this,"combine",[n,r]),t.combineAsArray(this,n).map(function(t){return e(t[0],t[1])}))},t.Observable.prototype.withStateMachine=function(n,r){var e;return e=n,at(new t.Desc(this,"withStateMachine",[n,r]),this.withHandler(function(n){var u,i,o,s,c,a,f;for(u=r(e,n),s=u[0],a=u[1],e=s,f=t.more,i=0,o=a.length;o>i;i++)if(c=a[i],f=this.push(c),f===t.noMore)return f;return f}))},t.Observable.prototype.skipDuplicates=function(n){return null==n&&(n=function(t,n){return t===n}),at(new t.Desc(this,"skipDuplicates",[]),this.withStateMachine(d,function(t,r){return r.hasValue()?r.isInitial()||t===d||!n(t.get(),r.value())?[new m(r.value()),[r]]:[t,[]]:[t,[r]]}))},t.Observable.prototype.awaiting=function(n){return at(new t.Desc(this,"awaiting",[n]),t.groupSimultaneous(this,n).map(function(t){var n,r;return n=t[0],r=t[1],0===r.length}).toProperty(!1).skipDuplicates())},t.Observable.prototype.not=function(){return at(new t.Desc(this,"not",[]),this.map(function(t){return!t}))},t.Property.prototype.and=function(n){return at(new t.Desc(this,"and",[n]),this.combine(n,function(t,n){return t&&n}))},t.Property.prototype.or=function(n){return at(new t.Desc(this,"or",[n]),this.combine(n,function(t,n){return t||n}))},t.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()}},t.EventStream.prototype.bufferWithTime=function(n){return at(new t.Desc(this,"bufferWithTime",[n]),this.bufferWithTimeOrCount(n,Number.MAX_VALUE))},t.EventStream.prototype.bufferWithCount=function(n){return at(new t.Desc(this,"bufferWithCount",[n]),this.bufferWithTimeOrCount(void 0,n))},t.EventStream.prototype.bufferWithTimeOrCount=function(n,r){var e;return e=function(t){return t.values.length===r?t.flush():void 0!==n?t.schedule():void 0},at(new t.Desc(this,"bufferWithTimeOrCount",[n,r]),this.buffer(n,e,e))},t.EventStream.prototype.buffer=function(n,r,e){var u,i,o;return null==r&&(r=G),null==e&&(e=G),u={scheduled:null,end:void 0,values:[],flush:function(){var n,r;if(this.scheduled&&(t.scheduler.clearTimeout(this.scheduled),this.scheduled=null),this.values.length>0){if(r=this.values,this.values=[],n=this.push(X(r)),null!=this.end)return this.push(this.end);if(n!==t.noMore)return e(this)}else if(null!=this.end)return this.push(this.end)},schedule:function(){return this.scheduled?void 0:this.scheduled=n(function(t){return function(){return t.flush()}}(this))}},o=t.more,E.isFunction(n)||(i=n,n=function(n){return t.scheduler.setTimeout(n,i)}),at(new t.Desc(this,"buffer",[]),this.withHandler(function(t){return u.push=function(t){return function(n){return t.push(n)}}(this),t.isError()?o=this.push(t):t.isEnd()?(u.end=t,u.scheduled||u.flush()):(u.values.push(t.value()),r(u)),o}))},t.Observable.prototype.filter=function(){var n,r;return r=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],k(this,r,n,function(n){return at(new t.Desc(this,"filter",[n]),this.withHandler(function(r){return r.filter(n)?this.push(r):t.more}))})},t.once=function(n){return new f(new i(t,"once",[n]),function(t){return t(et(n)),t(W()),G})},t.EventStream.prototype.concat=function(n){var r;return r=this,new f(new t.Desc(r,"concat",[n]),function(t){var e,u;return u=G,e=r.dispatcher.subscribe(function(r){return r.isEnd()?u=n.dispatcher.subscribe(t):t(r)}),function(){return e(),u()}})},t.Observable.prototype.flatMap=function(){return B(this,$(arguments))},t.Observable.prototype.flatMapFirst=function(){return B(this,$(arguments),!0)},B=function(n,r,u,i){var o,s,c;return c=[n],o=[],s=new f(new t.Desc(n,"flatMap"+(u?"First":""),[r]),function(s){var c,a,f,h,p;return f=new e,h=[],p=function(n){var e;return e=Z(r(n.value())),o.push(e),f.add(function(n,r){return e.dispatcher.subscribe(function(u){var i;return u.isEnd()?(E.remove(e,o),a(),c(r),t.noMore):(u instanceof l&&(u=u.toNext()),i=s(u),i===t.noMore&&n(),i)})})},a=function(){var t;return t=h.shift(),t?p(t):void 0},c=function(t){return t(),f.empty()?s(W()):void 0},f.add(function(r,e){return n.dispatcher.subscribe(function(n){return n.isEnd()?c(e):n.isError()?s(n):u&&f.count()>1?t.more:f.unsubscribed?t.noMore:i&&f.count()>i?h.push(n):p(n)})}),f.unsubscribe}),s.internalDeps=function(){return o.length?c.concat(o):c},s},$=function(t){return 1===t.length&&U(t[0])?E.always(t[0]):R(t)},Z=function(n){return U(n)?n:t.once(n)},t.Observable.prototype.flatMapWithConcurrencyLimit=function(){var n,r;return r=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],at(new t.Desc(this,"flatMapWithConcurrencyLimit",[r].concat(pt.call(n))),B(this,$(n),!1,r))},t.Observable.prototype.flatMapConcat=function(){return at(new t.Desc(this,"flatMapConcat",Array.prototype.slice.call(arguments,0)),this.flatMapWithConcurrencyLimit.apply(this,[1].concat(pt.call(arguments))))},t.later=function(n,r){return at(new t.Desc(t,"later",[n,r]),t.fromBinder(function(e){var u,i;return i=function(){return e([r,W()])},u=t.scheduler.setTimeout(i,n),function(){return t.scheduler.clearTimeout(u)}}))},t.Observable.prototype.bufferingThrottle=function(n){return at(new t.Desc(this,"bufferingThrottle",[n]),this.flatMapConcat(function(r){return t.once(r).concat(t.later(n).filter(!1))}))},t.Property.prototype.bufferingThrottle=function(){return t.Observable.prototype.bufferingThrottle.apply(this,arguments).toProperty()},r=function(n){function r(){return this.guardedSink=dt(this.guardedSink,this),this.subscribeAll=dt(this.subscribeAll,this),this.unsubAll=dt(this.unsubAll,this),this instanceof r?(this.sink=void 0,this.subscriptions=[],this.ended=!1,void r.__super__.constructor.call(this,new t.Desc(t,"Bus",[]),this.subscribeAll)):new r}return lt(r,n),r.prototype.unsubAll=function(){var t,n,r,e;for(r=this.subscriptions,t=0,n=r.length;n>t;t++)e=r[t],"function"==typeof e.unsub&&e.unsub();return void 0},r.prototype.subscribeAll=function(t){var n,r,e,u;if(this.ended)t(W());else for(this.sink=t,e=M(this.subscriptions),n=0,r=e.length;r>n;n++)u=e[n],this.subscribeInput(u);return this.unsubAll},r.prototype.guardedSink=function(n){return function(r){return function(e){return e.isEnd()?(r.unsubscribeInput(n),t.noMore):r.sink(e)}}(this)},r.prototype.subscribeInput=function(t){return t.unsub=t.input.dispatcher.subscribe(this.guardedSink(t.input))},r.prototype.unsubscribeInput=function(t){var n,r,e,u,i;for(u=this.subscriptions,n=r=0,e=u.length;e>r;n=++r)if(i=u[n],i.input===t)return"function"==typeof i.unsub&&i.unsub(),void this.subscriptions.splice(n,1)},r.prototype.plug=function(t){var n;if(!this.ended)return n={input:t},this.subscriptions.push(n),null!=this.sink&&this.subscribeInput(n),function(n){return function(){return n.unsubscribeInput(t)}}(this)},r.prototype.end=function(){return this.ended=!0,this.unsubAll(),"function"==typeof this.sink?this.sink(W()):void 0},r.prototype.push=function(t){return this.ended?void 0:"function"==typeof this.sink?this.sink(X(t)):void 0},r.prototype.error=function(t){return"function"==typeof this.sink?this.sink(new c(t)):void 0},r}(f),t.Bus=r,z=function(n,r){return ft(function(){var e,u,i;return u=arguments[0],e=2<=arguments.length?pt.call(arguments,1):[],i=J(r,[function(t,n){return u.apply(null,pt.call(t).concat([n]))}]),at(new t.Desc(t,n,[u].concat(pt.call(e))),t.combineAsArray(e).flatMap(i))})},t.fromCallback=z("fromCallback",function(){var n,r;return r=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],t.fromBinder(function(t){return j(r,n)(t),G},function(t){return[t,W()]})}),t.fromNodeCallback=z("fromNodeCallback",function(){var n,r;return r=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],t.fromBinder(function(t){return j(r,n)(t),G},function(t,n){return t?[new c(t),W()]:[n,W()]})}),t.combineTemplate=function(n){var r,e,u,i,o,s,c,a,f,h,l;return c=[],l=[],s=function(t){return t[t.length-1]},h=function(t,n,r){return s(t)[n]=r},r=function(t,n){return function(r,e){return h(r,t,e[n])}},o=function(t,n){return function(r){return h(r,t,n)}},a=function(t){return q(t)?[]:{}},f=function(t,n){return function(r){var e;return e=a(n),h(r,t,e),r.push(e)}},u=function(t,n){var e;return U(n)?(l.push(n),c.push(r(t,l.length-1))):n!==Object(n)||"function"==typeof n||n instanceof RegExp||n instanceof Date?c.push(o(t,n)):(e=function(t){return t.pop()},c.push(f(t,n)),i(n),c.push(e))},i=function(t){return E.each(t,u)},i(n),e=function(t){var r,e,u,i,o;for(o=a(n),r=[o],u=0,i=c.length;i>u;u++)(e=c[u])(r,t);return o},at(new t.Desc(t,"combineTemplate",[n]),t.combineAsArray(l).map(e))},D=function(n,r){var e;return e=new f(I(n,"justInitValue"),function(r){var u,i;return i=void 0,u=n.dispatcher.subscribe(function(n){return n.isEnd()||(i=n),t.noMore}),w.whenDoneWith(e,function(){return null!=i&&r(i),r(W())}),u}),e.concat(r).toProperty()},t.Observable.prototype.mapEnd=function(){var n;return n=R(arguments),at(new t.Desc(this,"mapEnd",[n]),this.withHandler(function(r){return r.isEnd()?(this.push(X(n(r))),this.push(W()),t.noMore):this.push(r)}))},t.Observable.prototype.skipErrors=function(){return at(new t.Desc(this,"skipErrors",[]),this.withHandler(function(n){return n.isError()?t.more:this.push(n)}))},t.EventStream.prototype.takeUntil=function(n){var r;return r={},at(new t.Desc(this,"takeUntil",[n]),t.groupSimultaneous(this.mapEnd(r),n.skipErrors()).withHandler(function(e){var u,i,o,s,c,a;if(e.hasValue()){if(s=e.value(),u=s[0],n=s[1],n.length)return this.push(W());for(c=t.more,i=0,o=u.length;o>i;i++)a=u[i],c=this.push(a===r?W():X(a));return c}return this.push(e)}))},t.Property.prototype.takeUntil=function(n){var r;return r=this.changes().takeUntil(n),at(new t.Desc(this,"takeUntil",[n]),D(this,r))},t.Observable.prototype.flatMapLatest=function(){var n,r;return n=$(arguments),r=this.toEventStream(),at(new t.Desc(this,"flatMapLatest",[n]),r.flatMap(function(t){return Z(n(t)).takeUntil(r)}))},t.Property.prototype.delayChanges=function(t,n){return at(t,D(this,n(this.changes())))},t.EventStream.prototype.delay=function(n){return at(new t.Desc(this,"delay",[n]),this.flatMap(function(r){return t.later(n,r)}))},t.Property.prototype.delay=function(n){return this.delayChanges(new t.Desc(this,"delay",[n]),function(t){return t.delay(n)})},t.EventStream.prototype.debounce=function(n){return at(new t.Desc(this,"debounce",[n]),this.flatMapLatest(function(r){return t.later(n,r)}))},t.Property.prototype.debounce=function(n){return this.delayChanges(new t.Desc(this,"debounce",[n]),function(t){return t.debounce(n)})},t.EventStream.prototype.debounceImmediate=function(n){ | ||
return at(new t.Desc(this,"debounceImmediate",[n]),this.flatMapFirst(function(r){return t.once(r).concat(t.later(n).filter(!1))}))},t.Observable.prototype.decode=function(n){return at(new t.Desc(this,"decode",[n]),this.combine(t.combineTemplate(n),function(t,n){return n[t]}))},t.Observable.prototype.scan=function(n,r){var e,u,i,o;return r=rt(r),e=ot(n),u=!1,o=function(n){return function(o){var s,c,a,f;return s=!1,f=G,c=t.more,a=function(){return s?void 0:e.forEach(function(n){return s=u=!0,c=o(new l(function(){return n})),c===t.noMore?(f(),f=G):void 0})},f=n.dispatcher.subscribe(function(n){var i,f;return n.hasValue()?u&&n.isInitial()?t.more:(n.isInitial()||a(),s=u=!0,f=e.getOrElse(void 0),i=r(f,n.value()),e=new m(i),o(n.apply(function(){return i}))):(n.isEnd()&&(c=a()),c!==t.noMore?o(n):void 0)}),w.whenDoneWith(i,a),f}}(this),i=new y(new t.Desc(this,"scan",[n,r]),o)},t.Observable.prototype.diff=function(n,r){return r=rt(r),at(new t.Desc(this,"diff",[n,r]),this.scan([n],function(t,n){return[n,r(t[0],n)]}).filter(function(t){return 2===t.length}).map(function(t){return t[1]}))},t.Observable.prototype.doAction=function(){var n;return n=R(arguments),at(new t.Desc(this,"doAction",[n]),this.withHandler(function(t){return t.hasValue()&&n(t.value()),this.push(t)}))},t.Observable.prototype.doError=function(){var n;return n=R(arguments),at(new t.Desc(this,"doError",[n]),this.withHandler(function(t){return t.isError()&&n(t.error),this.push(t)}))},t.Observable.prototype.doLog=function(){var n;return n=1<=arguments.length?pt.call(arguments,0):[],at(new t.Desc(this,"doLog",n),this.withHandler(function(t){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log&&console.log.apply(console,pt.call(n).concat([t.log()])),this.push(t)}))},t.Observable.prototype.endOnError=function(){var n,r;return r=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],null==r&&(r=!0),k(this,r,n,function(n){return at(new t.Desc(this,"endOnError",[]),this.withHandler(function(t){return t.isError()&&n(t.error)?(this.push(t),this.push(W())):this.push(t)}))})},v.prototype.errors=function(){return at(new t.Desc(this,"errors",[]),this.filter(function(){return!1}))},t.Observable.prototype.mapError=function(){var n;return n=R(arguments),at(new t.Desc(this,"mapError",[n]),this.withHandler(function(t){return this.push(t.isError()?X(n(t.error)):t)}))},t.Observable.prototype.flatMapError=function(n){return at(new t.Desc(this,"flatMapError",[n]),this.mapError(function(t){return new c(t)}).flatMap(function(r){return r instanceof c?n(r.error):t.once(r)}))},t.EventStream.prototype.sampledBy=function(n,r){return at(new t.Desc(this,"sampledBy",[n,r]),this.toProperty().sampledBy(n,r))},t.Property.prototype.sampledBy=function(n,r){var e,u,i,o,s;return null!=r?r=rt(r):(e=!0,r=function(t){return t.value()}),s=new g(this,!1,e),i=new g(n,!0,e),o=t.when([s,i],r),u=n instanceof y?o.toProperty():o,at(new t.Desc(this,"sampledBy",[n,r]),u)},t.Property.prototype.sample=function(n){return at(new t.Desc(this,"sample",[n]),this.sampledBy(t.interval(n,{})))},t.Observable.prototype.map=function(){var n,r;return r=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],r instanceof y?r.sampledBy(this,F):k(this,r,n,function(n){return at(new t.Desc(this,"map",[n]),this.withHandler(function(t){return this.push(t.fmap(n))}))})},t.Observable.prototype.fold=function(n,r){return at(new t.Desc(this,"fold",[n,r]),this.scan(n,r).sampledBy(this.filter(!1).mapEnd().toProperty()))},v.prototype.reduce=v.prototype.fold,T=[["addEventListener","removeEventListener"],["addListener","removeListener"],["on","off"],["bind","unbind"]],V=function(t){var n,r,e,u,i,o,s;for(r=0,u=T.length;u>r;r++)if(s=T[r],o=[t[s[0]],t[s[1]]],o[0]&&o[1])return o;for(e=0,i=T.length;i>e;e++)if(s=T[e],n=t[s[0]])return[n,function(){}];throw new c("No suitable event methods in "+t)},t.fromEventTarget=function(n,r,e){var u,i,o;return u=V(n),i=u[0],o=u[1],at(new t.Desc(t,"fromEvent",[n,r]),t.fromBinder(function(t){return i.call(n,r,t),function(){return o.call(n,r,t)}},e))},t.fromEvent=t.fromEventTarget,t.fromPoll=function(n,r){return at(new t.Desc(t,"fromPoll",[n,r]),t.fromBinder(function(r){var e;return e=t.scheduler.setInterval(r,n),function(){return t.scheduler.clearInterval(e)}},r))},ct=function(t){return[t,W()]},t.fromPromise=function(n,r,e){return null==e&&(e=ct),at(new t.Desc(t,"fromPromise",[n]),t.fromBinder(function(t){var e;return null!=(e=n.then(t,function(n){return t(new c(n))}))&&"function"==typeof e.done&&e.done(),function(){return r&&"function"==typeof n.abort?n.abort():void 0}},e))},t.Observable.prototype.groupBy=function(n,r){var e,u;return null==r&&(r=t._.id),u={},e=this,e.filter(function(t){return!u[n(t)]}).map(function(i){var o,s,c,a;return s=n(i),a=e.filter(function(t){return n(t)===s}),o=t.once(i).concat(a),c=r(o,i).withHandler(function(t){return this.push(t),t.isEnd()?delete u[s]:void 0}),u[s]=c})},t.fromArray=function(n){var r;return n.length?(r=0,new f(new t.Desc(t,"fromArray",[n]),function(e){var u,i,o,s,c;return c=!1,s=t.more,o=!1,i=!1,u=function(){var a;if(i=!0,!o){for(o=!0;i;)i=!1,s===t.noMore||c||(a=n[r++],s=e(et(a)),s!==t.noMore&&(r===n.length?e(W()):w.afterTransaction(u)));return o=!1}},u(),function(){return c=!0}})):at(new t.Desc(t,"fromArray",n),t.never())},t.EventStream.prototype.holdWhen=function(n){var r,u,i;return u=!1,r=[],i=this,new f(new t.Desc(this,"holdWhen",[n]),function(t){var o,s,c;return o=new e,c=!1,s=function(n){return"function"==typeof n&&n(),o.empty()&&c?t(W()):void 0},o.add(function(e,i){return n.subscribeInternal(function(n){var e,o,c,a,f;if(!n.hasValue())return n.isEnd()?s(i):t(n);if(u=n.value(),!u){for(a=r,r=[],c=[],e=0,o=a.length;o>e;e++)f=a[e],c.push(t(X(f)));return c}})}),o.add(function(n,e){return i.subscribeInternal(function(n){return u&&n.hasValue()?r.push(n.value()):n.isEnd()&&r.length?s(e):t(n)})}),c=!0,s(),o.unsubscribe})},t.interval=function(n,r){return null==r&&(r={}),at(new t.Desc(t,"interval",[n,r]),t.fromPoll(n,function(){return X(r)}))},t.$={},t.$.asEventStream=function(n,r,e){var u;return E.isFunction(r)&&(u=[r,void 0],e=u[0],r=u[1]),at(new t.Desc(this.selector||this,"asEventStream",[n]),t.fromBinder(function(t){return function(e){return t.on(n,r,e),function(){return t.off(n,r,e)}}}(this),e))},null!=(Y="undefined"!=typeof jQuery&&null!==jQuery?jQuery:"undefined"!=typeof Zepto&&null!==Zepto?Zepto:void 0)&&(Y.fn.asEventStream=t.$.asEventStream),t.Observable.prototype.log=function(){var t;return t=1<=arguments.length?pt.call(arguments,0):[],this.subscribe(function(n){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log?console.log.apply(console,pt.call(t).concat([n.log()])):void 0}),this},t.EventStream.prototype.merge=function(n){var r;return r=this,at(new t.Desc(r,"merge",[n]),t.mergeAll(this,n))},t.mergeAll=function(){var n;return n=S(arguments),n.length?new f(new t.Desc(t,"mergeAll",n),function(r){var e,u,i;return e=0,i=function(u){return function(i){return u.dispatcher.subscribe(function(u){var o;return u.isEnd()?(e++,e===n.length?r(W()):t.more):(o=r(u),o===t.noMore&&i(),o)})}},u=E.map(i,n),new t.CompositeUnsubscribe(u).unsubscribe}):t.never()},t.repeatedly=function(n,r){var e;return e=0,at(new t.Desc(t,"repeatedly",[n,r]),t.fromPoll(n,function(){return r[e++%r.length]}))},t.repeat=function(n){var r;return r=0,t.fromBinder(function(e){var u,i,o,s,c;return u=!1,o=t.more,c=function(){},i=function(t){return t.isEnd()?u?s():u=!0:o=e(t)},s=function(){var s;for(u=!0;u&&o!==t.noMore;)s=n(r++),u=!1,s?c=s.subscribeInternal(i):e(W());return u=!0},s(),function(){return c()}})},t.retry=function(n){var r,e,u,i,o,s,c;if(!E.isFunction(n.source))throw new h("'source' option has to be a function");return c=n.source,s=n.retries||0,o=n.maxRetries||s,r=n.delay||function(){return 0},i=n.isRetryable||function(){return!0},u=!1,e=null,at(new t.Desc(t,"retry",[n]),t.repeat(function(){var n,a,f;return u?null:(f=function(){return c().endOnError().withHandler(function(t){return t.isError()?(e=t,i(e.error)&&s>0?void 0:(u=!0,this.push(t))):(t.hasValue()&&(e=null,u=!0),this.push(t))})},e?(n={error:e.error,retriesDone:o-s},a=t.later(r(n)).filter(!1),s-=1,a.concat(t.once().flatMap(f))):f())}))},t.sequentially=function(n,r){var e;return e=0,at(new t.Desc(t,"sequentially",[n,r]),t.fromPoll(n,function(){var t;return t=r[e++],e<r.length?t:e===r.length?[t,W()]:W()}))},t.Observable.prototype.skip=function(n){return at(new t.Desc(this,"skip",[n]),this.withHandler(function(r){return r.hasValue()&&n>0?(n--,t.more):this.push(r)}))},t.Observable.prototype.take=function(n){return 0>=n?t.never():at(new t.Desc(this,"take",[n]),this.withHandler(function(r){return r.hasValue()?(n--,n>0?this.push(r):(0===n&&this.push(r),this.push(W()),t.noMore)):this.push(r)}))},t.EventStream.prototype.skipUntil=function(n){var r;return r=n.take(1).map(!0).toProperty(!1),at(new t.Desc(this,"skipUntil",[n]),this.filter(r))},t.EventStream.prototype.skipWhile=function(){var n,r,e;return r=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],e=!1,k(this,r,n,function(n){return at(new t.Desc(this,"skipWhile",[n]),this.withHandler(function(r){return!e&&r.hasValue()&&n(r.value())?t.more:(r.hasValue()&&(e=!0),this.push(r))}))})},t.Observable.prototype.slidingWindow=function(n,r){return null==r&&(r=0),at(new t.Desc(this,"slidingWindow",[n,r]),this.scan([],function(t,r){return t.concat([r]).slice(-n)}).filter(function(t){return t.length>=r}))},t.spy=function(t){return nt.push(t)},nt=[],tt=function(t){var n,r,e;if(nt.length&&!tt.running)try{for(tt.running=!0,n=0,r=nt.length;r>n;n++)(e=nt[n])(t)}finally{delete tt.running}return void 0},t.Property.prototype.startWith=function(n){return at(new t.Desc(this,"startWith",[n]),this.scan(n,function(t,n){return n}))},t.EventStream.prototype.startWith=function(n){return at(new t.Desc(this,"startWith",[n]),t.once(n).concat(this))},t.Observable.prototype.takeWhile=function(){var n,r;return r=arguments[0],n=2<=arguments.length?pt.call(arguments,1):[],k(this,r,n,function(n){return at(new t.Desc(this,"takeWhile",[n]),this.withHandler(function(r){return r.filter(n)?this.push(r):(this.push(W()),t.noMore)}))})},t["try"]=function(n){return function(r){var e;try{return t.once(n(r))}catch(u){return e=u,new t.Error(e)}}},t.update=function(){var n,r,e,u;for(r=arguments[0],u=2<=arguments.length?pt.call(arguments,1):[],e=function(t){return function(){var n;return n=1<=arguments.length?pt.call(arguments,0):[],function(r){return t.apply(null,[r].concat(n))}}},n=u.length-1;n>0;)u[n]instanceof Function||(u[n]=function(t){return function(){return t}}(u[n])),u[n]=e(u[n]),n-=2;return at(new t.Desc(t,"update",[r].concat(pt.call(u))),t.when.apply(t,u).scan(r,function(t,n){return n(t)}))},t.zipAsArray=function(){var n;return n=S(arguments),at(new t.Desc(t,"zipAsArray",n),t.zipWith(n,function(){var t;return t=1<=arguments.length?pt.call(arguments,0):[]}))},t.zipWith=function(){var n,r,e;return r=O(arguments),e=r[0],n=r[1],e=E.map(function(t){return t.toEventStream()},e),at(new t.Desc(t,"zipWith",[n].concat(pt.call(e))),t.when(e,n))},t.Observable.prototype.zip=function(n,r){return null==r&&(r=Array),at(new t.Desc(this,"zip",[n]),t.zipWith([this,n],r))},t.Observable.prototype.first=function(){return at(new t.Desc(this,"first",[]),this.take(1))},t.Observable.prototype.last=function(){var n;return at(new t.Desc(this,"last",[]),this.withHandler(function(r){return r.isEnd()?(n&&this.push(n),this.push(W()),t.noMore):void(n=r)}))},t.EventStream.prototype.throttle=function(n){return at(new t.Desc(this,"throttle",[n]),this.bufferWithTime(n).map(function(t){return t[t.length-1]}))},t.Property.prototype.throttle=function(n){return this.delayChanges(new t.Desc(this,"throttle",[n]),function(t){return t.throttle(n)})},v.prototype.firstToPromise=function(n){var r=this;if("function"!=typeof n){if("function"!=typeof Promise)throw new h("There isn't default Promise, use shim or parameter");n=Promise}return new n(function(n,e){return r.subscribe(function(r){return r.hasValue()&&n(r.value()),r.isError()&&e(r.error),t.noMore})})},v.prototype.toPromise=function(t){return this.last().firstToPromise(t)},"undefined"!=typeof define&&null!==define&&null!=define.amd?(define([],function(){return t}),"undefined"!=typeof this&&null!==this&&(this.Bacon=t)):"undefined"!=typeof module&&null!==module&&null!=module.exports?(module.exports=t,t.Bacon=t):this.Bacon=t}).call(this); |
{ | ||
"name": "baconjs", | ||
"description": "A small functional reactive programming lib for JavaScript.", | ||
"version": "0.7.74", | ||
"version": "0.7.75", | ||
"keywords": [ | ||
@@ -36,2 +36,4 @@ "bacon.js", | ||
"benchmark": "1.0.0", | ||
"bluebird": "^2", | ||
"bower-json": "^0.4", | ||
"browserify": "^9.0.3", | ||
@@ -42,2 +44,3 @@ "chai": "^2.1.0", | ||
"coffeelint": "^1.9.2", | ||
"es6-promise": "^3.0.2", | ||
"escodegen": "^1.6.1", | ||
@@ -54,2 +57,3 @@ "esprima": "^2.0.0", | ||
"jasmine-node": "^1.14.5", | ||
"jquery": "^2.1.4", | ||
"jsstana": "^0.1.5", | ||
@@ -60,6 +64,3 @@ "lodash": "^3.3.1", | ||
"sinon": "^1.12.2", | ||
"uglify-js": "^2.4.16", | ||
"bluebird": "^2", | ||
"when": "^3.6.4", | ||
"bower-json": "^0.4" | ||
"uglify-js": "^2.4.16" | ||
}, | ||
@@ -66,0 +67,0 @@ "repository": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
359126
6754
28