Skip to content

Instantly share code, notes, and snippets.

@foxdonut
Created February 10, 2016 13:38
Show Gist options
  • Save foxdonut/badbe24c465c817c5373 to your computer and use it in GitHub Desktop.
Save foxdonut/badbe24c465c817c5373 to your computer and use it in GitHub Desktop.
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var most = require("most");
var h = require("virtual-dom/h");
var diff = require("virtual-dom/diff");
var patch = require("virtual-dom/patch");
var createElement = require("virtual-dom/create-element");
var match = function(query) {
return function(evt) {
return evt.target.matches(query);
};
};
var render = function(element, vtree$) {
vtree$
.scan(function(tree, newTree) {
return tree ? diff(tree, newTree) : newTree;
})
.scan((function(container) {
return function(rootNode, nextDiff) {
if (rootNode) {
rootNode = patch(rootNode, nextDiff);
}
else if (nextDiff) {
rootNode = createElement(nextDiff);
container.appendChild(rootNode);
}
return rootNode;
};
})(element))
.drain();
};
var view = function(count) {
return h("div", [
h("div", "Count: " + String(count)),
h("button.myButton", "Click me")]);
};
var appNode = document.getElementById("app");
var add$ = most.fromEvent("click", appNode)
.filter(match("button.myButton"))
.map(function() { return 1; });
var model$ = add$
.scan(function(count, inc) {
return count + inc;
}, 0)
.startWith(0);
var view$ = model$.map(view);
render(appNode, view$);
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){module.exports=LinkedList;function LinkedList(){this.head=null;this.length=0}LinkedList.prototype.add=function(x){if(this.head!==null){this.head.prev=x;x.next=this.head}this.head=x;++this.length};LinkedList.prototype.remove=function(x){--this.length;if(x===this.head){this.head=this.head.next}if(x.next!==null){x.next.prev=x.prev;x.next=null}if(x.prev!==null){x.prev.next=x.next;x.prev=null}};LinkedList.prototype.isEmpty=function(){return this.length===0};LinkedList.prototype.dispose=function(){if(this.isEmpty()){return Promise.resolve()}var promises=[];var x=this.head;this.head=null;this.length=0;while(x!==null){promises.push(x.dispose());x=x.next}return Promise.all(promises)}},{}],2:[function(require,module,exports){exports.isPromise=isPromise;function isPromise(p){return p!==null&&typeof p==="object"&&typeof p.then==="function"}},{}],3:[function(require,module,exports){module.exports=Queue;function Queue(capPow2){this._capacity=capPow2||32;this._length=0;this._head=0}Queue.prototype.push=function(x){var len=this._length;this._checkCapacity(len+1);var i=this._head+len&this._capacity-1;this[i]=x;this._length=len+1};Queue.prototype.shift=function(){var head=this._head;var x=this[head];this[head]=void 0;this._head=head+1&this._capacity-1;this._length--;return x};Queue.prototype.isEmpty=function(){return this._length===0};Queue.prototype.length=function(){return this._length};Queue.prototype._checkCapacity=function(size){if(this._capacity<size){this._ensureCapacity(this._capacity<<1)}};Queue.prototype._ensureCapacity=function(capacity){var oldCapacity=this._capacity;this._capacity=capacity;var last=this._head+this._length;if(last>oldCapacity){copy(this,0,this,oldCapacity,last&oldCapacity-1)}};function copy(src,srcIndex,dst,dstIndex,len){for(var j=0;j<len;++j){dst[j+dstIndex]=src[j+srcIndex];src[j+srcIndex]=void 0}}},{}],4:[function(require,module,exports){module.exports=Stream;function Stream(source){this.source=source}},{}],5:[function(require,module,exports){exports.noop=noop;exports.identity=identity;exports.compose=compose;exports.apply=apply;exports.cons=cons;exports.append=append;exports.drop=drop;exports.tail=tail;exports.copy=copy;exports.map=map;exports.reduce=reduce;exports.replace=replace;exports.remove=remove;exports.removeAll=removeAll;exports.findIndex=findIndex;exports.isArrayLike=isArrayLike;function noop(){}function identity(x){return x}function compose(f,g){return function(x){return f(g(x))}}function apply(f,x){return f(x)}function cons(x,array){var l=array.length;var a=new Array(l+1);a[0]=x;for(var i=0;i<l;++i){a[i+1]=array[i]}return a}function append(x,a){var l=a.length;var b=new Array(l+1);for(var i=0;i<l;++i){b[i]=a[i]}b[l]=x;return b}function drop(n,array){var l=array.length;if(n>=l){return[]}l-=n;var a=new Array(l);for(var i=0;i<l;++i){a[i]=array[n+i]}return a}function tail(array){return drop(1,array)}function copy(array){var l=array.length;var a=new Array(l);for(var i=0;i<l;++i){a[i]=array[i]}return a}function map(f,array){var l=array.length;var a=new Array(l);for(var i=0;i<l;++i){a[i]=f(array[i])}return a}function reduce(f,z,array){var r=z;for(var i=0,l=array.length;i<l;++i){r=f(r,array[i],i)}return r}function replace(x,i,array){var l=array.length;var a=new Array(l);for(var j=0;j<l;++j){a[j]=i===j?x:array[j]}return a}function remove(index,array){var l=array.length;if(l===0||index>=array){return array}if(l===1){return[]}return unsafeRemove(index,array,l-1)}function unsafeRemove(index,a,l){var b=new Array(l);var i;for(i=0;i<index;++i){b[i]=a[i]}for(i=index;i<l;++i){b[i]=a[i+1]}return b}function removeAll(f,a){var l=a.length;var b=new Array(l);for(var x,i=0,j=0;i<l;++i){x=a[i];if(!f(x)){b[j]=x;++j}}b.length=j;return b}function findIndex(x,a){for(var i=0,l=a.length;i<l;++i){if(x===a[i]){return i}}return-1}function isArrayLike(x){return x!=null&&typeof x.length==="number"&&typeof x!=="function"}},{}],6:[function(require,module,exports){var Stream=require("../Stream");var Pipe=require("../sink/Pipe");var runSource=require("../runSource");var cons=require("./build").cons;var noop=require("../base").noop;exports.scan=scan;exports.reduce=reduce;function scan(f,initial,stream){return cons(initial,new Stream(new Accumulate(ScanSink,f,initial,stream.source)))}function ScanSink(f,z,sink){this.f=f;this.value=z;this.sink=sink}ScanSink.prototype.event=function(t,x){var f=this.f;this.value=f(this.value,x);this.sink.event(t,this.value)};ScanSink.prototype.error=Pipe.prototype.error;ScanSink.prototype.end=Pipe.prototype.end;function reduce(f,initial,stream){return runSource.withDefaultScheduler(noop,new Accumulate(AccumulateSink,f,initial,stream.source))}function Accumulate(SinkType,f,z,source){this.SinkType=SinkType;this.f=f;this.value=z;this.source=source}Accumulate.prototype.run=function(sink,scheduler){return this.source.run(new this.SinkType(this.f,this.value,sink),scheduler)};function AccumulateSink(f,z,sink){this.f=f;this.value=z;this.sink=sink}AccumulateSink.prototype.event=function(t,x){var f=this.f;this.value=f(this.value,x);this.sink.event(t,this.value)};AccumulateSink.prototype.error=Pipe.prototype.error;AccumulateSink.prototype.end=function(t){this.sink.end(t,this.value)}},{"../Stream":4,"../base":5,"../runSource":41,"../sink/Pipe":50,"./build":8}],7:[function(require,module,exports){var combine=require("./combine").combine;var apply=require("../base").apply;exports.ap=ap;function ap(fs,xs){return combine(apply,fs,xs)}},{"../base":5,"./combine":9}],8:[function(require,module,exports){var streamOf=require("../source/core").of;var continueWith=require("./continueWith").continueWith;exports.concat=concat;exports.cycle=cycle;exports.cons=cons;function cons(x,stream){return concat(streamOf(x),stream)}function concat(left,right){return continueWith(function(){return right},left)}function cycle(stream){return continueWith(function cycleNext(){return cycle(stream)},stream)}},{"../source/core":55,"./continueWith":11}],9:[function(require,module,exports){var Stream=require("../Stream");var transform=require("./transform");var core=require("../source/core");var Pipe=require("../sink/Pipe");var IndexSink=require("../sink/IndexSink");var mergeSources=require("./merge").mergeSources;var dispose=require("../disposable/dispose");var base=require("../base");var invoke=require("../invoke");var hasValue=IndexSink.hasValue;var tail=base.tail;exports.combineArray=combineArray;exports.combine=combine;function combine(f){return combineArray(f,tail(arguments))}function combineArray(f,streams){var l=streams.length;return l===0?core.empty():l===1?transform.map(f,streams[0]):new Stream(mergeSources(CombineSink,f,streams))}function CombineSink(disposables,sinks,sink,f){this.sink=sink;this.disposables=disposables;this.sinks=sinks;this.f=f;this.values=new Array(sinks.length);this.ready=false;this.activeCount=sinks.length}CombineSink.prototype.error=Pipe.prototype.error;CombineSink.prototype.event=function(t,indexedValue){if(!this.ready){this.ready=this.sinks.every(hasValue)}this.values[indexedValue.index]=indexedValue.value;if(this.ready){this.sink.event(t,invoke(this.f,this.values))}};CombineSink.prototype.end=function(t,indexedValue){dispose.tryDispose(t,this.disposables[indexedValue.index],this.sink);if(--this.activeCount===0){this.sink.end(t,indexedValue.value)}}},{"../Stream":4,"../base":5,"../disposable/dispose":34,"../invoke":39,"../sink/IndexSink":48,"../sink/Pipe":50,"../source/core":55,"./merge":18,"./transform":29}],10:[function(require,module,exports){var mergeConcurrently=require("./mergeConcurrently").mergeConcurrently;var map=require("./transform").map;exports.concatMap=concatMap;function concatMap(f,stream){return mergeConcurrently(1,map(f,stream))}},{"./mergeConcurrently":19,"./transform":29}],11:[function(require,module,exports){var Stream=require("../Stream");var Sink=require("../sink/Pipe");var dispose=require("../disposable/dispose");var isPromise=require("../Promise").isPromise;exports.continueWith=continueWith;function continueWith(f,stream){return new Stream(new ContinueWith(f,stream.source))}function ContinueWith(f,source){this.f=f;this.source=source}ContinueWith.prototype.run=function(sink,scheduler){return new ContinueWithSink(this.f,this.source,sink,scheduler)};function ContinueWithSink(f,source,sink,scheduler){this.f=f;this.sink=sink;this.scheduler=scheduler;this.active=true;this.disposable=dispose.once(source.run(this,scheduler))}ContinueWithSink.prototype.error=Sink.prototype.error;ContinueWithSink.prototype.event=function(t,x){if(!this.active){return}this.sink.event(t,x)};ContinueWithSink.prototype.end=function(t,x){if(!this.active){return}var result=dispose.tryDispose(t,this.disposable,this.sink);this.disposable=isPromise(result)?dispose.promised(this._thenContinue(result,x)):this._continue(this.f,x)};ContinueWithSink.prototype._thenContinue=function(p,x){var self=this;return p.then(function(){return self._continue(self.f,x)})};ContinueWithSink.prototype._continue=function(f,x){return f(x).source.run(this.sink,this.scheduler)};ContinueWithSink.prototype.dispose=function(){this.active=false;return this.disposable.dispose()}},{"../Promise":2,"../Stream":4,"../disposable/dispose":34,"../sink/Pipe":50}],12:[function(require,module,exports){var Stream=require("../Stream");var Sink=require("../sink/Pipe");var dispose=require("../disposable/dispose");var PropagateTask=require("../scheduler/PropagateTask");exports.delay=delay;function delay(delayTime,stream){return delayTime<=0?stream:new Stream(new Delay(delayTime,stream.source))}function Delay(dt,source){this.dt=dt;this.source=source}Delay.prototype.run=function(sink,scheduler){var delaySink=new DelaySink(this.dt,sink,scheduler);return dispose.all([delaySink,this.source.run(delaySink,scheduler)])};function DelaySink(dt,sink,scheduler){this.dt=dt;this.sink=sink;this.scheduler=scheduler}DelaySink.prototype.dispose=function(){var self=this;this.scheduler.cancelAll(function(task){return task.sink===self.sink})};DelaySink.prototype.event=function(t,x){this.scheduler.delay(this.dt,PropagateTask.event(x,this.sink))};DelaySink.prototype.end=function(t,x){this.scheduler.delay(this.dt,PropagateTask.end(x,this.sink))};DelaySink.prototype.error=Sink.prototype.error},{"../Stream":4,"../disposable/dispose":34,"../scheduler/PropagateTask":42,"../sink/Pipe":50}],13:[function(require,module,exports){var Stream=require("../Stream");var ValueSource=require("../source/ValueSource");var tryDispose=require("../disposable/dispose").tryDispose;var tryEvent=require("../source/tryEvent");var apply=require("../base").apply;exports.flatMapError=recoverWith;exports.recoverWith=recoverWith;exports.throwError=throwError;function recoverWith(f,stream){return new Stream(new RecoverWith(f,stream.source))}function throwError(e){return new Stream(new ValueSource(error,e))}function error(t,e,sink){sink.error(t,e)}function RecoverWith(f,source){this.f=f;this.source=source}RecoverWith.prototype.run=function(sink,scheduler){return new RecoverWithSink(this.f,this.source,sink,scheduler)};function RecoverWithSink(f,source,sink,scheduler){this.f=f;this.sink=sink;this.scheduler=scheduler;this.active=true;this.disposable=source.run(this,scheduler)}RecoverWithSink.prototype.error=function(t,e){if(!this.active){return}tryDispose(t,this.disposable,this);var stream=apply(this.f,e);this.disposable=stream.source.run(this.sink,this.scheduler)};RecoverWithSink.prototype.event=function(t,x){if(!this.active){return}tryEvent.tryEvent(t,x,this.sink)};RecoverWithSink.prototype.end=function(t,x){if(!this.active){return}tryEvent.tryEnd(t,x,this.sink)};RecoverWithSink.prototype.dispose=function(){this.active=false;return this.disposable.dispose()}},{"../Stream":4,"../base":5,"../disposable/dispose":34,"../source/ValueSource":54,"../source/tryEvent":64}],14:[function(require,module,exports){var Stream=require("../Stream");var Sink=require("../sink/Pipe");var Filter=require("../fusion/Filter");exports.filter=filter;exports.skipRepeats=skipRepeats;exports.skipRepeatsWith=skipRepeatsWith;function filter(p,stream){return new Stream(Filter.create(p,stream.source))}function skipRepeats(stream){return skipRepeatsWith(same,stream)}function skipRepeatsWith(equals,stream){return new Stream(new SkipRepeats(equals,stream.source))}function SkipRepeats(equals,source){this.equals=equals;this.source=source}SkipRepeats.prototype.run=function(sink,scheduler){return this.source.run(new SkipRepeatsSink(this.equals,sink),scheduler)};function SkipRepeatsSink(equals,sink){this.equals=equals;this.sink=sink;this.value=void 0;this.init=true}SkipRepeatsSink.prototype.end=Sink.prototype.end;SkipRepeatsSink.prototype.error=Sink.prototype.error;SkipRepeatsSink.prototype.event=function(t,x){if(this.init){this.init=false;this.value=x;this.sink.event(t,x)}else if(!this.equals(this.value,x)){this.value=x;this.sink.event(t,x)}};function same(a,b){return a===b}},{"../Stream":4,"../fusion/Filter":36,"../sink/Pipe":50}],15:[function(require,module,exports){var mergeConcurrently=require("./mergeConcurrently").mergeConcurrently;var map=require("./transform").map;exports.flatMap=flatMap;exports.join=join;function flatMap(f,stream){return join(map(f,stream))}function join(stream){return mergeConcurrently(Infinity,stream)}},{"./mergeConcurrently":19,"./transform":29}],16:[function(require,module,exports){var Stream=require("../Stream");var Sink=require("../sink/Pipe");var dispose=require("../disposable/dispose");var PropagateTask=require("../scheduler/PropagateTask");exports.throttle=throttle;exports.debounce=debounce;function throttle(period,stream){return new Stream(new Throttle(period,stream.source))}function Throttle(period,source){this.dt=period;this.source=source}Throttle.prototype.run=function(sink,scheduler){return this.source.run(new ThrottleSink(this.dt,sink),scheduler)};function ThrottleSink(dt,sink){this.time=0;this.dt=dt;this.sink=sink}ThrottleSink.prototype.event=function(t,x){if(t>=this.time){this.time=t+this.dt;this.sink.event(t,x)}};ThrottleSink.prototype.end=Sink.prototype.end;ThrottleSink.prototype.error=Sink.prototype.error;function debounce(period,stream){return new Stream(new Debounce(period,stream.source))}function Debounce(dt,source){this.dt=dt;this.source=source}Debounce.prototype.run=function(sink,scheduler){return new DebounceSink(this.dt,this.source,sink,scheduler)};function DebounceSink(dt,source,sink,scheduler){this.dt=dt;this.sink=sink;this.scheduler=scheduler;this.value=void 0;this.timer=null;var sourceDisposable=source.run(this,scheduler);this.disposable=dispose.all([this,sourceDisposable])}DebounceSink.prototype.event=function(t,x){this._clearTimer();this.value=x;this.timer=this.scheduler.delay(this.dt,PropagateTask.event(x,this.sink))};DebounceSink.prototype.end=function(t,x){if(this._clearTimer()){this.sink.event(t,this.value);this.value=void 0}this.sink.end(t,x)};DebounceSink.prototype.error=function(t,x){this._clearTimer();this.sink.error(t,x)};DebounceSink.prototype.dispose=function(){this._clearTimer()};DebounceSink.prototype._clearTimer=function(){if(this.timer===null){return false}this.timer.cancel();this.timer=null;return true}},{"../Stream":4,"../disposable/dispose":34,"../scheduler/PropagateTask":42,"../sink/Pipe":50}],17:[function(require,module,exports){var Stream=require("../Stream");var Pipe=require("../sink/Pipe");exports.loop=loop;function loop(stepper,seed,stream){return new Stream(new Loop(stepper,seed,stream.source))}function Loop(stepper,seed,source){this.step=stepper;this.seed=seed;this.source=source}Loop.prototype.run=function(sink,scheduler){return this.source.run(new LoopSink(this.step,this.seed,sink),scheduler)};function LoopSink(stepper,seed,sink){this.step=stepper;this.seed=seed;this.sink=sink}LoopSink.prototype.error=Pipe.prototype.error;LoopSink.prototype.event=function(t,x){var result=this.step(this.seed,x);this.seed=result.seed;this.sink.event(t,result.value)};LoopSink.prototype.end=function(t){this.sink.end(t,this.seed)}},{"../Stream":4,"../sink/Pipe":50}],18:[function(require,module,exports){var Stream=require("../Stream");var Pipe=require("../sink/Pipe");var IndexSink=require("../sink/IndexSink");var empty=require("../source/core").empty;var dispose=require("../disposable/dispose");var base=require("../base");var copy=base.copy;var map=base.map;exports.merge=merge;exports.mergeArray=mergeArray;exports.mergeSources=mergeSources;function merge(){return mergeArray(copy(arguments))}function mergeArray(streams){var l=streams.length;return l===0?empty():l===1?streams[0]:new Stream(mergeSources(MergeSink,void 0,streams))}function mergeSources(Sink,arg,streams){return new Merge(Sink,arg,map(getSource,streams))}function getSource(stream){return stream.source}function Merge(Sink,arg,sources){this.Sink=Sink;this.arg=arg;this.sources=sources}Merge.prototype.run=function(sink,scheduler){var l=this.sources.length;var disposables=new Array(l);var sinks=new Array(l);var mergeSink=new this.Sink(disposables,sinks,sink,this.arg);for(var indexSink,i=0;i<l;++i){indexSink=sinks[i]=new IndexSink(i,mergeSink);disposables[i]=this.sources[i].run(indexSink,scheduler)}return dispose.all(disposables)};function MergeSink(disposables,sinks,sink){this.sink=sink;this.disposables=disposables;this.activeCount=sinks.length}MergeSink.prototype.error=Pipe.prototype.error;MergeSink.prototype.event=function(t,indexValue){this.sink.event(t,indexValue.value)};MergeSink.prototype.end=function(t,indexedValue){dispose.tryDispose(t,this.disposables[indexedValue.index],this.sink);if(--this.activeCount===0){this.sink.end(t,indexedValue.value)}}},{"../Stream":4,"../base":5,"../disposable/dispose":34,"../sink/IndexSink":48,"../sink/Pipe":50,"../source/core":55}],19:[function(require,module,exports){var Stream=require("../Stream");var dispose=require("../disposable/dispose");var LinkedList=require("../LinkedList");exports.mergeConcurrently=mergeConcurrently;function mergeConcurrently(concurrency,stream){return new Stream(new MergeConcurrently(concurrency,stream.source))}function MergeConcurrently(concurrency,source){this.concurrency=concurrency;this.source=source}MergeConcurrently.prototype.run=function(sink,scheduler){return new Outer(this.concurrency,this.source,sink,scheduler)};function Outer(concurrency,source,sink,scheduler){this.concurrency=concurrency;this.sink=sink;this.scheduler=scheduler;this.pending=[];this.current=new LinkedList;this.disposable=dispose.once(source.run(this,scheduler));this.active=true}Outer.prototype.event=function(t,x){this._addInner(t,x)};Outer.prototype._addInner=function(t,stream){if(this.current.length<this.concurrency){this._startInner(t,stream)}else{this.pending.push(stream)}};Outer.prototype._startInner=function(t,stream){var innerSink=new Inner(t,this,this.sink);this.current.add(innerSink);innerSink.disposable=stream.source.run(innerSink,this.scheduler)};Outer.prototype.end=function(t,x){this.active=false;this.disposable.dispose();this._checkEnd(t,x)};Outer.prototype.error=function(t,e){this.active=false;this.sink.error(t,e)};Outer.prototype.dispose=function(){this.active=false;this.pending.length=0;return Promise.all([this.disposable.dispose(),this.current.dispose()])};Outer.prototype._endInner=function(t,x,inner){this.current.remove(inner);dispose.tryDispose(t,inner,this);if(this.pending.length===0){this._checkEnd(t,x)}else{this._startInner(t,this.pending.shift())}};Outer.prototype._checkEnd=function(t,x){if(!this.active&&this.current.isEmpty()){this.sink.end(t,x)}};function Inner(time,outer,sink){this.prev=this.next=null;this.time=time;this.outer=outer;this.sink=sink;this.disposable=void 0}Inner.prototype.event=function(t,x){this.sink.event(Math.max(t,this.time),x)};Inner.prototype.end=function(t,x){this.outer._endInner(Math.max(t,this.time),x,this)};Inner.prototype.error=function(t,e){this.outer.error(Math.max(t,this.time),e)};Inner.prototype.dispose=function(){return this.disposable.dispose()}},{"../LinkedList":1,"../Stream":4,"../disposable/dispose":34}],20:[function(require,module,exports){var Stream=require("../Stream");var MulticastSource=require("../source/MulticastSource");exports.multicast=multicast;function multicast(stream){var source=stream.source;return source instanceof MulticastSource?stream:new Stream(new MulticastSource(source))}},{"../Stream":4,"../source/MulticastSource":53}],21:[function(require,module,exports){var runSource=require("../runSource");var noop=require("../base").noop;exports.observe=observe;exports.drain=drain;function observe(f,stream){return runSource.withDefaultScheduler(f,stream.source)}function drain(stream){return runSource.withDefaultScheduler(noop,stream.source)}},{"../base":5,"../runSource":41}],22:[function(require,module,exports){var Stream=require("../Stream");var fatal=require("../fatalError");exports.fromPromise=fromPromise;exports.awaitPromises=awaitPromises;function fromPromise(p){return new Stream(new PromiseSource(p))}function PromiseSource(p){this.promise=p}PromiseSource.prototype.run=function(sink,scheduler){return new PromiseProducer(this.promise,sink,scheduler)};function PromiseProducer(p,sink,scheduler){this.sink=sink;this.scheduler=scheduler;this.active=true;var self=this;Promise.resolve(p).then(function(x){self._emit(self.scheduler.now(),x)}).catch(function(e){self._error(self.scheduler.now(),e)})}PromiseProducer.prototype._emit=function(t,x){if(!this.active){return}this.sink.event(t,x);this.sink.end(t,void 0)};PromiseProducer.prototype._error=function(t,e){if(!this.active){return}this.sink.error(t,e)};PromiseProducer.prototype.dispose=function(){this.active=false};function awaitPromises(stream){return new Stream(new Await(stream.source))}function Await(source){this.source=source}Await.prototype.run=function(sink,scheduler){return this.source.run(new AwaitSink(sink,scheduler),scheduler)};function AwaitSink(sink,scheduler){this.sink=sink;this.scheduler=scheduler;this.queue=Promise.resolve();var self=this;this._eventBound=function(x){self.sink.event(self.scheduler.now(),x)};this._endBound=function(x){self.sink.end(self.scheduler.now(),x)};this._errorBound=function(e){self.sink.error(self.scheduler.now(),e)}}AwaitSink.prototype.event=function(t,promise){var self=this;this.queue=this.queue.then(function(){return self._event(promise)}).catch(this._errorBound)};AwaitSink.prototype.end=function(t,x){var self=this;this.queue=this.queue.then(function(){return self._end(x)}).catch(this._errorBound)};AwaitSink.prototype.error=function(t,e){var self=this;this.queue=this.queue.then(function(){return self._errorBound(e)}).catch(fatal)};AwaitSink.prototype._event=function(promise){return promise.then(this._eventBound)};AwaitSink.prototype._end=function(x){return Promise.resolve(x).then(this._endBound)}},{"../Stream":4,"../fatalError":35}],23:[function(require,module,exports){var Stream=require("../Stream");var Pipe=require("../sink/Pipe");var dispose=require("../disposable/dispose");var base=require("../base");var invoke=require("../invoke");exports.sample=sample;exports.sampleWith=sampleWith;exports.sampleArray=sampleArray;function sample(f,sampler){return sampleArray(f,sampler,base.drop(2,arguments))}function sampleWith(sampler,stream){return new Stream(new Sampler(base.identity,sampler.source,[stream.source]))}function sampleArray(f,sampler,streams){return new Stream(new Sampler(f,sampler.source,base.map(getSource,streams)))}function getSource(stream){return stream.source}function Sampler(f,sampler,sources){this.f=f;this.sampler=sampler;this.sources=sources}Sampler.prototype.run=function(sink,scheduler){var l=this.sources.length;var disposables=new Array(l+1);var sinks=new Array(l);var sampleSink=new SampleSink(this.f,sinks,sink);for(var hold,i=0;i<l;++i){hold=sinks[i]=new Hold(sampleSink);disposables[i]=this.sources[i].run(hold,scheduler)}disposables[i]=this.sampler.run(sampleSink,scheduler);return dispose.all(disposables)};function Hold(sink){this.sink=sink;this.hasValue=false}Hold.prototype.event=function(t,x){this.value=x;this.hasValue=true;this.sink._notify(this)};Hold.prototype.end=base.noop;Hold.prototype.error=Pipe.prototype.error;function SampleSink(f,sinks,sink){this.f=f;this.sinks=sinks;this.sink=sink;this.active=false}SampleSink.prototype._notify=function(){if(!this.active){this.active=this.sinks.every(hasValue)}};SampleSink.prototype.event=function(t){if(this.active){this.sink.event(t,invoke(this.f,base.map(getValue,this.sinks)))}};SampleSink.prototype.end=Pipe.prototype.end;SampleSink.prototype.error=Pipe.prototype.error;function hasValue(hold){return hold.hasValue}function getValue(hold){return hold.value}},{"../Stream":4,"../base":5,"../disposable/dispose":34,"../invoke":39,"../sink/Pipe":50}],24:[function(require,module,exports){var Stream=require("../Stream");var Sink=require("../sink/Pipe");var core=require("../source/core");var dispose=require("../disposable/dispose");exports.take=take;exports.skip=skip;exports.slice=slice;exports.takeWhile=takeWhile;exports.skipWhile=skipWhile;function take(n,stream){return slice(0,n,stream)}function skip(n,stream){return slice(n,Infinity,stream)}function slice(start,end,stream){return end<=start?core.empty():new Stream(new Slice(start,end,stream.source))}function Slice(min,max,source){this.skip=min;this.take=max-min;this.source=source}Slice.prototype.run=function(sink,scheduler){return new SliceSink(this.skip,this.take,this.source,sink,scheduler)};function SliceSink(skip,take,source,sink,scheduler){this.skip=skip;this.take=take;this.sink=sink;this.disposable=dispose.once(source.run(this,scheduler))}SliceSink.prototype.end=Sink.prototype.end;SliceSink.prototype.error=Sink.prototype.error;SliceSink.prototype.event=function(t,x){if(this.skip>0){this.skip-=1;return}if(this.take===0){return}this.take-=1;this.sink.event(t,x);if(this.take===0){this.dispose();this.sink.end(t,x)}};SliceSink.prototype.dispose=function(){return this.disposable.dispose()};function takeWhile(p,stream){return new Stream(new TakeWhile(p,stream.source))}function TakeWhile(p,source){this.p=p;this.source=source}TakeWhile.prototype.run=function(sink,scheduler){return new TakeWhileSink(this.p,this.source,sink,scheduler)};function TakeWhileSink(p,source,sink,scheduler){this.p=p;this.sink=sink;this.active=true;this.disposable=dispose.once(source.run(this,scheduler))}TakeWhileSink.prototype.end=Sink.prototype.end;TakeWhileSink.prototype.error=Sink.prototype.error;TakeWhileSink.prototype.event=function(t,x){if(!this.active){return}var p=this.p;this.active=p(x);if(this.active){this.sink.event(t,x)}else{this.dispose();this.sink.end(t,x)}};TakeWhileSink.prototype.dispose=function(){return this.disposable.dispose()};function skipWhile(p,stream){return new Stream(new SkipWhile(p,stream.source))}function SkipWhile(p,source){this.p=p;this.source=source}SkipWhile.prototype.run=function(sink,scheduler){return this.source.run(new SkipWhileSink(this.p,sink),scheduler)};function SkipWhileSink(p,sink){this.p=p;this.sink=sink;this.skipping=true}SkipWhileSink.prototype.end=Sink.prototype.end;SkipWhileSink.prototype.error=Sink.prototype.error;SkipWhileSink.prototype.event=function(t,x){if(this.skipping){var p=this.p;this.skipping=p(x);if(this.skipping){return}}this.sink.event(t,x)}},{"../Stream":4,"../disposable/dispose":34,"../sink/Pipe":50,"../source/core":55}],25:[function(require,module,exports){var Stream=require("../Stream");var MulticastSource=require("../source/MulticastSource");var until=require("./timeslice").takeUntil;var mergeConcurrently=require("./mergeConcurrently").mergeConcurrently;var map=require("./transform").map;exports.switch=switchLatest;function switchLatest(stream){var upstream=new Stream(new MulticastSource(stream.source));return mergeConcurrently(1,map(untilNext,upstream));function untilNext(s){return until(upstream,s)}}},{"../Stream":4,"../source/MulticastSource":53,"./mergeConcurrently":19,"./timeslice":26,"./transform":29}],26:[function(require,module,exports){var Stream=require("../Stream");var Pipe=require("../sink/Pipe");var dispose=require("../disposable/dispose");var join=require("../combinator/flatMap").join;var noop=require("../base").noop;exports.during=during;exports.takeUntil=takeUntil;exports.skipUntil=skipUntil;function takeUntil(signal,stream){return new Stream(new Until(signal.source,stream.source))}function skipUntil(signal,stream){return new Stream(new Since(signal.source,stream.source))}function during(timeWindow,stream){return takeUntil(join(timeWindow),skipUntil(timeWindow,stream))}function Until(maxSignal,source){this.maxSignal=maxSignal;this.source=source}Until.prototype.run=function(sink,scheduler){var min=new Bound(-Infinity,sink);var max=new UpperBound(this.maxSignal,sink,scheduler);var disposable=this.source.run(new TimeWindowSink(min,max,sink),scheduler);return dispose.all([min,max,disposable])};function Since(minSignal,source){this.minSignal=minSignal;this.source=source}Since.prototype.run=function(sink,scheduler){var min=new LowerBound(this.minSignal,sink,scheduler);var max=new Bound(Infinity,sink);var disposable=this.source.run(new TimeWindowSink(min,max,sink),scheduler);return dispose.all([min,max,disposable])};function Bound(value,sink){this.value=value;this.sink=sink}Bound.prototype.error=Pipe.prototype.error;Bound.prototype.event=noop;Bound.prototype.end=noop;Bound.prototype.dispose=noop;function TimeWindowSink(min,max,sink){this.min=min;this.max=max;this.sink=sink}TimeWindowSink.prototype.event=function(t,x){if(t>=this.min.value&&t<this.max.value){this.sink.event(t,x)}};TimeWindowSink.prototype.error=Pipe.prototype.error;TimeWindowSink.prototype.end=Pipe.prototype.end;function LowerBound(signal,sink,scheduler){this.value=Infinity;this.sink=sink;this.disposable=signal.run(this,scheduler)}LowerBound.prototype.event=function(t){if(t<this.value){this.value=t}};LowerBound.prototype.end=noop;LowerBound.prototype.error=Pipe.prototype.error;LowerBound.prototype.dispose=function(){return this.disposable.dispose()};function UpperBound(signal,sink,scheduler){this.value=Infinity;this.sink=sink;this.disposable=signal.run(this,scheduler)}UpperBound.prototype.event=function(t,x){if(t<this.value){this.value=t;this.sink.end(t,x)}};UpperBound.prototype.end=noop;UpperBound.prototype.error=Pipe.prototype.error;UpperBound.prototype.dispose=function(){return this.disposable.dispose()}},{"../Stream":4,"../base":5,"../combinator/flatMap":15,"../disposable/dispose":34,"../sink/Pipe":50}],27:[function(require,module,exports){var Stream=require("../Stream");var Sink=require("../sink/Pipe");exports.timestamp=timestamp;function timestamp(stream){return new Stream(new Timestamp(stream.source))}function Timestamp(source){this.source=source}Timestamp.prototype.run=function(sink,scheduler){return this.source.run(new TimestampSink(sink),scheduler)};function TimestampSink(sink){this.sink=sink}TimestampSink.prototype.end=Sink.prototype.end;TimestampSink.prototype.error=Sink.prototype.error;TimestampSink.prototype.event=function(t,x){this.sink.event(t,{time:t,value:x})}},{"../Stream":4,"../sink/Pipe":50}],28:[function(require,module,exports){var Stream=require("../Stream");exports.transduce=transduce;function transduce(transducer,stream){return new Stream(new Transduce(transducer,stream.source))}function Transduce(transducer,source){this.transducer=transducer;this.source=source}Transduce.prototype.run=function(sink,scheduler){var xf=this.transducer(new Transformer(sink));return this.source.run(new TransduceSink(getTxHandler(xf),sink),scheduler)};function TransduceSink(adapter,sink){this.xf=adapter;this.sink=sink}TransduceSink.prototype.event=function(t,x){
var next=this.xf.step(t,x);return this.xf.isReduced(next)?this.sink.end(t,this.xf.getResult(next)):next};TransduceSink.prototype.end=function(t,x){return this.xf.result(x)};TransduceSink.prototype.error=function(t,e){return this.sink.error(t,e)};function Transformer(sink){this.time=-Infinity;this.sink=sink}Transformer.prototype["@@transducer/init"]=Transformer.prototype.init=function(){};Transformer.prototype["@@transducer/step"]=Transformer.prototype.step=function(t,x){if(!isNaN(t)){this.time=Math.max(t,this.time)}return this.sink.event(this.time,x)};Transformer.prototype["@@transducer/result"]=Transformer.prototype.result=function(x){return this.sink.end(this.time,x)};function getTxHandler(tx){return typeof tx["@@transducer/step"]==="function"?new TxAdapter(tx):new LegacyTxAdapter(tx)}function TxAdapter(tx){this.tx=tx}TxAdapter.prototype.step=function(t,x){return this.tx["@@transducer/step"](t,x)};TxAdapter.prototype.result=function(x){return this.tx["@@transducer/result"](x)};TxAdapter.prototype.isReduced=function(x){return x!=null&&x["@@transducer/reduced"]};TxAdapter.prototype.getResult=function(x){return x["@@transducer/value"]};function LegacyTxAdapter(tx){this.tx=tx}LegacyTxAdapter.prototype.step=function(t,x){return this.tx.step(t,x)};LegacyTxAdapter.prototype.result=function(x){return this.tx.result(x)};LegacyTxAdapter.prototype.isReduced=function(x){return x!=null&&x.__transducers_reduced__};LegacyTxAdapter.prototype.getResult=function(x){return x.value}},{"../Stream":4}],29:[function(require,module,exports){var Stream=require("../Stream");var Map=require("../fusion/Map");exports.map=map;exports.constant=constant;exports.tap=tap;function map(f,stream){return new Stream(Map.create(f,stream.source))}function constant(x,stream){return map(function(){return x},stream)}function tap(f,stream){return map(function(x){f(x);return x},stream)}},{"../Stream":4,"../fusion/Map":38}],30:[function(require,module,exports){var Stream=require("../Stream");var transform=require("./transform");var core=require("../source/core");var Sink=require("../sink/Pipe");var IndexSink=require("../sink/IndexSink");var dispose=require("../disposable/dispose");var base=require("../base");var invoke=require("../invoke");var Queue=require("../Queue");var map=base.map;var tail=base.tail;exports.zip=zip;exports.zipArray=zipArray;function zip(f){return zipArray(f,tail(arguments))}function zipArray(f,streams){return streams.length===0?core.empty():streams.length===1?transform.map(f,streams[0]):new Stream(new Zip(f,map(getSource,streams)))}function getSource(stream){return stream.source}function Zip(f,sources){this.f=f;this.sources=sources}Zip.prototype.run=function(sink,scheduler){var l=this.sources.length;var disposables=new Array(l);var sinks=new Array(l);var buffers=new Array(l);var zipSink=new ZipSink(this.f,buffers,sinks,sink);for(var indexSink,i=0;i<l;++i){buffers[i]=new Queue;indexSink=sinks[i]=new IndexSink(i,zipSink);disposables[i]=this.sources[i].run(indexSink,scheduler)}return dispose.all(disposables)};function ZipSink(f,buffers,sinks,sink){this.f=f;this.sinks=sinks;this.sink=sink;this.buffers=buffers}ZipSink.prototype.event=function(t,indexedValue){var buffers=this.buffers;var buffer=buffers[indexedValue.index];buffer.push(indexedValue.value);if(buffer.length()===1){if(!ready(this.buffers)){return}emitZipped(this.f,t,buffers,this.sink);if(ended(this.buffers,this.sinks)){this.sink.end(t,void 0)}}};ZipSink.prototype.end=function(t,indexedValue){var buffer=this.buffers[indexedValue.index];if(buffer.isEmpty()){this.sink.end(t,indexedValue.value)}};ZipSink.prototype.error=Sink.prototype.error;function emitZipped(f,t,buffers,sink){sink.event(t,invoke(f,map(head,buffers)))}function head(buffer){return buffer.shift()}function ended(buffers,sinks){for(var i=0,l=buffers.length;i<l;++i){if(buffers[i].isEmpty()&&!sinks[i].active){return true}}return false}function ready(buffers){for(var i=0,l=buffers.length;i<l;++i){if(buffers[i].isEmpty()){return false}}return true}},{"../Queue":3,"../Stream":4,"../base":5,"../disposable/dispose":34,"../invoke":39,"../sink/IndexSink":48,"../sink/Pipe":50,"../source/core":55,"./transform":29}],31:[function(require,module,exports){module.exports=defer;function defer(task){return Promise.resolve(task).then(runTask)}function runTask(task){try{return task.run()}catch(e){return task.error(e)}}},{}],32:[function(require,module,exports){module.exports=Disposable;function Disposable(dispose,data){this._dispose=dispose;this._data=data}Disposable.prototype.dispose=function(){return this._dispose(this._data)}},{}],33:[function(require,module,exports){module.exports=SettableDisposable;function SettableDisposable(){this.disposable=void 0;this.disposed=false;this._resolve=void 0;var self=this;this.result=new Promise(function(resolve){self._resolve=resolve})}SettableDisposable.prototype.setDisposable=function(disposable){if(this.disposable!==void 0){throw new Error("setDisposable called more than once")}this.disposable=disposable;if(this.disposed){this._resolve(disposable.dispose())}};SettableDisposable.prototype.dispose=function(){if(this.disposed){return this.result}this.disposed=true;if(this.disposable!==void 0){this.result=this.disposable.dispose()}return this.result}},{}],34:[function(require,module,exports){var Disposable=require("./Disposable");var SettableDisposable=require("./SettableDisposable");var isPromise=require("../Promise").isPromise;var base=require("../base");var map=base.map;var identity=base.identity;exports.tryDispose=tryDispose;exports.create=create;exports.once=once;exports.empty=empty;exports.all=all;exports.settable=settable;exports.promised=promised;function tryDispose(t,disposable,sink){var result=disposeSafely(disposable);return isPromise(result)?result.catch(function(e){sink.error(t,e)}):result}function create(dispose,data){return once(new Disposable(dispose,data))}function empty(){return new Disposable(identity,void 0)}function all(disposables){return create(disposeAll,disposables)}function disposeAll(disposables){return Promise.all(map(disposeSafely,disposables))}function disposeSafely(disposable){try{return disposable.dispose()}catch(e){return Promise.reject(e)}}function promised(disposablePromise){return create(disposePromise,disposablePromise)}function disposePromise(disposablePromise){return disposablePromise.then(disposeOne)}function disposeOne(disposable){return disposable.dispose()}function settable(){return new SettableDisposable}function once(disposable){return new Disposable(disposeMemoized,memoized(disposable))}function disposeMemoized(memoized){if(!memoized.disposed){memoized.disposed=true;memoized.value=disposeSafely(memoized.disposable);memoized.disposable=void 0}return memoized.value}function memoized(disposable){return{disposed:false,disposable:disposable,value:void 0}}},{"../Promise":2,"../base":5,"./Disposable":32,"./SettableDisposable":33}],35:[function(require,module,exports){module.exports=fatalError;function fatalError(e){setTimeout(function(){throw e},0)}},{}],36:[function(require,module,exports){var Pipe=require("../sink/Pipe");module.exports=Filter;function Filter(p,source){this.p=p;this.source=source}Filter.create=function createFilter(p,source){if(source instanceof Filter){return new Filter(and(source.p,p),source.source)}return new Filter(p,source)};Filter.prototype.run=function(sink,scheduler){return this.source.run(new FilterSink(this.p,sink),scheduler)};function FilterSink(p,sink){this.p=p;this.sink=sink}FilterSink.prototype.end=Pipe.prototype.end;FilterSink.prototype.error=Pipe.prototype.error;FilterSink.prototype.event=function(t,x){var p=this.p;p(x)&&this.sink.event(t,x)};function and(p,q){return function(x){return p(x)&&q(x)}}},{"../sink/Pipe":50}],37:[function(require,module,exports){var Pipe=require("../sink/Pipe");module.exports=FilterMap;function FilterMap(p,f,source){this.p=p;this.f=f;this.source=source}FilterMap.prototype.run=function(sink,scheduler){return this.source.run(new FilterMapSink(this.p,this.f,sink),scheduler)};function FilterMapSink(p,f,sink){this.p=p;this.f=f;this.sink=sink}FilterMapSink.prototype.event=function(t,x){var f=this.f;var p=this.p;p(x)&&this.sink.event(t,f(x))};FilterMapSink.prototype.end=Pipe.prototype.end;FilterMapSink.prototype.error=Pipe.prototype.error},{"../sink/Pipe":50}],38:[function(require,module,exports){var Pipe=require("../sink/Pipe");var Filter=require("./Filter");var FilterMap=require("./FilterMap");var base=require("../base");module.exports=Map;function Map(f,source){this.f=f;this.source=source}Map.create=function createMap(f,source){if(source instanceof Map){return new Map(base.compose(f,source.f),source.source)}if(source instanceof Filter){return new FilterMap(source.p,f,source.source)}if(source instanceof FilterMap){return new FilterMap(source.p,base.compose(f,source.f),source.source)}return new Map(f,source)};Map.prototype.run=function(sink,scheduler){return this.source.run(new MapSink(this.f,sink),scheduler)};function MapSink(f,sink){this.f=f;this.sink=sink}MapSink.prototype.end=Pipe.prototype.end;MapSink.prototype.error=Pipe.prototype.error;MapSink.prototype.event=function(t,x){var f=this.f;this.sink.event(t,f(x))}},{"../base":5,"../sink/Pipe":50,"./Filter":36,"./FilterMap":37}],39:[function(require,module,exports){module.exports=invoke;function invoke(f,args){switch(args.length){case 0:return f();case 1:return f(args[0]);case 2:return f(args[0],args[1]);case 3:return f(args[0],args[1],args[2]);case 4:return f(args[0],args[1],args[2],args[3]);case 5:return f(args[0],args[1],args[2],args[3],args[4]);default:return f.apply(void 0,args)}}},{}],40:[function(require,module,exports){exports.isIterable=isIterable;exports.getIterator=getIterator;exports.makeIterable=makeIterable;var iteratorSymbol;if(typeof Set==="function"&&typeof(new Set)["@@iterator"]==="function"){iteratorSymbol="@@iterator"}else{iteratorSymbol=typeof Symbol==="function"&&Symbol.iterator||"_es6shim_iterator_"}function isIterable(o){return typeof o[iteratorSymbol]==="function"}function getIterator(o){return o[iteratorSymbol]()}function makeIterable(f,o){o[iteratorSymbol]=f;return o}},{}],41:[function(require,module,exports){var Observer=require("./sink/Observer");var dispose=require("./disposable/dispose");var defaultScheduler=require("./scheduler/defaultScheduler");exports.withDefaultScheduler=withDefaultScheduler;exports.withScheduler=withScheduler;function withDefaultScheduler(f,source){return withScheduler(f,source,defaultScheduler)}function withScheduler(f,source,scheduler){return new Promise(function(resolve,reject){runSource(f,source,scheduler,resolve,reject)})}function runSource(f,source,scheduler,resolve,reject){var disposable=dispose.settable();var observer=new Observer(f,resolve,reject,disposable);disposable.setDisposable(source.run(observer,scheduler))}},{"./disposable/dispose":34,"./scheduler/defaultScheduler":44,"./sink/Observer":49}],42:[function(require,module,exports){var fatal=require("../fatalError");module.exports=PropagateTask;function PropagateTask(run,value,sink){this._run=run;this.value=value;this.sink=sink;this.active=true}PropagateTask.event=function(value,sink){return new PropagateTask(emit,value,sink)};PropagateTask.end=function(value,sink){return new PropagateTask(end,value,sink)};PropagateTask.error=function(value,sink){return new PropagateTask(error,value,sink)};PropagateTask.prototype.dispose=function(){this.active=false};PropagateTask.prototype.run=function(t){if(!this.active){return}this._run(t,this.value,this.sink)};PropagateTask.prototype.error=function(t,e){if(!this.active){return fatal(e)}this.sink.error(t,e)};function error(t,e,sink){sink.error(t,e)}function emit(t,x,sink){sink.event(t,x)}function end(t,x,sink){sink.end(t,x)}},{"../fatalError":35}],43:[function(require,module,exports){var base=require("./../base");module.exports=Scheduler;function ScheduledTask(delay,period,task,scheduler){this.time=delay;this.period=period;this.task=task;this.scheduler=scheduler;this.active=true}ScheduledTask.prototype.run=function(){return this.task.run(this.time)};ScheduledTask.prototype.error=function(e){return this.task.error(this.time,e)};ScheduledTask.prototype.cancel=function(){this.scheduler.cancel(this);return this.task.dispose()};function runTask(task){try{return task.run()}catch(e){return task.error(e)}}function Scheduler(timer){this.timer=timer;this._timer=null;this._nextArrival=0;this._tasks=[];var self=this;this._runReadyTasksBound=function(){self._runReadyTasks(self.now())}}Scheduler.prototype.now=function(){return this.timer.now()};Scheduler.prototype.asap=function(task){return this.schedule(0,-1,task)};Scheduler.prototype.delay=function(delay,task){return this.schedule(delay,-1,task)};Scheduler.prototype.periodic=function(period,task){return this.schedule(0,period,task)};Scheduler.prototype.schedule=function(delay,period,task){var now=this.now();var st=new ScheduledTask(now+Math.max(0,delay),period,task,this);insertByTime(st,this._tasks);this._scheduleNextRun(now);return st};Scheduler.prototype.cancel=function(task){task.active=false;var i=binarySearch(task.time,this._tasks);if(i>=0&&i<this._tasks.length){var at=base.findIndex(task,this._tasks[i].events);this._tasks[i].events.splice(at,1);this._reschedule()}};Scheduler.prototype.cancelAll=function(f){this._tasks=base.removeAll(f,this._tasks);this._reschedule()};Scheduler.prototype._reschedule=function(){if(this._tasks.length===0){this._unschedule()}else{this._scheduleNextRun(this.now())}};Scheduler.prototype._unschedule=function(){this.timer.clearTimer(this._timer);this._timer=null};Scheduler.prototype._scheduleNextRun=function(now){if(this._tasks.length===0){return}var nextArrival=this._tasks[0].time;if(this._timer===null){this._scheduleNextArrival(nextArrival,now)}else if(nextArrival<this._nextArrival){this._unschedule();this._scheduleNextArrival(nextArrival,now)}};Scheduler.prototype._scheduleNextArrival=function(nextArrival,now){this._nextArrival=nextArrival;var delay=Math.max(0,nextArrival-now);this._timer=this.timer.setTimer(this._runReadyTasksBound,delay)};Scheduler.prototype._runReadyTasks=function(now){this._timer=null;this._tasks=this._findAndRunTasks(now);this._scheduleNextRun(this.now())};Scheduler.prototype._findAndRunTasks=function(now){var tasks=this._tasks;var l=tasks.length;var i=0;while(i<l&&tasks[i].time<=now){++i}this._tasks=tasks.slice(i);for(var j=0;j<i;++j){this._tasks=runTasks(tasks[j],this._tasks)}return this._tasks};function runTasks(timeslot,tasks){var events=timeslot.events;for(var i=0;i<events.length;++i){var task=events[i];if(task.active){runTask(task);if(task.period>=0){task.time=task.time+task.period;insertByTime(task,tasks)}}}return tasks}function insertByTime(task,timeslots){var l=timeslots.length;if(l===0){timeslots.push(newTimeslot(task.time,[task]));return}var i=binarySearch(task.time,timeslots);if(i>=l){timeslots.push(newTimeslot(task.time,[task]))}else if(task.time===timeslots[i].time){timeslots[i].events.push(task)}else{timeslots.splice(i,0,newTimeslot(task.time,[task]))}}function binarySearch(t,sortedArray){var lo=0;var hi=sortedArray.length;var mid,y;while(lo<hi){mid=Math.floor((lo+hi)/2);y=sortedArray[mid];if(t===y.time){return mid}else if(t<y.time){hi=mid}else{lo=mid+1}}return hi}function newTimeslot(t,events){return{time:t,events:events}}},{"./../base":5}],44:[function(require,module,exports){(function(process){var Scheduler=require("./Scheduler");var setTimeoutTimer=require("./timeoutTimer");var nodeTimer=require("./nodeTimer");var isNode=typeof process==="object"&&typeof process.nextTick==="function";module.exports=new Scheduler(isNode?nodeTimer:setTimeoutTimer)}).call(this,require("_process"))},{"./Scheduler":43,"./nodeTimer":45,"./timeoutTimer":46,_process:66}],45:[function(require,module,exports){var defer=require("../defer");function Task(f){this.f=f;this.active=true}Task.prototype.run=function(){if(!this.active){return}var f=this.f;return f()};Task.prototype.error=function(e){throw e};Task.prototype.cancel=function(){this.active=false};function runAsTask(f){var task=new Task(f);defer(task);return task}module.exports={now:Date.now,setTimer:function(f,dt){return dt<=0?runAsTask(f):setTimeout(f,dt)},clearTimer:function(t){return t instanceof Task?t.cancel():clearTimeout(t)}}},{"../defer":31}],46:[function(require,module,exports){module.exports={now:Date.now,setTimer:function(f,dt){return setTimeout(f,dt)},clearTimer:function(t){return clearTimeout(t)}}},{}],47:[function(require,module,exports){var defer=require("../defer");module.exports=DeferredSink;function DeferredSink(sink){this.sink=sink;this.events=[];this.length=0;this.active=true}DeferredSink.prototype.event=function(t,x){if(!this.active){return}if(this.length===0){defer(new PropagateAllTask(this))}this.events[this.length++]={time:t,value:x}};DeferredSink.prototype.error=function(t,e){this.active=false;defer(new ErrorTask(t,e,this.sink))};DeferredSink.prototype.end=function(t,x){this.active=false;defer(new EndTask(t,x,this.sink))};function PropagateAllTask(deferred){this.deferred=deferred}PropagateAllTask.prototype.run=function(){var p=this.deferred;var events=p.events;var sink=p.sink;var event;for(var i=0,l=p.length;i<l;++i){event=events[i];sink.event(event.time,event.value);events[i]=void 0}p.length=0};PropagateAllTask.prototype.error=function(e){this.deferred.error(0,e)};function EndTask(t,x,sink){this.time=t;this.value=x;this.sink=sink}EndTask.prototype.run=function(){this.sink.end(this.time,this.value)};EndTask.prototype.error=function(e){this.sink.error(this.time,e)};function ErrorTask(t,e,sink){this.time=t;this.value=e;this.sink=sink}ErrorTask.prototype.run=function(){this.sink.error(this.time,this.value)};ErrorTask.prototype.error=function(e){throw e}},{"../defer":31}],48:[function(require,module,exports){var Sink=require("./Pipe");module.exports=IndexSink;IndexSink.hasValue=hasValue;function hasValue(indexSink){return indexSink.hasValue}function IndexSink(i,sink){this.index=i;this.sink=sink;this.active=true;this.hasValue=false;this.value=void 0}IndexSink.prototype.event=function(t,x){if(!this.active){return}this.value=x;this.hasValue=true;this.sink.event(t,this)};IndexSink.prototype.end=function(t,x){if(!this.active){return}this.active=false;this.sink.end(t,{index:this.index,value:x})};IndexSink.prototype.error=Sink.prototype.error},{"./Pipe":50}],49:[function(require,module,exports){module.exports=Observer;function Observer(event,end,error,disposable){this._event=event;this._end=end;this._error=error;this._disposable=disposable;this.active=true}Observer.prototype.event=function(t,x){if(!this.active){return}this._event(x)};Observer.prototype.end=function(t,x){if(!this.active){return}this.active=false;disposeThen(this._end,this._error,this._disposable,x)};Observer.prototype.error=function(t,e){this.active=false;disposeThen(this._error,this._error,this._disposable,e)};function disposeThen(end,error,disposable,x){Promise.resolve(disposable.dispose()).then(function(){end(x)},error)}},{}],50:[function(require,module,exports){module.exports=Pipe;function Pipe(sink){this.sink=sink}Pipe.prototype.event=function(t,x){return this.sink.event(t,x)};Pipe.prototype.end=function(t,x){return this.sink.end(t,x)};Pipe.prototype.error=function(t,e){return this.sink.error(t,e)}},{}],51:[function(require,module,exports){var DeferredSink=require("../sink/DeferredSink");var dispose=require("../disposable/dispose");var tryEvent=require("./tryEvent");module.exports=EventEmitterSource;function EventEmitterSource(event,source){this.event=event;this.source=source}EventEmitterSource.prototype.run=function(sink,scheduler){var dsink=new DeferredSink(sink);function addEventVariadic(a){var l=arguments.length;if(l>1){var arr=new Array(l);for(var i=0;i<l;++i){arr[i]=arguments[i]}tryEvent.tryEvent(scheduler.now(),arr,dsink)}else{tryEvent.tryEvent(scheduler.now(),a,dsink)}}this.source.addListener(this.event,addEventVariadic);return dispose.create(disposeEventEmitter,{target:this,addEvent:addEventVariadic})};function disposeEventEmitter(info){var target=info.target;target.source.removeListener(target.event,info.addEvent)}},{"../disposable/dispose":34,"../sink/DeferredSink":47,"./tryEvent":64}],52:[function(require,module,exports){var dispose=require("../disposable/dispose");var tryEvent=require("./tryEvent");module.exports=EventTargetSource;function EventTargetSource(event,source,capture){this.event=event;this.source=source;this.capture=capture}EventTargetSource.prototype.run=function(sink,scheduler){function addEvent(e){tryEvent.tryEvent(scheduler.now(),e,sink)}this.source.addEventListener(this.event,addEvent,this.capture);return dispose.create(disposeEventTarget,{target:this,addEvent:addEvent})};function disposeEventTarget(info){var target=info.target;target.source.removeEventListener(target.event,info.addEvent,target.capture)}},{"../disposable/dispose":34,"./tryEvent":64}],53:[function(require,module,exports){var base=require("../base");module.exports=MulticastSource;function MulticastSource(source){this.source=source;this.sinks=[];this._disposable=void 0}MulticastSource.prototype.run=function(sink,scheduler){var n=this.add(sink);if(n===1){this._disposable=this.source.run(this,scheduler)}return new MulticastDisposable(this,sink)};MulticastSource.prototype._dispose=function(){var disposable=this._disposable;this._disposable=void 0;return Promise.resolve(disposable).then(dispose)};function dispose(disposable){if(disposable===void 0){return}return disposable.dispose()}function MulticastDisposable(source,sink){this.source=source;this.sink=sink}MulticastDisposable.prototype.dispose=function(){var s=this.source;var remaining=s.remove(this.sink);return remaining===0&&s._dispose()};MulticastSource.prototype.add=function(sink){this.sinks=base.append(sink,this.sinks);return this.sinks.length};MulticastSource.prototype.remove=function(sink){this.sinks=base.remove(base.findIndex(sink,this.sinks),this.sinks);return this.sinks.length};MulticastSource.prototype.event=function(t,x){var s=this.sinks;if(s.length===1){s[0].event(t,x);return}for(var i=0;i<s.length;++i){s[i].event(t,x)}};MulticastSource.prototype.end=function(t,x){var s=this.sinks;if(s.length===1){s[0].end(t,x);return}for(var i=0;i<s.length;++i){s[i].end(t,x)}};MulticastSource.prototype.error=function(t,e){var s=this.sinks;if(s.length===1){s[0].error(t,e);return}for(var i=0;i<s.length;++i){s[i].error(t,e)}}},{"../base":5}],54:[function(require,module,exports){var PropagateTask=require("../scheduler/PropagateTask");module.exports=ValueSource;function ValueSource(emit,x){this.emit=emit;this.value=x}ValueSource.prototype.run=function(sink,scheduler){return new ValueProducer(this.emit,this.value,sink,scheduler)};function ValueProducer(emit,x,sink,scheduler){this.task=new PropagateTask(emit,x,sink);scheduler.asap(this.task)}ValueProducer.prototype.dispose=function(){return this.task.dispose()}},{"../scheduler/PropagateTask":42}],55:[function(require,module,exports){var Stream=require("../Stream");var ValueSource=require("../source/ValueSource");var dispose=require("../disposable/dispose");var PropagateTask=require("../scheduler/PropagateTask");exports.of=streamOf;exports.empty=empty;exports.never=never;function streamOf(x){return new Stream(new ValueSource(emit,x))}function emit(t,x,sink){sink.event(0,x);sink.end(0,void 0)}function empty(){return EMPTY}function EmptySource(){}EmptySource.prototype.run=function(sink,scheduler){var task=PropagateTask.end(void 0,sink);scheduler.asap(task);return dispose.create(disposeEmpty,task)};function disposeEmpty(task){return task.dispose()}var EMPTY=new Stream(new EmptySource);function never(){return NEVER}function NeverSource(){}NeverSource.prototype.run=function(){return dispose.empty()};var NEVER=new Stream(new NeverSource)},{"../Stream":4,"../disposable/dispose":34,"../scheduler/PropagateTask":42,"../source/ValueSource":54}],56:[function(require,module,exports){var Stream=require("../Stream");var MulticastSource=require("./MulticastSource");var DeferredSink=require("../sink/DeferredSink");var tryEvent=require("./tryEvent");exports.create=create;function create(run){return new Stream(new MulticastSource(new SubscriberSource(run)))}function SubscriberSource(subscribe){this._subscribe=subscribe}SubscriberSource.prototype.run=function(sink,scheduler){return new Subscription(new DeferredSink(sink),scheduler,this._subscribe)};function Subscription(sink,scheduler,subscribe){this.sink=sink;this.scheduler=scheduler;this.active=true;this._unsubscribe=this._init(subscribe)}Subscription.prototype._init=function(subscribe){var s=this;try{return subscribe(add,end,error)}catch(e){error(e)}function add(x){s._add(x)}function end(x){s._end(x)}function error(e){s._error(e)}};Subscription.prototype._add=function(x){if(!this.active){return}tryEvent.tryEvent(this.scheduler.now(),x,this.sink)};Subscription.prototype._end=function(x){if(!this.active){return}this.active=false;tryEvent.tryEnd(this.scheduler.now(),x,this.sink)};Subscription.prototype._error=function(x){this.active=false;this.sink.error(this.scheduler.now(),x)};Subscription.prototype.dispose=function(){this.active=false;if(typeof this._unsubscribe==="function"){return this._unsubscribe.call(void 0)}}},{"../Stream":4,"../sink/DeferredSink":47,"./MulticastSource":53,"./tryEvent":64}],57:[function(require,module,exports){var fromArray=require("./fromArray").fromArray;var isIterable=require("../iterable").isIterable;var fromIterable=require("./fromIterable").fromIterable;var isArrayLike=require("../base").isArrayLike;exports.from=from;function from(a){if(Array.isArray(a)||isArrayLike(a)){return fromArray(a)}if(isIterable(a)){return fromIterable(a)}throw new TypeError("not iterable: "+a)}},{"../base":5,"../iterable":40,"./fromArray":58,"./fromIterable":60}],58:[function(require,module,exports){var Stream=require("../Stream");var PropagateTask=require("../scheduler/PropagateTask");exports.fromArray=fromArray;function fromArray(a){return new Stream(new ArraySource(a))}function ArraySource(a){this.array=a}ArraySource.prototype.run=function(sink,scheduler){return new ArrayProducer(this.array,sink,scheduler)};function ArrayProducer(array,sink,scheduler){this.scheduler=scheduler;this.task=new PropagateTask(runProducer,array,sink);scheduler.asap(this.task)}ArrayProducer.prototype.dispose=function(){return this.task.dispose()};function runProducer(t,array,sink){produce(this,array,sink)}function produce(task,array,sink){for(var i=0,l=array.length;i<l&&task.active;++i){sink.event(0,array[i])}task.active&&end();function end(){sink.end(0)}}},{"../Stream":4,"../scheduler/PropagateTask":42}],59:[function(require,module,exports){var Stream=require("../Stream");var MulticastSource=require("./MulticastSource");var EventTargetSource=require("./EventTargetSource");var EventEmitterSource=require("./EventEmitterSource");exports.fromEvent=fromEvent;function fromEvent(event,source){var s;if(typeof source.addEventListener==="function"&&typeof source.removeEventListener==="function"){var capture=arguments.length>2&&!!arguments[2];s=new MulticastSource(new EventTargetSource(event,source,capture))}else if(typeof source.addListener==="function"&&typeof source.removeListener==="function"){s=new EventEmitterSource(event,source)}else{throw new Error("source must support addEventListener/removeEventListener or addListener/removeListener")}return new Stream(s)}},{"../Stream":4,"./EventEmitterSource":51,"./EventTargetSource":52,"./MulticastSource":53}],60:[function(require,module,exports){var Stream=require("../Stream");var getIterator=require("../iterable").getIterator;var PropagateTask=require("../scheduler/PropagateTask");exports.fromIterable=fromIterable;function fromIterable(iterable){return new Stream(new IterableSource(iterable))}function IterableSource(iterable){this.iterable=iterable}IterableSource.prototype.run=function(sink,scheduler){return new IteratorProducer(getIterator(this.iterable),sink,scheduler)};function IteratorProducer(iterator,sink,scheduler){this.scheduler=scheduler;this.iterator=iterator;this.task=new PropagateTask(runProducer,this,sink);scheduler.asap(this.task)}IteratorProducer.prototype.dispose=function(){return this.task.dispose()};function runProducer(t,producer,sink){var x=producer.iterator.next();if(x.done){sink.end(t,x.value)}else{sink.event(t,x.value)}producer.scheduler.asap(producer.task)}},{"../Stream":4,"../iterable":40,"../scheduler/PropagateTask":42}],61:[function(require,module,exports){var Stream=require("../Stream");var base=require("../base");exports.generate=generate;function generate(f){return new Stream(new GenerateSource(f,base.tail(arguments)))}function GenerateSource(f,args){this.f=f;this.args=args}GenerateSource.prototype.run=function(sink,scheduler){return new Generate(this.f.apply(void 0,this.args),sink,scheduler)};function Generate(iterator,sink,scheduler){this.iterator=iterator;this.sink=sink;this.scheduler=scheduler;this.active=true;var self=this;function err(e){self.sink.error(self.scheduler.now(),e)}Promise.resolve(this).then(next).catch(err)}function next(generate,x){return generate.active?handle(generate,generate.iterator.next(x)):x}function handle(generate,result){if(result.done){return generate.sink.end(generate.scheduler.now(),result.value)}return Promise.resolve(result.value).then(function(x){return emit(generate,x)},function(e){return error(generate,e)})}function emit(generate,x){generate.sink.event(generate.scheduler.now(),x);return next(generate,x)}function error(generate,e){return handle(generate,generate.iterator.throw(e))}Generate.prototype.dispose=function(){this.active=false}},{"../Stream":4,"../base":5}],62:[function(require,module,exports){var Stream=require("../Stream");exports.iterate=iterate;function iterate(f,x){return new Stream(new IterateSource(f,x))}function IterateSource(f,x){this.f=f;this.value=x}IterateSource.prototype.run=function(sink,scheduler){return new Iterate(this.f,this.value,sink,scheduler)};function Iterate(f,initial,sink,scheduler){this.f=f;this.sink=sink;this.scheduler=scheduler;this.active=true;var x=initial;var self=this;function err(e){self.sink.error(self.scheduler.now(),e)}function start(iterate){return stepIterate(iterate,x)}Promise.resolve(this).then(start).catch(err)}Iterate.prototype.dispose=function(){this.active=false};function stepIterate(iterate,x){iterate.sink.event(iterate.scheduler.now(),x);if(!iterate.active){return x}var f=iterate.f;return Promise.resolve(f(x)).then(function(y){return continueIterate(iterate,y)})}function continueIterate(iterate,x){return!iterate.active?iterate.value:stepIterate(iterate,x)}},{"../Stream":4}],63:[function(require,module,exports){var Stream=require("../Stream");var dispose=require("../disposable/dispose");var MulticastSource=require("./MulticastSource");var PropagateTask=require("../scheduler/PropagateTask");exports.periodic=periodic;function periodic(period,value){return new Stream(new MulticastSource(new Periodic(period,value)))}function Periodic(period,value){this.period=period;this.value=value}Periodic.prototype.run=function(sink,scheduler){var task=scheduler.periodic(this.period,new PropagateTask(emit,this.value,sink));return dispose.create(cancelTask,task)};function cancelTask(task){task.cancel()}function emit(t,x,sink){sink.event(t,x)}},{"../Stream":4,"../disposable/dispose":34,"../scheduler/PropagateTask":42,"./MulticastSource":53}],64:[function(require,module,exports){exports.tryEvent=tryEvent;exports.tryEnd=tryEnd;function tryEvent(t,x,sink){try{sink.event(t,x)}catch(e){sink.error(t,e)}}function tryEnd(t,x,sink){try{sink.end(t,x)}catch(e){sink.error(t,e)}}},{}],65:[function(require,module,exports){var Stream=require("../Stream");exports.unfold=unfold;function unfold(f,seed){return new Stream(new UnfoldSource(f,seed))}function UnfoldSource(f,seed){this.f=f;this.value=seed}UnfoldSource.prototype.run=function(sink,scheduler){return new Unfold(this.f,this.value,sink,scheduler)};function Unfold(f,x,sink,scheduler){
this.f=f;this.sink=sink;this.scheduler=scheduler;this.active=true;var self=this;function err(e){self.sink.error(self.scheduler.now(),e)}function start(unfold){return stepUnfold(unfold,x)}Promise.resolve(this).then(start).catch(err)}Unfold.prototype.dispose=function(){this.active=false};function stepUnfold(unfold,x){var f=unfold.f;return Promise.resolve(f(x)).then(function(tuple){return continueUnfold(unfold,tuple)})}function continueUnfold(unfold,tuple){if(tuple.done){unfold.sink.end(unfold.scheduler.now(),tuple.value);return tuple.value}unfold.sink.event(unfold.scheduler.now(),tuple.value);if(!unfold.active){return tuple.value}return stepUnfold(unfold,tuple.seed)}},{"../Stream":4}],66:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}if(canPost){var queue=[];window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],most:[function(require,module,exports){var Stream=require("./lib/Stream");var base=require("./lib/base");var core=require("./lib/source/core");var from=require("./lib/source/from").from;var periodic=require("./lib/source/periodic").periodic;exports.Stream=Stream;exports.of=Stream.of=core.of;exports.just=core.of;exports.empty=Stream.empty=core.empty;exports.never=core.never;exports.from=from;exports.periodic=periodic;var create=require("./lib/source/create");exports.create=create.create;var events=require("./lib/source/fromEvent");exports.fromEvent=events.fromEvent;var observe=require("./lib/combinator/observe");exports.observe=observe.observe;exports.forEach=observe.observe;exports.drain=observe.drain;Stream.prototype.observe=Stream.prototype.forEach=function(f){return observe.observe(f,this)};Stream.prototype.drain=function(){return observe.drain(this)};var loop=require("./lib/combinator/loop").loop;exports.loop=loop;Stream.prototype.loop=function(stepper,seed){return loop(stepper,seed,this)};var accumulate=require("./lib/combinator/accumulate");exports.scan=accumulate.scan;exports.reduce=accumulate.reduce;Stream.prototype.scan=function(f,initial){return accumulate.scan(f,initial,this)};Stream.prototype.reduce=function(f,initial){return accumulate.reduce(f,initial,this)};var unfold=require("./lib/source/unfold");var iterate=require("./lib/source/iterate");var generate=require("./lib/source/generate");var build=require("./lib/combinator/build");exports.unfold=unfold.unfold;exports.iterate=iterate.iterate;exports.generate=generate.generate;exports.cycle=build.cycle;exports.concat=build.concat;exports.startWith=build.cons;Stream.prototype.cycle=function(){return build.cycle(this)};Stream.prototype.concat=function(tail){return build.concat(this,tail)};Stream.prototype.startWith=function(x){return build.cons(x,this)};var transform=require("./lib/combinator/transform");var applicative=require("./lib/combinator/applicative");exports.map=transform.map;exports.constant=transform.constant;exports.tap=transform.tap;exports.ap=applicative.ap;Stream.prototype.map=function(f){return transform.map(f,this)};Stream.prototype.ap=function(xs){return applicative.ap(this,xs)};Stream.prototype.constant=function(x){return transform.constant(x,this)};Stream.prototype.tap=function(f){return transform.tap(f,this)};var transduce=require("./lib/combinator/transduce");exports.transduce=transduce.transduce;Stream.prototype.transduce=function(transducer){return transduce.transduce(transducer,this)};var flatMap=require("./lib/combinator/flatMap");exports.flatMap=exports.chain=flatMap.flatMap;exports.join=flatMap.join;Stream.prototype.flatMap=Stream.prototype.chain=function(f){return flatMap.flatMap(f,this)};Stream.prototype.join=function(){return flatMap.join(this)};var continueWith=require("./lib/combinator/continueWith").continueWith;exports.continueWith=continueWith;exports.flatMapEnd=continueWith;Stream.prototype.continueWith=Stream.prototype.flatMapEnd=function(f){return continueWith(f,this)};var concatMap=require("./lib/combinator/concatMap").concatMap;exports.concatMap=concatMap;Stream.prototype.concatMap=function(f){return concatMap(f,this)};var mergeConcurrently=require("./lib/combinator/mergeConcurrently");exports.mergeConcurrently=mergeConcurrently.mergeConcurrently;Stream.prototype.mergeConcurrently=function(concurrency){return mergeConcurrently.mergeConcurrently(concurrency,this)};var merge=require("./lib/combinator/merge");exports.merge=merge.merge;exports.mergeArray=merge.mergeArray;Stream.prototype.merge=function(){return merge.mergeArray(base.cons(this,arguments))};var combine=require("./lib/combinator/combine");exports.combine=combine.combine;exports.combineArray=combine.combineArray;Stream.prototype.combine=function(f){return combine.combineArray(f,base.replace(this,0,arguments))};var sample=require("./lib/combinator/sample");exports.sample=sample.sample;exports.sampleWith=sample.sampleWith;Stream.prototype.sampleWith=function(sampler){return sample.sampleWith(sampler,this)};Stream.prototype.sample=function(f){return sample.sampleArray(f,this,base.tail(arguments))};var zip=require("./lib/combinator/zip");exports.zip=zip.zip;Stream.prototype.zip=function(f){return zip.zipArray(f,base.replace(this,0,arguments))};var switchLatest=require("./lib/combinator/switch").switch;exports.switch=switchLatest;exports.switchLatest=switchLatest;Stream.prototype.switch=Stream.prototype.switchLatest=function(){return switchLatest(this)};var filter=require("./lib/combinator/filter");exports.filter=filter.filter;exports.skipRepeats=exports.distinct=filter.skipRepeats;exports.skipRepeatsWith=exports.distinctBy=filter.skipRepeatsWith;Stream.prototype.filter=function(p){return filter.filter(p,this)};Stream.prototype.skipRepeats=function(){return filter.skipRepeats(this)};Stream.prototype.skipRepeatsWith=function(equals){return filter.skipRepeatsWith(equals,this)};var slice=require("./lib/combinator/slice");exports.take=slice.take;exports.skip=slice.skip;exports.slice=slice.slice;exports.takeWhile=slice.takeWhile;exports.skipWhile=slice.skipWhile;Stream.prototype.take=function(n){return slice.take(n,this)};Stream.prototype.skip=function(n){return slice.skip(n,this)};Stream.prototype.slice=function(start,end){return slice.slice(start,end,this)};Stream.prototype.takeWhile=function(p){return slice.takeWhile(p,this)};Stream.prototype.skipWhile=function(p){return slice.skipWhile(p,this)};var timeslice=require("./lib/combinator/timeslice");exports.until=exports.takeUntil=timeslice.takeUntil;exports.since=exports.skipUntil=timeslice.skipUntil;exports.during=timeslice.during;Stream.prototype.until=Stream.prototype.takeUntil=function(signal){return timeslice.takeUntil(signal,this)};Stream.prototype.since=Stream.prototype.skipUntil=function(signal){return timeslice.skipUntil(signal,this)};Stream.prototype.during=function(timeWindow){return timeslice.during(timeWindow,this)};var delay=require("./lib/combinator/delay").delay;exports.delay=delay;Stream.prototype.delay=function(delayTime){return delay(delayTime,this)};var timestamp=require("./lib/combinator/timestamp").timestamp;exports.timestamp=timestamp;Stream.prototype.timestamp=function(){return timestamp(this)};var limit=require("./lib/combinator/limit");exports.throttle=limit.throttle;exports.debounce=limit.debounce;Stream.prototype.throttle=function(period){return limit.throttle(period,this)};Stream.prototype.debounce=function(period){return limit.debounce(period,this)};var promises=require("./lib/combinator/promises");exports.fromPromise=promises.fromPromise;exports.await=promises.awaitPromises;Stream.prototype.await=function(){return promises.awaitPromises(this)};var errors=require("./lib/combinator/errors");exports.recoverWith=errors.flatMapError;exports.flatMapError=errors.flatMapError;exports.throwError=errors.throwError;Stream.prototype.recoverWith=Stream.prototype.flatMapError=function(f){return errors.flatMapError(f,this)};var multicast=require("./lib/combinator/multicast").multicast;exports.multicast=multicast;Stream.prototype.multicast=function(){return multicast(this)}},{"./lib/Stream":4,"./lib/base":5,"./lib/combinator/accumulate":6,"./lib/combinator/applicative":7,"./lib/combinator/build":8,"./lib/combinator/combine":9,"./lib/combinator/concatMap":10,"./lib/combinator/continueWith":11,"./lib/combinator/delay":12,"./lib/combinator/errors":13,"./lib/combinator/filter":14,"./lib/combinator/flatMap":15,"./lib/combinator/limit":16,"./lib/combinator/loop":17,"./lib/combinator/merge":18,"./lib/combinator/mergeConcurrently":19,"./lib/combinator/multicast":20,"./lib/combinator/observe":21,"./lib/combinator/promises":22,"./lib/combinator/sample":23,"./lib/combinator/slice":24,"./lib/combinator/switch":25,"./lib/combinator/timeslice":26,"./lib/combinator/timestamp":27,"./lib/combinator/transduce":28,"./lib/combinator/transform":29,"./lib/combinator/zip":30,"./lib/source/core":55,"./lib/source/create":56,"./lib/source/from":57,"./lib/source/fromEvent":59,"./lib/source/generate":61,"./lib/source/iterate":62,"./lib/source/periodic":63,"./lib/source/unfold":65}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){module.exports=function split(undef){var nativeSplit=String.prototype.split,compliantExecNpcg=/()??/.exec("")[1]===undef,self;self=function(str,separator,limit){if(Object.prototype.toString.call(separator)!=="[object RegExp]"){return nativeSplit.call(str,separator,limit)}var output=[],flags=(separator.ignoreCase?"i":"")+(separator.multiline?"m":"")+(separator.extended?"x":"")+(separator.sticky?"y":""),lastLastIndex=0,separator=new RegExp(separator.source,flags+"g"),separator2,match,lastIndex,lastLength;str+="";if(!compliantExecNpcg){separator2=new RegExp("^"+separator.source+"$(?!\\s)",flags)}limit=limit===undef?-1>>>0:limit>>>0;while(match=separator.exec(str)){lastIndex=match.index+match[0].length;if(lastIndex>lastLastIndex){output.push(str.slice(lastLastIndex,match.index));if(!compliantExecNpcg&&match.length>1){match[0].replace(separator2,function(){for(var i=1;i<arguments.length-2;i++){if(arguments[i]===undef){match[i]=undef}}})}if(match.length>1&&match.index<str.length){Array.prototype.push.apply(output,match.slice(1))}lastLength=match[0].length;lastLastIndex=lastIndex;if(output.length>=limit){break}}if(separator.lastIndex===match.index){separator.lastIndex++}}if(lastLastIndex===str.length){if(lastLength||!separator.test("")){output.push("")}}else{output.push(str.slice(lastLastIndex))}return output.length>limit?output.slice(0,limit):output};return self}()},{}],2:[function(require,module,exports){"use strict";var OneVersionConstraint=require("individual/one-version");var MY_VERSION="7";OneVersionConstraint("ev-store",MY_VERSION);var hashKey="__EV_STORE_KEY@"+MY_VERSION;module.exports=EvStore;function EvStore(elem){var hash=elem[hashKey];if(!hash){hash=elem[hashKey]={}}return hash}},{"individual/one-version":4}],3:[function(require,module,exports){(function(global){"use strict";var root=typeof window!=="undefined"?window:typeof global!=="undefined"?global:{};module.exports=Individual;function Individual(key,value){if(key in root){return root[key]}root[key]=value;return value}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],4:[function(require,module,exports){"use strict";var Individual=require("./index.js");module.exports=OneVersion;function OneVersion(moduleName,version,defaultValue){var key="__INDIVIDUAL_ONE_VERSION_"+moduleName;var enforceKey=key+"_ENFORCE_SINGLETON";var versionValue=Individual(enforceKey,version);if(versionValue!==version){throw new Error("Can only have one copy of "+moduleName+".\n"+"You already have version "+versionValue+" installed.\n"+"This means you cannot install version "+version)}return Individual(key,defaultValue)}},{"./index.js":3}],5:[function(require,module,exports){var nativeIsArray=Array.isArray;var toString=Object.prototype.toString;module.exports=nativeIsArray||isArray;function isArray(obj){return toString.call(obj)==="[object Array]"}},{}],6:[function(require,module,exports){"use strict";var EvStore=require("ev-store");module.exports=EvHook;function EvHook(value){if(!(this instanceof EvHook)){return new EvHook(value)}this.value=value}EvHook.prototype.hook=function(node,propertyName){var es=EvStore(node);var propName=propertyName.substr(3);es[propName]=this.value};EvHook.prototype.unhook=function(node,propertyName){var es=EvStore(node);var propName=propertyName.substr(3);es[propName]=undefined}},{"ev-store":2}],7:[function(require,module,exports){"use strict";module.exports=SoftSetHook;function SoftSetHook(value){if(!(this instanceof SoftSetHook)){return new SoftSetHook(value)}this.value=value}SoftSetHook.prototype.hook=function(node,propertyName){if(node[propertyName]!==this.value){node[propertyName]=this.value}}},{}],8:[function(require,module,exports){"use strict";var isArray=require("x-is-array");var VNode=require("../vnode/vnode.js");var VText=require("../vnode/vtext.js");var isVNode=require("../vnode/is-vnode");var isVText=require("../vnode/is-vtext");var isWidget=require("../vnode/is-widget");var isHook=require("../vnode/is-vhook");var isVThunk=require("../vnode/is-thunk");var parseTag=require("./parse-tag.js");var softSetHook=require("./hooks/soft-set-hook.js");var evHook=require("./hooks/ev-hook.js");module.exports=h;function h(tagName,properties,children){var childNodes=[];var tag,props,key,namespace;if(!children&&isChildren(properties)){children=properties;props={}}props=props||properties||{};tag=parseTag(tagName,props);if(props.hasOwnProperty("key")){key=props.key;props.key=undefined}if(props.hasOwnProperty("namespace")){namespace=props.namespace;props.namespace=undefined}if(tag==="INPUT"&&!namespace&&props.hasOwnProperty("value")&&props.value!==undefined&&!isHook(props.value)){props.value=softSetHook(props.value)}transformProperties(props);if(children!==undefined&&children!==null){addChild(children,childNodes,tag,props)}return new VNode(tag,props,childNodes,key,namespace)}function addChild(c,childNodes,tag,props){if(typeof c==="string"){childNodes.push(new VText(c))}else if(typeof c==="number"){childNodes.push(new VText(String(c)))}else if(isChild(c)){childNodes.push(c)}else if(isArray(c)){for(var i=0;i<c.length;i++){addChild(c[i],childNodes,tag,props)}}else if(c===null||c===undefined){return}else{throw UnexpectedVirtualElement({foreignObject:c,parentVnode:{tagName:tag,properties:props}})}}function transformProperties(props){for(var propName in props){if(props.hasOwnProperty(propName)){var value=props[propName];if(isHook(value)){continue}if(propName.substr(0,3)==="ev-"){props[propName]=evHook(value)}}}}function isChild(x){return isVNode(x)||isVText(x)||isWidget(x)||isVThunk(x)}function isChildren(x){return typeof x==="string"||isArray(x)||isChild(x)}function UnexpectedVirtualElement(data){var err=new Error;err.type="virtual-hyperscript.unexpected.virtual-element";err.message="Unexpected virtual child passed to h().\n"+"Expected a VNode / Vthunk / VWidget / string but:\n"+"got:\n"+errorString(data.foreignObject)+".\n"+"The parent vnode is:\n"+errorString(data.parentVnode);"\n"+"Suggested fix: change your `h(..., [ ... ])` callsite.";err.foreignObject=data.foreignObject;err.parentVnode=data.parentVnode;return err}function errorString(obj){try{return JSON.stringify(obj,null," ")}catch(e){return String(obj)}}},{"../vnode/is-thunk":10,"../vnode/is-vhook":11,"../vnode/is-vnode":12,"../vnode/is-vtext":13,"../vnode/is-widget":14,"../vnode/vnode.js":16,"../vnode/vtext.js":17,"./hooks/ev-hook.js":6,"./hooks/soft-set-hook.js":7,"./parse-tag.js":9,"x-is-array":5}],9:[function(require,module,exports){"use strict";var split=require("browser-split");var classIdSplit=/([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/;var notClassId=/^\.|#/;module.exports=parseTag;function parseTag(tag,props){if(!tag){return"DIV"}var noId=!props.hasOwnProperty("id");var tagParts=split(tag,classIdSplit);var tagName=null;if(notClassId.test(tagParts[1])){tagName="DIV"}var classes,part,type,i;for(i=0;i<tagParts.length;i++){part=tagParts[i];if(!part){continue}type=part.charAt(0);if(!tagName){tagName=part}else if(type==="."){classes=classes||[];classes.push(part.substring(1,part.length))}else if(type==="#"&&noId){props.id=part.substring(1,part.length)}}if(classes){if(props.className){classes.push(props.className)}props.className=classes.join(" ")}return props.namespace?tagName:tagName.toUpperCase()}},{"browser-split":1}],10:[function(require,module,exports){module.exports=isThunk;function isThunk(t){return t&&t.type==="Thunk"}},{}],11:[function(require,module,exports){module.exports=isHook;function isHook(hook){return hook&&(typeof hook.hook==="function"&&!hook.hasOwnProperty("hook")||typeof hook.unhook==="function"&&!hook.hasOwnProperty("unhook"))}},{}],12:[function(require,module,exports){var version=require("./version");module.exports=isVirtualNode;function isVirtualNode(x){return x&&x.type==="VirtualNode"&&x.version===version}},{"./version":15}],13:[function(require,module,exports){var version=require("./version");module.exports=isVirtualText;function isVirtualText(x){return x&&x.type==="VirtualText"&&x.version===version}},{"./version":15}],14:[function(require,module,exports){module.exports=isWidget;function isWidget(w){return w&&w.type==="Widget"}},{}],15:[function(require,module,exports){module.exports="2"},{}],16:[function(require,module,exports){var version=require("./version");var isVNode=require("./is-vnode");var isWidget=require("./is-widget");var isThunk=require("./is-thunk");var isVHook=require("./is-vhook");module.exports=VirtualNode;var noProperties={};var noChildren=[];function VirtualNode(tagName,properties,children,key,namespace){this.tagName=tagName;this.properties=properties||noProperties;this.children=children||noChildren;this.key=key!=null?String(key):undefined;this.namespace=typeof namespace==="string"?namespace:null;var count=children&&children.length||0;var descendants=0;var hasWidgets=false;var hasThunks=false;var descendantHooks=false;var hooks;for(var propName in properties){if(properties.hasOwnProperty(propName)){var property=properties[propName];if(isVHook(property)&&property.unhook){if(!hooks){hooks={}}hooks[propName]=property}}}for(var i=0;i<count;i++){var child=children[i];if(isVNode(child)){descendants+=child.count||0;if(!hasWidgets&&child.hasWidgets){hasWidgets=true}if(!hasThunks&&child.hasThunks){hasThunks=true}if(!descendantHooks&&(child.hooks||child.descendantHooks)){descendantHooks=true}}else if(!hasWidgets&&isWidget(child)){if(typeof child.destroy==="function"){hasWidgets=true}}else if(!hasThunks&&isThunk(child)){hasThunks=true}}this.count=count+descendants;this.hasWidgets=hasWidgets;this.hasThunks=hasThunks;this.hooks=hooks;this.descendantHooks=descendantHooks}VirtualNode.prototype.version=version;VirtualNode.prototype.type="VirtualNode"},{"./is-thunk":10,"./is-vhook":11,"./is-vnode":12,"./is-widget":14,"./version":15}],17:[function(require,module,exports){var version=require("./version");module.exports=VirtualText;function VirtualText(text){this.text=String(text)}VirtualText.prototype.version=version;VirtualText.prototype.type="VirtualText"},{"./version":15}],"virtual-dom/h":[function(require,module,exports){var h=require("./virtual-hyperscript/index.js");module.exports=h},{"./virtual-hyperscript/index.js":8}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){(function(global){var topLevel=typeof global!=="undefined"?global:typeof window!=="undefined"?window:{};var minDoc=require("min-document");if(typeof document!=="undefined"){module.exports=document}else{var doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"];if(!doccy){doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"]=minDoc}module.exports=doccy}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"min-document":18}],2:[function(require,module,exports){"use strict";module.exports=function isObject(x){return typeof x==="object"&&x!==null}},{}],3:[function(require,module,exports){var nativeIsArray=Array.isArray;var toString=Object.prototype.toString;module.exports=nativeIsArray||isArray;function isArray(obj){return toString.call(obj)==="[object Array]"}},{}],4:[function(require,module,exports){var isObject=require("is-object");var isHook=require("../vnode/is-vhook.js");module.exports=applyProperties;function applyProperties(node,props,previous){for(var propName in props){var propValue=props[propName];if(propValue===undefined){removeProperty(node,propName,propValue,previous)}else if(isHook(propValue)){removeProperty(node,propName,propValue,previous);if(propValue.hook){propValue.hook(node,propName,previous?previous[propName]:undefined)}}else{if(isObject(propValue)){patchObject(node,props,previous,propName,propValue)}else{node[propName]=propValue}}}}function removeProperty(node,propName,propValue,previous){if(previous){var previousValue=previous[propName];if(!isHook(previousValue)){if(propName==="attributes"){for(var attrName in previousValue){node.removeAttribute(attrName)}}else if(propName==="style"){for(var i in previousValue){node.style[i]=""}}else if(typeof previousValue==="string"){node[propName]=""}else{node[propName]=null}}else if(previousValue.unhook){previousValue.unhook(node,propName,propValue)}}}function patchObject(node,props,previous,propName,propValue){var previousValue=previous?previous[propName]:undefined;if(propName==="attributes"){for(var attrName in propValue){var attrValue=propValue[attrName];if(attrValue===undefined){node.removeAttribute(attrName)}else{node.setAttribute(attrName,attrValue)}}return}if(previousValue&&isObject(previousValue)&&getPrototype(previousValue)!==getPrototype(propValue)){node[propName]=propValue;return}if(!isObject(node[propName])){node[propName]={}}var replacer=propName==="style"?"":undefined;for(var k in propValue){var value=propValue[k];node[propName][k]=value===undefined?replacer:value}}function getPrototype(value){if(Object.getPrototypeOf){return Object.getPrototypeOf(value)}else if(value.__proto__){return value.__proto__}else if(value.constructor){return value.constructor.prototype}}},{"../vnode/is-vhook.js":12,"is-object":2}],5:[function(require,module,exports){var document=require("global/document");var applyProperties=require("./apply-properties");var isVNode=require("../vnode/is-vnode.js");var isVText=require("../vnode/is-vtext.js");var isWidget=require("../vnode/is-widget.js");var handleThunk=require("../vnode/handle-thunk.js");module.exports=createElement;function createElement(vnode,opts){var doc=opts?opts.document||document:document;var warn=opts?opts.warn:null;vnode=handleThunk(vnode).a;if(isWidget(vnode)){return vnode.init()}else if(isVText(vnode)){return doc.createTextNode(vnode.text)}else if(!isVNode(vnode)){if(warn){warn("Item is not a valid virtual dom node",vnode)}return null}var node=vnode.namespace===null?doc.createElement(vnode.tagName):doc.createElementNS(vnode.namespace,vnode.tagName);var props=vnode.properties;applyProperties(node,props);var children=vnode.children;for(var i=0;i<children.length;i++){var childNode=createElement(children[i],opts);if(childNode){node.appendChild(childNode)}}return node}},{"../vnode/handle-thunk.js":10,"../vnode/is-vnode.js":13,"../vnode/is-vtext.js":14,"../vnode/is-widget.js":15,"./apply-properties":4,"global/document":1}],6:[function(require,module,exports){var noChild={};module.exports=domIndex;function domIndex(rootNode,tree,indices,nodes){if(!indices||indices.length===0){return{}}else{indices.sort(ascending);return recurse(rootNode,tree,indices,nodes,0)}}function recurse(rootNode,tree,indices,nodes,rootIndex){nodes=nodes||{};if(rootNode){if(indexInRange(indices,rootIndex,rootIndex)){nodes[rootIndex]=rootNode}var vChildren=tree.children;if(vChildren){var childNodes=rootNode.childNodes;for(var i=0;i<tree.children.length;i++){rootIndex+=1;var vChild=vChildren[i]||noChild;var nextIndex=rootIndex+(vChild.count||0);if(indexInRange(indices,rootIndex,nextIndex)){recurse(childNodes[i],vChild,indices,nodes,rootIndex)}rootIndex=nextIndex}}}return nodes}function indexInRange(indices,left,right){if(indices.length===0){return false}var minIndex=0;var maxIndex=indices.length-1;var currentIndex;var currentItem;while(minIndex<=maxIndex){currentIndex=(maxIndex+minIndex)/2>>0;currentItem=indices[currentIndex];if(minIndex===maxIndex){return currentItem>=left&&currentItem<=right}else if(currentItem<left){minIndex=currentIndex+1}else if(currentItem>right){maxIndex=currentIndex-1}else{return true}}return false}function ascending(a,b){return a>b?1:-1}},{}],7:[function(require,module,exports){var applyProperties=require("./apply-properties");var isWidget=require("../vnode/is-widget.js");var VPatch=require("../vnode/vpatch.js");var updateWidget=require("./update-widget");module.exports=applyPatch;function applyPatch(vpatch,domNode,renderOptions){var type=vpatch.type;var vNode=vpatch.vNode;var patch=vpatch.patch;switch(type){case VPatch.REMOVE:return removeNode(domNode,vNode);case VPatch.INSERT:return insertNode(domNode,patch,renderOptions);case VPatch.VTEXT:return stringPatch(domNode,vNode,patch,renderOptions);case VPatch.WIDGET:return widgetPatch(domNode,vNode,patch,renderOptions);case VPatch.VNODE:return vNodePatch(domNode,vNode,patch,renderOptions);case VPatch.ORDER:reorderChildren(domNode,patch);return domNode;case VPatch.PROPS:applyProperties(domNode,patch,vNode.properties);return domNode;case VPatch.THUNK:return replaceRoot(domNode,renderOptions.patch(domNode,patch,renderOptions));default:return domNode}}function removeNode(domNode,vNode){var parentNode=domNode.parentNode;if(parentNode){parentNode.removeChild(domNode)}destroyWidget(domNode,vNode);return null}function insertNode(parentNode,vNode,renderOptions){var newNode=renderOptions.render(vNode,renderOptions);if(parentNode){parentNode.appendChild(newNode)}return parentNode}function stringPatch(domNode,leftVNode,vText,renderOptions){var newNode;if(domNode.nodeType===3){domNode.replaceData(0,domNode.length,vText.text);newNode=domNode}else{var parentNode=domNode.parentNode;newNode=renderOptions.render(vText,renderOptions);if(parentNode&&newNode!==domNode){parentNode.replaceChild(newNode,domNode)}}return newNode}function widgetPatch(domNode,leftVNode,widget,renderOptions){var updating=updateWidget(leftVNode,widget);var newNode;if(updating){newNode=widget.update(leftVNode,domNode)||domNode}else{newNode=renderOptions.render(widget,renderOptions)}var parentNode=domNode.parentNode;if(parentNode&&newNode!==domNode){parentNode.replaceChild(newNode,domNode)}if(!updating){destroyWidget(domNode,leftVNode)}return newNode}function vNodePatch(domNode,leftVNode,vNode,renderOptions){var parentNode=domNode.parentNode;var newNode=renderOptions.render(vNode,renderOptions);if(parentNode&&newNode!==domNode){parentNode.replaceChild(newNode,domNode)}return newNode}function destroyWidget(domNode,w){if(typeof w.destroy==="function"&&isWidget(w)){w.destroy(domNode)}}function reorderChildren(domNode,moves){var childNodes=domNode.childNodes;var keyMap={};var node;var remove;var insert;for(var i=0;i<moves.removes.length;i++){remove=moves.removes[i];node=childNodes[remove.from];if(remove.key){keyMap[remove.key]=node}domNode.removeChild(node)}var length=childNodes.length;for(var j=0;j<moves.inserts.length;j++){insert=moves.inserts[j];node=keyMap[insert.key];domNode.insertBefore(node,insert.to>=length++?null:childNodes[insert.to])}}function replaceRoot(oldRoot,newRoot){if(oldRoot&&newRoot&&oldRoot!==newRoot&&oldRoot.parentNode){oldRoot.parentNode.replaceChild(newRoot,oldRoot)}return newRoot}},{"../vnode/is-widget.js":15,"../vnode/vpatch.js":17,"./apply-properties":4,"./update-widget":9}],8:[function(require,module,exports){var document=require("global/document");var isArray=require("x-is-array");var render=require("./create-element");var domIndex=require("./dom-index");var patchOp=require("./patch-op");module.exports=patch;function patch(rootNode,patches,renderOptions){renderOptions=renderOptions||{};renderOptions.patch=renderOptions.patch&&renderOptions.patch!==patch?renderOptions.patch:patchRecursive;renderOptions.render=renderOptions.render||render;return renderOptions.patch(rootNode,patches,renderOptions)}function patchRecursive(rootNode,patches,renderOptions){var indices=patchIndices(patches);if(indices.length===0){return rootNode}var index=domIndex(rootNode,patches.a,indices);var ownerDocument=rootNode.ownerDocument;if(!renderOptions.document&&ownerDocument!==document){renderOptions.document=ownerDocument}for(var i=0;i<indices.length;i++){var nodeIndex=indices[i];rootNode=applyPatch(rootNode,index[nodeIndex],patches[nodeIndex],renderOptions)}return rootNode}function applyPatch(rootNode,domNode,patchList,renderOptions){if(!domNode){return rootNode}var newNode;if(isArray(patchList)){for(var i=0;i<patchList.length;i++){newNode=patchOp(patchList[i],domNode,renderOptions);if(domNode===rootNode){rootNode=newNode}}}else{newNode=patchOp(patchList,domNode,renderOptions);if(domNode===rootNode){rootNode=newNode}}return rootNode}function patchIndices(patches){var indices=[];for(var key in patches){if(key!=="a"){indices.push(Number(key))}}return indices}},{"./create-element":5,"./dom-index":6,"./patch-op":7,"global/document":1,"x-is-array":3}],9:[function(require,module,exports){var isWidget=require("../vnode/is-widget.js");module.exports=updateWidget;function updateWidget(a,b){if(isWidget(a)&&isWidget(b)){if("name"in a&&"name"in b){return a.id===b.id}else{return a.init===b.init}}return false}},{"../vnode/is-widget.js":15}],10:[function(require,module,exports){var isVNode=require("./is-vnode");var isVText=require("./is-vtext");var isWidget=require("./is-widget");var isThunk=require("./is-thunk");module.exports=handleThunk;function handleThunk(a,b){var renderedA=a;var renderedB=b;if(isThunk(b)){renderedB=renderThunk(b,a)}if(isThunk(a)){renderedA=renderThunk(a,null)}return{a:renderedA,b:renderedB}}function renderThunk(thunk,previous){var renderedThunk=thunk.vnode;if(!renderedThunk){renderedThunk=thunk.vnode=thunk.render(previous)}if(!(isVNode(renderedThunk)||isVText(renderedThunk)||isWidget(renderedThunk))){throw new Error("thunk did not return a valid node")}return renderedThunk}},{"./is-thunk":11,
"./is-vnode":13,"./is-vtext":14,"./is-widget":15}],11:[function(require,module,exports){module.exports=isThunk;function isThunk(t){return t&&t.type==="Thunk"}},{}],12:[function(require,module,exports){module.exports=isHook;function isHook(hook){return hook&&(typeof hook.hook==="function"&&!hook.hasOwnProperty("hook")||typeof hook.unhook==="function"&&!hook.hasOwnProperty("unhook"))}},{}],13:[function(require,module,exports){var version=require("./version");module.exports=isVirtualNode;function isVirtualNode(x){return x&&x.type==="VirtualNode"&&x.version===version}},{"./version":16}],14:[function(require,module,exports){var version=require("./version");module.exports=isVirtualText;function isVirtualText(x){return x&&x.type==="VirtualText"&&x.version===version}},{"./version":16}],15:[function(require,module,exports){module.exports=isWidget;function isWidget(w){return w&&w.type==="Widget"}},{}],16:[function(require,module,exports){module.exports="2"},{}],17:[function(require,module,exports){var version=require("./version");VirtualPatch.NONE=0;VirtualPatch.VTEXT=1;VirtualPatch.VNODE=2;VirtualPatch.WIDGET=3;VirtualPatch.PROPS=4;VirtualPatch.ORDER=5;VirtualPatch.INSERT=6;VirtualPatch.REMOVE=7;VirtualPatch.THUNK=8;module.exports=VirtualPatch;function VirtualPatch(type,vNode,patch){this.type=Number(type);this.vNode=vNode;this.patch=patch}VirtualPatch.prototype.version=version;VirtualPatch.prototype.type="VirtualPatch"},{"./version":16}],18:[function(require,module,exports){},{}],"virtual-dom/patch":[function(require,module,exports){var patch=require("./vdom/patch.js");module.exports=patch},{"./vdom/patch.js":8}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){(function(global){var topLevel=typeof global!=="undefined"?global:typeof window!=="undefined"?window:{};var minDoc=require("min-document");if(typeof document!=="undefined"){module.exports=document}else{var doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"];if(!doccy){doccy=topLevel["__GLOBAL_DOCUMENT_CACHE@4"]=minDoc}module.exports=doccy}}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"min-document":12}],2:[function(require,module,exports){"use strict";module.exports=function isObject(x){return typeof x==="object"&&x!==null}},{}],3:[function(require,module,exports){var isObject=require("is-object");var isHook=require("../vnode/is-vhook.js");module.exports=applyProperties;function applyProperties(node,props,previous){for(var propName in props){var propValue=props[propName];if(propValue===undefined){removeProperty(node,propName,propValue,previous)}else if(isHook(propValue)){removeProperty(node,propName,propValue,previous);if(propValue.hook){propValue.hook(node,propName,previous?previous[propName]:undefined)}}else{if(isObject(propValue)){patchObject(node,props,previous,propName,propValue)}else{node[propName]=propValue}}}}function removeProperty(node,propName,propValue,previous){if(previous){var previousValue=previous[propName];if(!isHook(previousValue)){if(propName==="attributes"){for(var attrName in previousValue){node.removeAttribute(attrName)}}else if(propName==="style"){for(var i in previousValue){node.style[i]=""}}else if(typeof previousValue==="string"){node[propName]=""}else{node[propName]=null}}else if(previousValue.unhook){previousValue.unhook(node,propName,propValue)}}}function patchObject(node,props,previous,propName,propValue){var previousValue=previous?previous[propName]:undefined;if(propName==="attributes"){for(var attrName in propValue){var attrValue=propValue[attrName];if(attrValue===undefined){node.removeAttribute(attrName)}else{node.setAttribute(attrName,attrValue)}}return}if(previousValue&&isObject(previousValue)&&getPrototype(previousValue)!==getPrototype(propValue)){node[propName]=propValue;return}if(!isObject(node[propName])){node[propName]={}}var replacer=propName==="style"?"":undefined;for(var k in propValue){var value=propValue[k];node[propName][k]=value===undefined?replacer:value}}function getPrototype(value){if(Object.getPrototypeOf){return Object.getPrototypeOf(value)}else if(value.__proto__){return value.__proto__}else if(value.constructor){return value.constructor.prototype}}},{"../vnode/is-vhook.js":7,"is-object":2}],4:[function(require,module,exports){var document=require("global/document");var applyProperties=require("./apply-properties");var isVNode=require("../vnode/is-vnode.js");var isVText=require("../vnode/is-vtext.js");var isWidget=require("../vnode/is-widget.js");var handleThunk=require("../vnode/handle-thunk.js");module.exports=createElement;function createElement(vnode,opts){var doc=opts?opts.document||document:document;var warn=opts?opts.warn:null;vnode=handleThunk(vnode).a;if(isWidget(vnode)){return vnode.init()}else if(isVText(vnode)){return doc.createTextNode(vnode.text)}else if(!isVNode(vnode)){if(warn){warn("Item is not a valid virtual dom node",vnode)}return null}var node=vnode.namespace===null?doc.createElement(vnode.tagName):doc.createElementNS(vnode.namespace,vnode.tagName);var props=vnode.properties;applyProperties(node,props);var children=vnode.children;for(var i=0;i<children.length;i++){var childNode=createElement(children[i],opts);if(childNode){node.appendChild(childNode)}}return node}},{"../vnode/handle-thunk.js":5,"../vnode/is-vnode.js":8,"../vnode/is-vtext.js":9,"../vnode/is-widget.js":10,"./apply-properties":3,"global/document":1}],5:[function(require,module,exports){var isVNode=require("./is-vnode");var isVText=require("./is-vtext");var isWidget=require("./is-widget");var isThunk=require("./is-thunk");module.exports=handleThunk;function handleThunk(a,b){var renderedA=a;var renderedB=b;if(isThunk(b)){renderedB=renderThunk(b,a)}if(isThunk(a)){renderedA=renderThunk(a,null)}return{a:renderedA,b:renderedB}}function renderThunk(thunk,previous){var renderedThunk=thunk.vnode;if(!renderedThunk){renderedThunk=thunk.vnode=thunk.render(previous)}if(!(isVNode(renderedThunk)||isVText(renderedThunk)||isWidget(renderedThunk))){throw new Error("thunk did not return a valid node")}return renderedThunk}},{"./is-thunk":6,"./is-vnode":8,"./is-vtext":9,"./is-widget":10}],6:[function(require,module,exports){module.exports=isThunk;function isThunk(t){return t&&t.type==="Thunk"}},{}],7:[function(require,module,exports){module.exports=isHook;function isHook(hook){return hook&&(typeof hook.hook==="function"&&!hook.hasOwnProperty("hook")||typeof hook.unhook==="function"&&!hook.hasOwnProperty("unhook"))}},{}],8:[function(require,module,exports){var version=require("./version");module.exports=isVirtualNode;function isVirtualNode(x){return x&&x.type==="VirtualNode"&&x.version===version}},{"./version":11}],9:[function(require,module,exports){var version=require("./version");module.exports=isVirtualText;function isVirtualText(x){return x&&x.type==="VirtualText"&&x.version===version}},{"./version":11}],10:[function(require,module,exports){module.exports=isWidget;function isWidget(w){return w&&w.type==="Widget"}},{}],11:[function(require,module,exports){module.exports="2"},{}],12:[function(require,module,exports){},{}],"virtual-dom/create-element":[function(require,module,exports){var createElement=require("./vdom/create-element.js");module.exports=createElement},{"./vdom/create-element.js":4}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";module.exports=function isObject(x){return typeof x==="object"&&x!==null}},{}],2:[function(require,module,exports){var nativeIsArray=Array.isArray;var toString=Object.prototype.toString;module.exports=nativeIsArray||isArray;function isArray(obj){return toString.call(obj)==="[object Array]"}},{}],3:[function(require,module,exports){var isVNode=require("./is-vnode");var isVText=require("./is-vtext");var isWidget=require("./is-widget");var isThunk=require("./is-thunk");module.exports=handleThunk;function handleThunk(a,b){var renderedA=a;var renderedB=b;if(isThunk(b)){renderedB=renderThunk(b,a)}if(isThunk(a)){renderedA=renderThunk(a,null)}return{a:renderedA,b:renderedB}}function renderThunk(thunk,previous){var renderedThunk=thunk.vnode;if(!renderedThunk){renderedThunk=thunk.vnode=thunk.render(previous)}if(!(isVNode(renderedThunk)||isVText(renderedThunk)||isWidget(renderedThunk))){throw new Error("thunk did not return a valid node")}return renderedThunk}},{"./is-thunk":4,"./is-vnode":6,"./is-vtext":7,"./is-widget":8}],4:[function(require,module,exports){module.exports=isThunk;function isThunk(t){return t&&t.type==="Thunk"}},{}],5:[function(require,module,exports){module.exports=isHook;function isHook(hook){return hook&&(typeof hook.hook==="function"&&!hook.hasOwnProperty("hook")||typeof hook.unhook==="function"&&!hook.hasOwnProperty("unhook"))}},{}],6:[function(require,module,exports){var version=require("./version");module.exports=isVirtualNode;function isVirtualNode(x){return x&&x.type==="VirtualNode"&&x.version===version}},{"./version":9}],7:[function(require,module,exports){var version=require("./version");module.exports=isVirtualText;function isVirtualText(x){return x&&x.type==="VirtualText"&&x.version===version}},{"./version":9}],8:[function(require,module,exports){module.exports=isWidget;function isWidget(w){return w&&w.type==="Widget"}},{}],9:[function(require,module,exports){module.exports="2"},{}],10:[function(require,module,exports){var version=require("./version");VirtualPatch.NONE=0;VirtualPatch.VTEXT=1;VirtualPatch.VNODE=2;VirtualPatch.WIDGET=3;VirtualPatch.PROPS=4;VirtualPatch.ORDER=5;VirtualPatch.INSERT=6;VirtualPatch.REMOVE=7;VirtualPatch.THUNK=8;module.exports=VirtualPatch;function VirtualPatch(type,vNode,patch){this.type=Number(type);this.vNode=vNode;this.patch=patch}VirtualPatch.prototype.version=version;VirtualPatch.prototype.type="VirtualPatch"},{"./version":9}],11:[function(require,module,exports){var isObject=require("is-object");var isHook=require("../vnode/is-vhook");module.exports=diffProps;function diffProps(a,b){var diff;for(var aKey in a){if(!(aKey in b)){diff=diff||{};diff[aKey]=undefined}var aValue=a[aKey];var bValue=b[aKey];if(aValue===bValue){continue}else if(isObject(aValue)&&isObject(bValue)){if(getPrototype(bValue)!==getPrototype(aValue)){diff=diff||{};diff[aKey]=bValue}else if(isHook(bValue)){diff=diff||{};diff[aKey]=bValue}else{var objectDiff=diffProps(aValue,bValue);if(objectDiff){diff=diff||{};diff[aKey]=objectDiff}}}else{diff=diff||{};diff[aKey]=bValue}}for(var bKey in b){if(!(bKey in a)){diff=diff||{};diff[bKey]=b[bKey]}}return diff}function getPrototype(value){if(Object.getPrototypeOf){return Object.getPrototypeOf(value)}else if(value.__proto__){return value.__proto__}else if(value.constructor){return value.constructor.prototype}}},{"../vnode/is-vhook":5,"is-object":1}],12:[function(require,module,exports){var isArray=require("x-is-array");var VPatch=require("../vnode/vpatch");var isVNode=require("../vnode/is-vnode");var isVText=require("../vnode/is-vtext");var isWidget=require("../vnode/is-widget");var isThunk=require("../vnode/is-thunk");var handleThunk=require("../vnode/handle-thunk");var diffProps=require("./diff-props");module.exports=diff;function diff(a,b){var patch={a:a};walk(a,b,patch,0);return patch}function walk(a,b,patch,index){if(a===b){return}var apply=patch[index];var applyClear=false;if(isThunk(a)||isThunk(b)){thunks(a,b,patch,index)}else if(b==null){if(!isWidget(a)){clearState(a,patch,index);apply=patch[index]}apply=appendPatch(apply,new VPatch(VPatch.REMOVE,a,b))}else if(isVNode(b)){if(isVNode(a)){if(a.tagName===b.tagName&&a.namespace===b.namespace&&a.key===b.key){var propsPatch=diffProps(a.properties,b.properties);if(propsPatch){apply=appendPatch(apply,new VPatch(VPatch.PROPS,a,propsPatch))}apply=diffChildren(a,b,patch,apply,index)}else{apply=appendPatch(apply,new VPatch(VPatch.VNODE,a,b));applyClear=true}}else{apply=appendPatch(apply,new VPatch(VPatch.VNODE,a,b));applyClear=true}}else if(isVText(b)){if(!isVText(a)){apply=appendPatch(apply,new VPatch(VPatch.VTEXT,a,b));applyClear=true}else if(a.text!==b.text){apply=appendPatch(apply,new VPatch(VPatch.VTEXT,a,b))}}else if(isWidget(b)){if(!isWidget(a)){applyClear=true}apply=appendPatch(apply,new VPatch(VPatch.WIDGET,a,b))}if(apply){patch[index]=apply}if(applyClear){clearState(a,patch,index)}}function diffChildren(a,b,patch,apply,index){var aChildren=a.children;var orderedSet=reorder(aChildren,b.children);var bChildren=orderedSet.children;var aLen=aChildren.length;var bLen=bChildren.length;var len=aLen>bLen?aLen:bLen;for(var i=0;i<len;i++){var leftNode=aChildren[i];var rightNode=bChildren[i];index+=1;if(!leftNode){if(rightNode){apply=appendPatch(apply,new VPatch(VPatch.INSERT,null,rightNode))}}else{walk(leftNode,rightNode,patch,index)}if(isVNode(leftNode)&&leftNode.count){index+=leftNode.count}}if(orderedSet.moves){apply=appendPatch(apply,new VPatch(VPatch.ORDER,a,orderedSet.moves))}return apply}function clearState(vNode,patch,index){unhook(vNode,patch,index);destroyWidgets(vNode,patch,index)}function destroyWidgets(vNode,patch,index){if(isWidget(vNode)){if(typeof vNode.destroy==="function"){patch[index]=appendPatch(patch[index],new VPatch(VPatch.REMOVE,vNode,null))}}else if(isVNode(vNode)&&(vNode.hasWidgets||vNode.hasThunks)){var children=vNode.children;var len=children.length;for(var i=0;i<len;i++){var child=children[i];index+=1;destroyWidgets(child,patch,index);if(isVNode(child)&&child.count){index+=child.count}}}else if(isThunk(vNode)){thunks(vNode,null,patch,index)}}function thunks(a,b,patch,index){var nodes=handleThunk(a,b);var thunkPatch=diff(nodes.a,nodes.b);if(hasPatches(thunkPatch)){patch[index]=new VPatch(VPatch.THUNK,null,thunkPatch)}}function hasPatches(patch){for(var index in patch){if(index!=="a"){return true}}return false}function unhook(vNode,patch,index){if(isVNode(vNode)){if(vNode.hooks){patch[index]=appendPatch(patch[index],new VPatch(VPatch.PROPS,vNode,undefinedKeys(vNode.hooks)))}if(vNode.descendantHooks||vNode.hasThunks){var children=vNode.children;var len=children.length;for(var i=0;i<len;i++){var child=children[i];index+=1;unhook(child,patch,index);if(isVNode(child)&&child.count){index+=child.count}}}}else if(isThunk(vNode)){thunks(vNode,null,patch,index)}}function undefinedKeys(obj){var result={};for(var key in obj){result[key]=undefined}return result}function reorder(aChildren,bChildren){var bChildIndex=keyIndex(bChildren);var bKeys=bChildIndex.keys;var bFree=bChildIndex.free;if(bFree.length===bChildren.length){return{children:bChildren,moves:null}}var aChildIndex=keyIndex(aChildren);var aKeys=aChildIndex.keys;var aFree=aChildIndex.free;if(aFree.length===aChildren.length){return{children:bChildren,moves:null}}var newChildren=[];var freeIndex=0;var freeCount=bFree.length;var deletedItems=0;for(var i=0;i<aChildren.length;i++){var aItem=aChildren[i];var itemIndex;if(aItem.key){if(bKeys.hasOwnProperty(aItem.key)){itemIndex=bKeys[aItem.key];newChildren.push(bChildren[itemIndex])}else{itemIndex=i-deletedItems++;newChildren.push(null)}}else{if(freeIndex<freeCount){itemIndex=bFree[freeIndex++];newChildren.push(bChildren[itemIndex])}else{itemIndex=i-deletedItems++;newChildren.push(null)}}}var lastFreeIndex=freeIndex>=bFree.length?bChildren.length:bFree[freeIndex];for(var j=0;j<bChildren.length;j++){var newItem=bChildren[j];if(newItem.key){if(!aKeys.hasOwnProperty(newItem.key)){newChildren.push(newItem)}}else if(j>=lastFreeIndex){newChildren.push(newItem)}}var simulate=newChildren.slice();var simulateIndex=0;var removes=[];var inserts=[];var simulateItem;for(var k=0;k<bChildren.length;){var wantedItem=bChildren[k];simulateItem=simulate[simulateIndex];while(simulateItem===null&&simulate.length){removes.push(remove(simulate,simulateIndex,null));simulateItem=simulate[simulateIndex]}if(!simulateItem||simulateItem.key!==wantedItem.key){if(wantedItem.key){if(simulateItem&&simulateItem.key){if(bKeys[simulateItem.key]!==k+1){removes.push(remove(simulate,simulateIndex,simulateItem.key));simulateItem=simulate[simulateIndex];if(!simulateItem||simulateItem.key!==wantedItem.key){inserts.push({key:wantedItem.key,to:k})}else{simulateIndex++}}else{inserts.push({key:wantedItem.key,to:k})}}else{inserts.push({key:wantedItem.key,to:k})}k++}else if(simulateItem&&simulateItem.key){removes.push(remove(simulate,simulateIndex,simulateItem.key))}}else{simulateIndex++;k++}}while(simulateIndex<simulate.length){simulateItem=simulate[simulateIndex];removes.push(remove(simulate,simulateIndex,simulateItem&&simulateItem.key))}if(removes.length===deletedItems&&!inserts.length){return{children:newChildren,moves:null}}return{children:newChildren,moves:{removes:removes,inserts:inserts}}}function remove(arr,index,key){arr.splice(index,1);return{from:index,key:key}}function keyIndex(children){var keys={};var free=[];var length=children.length;for(var i=0;i<length;i++){var child=children[i];if(child.key){keys[child.key]=i}else{free.push(i)}}return{keys:keys,free:free}}function appendPatch(apply,patch){if(apply){if(isArray(apply)){apply.push(patch)}else{apply=[apply,patch]}return apply}else{return patch}}},{"../vnode/handle-thunk":3,"../vnode/is-thunk":4,"../vnode/is-vnode":6,"../vnode/is-vtext":7,"../vnode/is-widget":8,"../vnode/vpatch":10,"./diff-props":11,"x-is-array":2}],"virtual-dom/diff":[function(require,module,exports){var diff=require("./vtree/diff.js");module.exports=diff},{"./vtree/diff.js":12}]},{},[]);var most=require("most");var h=require("virtual-dom/h");var diff=require("virtual-dom/diff");var patch=require("virtual-dom/patch");var createElement=require("virtual-dom/create-element");var match=function(query){return function(evt){return evt.target.matches(query)}};var render=function(element,vtree$){vtree$.scan(function(tree,newTree){return tree?diff(tree,newTree):newTree}).scan(function(container){return function(rootNode,nextDiff){if(rootNode){rootNode=patch(rootNode,nextDiff)}else if(nextDiff){rootNode=createElement(nextDiff);container.appendChild(rootNode)}return rootNode}}(element)).drain()};var view=function(count){return h("div",[h("div","Count: "+String(count)),h("button.myButton","Click me")])};var appNode=document.getElementById("app");var add$=most.fromEvent("click",appNode).filter(match("button.myButton")).map(function(){return 1});var model$=add$.scan(function(count,inc){return count+inc},0).startWith(0);var view$=model$.map(view);render(appNode,view$);
{
"name": "requirebin-sketch",
"version": "1.0.0",
"dependencies": {
"most": "0.18.0",
"virtual-dom": "2.1.1"
}
}
<!-- contents of this file will be placed inside the <body> -->
<div>Simple most.js + vdom example</div>
<div id="app"></div>
<!-- contents of this file will be placed inside the <head> -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment