UNPKG

universe

Version:

The fastest way to query and explore multivariate datasets

2 lines 127 kB
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.universe=f()}})(function(){var define,module,exports;return 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=require("./src/crossfilter").crossfilter},{"./src/crossfilter":5}],2:[function(require,module,exports){module.exports={name:"crossfilter2",version:"1.4.0-alpha.06",description:"Fast multidimensional filtering for coordinated views.",keywords:["analytics","visualization","crossfilter"],author:{name:"Mike Bostock",url:"http://bost.ocks.org/mike"},contributors:[{name:"Jason Davies",url:"http://www.jasondavies.com/"}],maintainers:[{name:"Gordon Woodhull",url:"https://github.com/gordonwoodhull"},{name:"Tanner Linsley",url:"https://github.com/tannerlinsley"},{name:"Ethan Jewett",url:"https://github.com/esjewett"}],homepage:"http://crossfilter.github.com/crossfilter/",main:"./index.js",repository:{type:"git",url:"http://github.com/crossfilter/crossfilter.git"},dependencies:{"lodash.result":"^4.4.0"},devDependencies:{browserify:"^13.0.0",d3:"3.5","package-json-versionify":"1.0.2","uglify-js":"2.4.0",vows:"0.7.0"},scripts:{benchmark:"node test/benchmark.js",build:"browserify index.js -t package-json-versionify --standalone crossfilter -o crossfilter.js && uglifyjs --compress --mangle --screw-ie8 crossfilter.js -o crossfilter.min.js",clean:"rm -f crossfilter.js crossfilter.min.js",test:"./node_modules/.bin/vows --verbose"},files:["src","index.js","crossfilter.js","crossfilter.min.js"]}},{}],3:[function(require,module,exports){if(typeof Uint8Array!=="undefined"){crossfilter_array8=function(n){return new Uint8Array(n)};crossfilter_array16=function(n){return new Uint16Array(n)};crossfilter_array32=function(n){return new Uint32Array(n)};crossfilter_arrayLengthen=function(array,length){if(array.length>=length)return array;var copy=new array.constructor(length);copy.set(array);return copy};crossfilter_arrayWiden=function(array,width){var copy;switch(width){case 16:copy=crossfilter_array16(array.length);break;case 32:copy=crossfilter_array32(array.length);break;default:throw new Error("invalid array width!")}copy.set(array);return copy}}function crossfilter_arrayUntyped(n){var array=new Array(n),i=-1;while(++i<n)array[i]=0;return array}function crossfilter_arrayLengthenUntyped(array,length){var n=array.length;while(n<length)array[n++]=0;return array}function crossfilter_arrayWidenUntyped(array,width){if(width>32)throw new Error("invalid array width!");return array}function crossfilter_bitarray(n){this.length=n;this.subarrays=1;this.width=8;this.masks={0:0};this[0]=crossfilter_array8(n)}crossfilter_bitarray.prototype.lengthen=function(n){var i,len;for(i=0,len=this.subarrays;i<len;++i){this[i]=crossfilter_arrayLengthen(this[i],n)}this.length=n};crossfilter_bitarray.prototype.add=function(){var m,w,one,i,len;for(i=0,len=this.subarrays;i<len;++i){m=this.masks[i];w=this.width-32*i;one=~m&-~m;if(w>=32&&!one){continue}if(w<32&&one&1<<w){this[i]=crossfilter_arrayWiden(this[i],w<<=1);this.width=32*i+w}this.masks[i]|=one;return{offset:i,one:one}}this[this.subarrays]=crossfilter_array8(this.length);this.masks[this.subarrays]=1;this.width+=8;return{offset:this.subarrays++,one:1}};crossfilter_bitarray.prototype.copy=function(dest,src){var i,len;for(i=0,len=this.subarrays;i<len;++i){this[i][dest]=this[i][src]}};crossfilter_bitarray.prototype.truncate=function(n){var i,len;for(i=0,len=this.subarrays;i<len;++i){for(var j=this.length-1;j>=n;j--){this[i][j]=0}this[i].length=n}this.length=n};crossfilter_bitarray.prototype.zero=function(n){var i,len;for(i=0,len=this.subarrays;i<len;++i){if(this[i][n]){return false}}return true};crossfilter_bitarray.prototype.zeroExcept=function(n,offset,zero){var i,len;for(i=0,len=this.subarrays;i<len;++i){if(i===offset?this[i][n]&zero:this[i][n]){return false}}return true};crossfilter_bitarray.prototype.zeroExceptMask=function(n,mask){var i,len;for(i=0,len=this.subarrays;i<len;++i){if(this[i][n]&mask[i]){return false}}return true};crossfilter_bitarray.prototype.only=function(n,offset,one){var i,len;for(i=0,len=this.subarrays;i<len;++i){if(this[i][n]!=(i===offset?one:0)){return false}}return true};crossfilter_bitarray.prototype.onlyExcept=function(n,offset,zero,onlyOffset,onlyOne){var mask;var i,len;for(i=0,len=this.subarrays;i<len;++i){mask=this[i][n];if(i===offset)mask&=zero;if(mask!=(i===onlyOffset?onlyOne:0)){return false}}return true};module.exports={array8:crossfilter_arrayUntyped,array16:crossfilter_arrayUntyped,array32:crossfilter_arrayUntyped,arrayLengthen:crossfilter_arrayLengthenUntyped,arrayWiden:crossfilter_arrayWidenUntyped,bitarray:crossfilter_bitarray}},{}],4:[function(require,module,exports){var crossfilter_identity=require("./identity");function bisect_by(f){function bisectLeft(a,x,lo,hi){while(lo<hi){var mid=lo+hi>>>1;if(f(a[mid])<x)lo=mid+1;else hi=mid}return lo}function bisectRight(a,x,lo,hi){while(lo<hi){var mid=lo+hi>>>1;if(x<f(a[mid]))hi=mid;else lo=mid+1}return lo}bisectRight.right=bisectRight;bisectRight.left=bisectLeft;return bisectRight}module.exports=bisect_by(crossfilter_identity);module.exports.by=bisect_by},{"./identity":9}],5:[function(require,module,exports){var xfilterArray=require("./array");var xfilterFilter=require("./filter");var crossfilter_identity=require("./identity");var crossfilter_null=require("./null");var crossfilter_zero=require("./zero");var xfilterHeapselect=require("./heapselect");var xfilterHeap=require("./heap");var bisect=require("./bisect");var insertionsort=require("./insertionsort");var permute=require("./permute");var quicksort=require("./quicksort");var xfilterReduce=require("./reduce");var packageJson=require("./../package.json");var result=require("lodash.result");exports.crossfilter=crossfilter;exports.crossfilter.heap=xfilterHeap;exports.crossfilter.heapselect=xfilterHeapselect;exports.crossfilter.bisect=bisect;exports.crossfilter.insertionsort=insertionsort;exports.crossfilter.permute=permute;exports.crossfilter.quicksort=quicksort;exports.crossfilter.version=packageJson.version;function crossfilter(){var crossfilter={add:add,remove:removeData,dimension:dimension,groupAll:groupAll,size:size,all:all,onChange:onChange,isElementFiltered:isElementFiltered};var data=[],n=0,filters,filterListeners=[],dataListeners=[],removeDataListeners=[],callbacks=[];filters=new xfilterArray.bitarray(0);function add(newData){var n0=n,n1=newData.length;if(n1){data=data.concat(newData);filters.lengthen(n+=n1);dataListeners.forEach(function(l){l(newData,n0,n1)});triggerOnChange("dataAdded")}return crossfilter}function removeData(){var newIndex=crossfilter_index(n,n),removed=[];for(var i=0,j=0;i<n;++i){if(!filters.zero(i))newIndex[i]=j++;else removed.push(i)}filterListeners.forEach(function(l){l(-1,-1,[],removed,true)});removeDataListeners.forEach(function(l){l(newIndex)});for(var i=0,j=0;i<n;++i){if(!filters.zero(i)){if(i!==j)filters.copy(j,i),data[j]=data[i];++j}}data.length=n=j;filters.truncate(j);triggerOnChange("dataRemoved")}function isElementFiltered(i,ignore_dimensions){var n,d,id,len,mask=Array(filters.subarrays);for(n=0;n<filters.subarrays;n++){mask[n]=~0}if(ignore_dimensions){for(d=0,len=ignore_dimensions.length;d<len;d++){id=ignore_dimensions[d].id();mask[id>>7]&=~(1<<(id&63))}}return filters.zeroExceptMask(i,mask)}function dimension(value,iterable){if(typeof value==="string"){var accessorPath=value;value=function(d){return result(d,accessorPath)}}var dimension={filter:filter,filterExact:filterExact,filterRange:filterRange,filterFunction:filterFunction,filterAll:filterAll,top:top,bottom:bottom,group:group,groupAll:groupAll,dispose:dispose,remove:dispose,accessor:value,id:function(){return id}};var one,zero,offset,id,values,index,oldValues,oldIndex,newValues,newIndex,iterablesIndexCount,newIterablesIndexCount,iterablesIndexFilterStatus,newIterablesIndexFilterStatus,oldIterablesIndexFilterStatus,iterablesEmptyRows,sort=quicksort.by(function(i){return newValues[i]}),refilter=xfilterFilter.filterAll,refilterFunction,indexListeners=[],dimensionGroups=[],lo0=0,hi0=0,t=0;dataListeners.unshift(preAdd);dataListeners.push(postAdd);removeDataListeners.push(removeData);var tmp=filters.add();offset=tmp.offset;one=tmp.one;zero=~one;id=offset<<7|Math.log(one)/Math.log(2);preAdd(data,0,n);postAdd(data,0,n);function preAdd(newData,n0,n1){if(iterable){t=0;j=0;k=[];for(i=0;i<newData.length;i++){for(j=0,k=value(newData[i]);j<k.length;j++){t++}}newValues=[];newIterablesIndexCount=crossfilter_range(newData.length);newIterablesIndexFilterStatus=crossfilter_index(t,1);iterablesEmptyRows=[];var unsortedIndex=crossfilter_range(t);for(l=0,i=0;i<newData.length;i++){k=value(newData[i]);if(!k.length){newIterablesIndexCount[i]=0;iterablesEmptyRows.push(i);continue}newIterablesIndexCount[i]=k.length;for(j=0;j<k.length;j++){newValues.push(k[j]);unsortedIndex[l]=i;l++}}var sortMap=sort(crossfilter_range(t),0,t);newValues=permute(newValues,sortMap);newIndex=permute(unsortedIndex,sortMap)}else{newValues=newData.map(value);newIndex=sort(crossfilter_range(n1),0,n1);newValues=permute(newValues,newIndex)}if(iterable){n1=t}var bounds=refilter(newValues),lo1=bounds[0],hi1=bounds[1];if(refilterFunction){for(i=0;i<n1;++i){if(!refilterFunction(newValues[i],i)){filters[offset][newIndex[i]+n0]|=one;if(iterable)newIterablesIndexFilterStatus[i]=1}}}else{for(i=0;i<lo1;++i){filters[offset][newIndex[i]+n0]|=one;if(iterable)newIterablesIndexFilterStatus[i]=1}for(i=hi1;i<n1;++i){filters[offset][newIndex[i]+n0]|=one;if(iterable)newIterablesIndexFilterStatus[i]=1}}if(!n0){values=newValues;index=newIndex;iterablesIndexCount=newIterablesIndexCount;iterablesIndexFilterStatus=newIterablesIndexFilterStatus;lo0=lo1;hi0=hi1;return}var oldValues=values,oldIndex=index,oldIterablesIndexFilterStatus=iterablesIndexFilterStatus;i0=0,i1=0;if(iterable){old_n0=n0;n0=oldValues.length;n1=t}values=iterable?new Array(n0+n1):new Array(n);index=iterable?new Array(n0+n1):crossfilter_index(n,n);if(iterable)iterablesIndexFilterStatus=crossfilter_index(n0+n1,1);if(iterable){var oldiiclength=iterablesIndexCount.length;iterablesIndexCount=xfilterArray.arrayLengthen(iterablesIndexCount,n);for(var j=0;j+oldiiclength<n;j++){iterablesIndexCount[j+oldiiclength]=newIterablesIndexCount[j]}}for(i=0;i0<n0&&i1<n1;++i){if(oldValues[i0]<newValues[i1]){values[i]=oldValues[i0];if(iterable)iterablesIndexFilterStatus[i]=oldIterablesIndexFilterStatus[i0];index[i]=oldIndex[i0++]}else{values[i]=newValues[i1];if(iterable)iterablesIndexFilterStatus[i]=oldIterablesIndexFilterStatus[i1];index[i]=newIndex[i1++]+(iterable?old_n0:n0)}}for(;i0<n0;++i0,++i){values[i]=oldValues[i0];if(iterable)iterablesIndexFilterStatus[i]=oldIterablesIndexFilterStatus[i0];index[i]=oldIndex[i0]}for(;i1<n1;++i1,++i){values[i]=newValues[i1];if(iterable)iterablesIndexFilterStatus[i]=oldIterablesIndexFilterStatus[i1];index[i]=newIndex[i1]+(iterable?old_n0:n0)}bounds=refilter(values),lo0=bounds[0],hi0=bounds[1]}function postAdd(newData,n0,n1){indexListeners.forEach(function(l){l(newValues,newIndex,n0,n1)});newValues=newIndex=null}function removeData(reIndex){for(var i=0,j=0,k;i<n;++i){if(!filters.zero(k=index[i])){if(i!==j)values[j]=values[i];index[j]=reIndex[k];++j}}values.length=j;while(j<n)index[j++]=0;var bounds=refilter(values);lo0=bounds[0],hi0=bounds[1]}function filterIndexBounds(bounds){var lo1=bounds[0],hi1=bounds[1];if(refilterFunction){refilterFunction=null;filterIndexFunction(function(d,i){return lo1<=i&&i<hi1},bounds[0]===0&&bounds[1]===index.length);lo0=lo1;hi0=hi1;return dimension}var i,j,k,added=[],removed=[],valueIndexAdded=[],valueIndexRemoved=[];if(lo1<lo0){for(i=lo1,j=Math.min(lo0,hi1);i<j;++i){added.push(index[i]);valueIndexAdded.push(i)}}else if(lo1>lo0){for(i=lo0,j=Math.min(lo1,hi0);i<j;++i){removed.push(index[i]);valueIndexRemoved.push(i)}}if(hi1>hi0){for(i=Math.max(lo1,hi0),j=hi1;i<j;++i){added.push(index[i]);valueIndexAdded.push(i)}}else if(hi1<hi0){for(i=Math.max(lo0,hi1),j=hi0;i<j;++i){removed.push(index[i]);valueIndexRemoved.push(i)}}if(!iterable){for(i=0;i<added.length;i++){filters[offset][added[i]]^=one}for(i=0;i<removed.length;i++){filters[offset][removed[i]]^=one}}else{var newAdded=[];var newRemoved=[];for(i=0;i<added.length;i++){iterablesIndexCount[added[i]]++;iterablesIndexFilterStatus[valueIndexAdded[i]]=0;if(iterablesIndexCount[added[i]]===1){filters[offset][added[i]]^=one;newAdded.push(added[i])}}for(i=0;i<removed.length;i++){iterablesIndexCount[removed[i]]--;iterablesIndexFilterStatus[valueIndexRemoved[i]]=1;if(iterablesIndexCount[removed[i]]===0){filters[offset][removed[i]]^=one;newRemoved.push(removed[i])}}added=newAdded;removed=newRemoved;if(bounds[0]===0&&bounds[1]===index.length){for(i=0;i<iterablesEmptyRows.length;i++){if(filters[offset][k=iterablesEmptyRows[i]]&one){filters[offset][k]^=one;added.push(k)}}}else{for(i=0;i<iterablesEmptyRows.length;i++){if(!(filters[offset][k=iterablesEmptyRows[i]]&one)){filters[offset][k]^=one;removed.push(k)}}}}lo0=lo1;hi0=hi1;filterListeners.forEach(function(l){l(one,offset,added,removed)});triggerOnChange("filtered");return dimension}function filter(range){return range==null?filterAll():Array.isArray(range)?filterRange(range):typeof range==="function"?filterFunction(range):filterExact(range)}function filterExact(value){return filterIndexBounds((refilter=xfilterFilter.filterExact(bisect,value))(values))}function filterRange(range){return filterIndexBounds((refilter=xfilterFilter.filterRange(bisect,range))(values))}function filterAll(){return filterIndexBounds((refilter=xfilterFilter.filterAll)(values))}function filterFunction(f){refilterFunction=f;refilter=xfilterFilter.filterAll;filterIndexFunction(f,false);lo0=0;hi0=n;return dimension}function filterIndexFunction(f,filterAll){var i,k,x,added=[],removed=[],valueIndexAdded=[],valueIndexRemoved=[],indexLength=index.length;if(!iterable){for(i=0;i<indexLength;++i){if(!(filters[offset][k=index[i]]&one)^!!(x=f(values[i],i))){if(x)added.push(k);else removed.push(k)}}}if(iterable){for(i=0;i<indexLength;++i){if(f(values[i],i)){added.push(index[i]);valueIndexAdded.push(i)}else{removed.push(index[i]);valueIndexRemoved.push(i)}}}if(!iterable){for(i=0;i<added.length;i++){if(filters[offset][added[i]]&one)filters[offset][added[i]]&=zero}for(i=0;i<removed.length;i++){if(!(filters[offset][removed[i]]&one))filters[offset][removed[i]]|=one}}else{var newAdded=[];var newRemoved=[];for(i=0;i<added.length;i++){if(iterablesIndexFilterStatus[valueIndexAdded[i]]===1){iterablesIndexCount[added[i]]++;iterablesIndexFilterStatus[valueIndexAdded[i]]=0;if(iterablesIndexCount[added[i]]===1){filters[offset][added[i]]^=one;newAdded.push(added[i])}}}for(i=0;i<removed.length;i++){if(iterablesIndexFilterStatus[valueIndexRemoved[i]]===0){iterablesIndexCount[removed[i]]--;iterablesIndexFilterStatus[valueIndexRemoved[i]]=1;if(iterablesIndexCount[removed[i]]===0){filters[offset][removed[i]]^=one;newRemoved.push(removed[i])}}}added=newAdded;removed=newRemoved;if(filterAll){for(i=0;i<iterablesEmptyRows.length;i++){if(filters[offset][k=iterablesEmptyRows[i]]&one){filters[offset][k]^=one;added.push(k)}}}else{for(i=0;i<iterablesEmptyRows.length;i++){if(!(filters[offset][k=iterablesEmptyRows[i]]&one)){filters[offset][k]^=one;removed.push(k)}}}}filterListeners.forEach(function(l){l(one,offset,added,removed)});triggerOnChange("filtered")}function top(k,top_offset){var array=[],i=hi0,j,toSkip=0;if(top_offset&&top_offset>0)toSkip=top_offset;while(--i>=lo0&&k>0){if(filters.zero(j=index[i])){if(toSkip>0){--toSkip}else{array.push(data[j]);--k}}}if(iterable){for(i=0;i<iterablesEmptyRows.length&&k>0;i++){if(filters.zero(j=iterablesEmptyRows[i])){if(toSkip>0){--toSkip}else{array.push(data[j]);--k}}}}return array}function bottom(k,bottom_offset){var array=[],i,j,toSkip=0;if(bottom_offset&&bottom_offset>0)toSkip=bottom_offset;if(iterable){for(i=0;i<iterablesEmptyRows.length&&k>0;i++){if(filters.zero(j=iterablesEmptyRows[i])){if(toSkip>0){--toSkip}else{array.push(data[j]);--k}}}}i=lo0;while(i<hi0&&k>0){if(filters.zero(j=index[i])){if(toSkip>0){--toSkip}else{array.push(data[j]);--k}}i++}return array}function group(key){var group={top:top,all:all,reduce:reduce,reduceCount:reduceCount,reduceSum:reduceSum,order:order,orderNatural:orderNatural,size:size,dispose:dispose,remove:dispose};dimensionGroups.push(group);var groups,groupIndex,groupWidth=8,groupCapacity=crossfilter_capacity(groupWidth),k=0,select,heap,reduceAdd,reduceRemove,reduceInitial,update=crossfilter_null,reset=crossfilter_null,resetNeeded=true,groupAll=key===crossfilter_null;if(arguments.length<1)key=crossfilter_identity;filterListeners.push(update);indexListeners.push(add);removeDataListeners.push(removeData);add(values,index,0,n);function add(newValues,newIndex,n0,n1){if(iterable){n0old=n0;n0=values.length-newValues.length;n1=newValues.length}var oldGroups=groups,reIndex=iterable?[]:crossfilter_index(k,groupCapacity),add=reduceAdd,remove=reduceRemove,initial=reduceInitial,k0=k,i0=0,i1=0,j,g0,x0,x1,g,x;if(resetNeeded)add=initial=crossfilter_null;if(resetNeeded)remove=initial=crossfilter_null;groups=new Array(k),k=0;if(iterable){groupIndex=k0>1?groupIndex:[]}else{groupIndex=k0>1?xfilterArray.arrayLengthen(groupIndex,n):crossfilter_index(n,groupCapacity)}if(k0)x0=(g0=oldGroups[0]).key;while(i1<n1&&!((x1=key(newValues[i1]))>=x1))++i1;while(i1<n1){if(g0&&x0<=x1){g=g0,x=x0;reIndex[i0]=k;if(g0=oldGroups[++i0])x0=g0.key}else{g={key:x1,value:initial()},x=x1}groups[k]=g;while(x1<=x){j=newIndex[i1]+(iterable?n0old:n0);if(iterable){if(groupIndex[j]){groupIndex[j].push(k)}else{groupIndex[j]=[k]}}else{groupIndex[j]=k}g.value=add(g.value,data[j],true);if(!filters.zeroExcept(j,offset,zero))g.value=remove(g.value,data[j],false);if(++i1>=n1)break;x1=key(newValues[i1])}groupIncrement()}while(i0<k0){groups[reIndex[i0]=k]=oldGroups[i0++];groupIncrement()}if(iterable){for(i=0;i<n;i++){if(!groupIndex[i]){groupIndex[i]=[]}}}if(k>i0){if(iterable){groupIndex=permute(groupIndex,reIndex,true)}else{for(i0=0;i0<n0;++i0){groupIndex[i0]=reIndex[groupIndex[i0]]}}}j=filterListeners.indexOf(update);if(k>1){update=updateMany;reset=resetMany}else{if(!k&&groupAll){k=1;groups=[{key:null,value:initial()}]}if(k===1){update=updateOne;reset=resetOne}else{update=crossfilter_null;reset=crossfilter_null}groupIndex=null}filterListeners[j]=update;function groupIncrement(){if(iterable){k++;return}if(++k===groupCapacity){reIndex=xfilterArray.arrayWiden(reIndex,groupWidth<<=1);groupIndex=xfilterArray.arrayWiden(groupIndex,groupWidth);groupCapacity=crossfilter_capacity(groupWidth)}}}function removeData(){if(k>1){var oldK=k,oldGroups=groups,seenGroups=crossfilter_index(oldK,oldK);for(var i=0,j=0;i<n;++i){if(!filters.zero(i)){seenGroups[groupIndex[j]=groupIndex[i]]=1;++j}}groups=[],k=0;for(i=0;i<oldK;++i){if(seenGroups[i]){seenGroups[i]=k++;groups.push(oldGroups[i])}}if(k>1){for(var i=0;i<j;++i)groupIndex[i]=seenGroups[groupIndex[i]]}else{groupIndex=null}filterListeners[filterListeners.indexOf(update)]=k>1?(reset=resetMany,update=updateMany):k===1?(reset=resetOne,update=updateOne):reset=update=crossfilter_null}else if(k===1){if(groupAll)return;for(var i=0;i<n;++i)if(!filters.zero(i))return;groups=[],k=0;filterListeners[filterListeners.indexOf(update)]=update=reset=crossfilter_null}}function updateMany(filterOne,filterOffset,added,removed,notFilter){if(filterOne===one&&filterOffset===offset||resetNeeded)return;var i,j,k,n,g;if(iterable){for(i=0,n=added.length;i<n;++i){if(filters.zeroExcept(k=added[i],offset,zero)){for(j=0;j<groupIndex[k].length;j++){g=groups[groupIndex[k][j]];g.value=reduceAdd(g.value,data[k],false,j)}}}for(i=0,n=removed.length;i<n;++i){if(filters.onlyExcept(k=removed[i],offset,zero,filterOffset,filterOne)){for(j=0;j<groupIndex[k].length;j++){g=groups[groupIndex[k][j]];g.value=reduceRemove(g.value,data[k],notFilter,j)}}}return}for(i=0,n=added.length;i<n;++i){if(filters.zeroExcept(k=added[i],offset,zero)){g=groups[groupIndex[k]];g.value=reduceAdd(g.value,data[k],false)}}for(i=0,n=removed.length;i<n;++i){if(filters.onlyExcept(k=removed[i],offset,zero,filterOffset,filterOne)){g=groups[groupIndex[k]];g.value=reduceRemove(g.value,data[k],notFilter)}}}function updateOne(filterOne,filterOffset,added,removed,notFilter){if(filterOne===one&&filterOffset===offset||resetNeeded)return;var i,k,n,g=groups[0];for(i=0,n=added.length;i<n;++i){if(filters.zeroExcept(k=added[i],offset,zero)){g.value=reduceAdd(g.value,data[k],false)}}for(i=0,n=removed.length;i<n;++i){if(filters.onlyExcept(k=removed[i],offset,zero,filterOffset,filterOne)){g.value=reduceRemove(g.value,data[k],notFilter)}}}function resetMany(){var i,j,g;for(i=0;i<k;++i){groups[i].value=reduceInitial()}if(iterable){for(i=0;i<n;++i){for(j=0;j<groupIndex[i].length;j++){g=groups[groupIndex[i][j]];g.value=reduceAdd(g.value,data[i],true,j)}}for(i=0;i<n;++i){if(!filters.zeroExcept(i,offset,zero)){for(j=0;j<groupIndex[i].length;j++){g=groups[groupIndex[i][j]];g.value=reduceRemove(g.value,data[i],false,j)}}}return}for(i=0;i<n;++i){g=groups[groupIndex[i]];g.value=reduceAdd(g.value,data[i],true)}for(i=0;i<n;++i){if(!filters.zeroExcept(i,offset,zero)){g=groups[groupIndex[i]];g.value=reduceRemove(g.value,data[i],false)}}}function resetOne(){var i,g=groups[0];g.value=reduceInitial();for(i=0;i<n;++i){g.value=reduceAdd(g.value,data[i],true)}for(i=0;i<n;++i){if(!filters.zeroExcept(i,offset,zero)){g.value=reduceRemove(g.value,data[i],false)}}}function all(){if(resetNeeded)reset(),resetNeeded=false;return groups}function top(k){var top=select(all(),0,groups.length,k);return heap.sort(top,0,top.length)}function reduce(add,remove,initial){reduceAdd=add;reduceRemove=remove;reduceInitial=initial;resetNeeded=true;return group}function reduceCount(){return reduce(xfilterReduce.reduceIncrement,xfilterReduce.reduceDecrement,crossfilter_zero)}function reduceSum(value){return reduce(xfilterReduce.reduceAdd(value),xfilterReduce.reduceSubtract(value),crossfilter_zero)}function order(value){select=xfilterHeapselect.by(valueOf);heap=xfilterHeap.by(valueOf);function valueOf(d){return value(d.value)}return group}function orderNatural(){return order(crossfilter_identity)}function size(){return k}function dispose(){var i=filterListeners.indexOf(update);if(i>=0)filterListeners.splice(i,1);i=indexListeners.indexOf(add);if(i>=0)indexListeners.splice(i,1);i=removeDataListeners.indexOf(removeData);if(i>=0)removeDataListeners.splice(i,1);return group}return reduceCount().orderNatural()}function groupAll(){var g=group(crossfilter_null),all=g.all;delete g.all;delete g.top;delete g.order;delete g.orderNatural;delete g.size;g.value=function(){return all()[0].value};return g}function dispose(){dimensionGroups.forEach(function(group){group.dispose()});var i=dataListeners.indexOf(preAdd);if(i>=0)dataListeners.splice(i,1);i=dataListeners.indexOf(postAdd);if(i>=0)dataListeners.splice(i,1);i=removeDataListeners.indexOf(removeData);if(i>=0)removeDataListeners.splice(i,1);filters.masks[offset]&=zero;return filterAll()}return dimension}function groupAll(){var group={reduce:reduce,reduceCount:reduceCount,reduceSum:reduceSum,value:value,dispose:dispose,remove:dispose};var reduceValue,reduceAdd,reduceRemove,reduceInitial,resetNeeded=true;filterListeners.push(update);dataListeners.push(add);add(data,0,n);function add(newData,n0){var i;if(resetNeeded)return;for(i=n0;i<n;++i){reduceValue=reduceAdd(reduceValue,data[i],true);if(!filters.zero(i)){reduceValue=reduceRemove(reduceValue,data[i],false)}}}function update(filterOne,filterOffset,added,removed,notFilter){var i,k,n;if(resetNeeded)return;for(i=0,n=added.length;i<n;++i){if(filters.zero(k=added[i])){reduceValue=reduceAdd(reduceValue,data[k],notFilter)}}for(i=0,n=removed.length;i<n;++i){if(filters.only(k=removed[i],filterOffset,filterOne)){reduceValue=reduceRemove(reduceValue,data[k],notFilter)}}}function reset(){var i;reduceValue=reduceInitial();for(i=0;i<n;++i){reduceValue=reduceAdd(reduceValue,data[i],true);if(!filters.zero(i)){reduceValue=reduceRemove(reduceValue,data[i],false)}}}function reduce(add,remove,initial){reduceAdd=add;reduceRemove=remove;reduceInitial=initial;resetNeeded=true;return group}function reduceCount(){return reduce(xfilterReduce.reduceIncrement,xfilterReduce.reduceDecrement,crossfilter_zero)}function reduceSum(value){return reduce(xfilterReduce.reduceAdd(value),xfilterReduce.reduceSubtract(value),crossfilter_zero)}function value(){if(resetNeeded)reset(),resetNeeded=false;return reduceValue}function dispose(){var i=filterListeners.indexOf(update);if(i>=0)filterListeners.splice(i);i=dataListeners.indexOf(add);if(i>=0)dataListeners.splice(i);return group}return reduceCount()}function size(){return n}function all(){return data}function onChange(cb){if(typeof cb!=="function"){console.warn("onChange callback parameter must be a function!");return}callbacks.push(cb);return function(){callbacks.splice(callbacks.indexOf(cb),1)}}function triggerOnChange(eventName){for(var i=0;i<callbacks.length;i++){callbacks[i](eventName)}}return arguments.length?add(arguments[0]):crossfilter}function crossfilter_index(n,m){return(m<257?xfilterArray.array8:m<65537?xfilterArray.array16:xfilterArray.array32)(n)}function crossfilter_range(n){var range=crossfilter_index(n,n);for(var i=-1;++i<n;)range[i]=i;return range}function crossfilter_capacity(w){return w===8?256:w===16?65536:4294967296}},{"./../package.json":2,"./array":3,"./bisect":4,"./filter":6,"./heap":7,"./heapselect":8,"./identity":9,"./insertionsort":10,"./null":11,"./permute":12,"./quicksort":13,"./reduce":14,"./zero":15,"lodash.result":16}],6:[function(require,module,exports){function crossfilter_filterExact(bisect,value){return function(values){var n=values.length;return[bisect.left(values,value,0,n),bisect.right(values,value,0,n)]}}function crossfilter_filterRange(bisect,range){var min=range[0],max=range[1];return function(values){var n=values.length;return[bisect.left(values,min,0,n),bisect.left(values,max,0,n)]}}function crossfilter_filterAll(values){return[0,values.length]}module.exports={filterExact:crossfilter_filterExact,filterRange:crossfilter_filterRange,filterAll:crossfilter_filterAll}},{}],7:[function(require,module,exports){var crossfilter_identity=require("./identity");function heap_by(f){function heap(a,lo,hi){var n=hi-lo,i=(n>>>1)+1;while(--i>0)sift(a,i,n,lo);return a}function sort(a,lo,hi){var n=hi-lo,t;while(--n>0)t=a[lo],a[lo]=a[lo+n],a[lo+n]=t,sift(a,1,n,lo);return a}function sift(a,i,n,lo){var d=a[--lo+i],x=f(d),child;while((child=i<<1)<=n){if(child<n&&f(a[lo+child])>f(a[lo+child+1]))child++;if(x<=f(a[lo+child]))break;a[lo+i]=a[lo+child];i=child}a[lo+i]=d}heap.sort=sort;return heap}module.exports=heap_by(crossfilter_identity);module.exports.by=heap_by},{"./identity":9}],8:[function(require,module,exports){var crossfilter_identity=require("./identity");var xFilterHeap=require("./heap");function heapselect_by(f){var heap=xFilterHeap.by(f);function heapselect(a,lo,hi,k){var queue=new Array(k=Math.min(hi-lo,k)),min,i,x,d;for(i=0;i<k;++i)queue[i]=a[lo++];heap(queue,0,k);if(lo<hi){min=f(queue[0]);do{if(x=f(d=a[lo])>min){queue[0]=d;min=f(heap(queue,0,k)[0])}}while(++lo<hi)}return queue}return heapselect}module.exports=heapselect_by(crossfilter_identity);module.exports.by=heapselect_by},{"./heap":7,"./identity":9}],9:[function(require,module,exports){function crossfilter_identity(d){return d}module.exports=crossfilter_identity},{}],10:[function(require,module,exports){var crossfilter_identity=require("./identity");function insertionsort_by(f){function insertionsort(a,lo,hi){for(var i=lo+1;i<hi;++i){for(var j=i,t=a[i],x=f(t);j>lo&&f(a[j-1])>x;--j){a[j]=a[j-1]}a[j]=t}return a}return insertionsort}module.exports=insertionsort_by(crossfilter_identity);module.exports.by=insertionsort_by},{"./identity":9}],11:[function(require,module,exports){function crossfilter_null(){return null}module.exports=crossfilter_null},{}],12:[function(require,module,exports){function permute(array,index,deep){for(var i=0,n=index.length,copy=deep?JSON.parse(JSON.stringify(array)):new Array(n);i<n;++i){copy[i]=array[index[i]]}return copy}module.exports=permute},{}],13:[function(require,module,exports){var crossfilter_identity=require("./identity");var xFilterInsertionsort=require("./insertionsort");function quicksort_by(f){var insertionsort=xFilterInsertionsort.by(f);function sort(a,lo,hi){return(hi-lo<quicksort_sizeThreshold?insertionsort:quicksort)(a,lo,hi)}function quicksort(a,lo,hi){var sixth=(hi-lo)/6|0,i1=lo+sixth,i5=hi-1-sixth,i3=lo+hi-1>>1,i2=i3-sixth,i4=i3+sixth;var e1=a[i1],x1=f(e1),e2=a[i2],x2=f(e2),e3=a[i3],x3=f(e3),e4=a[i4],x4=f(e4),e5=a[i5],x5=f(e5);var t;if(x1>x2)t=e1,e1=e2,e2=t,t=x1,x1=x2,x2=t;if(x4>x5)t=e4,e4=e5,e5=t,t=x4,x4=x5,x5=t;if(x1>x3)t=e1,e1=e3,e3=t,t=x1,x1=x3,x3=t;if(x2>x3)t=e2,e2=e3,e3=t,t=x2,x2=x3,x3=t;if(x1>x4)t=e1,e1=e4,e4=t,t=x1,x1=x4,x4=t;if(x3>x4)t=e3,e3=e4,e4=t,t=x3,x3=x4,x4=t;if(x2>x5)t=e2,e2=e5,e5=t,t=x2,x2=x5,x5=t;if(x2>x3)t=e2,e2=e3,e3=t,t=x2,x2=x3,x3=t;if(x4>x5)t=e4,e4=e5,e5=t,t=x4,x4=x5,x5=t;var pivot1=e2,pivotValue1=x2,pivot2=e4,pivotValue2=x4;a[i1]=e1;a[i2]=a[lo];a[i3]=e3;a[i4]=a[hi-1];a[i5]=e5;var less=lo+1,great=hi-2;var pivotsEqual=pivotValue1<=pivotValue2&&pivotValue1>=pivotValue2;if(pivotsEqual){for(var k=less;k<=great;++k){var ek=a[k],xk=f(ek);if(xk<pivotValue1){if(k!==less){a[k]=a[less];a[less]=ek}++less}else if(xk>pivotValue1){while(true){var greatValue=f(a[great]);if(greatValue>pivotValue1){great--;continue}else if(greatValue<pivotValue1){a[k]=a[less];a[less++]=a[great];a[great--]=ek;break}else{a[k]=a[great];a[great--]=ek;break}}}}}else{for(var k=less;k<=great;k++){var ek=a[k],xk=f(ek);if(xk<pivotValue1){if(k!==less){a[k]=a[less];a[less]=ek}++less}else{if(xk>pivotValue2){while(true){var greatValue=f(a[great]);if(greatValue>pivotValue2){great--;if(great<k)break;continue}else{if(greatValue<pivotValue1){a[k]=a[less];a[less++]=a[great];a[great--]=ek}else{a[k]=a[great];a[great--]=ek}break}}}}}}a[lo]=a[less-1];a[less-1]=pivot1;a[hi-1]=a[great+1];a[great+1]=pivot2;sort(a,lo,less-1);sort(a,great+2,hi);if(pivotsEqual){return a}if(less<i1&&great>i5){var lessValue,greatValue;while((lessValue=f(a[less]))<=pivotValue1&&lessValue>=pivotValue1)++less;while((greatValue=f(a[great]))<=pivotValue2&&greatValue>=pivotValue2)--great;for(var k=less;k<=great;k++){var ek=a[k],xk=f(ek);if(xk<=pivotValue1&&xk>=pivotValue1){if(k!==less){a[k]=a[less];a[less]=ek}less++}else{if(xk<=pivotValue2&&xk>=pivotValue2){while(true){var greatValue=f(a[great]);if(greatValue<=pivotValue2&&greatValue>=pivotValue2){great--;if(great<k)break;continue}else{if(greatValue<pivotValue1){a[k]=a[less];a[less++]=a[great];a[great--]=ek}else{a[k]=a[great];a[great--]=ek}break}}}}}}return sort(a,less,great+1)}return sort}var quicksort_sizeThreshold=32;module.exports=quicksort_by(crossfilter_identity);module.exports.by=quicksort_by},{"./identity":9,"./insertionsort":10}],14:[function(require,module,exports){function crossfilter_reduceIncrement(p){return p+1}function crossfilter_reduceDecrement(p){return p-1}function crossfilter_reduceAdd(f){return function(p,v){return p+ +f(v)}}function crossfilter_reduceSubtract(f){return function(p,v){return p-f(v)}}module.exports={reduceIncrement:crossfilter_reduceIncrement,reduceDecrement:crossfilter_reduceDecrement,reduceAdd:crossfilter_reduceAdd,reduceSubtract:crossfilter_reduceSubtract}},{}], 15:[function(require,module,exports){function crossfilter_zero(){return 0}module.exports=crossfilter_zero},{}],16:[function(require,module,exports){(function(global){var FUNC_ERROR_TEXT="Expected a function";var HASH_UNDEFINED="__lodash_hash_undefined__";var INFINITY=1/0;var funcTag="[object Function]",genTag="[object GeneratorFunction]",symbolTag="[object Symbol]";var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,reLeadingDot=/^\./,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;var reRegExpChar=/[\\^$.*+?()[\]{}|]/g;var reEscapeChar=/\\(\\)?/g;var reIsHostCtor=/^\[object .+?Constructor\]$/;var freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global;var freeSelf=typeof self=="object"&&self&&self.Object===Object&&self;var root=freeGlobal||freeSelf||Function("return this")();function getValue(object,key){return object==null?undefined:object[key]}function isHostObject(value){var result=false;if(value!=null&&typeof value.toString!="function"){try{result=!!(value+"")}catch(e){}}return result}var arrayProto=Array.prototype,funcProto=Function.prototype,objectProto=Object.prototype;var coreJsData=root["__core-js_shared__"];var maskSrcKey=function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""}();var funcToString=funcProto.toString;var hasOwnProperty=objectProto.hasOwnProperty;var objectToString=objectProto.toString;var reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Symbol=root.Symbol,splice=arrayProto.splice;var Map=getNative(root,"Map"),nativeCreate=getNative(Object,"create");var symbolProto=Symbol?Symbol.prototype:undefined,symbolToString=symbolProto?symbolProto.toString:undefined;function Hash(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{}}function hashDelete(key){return this.has(key)&&delete this.__data__[key]}function hashGet(key){var data=this.__data__;if(nativeCreate){var result=data[key];return result===HASH_UNDEFINED?undefined:result}return hasOwnProperty.call(data,key)?data[key]:undefined}function hashHas(key){var data=this.__data__;return nativeCreate?data[key]!==undefined:hasOwnProperty.call(data,key)}function hashSet(key,value){var data=this.__data__;data[key]=nativeCreate&&value===undefined?HASH_UNDEFINED:value;return this}Hash.prototype.clear=hashClear;Hash.prototype["delete"]=hashDelete;Hash.prototype.get=hashGet;Hash.prototype.has=hashHas;Hash.prototype.set=hashSet;function ListCache(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function listCacheClear(){this.__data__=[]}function listCacheDelete(key){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){return false}var lastIndex=data.length-1;if(index==lastIndex){data.pop()}else{splice.call(data,index,1)}return true}function listCacheGet(key){var data=this.__data__,index=assocIndexOf(data,key);return index<0?undefined:data[index][1]}function listCacheHas(key){return assocIndexOf(this.__data__,key)>-1}function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){data.push([key,value])}else{data[index][1]=value}return this}ListCache.prototype.clear=listCacheClear;ListCache.prototype["delete"]=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;function MapCache(entries){var index=-1,length=entries?entries.length:0;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}function mapCacheClear(){this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}function mapCacheDelete(key){return getMapData(this,key)["delete"](key)}function mapCacheGet(key){return getMapData(this,key).get(key)}function mapCacheHas(key){return getMapData(this,key).has(key)}function mapCacheSet(key,value){getMapData(this,key).set(key,value);return this}MapCache.prototype.clear=mapCacheClear;MapCache.prototype["delete"]=mapCacheDelete;MapCache.prototype.get=mapCacheGet;MapCache.prototype.has=mapCacheHas;MapCache.prototype.set=mapCacheSet;function assocIndexOf(array,key){var length=array.length;while(length--){if(eq(array[length][0],key)){return length}}return-1}function baseIsNative(value){if(!isObject(value)||isMasked(value)){return false}var pattern=isFunction(value)||isHostObject(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value))}function baseToString(value){if(typeof value=="string"){return value}if(isSymbol(value)){return symbolToString?symbolToString.call(value):""}var result=value+"";return result=="0"&&1/value==-INFINITY?"-0":result}function castPath(value){return isArray(value)?value:stringToPath(value)}function getMapData(map,key){var data=map.__data__;return isKeyable(key)?data[typeof key=="string"?"string":"hash"]:data.map}function getNative(object,key){var value=getValue(object,key);return baseIsNative(value)?value:undefined}function isKey(value,object){if(isArray(value)){return false}var type=typeof value;if(type=="number"||type=="symbol"||type=="boolean"||value==null||isSymbol(value)){return true}return reIsPlainProp.test(value)||!reIsDeepProp.test(value)||object!=null&&value in Object(object)}function isKeyable(value){var type=typeof value;return type=="string"||type=="number"||type=="symbol"||type=="boolean"?value!=="__proto__":value===null}function isMasked(func){return!!maskSrcKey&&maskSrcKey in func}var stringToPath=memoize(function(string){string=toString(string);var result=[];if(reLeadingDot.test(string)){result.push("")}string.replace(rePropName,function(match,number,quote,string){result.push(quote?string.replace(reEscapeChar,"$1"):number||match)});return result});function toKey(value){if(typeof value=="string"||isSymbol(value)){return value}var result=value+"";return result=="0"&&1/value==-INFINITY?"-0":result}function toSource(func){if(func!=null){try{return funcToString.call(func)}catch(e){}try{return func+""}catch(e){}}return""}function memoize(func,resolver){if(typeof func!="function"||resolver&&typeof resolver!="function"){throw new TypeError(FUNC_ERROR_TEXT)}var memoized=function(){var args=arguments,key=resolver?resolver.apply(this,args):args[0],cache=memoized.cache;if(cache.has(key)){return cache.get(key)}var result=func.apply(this,args);memoized.cache=cache.set(key,result);return result};memoized.cache=new(memoize.Cache||MapCache);return memoized}memoize.Cache=MapCache;function eq(value,other){return value===other||value!==value&&other!==other}var isArray=Array.isArray;function isFunction(value){var tag=isObject(value)?objectToString.call(value):"";return tag==funcTag||tag==genTag}function isObject(value){var type=typeof value;return!!value&&(type=="object"||type=="function")}function isObjectLike(value){return!!value&&typeof value=="object"}function isSymbol(value){return typeof value=="symbol"||isObjectLike(value)&&objectToString.call(value)==symbolTag}function toString(value){return value==null?"":baseToString(value)}function result(object,path,defaultValue){path=isKey(path,object)?[path]:castPath(path);var index=-1,length=path.length;if(!length){object=undefined;length=1}while(++index<length){var value=object==null?undefined:object[toKey(path[index])];if(value===undefined){index=length;value=defaultValue}object=isFunction(value)?value.call(object):value}return object}module.exports=result}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],17:[function(require,module,exports){var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){cachedSetTimeout=setTimeout}else{cachedSetTimeout=defaultSetTimout}}catch(e){cachedSetTimeout=defaultSetTimout}try{if(typeof clearTimeout==="function"){cachedClearTimeout=clearTimeout}else{cachedClearTimeout=defaultClearTimeout}}catch(e){cachedClearTimeout=defaultClearTimeout}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0)}if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0)}try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker)}if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker)}try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run()}}queueIndex=-1;len=queue.length}currentQueue=null;draining=false;runClearTimeout(timeout)}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i]}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue)}};function Item(fun,array){this.fun=fun;this.array=array}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=true;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[]};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")};process.umask=function(){return 0}},{}],18:[function(require,module,exports){(function(process){(function(definition){"use strict";if(typeof bootstrap==="function"){bootstrap("promise",definition)}else if(typeof exports==="object"&&typeof module==="object"){module.exports=definition()}else if(typeof define==="function"&&define.amd){define(definition)}else if(typeof ses!=="undefined"){if(!ses.ok()){return}else{ses.makeQ=definition}}else if(typeof window!=="undefined"||typeof self!=="undefined"){var global=typeof window!=="undefined"?window:self;var previousQ=global.Q;global.Q=definition();global.Q.noConflict=function(){global.Q=previousQ;return this}}else{throw new Error("This environment was not anticipated by Q. Please file a bug.")}})(function(){"use strict";var hasStacks=false;try{throw new Error}catch(e){hasStacks=!!e.stack}var qStartingLine=captureLine();var qFileName;var noop=function(){};var nextTick=function(){var head={task:void 0,next:null};var tail=head;var flushing=false;var requestTick=void 0;var isNodeJS=false;var laterQueue=[];function flush(){var task,domain;while(head.next){head=head.next;task=head.task;head.task=void 0;domain=head.domain;if(domain){head.domain=void 0;domain.enter()}runSingle(task,domain)}while(laterQueue.length){task=laterQueue.pop();runSingle(task)}flushing=false}function runSingle(task,domain){try{task()}catch(e){if(isNodeJS){if(domain){domain.exit()}setTimeout(flush,0);if(domain){domain.enter()}throw e}else{setTimeout(function(){throw e},0)}}if(domain){domain.exit()}}nextTick=function(task){tail=tail.next={task:task,domain:isNodeJS&&process.domain,next:null};if(!flushing){flushing=true;requestTick()}};if(typeof process==="object"&&process.toString()==="[object process]"&&process.nextTick){isNodeJS=true;requestTick=function(){process.nextTick(flush)}}else if(typeof setImmediate==="function"){if(typeof window!=="undefined"){requestTick=setImmediate.bind(window,flush)}else{requestTick=function(){setImmediate(flush)}}}else if(typeof MessageChannel!=="undefined"){var channel=new MessageChannel;channel.port1.onmessage=function(){requestTick=requestPortTick;channel.port1.onmessage=flush;flush()};var requestPortTick=function(){channel.port2.postMessage(0)};requestTick=function(){setTimeout(flush,0);requestPortTick()}}else{requestTick=function(){setTimeout(flush,0)}}nextTick.runAfter=function(task){laterQueue.push(task);if(!flushing){flushing=true;requestTick()}};return nextTick}();var call=Function.call;function uncurryThis(f){return function(){return call.apply(f,arguments)}}var array_slice=uncurryThis(Array.prototype.slice);var array_reduce=uncurryThis(Array.prototype.reduce||function(callback,basis){var index=0,length=this.length;if(arguments.length===1){do{if(index in this){basis=this[index++];break}if(++index>=length){throw new TypeError}}while(1)}for(;index<length;index++){if(index in this){basis=callback(basis,this[index],index)}}return basis});var array_indexOf=uncurryThis(Array.prototype.indexOf||function(value){for(var i=0;i<this.length;i++){if(this[i]===value){return i}}return-1});var array_map=uncurryThis(Array.prototype.map||function(callback,thisp){var self=this;var collect=[];array_reduce(self,function(undefined,value,index){collect.push(callback.call(thisp,value,index,self))},void 0);return collect});var object_create=Object.create||function(prototype){function Type(){}Type.prototype=prototype;return new Type};var object_defineProperty=Object.defineProperty||function(obj,prop,descriptor){obj[prop]=descriptor.value;return obj};var object_hasOwnProperty=uncurryThis(Object.prototype.hasOwnProperty);var object_keys=Object.keys||function(object){var keys=[];for(var key in object){if(object_hasOwnProperty(object,key)){keys.push(key)}}return keys};var object_toString=uncurryThis(Object.prototype.toString);function isObject(value){return value===Object(value)}function isStopIteration(exception){return object_toString(exception)==="[object StopIteration]"||exception instanceof QReturnValue}var QReturnValue;if(typeof ReturnValue!=="undefined"){QReturnValue=ReturnValue}else{QReturnValue=function(value){this.value=value}}var STACK_JUMP_SEPARATOR="From previous event:";function makeStackTraceLong(error,promise){if(hasStacks&&promise.stack&&typeof error==="object"&&error!==null&&error.stack){var stacks=[];for(var p=promise;!!p;p=p.source){if(p.stack&&(!error.__minimumStackCounter__||error.__minimumStackCounter__>p.stackCounter)){object_defineProperty(error,"__minimumStackCounter__",{value:p.stackCounter,configurable:true});stacks.unshift(p.stack)}}stacks.unshift(error.stack);var concatedStacks=stacks.join("\n"+STACK_JUMP_SEPARATOR+"\n");var stack=filterStackString(concatedStacks);object_defineProperty(error,"stack",{value:stack,configurable:true})}}function filterStackString(stackString){var lines=stackString.split("\n");var desiredLines=[];for(var i=0;i<lines.length;++i){var line=lines[i];if(!isInternalFrame(line)&&!isNodeFrame(line)&&line){desiredLines.push(line)}}return desiredLines.join("\n")}function isNodeFrame(stackLine){return stackLine.indexOf("(module.js:")!==-1||stackLine.indexOf("(node.js:")!==-1}function getFileNameAndLineNumber(stackLine){var attempt1=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);if(attempt1){return[attempt1[1],Number(attempt1[2])]}var attempt2=/at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine);if(attempt2){return[attempt2[1],Number(attempt2[2])]}var attempt3=/.*@(.+):(\d+)$/.exec(stackLine);if(attempt3){return[attempt3[1],Number(attempt3[2])]}}function isInternalFrame(stackLine){var fileNameAndLineNumber=getFileNameAndLineNumber(stackLine);if(!fileNameAndLineNumber){return false}var fileName=fileNameAndLineNumber[0];var lineNumber=fileNameAndLineNumber[1];return fileName===qFileName&&lineNumber>=qStartingLine&&lineNumber<=qEndingLine}function captureLine(){if(!hasStacks){return}try{throw new Error}catch(e){var lines=e.stack.split("\n");var firstLine=lines[0].indexOf("@")>0?lines[1]:lines[2];var fileNameAndLineNumber=getFileNameAndLineNumber(firstLine);if(!fileNameAndLineNumber){return}qFileName=fileNameAndLineNumber[0];return fileNameAndLineNumber[1]}}function deprecate(callback,name,alternative){return function(){if(typeof console!=="undefined"&&typeof console.warn==="function"){console.warn(name+" is deprecated, use "+alternative+" instead.",new Error("").stack)}return callback.apply(callback,arguments)}}function Q(value){if(value instanceof Promise){return value}if(isPromiseAlike(value)){return coerce(value)}else{return fulfill(value)}}Q.resolve=Q;Q.nextTick=nextTick;Q.longStackSupport=false;var longStackCounter=1;if(typeof process==="object"&&process&&process.env&&process.env.Q_DEBUG){Q.longStackSupport=true}Q.defer=defer;function defer(){var messages=[],progressListeners=[],resolvedPromise;var deferred=object_create(defer.prototype);var promise=object_create(Promise.prototype);promise.promiseDispatch=function(resolve,op,operands){var args=array_slice(arguments);if(messages){messages.push(args);if(op==="when"&&operands[1]){progressListeners.push(operands[1])}}else{Q.nextTick(function(){resolvedPromise.promiseDispatch.apply(resolvedPromise,args)})}};promise.valueOf=function(){if(messages){return promise}var nearerValue=nearer(resolvedPromise);if(isPromise(nearerValue)){resolvedPromise=nearerValue}