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

vega-encode

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-encode - npm Package Compare versions

Comparing version 4.9.0 to 4.9.1

rollup.config.mjs

670

build/vega-encode.js

@@ -23,3 +23,2 @@ (function (global, factory) {

*/
function AxisTicks(params) {

@@ -33,11 +32,10 @@ vegaDataflow.Transform.call(this, null, params);

}
var locale = pulse.dataflow.locale(),
out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
ticks = this.value,
scale = _.scale,
tally = _.count == null ? _.values ? _.values.length : 10 : _.count,
count = vegaScale.tickCount(scale, tally, _.minstep),
format = _.format || vegaScale.tickFormat(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values),
values = _.values ? vegaScale.validTicks(scale, _.values, count) : vegaScale.tickValues(scale, count);
out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
ticks = this.value,
scale = _.scale,
tally = _.count == null ? _.values ? _.values.length : 10 : _.count,
count = vegaScale.tickCount(scale, tally, _.minstep),
format = _.format || vegaScale.tickFormat(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values),
values = _.values ? vegaScale.validTicks(scale, _.values, count) : vegaScale.tickValues(scale, count);
if (ticks) out.rem = ticks;

@@ -49,3 +47,2 @@ ticks = values.map((value, i) => vegaDataflow.ingest({

}));
if (_.extra && ticks.length) {

@@ -62,3 +59,2 @@ // add an extra tick pegged to the initial domain value

}
out.source = ticks;

@@ -69,3 +65,2 @@ out.add = ticks;

}
});

@@ -80,36 +75,29 @@

*/
function DataJoin(params) {
vegaDataflow.Transform.call(this, null, params);
}
function defaultItemCreate() {
return vegaDataflow.ingest({});
}
function newMap(key) {
const map = vegaUtil.fastmap().test(t => t.exit);
map.lookup = t => map.get(key(t));
return map;
}
vegaUtil.inherits(DataJoin, vegaDataflow.Transform, {
transform(_, pulse) {
var df = pulse.dataflow,
out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
item = _.item || defaultItemCreate,
key = _.key || vegaDataflow.tupleid,
map = this.value; // prevent transient (e.g., hover) requests from
out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
item = _.item || defaultItemCreate,
key = _.key || vegaDataflow.tupleid,
map = this.value;
// prevent transient (e.g., hover) requests from
// cascading across marks derived from marks
if (vegaUtil.isArray(out.encode)) {
out.encode = null;
}
if (map && (_.modified('key') || pulse.modified(key))) {
vegaUtil.error('DataJoin does not support modified key function or fields.');
}
if (!map) {

@@ -119,7 +107,5 @@ pulse = pulse.addAll();

}
pulse.visit(pulse.ADD, t => {
const k = key(t);
let x = map.get(k);
if (x) {

@@ -137,3 +123,2 @@ if (x.exit) {

}
x.datum = t;

@@ -144,4 +129,3 @@ x.exit = false;

const k = key(t),
x = map.get(k);
x = map.get(k);
if (x) {

@@ -154,4 +138,3 @@ x.datum = t;

const k = key(t),
x = map.get(k);
x = map.get(k);
if (t === x.datum && !x.exit) {

@@ -164,10 +147,7 @@ out.rem.push(x);

if (pulse.changed(pulse.ADD_MOD)) out.modifies('datum');
if (pulse.clean() || _.clean && map.empty > df.cleanThreshold) {
df.runAfter(map.clean);
}
return out;
}
});

@@ -187,3 +167,2 @@

*/
function Encode(params) {

@@ -195,8 +174,9 @@ vegaDataflow.Transform.call(this, null, params);

var out = pulse.fork(pulse.ADD_REM),
fmod = _.mod || false,
encoders = _.encoders,
encode = pulse.encode; // if an array, the encode directive includes additional sets
fmod = _.mod || false,
encoders = _.encoders,
encode = pulse.encode;
// if an array, the encode directive includes additional sets
// that must be defined in order for the primary set to be invoked
// e.g., only run the update set if the hover set is defined
if (vegaUtil.isArray(encode)) {

@@ -209,11 +189,10 @@ if (out.changed() || encode.every(e => encoders[e])) {

}
} // marshall encoder functions
}
// marshall encoder functions
var reenter = encode === 'enter',
update = encoders.update || vegaUtil.falsy,
enter = encoders.enter || vegaUtil.falsy,
exit = encoders.exit || vegaUtil.falsy,
set = (encode && !reenter ? encoders[encode] : update) || vegaUtil.falsy;
update = encoders.update || vegaUtil.falsy,
enter = encoders.enter || vegaUtil.falsy,
exit = encoders.exit || vegaUtil.falsy,
set = (encode && !reenter ? encoders[encode] : update) || vegaUtil.falsy;
if (pulse.changed(pulse.ADD)) {

@@ -226,3 +205,2 @@ pulse.visit(pulse.ADD, t => {

out.modifies(update.output);
if (set !== vegaUtil.falsy && set !== update) {

@@ -235,3 +213,2 @@ pulse.visit(pulse.ADD, t => {

}
if (pulse.changed(pulse.REM) && exit !== vegaUtil.falsy) {

@@ -243,6 +220,4 @@ pulse.visit(pulse.REM, t => {

}
if (reenter || set !== vegaUtil.falsy) {
const flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0);
if (reenter) {

@@ -259,9 +234,6 @@ pulse.visit(flag, t => {

}
if (out.mod.length) out.modifies(set.output);
}
return out.changed() ? out : pulse.StopPropagation;
}
});

@@ -287,3 +259,2 @@

*/
function LegendEntries(params) {

@@ -297,20 +268,18 @@ vegaDataflow.Transform.call(this, [], params);

}
var locale = pulse.dataflow.locale(),
out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
items = this.value,
type = _.type || vegaScale.SymbolLegend,
scale = _.scale,
limit = +_.limit,
count = vegaScale.tickCount(scale, _.count == null ? 5 : _.count, _.minstep),
lskip = !!_.values || type === vegaScale.SymbolLegend,
format = _.format || vegaScale.labelFormat(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip),
values = _.values || vegaScale.labelValues(scale, count),
domain,
fraction,
size,
offset,
ellipsis;
out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
items = this.value,
type = _.type || vegaScale.SymbolLegend,
scale = _.scale,
limit = +_.limit,
count = vegaScale.tickCount(scale, _.count == null ? 5 : _.count, _.minstep),
lskip = !!_.values || type === vegaScale.SymbolLegend,
format = _.format || vegaScale.labelFormat(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip),
values = _.values || vegaScale.labelValues(scale, count),
domain,
fraction,
size,
offset,
ellipsis;
if (items) out.rem = items;
if (type === vegaScale.SymbolLegend) {

@@ -324,3 +293,2 @@ if (limit && values.length > limit) {

}
if (vegaUtil.isFunction(size = _.size)) {

@@ -330,5 +298,4 @@ // if first value maps to size zero, remove from list (vega#717)

items = items.slice(1);
} // compute size offset for legend entries
}
// compute size offset for legend entries
offset = items.reduce((max, value) => Math.max(max, size(value, _)), 0);

@@ -338,3 +305,2 @@ } else {

}
items = items.map((value, index) => vegaDataflow.ingest({

@@ -347,3 +313,2 @@ index: index,

}));
if (ellipsis) {

@@ -360,9 +325,9 @@ ellipsis = values[items.length];

} else if (type === vegaScale.GradientLegend) {
domain = scale.domain(), fraction = vegaScale.scaleFraction(scale, domain[0], vegaUtil.peek(domain)); // if automatic label generation produces 2 or fewer values,
domain = scale.domain(), fraction = vegaScale.scaleFraction(scale, domain[0], vegaUtil.peek(domain));
// if automatic label generation produces 2 or fewer values,
// use the domain end points instead (fixes vega/vega#1364)
if (values.length < 3 && !_.values && domain[0] !== vegaUtil.peek(domain)) {
values = [domain[0], vegaUtil.peek(domain)];
}
items = values.map((value, index) => vegaDataflow.ingest({

@@ -385,3 +350,2 @@ index: index,

}
out.source = items;

@@ -392,12 +356,9 @@ out.add = items;

}
});
const sourceX = t => t.source.x;
const sourceY = t => t.source.y;
const targetX = t => t.target.x;
const targetY = t => t.target.y;
const targetY = t => t.target.y;
/**

@@ -408,4 +369,2 @@ * Layout paths linking source and target elements.

*/
function LinkPath(params) {

@@ -457,14 +416,12 @@ vegaDataflow.Transform.call(this, {}, params);

var sx = _.sourceX || sourceX,
sy = _.sourceY || sourceY,
tx = _.targetX || targetX,
ty = _.targetY || targetY,
as = _.as || 'path',
orient = _.orient || 'vertical',
shape = _.shape || 'line',
path = Paths.get(shape + '-' + orient) || Paths.get(shape);
sy = _.sourceY || sourceY,
tx = _.targetX || targetX,
ty = _.targetY || targetY,
as = _.as || 'path',
orient = _.orient || 'vertical',
shape = _.shape || 'line',
path = Paths.get(shape + '-' + orient) || Paths.get(shape);
if (!path) {
vegaUtil.error('LinkPath unsupported type: ' + _.shape + (_.orient ? '-' + _.orient : ''));
}
pulse.visit(pulse.SOURCE, t => {

@@ -475,42 +432,31 @@ t[as] = path(sx(t), sy(t), tx(t), ty(t));

}
});
const line = (sx, sy, tx, ty) => 'M' + sx + ',' + sy + 'L' + tx + ',' + ty;
const lineR = (sa, sr, ta, tr) => line(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));
const arc = (sx, sy, tx, ty) => {
var dx = tx - sx,
dy = ty - sy,
rr = Math.sqrt(dx * dx + dy * dy) / 2,
ra = 180 * Math.atan2(dy, dx) / Math.PI;
dy = ty - sy,
rr = Math.sqrt(dx * dx + dy * dy) / 2,
ra = 180 * Math.atan2(dy, dx) / Math.PI;
return 'M' + sx + ',' + sy + 'A' + rr + ',' + rr + ' ' + ra + ' 0 1' + ' ' + tx + ',' + ty;
};
const arcR = (sa, sr, ta, tr) => arc(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));
const curve = (sx, sy, tx, ty) => {
const dx = tx - sx,
dy = ty - sy,
ix = 0.2 * (dx + dy),
iy = 0.2 * (dy - dx);
dy = ty - sy,
ix = 0.2 * (dx + dy),
iy = 0.2 * (dy - dx);
return 'M' + sx + ',' + sy + 'C' + (sx + ix) + ',' + (sy + iy) + ' ' + (tx + iy) + ',' + (ty - ix) + ' ' + tx + ',' + ty;
};
const curveR = (sa, sr, ta, tr) => curve(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));
const orthoX = (sx, sy, tx, ty) => 'M' + sx + ',' + sy + 'V' + ty + 'H' + tx;
const orthoY = (sx, sy, tx, ty) => 'M' + sx + ',' + sy + 'H' + tx + 'V' + ty;
const orthoR = (sa, sr, ta, tr) => {
const sc = Math.cos(sa),
ss = Math.sin(sa),
tc = Math.cos(ta),
ts = Math.sin(ta),
sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa;
ss = Math.sin(sa),
tc = Math.cos(ta),
ts = Math.sin(ta),
sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa;
return 'M' + sr * sc + ',' + sr * ss + 'A' + sr + ',' + sr + ' 0 0,' + (sf ? 1 : 0) + ' ' + sr * tc + ',' + sr * ts + 'L' + tr * tc + ',' + tr * ts;
};
const diagonalX = (sx, sy, tx, ty) => {

@@ -520,3 +466,2 @@ const m = (sx + tx) / 2;

};
const diagonalY = (sx, sy, tx, ty) => {

@@ -526,12 +471,10 @@ const m = (sy + ty) / 2;

};
const diagonalR = (sa, sr, ta, tr) => {
const sc = Math.cos(sa),
ss = Math.sin(sa),
tc = Math.cos(ta),
ts = Math.sin(ta),
mr = (sr + tr) / 2;
ss = Math.sin(sa),
tc = Math.cos(ta),
ts = Math.sin(ta),
mr = (sr + tr) / 2;
return 'M' + sr * sc + ',' + sr * ss + 'C' + mr * sc + ',' + mr * ss + ' ' + mr * tc + ',' + mr * ts + ' ' + tr * tc + ',' + tr * ts;
};
const Paths = vegaUtil.fastmap({

@@ -555,9 +498,7 @@ 'line': line,

var i = -1,
n = Math.max(0, Math.ceil((stop - start) / step)) | 0,
range = new Array(n);
n = Math.max(0, Math.ceil((stop - start) / step)) | 0,
range = new Array(n);
while (++i < n) {
range[i] = start + i * step;
}
return range;

@@ -568,3 +509,2 @@ }

let sum = 0;
if (valueof === undefined) {

@@ -578,3 +518,2 @@ for (let value of values) {

let index = -1;
for (let value of values) {

@@ -586,3 +525,2 @@ if (value = +valueof(value, ++index, values)) {

}
return sum;

@@ -600,3 +538,2 @@ }

*/
function Pie(params) {

@@ -636,21 +573,19 @@ vegaDataflow.Transform.call(this, null, params);

var as = _.as || ['startAngle', 'endAngle'],
startAngle = as[0],
endAngle = as[1],
field = _.field || vegaUtil.one,
start = _.startAngle || 0,
stop = _.endAngle != null ? _.endAngle : 2 * Math.PI,
data = pulse.source,
values = data.map(field),
n = values.length,
a = start,
k = (stop - start) / sum(values),
index = range(n),
i,
t,
v;
startAngle = as[0],
endAngle = as[1],
field = _.field || vegaUtil.one,
start = _.startAngle || 0,
stop = _.endAngle != null ? _.endAngle : 2 * Math.PI,
data = pulse.source,
values = data.map(field),
n = values.length,
a = start,
k = (stop - start) / sum(values),
index = range(n),
i,
t,
v;
if (_.sort) {
index.sort((a, b) => values[a] - values[b]);
}
for (i = 0; i < n; ++i) {

@@ -662,7 +597,5 @@ v = values[index[i]];

}
this.value = values;
return pulse.reflow(_.modified()).modifies(as);
}
});

@@ -676,5 +609,3 @@

var prototype = Object.create(parent.prototype);
for (var key in definition) prototype[key] = definition[key];
return prototype;

@@ -687,11 +618,11 @@ }

var reI = "\\s*([+-]?\\d+)\\s*",
reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
reHex = /^#([0-9a-f]{3,8})$/,
reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"),
reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"),
reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"),
reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"),
reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"),
reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");
reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",
reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
reHex = /^#([0-9a-f]{3,8})$/,
reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`),
reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`),
reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`),
reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`),
reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`),
reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
var named = {

@@ -848,6 +779,6 @@ aliceblue: 0xf0f8ff,

define(Color, color, {
copy: function (channels) {
copy(channels) {
return Object.assign(new this.constructor(), this, channels);
},
displayable: function () {
displayable() {
return this.rgb().displayable();

@@ -858,2 +789,3 @@ },

formatHex: color_formatHex,
formatHex8: color_formatHex8,
formatHsl: color_formatHsl,

@@ -863,15 +795,14 @@ formatRgb: color_formatRgb,

});
function color_formatHex() {
return this.rgb().formatHex();
}
function color_formatHex8() {
return this.rgb().formatHex8();
}
function color_formatHsl() {
return hslConvert(this).formatHsl();
}
function color_formatRgb() {
return this.rgb().formatRgb();
}
function color(format) {

@@ -894,7 +825,5 @@ var m, l;

}
function rgbn(n) {
return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
}
function rgba(r, g, b, a) {

@@ -904,3 +833,2 @@ if (a <= 0) r = g = b = NaN;

}
function rgbConvert(o) {

@@ -922,14 +850,17 @@ if (!(o instanceof Color)) o = color(o);

define(Rgb, rgb$1, extend(Color, {
brighter: function (k) {
brighter(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
},
darker: function (k) {
darker(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
},
rgb: function () {
rgb() {
return this;
},
displayable: function () {
clamp() {
return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
},
displayable() {
return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;

@@ -940,21 +871,26 @@ },

formatHex: rgb_formatHex,
formatHex8: rgb_formatHex8,
formatRgb: rgb_formatRgb,
toString: rgb_formatRgb
}));
function rgb_formatHex() {
return "#" + hex(this.r) + hex(this.g) + hex(this.b);
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
}
function rgb_formatHex8() {
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
}
function rgb_formatRgb() {
var a = this.opacity;
a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
return (a === 1 ? "rgb(" : "rgba(") + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + (a === 1 ? ")" : ", " + a + ")");
const a = clampa(this.opacity);
return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
}
function clampa(opacity) {
return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
}
function clampi(value) {
return Math.max(0, Math.min(255, Math.round(value) || 0));
}
function hex(value) {
value = Math.max(0, Math.min(255, Math.round(value) || 0));
value = clampi(value);
return (value < 16 ? "0" : "") + value.toString(16);
}
function hsla(h, s, l, a) {

@@ -964,3 +900,2 @@ if (a <= 0) h = s = l = NaN;else if (l <= 0 || l >= 1) h = s = NaN;else if (s <= 0) h = NaN;

}
function hslConvert(o) {

@@ -973,10 +908,9 @@ if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);

var r = o.r / 255,
g = o.g / 255,
b = o.b / 255,
min = Math.min(r, g, b),
max = Math.max(r, g, b),
h = NaN,
s = max - min,
l = (max + min) / 2;
g = o.g / 255,
b = o.b / 255,
min = Math.min(r, g, b),
max = Math.max(r, g, b),
h = NaN,
s = max - min,
l = (max + min) / 2;
if (s) {

@@ -989,3 +923,2 @@ if (r === max) h = (g - b) / s + (g < b) * 6;else if (g === max) h = (b - r) / s + 2;else h = (r - g) / s + 4;

}
return new Hsl(h, s, l, o.opacity);

@@ -996,3 +929,2 @@ }

}
function Hsl(h, s, l, opacity) {

@@ -1004,31 +936,39 @@ this.h = +h;

}
define(Hsl, hsl, extend(Color, {
brighter: function (k) {
brighter(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
},
darker: function (k) {
darker(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
},
rgb: function () {
rgb() {
var h = this.h % 360 + (this.h < 0) * 360,
s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
l = this.l,
m2 = l + (l < 0.5 ? l : 1 - l) * s,
m1 = 2 * l - m2;
s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
l = this.l,
m2 = l + (l < 0.5 ? l : 1 - l) * s,
m1 = 2 * l - m2;
return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity);
},
displayable: function () {
clamp() {
return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
},
displayable() {
return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
},
formatHsl: function () {
var a = this.opacity;
a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
return (a === 1 ? "hsl(" : "hsla(") + (this.h || 0) + ", " + (this.s || 0) * 100 + "%, " + (this.l || 0) * 100 + "%" + (a === 1 ? ")" : ", " + a + ")");
formatHsl() {
const a = clampa(this.opacity);
return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
}
}));
function clamph(value) {
value = (value || 0) % 360;
return value < 0 ? value + 360 : value;
}
function clampt(value) {
return Math.max(0, Math.min(1, value || 0));
}
/* From FvD 13.37, CSS Color Module Level 3 */
function hsl2rgb(h, m1, m2) {

@@ -1045,3 +985,2 @@ return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;

}
function exponential(a, b, y) {

@@ -1064,8 +1003,7 @@ return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function (t) {

var color = gamma(y);
function rgb(start, end) {
var r = color((start = rgb$1(start)).r, (end = rgb$1(end)).r),
g = color(start.g, end.g),
b = color(start.b, end.b),
opacity = nogamma(start.opacity, end.opacity);
g = color(start.g, end.g),
b = color(start.b, end.b),
opacity = nogamma(start.opacity, end.opacity);
return function (t) {

@@ -1079,3 +1017,2 @@ start.r = r(t);

}
rgb.gamma = rgbGamma;

@@ -1088,7 +1025,6 @@ return rgb;

var n = a ? Math.min(b.length, a.length) : 0,
c = b.slice(),
i;
c = b.slice(),
i;
return function (t) {
for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;
return c;

@@ -1103,14 +1039,10 @@ };

var nb = b ? b.length : 0,
na = a ? Math.min(nb, a.length) : 0,
x = new Array(na),
c = new Array(nb),
i;
na = a ? Math.min(nb, a.length) : 0,
x = new Array(na),
c = new Array(nb),
i;
for (i = 0; i < na; ++i) x[i] = interpolate(a[i], b[i]);
for (; i < nb; ++i) c[i] = b[i];
return function (t) {
for (i = 0; i < na; ++i) c[i] = x[i](t);
return c;

@@ -1135,7 +1067,6 @@ };

var i = {},
c = {},
k;
c = {},
k;
if (a === null || typeof a !== "object") a = {};
if (b === null || typeof b !== "object") b = {};
for (k in b) {

@@ -1148,6 +1079,4 @@ if (k in a) {

}
return function (t) {
for (k in i) c[k] = i[k](t);
return c;

@@ -1158,4 +1087,3 @@ };

var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
reB = new RegExp(reA.source, "g");
reB = new RegExp(reA.source, "g");
function zero(b) {

@@ -1166,3 +1094,2 @@ return function () {

}
function one(b) {

@@ -1173,21 +1100,21 @@ return function (t) {

}
function string (a, b) {
var bi = reA.lastIndex = reB.lastIndex = 0,
// scan index for next number in b
am,
// current match in a
bm,
// current match in b
bs,
// string preceding current number in b, if any
i = -1,
// index in s
s = [],
// string constants and placeholders
q = []; // number interpolators
// scan index for next number in b
am,
// current match in a
bm,
// current match in b
bs,
// string preceding current number in b, if any
i = -1,
// index in s
s = [],
// string constants and placeholders
q = []; // number interpolators
// Coerce inputs to strings.
a = a + "", b = b + "";
a = a + "", b = b + ""; // Interpolate pairs of numbers in a & b.
// Interpolate pairs of numbers in a & b.
while ((am = reA.exec(a)) && (bm = reB.exec(b))) {

@@ -1200,3 +1127,2 @@ if ((bs = bm.index) > bi) {

}
if ((am = am[0]) === (bm = bm[0])) {

@@ -1214,7 +1140,6 @@ // numbers in a & b match

}
bi = reB.lastIndex;
} // Add remains of b.
}
// Add remains of b.
if (bi < b.length) {

@@ -1224,9 +1149,8 @@ bs = b.slice(bi);

else s[++i] = bs;
} // Special optimization for only a single match.
}
// Special optimization for only a single match.
// Otherwise, interpolate each of the numbers and rejoin the string.
return s.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function (t) {
for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
return s.join("");

@@ -1238,3 +1162,3 @@ });

var t = typeof b,
c;
c;
return b == null || t === "boolean" ? constant(b) : (t === "number" ? number : t === "string" ? (c = color(b)) ? (b = c, rgb) : string : b instanceof color ? rgb : b instanceof Date ? date : isNumberArray(b) ? numberArray : Array.isArray(b) ? genericArray : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object : number)(a, b);

@@ -1250,3 +1174,2 @@ }

const DEFAULT_COUNT = 5;
function includeZero(scale) {

@@ -1256,8 +1179,7 @@ const type = scale.type;

}
function includePad(type) {
return vegaScale.isContinuous(type) && type !== vegaScale.Sequential;
}
const SKIP = vegaUtil.toSet(['set', 'modified', 'clear', 'type', 'scheme', 'schemeExtent', 'schemeCount', 'domain', 'domainMin', 'domainMid', 'domainMax', 'domainRaw', 'domainImplicit', 'nice', 'zero', 'bins', 'range', 'rangeStep', 'round', 'reverse', 'interpolate', 'interpolateGamma']);
const SKIP = vegaUtil.toSet(['set', 'modified', 'clear', 'type', 'scheme', 'schemeExtent', 'schemeCount', 'domain', 'domainMin', 'domainMid', 'domainMax', 'domainRaw', 'domainImplicit', 'nice', 'zero', 'bins', 'range', 'rangeStep', 'round', 'reverse', 'interpolate', 'interpolateGamma']);
/**

@@ -1268,3 +1190,2 @@ * Maintains a scale function mapping data values to visual channels.

*/
function Scale(params) {

@@ -1274,32 +1195,28 @@ vegaDataflow.Transform.call(this, null, params);

}
vegaUtil.inherits(Scale, vegaDataflow.Transform, {
transform(_, pulse) {
var df = pulse.dataflow,
scale = this.value,
key = scaleKey(_);
scale = this.value,
key = scaleKey(_);
if (!scale || key !== scale.type) {
this.value = scale = vegaScale.scale(key)();
}
for (key in _) if (!SKIP[key]) {
// padding is a scale property for band/point but not others
if (key === 'padding' && includePad(scale.type)) continue; // invoke scale property setter, raise warning if not found
if (key === 'padding' && includePad(scale.type)) continue;
// invoke scale property setter, raise warning if not found
vegaUtil.isFunction(scale[key]) ? scale[key](_[key]) : df.warn('Unsupported scale property: ' + key);
}
configureRange(scale, _, configureBins(scale, _, configureDomain(scale, _, df)));
return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);
}
});
function scaleKey(_) {
var t = _.type,
d = '',
n; // backwards compatibility pre Vega 5.
d = '',
n;
// backwards compatibility pre Vega 5.
if (t === vegaScale.Sequential) return vegaScale.Sequential + '-' + vegaScale.Linear;
if (isContinuousColor(_)) {

@@ -1309,6 +1226,4 @@ n = _.rawDomain ? _.rawDomain.length : _.domain ? _.domain.length + +(_.domainMid != null) : 0;

}
return (d + t || vegaScale.Linear).toLowerCase();
}
function isContinuousColor(_) {

@@ -1318,3 +1233,2 @@ const t = _.type;

}
function configureDomain(scale, _, df) {

@@ -1325,16 +1239,16 @@ // check raw domain, if provided use that and exit early

var domain = _.domain,
type = scale.type,
zero = _.zero || _.zero === undefined && includeZero(scale),
n,
mid;
if (!domain) return 0; // adjust continuous domain for minimum pixel padding
type = scale.type,
zero = _.zero || _.zero === undefined && includeZero(scale),
n,
mid;
if (!domain) return 0;
// adjust continuous domain for minimum pixel padding
if (includePad(type) && _.padding && domain[0] !== vegaUtil.peek(domain)) {
domain = padDomain(type, domain, _.range, _.padding, _.exponent, _.constant);
} // adjust domain based on zero, min, max settings
}
// adjust domain based on zero, min, max settings
if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) {
n = (domain = domain.slice()).length - 1 || 1;
if (zero) {

@@ -1344,6 +1258,4 @@ if (domain[0] > 0) domain[0] = 0;

}
if (_.domainMin != null) domain[0] = _.domainMin;
if (_.domainMax != null) domain[n] = _.domainMax;
if (_.domainMid != null) {

@@ -1355,21 +1267,21 @@ mid = _.domainMid;

}
} // set the scale domain
}
// set the scale domain
scale.domain(domainCheck(type, domain, df));
scale.domain(domainCheck(type, domain, df)); // if ordinal scale domain is defined, prevent implicit
// if ordinal scale domain is defined, prevent implicit
// domain construction as side-effect of scale lookup
if (type === vegaScale.Ordinal) {
scale.unknown(_.domainImplicit ? vegaScale.scaleImplicit : undefined);
} // perform 'nice' adjustment as requested
}
// perform 'nice' adjustment as requested
if (_.nice && scale.nice) {
scale.nice(_.nice !== true && vegaScale.tickCount(scale, _.nice) || null);
} // return the cardinality of the domain
}
// return the cardinality of the domain
return domain.length;
}
function rawDomain(scale, raw, df) {

@@ -1383,7 +1295,6 @@ if (raw) {

}
function padDomain(type, domain, range, pad, exponent, constant) {
var span = Math.abs(vegaUtil.peek(range) - range[0]),
frac = span / (span - 2 * pad),
d = type === vegaScale.Log ? vegaUtil.zoomLog(domain, null, frac) : type === vegaScale.Sqrt ? vegaUtil.zoomPow(domain, null, frac, 0.5) : type === vegaScale.Pow ? vegaUtil.zoomPow(domain, null, frac, exponent || 1) : type === vegaScale.Symlog ? vegaUtil.zoomSymlog(domain, null, frac, constant || 1) : vegaUtil.zoomLinear(domain, null, frac);
frac = span / (span - 2 * pad),
d = type === vegaScale.Log ? vegaUtil.zoomLog(domain, null, frac) : type === vegaScale.Sqrt ? vegaUtil.zoomPow(domain, null, frac, 0.5) : type === vegaScale.Pow ? vegaUtil.zoomPow(domain, null, frac, exponent || 1) : type === vegaScale.Symlog ? vegaUtil.zoomSymlog(domain, null, frac, constant || 1) : vegaUtil.zoomLinear(domain, null, frac);
domain = domain.slice();

@@ -1394,3 +1305,2 @@ domain[0] = d[0];

}
function domainCheck(type, domain, df) {

@@ -1401,3 +1311,2 @@ if (vegaScale.isLogarithmic(type)) {

var s = Math.abs(domain.reduce((s, v) => s + (v < 0 ? -1 : v > 0 ? 1 : 0), 0));
if (s !== domain.length) {

@@ -1407,17 +1316,14 @@ df.warn('Log scale domain includes zero: ' + vegaUtil.stringValue(domain));

}
return domain;
}
function configureBins(scale, _, count) {
let bins = _.bins;
if (bins && !vegaUtil.isArray(bins)) {
// generate bin boundary array
const domain = scale.domain(),
lo = domain[0],
hi = vegaUtil.peek(domain),
step = bins.step;
lo = domain[0],
hi = vegaUtil.peek(domain),
step = bins.step;
let start = bins.start == null ? lo : bins.start,
stop = bins.stop == null ? hi : bins.stop;
stop = bins.stop == null ? hi : bins.stop;
if (!step) vegaUtil.error('Scale bins parameter missing step property.');

@@ -1428,3 +1334,2 @@ if (start < lo) start = step * Math.ceil(lo / step);

}
if (bins) {

@@ -1436,5 +1341,5 @@ // assign bin boundaries to scale instance

delete scale.bins;
} // special handling for bin-ordinal scales
}
// special handling for bin-ordinal scales
if (scale.type === vegaScale.BinOrdinal) {

@@ -1449,19 +1354,20 @@ if (!bins) {

}
} // return domain cardinality
}
// return domain cardinality
return count;
}
function configureRange(scale, _, count) {
var type = scale.type,
round = _.round || false,
range = _.range; // if range step specified, calculate full range extent
round = _.round || false,
range = _.range;
// if range step specified, calculate full range extent
if (_.rangeStep != null) {
range = configureRangeStep(type, _, count);
} // else if a range scheme is defined, use that
}
// else if a range scheme is defined, use that
else if (_.scheme) {
range = configureScheme(type, _, count);
if (vegaUtil.isFunction(range)) {

@@ -1474,10 +1380,10 @@ if (scale.interpolator) {

}
} // given a range array for an interpolating scale, convert to interpolator
}
// given a range array for an interpolating scale, convert to interpolator
if (range && vegaScale.isInterpolating(type)) {
return scale.interpolator(vegaScale.interpolateColors(flip(range, _.reverse), _.interpolate, _.interpolateGamma));
} // configure rounding / interpolation
}
// configure rounding / interpolation
if (range && _.interpolate && scale.interpolate) {

@@ -1490,22 +1396,18 @@ scale.interpolate(vegaScale.interpolate(_.interpolate, _.interpolateGamma));

}
if (range) scale.range(flip(range, _.reverse));
}
function configureRangeStep(type, _, count) {
if (type !== vegaScale.Band && type !== vegaScale.Point) {
vegaUtil.error('Only band and point scales support rangeStep.');
} // calculate full range based on requested step size and padding
}
// calculate full range based on requested step size and padding
var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0,
inner = type === vegaScale.Point ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0;
inner = type === vegaScale.Point ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0;
return [0, _.rangeStep * vegaScale.bandSpace(count, inner, outer)];
}
function configureScheme(type, _, count) {
var extent = _.schemeExtent,
name,
scheme;
name,
scheme;
if (vegaUtil.isArray(_.scheme)) {

@@ -1517,14 +1419,13 @@ scheme = vegaScale.interpolateColors(_.scheme, _.interpolate, _.interpolateGamma);

if (!scheme) vegaUtil.error(`Unrecognized scheme name: ${_.scheme}`);
} // determine size for potential discrete range
}
// determine size for potential discrete range
count = type === vegaScale.Threshold ? count + 1 : type === vegaScale.BinOrdinal ? count - 1 : type === vegaScale.Quantile || type === vegaScale.Quantize ? +_.schemeCount || DEFAULT_COUNT : count;
count = type === vegaScale.Threshold ? count + 1 : type === vegaScale.BinOrdinal ? count - 1 : type === vegaScale.Quantile || type === vegaScale.Quantize ? +_.schemeCount || DEFAULT_COUNT : count; // adjust and/or quantize scheme as appropriate
// adjust and/or quantize scheme as appropriate
return vegaScale.isInterpolating(type) ? adjustScheme(scheme, extent, _.reverse) : vegaUtil.isFunction(scheme) ? vegaScale.quantizeInterpolator(adjustScheme(scheme, extent), count) : type === vegaScale.Ordinal ? scheme : scheme.slice(0, count);
}
function adjustScheme(scheme, extent, reverse) {
return vegaUtil.isFunction(scheme) && (extent || reverse) ? vegaScale.interpolateRange(scheme, flip(extent || [0, 1], reverse)) : scheme;
}
function flip(array, reverse) {

@@ -1541,3 +1442,2 @@ return reverse ? array.slice().reverse() : array;

*/
function SortItems(params) {

@@ -1553,9 +1453,9 @@ vegaDataflow.Transform.call(this, null, params);

}
});
const Zero = 'zero',
Center = 'center',
Normalize = 'normalize',
DefOutput = ['y0', 'y1'];
Center = 'center',
Normalize = 'normalize',
DefOutput = ['y0', 'y1'];
/**

@@ -1570,3 +1470,2 @@ * Stack layout for visualization elements.

*/
function Stack(params) {

@@ -1606,29 +1505,27 @@ vegaDataflow.Transform.call(this, null, params);

var as = _.as || DefOutput,
y0 = as[0],
y1 = as[1],
sort = vegaDataflow.stableCompare(_.sort),
field = _.field || vegaUtil.one,
stack = _.offset === Center ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero,
groups,
i,
n,
max; // partition, sum, and sort the stack groups
y0 = as[0],
y1 = as[1],
sort = vegaDataflow.stableCompare(_.sort),
field = _.field || vegaUtil.one,
stack = _.offset === Center ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero,
groups,
i,
n,
max;
groups = partition(pulse.source, _.groupby, sort, field); // compute stack layouts per group
// partition, sum, and sort the stack groups
groups = partition(pulse.source, _.groupby, sort, field);
// compute stack layouts per group
for (i = 0, n = groups.length, max = groups.max; i < n; ++i) {
stack(groups[i], max, field, y0, y1);
}
return pulse.reflow(_.modified()).modifies(as);
}
});
function stackCenter(group, max, field, y0, y1) {
var last = (max - group.sum) / 2,
m = group.length,
j = 0,
t;
m = group.length,
j = 0,
t;
for (; j < m; ++j) {

@@ -1640,11 +1537,9 @@ t = group[j];

}
function stackNormalize(group, max, field, y0, y1) {
var scale = 1 / group.sum,
last = 0,
m = group.length,
j = 0,
v = 0,
t;
last = 0,
m = group.length,
j = 0,
v = 0,
t;
for (; j < m; ++j) {

@@ -1656,15 +1551,12 @@ t = group[j];

}
function stackZero(group, max, field, y0, y1) {
var lastPos = 0,
lastNeg = 0,
m = group.length,
j = 0,
v,
t;
lastNeg = 0,
m = group.length,
j = 0,
v,
t;
for (; j < m; ++j) {
t = group[j];
v = +field(t);
if (v < 0) {

@@ -1679,17 +1571,16 @@ t[y0] = lastNeg;

}
function partition(data, groupby, sort, field) {
var groups = [],
get = f => f(t),
map,
i,
n,
m,
t,
k,
g,
s,
max; // partition data points into stack groups
get = f => f(t),
map,
i,
n,
m,
t,
k,
g,
s,
max;
// partition data points into stack groups
if (groupby == null) {

@@ -1702,3 +1593,2 @@ groups.push(data.slice());

g = map[k];
if (!g) {

@@ -1708,15 +1598,12 @@ map[k] = g = [];

}
g.push(t);
}
} // compute sums of groups, sort groups as needed
}
// compute sums of groups, sort groups as needed
for (k = 0, max = 0, m = groups.length; k < m; ++k) {
g = groups[k];
for (i = 0, s = 0, n = g.length; i < n; ++i) {
s += Math.abs(field(g[i]));
}
g.sum = s;

@@ -1726,3 +1613,2 @@ if (s > max) max = s;

}
groups.max = max;

@@ -1742,4 +1628,2 @@ return groups;

Object.defineProperty(exports, '__esModule', { value: true });
}));

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-dataflow"),require("vega-scale"),require("vega-util")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-scale","vega-util"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vega={},e.vega,e.vega,e.vega)}(this,(function(e,t,n,r){"use strict";function a(e){t.Transform.call(this,null,e)}function i(e){t.Transform.call(this,null,e)}function o(){return t.ingest({})}function l(e){t.Transform.call(this,null,e)}function s(e){t.Transform.call(this,[],e)}r.inherits(a,t.Transform,{transform(e,r){if(this.value&&!e.modified())return r.StopPropagation;var a=r.dataflow.locale(),i=r.fork(r.NO_SOURCE|r.NO_FIELDS),o=this.value,l=e.scale,s=null==e.count?e.values?e.values.length:10:e.count,u=n.tickCount(l,s,e.minstep),c=e.format||n.tickFormat(a,l,u,e.formatSpecifier,e.formatType,!!e.values),d=e.values?n.validTicks(l,e.values,u):n.tickValues(l,u);return o&&(i.rem=o),o=d.map(((e,n)=>t.ingest({index:n/(d.length-1||1),value:e,label:c(e)}))),e.extra&&o.length&&o.push(t.ingest({index:-1,extra:{value:o[0].value},label:""})),i.source=o,i.add=o,this.value=o,i}}),r.inherits(i,t.Transform,{transform(e,n){var a=n.dataflow,i=n.fork(n.NO_SOURCE|n.NO_FIELDS),l=e.item||o,s=e.key||t.tupleid,u=this.value;return r.isArray(i.encode)&&(i.encode=null),u&&(e.modified("key")||n.modified(s))&&r.error("DataJoin does not support modified key function or fields."),u||(n=n.addAll(),this.value=u=function(e){const t=r.fastmap().test((e=>e.exit));return t.lookup=n=>t.get(e(n)),t}(s)),n.visit(n.ADD,(e=>{const t=s(e);let n=u.get(t);n?n.exit?(u.empty--,i.add.push(n)):i.mod.push(n):(n=l(e),u.set(t,n),i.add.push(n)),n.datum=e,n.exit=!1})),n.visit(n.MOD,(e=>{const t=s(e),n=u.get(t);n&&(n.datum=e,i.mod.push(n))})),n.visit(n.REM,(e=>{const t=s(e),n=u.get(t);e!==n.datum||n.exit||(i.rem.push(n),n.exit=!0,++u.empty)})),n.changed(n.ADD_MOD)&&i.modifies("datum"),(n.clean()||e.clean&&u.empty>a.cleanThreshold)&&a.runAfter(u.clean),i}}),r.inherits(l,t.Transform,{transform(e,t){var n=t.fork(t.ADD_REM),a=e.mod||!1,i=e.encoders,o=t.encode;if(r.isArray(o)){if(!n.changed()&&!o.every((e=>i[e])))return t.StopPropagation;o=o[0],n.encode=null}var l="enter"===o,s=i.update||r.falsy,u=i.enter||r.falsy,c=i.exit||r.falsy,d=(o&&!l?i[o]:s)||r.falsy;if(t.changed(t.ADD)&&(t.visit(t.ADD,(t=>{u(t,e),s(t,e)})),n.modifies(u.output),n.modifies(s.output),d!==r.falsy&&d!==s&&(t.visit(t.ADD,(t=>{d(t,e)})),n.modifies(d.output))),t.changed(t.REM)&&c!==r.falsy&&(t.visit(t.REM,(t=>{c(t,e)})),n.modifies(c.output)),l||d!==r.falsy){const r=t.MOD|(e.modified()?t.REFLOW:0);l?(t.visit(r,(t=>{const r=u(t,e)||a;(d(t,e)||r)&&n.mod.push(t)})),n.mod.length&&n.modifies(u.output)):t.visit(r,(t=>{(d(t,e)||a)&&n.mod.push(t)})),n.mod.length&&n.modifies(d.output)}return n.changed()?n:t.StopPropagation}}),r.inherits(s,t.Transform,{transform(e,a){if(null!=this.value&&!e.modified())return a.StopPropagation;var i,o,l,s,u,c=a.dataflow.locale(),d=a.fork(a.NO_SOURCE|a.NO_FIELDS),f=this.value,h=e.type||n.SymbolLegend,m=e.scale,g=+e.limit,p=n.tickCount(m,null==e.count?5:e.count,e.minstep),y=!!e.values||h===n.SymbolLegend,v=e.format||n.labelFormat(c,m,p,h,e.formatSpecifier,e.formatType,y),b=e.values||n.labelValues(m,p);return f&&(d.rem=f),h===n.SymbolLegend?(g&&b.length>g?(a.dataflow.warn("Symbol legend count exceeds limit, filtering items."),f=b.slice(0,g-1),u=!0):f=b,r.isFunction(l=e.size)?(e.values||0!==m(f[0])||(f=f.slice(1)),s=f.reduce(((t,n)=>Math.max(t,l(n,e))),0)):l=r.constant(s=l||8),f=f.map(((n,r)=>t.ingest({index:r,label:v(n,r,f),value:n,offset:s,size:l(n,e)}))),u&&(u=b[f.length],f.push(t.ingest({index:f.length,label:"…".concat(b.length-f.length," entries"),value:u,offset:s,size:l(u,e)})))):h===n.GradientLegend?(i=m.domain(),o=n.scaleFraction(m,i[0],r.peek(i)),b.length<3&&!e.values&&i[0]!==r.peek(i)&&(b=[i[0],r.peek(i)]),f=b.map(((e,n)=>t.ingest({index:n,label:v(e,n,b),value:e,perc:o(e)})))):(l=b.length-1,o=n.labelFraction(m),f=b.map(((e,n)=>t.ingest({index:n,label:v(e,n,b),value:e,perc:n?o(e):0,perc2:n===l?1:o(b[n+1])})))),d.source=f,d.add=f,this.value=f,d}});const u=e=>e.source.x,c=e=>e.source.y,d=e=>e.target.x,f=e=>e.target.y;function h(e){t.Transform.call(this,{},e)}h.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},r.inherits(h,t.Transform,{transform(e,t){var n=e.sourceX||u,a=e.sourceY||c,i=e.targetX||d,o=e.targetY||f,l=e.as||"path",s=e.orient||"vertical",h=e.shape||"line",m=y.get(h+"-"+s)||y.get(h);return m||r.error("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,(e=>{e[l]=m(n(e),a(e),i(e),o(e))})),t.reflow(e.modified()).modifies(l)}});const m=(e,t,n,r)=>"M"+e+","+t+"L"+n+","+r,g=(e,t,n,r)=>{var a=n-e,i=r-t,o=Math.sqrt(a*a+i*i)/2;return"M"+e+","+t+"A"+o+","+o+" "+180*Math.atan2(i,a)/Math.PI+" 0 1 "+n+","+r},p=(e,t,n,r)=>{const a=n-e,i=r-t,o=.2*(a+i),l=.2*(i-a);return"M"+e+","+t+"C"+(e+o)+","+(t+l)+" "+(n+l)+","+(r-o)+" "+n+","+r},y=r.fastmap({line:m,"line-radial":(e,t,n,r)=>m(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),arc:g,"arc-radial":(e,t,n,r)=>g(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),curve:p,"curve-radial":(e,t,n,r)=>p(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),"orthogonal-horizontal":(e,t,n,r)=>"M"+e+","+t+"V"+r+"H"+n,"orthogonal-vertical":(e,t,n,r)=>"M"+e+","+t+"H"+n+"V"+r,"orthogonal-radial":(e,t,n,r)=>{const a=Math.cos(e),i=Math.sin(e),o=Math.cos(n),l=Math.sin(n);return"M"+t*a+","+t*i+"A"+t+","+t+" 0 0,"+((Math.abs(n-e)>Math.PI?n<=e:n>e)?1:0)+" "+t*o+","+t*l+"L"+r*o+","+r*l},"diagonal-horizontal":(e,t,n,r)=>{const a=(e+n)/2;return"M"+e+","+t+"C"+a+","+t+" "+a+","+r+" "+n+","+r},"diagonal-vertical":(e,t,n,r)=>{const a=(t+r)/2;return"M"+e+","+t+"C"+e+","+a+" "+n+","+a+" "+n+","+r},"diagonal-radial":(e,t,n,r)=>{const a=Math.cos(e),i=Math.sin(e),o=Math.cos(n),l=Math.sin(n),s=(t+r)/2;return"M"+t*a+","+t*i+"C"+s*a+","+s*i+" "+s*o+","+s*l+" "+r*o+","+r*l}});function v(e,t,n){e=+e,t=+t,n=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+n;for(var r=-1,a=0|Math.max(0,Math.ceil((t-e)/n)),i=new Array(a);++r<a;)i[r]=e+r*n;return i}function b(e){t.Transform.call(this,null,e)}function M(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function w(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function x(){}b.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},r.inherits(b,t.Transform,{transform(e,t){var n,a,i,o=e.as||["startAngle","endAngle"],l=o[0],s=o[1],u=e.field||r.one,c=e.startAngle||0,d=null!=e.endAngle?e.endAngle:2*Math.PI,f=t.source,h=f.map(u),m=h.length,g=c,p=(d-c)/function(e,t){let n=0;if(void 0===t)for(let t of e)(t=+t)&&(n+=t);else{let r=-1;for(let a of e)(a=+t(a,++r,e))&&(n+=a)}return n}(h),y=v(m);for(e.sort&&y.sort(((e,t)=>h[e]-h[t])),n=0;n<m;++n)i=h[y[n]],(a=f[y[n]])[l]=g,a[s]=g+=i*p;return this.value=h,t.reflow(e.modified()).modifies(o)}});var k=.7,S=1/k,N="\\s*([+-]?\\d+)\\s*",D="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",A="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",O=/^#([0-9a-f]{3,8})$/,T=new RegExp("^rgb\\("+[N,N,N]+"\\)$"),E=new RegExp("^rgb\\("+[A,A,A]+"\\)$"),R=new RegExp("^rgba\\("+[N,N,N,D]+"\\)$"),C=new RegExp("^rgba\\("+[A,A,A,D]+"\\)$"),L=new RegExp("^hsl\\("+[D,A,A]+"\\)$"),q=new RegExp("^hsla\\("+[D,A,A,D]+"\\)$"),z={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function I(){return this.rgb().formatHex()}function P(){return this.rgb().formatRgb()}function F(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=O.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?_(t):3===n?new V(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?j(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?j(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=T.exec(e))?new V(t[1],t[2],t[3],1):(t=E.exec(e))?new V(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=R.exec(e))?j(t[1],t[2],t[3],t[4]):(t=C.exec(e))?j(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=L.exec(e))?X(t[1],t[2]/100,t[3]/100,1):(t=q.exec(e))?X(t[1],t[2]/100,t[3]/100,t[4]):z.hasOwnProperty(e)?_(z[e]):"transparent"===e?new V(NaN,NaN,NaN,0):null}function _(e){return new V(e>>16&255,e>>8&255,255&e,1)}function j(e,t,n,r){return r<=0&&(e=t=n=NaN),new V(e,t,n,r)}function H(e){return e instanceof x||(e=F(e)),e?new V((e=e.rgb()).r,e.g,e.b,e.opacity):new V}function U(e,t,n,r){return 1===arguments.length?H(e):new V(e,t,n,null==r?1:r)}function V(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function $(){return"#"+B(this.r)+B(this.g)+B(this.b)}function G(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}function B(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function X(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Q(e,t,n,r)}function Y(e){if(e instanceof Q)return new Q(e.h,e.s,e.l,e.opacity);if(e instanceof x||(e=F(e)),!e)return new Q;if(e instanceof Q)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,l=i-a,s=(i+a)/2;return l?(o=t===i?(n-r)/l+6*(n<r):n===i?(r-t)/l+2:(t-n)/l+4,l/=s<.5?i+a:2-i-a,o*=60):l=s>0&&s<1?0:o,new Q(o,l,s,e.opacity)}function Q(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function J(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}M(x,F,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:I,formatHex:I,formatHsl:function(){return Y(this).formatHsl()},formatRgb:P,toString:P}),M(V,U,w(x,{brighter:function(e){return e=null==e?S:Math.pow(S,e),new V(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?k:Math.pow(k,e),new V(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:$,formatHex:$,formatRgb:G,toString:G})),M(Q,(function(e,t,n,r){return 1===arguments.length?Y(e):new Q(e,t,n,null==r?1:r)}),w(x,{brighter:function(e){return e=null==e?S:Math.pow(S,e),new Q(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?k:Math.pow(k,e),new Q(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new V(J(e>=240?e-240:e+120,a,r),J(e,a,r),J(e<120?e+240:e-120,a,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}}));var W=e=>()=>e;function K(e){return 1==(e=+e)?Z:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):W(isNaN(t)?n:t)}}function Z(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):W(isNaN(e)?t:e)}var ee=function e(t){var n=K(t);function r(e,t){var r=n((e=U(e)).r,(t=U(t)).r),a=n(e.g,t.g),i=n(e.b,t.b),o=Z(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=a(t),e.b=i(t),e.opacity=o(t),e+""}}return r.gamma=e,r}(1);function te(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,a=t.slice();return function(i){for(n=0;n<r;++n)a[n]=e[n]*(1-i)+t[n]*i;return a}}function ne(e,t){var n,r=t?t.length:0,a=e?Math.min(r,e.length):0,i=new Array(a),o=new Array(r);for(n=0;n<a;++n)i[n]=ue(e[n],t[n]);for(;n<r;++n)o[n]=t[n];return function(e){for(n=0;n<a;++n)o[n]=i[n](e);return o}}function re(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function ae(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function ie(e,t){var n,r={},a={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?r[n]=ue(e[n],t[n]):a[n]=t[n];return function(e){for(n in r)a[n]=r[n](e);return a}}var oe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,le=new RegExp(oe.source,"g");function se(e,t){var n,r,a,i=oe.lastIndex=le.lastIndex=0,o=-1,l=[],s=[];for(e+="",t+="";(n=oe.exec(e))&&(r=le.exec(t));)(a=r.index)>i&&(a=t.slice(i,a),l[o]?l[o]+=a:l[++o]=a),(n=n[0])===(r=r[0])?l[o]?l[o]+=r:l[++o]=r:(l[++o]=null,s.push({i:o,x:ae(n,r)})),i=le.lastIndex;return i<t.length&&(a=t.slice(i),l[o]?l[o]+=a:l[++o]=a),l.length<2?s[0]?function(e){return function(t){return e(t)+""}}(s[0].x):function(e){return function(){return e}}(t):(t=s.length,function(e){for(var n,r=0;r<t;++r)l[(n=s[r]).i]=n.x(e);return l.join("")})}function ue(e,t){var n,r,a=typeof t;return null==t||"boolean"===a?W(t):("number"===a?ae:"string"===a?(n=F(t))?(t=n,ee):se:t instanceof F?ee:t instanceof Date?re:(r=t,!ArrayBuffer.isView(r)||r instanceof DataView?Array.isArray(t)?ne:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?ie:ae:te))(e,t)}function ce(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function de(e){return n.isContinuous(e)&&e!==n.Sequential}const fe=r.toSet(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function he(e){t.Transform.call(this,null,e),this.modified(!0)}function me(e,t,a){n.isLogarithmic(e)&&(Math.abs(t.reduce(((e,t)=>e+(t<0?-1:t>0?1:0)),0))!==t.length&&a.warn("Log scale domain includes zero: "+r.stringValue(t)));return t}function ge(e,t,a){return r.isFunction(e)&&(t||a)?n.interpolateRange(e,pe(t||[0,1],a)):e}function pe(e,t){return t?e.slice().reverse():e}function ye(e){t.Transform.call(this,null,e)}r.inherits(he,t.Transform,{transform(e,t){var a=t.dataflow,i=this.value,o=function(e){var t,a=e.type,i="";if(a===n.Sequential)return n.Sequential+"-"+n.Linear;(function(e){const t=e.type;return n.isContinuous(t)&&t!==n.Time&&t!==n.UTC&&(e.scheme||e.range&&e.range.length&&e.range.every(r.isString))})(e)&&(i=2===(t=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0)?n.Sequential+"-":3===t?n.Diverging+"-":"");return(i+a||n.Linear).toLowerCase()}(e);for(o in i&&o===i.type||(this.value=i=n.scale(o)()),e)if(!fe[o]){if("padding"===o&&de(i.type))continue;r.isFunction(i[o])?i[o](e[o]):a.warn("Unsupported scale property: "+o)}return function(e,t,a){var i=e.type,o=t.round||!1,l=t.range;if(null!=t.rangeStep)l=function(e,t,a){e!==n.Band&&e!==n.Point&&r.error("Only band and point scales support rangeStep.");var i=(null!=t.paddingOuter?t.paddingOuter:t.padding)||0,o=e===n.Point?1:(null!=t.paddingInner?t.paddingInner:t.padding)||0;return[0,t.rangeStep*n.bandSpace(a,o,i)]}(i,t,a);else if(t.scheme&&(l=function(e,t,a){var i,o,l=t.schemeExtent;r.isArray(t.scheme)?o=n.interpolateColors(t.scheme,t.interpolate,t.interpolateGamma):(i=t.scheme.toLowerCase(),(o=n.scheme(i))||r.error("Unrecognized scheme name: ".concat(t.scheme)));return a=e===n.Threshold?a+1:e===n.BinOrdinal?a-1:e===n.Quantile||e===n.Quantize?+t.schemeCount||5:a,n.isInterpolating(e)?ge(o,l,t.reverse):r.isFunction(o)?n.quantizeInterpolator(ge(o,l),a):e===n.Ordinal?o:o.slice(0,a)}(i,t,a),r.isFunction(l))){if(e.interpolator)return e.interpolator(l);r.error("Scale type ".concat(i," does not support interpolating color schemes."))}if(l&&n.isInterpolating(i))return e.interpolator(n.interpolateColors(pe(l,t.reverse),t.interpolate,t.interpolateGamma));l&&t.interpolate&&e.interpolate?e.interpolate(n.interpolate(t.interpolate,t.interpolateGamma)):r.isFunction(e.round)?e.round(o):r.isFunction(e.rangeRound)&&e.interpolate(o?ce:ue);l&&e.range(pe(l,t.reverse))}(i,e,function(e,t,a){let i=t.bins;if(i&&!r.isArray(i)){const t=e.domain(),n=t[0],a=r.peek(t),o=i.step;let l=null==i.start?n:i.start,s=null==i.stop?a:i.stop;o||r.error("Scale bins parameter missing step property."),l<n&&(l=o*Math.ceil(n/o)),s>a&&(s=o*Math.floor(a/o)),i=v(l,s+o/2,o)}i?e.bins=i:e.bins&&delete e.bins;e.type===n.BinOrdinal&&(i?t.domain||t.domainRaw||(e.domain(i),a=i.length):e.bins=e.domain());return a}(i,e,function(e,t,a){const i=function(e,t,n){return t?(e.domain(me(e.type,t,n)),t.length):-1}(e,t.domainRaw,a);if(i>-1)return i;var o,l,s=t.domain,u=e.type,c=t.zero||void 0===t.zero&&function(e){const t=e.type;return!e.bins&&(t===n.Linear||t===n.Pow||t===n.Sqrt)}(e);if(!s)return 0;de(u)&&t.padding&&s[0]!==r.peek(s)&&(s=function(e,t,a,i,o,l){var s=Math.abs(r.peek(a)-a[0]),u=s/(s-2*i),c=e===n.Log?r.zoomLog(t,null,u):e===n.Sqrt?r.zoomPow(t,null,u,.5):e===n.Pow?r.zoomPow(t,null,u,o||1):e===n.Symlog?r.zoomSymlog(t,null,u,l||1):r.zoomLinear(t,null,u);return(t=t.slice())[0]=c[0],t[t.length-1]=c[1],t}(u,s,t.range,t.padding,t.exponent,t.constant));if((c||null!=t.domainMin||null!=t.domainMax||null!=t.domainMid)&&(o=(s=s.slice()).length-1||1,c&&(s[0]>0&&(s[0]=0),s[o]<0&&(s[o]=0)),null!=t.domainMin&&(s[0]=t.domainMin),null!=t.domainMax&&(s[o]=t.domainMax),null!=t.domainMid)){const e=(l=t.domainMid)>s[o]?o+1:l<s[0]?0:o;e!==o&&a.warn("Scale domainMid exceeds domain min or max.",l),s.splice(e,0,l)}e.domain(me(u,s,a)),u===n.Ordinal&&e.unknown(t.domainImplicit?n.scaleImplicit:void 0);t.nice&&e.nice&&e.nice(!0!==t.nice&&n.tickCount(e,t.nice)||null);return s.length}(i,e,a))),t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),r.inherits(ye,t.Transform,{transform(e,n){const r=e.modified("sort")||n.changed(n.ADD)||n.modified(e.sort.fields)||n.modified("datum");return r&&n.source.sort(t.stableCompare(e.sort)),this.modified(r),n}});const ve="zero",be="center",Me="normalize",we=["y0","y1"];function xe(e){t.Transform.call(this,null,e)}function ke(e,t,n,r,a){for(var i,o=(t-e.sum)/2,l=e.length,s=0;s<l;++s)(i=e[s])[r]=o,i[a]=o+=Math.abs(n(i))}function Se(e,t,n,r,a){for(var i,o=1/e.sum,l=0,s=e.length,u=0,c=0;u<s;++u)(i=e[u])[r]=l,i[a]=l=o*(c+=Math.abs(n(i)))}function Ne(e,t,n,r,a){for(var i,o,l=0,s=0,u=e.length,c=0;c<u;++c)(i=+n(o=e[c]))<0?(o[r]=s,o[a]=s+=i):(o[r]=l,o[a]=l+=i)}xe.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:ve,values:[ve,be,Me]},{name:"as",type:"string",array:!0,length:2,default:we}]},r.inherits(xe,t.Transform,{transform(e,n){var a,i,o,l,s=e.as||we,u=s[0],c=s[1],d=t.stableCompare(e.sort),f=e.field||r.one,h=e.offset===be?ke:e.offset===Me?Se:Ne;for(a=function(e,t,n,r){var a,i,o,l,s,u,c,d,f,h=[],m=e=>e(s);if(null==t)h.push(e.slice());else for(a={},i=0,o=e.length;i<o;++i)s=e[i],(c=a[u=t.map(m)])||(a[u]=c=[],h.push(c)),c.push(s);for(u=0,f=0,l=h.length;u<l;++u){for(i=0,d=0,o=(c=h[u]).length;i<o;++i)d+=Math.abs(r(c[i]));c.sum=d,d>f&&(f=d),n&&c.sort(n)}return h.max=f,h}(n.source,e.groupby,d,f),i=0,o=a.length,l=a.max;i<o;++i)h(a[i],l,f,u,c);return n.reflow(e.modified()).modifies(s)}}),e.axisticks=a,e.datajoin=i,e.encode=l,e.legendentries=s,e.linkpath=h,e.pie=b,e.scale=he,e.sortitems=ye,e.stack=xe,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-dataflow"),require("vega-scale"),require("vega-util")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-scale","vega-util"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vega={},e.vega,e.vega,e.vega)}(this,(function(e,t,n,r){"use strict";function i(e){t.Transform.call(this,null,e)}function a(e){t.Transform.call(this,null,e)}function o(){return t.ingest({})}function s(e){t.Transform.call(this,null,e)}function l(e){t.Transform.call(this,[],e)}r.inherits(i,t.Transform,{transform(e,r){if(this.value&&!e.modified())return r.StopPropagation;var i=r.dataflow.locale(),a=r.fork(r.NO_SOURCE|r.NO_FIELDS),o=this.value,s=e.scale,l=null==e.count?e.values?e.values.length:10:e.count,u=n.tickCount(s,l,e.minstep),c=e.format||n.tickFormat(i,s,u,e.formatSpecifier,e.formatType,!!e.values),d=e.values?n.validTicks(s,e.values,u):n.tickValues(s,u);return o&&(a.rem=o),o=d.map(((e,n)=>t.ingest({index:n/(d.length-1||1),value:e,label:c(e)}))),e.extra&&o.length&&o.push(t.ingest({index:-1,extra:{value:o[0].value},label:""})),a.source=o,a.add=o,this.value=o,a}}),r.inherits(a,t.Transform,{transform(e,n){var i=n.dataflow,a=n.fork(n.NO_SOURCE|n.NO_FIELDS),s=e.item||o,l=e.key||t.tupleid,u=this.value;return r.isArray(a.encode)&&(a.encode=null),u&&(e.modified("key")||n.modified(l))&&r.error("DataJoin does not support modified key function or fields."),u||(n=n.addAll(),this.value=u=function(e){const t=r.fastmap().test((e=>e.exit));return t.lookup=n=>t.get(e(n)),t}(l)),n.visit(n.ADD,(e=>{const t=l(e);let n=u.get(t);n?n.exit?(u.empty--,a.add.push(n)):a.mod.push(n):(n=s(e),u.set(t,n),a.add.push(n)),n.datum=e,n.exit=!1})),n.visit(n.MOD,(e=>{const t=l(e),n=u.get(t);n&&(n.datum=e,a.mod.push(n))})),n.visit(n.REM,(e=>{const t=l(e),n=u.get(t);e!==n.datum||n.exit||(a.rem.push(n),n.exit=!0,++u.empty)})),n.changed(n.ADD_MOD)&&a.modifies("datum"),(n.clean()||e.clean&&u.empty>i.cleanThreshold)&&i.runAfter(u.clean),a}}),r.inherits(s,t.Transform,{transform(e,t){var n=t.fork(t.ADD_REM),i=e.mod||!1,a=e.encoders,o=t.encode;if(r.isArray(o)){if(!n.changed()&&!o.every((e=>a[e])))return t.StopPropagation;o=o[0],n.encode=null}var s="enter"===o,l=a.update||r.falsy,u=a.enter||r.falsy,c=a.exit||r.falsy,d=(o&&!s?a[o]:l)||r.falsy;if(t.changed(t.ADD)&&(t.visit(t.ADD,(t=>{u(t,e),l(t,e)})),n.modifies(u.output),n.modifies(l.output),d!==r.falsy&&d!==l&&(t.visit(t.ADD,(t=>{d(t,e)})),n.modifies(d.output))),t.changed(t.REM)&&c!==r.falsy&&(t.visit(t.REM,(t=>{c(t,e)})),n.modifies(c.output)),s||d!==r.falsy){const r=t.MOD|(e.modified()?t.REFLOW:0);s?(t.visit(r,(t=>{const r=u(t,e)||i;(d(t,e)||r)&&n.mod.push(t)})),n.mod.length&&n.modifies(u.output)):t.visit(r,(t=>{(d(t,e)||i)&&n.mod.push(t)})),n.mod.length&&n.modifies(d.output)}return n.changed()?n:t.StopPropagation}}),r.inherits(l,t.Transform,{transform(e,i){if(null!=this.value&&!e.modified())return i.StopPropagation;var a,o,s,l,u,c=i.dataflow.locale(),d=i.fork(i.NO_SOURCE|i.NO_FIELDS),h=this.value,f=e.type||n.SymbolLegend,m=e.scale,g=+e.limit,p=n.tickCount(m,null==e.count?5:e.count,e.minstep),y=!!e.values||f===n.SymbolLegend,v=e.format||n.labelFormat(c,m,p,f,e.formatSpecifier,e.formatType,y),b=e.values||n.labelValues(m,p);return h&&(d.rem=h),f===n.SymbolLegend?(g&&b.length>g?(i.dataflow.warn("Symbol legend count exceeds limit, filtering items."),h=b.slice(0,g-1),u=!0):h=b,r.isFunction(s=e.size)?(e.values||0!==m(h[0])||(h=h.slice(1)),l=h.reduce(((t,n)=>Math.max(t,s(n,e))),0)):s=r.constant(l=s||8),h=h.map(((n,r)=>t.ingest({index:r,label:v(n,r,h),value:n,offset:l,size:s(n,e)}))),u&&(u=b[h.length],h.push(t.ingest({index:h.length,label:`…${b.length-h.length} entries`,value:u,offset:l,size:s(u,e)})))):f===n.GradientLegend?(a=m.domain(),o=n.scaleFraction(m,a[0],r.peek(a)),b.length<3&&!e.values&&a[0]!==r.peek(a)&&(b=[a[0],r.peek(a)]),h=b.map(((e,n)=>t.ingest({index:n,label:v(e,n,b),value:e,perc:o(e)})))):(s=b.length-1,o=n.labelFraction(m),h=b.map(((e,n)=>t.ingest({index:n,label:v(e,n,b),value:e,perc:n?o(e):0,perc2:n===s?1:o(b[n+1])})))),d.source=h,d.add=h,this.value=h,d}});const u=e=>e.source.x,c=e=>e.source.y,d=e=>e.target.x,h=e=>e.target.y;function f(e){t.Transform.call(this,{},e)}f.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},r.inherits(f,t.Transform,{transform(e,t){var n=e.sourceX||u,i=e.sourceY||c,a=e.targetX||d,o=e.targetY||h,s=e.as||"path",l=e.orient||"vertical",f=e.shape||"line",m=y.get(f+"-"+l)||y.get(f);return m||r.error("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,(e=>{e[s]=m(n(e),i(e),a(e),o(e))})),t.reflow(e.modified()).modifies(s)}});const m=(e,t,n,r)=>"M"+e+","+t+"L"+n+","+r,g=(e,t,n,r)=>{var i=n-e,a=r-t,o=Math.sqrt(i*i+a*a)/2;return"M"+e+","+t+"A"+o+","+o+" "+180*Math.atan2(a,i)/Math.PI+" 0 1 "+n+","+r},p=(e,t,n,r)=>{const i=n-e,a=r-t,o=.2*(i+a),s=.2*(a-i);return"M"+e+","+t+"C"+(e+o)+","+(t+s)+" "+(n+s)+","+(r-o)+" "+n+","+r},y=r.fastmap({line:m,"line-radial":(e,t,n,r)=>m(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),arc:g,"arc-radial":(e,t,n,r)=>g(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),curve:p,"curve-radial":(e,t,n,r)=>p(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),"orthogonal-horizontal":(e,t,n,r)=>"M"+e+","+t+"V"+r+"H"+n,"orthogonal-vertical":(e,t,n,r)=>"M"+e+","+t+"H"+n+"V"+r,"orthogonal-radial":(e,t,n,r)=>{const i=Math.cos(e),a=Math.sin(e),o=Math.cos(n),s=Math.sin(n);return"M"+t*i+","+t*a+"A"+t+","+t+" 0 0,"+((Math.abs(n-e)>Math.PI?n<=e:n>e)?1:0)+" "+t*o+","+t*s+"L"+r*o+","+r*s},"diagonal-horizontal":(e,t,n,r)=>{const i=(e+n)/2;return"M"+e+","+t+"C"+i+","+t+" "+i+","+r+" "+n+","+r},"diagonal-vertical":(e,t,n,r)=>{const i=(t+r)/2;return"M"+e+","+t+"C"+e+","+i+" "+n+","+i+" "+n+","+r},"diagonal-radial":(e,t,n,r)=>{const i=Math.cos(e),a=Math.sin(e),o=Math.cos(n),s=Math.sin(n),l=(t+r)/2;return"M"+t*i+","+t*a+"C"+l*i+","+l*a+" "+l*o+","+l*s+" "+r*o+","+r*s}});function v(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((t-e)/n)),a=new Array(i);++r<i;)a[r]=e+r*n;return a}function b(e){t.Transform.call(this,null,e)}function w(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function M(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function x(){}b.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},r.inherits(b,t.Transform,{transform(e,t){var n,i,a,o=e.as||["startAngle","endAngle"],s=o[0],l=o[1],u=e.field||r.one,c=e.startAngle||0,d=null!=e.endAngle?e.endAngle:2*Math.PI,h=t.source,f=h.map(u),m=f.length,g=c,p=(d-c)/function(e,t){let n=0;if(void 0===t)for(let t of e)(t=+t)&&(n+=t);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}(f),y=v(m);for(e.sort&&y.sort(((e,t)=>f[e]-f[t])),n=0;n<m;++n)a=f[y[n]],(i=h[y[n]])[s]=g,i[l]=g+=a*p;return this.value=f,t.reflow(e.modified()).modifies(o)}});var k=.7,$=1/k,S="\\s*([+-]?\\d+)\\s*",N="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",D="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",A=/^#([0-9a-f]{3,8})$/,O=new RegExp(`^rgb\\(${S},${S},${S}\\)$`),T=new RegExp(`^rgb\\(${D},${D},${D}\\)$`),E=new RegExp(`^rgba\\(${S},${S},${S},${N}\\)$`),R=new RegExp(`^rgba\\(${D},${D},${D},${N}\\)$`),C=new RegExp(`^hsl\\(${N},${D},${D}\\)$`),L=new RegExp(`^hsla\\(${N},${D},${D},${N}\\)$`),q={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function z(){return this.rgb().formatHex()}function I(){return this.rgb().formatRgb()}function P(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=A.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?F(t):3===n?new j(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?H(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?H(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=O.exec(e))?new j(t[1],t[2],t[3],1):(t=T.exec(e))?new j(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=E.exec(e))?H(t[1],t[2],t[3],t[4]):(t=R.exec(e))?H(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=C.exec(e))?Y(t[1],t[2]/100,t[3]/100,1):(t=L.exec(e))?Y(t[1],t[2]/100,t[3]/100,t[4]):q.hasOwnProperty(e)?F(q[e]):"transparent"===e?new j(NaN,NaN,NaN,0):null}function F(e){return new j(e>>16&255,e>>8&255,255&e,1)}function H(e,t,n,r){return r<=0&&(e=t=n=NaN),new j(e,t,n,r)}function _(e,t,n,r){return 1===arguments.length?((i=e)instanceof x||(i=P(i)),i?new j((i=i.rgb()).r,i.g,i.b,i.opacity):new j):new j(e,t,n,null==r?1:r);var i}function j(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function U(){return`#${X(this.r)}${X(this.g)}${X(this.b)}`}function V(){const e=G(this.opacity);return`${1===e?"rgb(":"rgba("}${B(this.r)}, ${B(this.g)}, ${B(this.b)}${1===e?")":`, ${e})`}`}function G(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function B(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function X(e){return((e=B(e))<16?"0":"")+e.toString(16)}function Y(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new J(e,t,n,r)}function Q(e){if(e instanceof J)return new J(e.h,e.s,e.l,e.opacity);if(e instanceof x||(e=P(e)),!e)return new J;if(e instanceof J)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,l=(a+i)/2;return s?(o=t===a?(n-r)/s+6*(n<r):n===a?(r-t)/s+2:(t-n)/s+4,s/=l<.5?a+i:2-a-i,o*=60):s=l>0&&l<1?0:o,new J(o,s,l,e.opacity)}function J(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function W(e){return(e=(e||0)%360)<0?e+360:e}function K(e){return Math.max(0,Math.min(1,e||0))}function Z(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}w(x,P,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:z,formatHex:z,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Q(this).formatHsl()},formatRgb:I,toString:I}),w(j,_,M(x,{brighter(e){return e=null==e?$:Math.pow($,e),new j(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?k:Math.pow(k,e),new j(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new j(B(this.r),B(this.g),B(this.b),G(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:U,formatHex:U,formatHex8:function(){return`#${X(this.r)}${X(this.g)}${X(this.b)}${X(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:V,toString:V})),w(J,(function(e,t,n,r){return 1===arguments.length?Q(e):new J(e,t,n,null==r?1:r)}),M(x,{brighter(e){return e=null==e?$:Math.pow($,e),new J(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?k:Math.pow(k,e),new J(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new j(Z(e>=240?e-240:e+120,i,r),Z(e,i,r),Z(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new J(W(this.h),K(this.s),K(this.l),G(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=G(this.opacity);return`${1===e?"hsl(":"hsla("}${W(this.h)}, ${100*K(this.s)}%, ${100*K(this.l)}%${1===e?")":`, ${e})`}`}}));var ee=e=>()=>e;function te(e){return 1==(e=+e)?ne:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):ee(isNaN(t)?n:t)}}function ne(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):ee(isNaN(e)?t:e)}var re=function e(t){var n=te(t);function r(e,t){var r=n((e=_(e)).r,(t=_(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=ne(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+""}}return r.gamma=e,r}(1);function ie(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,i=t.slice();return function(a){for(n=0;n<r;++n)i[n]=e[n]*(1-a)+t[n]*a;return i}}function ae(e,t){var n,r=t?t.length:0,i=e?Math.min(r,e.length):0,a=new Array(i),o=new Array(r);for(n=0;n<i;++n)a[n]=he(e[n],t[n]);for(;n<r;++n)o[n]=t[n];return function(e){for(n=0;n<i;++n)o[n]=a[n](e);return o}}function oe(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function se(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function le(e,t){var n,r={},i={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?r[n]=he(e[n],t[n]):i[n]=t[n];return function(e){for(n in r)i[n]=r[n](e);return i}}var ue=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ce=new RegExp(ue.source,"g");function de(e,t){var n,r,i,a=ue.lastIndex=ce.lastIndex=0,o=-1,s=[],l=[];for(e+="",t+="";(n=ue.exec(e))&&(r=ce.exec(t));)(i=r.index)>a&&(i=t.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(n=n[0])===(r=r[0])?s[o]?s[o]+=r:s[++o]=r:(s[++o]=null,l.push({i:o,x:se(n,r)})),a=ce.lastIndex;return a<t.length&&(i=t.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,r=0;r<t;++r)s[(n=l[r]).i]=n.x(e);return s.join("")})}function he(e,t){var n,r,i=typeof t;return null==t||"boolean"===i?ee(t):("number"===i?se:"string"===i?(n=P(t))?(t=n,re):de:t instanceof P?re:t instanceof Date?oe:(r=t,!ArrayBuffer.isView(r)||r instanceof DataView?Array.isArray(t)?ae:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?le:se:ie))(e,t)}function fe(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}const me=5;function ge(e){return n.isContinuous(e)&&e!==n.Sequential}const pe=r.toSet(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function ye(e){t.Transform.call(this,null,e),this.modified(!0)}function ve(e,t,i){n.isLogarithmic(e)&&(Math.abs(t.reduce(((e,t)=>e+(t<0?-1:t>0?1:0)),0))!==t.length&&i.warn("Log scale domain includes zero: "+r.stringValue(t)));return t}function be(e,t,i){return r.isFunction(e)&&(t||i)?n.interpolateRange(e,we(t||[0,1],i)):e}function we(e,t){return t?e.slice().reverse():e}function Me(e){t.Transform.call(this,null,e)}r.inherits(ye,t.Transform,{transform(e,t){var i=t.dataflow,a=this.value,o=function(e){var t,i=e.type,a="";if(i===n.Sequential)return n.Sequential+"-"+n.Linear;(function(e){const t=e.type;return n.isContinuous(t)&&t!==n.Time&&t!==n.UTC&&(e.scheme||e.range&&e.range.length&&e.range.every(r.isString))})(e)&&(a=2===(t=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0)?n.Sequential+"-":3===t?n.Diverging+"-":"");return(a+i||n.Linear).toLowerCase()}(e);for(o in a&&o===a.type||(this.value=a=n.scale(o)()),e)if(!pe[o]){if("padding"===o&&ge(a.type))continue;r.isFunction(a[o])?a[o](e[o]):i.warn("Unsupported scale property: "+o)}return function(e,t,i){var a=e.type,o=t.round||!1,s=t.range;if(null!=t.rangeStep)s=function(e,t,i){e!==n.Band&&e!==n.Point&&r.error("Only band and point scales support rangeStep.");var a=(null!=t.paddingOuter?t.paddingOuter:t.padding)||0,o=e===n.Point?1:(null!=t.paddingInner?t.paddingInner:t.padding)||0;return[0,t.rangeStep*n.bandSpace(i,o,a)]}(a,t,i);else if(t.scheme&&(s=function(e,t,i){var a,o,s=t.schemeExtent;r.isArray(t.scheme)?o=n.interpolateColors(t.scheme,t.interpolate,t.interpolateGamma):(a=t.scheme.toLowerCase(),(o=n.scheme(a))||r.error(`Unrecognized scheme name: ${t.scheme}`));return i=e===n.Threshold?i+1:e===n.BinOrdinal?i-1:e===n.Quantile||e===n.Quantize?+t.schemeCount||me:i,n.isInterpolating(e)?be(o,s,t.reverse):r.isFunction(o)?n.quantizeInterpolator(be(o,s),i):e===n.Ordinal?o:o.slice(0,i)}(a,t,i),r.isFunction(s))){if(e.interpolator)return e.interpolator(s);r.error(`Scale type ${a} does not support interpolating color schemes.`)}if(s&&n.isInterpolating(a))return e.interpolator(n.interpolateColors(we(s,t.reverse),t.interpolate,t.interpolateGamma));s&&t.interpolate&&e.interpolate?e.interpolate(n.interpolate(t.interpolate,t.interpolateGamma)):r.isFunction(e.round)?e.round(o):r.isFunction(e.rangeRound)&&e.interpolate(o?fe:he);s&&e.range(we(s,t.reverse))}(a,e,function(e,t,i){let a=t.bins;if(a&&!r.isArray(a)){const t=e.domain(),n=t[0],i=r.peek(t),o=a.step;let s=null==a.start?n:a.start,l=null==a.stop?i:a.stop;o||r.error("Scale bins parameter missing step property."),s<n&&(s=o*Math.ceil(n/o)),l>i&&(l=o*Math.floor(i/o)),a=v(s,l+o/2,o)}a?e.bins=a:e.bins&&delete e.bins;e.type===n.BinOrdinal&&(a?t.domain||t.domainRaw||(e.domain(a),i=a.length):e.bins=e.domain());return i}(a,e,function(e,t,i){const a=function(e,t,n){return t?(e.domain(ve(e.type,t,n)),t.length):-1}(e,t.domainRaw,i);if(a>-1)return a;var o,s,l=t.domain,u=e.type,c=t.zero||void 0===t.zero&&function(e){const t=e.type;return!e.bins&&(t===n.Linear||t===n.Pow||t===n.Sqrt)}(e);if(!l)return 0;ge(u)&&t.padding&&l[0]!==r.peek(l)&&(l=function(e,t,i,a,o,s){var l=Math.abs(r.peek(i)-i[0]),u=l/(l-2*a),c=e===n.Log?r.zoomLog(t,null,u):e===n.Sqrt?r.zoomPow(t,null,u,.5):e===n.Pow?r.zoomPow(t,null,u,o||1):e===n.Symlog?r.zoomSymlog(t,null,u,s||1):r.zoomLinear(t,null,u);return t=t.slice(),t[0]=c[0],t[t.length-1]=c[1],t}(u,l,t.range,t.padding,t.exponent,t.constant));if((c||null!=t.domainMin||null!=t.domainMax||null!=t.domainMid)&&(o=(l=l.slice()).length-1||1,c&&(l[0]>0&&(l[0]=0),l[o]<0&&(l[o]=0)),null!=t.domainMin&&(l[0]=t.domainMin),null!=t.domainMax&&(l[o]=t.domainMax),null!=t.domainMid)){const e=(s=t.domainMid)>l[o]?o+1:s<l[0]?0:o;e!==o&&i.warn("Scale domainMid exceeds domain min or max.",s),l.splice(e,0,s)}e.domain(ve(u,l,i)),u===n.Ordinal&&e.unknown(t.domainImplicit?n.scaleImplicit:void 0);t.nice&&e.nice&&e.nice(!0!==t.nice&&n.tickCount(e,t.nice)||null);return l.length}(a,e,i))),t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),r.inherits(Me,t.Transform,{transform(e,n){const r=e.modified("sort")||n.changed(n.ADD)||n.modified(e.sort.fields)||n.modified("datum");return r&&n.source.sort(t.stableCompare(e.sort)),this.modified(r),n}});const xe="zero",ke="center",$e="normalize",Se=["y0","y1"];function Ne(e){t.Transform.call(this,null,e)}function De(e,t,n,r,i){for(var a,o=(t-e.sum)/2,s=e.length,l=0;l<s;++l)(a=e[l])[r]=o,a[i]=o+=Math.abs(n(a))}function Ae(e,t,n,r,i){for(var a,o=1/e.sum,s=0,l=e.length,u=0,c=0;u<l;++u)(a=e[u])[r]=s,a[i]=s=o*(c+=Math.abs(n(a)))}function Oe(e,t,n,r,i){for(var a,o,s=0,l=0,u=e.length,c=0;c<u;++c)(a=+n(o=e[c]))<0?(o[r]=l,o[i]=l+=a):(o[r]=s,o[i]=s+=a)}Ne.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:xe,values:[xe,ke,$e]},{name:"as",type:"string",array:!0,length:2,default:Se}]},r.inherits(Ne,t.Transform,{transform(e,n){var i,a,o,s,l=e.as||Se,u=l[0],c=l[1],d=t.stableCompare(e.sort),h=e.field||r.one,f=e.offset===ke?De:e.offset===$e?Ae:Oe;for(i=function(e,t,n,r){var i,a,o,s,l,u,c,d,h,f=[],m=e=>e(l);if(null==t)f.push(e.slice());else for(i={},a=0,o=e.length;a<o;++a)l=e[a],(c=i[u=t.map(m)])||(i[u]=c=[],f.push(c)),c.push(l);for(u=0,h=0,s=f.length;u<s;++u){for(a=0,d=0,o=(c=f[u]).length;a<o;++a)d+=Math.abs(r(c[a]));c.sum=d,d>h&&(h=d),n&&c.sort(n)}return f.max=h,f}(n.source,e.groupby,d,h),a=0,o=i.length,s=i.max;a<o;++a)f(i[a],s,h,u,c);return n.reflow(e.modified()).modifies(l)}}),e.axisticks=i,e.datajoin=a,e.encode=s,e.legendentries=l,e.linkpath=f,e.pie=b,e.scale=ye,e.sortitems=Me,e.stack=Ne}));
//# sourceMappingURL=vega-encode.min.js.map
import { Transform, ingest, tupleid, stableCompare } from 'vega-dataflow';
import { tickCount, tickFormat, validTicks, tickValues, SymbolLegend, labelFormat, labelValues, GradientLegend, scaleFraction, labelFraction, scale, isContinuous, Sequential, Linear, Time, UTC, Pow, Sqrt, Ordinal, scaleImplicit, Log, Symlog, isLogarithmic, BinOrdinal, bandSpace, isInterpolating, interpolateRange, quantizeInterpolator, interpolateColors, interpolate, Band, Point, scheme, Threshold, Quantile, Quantize, Diverging } from 'vega-scale';
import { tickCount, tickFormat, validTicks, tickValues, SymbolLegend, labelFormat, labelValues, GradientLegend, scaleFraction, labelFraction, scale, Sequential, Linear, isContinuous, Time, UTC, Ordinal, scaleImplicit, Log, Sqrt, Pow, Symlog, isLogarithmic, BinOrdinal, isInterpolating, interpolateColors, interpolate, Band, Point, bandSpace, scheme, Threshold, Quantile, Quantize, quantizeInterpolator, interpolateRange, Diverging } from 'vega-scale';
import { inherits, isArray, error, fastmap, falsy, isFunction, constant, peek, one, toSet, isString, zoomLog, zoomPow, zoomSymlog, zoomLinear, stringValue } from 'vega-util';

@@ -23,3 +23,2 @@ import { sum, range } from 'd3-array';

*/
function AxisTicks(params) {

@@ -33,11 +32,10 @@ Transform.call(this, null, params);

}
var locale = pulse.dataflow.locale(),
out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
ticks = this.value,
scale = _.scale,
tally = _.count == null ? _.values ? _.values.length : 10 : _.count,
count = tickCount(scale, tally, _.minstep),
format = _.format || tickFormat(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values),
values = _.values ? validTicks(scale, _.values, count) : tickValues(scale, count);
out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
ticks = this.value,
scale = _.scale,
tally = _.count == null ? _.values ? _.values.length : 10 : _.count,
count = tickCount(scale, tally, _.minstep),
format = _.format || tickFormat(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values),
values = _.values ? validTicks(scale, _.values, count) : tickValues(scale, count);
if (ticks) out.rem = ticks;

@@ -49,3 +47,2 @@ ticks = values.map((value, i) => ingest({

}));
if (_.extra && ticks.length) {

@@ -62,3 +59,2 @@ // add an extra tick pegged to the initial domain value

}
out.source = ticks;

@@ -69,3 +65,2 @@ out.add = ticks;

}
});

@@ -80,36 +75,29 @@

*/
function DataJoin(params) {
Transform.call(this, null, params);
}
function defaultItemCreate() {
return ingest({});
}
function newMap(key) {
const map = fastmap().test(t => t.exit);
map.lookup = t => map.get(key(t));
return map;
}
inherits(DataJoin, Transform, {
transform(_, pulse) {
var df = pulse.dataflow,
out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
item = _.item || defaultItemCreate,
key = _.key || tupleid,
map = this.value; // prevent transient (e.g., hover) requests from
out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
item = _.item || defaultItemCreate,
key = _.key || tupleid,
map = this.value;
// prevent transient (e.g., hover) requests from
// cascading across marks derived from marks
if (isArray(out.encode)) {
out.encode = null;
}
if (map && (_.modified('key') || pulse.modified(key))) {
error('DataJoin does not support modified key function or fields.');
}
if (!map) {

@@ -119,7 +107,5 @@ pulse = pulse.addAll();

}
pulse.visit(pulse.ADD, t => {
const k = key(t);
let x = map.get(k);
if (x) {

@@ -137,3 +123,2 @@ if (x.exit) {

}
x.datum = t;

@@ -144,4 +129,3 @@ x.exit = false;

const k = key(t),
x = map.get(k);
x = map.get(k);
if (x) {

@@ -154,4 +138,3 @@ x.datum = t;

const k = key(t),
x = map.get(k);
x = map.get(k);
if (t === x.datum && !x.exit) {

@@ -164,10 +147,7 @@ out.rem.push(x);

if (pulse.changed(pulse.ADD_MOD)) out.modifies('datum');
if (pulse.clean() || _.clean && map.empty > df.cleanThreshold) {
df.runAfter(map.clean);
}
return out;
}
});

@@ -187,3 +167,2 @@

*/
function Encode(params) {

@@ -195,8 +174,9 @@ Transform.call(this, null, params);

var out = pulse.fork(pulse.ADD_REM),
fmod = _.mod || false,
encoders = _.encoders,
encode = pulse.encode; // if an array, the encode directive includes additional sets
fmod = _.mod || false,
encoders = _.encoders,
encode = pulse.encode;
// if an array, the encode directive includes additional sets
// that must be defined in order for the primary set to be invoked
// e.g., only run the update set if the hover set is defined
if (isArray(encode)) {

@@ -209,11 +189,10 @@ if (out.changed() || encode.every(e => encoders[e])) {

}
} // marshall encoder functions
}
// marshall encoder functions
var reenter = encode === 'enter',
update = encoders.update || falsy,
enter = encoders.enter || falsy,
exit = encoders.exit || falsy,
set = (encode && !reenter ? encoders[encode] : update) || falsy;
update = encoders.update || falsy,
enter = encoders.enter || falsy,
exit = encoders.exit || falsy,
set = (encode && !reenter ? encoders[encode] : update) || falsy;
if (pulse.changed(pulse.ADD)) {

@@ -226,3 +205,2 @@ pulse.visit(pulse.ADD, t => {

out.modifies(update.output);
if (set !== falsy && set !== update) {

@@ -235,3 +213,2 @@ pulse.visit(pulse.ADD, t => {

}
if (pulse.changed(pulse.REM) && exit !== falsy) {

@@ -243,6 +220,4 @@ pulse.visit(pulse.REM, t => {

}
if (reenter || set !== falsy) {
const flag = pulse.MOD | (_.modified() ? pulse.REFLOW : 0);
if (reenter) {

@@ -259,9 +234,6 @@ pulse.visit(flag, t => {

}
if (out.mod.length) out.modifies(set.output);
}
return out.changed() ? out : pulse.StopPropagation;
}
});

@@ -287,3 +259,2 @@

*/
function LegendEntries(params) {

@@ -297,20 +268,18 @@ Transform.call(this, [], params);

}
var locale = pulse.dataflow.locale(),
out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
items = this.value,
type = _.type || SymbolLegend,
scale = _.scale,
limit = +_.limit,
count = tickCount(scale, _.count == null ? 5 : _.count, _.minstep),
lskip = !!_.values || type === SymbolLegend,
format = _.format || labelFormat(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip),
values = _.values || labelValues(scale, count),
domain,
fraction,
size,
offset,
ellipsis;
out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
items = this.value,
type = _.type || SymbolLegend,
scale = _.scale,
limit = +_.limit,
count = tickCount(scale, _.count == null ? 5 : _.count, _.minstep),
lskip = !!_.values || type === SymbolLegend,
format = _.format || labelFormat(locale, scale, count, type, _.formatSpecifier, _.formatType, lskip),
values = _.values || labelValues(scale, count),
domain,
fraction,
size,
offset,
ellipsis;
if (items) out.rem = items;
if (type === SymbolLegend) {

@@ -324,3 +293,2 @@ if (limit && values.length > limit) {

}
if (isFunction(size = _.size)) {

@@ -330,5 +298,4 @@ // if first value maps to size zero, remove from list (vega#717)

items = items.slice(1);
} // compute size offset for legend entries
}
// compute size offset for legend entries
offset = items.reduce((max, value) => Math.max(max, size(value, _)), 0);

@@ -338,3 +305,2 @@ } else {

}
items = items.map((value, index) => ingest({

@@ -347,3 +313,2 @@ index: index,

}));
if (ellipsis) {

@@ -353,3 +318,3 @@ ellipsis = values[items.length];

index: items.length,
label: "\u2026".concat(values.length - items.length, " entries"),
label: `\u2026${values.length - items.length} entries`,
value: ellipsis,

@@ -361,9 +326,9 @@ offset: offset,

} else if (type === GradientLegend) {
domain = scale.domain(), fraction = scaleFraction(scale, domain[0], peek(domain)); // if automatic label generation produces 2 or fewer values,
domain = scale.domain(), fraction = scaleFraction(scale, domain[0], peek(domain));
// if automatic label generation produces 2 or fewer values,
// use the domain end points instead (fixes vega/vega#1364)
if (values.length < 3 && !_.values && domain[0] !== peek(domain)) {
values = [domain[0], peek(domain)];
}
items = values.map((value, index) => ingest({

@@ -386,3 +351,2 @@ index: index,

}
out.source = items;

@@ -393,12 +357,9 @@ out.add = items;

}
});
const sourceX = t => t.source.x;
const sourceY = t => t.source.y;
const targetX = t => t.target.x;
const targetY = t => t.target.y;
const targetY = t => t.target.y;
/**

@@ -409,4 +370,2 @@ * Layout paths linking source and target elements.

*/
function LinkPath(params) {

@@ -458,14 +417,12 @@ Transform.call(this, {}, params);

var sx = _.sourceX || sourceX,
sy = _.sourceY || sourceY,
tx = _.targetX || targetX,
ty = _.targetY || targetY,
as = _.as || 'path',
orient = _.orient || 'vertical',
shape = _.shape || 'line',
path = Paths.get(shape + '-' + orient) || Paths.get(shape);
sy = _.sourceY || sourceY,
tx = _.targetX || targetX,
ty = _.targetY || targetY,
as = _.as || 'path',
orient = _.orient || 'vertical',
shape = _.shape || 'line',
path = Paths.get(shape + '-' + orient) || Paths.get(shape);
if (!path) {
error('LinkPath unsupported type: ' + _.shape + (_.orient ? '-' + _.orient : ''));
}
pulse.visit(pulse.SOURCE, t => {

@@ -476,42 +433,31 @@ t[as] = path(sx(t), sy(t), tx(t), ty(t));

}
});
const line = (sx, sy, tx, ty) => 'M' + sx + ',' + sy + 'L' + tx + ',' + ty;
const lineR = (sa, sr, ta, tr) => line(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));
const arc = (sx, sy, tx, ty) => {
var dx = tx - sx,
dy = ty - sy,
rr = Math.sqrt(dx * dx + dy * dy) / 2,
ra = 180 * Math.atan2(dy, dx) / Math.PI;
dy = ty - sy,
rr = Math.sqrt(dx * dx + dy * dy) / 2,
ra = 180 * Math.atan2(dy, dx) / Math.PI;
return 'M' + sx + ',' + sy + 'A' + rr + ',' + rr + ' ' + ra + ' 0 1' + ' ' + tx + ',' + ty;
};
const arcR = (sa, sr, ta, tr) => arc(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));
const curve = (sx, sy, tx, ty) => {
const dx = tx - sx,
dy = ty - sy,
ix = 0.2 * (dx + dy),
iy = 0.2 * (dy - dx);
dy = ty - sy,
ix = 0.2 * (dx + dy),
iy = 0.2 * (dy - dx);
return 'M' + sx + ',' + sy + 'C' + (sx + ix) + ',' + (sy + iy) + ' ' + (tx + iy) + ',' + (ty - ix) + ' ' + tx + ',' + ty;
};
const curveR = (sa, sr, ta, tr) => curve(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));
const orthoX = (sx, sy, tx, ty) => 'M' + sx + ',' + sy + 'V' + ty + 'H' + tx;
const orthoY = (sx, sy, tx, ty) => 'M' + sx + ',' + sy + 'H' + tx + 'V' + ty;
const orthoR = (sa, sr, ta, tr) => {
const sc = Math.cos(sa),
ss = Math.sin(sa),
tc = Math.cos(ta),
ts = Math.sin(ta),
sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa;
ss = Math.sin(sa),
tc = Math.cos(ta),
ts = Math.sin(ta),
sf = Math.abs(ta - sa) > Math.PI ? ta <= sa : ta > sa;
return 'M' + sr * sc + ',' + sr * ss + 'A' + sr + ',' + sr + ' 0 0,' + (sf ? 1 : 0) + ' ' + sr * tc + ',' + sr * ts + 'L' + tr * tc + ',' + tr * ts;
};
const diagonalX = (sx, sy, tx, ty) => {

@@ -521,3 +467,2 @@ const m = (sx + tx) / 2;

};
const diagonalY = (sx, sy, tx, ty) => {

@@ -527,12 +472,10 @@ const m = (sy + ty) / 2;

};
const diagonalR = (sa, sr, ta, tr) => {
const sc = Math.cos(sa),
ss = Math.sin(sa),
tc = Math.cos(ta),
ts = Math.sin(ta),
mr = (sr + tr) / 2;
ss = Math.sin(sa),
tc = Math.cos(ta),
ts = Math.sin(ta),
mr = (sr + tr) / 2;
return 'M' + sr * sc + ',' + sr * ss + 'C' + mr * sc + ',' + mr * ss + ' ' + mr * tc + ',' + mr * ts + ' ' + tr * tc + ',' + tr * ts;
};
const Paths = fastmap({

@@ -562,3 +505,2 @@ 'line': line,

*/
function Pie(params) {

@@ -598,21 +540,19 @@ Transform.call(this, null, params);

var as = _.as || ['startAngle', 'endAngle'],
startAngle = as[0],
endAngle = as[1],
field = _.field || one,
start = _.startAngle || 0,
stop = _.endAngle != null ? _.endAngle : 2 * Math.PI,
data = pulse.source,
values = data.map(field),
n = values.length,
a = start,
k = (stop - start) / sum(values),
index = range(n),
i,
t,
v;
startAngle = as[0],
endAngle = as[1],
field = _.field || one,
start = _.startAngle || 0,
stop = _.endAngle != null ? _.endAngle : 2 * Math.PI,
data = pulse.source,
values = data.map(field),
n = values.length,
a = start,
k = (stop - start) / sum(values),
index = range(n),
i,
t,
v;
if (_.sort) {
index.sort((a, b) => values[a] - values[b]);
}
for (i = 0; i < n; ++i) {

@@ -624,11 +564,8 @@ v = values[index[i]];

}
this.value = values;
return pulse.reflow(_.modified()).modifies(as);
}
});
const DEFAULT_COUNT = 5;
function includeZero(scale) {

@@ -638,8 +575,7 @@ const type = scale.type;

}
function includePad(type) {
return isContinuous(type) && type !== Sequential;
}
const SKIP = toSet(['set', 'modified', 'clear', 'type', 'scheme', 'schemeExtent', 'schemeCount', 'domain', 'domainMin', 'domainMid', 'domainMax', 'domainRaw', 'domainImplicit', 'nice', 'zero', 'bins', 'range', 'rangeStep', 'round', 'reverse', 'interpolate', 'interpolateGamma']);
const SKIP = toSet(['set', 'modified', 'clear', 'type', 'scheme', 'schemeExtent', 'schemeCount', 'domain', 'domainMin', 'domainMid', 'domainMax', 'domainRaw', 'domainImplicit', 'nice', 'zero', 'bins', 'range', 'rangeStep', 'round', 'reverse', 'interpolate', 'interpolateGamma']);
/**

@@ -650,3 +586,2 @@ * Maintains a scale function mapping data values to visual channels.

*/
function Scale(params) {

@@ -656,32 +591,28 @@ Transform.call(this, null, params);

}
inherits(Scale, Transform, {
transform(_, pulse) {
var df = pulse.dataflow,
scale$1 = this.value,
key = scaleKey(_);
scale$1 = this.value,
key = scaleKey(_);
if (!scale$1 || key !== scale$1.type) {
this.value = scale$1 = scale(key)();
}
for (key in _) if (!SKIP[key]) {
// padding is a scale property for band/point but not others
if (key === 'padding' && includePad(scale$1.type)) continue; // invoke scale property setter, raise warning if not found
if (key === 'padding' && includePad(scale$1.type)) continue;
// invoke scale property setter, raise warning if not found
isFunction(scale$1[key]) ? scale$1[key](_[key]) : df.warn('Unsupported scale property: ' + key);
}
configureRange(scale$1, _, configureBins(scale$1, _, configureDomain(scale$1, _, df)));
return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);
}
});
function scaleKey(_) {
var t = _.type,
d = '',
n; // backwards compatibility pre Vega 5.
d = '',
n;
// backwards compatibility pre Vega 5.
if (t === Sequential) return Sequential + '-' + Linear;
if (isContinuousColor(_)) {

@@ -691,6 +622,4 @@ n = _.rawDomain ? _.rawDomain.length : _.domain ? _.domain.length + +(_.domainMid != null) : 0;

}
return (d + t || Linear).toLowerCase();
}
function isContinuousColor(_) {

@@ -700,3 +629,2 @@ const t = _.type;

}
function configureDomain(scale, _, df) {

@@ -707,16 +635,16 @@ // check raw domain, if provided use that and exit early

var domain = _.domain,
type = scale.type,
zero = _.zero || _.zero === undefined && includeZero(scale),
n,
mid;
if (!domain) return 0; // adjust continuous domain for minimum pixel padding
type = scale.type,
zero = _.zero || _.zero === undefined && includeZero(scale),
n,
mid;
if (!domain) return 0;
// adjust continuous domain for minimum pixel padding
if (includePad(type) && _.padding && domain[0] !== peek(domain)) {
domain = padDomain(type, domain, _.range, _.padding, _.exponent, _.constant);
} // adjust domain based on zero, min, max settings
}
// adjust domain based on zero, min, max settings
if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) {
n = (domain = domain.slice()).length - 1 || 1;
if (zero) {

@@ -726,6 +654,4 @@ if (domain[0] > 0) domain[0] = 0;

}
if (_.domainMin != null) domain[0] = _.domainMin;
if (_.domainMax != null) domain[n] = _.domainMax;
if (_.domainMid != null) {

@@ -737,21 +663,21 @@ mid = _.domainMid;

}
} // set the scale domain
}
// set the scale domain
scale.domain(domainCheck(type, domain, df));
scale.domain(domainCheck(type, domain, df)); // if ordinal scale domain is defined, prevent implicit
// if ordinal scale domain is defined, prevent implicit
// domain construction as side-effect of scale lookup
if (type === Ordinal) {
scale.unknown(_.domainImplicit ? scaleImplicit : undefined);
} // perform 'nice' adjustment as requested
}
// perform 'nice' adjustment as requested
if (_.nice && scale.nice) {
scale.nice(_.nice !== true && tickCount(scale, _.nice) || null);
} // return the cardinality of the domain
}
// return the cardinality of the domain
return domain.length;
}
function rawDomain(scale, raw, df) {

@@ -765,7 +691,6 @@ if (raw) {

}
function padDomain(type, domain, range, pad, exponent, constant) {
var span = Math.abs(peek(range) - range[0]),
frac = span / (span - 2 * pad),
d = type === Log ? zoomLog(domain, null, frac) : type === Sqrt ? zoomPow(domain, null, frac, 0.5) : type === Pow ? zoomPow(domain, null, frac, exponent || 1) : type === Symlog ? zoomSymlog(domain, null, frac, constant || 1) : zoomLinear(domain, null, frac);
frac = span / (span - 2 * pad),
d = type === Log ? zoomLog(domain, null, frac) : type === Sqrt ? zoomPow(domain, null, frac, 0.5) : type === Pow ? zoomPow(domain, null, frac, exponent || 1) : type === Symlog ? zoomSymlog(domain, null, frac, constant || 1) : zoomLinear(domain, null, frac);
domain = domain.slice();

@@ -776,3 +701,2 @@ domain[0] = d[0];

}
function domainCheck(type, domain, df) {

@@ -783,3 +707,2 @@ if (isLogarithmic(type)) {

var s = Math.abs(domain.reduce((s, v) => s + (v < 0 ? -1 : v > 0 ? 1 : 0), 0));
if (s !== domain.length) {

@@ -789,17 +712,14 @@ df.warn('Log scale domain includes zero: ' + stringValue(domain));

}
return domain;
}
function configureBins(scale, _, count) {
let bins = _.bins;
if (bins && !isArray(bins)) {
// generate bin boundary array
const domain = scale.domain(),
lo = domain[0],
hi = peek(domain),
step = bins.step;
lo = domain[0],
hi = peek(domain),
step = bins.step;
let start = bins.start == null ? lo : bins.start,
stop = bins.stop == null ? hi : bins.stop;
stop = bins.stop == null ? hi : bins.stop;
if (!step) error('Scale bins parameter missing step property.');

@@ -810,3 +730,2 @@ if (start < lo) start = step * Math.ceil(lo / step);

}
if (bins) {

@@ -818,5 +737,5 @@ // assign bin boundaries to scale instance

delete scale.bins;
} // special handling for bin-ordinal scales
}
// special handling for bin-ordinal scales
if (scale.type === BinOrdinal) {

@@ -831,19 +750,20 @@ if (!bins) {

}
} // return domain cardinality
}
// return domain cardinality
return count;
}
function configureRange(scale, _, count) {
var type = scale.type,
round = _.round || false,
range = _.range; // if range step specified, calculate full range extent
round = _.round || false,
range = _.range;
// if range step specified, calculate full range extent
if (_.rangeStep != null) {
range = configureRangeStep(type, _, count);
} // else if a range scheme is defined, use that
}
// else if a range scheme is defined, use that
else if (_.scheme) {
range = configureScheme(type, _, count);
if (isFunction(range)) {

@@ -853,13 +773,13 @@ if (scale.interpolator) {

} else {
error("Scale type ".concat(type, " does not support interpolating color schemes."));
error(`Scale type ${type} does not support interpolating color schemes.`);
}
}
} // given a range array for an interpolating scale, convert to interpolator
}
// given a range array for an interpolating scale, convert to interpolator
if (range && isInterpolating(type)) {
return scale.interpolator(interpolateColors(flip(range, _.reverse), _.interpolate, _.interpolateGamma));
} // configure rounding / interpolation
}
// configure rounding / interpolation
if (range && _.interpolate && scale.interpolate) {

@@ -872,22 +792,18 @@ scale.interpolate(interpolate(_.interpolate, _.interpolateGamma));

}
if (range) scale.range(flip(range, _.reverse));
}
function configureRangeStep(type, _, count) {
if (type !== Band && type !== Point) {
error('Only band and point scales support rangeStep.');
} // calculate full range based on requested step size and padding
}
// calculate full range based on requested step size and padding
var outer = (_.paddingOuter != null ? _.paddingOuter : _.padding) || 0,
inner = type === Point ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0;
inner = type === Point ? 1 : (_.paddingInner != null ? _.paddingInner : _.padding) || 0;
return [0, _.rangeStep * bandSpace(count, inner, outer)];
}
function configureScheme(type, _, count) {
var extent = _.schemeExtent,
name,
scheme$1;
name,
scheme$1;
if (isArray(_.scheme)) {

@@ -898,15 +814,14 @@ scheme$1 = interpolateColors(_.scheme, _.interpolate, _.interpolateGamma);

scheme$1 = scheme(name);
if (!scheme$1) error("Unrecognized scheme name: ".concat(_.scheme));
} // determine size for potential discrete range
if (!scheme$1) error(`Unrecognized scheme name: ${_.scheme}`);
}
// determine size for potential discrete range
count = type === Threshold ? count + 1 : type === BinOrdinal ? count - 1 : type === Quantile || type === Quantize ? +_.schemeCount || DEFAULT_COUNT : count;
count = type === Threshold ? count + 1 : type === BinOrdinal ? count - 1 : type === Quantile || type === Quantize ? +_.schemeCount || DEFAULT_COUNT : count; // adjust and/or quantize scheme as appropriate
// adjust and/or quantize scheme as appropriate
return isInterpolating(type) ? adjustScheme(scheme$1, extent, _.reverse) : isFunction(scheme$1) ? quantizeInterpolator(adjustScheme(scheme$1, extent), count) : type === Ordinal ? scheme$1 : scheme$1.slice(0, count);
}
function adjustScheme(scheme, extent, reverse) {
return isFunction(scheme) && (extent || reverse) ? interpolateRange(scheme, flip(extent || [0, 1], reverse)) : scheme;
}
function flip(array, reverse) {

@@ -923,3 +838,2 @@ return reverse ? array.slice().reverse() : array;

*/
function SortItems(params) {

@@ -935,9 +849,9 @@ Transform.call(this, null, params);

}
});
const Zero = 'zero',
Center = 'center',
Normalize = 'normalize',
DefOutput = ['y0', 'y1'];
Center = 'center',
Normalize = 'normalize',
DefOutput = ['y0', 'y1'];
/**

@@ -952,3 +866,2 @@ * Stack layout for visualization elements.

*/
function Stack(params) {

@@ -988,29 +901,27 @@ Transform.call(this, null, params);

var as = _.as || DefOutput,
y0 = as[0],
y1 = as[1],
sort = stableCompare(_.sort),
field = _.field || one,
stack = _.offset === Center ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero,
groups,
i,
n,
max; // partition, sum, and sort the stack groups
y0 = as[0],
y1 = as[1],
sort = stableCompare(_.sort),
field = _.field || one,
stack = _.offset === Center ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero,
groups,
i,
n,
max;
groups = partition(pulse.source, _.groupby, sort, field); // compute stack layouts per group
// partition, sum, and sort the stack groups
groups = partition(pulse.source, _.groupby, sort, field);
// compute stack layouts per group
for (i = 0, n = groups.length, max = groups.max; i < n; ++i) {
stack(groups[i], max, field, y0, y1);
}
return pulse.reflow(_.modified()).modifies(as);
}
});
function stackCenter(group, max, field, y0, y1) {
var last = (max - group.sum) / 2,
m = group.length,
j = 0,
t;
m = group.length,
j = 0,
t;
for (; j < m; ++j) {

@@ -1022,11 +933,9 @@ t = group[j];

}
function stackNormalize(group, max, field, y0, y1) {
var scale = 1 / group.sum,
last = 0,
m = group.length,
j = 0,
v = 0,
t;
last = 0,
m = group.length,
j = 0,
v = 0,
t;
for (; j < m; ++j) {

@@ -1038,15 +947,12 @@ t = group[j];

}
function stackZero(group, max, field, y0, y1) {
var lastPos = 0,
lastNeg = 0,
m = group.length,
j = 0,
v,
t;
lastNeg = 0,
m = group.length,
j = 0,
v,
t;
for (; j < m; ++j) {
t = group[j];
v = +field(t);
if (v < 0) {

@@ -1061,17 +967,16 @@ t[y0] = lastNeg;

}
function partition(data, groupby, sort, field) {
var groups = [],
get = f => f(t),
map,
i,
n,
m,
t,
k,
g,
s,
max; // partition data points into stack groups
get = f => f(t),
map,
i,
n,
m,
t,
k,
g,
s,
max;
// partition data points into stack groups
if (groupby == null) {

@@ -1084,3 +989,2 @@ groups.push(data.slice());

g = map[k];
if (!g) {

@@ -1090,15 +994,12 @@ map[k] = g = [];

}
g.push(t);
}
} // compute sums of groups, sort groups as needed
}
// compute sums of groups, sort groups as needed
for (k = 0, max = 0, m = groups.length; k < m; ++k) {
g = groups[k];
for (i = 0, s = 0, n = g.length; i < n; ++i) {
s += Math.abs(field(g[i]));
}
g.sum = s;

@@ -1108,3 +1009,2 @@ if (s > max) max = s;

}
groups.max = max;

@@ -1111,0 +1011,0 @@ return groups;

{
"name": "vega-encode",
"version": "4.9.0",
"version": "4.9.1",
"description": "Visual encoding transforms for Vega dataflows.",

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

"prebuild": "rimraf build",
"build": "rollup -c",
"build": "rollup -c rollup.config.mjs",
"pretest": "yarn build --config-test",

@@ -26,7 +26,7 @@ "test": "tape 'test/**/*-test.js'",

"dependencies": {
"d3-array": "^3.1.1",
"d3-array": "^3.2.2",
"d3-interpolate": "^3.0.1",
"vega-dataflow": "^5.7.3",
"vega-scale": "^7.0.3",
"vega-util": "^1.15.2"
"vega-dataflow": "^5.7.5",
"vega-scale": "^7.3.0",
"vega-util": "^1.17.1"
},

@@ -36,3 +36,3 @@ "devDependencies": {

},
"gitHead": "9a3faca4395cade9ecdfde90af98f1c53e9916b2"
"gitHead": "fb1092f6b931d450f9c210b67ae4752bd3dd461b"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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