@carbon/charts
Version:
Carbon Charts component library
1,568 lines • 438 kB
JavaScript
import { t as Br, $ as ol, i as ll, a0 as cl, a1 as zr, a2 as Ur, a3 as ul, a4 as hl, a5 as dl, a6 as pl, a7 as Fr, a8 as ya, a9 as an, g as O, p as Kt, a as sn, C as Ea, aa as Et, w as Mt, ab as kn, E as xa, H as jt, ac as Wr, ad as Ls, c as fl, ae as xe, I as di, K as pi, e as se, af as yn, ag as ge, f as ye, x as ve, ah as gl, h as Je, O as ml, ai as Xr, aj as Re, z as xt, l as qt, ak as Gt, al as vl, M as yl, am as Yr, y as _t, q as dn, n as Bn, an as $s, ao as El, ap as xl, aq as fi, ar as Sa, A as Ae, as as Ta, at as Zr, au as Sl } from "./color-scale-utils-BzjNNGXE.mjs";
import { y as at, $ as b, N as Tt, r as be, q as ze, L as Tl, A as te, m as nt, s as Me, W as Qe, S as kt, e as J, Z as Ue, i as Xt, f as ba, J as Vs, d as bl, F as zn, n as Gs, H as Hs, C as Bs, p as Un, b as Oa, D as zs, U as Ol, x as we, a0 as Fn, O as Us } from "./axis-scales-CPuwbFQf.mjs";
import { R as lt } from "./a11y-ePqvrObQ.mjs";
import { t as ns, s as D, h as La, e as Ut, c as ss, f as Ce, g as oe, m as Fs, i as Aa, j as Ma, k as tn, l as Dt, n as wa, o as Ll, q as Al, u as zi, D as I, v as Ml, w as gi, G as Ca, x as hs, y as wl, a as Cl, p as bt, r as ka, b as kl } from "./angle-utils-jnw9HSFu.mjs";
import { b as qr, c as pt, a as Ui, s as _l } from "./array-CmsYzTI6.mjs";
function Il(i, t, e, n) {
for (var s = -1, a = i == null ? 0 : i.length; ++s < a; )
e = t(e, i[s], s, i);
return e;
}
function Rl(i) {
return function(t) {
return i?.[t];
};
}
var Dl = {
// Latin-1 Supplement block.
À: "A",
Á: "A",
Â: "A",
Ã: "A",
Ä: "A",
Å: "A",
à: "a",
á: "a",
â: "a",
ã: "a",
ä: "a",
å: "a",
Ç: "C",
ç: "c",
Ð: "D",
ð: "d",
È: "E",
É: "E",
Ê: "E",
Ë: "E",
è: "e",
é: "e",
ê: "e",
ë: "e",
Ì: "I",
Í: "I",
Î: "I",
Ï: "I",
ì: "i",
í: "i",
î: "i",
ï: "i",
Ñ: "N",
ñ: "n",
Ò: "O",
Ó: "O",
Ô: "O",
Õ: "O",
Ö: "O",
Ø: "O",
ò: "o",
ó: "o",
ô: "o",
õ: "o",
ö: "o",
ø: "o",
Ù: "U",
Ú: "U",
Û: "U",
Ü: "U",
ù: "u",
ú: "u",
û: "u",
ü: "u",
Ý: "Y",
ý: "y",
ÿ: "y",
Æ: "Ae",
æ: "ae",
Þ: "Th",
þ: "th",
ß: "ss",
// Latin Extended-A block.
Ā: "A",
Ă: "A",
Ą: "A",
ā: "a",
ă: "a",
ą: "a",
Ć: "C",
Ĉ: "C",
Ċ: "C",
Č: "C",
ć: "c",
ĉ: "c",
ċ: "c",
č: "c",
Ď: "D",
Đ: "D",
ď: "d",
đ: "d",
Ē: "E",
Ĕ: "E",
Ė: "E",
Ę: "E",
Ě: "E",
ē: "e",
ĕ: "e",
ė: "e",
ę: "e",
ě: "e",
Ĝ: "G",
Ğ: "G",
Ġ: "G",
Ģ: "G",
ĝ: "g",
ğ: "g",
ġ: "g",
ģ: "g",
Ĥ: "H",
Ħ: "H",
ĥ: "h",
ħ: "h",
Ĩ: "I",
Ī: "I",
Ĭ: "I",
Į: "I",
İ: "I",
ĩ: "i",
ī: "i",
ĭ: "i",
į: "i",
ı: "i",
Ĵ: "J",
ĵ: "j",
Ķ: "K",
ķ: "k",
ĸ: "k",
Ĺ: "L",
Ļ: "L",
Ľ: "L",
Ŀ: "L",
Ł: "L",
ĺ: "l",
ļ: "l",
ľ: "l",
ŀ: "l",
ł: "l",
Ń: "N",
Ņ: "N",
Ň: "N",
Ŋ: "N",
ń: "n",
ņ: "n",
ň: "n",
ŋ: "n",
Ō: "O",
Ŏ: "O",
Ő: "O",
ō: "o",
ŏ: "o",
ő: "o",
Ŕ: "R",
Ŗ: "R",
Ř: "R",
ŕ: "r",
ŗ: "r",
ř: "r",
Ś: "S",
Ŝ: "S",
Ş: "S",
Š: "S",
ś: "s",
ŝ: "s",
ş: "s",
š: "s",
Ţ: "T",
Ť: "T",
Ŧ: "T",
ţ: "t",
ť: "t",
ŧ: "t",
Ũ: "U",
Ū: "U",
Ŭ: "U",
Ů: "U",
Ű: "U",
Ų: "U",
ũ: "u",
ū: "u",
ŭ: "u",
ů: "u",
ű: "u",
ų: "u",
Ŵ: "W",
ŵ: "w",
Ŷ: "Y",
ŷ: "y",
Ÿ: "Y",
Ź: "Z",
Ż: "Z",
Ž: "Z",
ź: "z",
ż: "z",
ž: "z",
IJ: "IJ",
ij: "ij",
Œ: "Oe",
œ: "oe",
ʼn: "'n",
ſ: "s"
}, Nl = Rl(Dl), Pl = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, $l = "\\u0300-\\u036f", Vl = "\\ufe20-\\ufe2f", Gl = "\\u20d0-\\u20ff", Hl = $l + Vl + Gl, Bl = "[" + Hl + "]", zl = RegExp(Bl, "g");
function Ul(i) {
return i = Br(i), i && i.replace(Pl, Nl).replace(zl, "");
}
var Fl = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
function Wl(i) {
return i.match(Fl) || [];
}
var Xl = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
function Yl(i) {
return Xl.test(i);
}
var jr = "\\ud800-\\udfff", Zl = "\\u0300-\\u036f", ql = "\\ufe20-\\ufe2f", jl = "\\u20d0-\\u20ff", Kl = Zl + ql + jl, Kr = "\\u2700-\\u27bf", Jr = "a-z\\xdf-\\xf6\\xf8-\\xff", Jl = "\\xac\\xb1\\xd7\\xf7", Ql = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", tc = "\\u2000-\\u206f", ec = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", Qr = "A-Z\\xc0-\\xd6\\xd8-\\xde", nc = "\\ufe0e\\ufe0f", to = Jl + Ql + tc + ec, eo = "['’]", _a = "[" + to + "]", sc = "[" + Kl + "]", no = "\\d+", ic = "[" + Kr + "]", so = "[" + Jr + "]", io = "[^" + jr + to + no + Kr + Jr + Qr + "]", ac = "\\ud83c[\\udffb-\\udfff]", rc = "(?:" + sc + "|" + ac + ")", oc = "[^" + jr + "]", ao = "(?:\\ud83c[\\udde6-\\uddff]){2}", ro = "[\\ud800-\\udbff][\\udc00-\\udfff]", qe = "[" + Qr + "]", lc = "\\u200d", Ia = "(?:" + so + "|" + io + ")", cc = "(?:" + qe + "|" + io + ")", Ra = "(?:" + eo + "(?:d|ll|m|re|s|t|ve))?", Da = "(?:" + eo + "(?:D|LL|M|RE|S|T|VE))?", oo = rc + "?", lo = "[" + nc + "]?", uc = "(?:" + lc + "(?:" + [oc, ao, ro].join("|") + ")" + lo + oo + ")*", hc = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", dc = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", pc = lo + oo + uc, fc = "(?:" + [ic, ao, ro].join("|") + ")" + pc, gc = RegExp([
qe + "?" + so + "+" + Ra + "(?=" + [_a, qe, "$"].join("|") + ")",
cc + "+" + Da + "(?=" + [_a, qe + Ia, "$"].join("|") + ")",
qe + "?" + Ia + "+" + Ra,
qe + "+" + Da,
dc,
hc,
no,
fc
].join("|"), "g");
function mc(i) {
return i.match(gc) || [];
}
function vc(i, t, e) {
return i = Br(i), t = t, t === void 0 ? Yl(i) ? mc(i) : Wl(i) : i.match(t) || [];
}
var yc = "['’]", Ec = RegExp(yc, "g");
function xc(i) {
return function(t) {
return Il(vc(Ul(t).replace(Ec, "")), i, "");
};
}
function Sc(i, t, e) {
return i === i && (e !== void 0 && (i = i <= e ? i : e), t !== void 0 && (i = i >= t ? i : t)), i;
}
function co(i, t, e) {
return e === void 0 && (e = t, t = void 0), e !== void 0 && (e = ns(e), e = e === e ? e : 0), t !== void 0 && (t = ns(t), t = t === t ? t : 0), Sc(ns(i), t, e);
}
var Tc = "Expected a function";
function bc(i, t, e) {
if (typeof i != "function")
throw new TypeError(Tc);
return setTimeout(function() {
i.apply(void 0, e);
}, t);
}
var Oc = ol(function(i, t, e) {
return bc(i, ns(t) || 0, e);
});
function Lc(i, t) {
var e = -1, n = ll(i) ? Array(i.length) : [];
return qr(i, function(s, a, r) {
n[++e] = t(s, a, r);
}), n;
}
function Ac(i, t) {
var e = Ur(i) ? cl : Lc;
return e(i, zr(t));
}
var Mc = 1 / 0;
function wc(i, t) {
return ul(Ac(i, t), Mc);
}
function uo(i, t) {
return hl(i, t);
}
var Fe = xc(function(i, t, e) {
return i + (e ? "-" : "") + t.toLowerCase();
});
function Cc(i, t) {
var e;
return qr(i, function(n, s, a) {
return e = t(n, s, a), !e;
}), !!e;
}
function kc(i, t, e) {
var n = Ur(i) ? dl : Cc;
return n(i, zr(t));
}
class De {
constructor() {
this._partials = new Float64Array(32), this._n = 0;
}
add(t) {
const e = this._partials;
let n = 0;
for (let s = 0; s < this._n && s < 32; s++) {
const a = e[s], r = t + a, o = Math.abs(t) < Math.abs(a) ? t - (r - a) : a - (r - t);
o && (e[n++] = o), t = r;
}
return e[n] = t, this._n = n + 1, this;
}
valueOf() {
const t = this._partials;
let e = this._n, n, s, a, r = 0;
if (e > 0) {
for (r = t[--e]; e > 0 && (n = r, s = t[--e], r = n + s, a = s - (r - n), !a); )
;
e > 0 && (a < 0 && t[e - 1] < 0 || a > 0 && t[e - 1] > 0) && (s = a * 2, n = r + s, s == n - r && (r = n));
}
return r;
}
}
function* _c(i) {
for (const t of i)
yield* t;
}
function ho(i) {
return Array.from(_c(i));
}
function Ic(i) {
return i;
}
var is = 1, as = 2, mi = 3, En = 4, Na = 1e-6;
function Rc(i) {
return "translate(" + i + ",0)";
}
function Dc(i) {
return "translate(0," + i + ")";
}
function Nc(i) {
return (t) => +i(t);
}
function Pc(i, t) {
return t = Math.max(0, i.bandwidth() - t * 2) / 2, i.round() && (t = Math.round(t)), (e) => +i(e) + t;
}
function $c() {
return !this.__axis;
}
function As(i, t) {
var e = [], n = null, s = null, a = 6, r = 6, o = 3, c = typeof window < "u" && window.devicePixelRatio > 1 ? 0 : 0.5, l = i === is || i === En ? -1 : 1, h = i === En || i === as ? "x" : "y", d = i === is || i === mi ? Rc : Dc;
function u(p) {
var f = n ?? (t.ticks ? t.ticks.apply(t, e) : t.domain()), m = s ?? (t.tickFormat ? t.tickFormat.apply(t, e) : Ic), g = Math.max(a, 0) + o, v = t.range(), S = +v[0] + c, y = +v[v.length - 1] + c, E = (t.bandwidth ? Pc : Nc)(t.copy(), c), x = p.selection ? p.selection() : p, T = x.selectAll(".domain").data([null]), C = x.selectAll(".tick").data(f, t).order(), _ = C.exit(), V = C.enter().append("g").attr("class", "tick"), R = C.select("line"), A = C.select("text");
T = T.merge(T.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")), C = C.merge(V), R = R.merge(V.append("line").attr("stroke", "currentColor").attr(h + "2", l * a)), A = A.merge(V.append("text").attr("fill", "currentColor").attr(h, l * g).attr("dy", i === is ? "0em" : i === mi ? "0.71em" : "0.32em")), p !== x && (T = T.transition(p), C = C.transition(p), R = R.transition(p), A = A.transition(p), _ = _.transition(p).attr("opacity", Na).attr("transform", function(H) {
return isFinite(H = E(H)) ? d(H + c) : this.getAttribute("transform");
}), V.attr("opacity", Na).attr("transform", function(H) {
var N = this.parentNode.__axis;
return d((N && isFinite(N = N(H)) ? N : E(H)) + c);
})), _.remove(), T.attr("d", i === En || i === as ? r ? "M" + l * r + "," + S + "H" + c + "V" + y + "H" + l * r : "M" + c + "," + S + "V" + y : r ? "M" + S + "," + l * r + "V" + c + "H" + y + "V" + l * r : "M" + S + "," + c + "H" + y), C.attr("opacity", 1).attr("transform", function(H) {
return d(E(H) + c);
}), R.attr(h + "2", l * a), A.attr(h, l * g).text(m), x.filter($c).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", i === as ? "start" : i === En ? "end" : "middle"), x.each(function() {
this.__axis = E;
});
}
return u.scale = function(p) {
return arguments.length ? (t = p, u) : t;
}, u.ticks = function() {
return e = Array.from(arguments), u;
}, u.tickArguments = function(p) {
return arguments.length ? (e = p == null ? [] : Array.from(p), u) : e.slice();
}, u.tickValues = function(p) {
return arguments.length ? (n = p == null ? null : Array.from(p), u) : n && n.slice();
}, u.tickFormat = function(p) {
return arguments.length ? (s = p, u) : s;
}, u.tickSize = function(p) {
return arguments.length ? (a = r = +p, u) : a;
}, u.tickSizeInner = function(p) {
return arguments.length ? (a = +p, u) : a;
}, u.tickSizeOuter = function(p) {
return arguments.length ? (r = +p, u) : r;
}, u.tickPadding = function(p) {
return arguments.length ? (o = +p, u) : o;
}, u.offset = function(p) {
return arguments.length ? (c = +p, u) : c;
}, u;
}
function Vc(i) {
return As(is, i);
}
function Gc(i) {
return As(as, i);
}
function Fi(i) {
return As(mi, i);
}
function po(i) {
return As(En, i);
}
const vi = { capture: !0, passive: !1 };
function yi(i) {
i.preventDefault(), i.stopImmediatePropagation();
}
function Hc(i) {
var t = i.document.documentElement, e = D(i).on("dragstart.drag", yi, vi);
"onselectstart" in t ? e.on("selectstart.drag", yi, vi) : (t.__noselect = t.style.MozUserSelect, t.style.MozUserSelect = "none");
}
function Bc(i, t) {
var e = i.document.documentElement, n = D(i).on("dragstart.drag", null);
t && (n.on("click.drag", yi, vi), setTimeout(function() {
n.on("click.drag", null);
}, 0)), "onselectstart" in e ? n.on("selectstart.drag", null) : (e.style.MozUserSelect = e.__noselect, delete e.__noselect);
}
function zc(i, t) {
for (var e = new Array(t), n = 0; n < t; ++n) e[n] = i(n / (t - 1));
return e;
}
const Uc = (i) => +i, Ws = (i) => () => i;
function Fc(i, {
sourceEvent: t,
target: e,
selection: n,
mode: s,
dispatch: a
}) {
Object.defineProperties(this, {
type: { value: i, enumerable: !0, configurable: !0 },
sourceEvent: { value: t, enumerable: !0, configurable: !0 },
target: { value: e, enumerable: !0, configurable: !0 },
selection: { value: n, enumerable: !0, configurable: !0 },
mode: { value: s, enumerable: !0, configurable: !0 },
_: { value: a }
});
}
function Wc(i) {
i.stopImmediatePropagation();
}
function Xs(i) {
i.preventDefault(), i.stopImmediatePropagation();
}
var Pa = { name: "drag" }, Ys = { name: "space" }, We = { name: "handle" }, Xe = { name: "center" };
const { abs: $a, max: Nt, min: Pt } = Math;
function Va(i) {
return [+i[0], +i[1]];
}
function Ga(i) {
return [Va(i[0]), Va(i[1])];
}
var rs = {
name: "x",
handles: ["w", "e"].map(Ei),
input: function(i, t) {
return i == null ? null : [[+i[0], t[0][1]], [+i[1], t[1][1]]];
},
output: function(i) {
return i && [i[0][0], i[1][0]];
}
}, Zs = {}, fe = {
overlay: "crosshair",
selection: "move",
n: "ns-resize",
e: "ew-resize",
s: "ns-resize",
w: "ew-resize",
nw: "nwse-resize",
ne: "nesw-resize",
se: "nwse-resize",
sw: "nesw-resize"
}, Ha = {
e: "w",
w: "e",
nw: "ne",
ne: "nw",
se: "sw",
sw: "se"
}, Ba = {
n: "s",
s: "n",
nw: "sw",
ne: "se",
se: "ne",
sw: "nw"
}, Xc = {
overlay: 1,
selection: 1,
n: null,
e: 1,
s: null,
w: -1,
nw: -1,
ne: 1,
se: 1,
sw: -1
}, Yc = {
overlay: 1,
selection: 1,
n: -1,
e: null,
s: 1,
w: null,
nw: -1,
ne: -1,
se: 1,
sw: 1
};
function Ei(i) {
return { type: i };
}
function Zc(i) {
return !i.ctrlKey && !i.button;
}
function qc() {
var i = this.ownerSVGElement || this;
return i.hasAttribute("viewBox") ? (i = i.viewBox.baseVal, [[i.x, i.y], [i.x + i.width, i.y + i.height]]) : [[0, 0], [i.width.baseVal.value, i.height.baseVal.value]];
}
function jc() {
return navigator.maxTouchPoints || "ontouchstart" in this;
}
function qs(i) {
for (; !i.__brush; ) if (!(i = i.parentNode)) return;
return i.__brush;
}
function Kc(i) {
return i[0][0] === i[1][0] || i[0][1] === i[1][1];
}
function fo() {
return Jc(rs);
}
function Jc(i) {
var t = qc, e = Zc, n = jc, s = !0, a = pl("start", "brush", "end"), r = 6, o;
function c(g) {
var v = g.property("__brush", m).selectAll(".overlay").data([Ei("overlay")]);
v.enter().append("rect").attr("class", "overlay").attr("pointer-events", "all").attr("cursor", fe.overlay).merge(v).each(function() {
var y = qs(this).extent;
D(this).attr("x", y[0][0]).attr("y", y[0][1]).attr("width", y[1][0] - y[0][0]).attr("height", y[1][1] - y[0][1]);
}), g.selectAll(".selection").data([Ei("selection")]).enter().append("rect").attr("class", "selection").attr("cursor", fe.selection).attr("fill", "#777").attr("fill-opacity", 0.3).attr("stroke", "#fff").attr("shape-rendering", "crispEdges");
var S = g.selectAll(".handle").data(i.handles, function(y) {
return y.type;
});
S.exit().remove(), S.enter().append("rect").attr("class", function(y) {
return "handle handle--" + y.type;
}).attr("cursor", function(y) {
return fe[y.type];
}), g.each(l).attr("fill", "none").attr("pointer-events", "all").on("mousedown.brush", u).filter(n).on("touchstart.brush", u).on("touchmove.brush", p).on("touchend.brush touchcancel.brush", f).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
}
c.move = function(g, v, S) {
g.tween ? g.on("start.brush", function(y) {
h(this, arguments).beforestart().start(y);
}).on("interrupt.brush end.brush", function(y) {
h(this, arguments).end(y);
}).tween("brush", function() {
var y = this, E = y.__brush, x = h(y, arguments), T = E.selection, C = i.input(typeof v == "function" ? v.apply(this, arguments) : v, E.extent), _ = Fr(T, C);
function V(R) {
E.selection = R === 1 && C === null ? null : _(R), l.call(y), x.brush();
}
return T !== null && C !== null ? V : V(1);
}) : g.each(function() {
var y = this, E = arguments, x = y.__brush, T = i.input(typeof v == "function" ? v.apply(y, E) : v, x.extent), C = h(y, E).beforestart();
ya(y), x.selection = T === null ? null : T, l.call(y), C.start(S).brush(S).end(S);
});
}, c.clear = function(g, v) {
c.move(g, null, v);
};
function l() {
var g = D(this), v = qs(this).selection;
v ? (g.selectAll(".selection").style("display", null).attr("x", v[0][0]).attr("y", v[0][1]).attr("width", v[1][0] - v[0][0]).attr("height", v[1][1] - v[0][1]), g.selectAll(".handle").style("display", null).attr("x", function(S) {
return S.type[S.type.length - 1] === "e" ? v[1][0] - r / 2 : v[0][0] - r / 2;
}).attr("y", function(S) {
return S.type[0] === "s" ? v[1][1] - r / 2 : v[0][1] - r / 2;
}).attr("width", function(S) {
return S.type === "n" || S.type === "s" ? v[1][0] - v[0][0] + r : r;
}).attr("height", function(S) {
return S.type === "e" || S.type === "w" ? v[1][1] - v[0][1] + r : r;
})) : g.selectAll(".selection,.handle").style("display", "none").attr("x", null).attr("y", null).attr("width", null).attr("height", null);
}
function h(g, v, S) {
var y = g.__brush.emitter;
return y && (!S || !y.clean) ? y : new d(g, v, S);
}
function d(g, v, S) {
this.that = g, this.args = v, this.state = g.__brush, this.active = 0, this.clean = S;
}
d.prototype = {
beforestart: function() {
return ++this.active === 1 && (this.state.emitter = this, this.starting = !0), this;
},
start: function(g, v) {
return this.starting ? (this.starting = !1, this.emit("start", g, v)) : this.emit("brush", g), this;
},
brush: function(g, v) {
return this.emit("brush", g, v), this;
},
end: function(g, v) {
return --this.active === 0 && (delete this.state.emitter, this.emit("end", g, v)), this;
},
emit: function(g, v, S) {
var y = D(this.that).datum();
a.call(
g,
this.that,
new Fc(g, {
sourceEvent: v,
target: c,
selection: i.output(this.state.selection),
mode: S,
dispatch: a
}),
y
);
}
};
function u(g) {
if (o && !g.touches || !e.apply(this, arguments)) return;
var v = this, S = g.target.__data__.type, y = (s && g.metaKey ? S = "overlay" : S) === "selection" ? Pa : s && g.altKey ? Xe : We, E = i === Zs ? null : Xc[S], x = i === rs ? null : Yc[S], T = qs(v), C = T.extent, _ = T.selection, V = C[0][0], R, A, H = C[0][1], N, M, L = C[1][0], P, $, k = C[1][1], G, q, X = 0, F = 0, Z, rt = E && x && s && g.shiftKey, j, Y, K = Array.from(g.touches || [g], (et) => {
const yt = et.identifier;
return et = an(et, v), et.point0 = et.slice(), et.identifier = yt, et;
});
ya(v);
var ot = h(v, arguments, !0).beforestart();
if (S === "overlay") {
_ && (Z = !0);
const et = [K[0], K[1] || K[0]];
T.selection = _ = [[
R = i === Zs ? V : Pt(et[0][0], et[1][0]),
N = i === rs ? H : Pt(et[0][1], et[1][1])
], [
P = i === Zs ? L : Nt(et[0][0], et[1][0]),
G = i === rs ? k : Nt(et[0][1], et[1][1])
]], K.length > 1 && B(g);
} else
R = _[0][0], N = _[0][1], P = _[1][0], G = _[1][1];
A = R, M = N, $ = P, q = G;
var ct = D(v).attr("pointer-events", "none"), st = ct.selectAll(".overlay").attr("cursor", fe[S]);
if (g.touches)
ot.moved = z, ot.ended = U;
else {
var it = D(g.view).on("mousemove.brush", z, !0).on("mouseup.brush", U, !0);
s && it.on("keydown.brush", wt, !0).on("keyup.brush", Te, !0), Hc(g.view);
}
l.call(v), ot.start(g, y.name);
function z(et) {
for (const yt of et.changedTouches || [et])
for (const Zt of K)
Zt.identifier === yt.identifier && (Zt.cur = an(yt, v));
if (rt && !j && !Y && K.length === 1) {
const yt = K[0];
$a(yt.cur[0] - yt[0]) > $a(yt.cur[1] - yt[1]) ? Y = !0 : j = !0;
}
for (const yt of K)
yt.cur && (yt[0] = yt.cur[0], yt[1] = yt.cur[1]);
Z = !0, Xs(et), B(et);
}
function B(et) {
const yt = K[0], Zt = yt.point0;
var Wt;
switch (X = yt[0] - Zt[0], F = yt[1] - Zt[1], y) {
case Ys:
case Pa: {
E && (X = Nt(V - R, Pt(L - P, X)), A = R + X, $ = P + X), x && (F = Nt(H - N, Pt(k - G, F)), M = N + F, q = G + F);
break;
}
case We: {
K[1] ? (E && (A = Nt(V, Pt(L, K[0][0])), $ = Nt(V, Pt(L, K[1][0])), E = 1), x && (M = Nt(H, Pt(k, K[0][1])), q = Nt(H, Pt(k, K[1][1])), x = 1)) : (E < 0 ? (X = Nt(V - R, Pt(L - R, X)), A = R + X, $ = P) : E > 0 && (X = Nt(V - P, Pt(L - P, X)), A = R, $ = P + X), x < 0 ? (F = Nt(H - N, Pt(k - N, F)), M = N + F, q = G) : x > 0 && (F = Nt(H - G, Pt(k - G, F)), M = N, q = G + F));
break;
}
case Xe: {
E && (A = Nt(V, Pt(L, R - X * E)), $ = Nt(V, Pt(L, P + X * E))), x && (M = Nt(H, Pt(k, N - F * x)), q = Nt(H, Pt(k, G + F * x)));
break;
}
}
$ < A && (E *= -1, Wt = R, R = P, P = Wt, Wt = A, A = $, $ = Wt, S in Ha && st.attr("cursor", fe[S = Ha[S]])), q < M && (x *= -1, Wt = N, N = G, G = Wt, Wt = M, M = q, q = Wt, S in Ba && st.attr("cursor", fe[S = Ba[S]])), T.selection && (_ = T.selection), j && (A = _[0][0], $ = _[1][0]), Y && (M = _[0][1], q = _[1][1]), (_[0][0] !== A || _[0][1] !== M || _[1][0] !== $ || _[1][1] !== q) && (T.selection = [[A, M], [$, q]], l.call(v), ot.brush(et, y.name));
}
function U(et) {
if (Wc(et), et.touches) {
if (et.touches.length) return;
o && clearTimeout(o), o = setTimeout(function() {
o = null;
}, 500);
} else
Bc(et.view, Z), it.on("keydown.brush keyup.brush mousemove.brush mouseup.brush", null);
ct.attr("pointer-events", "all"), st.attr("cursor", fe.overlay), T.selection && (_ = T.selection), Kc(_) && (T.selection = null, l.call(v)), ot.end(et, y.name);
}
function wt(et) {
switch (et.keyCode) {
case 16: {
rt = E && x;
break;
}
case 18: {
y === We && (E && (P = $ - X * E, R = A + X * E), x && (G = q - F * x, N = M + F * x), y = Xe, B(et));
break;
}
case 32: {
(y === We || y === Xe) && (E < 0 ? P = $ - X : E > 0 && (R = A - X), x < 0 ? G = q - F : x > 0 && (N = M - F), y = Ys, st.attr("cursor", fe.selection), B(et));
break;
}
default:
return;
}
Xs(et);
}
function Te(et) {
switch (et.keyCode) {
case 16: {
rt && (j = Y = rt = !1, B(et));
break;
}
case 18: {
y === Xe && (E < 0 ? P = $ : E > 0 && (R = A), x < 0 ? G = q : x > 0 && (N = M), y = We, B(et));
break;
}
case 32: {
y === Ys && (et.altKey ? (E && (P = $ - X * E, R = A + X * E), x && (G = q - F * x, N = M + F * x), y = Xe) : (E < 0 ? P = $ : E > 0 && (R = A), x < 0 ? G = q : x > 0 && (N = M), y = We), st.attr("cursor", fe[S]), B(et));
break;
}
default:
return;
}
Xs(et);
}
}
function p(g) {
h(this, arguments).moved(g);
}
function f(g) {
h(this, arguments).ended(g);
}
function m() {
var g = this.__brush || { selection: null };
return g.extent = Ga(t.apply(this, arguments)), g.dim = i, g;
}
return c.extent = function(g) {
return arguments.length ? (t = typeof g == "function" ? g : Ws(Ga(g)), c) : t;
}, c.filter = function(g) {
return arguments.length ? (e = typeof g == "function" ? g : Ws(!!g), c) : e;
}, c.touchable = function(g) {
return arguments.length ? (n = typeof g == "function" ? g : Ws(!!g), c) : n;
}, c.handleSize = function(g) {
return arguments.length ? (r = +g, c) : r;
}, c.keyModifiers = function(g) {
return arguments.length ? (s = !!g, c) : s;
}, c.on = function() {
var g = a.on.apply(a, arguments);
return g === a ? c : g;
}, c;
}
const xi = Math.PI, Si = 2 * xi, ke = 1e-6, Qc = Si - ke;
function go(i) {
this._ += i[0];
for (let t = 1, e = i.length; t < e; ++t)
this._ += arguments[t] + i[t];
}
function tu(i) {
let t = Math.floor(i);
if (!(t >= 0)) throw new Error(`invalid digits: ${i}`);
if (t > 15) return go;
const e = 10 ** t;
return function(n) {
this._ += n[0];
for (let s = 1, a = n.length; s < a; ++s)
this._ += Math.round(arguments[s] * e) / e + n[s];
};
}
let Wi = class {
constructor(t) {
this._x0 = this._y0 = // start of current subpath
this._x1 = this._y1 = null, this._ = "", this._append = t == null ? go : tu(t);
}
moveTo(t, e) {
this._append`M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +e}`;
}
closePath() {
this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._append`Z`);
}
lineTo(t, e) {
this._append`L${this._x1 = +t},${this._y1 = +e}`;
}
quadraticCurveTo(t, e, n, s) {
this._append`Q${+t},${+e},${this._x1 = +n},${this._y1 = +s}`;
}
bezierCurveTo(t, e, n, s, a, r) {
this._append`C${+t},${+e},${+n},${+s},${this._x1 = +a},${this._y1 = +r}`;
}
arcTo(t, e, n, s, a) {
if (t = +t, e = +e, n = +n, s = +s, a = +a, a < 0) throw new Error(`negative radius: ${a}`);
let r = this._x1, o = this._y1, c = n - t, l = s - e, h = r - t, d = o - e, u = h * h + d * d;
if (this._x1 === null)
this._append`M${this._x1 = t},${this._y1 = e}`;
else if (u > ke) if (!(Math.abs(d * c - l * h) > ke) || !a)
this._append`L${this._x1 = t},${this._y1 = e}`;
else {
let p = n - r, f = s - o, m = c * c + l * l, g = p * p + f * f, v = Math.sqrt(m), S = Math.sqrt(u), y = a * Math.tan((xi - Math.acos((m + u - g) / (2 * v * S))) / 2), E = y / S, x = y / v;
Math.abs(E - 1) > ke && this._append`L${t + E * h},${e + E * d}`, this._append`A${a},${a},0,0,${+(d * p > h * f)},${this._x1 = t + x * c},${this._y1 = e + x * l}`;
}
}
arc(t, e, n, s, a, r) {
if (t = +t, e = +e, n = +n, r = !!r, n < 0) throw new Error(`negative radius: ${n}`);
let o = n * Math.cos(s), c = n * Math.sin(s), l = t + o, h = e + c, d = 1 ^ r, u = r ? s - a : a - s;
this._x1 === null ? this._append`M${l},${h}` : (Math.abs(this._x1 - l) > ke || Math.abs(this._y1 - h) > ke) && this._append`L${l},${h}`, n && (u < 0 && (u = u % Si + Si), u > Qc ? this._append`A${n},${n},0,1,${d},${t - o},${e - c}A${n},${n},0,1,${d},${this._x1 = l},${this._y1 = h}` : u > ke && this._append`A${n},${n},0,${+(u >= xi)},${d},${this._x1 = t + n * Math.cos(a)},${this._y1 = e + n * Math.sin(a)}`);
}
rect(t, e, n, s) {
this._append`M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +e}h${n = +n}v${+s}h${-n}Z`;
}
toString() {
return this._;
}
};
function Ms() {
return new Wi();
}
Ms.prototype = Wi.prototype;
var gt = 1e-6, mo = 1e-12, ht = Math.PI, Ft = ht / 2, za = ht / 4, Yt = ht * 2, Vt = 180 / ht, Ot = ht / 180, mt = Math.abs, vo = Math.atan, Ne = Math.atan2, vt = Math.cos, eu = Math.exp, nu = Math.log, ft = Math.sin, Oe = Math.sign || function(i) {
return i > 0 ? 1 : i < 0 ? -1 : 0;
}, ae = Math.sqrt, su = Math.tan;
function iu(i) {
return i > 1 ? 0 : i < -1 ? ht : Math.acos(i);
}
function Se(i) {
return i > 1 ? Ft : i < -1 ? -Ft : Math.asin(i);
}
function Qt() {
}
function ds(i, t) {
i && Fa.hasOwnProperty(i.type) && Fa[i.type](i, t);
}
var Ua = {
Feature: function(i, t) {
ds(i.geometry, t);
},
FeatureCollection: function(i, t) {
for (var e = i.features, n = -1, s = e.length; ++n < s; ) ds(e[n].geometry, t);
}
}, Fa = {
Sphere: function(i, t) {
t.sphere();
},
Point: function(i, t) {
i = i.coordinates, t.point(i[0], i[1], i[2]);
},
MultiPoint: function(i, t) {
for (var e = i.coordinates, n = -1, s = e.length; ++n < s; ) i = e[n], t.point(i[0], i[1], i[2]);
},
LineString: function(i, t) {
Ti(i.coordinates, t, 0);
},
MultiLineString: function(i, t) {
for (var e = i.coordinates, n = -1, s = e.length; ++n < s; ) Ti(e[n], t, 0);
},
Polygon: function(i, t) {
Wa(i.coordinates, t);
},
MultiPolygon: function(i, t) {
for (var e = i.coordinates, n = -1, s = e.length; ++n < s; ) Wa(e[n], t);
},
GeometryCollection: function(i, t) {
for (var e = i.geometries, n = -1, s = e.length; ++n < s; ) ds(e[n], t);
}
};
function Ti(i, t, e) {
var n = -1, s = i.length - e, a;
for (t.lineStart(); ++n < s; ) a = i[n], t.point(a[0], a[1], a[2]);
t.lineEnd();
}
function Wa(i, t) {
var e = -1, n = i.length;
for (t.polygonStart(); ++e < n; ) Ti(i[e], t, 1);
t.polygonEnd();
}
function je(i, t) {
i && Ua.hasOwnProperty(i.type) ? Ua[i.type](i, t) : ds(i, t);
}
function bi(i) {
return [Ne(i[1], i[0]), Se(i[2])];
}
function rn(i) {
var t = i[0], e = i[1], n = vt(e);
return [n * vt(t), n * ft(t), ft(e)];
}
function Wn(i, t) {
return i[0] * t[0] + i[1] * t[1] + i[2] * t[2];
}
function ps(i, t) {
return [i[1] * t[2] - i[2] * t[1], i[2] * t[0] - i[0] * t[2], i[0] * t[1] - i[1] * t[0]];
}
function js(i, t) {
i[0] += t[0], i[1] += t[1], i[2] += t[2];
}
function Xn(i, t) {
return [i[0] * t, i[1] * t, i[2] * t];
}
function Oi(i) {
var t = ae(i[0] * i[0] + i[1] * i[1] + i[2] * i[2]);
i[0] /= t, i[1] /= t, i[2] /= t;
}
function Li(i, t) {
function e(n, s) {
return n = i(n, s), t(n[0], n[1]);
}
return i.invert && t.invert && (e.invert = function(n, s) {
return n = t.invert(n, s), n && i.invert(n[0], n[1]);
}), e;
}
function Ai(i, t) {
return mt(i) > ht && (i -= Math.round(i / Yt) * Yt), [i, t];
}
Ai.invert = Ai;
function yo(i, t, e) {
return (i %= Yt) ? t || e ? Li(Ya(i), Za(t, e)) : Ya(i) : t || e ? Za(t, e) : Ai;
}
function Xa(i) {
return function(t, e) {
return t += i, mt(t) > ht && (t -= Math.round(t / Yt) * Yt), [t, e];
};
}
function Ya(i) {
var t = Xa(i);
return t.invert = Xa(-i), t;
}
function Za(i, t) {
var e = vt(i), n = ft(i), s = vt(t), a = ft(t);
function r(o, c) {
var l = vt(c), h = vt(o) * l, d = ft(o) * l, u = ft(c), p = u * e + h * n;
return [
Ne(d * s - p * a, h * e - u * n),
Se(p * s + d * a)
];
}
return r.invert = function(o, c) {
var l = vt(c), h = vt(o) * l, d = ft(o) * l, u = ft(c), p = u * s - d * a;
return [
Ne(d * s + u * a, h * e + p * n),
Se(p * e - h * n)
];
}, r;
}
function au(i) {
i = yo(i[0] * Ot, i[1] * Ot, i.length > 2 ? i[2] * Ot : 0);
function t(e) {
return e = i(e[0] * Ot, e[1] * Ot), e[0] *= Vt, e[1] *= Vt, e;
}
return t.invert = function(e) {
return e = i.invert(e[0] * Ot, e[1] * Ot), e[0] *= Vt, e[1] *= Vt, e;
}, t;
}
function ru(i, t, e, n, s, a) {
if (e) {
var r = vt(t), o = ft(t), c = n * e;
s == null ? (s = t + n * Yt, a = t - c / 2) : (s = qa(r, s), a = qa(r, a), (n > 0 ? s < a : s > a) && (s += n * Yt));
for (var l, h = s; n > 0 ? h > a : h < a; h -= c)
l = bi([r, -o * vt(h), -o * ft(h)]), i.point(l[0], l[1]);
}
}
function qa(i, t) {
t = rn(t), t[0] -= i, Oi(t);
var e = iu(-t[1]);
return ((-t[2] < 0 ? -e : e) + Yt - gt) % Yt;
}
function Eo() {
var i = [], t;
return {
point: function(e, n, s) {
t.push([e, n, s]);
},
lineStart: function() {
i.push(t = []);
},
lineEnd: Qt,
rejoin: function() {
i.length > 1 && i.push(i.pop().concat(i.shift()));
},
result: function() {
var e = i;
return i = [], t = null, e;
}
};
}
function os(i, t) {
return mt(i[0] - t[0]) < gt && mt(i[1] - t[1]) < gt;
}
function Yn(i, t, e, n) {
this.x = i, this.z = t, this.o = e, this.e = n, this.v = !1, this.n = this.p = null;
}
function xo(i, t, e, n, s) {
var a = [], r = [], o, c;
if (i.forEach(function(f) {
if (!((m = f.length - 1) <= 0)) {
var m, g = f[0], v = f[m], S;
if (os(g, v)) {
if (!g[2] && !v[2]) {
for (s.lineStart(), o = 0; o < m; ++o) s.point((g = f[o])[0], g[1]);
s.lineEnd();
return;
}
v[0] += 2 * gt;
}
a.push(S = new Yn(g, f, null, !0)), r.push(S.o = new Yn(g, null, S, !1)), a.push(S = new Yn(v, f, null, !1)), r.push(S.o = new Yn(v, null, S, !0));
}
}), !!a.length) {
for (r.sort(t), ja(a), ja(r), o = 0, c = r.length; o < c; ++o)
r[o].e = e = !e;
for (var l = a[0], h, d; ; ) {
for (var u = l, p = !0; u.v; ) if ((u = u.n) === l) return;
h = u.z, s.lineStart();
do {
if (u.v = u.o.v = !0, u.e) {
if (p)
for (o = 0, c = h.length; o < c; ++o) s.point((d = h[o])[0], d[1]);
else
n(u.x, u.n.x, 1, s);
u = u.n;
} else {
if (p)
for (h = u.p.z, o = h.length - 1; o >= 0; --o) s.point((d = h[o])[0], d[1]);
else
n(u.x, u.p.x, -1, s);
u = u.p;
}
u = u.o, h = u.z, p = !p;
} while (!u.v);
s.lineEnd();
}
}
}
function ja(i) {
if (t = i.length) {
for (var t, e = 0, n = i[0], s; ++e < t; )
n.n = s = i[e], s.p = n, n = s;
n.n = s = i[0], s.p = n;
}
}
function Ks(i) {
return mt(i[0]) <= ht ? i[0] : Oe(i[0]) * ((mt(i[0]) + ht) % Yt - ht);
}
function ou(i, t) {
var e = Ks(t), n = t[1], s = ft(n), a = [ft(e), -vt(e), 0], r = 0, o = 0, c = new De();
s === 1 ? n = Ft + gt : s === -1 && (n = -Ft - gt);
for (var l = 0, h = i.length; l < h; ++l)
if (u = (d = i[l]).length)
for (var d, u, p = d[u - 1], f = Ks(p), m = p[1] / 2 + za, g = ft(m), v = vt(m), S = 0; S < u; ++S, f = E, g = T, v = C, p = y) {
var y = d[S], E = Ks(y), x = y[1] / 2 + za, T = ft(x), C = vt(x), _ = E - f, V = _ >= 0 ? 1 : -1, R = V * _, A = R > ht, H = g * T;
if (c.add(Ne(H * V * ft(R), v * C + H * vt(R))), r += A ? _ + V * Yt : _, A ^ f >= e ^ E >= e) {
var N = ps(rn(p), rn(y));
Oi(N);
var M = ps(a, N);
Oi(M);
var L = (A ^ _ >= 0 ? -1 : 1) * Se(M[2]);
(n > L || n === L && (N[0] || N[1])) && (o += A ^ _ >= 0 ? 1 : -1);
}
}
return (r < -gt || r < gt && c < -mo) ^ o & 1;
}
function So(i, t, e, n) {
return function(s) {
var a = t(s), r = Eo(), o = t(r), c = !1, l, h, d, u = {
point: p,
lineStart: m,
lineEnd: g,
polygonStart: function() {
u.point = v, u.lineStart = S, u.lineEnd = y, h = [], l = [];
},
polygonEnd: function() {
u.point = p, u.lineStart = m, u.lineEnd = g, h = ho(h);
var E = ou(l, n);
h.length ? (c || (s.polygonStart(), c = !0), xo(h, cu, E, e, s)) : E && (c || (s.polygonStart(), c = !0), s.lineStart(), e(null, null, 1, s), s.lineEnd()), c && (s.polygonEnd(), c = !1), h = l = null;
},
sphere: function() {
s.polygonStart(), s.lineStart(), e(null, null, 1, s), s.lineEnd(), s.polygonEnd();
}
};
function p(E, x) {
i(E, x) && s.point(E, x);
}
function f(E, x) {
a.point(E, x);
}
function m() {
u.point = f, a.lineStart();
}
function g() {
u.point = p, a.lineEnd();
}
function v(E, x) {
d.push([E, x]), o.point(E, x);
}
function S() {
o.lineStart(), d = [];
}
function y() {
v(d[0][0], d[0][1]), o.lineEnd();
var E = o.clean(), x = r.result(), T, C = x.length, _, V, R;
if (d.pop(), l.push(d), d = null, !!C) {
if (E & 1) {
if (V = x[0], (_ = V.length - 1) > 0) {
for (c || (s.polygonStart(), c = !0), s.lineStart(), T = 0; T < _; ++T) s.point((R = V[T])[0], R[1]);
s.lineEnd();
}
return;
}
C > 1 && E & 2 && x.push(x.pop().concat(x.shift())), h.push(x.filter(lu));
}
}
return u;
};
}
function lu(i) {
return i.length > 1;
}
function cu(i, t) {
return ((i = i.x)[0] < 0 ? i[1] - Ft - gt : Ft - i[1]) - ((t = t.x)[0] < 0 ? t[1] - Ft - gt : Ft - t[1]);
}
const Ka = So(
function() {
return !0;
},
uu,
du,
[-ht, -Ft]
);
function uu(i) {
var t = NaN, e = NaN, n = NaN, s;
return {
lineStart: function() {
i.lineStart(), s = 1;
},
point: function(a, r) {
var o = a > 0 ? ht : -ht, c = mt(a - t);
mt(c - ht) < gt ? (i.point(t, e = (e + r) / 2 > 0 ? Ft : -Ft), i.point(n, e), i.lineEnd(), i.lineStart(), i.point(o, e), i.point(a, e), s = 0) : n !== o && c >= ht && (mt(t - n) < gt && (t -= n * gt), mt(a - o) < gt && (a -= o * gt), e = hu(t, e, a, r), i.point(n, e), i.lineEnd(), i.lineStart(), i.point(o, e), s = 0), i.point(t = a, e = r), n = o;
},
lineEnd: function() {
i.lineEnd(), t = e = NaN;
},
clean: function() {
return 2 - s;
}
};
}
function hu(i, t, e, n) {
var s, a, r = ft(i - e);
return mt(r) > gt ? vo((ft(t) * (a = vt(n)) * ft(e) - ft(n) * (s = vt(t)) * ft(i)) / (s * a * r)) : (t + n) / 2;
}
function du(i, t, e, n) {
var s;
if (i == null)
s = e * Ft, n.point(-ht, s), n.point(0, s), n.point(ht, s), n.point(ht, 0), n.point(ht, -s), n.point(0, -s), n.point(-ht, -s), n.point(-ht, 0), n.point(-ht, s);
else if (mt(i[0] - t[0]) > gt) {
var a = i[0] < t[0] ? ht : -ht;
s = e * a / 2, n.point(-a, s), n.point(0, s), n.point(a, s);
} else
n.point(t[0], t[1]);
}
function pu(i) {
var t = vt(i), e = 2 * Ot, n = t > 0, s = mt(t) > gt;
function a(h, d, u, p) {
ru(p, i, e, u, h, d);
}
function r(h, d) {
return vt(h) * vt(d) > t;
}
function o(h) {
var d, u, p, f, m;
return {
lineStart: function() {
f = p = !1, m = 1;
},
point: function(g, v) {
var S = [g, v], y, E = r(g, v), x = n ? E ? 0 : l(g, v) : E ? l(g + (g < 0 ? ht : -ht), v) : 0;
if (!d && (f = p = E) && h.lineStart(), E !== p && (y = c(d, S), (!y || os(d, y) || os(S, y)) && (S[2] = 1)), E !== p)
m = 0, E ? (h.lineStart(), y = c(S, d), h.point(y[0], y[1])) : (y = c(d, S), h.point(y[0], y[1], 2), h.lineEnd()), d = y;
else if (s && d && n ^ E) {
var T;
!(x & u) && (T = c(S, d, !0)) && (m = 0, n ? (h.lineStart(), h.point(T[0][0], T[0][1]), h.point(T[1][0], T[1][1]), h.lineEnd()) : (h.point(T[1][0], T[1][1]), h.lineEnd(), h.lineStart(), h.point(T[0][0], T[0][1], 3)));
}
E && (!d || !os(d, S)) && h.point(S[0], S[1]), d = S, p = E, u = x;
},
lineEnd: function() {
p && h.lineEnd(), d = null;
},
// Rejoin first and last segments if there were intersections and the first
// and last points were visible.
clean: function() {
return m | (f && p) << 1;
}
};
}
function c(h, d, u) {
var p = rn(h), f = rn(d), m = [1, 0, 0], g = ps(p, f), v = Wn(g, g), S = g[0], y = v - S * S;
if (!y) return !u && h;
var E = t * v / y, x = -t * S / y, T = ps(m, g), C = Xn(m, E), _ = Xn(g, x);
js(C, _);
var V = T, R = Wn(C, V), A = Wn(V, V), H = R * R - A * (Wn(C, C) - 1);
if (!(H < 0)) {
var N = ae(H), M = Xn(V, (-R - N) / A);
if (js(M, C), M = bi(M), !u) return M;
var L = h[0], P = d[0], $ = h[1], k = d[1], G;
P < L && (G = L, L = P, P = G);
var q = P - L, X = mt(q - ht) < gt, F = X || q < gt;
if (!X && k < $ && (G = $, $ = k, k = G), F ? X ? $ + k > 0 ^ M[1] < (mt(M[0] - L) < gt ? $ : k) : $ <= M[1] && M[1] <= k : q > ht ^ (L <= M[0] && M[0] <= P)) {
var Z = Xn(V, (-R + N) / A);
return js(Z, C), [M, bi(Z)];
}
}
}
function l(h, d) {
var u = n ? i : ht - i, p = 0;
return h < -u ? p |= 1 : h > u && (p |= 2), d < -u ? p |= 4 : d > u && (p |= 8), p;
}
return So(r, o, a, n ? [0, -i] : [-ht, i - ht]);
}
function fu(i, t, e, n, s, a) {
var r = i[0], o = i[1], c = t[0], l = t[1], h = 0, d = 1, u = c - r, p = l - o, f;
if (f = e - r, !(!u && f > 0)) {
if (f /= u, u < 0) {
if (f < h) return;
f < d && (d = f);
} else if (u > 0) {
if (f > d) return;
f > h && (h = f);
}
if (f = s - r, !(!u && f < 0)) {
if (f /= u, u < 0) {
if (f > d) return;
f > h && (h = f);
} else if (u > 0) {
if (f < h) return;
f < d && (d = f);
}
if (f = n - o, !(!p && f > 0)) {
if (f /= p, p < 0) {
if (f < h) return;
f < d && (d = f);
} else if (p > 0) {
if (f > d) return;
f > h && (h = f);
}
if (f = a - o, !(!p && f < 0)) {
if (f /= p, p < 0) {
if (f > d) return;
f > h && (h = f);
} else if (p > 0) {
if (f < h) return;
f < d && (d = f);
}
return h > 0 && (i[0] = r + h * u, i[1] = o + h * p), d < 1 && (t[0] = r + d * u, t[1] = o + d * p), !0;
}
}
}
}
}
var xn = 1e9, Zn = -xn;
function gu(i, t, e, n) {
function s(l, h) {
return i <= l && l <= e && t <= h && h <= n;
}
function a(l, h, d, u) {
var p = 0, f = 0;
if (l == null || (p = r(l, d)) !== (f = r(h, d)) || c(l, h) < 0 ^ d > 0)
do
u.point(p === 0 || p === 3 ? i : e, p > 1 ? n : t);
while ((p = (p + d + 4) % 4) !== f);
else
u.point(h[0], h[1]);
}
function r(l, h) {
return mt(l[0] - i) < gt ? h > 0 ? 0 : 3 : mt(l[0] - e) < gt ? h > 0 ? 2 : 1 : mt(l[1] - t) < gt ? h > 0 ? 1 : 0 : h > 0 ? 3 : 2;
}
function o(l, h) {
return c(l.x, h.x);
}
function c(l, h) {
var d = r(l, 1), u = r(h, 1);
return d !== u ? d - u : d === 0 ? h[1] - l[1] : d === 1 ? l[0] - h[0] : d === 2 ? l[1] - h[1] : h[0] - l[0];
}
return function(l) {
var h = l, d = Eo(), u, p, f, m, g, v, S, y, E, x, T, C = {
point: _,
lineStart: H,
lineEnd: N,
polygonStart: R,
polygonEnd: A
};
function _(L, P) {
s(L, P) && h.point(L, P);
}
function V() {
for (var L = 0, P = 0, $ = p.length; P < $; ++P)
for (var k = p[P], G = 1, q = k.length, X = k[0], F, Z, rt = X[0], j = X[1]; G < q; ++G)
F = rt, Z = j, X = k[G], rt = X[0], j = X[1], Z <= n ? j > n && (rt - F) * (n - Z) > (j - Z) * (i - F) && ++L : j <= n && (rt - F) * (n - Z) < (j - Z) * (i - F) && --L;
return L;
}
function R() {
h = d, u = [], p = [], T = !0;
}
function A() {
var L = V(), P = T && L, $ = (u = ho(u)).length;
(P || $) && (l.polygonStart(), P && (l.lineStart(), a(null, null, 1, l), l.lineEnd()), $ && xo(u, o, L, a, l), l.polygonEnd()), h = l, u = p = f = null;
}
function H() {
C.point = M, p && p.push(f = []), x = !0, E = !1, S = y = NaN;
}
function N() {
u && (M(m, g), v && E && d.rejoin(), u.push(d.result())), C.point = _, E && h.lineEnd();
}
function M(L, P) {
var $ = s(L, P);
if (p && f.push([L, P]), x)
m = L, g = P, v = $, x = !1, $ && (h.lineStart(), h.point(L, P));
else if ($ && E) h.point(L, P);
else {
var k = [S = Math.max(Zn, Math.min(xn, S)), y = Math.max(Zn, Math.min(xn, y))], G = [L = Math.max(Zn, Math.min(xn, L)), P = Math.max(Zn, Math.min(xn, P))];
fu(k, G, i, t, e, n) ? (E || (h.lineStart(), h.point(k[0], k[1])), h.point(G[0], G[1]), $ || h.lineEnd(), T = !1) : $ && (h.lineStart(), h.point(L, P), T = !1);
}
S = L, y = P, E = $;
}
return C;
};
}
const Mi = (i) => i;
var Js = new De(), wi = new De(), To, bo, Ci, ki, Ee = {
point: Qt,
lineStart: Qt,
lineEnd: Qt,
polygonStart: function() {
Ee.lineStart = mu, Ee.lineEnd = yu;
},
polygonEnd: function() {
Ee.lineStart = Ee.lineEnd = Ee.point = Qt, Js.add(mt(wi)), wi = new De();
},
result: function() {
var i = Js / 2;
return Js = new De(), i;
}
};
function mu() {
Ee.point = vu;
}
function vu(i, t) {
Ee.point = Oo, To = Ci = i, bo = ki = t;
}
function Oo(i, t) {
wi.add(ki * i - Ci * t), Ci = i, ki = t;
}
function yu() {
Oo(To, bo);
}
var on = 1 / 0, fs = on, _n = -on, gs = _n, ms = {
point: Eu,
lineStart: Qt,
lineEnd: Qt,
polygonStart: Qt,
polygonEnd: Qt,
result: function() {
var i = [[on, fs], [_n, gs]];
return _n = gs = -(fs = on = 1 / 0), i;
}
};
function Eu(i, t) {
i < on && (on = i), i > _n && (_n = i), t < fs && (fs = t), t > gs && (gs = t);
}
var _i = 0, Ii = 0, Sn = 0, vs = 0, ys = 0, en = 0, Ri = 0, Di = 0, Tn = 0, Lo, Ao, le, ce, Jt = {
point: Pe,
lineStart: Ja,
lineEnd: Qa,
polygonStart: function() {
Jt.lineStart = Tu, Jt.lineEnd = bu;
},
polygonEnd: function() {
Jt.point = Pe, Jt.lineStart = Ja, Jt.lineEnd = Qa;
},
result: function() {
var i = Tn ? [Ri / Tn, Di / Tn] : en ? [vs / en, ys / en] : Sn ? [_i / Sn, Ii / Sn] : [NaN, NaN];
return _i = Ii = Sn = vs = ys = en = Ri = Di = Tn = 0, i;
}
};
function Pe(i, t) {
_i += i, Ii += t, ++Sn;
}
function Ja() {
Jt.point = xu;
}
function xu(i, t) {
Jt.point = Su, Pe(le = i, ce = t);
}
function Su(i, t) {
var e = i - le, n = t - ce, s = ae(e * e + n * n);
vs += s * (le + i) / 2, ys += s * (ce + t) / 2, en += s, Pe(le = i, ce = t);
}
function Qa() {
Jt.point = Pe;
}
function Tu() {
Jt.point = Ou;
}
function bu() {
Mo(Lo, Ao);
}
function Ou(i, t) {
Jt.point = Mo, Pe(Lo = le = i, Ao = ce = t);
}
function Mo(i, t) {
var e = i - le, n = t - ce, s = ae(e * e + n * n);
vs += s * (le + i) / 2, ys += s * (ce + t) / 2, en += s, s = ce * i - le * t, Ri += s * (le + i), Di += s * (ce + t), Tn += s * 3, Pe(le = i, ce = t);
}
function wo(i) {
this._context = i;
}
wo.prototype = {
_radius: 4.5,
pointRadius: function(i) {
return this._radius = i, this;
},
polygonStart: function() {
this._line = 0;
},
polygonEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._point = 0;
},
lineEnd: function() {
this._line === 0 && this._context.closePath(), this._point = NaN;
},
point: function(i, t) {
switch (this._point) {
case 0: {
this._context.moveTo(i, t), this._point = 1;
break;
}
case 1: {
this._context.lineTo(i, t);
break;
}
default: {
this._context.moveTo(i + this._radius, t), this._context.arc(i, t, this._radius, 0, Yt);
break;
}
}
},
result: Qt
};
var Ni = new De(), Qs, Co, ko, bn, On, In = {
point: Qt,
lineStart: function() {
In.point = Lu;
},
lineEnd: function() {
Qs && _o(Co, ko), In.point = Qt;
},
polygonStart: function() {
Qs = !0;
},
polygonEnd: function() {
Qs = null;
},
result: function() {
var i = +Ni;
return Ni = new De(), i;
}
};
function Lu(i, t) {
In.point = _o, Co = bn = i, ko = On = t;
}
function _o(i, t) {
bn -= i, On -= t, Ni.add(ae(bn * bn + On * On)), bn = i, On = t;
}
let tr, Es, er, nr;
class sr {
constructor(t) {
this._append = t == null ? Io : Au(t), this._radius = 4.5, this._ = "";
}
pointRadius(t) {
return this._radius = +t, this;
}
polygonStart() {
this._line = 0;
}
polygonEnd() {
this._line = NaN;
}
lineStart() {
this._point = 0;
}
lineEnd() {
this._line === 0 && (this._ += "Z"), this._point = NaN;
}
point(t, e) {
switch (this._point) {
case 0: {
this._append`M${t},${e}`, this._point = 1;
break;
}
case 1: {
this._append`L${t},${e}`;
break;
}
default: {
if (this._append`M${t},${e}`, this._radius !== er || this._append !== Es) {
const n = this._radius, s = this._;
this._ = "", this._append`m0,${n}a${n},${n} 0 1,1 0,${-2 * n}a${n},${n} 0 1,1 0,${2 * n}z`, er = n, Es = this._append, nr = this._, this._ = s;
}
this._ += nr;
break;
}
}
}
result() {
const t = this._;
return this._ = "", t.length ? t : null;
}
}
function Io(i) {
let t = 1;
this._ += i[0];
for (const e = i.length; t < e; ++t)
this._ += arguments[t] + i[t];
}
function Au(i) {
const t = Math.floor(i);
if (!(t >= 0)) throw new RangeError(`invalid digits: ${i}`);
if (t > 15) return Io;
if (t !== tr) {
const e = 10 ** t;
tr = t, Es = function(s) {
let a = 1;
this._ += s[0];
for (const r = s.length; a < r; ++a)
this._ += Math.round(arguments[a] * e) / e + s[a];
};
}
return Es;
}
function Mu(i, t) {
let e = 3, n = 4.5, s, a;
function r(o) {
return o && (typeof n == "function" && a.pointRadius(+n.apply(this, arguments)), je(o, s(a))), a.result();
}
return r.area = function(o) {
return je(o, s(Ee)), Ee.result();
}, r.measure = function(o) {
return je(o, s(In)), In.result();
}, r.bounds = function(o) {
return je(o, s(ms)), ms.result();
}, r.centroid = function(o) {
return je(o, s(Jt)), Jt.result();
}, r.projection = function(o) {
return arguments.length ? (s = o == null ? (i = null, Mi) : (i = o).stream, r) : i;
}, r.context = function(o) {
return arguments.length ? (a = o == null ? (t = null, new sr(e)) : new wo(t = o), typeof n != "function" && a.pointRadius(n), r) : t;
}, r.pointRadius = function(o) {
return arguments.length ? (n = typeof o == "function" ? o : (a.pointRadius(+o), +o), r) : n;
}, r.digits = function(o) {
if (!arguments.length) return e;
if (o == null) e = null;
else {
const c = Math.floor(o);
if (!(c >= 0)) throw new RangeError(`invalid digits: ${o}`);
e = c;
}
return t === null && (a = new sr(e)), r;
}, r.projection(i).digits(e).context(t);
}
function Xi(i) {
return function(t) {
var e = new Pi();
for (var n in i) e[n] = i[n];
return e.stream = t, e;
};
}
function Pi() {
}
Pi.prototype = {
constructor: Pi,
point: function(i, t) {
this.stream.point(i, t);
},
sphere: function() {
this.stream.sphere();
},
lineStart: functio