Skip to content

Instantly share code, notes, and snippets.

@tannerlinsley
Last active July 20, 2016 23:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tannerlinsley/36719c9856bbca4f1c25e1a3b7aeb676 to your computer and use it in GitHub Desktop.
Save tannerlinsley/36719c9856bbca4f1c25e1a3b7aeb676 to your computer and use it in GitHub Desktop.
requirebin sketch
var universe = require('universe');
var _ = require('lodash')
var myUniverse = null;
var queryRes = null;
var data = [
{
animal: 'cat',
value: 3,
},
{
animal: 'dog',
value: 8,
},
{
animal: 'monkey',
value: 2,
},
{
animal: 'monkey',
value: 9,
},
{
animal: 'marmot',
value: 7,
},
{
animal: 'bird',
value: 100,
},
];
// boot up universe
universe(data)
.then(function (instance) {
// store the original instance, to later apply filter globally
myUniverse = instance;
return instance.query({
groupBy: 'animal',
select: {
$dataList: true,
}
})
})
.then(function (res) {
console.log('query results are ready...');
queryRes = res;
return res.universe;
})
.then(logQuery)
// simulate some UI events
setTimeout(tweakFilter2, 1000);
// tweakFilter1 has no effect- the original dataset always appears in query result
function tweakFilter1() {
myUniverse.filter('animal', 'monkey')
.then(logQuery);
}
// tweakFilter2 sometimes works- but the query result ALTERNATES
// with the original dataset, back and forth
function tweakFilter2() {
console.log('Filtering....')
myUniverse.filter('value', 9)
.then(logQuery);
}
// tweakFilter3 results always seems legit! why not the others?
function tweakFilter3() {
myUniverse.filter('value', [Math.random(), 10 * Math.random()], true)
.then(logQuery);
}
function logQuery(result) {
console.log(JSON.stringify(queryRes.data, null, 2));
}
setTimeout(function(){require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canMutationObserver=typeof window!=="undefined"&&window.MutationObserver;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}var queue=[];if(canMutationObserver){var hiddenDiv=document.createElement("div");var observer=new MutationObserver(function(){var queueList=queue.slice();queue.length=0;queueList.forEach(function(fn){fn()})});observer.observe(hiddenDiv,{attributes:true});return function nextTick(fn){if(!queue.length){hiddenDiv.setAttribute("yes","no")}queue.push(fn)}}if(canPost){window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],2:[function(require,module,exports){(function(exports){crossfilter.version="2.0.0-alpha.03";function crossfilter_identity(d){return d}crossfilter.permute=permute;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}var bisect=crossfilter.bisect=bisect_by(crossfilter_identity);bisect.by=bisect_by;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}var heap=crossfilter.heap=heap_by(crossfilter_identity);heap.by=heap_by;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}var heapselect=crossfilter.heapselect=heapselect_by(crossfilter_identity);heapselect.by=heapselect_by;function heapselect_by(f){var heap=heap_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}var insertionsort=crossfilter.insertionsort=insertionsort_by(crossfilter_identity);insertionsort.by=insertionsort_by;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}var quicksort=crossfilter.quicksort=quicksort_by(crossfilter_identity);quicksort.by=quicksort_by;function quicksort_by(f){var insertionsort=insertionsort_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;var crossfilter_array8=crossfilter_arrayUntyped,crossfilter_array16=crossfilter_arrayUntyped,crossfilter_array32=crossfilter_arrayUntyped,crossfilter_arrayLengthen=crossfilter_arrayLengthenUntyped,crossfilter_arrayWiden=crossfilter_arrayWidenUntyped;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.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};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]}function crossfilter_null(){return null}function crossfilter_zero(){return 0}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)}}exports.crossfilter=crossfilter;function crossfilter(){var crossfilter={add:add,remove:removeData,dimension:dimension,groupAll:groupAll,size:size,all:all,onChange:onChange};var data=[],n=0,filters,filterListeners=[],dataListeners=[],removeDataListeners=[],callbacks=[];filters=new crossfilter_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 dimension(value,iterable){var dimension={filter:filter,filterExact:filterExact,filterRange:filterRange,filterFunction:filterFunction,filterAll:filterAll,top:top,bottom:bottom,group:group,groupAll:groupAll,dispose:dispose,remove:dispose};var one,zero,offset,values,index,oldValues,oldIndex,newValues,newIndex,iterablesIndexCount,newIterablesIndexCount,iterablesIndexFilterStatus,newIterablesIndexFilterStatus,oldIterablesIndexFilterStatus,iterablesEmptyRows,sort=quicksort_by(function(i){return newValues[i]}),refilter=crossfilter_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;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}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=crossfilter_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=crossfilter_filterExact(bisect,value))(values))}function filterRange(range){return filterIndexBounds((refilter=crossfilter_filterRange(bisect,range))(values))}function filterAll(){return filterIndexBounds((refilter=crossfilter_filterAll)(values))}function filterFunction(f){refilter=crossfilter_filterAll;filterIndexFunction(refilterFunction=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){var array=[],i=hi0,j;while(--i>=lo0&&k>0){if(filters.zero(j=index[i])){array.push(data[j]);--k}}if(iterable){for(i=0;i<iterablesEmptyRows.length&&k>0;i++){if(filters.zero(j=iterablesEmptyRows[i])){array.push(data[j]);--k}}}return array}function bottom(k){var array=[],i,j;if(iterable){for(i=0;i<iterablesEmptyRows.length&&k>0;i++){if(filters.zero(j=iterablesEmptyRows[i])){array.push(data[j]);--k}}}i=lo0;while(i<hi0&&k>0){if(filters.zero(j=index[i])){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?crossfilter_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=crossfilter_arrayWiden(reIndex,groupWidth<<=1);groupIndex=crossfilter_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(crossfilter_reduceIncrement,crossfilter_reduceDecrement,crossfilter_zero)}function reduceSum(value){return reduce(crossfilter_reduceAdd(value),crossfilter_reduceSubtract(value),crossfilter_zero)}function order(value){select=heapselect_by(valueOf);heap=heap_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(crossfilter_reduceIncrement,crossfilter_reduceDecrement,crossfilter_zero)}function reduceSum(value){return reduce(crossfilter_reduceAdd(value),crossfilter_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?crossfilter_array8:m<65537?crossfilter_array16:crossfilter_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}})(typeof exports!=="undefined"&&exports||this)},{}],3:[function(require,module,exports){module.exports=require("./crossfilter").crossfilter},{"./crossfilter":2}],4:[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_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&&error.stack.indexOf(STACK_JUMP_SEPARATOR)===-1){var stacks=[];for(var p=promise;!!p;p=p.source){if(p.stack){stacks.unshift(p.stack)}}stacks.unshift(error.stack);var concatedStacks=stacks.join("\n"+STACK_JUMP_SEPARATOR+"\n");error.stack=filterStackString(concatedStacks)}}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;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}return nearerValue};promise.inspect=function(){if(!resolvedPromise){return{state:"pending"}}return resolvedPromise.inspect()};if(Q.longStackSupport&&hasStacks){try{throw new Error}catch(e){promise.stack=e.stack.substring(e.stack.indexOf("\n")+1)}}function become(newPromise){resolvedPromise=newPromise;promise.source=newPromise;array_reduce(messages,function(undefined,message){Q.nextTick(function(){newPromise.promiseDispatch.apply(newPromise,message)})},void 0);messages=void 0;progressListeners=void 0}deferred.promise=promise;deferred.resolve=function(value){if(resolvedPromise){return}become(Q(value))};deferred.fulfill=function(value){if(resolvedPromise){return}become(fulfill(value))};deferred.reject=function(reason){if(resolvedPromise){return}become(reject(reason))};deferred.notify=function(progress){if(resolvedPromise){return}array_reduce(progressListeners,function(undefined,progressListener){Q.nextTick(function(){progressListener(progress)})},void 0)};return deferred}defer.prototype.makeNodeResolver=function(){var self=this;return function(error,value){if(error){self.reject(error)}else if(arguments.length>2){self.resolve(array_slice(arguments,1))}else{self.resolve(value)}}};Q.Promise=promise;Q.promise=promise;function promise(resolver){if(typeof resolver!=="function"){throw new TypeError("resolver must be a function.")}var deferred=defer();try{resolver(deferred.resolve,deferred.reject,deferred.notify)}catch(reason){deferred.reject(reason)}return deferred.promise}promise.race=race;promise.all=all;promise.reject=reject;promise.resolve=Q;Q.passByCopy=function(object){return object};Promise.prototype.passByCopy=function(){return this};Q.join=function(x,y){return Q(x).join(y)};Promise.prototype.join=function(that){return Q([this,that]).spread(function(x,y){if(x===y){return x}else{throw new Error("Can't join: not the same: "+x+" "+y)}})};Q.race=race;function race(answerPs){return promise(function(resolve,reject){for(var i=0,len=answerPs.length;i<len;i++){Q(answerPs[i]).then(resolve,reject)}})}Promise.prototype.race=function(){return this.then(Q.race)};Q.makePromise=Promise;function Promise(descriptor,fallback,inspect){if(fallback===void 0){fallback=function(op){return reject(new Error("Promise does not support operation: "+op))}}if(inspect===void 0){inspect=function(){return{state:"unknown"}}}var promise=object_create(Promise.prototype);promise.promiseDispatch=function(resolve,op,args){var result;try{if(descriptor[op]){result=descriptor[op].apply(promise,args)}else{result=fallback.call(promise,op,args)}}catch(exception){result=reject(exception)}if(resolve){resolve(result)}};promise.inspect=inspect;if(inspect){var inspected=inspect();if(inspected.state==="rejected"){promise.exception=inspected.reason}promise.valueOf=function(){var inspected=inspect();if(inspected.state==="pending"||inspected.state==="rejected"){return promise}return inspected.value}}return promise}Promise.prototype.toString=function(){return"[object Promise]"};Promise.prototype.then=function(fulfilled,rejected,progressed){var self=this;var deferred=defer();var done=false;function _fulfilled(value){try{return typeof fulfilled==="function"?fulfilled(value):value}catch(exception){return reject(exception)}}function _rejected(exception){if(typeof rejected==="function"){makeStackTraceLong(exception,self);try{return rejected(exception)}catch(newException){return reject(newException)}}return reject(exception)}function _progressed(value){return typeof progressed==="function"?progressed(value):value}Q.nextTick(function(){self.promiseDispatch(function(value){if(done){return}done=true;deferred.resolve(_fulfilled(value))},"when",[function(exception){if(done){return}done=true;deferred.resolve(_rejected(exception))}])});self.promiseDispatch(void 0,"when",[void 0,function(value){var newValue;var threw=false;try{newValue=_progressed(value)}catch(e){threw=true;if(Q.onerror){Q.onerror(e)}else{throw e}}if(!threw){deferred.notify(newValue)}}]);return deferred.promise};Q.tap=function(promise,callback){return Q(promise).tap(callback)};Promise.prototype.tap=function(callback){callback=Q(callback);return this.then(function(value){return callback.fcall(value).thenResolve(value)})};Q.when=when;function when(value,fulfilled,rejected,progressed){return Q(value).then(fulfilled,rejected,progressed)}Promise.prototype.thenResolve=function(value){return this.then(function(){return value})};Q.thenResolve=function(promise,value){return Q(promise).thenResolve(value)};Promise.prototype.thenReject=function(reason){return this.then(function(){throw reason})};Q.thenReject=function(promise,reason){return Q(promise).thenReject(reason)};Q.nearer=nearer;function nearer(value){if(isPromise(value)){var inspected=value.inspect();if(inspected.state==="fulfilled"){return inspected.value}}return value}Q.isPromise=isPromise;function isPromise(object){return object instanceof Promise}Q.isPromiseAlike=isPromiseAlike;function isPromiseAlike(object){return isObject(object)&&typeof object.then==="function"}Q.isPending=isPending;function isPending(object){return isPromise(object)&&object.inspect().state==="pending"}Promise.prototype.isPending=function(){return this.inspect().state==="pending"};Q.isFulfilled=isFulfilled;function isFulfilled(object){return!isPromise(object)||object.inspect().state==="fulfilled"}Promise.prototype.isFulfilled=function(){return this.inspect().state==="fulfilled"};Q.isRejected=isRejected;function isRejected(object){return isPromise(object)&&object.inspect().state==="rejected"}Promise.prototype.isRejected=function(){return this.inspect().state==="rejected"};var unhandledReasons=[];var unhandledRejections=[];var reportedUnhandledRejections=[];var trackUnhandledRejections=true;function resetUnhandledRejections(){unhandledReasons.length=0;unhandledRejections.length=0;if(!trackUnhandledRejections){trackUnhandledRejections=true}}function trackRejection(promise,reason){if(!trackUnhandledRejections){return}if(typeof process==="object"&&typeof process.emit==="function"){Q.nextTick.runAfter(function(){if(array_indexOf(unhandledRejections,promise)!==-1){process.emit("unhandledRejection",reason,promise);reportedUnhandledRejections.push(promise)}})}unhandledRejections.push(promise);if(reason&&typeof reason.stack!=="undefined"){unhandledReasons.push(reason.stack)}else{unhandledReasons.push("(no stack) "+reason)}}function untrackRejection(promise){if(!trackUnhandledRejections){return}var at=array_indexOf(unhandledRejections,promise);if(at!==-1){if(typeof process==="object"&&typeof process.emit==="function"){Q.nextTick.runAfter(function(){var atReport=array_indexOf(reportedUnhandledRejections,promise);if(atReport!==-1){process.emit("rejectionHandled",unhandledReasons[at],promise);reportedUnhandledRejections.splice(atReport,1)}})}unhandledRejections.splice(at,1);unhandledReasons.splice(at,1)}}Q.resetUnhandledRejections=resetUnhandledRejections;Q.getUnhandledReasons=function(){return unhandledReasons.slice()};Q.stopUnhandledRejectionTracking=function(){resetUnhandledRejections();trackUnhandledRejections=false};resetUnhandledRejections();Q.reject=reject;function reject(reason){var rejection=Promise({when:function(rejected){if(rejected){untrackRejection(this)}return rejected?rejected(reason):this}},function fallback(){return this},function inspect(){return{state:"rejected",reason:reason}});trackRejection(rejection,reason);return rejection}Q.fulfill=fulfill;function fulfill(value){return Promise({when:function(){return value},get:function(name){return value[name]},set:function(name,rhs){value[name]=rhs},"delete":function(name){delete value[name]},post:function(name,args){if(name===null||name===void 0){return value.apply(void 0,args)}else{return value[name].apply(value,args)}},apply:function(thisp,args){return value.apply(thisp,args)},keys:function(){return object_keys(value)}},void 0,function inspect(){return{state:"fulfilled",value:value}})}function coerce(promise){var deferred=defer();Q.nextTick(function(){try{promise.then(deferred.resolve,deferred.reject,deferred.notify)}catch(exception){deferred.reject(exception)}});return deferred.promise}Q.master=master;function master(object){return Promise({isDef:function(){}},function fallback(op,args){return dispatch(object,op,args)},function(){return Q(object).inspect()})}Q.spread=spread;function spread(value,fulfilled,rejected){return Q(value).spread(fulfilled,rejected)}Promise.prototype.spread=function(fulfilled,rejected){return this.all().then(function(array){return fulfilled.apply(void 0,array)},rejected)};Q.async=async;function async(makeGenerator){return function(){function continuer(verb,arg){var result;if(typeof StopIteration==="undefined"){try{result=generator[verb](arg)}catch(exception){return reject(exception)}if(result.done){return Q(result.value)}else{return when(result.value,callback,errback)}}else{try{result=generator[verb](arg)}catch(exception){if(isStopIteration(exception)){return Q(exception.value)}else{return reject(exception)}}return when(result,callback,errback)}}var generator=makeGenerator.apply(this,arguments);var callback=continuer.bind(continuer,"next");var errback=continuer.bind(continuer,"throw");return callback()}}Q.spawn=spawn;function spawn(makeGenerator){Q.done(Q.async(makeGenerator)())}Q["return"]=_return;function _return(value){throw new QReturnValue(value)}Q.promised=promised;function promised(callback){return function(){return spread([this,all(arguments)],function(self,args){return callback.apply(self,args)})}}Q.dispatch=dispatch;function dispatch(object,op,args){return Q(object).dispatch(op,args)}Promise.prototype.dispatch=function(op,args){var self=this;var deferred=defer();Q.nextTick(function(){self.promiseDispatch(deferred.resolve,op,args)});return deferred.promise};Q.get=function(object,key){return Q(object).dispatch("get",[key])};Promise.prototype.get=function(key){return this.dispatch("get",[key])};Q.set=function(object,key,value){return Q(object).dispatch("set",[key,value])};Promise.prototype.set=function(key,value){return this.dispatch("set",[key,value])};Q.del=Q["delete"]=function(object,key){return Q(object).dispatch("delete",[key])};Promise.prototype.del=Promise.prototype["delete"]=function(key){return this.dispatch("delete",[key])};Q.mapply=Q.post=function(object,name,args){return Q(object).dispatch("post",[name,args])};Promise.prototype.mapply=Promise.prototype.post=function(name,args){return this.dispatch("post",[name,args])};Q.send=Q.mcall=Q.invoke=function(object,name){return Q(object).dispatch("post",[name,array_slice(arguments,2)])};Promise.prototype.send=Promise.prototype.mcall=Promise.prototype.invoke=function(name){return this.dispatch("post",[name,array_slice(arguments,1)])};Q.fapply=function(object,args){return Q(object).dispatch("apply",[void 0,args])};Promise.prototype.fapply=function(args){return this.dispatch("apply",[void 0,args])};Q["try"]=Q.fcall=function(object){return Q(object).dispatch("apply",[void 0,array_slice(arguments,1)])};Promise.prototype.fcall=function(){return this.dispatch("apply",[void 0,array_slice(arguments)])};Q.fbind=function(object){var promise=Q(object);var args=array_slice(arguments,1);return function fbound(){return promise.dispatch("apply",[this,args.concat(array_slice(arguments))])}};Promise.prototype.fbind=function(){var promise=this;var args=array_slice(arguments);return function fbound(){return promise.dispatch("apply",[this,args.concat(array_slice(arguments))])}};Q.keys=function(object){return Q(object).dispatch("keys",[])};Promise.prototype.keys=function(){return this.dispatch("keys",[])};Q.all=all;function all(promises){return when(promises,function(promises){var pendingCount=0;var deferred=defer();array_reduce(promises,function(undefined,promise,index){var snapshot;if(isPromise(promise)&&(snapshot=promise.inspect()).state==="fulfilled"){promises[index]=snapshot.value}else{++pendingCount;when(promise,function(value){promises[index]=value;if(--pendingCount===0){deferred.resolve(promises)}},deferred.reject,function(progress){deferred.notify({index:index,value:progress})})}},void 0);if(pendingCount===0){deferred.resolve(promises)}return deferred.promise})}Promise.prototype.all=function(){return all(this)};Q.any=any;function any(promises){if(promises.length===0){return Q.resolve()}var deferred=Q.defer();var pendingCount=0;array_reduce(promises,function(prev,current,index){var promise=promises[index];pendingCount++;when(promise,onFulfilled,onRejected,onProgress);function onFulfilled(result){deferred.resolve(result)}function onRejected(){pendingCount--;if(pendingCount===0){deferred.reject(new Error("Can't get fulfillment value from any promise, all "+"promises were rejected."))}}function onProgress(progress){deferred.notify({index:index,value:progress})}},undefined);return deferred.promise}Promise.prototype.any=function(){return any(this)};Q.allResolved=deprecate(allResolved,"allResolved","allSettled");function allResolved(promises){return when(promises,function(promises){promises=array_map(promises,Q);return when(all(array_map(promises,function(promise){return when(promise,noop,noop)})),function(){return promises})})}Promise.prototype.allResolved=function(){return allResolved(this)};Q.allSettled=allSettled;function allSettled(promises){return Q(promises).allSettled()}Promise.prototype.allSettled=function(){return this.then(function(promises){return all(array_map(promises,function(promise){promise=Q(promise);function regardless(){return promise.inspect()}return promise.then(regardless,regardless)}))})};Q.fail=Q["catch"]=function(object,rejected){return Q(object).then(void 0,rejected)};Promise.prototype.fail=Promise.prototype["catch"]=function(rejected){return this.then(void 0,rejected)};Q.progress=progress;function progress(object,progressed){return Q(object).then(void 0,void 0,progressed)}Promise.prototype.progress=function(progressed){return this.then(void 0,void 0,progressed)};Q.fin=Q["finally"]=function(object,callback){return Q(object)["finally"](callback)};Promise.prototype.fin=Promise.prototype["finally"]=function(callback){callback=Q(callback);return this.then(function(value){return callback.fcall().then(function(){return value})},function(reason){return callback.fcall().then(function(){throw reason})})};Q.done=function(object,fulfilled,rejected,progress){return Q(object).done(fulfilled,rejected,progress)};Promise.prototype.done=function(fulfilled,rejected,progress){var onUnhandledError=function(error){Q.nextTick(function(){makeStackTraceLong(error,promise);if(Q.onerror){Q.onerror(error)}else{throw error}})};var promise=fulfilled||rejected||progress?this.then(fulfilled,rejected,progress):this;if(typeof process==="object"&&process&&process.domain){onUnhandledError=process.domain.bind(onUnhandledError)}promise.then(void 0,onUnhandledError)};Q.timeout=function(object,ms,error){return Q(object).timeout(ms,error)};Promise.prototype.timeout=function(ms,error){var deferred=defer();var timeoutId=setTimeout(function(){if(!error||"string"===typeof error){error=new Error(error||"Timed out after "+ms+" ms");error.code="ETIMEDOUT"}deferred.reject(error)},ms);this.then(function(value){clearTimeout(timeoutId);deferred.resolve(value)},function(exception){clearTimeout(timeoutId);deferred.reject(exception)},deferred.notify);return deferred.promise};Q.delay=function(object,timeout){if(timeout===void 0){timeout=object;object=void 0}return Q(object).delay(timeout)};Promise.prototype.delay=function(timeout){return this.then(function(value){var deferred=defer();setTimeout(function(){deferred.resolve(value)},timeout);return deferred.promise})};Q.nfapply=function(callback,args){return Q(callback).nfapply(args)};Promise.prototype.nfapply=function(args){var deferred=defer();var nodeArgs=array_slice(args);nodeArgs.push(deferred.makeNodeResolver());this.fapply(nodeArgs).fail(deferred.reject);return deferred.promise};Q.nfcall=function(callback){var args=array_slice(arguments,1);return Q(callback).nfapply(args)};Promise.prototype.nfcall=function(){var nodeArgs=array_slice(arguments);var deferred=defer();nodeArgs.push(deferred.makeNodeResolver());this.fapply(nodeArgs).fail(deferred.reject);return deferred.promise};Q.nfbind=Q.denodeify=function(callback){var baseArgs=array_slice(arguments,1);return function(){var nodeArgs=baseArgs.concat(array_slice(arguments));var deferred=defer();nodeArgs.push(deferred.makeNodeResolver());Q(callback).fapply(nodeArgs).fail(deferred.reject);return deferred.promise}};Promise.prototype.nfbind=Promise.prototype.denodeify=function(){var args=array_slice(arguments);args.unshift(this);return Q.denodeify.apply(void 0,args)};Q.nbind=function(callback,thisp){var baseArgs=array_slice(arguments,2);return function(){var nodeArgs=baseArgs.concat(array_slice(arguments));var deferred=defer();nodeArgs.push(deferred.makeNodeResolver());function bound(){return callback.apply(thisp,arguments)}Q(bound).fapply(nodeArgs).fail(deferred.reject);return deferred.promise}};Promise.prototype.nbind=function(){var args=array_slice(arguments,0);args.unshift(this);return Q.nbind.apply(void 0,args)};Q.nmapply=Q.npost=function(object,name,args){return Q(object).npost(name,args)};Promise.prototype.nmapply=Promise.prototype.npost=function(name,args){var nodeArgs=array_slice(args||[]);var deferred=defer();nodeArgs.push(deferred.makeNodeResolver());this.dispatch("post",[name,nodeArgs]).fail(deferred.reject);return deferred.promise};Q.nsend=Q.nmcall=Q.ninvoke=function(object,name){var nodeArgs=array_slice(arguments,2);var deferred=defer();nodeArgs.push(deferred.makeNodeResolver());Q(object).dispatch("post",[name,nodeArgs]).fail(deferred.reject);return deferred.promise};Promise.prototype.nsend=Promise.prototype.nmcall=Promise.prototype.ninvoke=function(name){var nodeArgs=array_slice(arguments,1);var deferred=defer();nodeArgs.push(deferred.makeNodeResolver());this.dispatch("post",[name,nodeArgs]).fail(deferred.reject);return deferred.promise};Q.nodeify=nodeify;function nodeify(object,nodeback){return Q(object).nodeify(nodeback)}Promise.prototype.nodeify=function(nodeback){if(nodeback){this.then(function(value){Q.nextTick(function(){nodeback(null,value)})},function(error){Q.nextTick(function(){nodeback(error)})})}else{return this}};Q.noConflict=function(){throw new Error("Q.noConflict only works when Q is used as a global")};var qEndingLine=captureLine();return Q})}).call(this,require("_process"))},{_process:1}],5:[function(require,module,exports){var reductio_parameters=require("./parameters.js");_assign=function assign(target){if(target==null){throw new TypeError("Cannot convert undefined or null to object")}var output=Object(target);for(var index=1;index<arguments.length;++index){var source=arguments[index];if(source!=null){for(var nextKey in source){if(source.hasOwnProperty(nextKey)){output[nextKey]=source[nextKey]}}}}return output};function accessor_build(obj,p){function accessorify(v){if(typeof v==="string"){var tempValue=v;var func=function(d){return d[tempValue]};return func}else{return v}}function accessorifyNumeric(v){if(typeof v==="string"){var tempValue=v;var func=function(d){return+d[tempValue]};return func}else{return v}}obj.fromObject=function(value){if(!arguments.length)return p;_assign(p,value);return obj};obj.toObject=function(){return p};obj.count=function(value){if(!arguments.length)return p.count;p.count=value;return obj};obj.sum=function(value){if(!arguments.length)return p.sum;value=accessorifyNumeric(value);p.sum=value;return obj};obj.avg=function(value){if(!arguments.length)return p.avg;value=accessorifyNumeric(value);if(typeof value==="function"){if(p.sum)console.warn("SUM aggregation is being overwritten by AVG aggregation");p.sum=value;p.avg=true;p.count=true}else{p.avg=value}return obj};obj.exception=function(value){if(!arguments.length)return p.exceptionAccessor;value=accessorify(value);p.exceptionAccessor=value;return obj};obj.filter=function(value){if(!arguments.length)return p.filter;p.filter=value;return obj};obj.valueList=function(value){if(!arguments.length)return p.valueList;value=accessorify(value);p.valueList=value;return obj};obj.median=function(value){if(!arguments.length)return p.median;value=accessorifyNumeric(value);if(typeof value==="function"){if(p.valueList)console.warn("VALUELIST accessor is being overwritten by median aggregation");p.valueList=value}p.median=value;return obj};obj.min=function(value){if(!arguments.length)return p.min;value=accessorifyNumeric(value);if(typeof value==="function"){if(p.valueList)console.warn("VALUELIST accessor is being overwritten by median aggregation");p.valueList=value}p.min=value;return obj};obj.max=function(value){if(!arguments.length)return p.max;value=accessorifyNumeric(value);if(typeof value==="function"){if(p.valueList)console.warn("VALUELIST accessor is being overwritten by median aggregation");p.valueList=value}p.max=value;return obj};obj.exceptionCount=function(value){if(!arguments.length)return p.exceptionCount;value=accessorify(value);if(typeof value==="function"){if(p.sum)console.warn("EXCEPTION accessor is being overwritten by exception count aggregation");p.exceptionAccessor=value;p.exceptionCount=true}else{p.exceptionCount=value}return obj};obj.exceptionSum=function(value){if(!arguments.length)return p.exceptionSum;value=accessorifyNumeric(value);p.exceptionSum=value;return obj};obj.histogramValue=function(value){if(!arguments.length)return p.histogramValue;value=accessorifyNumeric(value);p.histogramValue=value;return obj};obj.histogramBins=function(value){if(!arguments.length)return p.histogramThresholds;p.histogramThresholds=value;return obj};obj.std=function(value){if(!arguments.length)return p.std;value=accessorifyNumeric(value);if(typeof value==="function"){p.sumOfSquares=value;p.sum=value;p.count=true;p.std=true}else{p.std=value}return obj};obj.sumOfSq=function(value){if(!arguments.length)return p.sumOfSquares;value=accessorifyNumeric(value);p.sumOfSquares=value;return obj};obj.value=function(value,accessor){if(!arguments.length||typeof value!=="string"){console.error("'value' requires a string argument.")}else{if(!p.values)p.values={};p.values[value]={};p.values[value].parameters=reductio_parameters();accessor_build(p.values[value],p.values[value].parameters);if(accessor)p.values[value].accessor=accessor;return p.values[value]}};obj.nest=function(keyAccessorArray){if(!arguments.length)return p.nestKeys;keyAccessorArray.map(accessorify);p.nestKeys=keyAccessorArray;return obj};obj.alias=function(propAccessorObj){if(!arguments.length)return p.aliasKeys;p.aliasKeys=propAccessorObj;return obj};obj.aliasProp=function(propAccessorObj){if(!arguments.length)return p.aliasPropKeys;p.aliasPropKeys=propAccessorObj;return obj};obj.groupAll=function(groupTest){if(!arguments.length)return p.groupAll;p.groupAll=groupTest;return obj};obj.dataList=function(value){if(!arguments.length)return p.dataList;p.dataList=value;return obj}}var reductio_accessors={build:accessor_build};module.exports=reductio_accessors},{"./parameters.js":21}],6:[function(require,module,exports){var reductio_alias={initial:function(prior,path,obj){return function(p){if(prior)p=prior(p);function buildAliasFunction(key){return function(){return obj[key](path(p))}}for(var prop in obj){path(p)[prop]=buildAliasFunction(prop)}return p}}};module.exports=reductio_alias},{}],7:[function(require,module,exports){var reductio_alias_prop={add:function(obj,prior,path){return function(p,v,nf){if(prior)prior(p,v,nf);for(var prop in obj){path(p)[prop]=obj[prop](path(p),v)}return p}}};module.exports=reductio_alias_prop},{}],8:[function(require,module,exports){var reductio_avg={add:function(a,prior,path){return function(p,v,nf){if(prior)prior(p,v,nf);if(path(p).count>0){path(p).avg=path(p).sum/path(p).count}else{path(p).avg=0}return p}},remove:function(a,prior,path){return function(p,v,nf){if(prior)prior(p,v,nf);if(path(p).count>0){path(p).avg=path(p).sum/path(p).count}else{path(p).avg=0}return p}},initial:function(prior,path){return function(p){p=prior(p);path(p).avg=0;return p}}};module.exports=reductio_avg},{}],9:[function(require,module,exports){var reductio_filter=require("./filter.js");var reductio_count=require("./count.js");var reductio_sum=require("./sum.js");var reductio_avg=require("./avg.js");var reductio_median=require("./median.js");var reductio_min=require("./min.js");var reductio_max=require("./max.js");var reductio_value_count=require("./value-count.js");var reductio_value_list=require("./value-list.js");var reductio_exception_count=require("./exception-count.js");var reductio_exception_sum=require("./exception-sum.js");var reductio_histogram=require("./histogram.js");var reductio_sum_of_sq=require("./sum-of-squares.js");var reductio_std=require("./std.js");var reductio_nest=require("./nest.js");var reductio_alias=require("./alias.js");var reductio_alias_prop=require("./aliasProp.js");var reductio_data_list=require("./data-list.js");function build_function(p,f,path){if(!path)path=function(d){return d};var origF={reduceAdd:f.reduceAdd,reduceRemove:f.reduceRemove,reduceInitial:f.reduceInitial};if(p.count||p.std){f.reduceAdd=reductio_count.add(f.reduceAdd,path);f.reduceRemove=reductio_count.remove(f.reduceRemove,path);f.reduceInitial=reductio_count.initial(f.reduceInitial,path)}if(p.sum){f.reduceAdd=reductio_sum.add(p.sum,f.reduceAdd,path);f.reduceRemove=reductio_sum.remove(p.sum,f.reduceRemove,path);f.reduceInitial=reductio_sum.initial(f.reduceInitial,path)}if(p.avg){if(!p.count||!p.sum){console.error("You must set .count(true) and define a .sum(accessor) to use .avg(true).")}else{f.reduceAdd=reductio_avg.add(p.sum,f.reduceAdd,path);f.reduceRemove=reductio_avg.remove(p.sum,f.reduceRemove,path);f.reduceInitial=reductio_avg.initial(f.reduceInitial,path)}}if(p.exceptionCount){if(!p.exceptionAccessor){console.error("You must define an .exception(accessor) to use .exceptionCount(true).")}else{f.reduceAdd=reductio_exception_count.add(p.exceptionAccessor,f.reduceAdd,path);f.reduceRemove=reductio_exception_count.remove(p.exceptionAccessor,f.reduceRemove,path);f.reduceInitial=reductio_exception_count.initial(f.reduceInitial,path)}}if(p.exceptionSum){if(!p.exceptionAccessor){console.error("You must define an .exception(accessor) to use .exceptionSum(accessor).")}else{f.reduceAdd=reductio_exception_sum.add(p.exceptionAccessor,p.exceptionSum,f.reduceAdd,path);f.reduceRemove=reductio_exception_sum.remove(p.exceptionAccessor,p.exceptionSum,f.reduceRemove,path);f.reduceInitial=reductio_exception_sum.initial(f.reduceInitial,path)}}if(p.valueList||p.median||p.min||p.max){f.reduceAdd=reductio_value_list.add(p.valueList,f.reduceAdd,path);f.reduceRemove=reductio_value_list.remove(p.valueList,f.reduceRemove,path);f.reduceInitial=reductio_value_list.initial(f.reduceInitial,path)}if(p.dataList){f.reduceAdd=reductio_data_list.add(p.dataList,f.reduceAdd,path);f.reduceRemove=reductio_data_list.remove(p.dataList,f.reduceRemove,path);f.reduceInitial=reductio_data_list.initial(f.reduceInitial,path)}if(p.median){f.reduceAdd=reductio_median.add(f.reduceAdd,path);f.reduceRemove=reductio_median.remove(f.reduceRemove,path);f.reduceInitial=reductio_median.initial(f.reduceInitial,path)}if(p.min){f.reduceAdd=reductio_min.add(f.reduceAdd,path);f.reduceRemove=reductio_min.remove(f.reduceRemove,path);f.reduceInitial=reductio_min.initial(f.reduceInitial,path)}if(p.max){f.reduceAdd=reductio_max.add(f.reduceAdd,path);f.reduceRemove=reductio_max.remove(f.reduceRemove,path);f.reduceInitial=reductio_max.initial(f.reduceInitial,path)}if(p.exceptionAccessor){f.reduceAdd=reductio_value_count.add(p.exceptionAccessor,f.reduceAdd,path);f.reduceRemove=reductio_value_count.remove(p.exceptionAccessor,f.reduceRemove,path);f.reduceInitial=reductio_value_count.initial(f.reduceInitial,path)}if(p.histogramValue&&p.histogramThresholds){f.reduceAdd=reductio_histogram.add(p.histogramValue,f.reduceAdd,path);f.reduceRemove=reductio_histogram.remove(p.histogramValue,f.reduceRemove,path);f.reduceInitial=reductio_histogram.initial(p.histogramThresholds,f.reduceInitial,path)}if(p.sumOfSquares){f.reduceAdd=reductio_sum_of_sq.add(p.sumOfSquares,f.reduceAdd,path);f.reduceRemove=reductio_sum_of_sq.remove(p.sumOfSquares,f.reduceRemove,path);f.reduceInitial=reductio_sum_of_sq.initial(f.reduceInitial,path);
}if(p.std){if(!p.sumOfSquares||!p.sum){console.error("You must set .sumOfSq(accessor) and define a .sum(accessor) to use .std(true). Or use .std(accessor).")}else{f.reduceAdd=reductio_std.add(f.reduceAdd,path);f.reduceRemove=reductio_std.remove(f.reduceRemove,path);f.reduceInitial=reductio_std.initial(f.reduceInitial,path)}}if(p.nestKeys){f.reduceAdd=reductio_nest.add(p.nestKeys,f.reduceAdd,path);f.reduceRemove=reductio_nest.remove(p.nestKeys,f.reduceRemove,path);f.reduceInitial=reductio_nest.initial(f.reduceInitial,path)}if(p.aliasKeys){f.reduceInitial=reductio_alias.initial(f.reduceInitial,path,p.aliasKeys)}if(p.aliasPropKeys){f.reduceAdd=reductio_alias_prop.add(p.aliasPropKeys,f.reduceAdd,path);f.reduceRemove=reductio_alias_prop.add(p.aliasPropKeys,f.reduceRemove,path)}if(p.filter){f.reduceAdd=reductio_filter.add(p.filter,f.reduceAdd,origF.reduceAdd,path);f.reduceRemove=reductio_filter.remove(p.filter,f.reduceRemove,origF.reduceRemove,path)}if(p.values){Object.getOwnPropertyNames(p.values).forEach(function(n){var setupPath=function(prior){return function(p){p=prior(p);path(p)[n]={};return p}};f.reduceInitial=setupPath(f.reduceInitial);build_function(p.values[n].parameters,f,function(p){return p[n]})})}}var reductio_build={build:build_function};module.exports=reductio_build},{"./alias.js":6,"./aliasProp.js":7,"./avg.js":8,"./count.js":11,"./data-list.js":12,"./exception-count.js":13,"./exception-sum.js":14,"./filter.js":15,"./histogram.js":16,"./max.js":17,"./median.js":18,"./min.js":19,"./nest.js":20,"./std.js":26,"./sum-of-squares.js":27,"./sum.js":28,"./value-count.js":29,"./value-list.js":30}],10:[function(require,module,exports){var pluck=function(n){return function(d){return d[n]}};_grouper=function(path,prior){if(!path)path=function(d){return d};return function(p,v){if(prior)prior(p,v);var x=path(p),y=path(v);if(typeof y.count!=="undefined")x.count+=y.count;if(typeof y.sum!=="undefined")x.sum+=y.sum;if(typeof y.avg!=="undefined")x.avg=x.sum/x.count;return p}};reductio_cap=function(prior,f,p){var obj=f.reduceInitial();var values=p.values?Object.keys(p.values):[];var _othersGrouper=_grouper();if(values.length){for(var i=0;i<values.length;++i){_othersGrouper=_grouper(pluck(values[i]),_othersGrouper)}}return function(cap,othersName){if(!arguments.length)return prior();if(cap===Infinity||!cap)return prior();var all=prior();var slice_idx=cap-1;if(all.length<=cap)return all;var data=all.slice(0,slice_idx);var others={key:othersName||"Others"};others.value=f.reduceInitial();for(var i=slice_idx;i<all.length;++i){_othersGrouper(others.value,all[i].value)}data.push(others);return data}};module.exports=reductio_cap},{}],11:[function(require,module,exports){var reductio_count={add:function(prior,path){return function(p,v,nf){if(prior)prior(p,v,nf);path(p).count++;return p}},remove:function(prior,path){return function(p,v,nf){if(prior)prior(p,v,nf);path(p).count--;return p}},initial:function(prior,path){return function(p){if(prior)p=prior(p);path(p).count=0;return p}}};module.exports=reductio_count},{}],12:[function(require,module,exports){var reductio_data_list={add:function(a,prior,path){return function(p,v,nf){if(prior)prior(p,v,nf);path(p).dataList.push(v);return p}},remove:function(a,prior,path){return function(p,v,nf){if(prior)prior(p,v,nf);path(p).dataList.splice(path(p).dataList.indexOf(v),1);return p}},initial:function(prior,path){return function(p){if(prior)p=prior(p);path(p).dataList=[];return p}}};module.exports=reductio_data_list},{}],13:[function(require,module,exports){var reductio_exception_count={add:function(a,prior,path){var i,curr;return function(p,v,nf){if(prior)prior(p,v,nf);i=path(p).bisect(path(p).values,a(v),0,path(p).values.length);curr=path(p).values[i];if(!curr||curr[0]!==a(v)||curr[1]===0){path(p).exceptionCount++}return p}},remove:function(a,prior,path){var i,curr;return function(p,v,nf){if(prior)prior(p,v,nf);i=path(p).bisect(path(p).values,a(v),0,path(p).values.length);curr=path(p).values[i];if(curr&&curr[0]===a(v)&&curr[1]===1){path(p).exceptionCount--}return p}},initial:function(prior,path){return function(p){p=prior(p);path(p).exceptionCount=0;return p}}};module.exports=reductio_exception_count},{}],14:[function(require,module,exports){var reductio_exception_sum={add:function(a,sum,prior,path){var i,curr;return function(p,v,nf){if(prior)prior(p,v,nf);i=path(p).bisect(path(p).values,a(v),0,path(p).values.length);curr=path(p).values[i];if(!curr||curr[0]!==a(v)||curr[1]===0){path(p).exceptionSum=path(p).exceptionSum+sum(v)}return p}},remove:function(a,sum,prior,path){var i,curr;return function(p,v,nf){if(prior)prior(p,v,nf);i=path(p).bisect(path(p).values,a(v),0,path(p).values.length);curr=path(p).values[i];if(curr&&curr[0]===a(v)&&curr[1]===1){path(p).exceptionSum=path(p).exceptionSum-sum(v)}return p}},initial:function(prior,path){return function(p){p=prior(p);path(p).exceptionSum=0;return p}}};module.exports=reductio_exception_sum},{}],15:[function(require,module,exports){var reductio_filter={add:function(filter,prior,skip){return function(p,v,nf){if(filter(v,nf)){if(prior)prior(p,v,nf)}else{if(skip)skip(p,v,nf)}return p}},remove:function(filter,prior,skip){return function(p,v,nf){if(filter(v,nf)){if(prior)prior(p,v,nf)}else{if(skip)skip(p,v,nf)}return p}}};module.exports=reductio_filter},{}],16:[function(require,module,exports){var crossfilter=require("crossfilter");var reductio_histogram={add:function(a,prior,path){var bisect=crossfilter.bisect.by(function(d){return d}).left;var bisectHisto=crossfilter.bisect.by(function(d){return d.x}).right;var curr;return function(p,v,nf){if(prior)prior(p,v,nf);curr=path(p).histogram[bisectHisto(path(p).histogram,a(v),0,path(p).histogram.length)-1];curr.y++;curr.splice(bisect(curr,a(v),0,curr.length),0,a(v));return p}},remove:function(a,prior,path){var bisect=crossfilter.bisect.by(function(d){return d}).left;var bisectHisto=crossfilter.bisect.by(function(d){return d.x}).right;var curr;return function(p,v,nf){if(prior)prior(p,v,nf);curr=path(p).histogram[bisectHisto(path(p).histogram,a(v),0,path(p).histogram.length)-1];curr.y--;curr.splice(bisect(curr,a(v),0,curr.length),1);return p}},initial:function(thresholds,prior,path){return function(p){p=prior(p);path(p).histogram=[];var arr=[];for(var i=1;i<thresholds.length;i++){arr=[];arr.x=thresholds[i-1];arr.dx=thresholds[i]-thresholds[i-1];arr.y=0;path(p).histogram.push(arr)}return p}}};module.exports=reductio_histogram},{crossfilter:3}],17:[function(require,module,exports){var reductio_max={add:function(prior,path){return function(p,v,nf){if(prior)prior(p,v,nf);path(p).max=path(p).valueList[path(p).valueList.length-1];return p}},remove:function(prior,path){return function(p,v,nf){if(prior)prior(p,v,nf);if(path(p).valueList.length===0){path(p).max=undefined;return p}path(p).max=path(p).valueList[path(p).valueList.length-1];return p}},initial:function(prior,path){return function(p){p=prior(p);path(p).max=undefined;return p}}};module.exports=reductio_max},{}],18:[function(require,module,exports){var reductio_median={add:function(prior,path){var half;return function(p,v,nf){if(prior)prior(p,v,nf);half=Math.floor(path(p).valueList.length/2);if(path(p).valueList.length%2){path(p).median=path(p).valueList[half]}else{path(p).median=(path(p).valueList[half-1]+path(p).valueList[half])/2}return p}},remove:function(prior,path){var half;return function(p,v,nf){if(prior)prior(p,v,nf);half=Math.floor(path(p).valueList.length/2);if(path(p).valueList.length===0){path(p).median=undefined;return p}if(path(p).valueList.length===1||path(p).valueList.length%2){path(p).median=path(p).valueList[half]}else{path(p).median=(path(p).valueList[half-1]+path(p).valueList[half])/2}return p}},initial:function(prior,path){return function(p){p=prior(p);path(p).median=undefined;return p}}};module.exports=reductio_median},{}],19:[function(require,module,exports){var reductio_min={add:function(prior,path){return function(p,v,nf){if(prior)prior(p,v,nf);path(p).min=path(p).valueList[0];return p}},remove:function(prior,path){return function(p,v,nf){if(prior)prior(p,v,nf);if(path(p).valueList.length===0){path(p).min=undefined;return p}path(p).min=path(p).valueList[0];return p}},initial:function(prior,path){return function(p){p=prior(p);path(p).min=undefined;return p}}};module.exports=reductio_min},{}],20:[function(require,module,exports){var crossfilter=require("crossfilter");var reductio_nest={add:function(keyAccessors,prior,path){var i;var arrRef;var newRef;return function(p,v,nf){if(prior)prior(p,v,nf);arrRef=path(p).nest;keyAccessors.forEach(function(a){newRef=arrRef.filter(function(d){return d.key===a(v)})[0];if(newRef){arrRef=newRef.values}else{newRef=[];arrRef.push({key:a(v),values:newRef});arrRef=newRef}});arrRef.push(v);return p}},remove:function(keyAccessors,prior,path){var arrRef;var nextRef;return function(p,v,nf){if(prior)prior(p,v,nf);arrRef=path(p).nest;keyAccessors.forEach(function(a){arrRef=arrRef.filter(function(d){return d.key===a(v)})[0].values});arrRef.splice(arrRef.indexOf(v),1);return p}},initial:function(prior,path){return function(p){p=prior(p);path(p).nest=[];return p}}};module.exports=reductio_nest},{crossfilter:3}],21:[function(require,module,exports){var reductio_parameters=function(){return{order:false,avg:false,count:false,sum:false,exceptionAccessor:false,exceptionCount:false,exceptionSum:false,filter:false,valueList:false,median:false,histogramValue:false,min:false,max:false,histogramThresholds:false,std:false,sumOfSquares:false,values:false,nestKeys:false,aliasKeys:false,aliasPropKeys:false,groupAll:false,dataList:false}};module.exports=reductio_parameters},{}],22:[function(require,module,exports){function postProcess(reductio){return function(group,p,f){group.post=function(){var postprocess=function(){return postprocess.all()};postprocess.all=function(){return group.all()};var postprocessors=reductio.postprocessors;Object.keys(postprocessors).forEach(function(name){postprocess[name]=function(){var _all=postprocess.all;var args=[].slice.call(arguments);postprocess.all=function(){return postprocessors[name](_all,f,p).apply(null,args)};return postprocess}});return postprocess}}}module.exports=postProcess},{}],23:[function(require,module,exports){module.exports=function(reductio){reductio.postprocessors={};reductio.registerPostProcessor=function(name,func){reductio.postprocessors[name]=func};reductio.registerPostProcessor("cap",require("./cap"));reductio.registerPostProcessor("sortBy",require("./sortBy"))}},{"./cap":10,"./sortBy":25}],24:[function(require,module,exports){var reductio_build=require("./build.js");var reductio_accessors=require("./accessors.js");var reductio_parameters=require("./parameters.js");var reductio_postprocess=require("./postprocess");var crossfilter=require("crossfilter");function reductio(){var parameters=reductio_parameters();var funcs={};function my(group){funcs={reduceAdd:function(p){return p},reduceRemove:function(p){return p},reduceInitial:function(){return{}}};reductio_build.build(parameters,funcs);if(parameters.groupAll){if(group.top){console.warn("'groupAll' is defined but attempting to run on a standard dimension.group(). Must run on dimension.groupAll().")}else{var bisect=crossfilter.bisect.by(function(d){return d.key}).left;var i,j;var keys;var keysLength;var k;group.reduce(function(p,v,nf){keys=parameters.groupAll(v);keysLength=keys.length;for(j=0;j<keysLength;j++){k=keys[j];i=bisect(p,k,0,p.length);if(!p[i]||p[i].key!==k){p.splice(i,0,{key:k,value:funcs.reduceInitial()})}funcs.reduceAdd(p[i].value,v,nf)}return p},function(p,v,nf){keys=parameters.groupAll(v);keysLength=keys.length;for(j=0;j<keysLength;j++){i=bisect(p,keys[j],0,p.length);funcs.reduceRemove(p[i].value,v,nf)}return p},function(){return[]});if(!group.all){group.all=function(){return this.value()}}}}else{group.reduce(funcs.reduceAdd,funcs.reduceRemove,funcs.reduceInitial)}reductio_postprocess(group,parameters,funcs);return group}reductio_accessors.build(my,parameters);return my}require("./postprocessors")(reductio);reductio_postprocess=reductio_postprocess(reductio);module.exports=reductio},{"./accessors.js":5,"./build.js":9,"./parameters.js":21,"./postprocess":22,"./postprocessors":23,crossfilter:3}],25:[function(require,module,exports){var pluck_n=function(n){if(typeof n==="function"){return n}if(~n.indexOf(".")){var split=n.split(".");return function(d){return split.reduce(function(p,v){return p[v]},d)}}return function(d){return d[n]}};function ascending(a,b){return a<b?-1:a>b?1:a>=b?0:NaN}var comparer=function(accessor,ordering){return function(a,b){return ordering(accessor(a),accessor(b))}};var type={}.toString;module.exports=function(prior){return function(value,order){if(arguments.length===1){order=ascending}return prior().sort(comparer(pluck_n(value),order))}}},{}],26:[function(require,module,exports){var reductio_std={add:function(prior,path){return function(p,v,nf){if(prior)prior(p,v,nf);if(path(p).count>0){path(p).std=0;var n=path(p).sumOfSq-path(p).sum*path(p).sum/path(p).count;if(n>0)path(p).std=Math.sqrt(n/(path(p).count-1))}else{path(p).std=0}return p}},remove:function(prior,path){return function(p,v,nf){if(prior)prior(p,v,nf);if(path(p).count>0){path(p).std=0;var n=path(p).sumOfSq-path(p).sum*path(p).sum/path(p).count;if(n>0)path(p).std=Math.sqrt(n/(path(p).count-1))}else{path(p).std=0}return p}},initial:function(prior,path){return function(p){p=prior(p);path(p).std=0;return p}}};module.exports=reductio_std},{}],27:[function(require,module,exports){var reductio_sum_of_sq={add:function(a,prior,path){return function(p,v,nf){if(prior)prior(p,v,nf);path(p).sumOfSq=path(p).sumOfSq+a(v)*a(v);return p}},remove:function(a,prior,path){return function(p,v,nf){if(prior)prior(p,v,nf);path(p).sumOfSq=path(p).sumOfSq-a(v)*a(v);return p}},initial:function(prior,path){return function(p){p=prior(p);path(p).sumOfSq=0;return p}}};module.exports=reductio_sum_of_sq},{}],28:[function(require,module,exports){var reductio_sum={add:function(a,prior,path){return function(p,v,nf){if(prior)prior(p,v,nf);path(p).sum=path(p).sum+a(v);return p}},remove:function(a,prior,path){return function(p,v,nf){if(prior)prior(p,v,nf);path(p).sum=path(p).sum-a(v);return p}},initial:function(prior,path){return function(p){p=prior(p);path(p).sum=0;return p}}};module.exports=reductio_sum},{}],29:[function(require,module,exports){var crossfilter=require("crossfilter");var reductio_value_count={add:function(a,prior,path){var i,curr;return function(p,v,nf){if(prior)prior(p,v,nf);i=path(p).bisect(path(p).values,a(v),0,path(p).values.length);curr=path(p).values[i];if(curr&&curr[0]===a(v)){curr[1]++}else{path(p).values.splice(i,0,[a(v),1])}return p}},remove:function(a,prior,path){var i;return function(p,v,nf){if(prior)prior(p,v,nf);i=path(p).bisect(path(p).values,a(v),0,path(p).values.length);path(p).values[i][1]--;return p}},initial:function(prior,path){return function(p){p=prior(p);path(p).values=[];path(p).bisect=crossfilter.bisect.by(function(d){return d[0]}).left;return p}}};module.exports=reductio_value_count},{crossfilter:3}],30:[function(require,module,exports){var crossfilter=require("crossfilter");var reductio_value_list={add:function(a,prior,path){var i;var bisect=crossfilter.bisect.by(function(d){return d}).left;return function(p,v,nf){if(prior)prior(p,v,nf);i=bisect(path(p).valueList,a(v),0,path(p).valueList.length);path(p).valueList.splice(i,0,a(v));return p}},remove:function(a,prior,path){var i;var bisect=crossfilter.bisect.by(function(d){return d}).left;return function(p,v,nf){if(prior)prior(p,v,nf);i=bisect(path(p).valueList,a(v),0,path(p).valueList.length);path(p).valueList.splice(i,1);return p}},initial:function(prior,path){return function(p){p=prior(p);path(p).valueList=[];return p}}};module.exports=reductio_value_list},{crossfilter:3}],31:[function(require,module,exports){"use strict";var _=require("./lodash");var aggregators={$sum:$sum,$avg:$avg,$max:$max,$min:$min,$count:$count,$first:$first,$last:$last,$get:$get,$nth:$get,$nthLast:$nthLast,$nthPct:$nthPct,$map:$map};module.exports={makeValueAccessor:makeValueAccessor,aggregators:aggregators,extractKeyValOrArray:extractKeyValOrArray,parseAggregatorParams:parseAggregatorParams};function makeValueAccessor(obj){if(typeof obj==="string"){if(isStringSyntax(obj)){obj=convertAggregatorString(obj)}else{return obj}}if(typeof obj==="number"){return obj}if(_.isObject(obj)){return make()}function make(){var stack=makeSubAggregationFunction(obj);return function topStack(d){return stack(d)}}}function makeSubAggregationFunction(obj){obj=_.isObject(obj)?extractKeyValOrArray(obj):obj;if(_.isString(obj)){if(isStringSyntax(obj)){return makeSubAggregationFunction(convertAggregatorString(obj))}else{return function identity(d){return d[obj]}}}if(_.isArray(obj)){var subStack=_.map(obj,makeSubAggregationFunction);return function getSubStack(d){return subStack.map(function(s){return s(d)})}}if(obj.key){if(aggregators[obj.key]){var subAggregationFunction=makeSubAggregationFunction(obj.value);return function getAggregation(d){return aggregators[obj.key](subAggregationFunction(d))}}else{console.error("Could not find aggregration method",obj)}}return[]}function extractKeyValOrArray(obj){var keyVal;var values=[];for(var key in obj){if(obj.hasOwnProperty(key)){keyVal={key:key,value:obj[key]};var subObj={};subObj[key]=obj[key];values.push(subObj)}}return values.length>1?values:keyVal}function isStringSyntax(str){return["$","("].indexOf(str.charAt(0))>-1}function parseAggregatorParams(keyString){var params=[];var p1=keyString.indexOf("(");var p2=keyString.indexOf(")");var key=p1>-1?keyString.substring(0,p1):keyString;if(!aggregators[key]){return false}if(p1>-1&&p2>-1&&p2>p1){params=keyString.substring(p1+1,p2).split(",")}return{aggregator:aggregators[key],params:params}}function convertAggregatorString(keyString){var obj={};var outerParens=/\((.+)\)/g;var innerParens=/\(([^\(\)]+)\)/g;var hasComma=/(?:\([^\(\)]*\))|(,)/g;return JSON.parse("{"+unwrapParensAndCommas(keyString)+"}");function unwrapParensAndCommas(str){str=str.replace(" ","");return'"'+str.replace(outerParens,function(p,pr){if(hasComma.test(pr)){if(pr.charAt(0)==="$"){return'":{"'+pr.replace(hasComma,function(p2,pr2){if(p2===","){return',"'}return unwrapParensAndCommas(p2).trim()})+"}"}return':["'+pr.replace(hasComma,function(p2,pr2){return'","'})+'"]'}})}}function $sum(children){return children.reduce(function(a,b){return a+b},0)}function $avg(children){return children.reduce(function(a,b){return a+b},0)/children.length}function $max(children){return Math.max.apply(null,children)}function $min(children){return Math.min.apply(null,children)}function $count(children){return children.length}function $med(children){children.sort(function(a,b){return a-b});var half=Math.floor(children.length/2);if(children.length%2)return children[half];else return(children[half-1]+children[half])/2}function $first(children){return children[0]}function $last(children){return children[children.length-1]}function $get(children,n){return children[n]}function $nthLast(children,n){return children[children.length-n]}function $nthPct(children,n){return children[Math.round(children.length*(n/100))]}function $map(children,n){return children.map(function(d){return d[n]})}},{"./lodash":39}],32:[function(require,module,exports){"use strict";var Promise=require("q");var _=require("./lodash");module.exports=function(service){return function clear(def){if(def){def=_.isArray(def)?def:[def]}if(!def){return Promise.all(_.map(service.columns,disposeColumn)).then(function(){service.columns=[];return service})}return Promise.all(_.map(def,function(d){if(_.isObject(d)){d=d.key}var column=_.remove(service.columns,function(c){if(_.isArray(d)){return!_.xor(c.key,d).length}if(c.key===d){if(c.dynamicReference){return false}return true}})[0];if(!column){return}disposeColumn(column)})).then(function(){return service});function disposeColumn(column){var disposalActions=[];if(column.removeListeners){disposalActions=_.map(column.removeListeners,function(listener){return Promise.resolve(listener())})}var filterKey=column.complex?JSON.stringify(column.key):column.key;delete service.filters[filterKey];if(column.dimension){disposalActions.push(Promise.resolve(column.dimension.dispose()))}return Promise.all(disposalActions)}}}},{"./lodash":39,q:4}],33:[function(require,module,exports){"use strict";var Promise=require("q");var _=require("./lodash");module.exports=function(service){var dimension=require("./dimension")(service);var columnFunc=column;columnFunc.find=findColumn;return columnFunc;function column(def){if(_.isUndefined(def)){def=true}if(!_.isArray(def)){def=[def]}return Promise.all(_.map(def,makeColumn)).then(function(res){return service})}function findColumn(d){return _.find(service.columns,function(c){if(_.isArray(d)){return!_.xor(c.key,d).length}return c.key===d})}function getType(d){if(_.isNumber(d)){return"number"}if(_.isBoolean(d)){return"bool"}if(_.isArray(d)){return"array"}if(_.isObject(d)){return"object"}return"string"}function makeColumn(d){var column=_.isObject(d)?d:{key:d};var existing=findColumn(column.key);if(existing){existing=existing;existing.temporary=false;if(existing.dynamicReference){existing.dynamicReference=false}return existing.promise.then(function(){return service})}column.queries=[];service.columns.push(column);column.promise=Promise.try(function(){return Promise.resolve(service.cf.all())}).then(function(all){var sample;if(_.isArray(column.key)){column.complex=true;sample=_.values(_.pick(all[0],column.key));if(sample.length!==column.key.length){throw new Error("Column key does not exist in data!",column.key)}}else{sample=all[0][column.key]}if(!column.complex&&column.key!==true&&typeof sample==="undefined"){throw new Error("Column key does not exist in data!",column.key)}column.type=column.key===true?"all":column.complex?"complex":column.array?"array":getType(sample);return dimension.make(column.key,column.type)}).then(function(dim){column.dimension=dim;column.filterCount=0;var stopListeningForData=service.onDataChange(buildColumnKeys);column.removeListeners=[stopListeningForData];return buildColumnKeys();function buildColumnKeys(changes){if(column.key===true){return Promise.resolve()}var accessor=dimension.makeAccessor(column.key);column.values=column.values||[];return Promise.try(function(){if(changes&&changes.added){return Promise.resolve(changes.added)}else{return Promise.resolve(column.dimension.bottom(Infinity))}}).then(function(rows){if(column.type==="complex"){var newValues=_.flatten(_.map(rows,accessor))}else if(column.type==="array"){var newValues=_.flatten(_.map(rows,accessor))}else{var newValues=_.map(rows,accessor)}column.values=_.uniq(column.values.concat(newValues))})}});return column.promise.then(function(){return service})}}},{"./dimension":36,"./lodash":39,q:4}],34:[function(require,module,exports){"use strict";var Promise=require("q");var crossfilter=require("crossfilter2");var _=require("./lodash");module.exports=function(service){return{build:build,generateColumns:generateColumns,add:add,remove:remove};function build(c){if(_.isArray(c)){return Promise.resolve(crossfilter(c))}if(!c||typeof c.dimension!=="function"){return Promise.reject(new Error("No Crossfilter data or instance found!"))}return Promise.resolve(c)}function generateColumns(data){if(!service.options.generatedColumns){return data}return _.map(data,function(d,i){_.forEach(service.options.generatedColumns,function(val,key){d[key]=val(d)});return d})}function add(data){data=generateColumns(data);return Promise.try(function(){return Promise.resolve(service.cf.add(data))}).then(function(){return Promise.serial(_.map(service.dataListeners,function(listener){return function(){return listener({added:data})}}))}).then(function(){return service})}function remove(){return Promise.try(function(){return Promise.resolve(service.cf.remove())}).then(function(){return service})}}},{"./lodash":39,crossfilter2:3,q:4}],35:[function(require,module,exports){"use strict";var Promise=require("q");var _=require("./lodash");module.exports=function(service){return function destroy(){return service.clear().then(function(){service.cf.dataListeners=[];service.cf.filterListeners=[];return Promise.resolve(service.cf.remove())}).then(function(){return service})}}},{"./lodash":39,q:4}],36:[function(require,module,exports){"use strict";var Promise=require("q");var _=require("./lodash");module.exports=function(service){return{make:make,makeAccessor:makeAccessor};function make(key,type){var accessor=makeAccessor(key);return Promise.resolve(service.cf.dimension(accessor,type=="array"))}function makeAccessor(key){var accessorFunction;if(_.isArray(key)){var arrayString=_.map(key,function(k){return"d['"+k+"']"});accessorFunction=new Function("d","return "+JSON.stringify(arrayString).replace(/\"/g,"")+"")}else{accessorFunction=key===true?function accessor(d,i){return i}:function(d){return d[key]}}return accessorFunction}}},{"./lodash":39,q:4}],37:[function(require,module,exports){"use strict";module.exports={$field:$field,$and:$and,$or:$or,$not:$not,$eq:$eq,$gt:$gt,$gte:$gte,$lt:$lt,$lte:$lte,$ne:$ne,$type:$type,$in:$in,$nin:$nin,$contains:$contains,$excludes:$excludes,$size:$size};function $field(d,child){return d[child]}function $and(d,child){child=child(d);for(var i=0;i<child.length;i++){if(!child[i]){return false}}return true}function $or(d,child){child=child(d);for(var i=0;i<child.length;i++){if(child[i]){return true}}return false}function $not(d,child){child=child(d);for(var i=0;i<child.length;i++){if(child[i]){return false}}return true}function $eq(d,child){return d===child()}function $gt(d,child){return d>child()}function $gte(d,child){return d>=child()}function $lt(d,child){return d<child()}function $lte(d,child){return d<=child()}function $ne(d,child){return d!==child()}function $type(d,child){return typeof d===child()}function $in(d,child){return d.indexOf(child())>-1}function $nin(d,child){return d.indexOf(child())===-1}function $contains(d,child){return child().indexOf(d)>-1}function $excludes(d,child){return child().indexOf(d)===-1}function $size(d,child){return d.length===child()}},{}],38:[function(require,module,exports){"use strict";var Promise=require("q");var _=require("./lodash");var expressions=require("./expressions");var aggregation=require("./aggregation");module.exports=function(service){return{filter:filter,filterAll:filterAll,applyFilters:applyFilters,makeFunction:makeFunction,scanForDynamicFilters:scanForDynamicFilters};function filter(column,fil,isRange,replace){var exists=service.column.find(column);return Promise.try(function(){if(!exists){return service.column({key:column,temporary:true}).then(function(){return service.column.find(column)})}return exists}).then(function(column){var newFilters=_.clone(service.filters,true);var filterKey=column.complex?JSON.stringify(column.key):column.key;newFilters[filterKey]=buildFilterObject(fil,isRange,replace);return applyFilters(newFilters)})}function filterAll(){return applyFilters({})}function buildFilterObject(fil,isRange,replace){if(_.isUndefined(fil)){return false}if(_.isFunction(fil)){return{value:fil,"function":fil,replace:true,type:"function"}}if(_.isObject(fil)){return{value:fil,"function":makeFunction(fil),replace:true,type:"function"}}if(_.isArray(fil)){return{value:fil,replace:isRange||replace,type:isRange?"range":"inclusive"}}return{value:fil,replace:replace,type:"exact"}}function applyFilters(newFilters){var ds=_.map(newFilters,function(fil,i){var existing=service.filters[i];if(fil.replace&&existing&&_.isEqual(fil,existing)){return Promise.resolve()}var column;if(i.charAt(0)==="["){column=service.column.find(JSON.parse(i))}else{column=service.column.find(i)}if(fil&&existing&&!fil.replace){newFilters[i]=fil=toggleFilters(fil,existing)}if(!fil){return Promise.resolve(column.dimension.filterAll())}if(fil.type==="exact"){return Promise.resolve(column.dimension.filterExact(fil.value))}if(fil.type==="range"){return Promise.resolve(column.dimension.filterRange(fil.value))}if(fil.type==="inclusive"){return Promise.resolve(column.dimension.filterFunction(function(d){return fil.value.indexOf(d)>-1}))}if(fil.type==="function"){return Promise.resolve(column.dimension.filterFunction(fil.function))}return Promise.resolve(column.dimension.filterAll())});return Promise.all(ds).then(function(){service.filters=newFilters;var tryRemoval=[];_.forEach(service.filters,function(val,key){if(!val){tryRemoval.push({key:key,val:val});delete service.filters[key]}});return Promise.all(_.map(tryRemoval,function(v){var column=service.column.find(v.key.charAt(0)==="["?JSON.parse(v.key):v.key);if(column.temporary&&!column.dynamicReference){return service.clear(column.key)}}))}).then(function(){return Promise.all(_.map(service.filterListeners,function(listener){return listener()}))}).then(function(){return service})}function toggleFilters(fil,existing){if(fil.type==="exact"&&existing.type==="inclusive"){fil.value=_.xor([fil.value],existing.value)}else if(fil.type==="inclusive"&&existing.type==="exact"){fil.value=_.xor(fil.value,[existing.value])}else if(fil.type==="inclusive"&&existing.type==="inclusive"){fil.value=_.xor(fil.value,existing.value)}else if(fil.type==="exact"&&existing.type==="exact"){if(fil.value===existing.value){return false}fil.value=[fil.value,existing.value]}if(!fil.value.length){fil=false}else if(fil.value.length===1){fil.type="exact";fil.value=fil.value[0]}else{fil.type="inclusive"}return fil}function scanForDynamicFilters(query){var columns=[];walk(query.filter);return columns;function walk(obj){_.forEach(obj,function(val,key){var ref=findDataReferences(val,key);if(ref)columns.push(ref);if(_.isString(val)){ref=findDataReferences(null,val);if(ref)columns.push(ref)}if(_.isObject(val)){walk(val)}})}}function findDataReferences(val,key){if(key==="$data"){return true}if(key&&key==="$column"){if(_.isString(val)){return val}console.warn('The value for filter "$column" must be a valid column key',val);return false}}function makeFunction(obj,isAggregation){var subGetters;if(_.isString(obj)){var dataRef=findDataReferences(null,obj);if(dataRef){var data=service.cf.all();return function(d){return data}}}if(_.isString(obj)||_.isNumber(obj)||_.isBoolean(obj)){return function(d){if(typeof d==="undefined"){return obj}return expressions.$eq(d,function(){return obj})}}if(_.isArray(obj)){subGetters=_.map(obj,function(o){return makeFunction(o,isAggregation)});return function(d){return subGetters.map(function(s){return s(d)})}}if(_.isObject(obj)){subGetters=_.map(obj,function(val,key){var getSub=makeFunction(val,isAggregation);var dataRef=findDataReferences(val,key);if(dataRef){var column=service.column.find(dataRef);var data=column.values;return function(d){return data}}if(expressions[key]){return function(d){return expressions[key](d,getSub)}}var aggregatorObj=aggregation.parseAggregatorParams(key);if(aggregatorObj){isAggregation=true;getSub=makeFunction(val,isAggregation);return function(d){return aggregatorObj.aggregator.apply(null,[getSub()].concat(aggregatorObj.params))}}return function(d){d=d[key];return getSub(d,getSub)}});if(isAggregation){if(subGetters.length===1){return function(d){return subGetters[0](d)}}return function(d){return _.map(subGetters,function(getSub){return getSub(d)})}}return function(d){return expressions.$and(d,function(d){return _.map(subGetters,function(getSub){return getSub(d)})})}}console.log("no expression found for ",obj);return false}}},{"./aggregation":31,"./expressions":37,"./lodash":39,q:4}],39:[function(require,module,exports){"use strict";module.exports={assign:assign,find:find,remove:remove,isArray:isArray,isObject:isObject,isBoolean:isBoolean,isString:isString,isNumber:isNumber,isFunction:isFunction,get:get,set:set,map:map,keys:keys,sortBy:sortBy,forEach:forEach,isUndefined:isUndefined,pick:pick,xor:xor,clone:clone,isEqual:isEqual,replaceArray:replaceArray,uniq:uniq,flatten:flatten,sort:sort,values:values,
recurseObject:recurseObject};function assign(out){out=out||{};for(var i=1;i<arguments.length;i++){if(!arguments[i])continue;for(var key in arguments[i]){if(arguments[i].hasOwnProperty(key))out[key]=arguments[i][key]}}return out}function find(a,b){return a.find(b)}function remove(a,b){return a.filter(function(o,i){var r=b(o);if(r){a.splice(i,1);return true}})}function isArray(a){return Array.isArray(a)}function isObject(d){return typeof d==="object"&&!isArray(d)}function isBoolean(d){return typeof d==="boolean"}function isString(d){return typeof d==="string"}function isNumber(d){return typeof d==="number"}function isFunction(a){return typeof a==="function"}function get(a,b){if(isArray(b)){b=b.join(".")}return b.replace("[",".").replace("]","").split(".").reduce(function(obj,property){return obj[property]},a)}function set(obj,prop,value){if(typeof prop==="string"){prop=prop.replace("[",".").replace("]","").split(".")}if(prop.length>1){var e=prop.shift();assign(obj[e]=Object.prototype.toString.call(obj[e])==="[object Object]"?obj[e]:{},prop,value)}else{obj[prop[0]]=value}}function map(a,b){var m;var key;if(isFunction(b)){if(isObject(a)){m=[];for(key in a){if(a.hasOwnProperty(key)){m.push(b(a[key],key,a))}}return m}return a.map(b)}if(isObject(a)){m=[];for(key in a){if(a.hasOwnProperty(key)){m.push(a[key])}}return m}return a.map(function(aa,i){return aa[b]})}function keys(obj){return Object.keys(obj)}function sortBy(a,b){if(isFunction(b)){return a.sort(function(aa,bb){if(b(aa)>b(bb)){return 1}if(b(aa)<b(bb)){return-1}return 0})}}function forEach(a,b){if(isObject(a)){for(var key in a){if(a.hasOwnProperty(key)){b(a[key],key,a)}}return}if(isArray(a)){return a.forEach(b)}}function isUndefined(a){return typeof a==="undefined"}function pick(a,b){var c={};forEach(b,function(bb){if(typeof a[bb]!=="undefined")c[bb]=a[bb]});return c}function xor(a,b){var unique=[];forEach(a,function(aa){if(b.indexOf(aa)===-1){return unique.push(aa)}});forEach(b,function(bb){if(a.indexOf(bb)===-1){return unique.push(bb)}});return unique}function clone(a){return JSON.parse(JSON.stringify(a,function replacer(key,value){if(typeof value==="function"){return value.toString()}return value}))}function isEqual(x,y){if(typeof x=="object"&&x!==null&&(typeof y=="object"&&y!==null)){if(Object.keys(x).length!=Object.keys(y).length)return false;for(var prop in x){if(y.hasOwnProperty(prop)){if(!isEqual(x[prop],y[prop]))return false}else return false}return true}else if(x!==y)return false;else return true}function replaceArray(a,b){var al=a.length;var bl=b.length;if(al>bl){a.splice(bl,al-bl)}else if(al<bl){a.push.apply(a,new Array(bl-al))}forEach(a,function(val,key){a[key]=b[key]});return a}function uniq(a){var seen=new Set;return a.filter(function(item){var allow=false;if(!seen.has(item)){seen.add(item);allow=true}return allow})}function flatten(aa){var flattened=[];for(var i=0;i<aa.length;++i){var current=aa[i];for(var j=0;j<current.length;++j)flattened.push(current[j])}return flattened}function sort(arr){for(var i=1;i<arr.length;i++){var tmp=arr[i],j=i;while(arr[j-1]>tmp){arr[j]=arr[j-1];--j}arr[j]=tmp}return arr}function values(a){var values=[];for(var key in a){if(a.hasOwnProperty(key)){values.push(a[key])}}return values}function recurseObject(obj,cb){_recurseObject(obj,[]);return obj;function _recurseObject(obj,path){for(var k in obj){var newPath=clone(path);newPath.push(k);if(typeof obj[k]=="object"&&obj[k]!==null){_recurseObject(obj[k],newPath)}else{if(!obj.hasOwnProperty(k)){continue}cb(obj[k],k,newPath)}}}}},{}],40:[function(require,module,exports){"use strict";var Promise=require("q");var _=require("./lodash");var aggregation=require("./aggregation");module.exports=function(service){return{post:post,sortByKey:sortByKey,limit:limit,squash:squash,change:change,changeMap:changeMap};function post(query,parent,cb){query.data=cloneIfLocked(parent);return Promise.resolve(cb(query,parent))}function sortByKey(query,parent,desc){query.data=cloneIfLocked(parent);query.data=_.sortBy(query.data,function(d){return d.key});if(desc){query.data.reverse()}}function limit(query,parent,start,end){query.data=cloneIfLocked(parent);if(_.isUndefined(end)){end=start||0;start=0}else{start=start||0;end=end||query.data.length}query.data=query.data.splice(start,end-start)}function squash(query,parent,start,end,aggObj,label){query.data=cloneIfLocked(parent);start=start||0;end=end||query.data.length;var toSquash=query.data.splice(start,end-start);var squashed={key:label||"Other",value:{}};_.recurseObject(aggObj,function(val,key,path){var items=[];_.forEach(toSquash,function(record){items.push(_.get(record.value,path))});_.set(squashed.value,path,aggregation.aggregators[val](items))});query.data.splice(start,0,squashed)}function change(query,parent,start,end,aggObj){query.data=cloneIfLocked(parent);start=start||0;end=end||query.data.length;var obj={key:[query.data[start].key,query.data[end].key],value:{}};_.recurseObject(aggObj,function(val,key,path){var changePath=_.clone(path);changePath.pop();changePath.push(key+"Change");_.set(obj.value,changePath,_.get(query.data[end].value,path)-_.get(query.data[start].value,path))});query.data=obj}function changeMap(query,parent,aggObj,defaultNull){defaultNull=_.isUndefined(defaultNull)?0:defaultNull;query.data=cloneIfLocked(parent);_.recurseObject(aggObj,function(val,key,path){var changePath=_.clone(path);var fromStartPath=_.clone(path);var fromEndPath=_.clone(path);changePath.pop();fromStartPath.pop();fromEndPath.pop();changePath.push(key+"Change");fromStartPath.push(key+"ChangeFromStart");fromEndPath.push(key+"ChangeFromEnd");var start=_.get(query.data[0].value,path,defaultNull);var end=_.get(query.data[query.data.length-1].value,path,defaultNull);_.forEach(query.data,function(record,i){var previous=query.data[i-1]||query.data[0];_.set(query.data[i].value,changePath,_.get(record.value,path,defaultNull)-(previous?_.get(previous.value,path,defaultNull):defaultNull));_.set(query.data[i].value,fromStartPath,_.get(record.value,path,defaultNull)-start);_.set(query.data[i].value,fromEndPath,_.get(record.value,path,defaultNull)-end)})})}};function cloneIfLocked(parent){return parent.locked?_.clone(parent.data):parent.data}},{"./aggregation":31,"./lodash":39,q:4}],41:[function(require,module,exports){"use strict";var Promise=require("q");var _=require("./lodash");Promise.serial=serial;var isPromiseLike=function(obj){return obj&&_.isFunction(obj.then)};function serial(tasks){var prevPromise;var error=new Error;_.forEach(tasks,function(task,key){var success=task.success||task;var fail=task.fail;var notify=task.notify;var nextPromise;if(!prevPromise){nextPromise=success();if(!isPromiseLike(nextPromise)){error.message="Task "+key+" did not return a promise.";throw error}}else{nextPromise=prevPromise.then(function(data){if(!success){return data}var ret=success(data);if(!isPromiseLike(ret)){error.message="Task "+key+" did not return a promise.";throw error}return ret},function(reason){if(!fail){return Promise.reject(reason)}var ret=fail(reason);if(!isPromiseLike(ret)){error.message="Fail for task "+key+" did not return a promise.";throw error}return ret},notify)}prevPromise=nextPromise});return prevPromise||Promise.when()}},{"./lodash":39,q:4}],42:[function(require,module,exports){"use strict";var Promise=require("q");var _=require("./lodash");module.exports=function(service){var reductiofy=require("./reductiofy")(service);var filters=require("./filters")(service);var postAggregation=require("./postAggregation")(service);var postAggregationMethods=_.keys(postAggregation);return function doQuery(queryObj){var queryHash=JSON.stringify(queryObj);for(var i=0;i<service.columns.length;i++){for(var j=0;j<service.columns[i].queries.length;j++){if(service.columns[i].queries[j].hash===queryHash){return Promise.try(function(){return service.columns[i].queries[j]})}}}var query={original:queryObj,hash:queryHash};if(_.isUndefined(query.original)){query.original={}}if(_.isUndefined(query.original.select)){query.original.select={$count:true}}query.original.groupBy=query.original.groupBy||true;query=newQueryObj(query);return createColumn(query).then(makeCrossfilterGroup).then(buildRequiredColumns).then(setupDataListeners).then(applyQuery);function createColumn(query){return service.column({key:query.original.groupBy,type:!_.isUndefined(query.type)?query.type:null,array:!!query.array}).then(function(){var column=service.column.find(query.original.groupBy);query.column=column;column.queries.push(query);column.removeListeners.push(function(){return query.clear()});return query})}function makeCrossfilterGroup(query){return Promise.resolve(query.column.dimension.group()).then(function(g){query.group=g;return query})}function buildRequiredColumns(query){var requiredColumns=filters.scanForDynamicFilters(query.original);if(requiredColumns.length){return Promise.all(_.map(requiredColumns,function(columnKey){return service.column({key:columnKey,dynamicReference:query.group})})).then(function(){return query})}return query}function setupDataListeners(query){var stopDataListen=service.onDataChange(function(){return applyQuery(query)});query.removeListeners.push(stopDataListen);var stopFilterListen=service.onFilter(function(){return postAggregate(query)});query.removeListeners.push(stopFilterListen);return query}function applyQuery(query){return buildReducer(query).then(applyReducer).then(attachData).then(postAggregate)}function buildReducer(query){return reductiofy(query.original).then(function(reducer){query.reducer=reducer;return query})}function applyReducer(query){return Promise.resolve(query.reducer(query.group)).then(function(){return query})}function attachData(query){return Promise.resolve(query.group.all()).then(function(data){query.data=data;return query})}function postAggregate(query){if(query.postAggregations.length>1){query.locked=true}return Promise.all(_.map(query.postAggregations,function(post){return post()})).then(function(){return query})}function newQueryObj(q,parent){var locked=false;if(!parent){parent=q;q={};locked=true}_.assign(q,{universe:service,crossfilter:service.cf,parent:parent,column:parent.column,dimension:parent.dimension,group:parent.group,reducer:parent.reducer,original:parent.original,hash:parent.hash,removeListeners:[],postAggregations:[],locked:locked,lock:lock,unlock:unlock,clear:clearQuery});_.forEach(postAggregationMethods,function(method){q[method]=postAggregateMethodWrap(postAggregation[method])});return q;function lock(set){if(!_.isUndefined(set)){q.locked=!!set;return}q.locked=true}function unlock(){q.locked=false}function clearQuery(){_.forEach(q.removeListeners,function(l){l()});return Promise.try(function(){return q.group.dispose()}).then(function(){q.column.queries.splice(q.column.queries.indexOf(q),1);if(!q.column.queries.length){return service.clear(q.column.key)}}).then(function(){return service})}function postAggregateMethodWrap(postMethod){return function(){var args=Array.prototype.slice.call(arguments);var sub={};newQueryObj(sub,q);args.unshift(sub,q);q.postAggregations.push(function(){Promise.resolve(postMethod.apply(null,args)).then(postAggregateChildren)});return Promise.resolve(postMethod.apply(null,args)).then(postAggregateChildren);function postAggregateChildren(){return postAggregate(sub).then(function(){return sub})}}}}}}},{"./filters":38,"./lodash":39,"./postAggregation":40,"./reductiofy":44,q:4}],43:[function(require,module,exports){"use strict";var _=require("./lodash");module.exports={shorthandLabels:{$count:"count",$sum:"sum",$avg:"avg",$min:"min",$max:"max",$med:"med",$sumSq:"sumSq",$std:"std"},aggregators:{$count:$count,$sum:$sum,$avg:$avg,$min:$min,$max:$max,$med:$med,$sumSq:$sumSq,$std:$std,$valueList:$valueList,$dataList:$dataList}};function $count(reducer,value){return reducer.count(true)}function $sum(reducer,value){return reducer.sum(value)}function $avg(reducer,value){return reducer.avg(value)}function $min(reducer,value){return reducer.min(value)}function $max(reducer,value){return reducer.max(value)}function $med(reducer,value){return reducer.median(value)}function $sumSq(reducer,value){return reducer.sumOfSq(value)}function $std(reducer,value){return reducer.std(value)}function $valueList(reducer,value){return reducer.valueList(value)}function $dataList(reducer,value){return reducer.dataList(true)}},{"./lodash":39}],44:[function(require,module,exports){"use strict";var reductio=require("reductio");var _=require("./lodash");var rAggregators=require("./reductioAggregators");var expressions=require("./expressions");var aggregation=require("./aggregation");module.exports=function(service){var filters=require("./filters")(service);return function reductiofy(query){var reducer=reductio();var groupBy=query.groupBy;aggregateOrNest(reducer,query.select);if(query.filter){var filterFunction=filters.makeFunction(query.filter);if(filterFunction){reducer.filter(filterFunction)}}return Promise.resolve(reducer);function aggregateOrNest(reducer,selects){var sortedSelectKeyValue=_.sortBy(_.map(selects,function(val,key){return{key:key,value:val}}),function(s){if(rAggregators.aggregators[s.key]){return 0}return 1});return _.forEach(sortedSelectKeyValue,function(s){if(rAggregators.aggregators[s.key]){var accessor=aggregation.makeValueAccessor(s.value);reducer=rAggregators.aggregators[s.key](reducer,accessor);return}if(!_.isObject(s.value)){console.error("Nested selects must be an object",s.key);return}reducer=aggregateOrNest(reducer.value(s.key),s.value)})}}}},{"./aggregation":31,"./expressions":37,"./filters":38,"./lodash":39,"./reductioAggregators":43,reductio:24}],universe:[function(require,module,exports){"use strict";require("./q.serial");var Promise=require("q");var _=require("./lodash");module.exports=universe;function universe(data,options){var service={options:_.assign({},options),columns:[],filters:{},dataListeners:[],filterListeners:[]};var cf=require("./crossfilter")(service);data=cf.generateColumns(data);return cf.build(data).then(function(data){service.cf=data;return _.assign(service,{add:cf.add,remove:cf.remove,column:require("./column")(service),query:require("./query")(service),filter:require("./filters")(service).filter,clear:require("./clear")(service),destroy:require("./destroy")(service),onDataChange:onDataChange,onFilter:onFilter})});function onDataChange(cb){service.dataListeners.push(cb);return function(){service.dataListeners.splice(service.dataListeners.indexOf(cb),1)}}function onFilter(cb){service.filterListeners.push(cb);return function(){service.filterListeners.splice(service.filterListeners.indexOf(cb),1)}}}},{"./clear":32,"./column":33,"./crossfilter":34,"./destroy":35,"./filters":38,"./lodash":39,"./q.serial":41,"./query":42,q:4}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({lodash:[function(require,module,exports){(function(global){(function(){var undefined;var VERSION="4.13.1";var LARGE_ARRAY_SIZE=200;var FUNC_ERROR_TEXT="Expected a function";var HASH_UNDEFINED="__lodash_hash_undefined__";var PLACEHOLDER="__lodash_placeholder__";var BIND_FLAG=1,BIND_KEY_FLAG=2,CURRY_BOUND_FLAG=4,CURRY_FLAG=8,CURRY_RIGHT_FLAG=16,PARTIAL_FLAG=32,PARTIAL_RIGHT_FLAG=64,ARY_FLAG=128,REARG_FLAG=256,FLIP_FLAG=512;var UNORDERED_COMPARE_FLAG=1,PARTIAL_COMPARE_FLAG=2;var DEFAULT_TRUNC_LENGTH=30,DEFAULT_TRUNC_OMISSION="...";var HOT_COUNT=150,HOT_SPAN=16;var LAZY_FILTER_FLAG=1,LAZY_MAP_FLAG=2,LAZY_WHILE_FLAG=3;var INFINITY=1/0,MAX_SAFE_INTEGER=9007199254740991,MAX_INTEGER=1.7976931348623157e308,NAN=0/0;var MAX_ARRAY_LENGTH=4294967295,MAX_ARRAY_INDEX=MAX_ARRAY_LENGTH-1,HALF_MAX_ARRAY_LENGTH=MAX_ARRAY_LENGTH>>>1;var argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",genTag="[object GeneratorFunction]",mapTag="[object Map]",numberTag="[object Number]",objectTag="[object Object]",promiseTag="[object Promise]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",weakMapTag="[object WeakMap]",weakSetTag="[object WeakSet]";var arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]";var reEmptyStringLeading=/\b__p \+= '';/g,reEmptyStringMiddle=/\b(__p \+=) '' \+/g,reEmptyStringTrailing=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var reEscapedHtml=/&(?:amp|lt|gt|quot|#39|#96);/g,reUnescapedHtml=/[&<>"'`]/g,reHasEscapedHtml=RegExp(reEscapedHtml.source),reHasUnescapedHtml=RegExp(reUnescapedHtml.source);var reEscape=/<%-([\s\S]+?)%>/g,reEvaluate=/<%([\s\S]+?)%>/g,reInterpolate=/<%=([\s\S]+?)%>/g;var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g;var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reHasRegExpChar=RegExp(reRegExpChar.source);var reTrim=/^\s+|\s+$/g,reTrimStart=/^\s+/,reTrimEnd=/\s+$/;var reBasicWord=/[a-zA-Z0-9]+/g;var reEscapeChar=/\\(\\)?/g;var reEsTemplate=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var reFlags=/\w*$/;var reHasHexPrefix=/^0x/i;var reIsBadHex=/^[-+]0x[0-9a-f]+$/i;var reIsBinary=/^0b[01]+$/i;var reIsHostCtor=/^\[object .+?Constructor\]$/;var reIsOctal=/^0o[0-7]+$/i;var reIsUint=/^(?:0|[1-9]\d*)$/;var reLatin1=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g;var reNoMatch=/($^)/;var reUnescapedString=/['\n\r\u2028\u2029\\]/g;var rsAstralRange="\\ud800-\\udfff",rsComboMarksRange="\\u0300-\\u036f\\ufe20-\\ufe23",rsComboSymbolsRange="\\u20d0-\\u20f0",rsDingbatRange="\\u2700-\\u27bf",rsLowerRange="a-z\\xdf-\\xf6\\xf8-\\xff",rsMathOpRange="\\xac\\xb1\\xd7\\xf7",rsNonCharRange="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",rsPunctuationRange="\\u2000-\\u206f",rsSpaceRange=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",rsUpperRange="A-Z\\xc0-\\xd6\\xd8-\\xde",rsVarRange="\\ufe0e\\ufe0f",rsBreakRange=rsMathOpRange+rsNonCharRange+rsPunctuationRange+rsSpaceRange;var rsApos="['’]",rsAstral="["+rsAstralRange+"]",rsBreak="["+rsBreakRange+"]",rsCombo="["+rsComboMarksRange+rsComboSymbolsRange+"]",rsDigits="\\d+",rsDingbat="["+rsDingbatRange+"]",rsLower="["+rsLowerRange+"]",rsMisc="[^"+rsAstralRange+rsBreakRange+rsDigits+rsDingbatRange+rsLowerRange+rsUpperRange+"]",rsFitz="\\ud83c[\\udffb-\\udfff]",rsModifier="(?:"+rsCombo+"|"+rsFitz+")",rsNonAstral="[^"+rsAstralRange+"]",rsRegional="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair="[\\ud800-\\udbff][\\udc00-\\udfff]",rsUpper="["+rsUpperRange+"]",rsZWJ="\\u200d";var rsLowerMisc="(?:"+rsLower+"|"+rsMisc+")",rsUpperMisc="(?:"+rsUpper+"|"+rsMisc+")",rsOptLowerContr="(?:"+rsApos+"(?:d|ll|m|re|s|t|ve))?",rsOptUpperContr="(?:"+rsApos+"(?:D|LL|M|RE|S|T|VE))?",reOptMod=rsModifier+"?",rsOptVar="["+rsVarRange+"]?",rsOptJoin="(?:"+rsZWJ+"(?:"+[rsNonAstral,rsRegional,rsSurrPair].join("|")+")"+rsOptVar+reOptMod+")*",rsSeq=rsOptVar+reOptMod+rsOptJoin,rsEmoji="(?:"+[rsDingbat,rsRegional,rsSurrPair].join("|")+")"+rsSeq,rsSymbol="(?:"+[rsNonAstral+rsCombo+"?",rsCombo,rsRegional,rsSurrPair,rsAstral].join("|")+")";var reApos=RegExp(rsApos,"g");var reComboMark=RegExp(rsCombo,"g");var reComplexSymbol=RegExp(rsFitz+"(?="+rsFitz+")|"+rsSymbol+rsSeq,"g");var reComplexWord=RegExp([rsUpper+"?"+rsLower+"+"+rsOptLowerContr+"(?="+[rsBreak,rsUpper,"$"].join("|")+")",rsUpperMisc+"+"+rsOptUpperContr+"(?="+[rsBreak,rsUpper+rsLowerMisc,"$"].join("|")+")",rsUpper+"?"+rsLowerMisc+"+"+rsOptLowerContr,rsUpper+"+"+rsOptUpperContr,rsDigits,rsEmoji].join("|"),"g");var reHasComplexSymbol=RegExp("["+rsZWJ+rsAstralRange+rsComboMarksRange+rsComboSymbolsRange+rsVarRange+"]");var reHasComplexWord=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var contextProps=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","Reflect","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","isFinite","parseInt","setTimeout"];var templateCounter=-1;var typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=true;typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=false;var cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=cloneableTags[arrayBufferTag]=cloneableTags[dataViewTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[setTag]=cloneableTags[stringTag]=cloneableTags[symbolTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=true;cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=false;var deburredLetters={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"};var htmlEscapes={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","`":"&#96;"};var htmlUnescapes={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&#96;":"`"};var stringEscapes={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};var freeParseFloat=parseFloat,freeParseInt=parseInt;var freeExports=typeof exports=="object"&&exports;var freeModule=freeExports&&typeof module=="object"&&module;var moduleExports=freeModule&&freeModule.exports===freeExports;var freeGlobal=checkGlobal(typeof global=="object"&&global);var freeSelf=checkGlobal(typeof self=="object"&&self);var thisGlobal=checkGlobal(typeof this=="object"&&this);var root=freeGlobal||freeSelf||thisGlobal||Function("return this")();function addMapEntry(map,pair){map.set(pair[0],pair[1]);return map}function addSetEntry(set,value){set.add(value);return set}function apply(func,thisArg,args){var length=args.length;switch(length){case 0:return func.call(thisArg);case 1:return func.call(thisArg,args[0]);case 2:return func.call(thisArg,args[0],args[1]);case 3:return func.call(thisArg,args[0],args[1],args[2])}return func.apply(thisArg,args)}function arrayAggregator(array,setter,iteratee,accumulator){var index=-1,length=array?array.length:0;while(++index<length){var value=array[index];setter(accumulator,value,iteratee(value),array)}return accumulator}function arrayEach(array,iteratee){var index=-1,length=array?array.length:0;while(++index<length){if(iteratee(array[index],index,array)===false){break}}return array}function arrayEachRight(array,iteratee){var length=array?array.length:0;while(length--){if(iteratee(array[length],length,array)===false){break}}return array}function arrayEvery(array,predicate){var index=-1,length=array?array.length:0;while(++index<length){if(!predicate(array[index],index,array)){return false}}return true}function arrayFilter(array,predicate){var index=-1,length=array?array.length:0,resIndex=0,result=[];while(++index<length){var value=array[index];if(predicate(value,index,array)){result[resIndex++]=value}}return result}function arrayIncludes(array,value){var length=array?array.length:0;return!!length&&baseIndexOf(array,value,0)>-1}function arrayIncludesWith(array,value,comparator){var index=-1,length=array?array.length:0;while(++index<length){if(comparator(value,array[index])){return true}}return false}function arrayMap(array,iteratee){var index=-1,length=array?array.length:0,result=Array(length);while(++index<length){result[index]=iteratee(array[index],index,array)}return result}function arrayPush(array,values){var index=-1,length=values.length,offset=array.length;while(++index<length){array[offset+index]=values[index]}return array}function arrayReduce(array,iteratee,accumulator,initAccum){var index=-1,length=array?array.length:0;if(initAccum&&length){accumulator=array[++index]}while(++index<length){accumulator=iteratee(accumulator,array[index],index,array)}return accumulator}function arrayReduceRight(array,iteratee,accumulator,initAccum){var length=array?array.length:0;if(initAccum&&length){accumulator=array[--length]}while(length--){accumulator=iteratee(accumulator,array[length],length,array)}return accumulator}function arraySome(array,predicate){var index=-1,length=array?array.length:0;while(++index<length){if(predicate(array[index],index,array)){return true}}return false}function baseFindKey(collection,predicate,eachFunc){var result;eachFunc(collection,function(value,key,collection){if(predicate(value,key,collection)){result=key;return false}});return result}function baseFindIndex(array,predicate,fromIndex,fromRight){var length=array.length,index=fromIndex+(fromRight?1:-1);while(fromRight?index--:++index<length){if(predicate(array[index],index,array)){return index}}return-1}function baseIndexOf(array,value,fromIndex){if(value!==value){return indexOfNaN(array,fromIndex)}var index=fromIndex-1,length=array.length;while(++index<length){if(array[index]===value){return index}}return-1}function baseIndexOfWith(array,value,fromIndex,comparator){var index=fromIndex-1,length=array.length;while(++index<length){if(comparator(array[index],value)){return index}}return-1}function baseMean(array,iteratee){var length=array?array.length:0;return length?baseSum(array,iteratee)/length:NAN}function baseReduce(collection,iteratee,accumulator,initAccum,eachFunc){eachFunc(collection,function(value,index,collection){accumulator=initAccum?(initAccum=false,value):iteratee(accumulator,value,index,collection)});return accumulator}function baseSortBy(array,comparer){var length=array.length;array.sort(comparer);while(length--){array[length]=array[length].value}return array}function baseSum(array,iteratee){var result,index=-1,length=array.length;while(++index<length){var current=iteratee(array[index]);if(current!==undefined){result=result===undefined?current:result+current}}return result}function baseTimes(n,iteratee){var index=-1,result=Array(n);while(++index<n){result[index]=iteratee(index)}return result}function baseToPairs(object,props){return arrayMap(props,function(key){return[key,object[key]]})}function baseUnary(func){return function(value){return func(value)}}function baseValues(object,props){return arrayMap(props,function(key){return object[key]})}function cacheHas(cache,key){return cache.has(key)}function charsStartIndex(strSymbols,chrSymbols){var index=-1,length=strSymbols.length;while(++index<length&&baseIndexOf(chrSymbols,strSymbols[index],0)>-1){}return index}function charsEndIndex(strSymbols,chrSymbols){var index=strSymbols.length;while(index--&&baseIndexOf(chrSymbols,strSymbols[index],0)>-1){}return index}function checkGlobal(value){return value&&value.Object===Object?value:null}function countHolders(array,placeholder){var length=array.length,result=0;while(length--){if(array[length]===placeholder){result++}}return result}function deburrLetter(letter){return deburredLetters[letter]}function escapeHtmlChar(chr){return htmlEscapes[chr]}function escapeStringChar(chr){return"\\"+stringEscapes[chr]}function getValue(object,key){return object==null?undefined:object[key]}function indexOfNaN(array,fromIndex,fromRight){var length=array.length,index=fromIndex+(fromRight?1:-1);while(fromRight?index--:++index<length){var other=array[index];if(other!==other){return index}}return-1}function isHostObject(value){var result=false;if(value!=null&&typeof value.toString!="function"){try{result=!!(value+"")}catch(e){}}return result}function iteratorToArray(iterator){var data,result=[];while(!(data=iterator.next()).done){result.push(data.value)}return result}function mapToArray(map){var index=-1,result=Array(map.size);map.forEach(function(value,key){result[++index]=[key,value]});return result}function replaceHolders(array,placeholder){var index=-1,length=array.length,resIndex=0,result=[];while(++index<length){var value=array[index];if(value===placeholder||value===PLACEHOLDER){array[index]=PLACEHOLDER;result[resIndex++]=index}}return result}function setToArray(set){var index=-1,result=Array(set.size);set.forEach(function(value){result[++index]=value});return result}function setToPairs(set){var index=-1,result=Array(set.size);set.forEach(function(value){result[++index]=[value,value]});return result}function stringSize(string){if(!(string&&reHasComplexSymbol.test(string))){return string.length}var result=reComplexSymbol.lastIndex=0;while(reComplexSymbol.test(string)){result++}return result}function stringToArray(string){return string.match(reComplexSymbol)}function unescapeHtmlChar(chr){return htmlUnescapes[chr]}function runInContext(context){context=context?_.defaults({},context,_.pick(root,contextProps)):root;var Date=context.Date,Error=context.Error,Math=context.Math,RegExp=context.RegExp,TypeError=context.TypeError;var arrayProto=context.Array.prototype,objectProto=context.Object.prototype,stringProto=context.String.prototype;var coreJsData=context["__core-js_shared__"];var maskSrcKey=function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""}();var funcToString=context.Function.prototype.toString;var hasOwnProperty=objectProto.hasOwnProperty;var idCounter=0;var objectCtorString=funcToString.call(Object);var objectToString=objectProto.toString;var oldDash=root._;var reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Buffer=moduleExports?context.Buffer:undefined,Reflect=context.Reflect,Symbol=context.Symbol,Uint8Array=context.Uint8Array,enumerate=Reflect?Reflect.enumerate:undefined,getOwnPropertySymbols=Object.getOwnPropertySymbols,iteratorSymbol=typeof(iteratorSymbol=Symbol&&Symbol.iterator)=="symbol"?iteratorSymbol:undefined,objectCreate=Object.create,propertyIsEnumerable=objectProto.propertyIsEnumerable,splice=arrayProto.splice;var setTimeout=function(func,wait){return context.setTimeout.call(root,func,wait)};var nativeCeil=Math.ceil,nativeFloor=Math.floor,nativeGetPrototype=Object.getPrototypeOf,nativeIsFinite=context.isFinite,nativeJoin=arrayProto.join,nativeKeys=Object.keys,nativeMax=Math.max,nativeMin=Math.min,nativeParseInt=context.parseInt,nativeRandom=Math.random,nativeReplace=stringProto.replace,nativeReverse=arrayProto.reverse,nativeSplit=stringProto.split;var DataView=getNative(context,"DataView"),Map=getNative(context,"Map"),Promise=getNative(context,"Promise"),Set=getNative(context,"Set"),WeakMap=getNative(context,"WeakMap"),nativeCreate=getNative(Object,"create");
var metaMap=WeakMap&&new WeakMap;var nonEnumShadows=!propertyIsEnumerable.call({valueOf:1},"valueOf");var realNames={};var dataViewCtorString=toSource(DataView),mapCtorString=toSource(Map),promiseCtorString=toSource(Promise),setCtorString=toSource(Set),weakMapCtorString=toSource(WeakMap);var symbolProto=Symbol?Symbol.prototype:undefined,symbolValueOf=symbolProto?symbolProto.valueOf:undefined,symbolToString=symbolProto?symbolProto.toString:undefined;function lodash(value){if(isObjectLike(value)&&!isArray(value)&&!(value instanceof LazyWrapper)){if(value instanceof LodashWrapper){return value}if(hasOwnProperty.call(value,"__wrapped__")){return wrapperClone(value)}}return new LodashWrapper(value)}function baseLodash(){}function LodashWrapper(value,chainAll){this.__wrapped__=value;this.__actions__=[];this.__chain__=!!chainAll;this.__index__=0;this.__values__=undefined}lodash.templateSettings={escape:reEscape,evaluate:reEvaluate,interpolate:reInterpolate,variable:"",imports:{_:lodash}};lodash.prototype=baseLodash.prototype;lodash.prototype.constructor=lodash;LodashWrapper.prototype=baseCreate(baseLodash.prototype);LodashWrapper.prototype.constructor=LodashWrapper;function LazyWrapper(value){this.__wrapped__=value;this.__actions__=[];this.__dir__=1;this.__filtered__=false;this.__iteratees__=[];this.__takeCount__=MAX_ARRAY_LENGTH;this.__views__=[]}function lazyClone(){var result=new LazyWrapper(this.__wrapped__);result.__actions__=copyArray(this.__actions__);result.__dir__=this.__dir__;result.__filtered__=this.__filtered__;result.__iteratees__=copyArray(this.__iteratees__);result.__takeCount__=this.__takeCount__;result.__views__=copyArray(this.__views__);return result}function lazyReverse(){if(this.__filtered__){var result=new LazyWrapper(this);result.__dir__=-1;result.__filtered__=true}else{result=this.clone();result.__dir__*=-1}return result}function lazyValue(){var array=this.__wrapped__.value(),dir=this.__dir__,isArr=isArray(array),isRight=dir<0,arrLength=isArr?array.length:0,view=getView(0,arrLength,this.__views__),start=view.start,end=view.end,length=end-start,index=isRight?end:start-1,iteratees=this.__iteratees__,iterLength=iteratees.length,resIndex=0,takeCount=nativeMin(length,this.__takeCount__);if(!isArr||arrLength<LARGE_ARRAY_SIZE||arrLength==length&&takeCount==length){return baseWrapperValue(array,this.__actions__)}var result=[];outer:while(length--&&resIndex<takeCount){index+=dir;var iterIndex=-1,value=array[index];while(++iterIndex<iterLength){var data=iteratees[iterIndex],iteratee=data.iteratee,type=data.type,computed=iteratee(value);if(type==LAZY_MAP_FLAG){value=computed}else if(!computed){if(type==LAZY_FILTER_FLAG){continue outer}else{break outer}}}result[resIndex++]=value}return result}LazyWrapper.prototype=baseCreate(baseLodash.prototype);LazyWrapper.prototype.constructor=LazyWrapper;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 SetCache(values){var index=-1,length=values?values.length:0;this.__data__=new MapCache;while(++index<length){this.add(values[index])}}function setCacheAdd(value){this.__data__.set(value,HASH_UNDEFINED);return this}function setCacheHas(value){return this.__data__.has(value)}SetCache.prototype.add=SetCache.prototype.push=setCacheAdd;SetCache.prototype.has=setCacheHas;function Stack(entries){this.__data__=new ListCache(entries)}function stackClear(){this.__data__=new ListCache}function stackDelete(key){return this.__data__["delete"](key)}function stackGet(key){return this.__data__.get(key)}function stackHas(key){return this.__data__.has(key)}function stackSet(key,value){var cache=this.__data__;if(cache instanceof ListCache&&cache.__data__.length==LARGE_ARRAY_SIZE){cache=this.__data__=new MapCache(cache.__data__)}cache.set(key,value);return this}Stack.prototype.clear=stackClear;Stack.prototype["delete"]=stackDelete;Stack.prototype.get=stackGet;Stack.prototype.has=stackHas;Stack.prototype.set=stackSet;function assignInDefaults(objValue,srcValue,key,object){if(objValue===undefined||eq(objValue,objectProto[key])&&!hasOwnProperty.call(object,key)){return srcValue}return objValue}function assignMergeValue(object,key,value){if(value!==undefined&&!eq(object[key],value)||typeof key=="number"&&value===undefined&&!(key in object)){object[key]=value}}function assignValue(object,key,value){var objValue=object[key];if(!(hasOwnProperty.call(object,key)&&eq(objValue,value))||value===undefined&&!(key in object)){object[key]=value}}function assocIndexOf(array,key){var length=array.length;while(length--){if(eq(array[length][0],key)){return length}}return-1}function baseAggregator(collection,setter,iteratee,accumulator){baseEach(collection,function(value,key,collection){setter(accumulator,value,iteratee(value),collection)});return accumulator}function baseAssign(object,source){return object&&copyObject(source,keys(source),object)}function baseAt(object,paths){var index=-1,isNil=object==null,length=paths.length,result=Array(length);while(++index<length){result[index]=isNil?undefined:get(object,paths[index])}return result}function baseClamp(number,lower,upper){if(number===number){if(upper!==undefined){number=number<=upper?number:upper}if(lower!==undefined){number=number>=lower?number:lower}}return number}function baseClone(value,isDeep,isFull,customizer,key,object,stack){var result;if(customizer){result=object?customizer(value,key,object,stack):customizer(value)}if(result!==undefined){return result}if(!isObject(value)){return value}var isArr=isArray(value);if(isArr){result=initCloneArray(value);if(!isDeep){return copyArray(value,result)}}else{var tag=getTag(value),isFunc=tag==funcTag||tag==genTag;if(isBuffer(value)){return cloneBuffer(value,isDeep)}if(tag==objectTag||tag==argsTag||isFunc&&!object){if(isHostObject(value)){return object?value:{}}result=initCloneObject(isFunc?{}:value);if(!isDeep){return copySymbols(value,baseAssign(result,value))}}else{if(!cloneableTags[tag]){return object?value:{}}result=initCloneByTag(value,tag,baseClone,isDeep)}}stack||(stack=new Stack);var stacked=stack.get(value);if(stacked){return stacked}stack.set(value,result);if(!isArr){var props=isFull?getAllKeys(value):keys(value)}arrayEach(props||value,function(subValue,key){if(props){key=subValue;subValue=value[key]}assignValue(result,key,baseClone(subValue,isDeep,isFull,customizer,key,value,stack))});return result}function baseConforms(source){var props=keys(source),length=props.length;return function(object){if(object==null){return!length}var index=length;while(index--){var key=props[index],predicate=source[key],value=object[key];if(value===undefined&&!(key in Object(object))||!predicate(value)){return false}}return true}}function baseCreate(proto){return isObject(proto)?objectCreate(proto):{}}function baseDelay(func,wait,args){if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}return setTimeout(function(){func.apply(undefined,args)},wait)}function baseDifference(array,values,iteratee,comparator){var index=-1,includes=arrayIncludes,isCommon=true,length=array.length,result=[],valuesLength=values.length;if(!length){return result}if(iteratee){values=arrayMap(values,baseUnary(iteratee))}if(comparator){includes=arrayIncludesWith;isCommon=false}else if(values.length>=LARGE_ARRAY_SIZE){includes=cacheHas;isCommon=false;values=new SetCache(values)}outer:while(++index<length){var value=array[index],computed=iteratee?iteratee(value):value;value=comparator||value!==0?value:0;if(isCommon&&computed===computed){var valuesIndex=valuesLength;while(valuesIndex--){if(values[valuesIndex]===computed){continue outer}}result.push(value)}else if(!includes(values,computed,comparator)){result.push(value)}}return result}var baseEach=createBaseEach(baseForOwn);var baseEachRight=createBaseEach(baseForOwnRight,true);function baseEvery(collection,predicate){var result=true;baseEach(collection,function(value,index,collection){result=!!predicate(value,index,collection);return result});return result}function baseExtremum(array,iteratee,comparator){var index=-1,length=array.length;while(++index<length){var value=array[index],current=iteratee(value);if(current!=null&&(computed===undefined?current===current&&!isSymbol(current):comparator(current,computed))){var computed=current,result=value}}return result}function baseFill(array,value,start,end){var length=array.length;start=toInteger(start);if(start<0){start=-start>length?0:length+start}end=end===undefined||end>length?length:toInteger(end);if(end<0){end+=length}end=start>end?0:toLength(end);while(start<end){array[start++]=value}return array}function baseFilter(collection,predicate){var result=[];baseEach(collection,function(value,index,collection){if(predicate(value,index,collection)){result.push(value)}});return result}function baseFlatten(array,depth,predicate,isStrict,result){var index=-1,length=array.length;predicate||(predicate=isFlattenable);result||(result=[]);while(++index<length){var value=array[index];if(depth>0&&predicate(value)){if(depth>1){baseFlatten(value,depth-1,predicate,isStrict,result)}else{arrayPush(result,value)}}else if(!isStrict){result[result.length]=value}}return result}var baseFor=createBaseFor();var baseForRight=createBaseFor(true);function baseForOwn(object,iteratee){return object&&baseFor(object,iteratee,keys)}function baseForOwnRight(object,iteratee){return object&&baseForRight(object,iteratee,keys)}function baseFunctions(object,props){return arrayFilter(props,function(key){return isFunction(object[key])})}function baseGet(object,path){path=isKey(path,object)?[path]:castPath(path);var index=0,length=path.length;while(object!=null&&index<length){object=object[toKey(path[index++])]}return index&&index==length?object:undefined}function baseGetAllKeys(object,keysFunc,symbolsFunc){var result=keysFunc(object);return isArray(object)?result:arrayPush(result,symbolsFunc(object))}function baseGt(value,other){return value>other}function baseHas(object,key){return object!=null&&(hasOwnProperty.call(object,key)||typeof object=="object"&&key in object&&getPrototype(object)===null)}function baseHasIn(object,key){return object!=null&&key in Object(object)}function baseInRange(number,start,end){return number>=nativeMin(start,end)&&number<nativeMax(start,end)}function baseIntersection(arrays,iteratee,comparator){var includes=comparator?arrayIncludesWith:arrayIncludes,length=arrays[0].length,othLength=arrays.length,othIndex=othLength,caches=Array(othLength),maxLength=Infinity,result=[];while(othIndex--){var array=arrays[othIndex];if(othIndex&&iteratee){array=arrayMap(array,baseUnary(iteratee))}maxLength=nativeMin(array.length,maxLength);caches[othIndex]=!comparator&&(iteratee||length>=120&&array.length>=120)?new SetCache(othIndex&&array):undefined}array=arrays[0];var index=-1,seen=caches[0];outer:while(++index<length&&result.length<maxLength){var value=array[index],computed=iteratee?iteratee(value):value;value=comparator||value!==0?value:0;if(!(seen?cacheHas(seen,computed):includes(result,computed,comparator))){othIndex=othLength;while(--othIndex){var cache=caches[othIndex];if(!(cache?cacheHas(cache,computed):includes(arrays[othIndex],computed,comparator))){continue outer}}if(seen){seen.push(computed)}result.push(value)}}return result}function baseInverter(object,setter,iteratee,accumulator){baseForOwn(object,function(value,key,object){setter(accumulator,iteratee(value),key,object)});return accumulator}function baseInvoke(object,path,args){if(!isKey(path,object)){path=castPath(path);object=parent(object,path);path=last(path)}var func=object==null?object:object[toKey(path)];return func==null?undefined:apply(func,object,args)}function baseIsEqual(value,other,customizer,bitmask,stack){if(value===other){return true}if(value==null||other==null||!isObject(value)&&!isObjectLike(other)){return value!==value&&other!==other}return baseIsEqualDeep(value,other,baseIsEqual,customizer,bitmask,stack)}function baseIsEqualDeep(object,other,equalFunc,customizer,bitmask,stack){var objIsArr=isArray(object),othIsArr=isArray(other),objTag=arrayTag,othTag=arrayTag;if(!objIsArr){objTag=getTag(object);objTag=objTag==argsTag?objectTag:objTag}if(!othIsArr){othTag=getTag(other);othTag=othTag==argsTag?objectTag:othTag}var objIsObj=objTag==objectTag&&!isHostObject(object),othIsObj=othTag==objectTag&&!isHostObject(other),isSameTag=objTag==othTag;if(isSameTag&&!objIsObj){stack||(stack=new Stack);return objIsArr||isTypedArray(object)?equalArrays(object,other,equalFunc,customizer,bitmask,stack):equalByTag(object,other,objTag,equalFunc,customizer,bitmask,stack)}if(!(bitmask&PARTIAL_COMPARE_FLAG)){var objIsWrapped=objIsObj&&hasOwnProperty.call(object,"__wrapped__"),othIsWrapped=othIsObj&&hasOwnProperty.call(other,"__wrapped__");if(objIsWrapped||othIsWrapped){var objUnwrapped=objIsWrapped?object.value():object,othUnwrapped=othIsWrapped?other.value():other;stack||(stack=new Stack);return equalFunc(objUnwrapped,othUnwrapped,customizer,bitmask,stack)}}if(!isSameTag){return false}stack||(stack=new Stack);return equalObjects(object,other,equalFunc,customizer,bitmask,stack)}function baseIsMatch(object,source,matchData,customizer){var index=matchData.length,length=index,noCustomizer=!customizer;if(object==null){return!length}object=Object(object);while(index--){var data=matchData[index];if(noCustomizer&&data[2]?data[1]!==object[data[0]]:!(data[0]in object)){return false}}while(++index<length){data=matchData[index];var key=data[0],objValue=object[key],srcValue=data[1];if(noCustomizer&&data[2]){if(objValue===undefined&&!(key in object)){return false}}else{var stack=new Stack;if(customizer){var result=customizer(objValue,srcValue,key,object,source,stack)}if(!(result===undefined?baseIsEqual(srcValue,objValue,customizer,UNORDERED_COMPARE_FLAG|PARTIAL_COMPARE_FLAG,stack):result)){return false}}}return true}function baseIsNative(value){if(!isObject(value)||isMasked(value)){return false}var pattern=isFunction(value)||isHostObject(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value))}function baseIteratee(value){if(typeof value=="function"){return value}if(value==null){return identity}if(typeof value=="object"){return isArray(value)?baseMatchesProperty(value[0],value[1]):baseMatches(value)}return property(value)}function baseKeys(object){return nativeKeys(Object(object))}function baseKeysIn(object){object=object==null?object:Object(object);var result=[];for(var key in object){result.push(key)}return result}if(enumerate&&!propertyIsEnumerable.call({valueOf:1},"valueOf")){baseKeysIn=function(object){return iteratorToArray(enumerate(object))}}function baseLt(value,other){return value<other}function baseMap(collection,iteratee){var index=-1,result=isArrayLike(collection)?Array(collection.length):[];baseEach(collection,function(value,key,collection){result[++index]=iteratee(value,key,collection)});return result}function baseMatches(source){var matchData=getMatchData(source);if(matchData.length==1&&matchData[0][2]){return matchesStrictComparable(matchData[0][0],matchData[0][1])}return function(object){return object===source||baseIsMatch(object,source,matchData)}}function baseMatchesProperty(path,srcValue){if(isKey(path)&&isStrictComparable(srcValue)){return matchesStrictComparable(toKey(path),srcValue)}return function(object){var objValue=get(object,path);return objValue===undefined&&objValue===srcValue?hasIn(object,path):baseIsEqual(srcValue,objValue,undefined,UNORDERED_COMPARE_FLAG|PARTIAL_COMPARE_FLAG)}}function baseMerge(object,source,srcIndex,customizer,stack){if(object===source){return}if(!(isArray(source)||isTypedArray(source))){var props=keysIn(source)}arrayEach(props||source,function(srcValue,key){if(props){key=srcValue;srcValue=source[key]}if(isObject(srcValue)){stack||(stack=new Stack);baseMergeDeep(object,source,key,srcIndex,baseMerge,customizer,stack)}else{var newValue=customizer?customizer(object[key],srcValue,key+"",object,source,stack):undefined;if(newValue===undefined){newValue=srcValue}assignMergeValue(object,key,newValue)}})}function baseMergeDeep(object,source,key,srcIndex,mergeFunc,customizer,stack){var objValue=object[key],srcValue=source[key],stacked=stack.get(srcValue);if(stacked){assignMergeValue(object,key,stacked);return}var newValue=customizer?customizer(objValue,srcValue,key+"",object,source,stack):undefined;var isCommon=newValue===undefined;if(isCommon){newValue=srcValue;if(isArray(srcValue)||isTypedArray(srcValue)){if(isArray(objValue)){newValue=objValue}else if(isArrayLikeObject(objValue)){newValue=copyArray(objValue)}else{isCommon=false;newValue=baseClone(srcValue,true)}}else if(isPlainObject(srcValue)||isArguments(srcValue)){if(isArguments(objValue)){newValue=toPlainObject(objValue)}else if(!isObject(objValue)||srcIndex&&isFunction(objValue)){isCommon=false;newValue=baseClone(srcValue,true)}else{newValue=objValue}}else{isCommon=false}}stack.set(srcValue,newValue);if(isCommon){mergeFunc(newValue,srcValue,srcIndex,customizer,stack)}stack["delete"](srcValue);assignMergeValue(object,key,newValue)}function baseNth(array,n){var length=array.length;if(!length){return}n+=n<0?length:0;return isIndex(n,length)?array[n]:undefined}function baseOrderBy(collection,iteratees,orders){var index=-1;iteratees=arrayMap(iteratees.length?iteratees:[identity],baseUnary(getIteratee()));var result=baseMap(collection,function(value,key,collection){var criteria=arrayMap(iteratees,function(iteratee){return iteratee(value)});return{criteria:criteria,index:++index,value:value}});return baseSortBy(result,function(object,other){return compareMultiple(object,other,orders)})}function basePick(object,props){object=Object(object);return arrayReduce(props,function(result,key){if(key in object){result[key]=object[key]}return result},{})}function basePickBy(object,predicate){var index=-1,props=getAllKeysIn(object),length=props.length,result={};while(++index<length){var key=props[index],value=object[key];if(predicate(value,key)){result[key]=value}}return result}function baseProperty(key){return function(object){return object==null?undefined:object[key]}}function basePropertyDeep(path){return function(object){return baseGet(object,path)}}function basePullAll(array,values,iteratee,comparator){var indexOf=comparator?baseIndexOfWith:baseIndexOf,index=-1,length=values.length,seen=array;if(array===values){values=copyArray(values)}if(iteratee){seen=arrayMap(array,baseUnary(iteratee))}while(++index<length){var fromIndex=0,value=values[index],computed=iteratee?iteratee(value):value;while((fromIndex=indexOf(seen,computed,fromIndex,comparator))>-1){if(seen!==array){splice.call(seen,fromIndex,1)}splice.call(array,fromIndex,1)}}return array}function basePullAt(array,indexes){var length=array?indexes.length:0,lastIndex=length-1;while(length--){var index=indexes[length];if(length==lastIndex||index!==previous){var previous=index;if(isIndex(index)){splice.call(array,index,1)}else if(!isKey(index,array)){var path=castPath(index),object=parent(array,path);if(object!=null){delete object[toKey(last(path))]}}else{delete array[toKey(index)]}}}return array}function baseRandom(lower,upper){return lower+nativeFloor(nativeRandom()*(upper-lower+1))}function baseRange(start,end,step,fromRight){var index=-1,length=nativeMax(nativeCeil((end-start)/(step||1)),0),result=Array(length);while(length--){result[fromRight?length:++index]=start;start+=step}return result}function baseRepeat(string,n){var result="";if(!string||n<1||n>MAX_SAFE_INTEGER){return result}do{if(n%2){result+=string}n=nativeFloor(n/2);if(n){string+=string}}while(n);return result}function baseSet(object,path,value,customizer){path=isKey(path,object)?[path]:castPath(path);var index=-1,length=path.length,lastIndex=length-1,nested=object;while(nested!=null&&++index<length){var key=toKey(path[index]);if(isObject(nested)){var newValue=value;if(index!=lastIndex){var objValue=nested[key];newValue=customizer?customizer(objValue,key,nested):undefined;if(newValue===undefined){newValue=objValue==null?isIndex(path[index+1])?[]:{}:objValue}}assignValue(nested,key,newValue)}nested=nested[key]}return object}var baseSetData=!metaMap?identity:function(func,data){metaMap.set(func,data);return func};function baseSlice(array,start,end){var index=-1,length=array.length;if(start<0){start=-start>length?0:length+start}end=end>length?length:end;if(end<0){end+=length}length=start>end?0:end-start>>>0;start>>>=0;var result=Array(length);while(++index<length){result[index]=array[index+start]}return result}function baseSome(collection,predicate){var result;baseEach(collection,function(value,index,collection){result=predicate(value,index,collection);return!result});return!!result}function baseSortedIndex(array,value,retHighest){var low=0,high=array?array.length:low;if(typeof value=="number"&&value===value&&high<=HALF_MAX_ARRAY_LENGTH){while(low<high){var mid=low+high>>>1,computed=array[mid];if(computed!==null&&!isSymbol(computed)&&(retHighest?computed<=value:computed<value)){low=mid+1}else{high=mid}}return high}return baseSortedIndexBy(array,value,identity,retHighest)}function baseSortedIndexBy(array,value,iteratee,retHighest){value=iteratee(value);var low=0,high=array?array.length:0,valIsNaN=value!==value,valIsNull=value===null,valIsSymbol=isSymbol(value),valIsUndefined=value===undefined;while(low<high){var mid=nativeFloor((low+high)/2),computed=iteratee(array[mid]),othIsDefined=computed!==undefined,othIsNull=computed===null,othIsReflexive=computed===computed,othIsSymbol=isSymbol(computed);if(valIsNaN){var setLow=retHighest||othIsReflexive}else if(valIsUndefined){setLow=othIsReflexive&&(retHighest||othIsDefined)}else if(valIsNull){setLow=othIsReflexive&&othIsDefined&&(retHighest||!othIsNull)}else if(valIsSymbol){setLow=othIsReflexive&&othIsDefined&&!othIsNull&&(retHighest||!othIsSymbol)}else if(othIsNull||othIsSymbol){setLow=false}else{setLow=retHighest?computed<=value:computed<value}if(setLow){low=mid+1}else{high=mid}}return nativeMin(high,MAX_ARRAY_INDEX)}function baseSortedUniq(array,iteratee){var index=-1,length=array.length,resIndex=0,result=[];while(++index<length){var value=array[index],computed=iteratee?iteratee(value):value;if(!index||!eq(computed,seen)){var seen=computed;result[resIndex++]=value===0?0:value}}return result}function baseToNumber(value){if(typeof value=="number"){return value}if(isSymbol(value)){return NAN}return+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 baseUniq(array,iteratee,comparator){var index=-1,includes=arrayIncludes,length=array.length,isCommon=true,result=[],seen=result;if(comparator){isCommon=false;includes=arrayIncludesWith}else if(length>=LARGE_ARRAY_SIZE){var set=iteratee?null:createSet(array);if(set){return setToArray(set)}isCommon=false;includes=cacheHas;seen=new SetCache}else{seen=iteratee?[]:result}outer:while(++index<length){var value=array[index],computed=iteratee?iteratee(value):value;value=comparator||value!==0?value:0;if(isCommon&&computed===computed){var seenIndex=seen.length;while(seenIndex--){if(seen[seenIndex]===computed){continue outer}}if(iteratee){seen.push(computed)}result.push(value)}else if(!includes(seen,computed,comparator)){if(seen!==result){seen.push(computed)}result.push(value)}}return result}function baseUnset(object,path){path=isKey(path,object)?[path]:castPath(path);object=parent(object,path);var key=toKey(last(path));return!(object!=null&&baseHas(object,key))||delete object[key]}function baseUpdate(object,path,updater,customizer){return baseSet(object,path,updater(baseGet(object,path)),customizer)}function baseWhile(array,predicate,isDrop,fromRight){var length=array.length,index=fromRight?length:-1;while((fromRight?index--:++index<length)&&predicate(array[index],index,array)){}return isDrop?baseSlice(array,fromRight?0:index,fromRight?index+1:length):baseSlice(array,fromRight?index+1:0,fromRight?length:index)}function baseWrapperValue(value,actions){var result=value;if(result instanceof LazyWrapper){result=result.value()}return arrayReduce(actions,function(result,action){return action.func.apply(action.thisArg,arrayPush([result],action.args))},result)}function baseXor(arrays,iteratee,comparator){var index=-1,length=arrays.length;while(++index<length){var result=result?arrayPush(baseDifference(result,arrays[index],iteratee,comparator),baseDifference(arrays[index],result,iteratee,comparator)):arrays[index]}return result&&result.length?baseUniq(result,iteratee,comparator):[]}function baseZipObject(props,values,assignFunc){var index=-1,length=props.length,valsLength=values.length,result={};while(++index<length){var value=index<valsLength?values[index]:undefined;assignFunc(result,props[index],value)}return result}function castArrayLikeObject(value){return isArrayLikeObject(value)?value:[]}function castFunction(value){return typeof value=="function"?value:identity}function castPath(value){return isArray(value)?value:stringToPath(value)}function castSlice(array,start,end){var length=array.length;end=end===undefined?length:end;return!start&&end>=length?array:baseSlice(array,start,end)}function cloneBuffer(buffer,isDeep){if(isDeep){return buffer.slice()}var result=new buffer.constructor(buffer.length);buffer.copy(result);return result}function cloneArrayBuffer(arrayBuffer){var result=new arrayBuffer.constructor(arrayBuffer.byteLength);new Uint8Array(result).set(new Uint8Array(arrayBuffer));return result}function cloneDataView(dataView,isDeep){var buffer=isDeep?cloneArrayBuffer(dataView.buffer):dataView.buffer;return new dataView.constructor(buffer,dataView.byteOffset,dataView.byteLength)}function cloneMap(map,isDeep,cloneFunc){var array=isDeep?cloneFunc(mapToArray(map),true):mapToArray(map);return arrayReduce(array,addMapEntry,new map.constructor)}function cloneRegExp(regexp){var result=new regexp.constructor(regexp.source,reFlags.exec(regexp));result.lastIndex=regexp.lastIndex;return result}function cloneSet(set,isDeep,cloneFunc){var array=isDeep?cloneFunc(setToArray(set),true):setToArray(set);return arrayReduce(array,addSetEntry,new set.constructor)}function cloneSymbol(symbol){return symbolValueOf?Object(symbolValueOf.call(symbol)):{}}function cloneTypedArray(typedArray,isDeep){var buffer=isDeep?cloneArrayBuffer(typedArray.buffer):typedArray.buffer;return new typedArray.constructor(buffer,typedArray.byteOffset,typedArray.length)}function compareAscending(value,other){if(value!==other){var valIsDefined=value!==undefined,valIsNull=value===null,valIsReflexive=value===value,valIsSymbol=isSymbol(value);var othIsDefined=other!==undefined,othIsNull=other===null,othIsReflexive=other===other,othIsSymbol=isSymbol(other);if(!othIsNull&&!othIsSymbol&&!valIsSymbol&&value>other||valIsSymbol&&othIsDefined&&othIsReflexive&&!othIsNull&&!othIsSymbol||valIsNull&&othIsDefined&&othIsReflexive||!valIsDefined&&othIsReflexive||!valIsReflexive){return 1}if(!valIsNull&&!valIsSymbol&&!othIsSymbol&&value<other||othIsSymbol&&valIsDefined&&valIsReflexive&&!valIsNull&&!valIsSymbol||othIsNull&&valIsDefined&&valIsReflexive||!othIsDefined&&valIsReflexive||!othIsReflexive){return-1}}return 0}function compareMultiple(object,other,orders){var index=-1,objCriteria=object.criteria,othCriteria=other.criteria,length=objCriteria.length,ordersLength=orders.length;while(++index<length){var result=compareAscending(objCriteria[index],othCriteria[index]);if(result){if(index>=ordersLength){return result}var order=orders[index];return result*(order=="desc"?-1:1)}}return object.index-other.index}function composeArgs(args,partials,holders,isCurried){var argsIndex=-1,argsLength=args.length,holdersLength=holders.length,leftIndex=-1,leftLength=partials.length,rangeLength=nativeMax(argsLength-holdersLength,0),result=Array(leftLength+rangeLength),isUncurried=!isCurried;while(++leftIndex<leftLength){result[leftIndex]=partials[leftIndex]}while(++argsIndex<holdersLength){if(isUncurried||argsIndex<argsLength){result[holders[argsIndex]]=args[argsIndex]}}while(rangeLength--){result[leftIndex++]=args[argsIndex++]}return result}function composeArgsRight(args,partials,holders,isCurried){var argsIndex=-1,argsLength=args.length,holdersIndex=-1,holdersLength=holders.length,rightIndex=-1,rightLength=partials.length,rangeLength=nativeMax(argsLength-holdersLength,0),result=Array(rangeLength+rightLength),isUncurried=!isCurried;while(++argsIndex<rangeLength){result[argsIndex]=args[argsIndex]}var offset=argsIndex;while(++rightIndex<rightLength){result[offset+rightIndex]=partials[rightIndex]}while(++holdersIndex<holdersLength){if(isUncurried||argsIndex<argsLength){result[offset+holders[holdersIndex]]=args[argsIndex++]}}return result}function copyArray(source,array){var index=-1,length=source.length;array||(array=Array(length));while(++index<length){array[index]=source[index]}return array}function copyObject(source,props,object,customizer){object||(object={});var index=-1,length=props.length;while(++index<length){var key=props[index];var newValue=customizer?customizer(object[key],source[key],key,object,source):source[key];assignValue(object,key,newValue)}return object}function copySymbols(source,object){return copyObject(source,getSymbols(source),object)}function createAggregator(setter,initializer){return function(collection,iteratee){var func=isArray(collection)?arrayAggregator:baseAggregator,accumulator=initializer?initializer():{};return func(collection,setter,getIteratee(iteratee),accumulator)}}function createAssigner(assigner){return rest(function(object,sources){
var index=-1,length=sources.length,customizer=length>1?sources[length-1]:undefined,guard=length>2?sources[2]:undefined;customizer=assigner.length>3&&typeof customizer=="function"?(length--,customizer):undefined;if(guard&&isIterateeCall(sources[0],sources[1],guard)){customizer=length<3?undefined:customizer;length=1}object=Object(object);while(++index<length){var source=sources[index];if(source){assigner(object,source,index,customizer)}}return object})}function createBaseEach(eachFunc,fromRight){return function(collection,iteratee){if(collection==null){return collection}if(!isArrayLike(collection)){return eachFunc(collection,iteratee)}var length=collection.length,index=fromRight?length:-1,iterable=Object(collection);while(fromRight?index--:++index<length){if(iteratee(iterable[index],index,iterable)===false){break}}return collection}}function createBaseFor(fromRight){return function(object,iteratee,keysFunc){var index=-1,iterable=Object(object),props=keysFunc(object),length=props.length;while(length--){var key=props[fromRight?length:++index];if(iteratee(iterable[key],key,iterable)===false){break}}return object}}function createBaseWrapper(func,bitmask,thisArg){var isBind=bitmask&BIND_FLAG,Ctor=createCtorWrapper(func);function wrapper(){var fn=this&&this!==root&&this instanceof wrapper?Ctor:func;return fn.apply(isBind?thisArg:this,arguments)}return wrapper}function createCaseFirst(methodName){return function(string){string=toString(string);var strSymbols=reHasComplexSymbol.test(string)?stringToArray(string):undefined;var chr=strSymbols?strSymbols[0]:string.charAt(0);var trailing=strSymbols?castSlice(strSymbols,1).join(""):string.slice(1);return chr[methodName]()+trailing}}function createCompounder(callback){return function(string){return arrayReduce(words(deburr(string).replace(reApos,"")),callback,"")}}function createCtorWrapper(Ctor){return function(){var args=arguments;switch(args.length){case 0:return new Ctor;case 1:return new Ctor(args[0]);case 2:return new Ctor(args[0],args[1]);case 3:return new Ctor(args[0],args[1],args[2]);case 4:return new Ctor(args[0],args[1],args[2],args[3]);case 5:return new Ctor(args[0],args[1],args[2],args[3],args[4]);case 6:return new Ctor(args[0],args[1],args[2],args[3],args[4],args[5]);case 7:return new Ctor(args[0],args[1],args[2],args[3],args[4],args[5],args[6])}var thisBinding=baseCreate(Ctor.prototype),result=Ctor.apply(thisBinding,args);return isObject(result)?result:thisBinding}}function createCurryWrapper(func,bitmask,arity){var Ctor=createCtorWrapper(func);function wrapper(){var length=arguments.length,args=Array(length),index=length,placeholder=getHolder(wrapper);while(index--){args[index]=arguments[index]}var holders=length<3&&args[0]!==placeholder&&args[length-1]!==placeholder?[]:replaceHolders(args,placeholder);length-=holders.length;if(length<arity){return createRecurryWrapper(func,bitmask,createHybridWrapper,wrapper.placeholder,undefined,args,holders,undefined,undefined,arity-length)}var fn=this&&this!==root&&this instanceof wrapper?Ctor:func;return apply(fn,this,args)}return wrapper}function createFind(findIndexFunc){return function(collection,predicate,fromIndex){var iterable=Object(collection);predicate=getIteratee(predicate,3);if(!isArrayLike(collection)){var props=keys(collection)}var index=findIndexFunc(props||collection,function(value,key){if(props){key=value;value=iterable[key]}return predicate(value,key,iterable)},fromIndex);return index>-1?collection[props?props[index]:index]:undefined}}function createFlow(fromRight){return rest(function(funcs){funcs=baseFlatten(funcs,1);var length=funcs.length,index=length,prereq=LodashWrapper.prototype.thru;if(fromRight){funcs.reverse()}while(index--){var func=funcs[index];if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}if(prereq&&!wrapper&&getFuncName(func)=="wrapper"){var wrapper=new LodashWrapper([],true)}}index=wrapper?index:length;while(++index<length){func=funcs[index];var funcName=getFuncName(func),data=funcName=="wrapper"?getData(func):undefined;if(data&&isLaziable(data[0])&&data[1]==(ARY_FLAG|CURRY_FLAG|PARTIAL_FLAG|REARG_FLAG)&&!data[4].length&&data[9]==1){wrapper=wrapper[getFuncName(data[0])].apply(wrapper,data[3])}else{wrapper=func.length==1&&isLaziable(func)?wrapper[funcName]():wrapper.thru(func)}}return function(){var args=arguments,value=args[0];if(wrapper&&args.length==1&&isArray(value)&&value.length>=LARGE_ARRAY_SIZE){return wrapper.plant(value).value()}var index=0,result=length?funcs[index].apply(this,args):value;while(++index<length){result=funcs[index].call(this,result)}return result}})}function createHybridWrapper(func,bitmask,thisArg,partials,holders,partialsRight,holdersRight,argPos,ary,arity){var isAry=bitmask&ARY_FLAG,isBind=bitmask&BIND_FLAG,isBindKey=bitmask&BIND_KEY_FLAG,isCurried=bitmask&(CURRY_FLAG|CURRY_RIGHT_FLAG),isFlip=bitmask&FLIP_FLAG,Ctor=isBindKey?undefined:createCtorWrapper(func);function wrapper(){var length=arguments.length,args=Array(length),index=length;while(index--){args[index]=arguments[index]}if(isCurried){var placeholder=getHolder(wrapper),holdersCount=countHolders(args,placeholder)}if(partials){args=composeArgs(args,partials,holders,isCurried)}if(partialsRight){args=composeArgsRight(args,partialsRight,holdersRight,isCurried)}length-=holdersCount;if(isCurried&&length<arity){var newHolders=replaceHolders(args,placeholder);return createRecurryWrapper(func,bitmask,createHybridWrapper,wrapper.placeholder,thisArg,args,newHolders,argPos,ary,arity-length)}var thisBinding=isBind?thisArg:this,fn=isBindKey?thisBinding[func]:func;length=args.length;if(argPos){args=reorder(args,argPos)}else if(isFlip&&length>1){args.reverse()}if(isAry&&ary<length){args.length=ary}if(this&&this!==root&&this instanceof wrapper){fn=Ctor||createCtorWrapper(fn)}return fn.apply(thisBinding,args)}return wrapper}function createInverter(setter,toIteratee){return function(object,iteratee){return baseInverter(object,setter,toIteratee(iteratee),{})}}function createMathOperation(operator){return function(value,other){var result;if(value===undefined&&other===undefined){return 0}if(value!==undefined){result=value}if(other!==undefined){if(result===undefined){return other}if(typeof value=="string"||typeof other=="string"){value=baseToString(value);other=baseToString(other)}else{value=baseToNumber(value);other=baseToNumber(other)}result=operator(value,other)}return result}}function createOver(arrayFunc){return rest(function(iteratees){iteratees=iteratees.length==1&&isArray(iteratees[0])?arrayMap(iteratees[0],baseUnary(getIteratee())):arrayMap(baseFlatten(iteratees,1,isFlattenableIteratee),baseUnary(getIteratee()));return rest(function(args){var thisArg=this;return arrayFunc(iteratees,function(iteratee){return apply(iteratee,thisArg,args)})})})}function createPadding(length,chars){chars=chars===undefined?" ":baseToString(chars);var charsLength=chars.length;if(charsLength<2){return charsLength?baseRepeat(chars,length):chars}var result=baseRepeat(chars,nativeCeil(length/stringSize(chars)));return reHasComplexSymbol.test(chars)?castSlice(stringToArray(result),0,length).join(""):result.slice(0,length)}function createPartialWrapper(func,bitmask,thisArg,partials){var isBind=bitmask&BIND_FLAG,Ctor=createCtorWrapper(func);function wrapper(){var argsIndex=-1,argsLength=arguments.length,leftIndex=-1,leftLength=partials.length,args=Array(leftLength+argsLength),fn=this&&this!==root&&this instanceof wrapper?Ctor:func;while(++leftIndex<leftLength){args[leftIndex]=partials[leftIndex]}while(argsLength--){args[leftIndex++]=arguments[++argsIndex]}return apply(fn,isBind?thisArg:this,args)}return wrapper}function createRange(fromRight){return function(start,end,step){if(step&&typeof step!="number"&&isIterateeCall(start,end,step)){end=step=undefined}start=toNumber(start);start=start===start?start:0;if(end===undefined){end=start;start=0}else{end=toNumber(end)||0}step=step===undefined?start<end?1:-1:toNumber(step)||0;return baseRange(start,end,step,fromRight)}}function createRelationalOperation(operator){return function(value,other){if(!(typeof value=="string"&&typeof other=="string")){value=toNumber(value);other=toNumber(other)}return operator(value,other)}}function createRecurryWrapper(func,bitmask,wrapFunc,placeholder,thisArg,partials,holders,argPos,ary,arity){var isCurry=bitmask&CURRY_FLAG,newHolders=isCurry?holders:undefined,newHoldersRight=isCurry?undefined:holders,newPartials=isCurry?partials:undefined,newPartialsRight=isCurry?undefined:partials;bitmask|=isCurry?PARTIAL_FLAG:PARTIAL_RIGHT_FLAG;bitmask&=~(isCurry?PARTIAL_RIGHT_FLAG:PARTIAL_FLAG);if(!(bitmask&CURRY_BOUND_FLAG)){bitmask&=~(BIND_FLAG|BIND_KEY_FLAG)}var newData=[func,bitmask,thisArg,newPartials,newHolders,newPartialsRight,newHoldersRight,argPos,ary,arity];var result=wrapFunc.apply(undefined,newData);if(isLaziable(func)){setData(result,newData)}result.placeholder=placeholder;return result}function createRound(methodName){var func=Math[methodName];return function(number,precision){number=toNumber(number);precision=nativeMin(toInteger(precision),292);if(precision){var pair=(toString(number)+"e").split("e"),value=func(pair[0]+"e"+(+pair[1]+precision));pair=(toString(value)+"e").split("e");return+(pair[0]+"e"+(+pair[1]-precision))}return func(number)}}var createSet=!(Set&&1/setToArray(new Set([,-0]))[1]==INFINITY)?noop:function(values){return new Set(values)};function createToPairs(keysFunc){return function(object){var tag=getTag(object);if(tag==mapTag){return mapToArray(object)}if(tag==setTag){return setToPairs(object)}return baseToPairs(object,keysFunc(object))}}function createWrapper(func,bitmask,thisArg,partials,holders,argPos,ary,arity){var isBindKey=bitmask&BIND_KEY_FLAG;if(!isBindKey&&typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}var length=partials?partials.length:0;if(!length){bitmask&=~(PARTIAL_FLAG|PARTIAL_RIGHT_FLAG);partials=holders=undefined}ary=ary===undefined?ary:nativeMax(toInteger(ary),0);arity=arity===undefined?arity:toInteger(arity);length-=holders?holders.length:0;if(bitmask&PARTIAL_RIGHT_FLAG){var partialsRight=partials,holdersRight=holders;partials=holders=undefined}var data=isBindKey?undefined:getData(func);var newData=[func,bitmask,thisArg,partials,holders,partialsRight,holdersRight,argPos,ary,arity];if(data){mergeData(newData,data)}func=newData[0];bitmask=newData[1];thisArg=newData[2];partials=newData[3];holders=newData[4];arity=newData[9]=newData[9]==null?isBindKey?0:func.length:nativeMax(newData[9]-length,0);if(!arity&&bitmask&(CURRY_FLAG|CURRY_RIGHT_FLAG)){bitmask&=~(CURRY_FLAG|CURRY_RIGHT_FLAG)}if(!bitmask||bitmask==BIND_FLAG){var result=createBaseWrapper(func,bitmask,thisArg)}else if(bitmask==CURRY_FLAG||bitmask==CURRY_RIGHT_FLAG){result=createCurryWrapper(func,bitmask,arity)}else if((bitmask==PARTIAL_FLAG||bitmask==(BIND_FLAG|PARTIAL_FLAG))&&!holders.length){result=createPartialWrapper(func,bitmask,thisArg,partials)}else{result=createHybridWrapper.apply(undefined,newData)}var setter=data?baseSetData:setData;return setter(result,newData)}function equalArrays(array,other,equalFunc,customizer,bitmask,stack){var isPartial=bitmask&PARTIAL_COMPARE_FLAG,arrLength=array.length,othLength=other.length;if(arrLength!=othLength&&!(isPartial&&othLength>arrLength)){return false}var stacked=stack.get(array);if(stacked){return stacked==other}var index=-1,result=true,seen=bitmask&UNORDERED_COMPARE_FLAG?new SetCache:undefined;stack.set(array,other);while(++index<arrLength){var arrValue=array[index],othValue=other[index];if(customizer){var compared=isPartial?customizer(othValue,arrValue,index,other,array,stack):customizer(arrValue,othValue,index,array,other,stack)}if(compared!==undefined){if(compared){continue}result=false;break}if(seen){if(!arraySome(other,function(othValue,othIndex){if(!seen.has(othIndex)&&(arrValue===othValue||equalFunc(arrValue,othValue,customizer,bitmask,stack))){return seen.add(othIndex)}})){result=false;break}}else if(!(arrValue===othValue||equalFunc(arrValue,othValue,customizer,bitmask,stack))){result=false;break}}stack["delete"](array);return result}function equalByTag(object,other,tag,equalFunc,customizer,bitmask,stack){switch(tag){case dataViewTag:if(object.byteLength!=other.byteLength||object.byteOffset!=other.byteOffset){return false}object=object.buffer;other=other.buffer;case arrayBufferTag:if(object.byteLength!=other.byteLength||!equalFunc(new Uint8Array(object),new Uint8Array(other))){return false}return true;case boolTag:case dateTag:return+object==+other;case errorTag:return object.name==other.name&&object.message==other.message;case numberTag:return object!=+object?other!=+other:object==+other;case regexpTag:case stringTag:return object==other+"";case mapTag:var convert=mapToArray;case setTag:var isPartial=bitmask&PARTIAL_COMPARE_FLAG;convert||(convert=setToArray);if(object.size!=other.size&&!isPartial){return false}var stacked=stack.get(object);if(stacked){return stacked==other}bitmask|=UNORDERED_COMPARE_FLAG;stack.set(object,other);return equalArrays(convert(object),convert(other),equalFunc,customizer,bitmask,stack);case symbolTag:if(symbolValueOf){return symbolValueOf.call(object)==symbolValueOf.call(other)}}return false}function equalObjects(object,other,equalFunc,customizer,bitmask,stack){var isPartial=bitmask&PARTIAL_COMPARE_FLAG,objProps=keys(object),objLength=objProps.length,othProps=keys(other),othLength=othProps.length;if(objLength!=othLength&&!isPartial){return false}var index=objLength;while(index--){var key=objProps[index];if(!(isPartial?key in other:baseHas(other,key))){return false}}var stacked=stack.get(object);if(stacked){return stacked==other}var result=true;stack.set(object,other);var skipCtor=isPartial;while(++index<objLength){key=objProps[index];var objValue=object[key],othValue=other[key];if(customizer){var compared=isPartial?customizer(othValue,objValue,key,other,object,stack):customizer(objValue,othValue,key,object,other,stack)}if(!(compared===undefined?objValue===othValue||equalFunc(objValue,othValue,customizer,bitmask,stack):compared)){result=false;break}skipCtor||(skipCtor=key=="constructor")}if(result&&!skipCtor){var objCtor=object.constructor,othCtor=other.constructor;if(objCtor!=othCtor&&("constructor"in object&&"constructor"in other)&&!(typeof objCtor=="function"&&objCtor instanceof objCtor&&typeof othCtor=="function"&&othCtor instanceof othCtor)){result=false}}stack["delete"](object);return result}function getAllKeys(object){return baseGetAllKeys(object,keys,getSymbols)}function getAllKeysIn(object){return baseGetAllKeys(object,keysIn,getSymbolsIn)}var getData=!metaMap?noop:function(func){return metaMap.get(func)};function getFuncName(func){var result=func.name+"",array=realNames[result],length=hasOwnProperty.call(realNames,result)?array.length:0;while(length--){var data=array[length],otherFunc=data.func;if(otherFunc==null||otherFunc==func){return data.name}}return result}function getHolder(func){var object=hasOwnProperty.call(lodash,"placeholder")?lodash:func;return object.placeholder}function getIteratee(){var result=lodash.iteratee||iteratee;result=result===iteratee?baseIteratee:result;return arguments.length?result(arguments[0],arguments[1]):result}var getLength=baseProperty("length");function getMapData(map,key){var data=map.__data__;return isKeyable(key)?data[typeof key=="string"?"string":"hash"]:data.map}function getMatchData(object){var result=keys(object),length=result.length;while(length--){var key=result[length],value=object[key];result[length]=[key,value,isStrictComparable(value)]}return result}function getNative(object,key){var value=getValue(object,key);return baseIsNative(value)?value:undefined}function getPrototype(value){return nativeGetPrototype(Object(value))}function getSymbols(object){return getOwnPropertySymbols(Object(object))}if(!getOwnPropertySymbols){getSymbols=stubArray}var getSymbolsIn=!getOwnPropertySymbols?getSymbols:function(object){var result=[];while(object){arrayPush(result,getSymbols(object));object=getPrototype(object)}return result};function getTag(value){return objectToString.call(value)}if(DataView&&getTag(new DataView(new ArrayBuffer(1)))!=dataViewTag||Map&&getTag(new Map)!=mapTag||Promise&&getTag(Promise.resolve())!=promiseTag||Set&&getTag(new Set)!=setTag||WeakMap&&getTag(new WeakMap)!=weakMapTag){getTag=function(value){var result=objectToString.call(value),Ctor=result==objectTag?value.constructor:undefined,ctorString=Ctor?toSource(Ctor):undefined;if(ctorString){switch(ctorString){case dataViewCtorString:return dataViewTag;case mapCtorString:return mapTag;case promiseCtorString:return promiseTag;case setCtorString:return setTag;case weakMapCtorString:return weakMapTag}}return result}}function getView(start,end,transforms){var index=-1,length=transforms.length;while(++index<length){var data=transforms[index],size=data.size;switch(data.type){case"drop":start+=size;break;case"dropRight":end-=size;break;case"take":end=nativeMin(end,start+size);break;case"takeRight":start=nativeMax(start,end-size);break}}return{start:start,end:end}}function hasPath(object,path,hasFunc){path=isKey(path,object)?[path]:castPath(path);var result,index=-1,length=path.length;while(++index<length){var key=toKey(path[index]);if(!(result=object!=null&&hasFunc(object,key))){break}object=object[key]}if(result){return result}var length=object?object.length:0;return!!length&&isLength(length)&&isIndex(key,length)&&(isArray(object)||isString(object)||isArguments(object))}function initCloneArray(array){var length=array.length,result=array.constructor(length);if(length&&typeof array[0]=="string"&&hasOwnProperty.call(array,"index")){result.index=array.index;result.input=array.input}return result}function initCloneObject(object){return typeof object.constructor=="function"&&!isPrototype(object)?baseCreate(getPrototype(object)):{}}function initCloneByTag(object,tag,cloneFunc,isDeep){var Ctor=object.constructor;switch(tag){case arrayBufferTag:return cloneArrayBuffer(object);case boolTag:case dateTag:return new Ctor(+object);case dataViewTag:return cloneDataView(object,isDeep);case float32Tag:case float64Tag:case int8Tag:case int16Tag:case int32Tag:case uint8Tag:case uint8ClampedTag:case uint16Tag:case uint32Tag:return cloneTypedArray(object,isDeep);case mapTag:return cloneMap(object,isDeep,cloneFunc);case numberTag:case stringTag:return new Ctor(object);case regexpTag:return cloneRegExp(object);case setTag:return cloneSet(object,isDeep,cloneFunc);case symbolTag:return cloneSymbol(object)}}function indexKeys(object){var length=object?object.length:undefined;if(isLength(length)&&(isArray(object)||isString(object)||isArguments(object))){return baseTimes(length,String)}return null}function isFlattenable(value){return isArray(value)||isArguments(value)}function isFlattenableIteratee(value){return isArray(value)&&!(value.length==2&&!isFunction(value[0]))}function isIndex(value,length){length=length==null?MAX_SAFE_INTEGER:length;return!!length&&(typeof value=="number"||reIsUint.test(value))&&(value>-1&&value%1==0&&value<length)}function isIterateeCall(value,index,object){if(!isObject(object)){return false}var type=typeof index;if(type=="number"?isArrayLike(object)&&isIndex(index,object.length):type=="string"&&index in object){return eq(object[index],value)}return false}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 isLaziable(func){var funcName=getFuncName(func),other=lodash[funcName];if(typeof other!="function"||!(funcName in LazyWrapper.prototype)){return false}if(func===other){return true}var data=getData(other);return!!data&&func===data[0]}function isMasked(func){return!!maskSrcKey&&maskSrcKey in func}var isMaskable=coreJsData?isFunction:stubFalse;function isPrototype(value){var Ctor=value&&value.constructor,proto=typeof Ctor=="function"&&Ctor.prototype||objectProto;return value===proto}function isStrictComparable(value){return value===value&&!isObject(value)}function matchesStrictComparable(key,srcValue){return function(object){if(object==null){return false}return object[key]===srcValue&&(srcValue!==undefined||key in Object(object))}}function mergeData(data,source){var bitmask=data[1],srcBitmask=source[1],newBitmask=bitmask|srcBitmask,isCommon=newBitmask<(BIND_FLAG|BIND_KEY_FLAG|ARY_FLAG);var isCombo=srcBitmask==ARY_FLAG&&bitmask==CURRY_FLAG||srcBitmask==ARY_FLAG&&bitmask==REARG_FLAG&&data[7].length<=source[8]||srcBitmask==(ARY_FLAG|REARG_FLAG)&&source[7].length<=source[8]&&bitmask==CURRY_FLAG;if(!(isCommon||isCombo)){return data}if(srcBitmask&BIND_FLAG){data[2]=source[2];newBitmask|=bitmask&BIND_FLAG?0:CURRY_BOUND_FLAG}var value=source[3];if(value){var partials=data[3];data[3]=partials?composeArgs(partials,value,source[4]):value;data[4]=partials?replaceHolders(data[3],PLACEHOLDER):source[4]}value=source[5];if(value){partials=data[5];data[5]=partials?composeArgsRight(partials,value,source[6]):value;data[6]=partials?replaceHolders(data[5],PLACEHOLDER):source[6]}value=source[7];if(value){data[7]=value}if(srcBitmask&ARY_FLAG){data[8]=data[8]==null?source[8]:nativeMin(data[8],source[8])}if(data[9]==null){data[9]=source[9]}data[0]=source[0];data[1]=newBitmask;return data}function mergeDefaults(objValue,srcValue,key,object,source,stack){if(isObject(objValue)&&isObject(srcValue)){baseMerge(objValue,srcValue,undefined,mergeDefaults,stack.set(srcValue,objValue))}return objValue}function parent(object,path){return path.length==1?object:baseGet(object,baseSlice(path,0,-1))}function reorder(array,indexes){var arrLength=array.length,length=nativeMin(indexes.length,arrLength),oldArray=copyArray(array);while(length--){var index=indexes[length];array[length]=isIndex(index,arrLength)?oldArray[index]:undefined}return array}var setData=function(){var count=0,lastCalled=0;return function(key,value){var stamp=now(),remaining=HOT_SPAN-(stamp-lastCalled);lastCalled=stamp;if(remaining>0){if(++count>=HOT_COUNT){return key}}else{count=0}return baseSetData(key,value)}}();var stringToPath=memoize(function(string){var result=[];toString(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 wrapperClone(wrapper){if(wrapper instanceof LazyWrapper){return wrapper.clone()}var result=new LodashWrapper(wrapper.__wrapped__,wrapper.__chain__);result.__actions__=copyArray(wrapper.__actions__);result.__index__=wrapper.__index__;result.__values__=wrapper.__values__;return result}function chunk(array,size,guard){if(guard?isIterateeCall(array,size,guard):size===undefined){size=1}else{size=nativeMax(toInteger(size),0)}var length=array?array.length:0;if(!length||size<1){return[]}var index=0,resIndex=0,result=Array(nativeCeil(length/size));while(index<length){result[resIndex++]=baseSlice(array,index,index+=size)}return result}function compact(array){var index=-1,length=array?array.length:0,resIndex=0,result=[];while(++index<length){var value=array[index];if(value){result[resIndex++]=value}}return result}function concat(){var length=arguments.length,args=Array(length?length-1:0),array=arguments[0],index=length;while(index--){args[index-1]=arguments[index]}return length?arrayPush(isArray(array)?copyArray(array):[array],baseFlatten(args,1)):[]}var difference=rest(function(array,values){return isArrayLikeObject(array)?baseDifference(array,baseFlatten(values,1,isArrayLikeObject,true)):[]});var differenceBy=rest(function(array,values){var iteratee=last(values);if(isArrayLikeObject(iteratee)){iteratee=undefined}return isArrayLikeObject(array)?baseDifference(array,baseFlatten(values,1,isArrayLikeObject,true),getIteratee(iteratee)):[]});var differenceWith=rest(function(array,values){var comparator=last(values);if(isArrayLikeObject(comparator)){comparator=undefined}return isArrayLikeObject(array)?baseDifference(array,baseFlatten(values,1,isArrayLikeObject,true),undefined,comparator):[]});function drop(array,n,guard){var length=array?array.length:0;if(!length){return[]}n=guard||n===undefined?1:toInteger(n);return baseSlice(array,n<0?0:n,length)}function dropRight(array,n,guard){var length=array?array.length:0;if(!length){return[]}n=guard||n===undefined?1:toInteger(n);n=length-n;return baseSlice(array,0,n<0?0:n)}function dropRightWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3),true,true):[]}function dropWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3),true):[]}function fill(array,value,start,end){var length=array?array.length:0;if(!length){return[]}if(start&&typeof start!="number"&&isIterateeCall(array,value,start)){start=0;end=length}return baseFill(array,value,start,end)}function findIndex(array,predicate,fromIndex){var length=array?array.length:0;if(!length){return-1}var index=fromIndex==null?0:toInteger(fromIndex);if(index<0){index=nativeMax(length+index,0)}return baseFindIndex(array,getIteratee(predicate,3),index)}function findLastIndex(array,predicate,fromIndex){var length=array?array.length:0;if(!length){return-1}var index=length-1;if(fromIndex!==undefined){index=toInteger(fromIndex);index=fromIndex<0?nativeMax(length+index,0):nativeMin(index,length-1)}return baseFindIndex(array,getIteratee(predicate,3),index,true)}function flatten(array){var length=array?array.length:0;return length?baseFlatten(array,1):[]}function flattenDeep(array){var length=array?array.length:0;return length?baseFlatten(array,INFINITY):[]}function flattenDepth(array,depth){var length=array?array.length:0;if(!length){return[]}depth=depth===undefined?1:toInteger(depth);return baseFlatten(array,depth)}function fromPairs(pairs){var index=-1,length=pairs?pairs.length:0,result={};while(++index<length){var pair=pairs[index];result[pair[0]]=pair[1]}return result}function head(array){return array&&array.length?array[0]:undefined}function indexOf(array,value,fromIndex){var length=array?array.length:0;if(!length){return-1}var index=fromIndex==null?0:toInteger(fromIndex);if(index<0){index=nativeMax(length+index,0)}return baseIndexOf(array,value,index)}function initial(array){return dropRight(array,1)}var intersection=rest(function(arrays){var mapped=arrayMap(arrays,castArrayLikeObject);return mapped.length&&mapped[0]===arrays[0]?baseIntersection(mapped):[]});var intersectionBy=rest(function(arrays){var iteratee=last(arrays),mapped=arrayMap(arrays,castArrayLikeObject);if(iteratee===last(mapped)){iteratee=undefined}else{mapped.pop()}return mapped.length&&mapped[0]===arrays[0]?baseIntersection(mapped,getIteratee(iteratee)):[]});var intersectionWith=rest(function(arrays){var comparator=last(arrays),mapped=arrayMap(arrays,castArrayLikeObject);if(comparator===last(mapped)){comparator=undefined}else{mapped.pop()}return mapped.length&&mapped[0]===arrays[0]?baseIntersection(mapped,undefined,comparator):[]});function join(array,separator){return array?nativeJoin.call(array,separator):""}function last(array){var length=array?array.length:0;return length?array[length-1]:undefined}function lastIndexOf(array,value,fromIndex){var length=array?array.length:0;if(!length){return-1}var index=length;if(fromIndex!==undefined){index=toInteger(fromIndex);index=(index<0?nativeMax(length+index,0):nativeMin(index,length-1))+1}if(value!==value){return indexOfNaN(array,index-1,true)}while(index--){if(array[index]===value){return index}}return-1}function nth(array,n){return array&&array.length?baseNth(array,toInteger(n)):undefined}var pull=rest(pullAll);function pullAll(array,values){return array&&array.length&&values&&values.length?basePullAll(array,values):array}function pullAllBy(array,values,iteratee){return array&&array.length&&values&&values.length?basePullAll(array,values,getIteratee(iteratee)):array}function pullAllWith(array,values,comparator){return array&&array.length&&values&&values.length?basePullAll(array,values,undefined,comparator):array}var pullAt=rest(function(array,indexes){indexes=baseFlatten(indexes,1);var length=array?array.length:0,result=baseAt(array,indexes);basePullAt(array,arrayMap(indexes,function(index){return isIndex(index,length)?+index:index}).sort(compareAscending));return result});function remove(array,predicate){var result=[];if(!(array&&array.length)){return result}var index=-1,indexes=[],length=array.length;predicate=getIteratee(predicate,3);while(++index<length){var value=array[index];if(predicate(value,index,array)){result.push(value);indexes.push(index)}}basePullAt(array,indexes);return result}function reverse(array){return array?nativeReverse.call(array):array}function slice(array,start,end){var length=array?array.length:0;if(!length){return[]}if(end&&typeof end!="number"&&isIterateeCall(array,start,end)){start=0;end=length}else{start=start==null?0:toInteger(start);end=end===undefined?length:toInteger(end)}return baseSlice(array,start,end)}function sortedIndex(array,value){return baseSortedIndex(array,value)}function sortedIndexBy(array,value,iteratee){return baseSortedIndexBy(array,value,getIteratee(iteratee))}function sortedIndexOf(array,value){var length=array?array.length:0;if(length){var index=baseSortedIndex(array,value);if(index<length&&eq(array[index],value)){return index}}return-1}function sortedLastIndex(array,value){return baseSortedIndex(array,value,true)}function sortedLastIndexBy(array,value,iteratee){return baseSortedIndexBy(array,value,getIteratee(iteratee),true)}function sortedLastIndexOf(array,value){var length=array?array.length:0;if(length){var index=baseSortedIndex(array,value,true)-1;if(eq(array[index],value)){return index}}return-1}function sortedUniq(array){return array&&array.length?baseSortedUniq(array):[]}function sortedUniqBy(array,iteratee){return array&&array.length?baseSortedUniq(array,getIteratee(iteratee)):[]}function tail(array){return drop(array,1)}function take(array,n,guard){if(!(array&&array.length)){return[]}n=guard||n===undefined?1:toInteger(n);return baseSlice(array,0,n<0?0:n)}function takeRight(array,n,guard){var length=array?array.length:0;if(!length){return[]}n=guard||n===undefined?1:toInteger(n);n=length-n;return baseSlice(array,n<0?0:n,length)}function takeRightWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3),false,true):[]}function takeWhile(array,predicate){return array&&array.length?baseWhile(array,getIteratee(predicate,3)):[]}var union=rest(function(arrays){return baseUniq(baseFlatten(arrays,1,isArrayLikeObject,true))});var unionBy=rest(function(arrays){var iteratee=last(arrays);if(isArrayLikeObject(iteratee)){iteratee=undefined}return baseUniq(baseFlatten(arrays,1,isArrayLikeObject,true),getIteratee(iteratee))});var unionWith=rest(function(arrays){var comparator=last(arrays);if(isArrayLikeObject(comparator)){comparator=undefined}return baseUniq(baseFlatten(arrays,1,isArrayLikeObject,true),undefined,comparator)});function uniq(array){return array&&array.length?baseUniq(array):[]}function uniqBy(array,iteratee){return array&&array.length?baseUniq(array,getIteratee(iteratee)):[]}function uniqWith(array,comparator){return array&&array.length?baseUniq(array,undefined,comparator):[]}function unzip(array){if(!(array&&array.length)){return[]}var length=0;array=arrayFilter(array,function(group){if(isArrayLikeObject(group)){length=nativeMax(group.length,length);return true}});return baseTimes(length,function(index){return arrayMap(array,baseProperty(index))})}function unzipWith(array,iteratee){if(!(array&&array.length)){
return[]}var result=unzip(array);if(iteratee==null){return result}return arrayMap(result,function(group){return apply(iteratee,undefined,group)})}var without=rest(function(array,values){return isArrayLikeObject(array)?baseDifference(array,values):[]});var xor=rest(function(arrays){return baseXor(arrayFilter(arrays,isArrayLikeObject))});var xorBy=rest(function(arrays){var iteratee=last(arrays);if(isArrayLikeObject(iteratee)){iteratee=undefined}return baseXor(arrayFilter(arrays,isArrayLikeObject),getIteratee(iteratee))});var xorWith=rest(function(arrays){var comparator=last(arrays);if(isArrayLikeObject(comparator)){comparator=undefined}return baseXor(arrayFilter(arrays,isArrayLikeObject),undefined,comparator)});var zip=rest(unzip);function zipObject(props,values){return baseZipObject(props||[],values||[],assignValue)}function zipObjectDeep(props,values){return baseZipObject(props||[],values||[],baseSet)}var zipWith=rest(function(arrays){var length=arrays.length,iteratee=length>1?arrays[length-1]:undefined;iteratee=typeof iteratee=="function"?(arrays.pop(),iteratee):undefined;return unzipWith(arrays,iteratee)});function chain(value){var result=lodash(value);result.__chain__=true;return result}function tap(value,interceptor){interceptor(value);return value}function thru(value,interceptor){return interceptor(value)}var wrapperAt=rest(function(paths){paths=baseFlatten(paths,1);var length=paths.length,start=length?paths[0]:0,value=this.__wrapped__,interceptor=function(object){return baseAt(object,paths)};if(length>1||this.__actions__.length||!(value instanceof LazyWrapper)||!isIndex(start)){return this.thru(interceptor)}value=value.slice(start,+start+(length?1:0));value.__actions__.push({func:thru,args:[interceptor],thisArg:undefined});return new LodashWrapper(value,this.__chain__).thru(function(array){if(length&&!array.length){array.push(undefined)}return array})});function wrapperChain(){return chain(this)}function wrapperCommit(){return new LodashWrapper(this.value(),this.__chain__)}function wrapperNext(){if(this.__values__===undefined){this.__values__=toArray(this.value())}var done=this.__index__>=this.__values__.length,value=done?undefined:this.__values__[this.__index__++];return{done:done,value:value}}function wrapperToIterator(){return this}function wrapperPlant(value){var result,parent=this;while(parent instanceof baseLodash){var clone=wrapperClone(parent);clone.__index__=0;clone.__values__=undefined;if(result){previous.__wrapped__=clone}else{result=clone}var previous=clone;parent=parent.__wrapped__}previous.__wrapped__=value;return result}function wrapperReverse(){var value=this.__wrapped__;if(value instanceof LazyWrapper){var wrapped=value;if(this.__actions__.length){wrapped=new LazyWrapper(this)}wrapped=wrapped.reverse();wrapped.__actions__.push({func:thru,args:[reverse],thisArg:undefined});return new LodashWrapper(wrapped,this.__chain__)}return this.thru(reverse)}function wrapperValue(){return baseWrapperValue(this.__wrapped__,this.__actions__)}var countBy=createAggregator(function(result,value,key){hasOwnProperty.call(result,key)?++result[key]:result[key]=1});function every(collection,predicate,guard){var func=isArray(collection)?arrayEvery:baseEvery;if(guard&&isIterateeCall(collection,predicate,guard)){predicate=undefined}return func(collection,getIteratee(predicate,3))}function filter(collection,predicate){var func=isArray(collection)?arrayFilter:baseFilter;return func(collection,getIteratee(predicate,3))}var find=createFind(findIndex);var findLast=createFind(findLastIndex);function flatMap(collection,iteratee){return baseFlatten(map(collection,iteratee),1)}function flatMapDeep(collection,iteratee){return baseFlatten(map(collection,iteratee),INFINITY)}function flatMapDepth(collection,iteratee,depth){depth=depth===undefined?1:toInteger(depth);return baseFlatten(map(collection,iteratee),depth)}function forEach(collection,iteratee){var func=isArray(collection)?arrayEach:baseEach;return func(collection,getIteratee(iteratee,3))}function forEachRight(collection,iteratee){var func=isArray(collection)?arrayEachRight:baseEachRight;return func(collection,getIteratee(iteratee,3))}var groupBy=createAggregator(function(result,value,key){if(hasOwnProperty.call(result,key)){result[key].push(value)}else{result[key]=[value]}});function includes(collection,value,fromIndex,guard){collection=isArrayLike(collection)?collection:values(collection);fromIndex=fromIndex&&!guard?toInteger(fromIndex):0;var length=collection.length;if(fromIndex<0){fromIndex=nativeMax(length+fromIndex,0)}return isString(collection)?fromIndex<=length&&collection.indexOf(value,fromIndex)>-1:!!length&&baseIndexOf(collection,value,fromIndex)>-1}var invokeMap=rest(function(collection,path,args){var index=-1,isFunc=typeof path=="function",isProp=isKey(path),result=isArrayLike(collection)?Array(collection.length):[];baseEach(collection,function(value){var func=isFunc?path:isProp&&value!=null?value[path]:undefined;result[++index]=func?apply(func,value,args):baseInvoke(value,path,args)});return result});var keyBy=createAggregator(function(result,value,key){result[key]=value});function map(collection,iteratee){var func=isArray(collection)?arrayMap:baseMap;return func(collection,getIteratee(iteratee,3))}function orderBy(collection,iteratees,orders,guard){if(collection==null){return[]}if(!isArray(iteratees)){iteratees=iteratees==null?[]:[iteratees]}orders=guard?undefined:orders;if(!isArray(orders)){orders=orders==null?[]:[orders]}return baseOrderBy(collection,iteratees,orders)}var partition=createAggregator(function(result,value,key){result[key?0:1].push(value)},function(){return[[],[]]});function reduce(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduce:baseReduce,initAccum=arguments.length<3;return func(collection,getIteratee(iteratee,4),accumulator,initAccum,baseEach)}function reduceRight(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduceRight:baseReduce,initAccum=arguments.length<3;return func(collection,getIteratee(iteratee,4),accumulator,initAccum,baseEachRight)}function reject(collection,predicate){var func=isArray(collection)?arrayFilter:baseFilter;predicate=getIteratee(predicate,3);return func(collection,function(value,index,collection){return!predicate(value,index,collection)})}function sample(collection){var array=isArrayLike(collection)?collection:values(collection),length=array.length;return length>0?array[baseRandom(0,length-1)]:undefined}function sampleSize(collection,n,guard){var index=-1,result=toArray(collection),length=result.length,lastIndex=length-1;if(guard?isIterateeCall(collection,n,guard):n===undefined){n=1}else{n=baseClamp(toInteger(n),0,length)}while(++index<n){var rand=baseRandom(index,lastIndex),value=result[rand];result[rand]=result[index];result[index]=value}result.length=n;return result}function shuffle(collection){return sampleSize(collection,MAX_ARRAY_LENGTH)}function size(collection){if(collection==null){return 0}if(isArrayLike(collection)){var result=collection.length;return result&&isString(collection)?stringSize(collection):result}if(isObjectLike(collection)){var tag=getTag(collection);if(tag==mapTag||tag==setTag){return collection.size}}return keys(collection).length}function some(collection,predicate,guard){var func=isArray(collection)?arraySome:baseSome;if(guard&&isIterateeCall(collection,predicate,guard)){predicate=undefined}return func(collection,getIteratee(predicate,3))}var sortBy=rest(function(collection,iteratees){if(collection==null){return[]}var length=iteratees.length;if(length>1&&isIterateeCall(collection,iteratees[0],iteratees[1])){iteratees=[]}else if(length>2&&isIterateeCall(iteratees[0],iteratees[1],iteratees[2])){iteratees=[iteratees[0]]}iteratees=iteratees.length==1&&isArray(iteratees[0])?iteratees[0]:baseFlatten(iteratees,1,isFlattenableIteratee);return baseOrderBy(collection,iteratees,[])});function now(){return Date.now()}function after(n,func){if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}n=toInteger(n);return function(){if(--n<1){return func.apply(this,arguments)}}}function ary(func,n,guard){n=guard?undefined:n;n=func&&n==null?func.length:n;return createWrapper(func,ARY_FLAG,undefined,undefined,undefined,undefined,n)}function before(n,func){var result;if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}n=toInteger(n);return function(){if(--n>0){result=func.apply(this,arguments)}if(n<=1){func=undefined}return result}}var bind=rest(function(func,thisArg,partials){var bitmask=BIND_FLAG;if(partials.length){var holders=replaceHolders(partials,getHolder(bind));bitmask|=PARTIAL_FLAG}return createWrapper(func,bitmask,thisArg,partials,holders)});var bindKey=rest(function(object,key,partials){var bitmask=BIND_FLAG|BIND_KEY_FLAG;if(partials.length){var holders=replaceHolders(partials,getHolder(bindKey));bitmask|=PARTIAL_FLAG}return createWrapper(key,bitmask,object,partials,holders)});function curry(func,arity,guard){arity=guard?undefined:arity;var result=createWrapper(func,CURRY_FLAG,undefined,undefined,undefined,undefined,undefined,arity);result.placeholder=curry.placeholder;return result}function curryRight(func,arity,guard){arity=guard?undefined:arity;var result=createWrapper(func,CURRY_RIGHT_FLAG,undefined,undefined,undefined,undefined,undefined,arity);result.placeholder=curryRight.placeholder;return result}function debounce(func,wait,options){var lastArgs,lastThis,maxWait,result,timerId,lastCallTime,lastInvokeTime=0,leading=false,maxing=false,trailing=true;if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}wait=toNumber(wait)||0;if(isObject(options)){leading=!!options.leading;maxing="maxWait"in options;maxWait=maxing?nativeMax(toNumber(options.maxWait)||0,wait):maxWait;trailing="trailing"in options?!!options.trailing:trailing}function invokeFunc(time){var args=lastArgs,thisArg=lastThis;lastArgs=lastThis=undefined;lastInvokeTime=time;result=func.apply(thisArg,args);return result}function leadingEdge(time){lastInvokeTime=time;timerId=setTimeout(timerExpired,wait);return leading?invokeFunc(time):result}function remainingWait(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime,result=wait-timeSinceLastCall;return maxing?nativeMin(result,maxWait-timeSinceLastInvoke):result}function shouldInvoke(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime;return lastCallTime===undefined||timeSinceLastCall>=wait||timeSinceLastCall<0||maxing&&timeSinceLastInvoke>=maxWait}function timerExpired(){var time=now();if(shouldInvoke(time)){return trailingEdge(time)}timerId=setTimeout(timerExpired,remainingWait(time))}function trailingEdge(time){timerId=undefined;if(trailing&&lastArgs){return invokeFunc(time)}lastArgs=lastThis=undefined;return result}function cancel(){lastInvokeTime=0;lastArgs=lastCallTime=lastThis=timerId=undefined}function flush(){return timerId===undefined?result:trailingEdge(now())}function debounced(){var time=now(),isInvoking=shouldInvoke(time);lastArgs=arguments;lastThis=this;lastCallTime=time;if(isInvoking){if(timerId===undefined){return leadingEdge(lastCallTime)}if(maxing){timerId=setTimeout(timerExpired,wait);return invokeFunc(lastCallTime)}}if(timerId===undefined){timerId=setTimeout(timerExpired,wait)}return result}debounced.cancel=cancel;debounced.flush=flush;return debounced}var defer=rest(function(func,args){return baseDelay(func,1,args)});var delay=rest(function(func,wait,args){return baseDelay(func,toNumber(wait)||0,args)});function flip(func){return createWrapper(func,FLIP_FLAG)}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 negate(predicate){if(typeof predicate!="function"){throw new TypeError(FUNC_ERROR_TEXT)}return function(){return!predicate.apply(this,arguments)}}function once(func){return before(2,func)}var overArgs=rest(function(func,transforms){transforms=transforms.length==1&&isArray(transforms[0])?arrayMap(transforms[0],baseUnary(getIteratee())):arrayMap(baseFlatten(transforms,1,isFlattenableIteratee),baseUnary(getIteratee()));var funcsLength=transforms.length;return rest(function(args){var index=-1,length=nativeMin(args.length,funcsLength);while(++index<length){args[index]=transforms[index].call(this,args[index])}return apply(func,this,args)})});var partial=rest(function(func,partials){var holders=replaceHolders(partials,getHolder(partial));return createWrapper(func,PARTIAL_FLAG,undefined,partials,holders)});var partialRight=rest(function(func,partials){var holders=replaceHolders(partials,getHolder(partialRight));return createWrapper(func,PARTIAL_RIGHT_FLAG,undefined,partials,holders)});var rearg=rest(function(func,indexes){return createWrapper(func,REARG_FLAG,undefined,undefined,undefined,baseFlatten(indexes,1))});function rest(func,start){if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}start=nativeMax(start===undefined?func.length-1:toInteger(start),0);return function(){var args=arguments,index=-1,length=nativeMax(args.length-start,0),array=Array(length);while(++index<length){array[index]=args[start+index]}switch(start){case 0:return func.call(this,array);case 1:return func.call(this,args[0],array);case 2:return func.call(this,args[0],args[1],array)}var otherArgs=Array(start+1);index=-1;while(++index<start){otherArgs[index]=args[index]}otherArgs[start]=array;return apply(func,this,otherArgs)}}function spread(func,start){if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}start=start===undefined?0:nativeMax(toInteger(start),0);return rest(function(args){var array=args[start],otherArgs=castSlice(args,0,start);if(array){arrayPush(otherArgs,array)}return apply(func,this,otherArgs)})}function throttle(func,wait,options){var leading=true,trailing=true;if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}if(isObject(options)){leading="leading"in options?!!options.leading:leading;trailing="trailing"in options?!!options.trailing:trailing}return debounce(func,wait,{leading:leading,maxWait:wait,trailing:trailing})}function unary(func){return ary(func,1)}function wrap(value,wrapper){wrapper=wrapper==null?identity:wrapper;return partial(wrapper,value)}function castArray(){if(!arguments.length){return[]}var value=arguments[0];return isArray(value)?value:[value]}function clone(value){return baseClone(value,false,true)}function cloneWith(value,customizer){return baseClone(value,false,true,customizer)}function cloneDeep(value){return baseClone(value,true,true)}function cloneDeepWith(value,customizer){return baseClone(value,true,true,customizer)}function eq(value,other){return value===other||value!==value&&other!==other}var gt=createRelationalOperation(baseGt);var gte=createRelationalOperation(function(value,other){return value>=other});function isArguments(value){return isArrayLikeObject(value)&&hasOwnProperty.call(value,"callee")&&(!propertyIsEnumerable.call(value,"callee")||objectToString.call(value)==argsTag)}var isArray=Array.isArray;function isArrayBuffer(value){return isObjectLike(value)&&objectToString.call(value)==arrayBufferTag}function isArrayLike(value){return value!=null&&isLength(getLength(value))&&!isFunction(value)}function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}function isBoolean(value){return value===true||value===false||isObjectLike(value)&&objectToString.call(value)==boolTag}var isBuffer=!Buffer?stubFalse:function(value){return value instanceof Buffer};function isDate(value){return isObjectLike(value)&&objectToString.call(value)==dateTag}function isElement(value){return!!value&&value.nodeType===1&&isObjectLike(value)&&!isPlainObject(value)}function isEmpty(value){if(isArrayLike(value)&&(isArray(value)||isString(value)||isFunction(value.splice)||isArguments(value)||isBuffer(value))){return!value.length}if(isObjectLike(value)){var tag=getTag(value);if(tag==mapTag||tag==setTag){return!value.size}}for(var key in value){if(hasOwnProperty.call(value,key)){return false}}return!(nonEnumShadows&&keys(value).length)}function isEqual(value,other){return baseIsEqual(value,other)}function isEqualWith(value,other,customizer){customizer=typeof customizer=="function"?customizer:undefined;var result=customizer?customizer(value,other):undefined;return result===undefined?baseIsEqual(value,other,customizer):!!result}function isError(value){if(!isObjectLike(value)){return false}return objectToString.call(value)==errorTag||typeof value.message=="string"&&typeof value.name=="string"}function isFinite(value){return typeof value=="number"&&nativeIsFinite(value)}function isFunction(value){var tag=isObject(value)?objectToString.call(value):"";return tag==funcTag||tag==genTag}function isInteger(value){return typeof value=="number"&&value==toInteger(value)}function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return!!value&&(type=="object"||type=="function")}function isObjectLike(value){return!!value&&typeof value=="object"}function isMap(value){return isObjectLike(value)&&getTag(value)==mapTag}function isMatch(object,source){return object===source||baseIsMatch(object,source,getMatchData(source))}function isMatchWith(object,source,customizer){customizer=typeof customizer=="function"?customizer:undefined;return baseIsMatch(object,source,getMatchData(source),customizer)}function isNaN(value){return isNumber(value)&&value!=+value}function isNative(value){if(isMaskable(value)){throw new Error("This method is not supported with `core-js`. Try https://github.com/es-shims.")}return baseIsNative(value)}function isNull(value){return value===null}function isNil(value){return value==null}function isNumber(value){return typeof value=="number"||isObjectLike(value)&&objectToString.call(value)==numberTag}function isPlainObject(value){if(!isObjectLike(value)||objectToString.call(value)!=objectTag||isHostObject(value)){return false}var proto=getPrototype(value);if(proto===null){return true}var Ctor=hasOwnProperty.call(proto,"constructor")&&proto.constructor;return typeof Ctor=="function"&&Ctor instanceof Ctor&&funcToString.call(Ctor)==objectCtorString}function isRegExp(value){return isObject(value)&&objectToString.call(value)==regexpTag}function isSafeInteger(value){return isInteger(value)&&value>=-MAX_SAFE_INTEGER&&value<=MAX_SAFE_INTEGER}function isSet(value){return isObjectLike(value)&&getTag(value)==setTag}function isString(value){return typeof value=="string"||!isArray(value)&&isObjectLike(value)&&objectToString.call(value)==stringTag}function isSymbol(value){return typeof value=="symbol"||isObjectLike(value)&&objectToString.call(value)==symbolTag}function isTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[objectToString.call(value)]}function isUndefined(value){return value===undefined}function isWeakMap(value){return isObjectLike(value)&&getTag(value)==weakMapTag}function isWeakSet(value){return isObjectLike(value)&&objectToString.call(value)==weakSetTag}var lt=createRelationalOperation(baseLt);var lte=createRelationalOperation(function(value,other){return value<=other});function toArray(value){if(!value){return[]}if(isArrayLike(value)){return isString(value)?stringToArray(value):copyArray(value)}if(iteratorSymbol&&value[iteratorSymbol]){return iteratorToArray(value[iteratorSymbol]())}var tag=getTag(value),func=tag==mapTag?mapToArray:tag==setTag?setToArray:values;return func(value)}function toFinite(value){if(!value){return value===0?value:0}value=toNumber(value);if(value===INFINITY||value===-INFINITY){var sign=value<0?-1:1;return sign*MAX_INTEGER}return value===value?value:0}function toInteger(value){var result=toFinite(value),remainder=result%1;return result===result?remainder?result-remainder:result:0}function toLength(value){return value?baseClamp(toInteger(value),0,MAX_ARRAY_LENGTH):0}function toNumber(value){if(typeof value=="number"){return value}if(isSymbol(value)){return NAN}if(isObject(value)){var other=isFunction(value.valueOf)?value.valueOf():value;value=isObject(other)?other+"":other}if(typeof value!="string"){return value===0?value:+value}value=value.replace(reTrim,"");var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}function toPlainObject(value){return copyObject(value,keysIn(value))}function toSafeInteger(value){return baseClamp(toInteger(value),-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER)}function toString(value){return value==null?"":baseToString(value)}var assign=createAssigner(function(object,source){if(nonEnumShadows||isPrototype(source)||isArrayLike(source)){copyObject(source,keys(source),object);return}for(var key in source){if(hasOwnProperty.call(source,key)){assignValue(object,key,source[key])}}});var assignIn=createAssigner(function(object,source){if(nonEnumShadows||isPrototype(source)||isArrayLike(source)){copyObject(source,keysIn(source),object);return}for(var key in source){assignValue(object,key,source[key])}});var assignInWith=createAssigner(function(object,source,srcIndex,customizer){copyObject(source,keysIn(source),object,customizer)});var assignWith=createAssigner(function(object,source,srcIndex,customizer){copyObject(source,keys(source),object,customizer)});var at=rest(function(object,paths){return baseAt(object,baseFlatten(paths,1))});function create(prototype,properties){var result=baseCreate(prototype);return properties?baseAssign(result,properties):result}var defaults=rest(function(args){args.push(undefined,assignInDefaults);return apply(assignInWith,undefined,args)});var defaultsDeep=rest(function(args){args.push(undefined,mergeDefaults);return apply(mergeWith,undefined,args)});function findKey(object,predicate){return baseFindKey(object,getIteratee(predicate,3),baseForOwn)}function findLastKey(object,predicate){return baseFindKey(object,getIteratee(predicate,3),baseForOwnRight)}function forIn(object,iteratee){return object==null?object:baseFor(object,getIteratee(iteratee,3),keysIn)}function forInRight(object,iteratee){return object==null?object:baseForRight(object,getIteratee(iteratee,3),keysIn)}function forOwn(object,iteratee){return object&&baseForOwn(object,getIteratee(iteratee,3))}function forOwnRight(object,iteratee){return object&&baseForOwnRight(object,getIteratee(iteratee,3))}function functions(object){return object==null?[]:baseFunctions(object,keys(object))}function functionsIn(object){return object==null?[]:baseFunctions(object,keysIn(object))}function get(object,path,defaultValue){var result=object==null?undefined:baseGet(object,path);return result===undefined?defaultValue:result}function has(object,path){return object!=null&&hasPath(object,path,baseHas)}function hasIn(object,path){return object!=null&&hasPath(object,path,baseHasIn)}var invert=createInverter(function(result,value,key){result[value]=key},constant(identity));var invertBy=createInverter(function(result,value,key){if(hasOwnProperty.call(result,value)){result[value].push(key)}else{result[value]=[key]}},getIteratee);var invoke=rest(baseInvoke);function keys(object){var isProto=isPrototype(object);if(!(isProto||isArrayLike(object))){return baseKeys(object)}var indexes=indexKeys(object),skipIndexes=!!indexes,result=indexes||[],length=result.length;for(var key in object){if(baseHas(object,key)&&!(skipIndexes&&(key=="length"||isIndex(key,length)))&&!(isProto&&key=="constructor")){result.push(key)}}return result}function keysIn(object){var index=-1,isProto=isPrototype(object),props=baseKeysIn(object),propsLength=props.length,indexes=indexKeys(object),skipIndexes=!!indexes,result=indexes||[],length=result.length;while(++index<propsLength){var key=props[index];if(!(skipIndexes&&(key=="length"||isIndex(key,length)))&&!(key=="constructor"&&(isProto||!hasOwnProperty.call(object,key)))){result.push(key)}}return result}function mapKeys(object,iteratee){var result={};iteratee=getIteratee(iteratee,3);baseForOwn(object,function(value,key,object){result[iteratee(value,key,object)]=value});return result}function mapValues(object,iteratee){var result={};iteratee=getIteratee(iteratee,3);baseForOwn(object,function(value,key,object){result[key]=iteratee(value,key,object)});return result}var merge=createAssigner(function(object,source,srcIndex){baseMerge(object,source,srcIndex)});var mergeWith=createAssigner(function(object,source,srcIndex,customizer){baseMerge(object,source,srcIndex,customizer)});var omit=rest(function(object,props){if(object==null){return{}}props=arrayMap(baseFlatten(props,1),toKey);return basePick(object,baseDifference(getAllKeysIn(object),props))});function omitBy(object,predicate){predicate=getIteratee(predicate);return basePickBy(object,function(value,key){return!predicate(value,key)})}var pick=rest(function(object,props){return object==null?{}:basePick(object,arrayMap(baseFlatten(props,1),toKey))});function pickBy(object,predicate){return object==null?{}:basePickBy(object,getIteratee(predicate))}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}function set(object,path,value){return object==null?object:baseSet(object,path,value)}function setWith(object,path,value,customizer){customizer=typeof customizer=="function"?customizer:undefined;return object==null?object:baseSet(object,path,value,customizer)}var toPairs=createToPairs(keys);var toPairsIn=createToPairs(keysIn);function transform(object,iteratee,accumulator){var isArr=isArray(object)||isTypedArray(object);iteratee=getIteratee(iteratee,4);if(accumulator==null){if(isArr||isObject(object)){var Ctor=object.constructor;if(isArr){accumulator=isArray(object)?new Ctor:[]}else{accumulator=isFunction(Ctor)?baseCreate(getPrototype(object)):{}}}else{accumulator={}}}(isArr?arrayEach:baseForOwn)(object,function(value,index,object){return iteratee(accumulator,value,index,object)});return accumulator}function unset(object,path){return object==null?true:baseUnset(object,path)}function update(object,path,updater){return object==null?object:baseUpdate(object,path,castFunction(updater))}function updateWith(object,path,updater,customizer){customizer=typeof customizer=="function"?customizer:undefined;return object==null?object:baseUpdate(object,path,castFunction(updater),customizer)}function values(object){return object?baseValues(object,keys(object)):[]}function valuesIn(object){return object==null?[]:baseValues(object,keysIn(object))}function clamp(number,lower,upper){if(upper===undefined){upper=lower;lower=undefined}if(upper!==undefined){upper=toNumber(upper);upper=upper===upper?upper:0}if(lower!==undefined){lower=toNumber(lower);lower=lower===lower?lower:0}return baseClamp(toNumber(number),lower,upper)}function inRange(number,start,end){start=toNumber(start)||0;if(end===undefined){end=start;start=0}else{end=toNumber(end)||0}number=toNumber(number);return baseInRange(number,start,end)}function random(lower,upper,floating){if(floating&&typeof floating!="boolean"&&isIterateeCall(lower,upper,floating)){upper=floating=undefined}if(floating===undefined){if(typeof upper=="boolean"){floating=upper;upper=undefined}else if(typeof lower=="boolean"){floating=lower;lower=undefined}}if(lower===undefined&&upper===undefined){lower=0;upper=1}else{lower=toNumber(lower)||0;if(upper===undefined){upper=lower;lower=0}else{upper=toNumber(upper)||0}}if(lower>upper){var temp=lower;lower=upper;upper=temp}if(floating||lower%1||upper%1){var rand=nativeRandom();return nativeMin(lower+rand*(upper-lower+freeParseFloat("1e-"+((rand+"").length-1))),upper)}return baseRandom(lower,upper)}var camelCase=createCompounder(function(result,word,index){word=word.toLowerCase();return result+(index?capitalize(word):word)});function capitalize(string){return upperFirst(toString(string).toLowerCase())}function deburr(string){string=toString(string);return string&&string.replace(reLatin1,deburrLetter).replace(reComboMark,"")}function endsWith(string,target,position){string=toString(string);target=baseToString(target);var length=string.length;position=position===undefined?length:baseClamp(toInteger(position),0,length);position-=target.length;return position>=0&&string.indexOf(target,position)==position}function escape(string){string=toString(string);return string&&reHasUnescapedHtml.test(string)?string.replace(reUnescapedHtml,escapeHtmlChar):string}function escapeRegExp(string){string=toString(string);return string&&reHasRegExpChar.test(string)?string.replace(reRegExpChar,"\\$&"):string}var kebabCase=createCompounder(function(result,word,index){return result+(index?"-":"")+word.toLowerCase()});var lowerCase=createCompounder(function(result,word,index){return result+(index?" ":"")+word.toLowerCase()});var lowerFirst=createCaseFirst("toLowerCase");function pad(string,length,chars){string=toString(string);length=toInteger(length);var strLength=length?stringSize(string):0;if(!length||strLength>=length){return string}var mid=(length-strLength)/2;return createPadding(nativeFloor(mid),chars)+string+createPadding(nativeCeil(mid),chars)}function padEnd(string,length,chars){string=toString(string);length=toInteger(length);var strLength=length?stringSize(string):0;return length&&strLength<length?string+createPadding(length-strLength,chars):string}function padStart(string,length,chars){string=toString(string);length=toInteger(length);var strLength=length?stringSize(string):0;return length&&strLength<length?createPadding(length-strLength,chars)+string:string}function parseInt(string,radix,guard){if(guard||radix==null){radix=0}else if(radix){radix=+radix}string=toString(string).replace(reTrim,"");return nativeParseInt(string,radix||(reHasHexPrefix.test(string)?16:10))}function repeat(string,n,guard){if(guard?isIterateeCall(string,n,guard):n===undefined){n=1}else{n=toInteger(n)}return baseRepeat(toString(string),n)}function replace(){var args=arguments,string=toString(args[0]);return args.length<3?string:nativeReplace.call(string,args[1],args[2])}var snakeCase=createCompounder(function(result,word,index){return result+(index?"_":"")+word.toLowerCase()});function split(string,separator,limit){if(limit&&typeof limit!="number"&&isIterateeCall(string,separator,limit)){separator=limit=undefined}limit=limit===undefined?MAX_ARRAY_LENGTH:limit>>>0;if(!limit){return[]}string=toString(string);if(string&&(typeof separator=="string"||separator!=null&&!isRegExp(separator))){separator=baseToString(separator);if(separator==""&&reHasComplexSymbol.test(string)){return castSlice(stringToArray(string),0,limit)}}return nativeSplit.call(string,separator,limit)}var startCase=createCompounder(function(result,word,index){return result+(index?" ":"")+upperFirst(word)});function startsWith(string,target,position){string=toString(string);position=baseClamp(toInteger(position),0,string.length);return string.lastIndexOf(baseToString(target),position)==position}function template(string,options,guard){var settings=lodash.templateSettings;if(guard&&isIterateeCall(string,options,guard)){options=undefined}string=toString(string);options=assignInWith({},options,settings,assignInDefaults);var imports=assignInWith({},options.imports,settings.imports,assignInDefaults),importsKeys=keys(imports),importsValues=baseValues(imports,importsKeys);var isEscaping,isEvaluating,index=0,interpolate=options.interpolate||reNoMatch,source="__p += '";var reDelimiters=RegExp((options.escape||reNoMatch).source+"|"+interpolate.source+"|"+(interpolate===reInterpolate?reEsTemplate:reNoMatch).source+"|"+(options.evaluate||reNoMatch).source+"|$","g");
var sourceURL="//# sourceURL="+("sourceURL"in options?options.sourceURL:"lodash.templateSources["+ ++templateCounter+"]")+"\n";string.replace(reDelimiters,function(match,escapeValue,interpolateValue,esTemplateValue,evaluateValue,offset){interpolateValue||(interpolateValue=esTemplateValue);source+=string.slice(index,offset).replace(reUnescapedString,escapeStringChar);if(escapeValue){isEscaping=true;source+="' +\n__e("+escapeValue+") +\n'"}if(evaluateValue){isEvaluating=true;source+="';\n"+evaluateValue+";\n__p += '"}if(interpolateValue){source+="' +\n((__t = ("+interpolateValue+")) == null ? '' : __t) +\n'"}index=offset+match.length;return match});source+="';\n";var variable=options.variable;if(!variable){source="with (obj) {\n"+source+"\n}\n"}source=(isEvaluating?source.replace(reEmptyStringLeading,""):source).replace(reEmptyStringMiddle,"$1").replace(reEmptyStringTrailing,"$1;");source="function("+(variable||"obj")+") {\n"+(variable?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(isEscaping?", __e = _.escape":"")+(isEvaluating?", __j = Array.prototype.join;\n"+"function print() { __p += __j.call(arguments, '') }\n":";\n")+source+"return __p\n}";var result=attempt(function(){return Function(importsKeys,sourceURL+"return "+source).apply(undefined,importsValues)});result.source=source;if(isError(result)){throw result}return result}function toLower(value){return toString(value).toLowerCase()}function toUpper(value){return toString(value).toUpperCase()}function trim(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined)){return string.replace(reTrim,"")}if(!string||!(chars=baseToString(chars))){return string}var strSymbols=stringToArray(string),chrSymbols=stringToArray(chars),start=charsStartIndex(strSymbols,chrSymbols),end=charsEndIndex(strSymbols,chrSymbols)+1;return castSlice(strSymbols,start,end).join("")}function trimEnd(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined)){return string.replace(reTrimEnd,"")}if(!string||!(chars=baseToString(chars))){return string}var strSymbols=stringToArray(string),end=charsEndIndex(strSymbols,stringToArray(chars))+1;return castSlice(strSymbols,0,end).join("")}function trimStart(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined)){return string.replace(reTrimStart,"")}if(!string||!(chars=baseToString(chars))){return string}var strSymbols=stringToArray(string),start=charsStartIndex(strSymbols,stringToArray(chars));return castSlice(strSymbols,start).join("")}function truncate(string,options){var length=DEFAULT_TRUNC_LENGTH,omission=DEFAULT_TRUNC_OMISSION;if(isObject(options)){var separator="separator"in options?options.separator:separator;length="length"in options?toInteger(options.length):length;omission="omission"in options?baseToString(options.omission):omission}string=toString(string);var strLength=string.length;if(reHasComplexSymbol.test(string)){var strSymbols=stringToArray(string);strLength=strSymbols.length}if(length>=strLength){return string}var end=length-stringSize(omission);if(end<1){return omission}var result=strSymbols?castSlice(strSymbols,0,end).join(""):string.slice(0,end);if(separator===undefined){return result+omission}if(strSymbols){end+=result.length-end}if(isRegExp(separator)){if(string.slice(end).search(separator)){var match,substring=result;if(!separator.global){separator=RegExp(separator.source,toString(reFlags.exec(separator))+"g")}separator.lastIndex=0;while(match=separator.exec(substring)){var newEnd=match.index}result=result.slice(0,newEnd===undefined?end:newEnd)}}else if(string.indexOf(baseToString(separator),end)!=end){var index=result.lastIndexOf(separator);if(index>-1){result=result.slice(0,index)}}return result+omission}function unescape(string){string=toString(string);return string&&reHasEscapedHtml.test(string)?string.replace(reEscapedHtml,unescapeHtmlChar):string}var upperCase=createCompounder(function(result,word,index){return result+(index?" ":"")+word.toUpperCase()});var upperFirst=createCaseFirst("toUpperCase");function words(string,pattern,guard){string=toString(string);pattern=guard?undefined:pattern;if(pattern===undefined){pattern=reHasComplexWord.test(string)?reComplexWord:reBasicWord}return string.match(pattern)||[]}var attempt=rest(function(func,args){try{return apply(func,undefined,args)}catch(e){return isError(e)?e:new Error(e)}});var bindAll=rest(function(object,methodNames){arrayEach(baseFlatten(methodNames,1),function(key){key=toKey(key);object[key]=bind(object[key],object)});return object});function cond(pairs){var length=pairs?pairs.length:0,toIteratee=getIteratee();pairs=!length?[]:arrayMap(pairs,function(pair){if(typeof pair[1]!="function"){throw new TypeError(FUNC_ERROR_TEXT)}return[toIteratee(pair[0]),pair[1]]});return rest(function(args){var index=-1;while(++index<length){var pair=pairs[index];if(apply(pair[0],this,args)){return apply(pair[1],this,args)}}})}function conforms(source){return baseConforms(baseClone(source,true))}function constant(value){return function(){return value}}var flow=createFlow();var flowRight=createFlow(true);function identity(value){return value}function iteratee(func){return baseIteratee(typeof func=="function"?func:baseClone(func,true))}function matches(source){return baseMatches(baseClone(source,true))}function matchesProperty(path,srcValue){return baseMatchesProperty(path,baseClone(srcValue,true))}var method=rest(function(path,args){return function(object){return baseInvoke(object,path,args)}});var methodOf=rest(function(object,args){return function(path){return baseInvoke(object,path,args)}});function mixin(object,source,options){var props=keys(source),methodNames=baseFunctions(source,props);if(options==null&&!(isObject(source)&&(methodNames.length||!props.length))){options=source;source=object;object=this;methodNames=baseFunctions(source,keys(source))}var chain=!(isObject(options)&&"chain"in options)||!!options.chain,isFunc=isFunction(object);arrayEach(methodNames,function(methodName){var func=source[methodName];object[methodName]=func;if(isFunc){object.prototype[methodName]=function(){var chainAll=this.__chain__;if(chain||chainAll){var result=object(this.__wrapped__),actions=result.__actions__=copyArray(this.__actions__);actions.push({func:func,args:arguments,thisArg:object});result.__chain__=chainAll;return result}return func.apply(object,arrayPush([this.value()],arguments))}}});return object}function noConflict(){if(root._===this){root._=oldDash}return this}function noop(){}function nthArg(n){n=toInteger(n);return rest(function(args){return baseNth(args,n)})}var over=createOver(arrayMap);var overEvery=createOver(arrayEvery);var overSome=createOver(arraySome);function property(path){return isKey(path)?baseProperty(toKey(path)):basePropertyDeep(path)}function propertyOf(object){return function(path){return object==null?undefined:baseGet(object,path)}}var range=createRange();var rangeRight=createRange(true);function stubArray(){return[]}function stubFalse(){return false}function stubObject(){return{}}function stubString(){return""}function stubTrue(){return true}function times(n,iteratee){n=toInteger(n);if(n<1||n>MAX_SAFE_INTEGER){return[]}var index=MAX_ARRAY_LENGTH,length=nativeMin(n,MAX_ARRAY_LENGTH);iteratee=getIteratee(iteratee);n-=MAX_ARRAY_LENGTH;var result=baseTimes(length,iteratee);while(++index<n){iteratee(index)}return result}function toPath(value){if(isArray(value)){return arrayMap(value,toKey)}return isSymbol(value)?[value]:copyArray(stringToPath(value))}function uniqueId(prefix){var id=++idCounter;return toString(prefix)+id}var add=createMathOperation(function(augend,addend){return augend+addend});var ceil=createRound("ceil");var divide=createMathOperation(function(dividend,divisor){return dividend/divisor});var floor=createRound("floor");function max(array){return array&&array.length?baseExtremum(array,identity,baseGt):undefined}function maxBy(array,iteratee){return array&&array.length?baseExtremum(array,getIteratee(iteratee),baseGt):undefined}function mean(array){return baseMean(array,identity)}function meanBy(array,iteratee){return baseMean(array,getIteratee(iteratee))}function min(array){return array&&array.length?baseExtremum(array,identity,baseLt):undefined}function minBy(array,iteratee){return array&&array.length?baseExtremum(array,getIteratee(iteratee),baseLt):undefined}var multiply=createMathOperation(function(multiplier,multiplicand){return multiplier*multiplicand});var round=createRound("round");var subtract=createMathOperation(function(minuend,subtrahend){return minuend-subtrahend});function sum(array){return array&&array.length?baseSum(array,identity):0}function sumBy(array,iteratee){return array&&array.length?baseSum(array,getIteratee(iteratee)):0}lodash.after=after;lodash.ary=ary;lodash.assign=assign;lodash.assignIn=assignIn;lodash.assignInWith=assignInWith;lodash.assignWith=assignWith;lodash.at=at;lodash.before=before;lodash.bind=bind;lodash.bindAll=bindAll;lodash.bindKey=bindKey;lodash.castArray=castArray;lodash.chain=chain;lodash.chunk=chunk;lodash.compact=compact;lodash.concat=concat;lodash.cond=cond;lodash.conforms=conforms;lodash.constant=constant;lodash.countBy=countBy;lodash.create=create;lodash.curry=curry;lodash.curryRight=curryRight;lodash.debounce=debounce;lodash.defaults=defaults;lodash.defaultsDeep=defaultsDeep;lodash.defer=defer;lodash.delay=delay;lodash.difference=difference;lodash.differenceBy=differenceBy;lodash.differenceWith=differenceWith;lodash.drop=drop;lodash.dropRight=dropRight;lodash.dropRightWhile=dropRightWhile;lodash.dropWhile=dropWhile;lodash.fill=fill;lodash.filter=filter;lodash.flatMap=flatMap;lodash.flatMapDeep=flatMapDeep;lodash.flatMapDepth=flatMapDepth;lodash.flatten=flatten;lodash.flattenDeep=flattenDeep;lodash.flattenDepth=flattenDepth;lodash.flip=flip;lodash.flow=flow;lodash.flowRight=flowRight;lodash.fromPairs=fromPairs;lodash.functions=functions;lodash.functionsIn=functionsIn;lodash.groupBy=groupBy;lodash.initial=initial;lodash.intersection=intersection;lodash.intersectionBy=intersectionBy;lodash.intersectionWith=intersectionWith;lodash.invert=invert;lodash.invertBy=invertBy;lodash.invokeMap=invokeMap;lodash.iteratee=iteratee;lodash.keyBy=keyBy;lodash.keys=keys;lodash.keysIn=keysIn;lodash.map=map;lodash.mapKeys=mapKeys;lodash.mapValues=mapValues;lodash.matches=matches;lodash.matchesProperty=matchesProperty;lodash.memoize=memoize;lodash.merge=merge;lodash.mergeWith=mergeWith;lodash.method=method;lodash.methodOf=methodOf;lodash.mixin=mixin;lodash.negate=negate;lodash.nthArg=nthArg;lodash.omit=omit;lodash.omitBy=omitBy;lodash.once=once;lodash.orderBy=orderBy;lodash.over=over;lodash.overArgs=overArgs;lodash.overEvery=overEvery;lodash.overSome=overSome;lodash.partial=partial;lodash.partialRight=partialRight;lodash.partition=partition;lodash.pick=pick;lodash.pickBy=pickBy;lodash.property=property;lodash.propertyOf=propertyOf;lodash.pull=pull;lodash.pullAll=pullAll;lodash.pullAllBy=pullAllBy;lodash.pullAllWith=pullAllWith;lodash.pullAt=pullAt;lodash.range=range;lodash.rangeRight=rangeRight;lodash.rearg=rearg;lodash.reject=reject;lodash.remove=remove;lodash.rest=rest;lodash.reverse=reverse;lodash.sampleSize=sampleSize;lodash.set=set;lodash.setWith=setWith;lodash.shuffle=shuffle;lodash.slice=slice;lodash.sortBy=sortBy;lodash.sortedUniq=sortedUniq;lodash.sortedUniqBy=sortedUniqBy;lodash.split=split;lodash.spread=spread;lodash.tail=tail;lodash.take=take;lodash.takeRight=takeRight;lodash.takeRightWhile=takeRightWhile;lodash.takeWhile=takeWhile;lodash.tap=tap;lodash.throttle=throttle;lodash.thru=thru;lodash.toArray=toArray;lodash.toPairs=toPairs;lodash.toPairsIn=toPairsIn;lodash.toPath=toPath;lodash.toPlainObject=toPlainObject;lodash.transform=transform;lodash.unary=unary;lodash.union=union;lodash.unionBy=unionBy;lodash.unionWith=unionWith;lodash.uniq=uniq;lodash.uniqBy=uniqBy;lodash.uniqWith=uniqWith;lodash.unset=unset;lodash.unzip=unzip;lodash.unzipWith=unzipWith;lodash.update=update;lodash.updateWith=updateWith;lodash.values=values;lodash.valuesIn=valuesIn;lodash.without=without;lodash.words=words;lodash.wrap=wrap;lodash.xor=xor;lodash.xorBy=xorBy;lodash.xorWith=xorWith;lodash.zip=zip;lodash.zipObject=zipObject;lodash.zipObjectDeep=zipObjectDeep;lodash.zipWith=zipWith;lodash.entries=toPairs;lodash.entriesIn=toPairsIn;lodash.extend=assignIn;lodash.extendWith=assignInWith;mixin(lodash,lodash);lodash.add=add;lodash.attempt=attempt;lodash.camelCase=camelCase;lodash.capitalize=capitalize;lodash.ceil=ceil;lodash.clamp=clamp;lodash.clone=clone;lodash.cloneDeep=cloneDeep;lodash.cloneDeepWith=cloneDeepWith;lodash.cloneWith=cloneWith;lodash.deburr=deburr;lodash.divide=divide;lodash.endsWith=endsWith;lodash.eq=eq;lodash.escape=escape;lodash.escapeRegExp=escapeRegExp;lodash.every=every;lodash.find=find;lodash.findIndex=findIndex;lodash.findKey=findKey;lodash.findLast=findLast;lodash.findLastIndex=findLastIndex;lodash.findLastKey=findLastKey;lodash.floor=floor;lodash.forEach=forEach;lodash.forEachRight=forEachRight;lodash.forIn=forIn;lodash.forInRight=forInRight;lodash.forOwn=forOwn;lodash.forOwnRight=forOwnRight;lodash.get=get;lodash.gt=gt;lodash.gte=gte;lodash.has=has;lodash.hasIn=hasIn;lodash.head=head;lodash.identity=identity;lodash.includes=includes;lodash.indexOf=indexOf;lodash.inRange=inRange;lodash.invoke=invoke;lodash.isArguments=isArguments;lodash.isArray=isArray;lodash.isArrayBuffer=isArrayBuffer;lodash.isArrayLike=isArrayLike;lodash.isArrayLikeObject=isArrayLikeObject;lodash.isBoolean=isBoolean;lodash.isBuffer=isBuffer;lodash.isDate=isDate;lodash.isElement=isElement;lodash.isEmpty=isEmpty;lodash.isEqual=isEqual;lodash.isEqualWith=isEqualWith;lodash.isError=isError;lodash.isFinite=isFinite;lodash.isFunction=isFunction;lodash.isInteger=isInteger;lodash.isLength=isLength;lodash.isMap=isMap;lodash.isMatch=isMatch;lodash.isMatchWith=isMatchWith;lodash.isNaN=isNaN;lodash.isNative=isNative;lodash.isNil=isNil;lodash.isNull=isNull;lodash.isNumber=isNumber;lodash.isObject=isObject;lodash.isObjectLike=isObjectLike;lodash.isPlainObject=isPlainObject;lodash.isRegExp=isRegExp;lodash.isSafeInteger=isSafeInteger;lodash.isSet=isSet;lodash.isString=isString;lodash.isSymbol=isSymbol;lodash.isTypedArray=isTypedArray;lodash.isUndefined=isUndefined;lodash.isWeakMap=isWeakMap;lodash.isWeakSet=isWeakSet;lodash.join=join;lodash.kebabCase=kebabCase;lodash.last=last;lodash.lastIndexOf=lastIndexOf;lodash.lowerCase=lowerCase;lodash.lowerFirst=lowerFirst;lodash.lt=lt;lodash.lte=lte;lodash.max=max;lodash.maxBy=maxBy;lodash.mean=mean;lodash.meanBy=meanBy;lodash.min=min;lodash.minBy=minBy;lodash.stubArray=stubArray;lodash.stubFalse=stubFalse;lodash.stubObject=stubObject;lodash.stubString=stubString;lodash.stubTrue=stubTrue;lodash.multiply=multiply;lodash.nth=nth;lodash.noConflict=noConflict;lodash.noop=noop;lodash.now=now;lodash.pad=pad;lodash.padEnd=padEnd;lodash.padStart=padStart;lodash.parseInt=parseInt;lodash.random=random;lodash.reduce=reduce;lodash.reduceRight=reduceRight;lodash.repeat=repeat;lodash.replace=replace;lodash.result=result;lodash.round=round;lodash.runInContext=runInContext;lodash.sample=sample;lodash.size=size;lodash.snakeCase=snakeCase;lodash.some=some;lodash.sortedIndex=sortedIndex;lodash.sortedIndexBy=sortedIndexBy;lodash.sortedIndexOf=sortedIndexOf;lodash.sortedLastIndex=sortedLastIndex;lodash.sortedLastIndexBy=sortedLastIndexBy;lodash.sortedLastIndexOf=sortedLastIndexOf;lodash.startCase=startCase;lodash.startsWith=startsWith;lodash.subtract=subtract;lodash.sum=sum;lodash.sumBy=sumBy;lodash.template=template;lodash.times=times;lodash.toFinite=toFinite;lodash.toInteger=toInteger;lodash.toLength=toLength;lodash.toLower=toLower;lodash.toNumber=toNumber;lodash.toSafeInteger=toSafeInteger;lodash.toString=toString;lodash.toUpper=toUpper;lodash.trim=trim;lodash.trimEnd=trimEnd;lodash.trimStart=trimStart;lodash.truncate=truncate;lodash.unescape=unescape;lodash.uniqueId=uniqueId;lodash.upperCase=upperCase;lodash.upperFirst=upperFirst;lodash.each=forEach;lodash.eachRight=forEachRight;lodash.first=head;mixin(lodash,function(){var source={};baseForOwn(lodash,function(func,methodName){if(!hasOwnProperty.call(lodash.prototype,methodName)){source[methodName]=func}});return source}(),{chain:false});lodash.VERSION=VERSION;arrayEach(["bind","bindKey","curry","curryRight","partial","partialRight"],function(methodName){lodash[methodName].placeholder=lodash});arrayEach(["drop","take"],function(methodName,index){LazyWrapper.prototype[methodName]=function(n){var filtered=this.__filtered__;if(filtered&&!index){return new LazyWrapper(this)}n=n===undefined?1:nativeMax(toInteger(n),0);var result=this.clone();if(filtered){result.__takeCount__=nativeMin(n,result.__takeCount__)}else{result.__views__.push({size:nativeMin(n,MAX_ARRAY_LENGTH),type:methodName+(result.__dir__<0?"Right":"")})}return result};LazyWrapper.prototype[methodName+"Right"]=function(n){return this.reverse()[methodName](n).reverse()}});arrayEach(["filter","map","takeWhile"],function(methodName,index){var type=index+1,isFilter=type==LAZY_FILTER_FLAG||type==LAZY_WHILE_FLAG;LazyWrapper.prototype[methodName]=function(iteratee){var result=this.clone();result.__iteratees__.push({iteratee:getIteratee(iteratee,3),type:type});result.__filtered__=result.__filtered__||isFilter;return result}});arrayEach(["head","last"],function(methodName,index){var takeName="take"+(index?"Right":"");LazyWrapper.prototype[methodName]=function(){return this[takeName](1).value()[0]}});arrayEach(["initial","tail"],function(methodName,index){var dropName="drop"+(index?"":"Right");LazyWrapper.prototype[methodName]=function(){return this.__filtered__?new LazyWrapper(this):this[dropName](1)}});LazyWrapper.prototype.compact=function(){return this.filter(identity)};LazyWrapper.prototype.find=function(predicate){return this.filter(predicate).head()};LazyWrapper.prototype.findLast=function(predicate){return this.reverse().find(predicate)};LazyWrapper.prototype.invokeMap=rest(function(path,args){if(typeof path=="function"){return new LazyWrapper(this)}return this.map(function(value){return baseInvoke(value,path,args)})});LazyWrapper.prototype.reject=function(predicate){predicate=getIteratee(predicate,3);return this.filter(function(value){return!predicate(value)})};LazyWrapper.prototype.slice=function(start,end){start=toInteger(start);var result=this;if(result.__filtered__&&(start>0||end<0)){return new LazyWrapper(result)}if(start<0){result=result.takeRight(-start)}else if(start){result=result.drop(start)}if(end!==undefined){end=toInteger(end);result=end<0?result.dropRight(-end):result.take(end-start)}return result};LazyWrapper.prototype.takeRightWhile=function(predicate){return this.reverse().takeWhile(predicate).reverse()};LazyWrapper.prototype.toArray=function(){return this.take(MAX_ARRAY_LENGTH)};baseForOwn(LazyWrapper.prototype,function(func,methodName){var checkIteratee=/^(?:filter|find|map|reject)|While$/.test(methodName),isTaker=/^(?:head|last)$/.test(methodName),lodashFunc=lodash[isTaker?"take"+(methodName=="last"?"Right":""):methodName],retUnwrapped=isTaker||/^find/.test(methodName);if(!lodashFunc){return}lodash.prototype[methodName]=function(){var value=this.__wrapped__,args=isTaker?[1]:arguments,isLazy=value instanceof LazyWrapper,iteratee=args[0],useLazy=isLazy||isArray(value);var interceptor=function(value){var result=lodashFunc.apply(lodash,arrayPush([value],args));return isTaker&&chainAll?result[0]:result};if(useLazy&&checkIteratee&&typeof iteratee=="function"&&iteratee.length!=1){isLazy=useLazy=false}var chainAll=this.__chain__,isHybrid=!!this.__actions__.length,isUnwrapped=retUnwrapped&&!chainAll,onlyLazy=isLazy&&!isHybrid;if(!retUnwrapped&&useLazy){value=onlyLazy?value:new LazyWrapper(this);var result=func.apply(value,args);result.__actions__.push({func:thru,args:[interceptor],thisArg:undefined});return new LodashWrapper(result,chainAll)}if(isUnwrapped&&onlyLazy){return func.apply(this,args)}result=this.thru(interceptor);return isUnwrapped?isTaker?result.value()[0]:result.value():result}});arrayEach(["pop","push","shift","sort","splice","unshift"],function(methodName){var func=arrayProto[methodName],chainName=/^(?:push|sort|unshift)$/.test(methodName)?"tap":"thru",retUnwrapped=/^(?:pop|shift)$/.test(methodName);lodash.prototype[methodName]=function(){var args=arguments;if(retUnwrapped&&!this.__chain__){var value=this.value();return func.apply(isArray(value)?value:[],args)}return this[chainName](function(value){return func.apply(isArray(value)?value:[],args)})}});baseForOwn(LazyWrapper.prototype,function(func,methodName){var lodashFunc=lodash[methodName];if(lodashFunc){var key=lodashFunc.name+"",names=realNames[key]||(realNames[key]=[]);names.push({name:methodName,func:lodashFunc})}});realNames[createHybridWrapper(undefined,BIND_KEY_FLAG).name]=[{name:"wrapper",func:undefined}];LazyWrapper.prototype.clone=lazyClone;LazyWrapper.prototype.reverse=lazyReverse;LazyWrapper.prototype.value=lazyValue;lodash.prototype.at=wrapperAt;lodash.prototype.chain=wrapperChain;lodash.prototype.commit=wrapperCommit;lodash.prototype.next=wrapperNext;lodash.prototype.plant=wrapperPlant;lodash.prototype.reverse=wrapperReverse;lodash.prototype.toJSON=lodash.prototype.valueOf=lodash.prototype.value=wrapperValue;if(iteratorSymbol){lodash.prototype[iteratorSymbol]=wrapperToIterator}return lodash}var _=runInContext();(freeSelf||{})._=_;if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define(function(){return _})}else if(freeModule){(freeModule.exports=_)._=_;freeExports._=_}else{root._=_}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[]);var universe=require("universe");var _=require("lodash");var myUniverse=null;var queryRes=null;var data=[{animal:"cat",value:3},{animal:"dog",value:8},{animal:"monkey",value:2},{animal:"monkey",value:9},{animal:"marmot",value:7},{animal:"bird",value:100}];universe(data).then(function(instance){myUniverse=instance;return instance.query({groupBy:"animal",select:{$dataList:true}})}).then(function(res){console.log("query results are ready...");queryRes=res;return res.universe}).then(logQuery);setTimeout(tweakFilter2,1e3);function tweakFilter1(){myUniverse.filter("animal","monkey").then(logQuery)}function tweakFilter2(){console.log("Filtering....");myUniverse.filter("value",9).then(logQuery)}function tweakFilter3(){myUniverse.filter("value",[Math.random(),10*Math.random()],true).then(logQuery)}function logQuery(result){console.log(JSON.stringify(queryRes.data,null,2))}},0);
{
"name": "requirebin-sketch",
"version": "1.0.0",
"dependencies": {
"universe": "0.6.4",
"lodash": "4.13.1"
}
}
<!-- contents of this file will be placed inside the <body> -->
<!-- contents of this file will be placed inside the <head> -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment