genomefeatures
Version:
A D3 based genome feature rendering
1,611 lines • 341 kB
JavaScript
function vn(t, e) {
return t == null || e == null ? NaN : t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
}
function ho(t, e) {
return t == null || e == null ? NaN : e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
}
function Oa(t) {
let e, n, i;
t.length !== 2 ? (e = vn, n = (o, c) => vn(t(o), c), i = (o, c) => t(o) - c) : (e = t === vn || t === ho ? t : po, n = t, i = t);
function r(o, c, f = 0, u = o.length) {
if (f < u) {
if (e(c, c) !== 0) return u;
do {
const m = f + u >>> 1;
n(o[m], c) < 0 ? f = m + 1 : u = m;
} while (f < u);
}
return f;
}
function a(o, c, f = 0, u = o.length) {
if (f < u) {
if (e(c, c) !== 0) return u;
do {
const m = f + u >>> 1;
n(o[m], c) <= 0 ? f = m + 1 : u = m;
} while (f < u);
}
return f;
}
function s(o, c, f = 0, u = o.length) {
const m = r(o, c, f, u - 1);
return m > f && i(o[m - 1], c) > -i(o[m], c) ? m - 1 : m;
}
return { left: r, center: s, right: a };
}
function po() {
return 0;
}
function _o(t) {
return t === null ? NaN : +t;
}
const go = Oa(vn), mo = go.right;
Oa(_o).center;
const vo = Math.sqrt(50), wo = Math.sqrt(10), yo = Math.sqrt(2);
function En(t, e, n) {
const i = (e - t) / Math.max(0, n), r = Math.floor(Math.log10(i)), a = i / Math.pow(10, r), s = a >= vo ? 10 : a >= wo ? 5 : a >= yo ? 2 : 1;
let o, c, f;
return r < 0 ? (f = Math.pow(10, -r) / s, o = Math.round(t * f), c = Math.round(e * f), o / f < t && ++o, c / f > e && --c, f = -f) : (f = Math.pow(10, r) * s, o = Math.round(t / f), c = Math.round(e / f), o * f < t && ++o, c * f > e && --c), c < o && 0.5 <= n && n < 2 ? En(t, e, n * 2) : [o, c, f];
}
function bo(t, e, n) {
if (e = +e, t = +t, n = +n, !(n > 0)) return [];
if (t === e) return [t];
const i = e < t, [r, a, s] = i ? En(e, t, n) : En(t, e, n);
if (!(a >= r)) return [];
const o = a - r + 1, c = new Array(o);
if (i)
if (s < 0) for (let f = 0; f < o; ++f) c[f] = (a - f) / -s;
else for (let f = 0; f < o; ++f) c[f] = (a - f) * s;
else if (s < 0) for (let f = 0; f < o; ++f) c[f] = (r + f) / -s;
else for (let f = 0; f < o; ++f) c[f] = (r + f) * s;
return c;
}
function gi(t, e, n) {
return e = +e, t = +t, n = +n, En(t, e, n)[2];
}
function xo(t, e, n) {
e = +e, t = +t, n = +n;
const i = e < t, r = i ? gi(e, t, n) : gi(t, e, n);
return (i ? -1 : 1) * (r < 0 ? 1 / -r : r);
}
function ko(t) {
return t;
}
var wn = 1, Gn = 2, mi = 3, an = 4, or = 1e-6;
function To(t) {
return "translate(" + t + ",0)";
}
function Eo(t) {
return "translate(0," + t + ")";
}
function So(t) {
return (e) => +t(e);
}
function Ao(t, e) {
return e = Math.max(0, t.bandwidth() - e * 2) / 2, t.round() && (e = Math.round(e)), (n) => +t(n) + e;
}
function $o() {
return !this.__axis;
}
function Ca(t, e) {
var n = [], i = null, r = null, a = 6, s = 6, o = 3, c = typeof window < "u" && window.devicePixelRatio > 1 ? 0 : 0.5, f = t === wn || t === an ? -1 : 1, u = t === an || t === Gn ? "x" : "y", m = t === wn || t === mi ? To : Eo;
function p(_) {
var E = i ?? (e.ticks ? e.ticks.apply(e, n) : e.domain()), z = r ?? (e.tickFormat ? e.tickFormat.apply(e, n) : ko), I = Math.max(a, 0) + o, A = e.range(), T = +A[0] + c, x = +A[A.length - 1] + c, b = (e.bandwidth ? Ao : So)(e.copy(), c), S = _.selection ? _.selection() : _, $ = S.selectAll(".domain").data([null]), k = S.selectAll(".tick").data(E, e).order(), B = k.exit(), F = k.enter().append("g").attr("class", "tick"), O = k.select("line"), v = k.select("text");
$ = $.merge($.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")), k = k.merge(F), O = O.merge(F.append("line").attr("stroke", "currentColor").attr(u + "2", f * a)), v = v.merge(F.append("text").attr("fill", "currentColor").attr(u, f * I).attr("dy", t === wn ? "0em" : t === mi ? "0.71em" : "0.32em")), _ !== S && ($ = $.transition(_), k = k.transition(_), O = O.transition(_), v = v.transition(_), B = B.transition(_).attr("opacity", or).attr("transform", function(q) {
return isFinite(q = b(q)) ? m(q + c) : this.getAttribute("transform");
}), F.attr("opacity", or).attr("transform", function(q) {
var P = this.parentNode.__axis;
return m((P && isFinite(P = P(q)) ? P : b(q)) + c);
})), B.remove(), $.attr("d", t === an || t === Gn ? s ? "M" + f * s + "," + T + "H" + c + "V" + x + "H" + f * s : "M" + c + "," + T + "V" + x : s ? "M" + T + "," + f * s + "V" + c + "H" + x + "V" + f * s : "M" + T + "," + c + "H" + x), k.attr("opacity", 1).attr("transform", function(q) {
return m(b(q) + c);
}), O.attr(u + "2", f * a), v.attr(u, f * I).text(z), S.filter($o).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", t === Gn ? "start" : t === an ? "end" : "middle"), S.each(function() {
this.__axis = b;
});
}
return p.scale = function(_) {
return arguments.length ? (e = _, p) : e;
}, p.ticks = function() {
return n = Array.from(arguments), p;
}, p.tickArguments = function(_) {
return arguments.length ? (n = _ == null ? [] : Array.from(_), p) : n.slice();
}, p.tickValues = function(_) {
return arguments.length ? (i = _ == null ? null : Array.from(_), p) : i && i.slice();
}, p.tickFormat = function(_) {
return arguments.length ? (r = _, p) : r;
}, p.tickSize = function(_) {
return arguments.length ? (a = s = +_, p) : a;
}, p.tickSizeInner = function(_) {
return arguments.length ? (a = +_, p) : a;
}, p.tickSizeOuter = function(_) {
return arguments.length ? (s = +_, p) : s;
}, p.tickPadding = function(_) {
return arguments.length ? (o = +_, p) : o;
}, p.offset = function(_) {
return arguments.length ? (c = +_, p) : c;
}, p;
}
function lr(t) {
return Ca(wn, t);
}
function No(t) {
return Ca(mi, t);
}
var Io = { value: () => {
} };
function Fa() {
for (var t = 0, e = arguments.length, n = {}, i; t < e; ++t) {
if (!(i = arguments[t] + "") || i in n || /[\s.]/.test(i)) throw new Error("illegal type: " + i);
n[i] = [];
}
return new yn(n);
}
function yn(t) {
this._ = t;
}
function Do(t, e) {
return t.trim().split(/^|\s+/).map(function(n) {
var i = "", r = n.indexOf(".");
if (r >= 0 && (i = n.slice(r + 1), n = n.slice(0, r)), n && !e.hasOwnProperty(n)) throw new Error("unknown type: " + n);
return { type: n, name: i };
});
}
yn.prototype = Fa.prototype = {
constructor: yn,
on: function(t, e) {
var n = this._, i = Do(t + "", n), r, a = -1, s = i.length;
if (arguments.length < 2) {
for (; ++a < s; ) if ((r = (t = i[a]).type) && (r = Ro(n[r], t.name))) return r;
return;
}
if (e != null && typeof e != "function") throw new Error("invalid callback: " + e);
for (; ++a < s; )
if (r = (t = i[a]).type) n[r] = cr(n[r], t.name, e);
else if (e == null) for (r in n) n[r] = cr(n[r], t.name, null);
return this;
},
copy: function() {
var t = {}, e = this._;
for (var n in e) t[n] = e[n].slice();
return new yn(t);
},
call: function(t, e) {
if ((r = arguments.length - 2) > 0) for (var n = new Array(r), i = 0, r, a; i < r; ++i) n[i] = arguments[i + 2];
if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
for (a = this._[t], i = 0, r = a.length; i < r; ++i) a[i].value.apply(e, n);
},
apply: function(t, e, n) {
if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
for (var i = this._[t], r = 0, a = i.length; r < a; ++r) i[r].value.apply(e, n);
}
};
function Ro(t, e) {
for (var n = 0, i = t.length, r; n < i; ++n)
if ((r = t[n]).name === e)
return r.value;
}
function cr(t, e, n) {
for (var i = 0, r = t.length; i < r; ++i)
if (t[i].name === e) {
t[i] = Io, t = t.slice(0, i).concat(t.slice(i + 1));
break;
}
return n != null && t.push({ name: e, value: n }), t;
}
var vi = "http://www.w3.org/1999/xhtml";
const fr = {
svg: "http://www.w3.org/2000/svg",
xhtml: vi,
xlink: "http://www.w3.org/1999/xlink",
xml: "http://www.w3.org/XML/1998/namespace",
xmlns: "http://www.w3.org/2000/xmlns/"
};
function Hn(t) {
var e = t += "", n = e.indexOf(":");
return n >= 0 && (e = t.slice(0, n)) !== "xmlns" && (t = t.slice(n + 1)), fr.hasOwnProperty(e) ? { space: fr[e], local: t } : t;
}
function Mo(t) {
return function() {
var e = this.ownerDocument, n = this.namespaceURI;
return n === vi && e.documentElement.namespaceURI === vi ? e.createElement(t) : e.createElementNS(n, t);
};
}
function Lo(t) {
return function() {
return this.ownerDocument.createElementNS(t.space, t.local);
};
}
function za(t) {
var e = Hn(t);
return (e.local ? Lo : Mo)(e);
}
function Oo() {
}
function zi(t) {
return t == null ? Oo : function() {
return this.querySelector(t);
};
}
function Co(t) {
typeof t != "function" && (t = zi(t));
for (var e = this._groups, n = e.length, i = new Array(n), r = 0; r < n; ++r)
for (var a = e[r], s = a.length, o = i[r] = new Array(s), c, f, u = 0; u < s; ++u)
(c = a[u]) && (f = t.call(c, c.__data__, u, a)) && ("__data__" in c && (f.__data__ = c.__data__), o[u] = f);
return new Vt(i, this._parents);
}
function Ba(t) {
return t == null ? [] : Array.isArray(t) ? t : Array.from(t);
}
function Fo() {
return [];
}
function Ha(t) {
return t == null ? Fo : function() {
return this.querySelectorAll(t);
};
}
function zo(t) {
return function() {
return Ba(t.apply(this, arguments));
};
}
function Bo(t) {
typeof t == "function" ? t = zo(t) : t = Ha(t);
for (var e = this._groups, n = e.length, i = [], r = [], a = 0; a < n; ++a)
for (var s = e[a], o = s.length, c, f = 0; f < o; ++f)
(c = s[f]) && (i.push(t.call(c, c.__data__, f, s)), r.push(c));
return new Vt(i, r);
}
function Pa(t) {
return function() {
return this.matches(t);
};
}
function Va(t) {
return function(e) {
return e.matches(t);
};
}
var Ho = Array.prototype.find;
function Po(t) {
return function() {
return Ho.call(this.children, t);
};
}
function Vo() {
return this.firstElementChild;
}
function Uo(t) {
return this.select(t == null ? Vo : Po(typeof t == "function" ? t : Va(t)));
}
var Zo = Array.prototype.filter;
function qo() {
return Array.from(this.children);
}
function Go(t) {
return function() {
return Zo.call(this.children, t);
};
}
function Wo(t) {
return this.selectAll(t == null ? qo : Go(typeof t == "function" ? t : Va(t)));
}
function Xo(t) {
typeof t != "function" && (t = Pa(t));
for (var e = this._groups, n = e.length, i = new Array(n), r = 0; r < n; ++r)
for (var a = e[r], s = a.length, o = i[r] = [], c, f = 0; f < s; ++f)
(c = a[f]) && t.call(c, c.__data__, f, a) && o.push(c);
return new Vt(i, this._parents);
}
function Ua(t) {
return new Array(t.length);
}
function Yo() {
return new Vt(this._enter || this._groups.map(Ua), this._parents);
}
function Sn(t, e) {
this.ownerDocument = t.ownerDocument, this.namespaceURI = t.namespaceURI, this._next = null, this._parent = t, this.__data__ = e;
}
Sn.prototype = {
constructor: Sn,
appendChild: function(t) {
return this._parent.insertBefore(t, this._next);
},
insertBefore: function(t, e) {
return this._parent.insertBefore(t, e);
},
querySelector: function(t) {
return this._parent.querySelector(t);
},
querySelectorAll: function(t) {
return this._parent.querySelectorAll(t);
}
};
function Ko(t) {
return function() {
return t;
};
}
function Jo(t, e, n, i, r, a) {
for (var s = 0, o, c = e.length, f = a.length; s < f; ++s)
(o = e[s]) ? (o.__data__ = a[s], i[s] = o) : n[s] = new Sn(t, a[s]);
for (; s < c; ++s)
(o = e[s]) && (r[s] = o);
}
function Qo(t, e, n, i, r, a, s) {
var o, c, f = /* @__PURE__ */ new Map(), u = e.length, m = a.length, p = new Array(u), _;
for (o = 0; o < u; ++o)
(c = e[o]) && (p[o] = _ = s.call(c, c.__data__, o, e) + "", f.has(_) ? r[o] = c : f.set(_, c));
for (o = 0; o < m; ++o)
_ = s.call(t, a[o], o, a) + "", (c = f.get(_)) ? (i[o] = c, c.__data__ = a[o], f.delete(_)) : n[o] = new Sn(t, a[o]);
for (o = 0; o < u; ++o)
(c = e[o]) && f.get(p[o]) === c && (r[o] = c);
}
function jo(t) {
return t.__data__;
}
function tl(t, e) {
if (!arguments.length) return Array.from(this, jo);
var n = e ? Qo : Jo, i = this._parents, r = this._groups;
typeof t != "function" && (t = Ko(t));
for (var a = r.length, s = new Array(a), o = new Array(a), c = new Array(a), f = 0; f < a; ++f) {
var u = i[f], m = r[f], p = m.length, _ = el(t.call(u, u && u.__data__, f, i)), E = _.length, z = o[f] = new Array(E), I = s[f] = new Array(E), A = c[f] = new Array(p);
n(u, m, z, I, A, _, e);
for (var T = 0, x = 0, b, S; T < E; ++T)
if (b = z[T]) {
for (T >= x && (x = T + 1); !(S = I[x]) && ++x < E; ) ;
b._next = S || null;
}
}
return s = new Vt(s, i), s._enter = o, s._exit = c, s;
}
function el(t) {
return typeof t == "object" && "length" in t ? t : Array.from(t);
}
function nl() {
return new Vt(this._exit || this._groups.map(Ua), this._parents);
}
function il(t, e, n) {
var i = this.enter(), r = this, a = this.exit();
return typeof t == "function" ? (i = t(i), i && (i = i.selection())) : i = i.append(t + ""), e != null && (r = e(r), r && (r = r.selection())), n == null ? a.remove() : n(a), i && r ? i.merge(r).order() : r;
}
function rl(t) {
for (var e = t.selection ? t.selection() : t, n = this._groups, i = e._groups, r = n.length, a = i.length, s = Math.min(r, a), o = new Array(r), c = 0; c < s; ++c)
for (var f = n[c], u = i[c], m = f.length, p = o[c] = new Array(m), _, E = 0; E < m; ++E)
(_ = f[E] || u[E]) && (p[E] = _);
for (; c < r; ++c)
o[c] = n[c];
return new Vt(o, this._parents);
}
function al() {
for (var t = this._groups, e = -1, n = t.length; ++e < n; )
for (var i = t[e], r = i.length - 1, a = i[r], s; --r >= 0; )
(s = i[r]) && (a && s.compareDocumentPosition(a) ^ 4 && a.parentNode.insertBefore(s, a), a = s);
return this;
}
function sl(t) {
t || (t = ol);
function e(m, p) {
return m && p ? t(m.__data__, p.__data__) : !m - !p;
}
for (var n = this._groups, i = n.length, r = new Array(i), a = 0; a < i; ++a) {
for (var s = n[a], o = s.length, c = r[a] = new Array(o), f, u = 0; u < o; ++u)
(f = s[u]) && (c[u] = f);
c.sort(e);
}
return new Vt(r, this._parents).order();
}
function ol(t, e) {
return t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
}
function ll() {
var t = arguments[0];
return arguments[0] = this, t.apply(null, arguments), this;
}
function cl() {
return Array.from(this);
}
function fl() {
for (var t = this._groups, e = 0, n = t.length; e < n; ++e)
for (var i = t[e], r = 0, a = i.length; r < a; ++r) {
var s = i[r];
if (s) return s;
}
return null;
}
function ul() {
let t = 0;
for (const e of this) ++t;
return t;
}
function hl() {
return !this.node();
}
function dl(t) {
for (var e = this._groups, n = 0, i = e.length; n < i; ++n)
for (var r = e[n], a = 0, s = r.length, o; a < s; ++a)
(o = r[a]) && t.call(o, o.__data__, a, r);
return this;
}
function pl(t) {
return function() {
this.removeAttribute(t);
};
}
function _l(t) {
return function() {
this.removeAttributeNS(t.space, t.local);
};
}
function gl(t, e) {
return function() {
this.setAttribute(t, e);
};
}
function ml(t, e) {
return function() {
this.setAttributeNS(t.space, t.local, e);
};
}
function vl(t, e) {
return function() {
var n = e.apply(this, arguments);
n == null ? this.removeAttribute(t) : this.setAttribute(t, n);
};
}
function wl(t, e) {
return function() {
var n = e.apply(this, arguments);
n == null ? this.removeAttributeNS(t.space, t.local) : this.setAttributeNS(t.space, t.local, n);
};
}
function yl(t, e) {
var n = Hn(t);
if (arguments.length < 2) {
var i = this.node();
return n.local ? i.getAttributeNS(n.space, n.local) : i.getAttribute(n);
}
return this.each((e == null ? n.local ? _l : pl : typeof e == "function" ? n.local ? wl : vl : n.local ? ml : gl)(n, e));
}
function Za(t) {
return t.ownerDocument && t.ownerDocument.defaultView || t.document && t || t.defaultView;
}
function bl(t) {
return function() {
this.style.removeProperty(t);
};
}
function xl(t, e, n) {
return function() {
this.style.setProperty(t, e, n);
};
}
function kl(t, e, n) {
return function() {
var i = e.apply(this, arguments);
i == null ? this.style.removeProperty(t) : this.style.setProperty(t, i, n);
};
}
function Tl(t, e, n) {
return arguments.length > 1 ? this.each((e == null ? bl : typeof e == "function" ? kl : xl)(t, e, n ?? "")) : Oe(this.node(), t);
}
function Oe(t, e) {
return t.style.getPropertyValue(e) || Za(t).getComputedStyle(t, null).getPropertyValue(e);
}
function El(t) {
return function() {
delete this[t];
};
}
function Sl(t, e) {
return function() {
this[t] = e;
};
}
function Al(t, e) {
return function() {
var n = e.apply(this, arguments);
n == null ? delete this[t] : this[t] = n;
};
}
function $l(t, e) {
return arguments.length > 1 ? this.each((e == null ? El : typeof e == "function" ? Al : Sl)(t, e)) : this.node()[t];
}
function qa(t) {
return t.trim().split(/^|\s+/);
}
function Bi(t) {
return t.classList || new Ga(t);
}
function Ga(t) {
this._node = t, this._names = qa(t.getAttribute("class") || "");
}
Ga.prototype = {
add: function(t) {
var e = this._names.indexOf(t);
e < 0 && (this._names.push(t), this._node.setAttribute("class", this._names.join(" ")));
},
remove: function(t) {
var e = this._names.indexOf(t);
e >= 0 && (this._names.splice(e, 1), this._node.setAttribute("class", this._names.join(" ")));
},
contains: function(t) {
return this._names.indexOf(t) >= 0;
}
};
function Wa(t, e) {
for (var n = Bi(t), i = -1, r = e.length; ++i < r; ) n.add(e[i]);
}
function Xa(t, e) {
for (var n = Bi(t), i = -1, r = e.length; ++i < r; ) n.remove(e[i]);
}
function Nl(t) {
return function() {
Wa(this, t);
};
}
function Il(t) {
return function() {
Xa(this, t);
};
}
function Dl(t, e) {
return function() {
(e.apply(this, arguments) ? Wa : Xa)(this, t);
};
}
function Rl(t, e) {
var n = qa(t + "");
if (arguments.length < 2) {
for (var i = Bi(this.node()), r = -1, a = n.length; ++r < a; ) if (!i.contains(n[r])) return !1;
return !0;
}
return this.each((typeof e == "function" ? Dl : e ? Nl : Il)(n, e));
}
function Ml() {
this.textContent = "";
}
function Ll(t) {
return function() {
this.textContent = t;
};
}
function Ol(t) {
return function() {
var e = t.apply(this, arguments);
this.textContent = e ?? "";
};
}
function Cl(t) {
return arguments.length ? this.each(t == null ? Ml : (typeof t == "function" ? Ol : Ll)(t)) : this.node().textContent;
}
function Fl() {
this.innerHTML = "";
}
function zl(t) {
return function() {
this.innerHTML = t;
};
}
function Bl(t) {
return function() {
var e = t.apply(this, arguments);
this.innerHTML = e ?? "";
};
}
function Hl(t) {
return arguments.length ? this.each(t == null ? Fl : (typeof t == "function" ? Bl : zl)(t)) : this.node().innerHTML;
}
function Pl() {
this.nextSibling && this.parentNode.appendChild(this);
}
function Vl() {
return this.each(Pl);
}
function Ul() {
this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild);
}
function Zl() {
return this.each(Ul);
}
function ql(t) {
var e = typeof t == "function" ? t : za(t);
return this.select(function() {
return this.appendChild(e.apply(this, arguments));
});
}
function Gl() {
return null;
}
function Wl(t, e) {
var n = typeof t == "function" ? t : za(t), i = e == null ? Gl : typeof e == "function" ? e : zi(e);
return this.select(function() {
return this.insertBefore(n.apply(this, arguments), i.apply(this, arguments) || null);
});
}
function Xl() {
var t = this.parentNode;
t && t.removeChild(this);
}
function Yl() {
return this.each(Xl);
}
function Kl() {
var t = this.cloneNode(!1), e = this.parentNode;
return e ? e.insertBefore(t, this.nextSibling) : t;
}
function Jl() {
var t = this.cloneNode(!0), e = this.parentNode;
return e ? e.insertBefore(t, this.nextSibling) : t;
}
function Ql(t) {
return this.select(t ? Jl : Kl);
}
function jl(t) {
return arguments.length ? this.property("__data__", t) : this.node().__data__;
}
function tc(t) {
return function(e) {
t.call(this, e, this.__data__);
};
}
function ec(t) {
return t.trim().split(/^|\s+/).map(function(e) {
var n = "", i = e.indexOf(".");
return i >= 0 && (n = e.slice(i + 1), e = e.slice(0, i)), { type: e, name: n };
});
}
function nc(t) {
return function() {
var e = this.__on;
if (e) {
for (var n = 0, i = -1, r = e.length, a; n < r; ++n)
a = e[n], (!t.type || a.type === t.type) && a.name === t.name ? this.removeEventListener(a.type, a.listener, a.options) : e[++i] = a;
++i ? e.length = i : delete this.__on;
}
};
}
function ic(t, e, n) {
return function() {
var i = this.__on, r, a = tc(e);
if (i) {
for (var s = 0, o = i.length; s < o; ++s)
if ((r = i[s]).type === t.type && r.name === t.name) {
this.removeEventListener(r.type, r.listener, r.options), this.addEventListener(r.type, r.listener = a, r.options = n), r.value = e;
return;
}
}
this.addEventListener(t.type, a, n), r = { type: t.type, name: t.name, value: e, listener: a, options: n }, i ? i.push(r) : this.__on = [r];
};
}
function rc(t, e, n) {
var i = ec(t + ""), r, a = i.length, s;
if (arguments.length < 2) {
var o = this.node().__on;
if (o) {
for (var c = 0, f = o.length, u; c < f; ++c)
for (r = 0, u = o[c]; r < a; ++r)
if ((s = i[r]).type === u.type && s.name === u.name)
return u.value;
}
return;
}
for (o = e ? ic : nc, r = 0; r < a; ++r) this.each(o(i[r], e, n));
return this;
}
function Ya(t, e, n) {
var i = Za(t), r = i.CustomEvent;
typeof r == "function" ? r = new r(e, n) : (r = i.document.createEvent("Event"), n ? (r.initEvent(e, n.bubbles, n.cancelable), r.detail = n.detail) : r.initEvent(e, !1, !1)), t.dispatchEvent(r);
}
function ac(t, e) {
return function() {
return Ya(this, t, e);
};
}
function sc(t, e) {
return function() {
return Ya(this, t, e.apply(this, arguments));
};
}
function oc(t, e) {
return this.each((typeof e == "function" ? sc : ac)(t, e));
}
function* lc() {
for (var t = this._groups, e = 0, n = t.length; e < n; ++e)
for (var i = t[e], r = 0, a = i.length, s; r < a; ++r)
(s = i[r]) && (yield s);
}
var Hi = [null];
function Vt(t, e) {
this._groups = t, this._parents = e;
}
function Se() {
return new Vt([[document.documentElement]], Hi);
}
function cc() {
return this;
}
Vt.prototype = Se.prototype = {
constructor: Vt,
select: Co,
selectAll: Bo,
selectChild: Uo,
selectChildren: Wo,
filter: Xo,
data: tl,
enter: Yo,
exit: nl,
join: il,
merge: rl,
selection: cc,
order: al,
sort: sl,
call: ll,
nodes: cl,
node: fl,
size: ul,
empty: hl,
each: dl,
attr: yl,
style: Tl,
property: $l,
classed: Rl,
text: Cl,
html: Hl,
raise: Vl,
lower: Zl,
append: ql,
insert: Wl,
remove: Yl,
clone: Ql,
datum: jl,
on: rc,
dispatch: oc,
[Symbol.iterator]: lc
};
function $t(t) {
return typeof t == "string" ? new Vt([[document.querySelector(t)]], [document.documentElement]) : new Vt([[t]], Hi);
}
function Jt(t) {
return typeof t == "string" ? new Vt([document.querySelectorAll(t)], [document.documentElement]) : new Vt([Ba(t)], Hi);
}
function Pi(t, e, n) {
t.prototype = e.prototype = n, n.constructor = t;
}
function Ka(t, e) {
var n = Object.create(t.prototype);
for (var i in e) n[i] = e[i];
return n;
}
function en() {
}
var Ye = 0.7, An = 1 / Ye, Me = "\\s*([+-]?\\d+)\\s*", Ke = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", ie = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", fc = /^#([0-9a-f]{3,8})$/, uc = new RegExp(`^rgb\\(${Me},${Me},${Me}\\)$`), hc = new RegExp(`^rgb\\(${ie},${ie},${ie}\\)$`), dc = new RegExp(`^rgba\\(${Me},${Me},${Me},${Ke}\\)$`), pc = new RegExp(`^rgba\\(${ie},${ie},${ie},${Ke}\\)$`), _c = new RegExp(`^hsl\\(${Ke},${ie},${ie}\\)$`), gc = new RegExp(`^hsla\\(${Ke},${ie},${ie},${Ke}\\)$`), ur = {
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
};
Pi(en, xe, {
copy(t) {
return Object.assign(new this.constructor(), this, t);
},
displayable() {
return this.rgb().displayable();
},
hex: hr,
// Deprecated! Use color.formatHex.
formatHex: hr,
formatHex8: mc,
formatHsl: vc,
formatRgb: dr,
toString: dr
});
function hr() {
return this.rgb().formatHex();
}
function mc() {
return this.rgb().formatHex8();
}
function vc() {
return Ja(this).formatHsl();
}
function dr() {
return this.rgb().formatRgb();
}
function xe(t) {
var e, n;
return t = (t + "").trim().toLowerCase(), (e = fc.exec(t)) ? (n = e[1].length, e = parseInt(e[1], 16), n === 6 ? pr(e) : n === 3 ? new Zt(e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, (e & 15) << 4 | e & 15, 1) : n === 8 ? sn(e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, (e & 255) / 255) : n === 4 ? sn(e >> 12 & 15 | e >> 8 & 240, e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, ((e & 15) << 4 | e & 15) / 255) : null) : (e = uc.exec(t)) ? new Zt(e[1], e[2], e[3], 1) : (e = hc.exec(t)) ? new Zt(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, 1) : (e = dc.exec(t)) ? sn(e[1], e[2], e[3], e[4]) : (e = pc.exec(t)) ? sn(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, e[4]) : (e = _c.exec(t)) ? mr(e[1], e[2] / 100, e[3] / 100, 1) : (e = gc.exec(t)) ? mr(e[1], e[2] / 100, e[3] / 100, e[4]) : ur.hasOwnProperty(t) ? pr(ur[t]) : t === "transparent" ? new Zt(NaN, NaN, NaN, 0) : null;
}
function pr(t) {
return new Zt(t >> 16 & 255, t >> 8 & 255, t & 255, 1);
}
function sn(t, e, n, i) {
return i <= 0 && (t = e = n = NaN), new Zt(t, e, n, i);
}
function wc(t) {
return t instanceof en || (t = xe(t)), t ? (t = t.rgb(), new Zt(t.r, t.g, t.b, t.opacity)) : new Zt();
}
function wi(t, e, n, i) {
return arguments.length === 1 ? wc(t) : new Zt(t, e, n, i ?? 1);
}
function Zt(t, e, n, i) {
this.r = +t, this.g = +e, this.b = +n, this.opacity = +i;
}
Pi(Zt, wi, Ka(en, {
brighter(t) {
return t = t == null ? An : Math.pow(An, t), new Zt(this.r * t, this.g * t, this.b * t, this.opacity);
},
darker(t) {
return t = t == null ? Ye : Math.pow(Ye, t), new Zt(this.r * t, this.g * t, this.b * t, this.opacity);
},
rgb() {
return this;
},
clamp() {
return new Zt(ye(this.r), ye(this.g), ye(this.b), $n(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;
},
hex: _r,
// Deprecated! Use color.formatHex.
formatHex: _r,
formatHex8: yc,
formatRgb: gr,
toString: gr
}));
function _r() {
return `#${ve(this.r)}${ve(this.g)}${ve(this.b)}`;
}
function yc() {
return `#${ve(this.r)}${ve(this.g)}${ve(this.b)}${ve((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
}
function gr() {
const t = $n(this.opacity);
return `${t === 1 ? "rgb(" : "rgba("}${ye(this.r)}, ${ye(this.g)}, ${ye(this.b)}${t === 1 ? ")" : `, ${t})`}`;
}
function $n(t) {
return isNaN(t) ? 1 : Math.max(0, Math.min(1, t));
}
function ye(t) {
return Math.max(0, Math.min(255, Math.round(t) || 0));
}
function ve(t) {
return t = ye(t), (t < 16 ? "0" : "") + t.toString(16);
}
function mr(t, e, n, i) {
return i <= 0 ? t = e = n = NaN : n <= 0 || n >= 1 ? t = e = NaN : e <= 0 && (t = NaN), new jt(t, e, n, i);
}
function Ja(t) {
if (t instanceof jt) return new jt(t.h, t.s, t.l, t.opacity);
if (t instanceof en || (t = xe(t)), !t) return new jt();
if (t instanceof jt) return t;
t = t.rgb();
var e = t.r / 255, n = t.g / 255, i = t.b / 255, r = Math.min(e, n, i), a = Math.max(e, n, i), s = NaN, o = a - r, c = (a + r) / 2;
return o ? (e === a ? s = (n - i) / o + (n < i) * 6 : n === a ? s = (i - e) / o + 2 : s = (e - n) / o + 4, o /= c < 0.5 ? a + r : 2 - a - r, s *= 60) : o = c > 0 && c < 1 ? 0 : s, new jt(s, o, c, t.opacity);
}
function bc(t, e, n, i) {
return arguments.length === 1 ? Ja(t) : new jt(t, e, n, i ?? 1);
}
function jt(t, e, n, i) {
this.h = +t, this.s = +e, this.l = +n, this.opacity = +i;
}
Pi(jt, bc, Ka(en, {
brighter(t) {
return t = t == null ? An : Math.pow(An, t), new jt(this.h, this.s, this.l * t, this.opacity);
},
darker(t) {
return t = t == null ? Ye : Math.pow(Ye, t), new jt(this.h, this.s, this.l * t, this.opacity);
},
rgb() {
var t = this.h % 360 + (this.h < 0) * 360, e = isNaN(t) || isNaN(this.s) ? 0 : this.s, n = this.l, i = n + (n < 0.5 ? n : 1 - n) * e, r = 2 * n - i;
return new Zt(
Wn(t >= 240 ? t - 240 : t + 120, r, i),
Wn(t, r, i),
Wn(t < 120 ? t + 240 : t - 120, r, i),
this.opacity
);
},
clamp() {
return new jt(vr(this.h), on(this.s), on(this.l), $n(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 t = $n(this.opacity);
return `${t === 1 ? "hsl(" : "hsla("}${vr(this.h)}, ${on(this.s) * 100}%, ${on(this.l) * 100}%${t === 1 ? ")" : `, ${t})`}`;
}
}));
function vr(t) {
return t = (t || 0) % 360, t < 0 ? t + 360 : t;
}
function on(t) {
return Math.max(0, Math.min(1, t || 0));
}
function Wn(t, e, n) {
return (t < 60 ? e + (n - e) * t / 60 : t < 180 ? n : t < 240 ? e + (n - e) * (240 - t) / 60 : e) * 255;
}
const Vi = (t) => () => t;
function xc(t, e) {
return function(n) {
return t + n * e;
};
}
function kc(t, e, n) {
return t = Math.pow(t, n), e = Math.pow(e, n) - t, n = 1 / n, function(i) {
return Math.pow(t + i * e, n);
};
}
function Tc(t) {
return (t = +t) == 1 ? Qa : function(e, n) {
return n - e ? kc(e, n, t) : Vi(isNaN(e) ? n : e);
};
}
function Qa(t, e) {
var n = e - t;
return n ? xc(t, n) : Vi(isNaN(t) ? e : t);
}
const Nn = function t(e) {
var n = Tc(e);
function i(r, a) {
var s = n((r = wi(r)).r, (a = wi(a)).r), o = n(r.g, a.g), c = n(r.b, a.b), f = Qa(r.opacity, a.opacity);
return function(u) {
return r.r = s(u), r.g = o(u), r.b = c(u), r.opacity = f(u), r + "";
};
}
return i.gamma = t, i;
}(1);
function Ec(t, e) {
e || (e = []);
var n = t ? Math.min(e.length, t.length) : 0, i = e.slice(), r;
return function(a) {
for (r = 0; r < n; ++r) i[r] = t[r] * (1 - a) + e[r] * a;
return i;
};
}
function Sc(t) {
return ArrayBuffer.isView(t) && !(t instanceof DataView);
}
function Ac(t, e) {
var n = e ? e.length : 0, i = t ? Math.min(n, t.length) : 0, r = new Array(i), a = new Array(n), s;
for (s = 0; s < i; ++s) r[s] = Ui(t[s], e[s]);
for (; s < n; ++s) a[s] = e[s];
return function(o) {
for (s = 0; s < i; ++s) a[s] = r[s](o);
return a;
};
}
function $c(t, e) {
var n = /* @__PURE__ */ new Date();
return t = +t, e = +e, function(i) {
return n.setTime(t * (1 - i) + e * i), n;
};
}
function Qt(t, e) {
return t = +t, e = +e, function(n) {
return t * (1 - n) + e * n;
};
}
function Nc(t, e) {
var n = {}, i = {}, r;
(t === null || typeof t != "object") && (t = {}), (e === null || typeof e != "object") && (e = {});
for (r in e)
r in t ? n[r] = Ui(t[r], e[r]) : i[r] = e[r];
return function(a) {
for (r in n) i[r] = n[r](a);
return i;
};
}
var yi = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, Xn = new RegExp(yi.source, "g");
function Ic(t) {
return function() {
return t;
};
}
function Dc(t) {
return function(e) {
return t(e) + "";
};
}
function ja(t, e) {
var n = yi.lastIndex = Xn.lastIndex = 0, i, r, a, s = -1, o = [], c = [];
for (t = t + "", e = e + ""; (i = yi.exec(t)) && (r = Xn.exec(e)); )
(a = r.index) > n && (a = e.slice(n, a), o[s] ? o[s] += a : o[++s] = a), (i = i[0]) === (r = r[0]) ? o[s] ? o[s] += r : o[++s] = r : (o[++s] = null, c.push({ i: s, x: Qt(i, r) })), n = Xn.lastIndex;
return n < e.length && (a = e.slice(n), o[s] ? o[s] += a : o[++s] = a), o.length < 2 ? c[0] ? Dc(c[0].x) : Ic(e) : (e = c.length, function(f) {
for (var u = 0, m; u < e; ++u) o[(m = c[u]).i] = m.x(f);
return o.join("");
});
}
function Ui(t, e) {
var n = typeof e, i;
return e == null || n === "boolean" ? Vi(e) : (n === "number" ? Qt : n === "string" ? (i = xe(e)) ? (e = i, Nn) : ja : e instanceof xe ? Nn : e instanceof Date ? $c : Sc(e) ? Ec : Array.isArray(e) ? Ac : typeof e.valueOf != "function" && typeof e.toString != "function" || isNaN(e) ? Nc : Qt)(t, e);
}
function Rc(t, e) {
return t = +t, e = +e, function(n) {
return Math.round(t * (1 - n) + e * n);
};
}
var wr = 180 / Math.PI, bi = {
translateX: 0,
translateY: 0,
rotate: 0,
skewX: 0,
scaleX: 1,
scaleY: 1
};
function ts(t, e, n, i, r, a) {
var s, o, c;
return (s = Math.sqrt(t * t + e * e)) && (t /= s, e /= s), (c = t * n + e * i) && (n -= t * c, i -= e * c), (o = Math.sqrt(n * n + i * i)) && (n /= o, i /= o, c /= o), t * i < e * n && (t = -t, e = -e, c = -c, s = -s), {
translateX: r,
translateY: a,
rotate: Math.atan2(e, t) * wr,
skewX: Math.atan(c) * wr,
scaleX: s,
scaleY: o
};
}
var ln;
function Mc(t) {
const e = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(t + "");
return e.isIdentity ? bi : ts(e.a, e.b, e.c, e.d, e.e, e.f);
}
function Lc(t) {
return t == null || (ln || (ln = document.createElementNS("http://www.w3.org/2000/svg", "g")), ln.setAttribute("transform", t), !(t = ln.transform.baseVal.consolidate())) ? bi : (t = t.matrix, ts(t.a, t.b, t.c, t.d, t.e, t.f));
}
function es(t, e, n, i) {
function r(f) {
return f.length ? f.pop() + " " : "";
}
function a(f, u, m, p, _, E) {
if (f !== m || u !== p) {
var z = _.push("translate(", null, e, null, n);
E.push({ i: z - 4, x: Qt(f, m) }, { i: z - 2, x: Qt(u, p) });
} else (m || p) && _.push("translate(" + m + e + p + n);
}
function s(f, u, m, p) {
f !== u ? (f - u > 180 ? u += 360 : u - f > 180 && (f += 360), p.push({ i: m.push(r(m) + "rotate(", null, i) - 2, x: Qt(f, u) })) : u && m.push(r(m) + "rotate(" + u + i);
}
function o(f, u, m, p) {
f !== u ? p.push({ i: m.push(r(m) + "skewX(", null, i) - 2, x: Qt(f, u) }) : u && m.push(r(m) + "skewX(" + u + i);
}
function c(f, u, m, p, _, E) {
if (f !== m || u !== p) {
var z = _.push(r(_) + "scale(", null, ",", null, ")");
E.push({ i: z - 4, x: Qt(f, m) }, { i: z - 2, x: Qt(u, p) });
} else (m !== 1 || p !== 1) && _.push(r(_) + "scale(" + m + "," + p + ")");
}
return function(f, u) {
var m = [], p = [];
return f = t(f), u = t(u), a(f.translateX, f.translateY, u.translateX, u.translateY, m, p), s(f.rotate, u.rotate, m, p), o(f.skewX, u.skewX, m, p), c(f.scaleX, f.scaleY, u.scaleX, u.scaleY, m, p), f = u = null, function(_) {
for (var E = -1, z = p.length, I; ++E < z; ) m[(I = p[E]).i] = I.x(_);
return m.join("");
};
};
}
var Oc = es(Mc, "px, ", "px)", "deg)"), Cc = es(Lc, ", ", ")", ")"), Ce = 0, Ue = 0, He = 0, ns = 1e3, In, Ze, Dn = 0, ke = 0, Pn = 0, Je = typeof performance == "object" && performance.now ? performance : Date, is = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(t) {
setTimeout(t, 17);
};
function Zi() {
return ke || (is(Fc), ke = Je.now() + Pn);
}
function Fc() {
ke = 0;
}
function Rn() {
this._call = this._time = this._next = null;
}
Rn.prototype = rs.prototype = {
constructor: Rn,
restart: function(t, e, n) {
if (typeof t != "function") throw new TypeError("callback is not a function");
n = (n == null ? Zi() : +n) + (e == null ? 0 : +e), !this._next && Ze !== this && (Ze ? Ze._next = this : In = this, Ze = this), this._call = t, this._time = n, xi();
},
stop: function() {
this._call && (this._call = null, this._time = 1 / 0, xi());
}
};
function rs(t, e, n) {
var i = new Rn();
return i.restart(t, e, n), i;
}
function zc() {
Zi(), ++Ce;
for (var t = In, e; t; )
(e = ke - t._time) >= 0 && t._call.call(void 0, e), t = t._next;
--Ce;
}
function yr() {
ke = (Dn = Je.now()) + Pn, Ce = Ue = 0;
try {
zc();
} finally {
Ce = 0, Hc(), ke = 0;
}
}
function Bc() {
var t = Je.now(), e = t - Dn;
e > ns && (Pn -= e, Dn = t);
}
function Hc() {
for (var t, e = In, n, i = 1 / 0; e; )
e._call ? (i > e._time && (i = e._time), t = e, e = e._next) : (n = e._next, e._next = null, e = t ? t._next = n : In = n);
Ze = t, xi(i);
}
function xi(t) {
if (!Ce) {
Ue && (Ue = clearTimeout(Ue));
var e = t - ke;
e > 24 ? (t < 1 / 0 && (Ue = setTimeout(yr, t - Je.now() - Pn)), He && (He = clearInterval(He))) : (He || (Dn = Je.now(), He = setInterval(Bc, ns)), Ce = 1, is(yr));
}
}
function br(t, e, n) {
var i = new Rn();
return e = e == null ? 0 : +e, i.restart((r) => {
i.stop(), t(r + e);
}, e, n), i;
}
var Pc = Fa("start", "end", "cancel", "interrupt"), Vc = [], as = 0, xr = 1, ki = 2, bn = 3, kr = 4, Ti = 5, xn = 6;
function Vn(t, e, n, i, r, a) {
var s = t.__transition;
if (!s) t.__transition = {};
else if (n in s) return;
Uc(t, n, {
name: e,
index: i,
// For context during callback.
group: r,
// For context during callback.
on: Pc,
tween: Vc,
time: a.time,
delay: a.delay,
duration: a.duration,
ease: a.ease,
timer: null,
state: as
});
}
function qi(t, e) {
var n = te(t, e);
if (n.state > as) throw new Error("too late; already scheduled");
return n;
}
function re(t, e) {
var n = te(t, e);
if (n.state > bn) throw new Error("too late; already running");
return n;
}
function te(t, e) {
var n = t.__transition;
if (!n || !(n = n[e])) throw new Error("transition not found");
return n;
}
function Uc(t, e, n) {
var i = t.__transition, r;
i[e] = n, n.timer = rs(a, 0, n.time);
function a(f) {
n.state = xr, n.timer.restart(s, n.delay, n.time), n.delay <= f && s(f - n.delay);
}
function s(f) {
var u, m, p, _;
if (n.state !== xr) return c();
for (u in i)
if (_ = i[u], _.name === n.name) {
if (_.state === bn) return br(s);
_.state === kr ? (_.state = xn, _.timer.stop(), _.on.call("interrupt", t, t.__data__, _.index, _.group), delete i[u]) : +u < e && (_.state = xn, _.timer.stop(), _.on.call("cancel", t, t.__data__, _.index, _.group), delete i[u]);
}
if (br(function() {
n.state === bn && (n.state = kr, n.timer.restart(o, n.delay, n.time), o(f));
}), n.state = ki, n.on.call("start", t, t.__data__, n.index, n.group), n.state === ki) {
for (n.state = bn, r = new Array(p = n.tween.length), u = 0, m = -1; u < p; ++u)
(_ = n.tween[u].value.call(t, t.__data__, n.index, n.group)) && (r[++m] = _);
r.length = m + 1;
}
}
function o(f) {
for (var u = f < n.duration ? n.ease.call(null, f / n.duration) : (n.timer.restart(c), n.state = Ti, 1), m = -1, p = r.length; ++m < p; )
r[m].call(t, u);
n.state === Ti && (n.on.call("end", t, t.__data__, n.index, n.group), c());
}
function c() {
n.state = xn, n.timer.stop(), delete i[e];
for (var f in i) return;
delete t.__transition;
}
}
function Zc(t, e) {
var n = t.__transition, i, r, a = !0, s;
if (n) {
e = e == null ? null : e + "";
for (s in n) {
if ((i = n[s]).name !== e) {
a = !1;
continue;
}
r = i.state > ki && i.state < Ti, i.state = xn, i.timer.stop(), i.on.call(r ? "interrupt" : "cancel", t, t.__data__, i.index, i.group), delete n[s];
}
a && delete t.__transition;
}
}
function qc(t) {
return this.each(function() {
Zc(this, t);
});
}
function Gc(t, e) {
var n, i;
return function() {
var r = re(this, t), a = r.tween;
if (a !== n) {
i = n = a;
for (var s = 0, o = i.length; s < o; ++s)
if (i[s].name === e) {
i = i.slice(), i.splice(s, 1);
break;
}
}
r.tween = i;
};
}
function Wc(t, e, n) {
var i, r;
if (typeof n != "function") throw new Error();
return function() {
var a = re(this, t), s = a.tween;
if (s !== i) {
r = (i = s).slice();
for (var o = { name: e, value: n }, c = 0, f = r.length; c < f; ++c)
if (r[c].name === e) {
r[c] = o;
break;
}
c === f && r.push(o);
}
a.tween = r;
};
}
function Xc(t, e) {
var n = this._id;
if (t += "", arguments.length < 2) {
for (var i = te(this.node(), n).tween, r = 0, a = i.length, s; r < a; ++r)
if ((s = i[r]).name === t)
return s.value;
return null;
}
return this.each((e == null ? Gc : Wc)(n, t, e));
}
function Gi(t, e, n) {
var i = t._id;
return t.each(function() {
var r = re(this, i);
(r.value || (r.value = {}))[e] = n.apply(this, arguments);
}), function(r) {
return te(r, i).value[e];
};
}
function ss(t, e) {
var n;
return (typeof e == "number" ? Qt : e instanceof xe ? Nn : (n = xe(e)) ? (e = n, Nn) : ja)(t, e);
}
function Yc(t) {
return function() {
this.removeAttribute(t);
};
}
function Kc(t) {
return function() {
this.removeAttributeNS(t.space, t.local);
};
}
function Jc(t, e, n) {
var i, r = n + "", a;
return function() {
var s = this.getAttribute(t);
return s === r ? null : s === i ? a : a = e(i = s, n);
};
}
function Qc(t, e, n) {
var i, r = n + "", a;
return function() {
var s = this.getAttributeNS(t.space, t.local);
return s === r ? null : s === i ? a : a = e(i = s, n);
};
}
function jc(t, e, n) {
var i, r, a;
return function() {
var s, o = n(this), c;
return o == null ? void this.removeAttribute(t) : (s = this.getAttribute(t), c = o + "", s === c ? null : s === i && c === r ? a : (r = c, a = e(i = s, o)));
};
}
function tf(t, e, n) {
var i, r, a;
return function() {
var s, o = n(this), c;
return o == null ? void this.removeAttributeNS(t.space, t.local) : (s = this.getAttributeNS(t.space, t.local), c = o + "", s === c ? null : s === i && c === r ? a : (r = c, a = e(i = s, o)));
};
}
function ef(t, e) {
var n = Hn(t), i = n === "transform" ? Cc : ss;
return this.attrTween(t, typeof e == "function" ? (n.local ? tf : jc)(n, i, Gi(this, "attr." + t, e)) : e == null ? (n.local ? Kc : Yc)(n) : (n.local ? Qc : Jc)(n, i, e));
}
function nf(t, e) {
return function(n) {
this.setAttribute(t, e.call(this, n));
};
}
function rf(t, e) {
return function(n) {
this.setAttributeNS(t.space, t.local, e.call(this, n));
};
}
function af(t, e) {
var n, i;
function r() {
var a = e.apply(this, arguments);
return a !== i && (n = (i = a) && rf(t, a)), n;
}
return r._value = e, r;
}
function sf(t, e) {
var n, i;
function r() {
var a = e.apply(this, arguments);
return a !== i && (n = (i = a) && nf(t, a)), n;
}
return r._value = e, r;
}
function of(t, e) {
var n = "attr." + t;
if (arguments.length < 2) return (n = this.tween(n)) && n._value;
if (e == null) return this.tween(n, null);
if (typeof e != "function") throw new Error();
var i = Hn(t);
return this.tween(n, (i.local ? af : sf)(i, e));
}
function lf(t, e) {
return function() {
qi(this, t).delay = +e.apply(this, arguments);
};
}
function cf(t, e) {
return e = +e, function() {
qi(this, t).delay = e;
};
}
function ff(t) {
var e = this._id;
return arguments.length ? this.each((typeof t == "function" ? lf : cf)(e, t)) : te(this.node(), e).delay;
}
function uf(t, e) {
return function() {
re(this, t).duration = +e.apply(this, arguments);
};
}
function hf(t, e) {
return e = +e, function() {
re(this, t).duration = e;
};
}
function df(t) {
var e = this._id;
return arguments.length ? this.each((typeof t == "function" ? uf : hf)(e, t)) : te(this.node(), e).duration;
}
function pf(t, e) {
if (typeof e != "function") throw new Error();
return function() {
re(this, t).ease = e;
};
}
function _f(t) {
var e = this._id;
return arguments.length ? this.each(pf(e, t)) : te(this.node(), e).ease;
}
function gf(t, e) {
return function() {
var n = e.apply(this, arguments);
if (typeof n != "function") throw new Error();
re(this, t).ease = n;
};
}
function mf(t) {
if (typeof t != "function") throw new Error();
return this.each(gf(this._id, t));
}
function vf(t) {
typeof t != "function" && (t = Pa(t));
for (var e = this._groups, n = e.length, i = new Array(n), r = 0; r < n; ++r)
for (var a = e[r], s = a.length, o = i[r] = [], c, f = 0; f < s; ++f)
(c = a[f]) && t.call(c, c.__data__, f, a) && o.push(c);
return new fe(i, this._parents, this._name, this._id);
}
function wf(t) {
if (t._id !== this._id) throw new Error();
for (var e = this._groups, n = t._groups, i = e.length, r = n.length, a = Math.min(i, r), s = new Array(i), o = 0; o < a; ++o)
for (var c = e[o], f = n[o], u = c.length, m = s[o] = new Array(u), p, _ = 0; _ < u; ++_)
(p = c[_] || f[_]) && (m[_] = p);
for (; o < i; ++o)
s[o] = e[o];
return new fe(s, this._parents, this._name, this._id);
}
function yf(t) {
return (t + "").trim().split(/^|\s+/).every(function(e) {
var n = e.indexOf(".");
return n >= 0 && (e = e.slice(0, n)), !e || e === "start";
});
}
function bf(t, e, n) {
var i, r, a = yf(e) ? qi : re;
return function() {
var s = a(this, t), o = s.on;
o !== i && (r = (i = o).copy()).on(e, n), s.on = r;
};
}
function xf(t, e) {
var n = this._id;
return arguments.length < 2 ? te(this.node(), n).on.on(t) : this.each(bf(n, t, e));
}
function kf(t) {
return function() {
var e = this.parentNode;
for (var n in this.__transition) if (+n !== t) return;
e && e.removeChild(this);
};
}
function Tf() {
return this.on("end.remove", kf(this._id));
}
function Ef(t) {
var e = this._name, n = this._id;
typeof t != "function" && (t = zi(t));
for (var i = this._groups, r = i.length, a = new Array(r), s = 0; s < r; ++s)
for (var o = i[s], c = o.length, f = a[s] = new Array(c), u, m, p = 0; p < c; ++p)
(u = o[p]) && (m = t.call(u, u.__data__, p, o)) && ("__data__" in u && (m.__data__ = u.__data__), f[p] = m, Vn(f[p], e, n, p, f, te(u, n)));
return new fe(a, this._parents, e, n);
}
function Sf(t) {
var e = this._name, n = thi