Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vega-dataflow

Package Overview
Dependencies
Maintainers
2
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-dataflow - npm Package Compare versions

Comparing version 2.0.0-beta to 2.0.0-beta.1

4

build/vega-dataflow.min.js

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vega-util"),require("vega-loader"),require("vega-statistics"),require("d3-array")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-loader","vega-statistics","d3-array"],e):e(t.vega=t.vega||{},t.vega,t.vega,t.vega,t.d3)}(this,function(t,e,i,n,r){"use strict";function s(t){var i=t||e.identity,n=[],r={};return n.add=function(t){var e=i(t);return r[e]||(r[e]=1,n.push(t)),n},n.remove=function(t){var e,s=i(t);return r[s]&&(r[s]=0,(e=n.indexOf(t))>=0&&n.splice(e,1)),n},n}function a(t){return t._id}function u(t,e){for(var i in t)"_id"!==i&&(e[i]=t[i]);return e}function o(t){var e=t===Object(t)?t:{data:t};return e._id||(e._id=++Gt),e}function l(t){return o(u(t,{}))}function h(t,e){return u(t,e)}function d(t,e){return e._id=t._id,e}function f(t){return t&&t.constructor===c}function c(){var t=[],i=[],n=[],r=[],s=[];return{constructor:c,insert:function(i){for(var n=e.array(i),r=0,s=n.length;r<s;++r)t.push(n[r]);return this},remove:function(t){for(var n=e.isFunction(t)?r:i,s=e.array(t),a=0,u=s.length;a<u;++a)n.push(s[a]);return this},modify:function(t,i,r){var a={field:i,value:e.constant(r)};return e.isFunction(t)?(a.filter=t,s.push(a)):(a.tuple=t,n.push(a)),this},encode:function(t,e){return n.push({tuple:t,field:e}),this},pulse:function(e,a){function u(t,i,n){n?t[i]=n(t):e.encode=i,l[t._id]=t}var l,h,d,f,c,m,v;for(h=0,d=t.length;h<d;++h)e.add.push(o(t[h]));for(l={},h=0,d=i.length;h<d;++h)m=i[h],l[m._id]=m;for(h=0,d=r.length;h<d;++h)c=r[h],a.forEach(function(t){c(t)&&(l[t._id]=t)});for(v in l)e.rem.push(l[v]);for(l={},h=0,d=n.length;h<d;++h)f=n[h],u(f.tuple,f.field,f.value),e.modifies(f.field);for(h=0,d=s.length;h<d;++h)f=s[h],c=f.filter,a.forEach(function(t){c(t)&&u(t,f.field,f.value)}),e.modifies(f.field);for(v in l)e.mod.push(l[v]);return e}}}function m(){Object.defineProperty(this,Vt,{writable:!0,value:{}})}function v(t,e){return(null!=e&&e>=0?e+":":"")+t}function p(t,e,i,n){this.id=++Kt,this.value=t,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,e&&(this._update=e),i&&this.parameters(i,n)}function g(t){return function(e){var i=this.flags;return 0===arguments.length?!!(i&t):(this.flags=e?i|t:i&~t,this)}}function _(t,e,i){this.id=++te,this.value=null,i&&(this.receive=i),t&&(this._filter=t),e&&(this._apply=e)}function y(t,e,i){return new _(t,e,i)}function x(t,i,n,r,s,a){var u,o,l=e.extend({},a,ne);e.isFunction(n)||(n=e.constant(n)),void 0===r?u=function(e){t.touch(n(e))}:e.isFunction(r)?(o=new p(null,r,s,!1),u=function(e){var i=n(e),r=(o.evaluate(e),o.value);f(r)?t.pulse(i,r,a):t.update(i,r,l)}):u=function(e){t.update(n(e),r,l)},i.apply(u)}function k(t,i,n,r,s,a){var u,o;void 0===r?o=n:(u=e.isFunction(r)?r:e.constant(r),r=n?function(t,e){if(!n.skip())return n.skip(!0).value=u(t,e)}:u,o=new p(null,r,s,!1),o.modified(a&&a.force),o.skip(!0),o.rank=0,n&&(o.value=n.value,o.targets().add(n))),i.targets().add(o)}function q(t){t.rank=++this._rank}function D(t){for(var e,i,n,r=[t];r.length;)if(this.rank(e=r.pop()),i=e._targets)for(n=i.length;--n>=0;)r.push(i[n])}function w(t,e,i){this.dataflow=t,this.stamp=null==e?-1:e,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=i||null}function O(t,e){return t?function(i,n){return t(i,n)&&e(i,n)}:e}function F(t,e){var i={};return t.visit(e,function(t){i[t._id]=1}),function(t){return i[t._id]?null:t}}function A(t,e){var i=e||ge;return this._pulse?this._enqueue(t):this._touched.add(t),i.skip&&t.skip(!0),this}function E(t,e,i){var n=i||ge;return(t.set(e)||n.force)&&this.touch(t,n),this}function b(t,e,i){var n=new w(this,this._clock+(this._pulse?0:1));return n.target=t,this._pulses[t.id]=e.pulse(n,t.value),this.touch(t,i||ge)}function M(t,e,n){return this.pulse(t,this.changeset().insert(i.read(e,n)))}function R(t){return arguments.length?(this._loadopt=t,this):this._loadopt}function S(t){var e,i=new Promise(function(t){e=t});return i.requests=0,i.done=function(){0===--i.requests&&t.runAfter(function(){t._pending=null,t.run(),e(t)})},t._pending=i}function P(t,e,n){var r=this,s=r._pending||S(r);s.requests+=1,i.load(e,r.loadOptions()).then(function(e){r.ingest(t,e,n)},function(t){r.warn("Loading failed: "+e,t),s.done()}).then(s.done).catch(function(t){r.error(t)})}function N(t,e,i,n){var r,s,a,u,o,l=this,h=0;for(this.dataflow=t,this.stamp=e,this.fields=null,this.encode=n||null,this.pulses=i,a=0,u=i.length;a<u;++a)if(r=i[a],r.stamp===e){if(r.fields){s=l.fields||(l.fields={});for(o in r.fields)s[o]=1}r.changed(l.ADD)&&(h|=l.ADD),r.changed(l.REM)&&(h|=l.REM),r.changed(l.MOD)&&(h|=l.MOD)}this.changes=h}function C(t){if(!this._touched.length)return 0;if(this._pending)return this.info("Awaiting requests, delaying dataflow run."),0;var i,n,r,a=this,u=0,o=a.logLevel();a._pulse=new w(a,++a._clock,t),o>=e.Info&&(r=Date.now(),a.debug("-- START PROPAGATION ("+a._clock+") -----")),a._touched.forEach(function(t){a._enqueue(t,!0)}),a._touched=s(e.id);try{for(;a._heap.size()>0;)i=a._heap.pop(),i.rank===i.qrank?(n=i.run(a._getPulse(i,t)),o>=e.Debug&&a.debug(i.id,n===se?"STOP":n,i),n!==se&&(a._pulse=n,i._targets&&i._targets.forEach(function(t){a._enqueue(t)})),++u):a._enqueue(i,!0)}catch(t){a.error(t)}if(a._pulses={},a._pulse=null,o>=e.Info&&(r=Date.now()-r,a.info("> Pulse "+a._clock+": "+u+" operators; "+r+"ms")),a._postrun.length){var l=a._postrun;a._postrun=[],l.forEach(function(t){try{t(a)}catch(t){a.error(t)}})}return u}function L(){return this._pending||Promise.resolve(this.run())}function U(t){if(this._pulse)this._postrun.push(t);else try{t(this)}catch(t){this.error(t)}}function z(t,e){var i=!this._pulses[t.id];i&&(this._pulses[t.id]=this._pulse),(i||e)&&(t.qrank=t.rank,this._heap.push(t))}function I(t,i){var n,r=t.source,s=this._clock;return r&&e.isArray(r)?(n=r.map(function(t){return t.pulse}),new N(this,s,n,i)):(r=r&&r.pulse,n=this._pulses[t.id],r&&r!==se&&(r.stamp===s&&n.target!==t?n=r:n.source=r.source),n)}function T(t){this.cmp=t,this.nodes=[]}function j(t,e,i,n){var r,s,a;for(r=t[i];i>e&&(a=i-1>>1,s=t[a],n(r,s)<0);)t[i]=s,i=a;return t[i]=r}function W(t,e,i){for(var n,r=e,s=t.length,a=t[e],u=2*e+1;u<s;)n=u+1,n<s&&i(t[u],t[n])>=0&&(u=n),t[e]=t[u],e=u,u=2*e+1;return t[e]=a,j(t,r,e,i)}function G(){this._log=e.logger(),this._clock=0,this._rank=0,this._touched=s(e.id),this._pulses={},this._pulse=null,this._heap=new T(function(t,e){return t.qrank-e.qrank}),this._postrun=[]}function V(t){return function(){return this._log[t].apply(this,arguments)}}function B(t,e){p.call(this,t,null,e)}function K(t,e){var i=t.type;$(i,t),H(i,e)}function $(t,e){return t=t&&t.toLowerCase(),arguments.length>1?(De[t]=e,this):De.hasOwnProperty(t)?De[t]:null}function H(t,e){return arguments.length>1?(qe[t]=e,this):qe.hasOwnProperty(t)?qe[t]:null}function J(t){this._key=t||"_id",this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null}function Q(t,e){return Oe[t](e)}function X(t){return function(i){var n=e.extend({init:"",add:"",rem:"",idx:0},t);return n.out=i||t.name,n}}function Y(t,e){return t.idx-e.idx}function Z(t,e){function i(t,n){function r(e){t[e]||i(t,t[e]=Oe[e]())}return n.req&&n.req.forEach(r),e&&n.str&&n.str.forEach(r),t}var n,r=t.reduce(i,t.reduce(function(t,e){return t[e.name]=e,t},{})),s=[];for(n in r)s.push(r[n]);return s.sort(Y)}function tt(t,i){var n=i||e.identity,r=Z(t,!0),s="this.cell = cell; this.tuple = t; this.valid = 0; this.missing = 0;",a="if(v==null){this.missing++; return;} if(v!==v) return; ++this.valid;",u="if(v==null){this.missing--; return;} if(v!==v) return; --this.valid;",o="var t = this.tuple; var cell = this.cell;";return r.forEach(function(t){t.idx<0?(s=t.init+s,a=t.add+a,u=t.rem+u):(s+=t.init,a+=t.add,u+=t.rem)}),t.slice().sort(Y).forEach(function(t){o+="t['"+t.out+"']="+t.set+";"}),o+="return t;",s=Function("cell","t",s),s.prototype.add=Function("v","t",a),s.prototype.rem=Function("v","t",u),s.prototype.set=Function(o),s.prototype.get=n,s.fields=t.map(function(t){return t.out}),s}function et(t){B.call(this,null,t),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}function it(t,e,i){return i||t+(e?"_"+e:"")}function nt(t){var e,i=this._dims,n=i.length,r=String(i[0](t));for(e=1;e<n;++e)r+="|"+i[e](t);return r}function rt(t){B.call(this,null,t)}function st(t){B.call(this,[],t)}function at(t){p.call(this,null,ut,t)}function ut(t){return this.value&&!t.modified()?this.value:e.compare(t.fields,t.orders)}function ot(t){B.call(this,null,t)}function lt(t,e,i){switch(e){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(i)}function ht(t){B.call(this,null,t)}function dt(t,e,i,n){for(var r,s,a=[],u={},l=t.length,h=0;h<l;++h)for(u[e]=s=t[h],r=0;r<l;++r)u[i]=t[r],n(u)&&(a.push(o(u)),u={},u[e]=s);return a}function ft(t){B.call(this,[+(1/0),-(1/0)],t)}function ct(t,e){p.call(this,t),this.parent=e}function mt(t){B.call(this,{},t),this._keys={},this._count=0;var e=this._targets=[];e.active=0,e.forEach=function(t){for(var i=0,n=e.active;i<n;++i)t(e[i],i,e)}}function vt(t){p.call(this,null,pt,t)}function pt(t){return this.value&&!t.modified()?this.value:e.isArray(t.name)?e.array(t.name).map(function(t){return e.field(t)}):e.field(t.name,t.as)}function gt(t){B.call(this,{},t)}function _t(t){B.call(this,{},t)}function yt(t){return t.fields.join("|")}function xt(t){B.call(this,null,t)}function kt(t){B.call(this,[],t)}function qt(t){B.call(this,[],t)}function Dt(t){var i,n=t.method||ze.value;return null!=ze[n]?n===ze.value?(i=void 0!==t.value?t.value:0,function(){return i}):ze[n]:void e.error("Unrecognized imputation method: "+n)}function wt(t){var e=t.field;return function(t){return t?e(t):NaN}}function Ot(t,e,i){var n,r,s,a,u,o,l,h,d,f=function(t){return t(d)},c=[],m=[],v={},p={};for(o=0,h=t.length;o<h;++o)d=t[o],r=(n=i.map(f))+"",l=v[r]||(v[r]=m.push(n)),a=(s=e?e.map(f):Ie)+"",(u=p[a])||(u=p[a]=[],c.push(u),u.values=s),u[l-1]=d;return c.domain=m,c}function Ft(t){p.call(this,null,At,t)}function At(t){return this.value&&!t.modified()?this.value:e.key(t.fields)}function Et(t){B.call(this,{},t)}function bt(t,e){return t.hasOwnProperty(e)?t[e]:null}function Mt(t){p.call(this,null,Rt,t)}function Rt(t){if(this.value&&!t.modified())return this.value;var e,i,n,r=+(1/0),s=-(1/0),a=t.extents;for(e=0,i=a.length;e<i;++e)n=a[e],n[0]<r&&(r=n[0]),n[1]>s&&(s=n[1]);return[r,s]}function St(t){p.call(this,null,Pt,t)}function Pt(t){return this.value&&!t.modified()?this.value:t.values.reduce(function(t,e){return t.concat(e)},[])}function Nt(t){B.call(this,null,t)}function Ct(t){mt.call(this,t)}function Lt(t){B.call(this,[],t)}function Ut(t){B.call(this,null,t)}function zt(t){B.call(this,null,t)}function It(t){B.call(this,[],t),this.count=0}function Tt(t){B.call(this,null,t),this.modified(!0)}function jt(t){B.call(this,{},t)}function Wt(t){B.call(this,null,t)}var Gt=1,Vt="_:mod:_",Bt=m.prototype;Bt.set=function(t,i,n,r){var s=this,a=s[t],u=s[Vt];return null!=i&&i>=0?(a[i]!==n||r)&&(a[i]=n,u[v(t,i)]=1,u[t]=1):(a!==n||r)&&(s[t]=n,u[t]=1,e.isArray(n)&&n.forEach(function(e,i){u[v(t,i)]=1})),s},Bt.modified=function(t,i){var n,r=this[Vt];if(!arguments.length){for(n in r)if(r[n])return!0;return!1}if(e.isArray(t)){for(n=0;n<t.length;++n)if(r[t[n]])return!0;return!1}return!!r[v(t,i)]},Bt.clear=function(){return this[Vt]={},this};var Kt=0,$t="pulse",Ht=new m,Jt=1,Qt=2,Xt=p.prototype;Xt.targets=function(){return this._targets||(this._targets=s(e.id))},Xt.set=function(t){return this.value!==t?(this.value=t,1):0},Xt.skip=g(Jt),Xt.modified=g(Qt),Xt.parameters=function(t,i){function n(t,e,n){n instanceof p?(n!==o&&(i&&n.targets().add(o),d.push(n)),h.push({op:n,name:t,index:e})):l.set(t,e,n)}i=i!==!1;var r,s,a,u,o=this,l=o._argval=o._argval||new m,h=o._argops=o._argops||[],d=[];for(r in t)if(s=t[r],r===$t)e.array(s).forEach(function(t){t instanceof p?t!==o&&(t.targets().add(o),d.push(t)):e.error("Pulse parameters must be operator instances.")}),o.source=s;else if(e.isArray(s))for(l.set(r,-1,Array(a=s.length)),u=0;u<a;++u)n(r,u,s[u]);else n(r,-1,s);return this.marshall().clear(),d},Xt.marshall=function(t){var e,i,n,r,s,a=this._argval||Ht,u=this._argops;if(u&&(n=u.length))for(i=0;i<n;++i)e=u[i],r=e.op,s=r.modified()&&r.stamp===t,a.set(e.name,e.index,r.value,s);return a},Xt.evaluate=function(t){if(this._update){var e=this.marshall(t.stamp),i=this._update(e,t);if(e.clear(),i!==this.value)this.value=i;else if(!this.modified())return t.StopPropagation}},Xt.run=function(t){if(t.stamp<=this.stamp)return t.StopPropagation;var e=this.skip()?(this.skip(!1),0):this.evaluate(t);return this.stamp=t.stamp,this.pulse=e||t};var Yt=function(t,i,n,r){var s=1,a=t instanceof p?t:t&&t.prototype instanceof p?new t:e.isFunction(t)?new p(null,t):(s=0,new p(t,i));return this.rank(a),s&&(r=n,n=i),n&&this.connect(a,a.parameters(n,r)),this.touch(a),a},Zt=function(t,e){var i,n,r=t.rank;for(i=0,n=e.length;i<n;++i)if(r<e[i].rank)return void this.rerank(t)},te=0,ee=_.prototype;ee._filter=e.truthy,ee._apply=e.identity,ee.targets=function(){return this._targets||(this._targets=s(e.id))},ee.consume=function(t){return arguments.length?(this._consume=!!t,this):!!this._consume},ee.receive=function(t){if(this._filter(t)){for(var e=this.value=this._apply(t),i=this._targets,n=i?i.length:0,r=0;r<n;++r)i[r].receive(e);this._consume&&(t.preventDefault(),t.stopPropagation())}},ee.filter=function(t){var e=y(t);return this.targets().add(e),e},ee.apply=function(t){var e=y(null,t);return this.targets().add(e),e},ee.merge=function(){var t=y();this.targets().add(t);for(var e=0,i=arguments.length;e<i;++e)arguments[e].targets().add(t);return t},ee.throttle=function(t){var e=-1;return this.filter(function(){var i=Date.now();return i-e>t?(e=i,1):0})},ee.debounce=function(t){function e(){var t=n.dataflow;i.receive(n),n=null,r=null,t&&t.run&&t.run()}var i=y(),n=null,r=null;return this.targets().add(y(null,null,function(i){n=i,r&&clearTimeout(r),r=setTimeout(e,t)})),i},ee.between=function(t,e){var i=!1;return t.targets().add(y(null,null,function(){i=!0})),e.targets().add(y(null,null,function(){i=!1})),this.filter(function(){return i})};var ie=function(t,i,n,r){var s,a=this,u=y(n,r),o=function(t){t.dataflow=a,u.receive(t),a.run()};s="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):e.array(t);for(var l=0,h=s.length;l<h;++l)s[l].addEventListener(i,o);return u},ne={skip:!0},re=function(t,e,i,n,r){var s=t instanceof p?k:x;return s(this,t,e,i,n,r),this},se={},ae=1,ue=2,oe=4,le=ae|ue,he=ae|oe,de=ae|ue|oe,fe=8,ce=16,me=32,ve=64,pe=w.prototype;pe.StopPropagation=se,pe.ADD=ae,pe.REM=ue,pe.MOD=oe,pe.ADD_REM=le,pe.ADD_MOD=he,pe.ALL=de,pe.REFLOW=fe,pe.SOURCE=ce,pe.NO_SOURCE=me,pe.NO_FIELDS=ve,pe.fork=function(t){return new w(this.dataflow).init(this,t)},pe.addAll=function(){var t=this;return this.source&&this.source.length!==this.add.length?(t=new w(this.dataflow).init(this),t.add=t.source,t):t},pe.init=function(t,e){var i=this;return i.stamp=t.stamp,i.encode=t.encode,!t.fields||e&ve||(i.fields=t.fields),i.add=e&ae?(i.addF=t.addF,t.add):(i.addF=null,[]),i.rem=e&ue?(i.remF=t.remF,t.rem):(i.remF=null,[]),i.mod=e&oe?(i.modF=t.modF,t.mod):(i.modF=null,[]),i.source=e&me?(i.srcF=null,null):(i.srcF=t.srcF,t.source),i},pe.runAfter=function(t){this.dataflow.runAfter(t)},pe.changed=function(t){var e=t||de;return e&ae&&this.add.length||e&ue&&this.rem.length||e&oe&&this.mod.length},pe.reflow=function(){var t=this.add.length,e=this.source&&this.source.length;return e&&e!==t&&(this.mod=this.source,t&&this.filter(oe,F(this,ae))),this},pe.modifies=function(t){var i=e.array(t),n=this.fields||(this.fields={});return i.forEach(function(t){n[t]=!0}),this},pe.modified=function(t){var i=this.fields;return!(!this.mod.length||!i)&&(arguments.length?e.isArray(t)?t.some(function(t){return i[t]}):i[t]:!!i)},pe.filter=function(t,e){var i=this;return t&ae&&(i.addF=O(i.addF,e)),t&ue&&(i.remF=O(i.remF,e)),t&oe&&(i.modF=O(i.modF,e)),t&ce&&(i.srcF=O(i.srcF,e)),i},pe.materialize=function(t){t=t||de;var e=this;return t&ae&&e.addF&&(e.add=e.add.filter(e.addF),e.addF=null),t&ue&&e.remF&&(e.rem=e.rem.filter(e.remF),e.remF=null),t&oe&&e.modF&&(e.mod=e.mod.filter(e.modF),e.modF=null),t&ce&&e.srcF&&(e.source=e.source.filter(e.srcF),e.srcF=null),e},pe.visit=function(t,i){var n,r,s=i;return t&ce?(e.visitArray(this.source,this.srcF,s),this):(t&ae&&e.visitArray(this.add,this.addF,s),t&ue&&e.visitArray(this.rem,this.remF,s),t&oe&&e.visitArray(this.mod,this.modF,s),t&fe&&(n=this.source)&&(r=this.add.length+this.mod.length,r===n||(r?e.visitArray(n,F(this,he),s):e.visitArray(n,this.srcF,s))),this)};var ge={skip:!1,force:!1},_e=e.inherits(N,w);_e.fork=function(){return arguments.length&&arguments[0]&w.prototype.ALL&&e.error("MultiPulse fork does not support tuple change sets."),new w(this.dataflow).init(this,0)},_e.changed=function(t){return this.changes&t},_e.modified=function(t){var i=this,n=i.fields;return n&&i.changes&i.MOD?e.isArray(t)?t.some(function(t){return n[t]}):n[t]:0},_e.filter=function(){e.error("MultiPulse does not support filtering.")},_e.materialize=function(){e.error("MultiPulse does not support materialization.")},_e.visit=function(t,e){var i,n,r=this.pulses;for(i=0,n=r.length;i<n;++i)r[i].stamp===this.stamp&&r[i].visit(t,e);return this};var ye=T.prototype;ye.size=function(){return this.nodes.length},ye.clear=function(){return this.nodes=[],this},ye.peek=function(){return this.nodes[0]},ye.push=function(t){var e=this.nodes;return e.push(t),j(e,0,e.length-1,this.cmp)},ye.pop=function(){var t,e=this.nodes,i=e.pop();return e.length?(t=e[0],e[0]=i,W(e,0,this.cmp)):t=i,t},ye.replace=function(t){var e=this.nodes,i=e[0];return e[0]=t,W(e,0,this.cmp),i},ye.pushpop=function(t){var e=this.nodes,i=e[0];return e.length&&this.cmp(i,t)<0&&(e[0]=t,t=i,W(e,0,this.cmp)),t};var xe=G.prototype;xe.stamp=function(){return this._clock},xe.add=Yt,xe.connect=Zt,xe.rank=q,xe.rerank=D,xe.pulse=b,xe.touch=A,xe.update=E,xe.changeset=c,xe.ingest=M,xe.request=P,xe.loadOptions=R,xe.events=ie,xe.on=re,xe.run=C,xe.runAsync=L,xe.runAfter=U,xe._enqueue=z,xe._getPulse=I,xe.warn=V("warn"),xe.info=V("info"),xe.debug=V("debug"),xe.logLevel=V("level"),xe.error=function(t){throw t};var ke=e.inherits(B,p);ke.evaluate=function(t){var e=this.marshall(t.stamp),i=this.transform(e,t);return e.clear(),i},ke.transform=function(){};var qe={},De={},we=J.prototype;we.add=function(t){this._add.push(t)},we.rem=function(t){this._rem.push(t)},we.values=function(){if(this._get=null,0===this._rem.length)return this._add;var t,e,i,n=this._add,r=this._rem,s=this._key,a=n.length,u=r.length,o=Array(a-u),l={};for(t=0;t<u;++t)l[r[t][s]]=1;for(t=0,e=0;t<a;++t)l[(i=n[t])[s]]?l[i[s]]=0:o[e++]=i;return this._rem=[],this._add=o},we.extent=function(t){if(this._get!==t||!this._ext){var i=this.values(),n=e.extentIndex(i,t);this._ext=[i[n[0]],i[n[1]]],this._get=t}return this._ext},we.argmin=function(t){return this.extent(t)[0]||{}},we.argmax=function(t){return this.extent(t)[1]||{}},we.min=function(t){var e=this.extent(t)[0];return null!=e?t(e):+(1/0)},we.max=function(t){var e=this.extent(t)[1];return null!=e?t(e):-(1/0)},we.quartile=function(t){return this._get===t&&this._q||(this._q=n.quartiles(this.values(),t),this._get=t),this._q},we.q1=function(t){return this.quartile(t)[0]},we.q2=function(t){return this.quartile(t)[1]},we.q3=function(t){return this.quartile(t)[2]},we.ci=function(t){return this._get===t&&this._ci||(this._ci=n.bootstrapCI(this.values(),1e3,.05,t),this._get=t),this._ci},we.ci0=function(t){return this.ci(t)[0]},we.ci1=function(t){return this.ci(t)[1]};var Oe={values:X({name:"values",init:"cell.store = true;",set:"cell.data.values()",idx:-1}),count:X({name:"count",set:"cell.num"}),missing:X({name:"missing",set:"this.missing"}),valid:X({name:"valid",set:"this.valid"}),distinct:X({name:"distinct",init:"this.dmap = {}; this.distinct = 0;",add:"this.dmap[v] = 1 + (this.dmap[v] || (++this.distinct, 0));",rem:"if (!(--this.dmap[v])) --this.distinct;",set:"this.distinct"}),sum:X({name:"sum",init:"this.sum = 0;",add:"this.sum += v;",rem:"this.sum -= v;",set:"this.sum"}),mean:X({name:"mean",init:"this.mean = 0;",add:"var d = v - this.mean; this.mean += d / this.valid;",rem:"var d = v - this.mean; this.mean -= this.valid ? d / this.valid : this.mean;",set:"this.mean"}),average:X({name:"average",set:"this.mean",req:["mean"],idx:1}),variance:X({name:"variance",init:"this.dev = 0;",add:"this.dev += d * (v - this.mean);",rem:"this.dev -= d * (v - this.mean);",set:"this.valid > 1 ? this.dev / (this.valid-1) : 0",req:["mean"],idx:1}),variancep:X({name:"variancep",set:"this.valid > 1 ? this.dev / this.valid : 0",req:["variance"],idx:2}),stdev:X({name:"stdev",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : 0",req:["variance"],idx:2}),stdevp:X({name:"stdevp",set:"this.valid > 1 ? Math.sqrt(this.dev / this.valid) : 0",req:["variance"],idx:2}),stderr:X({name:"stderr",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid * (this.valid-1))) : 0",req:["variance"],idx:2}),ci0:X({name:"ci0",set:"cell.data.ci0(this.get)",req:["values"],idx:3}),ci1:X({name:"ci1",set:"cell.data.ci1(this.get)",req:["values"],idx:3}),median:X({name:"median",set:"cell.data.q2(this.get)",req:["values"],idx:3}),q1:X({name:"q1",set:"cell.data.q1(this.get)",req:["values"],idx:3}),q3:X({name:"q3",set:"cell.data.q3(this.get)",req:["values"],idx:3}),argmin:X({name:"argmin",add:"if (v < this.min) this.argmin = t;",rem:"if (v <= this.min) this.argmin = null;",set:"this.argmin || cell.data.argmin(this.get)",req:["min"],str:["values"],idx:3}),argmax:X({name:"argmax",add:"if (v > this.max) this.argmax = t;",rem:"if (v >= this.max) this.argmax = null;",set:"this.argmax || cell.data.argmax(this.get)",req:["max"],str:["values"],idx:3}),min:X({name:"min",init:"this.min = null;",add:"if (v < this.min || this.min === null) this.min = v;",rem:"if (v <= this.min) this.min = NaN;",set:"this.min = (isNaN(this.min) ? cell.data.min(this.get) : this.min)",str:["values"],idx:4}),max:X({name:"max",init:"this.max = null;",add:"if (v > this.max || this.max === null) this.max = v;",rem:"if (v >= this.max) this.max = NaN;",set:"this.max = (isNaN(this.max) ? cell.data.max(this.get) : this.max)",str:["values"],idx:4})},Fe=e.inherits(et,B);Fe.transform=function(t,e){var i,n=this,r=e.fork(e.NO_SOURCE|e.NO_FIELDS);return this.stamp=r.stamp,this.value&&((i=t.modified())||e.modified(this._inputs))?(this._prev=this.value,this.value=i?this.init(t):{},e.visit(e.SOURCE,function(t){n.add(t)})):(this.value=this.value||this.init(t),e.visit(e.REM,function(t){n.rem(t)}),e.visit(e.ADD,function(t){n.add(t)})),r.modifies(this._outputs),n._drop=t.drop!==!1,n.changes(r)},Fe.init=function(t){function i(t){for(var e,i=t.fields,r=0,a=i.length;r<a;++r)s[e=i[r]]||(s[e]=1,n.push(e))}var n=this._inputs=[],r=this._outputs=[],s={};this._dims=e.array(t.groupby),this._dnames=this._dims.map(function(t){var n=e.accessorName(t);return i(t),r.push(n),n}),this.cellkey=t.key?t.key:0===this._dims.length?function(){return""}:1===this._dims.length?this._dims[0]:nt,this._countOnly=!0,this._counts=[],this._measures=[];var a,u,o,l,h,d,f=t.fields||[null],c=t.ops||["count"],m=t.as||[],v=f.length,p={};for(v!==c.length&&e.error("Unmatched number of fields and aggregate ops."),d=0;d<v;++d)a=f[d],u=c[d],null==a&&"count"!==u&&e.error("Null aggregate field specified."),l=e.accessorName(a),h=it(u,l,m[d]),r.push(h),"count"!==u?(o=p[l],o||(i(a),o=p[l]=[],o.field=a,this._measures.push(o)),"count"!==u&&(this._countOnly=!1),o.push(Q(u,h))):this._counts.push(h);return this._measures=this._measures.map(function(t){return tt(t,t.field)}),{}},Fe.cellkey=nt,Fe.cell=function(t,e){var i=this.value[t];return i?0===i.num&&this._drop&&i.stamp<this.stamp?(i.stamp=this.stamp,this._adds[this._alen++]=i):i.stamp<this.stamp&&(i.stamp=this.stamp,this._mods[this._mlen++]=i):(i=this.value[t]=this.newcell(t,e),this._adds[this._alen++]=i),i},Fe.newcell=function(t,e){var i={key:t,num:0,agg:null,tuple:this.newtuple(e,this._prev&&this._prev[t]),stamp:this.stamp,store:!1};if(!this._countOnly){var n,r=this._measures,s=r.length;for(i.agg=Array(s),n=0;n<s;++n)i.agg[n]=new r[n](i,i.tuple)}return i.store&&(i.data=new J),i},Fe.newtuple=function(t,e){var i,n,r=this._dnames,s=this._dims,a={};for(i=0,n=s.length;i<n;++i)a[r[i]]=s[i](t);return e?d(e.tuple,a):o(a)},Fe.add=function(t){var e,i,n,r=this.cellkey(t),s=this.cell(r,t);if(s.num+=1,!this._countOnly)for(s.store&&s.data.add(t),e=s.agg,i=0,n=e.length;i<n;++i)e[i].add(e[i].get(t),t)},Fe.rem=function(t){var e,i,n,r=this.cellkey(t),s=this.cell(r,t);if(s.num-=1,!this._countOnly)for(s.store&&s.data.rem(t),e=s.agg,i=0,n=e.length;i<n;++i)e[i].rem(e[i].get(t),t)},Fe.celltuple=function(t){var e,i,n,r=t.tuple,s=this._counts;for(t.store&&t.data.values(),i=0,n=s.length;i<n;++i)r[s[i]]=t.num;if(!this._countOnly)for(e=t.agg,i=0,n=e.length;i<n;++i)e[i].set();return r},Fe.changes=function(t){var e,i,n,r,s=this._adds,a=this._mods,u=this._prev,o=this._drop,l=t.add,h=t.rem,d=t.mod;if(u)for(i in u)h.push(u[i].tuple);for(n=0,r=this._alen;n<r;++n)l.push(this.celltuple(s[n])),s[n]=null;for(n=0,r=this._mlen;n<r;++n)e=a[n],(0===e.num&&o?h:d).push(this.celltuple(e)),a[n]=null;return this._alen=this._mlen=0,this._prev=null,t};var Ae=e.inherits(rt,B);Ae.transform=function(t,i){var n=this._bins(t),r=n.step,s=t.as||["bin0","bin1"],a=s[0],u=s[1],o=t.modified()?(i.reflow(),i.SOURCE):i.modified(e.accessorFields(t.field))?i.ADD_MOD:i.ADD;return i.visit(o,function(t){t[u]=(t[a]=n(t))+r}),i.modifies(s)},Ae._bins=function(t){if(this.value&&!t.modified())return this.value;var i=t.field,r=n.bin(t),s=r.start,a=r.step,u=function(t){var e=i(t);return null==e?null:s+a*Math.floor((+e-s)/a)};return u.step=a,this.value=e.accessor(u,e.accessorFields(i),t.name||"bin_"+e.accessorName(i))};var Ee=e.inherits(st,B);Ee.transform=function(t,i){var n,r=i.fork(i.ALL),s=i.changed(i.ADD),a=i.changed(),u=t.sort,o=this.value,l=function(t){o.push(t)},h=0;return r.rem.length&&(n={},r.visit(r.REM,function(t){n[t._id]=1,++h}),o=o.filter(function(t){return!n[t._id]})),u?((t.modified("sort")||i.modified(u.fields))&&(o.sort(u),a=!0),s&&(o=e.merge(u,o,r.add.sort(u)))):s&&r.visit(r.ADD,l),this.modified(a),this.value=r.source=o,r},e.inherits(at,p);var be=e.inherits(ot,B);be.transform=function(t,e){function i(e){return function(i){for(var n,r=lt(u(i),t.case,s)||[],o=0,l=r.length;o<l;++o)a.test(n=r[o])||e(n)}}var n=this._parameterCheck(t,e),r=this._counts,s=this._match,a=this._stop,u=t.field,o=t.as||["text","count"],l=i(function(t){r[t]=1+(r[t]||0)}),h=i(function(t){r[t]-=1});return n?e.visit(e.SOURCE,l):(e.visit(e.ADD,l),e.visit(e.REM,h)),this._finish(e,o)},be._parameterCheck=function(t,e){var i=!1;return!t.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(t.stopwords||"")+"$","i"),i=!0),!t.modified("pattern")&&this._match||(this._match=new RegExp(t.pattern||"[\\w']+","g"),i=!0),(t.modified("field")||e.modified(t.field.fields))&&(i=!0),i&&(this._counts={}),i},be._finish=function(t,e){var i,n,r,s=this._counts,a=this._tuples||(this._tuples={}),u=e[0],l=e[1],h=t.fork();for(i in s)n=a[i],r=s[i]||0,!n&&r?(a[i]=n=o({}),n[u]=i,n[l]=r,h.add.push(n)):0===r?(n&&h.rem.push(n),s[i]=null,a[i]=null):n[l]!==r&&(n[l]=r,h.mod.push(n));return h.modifies(e)};var Me=e.inherits(ht,B);Me.transform=function(t,i){var n=i.fork(i.NO_SOURCE),r=this.value,s=t.as||["a","b"],a=s[0],u=s[1],o=!r||i.changed(i.ADD_REM)||t.modified("as")||t.modified("filter");return o?(r&&(n.rem=r),n.add=this.value=dt(i.source,a,u,t.filter||e.truthy)):n.mod=r,n.source=this.value,n.modifies(s)};var Re=e.inherits(ft,B);Re.transform=function(t,e){var i,n=this.value,r=t.field,s=n[0],a=n[1],u=e.ADD;i=e.changed()||e.modified(r.fields)||t.modified("field"),i&&(u=e.SOURCE,s=+(1/0),a=-(1/0)),e.visit(u,function(t){var e=r(t);e<s&&(s=e),e>a&&(a=e)}),this.value=[s,a]};var Se=e.inherits(ct,p);Se.connect=function(t){return this.targets().add(t),t.source=this},Se.add=function(t){this.value.add.push(t)},Se.rem=function(t){this.value.rem.push(t)},Se.mod=function(t){this.value.mod.push(t)},Se.init=function(t){this.value.init(t)},Se.evaluate=function(){return this.value};var Pe=e.inherits(mt,B);Pe.activate=function(t){this._targets[this._targets.active++]=t},Pe.subflow=function(t,e,i,n){var r,s,a=this.value,u=a.hasOwnProperty(t)&&a[t];return u?u.value.stamp<i.stamp&&(u.init(i),this.activate(u)):(s=n||(s=this._group[t])&&s.tuple,r=i.dataflow,u=r.add(new ct(i.fork(),this)).connect(e(r,t,this._count++,s)),a[t]=u,this.activate(u)),u},Pe.transform=function(t,e){function i(t){return n.subflow(t,s,e)}var n=this,r=t.key,s=t.subflow,a=this._keys,u=t.modified("key");return this._group=t.group||{},this._targets.active=0,e.visit(e.ADD,function(t){i(a[t._id]=r(t)).add(t)}),e.visit(e.REM,function(t){var e=a[t._id];a[t._id]=null,i(e).rem(t)}),u||e.modified(r.fields)?e.visit(e.MOD,function(t){var e=a[t._id],n=r(t);e===n?i(n).mod(t):(a[t._id]=n,i(e).rem(t),i(n).add(t))}):e.changed(e.MOD)&&e.visit(e.MOD,function(t){i(a[t._id]).mod(t)}),u&&e.visit(e.REFLOW,function(t){var e=a[t._id],n=r(t);e!==n&&(a[t._id]=n,i(e).rem(t),i(n).add(t))}),e},e.inherits(vt,p);var Ne=e.inherits(gt,B);Ne.transform=function(t,e){function i(e){var i=n(e,t),s=r[e._id];i&&s?(r[e._id]=0,a.push(e)):i||s?l&&i&&!s&&o.push(e):(r[e._id]=1,u.push(e))}var n=t.expr,r=this.value,s=e.fork(),a=s.add,u=s.rem,o=s.mod,l=!0;return e.visit(e.REM,function(t){r[t._id]?r[t._id]=0:u.push(t)}),e.visit(e.ADD,function(e){n(e,t)?a.push(e):r[e._id]=1}),e.visit(e.MOD,i),t.modified()&&(l=!1,e.visit(e.REFLOW,i)),s};var Ce=e.inherits(_t,B);Ce.transform=function(t,e){function i(t){for(var e,i=s[t._id]=Array(m),n=0;n<m;++n)e=i[n]=l(t),e[d]=c[n],e[f]=u[n](t),p.add.push(e)}function n(t){for(var e,i=s[t._id],n=0;n<m;++n)_&1<<n&&(e=h(t,i[n],v),e[d]=c[n],e[f]=u[n](t),p.mod.push(e))}var r,s=this.value,a=t.modified("fields"),u=t.fields,o=t.as||["key","value"],d=o[0],f=o[1],c=u.map(yt),m=u.length,v=e.stamp,p=e.fork(),g=0,_=0;if(a){for(r in s)p.rem.push.apply(p.rem,s[r]);s=this.value={},e.visit(e.SOURCE,i)}else{for(e.visit(e.ADD,i);g<m;++g)e.modified(u[g].fields)&&(_|=1<<g);_&&e.visit(e.MOD,n),e.visit(e.REM,function(t){p.rem.push.apply(p.rem,s[t._id]),s[t._id]=null})}return p.modifies(o)};var Le=e.inherits(xt,B);Le.transform=function(t,e){function i(e){e[s]=r(e,t)}var n,r=t.expr,s=t.as;return t.modified()?e.materialize().reflow().visit(e.SOURCE,i):(n=e.modified(r.fields),e.visit(n?e.ADD_MOD:e.ADD,i)),e.modifies(s)};var Ue=e.inherits(kt,B);Ue.transform=function(t,e){var i,n,r,s=this.value,a=e.fork(e.ALL),u=t.size-s.length,l=t.generator;if(u>0){for(i=[];--u>=0;)i.push(r=o(l(t))),s.push(r);a.add=a.add.length?a.materialize(a.ADD).add.concat(i):i}else n=s.slice(0,-u),a.rem=a.rem.length?a.materialize(a.REM).rem.concat(n):n,s=s.slice(-u);return a.source=this.value=s,a};var ze={value:"value",median:r.median,mean:r.mean,min:r.min,max:r.max},Ie=[],Te=e.inherits(qt,B);Te.transform=function(t,i){var n,r,s,a,u,l,h,d,f,c,m=i.fork(i.ALL),v=Dt(t),p=wt(t),g=e.accessorName(t.field),_=t.groupby.map(e.accessorName),y=t.orderby.map(e.accessorName),x=Ot(i.source,t.groupby,t.orderby),k=[],q=this.value,D=x.domain.length;for(u=0,d=x.length;u<d;++u)for(n=x[u],s=n.values,r=NaN,h=0;h<D;++h)if(null==n[h]){for(a=x.domain[h],c={_impute:!0},l=0,f=s.length;l<f;++l)c[_[l]]=s[l];for(l=0,f=a.length;l<f;++l)c[y[l]]=a[l];c[g]=isNaN(r)?r=v(n,p):r,k.push(o(c))}return k.length&&(m.add=m.materialize(m.ADD).add.concat(k)),q.length&&(m.rem=m.materialize(m.REM).rem.concat(q)),this.value=k,m},e.inherits(Ft,p);var je=e.inherits(Et,B);je.transform=function(t,e){var i,n,r,s,a=e,u=t.as,o=t.fields,l=t.index,h=null==t.default?null:t.default,d=t.modified(),f=e.ADD;return 1===o.length?(n=o[0],r=u[0],i=function(t){var e=bt(l,n(t));t[r]=null==e?h:e}):i=function(t){for(var e,i=0,n=o.length;i<n;++i)e=bt(l,o[i](t)),t[u[i]]=null==e?h:e},d?(f=e.SOURCE,a=e.fork(e.ALL).reflow()):(s=o.some(function(t){
return e.modified(t.fields)}),f|=s?e.MOD:0),e.visit(f,i),a.modifies(u)},e.inherits(Mt,p),e.inherits(St,p),e.inherits(Nt,B),Nt.prototype.transform=function(t,e){return this.modified(t.modified()),this.value=t,e.fork()};var We=e.inherits(Ct,mt);We.transform=function(t,i){var n=this,r=t.subflow,s=t.field;return(t.modified("field")||s&&i.modified(s.fields))&&e.error("PreFacet does not support field modification."),this._targets.active=0,i.visit(i.ADD,function(t){var e=n.subflow(t._id,r,i,t);s?s(t).forEach(function(t){e.add(o(t))}):e.add(t)}),i.visit(i.REM,function(t){var e=n.subflow(t._id,r,i,t);s?s(t).forEach(function(t){e.rem(t)}):e.rem(t)}),i};var Ge=e.inherits(Lt,B);Ge.transform=function(t,e){if(t.modified()){var i=e.materialize().fork(e.MOD);return i.rem=e.rem.concat(this.value),i.source=this.value=r.range(t.start,t.stop,t.step).map(o),i.add=e.add.concat(this.value),i}};var Ve=e.inherits(Ut,B);Ve.transform=function(t,i){i.source||e.error("Rank transform requires an upstream data source.");var n,r=t.normalize,s=t.field,a=t.as||"rank",u={},o=-1;return s?(i.visit(i.SOURCE,function(t){var e=s(t);null==u[e]&&(u[e]=++o)}),i.visit(i.SOURCE,r&&--o?function(t){t[a]=u[s(t)]/o}:function(t){t[a]=u[s(t)]})):(o+=i.source.length,n=-1,i.visit(i.SOURCE,r&&o?function(t){t[a]=++n/o}:function(t){t[a]=++n})),i.reflow().modifies(a)};var Be=e.inherits(zt,B);Be.transform=function(t,e){var i,n=this.value||(i=e=e.addAll(),this.value={});return t.derive&&(i=e.fork(),e.visit(e.ADD,function(t){var e=l(t);n[t._id]=e,i.add.push(e)}),e.visit(e.MOD,function(t){i.mod.push(h(t,n[t._id]))}),e.visit(e.REM,function(t){i.rem.push(n[t._id]),n[t._id]=null})),i};var Ke=e.inherits(It,B);Ke.transform=function(t,e){function i(t){var e,i;a.length<s?a.push(t):(i=~~(u*Math.random()),i<a.length&&i>=o&&(e=a[i],l[e._id]&&n.rem.push(e),a[i]=t)),++u}var n=e.fork(),r=t.modified("size"),s=t.size,a=this.value,u=this.count,o=0,l=a.reduce(function(t,e){return t[e._id]=1,t},{});if(e.rem.length&&(e.visit(e.REM,function(t){l[t._id]&&(l[t._id]=-1,n.rem.push(t)),--u}),a=a.filter(function(t){return l[t._id]!==-1})),(e.rem.length||r)&&a.length<s&&e.source&&(o=u=a.length,e.visit(e.SOURCE,function(t){l[t._id]||i(t)}),o=-1),r&&a.length>s){for(var h=0,d=a.length-s;h<d;++h)l[a[h]._id]=-1,n.rem.push(a[h]);a=a.slice(d)}return e.mod.length&&e.visit(e.MOD,function(t){l[t._id]&&n.mod.push(t)}),e.add.length&&e.visit(e.ADD,i),(e.add.length||o<0)&&(n.add=a.filter(function(t){return!l[t._id]})),this.count=u,this.value=n.source=a,n};var $e=e.inherits(Tt,B);$e.transform=function(t,e){return this.value=e.source,e.changed()?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation};var He=e.inherits(jt,B);He.transform=function(t,e){function i(t){r[n(t)]=t}var n=t.field,r=this.value,s=!0;return t.modified("field")||e.modified(n.fields)?(this.value=r={},e.visit(e.SOURCE,i)):e.changed()?(e.visit(e.REM,function(t){r[n(t)]=void 0}),e.visit(e.ADD,i)):s=!1,this.modified(s),e.fork()};var Je=e.inherits(Wt,B);Je.transform=function(t,e){var i=!this.value||t.modified("field")||t.modified("sort")||e.changed()||t.sort&&e.modified(t.sort.fields);i&&(this.value=(t.sort?e.source.slice().sort(t.sort):e.source).map(t.field))};var Qe={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"fields",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:["count","valid","missing","distinct","sum","mean","average","variance","variancep","stdev","stdevp","median","q1","q3","modeskew","min","max","argmin","argmax"]},{name:"as",type:"string",array:!0},{name:"drop",type:"boolean",default:!0},{name:"key",type:"field"}]},Xe={type:"Bin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"maxbins",type:"number",default:20},{name:"base",type:"number",default:10},{name:"divide",type:"number",array:!0,default:[5,2]},{name:"extent",type:"number",array:!0,length:2,required:!0},{name:"step",type:"number"},{name:"steps",type:"number",array:!0},{name:"minstep",type:"number",default:0},{name:"nice",type:"boolean",default:!0},{name:"name",type:"string"},{name:"as",type:"string",array:!0,length:2,default:["bin0","bin1"]}]},Ye={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},Ze={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]},ti={type:"Cross",metadata:{source:!0,generates:!0,changes:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},ei={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},ii={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},ni={type:"Fold",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0,length:2,default:["key","value"]}]},ri={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0}]},si={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"orderby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},ai={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0,required:!0},{name:"default",default:null}]},ui={type:"Range",metadata:{generates:!0,source:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1}],output:["value"]},oi={type:"Rank",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"normalize",type:"boolean",default:!1},{name:"as",type:"string",default:"rank"}]},li={type:"Sample",metadata:{source:!0,changes:!0},params:[{name:"size",type:"number",default:1e3}]};K(Qe,et),K(Xe,rt),K(Ye,st),K(Ze,ot),K(ti,ht),K(ei,ft),K(ii,gt),K(ni,_t),K(ri,xt),K(si,qt),K(ai,Et),K(ui,Lt),K(oi,Ut),K(li,It),H("Compare",at),H("Facet",mt),H("Field",vt),H("Generate",kt),H("Key",Ft),H("MultiExtent",Mt),H("MultiValues",St),H("Params",Nt),H("PreFacet",Ct),H("Relay",zt),H("Sieve",Tt),H("Subflow",ct),H("TupleIndex",jt),H("Values",Wt),t.UniqueList=s,t.changeset=c,t.Dataflow=G,t.EventStream=_,t.Parameters=m,t.Pulse=w,t.MultiPulse=N,t.Operator=p,t.Transform=B,t.ingest=o,t.tupleid=a,t.definition=$,t.definitions=De,t.register=K,t.transform=H,t.transforms=qe,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vega-util"),require("vega-loader"),require("vega-statistics"),require("d3-array")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-loader","vega-statistics","d3-array"],e):e(t.vega=t.vega||{},t.vega,t.vega,t.vega,t.d3)}(this,function(t,e,i,n,r){"use strict";function s(t){var i=t||e.identity,n=[],r={};return n.add=function(t){var e=i(t);return r[e]||(r[e]=1,n.push(t)),n},n.remove=function(t){var e,s=i(t);return r[s]&&(r[s]=0,(e=n.indexOf(t))>=0&&n.splice(e,1)),n},n}function a(t){return t._id}function u(t,e){for(var i in t)"_id"!==i&&(e[i]=t[i]);return e}function o(t){var e=t===Object(t)?t:{data:t};return e._id||(e._id=++Wt),e}function l(t){return o(u(t,{}))}function h(t,e){return u(t,e)}function d(t,e){return e._id=t._id,e}function f(t){return t&&t.constructor===c}function c(){var t=[],i=[],n=[],r=[],s=[];return{constructor:c,insert:function(i){for(var n=e.array(i),r=0,s=n.length;r<s;++r)t.push(n[r]);return this},remove:function(t){for(var n=e.isFunction(t)?r:i,s=e.array(t),a=0,u=s.length;a<u;++a)n.push(s[a]);return this},modify:function(t,i,r){var a={field:i,value:e.constant(r)};return e.isFunction(t)?(a.filter=t,s.push(a)):(a.tuple=t,n.push(a)),this},encode:function(t,e){return n.push({tuple:t,field:e}),this},pulse:function(e,a){function u(t,i,n){n?t[i]=n(t):e.encode=i,l[t._id]=t}var l,h,d,f,c,m,v;for(h=0,d=t.length;h<d;++h)e.add.push(o(t[h]));for(l={},h=0,d=i.length;h<d;++h)m=i[h],l[m._id]=m;for(h=0,d=r.length;h<d;++h)c=r[h],a.forEach(function(t){c(t)&&(l[t._id]=t)});for(v in l)e.rem.push(l[v]);for(l={},h=0,d=n.length;h<d;++h)f=n[h],u(f.tuple,f.field,f.value),e.modifies(f.field);for(h=0,d=s.length;h<d;++h)f=s[h],c=f.filter,a.forEach(function(t){c(t)&&u(t,f.field,f.value)}),e.modifies(f.field);for(v in l)e.mod.push(l[v]);return e}}}function m(){Object.defineProperty(this,Gt,{writable:!0,value:{}})}function v(t,e){return(null!=e&&e>=0?e+":":"")+t}function p(t,e,i,n){this.id=++Bt,this.value=t,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,e&&(this._update=e),i&&this.parameters(i,n)}function g(t){return function(e){var i=this.flags;return 0===arguments.length?!!(i&t):(this.flags=e?i|t:i&~t,this)}}function _(t,e,i){this.id=++Zt,this.value=null,i&&(this.receive=i),t&&(this._filter=t),e&&(this._apply=e)}function y(t,e,i){return new _(t,e,i)}function x(t,i,n,r,s,a){var u,o,l=e.extend({},a,ie);e.isFunction(n)||(n=e.constant(n)),void 0===r?u=function(e){t.touch(n(e))}:e.isFunction(r)?(o=new p(null,r,s,!1),u=function(e){var i=n(e),r=(o.evaluate(e),o.value);f(r)?t.pulse(i,r,a):t.update(i,r,l)}):u=function(e){t.update(n(e),r,l)},i.apply(u)}function k(t,i,n,r,s,a){var u,o;void 0===r?o=n:(u=e.isFunction(r)?r:e.constant(r),r=n?function(t,e){if(!n.skip())return n.skip(!0).value=u(t,e)}:u,o=new p(null,r,s,!1),o.modified(a&&a.force),o.skip(!0),o.rank=0,n&&(o.value=n.value,o.targets().add(n))),i.targets().add(o)}function q(t){t.rank=++this._rank}function D(t){for(var e,i,n,r=[t];r.length;)if(this.rank(e=r.pop()),i=e._targets)for(n=i.length;--n>=0;)r.push(i[n])}function w(t,e,i){this.dataflow=t,this.stamp=null==e?-1:e,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=i||null}function F(t,e){return t?function(i,n){return t(i,n)&&e(i,n)}:e}function O(t,e){var i={};return t.visit(e,function(t){i[t._id]=1}),function(t){return i[t._id]?null:t}}function A(t,e){var i=e||pe;return this._pulse?this._enqueue(t):this._touched.add(t),i.skip&&t.skip(!0),this}function E(t,e,i){var n=i||pe;return(t.set(e)||n.force)&&this.touch(t,n),this}function b(t,e,i){var n=new w(this,this._clock+(this._pulse?0:1));return n.target=t,this._pulses[t.id]=e.pulse(n,t.value),this.touch(t,i||pe)}function M(t,e,n){return this.pulse(t,this.changeset().insert(i.read(e,n)))}function R(t){var e,i=new Promise(function(t){e=t});return i.requests=0,i.done=function(){0===--i.requests&&t.runAfter(function(){t._pending=null,t.run(),e(t)})},t._pending=i}function S(t,e,i){var n=this,r=n._pending||R(n);r.requests+=1,n.loader().load(e,{context:"dataflow"}).then(function(e){n.ingest(t,e,i)},function(t){n.warn("Loading failed: "+e,t),r.done()}).then(r.done).catch(function(t){n.error(t)})}function P(t,e,i,n){var r,s,a,u,o,l=this,h=0;for(this.dataflow=t,this.stamp=e,this.fields=null,this.encode=n||null,this.pulses=i,a=0,u=i.length;a<u;++a)if(r=i[a],r.stamp===e){if(r.fields){s=l.fields||(l.fields={});for(o in r.fields)s[o]=1}r.changed(l.ADD)&&(h|=l.ADD),r.changed(l.REM)&&(h|=l.REM),r.changed(l.MOD)&&(h|=l.MOD)}this.changes=h}function N(t){if(!this._touched.length)return 0;if(this._pending)return this.info("Awaiting requests, delaying dataflow run."),0;var i,n,r,a=this,u=0,o=a.logLevel();a._pulse=new w(a,++a._clock,t),o>=e.Info&&(r=Date.now(),a.debug("-- START PROPAGATION ("+a._clock+") -----")),a._touched.forEach(function(t){a._enqueue(t,!0)}),a._touched=s(e.id);try{for(;a._heap.size()>0;)i=a._heap.pop(),i.rank===i.qrank?(n=i.run(a._getPulse(i,t)),o>=e.Debug&&a.debug(i.id,n===re?"STOP":n,i),n!==re&&(a._pulse=n,i._targets&&i._targets.forEach(function(t){a._enqueue(t)})),++u):a._enqueue(i,!0)}catch(t){a.error(t)}if(a._pulses={},a._pulse=null,o>=e.Info&&(r=Date.now()-r,a.info("> Pulse "+a._clock+": "+u+" operators; "+r+"ms")),a._postrun.length){var l=a._postrun;a._postrun=[],l.forEach(function(t){try{t(a)}catch(t){a.error(t)}})}return u}function C(){return this._pending||Promise.resolve(this.run())}function L(t){if(this._pulse)this._postrun.push(t);else try{t(this)}catch(t){this.error(t)}}function U(t,e){var i=!this._pulses[t.id];i&&(this._pulses[t.id]=this._pulse),(i||e)&&(t.qrank=t.rank,this._heap.push(t))}function z(t,i){var n,r=t.source,s=this._clock;return r&&e.isArray(r)?(n=r.map(function(t){return t.pulse}),new P(this,s,n,i)):(r=r&&r.pulse,n=this._pulses[t.id],r&&r!==re&&(r.stamp===s&&n.target!==t?n=r:n.source=r.source),n)}function I(t){this.cmp=t,this.nodes=[]}function T(t,e,i,n){var r,s,a;for(r=t[i];i>e&&(a=i-1>>1,s=t[a],n(r,s)<0);)t[i]=s,i=a;return t[i]=r}function j(t,e,i){for(var n,r=e,s=t.length,a=t[e],u=2*e+1;u<s;)n=u+1,n<s&&i(t[u],t[n])>=0&&(u=n),t[e]=t[u],e=u,u=2*e+1;return t[e]=a,T(t,r,e,i)}function W(){this._log=e.logger(),this._clock=0,this._rank=0,this._loader=i.loader(),this._touched=s(e.id),this._pulses={},this._pulse=null,this._heap=new I(function(t,e){return t.qrank-e.qrank}),this._postrun=[]}function G(t){return function(){return this._log[t].apply(this,arguments)}}function V(t,e){p.call(this,t,null,e)}function B(t,e){var i=t.type;K(i,t),$(i,e)}function K(t,e){return t=t&&t.toLowerCase(),arguments.length>1?(qe[t]=e,this):qe.hasOwnProperty(t)?qe[t]:null}function $(t,e){return arguments.length>1?(ke[t]=e,this):ke.hasOwnProperty(t)?ke[t]:null}function H(t){this._key=t||"_id",this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null}function J(t,e){return we[t](e)}function Q(t){return function(i){var n=e.extend({init:"",add:"",rem:"",idx:0},t);return n.out=i||t.name,n}}function X(t,e){return t.idx-e.idx}function Y(t,e){function i(t,n){function r(e){t[e]||i(t,t[e]=we[e]())}return n.req&&n.req.forEach(r),e&&n.str&&n.str.forEach(r),t}var n,r=t.reduce(i,t.reduce(function(t,e){return t[e.name]=e,t},{})),s=[];for(n in r)s.push(r[n]);return s.sort(X)}function Z(t,i){var n=i||e.identity,r=Y(t,!0),s="this.cell = cell; this.tuple = t; this.valid = 0; this.missing = 0;",a="if(v==null){this.missing++; return;} if(v!==v) return; ++this.valid;",u="if(v==null){this.missing--; return;} if(v!==v) return; --this.valid;",o="var t = this.tuple; var cell = this.cell;";return r.forEach(function(t){t.idx<0?(s=t.init+s,a=t.add+a,u=t.rem+u):(s+=t.init,a+=t.add,u+=t.rem)}),t.slice().sort(X).forEach(function(t){o+="t['"+t.out+"']="+t.set+";"}),o+="return t;",s=Function("cell","t",s),s.prototype.add=Function("v","t",a),s.prototype.rem=Function("v","t",u),s.prototype.set=Function(o),s.prototype.get=n,s.fields=t.map(function(t){return t.out}),s}function tt(t){V.call(this,null,t),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}function et(t,e,i){return i||t+(e?"_"+e:"")}function it(t){var e,i=this._dims,n=i.length,r=String(i[0](t));for(e=1;e<n;++e)r+="|"+i[e](t);return r}function nt(t){V.call(this,null,t)}function rt(t){V.call(this,[],t)}function st(t){p.call(this,null,at,t)}function at(t){return this.value&&!t.modified()?this.value:e.compare(t.fields,t.orders)}function ut(t){V.call(this,null,t)}function ot(t,e,i){switch(e){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(i)}function lt(t){V.call(this,null,t)}function ht(t,e,i,n){for(var r,s,a=[],u={},l=t.length,h=0;h<l;++h)for(u[e]=s=t[h],r=0;r<l;++r)u[i]=t[r],n(u)&&(a.push(o(u)),u={},u[e]=s);return a}function dt(t){V.call(this,[+(1/0),-(1/0)],t)}function ft(t,e){p.call(this,t),this.parent=e}function ct(t){V.call(this,{},t),this._keys={},this._count=0;var e=this._targets=[];e.active=0,e.forEach=function(t){for(var i=0,n=e.active;i<n;++i)t(e[i],i,e)}}function mt(t){p.call(this,null,vt,t)}function vt(t){return this.value&&!t.modified()?this.value:e.isArray(t.name)?e.array(t.name).map(function(t){return e.field(t)}):e.field(t.name,t.as)}function pt(t){V.call(this,{},t)}function gt(t){V.call(this,{},t)}function _t(t){return t.fields.join("|")}function yt(t){V.call(this,null,t)}function xt(t){V.call(this,[],t)}function kt(t){V.call(this,[],t)}function qt(t){var i,n=t.method||Ue.value;return null!=Ue[n]?n===Ue.value?(i=void 0!==t.value?t.value:0,function(){return i}):Ue[n]:void e.error("Unrecognized imputation method: "+n)}function Dt(t){var e=t.field;return function(t){return t?e(t):NaN}}function wt(t,e,i){var n,r,s,a,u,o,l,h,d,f=function(t){return t(d)},c=[],m=[],v={},p={};for(o=0,h=t.length;o<h;++o)d=t[o],r=(n=i.map(f))+"",l=v[r]||(v[r]=m.push(n)),a=(s=e?e.map(f):ze)+"",(u=p[a])||(u=p[a]=[],c.push(u),u.values=s),u[l-1]=d;return c.domain=m,c}function Ft(t){p.call(this,null,Ot,t)}function Ot(t){return this.value&&!t.modified()?this.value:e.key(t.fields)}function At(t){V.call(this,{},t)}function Et(t,e){return t.hasOwnProperty(e)?t[e]:null}function bt(t){p.call(this,null,Mt,t)}function Mt(t){if(this.value&&!t.modified())return this.value;var e,i,n,r=+(1/0),s=-(1/0),a=t.extents;for(e=0,i=a.length;e<i;++e)n=a[e],n[0]<r&&(r=n[0]),n[1]>s&&(s=n[1]);return[r,s]}function Rt(t){p.call(this,null,St,t)}function St(t){return this.value&&!t.modified()?this.value:t.values.reduce(function(t,e){return t.concat(e)},[])}function Pt(t){V.call(this,null,t)}function Nt(t){ct.call(this,t)}function Ct(t){V.call(this,[],t)}function Lt(t){V.call(this,null,t)}function Ut(t){V.call(this,null,t)}function zt(t){V.call(this,[],t),this.count=0}function It(t){V.call(this,null,t),this.modified(!0)}function Tt(t){V.call(this,{},t)}function jt(t){V.call(this,null,t)}var Wt=1,Gt="_:mod:_",Vt=m.prototype;Vt.set=function(t,i,n,r){var s=this,a=s[t],u=s[Gt];return null!=i&&i>=0?(a[i]!==n||r)&&(a[i]=n,u[v(t,i)]=1,u[t]=1):(a!==n||r)&&(s[t]=n,u[t]=1,e.isArray(n)&&n.forEach(function(e,i){u[v(t,i)]=1})),s},Vt.modified=function(t,i){var n,r=this[Gt];if(!arguments.length){for(n in r)if(r[n])return!0;return!1}if(e.isArray(t)){for(n=0;n<t.length;++n)if(r[t[n]])return!0;return!1}return!!r[v(t,i)]},Vt.clear=function(){return this[Gt]={},this};var Bt=0,Kt="pulse",$t=new m,Ht=1,Jt=2,Qt=p.prototype;Qt.targets=function(){return this._targets||(this._targets=s(e.id))},Qt.set=function(t){return this.value!==t?(this.value=t,1):0},Qt.skip=g(Ht),Qt.modified=g(Jt),Qt.parameters=function(t,i){function n(t,e,n){n instanceof p?(n!==o&&(i&&n.targets().add(o),d.push(n)),h.push({op:n,name:t,index:e})):l.set(t,e,n)}i=i!==!1;var r,s,a,u,o=this,l=o._argval=o._argval||new m,h=o._argops=o._argops||[],d=[];for(r in t)if(s=t[r],r===Kt)e.array(s).forEach(function(t){t instanceof p?t!==o&&(t.targets().add(o),d.push(t)):e.error("Pulse parameters must be operator instances.")}),o.source=s;else if(e.isArray(s))for(l.set(r,-1,Array(a=s.length)),u=0;u<a;++u)n(r,u,s[u]);else n(r,-1,s);return this.marshall().clear(),d},Qt.marshall=function(t){var e,i,n,r,s,a=this._argval||$t,u=this._argops;if(u&&(n=u.length))for(i=0;i<n;++i)e=u[i],r=e.op,s=r.modified()&&r.stamp===t,a.set(e.name,e.index,r.value,s);return a},Qt.evaluate=function(t){if(this._update){var e=this.marshall(t.stamp),i=this._update(e,t);if(e.clear(),i!==this.value)this.value=i;else if(!this.modified())return t.StopPropagation}},Qt.run=function(t){if(t.stamp<=this.stamp)return t.StopPropagation;var e=this.skip()?(this.skip(!1),0):this.evaluate(t);return this.stamp=t.stamp,this.pulse=e||t};var Xt=function(t,i,n,r){var s=1,a=t instanceof p?t:t&&t.prototype instanceof p?new t:e.isFunction(t)?new p(null,t):(s=0,new p(t,i));return this.rank(a),s&&(r=n,n=i),n&&this.connect(a,a.parameters(n,r)),this.touch(a),a},Yt=function(t,e){var i,n,r=t.rank;for(i=0,n=e.length;i<n;++i)if(r<e[i].rank)return void this.rerank(t)},Zt=0,te=_.prototype;te._filter=e.truthy,te._apply=e.identity,te.targets=function(){return this._targets||(this._targets=s(e.id))},te.consume=function(t){return arguments.length?(this._consume=!!t,this):!!this._consume},te.receive=function(t){if(this._filter(t)){for(var e=this.value=this._apply(t),i=this._targets,n=i?i.length:0,r=0;r<n;++r)i[r].receive(e);this._consume&&(t.preventDefault(),t.stopPropagation())}},te.filter=function(t){var e=y(t);return this.targets().add(e),e},te.apply=function(t){var e=y(null,t);return this.targets().add(e),e},te.merge=function(){var t=y();this.targets().add(t);for(var e=0,i=arguments.length;e<i;++e)arguments[e].targets().add(t);return t},te.throttle=function(t){var e=-1;return this.filter(function(){var i=Date.now();return i-e>t?(e=i,1):0})},te.debounce=function(t){function e(){var t=n.dataflow;i.receive(n),n=null,r=null,t&&t.run&&t.run()}var i=y(),n=null,r=null;return this.targets().add(y(null,null,function(i){n=i,r&&clearTimeout(r),r=setTimeout(e,t)})),i},te.between=function(t,e){var i=!1;return t.targets().add(y(null,null,function(){i=!0})),e.targets().add(y(null,null,function(){i=!1})),this.filter(function(){return i})};var ee=function(t,i,n,r){var s,a=this,u=y(n,r),o=function(t){t.dataflow=a,u.receive(t),a.run()};s="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):e.array(t);for(var l=0,h=s.length;l<h;++l)s[l].addEventListener(i,o);return u},ie={skip:!0},ne=function(t,e,i,n,r){var s=t instanceof p?k:x;return s(this,t,e,i,n,r),this},re={},se=1,ae=2,ue=4,oe=se|ae,le=se|ue,he=se|ae|ue,de=8,fe=16,ce=32,me=64,ve=w.prototype;ve.StopPropagation=re,ve.ADD=se,ve.REM=ae,ve.MOD=ue,ve.ADD_REM=oe,ve.ADD_MOD=le,ve.ALL=he,ve.REFLOW=de,ve.SOURCE=fe,ve.NO_SOURCE=ce,ve.NO_FIELDS=me,ve.fork=function(t){return new w(this.dataflow).init(this,t)},ve.addAll=function(){var t=this;return this.source&&this.source.length!==this.add.length?(t=new w(this.dataflow).init(this),t.add=t.source,t):t},ve.init=function(t,e){var i=this;return i.stamp=t.stamp,i.encode=t.encode,!t.fields||e&me||(i.fields=t.fields),i.add=e&se?(i.addF=t.addF,t.add):(i.addF=null,[]),i.rem=e&ae?(i.remF=t.remF,t.rem):(i.remF=null,[]),i.mod=e&ue?(i.modF=t.modF,t.mod):(i.modF=null,[]),i.source=e&ce?(i.srcF=null,null):(i.srcF=t.srcF,t.source),i},ve.runAfter=function(t){this.dataflow.runAfter(t)},ve.changed=function(t){var e=t||he;return e&se&&this.add.length||e&ae&&this.rem.length||e&ue&&this.mod.length},ve.reflow=function(){var t=this.add.length,e=this.source&&this.source.length;return e&&e!==t&&(this.mod=this.source,t&&this.filter(ue,O(this,se))),this},ve.modifies=function(t){var i=e.array(t),n=this.fields||(this.fields={});return i.forEach(function(t){n[t]=!0}),this},ve.modified=function(t){var i=this.fields;return!(!this.mod.length||!i)&&(arguments.length?e.isArray(t)?t.some(function(t){return i[t]}):i[t]:!!i)},ve.filter=function(t,e){var i=this;return t&se&&(i.addF=F(i.addF,e)),t&ae&&(i.remF=F(i.remF,e)),t&ue&&(i.modF=F(i.modF,e)),t&fe&&(i.srcF=F(i.srcF,e)),i},ve.materialize=function(t){t=t||he;var e=this;return t&se&&e.addF&&(e.add=e.add.filter(e.addF),e.addF=null),t&ae&&e.remF&&(e.rem=e.rem.filter(e.remF),e.remF=null),t&ue&&e.modF&&(e.mod=e.mod.filter(e.modF),e.modF=null),t&fe&&e.srcF&&(e.source=e.source.filter(e.srcF),e.srcF=null),e},ve.visit=function(t,i){var n,r,s=i;return t&fe?(e.visitArray(this.source,this.srcF,s),this):(t&se&&e.visitArray(this.add,this.addF,s),t&ae&&e.visitArray(this.rem,this.remF,s),t&ue&&e.visitArray(this.mod,this.modF,s),t&de&&(n=this.source)&&(r=this.add.length+this.mod.length,r===n||(r?e.visitArray(n,O(this,le),s):e.visitArray(n,this.srcF,s))),this)};var pe={skip:!1,force:!1},ge=e.inherits(P,w);ge.fork=function(){return arguments.length&&arguments[0]&w.prototype.ALL&&e.error("MultiPulse fork does not support tuple change sets."),new w(this.dataflow).init(this,0)},ge.changed=function(t){return this.changes&t},ge.modified=function(t){var i=this,n=i.fields;return n&&i.changes&i.MOD?e.isArray(t)?t.some(function(t){return n[t]}):n[t]:0},ge.filter=function(){e.error("MultiPulse does not support filtering.")},ge.materialize=function(){e.error("MultiPulse does not support materialization.")},ge.visit=function(t,e){var i,n,r=this.pulses;for(i=0,n=r.length;i<n;++i)r[i].stamp===this.stamp&&r[i].visit(t,e);return this};var _e=I.prototype;_e.size=function(){return this.nodes.length},_e.clear=function(){return this.nodes=[],this},_e.peek=function(){return this.nodes[0]},_e.push=function(t){var e=this.nodes;return e.push(t),T(e,0,e.length-1,this.cmp)},_e.pop=function(){var t,e=this.nodes,i=e.pop();return e.length?(t=e[0],e[0]=i,j(e,0,this.cmp)):t=i,t},_e.replace=function(t){var e=this.nodes,i=e[0];return e[0]=t,j(e,0,this.cmp),i},_e.pushpop=function(t){var e=this.nodes,i=e[0];return e.length&&this.cmp(i,t)<0&&(e[0]=t,t=i,j(e,0,this.cmp)),t};var ye=W.prototype;ye.stamp=function(){return this._clock},ye.loader=function(t){return arguments.length?(this._loader=t,this):this._loader},ye.add=Xt,ye.connect=Yt,ye.rank=q,ye.rerank=D,ye.pulse=b,ye.touch=A,ye.update=E,ye.changeset=c,ye.ingest=M,ye.request=S,ye.events=ee,ye.on=ne,ye.run=N,ye.runAsync=C,ye.runAfter=L,ye._enqueue=U,ye._getPulse=z,ye.warn=G("warn"),ye.info=G("info"),ye.debug=G("debug"),ye.logLevel=G("level"),ye.error=function(t){throw t};var xe=e.inherits(V,p);xe.evaluate=function(t){var e=this.marshall(t.stamp),i=this.transform(e,t);return e.clear(),i},xe.transform=function(){};var ke={},qe={},De=H.prototype;De.add=function(t){this._add.push(t)},De.rem=function(t){this._rem.push(t)},De.values=function(){if(this._get=null,0===this._rem.length)return this._add;var t,e,i,n=this._add,r=this._rem,s=this._key,a=n.length,u=r.length,o=Array(a-u),l={};for(t=0;t<u;++t)l[r[t][s]]=1;for(t=0,e=0;t<a;++t)l[(i=n[t])[s]]?l[i[s]]=0:o[e++]=i;return this._rem=[],this._add=o},De.extent=function(t){if(this._get!==t||!this._ext){var i=this.values(),n=e.extentIndex(i,t);this._ext=[i[n[0]],i[n[1]]],this._get=t}return this._ext},De.argmin=function(t){return this.extent(t)[0]||{}},De.argmax=function(t){return this.extent(t)[1]||{}},De.min=function(t){var e=this.extent(t)[0];return null!=e?t(e):+(1/0)},De.max=function(t){var e=this.extent(t)[1];return null!=e?t(e):-(1/0)},De.quartile=function(t){return this._get===t&&this._q||(this._q=n.quartiles(this.values(),t),this._get=t),this._q},De.q1=function(t){return this.quartile(t)[0]},De.q2=function(t){return this.quartile(t)[1]},De.q3=function(t){return this.quartile(t)[2]},De.ci=function(t){return this._get===t&&this._ci||(this._ci=n.bootstrapCI(this.values(),1e3,.05,t),this._get=t),this._ci},De.ci0=function(t){return this.ci(t)[0]},De.ci1=function(t){return this.ci(t)[1]};var we={values:Q({name:"values",init:"cell.store = true;",set:"cell.data.values()",idx:-1}),count:Q({name:"count",set:"cell.num"}),missing:Q({name:"missing",set:"this.missing"}),valid:Q({name:"valid",set:"this.valid"}),distinct:Q({name:"distinct",init:"this.dmap = {}; this.distinct = 0;",add:"this.dmap[v] = 1 + (this.dmap[v] || (++this.distinct, 0));",rem:"if (!(--this.dmap[v])) --this.distinct;",set:"this.distinct"}),sum:Q({name:"sum",init:"this.sum = 0;",add:"this.sum += v;",rem:"this.sum -= v;",set:"this.sum"}),mean:Q({name:"mean",init:"this.mean = 0;",add:"var d = v - this.mean; this.mean += d / this.valid;",rem:"var d = v - this.mean; this.mean -= this.valid ? d / this.valid : this.mean;",set:"this.mean"}),average:Q({name:"average",set:"this.mean",req:["mean"],idx:1}),variance:Q({name:"variance",init:"this.dev = 0;",add:"this.dev += d * (v - this.mean);",rem:"this.dev -= d * (v - this.mean);",set:"this.valid > 1 ? this.dev / (this.valid-1) : 0",req:["mean"],idx:1}),variancep:Q({name:"variancep",set:"this.valid > 1 ? this.dev / this.valid : 0",req:["variance"],idx:2}),stdev:Q({name:"stdev",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : 0",req:["variance"],idx:2}),stdevp:Q({name:"stdevp",set:"this.valid > 1 ? Math.sqrt(this.dev / this.valid) : 0",req:["variance"],idx:2}),stderr:Q({name:"stderr",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid * (this.valid-1))) : 0",req:["variance"],idx:2}),ci0:Q({name:"ci0",set:"cell.data.ci0(this.get)",req:["values"],idx:3}),ci1:Q({name:"ci1",set:"cell.data.ci1(this.get)",req:["values"],idx:3}),median:Q({name:"median",set:"cell.data.q2(this.get)",req:["values"],idx:3}),q1:Q({name:"q1",set:"cell.data.q1(this.get)",req:["values"],idx:3}),q3:Q({name:"q3",set:"cell.data.q3(this.get)",req:["values"],idx:3}),argmin:Q({name:"argmin",add:"if (v < this.min) this.argmin = t;",rem:"if (v <= this.min) this.argmin = null;",set:"this.argmin || cell.data.argmin(this.get)",req:["min"],str:["values"],idx:3}),argmax:Q({name:"argmax",add:"if (v > this.max) this.argmax = t;",rem:"if (v >= this.max) this.argmax = null;",set:"this.argmax || cell.data.argmax(this.get)",req:["max"],str:["values"],idx:3}),min:Q({name:"min",init:"this.min = null;",add:"if (v < this.min || this.min === null) this.min = v;",rem:"if (v <= this.min) this.min = NaN;",set:"this.min = (isNaN(this.min) ? cell.data.min(this.get) : this.min)",str:["values"],idx:4}),max:Q({name:"max",init:"this.max = null;",add:"if (v > this.max || this.max === null) this.max = v;",rem:"if (v >= this.max) this.max = NaN;",set:"this.max = (isNaN(this.max) ? cell.data.max(this.get) : this.max)",str:["values"],idx:4})},Fe=e.inherits(tt,V);Fe.transform=function(t,e){var i,n=this,r=e.fork(e.NO_SOURCE|e.NO_FIELDS);return this.stamp=r.stamp,this.value&&((i=t.modified())||e.modified(this._inputs))?(this._prev=this.value,this.value=i?this.init(t):{},e.visit(e.SOURCE,function(t){n.add(t)})):(this.value=this.value||this.init(t),e.visit(e.REM,function(t){n.rem(t)}),e.visit(e.ADD,function(t){n.add(t)})),r.modifies(this._outputs),n._drop=t.drop!==!1,n.changes(r)},Fe.init=function(t){function i(t){for(var e,i=t.fields,r=0,a=i.length;r<a;++r)s[e=i[r]]||(s[e]=1,n.push(e))}var n=this._inputs=[],r=this._outputs=[],s={};this._dims=e.array(t.groupby),this._dnames=this._dims.map(function(t){var n=e.accessorName(t);return i(t),r.push(n),n}),this.cellkey=t.key?t.key:0===this._dims.length?function(){return""}:1===this._dims.length?this._dims[0]:it,this._countOnly=!0,this._counts=[],this._measures=[];var a,u,o,l,h,d,f=t.fields||[null],c=t.ops||["count"],m=t.as||[],v=f.length,p={};for(v!==c.length&&e.error("Unmatched number of fields and aggregate ops."),d=0;d<v;++d)a=f[d],u=c[d],null==a&&"count"!==u&&e.error("Null aggregate field specified."),l=e.accessorName(a),h=et(u,l,m[d]),r.push(h),"count"!==u?(o=p[l],o||(i(a),o=p[l]=[],o.field=a,this._measures.push(o)),"count"!==u&&(this._countOnly=!1),o.push(J(u,h))):this._counts.push(h);return this._measures=this._measures.map(function(t){return Z(t,t.field)}),{}},Fe.cellkey=it,Fe.cell=function(t,e){var i=this.value[t];return i?0===i.num&&this._drop&&i.stamp<this.stamp?(i.stamp=this.stamp,this._adds[this._alen++]=i):i.stamp<this.stamp&&(i.stamp=this.stamp,this._mods[this._mlen++]=i):(i=this.value[t]=this.newcell(t,e),this._adds[this._alen++]=i),i},Fe.newcell=function(t,e){var i={key:t,num:0,agg:null,tuple:this.newtuple(e,this._prev&&this._prev[t]),stamp:this.stamp,store:!1};if(!this._countOnly){var n,r=this._measures,s=r.length;for(i.agg=Array(s),n=0;n<s;++n)i.agg[n]=new r[n](i,i.tuple)}return i.store&&(i.data=new H),i},Fe.newtuple=function(t,e){var i,n,r=this._dnames,s=this._dims,a={};for(i=0,n=s.length;i<n;++i)a[r[i]]=s[i](t);return e?d(e.tuple,a):o(a)},Fe.add=function(t){var e,i,n,r=this.cellkey(t),s=this.cell(r,t);if(s.num+=1,!this._countOnly)for(s.store&&s.data.add(t),e=s.agg,i=0,n=e.length;i<n;++i)e[i].add(e[i].get(t),t)},Fe.rem=function(t){var e,i,n,r=this.cellkey(t),s=this.cell(r,t);if(s.num-=1,!this._countOnly)for(s.store&&s.data.rem(t),e=s.agg,i=0,n=e.length;i<n;++i)e[i].rem(e[i].get(t),t)},Fe.celltuple=function(t){var e,i,n,r=t.tuple,s=this._counts;for(t.store&&t.data.values(),i=0,n=s.length;i<n;++i)r[s[i]]=t.num;if(!this._countOnly)for(e=t.agg,i=0,n=e.length;i<n;++i)e[i].set();return r},Fe.changes=function(t){var e,i,n,r,s=this._adds,a=this._mods,u=this._prev,o=this._drop,l=t.add,h=t.rem,d=t.mod;if(u)for(i in u)h.push(u[i].tuple);for(n=0,r=this._alen;n<r;++n)l.push(this.celltuple(s[n])),s[n]=null;for(n=0,r=this._mlen;n<r;++n)e=a[n],(0===e.num&&o?h:d).push(this.celltuple(e)),a[n]=null;return this._alen=this._mlen=0,this._prev=null,t};var Oe=e.inherits(nt,V);Oe.transform=function(t,i){var n=this._bins(t),r=n.step,s=t.as||["bin0","bin1"],a=s[0],u=s[1],o=t.modified()?(i.reflow(),i.SOURCE):i.modified(e.accessorFields(t.field))?i.ADD_MOD:i.ADD;return i.visit(o,function(t){t[u]=(t[a]=n(t))+r}),i.modifies(s)},Oe._bins=function(t){if(this.value&&!t.modified())return this.value;var i=t.field,r=n.bin(t),s=r.start,a=r.step,u=function(t){var e=i(t);return null==e?null:s+a*Math.floor((+e-s)/a)};return u.step=a,this.value=e.accessor(u,e.accessorFields(i),t.name||"bin_"+e.accessorName(i))};var Ae=e.inherits(rt,V);Ae.transform=function(t,i){var n,r=i.fork(i.ALL),s=i.changed(i.ADD),a=i.changed(),u=t.sort,o=this.value,l=function(t){o.push(t)},h=0;return r.rem.length&&(n={},r.visit(r.REM,function(t){n[t._id]=1,++h}),o=o.filter(function(t){return!n[t._id]})),u?((t.modified("sort")||i.modified(u.fields))&&(o.sort(u),a=!0),s&&(o=e.merge(u,o,r.add.sort(u)))):s&&r.visit(r.ADD,l),this.modified(a),this.value=r.source=o,r},e.inherits(st,p);var Ee=e.inherits(ut,V);Ee.transform=function(t,e){function i(e){return function(i){for(var n,r=ot(u(i),t.case,s)||[],o=0,l=r.length;o<l;++o)a.test(n=r[o])||e(n)}}var n=this._parameterCheck(t,e),r=this._counts,s=this._match,a=this._stop,u=t.field,o=t.as||["text","count"],l=i(function(t){r[t]=1+(r[t]||0)}),h=i(function(t){r[t]-=1});return n?e.visit(e.SOURCE,l):(e.visit(e.ADD,l),e.visit(e.REM,h)),this._finish(e,o)},Ee._parameterCheck=function(t,e){var i=!1;return!t.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(t.stopwords||"")+"$","i"),i=!0),!t.modified("pattern")&&this._match||(this._match=new RegExp(t.pattern||"[\\w']+","g"),i=!0),(t.modified("field")||e.modified(t.field.fields))&&(i=!0),i&&(this._counts={}),i},Ee._finish=function(t,e){var i,n,r,s=this._counts,a=this._tuples||(this._tuples={}),u=e[0],l=e[1],h=t.fork();for(i in s)n=a[i],r=s[i]||0,!n&&r?(a[i]=n=o({}),n[u]=i,n[l]=r,h.add.push(n)):0===r?(n&&h.rem.push(n),s[i]=null,a[i]=null):n[l]!==r&&(n[l]=r,h.mod.push(n));return h.modifies(e)};var be=e.inherits(lt,V);be.transform=function(t,i){var n=i.fork(i.NO_SOURCE),r=this.value,s=t.as||["a","b"],a=s[0],u=s[1],o=!r||i.changed(i.ADD_REM)||t.modified("as")||t.modified("filter");return o?(r&&(n.rem=r),n.add=this.value=ht(i.source,a,u,t.filter||e.truthy)):n.mod=r,n.source=this.value,n.modifies(s)};var Me=e.inherits(dt,V);Me.transform=function(t,e){var i,n=this.value,r=t.field,s=n[0],a=n[1],u=e.ADD;i=e.changed()||e.modified(r.fields)||t.modified("field"),i&&(u=e.SOURCE,s=+(1/0),a=-(1/0)),e.visit(u,function(t){var e=r(t);e<s&&(s=e),e>a&&(a=e)}),this.value=[s,a]};var Re=e.inherits(ft,p);Re.connect=function(t){return this.targets().add(t),t.source=this},Re.add=function(t){this.value.add.push(t)},Re.rem=function(t){this.value.rem.push(t)},Re.mod=function(t){this.value.mod.push(t)},Re.init=function(t){this.value.init(t)},Re.evaluate=function(){return this.value};var Se=e.inherits(ct,V);Se.activate=function(t){this._targets[this._targets.active++]=t},Se.subflow=function(t,e,i,n){var r,s,a=this.value,u=a.hasOwnProperty(t)&&a[t];return u?u.value.stamp<i.stamp&&(u.init(i),this.activate(u)):(s=n||(s=this._group[t])&&s.tuple,r=i.dataflow,u=r.add(new ft(i.fork(),this)).connect(e(r,t,this._count++,s)),a[t]=u,this.activate(u)),u},Se.transform=function(t,e){function i(t){return n.subflow(t,s,e)}var n=this,r=t.key,s=t.subflow,a=this._keys,u=t.modified("key");return this._group=t.group||{},this._targets.active=0,e.visit(e.ADD,function(t){i(a[t._id]=r(t)).add(t)}),e.visit(e.REM,function(t){var e=a[t._id];a[t._id]=null,i(e).rem(t)}),u||e.modified(r.fields)?e.visit(e.MOD,function(t){var e=a[t._id],n=r(t);e===n?i(n).mod(t):(a[t._id]=n,i(e).rem(t),i(n).add(t))}):e.changed(e.MOD)&&e.visit(e.MOD,function(t){i(a[t._id]).mod(t)}),u&&e.visit(e.REFLOW,function(t){var e=a[t._id],n=r(t);e!==n&&(a[t._id]=n,i(e).rem(t),i(n).add(t))}),e},e.inherits(mt,p);var Pe=e.inherits(pt,V);Pe.transform=function(t,e){function i(e){var i=n(e,t),s=r[e._id];i&&s?(r[e._id]=0,a.push(e)):i||s?l&&i&&!s&&o.push(e):(r[e._id]=1,u.push(e))}var n=t.expr,r=this.value,s=e.fork(),a=s.add,u=s.rem,o=s.mod,l=!0;return e.visit(e.REM,function(t){r[t._id]?r[t._id]=0:u.push(t)}),e.visit(e.ADD,function(e){n(e,t)?a.push(e):r[e._id]=1}),e.visit(e.MOD,i),t.modified()&&(l=!1,e.visit(e.REFLOW,i)),s};var Ne=e.inherits(gt,V);Ne.transform=function(t,e){function i(t){for(var e,i=s[t._id]=Array(m),n=0;n<m;++n)e=i[n]=l(t),e[d]=c[n],e[f]=u[n](t),p.add.push(e)}function n(t){for(var e,i=s[t._id],n=0;n<m;++n)_&1<<n&&(e=h(t,i[n],v),e[d]=c[n],e[f]=u[n](t),p.mod.push(e))}var r,s=this.value,a=t.modified("fields"),u=t.fields,o=t.as||["key","value"],d=o[0],f=o[1],c=u.map(_t),m=u.length,v=e.stamp,p=e.fork(),g=0,_=0;if(a){for(r in s)p.rem.push.apply(p.rem,s[r]);s=this.value={},e.visit(e.SOURCE,i)}else{for(e.visit(e.ADD,i);g<m;++g)e.modified(u[g].fields)&&(_|=1<<g);_&&e.visit(e.MOD,n),e.visit(e.REM,function(t){p.rem.push.apply(p.rem,s[t._id]),s[t._id]=null})}return p.modifies(o)};var Ce=e.inherits(yt,V);Ce.transform=function(t,e){function i(e){e[s]=r(e,t)}var n,r=t.expr,s=t.as;return t.modified()?e.materialize().reflow().visit(e.SOURCE,i):(n=e.modified(r.fields),e.visit(n?e.ADD_MOD:e.ADD,i)),e.modifies(s)};var Le=e.inherits(xt,V);Le.transform=function(t,e){var i,n,r,s=this.value,a=e.fork(e.ALL),u=t.size-s.length,l=t.generator;if(u>0){for(i=[];--u>=0;)i.push(r=o(l(t))),s.push(r);a.add=a.add.length?a.materialize(a.ADD).add.concat(i):i}else n=s.slice(0,-u),a.rem=a.rem.length?a.materialize(a.REM).rem.concat(n):n,s=s.slice(-u);return a.source=this.value=s,a};var Ue={value:"value",median:r.median,mean:r.mean,min:r.min,max:r.max},ze=[],Ie=e.inherits(kt,V);Ie.transform=function(t,i){var n,r,s,a,u,l,h,d,f,c,m=i.fork(i.ALL),v=qt(t),p=Dt(t),g=e.accessorName(t.field),_=t.groupby.map(e.accessorName),y=t.orderby.map(e.accessorName),x=wt(i.source,t.groupby,t.orderby),k=[],q=this.value,D=x.domain.length;for(u=0,d=x.length;u<d;++u)for(n=x[u],s=n.values,r=NaN,h=0;h<D;++h)if(null==n[h]){for(a=x.domain[h],c={_impute:!0},l=0,f=s.length;l<f;++l)c[_[l]]=s[l];for(l=0,f=a.length;l<f;++l)c[y[l]]=a[l];c[g]=isNaN(r)?r=v(n,p):r,k.push(o(c))}return k.length&&(m.add=m.materialize(m.ADD).add.concat(k)),q.length&&(m.rem=m.materialize(m.REM).rem.concat(q)),this.value=k,m},e.inherits(Ft,p);var Te=e.inherits(At,V);Te.transform=function(t,e){var i,n,r,s,a=e,u=t.as,o=t.fields,l=t.index,h=null==t.default?null:t.default,d=t.modified(),f=e.ADD;return 1===o.length?(n=o[0],r=u[0],i=function(t){var e=Et(l,n(t));t[r]=null==e?h:e}):i=function(t){for(var e,i=0,n=o.length;i<n;++i)e=Et(l,o[i](t)),t[u[i]]=null==e?h:e},d?(f=e.SOURCE,a=e.fork(e.ALL).reflow()):(s=o.some(function(t){
return e.modified(t.fields)}),f|=s?e.MOD:0),e.visit(f,i),a.modifies(u)},e.inherits(bt,p),e.inherits(Rt,p),e.inherits(Pt,V),Pt.prototype.transform=function(t,e){return this.modified(t.modified()),this.value=t,e.fork()};var je=e.inherits(Nt,ct);je.transform=function(t,i){var n=this,r=t.subflow,s=t.field;return(t.modified("field")||s&&i.modified(s.fields))&&e.error("PreFacet does not support field modification."),this._targets.active=0,i.visit(i.ADD,function(t){var e=n.subflow(t._id,r,i,t);s?s(t).forEach(function(t){e.add(o(t))}):e.add(t)}),i.visit(i.REM,function(t){var e=n.subflow(t._id,r,i,t);s?s(t).forEach(function(t){e.rem(t)}):e.rem(t)}),i};var We=e.inherits(Ct,V);We.transform=function(t,e){if(t.modified()){var i=e.materialize().fork(e.MOD);return i.rem=e.rem.concat(this.value),i.source=this.value=r.range(t.start,t.stop,t.step).map(o),i.add=e.add.concat(this.value),i}};var Ge=e.inherits(Lt,V);Ge.transform=function(t,i){i.source||e.error("Rank transform requires an upstream data source.");var n,r=t.normalize,s=t.field,a=t.as||"rank",u={},o=-1;return s?(i.visit(i.SOURCE,function(t){var e=s(t);null==u[e]&&(u[e]=++o)}),i.visit(i.SOURCE,r&&--o?function(t){t[a]=u[s(t)]/o}:function(t){t[a]=u[s(t)]})):(o+=i.source.length,n=-1,i.visit(i.SOURCE,r&&o?function(t){t[a]=++n/o}:function(t){t[a]=++n})),i.reflow().modifies(a)};var Ve=e.inherits(Ut,V);Ve.transform=function(t,e){var i,n=this.value||(i=e=e.addAll(),this.value={});return t.derive&&(i=e.fork(),e.visit(e.ADD,function(t){var e=l(t);n[t._id]=e,i.add.push(e)}),e.visit(e.MOD,function(t){i.mod.push(h(t,n[t._id]))}),e.visit(e.REM,function(t){i.rem.push(n[t._id]),n[t._id]=null})),i};var Be=e.inherits(zt,V);Be.transform=function(t,e){function i(t){var e,i;a.length<s?a.push(t):(i=~~(u*Math.random()),i<a.length&&i>=o&&(e=a[i],l[e._id]&&n.rem.push(e),a[i]=t)),++u}var n=e.fork(),r=t.modified("size"),s=t.size,a=this.value,u=this.count,o=0,l=a.reduce(function(t,e){return t[e._id]=1,t},{});if(e.rem.length&&(e.visit(e.REM,function(t){l[t._id]&&(l[t._id]=-1,n.rem.push(t)),--u}),a=a.filter(function(t){return l[t._id]!==-1})),(e.rem.length||r)&&a.length<s&&e.source&&(o=u=a.length,e.visit(e.SOURCE,function(t){l[t._id]||i(t)}),o=-1),r&&a.length>s){for(var h=0,d=a.length-s;h<d;++h)l[a[h]._id]=-1,n.rem.push(a[h]);a=a.slice(d)}return e.mod.length&&e.visit(e.MOD,function(t){l[t._id]&&n.mod.push(t)}),e.add.length&&e.visit(e.ADD,i),(e.add.length||o<0)&&(n.add=a.filter(function(t){return!l[t._id]})),this.count=u,this.value=n.source=a,n};var Ke=e.inherits(It,V);Ke.transform=function(t,e){return this.value=e.source,e.changed()?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation};var $e=e.inherits(Tt,V);$e.transform=function(t,e){function i(t){r[n(t)]=t}var n=t.field,r=this.value,s=!0;return t.modified("field")||e.modified(n.fields)?(this.value=r={},e.visit(e.SOURCE,i)):e.changed()?(e.visit(e.REM,function(t){r[n(t)]=void 0}),e.visit(e.ADD,i)):s=!1,this.modified(s),e.fork()};var He=e.inherits(jt,V);He.transform=function(t,e){var i=!this.value||t.modified("field")||t.modified("sort")||e.changed()||t.sort&&e.modified(t.sort.fields);i&&(this.value=(t.sort?e.source.slice().sort(t.sort):e.source).map(t.field))};var Je={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"fields",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:["count","valid","missing","distinct","sum","mean","average","variance","variancep","stdev","stdevp","median","q1","q3","modeskew","min","max","argmin","argmax"]},{name:"as",type:"string",array:!0},{name:"drop",type:"boolean",default:!0},{name:"key",type:"field"}]},Qe={type:"Bin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"maxbins",type:"number",default:20},{name:"base",type:"number",default:10},{name:"divide",type:"number",array:!0,default:[5,2]},{name:"extent",type:"number",array:!0,length:2,required:!0},{name:"step",type:"number"},{name:"steps",type:"number",array:!0},{name:"minstep",type:"number",default:0},{name:"nice",type:"boolean",default:!0},{name:"name",type:"string"},{name:"as",type:"string",array:!0,length:2,default:["bin0","bin1"]}]},Xe={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},Ye={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]},Ze={type:"Cross",metadata:{source:!0,generates:!0,changes:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},ti={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},ei={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},ii={type:"Fold",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0,length:2,default:["key","value"]}]},ni={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0}]},ri={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"orderby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},si={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0,required:!0},{name:"default",default:null}]},ai={type:"Range",metadata:{generates:!0,source:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1}],output:["value"]},ui={type:"Rank",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"normalize",type:"boolean",default:!1},{name:"as",type:"string",default:"rank"}]},oi={type:"Sample",metadata:{source:!0,changes:!0},params:[{name:"size",type:"number",default:1e3}]};B(Je,tt),B(Qe,nt),B(Xe,rt),B(Ye,ut),B(Ze,lt),B(ti,dt),B(ei,pt),B(ii,gt),B(ni,yt),B(ri,kt),B(si,At),B(ai,Ct),B(ui,Lt),B(oi,zt),$("Compare",st),$("Facet",ct),$("Field",mt),$("Generate",xt),$("Key",Ft),$("MultiExtent",bt),$("MultiValues",Rt),$("Params",Pt),$("PreFacet",Nt),$("Relay",Ut),$("Sieve",It),$("Subflow",ft),$("TupleIndex",Tt),$("Values",jt),t.UniqueList=s,t.changeset=c,t.Dataflow=W,t.EventStream=_,t.Parameters=m,t.Pulse=w,t.MultiPulse=P,t.Operator=p,t.Transform=V,t.ingest=o,t.tupleid=a,t.definition=K,t.definitions=qe,t.register=B,t.transform=$,t.transforms=ke,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "vega-dataflow",
"version": "2.0.0-beta",
"version": "2.0.0-beta.1",
"description": "Reactive dataflow processing.",

@@ -33,3 +33,3 @@ "keywords": [

"d3-array": "1",
"vega-loader": "1",
"vega-loader": ">=2.0.0-beta",
"vega-statistics": "1",

@@ -36,0 +36,0 @@ "vega-util": "1"

@@ -7,3 +7,3 @@ import add from './dataflow/add';

import {pulse, touch, update} from './dataflow/update';
import {ingest, request, loadOptions} from './dataflow/load';
import {ingest, request} from './dataflow/load';
import {run, runAsync, runAfter, enqueue, getPulse} from './dataflow/run';

@@ -13,2 +13,3 @@ import changeset from './ChangeSet';

import UniqueList from './util/UniqueList';
import {loader} from 'vega-loader';
import {id, logger} from 'vega-util';

@@ -25,2 +26,3 @@

this._rank = 0;
this._loader = loader();

@@ -49,2 +51,17 @@ this._touched = UniqueList(id);

/**
* Gets or sets the loader instance to use for data file loading. A
* loader object must provide a "load" method for loading files and a
* "sanitize" method for checking URL/filename validity. Both methods
* should accept a URI and options hash as arguments, and return a Promise
* that resolves to the loaded file contents or sanitized URL string,
* respectively.
* @param {object} _ - The loader instance to use.
* @return {object|Dataflow} - If no arguments are provided, returns
* the current loader instance. Otherwise returns this Dataflow instance.
*/
prototype.loader = function(_) {
return arguments.length ? (this._loader = _, this) : this._loader;
};
// OPERATOR REGISTRATION

@@ -65,3 +82,2 @@ prototype.add = add;

prototype.request = request;
prototype.loadOptions = loadOptions;

@@ -68,0 +84,0 @@ // EVENT HANDLING

@@ -6,3 +6,3 @@ import Operator from '../Operator';

* Add an operator to the dataflow graph. This function accepts a
* variety of input argument types. The basic signature support an
* variety of input argument types. The basic signature supports an
* initial value, update function and parameters. If the first parameter

@@ -9,0 +9,0 @@ * is an Operator instance, it will be added directly. If it is a

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

import {load, read} from 'vega-loader';
import {read} from 'vega-loader';

@@ -7,6 +7,2 @@ export function ingest(target, data, format) {

export function loadOptions(_) {
return arguments.length ? (this._loadopt = _, this) : this._loadopt;
}
function loadPending(df) {

@@ -37,3 +33,4 @@ var pending = new Promise(function(accept) { resolve = accept; }),

load(url, df.loadOptions())
df.loader()
.load(url, {context:'dataflow'})
.then(

@@ -40,0 +37,0 @@ function(data) {

@@ -13,3 +13,8 @@ import {default as Pulse, StopPropagation} from '../Pulse';

* asynchronously invoked when data loading completes. To track when dataflow
* evaluation completes, use the runAsync instead.
* evaluation completes, use the {@link runAsync} method instead.
* @param {string} [encode] - The name of an encoding set to invoke during
* propagation. This value is added to generated Pulse instances;
* operators can then respond to (or ignore) this setting as appropriate.
* This parameter can be used in conjunction with the Encode transform in
* the vega-encode module.
*/

@@ -125,2 +130,7 @@ export function run(encode) {

* operator's qrank to the current rank value.
* @param {Operator} op - The operator to enqueue.
* @param {boolean} [force] - A flag indicating if the operator should be
* forceably added to the queue, even if it has already been previously
* enqueued during the current pulse propagation. This is useful when the
* dataflow graph is dynamically modified and the operator rank changes.
*/

@@ -144,2 +154,5 @@ export function enqueue(op, force) {

* Else we use the pulse from the pulse map, but copy the source tuple array.
* @param {Operator} op - The operator for which to get an input pulse.
* @param {string} [encode] - An (optional) encoding set name with which to
* annotate the returned pulse. See {@link run} for more information.
*/

@@ -146,0 +159,0 @@ export function getPulse(op, encode) {

@@ -8,3 +8,3 @@ import Pulse from '../Pulse';

* a pulse propagation, the operator will be evaluated the next time this
* data flow is run. If invoked in the midst of pulse propagation, the operator
* dataflow is run. If invoked in the midst of pulse propagation, the operator
* will be queued for evaluation if and only if the operator has not yet been

@@ -11,0 +11,0 @@ * evaluated on the current propagation timestamp.

@@ -37,2 +37,7 @@ import {array, isArray, visitArray} from 'vega-util';

* @param {Dataflow} dataflow - The backing dataflow instance.
* @param {number} stamp - The current propagation timestamp.
* @param {string} [encode] - An optional encoding set name, which is then
* accessible as Pulse.encode. Operators can respond to (or ignore) this
* setting as appropriate. This parameter can be used in conjunction with
* the Encode transform in the vega-encode module.
*/

@@ -152,3 +157,3 @@ export default function Pulse(dataflow, stamp, encode) {

* to the new pulse. Use the NO_SOURCE flag to enforce a null source.
* @return {Pulse}
* @return {Pulse} - Returns this Pulse instance.
*/

@@ -177,2 +182,9 @@ prototype.init = function(src, flags) {

/**
* Indicates if tuples have been added, removed or modified.
* @param {number} [flags] - The tuple types (ADD, REM or MOD) to query.
* Defaults to ALL, returning true if any tuple type has changed.
* @return {boolean} - Returns true if one or more queried tuple types have
* changed, false otherwise.
*/
prototype.changed = function(flags) {

@@ -185,2 +197,7 @@ var f = flags || ALL;

/**
* Forces a "reflow" of tuple values, such that all tuples in the backing
* source are added to the MOD set, unless already present in the ADD set.
* @return {Pulse} - This pulse instance.
*/
prototype.reflow = function() {

@@ -196,2 +213,8 @@ var len = this.add.length,

/**
* Marks one or more data field names as modified to assist dependency
* tracking and incremental processing by transform operators.
* @param {string|Array<string>} _ - The field(s) to mark as modified.
* @return {Pulse} - This pulse instance.
*/
prototype.modifies = function(_) {

@@ -204,2 +227,9 @@ var fields = array(_),

/**
* Checks if one or more data fields have been modified during this pulse
* propagation timestamp.
* @param {string|Array<string>} _ - The field(s) to check for modified.
* @return {boolean} - Returns true if any of the provided fields has been
* marked as modified, false otherwise.
*/
prototype.modified = function(_) {

@@ -213,2 +243,17 @@ var fields = this.fields;

/**
* Adds a filter function to one more tuple sets. Filters are applied to
* backing tuple arrays, to determine the actual set of tuples considered
* added, removed or modified. They can be used to delay materialization of
* a tuple set in order to avoid expensive array copies. In addition, the
* filter functions can serve as value transformers: unlike standard predicate
* function (which return boolean values), Pulse filters should return the
* actual tuple value to process. If a tuple set is already filtered, the
* new filter value will be appended into a conjuntive ('and') query.
* @param {number} flags - Flags indicating the tuple set(s) to filter.
* @param {function(*):object} filter - Filter function that will be applied
* to the tuple set array, and should return a data tuple if the value
* should be included in the tuple set, and falsy (or null) otherwise.
* @return {Pulse} - Returns this pulse instance.
*/
prototype.filter = function(flags, filter) {

@@ -227,2 +272,9 @@ var p = this;

/**
* Materialize one or more tuple sets in this pulse. If the tuple set(s) have
* a registered filter function, it will be applied and the tuple set(s) will
* be replaced with materialized tuple arrays.
* @param {number} flags - Flags indicating the tuple set(s) to materialize.
* @return {Pulse} - Returns this pulse instance.
*/
prototype.materialize = function(flags) {

@@ -246,2 +298,10 @@ flags = flags || ALL;

/**
* Visit one or more tuple sets in this pulse.
* @param {number} flags - Flags indicating the tuple set(s) to visit.
* Legal values are ADD, REM, MOD and SOURCE (if a backing data source
* has been set).
* @param {function(object):*} - Visitor function invoked per-tuple.
* @return {Pulse} - Returns this pulse instance.
*/
prototype.visit = function(flags, visitor) {

@@ -248,0 +308,0 @@ var v = visitor, src, sum;

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc