Comparing version 0.7.58 to 0.7.59
@@ -1,2 +0,2 @@ | ||
(function(){var t,n,r,e,u,i,o,s,c,a,l,f,h,p,d,v,y,m,b,g,E,w,S,M,O,_,A,k,I,W,P,T,x,F,V,B,C,H,D,q,L,U,N,z,j,R,Q,Z,$,X,G,J,K,Y,tt,nt,rt,et,ut,it,ot,st,ct,at={}.hasOwnProperty,lt=function(t,n){function r(){this.constructor=t}for(var e in n)at.call(n,e)&&(t[e]=n[e]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},ft=[].slice,ht=function(t,n){return function(){return t.apply(n,arguments)}};t={toString:function(){return"Bacon"}},t.version="0.7.58",f=("undefined"!=typeof global&&null!==global?global:this).Error,$=function(){},L=function(t,n){return n},V=function(t,n){return t},M=function(t){return t.slice(0)},H=function(t){return t instanceof Array},q=function(t){return t instanceof v},w={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)e=t[r],n(r,e);return void 0},toArray:function(t){return H(t)?t:[t]},contains:function(t,n){return-1!==w.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=w.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=w.id),r=0,e=t.length;e>r;r++)if(u=t[r],n(u))return!0;return!1},without:function(t,n){return w.filter(function(n){return n!==t},n)},remove:function(t,n){var r;return r=w.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 w.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 G++,null==t?"undefined":w.isFunction(t)?"function":H(t)?G>5?"[..]":"["+w.map(w.toString,t).toString()+"]":null!=(null!=t?t.toString:void 0)&&t.toString!==Object.prototype.toString?t.toString():"object"==typeof t?G>5?"{..}":(r=function(){var r;r=[];for(e in t)at.call(t,e)&&(u=function(){try{return t[e]}catch(r){return n=r}}(),r.push(w.toString(e)+":"+w.toString(u)));return r}(),"{"+r+"}"):t}finally{G--}}},G=0,t._=w,E=t.UpdateBarrier=function(){var n,r,e,u,i,o,s,c,a,l,f,h,p,d;return l=void 0,f=[],h={},r=[],e=0,n=function(t){return l?r.push(t):t()},p=function(t,n){var r;return l?(r=h[t.id],null==r?(r=h[t.id]=[n],f.push(t)):r.push(n)):n()},i=function(){for(;f.length>0;)s(0);return void 0},s=function(t){var n,r,e,u,i,s;for(u=f[t],i=u.id,s=h[i],f.splice(t,1),delete h[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),h[n.id]&&(e=w.indexOf(f,n),s(e));return void 0},a=function(t,n,u,o){var s,c;if(l)return u.apply(n,o);l=t;try{c=u.apply(n,o),i()}finally{for(l=void 0;e<r.length;)s=r[e],e++,s();e=0,r=[]}return c},u=function(){return l?l.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 f.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:w.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 l},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,this.cached=void 0}return t.prototype.deps=function(){return this.cached||(this.cached=T([this.context].concat(this.args)))},t.prototype.apply=function(t){return t.desc=this,t},t.prototype.toString=function(){return w.toString(this.context)+"."+w.toString(this.method)+"("+w.map(w.toString,this.args)+")"},t}(),k=function(){var t,n,r;return n=arguments[0],r=arguments[1],t=3<=arguments.length?ft.call(arguments,2):[],(n||r)instanceof i?n||r:new i(n,r,t)},st=function(){var t,n,r;return t=2<=arguments.length?ft.call(arguments,0,n=arguments.length-1):(n=0,[]),r=arguments[n++],k.apply(null,t).apply(r)},T=function(t){return H(t)?w.flatMap(T,t):q(t)?[t]:t instanceof g?[t.obs]:[]},ct=function(t){return function(){var n,r,e,u;return e=arguments[0],n=2<=arguments.length?ft.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(ft.call(n)))}},z=function(t){return t=Array.prototype.slice.call(t),j.apply(null,t)},X=function(t,n){return function(){var r;return r=1<=arguments.length?ft.call(arguments,0):[],t.apply(null,n.concat(r))}},it=function(t){return function(n){return function(r){var e;return null==r?void 0:(e=r[n],w.isFunction(e)?e.apply(r,t):e)}}},rt=function(t,n){var r,e;return e=t.slice(1).split("."),r=w.map(it(n),e),function(n){var e,u;for(e=0,u=r.length;u>e;e++)t=r[e],n=t(n);return n}},D=function(t){return"string"==typeof t&&t.length>1&&"."===t.charAt(0)},j=ct(function(){var t,n;return n=arguments[0],t=2<=arguments.length?ft.call(arguments,1):[],w.isFunction(n)?t.length?X(n,t):n:D(n)?rt(n,t):w.always(n)}),N=function(t,n){return j.apply(null,[t].concat(ft.call(n)))},A=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=N(n,r),e.call(t,n))},tt=function(t){var n;if(w.isFunction(t))return t;if(D(t))return n=et(t),function(t,r){return t[n](r)};throw new f("not a function or a field key: "+t)},et=function(t){return t.slice(1)},b=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()}},ut=function(t){return t instanceof b||t===d?t:new b(t)},t.noMore=["<no-more>"],t.more=["<more>"],W=0,a=function(){function t(){this.id=++W}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){n.__super__.constructor.call(this),!r&&w.isFunction(t)||t instanceof n?(this.valueF=t,this.valueInternal=void 0):(this.valueF=void 0,this.valueInternal=t)}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 w.toString(this.value())},n.prototype.log=function(){return this.value()},n}(a),h=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}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 n.__super__.constructor.apply(this,arguments)}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){this.error=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> "+w.toString(this.error)},n}(a),t.Event=a,t.Initial=h,t.Next=p,t.End=s,t.Error=c,C=function(t){return new h(t,!0)},Z=function(t){return new p(t,!0)},I=function(){return new s},nt=function(t){return t instanceof a?t:Z(t)},B=0,K=function(){},v=function(){function t(t){this.id=++B,st(t,this),this.initialDesc=this.desc}return t.prototype.subscribe=function(t){return E.wrappedSubscribe(this,t)},t.prototype.subscribeInternal=function(t){return this.dispatcher.subscribe(t)},t.prototype.onValue=function(){var t;return t=z(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=z(arguments),this.subscribe(function(n){return n.isError()?t(n.error):void 0})},t.prototype.onEnd=function(){var t;return t=z(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 k.apply(null,arguments).apply(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=ht(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=$,this.starting.push(t),e=function(e){return function(){return e.unsubscribed?void 0:(n=!0,e.remove(r),w.remove(t,e.starting))}}(this),r=t(this.unsubscribe,e),this.unsubscribed||n?r():this.subscriptions.push(r),w.remove(t,this.starting),r},t.prototype.remove=function(t){return this.unsubscribed?void 0:void 0!==w.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=ht(this.subscribe,this),this.handleEvent=ht(this.handleEvent,this),this.subscriptions=[],this.queue=[],this.pushing=!1,this.ended=!1,this.prevError=void 0,this.unsubSrc=void 0}return n.prototype.hasSubscribers=function(){return this.subscriptions.length>0},n.prototype.removeSub=function(t){return this.subscriptions=w.without(t,this.subscriptions)},n.prototype.push=function(t){return t.isEnd()&&(this.ended=!0),E.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(I()),$):(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}(),l=function(n){function r(t,n,e){w.isFunction(t)&&(e=n,n=t,t=[]),r.__super__.constructor.call(this,t),this.dispatcher=new o(n,e),K(this)}return lt(r,n),r.prototype.toProperty=function(n){var r,e;return e=0===arguments.length?d:ut(function(){return n}),r=this.dispatcher,new y(k(this,"toProperty",n),function(n){var u,i,o,s;return u=!1,s=$,i=t.more,o=function(){return u?void 0:e.forEach(function(r){return u=!0,i=n(new h(r)),i===t.noMore?(s(),s=$):void 0})},s=r.subscribe(function(r){return r.hasValue()?u&&r.isInitial()?t.more:(r.isInitial()||o(),u=!0,e=new b(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(t){return new r(k(this,"withHandler",t),this.dispatcher.subscribe,t)},r}(v),t.EventStream=l,t.never=function(){return new l(k(t,"never"),function(t){return t(I()),$})},t.when=function(){var n,r,e,u,i,o,s,c,a,f,h,p,d,v,y,m,b,S,M,A;if(0===arguments.length)return t.never();for(s=arguments.length,A="when: expecting arguments in the form (Observable+,function)+",S=[],d=[],r=0,v=[];s>r;){for(v[r]=arguments[r],v[r+1]=arguments[r+1],p=w.toArray(arguments[r]),n=O(arguments[r+1]),h={f:n,ixs:[]},M=!1,i=0,c=p.length;c>i;i++){for(b=p[i],e=w.indexOf(S,b),M||(M=g.isTrigger(b)),0>e&&(S.push(b),e=S.length-1),y=h.ixs,o=0,a=y.length;a>o;o++)u=y[o],u.index===e&&u.count++;h.ixs.push({index:e,count:1})}p.length>0&&d.push(h),r+=2}return S.length?(S=w.map(g.fromObservable,S),f=w.any(S,function(t){return t.flatten})&&_(w.map(function(t){return t.obs},S)),m=new l(k.apply(null,[t,"when"].concat(ft.call(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],!S[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],!S[r.index].mayHave(r.count))return!0},s=function(t){return!t.source.flatten},c=function(c){return function(l){var h,p,v;return p=function(){return E.whenDoneWith(m,h)},v=function(){var e,u,i,c,l,f;if(!(a.length>0))return t.more;for(l=t.more,f=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(S[r.index].consume());return u}(),l=n(f.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=w.filter(s,a)),l===t.noMore?l:v()},h=function(){var r;return r=v(),i&&(i=!1,(w.all(S,u)||w.all(d,e))&&(r=t.noMore,n(I()))),r===t.noMore&&l(),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}),f||E.hasWaiters()?p():h())),e===t.noMore&&l(),e||t.more})}},new t.CompositeUnsubscribe(function(){var t,n,r;for(r=[],t=0,n=S.length;n>t;t++)b=S[t],r.push(c(b));return r}()).unsubscribe})):t.never()},_=function(t,n){var r;return null==n&&(n=[]),r=function(t){var e;return w.contains(n,t)?!0:(e=t.internalDeps(),e.length?(n.push(t),w.any(e,r)):(n.push(t),!1))},w.any(t,r)},O=function(t){return w.isFunction(t)?t:w.always(t)},t.groupSimultaneous=function(){var r,e,u;return u=1<=arguments.length?ft.call(arguments,0):[],1===u.length&&H(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}(),st.apply(null,[t,"groupSimultaneous"].concat(ft.call(u),[t.when(e,function(){var t;return t=1<=arguments.length?ft.call(arguments,0):[]})]))},m=function(n){function r(t,n,e){this.property=t,this.subscribe=ht(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 b(t),this.currentValueRootId=E.currentEventId()),r.__super__.push.call(this,t)},r.prototype.maybeSubSource=function(n,r){return r===t.noMore?$:this.propertyEnded?(n(I()),$):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=E.currentEventId(),i=this.currentValueRootId,!this.propertyEnded&&i&&r&&r!==i?(E.whenDoneWith(this.property,function(t){return function(){return t.currentValueRootId===i?n(C(t.current.get().value())):void 0}}(this)),this.maybeSubSource(n,u)):(E.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(t){function n(t,r,e){w.isFunction(t)&&(e=r,r=t,t=[]),n.__super__.constructor.call(this,t),this.dispatcher=new m(this,r,e),K(this)}return lt(n,t),n.prototype.changes=function(){return new l(k(this,"changes"),function(t){return function(n){return t.dispatcher.subscribe(function(t){return t.isInitial()?void 0:n(t)})}}(this))},n.prototype.withHandler=function(t){return new n(k(this,"withHandler",t),this.dispatcher.subscribe,t)},n.prototype.toProperty=function(){return this},n.prototype.toEventStream=function(){return new l(k(this,"toEventStream"),function(t){return function(n){return t.dispatcher.subscribe(function(t){return t.isInitial()&&(t=t.toNext()),n(t)})}}(this))},n}(v),t.Property=y,t.constant=function(n){return new y(k(t,"constant",n),function(t){return t(C(n)),t(I()),$})},t.fromBinder=function(n,r){return null==r&&(r=w.id),new l(k(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,l;for(n=1<=arguments.length?ft.call(arguments,0):[],l=r.apply(this,n),H(l)&&w.last(l)instanceof a||(l=[l]),c=t.more,o=0,s=l.length;s>o;o++)if(u=l[o],c=e(u=nt(u)),c===t.noMore||u.isEnd())return i(),c;return c}),u&&i(),i})},P=[["addEventListener","removeEventListener"],["addListener","removeListener"],["on","off"],["bind","unbind"]],x=function(t){var n,r,e,u;for(n=0,r=P.length;r>n;n++)if(u=P[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=x(n),i=u[0],o=u[1],st(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 t,n;return n=arguments[0],t=2<=arguments.length?ft.call(arguments,1):[],A(this,n,t,function(t){return st(this,"map",t,this.withHandler(function(n){return this.push(n.fmap(t))}))})},t.combineAsArray=function(){var n,r,e,u,i,o,s;for(s=1<=arguments.length?ft.call(arguments,0):[],1===s.length&&H(s[0])&&(s=s[0]),n=r=0,e=s.length;e>r;n=++r)o=s[n],q(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}(),st.apply(null,[t,"combineAsArray"].concat(ft.call(s),[t.when(i,function(){var t;return t=1<=arguments.length?ft.call(arguments,0):[]}).toProperty()]))):t.constant([])},t.onValues=function(){var n,r,e;return e=2<=arguments.length?ft.call(arguments,0,r=arguments.length-1):(r=0,[]),n=arguments[r++],t.combineAsArray(e).onValues(n)},t.combineWith=function(){var n,r;return n=arguments[0],r=2<=arguments.length?ft.call(arguments,1):[],st.apply(null,[t,"combineWith",n].concat(ft.call(r),[t.combineAsArray(r).map(function(t){return n.apply(null,t)})]))},t.combineTemplate=function(n){var r,e,u,i,o,s,c,a,l,f;return c=[],f=[],s=function(t){return t[t.length-1]},l=function(t,n,r){return s(t)[n]=r},r=function(t,n){return function(r,e){return l(r,t,e[n])}},o=function(t,n){return function(r){return l(r,t,n)}},a=function(t){return H(t)?[]:{}},u=function(t,n){var e,u;return q(n)?(f.push(n),c.push(r(t,f.length-1))):n!==Object(n)||"function"==typeof n||n instanceof RegExp||n instanceof Date?c.push(o(t,n)):(u=function(t){return function(r){var e;return e=a(n),l(r,t,e),r.push(e)}},e=function(t){return t.pop()},c.push(u(t)),i(n),c.push(e))},i=function(t){return w.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},st(t,"combineTemplate",n,t.combineAsArray(f).map(e))},t.Observable.prototype.combine=function(n,r){var e;return e=tt(r),st(this,"combine",n,r,t.combineAsArray(this,n).map(function(t){return e(t[0],t[1])}))},t.Observable.prototype.decode=function(n){return st(this,"decode",n,this.combine(t.combineTemplate(n),function(t,n){return n[t]}))},t.Observable.prototype.withStateMachine=function(n,r){var e;return e=n,st(this,"withStateMachine",n,r,this.withHandler(function(n){var u,i,o,s,c,a,l;for(u=r(e,n),s=u[0],a=u[1],e=s,l=t.more,i=0,o=a.length;o>i;i++)if(c=a[i],l=this.push(c),l===t.noMore)return l;return l}))},t.Observable.prototype.skipDuplicates=function(t){return null==t&&(t=function(t,n){return t===n}),st(this,"skipDuplicates",this.withStateMachine(d,function(n,r){return r.hasValue()?r.isInitial()||n===d||!t(n.get(),r.value())?[new b(r.value()),[r]]:[n,[]]:[n,[r]]}))},t.Observable.prototype.awaiting=function(n){return st(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 st(this,"not",this.map(function(t){return!t}))},t.Property.prototype.and=function(t){return st(this,"and",t,this.combine(t,function(t,n){return t&&n}))},t.Property.prototype.or=function(t){return st(this,"or",t,this.combine(t,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(t){return st(this,"bufferWithTime",t,this.bufferWithTimeOrCount(t,Number.MAX_VALUE))},t.EventStream.prototype.bufferWithCount=function(t){return st(this,"bufferWithCount",t,this.bufferWithTimeOrCount(void 0,t))},t.EventStream.prototype.bufferWithTimeOrCount=function(t,n){var r;return r=function(r){return r.values.length===n?r.flush():void 0!==t?r.schedule():void 0},st(this,"bufferWithTimeOrCount",t,n,this.buffer(t,r,r))},t.EventStream.prototype.buffer=function(n,r,e){var u,i,o;return null==r&&(r=$),null==e&&(e=$),u={scheduled:null,end:void 0,values:[],flush:function(){var n;if(this.scheduled&&(t.scheduler.clearTimeout(this.scheduled),this.scheduled=null),this.values.length>0){if(n=this.push(Z(this.values)),this.values=[],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,w.isFunction(n)||(i=n,n=function(n){return t.scheduler.setTimeout(n,i)}),st(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?ft.call(arguments,1):[],A(this,r,n,function(n){return st(this,"filter",n,this.withHandler(function(r){return r.filter(n)?this.push(r):t.more}))})},t.once=function(n){return new l(k(t,"once",n),function(t){return t(nt(n)),t(I()),$})},t.EventStream.prototype.concat=function(t){var n;return n=this,new l(k(n,"concat",t),function(r){var e,u;return u=$,e=n.dispatcher.subscribe(function(n){return n.isEnd()?u=t.dispatcher.subscribe(r):r(n)}),function(){return e(),u()}})},t.Observable.prototype.flatMap=function(){return F(this,Q(arguments))},t.Observable.prototype.flatMapFirst=function(){return F(this,Q(arguments),!0)},F=function(n,r,u,i){var o,s,c;return c=[n],o=[],s=new l(k(n,"flatMap"+(u?"First":""),r),function(s){var c,a,l,f,p;return l=new e,f=[],p=function(n){var e;return e=R(r(n.value())),o.push(e),l.add(function(n,r){return e.dispatcher.subscribe(function(u){var i;return u.isEnd()?(w.remove(e,o),a(),c(r),t.noMore):(u instanceof h&&(u=u.toNext()),i=s(u),i===t.noMore&&n(),i)})})},a=function(){var t;return t=f.shift(),t?p(t):void 0},c=function(t){return t(),l.empty()?s(I()):void 0},l.add(function(r,e){return n.dispatcher.subscribe(function(n){return n.isEnd()?c(e):n.isError()?s(n):u&&l.count()>1?t.more:l.unsubscribed?t.noMore:i&&l.count()>i?f.push(n):p(n)})}),l.unsubscribe}),s.internalDeps=function(){return o.length?c.concat(o):c},s},Q=function(t){return 1===t.length&&q(t[0])?w.always(t[0]):z(t)},R=function(n){return q(n)?n:t.once(n)},t.Observable.prototype.flatMapWithConcurrencyLimit=function(){var t,n;return n=arguments[0],t=2<=arguments.length?ft.call(arguments,1):[],st.apply(null,[this,"flatMapWithConcurrencyLimit",n].concat(ft.call(t),[F(this,Q(t),!1,n)]))},t.Observable.prototype.flatMapConcat=function(){return st.apply(null,[this,"flatMapConcat"].concat(ft.call(arguments),[this.flatMapWithConcurrencyLimit.apply(this,[1].concat(ft.call(arguments)))]))},t.later=function(n,r){return st(t,"later",n,r,t.fromBinder(function(e){var u,i;return i=function(){return e([r,I()])},u=t.scheduler.setTimeout(i,n),function(){return t.scheduler.clearTimeout(u)}}))},t.Observable.prototype.bufferingThrottle=function(n){return st(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(){this.guardedSink=ht(this.guardedSink,this),this.subscribeAll=ht(this.subscribeAll,this),this.unsubAll=ht(this.unsubAll,this),this.sink=void 0,this.subscriptions=[],this.ended=!1,r.__super__.constructor.call(this,k(t,"Bus"),this.subscribeAll)}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(I());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(I()):void 0},r.prototype.push=function(t){return this.ended?void 0:"function"==typeof this.sink?this.sink(Z(t)):void 0},r.prototype.error=function(t){return"function"==typeof this.sink?this.sink(new c(t)):void 0},r}(l),t.Bus=r,U=function(n,r){return ct(function(){var e,u,i;return u=arguments[0],e=2<=arguments.length?ft.call(arguments,1):[],i=X(r,[function(t,n){return u.apply(null,ft.call(t).concat([n]))}]),st.apply(null,[t,n,u].concat(ft.call(e),[t.combineAsArray(e).flatMap(i)]))})},t.fromCallback=U("fromCallback",function(){var n,r;return r=arguments[0],n=2<=arguments.length?ft.call(arguments,1):[],t.fromBinder(function(t){return N(r,n)(t),$},function(t){return[t,I()]})}),t.fromNodeCallback=U("fromNodeCallback",function(){var n,r;return r=arguments[0],n=2<=arguments.length?ft.call(arguments,1):[],t.fromBinder(function(t){return N(r,n)(t),$},function(t,n){return t?[new c(t),I()]:[n,I()]})}),S=function(n,r){var e;return e=new l(k(n,"justInitValue"),function(r){var u,i;return i=void 0,u=n.dispatcher.subscribe(function(n){return n.isEnd()||(i=n),t.noMore}),E.whenDoneWith(e,function(){return null!=i&&r(i),r(I())}),u}),e.concat(r).toProperty()},t.Observable.prototype.mapEnd=function(){var n;return n=z(arguments),st(this,"mapEnd",n,this.withHandler(function(r){return r.isEnd()?(this.push(Z(n(r))),this.push(I()),t.noMore):this.push(r)}))},t.Observable.prototype.skipErrors=function(){return st(this,"skipErrors",this.withHandler(function(n){return n.isError()?t.more:this.push(n)}))},t.EventStream.prototype.takeUntil=function(n){var r;return r={},st(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(I());for(c=t.more,i=0,o=u.length;o>i;i++)a=u[i],c=this.push(a===r?I():Z(a));return c}return this.push(e)}))},t.Property.prototype.takeUntil=function(t){var n;return n=this.changes().takeUntil(t),st(this,"takeUntil",t,S(this,n))},t.Observable.prototype.flatMapLatest=function(){var t,n;return t=Q(arguments),n=this.toEventStream(),st(this,"flatMapLatest",t,n.flatMap(function(r){return R(t(r)).takeUntil(n)}))},t.Property.prototype.delayChanges=function(){var t,n,r;return t=2<=arguments.length?ft.call(arguments,0,r=arguments.length-1):(r=0,[]),n=arguments[r++],st.apply(null,[this].concat(ft.call(t),[S(this,n(this.changes()))]))},t.EventStream.prototype.delay=function(n){return st(this,"delay",n,this.flatMap(function(r){return t.later(n,r)}))},t.Property.prototype.delay=function(t){return this.delayChanges("delay",t,function(n){return n.delay(t)})},t.EventStream.prototype.debounce=function(n){return st(this,"debounce",n,this.flatMapLatest(function(r){return t.later(n,r)}))},t.Property.prototype.debounce=function(t){ | ||
return this.delayChanges("debounce",t,function(n){return n.debounce(t)})},t.EventStream.prototype.debounceImmediate=function(n){return st(this,"debounceImmediate",n,this.flatMapFirst(function(r){return t.once(r).concat(t.later(n).filter(!1))}))},t.Observable.prototype.scan=function(n,r){var e,u,i;return r=tt(r),e=ut(n),i=function(n){return function(i){var o,s,c,a;return o=!1,a=$,s=t.more,c=function(){return o?void 0:e.forEach(function(n){return o=!0,s=i(new h(function(){return n})),s===t.noMore?(a(),a=$):void 0})},a=n.dispatcher.subscribe(function(n){var u,a;return n.hasValue()?o&&n.isInitial()?t.more:(n.isInitial()||c(),o=!0,a=e.getOrElse(void 0),u=r(a,n.value()),e=new b(u),i(n.apply(function(){return u}))):(n.isEnd()&&(s=c()),s!==t.noMore?i(n):void 0)}),E.whenDoneWith(u,c),a}}(this),u=new y(k(this,"scan",n,r),i)},t.Observable.prototype.diff=function(t,n){return n=tt(n),st(this,"diff",t,n,this.scan([t],function(t,r){return[r,n(t[0],r)]}).filter(function(t){return 2===t.length}).map(function(t){return t[1]}))},t.Observable.prototype.doAction=function(){var t;return t=z(arguments),st(this,"doAction",t,this.withHandler(function(n){return n.hasValue()&&t(n.value()),this.push(n)}))},t.Observable.prototype.endOnError=function(){var t,n;return n=arguments[0],t=2<=arguments.length?ft.call(arguments,1):[],null==n&&(n=!0),A(this,n,t,function(t){return st(this,"endOnError",this.withHandler(function(n){return n.isError()&&t(n.error)?(this.push(n),this.push(I())):this.push(n)}))})},v.prototype.errors=function(){return st(this,"errors",this.filter(function(){return!1}))},ot=function(t){return[t,I()]},t.fromPromise=function(n,r){return st(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}},ot))},t.Observable.prototype.mapError=function(){var t;return t=z(arguments),st(this,"mapError",t,this.withHandler(function(n){return this.push(n.isError()?Z(t(n.error)):n)}))},t.Observable.prototype.flatMapError=function(n){return st(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(t,n){return st(this,"sampledBy",t,n,this.toProperty().sampledBy(t,n))},t.Property.prototype.sampledBy=function(n,r){var e,u,i,o,s;return null!=r?r=tt(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,st(this,"sampledBy",n,r,u)},t.Property.prototype.sample=function(n){return st(this,"sample",n,this.sampledBy(t.interval(n,{})))},t.Observable.prototype.map=function(){var t,n;return n=arguments[0],t=2<=arguments.length?ft.call(arguments,1):[],n instanceof y?n.sampledBy(this,V):A(this,n,t,function(t){return st(this,"map",t,this.withHandler(function(n){return this.push(n.fmap(t))}))})},t.Observable.prototype.fold=function(t,n){return st(this,"fold",t,n,this.scan(t,n).sampledBy(this.filter(!1).mapEnd().toProperty()))},v.prototype.reduce=v.prototype.fold,t.fromPoll=function(n,r){return st(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.EventStream.prototype.merge=function(n){var r;return r=this,st(r,"merge",n,t.mergeAll(this,n))},t.mergeAll=function(){var n;return n=1<=arguments.length?ft.call(arguments,0):[],H(n[0])&&(n=n[0]),n.length?new l(k.apply(null,[t,"mergeAll"].concat(ft.call(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(I()):t.more):(o=r(u),o===t.noMore&&i(),o)})}},u=w.map(i,n),new t.CompositeUnsubscribe(u).unsubscribe}):t.never()},t.Observable.prototype.take=function(n){return 0>=n?t.never():st(this,"take",n,this.withHandler(function(r){return r.hasValue()?(n--,n>0?this.push(r):(0===n&&this.push(r),this.push(I()),t.noMore)):this.push(r)}))},t.fromArray=function(n){var r;return n.length?(r=0,new l(k(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(nt(a)),s!==t.noMore&&(r===n.length?e(I()):E.afterTransaction(u)));return o=!1}},u(),function(){return c=!0}})):st(t,"fromArray",n,t.never())},t.EventStream.prototype.holdWhen=function(n){var r,e,u;return u=n.startWith(!1),e=u.filter(function(t){return!t}),r=u.filter(w.id),st(this,"holdWhen",n,this.filter(!1).merge(u.flatMapConcat(function(n){return function(u){return u?n.scan([],function(t,n){return t.concat([n])}).sampledBy(e).take(1).flatMap(t.fromArray):n.takeUntil(r)}}(this))))},t.interval=function(n,r){return null==r&&(r={}),st(t,"interval",n,r,t.fromPoll(n,function(){return Z(r)}))},t.$={},t.$.asEventStream=function(n,r,e){var u;return w.isFunction(r)&&(u=[r,void 0],e=u[0],r=u[1]),st(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!=(J="undefined"!=typeof jQuery&&null!==jQuery?jQuery:"undefined"!=typeof Zepto&&null!==Zepto?Zepto:void 0)&&(J.fn.asEventStream=t.$.asEventStream),t.Observable.prototype.log=function(){var t;return t=1<=arguments.length?ft.call(arguments,0):[],this.subscribe(function(n){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log?console.log.apply(console,ft.call(t).concat([n.log()])):void 0}),this},t.repeatedly=function(n,r){var e;return e=0,st(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(I());return u=!0},s(),function(){return c()}})},t.retry=function(n){var r,e,u,i,o,s,c;if(!w.isFunction(n.source))throw new f("'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,st(t,"retry",n,t.repeat(function(){var n,a,l;return u?null:(l=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(l))):l())}))},t.sequentially=function(n,r){var e;return e=0,st(t,"sequentially",n,r,t.fromPoll(n,function(){var t;return t=r[e++],e<r.length?t:e===r.length?[t,I()]:I()}))},t.Observable.prototype.skip=function(n){return st(this,"skip",n,this.withHandler(function(r){return r.hasValue()&&n>0?(n--,t.more):this.push(r)}))},t.EventStream.prototype.skipUntil=function(t){var n;return n=t.take(1).map(!0).toProperty(!1),st(this,"skipUntil",t,this.filter(n))},t.EventStream.prototype.skipWhile=function(){var n,r,e;return r=arguments[0],n=2<=arguments.length?ft.call(arguments,1):[],e=!1,A(this,r,n,function(n){return st(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(t,n){return null==n&&(n=0),st(this,"slidingWindow",t,n,this.scan([],function(n,r){return n.concat([r]).slice(-t)}).filter(function(t){return t.length>=n}))},t.spy=function(t){return Y.push(t)},Y=[],K=function(t){var n,r,e;if(Y.length&&!K.running)try{for(K.running=!0,n=0,r=Y.length;r>n;n++)(e=Y[n])(t)}finally{delete K.running}return void 0},t.Property.prototype.startWith=function(t){return st(this,"startWith",t,this.scan(t,function(t,n){return n}))},t.EventStream.prototype.startWith=function(n){return st(this,"startWith",n,t.once(n).concat(this))},t.Observable.prototype.takeWhile=function(){var n,r;return r=arguments[0],n=2<=arguments.length?ft.call(arguments,1):[],A(this,r,n,function(n){return st(this,"takeWhile",n,this.withHandler(function(r){return r.filter(n)?this.push(r):(this.push(I()),t.noMore)}))})},t.update=function(){var n,r,e,u;for(r=arguments[0],u=2<=arguments.length?ft.call(arguments,1):[],e=function(t){return function(){var n;return n=1<=arguments.length?ft.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 st.apply(null,[t,"update",r].concat(ft.call(u),[t.when.apply(t,u).scan(r,function(t,n){return n(t)})]))},t.zipAsArray=function(){var n;return n=1<=arguments.length?ft.call(arguments,0):[],H(n[0])&&(n=n[0]),st.apply(null,[t,"zipAsArray"].concat(ft.call(n),[t.zipWith(n,function(){var t;return t=1<=arguments.length?ft.call(arguments,0):[]})]))},t.zipWith=function(){var n,r,e;return n=arguments[0],e=2<=arguments.length?ft.call(arguments,1):[],w.isFunction(n)||(r=[n,e[0]],e=r[0],n=r[1]),e=w.map(function(t){return t.toEventStream()},e),st.apply(null,[t,"zipWith",n].concat(ft.call(e),[t.when(e,n)]))},t.Observable.prototype.zip=function(n,r){return null==r&&(r=Array),st(this,"zip",n,t.zipWith([this,n],r))},t.Observable.prototype.first=function(){return st(this,"first",this.take(1))},t.Observable.prototype.last=function(){var n;return st(this,"last",this.withHandler(function(r){return r.isEnd()?(n&&this.push(n),this.push(I()),t.noMore):void(n=r)}))},t.EventStream.prototype.throttle=function(t){return st(this,"throttle",t,this.bufferWithTime(t).map(function(t){return t[t.length-1]}))},t.Property.prototype.throttle=function(t){return this.delayChanges("throttle",t,function(n){return n.throttle(t)})},v.prototype.firstToPromise=function(n){var r=this;if("function"!=typeof n){if("function"!=typeof Promise)throw new f("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}),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,l,f,h,p,d,v,y,m,b,g,E,w,S,M,O,_,A,k,I,W,P,T,x,F,V,B,H,C,D,q,L,U,N,z,j,R,Q,Z,$,X,G,J,K,Y,tt,nt,rt,et,ut,it,ot,st,ct,at={}.hasOwnProperty,lt=function(t,n){function r(){this.constructor=t}for(var e in n)at.call(n,e)&&(t[e]=n[e]);return r.prototype=n.prototype,t.prototype=new r,t.__super__=n.prototype,t},ft=[].slice,ht=function(t,n){return function(){return t.apply(n,arguments)}};t={toString:function(){return"Bacon"}},t.version="0.7.59",f=("undefined"!=typeof global&&null!==global?global:this).Error,$=function(){},L=function(t,n){return n},V=function(t,n){return t},M=function(t){return t.slice(0)},C=function(t){return t instanceof Array},q=function(t){return t instanceof v},w={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)e=t[r],n(r,e);return void 0},toArray:function(t){return C(t)?t:[t]},contains:function(t,n){return-1!==w.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=w.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=w.id),r=0,e=t.length;e>r;r++)if(u=t[r],n(u))return!0;return!1},without:function(t,n){return w.filter(function(n){return n!==t},n)},remove:function(t,n){var r;return r=w.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 w.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 G++,null==t?"undefined":w.isFunction(t)?"function":C(t)?G>5?"[..]":"["+w.map(w.toString,t).toString()+"]":null!=(null!=t?t.toString:void 0)&&t.toString!==Object.prototype.toString?t.toString():"object"==typeof t?G>5?"{..}":(r=function(){var r;r=[];for(e in t)at.call(t,e)&&(u=function(){try{return t[e]}catch(r){return n=r}}(),r.push(w.toString(e)+":"+w.toString(u)));return r}(),"{"+r+"}"):t}finally{G--}}},G=0,t._=w,E=t.UpdateBarrier=function(){var n,r,e,u,i,o,s,c,a,l,f,h,p,d;return l=void 0,f=[],h={},r=[],e=0,n=function(t){return l?r.push(t):t()},p=function(t,n){var r;return l?(r=h[t.id],null==r?(r=h[t.id]=[n],f.push(t)):r.push(n)):n()},i=function(){for(;f.length>0;)s(0);return void 0},s=function(t){var n,r,e,u,i,s;for(u=f[t],i=u.id,s=h[i],f.splice(t,1),delete h[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),h[n.id]&&(e=w.indexOf(f,n),s(e));return void 0},a=function(t,n,u,o){var s,c;if(l)return u.apply(n,o);l=t;try{c=u.apply(n,o),i()}finally{for(l=void 0;e<r.length;)s=r[e],e++,s();e=0,r=[]}return c},u=function(){return l?l.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 f.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:w.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 l},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,this.cached=void 0}return t.prototype.deps=function(){return this.cached||(this.cached=T([this.context].concat(this.args)))},t.prototype.apply=function(t){return t.desc=this,t},t.prototype.toString=function(){return w.toString(this.context)+"."+w.toString(this.method)+"("+w.map(w.toString,this.args)+")"},t}(),k=function(){var t,n,r;return n=arguments[0],r=arguments[1],t=3<=arguments.length?ft.call(arguments,2):[],(n||r)instanceof i?n||r:new i(n,r,t)},st=function(){var t,n,r;return t=2<=arguments.length?ft.call(arguments,0,n=arguments.length-1):(n=0,[]),r=arguments[n++],k.apply(null,t).apply(r)},T=function(t){return C(t)?w.flatMap(T,t):q(t)?[t]:t instanceof g?[t.obs]:[]},ct=function(t){return function(){var n,r,e,u;return e=arguments[0],n=2<=arguments.length?ft.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(ft.call(n)))}},z=function(t){return t=Array.prototype.slice.call(t),j.apply(null,t)},X=function(t,n){return function(){var r;return r=1<=arguments.length?ft.call(arguments,0):[],t.apply(null,n.concat(r))}},it=function(t){return function(n){return function(r){var e;return null==r?void 0:(e=r[n],w.isFunction(e)?e.apply(r,t):e)}}},rt=function(t,n){var r,e;return e=t.slice(1).split("."),r=w.map(it(n),e),function(n){var e,u;for(e=0,u=r.length;u>e;e++)t=r[e],n=t(n);return n}},D=function(t){return"string"==typeof t&&t.length>1&&"."===t.charAt(0)},j=ct(function(){var t,n;return n=arguments[0],t=2<=arguments.length?ft.call(arguments,1):[],w.isFunction(n)?t.length?X(n,t):n:D(n)?rt(n,t):w.always(n)}),N=function(t,n){return j.apply(null,[t].concat(ft.call(n)))},A=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=N(n,r),e.call(t,n))},tt=function(t){var n;if(w.isFunction(t))return t;if(D(t))return n=et(t),function(t,r){return t[n](r)};throw new f("not a function or a field key: "+t)},et=function(t){return t.slice(1)},b=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()}},ut=function(t){return t instanceof b||t===d?t:new b(t)},t.noMore=["<no-more>"],t.more=["<more>"],W=0,a=function(){function t(){this.id=++W}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){n.__super__.constructor.call(this),!r&&w.isFunction(t)||t instanceof n?(this.valueF=t,this.valueInternal=void 0):(this.valueF=void 0,this.valueInternal=t)}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 w.toString(this.value())},n.prototype.log=function(){return this.value()},n}(a),h=function(t){function n(){return n.__super__.constructor.apply(this,arguments)}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 n.__super__.constructor.apply(this,arguments)}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){this.error=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> "+w.toString(this.error)},n}(a),t.Event=a,t.Initial=h,t.Next=p,t.End=s,t.Error=c,H=function(t){return new h(t,!0)},Z=function(t){return new p(t,!0)},I=function(){return new s},nt=function(t){return t instanceof a?t:Z(t)},B=0,K=function(){},v=function(){function t(t){this.id=++B,st(t,this),this.initialDesc=this.desc}return t.prototype.subscribe=function(t){return E.wrappedSubscribe(this,t)},t.prototype.subscribeInternal=function(t){return this.dispatcher.subscribe(t)},t.prototype.onValue=function(){var t;return t=z(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=z(arguments),this.subscribe(function(n){return n.isError()?t(n.error):void 0})},t.prototype.onEnd=function(){var t;return t=z(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 k.apply(null,arguments).apply(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=ht(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=$,this.starting.push(t),e=function(e){return function(){return e.unsubscribed?void 0:(n=!0,e.remove(r),w.remove(t,e.starting))}}(this),r=t(this.unsubscribe,e),this.unsubscribed||n?r():this.subscriptions.push(r),w.remove(t,this.starting),r},t.prototype.remove=function(t){return this.unsubscribed?void 0:void 0!==w.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=ht(this.subscribe,this),this.handleEvent=ht(this.handleEvent,this),this.subscriptions=[],this.queue=[],this.pushing=!1,this.ended=!1,this.prevError=void 0,this.unsubSrc=void 0}return n.prototype.hasSubscribers=function(){return this.subscriptions.length>0},n.prototype.removeSub=function(t){return this.subscriptions=w.without(t,this.subscriptions)},n.prototype.push=function(t){return t.isEnd()&&(this.ended=!0),E.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(I()),$):(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}(),l=function(n){function r(t,n,e){w.isFunction(t)&&(e=n,n=t,t=[]),r.__super__.constructor.call(this,t),this.dispatcher=new o(n,e),K(this)}return lt(r,n),r.prototype.toProperty=function(n){var r,e;return e=0===arguments.length?d:ut(function(){return n}),r=this.dispatcher,new y(k(this,"toProperty",n),function(n){var u,i,o,s;return u=!1,s=$,i=t.more,o=function(){return u?void 0:e.forEach(function(r){return u=!0,i=n(new h(r)),i===t.noMore?(s(),s=$):void 0})},s=r.subscribe(function(r){return r.hasValue()?u&&r.isInitial()?t.more:(r.isInitial()||o(),u=!0,e=new b(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(t){return new r(k(this,"withHandler",t),this.dispatcher.subscribe,t)},r}(v),t.EventStream=l,t.never=function(){return new l(k(t,"never"),function(t){return t(I()),$})},t.when=function(){var n,r,e,u,i,o,s,c,a,f,h,p,d,v,y,m,b,S,M,A;if(0===arguments.length)return t.never();for(s=arguments.length,A="when: expecting arguments in the form (Observable+,function)+",S=[],d=[],r=0,v=[];s>r;){for(v[r]=arguments[r],v[r+1]=arguments[r+1],p=w.toArray(arguments[r]),n=O(arguments[r+1]),h={f:n,ixs:[]},M=!1,i=0,c=p.length;c>i;i++){for(b=p[i],e=w.indexOf(S,b),M||(M=g.isTrigger(b)),0>e&&(S.push(b),e=S.length-1),y=h.ixs,o=0,a=y.length;a>o;o++)u=y[o],u.index===e&&u.count++;h.ixs.push({index:e,count:1})}p.length>0&&d.push(h),r+=2}return S.length?(S=w.map(g.fromObservable,S),f=w.any(S,function(t){return t.flatten})&&_(w.map(function(t){return t.obs},S)),m=new l(k.apply(null,[t,"when"].concat(ft.call(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],!S[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],!S[r.index].mayHave(r.count))return!0},s=function(t){return!t.source.flatten},c=function(c){return function(l){var h,p,v;return p=function(){return E.whenDoneWith(m,h)},v=function(){var e,u,i,c,l,f;if(!(a.length>0))return t.more;for(l=t.more,f=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(S[r.index].consume());return u}(),l=n(f.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=w.filter(s,a)),l===t.noMore?l:v()},h=function(){var r;return r=v(),i&&(i=!1,(w.all(S,u)||w.all(d,e))&&(r=t.noMore,n(I()))),r===t.noMore&&l(),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}),f||E.hasWaiters()?p():h())),e===t.noMore&&l(),e||t.more})}},new t.CompositeUnsubscribe(function(){var t,n,r;for(r=[],t=0,n=S.length;n>t;t++)b=S[t],r.push(c(b));return r}()).unsubscribe})):t.never()},_=function(t,n){var r;return null==n&&(n=[]),r=function(t){var e;return w.contains(n,t)?!0:(e=t.internalDeps(),e.length?(n.push(t),w.any(e,r)):(n.push(t),!1))},w.any(t,r)},O=function(t){return w.isFunction(t)?t:w.always(t)},t.groupSimultaneous=function(){var r,e,u;return u=1<=arguments.length?ft.call(arguments,0):[],1===u.length&&C(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}(),st.apply(null,[t,"groupSimultaneous"].concat(ft.call(u),[t.when(e,function(){var t;return t=1<=arguments.length?ft.call(arguments,0):[]})]))},m=function(n){function r(t,n,e){this.property=t,this.subscribe=ht(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 b(t),this.currentValueRootId=E.currentEventId()),r.__super__.push.call(this,t)},r.prototype.maybeSubSource=function(n,r){return r===t.noMore?$:this.propertyEnded?(n(I()),$):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=E.currentEventId(),i=this.currentValueRootId,!this.propertyEnded&&i&&r&&r!==i?(E.whenDoneWith(this.property,function(t){return function(){return t.currentValueRootId===i?n(H(t.current.get().value())):void 0}}(this)),this.maybeSubSource(n,u)):(E.inTransaction(void 0,this,function(){return u=n(H(this.current.get().value()))},[]),this.maybeSubSource(n,u))):this.maybeSubSource(n,u)},r}(o),y=function(t){function n(t,r,e){w.isFunction(t)&&(e=r,r=t,t=[]),n.__super__.constructor.call(this,t),this.dispatcher=new m(this,r,e),K(this)}return lt(n,t),n.prototype.changes=function(){return new l(k(this,"changes"),function(t){return function(n){return t.dispatcher.subscribe(function(t){return t.isInitial()?void 0:n(t)})}}(this))},n.prototype.withHandler=function(t){return new n(k(this,"withHandler",t),this.dispatcher.subscribe,t)},n.prototype.toProperty=function(){return this},n.prototype.toEventStream=function(){return new l(k(this,"toEventStream"),function(t){return function(n){return t.dispatcher.subscribe(function(t){return t.isInitial()&&(t=t.toNext()),n(t)})}}(this))},n}(v),t.Property=y,t.constant=function(n){return new y(k(t,"constant",n),function(t){return t(H(n)),t(I()),$})},t.fromBinder=function(n,r){return null==r&&(r=w.id),new l(k(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,l;for(n=1<=arguments.length?ft.call(arguments,0):[],l=r.apply(this,n),C(l)&&w.last(l)instanceof a||(l=[l]),c=t.more,o=0,s=l.length;s>o;o++)if(u=l[o],c=e(u=nt(u)),c===t.noMore||u.isEnd())return i(),c;return c}),u&&i(),i})},P=[["addEventListener","removeEventListener"],["addListener","removeListener"],["on","off"],["bind","unbind"]],x=function(t){var n,r,e,u;for(n=0,r=P.length;r>n;n++)if(u=P[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=x(n),i=u[0],o=u[1],st(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 t,n;return n=arguments[0],t=2<=arguments.length?ft.call(arguments,1):[],A(this,n,t,function(t){return st(this,"map",t,this.withHandler(function(n){return this.push(n.fmap(t))}))})},t.combineAsArray=function(){var n,r,e,u,i,o,s;for(s=1<=arguments.length?ft.call(arguments,0):[],1===s.length&&C(s[0])&&(s=s[0]),n=r=0,e=s.length;e>r;n=++r)o=s[n],q(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}(),st.apply(null,[t,"combineAsArray"].concat(ft.call(s),[t.when(i,function(){var t;return t=1<=arguments.length?ft.call(arguments,0):[]}).toProperty()]))):t.constant([])},t.onValues=function(){var n,r,e;return e=2<=arguments.length?ft.call(arguments,0,r=arguments.length-1):(r=0,[]),n=arguments[r++],t.combineAsArray(e).onValues(n)},t.combineWith=function(){var n,r;return n=arguments[0],r=2<=arguments.length?ft.call(arguments,1):[],st.apply(null,[t,"combineWith",n].concat(ft.call(r),[t.combineAsArray(r).map(function(t){return n.apply(null,t)})]))},t.combineTemplate=function(n){var r,e,u,i,o,s,c,a,l,f;return c=[],f=[],s=function(t){return t[t.length-1]},l=function(t,n,r){return s(t)[n]=r},r=function(t,n){return function(r,e){return l(r,t,e[n])}},o=function(t,n){return function(r){return l(r,t,n)}},a=function(t){return C(t)?[]:{}},u=function(t,n){var e,u;return q(n)?(f.push(n),c.push(r(t,f.length-1))):n!==Object(n)||"function"==typeof n||n instanceof RegExp||n instanceof Date?c.push(o(t,n)):(u=function(t){return function(r){var e;return e=a(n),l(r,t,e),r.push(e)}},e=function(t){return t.pop()},c.push(u(t)),i(n),c.push(e))},i=function(t){return w.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},st(t,"combineTemplate",n,t.combineAsArray(f).map(e))},t.Observable.prototype.combine=function(n,r){var e;return e=tt(r),st(this,"combine",n,r,t.combineAsArray(this,n).map(function(t){return e(t[0],t[1])}))},t.Observable.prototype.decode=function(n){return st(this,"decode",n,this.combine(t.combineTemplate(n),function(t,n){return n[t]}))},t.Observable.prototype.withStateMachine=function(n,r){var e;return e=n,st(this,"withStateMachine",n,r,this.withHandler(function(n){var u,i,o,s,c,a,l;for(u=r(e,n),s=u[0],a=u[1],e=s,l=t.more,i=0,o=a.length;o>i;i++)if(c=a[i],l=this.push(c),l===t.noMore)return l;return l}))},t.Observable.prototype.skipDuplicates=function(t){return null==t&&(t=function(t,n){return t===n}),st(this,"skipDuplicates",this.withStateMachine(d,function(n,r){return r.hasValue()?r.isInitial()||n===d||!t(n.get(),r.value())?[new b(r.value()),[r]]:[n,[]]:[n,[r]]}))},t.Observable.prototype.awaiting=function(n){return st(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 st(this,"not",this.map(function(t){return!t}))},t.Property.prototype.and=function(t){return st(this,"and",t,this.combine(t,function(t,n){return t&&n}))},t.Property.prototype.or=function(t){return st(this,"or",t,this.combine(t,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(t){return st(this,"bufferWithTime",t,this.bufferWithTimeOrCount(t,Number.MAX_VALUE))},t.EventStream.prototype.bufferWithCount=function(t){return st(this,"bufferWithCount",t,this.bufferWithTimeOrCount(void 0,t))},t.EventStream.prototype.bufferWithTimeOrCount=function(t,n){var r;return r=function(r){return r.values.length===n?r.flush():void 0!==t?r.schedule():void 0},st(this,"bufferWithTimeOrCount",t,n,this.buffer(t,r,r))},t.EventStream.prototype.buffer=function(n,r,e){var u,i,o;return null==r&&(r=$),null==e&&(e=$),u={scheduled:null,end:void 0,values:[],flush:function(){var n;if(this.scheduled&&(t.scheduler.clearTimeout(this.scheduled),this.scheduled=null),this.values.length>0){if(n=this.push(Z(this.values)),this.values=[],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,w.isFunction(n)||(i=n,n=function(n){return t.scheduler.setTimeout(n,i)}),st(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?ft.call(arguments,1):[],A(this,r,n,function(n){return st(this,"filter",n,this.withHandler(function(r){return r.filter(n)?this.push(r):t.more}))})},t.once=function(n){return new l(k(t,"once",n),function(t){return t(nt(n)),t(I()),$})},t.EventStream.prototype.concat=function(t){var n;return n=this,new l(k(n,"concat",t),function(r){var e,u;return u=$,e=n.dispatcher.subscribe(function(n){return n.isEnd()?u=t.dispatcher.subscribe(r):r(n)}),function(){return e(),u()}})},t.Observable.prototype.flatMap=function(){return F(this,Q(arguments))},t.Observable.prototype.flatMapFirst=function(){return F(this,Q(arguments),!0)},F=function(n,r,u,i){var o,s,c;return c=[n],o=[],s=new l(k(n,"flatMap"+(u?"First":""),r),function(s){var c,a,l,f,p;return l=new e,f=[],p=function(n){var e;return e=R(r(n.value())),o.push(e),l.add(function(n,r){return e.dispatcher.subscribe(function(u){var i;return u.isEnd()?(w.remove(e,o),a(),c(r),t.noMore):(u instanceof h&&(u=u.toNext()),i=s(u),i===t.noMore&&n(),i)})})},a=function(){var t;return t=f.shift(),t?p(t):void 0},c=function(t){return t(),l.empty()?s(I()):void 0},l.add(function(r,e){return n.dispatcher.subscribe(function(n){return n.isEnd()?c(e):n.isError()?s(n):u&&l.count()>1?t.more:l.unsubscribed?t.noMore:i&&l.count()>i?f.push(n):p(n)})}),l.unsubscribe}),s.internalDeps=function(){return o.length?c.concat(o):c},s},Q=function(t){return 1===t.length&&q(t[0])?w.always(t[0]):z(t)},R=function(n){return q(n)?n:t.once(n)},t.Observable.prototype.flatMapWithConcurrencyLimit=function(){var t,n;return n=arguments[0],t=2<=arguments.length?ft.call(arguments,1):[],st.apply(null,[this,"flatMapWithConcurrencyLimit",n].concat(ft.call(t),[F(this,Q(t),!1,n)]))},t.Observable.prototype.flatMapConcat=function(){return st.apply(null,[this,"flatMapConcat"].concat(ft.call(arguments),[this.flatMapWithConcurrencyLimit.apply(this,[1].concat(ft.call(arguments)))]))},t.later=function(n,r){return st(t,"later",n,r,t.fromBinder(function(e){var u,i;return i=function(){return e([r,I()])},u=t.scheduler.setTimeout(i,n),function(){return t.scheduler.clearTimeout(u)}}))},t.Observable.prototype.bufferingThrottle=function(n){return st(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(){this.guardedSink=ht(this.guardedSink,this),this.subscribeAll=ht(this.subscribeAll,this),this.unsubAll=ht(this.unsubAll,this),this.sink=void 0,this.subscriptions=[],this.ended=!1,r.__super__.constructor.call(this,k(t,"Bus"),this.subscribeAll)}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(I());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(I()):void 0},r.prototype.push=function(t){return this.ended?void 0:"function"==typeof this.sink?this.sink(Z(t)):void 0},r.prototype.error=function(t){return"function"==typeof this.sink?this.sink(new c(t)):void 0},r}(l),t.Bus=r,U=function(n,r){return ct(function(){var e,u,i;return u=arguments[0],e=2<=arguments.length?ft.call(arguments,1):[],i=X(r,[function(t,n){return u.apply(null,ft.call(t).concat([n]))}]),st.apply(null,[t,n,u].concat(ft.call(e),[t.combineAsArray(e).flatMap(i)]))})},t.fromCallback=U("fromCallback",function(){var n,r;return r=arguments[0],n=2<=arguments.length?ft.call(arguments,1):[],t.fromBinder(function(t){return N(r,n)(t),$},function(t){return[t,I()]})}),t.fromNodeCallback=U("fromNodeCallback",function(){var n,r;return r=arguments[0],n=2<=arguments.length?ft.call(arguments,1):[],t.fromBinder(function(t){return N(r,n)(t),$},function(t,n){return t?[new c(t),I()]:[n,I()]})}),S=function(n,r){var e;return e=new l(k(n,"justInitValue"),function(r){var u,i;return i=void 0,u=n.dispatcher.subscribe(function(n){return n.isEnd()||(i=n),t.noMore}),E.whenDoneWith(e,function(){return null!=i&&r(i),r(I())}),u}),e.concat(r).toProperty()},t.Observable.prototype.mapEnd=function(){var n;return n=z(arguments),st(this,"mapEnd",n,this.withHandler(function(r){return r.isEnd()?(this.push(Z(n(r))),this.push(I()),t.noMore):this.push(r)}))},t.Observable.prototype.skipErrors=function(){return st(this,"skipErrors",this.withHandler(function(n){return n.isError()?t.more:this.push(n)}))},t.EventStream.prototype.takeUntil=function(n){var r;return r={},st(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(I());for(c=t.more,i=0,o=u.length;o>i;i++)a=u[i],c=a===r?this.push(I()):this.push(Z(a));return c}return this.push(e)}))},t.Property.prototype.takeUntil=function(t){var n;return n=this.changes().takeUntil(t),st(this,"takeUntil",t,S(this,n))},t.Observable.prototype.flatMapLatest=function(){var t,n;return t=Q(arguments),n=this.toEventStream(),st(this,"flatMapLatest",t,n.flatMap(function(r){return R(t(r)).takeUntil(n)}))},t.Property.prototype.delayChanges=function(){var t,n,r;return t=2<=arguments.length?ft.call(arguments,0,r=arguments.length-1):(r=0,[]),n=arguments[r++],st.apply(null,[this].concat(ft.call(t),[S(this,n(this.changes()))]))},t.EventStream.prototype.delay=function(n){return st(this,"delay",n,this.flatMap(function(r){return t.later(n,r)}))},t.Property.prototype.delay=function(t){return this.delayChanges("delay",t,function(n){return n.delay(t)})},t.EventStream.prototype.debounce=function(n){return st(this,"debounce",n,this.flatMapLatest(function(r){return t.later(n,r)}))},t.Property.prototype.debounce=function(t){ | ||
return this.delayChanges("debounce",t,function(n){return n.debounce(t)})},t.EventStream.prototype.debounceImmediate=function(n){return st(this,"debounceImmediate",n,this.flatMapFirst(function(r){return t.once(r).concat(t.later(n).filter(!1))}))},t.Observable.prototype.scan=function(n,r){var e,u,i;return r=tt(r),e=ut(n),i=function(n){return function(i){var o,s,c,a;return o=!1,a=$,s=t.more,c=function(){return o?void 0:e.forEach(function(n){return o=!0,s=i(new h(function(){return n})),s===t.noMore?(a(),a=$):void 0})},a=n.dispatcher.subscribe(function(n){var u,a;return n.hasValue()?o&&n.isInitial()?t.more:(n.isInitial()||c(),o=!0,a=e.getOrElse(void 0),u=r(a,n.value()),e=new b(u),i(n.apply(function(){return u}))):(n.isEnd()&&(s=c()),s!==t.noMore?i(n):void 0)}),E.whenDoneWith(u,c),a}}(this),u=new y(k(this,"scan",n,r),i)},t.Observable.prototype.diff=function(t,n){return n=tt(n),st(this,"diff",t,n,this.scan([t],function(t,r){return[r,n(t[0],r)]}).filter(function(t){return 2===t.length}).map(function(t){return t[1]}))},t.Observable.prototype.doAction=function(){var t;return t=z(arguments),st(this,"doAction",t,this.withHandler(function(n){return n.hasValue()&&t(n.value()),this.push(n)}))},t.Observable.prototype.doError=function(){var t;return t=z(arguments),st(this,"doError",t,this.withHandler(function(n){return n.isError()&&t(n.error),this.push(n)}))},t.Observable.prototype.endOnError=function(){var t,n;return n=arguments[0],t=2<=arguments.length?ft.call(arguments,1):[],null==n&&(n=!0),A(this,n,t,function(t){return st(this,"endOnError",this.withHandler(function(n){return n.isError()&&t(n.error)?(this.push(n),this.push(I())):this.push(n)}))})},v.prototype.errors=function(){return st(this,"errors",this.filter(function(){return!1}))},ot=function(t){return[t,I()]},t.fromPromise=function(n,r){return st(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}},ot))},t.Observable.prototype.mapError=function(){var t;return t=z(arguments),st(this,"mapError",t,this.withHandler(function(n){return n.isError()?this.push(Z(t(n.error))):this.push(n)}))},t.Observable.prototype.flatMapError=function(n){return st(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(t,n){return st(this,"sampledBy",t,n,this.toProperty().sampledBy(t,n))},t.Property.prototype.sampledBy=function(n,r){var e,u,i,o,s;return null!=r?r=tt(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,st(this,"sampledBy",n,r,u)},t.Property.prototype.sample=function(n){return st(this,"sample",n,this.sampledBy(t.interval(n,{})))},t.Observable.prototype.map=function(){var t,n;return n=arguments[0],t=2<=arguments.length?ft.call(arguments,1):[],n instanceof y?n.sampledBy(this,V):A(this,n,t,function(t){return st(this,"map",t,this.withHandler(function(n){return this.push(n.fmap(t))}))})},t.Observable.prototype.fold=function(t,n){return st(this,"fold",t,n,this.scan(t,n).sampledBy(this.filter(!1).mapEnd().toProperty()))},v.prototype.reduce=v.prototype.fold,t.fromPoll=function(n,r){return st(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.EventStream.prototype.merge=function(n){var r;return r=this,st(r,"merge",n,t.mergeAll(this,n))},t.mergeAll=function(){var n;return n=1<=arguments.length?ft.call(arguments,0):[],C(n[0])&&(n=n[0]),n.length?new l(k.apply(null,[t,"mergeAll"].concat(ft.call(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(I()):t.more):(o=r(u),o===t.noMore&&i(),o)})}},u=w.map(i,n),new t.CompositeUnsubscribe(u).unsubscribe}):t.never()},t.Observable.prototype.take=function(n){return 0>=n?t.never():st(this,"take",n,this.withHandler(function(r){return r.hasValue()?(n--,n>0?this.push(r):(0===n&&this.push(r),this.push(I()),t.noMore)):this.push(r)}))},t.fromArray=function(n){var r;return n.length?(r=0,new l(k(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(nt(a)),s!==t.noMore&&(r===n.length?e(I()):E.afterTransaction(u)));return o=!1}},u(),function(){return c=!0}})):st(t,"fromArray",n,t.never())},t.EventStream.prototype.holdWhen=function(n){var r,e,u;return u=n.startWith(!1),e=u.filter(function(t){return!t}),r=u.filter(w.id),st(this,"holdWhen",n,this.filter(!1).merge(u.flatMapConcat(function(n){return function(u){return u?n.scan([],function(t,n){return t.concat([n])}).sampledBy(e).take(1).flatMap(t.fromArray):n.takeUntil(r)}}(this))))},t.interval=function(n,r){return null==r&&(r={}),st(t,"interval",n,r,t.fromPoll(n,function(){return Z(r)}))},t.$={},t.$.asEventStream=function(n,r,e){var u;return w.isFunction(r)&&(u=[r,void 0],e=u[0],r=u[1]),st(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!=(J="undefined"!=typeof jQuery&&null!==jQuery?jQuery:"undefined"!=typeof Zepto&&null!==Zepto?Zepto:void 0)&&(J.fn.asEventStream=t.$.asEventStream),t.Observable.prototype.log=function(){var t;return t=1<=arguments.length?ft.call(arguments,0):[],this.subscribe(function(n){return"undefined"!=typeof console&&null!==console&&"function"==typeof console.log?console.log.apply(console,ft.call(t).concat([n.log()])):void 0}),this},t.repeatedly=function(n,r){var e;return e=0,st(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(I());return u=!0},s(),function(){return c()}})},t.retry=function(n){var r,e,u,i,o,s,c;if(!w.isFunction(n.source))throw new f("'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,st(t,"retry",n,t.repeat(function(){var n,a,l;return u?null:(l=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(l))):l())}))},t.sequentially=function(n,r){var e;return e=0,st(t,"sequentially",n,r,t.fromPoll(n,function(){var t;return t=r[e++],e<r.length?t:e===r.length?[t,I()]:I()}))},t.Observable.prototype.skip=function(n){return st(this,"skip",n,this.withHandler(function(r){return r.hasValue()&&n>0?(n--,t.more):this.push(r)}))},t.EventStream.prototype.skipUntil=function(t){var n;return n=t.take(1).map(!0).toProperty(!1),st(this,"skipUntil",t,this.filter(n))},t.EventStream.prototype.skipWhile=function(){var n,r,e;return r=arguments[0],n=2<=arguments.length?ft.call(arguments,1):[],e=!1,A(this,r,n,function(n){return st(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(t,n){return null==n&&(n=0),st(this,"slidingWindow",t,n,this.scan([],function(n,r){return n.concat([r]).slice(-t)}).filter(function(t){return t.length>=n}))},t.spy=function(t){return Y.push(t)},Y=[],K=function(t){var n,r,e;if(Y.length&&!K.running)try{for(K.running=!0,n=0,r=Y.length;r>n;n++)(e=Y[n])(t)}finally{delete K.running}return void 0},t.Property.prototype.startWith=function(t){return st(this,"startWith",t,this.scan(t,function(t,n){return n}))},t.EventStream.prototype.startWith=function(n){return st(this,"startWith",n,t.once(n).concat(this))},t.Observable.prototype.takeWhile=function(){var n,r;return r=arguments[0],n=2<=arguments.length?ft.call(arguments,1):[],A(this,r,n,function(n){return st(this,"takeWhile",n,this.withHandler(function(r){return r.filter(n)?this.push(r):(this.push(I()),t.noMore)}))})},t.update=function(){var n,r,e,u;for(r=arguments[0],u=2<=arguments.length?ft.call(arguments,1):[],e=function(t){return function(){var n;return n=1<=arguments.length?ft.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 st.apply(null,[t,"update",r].concat(ft.call(u),[t.when.apply(t,u).scan(r,function(t,n){return n(t)})]))},t.zipAsArray=function(){var n;return n=1<=arguments.length?ft.call(arguments,0):[],C(n[0])&&(n=n[0]),st.apply(null,[t,"zipAsArray"].concat(ft.call(n),[t.zipWith(n,function(){var t;return t=1<=arguments.length?ft.call(arguments,0):[]})]))},t.zipWith=function(){var n,r,e;return n=arguments[0],e=2<=arguments.length?ft.call(arguments,1):[],w.isFunction(n)||(r=[n,e[0]],e=r[0],n=r[1]),e=w.map(function(t){return t.toEventStream()},e),st.apply(null,[t,"zipWith",n].concat(ft.call(e),[t.when(e,n)]))},t.Observable.prototype.zip=function(n,r){return null==r&&(r=Array),st(this,"zip",n,t.zipWith([this,n],r))},t.Observable.prototype.first=function(){return st(this,"first",this.take(1))},t.Observable.prototype.last=function(){var n;return st(this,"last",this.withHandler(function(r){return r.isEnd()?(n&&this.push(n),this.push(I()),t.noMore):void(n=r)}))},t.EventStream.prototype.throttle=function(t){return st(this,"throttle",t,this.bufferWithTime(t).map(function(t){return t[t.length-1]}))},t.Property.prototype.throttle=function(t){return this.delayChanges("throttle",t,function(n){return n.throttle(t)})},v.prototype.firstToPromise=function(n){var r=this;if("function"!=typeof n){if("function"!=typeof Promise)throw new f("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}),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.58", | ||
"version": "0.7.59", | ||
"keywords": [ | ||
@@ -61,3 +61,4 @@ "bacon.js", | ||
"bluebird": "^2", | ||
"when": "^3.6.4" | ||
"when": "^3.6.4", | ||
"bower-json": "^0.4" | ||
}, | ||
@@ -64,0 +65,0 @@ "repository": { |
Sorry, the diff of this file is too big to display
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
346012
6515
1906
27
1