New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@most/core

Package Overview
Dependencies
Maintainers
4
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@most/core - npm Package Compare versions

Comparing version 0.12.1 to 0.13.0

4

dist/mostCore.min.js

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

(function(t,n){typeof exports==="object"&&typeof module!=="undefined"?n(exports):typeof define==="function"&&define.amd?define(["exports"],n):n(t.mostCore=t.mostCore||{})})(this,function(t){"use strict";function n(t,n){var e=n.length;var r=new Array(e+1);for(var i=0;i<e;++i){r[i]=n[i]}r[e]=t;return r}function e(t,n){var e=n.length;var r=new Array(e);for(var i=0;i<e;++i){r[i]=t(n[i])}return r}function r(t,n,e){var r=n;for(var i=0,o=e.length;i<o;++i){r=t(r,e[i],i)}return r}function i(t,n){if(t<0){throw new TypeError("i must be >= 0")}var e=n.length;if(e===0||t>=e){return n}if(e===1){return[]}return o(t,n,e-1)}function o(t,n,e){var r=new Array(e);var i;for(i=0;i<t;++i){r[i]=n[i]}for(i=t;i<e;++i){r[i]=n[i+1]}return r}function s(t,n){for(var e=0,r=n.length;e<r;++e){if(t===n[e]){return e}}return-1}var u=function(t){return t};var c=function(t,n){return function(e){return t(n(e))}};var h=function(t,n){return t(n)};function a(t){function n(e,r){switch(arguments.length){case 0:return n;case 1:return function(n){return t(e,n)};default:return t(e,r)}}return n}function p(t){function n(e,r,i){switch(arguments.length){case 0:return n;case 1:return a(function(n,r){return t(e,n,r)});case 2:return function(n){return t(e,r,n)};default:return t(e,r,i)}}return n}function f(t){setTimeout(v,0,t)}function v(t){throw t}var l=function(t,n,e){return new k(t,n,e)};var d=function(t,n){return l(w,t,n)};var y=function(t){return l(m,undefined,t)};var _=function(t,n){return l(g,t,n)};var k=function t(n,e,r){this._run=n;this.value=e;this.sink=r;this.active=true};k.prototype.dispose=function t(){this.active=false};k.prototype.run=function t(n){if(!this.active){return}var t=this._run;t(n,this.value,this.sink)};k.prototype.error=function t(n,e){if(!this.active){return f(e)}this.sink.error(n,e)};var w=function(t,n,e){return e.event(t,n)};var m=function(t,n,e){return e.end(t)};var g=function(t,n,e){return e.error(t,n)};var b=function(){return O};var x=function t(){};x.prototype.run=function t(n,e){return e.asap(y(n))};var O=new x;var j=function(){return I};var I=new(function(){function t(){}t.prototype.dispose=function t(){};return t}());var A=function(t){return new T(t)};var T=function t(n){this.disposed=false;this.disposable=n};T.prototype.dispose=function t(){if(!this.disposed){this.disposed=true;this.disposable.dispose();this.disposable=undefined}};function E(t,n,e){var r=n;for(var i=0,o=e.length;i<o;++i){r=t(r,e[i],i)}return r}function C(t){function n(e,r){switch(arguments.length){case 0:return n;case 1:return function(n){return t(e,n)};default:return t(e,r)}}return n}function q(t){function n(e,r,i){switch(arguments.length){case 0:return n;case 1:return C(function(n,r){return t(e,n,r)});case 2:return function(n){return t(e,r,n)};default:return t(e,r,i)}}return n}var M=function t(n,e){this._dispose=n;this._resource=e};M.prototype.dispose=function t(){this._dispose(this._resource)};var S=function(t){return new P(t)};var B=C(function(t,n){return S([t,n])});var P=function t(n){this.disposables=n};P.prototype.dispose=function t(){D(V(this.disposables))};var V=function(t){return E(W,[],t)};var W=function(t,n){try{n.dispose()}catch(n){t.push(n)}return t};var D=function(t){if(t.length>0){throw new N(t.length+" errors",t)}};var N=function(t){function n(n,e){t.call(this,n);this.message=n;this.name=this.constructor.name;this.errors=e;if(t.captureStackTrace){t.captureStackTrace(this,this.constructor)}this.stack=""+this.stack+R(this.errors)}if(t){n.__proto__=t}n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.toString=function t(){return this.stack};return n}(Error);var R=function(t){return E(z,"",t)};var z=function(t,n,e){return t+"\n["+(e+1)+"] "+n.stack};var L=q(function(t,n,e){try{n.dispose()}catch(n){e.error(t,n)}});var F=function(){return H};var G=function t(){};G.prototype.run=function t(){return j()};var H=new G;var J=function(t,n){return new K(t,n)};var K=function t(n,e){this.time=n;this.value=e};K.prototype.run=function t(n,e){return e.delay(this.time,l(Q,this.value,n))};function Q(t,n,e){e.event(t,n);e.end(t)}var U=function(t){return J(0,t)};var X=function(t){return new Y(t)};var Y=function t(n){this.period=n};Y.prototype.run=function t(n,e){return e.periodic(this.period,d(undefined,n))};var Z=function(t){return new $(t)};var $=function t(n){this.run=n};var tt=function t(n){this.sink=n};tt.prototype.event=function t(n,e){return this.sink.event(n,e)};tt.prototype.end=function t(n){return this.sink.end(n)};tt.prototype.error=function t(n,e){return this.sink.error(n,e)};var nt=function(t,n){return et(rt,t,n)};var et=function(t,n,e){return n.length===0||e===b()?b():new it(t,n,e)};var rt=function(t,n){return t};var it=function t(n,e,r){this.f=n;this.values=e;this.source=r};it.prototype.run=function t(n,e){return this.source.run(new ot(this.f,this.values,n),e)};var ot=function(t){function n(n,e,r){t.call(this,r);this.f=n;this.values=e;this.index=0}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.f;this.sink.event(n,r(this.values[this.index],e));this.index+=1;if(this.index>=this.values.length){this.sink.end(n)}};return n}(tt);var st=function t(){this.disposable=undefined;this.disposed=false};st.prototype.setDisposable=function t(n){if(this.disposable!==void 0){throw new Error("setDisposable called more than once")}this.disposable=n;if(this.disposed){n.dispose()}};st.prototype.dispose=function t(){if(this.disposed){return}this.disposed=true;if(this.disposable!==void 0){this.disposable.dispose()}};var ut=function(t,n){return new Promise(function(e,r){return ct(t,n,e,r)})};function ct(t,n,e,r){var i=new st;var o=new ht(e,r,i);i.setDisposable(t.run(o,n))}var ht=function t(n,e,r){this._end=n;this._error=e;this._disposable=r;this.active=true};ht.prototype.event=function t(n,e){};ht.prototype.end=function t(n){if(!this.active){return}this._dispose(this._error,this._end,undefined)};ht.prototype.error=function t(n,e){this._dispose(this._error,this._error,e)};ht.prototype._dispose=function t(n,e,r){this.active=false;at(n,e,r,this._disposable)};function at(t,n,e,r){try{r.dispose()}catch(n){t(n);return}n(e)}var pt=function(t,n,e){return new ft(t,n,e)};var ft=function t(n,e,r){this.step=n;this.seed=e;this.source=r};ft.prototype.run=function t(n,e){return this.source.run(new vt(this.step,this.seed,n),e)};var vt=function(t){function n(n,e,r){t.call(this,r);this.step=n;this.seed=e}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.step(this.seed,e);this.seed=r.seed;this.sink.event(n,r.value)};return n}(tt);var lt=function(t,n,e){return new dt(t,n,e)};var dt=function t(n,e,r){this.source=r;this.f=n;this.value=e};dt.prototype.run=function t(n,e){var r=e.asap(d(this.value,n));var i=this.source.run(new yt(this.f,this.value,n),e);return B(r,i)};var yt=function(t){function n(n,e,r){t.call(this,r);this.f=n;this.value=e}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.f;this.value=r(this.value,e);this.sink.event(n,this.value)};return n}(tt);var _t=function t(n,e){this.sink=e;this.offset=n};_t.prototype.event=function t(n,e){this.sink.event(n+this.offset,e)};_t.prototype.error=function t(n,e){this.sink.error(n+this.offset,e)};_t.prototype.end=function t(n){this.sink.end(n+this.offset)};function kt(t,n){var e=n.length;var r=new Array(e);var i=0;for(var o=void 0,s=0;s<e;++s){o=n[s];if(!t(o)){r[i]=o;++i}}r.length=i;return r}function wt(t,n){for(var e=0,r=n.length;e<r;++e){if(t===n[e]){return e}}return-1}function mt(t){function n(e,r){switch(arguments.length){case 0:return n;case 1:return function(n){return t(e,n)};default:return t(e,r)}}return n}var gt=function t(n,e,r,i,o){this.time=n;this.localOffset=e;this.period=r;this.task=i;this.scheduler=o;this.active=true};gt.prototype.run=function t(){return this.task.run(this.time-this.localOffset)};gt.prototype.error=function t(n){return this.task.error(this.time-this.localOffset,n)};gt.prototype.dispose=function t(){this.scheduler.cancel(this);return this.task.dispose()};var bt=function t(){};bt.prototype.asap=function t(n){return this.scheduleTask(0,0,-1,n)};bt.prototype.delay=function t(n,e){return this.scheduleTask(0,n,-1,e)};bt.prototype.periodic=function t(n,e){return this.scheduleTask(0,0,n,e)};bt.prototype.schedule=function t(n,e,r){return this.scheduleTask(0,n,e,r)};var xt=function(t){function n(n,e){t.call(this);this.origin=n;this.scheduler=e}if(t){n.__proto__=t}n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.now=function t(){return this.scheduler.now()-this.origin};n.prototype.scheduleTask=function t(n,e,r,i){return this.scheduler.scheduleTask(n+this.origin,e,r,i)};n.prototype.relative=function t(e){return new n(e+this.origin,this.scheduler)};n.prototype.cancel=function t(n){return this.scheduler.cancel(n)};n.prototype.cancelAll=function t(n){return this.scheduler.cancelAll(n)};return n}(bt);var Ot=function(t){return Promise.resolve(t).then(jt)};function jt(t){try{return t.run()}catch(n){return t.error(n)}}var It=function t(){this.tasks=[]};It.prototype.nextArrival=function t(){return this.isEmpty()?Infinity:this.tasks[0].time};It.prototype.isEmpty=function t(){return this.tasks.length===0};It.prototype.add=function t(n){Tt(n,this.tasks)};It.prototype.remove=function t(n){var e=Bt(Mt(n),this.tasks);if(e>=0&&e<this.tasks.length){var r=wt(n,this.tasks[e].events);if(r>=0){this.tasks[e].events.splice(r,1);return true}}return false};It.prototype.removeAll=function t(n){var e=this;for(var r=0;r<this.tasks.length;++r){St(n,e.tasks[r])}};It.prototype.runTasks=function t(n,e){var r=this;var i=this.tasks;var o=i.length;var s=0;while(s<o&&i[s].time<=n){++s}this.tasks=i.slice(s);for(var u=0;u<s;++u){r.tasks=At(e,i[u].events,r.tasks)}};function At(t,n,e){for(var r=0;r<n.length;++r){var i=n[r];if(i.active){t(i);if(i.period>=0&&i.active){i.time=i.time+i.period;Tt(i,e)}}}return e}function Tt(t,n){var e=n.length;var r=Mt(t);if(e===0){n.push(Pt(r,[t]));return}var i=Bt(r,n);if(i>=e){n.push(Pt(r,[t]))}else{Et(t,n,r,i)}}function Et(t,n,e,r){var i=n[r];if(e===i.time){Ct(t,i.events,e)}else{n.splice(r,0,Pt(e,[t]))}}function Ct(t,n){if(n.length===0||t.time>=n[n.length-1].time){n.push(t)}else{qt(t,n)}}function qt(t,n){for(var e=0;e<n.length;e++){if(t.time<n[e].time){n.splice(e,0,t);break}}}function Mt(t){return Math.floor(t.time)}function St(t,n){n.events=kt(t,n.events)}function Bt(t,n){var e=0;var r=n.length;var i,o;while(e<r){i=Math.floor((e+r)/2);o=n[i];if(t===o.time){return i}else if(t<o.time){r=i}else{e=i+1}}return r}var Pt=function(t,n){return{time:t,events:n}};var Vt=function t(n){this._clock=n};Vt.prototype.now=function t(){return this._clock.now()};Vt.prototype.setTimer=function t(n,e){return e<=0?Dt(n):setTimeout(n,e)};Vt.prototype.clearTimer=function t(n){return n instanceof Wt?n.cancel():clearTimeout(n)};var Wt=function t(n){this.f=n;this.active=true};Wt.prototype.run=function t(){return this.active&&this.f()};Wt.prototype.error=function t(n){throw n};Wt.prototype.cancel=function t(){this.active=false};function Dt(t){var n=new Wt(t);Ot(n);return n}var Nt=function t(n,e){this.origin=e;this.clock=n};Nt.prototype.now=function t(){return this.clock.now()-this.origin};var Rt=function t(n,e){this.origin=e;this.hrtime=n};Rt.prototype.now=function t(){var n=this.hrtime(this.origin);return(n[0]*1e9+n[1])/1e6};var zt=mt(function(t,n){return new xt(t,n)});var Lt=function(t,n,e,r){return n.run(Ft(t,e),zt(t,r))};var Ft=function(t,n){return n instanceof _t?new _t(t+n.offset,n.sink):new _t(t,n)};var Gt=function(t,n){return new Ht(t,n)};var Ht=function t(n,e){this.f=n;this.source=e};Ht.prototype.run=function t(n,e){return new Jt(this.f,this.source,n,e)};var Jt=function(t){function n(n,e,r,i){t.call(this,r);this.f=n;this.scheduler=i;this.active=true;this.disposable=A(e.run(this,i))}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(!this.active){return}this.sink.event(n,e)};n.prototype.end=function t(n){if(!this.active){return}L(n,this.disposable,this.sink);this._startNext(n,this.sink)};n.prototype._startNext=function t(n,e){try{this.disposable=this._continue(this.f,n,e)}catch(t){e.error(n,t)}};n.prototype._continue=function t(n,e,r){return Lt(e,n(),r,this.scheduler)};n.prototype.dispose=function t(){this.active=false;return this.disposable.dispose()};return n}(tt);var Kt=function(t,n){return Gt(function(){return n},U(t))};var Qt=function t(n,e){this.p=n;this.source=e};Qt.prototype.run=function t(n,e){return this.source.run(new Ut(this.p,n),e)};Qt.create=function t(n,e){if(e instanceof Qt){return new Qt(Xt(e.p,n),e.source)}return new Qt(n,e)};var Ut=function(t){function n(n,e){t.call(this,e);this.p=n}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.p;r(e)&&this.sink.event(n,e)};return n}(tt);var Xt=function(t,n){return function(e){return t(e)&&n(e)}};var Yt=function t(n,e,r){this.p=n;this.f=e;this.source=r};Yt.prototype.run=function t(n,e){return this.source.run(new Zt(this.p,this.f,n),e)};var Zt=function(t){function n(n,e,r){t.call(this,r);this.p=n;this.f=e}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.f;var i=this.p;i(e)&&this.sink.event(n,r(e))};return n}(tt);var $t=function t(n,e){this.f=n;this.source=e};$t.prototype.run=function t(n,e){return this.source.run(new tn(this.f,n),e)};$t.create=function t(n,e){if(e instanceof $t){return new $t(c(n,e.f),e.source)}if(e instanceof Qt){return new Yt(e.p,n,e.source)}return new $t(n,e)};var tn=function(t){function n(n,e){t.call(this,e);this.f=n}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.f;this.sink.event(n,r(e))};return n}(tt);var nn=function(t,n){return $t.create(t,n)};var en=function(t,n){return nn(function(){return t},n)};var rn=function(t,n){return new on(t,n)};var on=function t(n,e){this.source=e;this.f=n};on.prototype.run=function t(n,e){return this.source.run(new sn(this.f,n),e)};var sn=function(t){function n(n,e){t.call(this,e);this.f=n}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.f;r(e);this.sink.event(n,e)};return n}(tt);var un=function(t){function n(n,e){t.call(this,e);this.index=n;this.active=true;this.value=undefined}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(!this.active){return}this.value=e;this.sink.event(n,this)};n.prototype.end=function t(n){if(!this.active){return}this.active=false;this.sink.event(n,this)};return n}(tt);function cn(t,n){switch(n.length){case 0:return t();case 1:return t(n[0]);case 2:return t(n[0],n[1]);case 3:return t(n[0],n[1],n[2]);case 4:return t(n[0],n[1],n[2],n[3]);case 5:return t(n[0],n[1],n[2],n[3],n[4]);default:return t.apply(void 0,n)}}function hn(t,n,e){return an(t,[n,e])}var an=function(t,n){return n.length===0?b():n.length===1?nn(t,n[0]):new pn(t,n)};var pn=function t(n,e){this.f=n;this.sources=e};pn.prototype.run=function t(n,e){var r=this;var i=this.sources.length;var o=new Array(i);var s=new Array(i);var u=new fn(o,s,n,this.f);for(var c=void 0,h=0;h<i;++h){c=s[h]=new un(h,u);o[h]=r.sources[h].run(c,e)}return S(o)};var fn=function(t){function n(n,e,r,i){t.call(this,r);this.disposables=n;this.sinks=e;this.f=i;var o=e.length;this.awaiting=o;this.values=new Array(o);this.hasValue=new Array(o).fill(false);this.activeCount=e.length}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(!e.active){this._dispose(n,e.index);return}var r=e.index;var i=this._updateReady(r);this.values[r]=e.value;if(i===0){this.sink.event(n,cn(this.f,this.values))}};n.prototype._updateReady=function t(n){if(this.awaiting>0){if(!this.hasValue[n]){this.hasValue[n]=true;this.awaiting-=1}}return this.awaiting};n.prototype._dispose=function t(n,e){L(n,this.disposables[e],this.sink);if(--this.activeCount===0){this.sink.end(n)}};return n}(tt);function vn(t,n){return hn(h,t,n)}function ln(){this.head=null;this.length=0}ln.prototype.add=function(t){if(this.head!==null){this.head.prev=t;t.next=this.head}this.head=t;++this.length};ln.prototype.remove=function(t){--this.length;if(t===this.head){this.head=this.head.next}if(t.next!==null){t.next.prev=t.prev;t.next=null}if(t.prev!==null){t.prev.next=t.next;t.prev=null}};ln.prototype.isEmpty=function(){return this.length===0};ln.prototype.dispose=function(){if(this.isEmpty()){return Promise.resolve()}var t=[];var n=this.head;this.head=null;this.length=0;while(n!==null){t.push(n.dispose());n=n.next}return Promise.all(t)};var dn=function(t,n){return yn(u,t,n)};var yn=function(t,n,e){return new _n(t,n,e)};var _n=function t(n,e,r){this.f=n;this.concurrency=e;this.source=r};_n.prototype.run=function t(n,e){return new kn(this.f,this.concurrency,this.source,n,e)};var kn=function t(n,e,r,i,o){this.f=n;this.concurrency=e;this.sink=i;this.scheduler=o;this.pending=[];this.current=new ln;this.disposable=A(r.run(this,o));this.active=true};kn.prototype.event=function t(n,e){this._addInner(n,e)};kn.prototype._addInner=function t(n,e){if(this.current.length<this.concurrency){this._startInner(n,e)}else{this.pending.push(e)}};kn.prototype._startInner=function t(n,e){try{this._initInner(n,e)}catch(t){this.error(n,t)}};kn.prototype._initInner=function t(n,e){var r=new mn(n,this,this.sink);r.disposable=wn(this.f,n,e,r,this.scheduler);this.current.add(r)};kn.prototype.end=function t(n){this.active=false;L(n,this.disposable,this.sink);this._checkEnd(n)};kn.prototype.error=function t(n,e){this.active=false;this.sink.error(n,e)};kn.prototype.dispose=function t(){this.active=false;this.pending.length=0;this.disposable.dispose();this.current.dispose()};kn.prototype._endInner=function t(n,e){this.current.remove(e);L(n,e,this);if(this.pending.length===0){this._checkEnd(n)}else{this._startInner(n,this.pending.shift())}};kn.prototype._checkEnd=function t(n){if(!this.active&&this.current.isEmpty()){this.sink.end(n)}};var wn=function(t,n,e,r,i){return t(e).run(r,zt(n,i))};var mn=function t(n,e,r){this.prev=this.next=null;this.time=n;this.outer=e;this.sink=r;this.disposable=void 0};mn.prototype.event=function t(n,e){this.sink.event(n+this.time,e)};mn.prototype.end=function t(n){this.outer._endInner(n+this.time,this)};mn.prototype.error=function t(n,e){this.outer.error(n+this.time,e)};mn.prototype.dispose=function t(){return this.disposable.dispose()};var gn=function(t,n){return yn(t,Infinity,n)};var bn=function(t){return dn(Infinity,t)};var xn=function(t,n){return yn(t,1,n)};function On(t,n){return jn([t,n])}var jn=function(t){return t.length===0?b():t.length===1?t[0]:In(t)};var In=function(t){return new Tn(r(An,[],t))};var An=function(t,n){return t.concat(n instanceof Tn?n.sources:n)};var Tn=function t(n){this.sources=n};Tn.prototype.run=function t(n,e){var r=this;var i=this.sources.length;var o=new Array(i);var s=new Array(i);var u=new En(o,s,n);for(var c=void 0,h=0;h<i;++h){c=s[h]=new un(h,u);o[h]=r.sources[h].run(c,e)}return S(o)};var En=function(t){function n(n,e,r){t.call(this,r);this.disposables=n;this.activeCount=e.length}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(!e.active){this._dispose(n,e.index);return}this.sink.event(n,e.value)};n.prototype._dispose=function t(n,e){L(n,this.disposables[e],this.sink);if(--this.activeCount===0){this.sink.end(n)}};return n}(tt);var Cn=function(t,n,e){return new qn(t,n,e)};var qn=function t(n,e,r){this.source=r;this.sampler=e;this.f=n};qn.prototype.run=function t(n,e){var r=new Mn(this.f,this.source,n);var i=this.source.run(r.hold,e);var o=this.sampler.run(r,e);return B(o,i)};var Mn=function(t){function n(n,e,r){t.call(this,r);this.source=e;this.f=n;this.hold=new Sn(this)}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(this.hold.hasValue){var r=this.f;this.sink.event(n,r(e,this.hold.value))}};return n}(tt);var Sn=function(t){function n(n){t.call(this,n);this.hasValue=false}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){this.value=e;this.hasValue=true};n.prototype.end=function t(){};return n}(tt);function Bn(t){this._capacity=t||32;this._length=0;this._head=0}Bn.prototype.push=function(t){var n=this._length;this._checkCapacity(n+1);var e=this._head+n&this._capacity-1;this[e]=t;this._length=n+1};Bn.prototype.shift=function(){var t=this._head;var n=this[t];this[t]=void 0;this._head=t+1&this._capacity-1;this._length--;return n};Bn.prototype.isEmpty=function(){return this._length===0};Bn.prototype.length=function(){return this._length};Bn.prototype._checkCapacity=function(t){if(this._capacity<t){this._ensureCapacity(this._capacity<<1)}};Bn.prototype._ensureCapacity=function(t){var n=this._capacity;this._capacity=t;var e=this._head+this._length;if(e>n){Pn(this,0,this,n,e&n-1)}};function Pn(t,n,e,r,i){for(var o=0;o<i;++o){e[o+r]=t[o+n];t[o+n]=void 0}}function Vn(t,n,e){return Wn(t,[n,e])}var Wn=function(t,n){return n.length===0?b():n.length===1?nn(t,n[0]):new Dn(t,n)};var Dn=function t(n,e){this.f=n;this.sources=e};Dn.prototype.run=function t(n,e){var r=this;var i=this.sources.length;var o=new Array(i);var s=new Array(i);var u=new Array(i);var c=new Nn(this.f,u,s,n);for(var h=void 0,a=0;a<i;++a){u[a]=new Bn;h=s[a]=new un(a,c);o[a]=r.sources[a].run(h,e)}return S(o)};var Nn=function(t){function n(n,e,r,i){t.call(this,i);this.f=n;this.sinks=r;this.buffers=e}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(!e.active){this._dispose(n,e.index);return}var r=this.buffers;var i=r[e.index];i.push(e.value);if(i.length()===1){if(!Fn(this.buffers)){return}Rn(this.f,n,r,this.sink);if(Ln(this.buffers,this.sinks)){this.sink.end(n)}}};n.prototype._dispose=function t(n,e){var r=this.buffers[e];if(r.isEmpty()){this.sink.end(n)}};return n}(tt);var Rn=function(t,n,r,i){return i.event(n,cn(t,e(zn,r)))};var zn=function(t){return t.shift()};function Ln(t,n){for(var e=0,r=t.length;e<r;++e){if(t[e].isEmpty()&&!n[e].active){return true}}return false}function Fn(t){for(var n=0,e=t.length;n<e;++n){if(t[n].isEmpty()){return false}}return true}var Gn=function(t){return new Hn(t)};var Hn=function t(n){this.source=n};Hn.prototype.run=function t(n,e){var r=new Jn(n,e);return B(r,this.source.run(r,e))};var Jn=function t(n,e){this.sink=n;this.scheduler=e;this.current=null;this.ended=false};Jn.prototype.event=function t(n,e){this._disposeCurrent(n);this.current=new Kn(e,n,Infinity,this,this.sink,this.scheduler)};Jn.prototype.end=function t(n){this.ended=true;this._checkEnd(n)};Jn.prototype.error=function t(n,e){this.ended=true;this.sink.error(n,e)};Jn.prototype.dispose=function t(){return this._disposeCurrent(this.scheduler.now())};Jn.prototype._disposeCurrent=function t(n){if(this.current!==null){return this.current._dispose(n)}};Jn.prototype._disposeInner=function t(n,e){e._dispose(n);if(e===this.current){this.current=null}};Jn.prototype._checkEnd=function t(n){if(this.ended&&this.current===null){this.sink.end(n)}};Jn.prototype._endInner=function t(n,e){this._disposeInner(n,e);this._checkEnd(n)};Jn.prototype._errorInner=function t(n,e,r){this._disposeInner(n,r);this.sink.error(n,e)};var Kn=function t(n,e,r,i,o,s){this.min=e;this.max=r;this.outer=i;this.sink=o;this.disposable=n.run(this,zt(e,s))};Kn.prototype.event=function t(n,e){var r=Math.max(0,n+this.min);if(r<this.max){this.sink.event(r,e)}};Kn.prototype.end=function t(n){this.outer._endInner(n+this.min,this)};Kn.prototype.error=function t(n,e){this.outer._errorInner(n+this.min,e,this)};Kn.prototype._dispose=function t(n){L(n+this.min,this.disposable,this.sink)};var Qn=function(t,n){return Qt.create(t,n)};var Un=function(t){return Xn($n,t)};var Xn=function(t,n){return new Yn(t,n)};var Yn=function t(n,e){this.equals=n;this.source=e};Yn.prototype.run=function t(n,e){return this.source.run(new Zn(this.equals,n),e)};var Zn=function(t){function n(n,e){t.call(this,e);this.equals=n;this.value=void 0;this.init=true}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(this.init){this.init=false;this.value=e;this.sink.event(n,e)}else if(!this.equals(this.value,e)){this.value=e;this.sink.event(n,e)}};return n}(tt);function $n(t,n){return t===n}var te=function(t,n){return ee(0,t,n)};var ne=function(t,n){return ee(t,Infinity,n)};var ee=function(t,n,e){return n<=t?b():re(t,n,e)};var re=function(t,n,e){return e instanceof $t?ie(t,n,e):e instanceof se?oe(t,n,e):new se(t,n,e)};var ie=function(t,n,e){return $t.create(e.f,re(t,n,e.source))};function oe(t,n,e){var r=t+e.min;var i=Math.min(n+e.min,e.max);return new se(r,i,e.source)}var se=function t(n,e,r){this.source=r;this.min=n;this.max=e};se.prototype.run=function t(n,e){var r=new st;var i=new ue(this.min,this.max-this.min,n,r);r.setDisposable(this.source.run(i,e));return r};var ue=function(t){function n(n,e,r,i){t.call(this,r);this.skip=n;this.take=e;this.disposable=i}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(this.skip>0){this.skip-=1;return}if(this.take===0){return}this.take-=1;this.sink.event(n,e);if(this.take===0){this.disposable.dispose();this.sink.end(n)}};return n}(tt);var ce=function(t,n){return new he(t,n)};var he=function t(n,e){this.p=n;this.source=e};he.prototype.run=function t(n,e){var r=new st;var i=new ae(this.p,n,r);r.setDisposable(this.source.run(i,e));return r};var ae=function(t){function n(n,e,r){t.call(this,e);this.p=n;this.active=true;this.disposable=r}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(!this.active){return}var r=this.p;this.active=r(e);if(this.active){this.sink.event(n,e)}else{this.disposable.dispose();this.sink.end(n)}};return n}(tt);var pe=function(t,n){return new fe(t,n)};var fe=function t(n,e){this.p=n;this.source=e};fe.prototype.run=function t(n,e){return this.source.run(new ve(this.p,n),e)};var ve=function(t){function n(n,e){t.call(this,e);this.p=n;this.skipping=true}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(this.skipping){var r=this.p;this.skipping=r(e);if(this.skipping){return}}this.sink.event(n,e)};return n}(tt);var le=function(t,n){return new de(t,n)};var de=function t(n,e){this.p=n;this.source=e};de.prototype.run=function t(n,e){return this.source.run(new ye(this.p,n),e)};var ye=function(t){function n(n,e){t.call(this,e);this.p=n;this.skipping=false}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(this.skipping){return}var r=this.p;this.skipping=r(e);this.sink.event(n,e);if(this.skipping){this.sink.end(n)}};return n}(tt);var _e=function(t,n){return new me(t,n)};var ke=function(t,n){return new ge(t,n)};var we=function(t,n){return _e(bn(t),ke(t,n))};var me=function t(n,e){this.maxSignal=n;this.source=e};me.prototype.run=function t(n,e){var r=new be(-Infinity,n);var i=new je(this.maxSignal,n,e);var o=this.source.run(new xe(r,i,n),e);return S([r,i,o])};var ge=function t(n,e){this.minSignal=n;this.source=e};ge.prototype.run=function t(n,e){var r=new Oe(this.minSignal,n,e);var i=new be(Infinity,n);var o=this.source.run(new xe(r,i,n),e);return S([r,i,o])};var be=function(t){function n(n,e){t.call(this,e);this.value=n}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(){};n.prototype.end=function t(){};n.prototype.dispose=function t(){};return n}(tt);var xe=function(t){function n(n,e,r){t.call(this,r);this.min=n;this.max=e}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(n>=this.min.value&&n<this.max.value){this.sink.event(n,e)}};return n}(tt);var Oe=function(t){function n(n,e,r){t.call(this,e);this.value=Infinity;this.disposable=n.run(this,r)}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n){if(n<this.value){this.value=n}};n.prototype.end=function t(){};n.prototype.dispose=function t(){return this.disposable.dispose()};return n}(tt);var je=function(t){function n(n,e,r){t.call(this,e);this.value=Infinity;this.disposable=n.run(this,r)}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(n<this.value){this.value=n;this.sink.end(n)}};n.prototype.end=function t(){};n.prototype.dispose=function t(){return this.disposable.dispose()};return n}(tt);var Ie=function(t,n){return t<=0?n:new Ae(t,n)};var Ae=function t(n,e){this.dt=n;this.source=e};Ae.prototype.run=function t(n,e){var r=new Te(this.dt,n,e);return B(r,this.source.run(r,e))};var Te=function(t){function n(n,e,r){t.call(this,e);this.dt=n;this.scheduler=r}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.dispose=function t(){var n=this;this.scheduler.cancelAll(function(t){return t.sink===n.sink})};n.prototype.event=function t(n,e){this.scheduler.delay(this.dt,d(e,this.sink))};n.prototype.end=function t(n){this.scheduler.delay(this.dt,y(this.sink))};return n}(tt);var Ee=function(t,n){return n instanceof $t?Ce(t,n):n instanceof Me?qe(t,n):new Me(t,n)};var Ce=function(t,n){return $t.create(n.f,Ee(t,n.source))};var qe=function(t,n){return new Me(Math.max(t,n.period),n.source)};var Me=function t(n,e){this.period=n;this.source=e};Me.prototype.run=function t(n,e){return this.source.run(new Se(this.period,n),e)};var Se=function(t){function n(n,e){t.call(this,e);this.time=0;this.period=n}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(n>=this.time){this.time=n+this.period;this.sink.event(n,e)}};return n}(tt);var Be=function(t,n){return new Pe(t,n)};var Pe=function t(n,e){this.dt=n;this.source=e};Pe.prototype.run=function t(n,e){return new Ve(this.dt,this.source,n,e)};var Ve=function t(n,e,r,i){this.dt=n;this.sink=r;this.scheduler=i;this.value=void 0;this.timer=null;this.disposable=e.run(this,i)};Ve.prototype.event=function t(n,e){this._clearTimer();this.value=e;this.timer=this.scheduler.delay(this.dt,d(e,this.sink))};Ve.prototype.end=function t(n){if(this._clearTimer()){this.sink.event(n,this.value);this.value=undefined}this.sink.end(n)};Ve.prototype.error=function t(n,e){this._clearTimer();this.sink.error(n,e)};Ve.prototype.dispose=function t(){this._clearTimer();this.disposable.dispose()};Ve.prototype._clearTimer=function t(){if(this.timer===null){return false}this.timer.dispose();this.timer=null;return true};var We=function(t){return new Ne(t)};var De=c(We,U);var Ne=function t(n){this.source=n};Ne.prototype.run=function t(n,e){return this.source.run(new Re(n,e),e)};var Re=function t(n,e){var r=this;this.sink=n;this.scheduler=e;this.queue=Promise.resolve();this._eventBound=function(t){return r.sink.event(r.scheduler.now(),t)};this._endBound=function(){return r.sink.end(r.scheduler.now())};this._errorBound=function(t){return r.sink.error(r.scheduler.now(),t)}};Re.prototype.event=function t(n,e){var r=this;this.queue=this.queue.then(function(){return r._event(e)}).catch(this._errorBound)};Re.prototype.end=function t(n){this.queue=this.queue.then(this._endBound).catch(this._errorBound)};Re.prototype.error=function t(n,e){var r=this
;this.queue=this.queue.then(function(){return r._errorBound(e)}).catch(f)};Re.prototype._event=function t(n){return n.then(this._eventBound)};function ze(t){this.sink=t;this.active=true}ze.prototype.event=function(t,n){if(!this.active){return}this.sink.event(t,n)};ze.prototype.end=function(t,n){if(!this.active){return}this.disable();this.sink.end(t,n)};ze.prototype.error=function(t,n){this.disable();this.sink.error(t,n)};ze.prototype.disable=function(){this.active=false;return this.sink};function Le(t,n,e){try{e.event(t,n)}catch(n){e.error(t,n)}}function Fe(t,n){try{n.end(t)}catch(e){n.error(t,e)}}var Ge=function(t,n){return new Ke(t,n)};var He=function(t){return new Je(t)};var Je=function t(n){this.value=n};Je.prototype.run=function t(n,e){return e.asap(_(this.value,n))};var Ke=function t(n,e){this.f=n;this.source=e};Ke.prototype.run=function t(n,e){return new Qe(this.f,this.source,n,e)};var Qe=function t(n,e,r,i){this.f=n;this.sink=new ze(r);this.scheduler=i;this.disposable=e.run(this,i)};Qe.prototype.event=function t(n,e){Le(n,e,this.sink)};Qe.prototype.end=function t(n){Fe(n,this.sink)};Qe.prototype.error=function t(n,e){var r=this.sink.disable();L(n,this.disposable,this.sink);this._startNext(n,e,r)};Qe.prototype._startNext=function t(n,e,r){try{this.disposable=this._continue(this.f,n,e,r)}catch(t){r.error(n,t)}};Qe.prototype._continue=function t(n,e,r,i){return Lt(e,n(r),i,this.scheduler)};Qe.prototype.dispose=function t(){return this.disposable.dispose()};var Ue=function(t){return t instanceof Xe?t:new Xe(t)};var Xe=function t(n){this.source=new Ye(n)};Xe.prototype.run=function t(n,e){return this.source.run(n,e)};var Ye=function t(n){this.source=n;this.sinks=[];this.disposable=j()};Ye.prototype.run=function t(n,e){var r=this.add(n);if(r===1){this.disposable=this.source.run(this,e)}return A(new Ze(this,n))};Ye.prototype.dispose=function t(){var n=this.disposable;this.disposable=j();return n.dispose()};Ye.prototype.add=function t(e){this.sinks=n(e,this.sinks);return this.sinks.length};Ye.prototype.remove=function t(n){var e=s(n,this.sinks);if(e>=0){this.sinks=i(e,this.sinks)}return this.sinks.length};Ye.prototype.event=function t(n,e){var r=this.sinks;if(r.length===1){return r[0].event(n,e)}for(var i=0;i<r.length;++i){Le(n,e,r[i])}};Ye.prototype.end=function t(n){var e=this.sinks;for(var r=0;r<e.length;++r){Fe(n,e[r])}};Ye.prototype.error=function t(n,e){var r=this.sinks;for(var i=0;i<r.length;++i){r[i].error(n,e)}};var Ze=function t(n,e){this.source=n;this.sink=e};Ze.prototype.dispose=function t(){if(this.source.remove(this.sink)===0){this.source.dispose()}};var $e=p(et);var tr=a(nt);var nr=a(ut);var er=p(pt);var rr=p(lt);var ir=a(Kt);var or=a(nn);var sr=a(en);var ur=a(rn);var cr=a(vn);var hr=a(gn);var ar=a(Gt);var pr=a(xn);var fr=a(dn);var vr=p(yn);var lr=a(On);var dr=p(hn);var yr=a(an);var _r=p(Cn);var kr=p(Vn);var wr=a(Wn);var mr=a(Qn);var gr=a(Xn);var br=a(te);var xr=a(ne);var Or=p(ee);var jr=a(ce);var Ir=a(pe);var Ar=a(le);var Tr=a(_e);var Er=a(ke);var Cr=a(we);var qr=a(Ie);var Mr=a(Ee);var Sr=a(Be);var Br=a(Ge);var Pr=p(l);var Vr=a(d);var Wr=a(_);t.zipArrayValues=$e;t.withArrayValues=tr;t.runEffects=nr;t.loop=er;t.scan=rr;t.startWith=ir;t.map=or;t.constant=sr;t.tap=ur;t.ap=cr;t.chain=hr;t.join=bn;t.continueWith=ar;t.concatMap=pr;t.mergeConcurrently=fr;t.mergeMapConcurrently=vr;t.merge=lr;t.mergeArray=jn;t.combine=dr;t.combineArray=yr;t.sample=_r;t.zip=kr;t.zipArray=wr;t.filter=mr;t.skipRepeats=Un;t.skipRepeatsWith=gr;t.take=br;t.skip=xr;t.slice=Or;t.takeWhile=jr;t.skipWhile=Ir;t.skipAfter=Ar;t.until=Tr;t.since=Er;t.during=Cr;t.delay=qr;t.throttle=Mr;t.debounce=Sr;t.recoverWith=Br;t.throwError=He;t.propagateTask=Pr;t.propagateEventTask=Vr;t.propagateErrorTask=Wr;t.propagateEndTask=y;t.empty=b;t.never=F;t.now=U;t.at=J;t.periodic=X;t.newStream=Z;t.switchLatest=Gn;t.fromPromise=De;t.awaitPromises=We;t.multicast=Ue;t.MulticastSource=Ye;Object.defineProperty(t,"__esModule",{value:true})});
(function(t,n){typeof exports==="object"&&typeof module!=="undefined"?n(exports):typeof define==="function"&&define.amd?define(["exports"],n):n(t.mostCore=t.mostCore||{})})(this,function(t){"use strict";function n(t,n){var e=n.length;var r=new Array(e+1);for(var i=0;i<e;++i){r[i]=n[i]}r[e]=t;return r}function e(t,n){var e=n.length;var r=new Array(e);for(var i=0;i<e;++i){r[i]=t(n[i])}return r}function r(t,n,e){var r=n;for(var i=0,s=e.length;i<s;++i){r=t(r,e[i],i)}return r}function i(t,n){if(t<0){throw new TypeError("i must be >= 0")}var e=n.length;if(e===0||t>=e){return n}if(e===1){return[]}return s(t,n,e-1)}function s(t,n,e){var r=new Array(e);var i;for(i=0;i<t;++i){r[i]=n[i]}for(i=t;i<e;++i){r[i]=n[i+1]}return r}function o(t,n){for(var e=0,r=n.length;e<r;++e){if(t===n[e]){return e}}return-1}var u=function(t){return t};var c=function(t,n){return function(e){return t(n(e))}};var h=function(t,n){return t(n)};function a(t){function n(e,r){switch(arguments.length){case 0:return n;case 1:return function(n){return t(e,n)};default:return t(e,r)}}return n}function p(t){function n(e,r,i){switch(arguments.length){case 0:return n;case 1:return a(function(n,r){return t(e,n,r)});case 2:return function(n){return t(e,r,n)};default:return t(e,r,i)}}return n}function f(t){setTimeout(v,0,t)}function v(t){throw t}var l=function(t,n,e){return new k(t,n,e)};var d=function(t,n){return l(m,t,n)};var y=function(t){return l(w,undefined,t)};var _=function(t,n){return l(g,t,n)};var k=function t(n,e,r){this._run=n;this.value=e;this.sink=r;this.active=true};k.prototype.dispose=function t(){this.active=false};k.prototype.run=function t(n){if(!this.active){return}var t=this._run;t(n,this.value,this.sink)};k.prototype.error=function t(n,e){if(!this.active){return f(e)}this.sink.error(n,e)};var m=function(t,n,e){return e.event(t,n)};var w=function(t,n,e){return e.end(t)};var g=function(t,n,e){return e.error(t,n)};function b(t,n){var e=n.length;var r=new Array(e);var i=0;for(var s=void 0,o=0;o<e;++o){s=n[o];if(!t(s)){r[i]=s;++i}}r.length=i;return r}function x(t,n){for(var e=0,r=n.length;e<r;++e){if(t===n[e]){return e}}return-1}function T(t){function n(e,r){switch(arguments.length){case 0:return n;case 1:return function(n){return t(e,n)};default:return t(e,r)}}return n}function A(t){function n(e,r,i){switch(arguments.length){case 0:return n;case 1:return T(function(n,r){return t(e,n,r)});case 2:return function(n){return t(e,r,n)};default:return t(e,r,i)}}return n}var O=function t(n,e,r,i,s){this.time=n;this.localOffset=e;this.period=r;this.task=i;this.scheduler=s;this.active=true};O.prototype.run=function t(){return this.task.run(this.time-this.localOffset)};O.prototype.error=function t(n){return this.task.error(this.time-this.localOffset,n)};O.prototype.dispose=function t(){this.scheduler.cancel(this);return this.task.dispose()};var j=function t(n,e){this.origin=n;this.scheduler=e};j.prototype.currentTime=function t(){return this.scheduler.currentTime()-this.origin};j.prototype.scheduleTask=function t(n,e,r,i){return this.scheduler.scheduleTask(n+this.origin,e,r,i)};j.prototype.relative=function t(n){return new j(n+this.origin,this.scheduler)};j.prototype.cancel=function t(n){return this.scheduler.cancel(n)};j.prototype.cancelAll=function t(n){return this.scheduler.cancelAll(n)};var I=function(t){return Promise.resolve(t).then(E)};function E(t){try{return t.run()}catch(n){return t.error(n)}}var C=function t(n,e){var r=this;this.timer=n;this.timeline=e;this._timer=null;this._nextArrival=Infinity;this._runReadyTasksBound=function(){return r._runReadyTasks(r.currentTime())}};C.prototype.currentTime=function t(){return this.timer.now()};C.prototype.scheduleTask=function t(n,e,r,i){var s=this.currentTime()+Math.max(0,e);var o=new O(s,n,r,i,this);this.timeline.add(o);this._scheduleNextRun();return o};C.prototype.relative=function t(n){return new j(n,this)};C.prototype.cancel=function t(n){n.active=false;if(this.timeline.remove(n)){this._reschedule()}};C.prototype.cancelAll=function t(n){this.timeline.removeAll(n);this._reschedule()};C.prototype._reschedule=function t(){if(this.timeline.isEmpty()){this._unschedule()}else{this._scheduleNextRun(this.currentTime())}};C.prototype._unschedule=function t(){this.timer.clearTimer(this._timer);this._timer=null};C.prototype._scheduleNextRun=function t(){if(this.timeline.isEmpty()){return}var n=this.timeline.nextArrival();if(this._timer===null){this._scheduleNextArrival(n)}else if(n<this._nextArrival){this._unschedule();this._scheduleNextArrival(n)}};C.prototype._scheduleNextArrival=function t(n){this._nextArrival=n;var e=Math.max(0,n-this.currentTime());this._timer=this.timer.setTimer(this._runReadyTasksBound,e)};C.prototype._runReadyTasks=function t(){this._timer=null;this.timeline.runTasks(this.currentTime(),E);this._scheduleNextRun()};var R=function t(){this.tasks=[]};R.prototype.nextArrival=function t(){return this.isEmpty()?Infinity:this.tasks[0].time};R.prototype.isEmpty=function t(){return this.tasks.length===0};R.prototype.add=function t(n){M(n,this.tasks)};R.prototype.remove=function t(n){var e=W(P(n),this.tasks);if(e>=0&&e<this.tasks.length){var r=x(n,this.tasks[e].events);if(r>=0){this.tasks[e].events.splice(r,1);return true}}return false};R.prototype.removeAll=function t(n){var e=this;for(var r=0;r<this.tasks.length;++r){V(n,e.tasks[r])}};R.prototype.runTasks=function t(n,e){var r=this;var i=this.tasks;var s=i.length;var o=0;while(o<s&&i[o].time<=n){++o}this.tasks=i.slice(o);for(var u=0;u<o;++u){r.tasks=q(e,i[u].events,r.tasks)}};function q(t,n,e){for(var r=0;r<n.length;++r){var i=n[r];if(i.active){t(i);if(i.period>=0&&i.active){i.time=i.time+i.period;M(i,e)}}}return e}function M(t,n){var e=n.length;var r=P(t);if(e===0){n.push(D(r,[t]));return}var i=W(r,n);if(i>=e){n.push(D(r,[t]))}else{N(t,n,r,i)}}function N(t,n,e,r){var i=n[r];if(e===i.time){B(t,i.events,e)}else{n.splice(r,0,D(e,[t]))}}function B(t,n){if(n.length===0||t.time>=n[n.length-1].time){n.push(t)}else{S(t,n)}}function S(t,n){for(var e=0;e<n.length;e++){if(t.time<n[e].time){n.splice(e,0,t);break}}}function P(t){return Math.floor(t.time)}function V(t,n){n.events=b(t,n.events)}function W(t,n){var e=0;var r=n.length;var i,s;while(e<r){i=Math.floor((e+r)/2);s=n[i];if(t===s.time){return i}else if(t<s.time){r=i}else{e=i+1}}return r}var D=function(t,n){return{time:t,events:n}};var z=function t(n){this._clock=n};z.prototype.now=function t(){return this._clock.now()};z.prototype.setTimer=function t(n,e){return e<=0?F(n):setTimeout(n,e)};z.prototype.clearTimer=function t(n){return n instanceof L?n.cancel():clearTimeout(n)};var L=function t(n){this.f=n;this.active=true};L.prototype.run=function t(){return this.active&&this.f()};L.prototype.error=function t(n){throw n};L.prototype.cancel=function t(){this.active=false};function F(t){var n=new L(t);I(n);return n}var G=function t(n,e){this.origin=e;this.clock=n};G.prototype.now=function t(){return this.clock.now()-this.origin};var H=function t(n,e){this.origin=e;this.hrtime=n};H.prototype.now=function t(){var n=this.hrtime(this.origin);return(n[0]*1e9+n[1])/1e6};var J=function(t){return t.currentTime()};var K=T(function(t,n){return n.scheduleTask(0,0,-1,t)});var Q=A(function(t,n,e){return e.scheduleTask(0,t,-1,n)});var U=A(function(t,n,e){return e.scheduleTask(0,0,t,n)});var X=T(function(t,n){return n.cancelAll(t)});var Y=T(function(t,n){return new j(t,n)});var Z=function(){return tt};var $=function t(){};$.prototype.run=function t(n,e){return K(y(n),e)};var tt=new $;var nt=function(){return et};var et=new(function(){function t(){}t.prototype.dispose=function t(){};return t}());var rt=function(t){return new it(t)};var it=function t(n){this.disposed=false;this.disposable=n};it.prototype.dispose=function t(){if(!this.disposed){this.disposed=true;this.disposable.dispose();this.disposable=undefined}};function st(t,n,e){var r=n;for(var i=0,s=e.length;i<s;++i){r=t(r,e[i],i)}return r}function ot(t){function n(e,r){switch(arguments.length){case 0:return n;case 1:return function(n){return t(e,n)};default:return t(e,r)}}return n}function ut(t){function n(e,r,i){switch(arguments.length){case 0:return n;case 1:return ot(function(n,r){return t(e,n,r)});case 2:return function(n){return t(e,r,n)};default:return t(e,r,i)}}return n}var ct=function t(n,e){this._dispose=n;this._resource=e};ct.prototype.dispose=function t(){this._dispose(this._resource)};var ht=function(t){return new pt(t)};var at=ot(function(t,n){return ht([t,n])});var pt=function t(n){this.disposables=n};pt.prototype.dispose=function t(){lt(ft(this.disposables))};var ft=function(t){return st(vt,[],t)};var vt=function(t,n){try{n.dispose()}catch(n){t.push(n)}return t};var lt=function(t){if(t.length>0){throw new dt(t.length+" errors",t)}};var dt=function(t){function n(n,e){t.call(this,n);this.message=n;this.name=this.constructor.name;this.errors=e;if(t.captureStackTrace){t.captureStackTrace(this,this.constructor)}this.stack=""+this.stack+yt(this.errors)}if(t){n.__proto__=t}n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.toString=function t(){return this.stack};return n}(Error);var yt=function(t){return st(_t,"",t)};var _t=function(t,n,e){return t+"\n["+(e+1)+"] "+n.stack};var kt=ut(function(t,n,e){try{n.dispose()}catch(n){e.error(t,n)}});var mt=function(){return gt};var wt=function t(){};wt.prototype.run=function t(){return nt()};var gt=new wt;var bt=function(t,n){return new xt(t,n)};var xt=function t(n,e){this.time=n;this.value=e};xt.prototype.run=function t(n,e){return Q(this.time,l(Tt,this.value,n),e)};function Tt(t,n,e){e.event(t,n);e.end(t)}var At=function(t){return bt(0,t)};var Ot=function(t){return new jt(t)};var jt=function t(n){this.period=n};jt.prototype.run=function t(n,e){return U(this.period,d(undefined,n),e)};var It=function(t){return new Et(t)};var Et=function t(n){this.run=n};var Ct=function t(n){this.sink=n};Ct.prototype.event=function t(n,e){return this.sink.event(n,e)};Ct.prototype.end=function t(n){return this.sink.end(n)};Ct.prototype.error=function t(n,e){return this.sink.error(n,e)};var Rt=function(t,n){return qt(Mt,t,n)};var qt=function(t,n,e){return n.length===0||e===Z()?Z():new Nt(t,n,e)};var Mt=function(t,n){return t};var Nt=function t(n,e,r){this.f=n;this.values=e;this.source=r};Nt.prototype.run=function t(n,e){return this.source.run(new Bt(this.f,this.values,n),e)};var Bt=function(t){function n(n,e,r){t.call(this,r);this.f=n;this.values=e;this.index=0}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.f;this.sink.event(n,r(this.values[this.index],e));this.index+=1;if(this.index>=this.values.length){this.sink.end(n)}};return n}(Ct);var St=function t(){this.disposable=undefined;this.disposed=false};St.prototype.setDisposable=function t(n){if(this.disposable!==void 0){throw new Error("setDisposable called more than once")}this.disposable=n;if(this.disposed){n.dispose()}};St.prototype.dispose=function t(){if(this.disposed){return}this.disposed=true;if(this.disposable!==void 0){this.disposable.dispose()}};var Pt=function(t,n){return new Promise(function(e,r){return Vt(t,n,e,r)})};function Vt(t,n,e,r){var i=new St;var s=new Wt(e,r,i);i.setDisposable(t.run(s,n))}var Wt=function t(n,e,r){this._end=n;this._error=e;this._disposable=r;this.active=true};Wt.prototype.event=function t(n,e){};Wt.prototype.end=function t(n){if(!this.active){return}this._dispose(this._error,this._end,undefined)};Wt.prototype.error=function t(n,e){this._dispose(this._error,this._error,e)};Wt.prototype._dispose=function t(n,e,r){this.active=false;Dt(n,e,r,this._disposable)};function Dt(t,n,e,r){try{r.dispose()}catch(n){t(n);return}n(e)}var zt=function(t,n,e){return new Lt(t,n,e)};var Lt=function t(n,e,r){this.step=n;this.seed=e;this.source=r};Lt.prototype.run=function t(n,e){return this.source.run(new Ft(this.step,this.seed,n),e)};var Ft=function(t){function n(n,e,r){t.call(this,r);this.step=n;this.seed=e}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.step(this.seed,e);this.seed=r.seed;this.sink.event(n,r.value)};return n}(Ct);var Gt=function(t,n,e){return new Ht(t,n,e)};var Ht=function t(n,e,r){this.source=r;this.f=n;this.value=e};Ht.prototype.run=function t(n,e){var r=K(d(this.value,n),e);var i=this.source.run(new Jt(this.f,this.value,n),e);return at(r,i)};var Jt=function(t){function n(n,e,r){t.call(this,r);this.f=n;this.value=e}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.f;this.value=r(this.value,e);this.sink.event(n,this.value)};return n}(Ct);var Kt=function t(n,e){this.sink=e;this.offset=n};Kt.prototype.event=function t(n,e){this.sink.event(n+this.offset,e)};Kt.prototype.error=function t(n,e){this.sink.error(n+this.offset,e)};Kt.prototype.end=function t(n){this.sink.end(n+this.offset)};var Qt=function(t,n,e,r){return n.run(Ut(t,e),Y(t,r))};var Ut=function(t,n){return n instanceof Kt?new Kt(t+n.offset,n.sink):new Kt(t,n)};var Xt=function(t,n){return new Yt(t,n)};var Yt=function t(n,e){this.f=n;this.source=e};Yt.prototype.run=function t(n,e){return new Zt(this.f,this.source,n,e)};var Zt=function(t){function n(n,e,r,i){t.call(this,r);this.f=n;this.scheduler=i;this.active=true;this.disposable=rt(e.run(this,i))}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(!this.active){return}this.sink.event(n,e)};n.prototype.end=function t(n){if(!this.active){return}kt(n,this.disposable,this.sink);this._startNext(n,this.sink)};n.prototype._startNext=function t(n,e){try{this.disposable=this._continue(this.f,n,e)}catch(t){e.error(n,t)}};n.prototype._continue=function t(n,e,r){return Qt(e,n(),r,this.scheduler)};n.prototype.dispose=function t(){this.active=false;return this.disposable.dispose()};return n}(Ct);var $t=function(t,n){return Xt(function(){return n},At(t))};var tn=function t(n,e){this.p=n;this.source=e};tn.prototype.run=function t(n,e){return this.source.run(new nn(this.p,n),e)};tn.create=function t(n,e){if(e instanceof tn){return new tn(en(e.p,n),e.source)}return new tn(n,e)};var nn=function(t){function n(n,e){t.call(this,e);this.p=n}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.p;r(e)&&this.sink.event(n,e)};return n}(Ct);var en=function(t,n){return function(e){return t(e)&&n(e)}};var rn=function t(n,e,r){this.p=n;this.f=e;this.source=r};rn.prototype.run=function t(n,e){return this.source.run(new sn(this.p,this.f,n),e)};var sn=function(t){function n(n,e,r){t.call(this,r);this.p=n;this.f=e}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.f;var i=this.p;i(e)&&this.sink.event(n,r(e))};return n}(Ct);var on=function t(n,e){this.f=n;this.source=e};on.prototype.run=function t(n,e){return this.source.run(new un(this.f,n),e)};on.create=function t(n,e){if(e instanceof on){return new on(c(n,e.f),e.source)}if(e instanceof tn){return new rn(e.p,n,e.source)}return new on(n,e)};var un=function(t){function n(n,e){t.call(this,e);this.f=n}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.f;this.sink.event(n,r(e))};return n}(Ct);var cn=function(t,n){return on.create(t,n)};var hn=function(t,n){return cn(function(){return t},n)};var an=function(t,n){return new pn(t,n)};var pn=function t(n,e){this.source=e;this.f=n};pn.prototype.run=function t(n,e){return this.source.run(new fn(this.f,n),e)};var fn=function(t){function n(n,e){t.call(this,e);this.f=n}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){var r=this.f;r(e);this.sink.event(n,e)};return n}(Ct);var vn=function(t){function n(n,e){t.call(this,e);this.index=n;this.active=true;this.value=undefined}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(!this.active){return}this.value=e;this.sink.event(n,this)};n.prototype.end=function t(n){if(!this.active){return}this.active=false;this.sink.event(n,this)};return n}(Ct);function ln(t,n){switch(n.length){case 0:return t();case 1:return t(n[0]);case 2:return t(n[0],n[1]);case 3:return t(n[0],n[1],n[2]);case 4:return t(n[0],n[1],n[2],n[3]);case 5:return t(n[0],n[1],n[2],n[3],n[4]);default:return t.apply(void 0,n)}}function dn(t,n,e){return yn(t,[n,e])}var yn=function(t,n){return n.length===0?Z():n.length===1?cn(t,n[0]):new _n(t,n)};var _n=function t(n,e){this.f=n;this.sources=e};_n.prototype.run=function t(n,e){var r=this;var i=this.sources.length;var s=new Array(i);var o=new Array(i);var u=new kn(s,o,n,this.f);for(var c=void 0,h=0;h<i;++h){c=o[h]=new vn(h,u);s[h]=r.sources[h].run(c,e)}return ht(s)};var kn=function(t){function n(n,e,r,i){t.call(this,r);this.disposables=n;this.sinks=e;this.f=i;var s=e.length;this.awaiting=s;this.values=new Array(s);this.hasValue=new Array(s).fill(false);this.activeCount=e.length}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(!e.active){this._dispose(n,e.index);return}var r=e.index;var i=this._updateReady(r);this.values[r]=e.value;if(i===0){this.sink.event(n,ln(this.f,this.values))}};n.prototype._updateReady=function t(n){if(this.awaiting>0){if(!this.hasValue[n]){this.hasValue[n]=true;this.awaiting-=1}}return this.awaiting};n.prototype._dispose=function t(n,e){kt(n,this.disposables[e],this.sink);if(--this.activeCount===0){this.sink.end(n)}};return n}(Ct);function mn(t,n){return dn(h,t,n)}function wn(){this.head=null;this.length=0}wn.prototype.add=function(t){if(this.head!==null){this.head.prev=t;t.next=this.head}this.head=t;++this.length};wn.prototype.remove=function(t){--this.length;if(t===this.head){this.head=this.head.next}if(t.next!==null){t.next.prev=t.prev;t.next=null}if(t.prev!==null){t.prev.next=t.next;t.prev=null}};wn.prototype.isEmpty=function(){return this.length===0};wn.prototype.dispose=function(){if(this.isEmpty()){return Promise.resolve()}var t=[];var n=this.head;this.head=null;this.length=0;while(n!==null){t.push(n.dispose());n=n.next}return Promise.all(t)};var gn=function(t,n){return bn(u,t,n)};var bn=function(t,n,e){return new xn(t,n,e)};var xn=function t(n,e,r){this.f=n;this.concurrency=e;this.source=r};xn.prototype.run=function t(n,e){return new Tn(this.f,this.concurrency,this.source,n,e)};var Tn=function t(n,e,r,i,s){this.f=n;this.concurrency=e;this.sink=i;this.scheduler=s;this.pending=[];this.current=new wn;this.disposable=rt(r.run(this,s));this.active=true};Tn.prototype.event=function t(n,e){this._addInner(n,e)};Tn.prototype._addInner=function t(n,e){if(this.current.length<this.concurrency){this._startInner(n,e)}else{this.pending.push(e)}};Tn.prototype._startInner=function t(n,e){try{this._initInner(n,e)}catch(t){this.error(n,t)}};Tn.prototype._initInner=function t(n,e){var r=new On(n,this,this.sink);r.disposable=An(this.f,n,e,r,this.scheduler);this.current.add(r)};Tn.prototype.end=function t(n){this.active=false;kt(n,this.disposable,this.sink);this._checkEnd(n)};Tn.prototype.error=function t(n,e){this.active=false;this.sink.error(n,e)};Tn.prototype.dispose=function t(){this.active=false;this.pending.length=0;this.disposable.dispose();this.current.dispose()};Tn.prototype._endInner=function t(n,e){this.current.remove(e);kt(n,e,this);if(this.pending.length===0){this._checkEnd(n)}else{this._startInner(n,this.pending.shift())}};Tn.prototype._checkEnd=function t(n){if(!this.active&&this.current.isEmpty()){this.sink.end(n)}};var An=function(t,n,e,r,i){return t(e).run(r,Y(n,i))};var On=function t(n,e,r){this.prev=this.next=null;this.time=n;this.outer=e;this.sink=r;this.disposable=void 0};On.prototype.event=function t(n,e){this.sink.event(n+this.time,e)};On.prototype.end=function t(n){this.outer._endInner(n+this.time,this)};On.prototype.error=function t(n,e){this.outer.error(n+this.time,e)};On.prototype.dispose=function t(){return this.disposable.dispose()};var jn=function(t,n){return bn(t,Infinity,n)};var In=function(t){return gn(Infinity,t)};var En=function(t,n){return bn(t,1,n)};function Cn(t,n){return Rn([t,n])}var Rn=function(t){return t.length===0?Z():t.length===1?t[0]:qn(t)};var qn=function(t){return new Nn(r(Mn,[],t))};var Mn=function(t,n){return t.concat(n instanceof Nn?n.sources:n)};var Nn=function t(n){this.sources=n};Nn.prototype.run=function t(n,e){var r=this;var i=this.sources.length;var s=new Array(i);var o=new Array(i);var u=new Bn(s,o,n);for(var c=void 0,h=0;h<i;++h){c=o[h]=new vn(h,u);s[h]=r.sources[h].run(c,e)}return ht(s)};var Bn=function(t){function n(n,e,r){t.call(this,r);this.disposables=n;this.activeCount=e.length}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(!e.active){this._dispose(n,e.index);return}this.sink.event(n,e.value)};n.prototype._dispose=function t(n,e){kt(n,this.disposables[e],this.sink);if(--this.activeCount===0){this.sink.end(n)}};return n}(Ct);var Sn=function(t,n,e){return new Pn(t,n,e)};var Pn=function t(n,e,r){this.source=r;this.sampler=e;this.f=n};Pn.prototype.run=function t(n,e){var r=new Vn(this.f,this.source,n);var i=this.source.run(r.hold,e);var s=this.sampler.run(r,e);return at(s,i)};var Vn=function(t){function n(n,e,r){t.call(this,r);this.source=e;this.f=n;this.hold=new Wn(this)}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(this.hold.hasValue){var r=this.f;this.sink.event(n,r(e,this.hold.value))}};return n}(Ct);var Wn=function(t){function n(n){t.call(this,n);this.hasValue=false}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){this.value=e;this.hasValue=true};n.prototype.end=function t(){};return n}(Ct);function Dn(t){this._capacity=t||32;this._length=0;this._head=0}Dn.prototype.push=function(t){var n=this._length;this._checkCapacity(n+1);var e=this._head+n&this._capacity-1;this[e]=t;this._length=n+1};Dn.prototype.shift=function(){var t=this._head;var n=this[t];this[t]=void 0;this._head=t+1&this._capacity-1;this._length--;return n};Dn.prototype.isEmpty=function(){return this._length===0};Dn.prototype.length=function(){return this._length};Dn.prototype._checkCapacity=function(t){if(this._capacity<t){this._ensureCapacity(this._capacity<<1)}};Dn.prototype._ensureCapacity=function(t){var n=this._capacity;this._capacity=t;var e=this._head+this._length;if(e>n){zn(this,0,this,n,e&n-1)}};function zn(t,n,e,r,i){for(var s=0;s<i;++s){e[s+r]=t[s+n];t[s+n]=void 0}}function Ln(t,n,e){return Fn(t,[n,e])}var Fn=function(t,n){return n.length===0?Z():n.length===1?cn(t,n[0]):new Gn(t,n)};var Gn=function t(n,e){this.f=n;this.sources=e};Gn.prototype.run=function t(n,e){var r=this;var i=this.sources.length;var s=new Array(i);var o=new Array(i);var u=new Array(i);var c=new Hn(this.f,u,o,n);for(var h=void 0,a=0;a<i;++a){u[a]=new Dn;h=o[a]=new vn(a,c);s[a]=r.sources[a].run(h,e)}return ht(s)};var Hn=function(t){function n(n,e,r,i){t.call(this,i);this.f=n;this.sinks=r;this.buffers=e}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(!e.active){this._dispose(n,e.index);return}var r=this.buffers;var i=r[e.index];i.push(e.value);if(i.length()===1){if(!Un(this.buffers)){return}Jn(this.f,n,r,this.sink);if(Qn(this.buffers,this.sinks)){this.sink.end(n)}}};n.prototype._dispose=function t(n,e){var r=this.buffers[e];if(r.isEmpty()){this.sink.end(n)}};return n}(Ct);var Jn=function(t,n,r,i){return i.event(n,ln(t,e(Kn,r)))};var Kn=function(t){return t.shift()};function Qn(t,n){for(var e=0,r=t.length;e<r;++e){if(t[e].isEmpty()&&!n[e].active){return true}}return false}function Un(t){for(var n=0,e=t.length;n<e;++n){if(t[n].isEmpty()){return false}}return true}var Xn=function(t){return new Yn(t)};var Yn=function t(n){this.source=n};Yn.prototype.run=function t(n,e){var r=new Zn(n,e);return at(r,this.source.run(r,e))};var Zn=function t(n,e){this.sink=n;this.scheduler=e;this.current=null;this.ended=false};Zn.prototype.event=function t(n,e){this._disposeCurrent(n);this.current=new $n(e,n,Infinity,this,this.sink,this.scheduler)};Zn.prototype.end=function t(n){this.ended=true;this._checkEnd(n)};Zn.prototype.error=function t(n,e){this.ended=true;this.sink.error(n,e)};Zn.prototype.dispose=function t(){return this._disposeCurrent(J(this.scheduler))};Zn.prototype._disposeCurrent=function t(n){if(this.current!==null){return this.current._dispose(n)}};Zn.prototype._disposeInner=function t(n,e){e._dispose(n);if(e===this.current){this.current=null}};Zn.prototype._checkEnd=function t(n){if(this.ended&&this.current===null){this.sink.end(n)}};Zn.prototype._endInner=function t(n,e){this._disposeInner(n,e);this._checkEnd(n)};Zn.prototype._errorInner=function t(n,e,r){this._disposeInner(n,r);this.sink.error(n,e)};var $n=function t(n,e,r,i,s,o){this.min=e;this.max=r;this.outer=i;this.sink=s;this.disposable=n.run(this,Y(e,o))};$n.prototype.event=function t(n,e){var r=Math.max(0,n+this.min);if(r<this.max){this.sink.event(r,e)}};$n.prototype.end=function t(n){this.outer._endInner(n+this.min,this)};$n.prototype.error=function t(n,e){this.outer._errorInner(n+this.min,e,this)};$n.prototype._dispose=function t(n){kt(n+this.min,this.disposable,this.sink)};var te=function(t,n){return tn.create(t,n)};var ne=function(t){return ee(se,t)};var ee=function(t,n){return new re(t,n)};var re=function t(n,e){this.equals=n;this.source=e};re.prototype.run=function t(n,e){return this.source.run(new ie(this.equals,n),e)};var ie=function(t){function n(n,e){t.call(this,e);this.equals=n;this.value=void 0;this.init=true}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(this.init){this.init=false;this.value=e;this.sink.event(n,e)}else if(!this.equals(this.value,e)){this.value=e;this.sink.event(n,e)}};return n}(Ct);function se(t,n){return t===n}var oe=function(t,n){return ce(0,t,n)};var ue=function(t,n){return ce(t,Infinity,n)};var ce=function(t,n,e){return n<=t?Z():he(t,n,e)};var he=function(t,n,e){return e instanceof on?ae(t,n,e):e instanceof fe?pe(t,n,e):new fe(t,n,e)};var ae=function(t,n,e){return on.create(e.f,he(t,n,e.source))};function pe(t,n,e){var r=t+e.min;var i=Math.min(n+e.min,e.max);return new fe(r,i,e.source)}var fe=function t(n,e,r){this.source=r;this.min=n;this.max=e};fe.prototype.run=function t(n,e){var r=new St;var i=new ve(this.min,this.max-this.min,n,r);r.setDisposable(this.source.run(i,e));return r};var ve=function(t){function n(n,e,r,i){t.call(this,r);this.skip=n;this.take=e;this.disposable=i}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(this.skip>0){this.skip-=1;return}if(this.take===0){return}this.take-=1;this.sink.event(n,e);if(this.take===0){this.disposable.dispose();this.sink.end(n)}};return n}(Ct);var le=function(t,n){return new de(t,n)};var de=function t(n,e){this.p=n;this.source=e};de.prototype.run=function t(n,e){var r=new St;var i=new ye(this.p,n,r);r.setDisposable(this.source.run(i,e));return r};var ye=function(t){function n(n,e,r){t.call(this,e);this.p=n;this.active=true;this.disposable=r}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(!this.active){return}var r=this.p;this.active=r(e);if(this.active){this.sink.event(n,e)}else{this.disposable.dispose();this.sink.end(n)}};return n}(Ct);var _e=function(t,n){return new ke(t,n)};var ke=function t(n,e){this.p=n;this.source=e};ke.prototype.run=function t(n,e){return this.source.run(new me(this.p,n),e)};var me=function(t){function n(n,e){t.call(this,e);this.p=n;this.skipping=true}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(this.skipping){var r=this.p;this.skipping=r(e);if(this.skipping){return}}this.sink.event(n,e)};return n}(Ct);var we=function(t,n){return new ge(t,n)};var ge=function t(n,e){this.p=n;this.source=e};ge.prototype.run=function t(n,e){return this.source.run(new be(this.p,n),e)};var be=function(t){function n(n,e){t.call(this,e);this.p=n;this.skipping=false}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(this.skipping){return}var r=this.p;this.skipping=r(e);this.sink.event(n,e);if(this.skipping){this.sink.end(n)}};return n}(Ct);var xe=function(t,n){return new Oe(t,n)};var Te=function(t,n){return new je(t,n)};var Ae=function(t,n){return xe(In(t),Te(t,n))};var Oe=function t(n,e){this.maxSignal=n;this.source=e};Oe.prototype.run=function t(n,e){var r=new Ie(-Infinity,n);var i=new Re(this.maxSignal,n,e);var s=this.source.run(new Ee(r,i,n),e);return ht([r,i,s])};var je=function t(n,e){this.minSignal=n;this.source=e};je.prototype.run=function t(n,e){var r=new Ce(this.minSignal,n,e);var i=new Ie(Infinity,n);var s=this.source.run(new Ee(r,i,n),e);return ht([r,i,s])};var Ie=function(t){function n(n,e){t.call(this,e);this.value=n}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(){};n.prototype.end=function t(){};n.prototype.dispose=function t(){};return n}(Ct);var Ee=function(t){function n(n,e,r){t.call(this,r);this.min=n;this.max=e}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(n>=this.min.value&&n<this.max.value){this.sink.event(n,e)}};return n}(Ct);var Ce=function(t){function n(n,e,r){t.call(this,e);this.value=Infinity;this.disposable=n.run(this,r)}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n){if(n<this.value){this.value=n}};n.prototype.end=function t(){};n.prototype.dispose=function t(){return this.disposable.dispose()};return n}(Ct);var Re=function(t){function n(n,e,r){t.call(this,e);this.value=Infinity;this.disposable=n.run(this,r)}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(n<this.value){this.value=n;this.sink.end(n)}};n.prototype.end=function t(){};n.prototype.dispose=function t(){return this.disposable.dispose()};return n}(Ct);var qe=function(t,n){return t<=0?n:new Me(t,n)};var Me=function t(n,e){this.dt=n;this.source=e};Me.prototype.run=function t(n,e){var r=new Ne(this.dt,n,e);return at(r,this.source.run(r,e))};var Ne=function(t){function n(n,e,r){t.call(this,e);this.dt=n;this.scheduler=r}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.dispose=function t(){var n=this;X(function(t){return t.sink===n.sink},this.scheduler)};n.prototype.event=function t(n,e){Q(this.dt,d(e,this.sink),this.scheduler)};n.prototype.end=function t(n){Q(this.dt,y(this.sink),this.scheduler)};return n}(Ct);var Be=function(t,n){return n instanceof on?Se(t,n):n instanceof Ve?Pe(t,n):new Ve(t,n)};var Se=function(t,n){return on.create(n.f,Be(t,n.source))};var Pe=function(t,n){return new Ve(Math.max(t,n.period),n.source)};var Ve=function t(n,e){this.period=n;this.source=e};Ve.prototype.run=function t(n,e){return this.source.run(new We(this.period,n),e)};var We=function(t){function n(n,e){t.call(this,e);this.time=0;this.period=n}if(t)n.__proto__=t;n.prototype=Object.create(t&&t.prototype);n.prototype.constructor=n;n.prototype.event=function t(n,e){if(n>=this.time){this.time=n+this.period;this.sink.event(n,e)}};return n}(Ct);var De=function(t,n){return new ze(t,n)};var ze=function t(n,e){this.dt=n;this.source=e};ze.prototype.run=function t(n,e){
return new Le(this.dt,this.source,n,e)};var Le=function t(n,e,r,i){this.dt=n;this.sink=r;this.scheduler=i;this.value=void 0;this.timer=null;this.disposable=e.run(this,i)};Le.prototype.event=function t(n,e){this._clearTimer();this.value=e;this.timer=Q(this.dt,d(e,this.sink),this.scheduler)};Le.prototype.end=function t(n){if(this._clearTimer()){this.sink.event(n,this.value);this.value=undefined}this.sink.end(n)};Le.prototype.error=function t(n,e){this._clearTimer();this.sink.error(n,e)};Le.prototype.dispose=function t(){this._clearTimer();this.disposable.dispose()};Le.prototype._clearTimer=function t(){if(this.timer===null){return false}this.timer.dispose();this.timer=null;return true};var Fe=function(t){return new He(t)};var Ge=c(Fe,At);var He=function t(n){this.source=n};He.prototype.run=function t(n,e){return this.source.run(new Je(n,e),e)};var Je=function t(n,e){var r=this;this.sink=n;this.scheduler=e;this.queue=Promise.resolve();this._eventBound=function(t){return r.sink.event(J(r.scheduler),t)};this._endBound=function(){return r.sink.end(J(r.scheduler))};this._errorBound=function(t){return r.sink.error(J(r.scheduler),t)}};Je.prototype.event=function t(n,e){var r=this;this.queue=this.queue.then(function(){return r._event(e)}).catch(this._errorBound)};Je.prototype.end=function t(n){this.queue=this.queue.then(this._endBound).catch(this._errorBound)};Je.prototype.error=function t(n,e){var r=this;this.queue=this.queue.then(function(){return r._errorBound(e)}).catch(f)};Je.prototype._event=function t(n){return n.then(this._eventBound)};function Ke(t){this.sink=t;this.active=true}Ke.prototype.event=function(t,n){if(!this.active){return}this.sink.event(t,n)};Ke.prototype.end=function(t,n){if(!this.active){return}this.disable();this.sink.end(t,n)};Ke.prototype.error=function(t,n){this.disable();this.sink.error(t,n)};Ke.prototype.disable=function(){this.active=false;return this.sink};function Qe(t,n,e){try{e.event(t,n)}catch(n){e.error(t,n)}}function Ue(t,n){try{n.end(t)}catch(e){n.error(t,e)}}var Xe=function(t,n){return new $e(t,n)};var Ye=function(t){return new Ze(t)};var Ze=function t(n){this.value=n};Ze.prototype.run=function t(n,e){return K(_(this.value,n),e)};var $e=function t(n,e){this.f=n;this.source=e};$e.prototype.run=function t(n,e){return new tr(this.f,this.source,n,e)};var tr=function t(n,e,r,i){this.f=n;this.sink=new Ke(r);this.scheduler=i;this.disposable=e.run(this,i)};tr.prototype.event=function t(n,e){Qe(n,e,this.sink)};tr.prototype.end=function t(n){Ue(n,this.sink)};tr.prototype.error=function t(n,e){var r=this.sink.disable();kt(n,this.disposable,this.sink);this._startNext(n,e,r)};tr.prototype._startNext=function t(n,e,r){try{this.disposable=this._continue(this.f,n,e,r)}catch(t){r.error(n,t)}};tr.prototype._continue=function t(n,e,r,i){return Qt(e,n(r),i,this.scheduler)};tr.prototype.dispose=function t(){return this.disposable.dispose()};var nr=function(t){return t instanceof er?t:new er(t)};var er=function t(n){this.source=new rr(n)};er.prototype.run=function t(n,e){return this.source.run(n,e)};var rr=function t(n){this.source=n;this.sinks=[];this.disposable=nt()};rr.prototype.run=function t(n,e){var r=this.add(n);if(r===1){this.disposable=this.source.run(this,e)}return rt(new ir(this,n))};rr.prototype.dispose=function t(){var n=this.disposable;this.disposable=nt();return n.dispose()};rr.prototype.add=function t(e){this.sinks=n(e,this.sinks);return this.sinks.length};rr.prototype.remove=function t(n){var e=o(n,this.sinks);if(e>=0){this.sinks=i(e,this.sinks)}return this.sinks.length};rr.prototype.event=function t(n,e){var r=this.sinks;if(r.length===1){return r[0].event(n,e)}for(var i=0;i<r.length;++i){Qe(n,e,r[i])}};rr.prototype.end=function t(n){var e=this.sinks;for(var r=0;r<e.length;++r){Ue(n,e[r])}};rr.prototype.error=function t(n,e){var r=this.sinks;for(var i=0;i<r.length;++i){r[i].error(n,e)}};var ir=function t(n,e){this.source=n;this.sink=e};ir.prototype.dispose=function t(){if(this.source.remove(this.sink)===0){this.source.dispose()}};var sr=p(qt);var or=a(Rt);var ur=a(Pt);var cr=p(zt);var hr=p(Gt);var ar=a($t);var pr=a(cn);var fr=a(hn);var vr=a(an);var lr=a(mn);var dr=a(jn);var yr=a(Xt);var _r=a(En);var kr=a(gn);var mr=p(bn);var wr=a(Cn);var gr=p(dn);var br=a(yn);var xr=p(Sn);var Tr=p(Ln);var Ar=a(Fn);var Or=a(te);var jr=a(ee);var Ir=a(oe);var Er=a(ue);var Cr=p(ce);var Rr=a(le);var qr=a(_e);var Mr=a(we);var Nr=a(xe);var Br=a(Te);var Sr=a(Ae);var Pr=a(qe);var Vr=a(Be);var Wr=a(De);var Dr=a(Xe);var zr=p(l);var Lr=a(d);var Fr=a(_);t.zipArrayValues=sr;t.withArrayValues=or;t.runEffects=ur;t.loop=cr;t.scan=hr;t.startWith=ar;t.map=pr;t.constant=fr;t.tap=vr;t.ap=lr;t.chain=dr;t.join=In;t.continueWith=yr;t.concatMap=_r;t.mergeConcurrently=kr;t.mergeMapConcurrently=mr;t.merge=wr;t.mergeArray=Rn;t.combine=gr;t.combineArray=br;t.sample=xr;t.zip=Tr;t.zipArray=Ar;t.filter=Or;t.skipRepeats=ne;t.skipRepeatsWith=jr;t.take=Ir;t.skip=Er;t.slice=Cr;t.takeWhile=Rr;t.skipWhile=qr;t.skipAfter=Mr;t.until=Nr;t.since=Br;t.during=Sr;t.delay=Pr;t.throttle=Vr;t.debounce=Wr;t.recoverWith=Dr;t.throwError=Ye;t.propagateTask=zr;t.propagateEventTask=Lr;t.propagateErrorTask=Fr;t.propagateEndTask=y;t.empty=Z;t.never=mt;t.now=At;t.at=bt;t.periodic=Ot;t.newStream=It;t.switchLatest=Xn;t.fromPromise=Ge;t.awaitPromises=Fe;t.multicast=nr;t.MulticastSource=rr;Object.defineProperty(t,"__esModule",{value:true})});
{
"name": "@most/core",
"version": "0.12.1",
"version": "0.13.0",
"description": "Reactive programming with lean, functions-only, curried, tree-shakeable API",

@@ -16,3 +16,3 @@ "typings": "type-definitions/most.d.ts",

"test:unit": "nyc --reporter=text-summary mocha -r buba/register --reporter dot --recursive 'test/**/*-test.js'",
"test:lint": "eslint --fix --ignore-path ../../.eslintignore src test",
"test:lint": "standard --fix 'src/**/*.js' 'test/**/*.js' --verbose | snazzy",
"test:flow": "flow check",

@@ -45,7 +45,4 @@ "build": "npm run build:dist && npm run build:min && npm run build:flow",

"@briancavalier/assert": "^3.2.0",
"@most/eslint-config-most": "^1.0.3",
"babel-eslint": "^7.1.1",
"buba": "^4.0.2",
"cpy-cli": "^1.0.1",
"eslint": "^3.15.0",
"flow-bin": "^0.53.1",

@@ -58,10 +55,18 @@ "mocha": "^3.4.2",

"sinon": "^1.17.7",
"snazzy": "^7.0.0",
"standard": "^10.0.3",
"uglify-js": "^2.7.5"
},
"dependencies": {
"@most/disposable": "^0.12.0",
"@most/prelude": "^1.6.3",
"@most/scheduler": "^0.12.0",
"@most/types": "^0.11.0"
"@most/disposable": "^0.13.0",
"@most/prelude": "^1.6.4",
"@most/scheduler": "^0.13.0",
"@most/types": "^0.11.1"
},
"standard": {
"ignore": [
"test/perf",
"test/flow"
]
}
}
import { Sink, Task } from '@most/types';
export function propagateTask<T>(run: PropagateTaskRun<T>, value: T, sink: Sink<T>): PropagateTask<T>;
export function propagateTask<T>(run: PropagateTaskRun<T>, value: T): (sink: Sink<T>) => PropagateTask<T>;
export function propagateTask<T>(run: PropagateTaskRun<T>): (value: T, sink: Sink<T>) => PropagateTask<T>;
export function propagateTask<T>(run: PropagateTaskRun<T>): (value: T) => (sink: Sink<T>) => PropagateTask<T>;
export function propagateTask<A, B = A>(run: PropagateTaskRun<A, B>, value: A, sink: Sink<B>): PropagateTask<A, B>;
export function propagateTask<A, B = A>(run: PropagateTaskRun<A, B>, value: A): (sink: Sink<B>) => PropagateTask<A, B>;
export function propagateTask<A, B = A>(run: PropagateTaskRun<A, B>): (value: A, sink: Sink<B>) => PropagateTask<A, B>;
export function propagateTask<A, B = A>(run: PropagateTaskRun<A, B>): (value: A) => (sink: Sink<B>) => PropagateTask<A, B>;

@@ -16,9 +16,9 @@ export function propagateEventTask<T>(value: T, sink: Sink<T>): PropagateTask<T>;

export type PropagateTaskRun<A> =
(time: number, value: A, sink: Sink<A>) => any
export type PropagateTaskRun<A, B = A> =
(time: number, value: A, sink: Sink<B>) => any
export interface PropagateTask<A> extends Task {
export interface PropagateTask<A, B = A> extends Task {
value: A;
sink: Sink<A>;
sink: Sink<B>;
active: boolean;
}
}

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc