Comparing version 0.0.6 to 0.0.7
@@ -1,2 +0,3 @@ | ||
/*! spica v0.0.6 https://github.com/falsandtru/spica | (c) 2016, falsandtru | undefined License (undefined) */ | ||
define="function"==typeof define&&define.amd?define:function(){"use strict";var t="spica",e={};return function r(n,i,o){return o?void o.apply(this,i.map(function(t){switch(t){case"require":return"function"==typeof require?require:void 0;case"exports":return-1===n.indexOf("/")?e[n]="undefined"==typeof exports?self[n]=self[n]||{}:exports:e[n]=e.hasOwnProperty(n)?e[n]:{};default:return".d"===t.slice(-2)&&{}||e.hasOwnProperty(t)&&e[t]||"function"==typeof require&&require(t)||self[t]}})):void r(t,n,i)}}();var __extends=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)};define("src/lib/concat",["require","exports"],function(t,e){"use strict";function r(t,e){for(var r=0,n=e.length,i=t.length;n>r;++r)t[r+i]=e[r];return t}e.concat=r}),define("src/lib/observable",["require","exports","src/lib/concat"],function(t,e,r){"use strict";var n=function(){function t(){this.node_={parent:void 0,childrenMap:Object.create(null),childrenList:[],registers:[]}}return t.prototype.monitor=function(t,e,r){var n=this;return void 0===r&&(r=e),void this.throwTypeErrorIfInvalidSubscriber_(e,t),void this.seekNode_(t).registers.push([t,r,!0,e]),function(){return n.off(t,r)}},t.prototype.on=function(t,e,r){var n=this;return void 0===r&&(r=e),void this.throwTypeErrorIfInvalidSubscriber_(e,t),void this.seekNode_(t).registers.push([t,r,!1,function(t){return e(t)}]),function(){return n.off(t,r)}},t.prototype.off=function(t,e){switch(typeof e){case"function":return void void this.seekNode_(t).registers.some(function(t,r,n){var i=t[1];if(e!==i)return!1;switch(r){case 0:return!void n.shift();case n.length-1:return!void n.pop();default:return!void n.splice(r,1)}});case"undefined":var r=this.seekNode_(t);return r.childrenMap=Object.create(null),r.childrenList=[],void(r.registers=[]);default:throw this.throwTypeErrorIfInvalidSubscriber_(e,t)}},t.prototype.once=function(t,e){var r=this;return void this.throwTypeErrorIfInvalidSubscriber_(e,t),this.on(t,function(n){return void r.off(t,e),e(n)},e)},t.prototype.emit=function(t,e,r){void this.drain_(t,e,r)},t.prototype.reflect=function(t,e){var r;return void this.emit(t,e,function(t,e){return r=e}),r},t.prototype.drain_=function(t,e,r){var n=[];if(void this.refsBelow_(this.seekNode_(t)).reduce(function(t,i){var o=i[2],u=i[3];if(!o)try{var s=u(e);r&&(n[n.length]=s)}catch(c){void 0!==c&&null!==c&&void console.error(c+"")}},void 0),void this.refsAbove_(this.seekNode_(t)).reduce(function(t,r){var n=r[2],i=r[3];if(n)try{void i(e)}catch(o){void 0!==o&&null!==o&&void console.error(o)}},void 0),r)try{void r(e,n)}catch(i){void console.error(i)}},t.prototype.refs=function(t){return this.refsBelow_(this.seekNode_(t))},t.prototype.refsAbove_=function(t){var e=t.parent,n=t.registers;for(n=r.concat([],n);e;)n=r.concat(n,e.registers),e=e.parent;return n},t.prototype.refsBelow_=function(t){var e=t.childrenList,n=t.childrenMap,i=t.registers;i=r.concat([],i);for(var o=0;o<e.length;++o){var u=e[o],s=this.refsBelow_(n[u]);i=r.concat(i,s),0===s.length&&(void delete n[u],void e.splice(e.indexOf(u),1),void--o)}return i},t.prototype.seekNode_=function(t){for(var e=this.node_,r=0,n=t;r<n.length;r++){var i=n[r],o=e.childrenMap;o[i+""]||(void e.childrenList.push(i+""),e.childrenList=e.childrenList.sort(),o[i+""]={parent:e,childrenMap:Object.create(null),childrenList:[],registers:[]}),e=o[i+""]}return e},t.prototype.throwTypeErrorIfInvalidSubscriber_=function(t,e){switch(typeof t){case"function":return;default:throw new TypeError("Spica: Observable: Invalid subscriber.\n "+t)}},t}();e.Observable=n}),define("src/lib/sqid",["require","exports"],function(t,e){"use strict";function r(t){return void 0===t?(1e15+ ++n+"").slice(1):(1e15+t+"").slice(1)}var n=0;e.sqid=r}),define("src/lib/type",["require","exports"],function(t,e){"use strict";function r(t){return Object.prototype.toString.call(t).split(" ").pop().slice(0,-1)}e.type=r}),define("src/lib/collection/datamap",["require","exports","src/lib/sqid","src/lib/type"],function(t,e,r,n){"use strict";function i(t){return t instanceof Object==!1}var o=function(){function t(){this.store=new Map,this.weakstore=new WeakMap}return t.prototype.stringify=function(t){switch(typeof t){case"undefined":return"0:"+t;case"boolean":return"1:"+t;case"number":return"2:"+(1e3+(""+t).length)+":"+t;case"string":return"3:"+(1e14+t.length)+":"+t;default:return i(t)?"8:"+t:t instanceof Array?"9:[ "+this.stringifyArray(t)+" ]":"9:{ "+(this.weakstore.has(t)?this.weakstore.get(t):this.stringifyObject(t)||this.weakstore.set(t,r.sqid()))+" }"}},t.prototype.stringifyArray=function(t){for(var e="",r=0,n=t;r<n.length;r++){var i=n[r];e+=""+this.stringify(i)}return e},t.prototype.stringifyObject=function(t){if("Object"!==n.type(t))return"";for(var e=Object.keys(t),r="",i=0,o=e;i<o.length;i++){var u=o[i];r+=this.stringify(u)+": "+this.stringify(t[u])}return r||" "},t.prototype.get=function(t){return(this.store.get(this.stringify(t))||[])[1]},t.prototype.set=function(t,e){return void this.store.set(this.stringify(t),[t,e]),this},t.prototype.has=function(t){return this.store.has(this.stringify(t))},t.prototype["delete"]=function(t){return this.store["delete"](this.stringify(t))},t.prototype.clear=function(){return this.store.clear()},Object.defineProperty(t.prototype,"size",{get:function(){return this.store.size},enumerable:!0,configurable:!0}),t}();e.DataMap=o}),define("src/lib/tick",["require","exports"],function(t,e){"use strict";var r;!function(t){function e(t){void i.push(t),void n()}function r(){void n(),void--o;for(var t=i.length;t-- >0;)void i.shift()()}function n(){if(0!==i.length)for(;o<u.length;)void setTimeout(r,u[o%u.length]),void++o}t.queue=e;var i=[],o=0,u=[0,4,10,20,25].reverse()}(r||(r={}));var n=Function("return typeof process === 'object' && typeof window !== 'object'")();e.Tick=n?Function("return fn => process.nextTick(fn)")():r.queue}),define("src/lib/thenable",["require","exports"],function(t,e){"use strict";function r(t){return!!t&&"object"==typeof t&&void 0!==t.then}e.isThenable=r}),define("src/lib/noop",["require","exports"],function(t,e){"use strict";function r(){}e.noop=r}),define("src/lib/supervisor",["require","exports","src/lib/observable","src/lib/collection/datamap","src/lib/tick","src/lib/thenable","src/lib/concat","src/lib/noop"],function(t,e,r,n,i,o,u,s){"use strict";function c(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(var r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var a=function(){function t(e){var i=this,o=void 0===e?{}:e,u=o.name,c=void 0===u?"":u,a=o.dependencies,f=void 0===a?[]:a,h=o.retry,d=void 0===h?!1:h,p=o.timeout,l=void 0===p?0:p,v=o.destructor,y=void 0===v?s.noop:v;if(this.deps=new n.DataMap,this.events={exec:new r.Observable,fail:new r.Observable,loss:new r.Observable,exit:new r.Observable},this.procs=new r.Observable,this.alive=!0,this.registerable=!0,this.scheduled=!1,this.workerSharedResource={procs:this.procs,dependenciesStack:[]},this.queue=[],this.constructor===t)throw new Error("Spica: Supervisor: Cannot instantiate abstract classes.");this.name=c,void f.reduce(function(t,e){var r=e[0],n=e[1];return void i.deps.set(r,n)},void 0),this.retry=d,this.timeout=l,this.destructor_=y,void++this.constructor.count}return t.prototype.destructor=function(t){for(void this.checkState(),this.alive=!1;this.queue.length>0;){var e=this.queue.shift(),r=e[0],n=e[1];void this.events.loss.emit(r,[r,void 0,n])}try{void this.destructor_(t)}catch(i){void console.error(i)}void--this.constructor.count,void Object.freeze(this)},t.prototype.schedule=function(){var t=this;this.alive&&(this.scheduled||(void i.Tick(function(e){t.alive&&(t.scheduled=!1,void t.drain())}),this.scheduled=!0))},t.prototype.register=function(t,e){if(void this.checkState(),!this.registerable)throw new Error("Spica: Supervisor: Supervisor "+this.name+" cannot register process during the exiting.");return t=u.concat([],t),void this.schedule(),new h(this,this.workerSharedResource,t,e,this.deps.get(t)||[]).terminate},t.prototype.call=function(t,e,r,n){var i=this;void 0===r&&(r=this.timeout),void 0===n&&(n=s.noop),void this.checkState(),t=u.concat([],t),void this.queue.push([t,e,function(t,e){return void n(e,t)},r,Date.now()]),void this.schedule(),r>0!=!1&&void setTimeout(function(){return i.drain(t)},r)},t.prototype.cast=function(t,e,r){void 0===r&&(r=this.retry),void this.checkState();var n=this.procs.reflect(t,new f.Call(e));return 0===n.length&&void this.events.fail.emit(t,[t,void 0,e]),n.length>0||!r?n:this.cast(t,e,!1)},t.prototype.refs=function(t){return void this.checkState(),this.procs.refs(t).map(function(t){var e=(t[0],t[1]),r=e(void 0);return[r.namespace,r.process,r.terminate]})},t.prototype.terminate=function(t,e){void this.checkState(),void 0===t&&(this.registerable=!1),void this.procs.emit(t||[],new f.Exit(e)),void this.procs.off(t||[]),void 0===t&&void this.destructor(e)},t.prototype.checkState=function(){if(!this.alive)throw new Error("Spica: Supervisor: Supervisor "+this.name+" already exited.")},t.prototype.drain=function(t){void 0===t&&(t=[]);for(var e,r=Date.now(),n=function(n){var o=i.queue[n],u=o[0],s=o[1],c=o[2],a=o[3],h=o[4],d=t.every(function(t,e){return t===u[e]})?i.procs.reflect(u,new f.Call(s)):[];if(0===d.length&&void i.events.fail.emit(u,[u,void 0,s]),0===d.length&&h+a>r)return e=n,"continue";if(0===n?void i.queue.shift():void i.queue.splice(n,1),void--n,0===d.length&&void i.events.loss.emit(u,[u,void 0,s]),!c)return e=n,"continue";try{void c(s,d)}catch(p){void console.error(p)}e=n},i=this,o=0;o<this.queue.length;++o){n(o);o=e}},t.count=0,t.procs=0,t}();e.Supervisor=a;var f;!function(t){var e=function(){function t(){}return t}(),r=function(t){function e(e){t.call(this),this.namespace=e}return __extends(e,t),e}(e);t.Deps=r;var n=function(t){function e(e){t.call(this),this.data=e}return __extends(e,t),e}(e);t.Call=n;var i=function(t){function e(e){t.call(this),this.reason=e}return __extends(e,t),e}(e);t.Exit=i}(f||(f={}));var h=function(){function t(e,r,n,i,o){var u=this;this.sv=e,this.sharedResource=r,this.namespace=n,this.process=i,this.dependencies=o,this.alive=!0,this.called=!1,this.concurrency=1,this.receive=function(e){return t.prototype.receive.call(u,e)},this.terminate=function(e){return t.prototype.terminate.call(u,e)},this.sharedResource.allRefsCache=void 0,void++this.sv.constructor.procs,void this.sharedResource.procs.on(n,this.receive)}return t.prototype.destructor=function(t){void this.checkState(),void this.sharedResource.procs.off(this.namespace,this.receive),this.alive=!1,void--this.sv.constructor.procs,this.sharedResource.allRefsCache=void 0,void Object.freeze(this),void this.sv.events.exit.emit(this.namespace,[this.namespace,this.process,t])},t.prototype.tryDependencyResolving=function(t){if(this.receive(new f.Deps(this.namespace)))return void(this.sharedResource.dependenciesStack=[]);throw void(this.sharedResource.dependenciesStack=[])},t.prototype.receive=function(t){var e=this;if(void this.checkState(),void 0===t)return this;if(t instanceof f.Deps){if(t.namespace.length!==this.namespace.length)return!1;if(0===this.concurrency)return!1;for(var r=0,n=this.sharedResource.dependenciesStack;r<n.length;r++){var i=n[r];if(c(this.namespace,i))return!0}return void this.sharedResource.dependenciesStack.push(this.namespace),this.dependencies.every(function(t){return(e.sharedResource.allRefsCache=e.sharedResource.allRefsCache||e.sharedResource.procs.refs([])).some(function(e){var r=e[0],n=e[1];return c(r,t)&&!!n(new f.Deps(t))})})}if(t instanceof f.Call){if(0===this.concurrency)throw void 0;void this.tryDependencyResolving(t),this.called||(this.called=!0,void this.sv.events.exec.emit(this.namespace,[this.namespace,this.process]));try{void--this.concurrency;var u=(0,this.process)(t.data);return o.isThenable(u)?void u.then(function(t){void e.sv.schedule(),e.alive&&void++e.concurrency},function(t){void e.sv.schedule(),e.alive&&(void++e.concurrency,void e.terminate(t))}):void++this.concurrency,u}catch(s){throw void void this.terminate(s)}}if(t instanceof f.Exit)throw void void this.terminate(t.reason);throw new TypeError("Spica: Supervisor: Invalid command: "+t)},t.prototype.terminate=function(t){void this.destructor(t)},t.prototype.checkState=function(){if(!this.alive)throw new Error("Spica: Supervisor: Process "+this.namespace+"/"+this.process+" already exited.")},t}()}),define("src/lib/monad/lazy",["require","exports"],function(t,e){"use strict";var r=function(){function t(t){this.thunk=t}return t.prototype.evaluate=function(){return this.memory_=this.memory_||this.thunk()},t}();e.Lazy=r}),define("src/lib/monad/functor",["require","exports","src/lib/monad/lazy"],function(t,e,r){"use strict";var n=function(t){function e(){t.apply(this,arguments)}return __extends(e,t),e}(r.Lazy);e.Functor=n}),define("src/lib/monad/monad",["require","exports","src/lib/monad/functor"],function(t,e,r){"use strict";var n=function(t){function e(){t.apply(this,arguments)}return __extends(e,t),e}(r.Functor);e.Monad=n}),define("src/lib/monad/maybe.impl",["require","exports","src/lib/monad/monad"],function(t,e,r){"use strict";var n=function(t){function e(e){t.call(this,e),this.thunk=e}return __extends(e,t),e.prototype.bind=function(t){var r=this;return new e(function(){var n=r.evaluate();if(n instanceof i)return t(n.extract());if(n instanceof o)return n;if(n instanceof e)return n.bind(t);throw new TypeError("Spica: Maybe: Invalid monad value.\n "+n)})},e.prototype.fmap=function(t){return this.bind(function(e){return new i(t(e))})},e.prototype.extract=function(t){return this.evaluate().extract(t)},e}(r.Monad);e.Maybe=n;var i=function(t){function e(e){t.call(this),this.val_=e}return __extends(e,t),e.prototype.bind=function(t){var e=this;return new n(function(){return e}).bind(t)},e.prototype.extract=function(t){return this.val_},e}(n);e.Just=i;var o=function(t){function e(){t.apply(this,arguments)}return __extends(e,t),e.prototype.bind=function(t){return this},e.prototype.fmap=function(t){return this},e.prototype.extract=function(t){if(!t)throw void 0;return t()},e}(n);e.Nothing=o}),define("src/lib/monad/maybe",["require","exports","src/lib/monad/maybe.impl"],function(t,e,r){"use strict";var n;!function(t){function e(t){return new r.Just(t)}t.Just=e,t.Nothing=new r.Nothing,t.Return=e}(n=e.Maybe||(e.Maybe={})),e.Just=n.Just,e.Nothing=n.Nothing,e.Return=e.Just}),define("src/lib/monad/either.impl",["require","exports","src/lib/monad/monad"],function(t,e,r){"use strict";var n=function(t){function e(e){t.call(this,e),this.thunk=e}return __extends(e,t),e.prototype.bind=function(t){var r=this;return new e(function(){var n=r.evaluate();if(n instanceof i)return n;if(n instanceof o)return t(n.extract());if(n instanceof e)return n.bind(t);throw new TypeError("Spica: Either: Invalid monad value.\n "+n)})},e.prototype.fmap=function(t){return this.bind(function(e){return new o(t(e))})},e.prototype.extract=function(t){return this.evaluate().extract(t)},e}(r.Monad);e.Either=n;var i=function(t){function e(e){t.call(this),this.val_=e}return __extends(e,t),e.prototype.bind=function(t){return this},e.prototype.fmap=function(t){return this},e.prototype.extract=function(t){if(!t)throw this.val_;return t(this.val_)},e}(n);e.Left=i;var o=function(t){function e(e){t.call(this),this.val_=e}return __extends(e,t),e.prototype.bind=function(t){var e=this;return new n(function(){return e}).bind(t)},e.prototype.extract=function(t){return this.val_},e}(n);e.Right=o}),define("src/lib/monad/either",["require","exports","src/lib/monad/either.impl"],function(t,e,r){"use strict";var n;!function(t){function e(t){return new r.Left(t)}function n(t){return new r.Right(t)}t.Left=e,t.Right=n,t.Return=n}(n=e.Either||(e.Either={})),e.Left=n.Left,e.Right=n.Right,e.Return=n.Return}),define("src/lib/cancelable",["require","exports","src/lib/noop","src/lib/monad/maybe","src/lib/monad/either"],function(t,e,r,n,i){"use strict";var o=function(){function t(){var t=this;this.canceled=!1,this.promise=function(e){return t.canceled?t.promise_=t.promise_||new Promise(function(e,r){return void r(t.reason)}):Promise.resolve(e)},this.maybe=function(e){return t.canceled?n.Nothing:n.Just(e)},this.either=function(e){return t.canceled?i.Left(t.reason):i.Right(e)},this.cancel=function(e){return t.cancel=r.noop,t.canceled=!0,void(t.reason=e)}}return t}();e.Cancelable=o}),define("src/lib/monad/sequence",["require","exports","src/lib/monad/monad","src/lib/concat"],function(t,e,r,n){"use strict";function i(t,e){switch(arguments.length){case 0:return[];case 1:return[t];case 2:return[t,e];default:throw o(arguments)}}function o(t){return console.error(t,t.length,t[0],t[1]),new TypeError("Spica: Sequence: Invalid parameters of cons.")}function u(t){return console.error(t),new TypeError("Spica: Sequence: Invalid data.")}var s=function(t){function e(e,r){t.call(this),this.cons=e,this.memory=r,void Object.freeze(this)}return __extends(e,t),e.from=function(t){return new e(function(e,r){return void 0===e&&(e=0),e<t.length?r(t[e],++e):r()})},e.write=function(t){return new e(function(e,r){return t.length>0?r(t.shift(),t):r()})},e.random=function(t){switch(void 0===t&&(t=function(){return Math.random()}),!0){case Array.isArray(t):return e.random().map(function(e){return t[e*t.length|0]});default:return new e(function(e,r){return r(t(),NaN)})}},e.zip=function(t,r){return new e(function(n,i){var o=void 0===n?[function(){return t.iterate()},function(){return r.iterate()}]:n,u=o[0],s=o[1];return e.Iterator.when(u(),function(){return i()},function(t){return e.Iterator.when(s(),function(){return i()},function(r){return i([e.Thunk.value(t),e.Thunk.value(r)],[e.Thunk.iterator(t),e.Thunk.iterator(r)])})})})},e.union=function(t,r){function n(t,r,n){return new e(function(i,o){var u=void 0===i?[function(){return r.iterate()},function(){return n.iterate()}]:i,s=u[0],c=u[1];return e.Iterator.when(s(),function(){return e.Iterator.when(c(),function(){return o()},function(t){return o(e.Thunk.value(t),[e.Iterator.done,e.Thunk.iterator(t)])})},function(r){return e.Iterator.when(c(),function(){return o(e.Thunk.value(r),[e.Thunk.iterator(r),e.Iterator.done])},function(n){var i=t(e.Thunk.value(r),e.Thunk.value(n));return 0>i?o(e.Thunk.value(r),[e.Thunk.iterator(r),function(){return n}]):i>0?o(e.Thunk.value(n),[function(){return r},e.Thunk.iterator(n)]):o(e.Thunk.value(r),[e.Thunk.iterator(r),e.Thunk.iterator(n)])})})})}return r.reduce(function(e,r){return n(t,e,r)})},e.intersect=function(t,r){function n(t,r,n){return new e(function(i,o){var u=void 0===i?[function(){return r.iterate()},function(){return n.iterate()}]:i,s=u[0],c=u[1];return e.Iterator.when(s(),function(){return o()},function(r,n){return e.Iterator.when(c(),function(){return o()},function(i,u){var s=t(e.Thunk.value(r),e.Thunk.value(i));return 0>s?(c=function(){return i},n()):s>0?u():o(e.Thunk.value(r),[e.Thunk.iterator(r),e.Thunk.iterator(i)])})})})}return r.reduce(function(e,r){return n(t,e,r)})},e.prototype.iterate=function(){return this.iterate_()},e.prototype.iterate_=function(t,r){var n=this;void 0===r&&(r=0);var o=this.memory?this.memory.has(r)?this.memory.get(r):this.memory.set(r,this.cons(t,i)).get(r):this.cons(t,i);switch(o.length){case 0:return[void 0,e.Iterator.done,-1];case 1:return[o[0],function(){return e.Iterator.done()},r];case 2:return[o[0],function(){return n.iterate_(o[1],r+1)},r];default:throw u(o)}},e.prototype.memoize=function(t){return void 0===t&&(t=this.memory||new Map),new e(this.cons,this.memory||t)},e.prototype.read=function(){for(var t=this,r=[],i=function(){return t.iterate()};;){var o=i();if(!e.isIterable(o))return r;void n.concat(r,[e.Thunk.value(o)]),i=e.Thunk.iterator(o)}},e.prototype.fmap=function(t){var r=this;return new e(function(n){return void 0===n&&(n=function(){return r.iterate()}),e.Iterator.when(n(),function(){return i()},function(r){return i(t(e.Thunk.value(r)),e.Thunk.iterator(r))})})},e.prototype.bind=function(t){var r=this;return new e(function(n,i){var o=void 0===n?[function(){return r.iterate()},e.Iterator.done]:n,u=o[0],s=o[1];return e.Iterator.when(u(),function(){return i()},function(r,n){return s=s===e.Iterator.done?function(){return t(e.Thunk.value(r)).iterate()}:s,e.Iterator.when(s(),function(){return s=e.Iterator.done,n()},function(t){return i(e.Thunk.value(t),[function(){return r},e.Thunk.iterator(t)])})})})},e.prototype.filterM=function(t){var r=this;return this.take(1).bind(function(){var i=r.read();switch(i.length){case 0:return e.from([[]]);default:var o=i.shift();return t(o).bind(function(r){return r?0===i.length?e.from([[o]]):e.from(i).filterM(t).fmap(function(t){return n.concat([o],t)}):0===i.length?e.from([[]]):e.from(i).filterM(t)})}})},e.prototype.mapM=function(t){var r=this;return this.take(1).bind(function(){var i=r.read();switch(i.length){case 0:return e.from([]);default:var o=i.shift();return t(o).bind(function(r){return 0===i.length?e.from([[r]]):e.from(i).mapM(t).fmap(function(t){return n.concat([r],t)})})}})},e.prototype.map=function(t){var r=this;return new e(function(n){return void 0===n&&(n=function(){return r.iterate()}),e.Iterator.when(n(),function(){return i()},function(r){return i(t(e.Thunk.value(r),e.Thunk.index(r)),e.Thunk.iterator(r))})})},e.prototype.scan=function(t,r){var n=this;return new e(function(o){var u=void 0===o?[void 0,void 0]:o,s=u[0],c=void 0===s?r:s,a=u[1],f=void 0===a?function(){return n.iterate()}:a;return e.Iterator.when(f(),function(){return i()},function(r){return i(c=t(c,e.Thunk.value(r)),[c,e.Thunk.iterator(r)])})})},e.prototype.until=function(t){var r=this;return new e(function(n,i){return void 0===n&&(n=function(){return r.iterate()}),e.Iterator.when(n(),function(){return i()},function(r){return t(e.Thunk.value(r))?i(e.Thunk.value(r)):i(e.Thunk.value(r),e.Thunk.iterator(r))})})},e.prototype.take=function(t){return this.takeWhile(function(e,r){return t>r})},e.prototype.drop=function(t){return this.dropWhile(function(e,r){return t>r})},e.prototype.takeWhile=function(t){var r=this;return new e(function(n,i){return void 0===n&&(n=function(){return r.iterate()}),e.Iterator.when(n(),function(){return i()},function(r){return t(e.Thunk.value(r),e.Thunk.index(r))?i(e.Thunk.value(r),e.Thunk.iterator(r)):i()})})},e.prototype.dropWhile=function(t){var r=this;return new e(function(n,i){return void 0===n&&(n=function(){return r.iterate()}),e.Iterator.when(n(),function(){return i()},function(r,n){return t(e.Thunk.value(r),e.Thunk.index(r))?n():i(e.Thunk.value(r),e.Thunk.iterator(r))})})},e.prototype.filter=function(t){var r=this;return new e(function(n,i){return void 0===n&&(n=function(){return r.iterate()}),e.Iterator.when(n(),function(){return i()},function(r,n){return t(e.Thunk.value(r),e.Thunk.index(r))?i(e.Thunk.value(r),e.Thunk.iterator(r)):n()})})},e}(r.Monad);e.Sequence=s;var s;!function(t){function e(t){return r.iterator(t)!==n.done}var r;!function(t){function e(t){return t[0]}function r(t){return t[1]}function n(t){return t[2]}t.value=e,t.iterator=r,t.index=n}(r=t.Thunk||(t.Thunk={}));var n;!function(e){function n(e,i,o){return t.isIterable(e)?o(e,function(){return n(r.iterator(e)(),i,o)}):i(e)}e.done=function(){return[void 0,e.done,-1]},e.when=n}(n=t.Iterator||(t.Iterator={})),t.isIterable=e}(s=e.Sequence||(e.Sequence={}))}),define("src/lib/collection/attrmap",["require","exports"],function(t,e){"use strict";var r=function(){function t(){this.store=new WeakMap}return t.prototype.get=function(t,e){return this.store.get(t)&&this.store.get(t).get(e)},t.prototype.set=function(t,e,r){var n=this.store.has(t)?this.store.get(t):this.store.set(t,new Map).get(t);return void n.set(e,r),this},t.prototype.has=function(t,e){return this.store.has(t)&&this.store.get(t).has(e)},t.prototype["delete"]=function(t,e){return void 0===e?this.store["delete"](t):this.store.has(t)?this.store.get(t)["delete"](e):!1},t}();e.AttrMap=r}),define("src/lib/collection/relationmap",["require","exports"],function(t,e){"use strict";var r=function(){function t(){this.store=new WeakMap}return t.prototype.get=function(t,e){return this.store.get(t)&&this.store.get(t).get(e)},t.prototype.set=function(t,e,r){var n=this.store.has(t)?this.store.get(t):this.store.set(t,new WeakMap).get(t);return void n.set(e,r),this},t.prototype.has=function(t,e){return this.store.has(t)&&this.store.get(t).has(e)},t.prototype["delete"]=function(t,e){return void 0===e?this.store["delete"](t):this.store.has(t)?this.store.get(t)["delete"](e):!1},t}();e.RelationMap=r}),define("src/lib/fingerprint",["require","exports"],function(t,e){"use strict";function r(){return i(o([u(window.navigator),u(window.screen),u((new Date).getTimezoneOffset())].join()))}function n(){return i(o([u(process)].join()))}function i(t){return t.split("").reduce(function(t,e,r){return(+e*r+t)%1e9||t-+e},0)}function o(t){return t.split("").map(function(t){return t.charCodeAt(0)}).join("")}function u(t,e){if(void 0===e&&(e=5),e>0&&t&&"object"==typeof t){var r="{";for(var n in t)r+='"'+n+'": '+u(t[n],e-1)+",";return r+="}"}return!t||t.toString?'"'+t+'"':'"'+Object.prototype.toString.call(t)+'"'}e.FINGERPRINT="object"==typeof window?r():n(),e.browser=r,e.server=n,e.hash=i,e.str2digit=o,e.stringify=u}),define("src/lib/uuid",["require","exports","src/lib/fingerprint"],function(t,e,r){"use strict";function n(){var t=u=u*Date.now()%1e15;if(16>t||t>1e15)throw new Error("Spica: uuid: Invalid uuid dynamic seed.");for(var e="",r=0,n=o;r<n.length;r++){var i=n[r];if("x"===i||"y"===i){var s=Math.random()*t%16|0,c="x"==i?s:3&s|8;e+=c.toString(16)}else e+=i}return e.toLowerCase()}var i=r.FINGERPRINT*Date.now()%1e15;if(!i||"number"!=typeof i||100>i||i>1e15)throw new Error("Spica: uuid: Invalid uuid static seed.\n "+r.FINGERPRINT);var o=Object.freeze("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split("")),u=i;e.v4=n}),define("src/lib/assign",["require","exports","src/lib/type"],function(t,e,r){"use strict";function n(t){return function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if(void 0===e||null===e)throw new TypeError("Spica: assign: Cannot walk on "+e+".");for(var i=0,o=r;i<o.length;i++){var u=o[i];if(void 0!==u&&null!==u)for(var s=0,c=Object.keys(Object(u));s<c.length;s++){var a=c[s],f=Object.getOwnPropertyDescriptor(Object(u),a);void 0!==f&&f.enumerable&&void t(a,Object(e),Object(u))}}return Object(e)}}e.assign=n(function(t,e,r){return e[t]=r[t]}),e.clone=n(function(t,n,i){switch(r.type(i[t])){case"Array":return n[t]=e.clone([],i[t]);case"Function":case"Object":return n[t]=e.clone({},i[t]);default:return n[t]=i[t]}}),e.extend=n(function(t,n,i){switch(r.type(i[t])){case"Array":return n[t]=e.extend([],i[t]);case"Function":case"Object":switch(r.type(n[t])){case"Function":case"Object":return n[t]=e.extend(n[t],i[t]);default:return n[t]=e.extend({},i[t])}default:return n[t]=i[t]}})}),define("src/export",["require","exports","src/lib/supervisor","src/lib/observable","src/lib/cancelable","src/lib/monad/sequence","src/lib/monad/maybe","src/lib/monad/either","src/lib/collection/datamap","src/lib/collection/attrmap","src/lib/collection/relationmap","src/lib/tick","src/lib/fingerprint","src/lib/uuid","src/lib/sqid","src/lib/assign","src/lib/concat"],function(t,e,r,n,i,o,u,s,c,a,f,h,d,p,l,v,y){"use strict";e.Supervisor=r.Supervisor,e.Observable=n.Observable,e.Cancelable=i.Cancelable,e.Sequence=o.Sequence,e.Maybe=u.Maybe,e.Just=u.Just,e.Nothing=u.Nothing,e.Either=s.Either,e.Left=s.Left,e.Right=s.Right,e.DataMap=c.DataMap,e.AttrMap=a.AttrMap,e.RelationMap=f.RelationMap,e.Tick=h.Tick,e.FINGERPRINT=d.FINGERPRINT,e.uuid=p.v4,e.sqid=l.sqid,e.assign=v.assign,e.clone=v.clone,e.extend=v.extend,e.concat=y.concat}),define("spica",["require","exports","src/export"],function(t,e,r){"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}n(r)}); | ||
/*! spica v0.0.7 https://github.com/falsandtru/spica | (c) 2016, falsandtru | undefined License (undefined) */ | ||
define="function"==typeof define&&define.amd?define:function(){"use strict";var e="spica",t={};return function n(r,i,o){return o?void o.apply(this,i.map(function(e){switch(e){case"require":return"function"==typeof require?require:void 0;case"exports":return-1===r.indexOf("/")?t[r]="undefined"==typeof exports?self[r]=self[r]||{}:exports:t[r]=t.hasOwnProperty(r)?t[r]:{};default:return".d"===e.slice(-2)&&{}||t.hasOwnProperty(e)&&t[e]||"function"==typeof require&&require(e)||self[e]}})):void n(e,r,i)}}();var __extends=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)};define("src/lib/concat",["require","exports"],function(e,t){"use strict";function n(e,t){for(var n=0,r=t.length,i=e.length;r>n;++n)e[n+i]=t[n];return e}t.concat=n}),define("src/lib/observable",["require","exports","src/lib/concat"],function(e,t,n){"use strict";var r=function(){function e(){this.node_={parent:void 0,childrenMap:Object.create(null),childrenList:[],registers:[]}}return e.prototype.monitor=function(e,t,n){var r=this;return void 0===n&&(n=t),void this.throwTypeErrorIfInvalidSubscriber_(t,e),void this.seekNode_(e).registers.push([e,n,!0,t]),function(){return r.off(e,n)}},e.prototype.on=function(e,t,n){var r=this;return void 0===n&&(n=t),void this.throwTypeErrorIfInvalidSubscriber_(t,e),void this.seekNode_(e).registers.push([e,n,!1,function(e){return t(e)}]),function(){return r.off(e,n)}},e.prototype.off=function(e,t){switch(typeof t){case"function":return void void this.seekNode_(e).registers.some(function(e,n,r){var i=e[1];if(t!==i)return!1;switch(n){case 0:return!void r.shift();case r.length-1:return!void r.pop();default:return!void r.splice(n,1)}});case"undefined":var n=this.seekNode_(e);return n.childrenMap=Object.create(null),n.childrenList=[],void(n.registers=[]);default:throw this.throwTypeErrorIfInvalidSubscriber_(t,e)}},e.prototype.once=function(e,t){var n=this;return void this.throwTypeErrorIfInvalidSubscriber_(t,e),this.on(e,function(r){return void n.off(e,t),t(r)},t)},e.prototype.emit=function(e,t,n){void this.drain_(e,t,n)},e.prototype.reflect=function(e,t){var n;return void this.emit(e,t,function(e,t){return n=t}),n},e.prototype.drain_=function(e,t,n){var r=[];if(void this.refsBelow_(this.seekNode_(e)).reduce(function(e,i){var o=i[2],u=i[3];if(!o)try{var c=u(t);n&&(r[r.length]=c)}catch(s){void 0!==s&&null!==s&&void console.error(s+"")}},void 0),void this.refsAbove_(this.seekNode_(e)).reduce(function(e,n){var r=n[2],i=n[3];if(r)try{void i(t)}catch(o){void 0!==o&&null!==o&&void console.error(o)}},void 0),n)try{void n(t,r)}catch(i){void console.error(i)}},e.prototype.refs=function(e){return this.refsBelow_(this.seekNode_(e))},e.prototype.refsAbove_=function(e){var t=e.parent,r=e.registers;for(r=n.concat([],r);t;)r=n.concat(r,t.registers),t=t.parent;return r},e.prototype.refsBelow_=function(e){var t=e.childrenList,r=e.childrenMap,i=e.registers;i=n.concat([],i);for(var o=0;o<t.length;++o){var u=t[o],c=this.refsBelow_(r[u]);i=n.concat(i,c),0===c.length&&(void delete r[u],void t.splice(t.indexOf(u),1),void--o)}return i},e.prototype.seekNode_=function(e){for(var t=this.node_,n=0,r=e;n<r.length;n++){var i=r[n],o=t.childrenMap;o[i+""]||(void t.childrenList.push(i+""),t.childrenList=t.childrenList.sort(),o[i+""]={parent:t,childrenMap:Object.create(null),childrenList:[],registers:[]}),t=o[i+""]}return t},e.prototype.throwTypeErrorIfInvalidSubscriber_=function(e,t){switch(typeof e){case"function":return;default:throw new TypeError("Spica: Observable: Invalid subscriber.\n "+e)}},e}();t.Observable=r}),define("src/lib/sqid",["require","exports"],function(e,t){"use strict";function n(e){return void 0===e?(1e15+ ++r+"").slice(1):(1e15+e+"").slice(1)}var r=0;t.sqid=n}),define("src/lib/type",["require","exports"],function(e,t){"use strict";function n(e){return Object.prototype.toString.call(e).split(" ").pop().slice(0,-1)}t.type=n}),define("src/lib/collection/datamap",["require","exports","src/lib/sqid","src/lib/type"],function(e,t,n,r){"use strict";function i(e){return e instanceof Object==!1}var o=function(){function e(){this.store=new Map,this.weakstore=new WeakMap}return e.prototype.stringify=function(e){switch(typeof e){case"undefined":return"0:"+e;case"boolean":return"1:"+e;case"number":return"2:"+(1e3+(""+e).length)+":"+e;case"string":return"3:"+(1e14+e.length)+":"+e;default:return i(e)?"8:"+e:e instanceof Array?"9:[ "+this.stringifyArray(e)+" ]":"9:{ "+(this.weakstore.has(e)?this.weakstore.get(e):this.stringifyObject(e)||this.weakstore.set(e,n.sqid()))+" }"}},e.prototype.stringifyArray=function(e){for(var t="",n=0,r=e;n<r.length;n++){var i=r[n];t+=""+this.stringify(i)}return t},e.prototype.stringifyObject=function(e){if("Object"!==r.type(e))return"";for(var t=Object.keys(e),n="",i=0,o=t;i<o.length;i++){var u=o[i];n+=this.stringify(u)+": "+this.stringify(e[u])}return n||" "},e.prototype.get=function(e){return(this.store.get(this.stringify(e))||[])[1]},e.prototype.set=function(e,t){return void this.store.set(this.stringify(e),[e,t]),this},e.prototype.has=function(e){return this.store.has(this.stringify(e))},e.prototype["delete"]=function(e){return this.store["delete"](this.stringify(e))},e.prototype.clear=function(){return this.store.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this.store.size},enumerable:!0,configurable:!0}),e}();t.DataMap=o}),define("src/lib/tick",["require","exports"],function(e,t){"use strict";var n;!function(e){function t(e){void i.push(e),void r()}function n(){void r(),void--o;for(var e=i.length;e-- >0;)void i.shift()()}function r(){if(0!==i.length)for(;o<u.length;)void setTimeout(n,u[o%u.length]),void++o}e.queue=t;var i=[],o=0,u=[0,4,10,20,25].reverse()}(n||(n={}));var r=Function("return typeof process === 'object' && typeof window !== 'object'")();t.Tick=r?Function("return fn => process.nextTick(fn)")():n.queue}),define("src/lib/thenable",["require","exports"],function(e,t){"use strict";function n(e){return!!e&&"object"==typeof e&&void 0!==e.then}t.isThenable=n}),define("src/lib/noop",["require","exports"],function(e,t){"use strict";function n(){}t.noop=n}),define("src/lib/supervisor",["require","exports","src/lib/observable","src/lib/collection/datamap","src/lib/tick","src/lib/thenable","src/lib/concat","src/lib/noop"],function(e,t,n,r,i,o,u,c){"use strict";function s(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}var a=function(){function e(t){var i=this,o=void 0===t?{}:t,u=o.name,s=void 0===u?"":u,a=o.dependencies,f=void 0===a?[]:a,d=o.retry,l=void 0===d?!1:d,h=o.timeout,p=void 0===h?0:h,v=o.destructor,b=void 0===v?c.noop:v;if(this.deps=new r.DataMap,this.events={exec:new n.Observable,fail:new n.Observable,loss:new n.Observable,exit:new n.Observable},this.procs=new n.Observable,this.alive=!0,this.registerable=!0,this.scheduled=!1,this.workerSharedResource={procs:this.procs,dependenciesStack:[]},this.queue=[],this.constructor===e)throw new Error("Spica: Supervisor: Cannot instantiate abstract classes.");this.name=s,void f.reduce(function(e,t){var n=t[0],r=t[1];return void i.deps.set(n,r)},void 0),this.retry=l,this.timeout=p,this.destructor_=b,void++this.constructor.count}return e.prototype.destructor=function(e){for(void this.checkState(),this.alive=!1;this.queue.length>0;){var t=this.queue.shift(),n=t[0],r=t[1];void this.events.loss.emit(n,[n,void 0,r])}try{void this.destructor_(e)}catch(i){void console.error(i)}void--this.constructor.count,void Object.freeze(this)},e.prototype.schedule=function(){var e=this;this.alive&&(this.scheduled||(void i.Tick(function(t){e.alive&&(e.scheduled=!1,void e.drain())}),this.scheduled=!0))},e.prototype.register=function(e,t){if(void this.checkState(),!this.registerable)throw new Error("Spica: Supervisor: Supervisor "+this.name+" cannot register process during the exiting.");return e=u.concat([],e),void this.schedule(),new d(this,this.workerSharedResource,e,t,this.deps.get(e)||[]).terminate},e.prototype.call=function(e,t,n,r){var i=this;void 0===n&&(n=this.timeout),void 0===r&&(r=c.noop),void this.checkState(),e=u.concat([],e),void this.queue.push([e,t,function(e,t){return void r(t,e)},n,Date.now()]),void this.schedule(),n>0!=!1&&void setTimeout(function(){return i.drain(e)},n)},e.prototype.cast=function(e,t,n){void 0===n&&(n=this.retry),void this.checkState();var r=this.procs.reflect(e,new f.Call(t));return 0===r.length&&void this.events.fail.emit(e,[e,void 0,t]),r.length>0||!n?r:this.cast(e,t,!1)},e.prototype.refs=function(e){return void this.checkState(),this.procs.refs(e).map(function(e){var t=(e[0],e[1]),n=t(void 0);return[n.namespace,n.process,n.terminate]})},e.prototype.terminate=function(e,t){void this.checkState(),void 0===e&&(this.registerable=!1),void this.procs.emit(e||[],new f.Exit(t)),void this.procs.off(e||[]),void 0===e&&void this.destructor(t)},e.prototype.checkState=function(){if(!this.alive)throw new Error("Spica: Supervisor: Supervisor "+this.name+" already exited.")},e.prototype.drain=function(e){void 0===e&&(e=[]);for(var t,n=Date.now(),r=function(r){var o=i.queue[r],u=o[0],c=o[1],s=o[2],a=o[3],d=o[4],l=e.every(function(e,t){return e===u[t]})?i.procs.reflect(u,new f.Call(c)):[];if(0===l.length&&void i.events.fail.emit(u,[u,void 0,c]),0===l.length&&d+a>n)return t=r,"continue";if(0===r?void i.queue.shift():void i.queue.splice(r,1),void--r,0===l.length&&void i.events.loss.emit(u,[u,void 0,c]),!s)return t=r,"continue";try{void s(c,l)}catch(h){void console.error(h)}t=r},i=this,o=0;o<this.queue.length;++o){r(o);o=t}},e.count=0,e.procs=0,e}();t.Supervisor=a;var f;!function(e){var t=function(){function e(){}return e}(),n=function(e){function t(t){e.call(this),this.namespace=t}return __extends(t,e),t}(t);e.Deps=n;var r=function(e){function t(t){e.call(this),this.data=t}return __extends(t,e),t}(t);e.Call=r;var i=function(e){function t(t){e.call(this),this.reason=t}return __extends(t,e),t}(t);e.Exit=i}(f||(f={}));var d=function(){function e(t,n,r,i,o){var u=this;this.sv=t,this.sharedResource=n,this.namespace=r,this.process=i,this.dependencies=o,this.alive=!0,this.called=!1,this.concurrency=1,this.receive=function(t){return e.prototype.receive.call(u,t)},this.terminate=function(t){return e.prototype.terminate.call(u,t)},this.sharedResource.allRefsCache=void 0,void++this.sv.constructor.procs,void this.sharedResource.procs.on(r,this.receive)}return e.prototype.destructor=function(e){void this.checkState(),void this.sharedResource.procs.off(this.namespace,this.receive),this.alive=!1,void--this.sv.constructor.procs,this.sharedResource.allRefsCache=void 0,void Object.freeze(this),void this.sv.events.exit.emit(this.namespace,[this.namespace,this.process,e])},e.prototype.tryDependencyResolving=function(e){if(this.receive(new f.Deps(this.namespace)))return void(this.sharedResource.dependenciesStack=[]);throw void(this.sharedResource.dependenciesStack=[])},e.prototype.receive=function(e){var t=this;if(void this.checkState(),void 0===e)return this;if(e instanceof f.Deps){if(e.namespace.length!==this.namespace.length)return!1;if(0===this.concurrency)return!1;for(var n=0,r=this.sharedResource.dependenciesStack;n<r.length;n++){var i=r[n];if(s(this.namespace,i))return!0}return void this.sharedResource.dependenciesStack.push(this.namespace),this.dependencies.every(function(e){return(t.sharedResource.allRefsCache=t.sharedResource.allRefsCache||t.sharedResource.procs.refs([])).some(function(t){var n=t[0],r=t[1];return s(n,e)&&!!r(new f.Deps(e))})})}if(e instanceof f.Call){if(0===this.concurrency)throw void 0;void this.tryDependencyResolving(e),this.called||(this.called=!0,void this.sv.events.exec.emit(this.namespace,[this.namespace,this.process]));try{void--this.concurrency;var u=(0,this.process)(e.data);return o.isThenable(u)?void u.then(function(e){void t.sv.schedule(),t.alive&&void++t.concurrency},function(e){void t.sv.schedule(),t.alive&&(void++t.concurrency,void t.terminate(e))}):void++this.concurrency,u}catch(c){throw void void this.terminate(c)}}if(e instanceof f.Exit)throw void void this.terminate(e.reason);throw new TypeError("Spica: Supervisor: Invalid command: "+e)},e.prototype.terminate=function(e){void this.destructor(e)},e.prototype.checkState=function(){if(!this.alive)throw new Error("Spica: Supervisor: Process "+this.namespace+"/"+this.process+" already exited.")},e}()}),define("src/lib/monad/lazy",["require","exports"],function(e,t){"use strict";var n=function(){function e(e){this.thunk=e}return e.prototype.evaluate=function(){return this.memory_=this.memory_||this.thunk()},e}();t.Lazy=n}),define("src/lib/monad/functor",["require","exports","src/lib/monad/lazy"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t}(n.Lazy);t.Functor=r}),define("src/lib/monad/monad",["require","exports","src/lib/monad/functor"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t}(n.Functor);t.Monad=r}),define("src/lib/monad/maybe.impl",["require","exports","src/lib/monad/monad"],function(e,t,n){"use strict";var r=function(e){function t(t){e.call(this,t),this.thunk=t}return __extends(t,e),t.prototype.bind=function(e){var n=this;return new t(function(){var r=n.evaluate();if(r instanceof i)return e(r.extract());if(r instanceof o)return r;if(r instanceof t)return r.bind(e);throw new TypeError("Spica: Maybe: Invalid monad value.\n "+r)})},t.prototype.fmap=function(e){return this.bind(function(t){return new i(e(t))})},t.prototype.extract=function(e){return this.evaluate().extract(e)},t}(n.Monad);t.Maybe=r;var i=function(e){function t(t){e.call(this),this.val_=t}return __extends(t,e),t.prototype.bind=function(e){var t=this;return new r(function(){return t}).bind(e)},t.prototype.extract=function(e){return this.val_},t}(r);t.Just=i;var o=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.bind=function(e){return this},t.prototype.fmap=function(e){return this},t.prototype.extract=function(e){if(!e)throw void 0;return e()},t}(r);t.Nothing=o}),define("src/lib/monad/maybe",["require","exports","src/lib/monad/maybe.impl"],function(e,t,n){"use strict";var r;!function(e){function t(e){return new n.Just(e)}e.Just=t,e.Nothing=new n.Nothing,e.Return=t}(r=t.Maybe||(t.Maybe={})),t.Just=r.Just,t.Nothing=r.Nothing,t.Return=t.Just}),define("src/lib/monad/either.impl",["require","exports","src/lib/monad/monad"],function(e,t,n){"use strict";var r=function(e){function t(t){e.call(this,t),this.thunk=t}return __extends(t,e),t.prototype.bind=function(e){var n=this;return new t(function(){var r=n.evaluate();if(r instanceof i)return r;if(r instanceof o)return e(r.extract());if(r instanceof t)return r.bind(e);throw new TypeError("Spica: Either: Invalid monad value.\n "+r)})},t.prototype.fmap=function(e){return this.bind(function(t){return new o(e(t))})},t.prototype.extract=function(e){return this.evaluate().extract(e)},t}(n.Monad);t.Either=r;var i=function(e){function t(t){e.call(this),this.val_=t}return __extends(t,e),t.prototype.bind=function(e){return this},t.prototype.fmap=function(e){return this},t.prototype.extract=function(e){if(!e)throw this.val_;return e(this.val_)},t}(r);t.Left=i;var o=function(e){function t(t){e.call(this),this.val_=t}return __extends(t,e),t.prototype.bind=function(e){var t=this;return new r(function(){return t}).bind(e)},t.prototype.extract=function(e){return this.val_},t}(r);t.Right=o}),define("src/lib/monad/either",["require","exports","src/lib/monad/either.impl"],function(e,t,n){"use strict";var r;!function(e){function t(e){return new n.Left(e)}function r(e){return new n.Right(e)}e.Left=t,e.Right=r,e.Return=r}(r=t.Either||(t.Either={})),t.Left=r.Left,t.Right=r.Right,t.Return=r.Return}),define("src/lib/cancelable",["require","exports","src/lib/noop","src/lib/monad/maybe","src/lib/monad/either"],function(e,t,n,r,i){"use strict";var o=function(){function e(){var e=this;this.canceled=!1,this.promise=function(t){return e.canceled?e.promise_=e.promise_||new Promise(function(t,n){return void n(e.reason)}):Promise.resolve(t)},this.maybe=function(t){return e.canceled?r.Nothing:r.Just(t)},this.either=function(t){return e.canceled?i.Left(e.reason):i.Right(t)},this.cancel=function(t){return e.cancel=n.noop,e.canceled=!0,void(e.reason=t)}}return e}();t.Cancelable=o}),define("src/lib/monad/sequence/core",["require","exports","src/lib/monad/monad"],function(e,t,n){"use strict";var r=function(e){function t(t,n){e.call(this),this.cons=t,this.memory=n}return __extends(t,e),t}(n.Monad);t.Sequence=r;var r;!function(e){}(r=t.Sequence||(t.Sequence={}));var r;!function(e){function t(t,n){switch(arguments.length){case 0:return[];case 1:return[t];case 2:return[t,n];default:throw e.Exception.invalidConsError(arguments)}}function n(e){return r.iterator(e)!==i.done}e.cons=t;var r;!function(e){function t(e){return e[0]}function n(e){return e[1]}function r(e){return e[2]}e.value=t,e.iterator=n,e.index=r}(r=e.Thunk||(e.Thunk={}));var i;!function(t){function n(t,i,o){return e.isIterable(t)?o(t,function(){return n(r.iterator(t)(),i,o)}):i(t)}t.done=function(){return[void 0,t.done,-1]},t.when=n}(i=e.Iterator||(e.Iterator={})),e.isIterable=n;var o;!function(e){function t(e){return console.error(e,e.length,e[0],e[1]),new TypeError("Spica: Sequence: Invalid parameters of cons.")}function n(e){return console.error(e),new TypeError("Spica: Sequence: Invalid data.")}function r(e){return console.error(e),new TypeError("Spica: Sequence: Invalid thunk.")}e.invalidConsError=t,e.invalidDataError=n,e.invalidThunkError=r}(o=e.Exception||(e.Exception={}))}(r=t.Sequence||(t.Sequence={}))}),define("src/lib/assign",["require","exports","src/lib/type"],function(e,t,n){"use strict";function r(e){return function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if(void 0===t||null===t)throw new TypeError("Spica: assign: Cannot walk on "+t+".");for(var i=0,o=n;i<o.length;i++){var u=o[i];if(void 0!==u&&null!==u)for(var c=0,s=Object.keys(Object(u));c<s.length;c++){var a=s[c],f=Object.getOwnPropertyDescriptor(Object(u),a);void 0!==f&&f.enumerable&&void e(a,Object(t),Object(u))}}return Object(t)}}t.assign=r(function(e,t,n){return t[e]=n[e]}),t.clone=r(function(e,r,i){switch(n.type(i[e])){case"Array":return r[e]=t.clone([],i[e]);case"Function":case"Object":return r[e]=t.clone({},i[e]);default:return r[e]=i[e]}}),t.extend=r(function(e,r,i){switch(n.type(i[e])){case"Array":return r[e]=t.extend([],i[e]);case"Function":case"Object":switch(n.type(r[e])){case"Function":case"Object":return r[e]=t.extend(r[e],i[e]);default:return r[e]=t.extend({},i[e])}default:return r[e]=i[e]}})}),define("src/lib/compose",["require","exports","src/lib/assign","src/lib/concat"],function(e,t,n,r){"use strict";function i(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return r.concat([e],t).reduce(function(e,t){void n.assign(e.prototype,t.prototype);for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e})}t.compose=i}),define("src/lib/monad/sequence/member/static/from",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.from=function(e){return new n.Sequence(function(t,n){return void 0===t&&(t=0),t<e.length?n(e[t],++t):n()})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/write",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.write=function(e){return new n.Sequence(function(t,n){return e.length>0?n(e.shift(),e):n()})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/random",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.random=function(e){switch(void 0===e&&(e=function(){return Math.random()}),!0){case Array.isArray(e):return this.random().map(function(t){return e[t*e.length|0]});default:return new n.Sequence(function(t,n){return n(e(),NaN)})}},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/zip",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.zip=function(e,t){return new n.Sequence(function(r,i){var o=void 0===r?[function(){return e.iterate()},function(){return t.iterate()}]:r,u=o[0],c=o[1];return n.Sequence.Iterator.when(u(),function(){return i()},function(e){return n.Sequence.Iterator.when(c(),function(){return i()},function(t){return i([n.Sequence.Thunk.value(e),n.Sequence.Thunk.value(t)],[n.Sequence.Thunk.iterator(e),n.Sequence.Thunk.iterator(t)])})})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/union",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.union=function(e,t){function r(e,t,r){return new n.Sequence(function(i,o){var u=void 0===i?[function(){return t.iterate()},function(){return r.iterate()}]:i,c=u[0],s=u[1];return n.Sequence.Iterator.when(c(),function(){return n.Sequence.Iterator.when(s(),function(){return o()},function(e){return o(n.Sequence.Thunk.value(e),[n.Sequence.Iterator.done,n.Sequence.Thunk.iterator(e)])})},function(t){return n.Sequence.Iterator.when(s(),function(){return o(n.Sequence.Thunk.value(t),[n.Sequence.Thunk.iterator(t),n.Sequence.Iterator.done])},function(r){var i=e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.value(r));return 0>i?o(n.Sequence.Thunk.value(t),[n.Sequence.Thunk.iterator(t),function(){return r}]):i>0?o(n.Sequence.Thunk.value(r),[function(){return t},n.Sequence.Thunk.iterator(r)]):o(n.Sequence.Thunk.value(t),[n.Sequence.Thunk.iterator(t),n.Sequence.Thunk.iterator(r)])})})})}return t.reduce(function(t,n){return r(e,t,n)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/intersect",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.intersect=function(e,t){function r(e,t,r){return new n.Sequence(function(i,o){var u=void 0===i?[function(){return t.iterate()},function(){return r.iterate()}]:i,c=u[0],s=u[1];return n.Sequence.Iterator.when(c(),function(){return o()},function(t,r){return n.Sequence.Iterator.when(s(),function(){return o()},function(i,u){var c=e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.value(i));return 0>c?(s=function(){return i},r()):c>0?u():o(n.Sequence.Thunk.value(t),[n.Sequence.Thunk.iterator(t),n.Sequence.Thunk.iterator(i)])})})})}return t.reduce(function(t,n){return r(e,t,n)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/iterate",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.iterate=function(){return this.iterate_()},t.prototype.iterate_=function(e,t){var r=this;void 0===t&&(t=0);var i=this.memory?this.memory.has(t)?this.memory.get(t):this.memory.set(t,this.cons(e,n.Sequence.cons)).get(t):this.cons(e,n.Sequence.cons);switch(i.length){case 0:return[void 0,n.Sequence.Iterator.done,-1];case 1:return[i[0],function(){return n.Sequence.Iterator.done()},t];case 2:return[i[0],function(){return r.iterate_(i[1],t+1)},t];default:throw n.Sequence.Exception.invalidDataError(i)}},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/memoize",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.memoize=function(e){return void 0===e&&(e=this.memory||new Map),new n.Sequence(this.cons,this.memory||e)},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/read",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,t,n,r){"use strict";var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.read=function(){for(var e=this,t=[],i=function(){return e.iterate()};;){var o=i();if(!n.Sequence.isIterable(o))return t;void r.concat(t,[n.Sequence.Thunk.value(o)]),i=n.Sequence.Thunk.iterator(o)}},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/instance/take",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.take=function(e){return this.takeWhile(function(t,n){return e>n})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/drop",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.drop=function(e){return this.dropWhile(function(t,n){return e>n})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/takeWhile",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.takeWhile=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t){return e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.index(t))?i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t)):i()})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/dropWhile",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.dropWhile=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t,r){return e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.index(t))?r():i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/until",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.until=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t){return e(n.Sequence.Thunk.value(t))?i(n.Sequence.Thunk.value(t)):i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/fmap",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.fmap=function(e){var t=this;return new n.Sequence(function(r){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return n.Sequence.cons()},function(t){return n.Sequence.cons(e(n.Sequence.Thunk.value(t)),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/bind",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.bind=function(e){var t=this;return new n.Sequence(function(r,i){var o=void 0===r?[function(){return t.iterate()},n.Sequence.Iterator.done]:r,u=o[0],c=o[1];return n.Sequence.Iterator.when(u(),function(){return i()},function(t,r){return c=c===n.Sequence.Iterator.done?function(){return e(n.Sequence.Thunk.value(t)).iterate()}:c,n.Sequence.Iterator.when(c(),function(){return c=n.Sequence.Iterator.done,r()},function(e){return i(n.Sequence.Thunk.value(e),[function(){return t},n.Sequence.Thunk.iterator(e)])})})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/mapM",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,t,n,r){"use strict";var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.mapM=function(e){var t=this;return this.take(1).bind(function(){var i=t.read();switch(i.length){case 0:return n.Sequence.from([]);default:var o=i.shift();return e(o).bind(function(t){return 0===i.length?n.Sequence.from([[t]]):n.Sequence.from(i).mapM(e).fmap(function(e){return r.concat([t],e)})})}})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/instance/filterM",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,t,n,r){"use strict";var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.filterM=function(e){var t=this;return this.take(1).bind(function(){var i=t.read();switch(i.length){case 0:return n.Sequence.from([[]]);default:var o=i.shift();return e(o).bind(function(t){return t?0===i.length?n.Sequence.from([[o]]):n.Sequence.from(i).filterM(e).fmap(function(e){return r.concat([o],e)}):0===i.length?n.Sequence.from([[]]):n.Sequence.from(i).filterM(e)})}})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/instance/map",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.map=function(e){var t=this;return new n.Sequence(function(r){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return n.Sequence.cons()},function(t){return n.Sequence.cons(e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.index(t)),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/filter",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.filter=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t,r){return e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.index(t))?i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t)):r()})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/scan",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.scan=function(e,t){var r=this;return new n.Sequence(function(i){var o=void 0===i?[void 0,void 0]:i,u=o[0],c=void 0===u?t:u,s=o[1],a=void 0===s?function(){return r.iterate()}:s;return n.Sequence.Iterator.when(a(),function(){return n.Sequence.cons(); | ||
},function(t){return n.Sequence.cons(c=e(c,n.Sequence.Thunk.value(t)),[c,n.Sequence.Thunk.iterator(t)])})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence",["require","exports","src/lib/monad/sequence/core","src/lib/monad/sequence/member/static/from","src/lib/monad/sequence/member/static/write","src/lib/monad/sequence/member/static/random","src/lib/monad/sequence/member/static/zip","src/lib/monad/sequence/member/static/union","src/lib/monad/sequence/member/static/intersect","src/lib/monad/sequence/member/instance/iterate","src/lib/monad/sequence/member/instance/memoize","src/lib/monad/sequence/member/instance/read","src/lib/monad/sequence/member/instance/take","src/lib/monad/sequence/member/instance/drop","src/lib/monad/sequence/member/instance/takeWhile","src/lib/monad/sequence/member/instance/dropWhile","src/lib/monad/sequence/member/instance/until","src/lib/monad/sequence/member/instance/fmap","src/lib/monad/sequence/member/instance/bind","src/lib/monad/sequence/member/instance/mapM","src/lib/monad/sequence/member/instance/filterM","src/lib/monad/sequence/member/instance/map","src/lib/monad/sequence/member/instance/filter","src/lib/monad/sequence/member/instance/scan","src/lib/compose"],function(e,t,n,r,i,o,u,c,s,a,f,d,l,h,p,v,b,m,q,y,S,x,w,_,g){"use strict";t.Sequence=n.Sequence,g.compose(n.Sequence,r["default"],i["default"],o["default"],u["default"],c["default"],s["default"],a["default"],f["default"],d["default"],l["default"],h["default"],p["default"],v["default"],b["default"],m["default"],q["default"],y["default"],S["default"],x["default"],w["default"],_["default"])}),define("src/lib/collection/attrmap",["require","exports"],function(e,t){"use strict";var n=function(){function e(){this.store=new WeakMap}return e.prototype.get=function(e,t){return this.store.get(e)&&this.store.get(e).get(t)},e.prototype.set=function(e,t,n){var r=this.store.has(e)?this.store.get(e):this.store.set(e,new Map).get(e);return void r.set(t,n),this},e.prototype.has=function(e,t){return this.store.has(e)&&this.store.get(e).has(t)},e.prototype["delete"]=function(e,t){return void 0===t?this.store["delete"](e):this.store.has(e)?this.store.get(e)["delete"](t):!1},e}();t.AttrMap=n}),define("src/lib/collection/relationmap",["require","exports"],function(e,t){"use strict";var n=function(){function e(){this.store=new WeakMap}return e.prototype.get=function(e,t){return this.store.get(e)&&this.store.get(e).get(t)},e.prototype.set=function(e,t,n){var r=this.store.has(e)?this.store.get(e):this.store.set(e,new WeakMap).get(e);return void r.set(t,n),this},e.prototype.has=function(e,t){return this.store.has(e)&&this.store.get(e).has(t)},e.prototype["delete"]=function(e,t){return void 0===t?this.store["delete"](e):this.store.has(e)?this.store.get(e)["delete"](t):!1},e}();t.RelationMap=n}),define("src/lib/mixin",["require","exports","src/lib/assign"],function(e,t,n){"use strict";function r(){for(var e=[],t=0;t<arguments.length;t++)e[t-0]=arguments[t];return e.reduceRight(function(e,t){return i(t,e)},function(){function e(){}return e}())}function i(e,t){var r=function(){function n(){return e.apply(t.apply(this,arguments)||this,arguments)}return n}();void n.assign(r.prototype,e.prototype,t.prototype);for(var i in t)t.hasOwnProperty(i)&&(r[i]=t[i]);for(var i in e)e.hasOwnProperty(i)&&(r[i]=e[i]);return r}t.Mixin=r}),define("src/lib/fingerprint",["require","exports"],function(e,t){"use strict";function n(){return i(o([u(window.navigator),u(window.screen),u((new Date).getTimezoneOffset())].join()))}function r(){return i(o([u(process)].join()))}function i(e){return e.split("").reduce(function(e,t,n){return(+t*n+e)%1e9||e-+t},0)}function o(e){return e.split("").map(function(e){return e.charCodeAt(0)}).join("")}function u(e,t){if(void 0===t&&(t=5),t>0&&e&&"object"==typeof e){var n="{";for(var r in e)n+='"'+r+'": '+u(e[r],t-1)+",";return n+="}"}return!e||e.toString?'"'+e+'"':'"'+Object.prototype.toString.call(e)+'"'}t.FINGERPRINT="object"==typeof window?n():r(),t.browser=n,t.server=r,t.hash=i,t.str2digit=o,t.stringify=u}),define("src/lib/uuid",["require","exports","src/lib/fingerprint"],function(e,t,n){"use strict";function r(){var e=u=u*Date.now()%1e15;if(16>e||e>1e15)throw new Error("Spica: uuid: Invalid uuid dynamic seed.");for(var t="",n=0,r=o;n<r.length;n++){var i=r[n];if("x"===i||"y"===i){var c=Math.random()*e%16|0,s="x"==i?c:3&c|8;t+=s.toString(16)}else t+=i}return t.toLowerCase()}var i=n.FINGERPRINT*Date.now()%1e15;if(!i||"number"!=typeof i||100>i||i>1e15)throw new Error("Spica: uuid: Invalid uuid static seed.\n "+n.FINGERPRINT);var o=Object.freeze("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split("")),u=i;t.v4=r}),define("src/export",["require","exports","src/lib/supervisor","src/lib/observable","src/lib/cancelable","src/lib/monad/sequence","src/lib/monad/maybe","src/lib/monad/either","src/lib/collection/datamap","src/lib/collection/attrmap","src/lib/collection/relationmap","src/lib/mixin","src/lib/tick","src/lib/fingerprint","src/lib/uuid","src/lib/sqid","src/lib/assign","src/lib/concat"],function(e,t,n,r,i,o,u,c,s,a,f,d,l,h,p,v,b,m){"use strict";t.Supervisor=n.Supervisor,t.Observable=r.Observable,t.Cancelable=i.Cancelable,t.Sequence=o.Sequence,t.Maybe=u.Maybe,t.Just=u.Just,t.Nothing=u.Nothing,t.Either=c.Either,t.Left=c.Left,t.Right=c.Right,t.DataMap=s.DataMap,t.AttrMap=a.AttrMap,t.RelationMap=f.RelationMap,t.Mixin=d.Mixin,t.Tick=l.Tick,t.FINGERPRINT=h.FINGERPRINT,t.uuid=p.v4,t.sqid=v.sqid,t.assign=b.assign,t.clone=b.clone,t.extend=b.extend,t.concat=m.concat}),define("spica",["require","exports","src/export"],function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}r(n)}); |
@@ -213,2 +213,4 @@ const gulp = require('gulp'); | ||
'karma:server', | ||
'bench', | ||
'dist', | ||
function () { | ||
@@ -215,0 +217,0 @@ done(); |
{ | ||
"name": "spica", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Supervisor, Observable, Sequence, Maybe, Either and some utils.", | ||
@@ -63,3 +63,3 @@ "private": false, | ||
"scripts": { | ||
"test": "gulp server && gulp bench && gulp dist" | ||
"test": "gulp server" | ||
}, | ||
@@ -66,0 +66,0 @@ "author": "falsandtru", |
@@ -10,2 +10,3 @@ export {Supervisor} from './lib/supervisor'; | ||
export {RelationMap} from './lib/collection/relationmap'; | ||
export {Mixin} from './lib/mixin'; | ||
export {Tick} from './lib/tick'; | ||
@@ -12,0 +13,0 @@ export {FINGERPRINT} from './lib/fingerprint'; |
@@ -1,315 +0,50 @@ | ||
import {Sequence as ISequence} from 'spica'; | ||
import {Monad} from './monad'; | ||
import {concat} from '../concat'; | ||
import {Sequence} from './sequence/core'; | ||
import from from './sequence/member/static/from'; | ||
import write from './sequence/member/static/write'; | ||
import random from './sequence/member/static/random'; | ||
import zip from './sequence/member/static/zip'; | ||
import union from './sequence/member/static/union'; | ||
import intersect from './sequence/member/static/intersect'; | ||
import iterate from './sequence/member/instance/iterate'; | ||
import memoize from './sequence/member/instance/memoize'; | ||
import read from './sequence/member/instance/read'; | ||
import take from './sequence/member/instance/take'; | ||
import drop from './sequence/member/instance/drop'; | ||
import takeWhile from './sequence/member/instance/takeWhile'; | ||
import dropWhile from './sequence/member/instance/dropWhile'; | ||
import until from './sequence/member/instance/until'; | ||
import fmap from './sequence/member/instance/fmap'; | ||
import bind from './sequence/member/instance/bind'; | ||
import mapM from './sequence/member/instance/mapM'; | ||
import filterM from './sequence/member/instance/filterM'; | ||
import map from './sequence/member/instance/map'; | ||
import filter from './sequence/member/instance/filter'; | ||
import scan from './sequence/member/instance/scan'; | ||
import {compose} from '../compose'; | ||
function cons<T, S>(value?: T, next?: S): Sequence.Data<T, S> { | ||
switch (arguments.length) { | ||
case 0: | ||
return <Sequence.Data<T, S>>[]; | ||
case 1: | ||
return <Sequence.Data<T, S>><[]>[value]; | ||
case 2: | ||
return <Sequence.Data<T, S>>[value, next]; | ||
default: | ||
throw invalidConsError(arguments); | ||
} | ||
} | ||
compose( | ||
Sequence, | ||
from, | ||
write, | ||
random, | ||
zip, | ||
union, | ||
intersect, | ||
iterate, | ||
memoize, | ||
read, | ||
take, | ||
drop, | ||
takeWhile, | ||
dropWhile, | ||
until, | ||
fmap, | ||
bind, | ||
mapM, | ||
filterM, | ||
map, | ||
filter, | ||
scan | ||
); | ||
export class Sequence<T, S> extends Monad<T> implements ISequence<T, S> { | ||
public static from<T>(as: T[]): Sequence<T, number> { | ||
return new Sequence<T, number>((i = 0, cons) => i < as.length ? cons(as[i], ++i) : cons()); | ||
} | ||
public static write<T>(as: T[]): Sequence<T, T[]> { | ||
return new Sequence<T, T[]>((_, cons) => as.length > 0 ? cons(as.shift(), as) : cons()); | ||
} | ||
public static random(): Sequence<number, number> | ||
public static random<T>(gen: () => T): Sequence<T, number> | ||
public static random<T>(as: T[]): Sequence<T, Sequence.Iterator<number>> | ||
public static random<T>(p: (() => number) | (() => T) | T[] = () => Math.random()): Sequence<number, number> | Sequence<T, number> | Sequence<T, Sequence.Iterator<number>> { | ||
switch (true) { | ||
case Array.isArray(p): | ||
return Sequence.random() | ||
.map(r => p[r * p.length | 0]); | ||
default: | ||
return new Sequence<T, number>((_, cons) => cons((<() => T>p)(), NaN)); | ||
} | ||
} | ||
public static zip<T, U>(a: Sequence<T, any>, b: Sequence<U, any>): Sequence<[T, U], [Sequence.Iterator<T>, Sequence.Iterator<U>]> { | ||
return new Sequence<[T, U], [Sequence.Iterator<T>, Sequence.Iterator<U>]>(([ai, bi] = [() => a.iterate(), () => b.iterate()], cons) => | ||
Sequence.Iterator.when( | ||
ai(), | ||
() => cons(), | ||
at => | ||
Sequence.Iterator.when( | ||
bi(), | ||
() => cons(), | ||
bt => cons([Sequence.Thunk.value(at), Sequence.Thunk.value(bt)], [Sequence.Thunk.iterator(at), Sequence.Thunk.iterator(bt)])))); | ||
} | ||
public static union<T>(cmp: (a: T, b: T) => number, ss: Sequence<T, any>[]): Sequence<T, [Sequence.Iterator<T>, Sequence.Iterator<T>]> { | ||
return ss.reduce((a, b) => union(cmp, a, b)); | ||
function union<T>(cmp: (a: T, b: T) => number, a: Sequence<T, any>, b: Sequence<T, any>): Sequence<T, [Sequence.Iterator<T>, Sequence.Iterator<T>]> { | ||
return new Sequence<T, [Sequence.Iterator<T>, Sequence.Iterator<T>]>(([ai, bi] = [() => a.iterate(), () => b.iterate()], cons) => | ||
Sequence.Iterator.when( | ||
ai(), | ||
() => | ||
Sequence.Iterator.when( | ||
bi(), | ||
() => cons(), | ||
bt => cons(Sequence.Thunk.value(bt), [Sequence.Iterator.done, Sequence.Thunk.iterator(bt)])), | ||
at => | ||
Sequence.Iterator.when( | ||
bi(), | ||
() => cons(Sequence.Thunk.value(at), [Sequence.Thunk.iterator(at), Sequence.Iterator.done]), | ||
bt => { | ||
const result = cmp(Sequence.Thunk.value(at), Sequence.Thunk.value(bt)); | ||
if (result < 0) return cons(Sequence.Thunk.value(at), [Sequence.Thunk.iterator(at), () => bt]); | ||
if (result > 0) return cons(Sequence.Thunk.value(bt), [() => at, Sequence.Thunk.iterator(bt)]); | ||
return cons(Sequence.Thunk.value(at), [Sequence.Thunk.iterator(at), Sequence.Thunk.iterator(bt)]); | ||
}))); | ||
} | ||
} | ||
public static intersect<T>(cmp: (a: T, b: T) => number, ss: Sequence<T, any>[]): Sequence<T, [Sequence.Iterator<T>, Sequence.Iterator<T>]> { | ||
return ss.reduce((a, b) => intersect(cmp, a, b)); | ||
function intersect<T>(cmp: (a: T, b: T) => number, a: Sequence<T, any>, b: Sequence<T, any>): Sequence<T, [Sequence.Iterator<T>, Sequence.Iterator<T>]> { | ||
return new Sequence<T, [Sequence.Iterator<T>, Sequence.Iterator<T>]>(([ai, bi] = [() => a.iterate(), () => b.iterate()], cons) => | ||
Sequence.Iterator.when( | ||
ai(), | ||
() => cons(), | ||
(at, ar) => | ||
Sequence.Iterator.when( | ||
bi(), | ||
() => cons(), | ||
(bt, br) => { | ||
const result = cmp(Sequence.Thunk.value(at), Sequence.Thunk.value(bt)); | ||
if (result < 0) return bi = () => bt, ar(); | ||
if (result > 0) return br(); | ||
return cons(Sequence.Thunk.value(at), [Sequence.Thunk.iterator(at), Sequence.Thunk.iterator(bt)]); | ||
}))); | ||
} | ||
} | ||
constructor( | ||
private cons: (p: S, cons: (value?: T, next?: S) => Sequence.Data<T, S>) => Sequence.Data<T, S>, | ||
private memory?: Map<number, Sequence.Data<T, S>> | ||
) { | ||
super(); | ||
void Object.freeze(this); | ||
} | ||
public iterate(): Sequence.Thunk<T> { | ||
return this.iterate_(); | ||
} | ||
private iterate_(p?: S, i = 0): Sequence.Thunk<T> { | ||
const data = this.memory | ||
? this.memory.has(i) | ||
? this.memory.get(i) | ||
: this.memory.set(i, this.cons(p, cons)).get(i) | ||
: this.cons(p, cons); | ||
switch (data.length) { | ||
case 0: | ||
return <Sequence.Thunk<T>>[ | ||
void 0, | ||
Sequence.Iterator.done, | ||
-1 | ||
]; | ||
case 1: | ||
return <Sequence.Thunk<T>>[ | ||
data[0], | ||
() => Sequence.Iterator.done(), | ||
i | ||
]; | ||
case 2: | ||
return <Sequence.Thunk<T>>[ | ||
data[0], | ||
() => this.iterate_(data[1], i + 1), | ||
i | ||
]; | ||
default: | ||
throw invalidDataError(data); | ||
} | ||
} | ||
public memoize(map: Map<number, Sequence.Data<T, S>> = this.memory || new Map<number, Sequence.Data<T, S>>()): Sequence<T, S> { | ||
return new Sequence<T, S>(this.cons, this.memory || map); | ||
} | ||
public read(): T[] { | ||
const acc: T[] = []; | ||
let iter = () => this.iterate(); | ||
while (true) { | ||
const thunk = iter(); | ||
if (!Sequence.isIterable(thunk)) return acc; | ||
void concat(acc, [Sequence.Thunk.value(thunk)]); | ||
iter = Sequence.Thunk.iterator(thunk); | ||
} | ||
} | ||
public fmap<U>(f: (p: T) => U): Sequence<U, Sequence.Iterator<T>> { | ||
return new Sequence<U, Sequence.Iterator<T>>((iter = () => this.iterate()) => | ||
Sequence.Iterator.when( | ||
iter(), | ||
() => cons<U, Sequence.Iterator<T>>(), | ||
thunk => cons<U, Sequence.Iterator<T>>(f(Sequence.Thunk.value(thunk)), Sequence.Thunk.iterator(thunk)))); | ||
} | ||
public bind<U>(f: (p: T) => Sequence<U, any>): Sequence<U, [Sequence.Iterator<T>, Sequence.Iterator<U>]> { | ||
return new Sequence<U, [Sequence.Iterator<T>, Sequence.Iterator<U>]>(([ai, bi] = [() => this.iterate(), Sequence.Iterator.done], cons) => | ||
Sequence.Iterator.when( | ||
ai(), | ||
() => cons(), | ||
(at, recur) => { | ||
bi = bi === Sequence.Iterator.done | ||
? () => f(Sequence.Thunk.value(at)).iterate() | ||
: bi; | ||
return Sequence.Iterator.when( | ||
bi(), | ||
() => (bi = Sequence.Iterator.done, recur()), | ||
bt => cons(Sequence.Thunk.value(bt), [() => at, Sequence.Thunk.iterator(bt)])); | ||
})); | ||
} | ||
public filterM(f: (p: T) => Sequence<boolean, any>): Sequence<T[], [Sequence.Iterator<T>, Sequence.Iterator<T[]>]> { | ||
return this | ||
.take(1) | ||
.bind(() => { | ||
const xs = this.read(); | ||
switch (xs.length) { | ||
case 0: | ||
return Sequence.from<T[]>([[]]); | ||
default: { | ||
const x = xs.shift(); | ||
return f(x) | ||
.bind(b => | ||
b | ||
? xs.length === 0 | ||
? Sequence.from<T[]>([[x]]) | ||
: Sequence.from(xs).filterM(f).fmap(ys => concat([x], ys)) | ||
: xs.length === 0 | ||
? Sequence.from<T[]>([[]]) | ||
: Sequence.from(xs).filterM(f)); | ||
} | ||
} | ||
}); | ||
} | ||
public mapM<U>(f: (p: T) => Sequence<U, any>): Sequence<U[], [Sequence.Iterator<T>, Sequence.Iterator<U[]>]> { | ||
return this | ||
.take(1) | ||
.bind(() => { | ||
const xs = this.read(); | ||
switch (xs.length) { | ||
case 0: | ||
return Sequence.from<U[]>([]); | ||
default: { | ||
const x = xs.shift(); | ||
return f(x) | ||
.bind(y => | ||
xs.length === 0 | ||
? Sequence.from<U[]>([[y]]) | ||
: Sequence.from(xs).mapM(f).fmap(ys => concat([y], ys))); | ||
} | ||
} | ||
}); | ||
} | ||
public map<U>(f: (p: T, i: number) => U): Sequence<U, Sequence.Iterator<T>> { | ||
return new Sequence<U, Sequence.Iterator<T>>((iter = () => this.iterate()) => | ||
Sequence.Iterator.when( | ||
iter(), | ||
() => cons<U, Sequence.Iterator<T>>(), | ||
thunk => cons<U, Sequence.Iterator<T>>(f(Sequence.Thunk.value(thunk), Sequence.Thunk.index(thunk)), Sequence.Thunk.iterator(thunk)))); | ||
} | ||
public scan<U>(f: (b: U, a: T) => U, z: U): Sequence<U, [U, Sequence.Iterator<T>]> { | ||
return new Sequence<U, [U, Sequence.Iterator<T>]>(([prev = z, iter = () => this.iterate()] = [void 0, void 0]) => | ||
Sequence.Iterator.when( | ||
iter(), | ||
() => cons<U, [U, Sequence.Iterator<T>]>(), | ||
thunk => | ||
cons<U, [U, Sequence.Iterator<T>]>( | ||
prev = f(prev, Sequence.Thunk.value(thunk)), | ||
[prev, Sequence.Thunk.iterator(thunk)]))); | ||
} | ||
public until(f: (p: T) => boolean): Sequence<T, Sequence.Iterator<T>> { | ||
return new Sequence<T, Sequence.Iterator<T>>((iter = () => this.iterate(), cons) => | ||
Sequence.Iterator.when( | ||
iter(), | ||
() => cons(), | ||
thunk => | ||
f(Sequence.Thunk.value(thunk)) | ||
? cons(Sequence.Thunk.value(thunk)) | ||
: cons(Sequence.Thunk.value(thunk), Sequence.Thunk.iterator(thunk)))); | ||
} | ||
public take(n: number): Sequence<T, Sequence.Iterator<T>> { | ||
return this.takeWhile((_, i) => i < n); | ||
} | ||
public drop(n: number): Sequence<T, Sequence.Iterator<T>> { | ||
return this.dropWhile((_, i) => i < n); | ||
} | ||
public takeWhile(f: (p: T, i: number) => boolean): Sequence<T, Sequence.Iterator<T>> { | ||
return new Sequence<T, Sequence.Iterator<T>>((iter = () => this.iterate(), cons) => | ||
Sequence.Iterator.when( | ||
iter(), | ||
() => cons(), | ||
thunk => | ||
f(Sequence.Thunk.value(thunk), Sequence.Thunk.index(thunk)) | ||
? cons(Sequence.Thunk.value(thunk), Sequence.Thunk.iterator(thunk)) | ||
: cons())); | ||
} | ||
public dropWhile(f: (p: T, i: number) => boolean): Sequence<T, Sequence.Iterator<T>> { | ||
return new Sequence<T, Sequence.Iterator<T>>((iter = () => this.iterate(), cons) => | ||
Sequence.Iterator.when( | ||
iter(), | ||
() => cons(), | ||
(thunk, recur) => | ||
f(Sequence.Thunk.value(thunk), Sequence.Thunk.index(thunk)) | ||
? recur() | ||
: cons(Sequence.Thunk.value(thunk), Sequence.Thunk.iterator(thunk)))); | ||
} | ||
public filter(f: (p: T, i: number) => boolean): Sequence<T, Sequence.Iterator<T>> { | ||
return new Sequence<T, Sequence.Iterator<T>>((iter = () => this.iterate(), cons) => | ||
Sequence.Iterator.when( | ||
iter(), | ||
() => cons(), | ||
(thunk, recur) => | ||
f(Sequence.Thunk.value(thunk), Sequence.Thunk.index(thunk)) | ||
? cons(Sequence.Thunk.value(thunk), Sequence.Thunk.iterator(thunk)) | ||
: recur())); | ||
} | ||
} | ||
export namespace Sequence { | ||
export type Data<T, S> = [T, S]; | ||
export type Thunk<T> = [T, Iterator<T>, number]; | ||
export namespace Thunk { | ||
export function value<T>(thunk: Thunk<T>): T { | ||
return thunk[0]; | ||
} | ||
export function iterator<T>(thunk: Thunk<T>): Iterator<T> { | ||
return thunk[1]; | ||
} | ||
export function index<T>(thunk: Thunk<T>): number { | ||
return thunk[2]; | ||
} | ||
} | ||
export type Iterator<T> = () => Thunk<T>; | ||
export namespace Iterator { | ||
export const done: Sequence.Iterator<any> = () => <Sequence.Thunk<any>>[void 0, done, -1]; | ||
export function when<T, U>( | ||
thunk: Thunk<T>, | ||
caseDone: (thunk: Thunk<T>) => U, | ||
caseIterable: (thunk: Thunk<T>, recur: () => U) => U | ||
): U { | ||
return Sequence.isIterable(thunk) | ||
? caseIterable(thunk, () => when(Thunk.iterator(thunk)(), caseDone, caseIterable)) | ||
: caseDone(thunk); | ||
} | ||
} | ||
export function isIterable(thunk: Thunk<any>): boolean { | ||
return Thunk.iterator(thunk) !== Iterator.done; | ||
} | ||
} | ||
function invalidConsError(args: IArguments): TypeError { | ||
console.error(args, args.length, args[0], args[1]); | ||
return new TypeError(`Spica: Sequence: Invalid parameters of cons.`); | ||
} | ||
function invalidDataError(data: Sequence.Data<any, any>): TypeError { | ||
console.error(data); | ||
return new TypeError(`Spica: Sequence: Invalid data.`); | ||
} | ||
function invalidThunkError(thunk: Sequence.Thunk<any>): TypeError { | ||
console.error(thunk); | ||
return new TypeError(`Spica: Sequence: Invalid thunk.`); | ||
} | ||
export {Sequence} |
@@ -9,2 +9,3 @@ import { | ||
DataMap, AttrMap, RelationMap, | ||
Mixin, | ||
Tick, | ||
@@ -106,2 +107,9 @@ FINGERPRINT, | ||
describe('Mixin', function () { | ||
it('Mixin', function () { | ||
assert(typeof Mixin === 'function'); | ||
}); | ||
}); | ||
describe('Tick', function () { | ||
@@ -108,0 +116,0 @@ it('Tick', function () { |
@@ -92,19 +92,19 @@ /** | ||
static union<T>(cmp: (a: T, b: T) => number, ss: Sequence<T, any>[]): Sequence<T, [Sequence.Iterator<T>, Sequence.Iterator<T>]>; | ||
static intersect<T>(cmp: (a: T, b: T) => number, ss: Sequence<T, any>): Sequence<T, [Sequence.Iterator<T>, Sequence.Iterator<T>]>; | ||
static intersect<T>(cmp: (a: T, b: T) => number, ss: Sequence<T, any>[]): Sequence<T, [Sequence.Iterator<T>, Sequence.Iterator<T>]>; | ||
constructor(cons: (p: S, cons: (value?: T, next?: S) => Sequence.Data<T, S>) => Sequence.Data<T, S>); | ||
read(): T[]; | ||
until(f: (p: T) => boolean): Sequence<T, Sequence.Iterator<T>>; | ||
take(n: number): Sequence<T, Sequence.Iterator<T>>; | ||
drop(n: number): Sequence<T, Sequence.Iterator<T>>; | ||
takeWhile(f: (p: T) => boolean, i: number): Sequence<T, Sequence.Iterator<T>>; | ||
dropWhile(f: (p: T) => boolean, i: number): Sequence<T, Sequence.Iterator<T>>; | ||
iterate(): Sequence.Thunk<T>; | ||
fmap<U>(f: (p: T) => U): Sequence<U, Sequence.Iterator<T>>; | ||
bind<U>(f: (p: T) => Sequence<U, any>): Sequence<U, [Sequence.Iterator<T>, Sequence.Iterator<U>]>; | ||
mapM<U>(f: (p: T) => Sequence<U, any>): Sequence<U[], [Sequence.Iterator<T>, Sequence.Iterator<U[]>]>; | ||
filterM(f: (p: T) => Sequence<boolean, any>): Sequence<T[], [Sequence.Iterator<T>, Sequence.Iterator<T[]>]>; | ||
map<U>(f: (p: T, i: number) => U): Sequence<U, Sequence.Iterator<T>>; | ||
filter(f: (p: T, i: number) => boolean): Sequence<T, Sequence.Iterator<T>>; | ||
scan<U>(f: (b: U, a: T) => U, z: U): Sequence<U, [U, Sequence.Iterator<T>]>; | ||
take(n: number): Sequence<T, Sequence.Iterator<T>>; | ||
drop(n: number): Sequence<T, Sequence.Iterator<T>>; | ||
takeWhile(f: (p: T, i: number) => boolean): Sequence<T, Sequence.Iterator<T>>; | ||
dropWhile(f: (p: T, i: number) => boolean): Sequence<T, Sequence.Iterator<T>>; | ||
until(f: (p: T) => boolean): Sequence<T, Sequence.Iterator<T>>; | ||
memoize(memory?: Map<number, Sequence.Data<T, S>>): Sequence<T, S>; | ||
iterate(): Sequence.Thunk<T>; | ||
fmap<U>(f: (p: T) => U): Sequence<U, Sequence.Iterator<T>>; | ||
bind<U>(f: (p: T) => Sequence<U, any>): Sequence<U, [Sequence.Iterator<T>, Sequence.Iterator<U>]>; | ||
filterM(f: (p: T) => Sequence<boolean, any>): Sequence<T[], [Sequence.Iterator<T>, Sequence.Iterator<T[]>]>; | ||
mapM<U>(f: (p: T) => Sequence<U, any>): Sequence<U[], [Sequence.Iterator<T>, Sequence.Iterator<U[]>]>; | ||
} | ||
@@ -219,2 +219,4 @@ export namespace Sequence { | ||
export function Mixin<T>(...mixins: Array<new (...args: any[]) => any>): new (...args: any[]) => T; | ||
export function Tick(fn: (_?: void) => any): void | ||
@@ -221,0 +223,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
290908
105
7678